@oxyhq/services 5.16.44 → 5.17.1

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 (512) hide show
  1. package/README.md +29 -10
  2. package/lib/commonjs/core/OxyServices.js +1 -1
  3. package/lib/commonjs/core/index.js +20 -15
  4. package/lib/commonjs/core/index.js.map +1 -1
  5. package/lib/commonjs/core/mixins/OxyServices.auth.js +36 -53
  6. package/lib/commonjs/core/mixins/OxyServices.auth.js.map +1 -1
  7. package/lib/commonjs/core/mixins/OxyServices.user.js +10 -17
  8. package/lib/commonjs/core/mixins/OxyServices.user.js.map +1 -1
  9. package/lib/commonjs/core/services/TokenService.js +27 -13
  10. package/lib/commonjs/core/services/TokenService.js.map +1 -1
  11. package/lib/commonjs/crypto/index.js +0 -16
  12. package/lib/commonjs/crypto/index.js.map +1 -1
  13. package/lib/commonjs/crypto/keyManager.js +21 -22
  14. package/lib/commonjs/crypto/keyManager.js.map +1 -1
  15. package/lib/commonjs/crypto/polyfill.js +1 -10
  16. package/lib/commonjs/crypto/polyfill.js.map +1 -1
  17. package/lib/commonjs/crypto/signatureService.js +18 -32
  18. package/lib/commonjs/crypto/signatureService.js.map +1 -1
  19. package/lib/commonjs/index.js +13 -134
  20. package/lib/commonjs/index.js.map +1 -1
  21. package/lib/commonjs/models/interfaces.js +0 -7
  22. package/lib/commonjs/models/interfaces.js.map +1 -1
  23. package/lib/commonjs/node/index.js +1 -10
  24. package/lib/commonjs/node/index.js.map +1 -1
  25. package/lib/commonjs/ui/components/BottomSheetRouter.js +1 -9
  26. package/lib/commonjs/ui/components/BottomSheetRouter.js.map +1 -1
  27. package/lib/commonjs/ui/components/OxyProvider.js +9 -20
  28. package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
  29. package/lib/commonjs/ui/context/OxyContext.js +779 -450
  30. package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
  31. package/lib/commonjs/ui/context/hooks/useAuthOperations.js +551 -0
  32. package/lib/commonjs/ui/context/hooks/useAuthOperations.js.map +1 -0
  33. package/lib/commonjs/ui/context/hooks/useDeviceManagement.js +73 -0
  34. package/lib/commonjs/ui/context/hooks/useDeviceManagement.js.map +1 -0
  35. package/lib/commonjs/ui/context/hooks/useStorage.js +79 -0
  36. package/lib/commonjs/ui/context/hooks/useStorage.js.map +1 -0
  37. package/lib/commonjs/ui/hooks/index.js +0 -20
  38. package/lib/commonjs/ui/hooks/index.js.map +1 -1
  39. package/lib/commonjs/ui/hooks/mutations/index.js +0 -12
  40. package/lib/commonjs/ui/hooks/mutations/index.js.map +1 -1
  41. package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js +23 -74
  42. package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js.map +1 -1
  43. package/lib/commonjs/ui/hooks/queries/index.js +0 -12
  44. package/lib/commonjs/ui/hooks/queries/index.js.map +1 -1
  45. package/lib/commonjs/ui/hooks/queries/queryKeys.js +1 -3
  46. package/lib/commonjs/ui/hooks/queries/queryKeys.js.map +1 -1
  47. package/lib/commonjs/ui/hooks/queries/useAccountQueries.js +28 -64
  48. package/lib/commonjs/ui/hooks/queries/useAccountQueries.js.map +1 -1
  49. package/lib/commonjs/ui/hooks/queries/useServicesQueries.js +6 -4
  50. package/lib/commonjs/ui/hooks/queries/useServicesQueries.js.map +1 -1
  51. package/lib/commonjs/ui/hooks/useDeviceManagement.js +73 -0
  52. package/lib/commonjs/ui/hooks/useDeviceManagement.js.map +1 -0
  53. package/lib/commonjs/ui/hooks/useProfileEditing.js +5 -3
  54. package/lib/commonjs/ui/hooks/useProfileEditing.js.map +1 -1
  55. package/lib/commonjs/ui/hooks/useSessionManagement.js +284 -0
  56. package/lib/commonjs/ui/hooks/useSessionManagement.js.map +1 -0
  57. package/lib/commonjs/ui/index.js +2 -10
  58. package/lib/commonjs/ui/index.js.map +1 -1
  59. package/lib/commonjs/ui/navigation/routes.js +1 -5
  60. package/lib/commonjs/ui/navigation/routes.js.map +1 -1
  61. package/lib/commonjs/ui/screens/AccountCenterScreen.js +4 -9
  62. package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +1 -1
  63. package/lib/commonjs/ui/screens/AccountSettingsScreen.js +19 -37
  64. package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
  65. package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +5 -5
  66. package/lib/commonjs/ui/screens/AccountSwitcherScreen.js.map +1 -1
  67. package/lib/commonjs/ui/screens/OxyAuthScreen.js +15 -2
  68. package/lib/commonjs/ui/screens/OxyAuthScreen.js.map +1 -1
  69. package/lib/commonjs/ui/screens/PrivacySettingsScreen.js +97 -76
  70. package/lib/commonjs/ui/screens/PrivacySettingsScreen.js.map +1 -1
  71. package/lib/commonjs/ui/screens/ProfileScreen.js +6 -6
  72. package/lib/commonjs/ui/screens/ProfileScreen.js.map +1 -1
  73. package/lib/commonjs/ui/stores/authStore.js +6 -54
  74. package/lib/commonjs/ui/stores/authStore.js.map +1 -1
  75. package/lib/commonjs/ui/styles/spacing.js +2 -54
  76. package/lib/commonjs/ui/styles/spacing.js.map +1 -1
  77. package/lib/commonjs/ui/utils/avatarUtils.js +12 -9
  78. package/lib/commonjs/ui/utils/avatarUtils.js.map +1 -1
  79. package/lib/commonjs/ui/utils/sessionHelpers.js +1 -7
  80. package/lib/commonjs/ui/utils/sessionHelpers.js.map +1 -1
  81. package/lib/commonjs/utils/deviceManager.js +177 -0
  82. package/lib/commonjs/utils/deviceManager.js.map +1 -0
  83. package/lib/commonjs/utils/errorUtils.js +0 -13
  84. package/lib/commonjs/utils/errorUtils.js.map +1 -1
  85. package/lib/commonjs/utils/index.js +7 -0
  86. package/lib/commonjs/utils/index.js.map +1 -1
  87. package/lib/commonjs/utils/sessionUtils.js +1 -8
  88. package/lib/commonjs/utils/sessionUtils.js.map +1 -1
  89. package/lib/commonjs/utils/validationUtils.js +1 -15
  90. package/lib/commonjs/utils/validationUtils.js.map +1 -1
  91. package/lib/module/core/OxyServices.js +1 -1
  92. package/lib/module/core/index.js +4 -6
  93. package/lib/module/core/index.js.map +1 -1
  94. package/lib/module/core/mixins/OxyServices.auth.js +36 -53
  95. package/lib/module/core/mixins/OxyServices.auth.js.map +1 -1
  96. package/lib/module/core/mixins/OxyServices.user.js +10 -17
  97. package/lib/module/core/mixins/OxyServices.user.js.map +1 -1
  98. package/lib/module/core/services/TokenService.js +27 -13
  99. package/lib/module/core/services/TokenService.js.map +1 -1
  100. package/lib/module/crypto/index.js +0 -3
  101. package/lib/module/crypto/index.js.map +1 -1
  102. package/lib/module/crypto/keyManager.js +21 -22
  103. package/lib/module/crypto/keyManager.js.map +1 -1
  104. package/lib/module/crypto/polyfill.js +1 -2
  105. package/lib/module/crypto/polyfill.js.map +1 -1
  106. package/lib/module/crypto/signatureService.js +18 -32
  107. package/lib/module/crypto/signatureService.js.map +1 -1
  108. package/lib/module/index.js +7 -19
  109. package/lib/module/index.js.map +1 -1
  110. package/lib/module/models/interfaces.js +0 -7
  111. package/lib/module/models/interfaces.js.map +1 -1
  112. package/lib/module/node/index.js +0 -3
  113. package/lib/module/node/index.js.map +1 -1
  114. package/lib/module/ui/components/BottomSheetRouter.js +2 -6
  115. package/lib/module/ui/components/BottomSheetRouter.js.map +1 -1
  116. package/lib/module/ui/components/OxyProvider.js +9 -20
  117. package/lib/module/ui/components/OxyProvider.js.map +1 -1
  118. package/lib/module/ui/context/OxyContext.js +779 -450
  119. package/lib/module/ui/context/OxyContext.js.map +1 -1
  120. package/lib/module/ui/context/hooks/useAuthOperations.js +545 -0
  121. package/lib/module/ui/context/hooks/useAuthOperations.js.map +1 -0
  122. package/lib/module/ui/context/hooks/useDeviceManagement.js +68 -0
  123. package/lib/module/ui/context/hooks/useDeviceManagement.js.map +1 -0
  124. package/lib/module/ui/context/hooks/useStorage.js +74 -0
  125. package/lib/module/ui/context/hooks/useStorage.js.map +1 -0
  126. package/lib/module/ui/hooks/index.js +0 -1
  127. package/lib/module/ui/hooks/index.js.map +1 -1
  128. package/lib/module/ui/hooks/mutations/index.js +1 -1
  129. package/lib/module/ui/hooks/mutations/index.js.map +1 -1
  130. package/lib/module/ui/hooks/mutations/useAccountMutations.js +21 -71
  131. package/lib/module/ui/hooks/mutations/useAccountMutations.js.map +1 -1
  132. package/lib/module/ui/hooks/queries/index.js +1 -1
  133. package/lib/module/ui/hooks/queries/index.js.map +1 -1
  134. package/lib/module/ui/hooks/queries/queryKeys.js +1 -3
  135. package/lib/module/ui/hooks/queries/queryKeys.js.map +1 -1
  136. package/lib/module/ui/hooks/queries/useAccountQueries.js +27 -61
  137. package/lib/module/ui/hooks/queries/useAccountQueries.js.map +1 -1
  138. package/lib/module/ui/hooks/queries/useServicesQueries.js +6 -4
  139. package/lib/module/ui/hooks/queries/useServicesQueries.js.map +1 -1
  140. package/lib/module/ui/hooks/useDeviceManagement.js +68 -0
  141. package/lib/module/ui/hooks/useDeviceManagement.js.map +1 -0
  142. package/lib/module/ui/hooks/useProfileEditing.js +5 -3
  143. package/lib/module/ui/hooks/useProfileEditing.js.map +1 -1
  144. package/lib/module/ui/hooks/useSessionManagement.js +279 -0
  145. package/lib/module/ui/hooks/useSessionManagement.js.map +1 -0
  146. package/lib/module/ui/index.js +1 -2
  147. package/lib/module/ui/index.js.map +1 -1
  148. package/lib/module/ui/navigation/routes.js +1 -5
  149. package/lib/module/ui/navigation/routes.js.map +1 -1
  150. package/lib/module/ui/screens/AccountCenterScreen.js +4 -9
  151. package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -1
  152. package/lib/module/ui/screens/AccountSettingsScreen.js +19 -37
  153. package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
  154. package/lib/module/ui/screens/AccountSwitcherScreen.js +5 -5
  155. package/lib/module/ui/screens/AccountSwitcherScreen.js.map +1 -1
  156. package/lib/module/ui/screens/OxyAuthScreen.js +15 -2
  157. package/lib/module/ui/screens/OxyAuthScreen.js.map +1 -1
  158. package/lib/module/ui/screens/PrivacySettingsScreen.js +98 -77
  159. package/lib/module/ui/screens/PrivacySettingsScreen.js.map +1 -1
  160. package/lib/module/ui/screens/ProfileScreen.js +6 -6
  161. package/lib/module/ui/screens/ProfileScreen.js.map +1 -1
  162. package/lib/module/ui/stores/authStore.js +6 -54
  163. package/lib/module/ui/stores/authStore.js.map +1 -1
  164. package/lib/module/ui/styles/spacing.js +2 -6
  165. package/lib/module/ui/styles/spacing.js.map +1 -1
  166. package/lib/module/ui/utils/avatarUtils.js +12 -9
  167. package/lib/module/ui/utils/avatarUtils.js.map +1 -1
  168. package/lib/module/ui/utils/sessionHelpers.js +1 -7
  169. package/lib/module/ui/utils/sessionHelpers.js.map +1 -1
  170. package/lib/module/utils/deviceManager.js +171 -0
  171. package/lib/module/utils/deviceManager.js.map +1 -0
  172. package/lib/module/utils/errorUtils.js +0 -7
  173. package/lib/module/utils/errorUtils.js.map +1 -1
  174. package/lib/module/utils/index.js +1 -2
  175. package/lib/module/utils/index.js.map +1 -1
  176. package/lib/module/utils/sessionUtils.js +1 -8
  177. package/lib/module/utils/sessionUtils.js.map +1 -1
  178. package/lib/module/utils/validationUtils.js +0 -13
  179. package/lib/module/utils/validationUtils.js.map +1 -1
  180. package/lib/typescript/core/OxyServices.d.ts +1 -1
  181. package/lib/typescript/core/index.d.ts +3 -3
  182. package/lib/typescript/core/index.d.ts.map +1 -1
  183. package/lib/typescript/core/mixins/OxyServices.auth.d.ts +21 -44
  184. package/lib/typescript/core/mixins/OxyServices.auth.d.ts.map +1 -1
  185. package/lib/typescript/core/mixins/OxyServices.user.d.ts +1 -0
  186. package/lib/typescript/core/mixins/OxyServices.user.d.ts.map +1 -1
  187. package/lib/typescript/core/mixins/index.d.ts +8 -15
  188. package/lib/typescript/core/mixins/index.d.ts.map +1 -1
  189. package/lib/typescript/core/services/TokenService.d.ts.map +1 -1
  190. package/lib/typescript/crypto/index.d.ts +0 -1
  191. package/lib/typescript/crypto/index.d.ts.map +1 -1
  192. package/lib/typescript/crypto/keyManager.d.ts +2 -15
  193. package/lib/typescript/crypto/keyManager.d.ts.map +1 -1
  194. package/lib/typescript/crypto/polyfill.d.ts +1 -2
  195. package/lib/typescript/crypto/polyfill.d.ts.map +1 -1
  196. package/lib/typescript/crypto/signatureService.d.ts +0 -13
  197. package/lib/typescript/crypto/signatureService.d.ts.map +1 -1
  198. package/lib/typescript/index.d.ts +7 -12
  199. package/lib/typescript/index.d.ts.map +1 -1
  200. package/lib/typescript/models/interfaces.d.ts +36 -5
  201. package/lib/typescript/models/interfaces.d.ts.map +1 -1
  202. package/lib/typescript/models/session.d.ts +18 -3
  203. package/lib/typescript/models/session.d.ts.map +1 -1
  204. package/lib/typescript/node/index.d.ts +0 -1
  205. package/lib/typescript/node/index.d.ts.map +1 -1
  206. package/lib/typescript/ui/components/BottomSheetRouter.d.ts +0 -5
  207. package/lib/typescript/ui/components/BottomSheetRouter.d.ts.map +1 -1
  208. package/lib/typescript/ui/components/OxyProvider.d.ts.map +1 -1
  209. package/lib/typescript/ui/components/TextField/Addons/Outline.d.ts +2 -2
  210. package/lib/typescript/ui/components/TextField/helpers.d.ts +2 -2
  211. package/lib/typescript/ui/components/TextField/types.d.ts +0 -1
  212. package/lib/typescript/ui/components/TextField/types.d.ts.map +1 -1
  213. package/lib/typescript/ui/context/OxyContext.d.ts +28 -5
  214. package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -1
  215. package/lib/typescript/ui/context/hooks/useAuthOperations.d.ts +59 -0
  216. package/lib/typescript/ui/context/hooks/useAuthOperations.d.ts.map +1 -0
  217. package/lib/typescript/ui/context/hooks/useDeviceManagement.d.ts +27 -0
  218. package/lib/typescript/ui/context/hooks/useDeviceManagement.d.ts.map +1 -0
  219. package/lib/typescript/ui/context/hooks/useStorage.d.ts +22 -0
  220. package/lib/typescript/ui/context/hooks/useStorage.d.ts.map +1 -0
  221. package/lib/typescript/ui/hooks/index.d.ts +0 -1
  222. package/lib/typescript/ui/hooks/index.d.ts.map +1 -1
  223. package/lib/typescript/ui/hooks/mutations/index.d.ts +1 -1
  224. package/lib/typescript/ui/hooks/mutations/index.d.ts.map +1 -1
  225. package/lib/typescript/ui/hooks/mutations/useAccountMutations.d.ts +8 -19
  226. package/lib/typescript/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
  227. package/lib/typescript/ui/hooks/mutations/useServicesMutations.d.ts +1 -1
  228. package/lib/typescript/ui/hooks/mutations/useServicesMutations.d.ts.map +1 -1
  229. package/lib/typescript/ui/hooks/queries/index.d.ts +1 -1
  230. package/lib/typescript/ui/hooks/queries/index.d.ts.map +1 -1
  231. package/lib/typescript/ui/hooks/queries/queryKeys.d.ts +0 -2
  232. package/lib/typescript/ui/hooks/queries/queryKeys.d.ts.map +1 -1
  233. package/lib/typescript/ui/hooks/queries/useAccountQueries.d.ts +5 -17
  234. package/lib/typescript/ui/hooks/queries/useAccountQueries.d.ts.map +1 -1
  235. package/lib/typescript/ui/hooks/queries/useServicesQueries.d.ts.map +1 -1
  236. package/lib/typescript/ui/hooks/useDeviceManagement.d.ts +27 -0
  237. package/lib/typescript/ui/hooks/useDeviceManagement.d.ts.map +1 -0
  238. package/lib/typescript/ui/hooks/useProfileEditing.d.ts.map +1 -1
  239. package/lib/typescript/ui/hooks/useSessionManagement.d.ts +41 -0
  240. package/lib/typescript/ui/hooks/useSessionManagement.d.ts.map +1 -0
  241. package/lib/typescript/ui/index.d.ts +0 -1
  242. package/lib/typescript/ui/index.d.ts.map +1 -1
  243. package/lib/typescript/ui/navigation/routes.d.ts +1 -1
  244. package/lib/typescript/ui/navigation/routes.d.ts.map +1 -1
  245. package/lib/typescript/ui/screens/AccountCenterScreen.d.ts.map +1 -1
  246. package/lib/typescript/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
  247. package/lib/typescript/ui/screens/OxyAuthScreen.d.ts.map +1 -1
  248. package/lib/typescript/ui/screens/PrivacySettingsScreen.d.ts.map +1 -1
  249. package/lib/typescript/ui/stores/authStore.d.ts +1 -8
  250. package/lib/typescript/ui/stores/authStore.d.ts.map +1 -1
  251. package/lib/typescript/ui/styles/spacing.d.ts +0 -5
  252. package/lib/typescript/ui/styles/spacing.d.ts.map +1 -1
  253. package/lib/typescript/ui/utils/avatarUtils.d.ts +4 -1
  254. package/lib/typescript/ui/utils/avatarUtils.d.ts.map +1 -1
  255. package/lib/typescript/ui/utils/sessionHelpers.d.ts +0 -1
  256. package/lib/typescript/ui/utils/sessionHelpers.d.ts.map +1 -1
  257. package/lib/typescript/utils/deviceManager.d.ts +66 -0
  258. package/lib/typescript/utils/deviceManager.d.ts.map +1 -0
  259. package/lib/typescript/utils/errorUtils.d.ts +0 -6
  260. package/lib/typescript/utils/errorUtils.d.ts.map +1 -1
  261. package/lib/typescript/utils/index.d.ts +2 -0
  262. package/lib/typescript/utils/index.d.ts.map +1 -1
  263. package/lib/typescript/utils/sessionUtils.d.ts.map +1 -1
  264. package/lib/typescript/utils/validationUtils.d.ts +0 -8
  265. package/lib/typescript/utils/validationUtils.d.ts.map +1 -1
  266. package/package.json +1 -6
  267. package/src/core/OxyServices.ts +1 -1
  268. package/src/core/index.ts +5 -8
  269. package/src/core/mixins/OxyServices.auth.ts +44 -87
  270. package/src/core/mixins/OxyServices.user.ts +10 -18
  271. package/src/core/services/TokenService.ts +27 -16
  272. package/src/crypto/index.ts +1 -3
  273. package/src/crypto/keyManager.ts +21 -30
  274. package/src/crypto/polyfill.ts +1 -2
  275. package/src/crypto/signatureService.ts +19 -43
  276. package/src/index.ts +6 -41
  277. package/src/models/interfaces.ts +39 -12
  278. package/src/models/session.ts +19 -7
  279. package/src/node/index.ts +0 -3
  280. package/src/ui/components/BottomSheetRouter.tsx +1 -6
  281. package/src/ui/components/OxyProvider.tsx +10 -17
  282. package/src/ui/components/TextField/Addons/Outline.tsx +2 -2
  283. package/src/ui/components/TextField/helpers.tsx +2 -2
  284. package/src/ui/components/TextField/types.tsx +1 -1
  285. package/src/ui/context/OxyContext.tsx +831 -463
  286. package/src/ui/context/hooks/useAuthOperations.ts +620 -0
  287. package/src/ui/context/hooks/useDeviceManagement.ts +108 -0
  288. package/src/ui/context/hooks/useStorage.ts +104 -0
  289. package/src/ui/hooks/index.ts +1 -2
  290. package/src/ui/hooks/mutations/index.ts +0 -2
  291. package/src/ui/hooks/mutations/useAccountMutations.ts +20 -66
  292. package/src/ui/hooks/queries/index.ts +0 -2
  293. package/src/ui/hooks/queries/queryKeys.ts +0 -2
  294. package/src/ui/hooks/queries/useAccountQueries.ts +19 -53
  295. package/src/ui/hooks/queries/useServicesQueries.ts +5 -5
  296. package/src/ui/hooks/useDeviceManagement.ts +108 -0
  297. package/src/ui/hooks/useProfileEditing.ts +3 -3
  298. package/src/ui/hooks/useSessionManagement.ts +405 -0
  299. package/src/ui/index.ts +1 -2
  300. package/src/ui/navigation/routes.ts +2 -6
  301. package/src/ui/screens/AccountCenterScreen.tsx +4 -9
  302. package/src/ui/screens/AccountSettingsScreen.tsx +31 -49
  303. package/src/ui/screens/AccountSwitcherScreen.tsx +5 -5
  304. package/src/ui/screens/OxyAuthScreen.tsx +19 -4
  305. package/src/ui/screens/PrivacySettingsScreen.tsx +101 -67
  306. package/src/ui/screens/ProfileScreen.tsx +10 -10
  307. package/src/ui/stores/authStore.ts +8 -48
  308. package/src/ui/styles/spacing.ts +2 -15
  309. package/src/ui/utils/avatarUtils.ts +21 -19
  310. package/src/ui/utils/sessionHelpers.ts +0 -7
  311. package/src/utils/__tests__/validationUtils.test.ts +1 -16
  312. package/src/utils/deviceManager.ts +198 -0
  313. package/src/utils/errorUtils.ts +1 -8
  314. package/src/utils/index.ts +2 -1
  315. package/src/utils/sessionUtils.ts +0 -8
  316. package/src/utils/validationUtils.ts +0 -12
  317. package/lib/commonjs/adapters/expo/crypto.js +0 -56
  318. package/lib/commonjs/adapters/expo/crypto.js.map +0 -1
  319. package/lib/commonjs/adapters/expo/fetch.js +0 -30
  320. package/lib/commonjs/adapters/expo/fetch.js.map +0 -1
  321. package/lib/commonjs/adapters/expo/index.js +0 -48
  322. package/lib/commonjs/adapters/expo/index.js.map +0 -1
  323. package/lib/commonjs/adapters/expo/storage.js +0 -201
  324. package/lib/commonjs/adapters/expo/storage.js.map +0 -1
  325. package/lib/commonjs/adapters/index.js +0 -48
  326. package/lib/commonjs/adapters/index.js.map +0 -1
  327. package/lib/commonjs/adapters/node/crypto.js +0 -40
  328. package/lib/commonjs/adapters/node/crypto.js.map +0 -1
  329. package/lib/commonjs/adapters/node/fetch.js +0 -62
  330. package/lib/commonjs/adapters/node/fetch.js.map +0 -1
  331. package/lib/commonjs/adapters/node/index.js +0 -34
  332. package/lib/commonjs/adapters/node/index.js.map +0 -1
  333. package/lib/commonjs/adapters/node/storage.js +0 -163
  334. package/lib/commonjs/adapters/node/storage.js.map +0 -1
  335. package/lib/commonjs/core/identity-session/DeviceManager.js +0 -237
  336. package/lib/commonjs/core/identity-session/DeviceManager.js.map +0 -1
  337. package/lib/commonjs/core/identity-session/INTEGRATION_GUIDE.md +0 -287
  338. package/lib/commonjs/core/identity-session/IdentityManager.js +0 -400
  339. package/lib/commonjs/core/identity-session/IdentityManager.js.map +0 -1
  340. package/lib/commonjs/core/identity-session/IdentitySessionCore.js +0 -394
  341. package/lib/commonjs/core/identity-session/IdentitySessionCore.js.map +0 -1
  342. package/lib/commonjs/core/identity-session/RefreshManager.js +0 -137
  343. package/lib/commonjs/core/identity-session/RefreshManager.js.map +0 -1
  344. package/lib/commonjs/core/identity-session/SessionManager.js +0 -427
  345. package/lib/commonjs/core/identity-session/SessionManager.js.map +0 -1
  346. package/lib/commonjs/core/identity-session/createIdentitySessionCore.js +0 -24
  347. package/lib/commonjs/core/identity-session/createIdentitySessionCore.js.map +0 -1
  348. package/lib/commonjs/core/identity-session/errors.js +0 -176
  349. package/lib/commonjs/core/identity-session/errors.js.map +0 -1
  350. package/lib/commonjs/core/identity-session/index.js +0 -80
  351. package/lib/commonjs/core/identity-session/index.js.map +0 -1
  352. package/lib/commonjs/core/identity-session/types.js +0 -2
  353. package/lib/commonjs/core/identity-session/types.js.map +0 -1
  354. package/lib/commonjs/crypto/README.md +0 -142
  355. package/lib/commonjs/crypto/core.js +0 -147
  356. package/lib/commonjs/crypto/core.js.map +0 -1
  357. package/lib/commonjs/node/signatureService.js +0 -107
  358. package/lib/commonjs/node/signatureService.js.map +0 -1
  359. package/lib/commonjs/ui/hooks/auth/index.js +0 -37
  360. package/lib/commonjs/ui/hooks/auth/index.js.map +0 -1
  361. package/lib/commonjs/ui/hooks/auth/useUsernameValidation.js +0 -171
  362. package/lib/commonjs/ui/hooks/auth/useUsernameValidation.js.map +0 -1
  363. package/lib/commonjs/ui/hooks/useAvatarPicker.js +0 -52
  364. package/lib/commonjs/ui/hooks/useAvatarPicker.js.map +0 -1
  365. package/lib/commonjs/ui/hooks/useIdentityTransfer.js +0 -125
  366. package/lib/commonjs/ui/hooks/useIdentityTransfer.js.map +0 -1
  367. package/lib/commonjs/ui/hooks/useTransferCodesPersistence.js +0 -81
  368. package/lib/commonjs/ui/hooks/useTransferCodesPersistence.js.map +0 -1
  369. package/lib/commonjs/ui/hooks/useTransferQueries.js +0 -85
  370. package/lib/commonjs/ui/hooks/useTransferQueries.js.map +0 -1
  371. package/lib/commonjs/ui/stores/transferStore.js +0 -157
  372. package/lib/commonjs/ui/stores/transferStore.js.map +0 -1
  373. package/lib/module/adapters/expo/crypto.js +0 -51
  374. package/lib/module/adapters/expo/crypto.js.map +0 -1
  375. package/lib/module/adapters/expo/fetch.js +0 -26
  376. package/lib/module/adapters/expo/fetch.js.map +0 -1
  377. package/lib/module/adapters/expo/index.js +0 -45
  378. package/lib/module/adapters/expo/index.js.map +0 -1
  379. package/lib/module/adapters/expo/storage.js +0 -198
  380. package/lib/module/adapters/expo/storage.js.map +0 -1
  381. package/lib/module/adapters/index.js +0 -45
  382. package/lib/module/adapters/index.js.map +0 -1
  383. package/lib/module/adapters/node/crypto.js +0 -36
  384. package/lib/module/adapters/node/crypto.js.map +0 -1
  385. package/lib/module/adapters/node/fetch.js +0 -57
  386. package/lib/module/adapters/node/fetch.js.map +0 -1
  387. package/lib/module/adapters/node/index.js +0 -31
  388. package/lib/module/adapters/node/index.js.map +0 -1
  389. package/lib/module/adapters/node/storage.js +0 -159
  390. package/lib/module/adapters/node/storage.js.map +0 -1
  391. package/lib/module/core/identity-session/DeviceManager.js +0 -232
  392. package/lib/module/core/identity-session/DeviceManager.js.map +0 -1
  393. package/lib/module/core/identity-session/INTEGRATION_GUIDE.md +0 -287
  394. package/lib/module/core/identity-session/IdentityManager.js +0 -395
  395. package/lib/module/core/identity-session/IdentityManager.js.map +0 -1
  396. package/lib/module/core/identity-session/IdentitySessionCore.js +0 -390
  397. package/lib/module/core/identity-session/IdentitySessionCore.js.map +0 -1
  398. package/lib/module/core/identity-session/RefreshManager.js +0 -132
  399. package/lib/module/core/identity-session/RefreshManager.js.map +0 -1
  400. package/lib/module/core/identity-session/SessionManager.js +0 -422
  401. package/lib/module/core/identity-session/SessionManager.js.map +0 -1
  402. package/lib/module/core/identity-session/createIdentitySessionCore.js +0 -21
  403. package/lib/module/core/identity-session/createIdentitySessionCore.js.map +0 -1
  404. package/lib/module/core/identity-session/errors.js +0 -170
  405. package/lib/module/core/identity-session/errors.js.map +0 -1
  406. package/lib/module/core/identity-session/index.js +0 -17
  407. package/lib/module/core/identity-session/index.js.map +0 -1
  408. package/lib/module/core/identity-session/types.js +0 -2
  409. package/lib/module/core/identity-session/types.js.map +0 -1
  410. package/lib/module/crypto/README.md +0 -142
  411. package/lib/module/crypto/core.js +0 -133
  412. package/lib/module/crypto/core.js.map +0 -1
  413. package/lib/module/node/signatureService.js +0 -101
  414. package/lib/module/node/signatureService.js.map +0 -1
  415. package/lib/module/ui/hooks/auth/index.js +0 -7
  416. package/lib/module/ui/hooks/auth/index.js.map +0 -1
  417. package/lib/module/ui/hooks/auth/useUsernameValidation.js +0 -167
  418. package/lib/module/ui/hooks/auth/useUsernameValidation.js.map +0 -1
  419. package/lib/module/ui/hooks/useAvatarPicker.js +0 -48
  420. package/lib/module/ui/hooks/useAvatarPicker.js.map +0 -1
  421. package/lib/module/ui/hooks/useIdentityTransfer.js +0 -121
  422. package/lib/module/ui/hooks/useIdentityTransfer.js.map +0 -1
  423. package/lib/module/ui/hooks/useTransferCodesPersistence.js +0 -77
  424. package/lib/module/ui/hooks/useTransferCodesPersistence.js.map +0 -1
  425. package/lib/module/ui/hooks/useTransferQueries.js +0 -80
  426. package/lib/module/ui/hooks/useTransferQueries.js.map +0 -1
  427. package/lib/module/ui/stores/transferStore.js +0 -152
  428. package/lib/module/ui/stores/transferStore.js.map +0 -1
  429. package/lib/typescript/adapters/expo/crypto.d.ts +0 -17
  430. package/lib/typescript/adapters/expo/crypto.d.ts.map +0 -1
  431. package/lib/typescript/adapters/expo/fetch.d.ts +0 -16
  432. package/lib/typescript/adapters/expo/fetch.d.ts.map +0 -1
  433. package/lib/typescript/adapters/expo/index.d.ts +0 -23
  434. package/lib/typescript/adapters/expo/index.d.ts.map +0 -1
  435. package/lib/typescript/adapters/expo/storage.d.ts +0 -23
  436. package/lib/typescript/adapters/expo/storage.d.ts.map +0 -1
  437. package/lib/typescript/adapters/index.d.ts +0 -17
  438. package/lib/typescript/adapters/index.d.ts.map +0 -1
  439. package/lib/typescript/adapters/node/crypto.d.ts +0 -17
  440. package/lib/typescript/adapters/node/crypto.d.ts.map +0 -1
  441. package/lib/typescript/adapters/node/fetch.d.ts +0 -16
  442. package/lib/typescript/adapters/node/fetch.d.ts.map +0 -1
  443. package/lib/typescript/adapters/node/index.d.ts +0 -23
  444. package/lib/typescript/adapters/node/index.d.ts.map +0 -1
  445. package/lib/typescript/adapters/node/storage.d.ts +0 -23
  446. package/lib/typescript/adapters/node/storage.d.ts.map +0 -1
  447. package/lib/typescript/core/identity-session/DeviceManager.d.ts +0 -64
  448. package/lib/typescript/core/identity-session/DeviceManager.d.ts.map +0 -1
  449. package/lib/typescript/core/identity-session/IdentityManager.d.ts +0 -88
  450. package/lib/typescript/core/identity-session/IdentityManager.d.ts.map +0 -1
  451. package/lib/typescript/core/identity-session/IdentitySessionCore.d.ts +0 -141
  452. package/lib/typescript/core/identity-session/IdentitySessionCore.d.ts.map +0 -1
  453. package/lib/typescript/core/identity-session/RefreshManager.d.ts +0 -36
  454. package/lib/typescript/core/identity-session/RefreshManager.d.ts.map +0 -1
  455. package/lib/typescript/core/identity-session/SessionManager.d.ts +0 -104
  456. package/lib/typescript/core/identity-session/SessionManager.d.ts.map +0 -1
  457. package/lib/typescript/core/identity-session/createIdentitySessionCore.d.ts +0 -11
  458. package/lib/typescript/core/identity-session/createIdentitySessionCore.d.ts.map +0 -1
  459. package/lib/typescript/core/identity-session/errors.d.ts +0 -63
  460. package/lib/typescript/core/identity-session/errors.d.ts.map +0 -1
  461. package/lib/typescript/core/identity-session/index.d.ts +0 -14
  462. package/lib/typescript/core/identity-session/index.d.ts.map +0 -1
  463. package/lib/typescript/core/identity-session/types.d.ts +0 -196
  464. package/lib/typescript/core/identity-session/types.d.ts.map +0 -1
  465. package/lib/typescript/crypto/core.d.ts +0 -56
  466. package/lib/typescript/crypto/core.d.ts.map +0 -1
  467. package/lib/typescript/node/signatureService.d.ts +0 -55
  468. package/lib/typescript/node/signatureService.d.ts.map +0 -1
  469. package/lib/typescript/ui/hooks/auth/index.d.ts +0 -6
  470. package/lib/typescript/ui/hooks/auth/index.d.ts.map +0 -1
  471. package/lib/typescript/ui/hooks/auth/useUsernameValidation.d.ts +0 -32
  472. package/lib/typescript/ui/hooks/auth/useUsernameValidation.d.ts.map +0 -1
  473. package/lib/typescript/ui/hooks/useAvatarPicker.d.ts +0 -18
  474. package/lib/typescript/ui/hooks/useAvatarPicker.d.ts.map +0 -1
  475. package/lib/typescript/ui/hooks/useIdentityTransfer.d.ts +0 -24
  476. package/lib/typescript/ui/hooks/useIdentityTransfer.d.ts.map +0 -1
  477. package/lib/typescript/ui/hooks/useTransferCodesPersistence.d.ts +0 -6
  478. package/lib/typescript/ui/hooks/useTransferCodesPersistence.d.ts.map +0 -1
  479. package/lib/typescript/ui/hooks/useTransferQueries.d.ts +0 -26
  480. package/lib/typescript/ui/hooks/useTransferQueries.d.ts.map +0 -1
  481. package/lib/typescript/ui/stores/transferStore.d.ts +0 -36
  482. package/lib/typescript/ui/stores/transferStore.d.ts.map +0 -1
  483. package/src/adapters/expo/crypto.ts +0 -55
  484. package/src/adapters/expo/fetch.ts +0 -28
  485. package/src/adapters/expo/index.ts +0 -51
  486. package/src/adapters/expo/storage.ts +0 -228
  487. package/src/adapters/index.ts +0 -48
  488. package/src/adapters/node/crypto.ts +0 -39
  489. package/src/adapters/node/fetch.ts +0 -59
  490. package/src/adapters/node/index.ts +0 -37
  491. package/src/adapters/node/storage.ts +0 -170
  492. package/src/core/identity-session/DeviceManager.ts +0 -273
  493. package/src/core/identity-session/INTEGRATION_GUIDE.md +0 -287
  494. package/src/core/identity-session/IdentityManager.ts +0 -474
  495. package/src/core/identity-session/IdentitySessionCore.ts +0 -464
  496. package/src/core/identity-session/RefreshManager.ts +0 -189
  497. package/src/core/identity-session/SessionManager.ts +0 -500
  498. package/src/core/identity-session/createIdentitySessionCore.ts +0 -19
  499. package/src/core/identity-session/errors.ts +0 -197
  500. package/src/core/identity-session/index.ts +0 -15
  501. package/src/core/identity-session/types.ts +0 -188
  502. package/src/crypto/README.md +0 -142
  503. package/src/crypto/__tests__/core.test.ts +0 -203
  504. package/src/crypto/core.ts +0 -142
  505. package/src/node/signatureService.ts +0 -126
  506. package/src/ui/hooks/auth/index.ts +0 -9
  507. package/src/ui/hooks/auth/useUsernameValidation.ts +0 -177
  508. package/src/ui/hooks/useAvatarPicker.ts +0 -62
  509. package/src/ui/hooks/useIdentityTransfer.ts +0 -135
  510. package/src/ui/hooks/useTransferCodesPersistence.ts +0 -80
  511. package/src/ui/hooks/useTransferQueries.ts +0 -102
  512. package/src/ui/stores/transferStore.ts +0 -201
@@ -1,171 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.USERNAME_REGEX = exports.USERNAME_MIN_LENGTH = exports.USERNAME_FORMAT_ERROR = exports.USERNAME_DEBOUNCE_MS = void 0;
7
- exports.useUsernameValidation = useUsernameValidation;
8
- var _react = require("react");
9
- var _reactQuery = require("@tanstack/react-query");
10
- var _errorUtils = require("../../../utils/errorUtils");
11
- var _hookUtils = require("../../../utils/hookUtils");
12
- /**
13
- * Username validation constants
14
- */
15
- const USERNAME_MIN_LENGTH = exports.USERNAME_MIN_LENGTH = 4;
16
- const USERNAME_REGEX = exports.USERNAME_REGEX = /^[a-z0-9]+$/i;
17
- const USERNAME_FORMAT_ERROR = exports.USERNAME_FORMAT_ERROR = 'You can use a-z, 0-9. Minimum length is 4 characters.';
18
- const USERNAME_DEBOUNCE_MS = exports.USERNAME_DEBOUNCE_MS = 500;
19
-
20
- /**
21
- * Username validation result interface
22
- */
23
-
24
- /**
25
- * Validate username format using services validation utilities
26
- */
27
- function validateUsernameFormat(username) {
28
- // Use stricter validation: lowercase alphanumeric only, min 4 chars
29
- return username.length >= USERNAME_MIN_LENGTH && USERNAME_REGEX.test(username);
30
- }
31
-
32
- /**
33
- * Check if an error is a network or timeout error
34
- */
35
- function isNetworkOrTimeoutError(error) {
36
- const apiError = (0, _errorUtils.handleHttpError)(error);
37
- return apiError.code === _errorUtils.ErrorCodes.NETWORK_ERROR || apiError.code === _errorUtils.ErrorCodes.TIMEOUT || apiError.code === _errorUtils.ErrorCodes.CONNECTION_FAILED;
38
- }
39
-
40
- /**
41
- * Extract error message from an unknown error shape
42
- */
43
- function extractAuthErrorMessage(error, fallbackMessage = 'An error occurred') {
44
- const apiError = (0, _errorUtils.handleHttpError)(error);
45
- return apiError.message || fallbackMessage;
46
- }
47
-
48
- /**
49
- * Hook for username validation with debouncing and availability checking
50
- *
51
- * Uses TanStack Query for efficient API calls with:
52
- * - Automatic request cancellation when username changes
53
- * - Built-in caching (same username checked multiple times = cached result)
54
- * - Request deduplication (multiple components checking same username = single request)
55
- * - Proper error handling
56
- *
57
- * @param username - The username to validate
58
- * @param oxyServices - OxyServices instance for API calls
59
- * @returns Username validation state and result
60
- */
61
- function useUsernameValidation(username, oxyServices) {
62
- // Debounce the username input to avoid excessive API calls
63
- const debouncedUsername = (0, _hookUtils.useDebounce)(username.trim().toLowerCase(), USERNAME_DEBOUNCE_MS);
64
-
65
- // Validate format synchronously (no API call needed)
66
- const isValid = (0, _react.useMemo)(() => validateUsernameFormat(username), [username]);
67
-
68
- // Determine if we should check availability
69
- const shouldCheckAvailability = (0, _react.useMemo)(() => {
70
- if (!debouncedUsername || debouncedUsername.length < USERNAME_MIN_LENGTH) {
71
- return false;
72
- }
73
- return validateUsernameFormat(debouncedUsername);
74
- }, [debouncedUsername]);
75
-
76
- // Use TanStack Query for the API call
77
- // This provides automatic caching, request cancellation, and deduplication
78
- const {
79
- data: availabilityResult,
80
- isLoading: isChecking,
81
- error: queryError,
82
- isFetching
83
- } = (0, _reactQuery.useQuery)({
84
- queryKey: ['username', 'availability', debouncedUsername],
85
- queryFn: async () => {
86
- if (!oxyServices) {
87
- throw new Error('OxyServices not available');
88
- }
89
- return await oxyServices.checkUsernameAvailability(debouncedUsername);
90
- },
91
- enabled: shouldCheckAvailability && !!oxyServices,
92
- staleTime: 5 * 60 * 1000,
93
- // Cache for 5 minutes (usernames don't change often)
94
- gcTime: 30 * 60 * 1000,
95
- // Keep in cache for 30 minutes
96
- retry: (failureCount, error) => {
97
- // Don't retry on network/timeout errors (user might be offline)
98
- if (isNetworkOrTimeoutError(error)) {
99
- return false;
100
- }
101
- // Retry up to 2 times for other errors
102
- return failureCount < 2;
103
- },
104
- retryDelay: attemptIndex => Math.min(1000 * 2 ** attemptIndex, 3000)
105
- });
106
-
107
- // Compute the result based on validation and query state
108
- return (0, _react.useMemo)(() => {
109
- // If username is too short or invalid format, return early validation
110
- if (!username || username.length < USERNAME_MIN_LENGTH) {
111
- return {
112
- isValid: false,
113
- isAvailable: null,
114
- error: null,
115
- isChecking: false
116
- };
117
- }
118
- if (!isValid) {
119
- return {
120
- isValid: false,
121
- isAvailable: false,
122
- error: USERNAME_FORMAT_ERROR,
123
- isChecking: false
124
- };
125
- }
126
-
127
- // If we're not checking yet (debounce period), show checking state only if user is typing
128
- const isCurrentlyChecking = isChecking || isFetching;
129
-
130
- // Handle network/timeout errors gracefully
131
- if (queryError && isNetworkOrTimeoutError(queryError)) {
132
- // Allow proceeding if offline/network issue (optimistic)
133
- return {
134
- isValid: true,
135
- isAvailable: true,
136
- // Optimistic: allow proceeding
137
- error: null,
138
- isChecking: false
139
- };
140
- }
141
-
142
- // Handle other errors
143
- if (queryError) {
144
- return {
145
- isValid: true,
146
- isAvailable: false,
147
- error: extractAuthErrorMessage(queryError, 'Failed to check username availability'),
148
- isChecking: false
149
- };
150
- }
151
-
152
- // If we have a result, use it
153
- if (availabilityResult) {
154
- return {
155
- isValid: true,
156
- isAvailable: availabilityResult.available,
157
- error: availabilityResult.available ? null : availabilityResult.message || 'Username is already taken',
158
- isChecking: false
159
- };
160
- }
161
-
162
- // Still checking (or waiting for debounce)
163
- return {
164
- isValid: true,
165
- isAvailable: null,
166
- error: null,
167
- isChecking: isCurrentlyChecking
168
- };
169
- }, [username, isValid, availabilityResult, isChecking, isFetching, queryError]);
170
- }
171
- //# sourceMappingURL=useUsernameValidation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_react","require","_reactQuery","_errorUtils","_hookUtils","USERNAME_MIN_LENGTH","exports","USERNAME_REGEX","USERNAME_FORMAT_ERROR","USERNAME_DEBOUNCE_MS","validateUsernameFormat","username","length","test","isNetworkOrTimeoutError","error","apiError","handleHttpError","code","ErrorCodes","NETWORK_ERROR","TIMEOUT","CONNECTION_FAILED","extractAuthErrorMessage","fallbackMessage","message","useUsernameValidation","oxyServices","debouncedUsername","useDebounce","trim","toLowerCase","isValid","useMemo","shouldCheckAvailability","data","availabilityResult","isLoading","isChecking","queryError","isFetching","useQuery","queryKey","queryFn","Error","checkUsernameAvailability","enabled","staleTime","gcTime","retry","failureCount","retryDelay","attemptIndex","Math","min","isAvailable","isCurrentlyChecking","available"],"sourceRoot":"../../../../../src","sources":["ui/hooks/auth/useUsernameValidation.ts"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAEA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAEA;AACA;AACA;AACO,MAAMI,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAG,CAAC;AAC7B,MAAME,cAAc,GAAAD,OAAA,CAAAC,cAAA,GAAG,cAAc;AACrC,MAAMC,qBAAqB,GAAAF,OAAA,CAAAE,qBAAA,GAAG,uDAAuD;AACrF,MAAMC,oBAAoB,GAAAH,OAAA,CAAAG,oBAAA,GAAG,GAAG;;AAEvC;AACA;AACA;;AAQA;AACA;AACA;AACA,SAASC,sBAAsBA,CAACC,QAAgB,EAAW;EACzD;EACA,OAAOA,QAAQ,CAACC,MAAM,IAAIP,mBAAmB,IAAIE,cAAc,CAACM,IAAI,CAACF,QAAQ,CAAC;AAChF;;AAEA;AACA;AACA;AACA,SAASG,uBAAuBA,CAACC,KAAc,EAAW;EACxD,MAAMC,QAAQ,GAAG,IAAAC,2BAAe,EAACF,KAAK,CAAC;EACvC,OACEC,QAAQ,CAACE,IAAI,KAAKC,sBAAU,CAACC,aAAa,IAC1CJ,QAAQ,CAACE,IAAI,KAAKC,sBAAU,CAACE,OAAO,IACpCL,QAAQ,CAACE,IAAI,KAAKC,sBAAU,CAACG,iBAAiB;AAElD;;AAEA;AACA;AACA;AACA,SAASC,uBAAuBA,CAACR,KAAc,EAAES,eAAe,GAAG,mBAAmB,EAAU;EAC9F,MAAMR,QAAQ,GAAG,IAAAC,2BAAe,EAACF,KAAK,CAAC;EACvC,OAAOC,QAAQ,CAACS,OAAO,IAAID,eAAe;AAC5C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,qBAAqBA,CACn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IAAI,2BAA4B;QACxGa,UAAU,EAAE;MACd,CAAC;IACH;;IAEA;IACA,OAAO;MACLN,OAAO,EAAE,IAAI;MACbuB,WAAW,EAAE,IAAI;MACjBxC,KAAK,EAAE,IAAI;MACXuB,UAAU,EAAEkB;IACd,CAAC;EACH,CAAC,EAAE,CAAC7C,QAAQ,EAAEqB,OAAO,EAAEI,kBAAkB,EAAEE,UAAU,EAAEE,UAAU,EAAED,UAAU,CAAC,CAAC;AACjF","ignoreList":[]}
@@ -1,52 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useAvatarPicker = useAvatarPicker;
7
- var _react = require("react");
8
- var _sonner = require("../../lib/sonner");
9
- var _i18n = require("../../i18n");
10
- var _bottomSheetManager = require("../navigation/bottomSheetManager");
11
- var _avatarUtils = require("../utils/avatarUtils");
12
- /**
13
- * Hook to handle avatar picker functionality
14
- */
15
- function useAvatarPicker({
16
- oxyServices,
17
- currentLanguage,
18
- activeSessionId,
19
- queryClient,
20
- syncIdentity
21
- }) {
22
- const openAvatarPicker = (0, _react.useCallback)(() => {
23
- (0, _bottomSheetManager.showBottomSheet)({
24
- screen: 'FileManagement',
25
- props: {
26
- selectMode: true,
27
- multiSelect: false,
28
- disabledMimeTypes: ['video/', 'audio/', 'application/pdf'],
29
- afterSelect: 'none',
30
- onSelect: async file => {
31
- if (!file.contentType.startsWith('image/')) {
32
- _sonner.toast.error((0, _i18n.translate)(currentLanguage, 'editProfile.toasts.selectImage') || 'Please select an image file');
33
- return;
34
- }
35
- try {
36
- await (0, _avatarUtils.updateAvatarVisibility)(file.id, oxyServices, 'useAvatarPicker');
37
- await (0, _avatarUtils.updateProfileWithAvatar)({
38
- avatar: file.id
39
- }, oxyServices, activeSessionId, queryClient, () => syncIdentity());
40
- _sonner.toast.success((0, _i18n.translate)(currentLanguage, 'editProfile.toasts.avatarUpdated') || 'Avatar updated');
41
- } catch (e) {
42
- _sonner.toast.error(e.message || (0, _i18n.translate)(currentLanguage, 'editProfile.toasts.updateAvatarFailed') || 'Failed to update avatar');
43
- }
44
- }
45
- }
46
- });
47
- }, [oxyServices, currentLanguage, activeSessionId, queryClient, syncIdentity]);
48
- return {
49
- openAvatarPicker
50
- };
51
- }
52
- //# sourceMappingURL=useAvatarPicker.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_react","require","_sonner","_i18n","_bottomSheetManager","_avatarUtils","useAvatarPicker","oxyServices","currentLanguage","activeSessionId","queryClient","syncIdentity","openAvatarPicker","useCallback","globalShowBottomSheet","screen","props","selectMode","multiSelect","disabledMimeTypes","afterSelect","onSelect","file","contentType","startsWith","toast","error","translate","updateAvatarVisibility","id","updateProfileWithAvatar","avatar","success","e","message"],"sourceRoot":"../../../../src","sources":["ui/hooks/useAvatarPicker.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAEA,IAAAG,mBAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAYA;AACA;AACA;AACO,SAASK,eAAeA,CAAC;EAC9BC,WAAW;EACXC,eAAe;EACfC,eAAe;EACfC,WAAW;EACXC;AACsB,CAAC,EAAE;EACzB,MAAMC,gBAAgB,GAAG,IAAAC,kBAAW,EAAC,MAAM;IACzC,IAAAC,mCAAqB,EAAC;MACpBC,MAAM,EAAE,gBAA6B;MACrCC,KAAK,EAAE;QACLC,UAAU,EAAE,IAAI;QAChBC,WAAW,EAAE,KAAK;QAClBC,iBAAiB,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,CAAC;QAC1DC,WAAW,EAAE,MAAM;QACnBC,QAAQ,EAAE,MAAOC,IAAS,IAAK;UAC7B,IAAI,CAACA,IAAI,CAACC,WAAW,CAACC,UAAU,CAAC,QAAQ,CAAC,EAAE;YAC1CC,aAAK,CAACC,KAAK,CAAC,IAAAC,eAAS,EAACnB,eAAe,EAAE,gCAAgC,CAAC,IAAI,6BAA6B,CAAC;YAC1G;UACF;UACA,IAAI;YACF,MAAM,IAAAoB,mCAAsB,EAACN,IAAI,CAACO,EAAE,EAAEtB,WAAW,EAAE,iBAAiB,CAAC;YACrE,MAAM,IAAAuB,oCAAuB,EAC3B;cAAEC,MAAM,EAAET,IAAI,CAACO;YAAG,CAAC,EACnBtB,WAAW,EACXE,eAAe,EACfC,WAAW,EACX,MAAMC,YAAY,CAAC,CACrB,CAAC;YACDc,aAAK,CAACO,OAAO,CAAC,IAAAL,eAAS,EAACnB,eAAe,EAAE,kCAAkC,CAAC,IAAI,gBAAgB,CAAC;UACnG,CAAC,CAAC,OAAOyB,CAAM,EAAE;YACfR,aAAK,CAACC,KAAK,CAACO,CAAC,CAACC,OAAO,IAAI,IAAAP,eAAS,EAACnB,eAAe,EAAE,uCAAuC,CAAC,IAAI,yBAAyB,CAAC;UAC5H;QACF;MACF;IACF,CAAC,CAAC;EACJ,CAAC,EAAE,CAACD,WAAW,EAAEC,eAAe,EAAEC,eAAe,EAAEC,WAAW,EAAEC,YAAY,CAAC,CAAC;EAE9E,OAAO;IAAEC;EAAiB,CAAC;AAC7B","ignoreList":[]}
@@ -1,125 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useIdentityTransfer = useIdentityTransfer;
7
- var _react = require("react");
8
- var _sonner = require("../../lib/sonner");
9
- var _transferStore = require("../stores/transferStore");
10
- /**
11
- * Hook to handle identity transfer completion
12
- * This hook processes the identity_transfer_complete event and deletes the identity from the source device
13
- */
14
- function useIdentityTransfer({
15
- identityCore,
16
- currentDeviceId,
17
- activeSessionId,
18
- getPublicKey,
19
- deleteIdentityAndClearAccount,
20
- logger
21
- }) {
22
- const getTransferCode = (0, _transferStore.useTransferStore)(state => state.getTransferCode);
23
- const clearTransferCode = (0, _transferStore.useTransferStore)(state => state.clearTransferCode);
24
- const updateTransferState = (0, _transferStore.useTransferStore)(state => state.updateTransferState);
25
- const handleIdentityTransferComplete = (0, _react.useCallback)(async data => {
26
- try {
27
- logger('Received identity transfer complete notification', {
28
- transferId: data.transferId,
29
- sourceDeviceId: data.sourceDeviceId,
30
- currentDeviceId,
31
- hasActiveSession: activeSessionId !== null,
32
- publicKey: data.publicKey.substring(0, 16) + '...'
33
- });
34
- const storedTransfer = getTransferCode(data.transferId);
35
- if (!storedTransfer) {
36
- logger('Transfer code not found for transferId', {
37
- transferId: data.transferId
38
- });
39
- _sonner.toast.error('Transfer verification failed: Code not found. Identity will not be deleted.');
40
- return;
41
- }
42
- const currentPublicKey = await getPublicKey();
43
- if (!currentPublicKey) {
44
- logger('No public key found on device - cannot verify transfer', {
45
- transferId: data.transferId
46
- });
47
- _sonner.toast.error('Transfer verification failed: No identity found on device. Identity will not be deleted.');
48
- return;
49
- }
50
- const isSourceDevice = currentPublicKey === storedTransfer.publicKey;
51
- if (!isSourceDevice) {
52
- logger('Current device public key does not match stored transfer public key - this is not the source device', {
53
- transferId: data.transferId,
54
- currentPublicKey: currentPublicKey.substring(0, 16) + '...',
55
- storedPublicKey: storedTransfer.publicKey.substring(0, 16) + '...'
56
- });
57
- return;
58
- }
59
- const publicKeyMatches = data.publicKey === storedTransfer.publicKey;
60
- if (!publicKeyMatches) {
61
- logger('Public key mismatch for transfer', {
62
- transferId: data.transferId,
63
- receivedPublicKey: data.publicKey.substring(0, 16) + '...',
64
- storedPublicKey: storedTransfer.publicKey.substring(0, 16) + '...'
65
- });
66
- _sonner.toast.error('Transfer verification failed: Public key mismatch. Identity will not be deleted.');
67
- return;
68
- }
69
- const transferAge = Date.now() - storedTransfer.timestamp;
70
- const tenMinutes = 10 * 60 * 1000;
71
- if (transferAge > tenMinutes) {
72
- logger('Transfer confirmation received too late', {
73
- transferId: data.transferId,
74
- age: transferAge,
75
- ageMinutes: Math.round(transferAge / 60000)
76
- });
77
- _sonner.toast.error('Transfer verification failed: Confirmation received too late. Identity will not be deleted.');
78
- clearTransferCode(data.transferId);
79
- return;
80
- }
81
- logger('All transfer verifications passed, deleting identity from source device', {
82
- transferId: data.transferId,
83
- sourceDeviceId: data.sourceDeviceId,
84
- publicKey: data.publicKey.substring(0, 16) + '...'
85
- });
86
- try {
87
- const identityStillExists = identityCore ? await identityCore.hasIdentity() : false;
88
- if (!identityStillExists) {
89
- logger('Identity already deleted - skipping deletion', {
90
- transferId: data.transferId
91
- });
92
- await updateTransferState(data.transferId, 'completed');
93
- await clearTransferCode(data.transferId);
94
- return;
95
- }
96
- await deleteIdentityAndClearAccount(false, false, true);
97
- const identityDeleted = identityCore ? !(await identityCore.hasIdentity()) : true;
98
- if (!identityDeleted) {
99
- logger('Identity deletion failed - identity still exists', {
100
- transferId: data.transferId
101
- });
102
- await updateTransferState(data.transferId, 'failed');
103
- throw new Error('Identity deletion failed - identity still exists');
104
- }
105
- await updateTransferState(data.transferId, 'completed');
106
- await clearTransferCode(data.transferId);
107
- logger('Identity successfully deleted and transfer code cleared', {
108
- transferId: data.transferId
109
- });
110
- _sonner.toast.success('Identity successfully transferred and removed from this device');
111
- } catch (deleteError) {
112
- logger('Error during identity deletion', deleteError);
113
- await updateTransferState(data.transferId, 'failed');
114
- throw deleteError;
115
- }
116
- } catch (error) {
117
- logger('Failed to delete identity after transfer', error);
118
- _sonner.toast.error(error?.message || 'Failed to remove identity from this device. Please try again manually from Security Settings.');
119
- }
120
- }, [deleteIdentityAndClearAccount, logger, getTransferCode, clearTransferCode, updateTransferState, currentDeviceId, activeSessionId, getPublicKey, identityCore]);
121
- return {
122
- handleIdentityTransferComplete
123
- };
124
- }
125
- //# sourceMappingURL=useIdentityTransfer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_react","require","_sonner","_transferStore","useIdentityTransfer","identityCore","currentDeviceId","activeSessionId","getPublicKey","deleteIdentityAndClearAccount","logger","getTransferCode","useTransferStore","state","clearTransferCode","updateTransferState","handleIdentityTransferComplete","useCallback","data","transferId","sourceDeviceId","hasActiveSession","publicKey","substring","storedTransfer","toast","error","currentPublicKey","isSourceDevice","storedPublicKey","publicKeyMatches","receivedPublicKey","transferAge","Date","now","timestamp","tenMinutes","age","ageMinutes","Math","round","identityStillExists","hasIdentity","identityDeleted","Error","success","deleteError","message"],"sourceRoot":"../../../../src","sources":["ui/hooks/useIdentityTransfer.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAYA;AACA;AACA;AACA;AACO,SAASG,mBAAmBA,CAAC;EAClCC,YAAY;EACZC,eAAe;EACfC,eAAe;EACfC,YAAY;EACZC,6BAA6B;EAC7BC;AAC0B,CAAC,EAAE;EAC7B,MAAMC,eAAe,GAAG,IAAAC,+BAAgB,EAAEC,KAAK,IAAKA,KAAK,CAACF,eAAe,CAAC;EAC1E,MAAMG,iBAAiB,GAAG,IAAAF,+BAAgB,EAAEC,KAAK,IAAKA,KAAK,CAACC,iBAAiB,CAAC;EAC9E,MAAMC,mBAAmB,GAAG,IAAAH,+BAAgB,EAAEC,KAAK,IAAKA,KAAK,CAACE,mBAAmB,CAAC;EAElF,MAAMC,8BAA8B,GAAG,IAAAC,kBAAW,EAChD,MAAOC,IAAmH,IAAK;IAC7H,IAAI;MACFR,MAAM,CAAC,kDAAkD,EAAE;QACzDS,UAAU,EAAED,IAAI,CAACC,UAAU;QAC3BC,cAAc,EAAEF,IAAI,CAACE,cAAc;QACnCd,eAAe;QACfe,gBAAgB,EAAEd,eAAe,KAAK,IAAI;QAC1Ce,SAAS,EAAEJ,IAAI,CAACI,SAAS,CAACC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG;MAC/C,CAAC,CAAC;MAEF,MAAMC,cAAc,GAAGb,eAAe,CAACO,IAAI,CAACC,UAAU,CAAC;MAEvD,IAAI,CAACK,cAAc,EAAE;QACnBd,MAAM,CAAC,wCAAwC,EAAE;UAAES,UAAU,EAAED,I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AAI,CAACC,UAAU,EAAE,QAAQ,CAAC;UACpD,MAAM,IAAIyB,KAAK,CAAC,kDAAkD,CAAC;QACrE;QAEA,MAAM7B,mBAAmB,CAACG,IAAI,CAACC,UAAU,EAAE,WAAW,CAAC;QACvD,MAAML,iBAAiB,CAACI,IAAI,CAACC,UAAU,CAAC;QAExCT,MAAM,CAAC,yDAAyD,EAAE;UAAES,UAAU,EAAED,IAAI,CAACC;QAAW,CAAC,CAAC;QAClGM,aAAK,CAACoB,OAAO,CAAC,gEAAgE,CAAC;MACjF,CAAC,CAAC,OAAOC,WAAgB,EAAE;QACzBpC,MAAM,CAAC,gCAAgC,EAAEoC,WAAW,CAAC;QACrD,MAAM/B,mBAAmB,CAACG,IAAI,CAACC,UAAU,EAAE,QAAQ,CAAC;QACpD,MAAM2B,WAAW;MACnB;IACF,CAAC,CAAC,OAAOpB,KAAU,EAAE;MACnBhB,MAAM,CAAC,0CAA0C,EAAEgB,KAAK,CAAC;MACzDD,aAAK,CAACC,KAAK,CAACA,KAAK,EAAEqB,OAAO,IAAI,+FAA+F,CAAC;IAChI;EACF,CAAC,EACD,CAACtC,6BAA6B,EAAEC,MAAM,EAAEC,eAAe,EAAEG,iBAAiB,EAAEC,mBAAmB,EAAET,eAAe,EAAEC,eAAe,EAAEC,YAAY,EAAEH,YAAY,CAC/J,CAAC;EAED,OAAO;IAAEW;EAA+B,CAAC;AAC3C","ignoreList":[]}
@@ -1,81 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useTransferCodesPersistence = useTransferCodesPersistence;
7
- var _react = require("react");
8
- var _useStorage = require("./useStorage");
9
- var _transferStore = require("../stores/transferStore");
10
- const TRANSFER_CODES_STORAGE_KEY = 'oxy_transfer_codes';
11
- const ACTIVE_TRANSFER_STORAGE_KEY = 'oxy_active_transfer_id';
12
-
13
- /**
14
- * Hook to handle persistence of transfer codes to storage
15
- * This hook automatically loads transfer codes on mount and persists them when they change
16
- */
17
- function useTransferCodesPersistence(storageKeyPrefix = 'oxy_session') {
18
- const TRANSFER_CODES_KEY = `${storageKeyPrefix}_transfer_codes`;
19
- const ACTIVE_TRANSFER_KEY = `${storageKeyPrefix}_active_transfer_id`;
20
- const {
21
- storage,
22
- isReady: isStorageReady
23
- } = (0, _useStorage.useStorage)();
24
- const isRestored = (0, _transferStore.useTransferStore)(state => state.isRestored);
25
- const restoreFromStorage = (0, _transferStore.useTransferStore)(state => state.restoreFromStorage);
26
- const markRestored = (0, _transferStore.useTransferStore)(state => state.markRestored);
27
- const cleanupExpired = (0, _transferStore.useTransferStore)(state => state.cleanupExpired);
28
- const {
29
- transferCodes,
30
- activeTransferId
31
- } = (0, _transferStore.useTransferStore)(state => ({
32
- transferCodes: state.transferCodes,
33
- activeTransferId: state.activeTransferId
34
- }));
35
-
36
- // Load transfer codes from storage on startup (only once)
37
- (0, _react.useEffect)(() => {
38
- if (!storage || !isStorageReady || isRestored) return;
39
- const loadTransferCodes = async () => {
40
- try {
41
- const storedCodes = await storage.getItem(TRANSFER_CODES_KEY);
42
- const storedActiveTransferId = await storage.getItem(ACTIVE_TRANSFER_KEY);
43
- const parsedCodes = storedCodes ? JSON.parse(storedCodes) : {};
44
- const activeTransferId = storedActiveTransferId || null;
45
- restoreFromStorage(parsedCodes, activeTransferId);
46
- markRestored();
47
- } catch (error) {
48
- // Mark as restored even on error to prevent retries
49
- markRestored();
50
- }
51
- };
52
- loadTransferCodes();
53
- }, [storage, isStorageReady, isRestored, restoreFromStorage, markRestored, TRANSFER_CODES_KEY, ACTIVE_TRANSFER_KEY]);
54
-
55
- // Persist transfer codes to storage whenever store changes
56
- (0, _react.useEffect)(() => {
57
- if (!storage || !isStorageReady || !isRestored) return;
58
- const persistTransferCodes = async () => {
59
- try {
60
- await storage.setItem(TRANSFER_CODES_KEY, JSON.stringify(transferCodes));
61
- if (activeTransferId) {
62
- await storage.setItem(ACTIVE_TRANSFER_KEY, activeTransferId);
63
- } else {
64
- await storage.removeItem(ACTIVE_TRANSFER_KEY);
65
- }
66
- } catch (error) {
67
- // Silently fail - persistence errors are not critical
68
- }
69
- };
70
- persistTransferCodes();
71
- }, [transferCodes, activeTransferId, storage, isStorageReady, isRestored, TRANSFER_CODES_KEY, ACTIVE_TRANSFER_KEY]);
72
-
73
- // Cleanup expired transfer codes (every minute)
74
- (0, _react.useEffect)(() => {
75
- const cleanup = setInterval(() => {
76
- cleanupExpired();
77
- }, 60000);
78
- return () => clearInterval(cleanup);
79
- }, [cleanupExpired]);
80
- }
81
- //# sourceMappingURL=useTransferCodesPersistence.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_react","require","_useStorage","_transferStore","TRANSFER_CODES_STORAGE_KEY","ACTIVE_TRANSFER_STORAGE_KEY","useTransferCodesPersistence","storageKeyPrefix","TRANSFER_CODES_KEY","ACTIVE_TRANSFER_KEY","storage","isReady","isStorageReady","useStorage","isRestored","useTransferStore","state","restoreFromStorage","markRestored","cleanupExpired","transferCodes","activeTransferId","useEffect","loadTransferCodes","storedCodes","getItem","storedActiveTransferId","parsedCodes","JSON","parse","error","persistTransferCodes","setItem","stringify","removeItem","cleanup","setInterval","clearInterval"],"sourceRoot":"../../../../src","sources":["ui/hooks/useTransferCodesPersistence.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAEA,MAAMG,0BAA0B,GAAG,oBAAoB;AACvD,MAAMC,2BAA2B,GAAG,wBAAwB;;AAE5D;AACA;AACA;AACA;AACO,SAASC,2BAA2BA,CAACC,gBAAwB,GAAG,aAAa,EAAE;EACpF,MAAMC,kBAAkB,GAAG,GAAGD,gBAAgB,iBAAiB;EAC/D,MAAME,mBAAmB,GAAG,GAAGF,gBAAgB,qBAAqB;EAEpE,MAAM;IAAEG,OAAO;IAAEC,OAAO,EAAEC;EAAe,CAAC,GAAG,IAAAC,sBAAU,EAAC,C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E,UAAU,EAAEG,kBAAkB,EAAEC,YAAY,EAAEV,kBAAkB,EAAEC,mBAAmB,CAAC,CAAC;;EAEpH;EACA,IAAAa,gBAAS,EAAC,MAAM;IACd,IAAI,CAACZ,OAAO,IAAI,CAACE,cAAc,IAAI,CAACE,UAAU,EAAE;IAEhD,MAAMiB,oBAAoB,GAAG,MAAAA,CAAA,KAAY;MACvC,IAAI;QACF,MAAMrB,OAAO,CAACsB,OAAO,CAACxB,kBAAkB,EAAEoB,IAAI,CAACK,SAAS,CAACb,aAAa,CAAC,CAAC;QAExE,IAAIC,gBAAgB,EAAE;UACpB,MAAMX,OAAO,CAACsB,OAAO,CAACvB,mBAAmB,EAAEY,gBAAgB,CAAC;QAC9D,CAAC,MAAM;UACL,MAAMX,OAAO,CAACwB,UAAU,CAACzB,mBAAmB,CAAC;QAC/C;MACF,CAAC,CAAC,OAAOqB,KAAK,EAAE;QACd;MAAA;IAEJ,CAAC;IAEDC,oBAAoB,CAAC,CAAC;EACxB,CAAC,EAAE,CAACX,aAAa,EAAEC,gBAAgB,EAAEX,OAAO,EAAEE,cAAc,EAAEE,UAAU,EAAEN,kBAAkB,EAAEC,mBAAmB,CAAC,CAAC;;EAEnH;EACA,IAAAa,gBAAS,EAAC,MAAM;IACd,MAAMa,OAAO,GAAGC,WAAW,CAAC,MAAM;MAChCjB,cAAc,CAAC,CAAC;IAClB,CAAC,EAAE,KAAK,CAAC;IAET,OAAO,MAAMkB,aAAa,CAACF,OAAO,CAAC;EACrC,CAAC,EAAE,CAAChB,cAAc,CAAC,CAAC;AACtB","ignoreList":[]}
@@ -1,85 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useCheckPendingTransfers = exports.transferQueryKeys = void 0;
7
- var _reactQuery = require("@tanstack/react-query");
8
- var _transferStore = require("../stores/transferStore");
9
- /**
10
- * Query keys for transfer-related queries
11
- */
12
- const transferQueryKeys = exports.transferQueryKeys = {
13
- pending: () => ['transfers', 'pending']
14
- };
15
-
16
- /**
17
- * Hook to check all pending transfers for completion
18
- * Used when app comes back online
19
- *
20
- * This version accepts oxyServices and isAuthenticated as parameters to avoid
21
- * circular dependency when used inside OxyContext
22
- */
23
- const useCheckPendingTransfers = (oxyServices, isAuthenticated) => {
24
- const getAllPendingTransfers = (0, _transferStore.useTransferStore)(state => state.getAllPendingTransfers);
25
- const pendingTransfers = getAllPendingTransfers();
26
- return (0, _reactQuery.useQuery)({
27
- queryKey: [...transferQueryKeys.pending(), pendingTransfers.map(t => t.transferId).join(',')],
28
- queryFn: async () => {
29
- if (!oxyServices || pendingTransfers.length === 0) {
30
- return [];
31
- }
32
- const results = [];
33
-
34
- // Check each pending transfer
35
- for (const {
36
- transferId,
37
- data
38
- } of pendingTransfers) {
39
- try {
40
- const response = await oxyServices.makeRequest('GET', `/api/identity/check-transfer/${transferId}`, undefined, {
41
- cache: false
42
- });
43
- if (response.completed && response.publicKey === data.publicKey) {
44
- results.push({
45
- transferId,
46
- completed: true,
47
- data: response
48
- });
49
- } else {
50
- results.push({
51
- transferId,
52
- completed: false
53
- });
54
- }
55
- } catch (error) {
56
- // Handle 401 errors gracefully - skip this transfer
57
- if (error?.status === 401 || error?.message?.includes('401') || error?.message?.includes('authentication')) {
58
- if (__DEV__) {
59
- console.warn(`[useCheckPendingTransfers] Authentication required for transfer ${transferId}, skipping`);
60
- }
61
- results.push({
62
- transferId,
63
- completed: false
64
- });
65
- continue;
66
- }
67
- // For other errors, mark as not completed
68
- results.push({
69
- transferId,
70
- completed: false
71
- });
72
- }
73
- }
74
- return results;
75
- },
76
- enabled: (isAuthenticated ?? false) && !!oxyServices && pendingTransfers.length > 0,
77
- staleTime: 30 * 1000,
78
- // 30 seconds
79
- gcTime: 5 * 60 * 1000,
80
- // 5 minutes
81
- retry: false // Don't retry - we'll check again on next reconnect
82
- });
83
- };
84
- exports.useCheckPendingTransfers = useCheckPendingTransfers;
85
- //# sourceMappingURL=useTransferQueries.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_reactQuery","require","_transferStore","transferQueryKeys","exports","pending","useCheckPendingTransfers","oxyServices","isAuthenticated","getAllPendingTransfers","useTransferStore","state","pendingTransfers","useQuery","queryKey","map","t","transferId","join","queryFn","length","results","data","response","makeRequest","undefined","cache","completed","publicKey","push","error","status","message","includes","__DEV__","console","warn","enabled","staleTime","gcTime","retry"],"sourceRoot":"../../../../src","sources":["ui/hooks/useTransferQueries.ts"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAGA;AACA;AACA;AACO,MAAME,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG;EAC/BE,OAAO,EAAEA,CAAA,KAAM,CAAC,WAAW,EAAE,SAAS;AACxC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,wBAAwB,GAAGA,CACtCC,WAAgC,EAChCC,eAAyB,KACtB;EACH,MAAMC,sBAAsB,GAAG,IAAAC,+BAAgB,EAAEC,KAAK,IAAKA,KAAK,CAACF,sBAAsB,CAAC;EACxF,MAAMG,gBAAgB,GAAGH,sBAAsB,CAAC,CAAC;EAEjD,OAAO,IAAAI,oBAAQ,EAAC;IACdC,QAAQ,EAAE,CAAC,GAAGX,iBAAiB,CAACE,OAAO,CAAC,CAAC,EAAEO,gBAAgB,CAACG,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACC,UAAU,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7FC,OAAO,EAAE,MAAAA,CAAA,KAAY;MACnB,IAAI,CAACZ,WAAW,IAAIK,gBAAgB,CAACQ,MAAM,KAAK,CAAC,EAAE;QACjD,OAAO,EAAE;MACX;MAEA,MAAMC,OAUJ,GAAG,EAAE;;MAEP;MACA,KAAK,MAAM;QAAEJ,UAAU;QAAEK;MAAK,CAAC,IAAIV,gBAAgB,EAAE;QACnD,IAAI;UACF,MAAMW,QAAQ,GAA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