@oxyhq/services 15.0.0 → 17.0.0

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 (280) hide show
  1. package/lib/commonjs/index.js +25 -55
  2. package/lib/commonjs/index.js.map +1 -1
  3. package/lib/commonjs/ui/client.js +0 -14
  4. package/lib/commonjs/ui/client.js.map +1 -1
  5. package/lib/commonjs/ui/components/OxyAccountDialog.js +764 -0
  6. package/lib/commonjs/ui/components/OxyAccountDialog.js.map +1 -0
  7. package/lib/commonjs/ui/components/OxyProvider.js +11 -6
  8. package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
  9. package/lib/commonjs/ui/components/OxySignInButton.js +10 -21
  10. package/lib/commonjs/ui/components/OxySignInButton.js.map +1 -1
  11. package/lib/commonjs/ui/components/ProfileButton.js +25 -112
  12. package/lib/commonjs/ui/components/ProfileButton.js.map +1 -1
  13. package/lib/commonjs/ui/components/RequireOxyAuth.js +299 -0
  14. package/lib/commonjs/ui/components/RequireOxyAuth.js.map +1 -0
  15. package/lib/commonjs/ui/context/OxyContext.js +106 -2
  16. package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
  17. package/lib/commonjs/ui/hooks/mutations/mutationKeys.js +1 -1
  18. package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js +10 -10
  19. package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js.map +1 -1
  20. package/lib/commonjs/ui/hooks/queries/queryKeys.js +1 -1
  21. package/lib/commonjs/ui/hooks/queries/useAccountQueries.js +7 -8
  22. package/lib/commonjs/ui/hooks/queries/useAccountQueries.js.map +1 -1
  23. package/lib/commonjs/ui/hooks/useAuth.js +19 -30
  24. package/lib/commonjs/ui/hooks/useAuth.js.map +1 -1
  25. package/lib/commonjs/ui/hooks/useSwitchableAccounts.js +37 -267
  26. package/lib/commonjs/ui/hooks/useSwitchableAccounts.js.map +1 -1
  27. package/lib/commonjs/ui/index.js +5 -40
  28. package/lib/commonjs/ui/index.js.map +1 -1
  29. package/lib/commonjs/ui/navigation/accountDialogManager.js +91 -0
  30. package/lib/commonjs/ui/navigation/accountDialogManager.js.map +1 -0
  31. package/lib/commonjs/ui/navigation/routes.js +0 -2
  32. package/lib/commonjs/ui/navigation/routes.js.map +1 -1
  33. package/lib/commonjs/ui/screens/ConnectedAppsScreen.js +17 -18
  34. package/lib/commonjs/ui/screens/ConnectedAppsScreen.js.map +1 -1
  35. package/lib/commonjs/ui/screens/ManageAccountScreen.js +4 -3
  36. package/lib/commonjs/ui/screens/ManageAccountScreen.js.map +1 -1
  37. package/lib/commonjs/ui/session/createSessionClient.js +10 -2
  38. package/lib/commonjs/ui/session/createSessionClient.js.map +1 -1
  39. package/lib/module/index.js +20 -17
  40. package/lib/module/index.js.map +1 -1
  41. package/lib/module/ui/client.js +1 -2
  42. package/lib/module/ui/client.js.map +1 -1
  43. package/lib/module/ui/components/OxyAccountDialog.js +761 -0
  44. package/lib/module/ui/components/OxyAccountDialog.js.map +1 -0
  45. package/lib/module/ui/components/OxyProvider.js +11 -6
  46. package/lib/module/ui/components/OxyProvider.js.map +1 -1
  47. package/lib/module/ui/components/OxySignInButton.js +10 -21
  48. package/lib/module/ui/components/OxySignInButton.js.map +1 -1
  49. package/lib/module/ui/components/ProfileButton.js +26 -112
  50. package/lib/module/ui/components/ProfileButton.js.map +1 -1
  51. package/lib/module/ui/components/RequireOxyAuth.js +294 -0
  52. package/lib/module/ui/components/RequireOxyAuth.js.map +1 -0
  53. package/lib/module/ui/context/OxyContext.js +107 -3
  54. package/lib/module/ui/context/OxyContext.js.map +1 -1
  55. package/lib/module/ui/hooks/mutations/mutationKeys.js +1 -1
  56. package/lib/module/ui/hooks/mutations/useAccountMutations.js +8 -8
  57. package/lib/module/ui/hooks/mutations/useAccountMutations.js.map +1 -1
  58. package/lib/module/ui/hooks/queries/queryKeys.js +1 -1
  59. package/lib/module/ui/hooks/queries/useAccountQueries.js +5 -6
  60. package/lib/module/ui/hooks/queries/useAccountQueries.js.map +1 -1
  61. package/lib/module/ui/hooks/useAuth.js +19 -30
  62. package/lib/module/ui/hooks/useAuth.js.map +1 -1
  63. package/lib/module/ui/hooks/useSwitchableAccounts.js +38 -267
  64. package/lib/module/ui/hooks/useSwitchableAccounts.js.map +1 -1
  65. package/lib/module/ui/index.js +1 -5
  66. package/lib/module/ui/index.js.map +1 -1
  67. package/lib/module/ui/navigation/accountDialogManager.js +81 -0
  68. package/lib/module/ui/navigation/accountDialogManager.js.map +1 -0
  69. package/lib/module/ui/navigation/routes.js +0 -2
  70. package/lib/module/ui/navigation/routes.js.map +1 -1
  71. package/lib/module/ui/screens/ConnectedAppsScreen.js +19 -20
  72. package/lib/module/ui/screens/ConnectedAppsScreen.js.map +1 -1
  73. package/lib/module/ui/screens/ManageAccountScreen.js +4 -3
  74. package/lib/module/ui/screens/ManageAccountScreen.js.map +1 -1
  75. package/lib/module/ui/session/createSessionClient.js +10 -2
  76. package/lib/module/ui/session/createSessionClient.js.map +1 -1
  77. package/lib/typescript/commonjs/index.d.ts +6 -13
  78. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  79. package/lib/typescript/commonjs/ui/client.d.ts +0 -4
  80. package/lib/typescript/commonjs/ui/client.d.ts.map +1 -1
  81. package/lib/typescript/commonjs/ui/components/OxyAccountDialog.d.ts +35 -0
  82. package/lib/typescript/commonjs/ui/components/OxyAccountDialog.d.ts.map +1 -0
  83. package/lib/typescript/commonjs/ui/components/OxyProvider.d.ts +2 -2
  84. package/lib/typescript/commonjs/ui/components/OxyProvider.d.ts.map +1 -1
  85. package/lib/typescript/commonjs/ui/components/OxySignInButton.d.ts.map +1 -1
  86. package/lib/typescript/commonjs/ui/components/ProfileButton.d.ts +11 -23
  87. package/lib/typescript/commonjs/ui/components/ProfileButton.d.ts.map +1 -1
  88. package/lib/typescript/commonjs/ui/components/RequireOxyAuth.d.ts +55 -0
  89. package/lib/typescript/commonjs/ui/components/RequireOxyAuth.d.ts.map +1 -0
  90. package/lib/typescript/commonjs/ui/context/OxyContext.d.ts +13 -1
  91. package/lib/typescript/commonjs/ui/context/OxyContext.d.ts.map +1 -1
  92. package/lib/typescript/commonjs/ui/hooks/mutations/useAccountMutations.d.ts +4 -4
  93. package/lib/typescript/commonjs/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
  94. package/lib/typescript/commonjs/ui/hooks/queries/useAccountQueries.d.ts +6 -7
  95. package/lib/typescript/commonjs/ui/hooks/queries/useAccountQueries.d.ts.map +1 -1
  96. package/lib/typescript/commonjs/ui/hooks/useAuth.d.ts.map +1 -1
  97. package/lib/typescript/commonjs/ui/hooks/useSwitchableAccounts.d.ts +13 -152
  98. package/lib/typescript/commonjs/ui/hooks/useSwitchableAccounts.d.ts.map +1 -1
  99. package/lib/typescript/commonjs/ui/index.d.ts +2 -5
  100. package/lib/typescript/commonjs/ui/index.d.ts.map +1 -1
  101. package/lib/typescript/commonjs/ui/navigation/accountDialogManager.d.ts +49 -0
  102. package/lib/typescript/commonjs/ui/navigation/accountDialogManager.d.ts.map +1 -0
  103. package/lib/typescript/commonjs/ui/navigation/routes.d.ts +1 -1
  104. package/lib/typescript/commonjs/ui/navigation/routes.d.ts.map +1 -1
  105. package/lib/typescript/commonjs/ui/screens/ConnectedAppsScreen.d.ts.map +1 -1
  106. package/lib/typescript/commonjs/ui/screens/ManageAccountScreen.d.ts +1 -1
  107. package/lib/typescript/commonjs/ui/screens/ManageAccountScreen.d.ts.map +1 -1
  108. package/lib/typescript/commonjs/ui/session/createSessionClient.d.ts +9 -2
  109. package/lib/typescript/commonjs/ui/session/createSessionClient.d.ts.map +1 -1
  110. package/lib/typescript/commonjs/ui/types/navigation.d.ts +9 -0
  111. package/lib/typescript/commonjs/ui/types/navigation.d.ts.map +1 -1
  112. package/lib/typescript/commonjs/ui/utils/storageHelpers.d.ts +7 -7
  113. package/lib/typescript/module/index.d.ts +6 -13
  114. package/lib/typescript/module/index.d.ts.map +1 -1
  115. package/lib/typescript/module/ui/client.d.ts +0 -4
  116. package/lib/typescript/module/ui/client.d.ts.map +1 -1
  117. package/lib/typescript/module/ui/components/OxyAccountDialog.d.ts +35 -0
  118. package/lib/typescript/module/ui/components/OxyAccountDialog.d.ts.map +1 -0
  119. package/lib/typescript/module/ui/components/OxyProvider.d.ts +2 -2
  120. package/lib/typescript/module/ui/components/OxyProvider.d.ts.map +1 -1
  121. package/lib/typescript/module/ui/components/OxySignInButton.d.ts.map +1 -1
  122. package/lib/typescript/module/ui/components/ProfileButton.d.ts +11 -23
  123. package/lib/typescript/module/ui/components/ProfileButton.d.ts.map +1 -1
  124. package/lib/typescript/module/ui/components/RequireOxyAuth.d.ts +55 -0
  125. package/lib/typescript/module/ui/components/RequireOxyAuth.d.ts.map +1 -0
  126. package/lib/typescript/module/ui/context/OxyContext.d.ts +13 -1
  127. package/lib/typescript/module/ui/context/OxyContext.d.ts.map +1 -1
  128. package/lib/typescript/module/ui/hooks/mutations/useAccountMutations.d.ts +4 -4
  129. package/lib/typescript/module/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
  130. package/lib/typescript/module/ui/hooks/queries/useAccountQueries.d.ts +6 -7
  131. package/lib/typescript/module/ui/hooks/queries/useAccountQueries.d.ts.map +1 -1
  132. package/lib/typescript/module/ui/hooks/useAuth.d.ts.map +1 -1
  133. package/lib/typescript/module/ui/hooks/useSwitchableAccounts.d.ts +13 -152
  134. package/lib/typescript/module/ui/hooks/useSwitchableAccounts.d.ts.map +1 -1
  135. package/lib/typescript/module/ui/index.d.ts +2 -5
  136. package/lib/typescript/module/ui/index.d.ts.map +1 -1
  137. package/lib/typescript/module/ui/navigation/accountDialogManager.d.ts +49 -0
  138. package/lib/typescript/module/ui/navigation/accountDialogManager.d.ts.map +1 -0
  139. package/lib/typescript/module/ui/navigation/routes.d.ts +1 -1
  140. package/lib/typescript/module/ui/navigation/routes.d.ts.map +1 -1
  141. package/lib/typescript/module/ui/screens/ConnectedAppsScreen.d.ts.map +1 -1
  142. package/lib/typescript/module/ui/screens/ManageAccountScreen.d.ts +1 -1
  143. package/lib/typescript/module/ui/screens/ManageAccountScreen.d.ts.map +1 -1
  144. package/lib/typescript/module/ui/session/createSessionClient.d.ts +9 -2
  145. package/lib/typescript/module/ui/session/createSessionClient.d.ts.map +1 -1
  146. package/lib/typescript/module/ui/types/navigation.d.ts +9 -0
  147. package/lib/typescript/module/ui/types/navigation.d.ts.map +1 -1
  148. package/lib/typescript/module/ui/utils/storageHelpers.d.ts +7 -7
  149. package/package.json +4 -4
  150. package/src/index.ts +23 -28
  151. package/src/ui/client.ts +0 -4
  152. package/src/ui/components/OxyAccountDialog.tsx +760 -0
  153. package/src/ui/components/OxyProvider.tsx +12 -6
  154. package/src/ui/components/OxySignInButton.tsx +10 -21
  155. package/src/ui/components/ProfileButton.tsx +23 -126
  156. package/src/ui/components/RequireOxyAuth.tsx +266 -0
  157. package/src/ui/context/OxyContext.tsx +146 -7
  158. package/src/ui/hooks/mutations/mutationKeys.ts +1 -1
  159. package/src/ui/hooks/mutations/useAccountMutations.ts +8 -8
  160. package/src/ui/hooks/queries/queryKeys.ts +1 -1
  161. package/src/ui/hooks/queries/useAccountQueries.ts +8 -9
  162. package/src/ui/hooks/useAuth.ts +19 -31
  163. package/src/ui/hooks/useSwitchableAccounts.ts +42 -376
  164. package/src/ui/index.ts +2 -5
  165. package/src/ui/navigation/accountDialogManager.ts +84 -0
  166. package/src/ui/navigation/routes.ts +1 -5
  167. package/src/ui/screens/ConnectedAppsScreen.tsx +23 -24
  168. package/src/ui/screens/ManageAccountScreen.tsx +3 -2
  169. package/src/ui/session/createSessionClient.ts +9 -1
  170. package/src/ui/types/navigation.ts +9 -0
  171. package/src/ui/utils/storageHelpers.ts +7 -7
  172. package/lib/commonjs/ui/components/AccountMenu.js +0 -598
  173. package/lib/commonjs/ui/components/AccountMenu.js.map +0 -1
  174. package/lib/commonjs/ui/components/AccountMenuButton.js +0 -135
  175. package/lib/commonjs/ui/components/AccountMenuButton.js.map +0 -1
  176. package/lib/commonjs/ui/components/AccountSwitcher.js +0 -780
  177. package/lib/commonjs/ui/components/AccountSwitcher.js.map +0 -1
  178. package/lib/commonjs/ui/components/AnotherDeviceQR.js +0 -116
  179. package/lib/commonjs/ui/components/AnotherDeviceQR.js.map +0 -1
  180. package/lib/commonjs/ui/components/ProfileMenu.js +0 -518
  181. package/lib/commonjs/ui/components/ProfileMenu.js.map +0 -1
  182. package/lib/commonjs/ui/components/SignInAccountChooser.js +0 -189
  183. package/lib/commonjs/ui/components/SignInAccountChooser.js.map +0 -1
  184. package/lib/commonjs/ui/components/SignInModal.js +0 -600
  185. package/lib/commonjs/ui/components/SignInModal.js.map +0 -1
  186. package/lib/commonjs/ui/hooks/useOxyAuthSession.js +0 -501
  187. package/lib/commonjs/ui/hooks/useOxyAuthSession.js.map +0 -1
  188. package/lib/commonjs/ui/hooks/usePasswordSignIn.js +0 -170
  189. package/lib/commonjs/ui/hooks/usePasswordSignIn.js.map +0 -1
  190. package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +0 -51
  191. package/lib/commonjs/ui/screens/AccountSwitcherScreen.js.map +0 -1
  192. package/lib/commonjs/ui/screens/OxyAuthScreen.js +0 -312
  193. package/lib/commonjs/ui/screens/OxyAuthScreen.js.map +0 -1
  194. package/lib/commonjs/utils/deviceFlowSignIn.js +0 -109
  195. package/lib/commonjs/utils/deviceFlowSignIn.js.map +0 -1
  196. package/lib/module/ui/components/AccountMenu.js +0 -593
  197. package/lib/module/ui/components/AccountMenu.js.map +0 -1
  198. package/lib/module/ui/components/AccountMenuButton.js +0 -130
  199. package/lib/module/ui/components/AccountMenuButton.js.map +0 -1
  200. package/lib/module/ui/components/AccountSwitcher.js +0 -774
  201. package/lib/module/ui/components/AccountSwitcher.js.map +0 -1
  202. package/lib/module/ui/components/AnotherDeviceQR.js +0 -110
  203. package/lib/module/ui/components/AnotherDeviceQR.js.map +0 -1
  204. package/lib/module/ui/components/ProfileMenu.js +0 -514
  205. package/lib/module/ui/components/ProfileMenu.js.map +0 -1
  206. package/lib/module/ui/components/SignInAccountChooser.js +0 -183
  207. package/lib/module/ui/components/SignInAccountChooser.js.map +0 -1
  208. package/lib/module/ui/components/SignInModal.js +0 -591
  209. package/lib/module/ui/components/SignInModal.js.map +0 -1
  210. package/lib/module/ui/hooks/useOxyAuthSession.js +0 -495
  211. package/lib/module/ui/hooks/useOxyAuthSession.js.map +0 -1
  212. package/lib/module/ui/hooks/usePasswordSignIn.js +0 -165
  213. package/lib/module/ui/hooks/usePasswordSignIn.js.map +0 -1
  214. package/lib/module/ui/screens/AccountSwitcherScreen.js +0 -48
  215. package/lib/module/ui/screens/AccountSwitcherScreen.js.map +0 -1
  216. package/lib/module/ui/screens/OxyAuthScreen.js +0 -306
  217. package/lib/module/ui/screens/OxyAuthScreen.js.map +0 -1
  218. package/lib/module/utils/deviceFlowSignIn.js +0 -106
  219. package/lib/module/utils/deviceFlowSignIn.js.map +0 -1
  220. package/lib/typescript/commonjs/ui/components/AccountMenu.d.ts +0 -47
  221. package/lib/typescript/commonjs/ui/components/AccountMenu.d.ts.map +0 -1
  222. package/lib/typescript/commonjs/ui/components/AccountMenuButton.d.ts +0 -26
  223. package/lib/typescript/commonjs/ui/components/AccountMenuButton.d.ts.map +0 -1
  224. package/lib/typescript/commonjs/ui/components/AccountSwitcher.d.ts +0 -46
  225. package/lib/typescript/commonjs/ui/components/AccountSwitcher.d.ts.map +0 -1
  226. package/lib/typescript/commonjs/ui/components/AnotherDeviceQR.d.ts +0 -34
  227. package/lib/typescript/commonjs/ui/components/AnotherDeviceQR.d.ts.map +0 -1
  228. package/lib/typescript/commonjs/ui/components/ProfileMenu.d.ts +0 -49
  229. package/lib/typescript/commonjs/ui/components/ProfileMenu.d.ts.map +0 -1
  230. package/lib/typescript/commonjs/ui/components/SignInAccountChooser.d.ts +0 -29
  231. package/lib/typescript/commonjs/ui/components/SignInAccountChooser.d.ts.map +0 -1
  232. package/lib/typescript/commonjs/ui/components/SignInModal.d.ts +0 -28
  233. package/lib/typescript/commonjs/ui/components/SignInModal.d.ts.map +0 -1
  234. package/lib/typescript/commonjs/ui/hooks/useOxyAuthSession.d.ts +0 -105
  235. package/lib/typescript/commonjs/ui/hooks/useOxyAuthSession.d.ts.map +0 -1
  236. package/lib/typescript/commonjs/ui/hooks/usePasswordSignIn.d.ts +0 -31
  237. package/lib/typescript/commonjs/ui/hooks/usePasswordSignIn.d.ts.map +0 -1
  238. package/lib/typescript/commonjs/ui/screens/AccountSwitcherScreen.d.ts +0 -11
  239. package/lib/typescript/commonjs/ui/screens/AccountSwitcherScreen.d.ts.map +0 -1
  240. package/lib/typescript/commonjs/ui/screens/OxyAuthScreen.d.ts +0 -22
  241. package/lib/typescript/commonjs/ui/screens/OxyAuthScreen.d.ts.map +0 -1
  242. package/lib/typescript/commonjs/utils/deviceFlowSignIn.d.ts +0 -97
  243. package/lib/typescript/commonjs/utils/deviceFlowSignIn.d.ts.map +0 -1
  244. package/lib/typescript/module/ui/components/AccountMenu.d.ts +0 -47
  245. package/lib/typescript/module/ui/components/AccountMenu.d.ts.map +0 -1
  246. package/lib/typescript/module/ui/components/AccountMenuButton.d.ts +0 -26
  247. package/lib/typescript/module/ui/components/AccountMenuButton.d.ts.map +0 -1
  248. package/lib/typescript/module/ui/components/AccountSwitcher.d.ts +0 -46
  249. package/lib/typescript/module/ui/components/AccountSwitcher.d.ts.map +0 -1
  250. package/lib/typescript/module/ui/components/AnotherDeviceQR.d.ts +0 -34
  251. package/lib/typescript/module/ui/components/AnotherDeviceQR.d.ts.map +0 -1
  252. package/lib/typescript/module/ui/components/ProfileMenu.d.ts +0 -49
  253. package/lib/typescript/module/ui/components/ProfileMenu.d.ts.map +0 -1
  254. package/lib/typescript/module/ui/components/SignInAccountChooser.d.ts +0 -29
  255. package/lib/typescript/module/ui/components/SignInAccountChooser.d.ts.map +0 -1
  256. package/lib/typescript/module/ui/components/SignInModal.d.ts +0 -28
  257. package/lib/typescript/module/ui/components/SignInModal.d.ts.map +0 -1
  258. package/lib/typescript/module/ui/hooks/useOxyAuthSession.d.ts +0 -105
  259. package/lib/typescript/module/ui/hooks/useOxyAuthSession.d.ts.map +0 -1
  260. package/lib/typescript/module/ui/hooks/usePasswordSignIn.d.ts +0 -31
  261. package/lib/typescript/module/ui/hooks/usePasswordSignIn.d.ts.map +0 -1
  262. package/lib/typescript/module/ui/screens/AccountSwitcherScreen.d.ts +0 -11
  263. package/lib/typescript/module/ui/screens/AccountSwitcherScreen.d.ts.map +0 -1
  264. package/lib/typescript/module/ui/screens/OxyAuthScreen.d.ts +0 -22
  265. package/lib/typescript/module/ui/screens/OxyAuthScreen.d.ts.map +0 -1
  266. package/lib/typescript/module/utils/deviceFlowSignIn.d.ts +0 -97
  267. package/lib/typescript/module/utils/deviceFlowSignIn.d.ts.map +0 -1
  268. package/src/ui/components/AccountMenu.tsx +0 -645
  269. package/src/ui/components/AccountMenuButton.tsx +0 -126
  270. package/src/ui/components/AccountSwitcher.tsx +0 -751
  271. package/src/ui/components/AnotherDeviceQR.tsx +0 -119
  272. package/src/ui/components/ProfileMenu.tsx +0 -564
  273. package/src/ui/components/SignInAccountChooser.tsx +0 -162
  274. package/src/ui/components/SignInModal.tsx +0 -530
  275. package/src/ui/hooks/useOxyAuthSession.ts +0 -635
  276. package/src/ui/hooks/usePasswordSignIn.ts +0 -207
  277. package/src/ui/screens/AccountSwitcherScreen.tsx +0 -43
  278. package/src/ui/screens/OxyAuthScreen.tsx +0 -324
  279. package/src/utils/__tests__/deviceFlowSignIn.test.ts +0 -231
  280. package/src/utils/deviceFlowSignIn.ts +0 -152
@@ -1,501 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.POLLING_INTERVAL_MS = exports.OXY_AUTH_WEB_URL = exports.OXY_ACCOUNTS_WEB_URL = exports.AUTH_SESSION_EXPIRY_MS = void 0;
7
- exports.useOxyAuthSession = useOxyAuthSession;
8
- var _react = require("react");
9
- var _reactNative = require("react-native");
10
- var _socket = _interopRequireDefault(require("socket.io-client"));
11
- var _core = require("@oxyhq/core");
12
- var _deviceFlowSignIn = require("../../utils/deviceFlowSignIn.js");
13
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
- /**
15
- * useOxyAuthSession — the single shared engine for the cross-app device-flow
16
- * sign-in ("Sign in with Oxy") used by BOTH containers:
17
- *
18
- * - `SignInModal` (web centered modal)
19
- * - `OxyAuthScreen` (native bottom sheet)
20
- *
21
- * Before this hook existed, those two files each re-implemented ~90% of the
22
- * same auth-session machinery (session-token creation, QR data, socket.io
23
- * `/auth-session` subscription, the HTTP polling fallback, waiting/error/retry
24
- * state, the open-auth handler, and cleanup) — and they had drifted (notably a
25
- * weaker `Math.random()` session token on native vs the crypto-secure one on
26
- * web). This hook owns ALL of it ONCE, with a clean typed surface, so the
27
- * containers only own their layout. The transport is functionally identical to
28
- * the previous implementations — this is a structural de-duplication, not a
29
- * behavior change.
30
- *
31
- * The native-only deep-link return path (`Linking` redirect handling) lives
32
- * HERE, gated to native via `Platform.OS`, so the web container never carries
33
- * native-only code while the two paths still cannot drift.
34
- */
35
-
36
- const debug = (0, _core.createDebugLogger)('useOxyAuthSession');
37
-
38
- /**
39
- * Default destination for the "Create an Oxy account" / "Get Oxy Accounts"
40
- * link, shared by both containers. Reused as-is from the original native
41
- * `OxyAuthScreen` so no new route is invented.
42
- */
43
- const OXY_ACCOUNTS_WEB_URL = exports.OXY_ACCOUNTS_WEB_URL = 'https://accounts.oxy.so';
44
-
45
- /** Default central Oxy auth web origin used when no override can be resolved. */
46
- const OXY_AUTH_WEB_URL = exports.OXY_AUTH_WEB_URL = 'https://auth.oxy.so';
47
-
48
- /** Auth session expiration (5 minutes). */
49
- const AUTH_SESSION_EXPIRY_MS = exports.AUTH_SESSION_EXPIRY_MS = 5 * 60 * 1000;
50
-
51
- /** Polling interval (fallback if the socket fails) in milliseconds. */
52
- const POLLING_INTERVAL_MS = exports.POLLING_INTERVAL_MS = 3000;
53
-
54
- /** The active device-flow session this client created and is waiting on. */
55
-
56
- /**
57
- * Extended `POST /auth/session/create` response (the "Sign in with Oxy" handoff
58
- * fields, Workstream C2). Both are optional so this hook degrades gracefully
59
- * when the handoff backend is not yet deployed — the legacy `oxyauth://<token>`
60
- * QR (`qrData`) remains the fallback.
61
- */
62
-
63
- /** Real-time auth-session socket payload (also matches the poll status shape). */
64
-
65
- /**
66
- * Resolve the central Oxy auth web origin from config or the API base URL.
67
- * Mirrors the resolution both containers previously inlined.
68
- */
69
- function resolveAuthWebBaseUrl(baseURL, authWebUrl) {
70
- if (authWebUrl) {
71
- return authWebUrl;
72
- }
73
- try {
74
- const url = new URL(baseURL);
75
- if (url.port === '3001') {
76
- url.port = '3002';
77
- return url.origin;
78
- }
79
- if (url.hostname.startsWith('api.')) {
80
- url.hostname = `auth.${url.hostname.slice(4)}`;
81
- return url.origin;
82
- }
83
- } catch {
84
- // Malformed base URL — fall back to the default origin below.
85
- }
86
- return OXY_AUTH_WEB_URL;
87
- }
88
-
89
- /**
90
- * Resolve the deep-link redirect URI used on native so the auth web flow can
91
- * bounce back into the app. Prefers an explicit config value, otherwise derives
92
- * a clean (query/hash-stripped) URI from the app's initial deep link.
93
- */
94
- async function resolveAuthRedirectUri(authRedirectUri) {
95
- if (authRedirectUri) {
96
- return authRedirectUri;
97
- }
98
- try {
99
- const initialUrl = await _reactNative.Linking.getInitialURL();
100
- if (!initialUrl) {
101
- return null;
102
- }
103
- const parsed = new URL(initialUrl);
104
- parsed.search = '';
105
- parsed.hash = '';
106
- return parsed.toString();
107
- } catch {
108
- return null;
109
- }
110
- }
111
-
112
- /** Parse the `session_id` / `error` params from a deep-link redirect URL. */
113
- function getRedirectParams(url) {
114
- try {
115
- const parsed = new URL(url);
116
- const sessionId = parsed.searchParams.get('session_id') ?? undefined;
117
- const error = parsed.searchParams.get('error') ?? undefined;
118
- if (!sessionId && !error) {
119
- return null;
120
- }
121
- return {
122
- sessionId,
123
- error
124
- };
125
- } catch {
126
- return null;
127
- }
128
- }
129
-
130
- /**
131
- * Generate a cryptographically random session token.
132
- *
133
- * 16 random bytes -> 32 hex chars (128 bits of entropy) — unguessable.
134
- * `crypto.getRandomValues` is guaranteed available because importing
135
- * `@oxyhq/core` installs a polyfill via `expo-crypto` on React Native. This is
136
- * the secure generator the web modal already used; the native screen previously
137
- * used a weaker `Math.random()` generator, which this consolidation removes.
138
- */
139
- function generateSessionToken() {
140
- const bytes = new Uint8Array(16);
141
- crypto.getRandomValues(bytes);
142
- return Array.from(bytes, b => b.toString(16).padStart(2, '0')).join('');
143
- }
144
-
145
- /**
146
- * Owns the full device-flow auth-session lifecycle for one mounted sign-in
147
- * surface. Both `SignInModal` and `OxyAuthScreen` consume this; neither
148
- * re-implements the socket / polling / deep-link transport.
149
- *
150
- * Subscriptions (socket connect/disconnect, the poll interval, the native
151
- * deep-link listener, and unmount cleanup) are the legitimate `useEffect` use
152
- * WITH cleanup. No effect here computes derived UI state.
153
- */
154
- function useOxyAuthSession(oxyServices, clientId, commitSession, options = {}) {
155
- const {
156
- onSignedIn
157
- } = options;
158
- const [authSession, setAuthSession] = (0, _react.useState)(null);
159
- const [isLoading, setIsLoading] = (0, _react.useState)(true);
160
- const [error, setError] = (0, _react.useState)(null);
161
- const [isWaiting, setIsWaiting] = (0, _react.useState)(false);
162
- // "Sign in with Oxy" handoff fields surfaced from the `create` response.
163
- const [authorizeCode, setAuthorizeCode] = (0, _react.useState)(null);
164
- const [qrPayload, setQrPayload] = (0, _react.useState)(null);
165
- const socketRef = (0, _react.useRef)(null);
166
- const pollingIntervalRef = (0, _react.useRef)(null);
167
- const isProcessingRef = (0, _react.useRef)(false);
168
- const linkingHandledRef = (0, _react.useRef)(false);
169
-
170
- // The latest `onSignedIn` callback, read via ref so the success handler does
171
- // not need it in its dependency list (which would otherwise rebuild the
172
- // socket/poll callbacks on every render where the container passes a new
173
- // closure).
174
- const onSignedInRef = (0, _react.useRef)(onSignedIn);
175
- onSignedInRef.current = onSignedIn;
176
-
177
- // Cleanup socket and polling. Idempotent.
178
- const cleanup = (0, _react.useCallback)(() => {
179
- setIsWaiting(false);
180
- if (socketRef.current) {
181
- socketRef.current.disconnect();
182
- socketRef.current = null;
183
- }
184
- if (pollingIntervalRef.current) {
185
- clearInterval(pollingIntervalRef.current);
186
- pollingIntervalRef.current = null;
187
- }
188
- }, []);
189
-
190
- // Handle successful authorization.
191
- //
192
- // The auth-session socket / poll (or deep-link return) hands us the
193
- // authorized `sessionId`. Before any session-management code can use it we
194
- // MUST first exchange the secret `sessionToken` (held only by this client,
195
- // generated for THIS flow) for the first access token via
196
- // `claimSessionByToken` — the device-flow equivalent of OAuth's
197
- // code-for-token exchange (RFC 8628 §3.4).
198
- //
199
- // Without that exchange the SDK has no bearer token — the session is
200
- // authorized server-side but the app never becomes authenticated and the UI
201
- // sits "Waiting for authorization..." forever. Once `claimSessionByToken`
202
- // plants the tokens in the HttpService, the claimed session is committed via
203
- // `commitSession` (`useOxy().handleWebSession`) — the SAME path a fresh
204
- // password sign-in or a silent cross-domain restore uses to register the
205
- // account into the device's server-authoritative session set. It is NOT yet a
206
- // member of that set, so
207
- // `switchSession` (an account-SWITCH between accounts already on the
208
- // device) is the wrong primitive here. Shared with both containers via
209
- // `completeDeviceFlowSignIn` so the two paths cannot drift.
210
- const handleAuthSuccess = (0, _react.useCallback)(async (sessionId, sessionToken) => {
211
- if (isProcessingRef.current) return;
212
- isProcessingRef.current = true;
213
- try {
214
- if (!commitSession) {
215
- throw new Error('Session commit unavailable');
216
- }
217
- const user = await (0, _deviceFlowSignIn.completeDeviceFlowSignIn)({
218
- oxyServices,
219
- sessionId,
220
- sessionToken,
221
- commitSession
222
- });
223
- onSignedInRef.current?.(user);
224
- } catch (err) {
225
- debug.error('Error completing auth:', err);
226
- setError('Authorization successful but failed to complete sign in. Please try again.');
227
- isProcessingRef.current = false;
228
- }
229
- }, [oxyServices, commitSession]);
230
-
231
- // Start polling for authorization.
232
- //
233
- // Idempotent: if a poll interval is already running this is a no-op, so the
234
- // `connect_error` path (which also calls this) cannot stack a second interval
235
- // on top of the always-on poll started in `generateAuthSession`.
236
- const startPolling = (0, _react.useCallback)(sessionToken => {
237
- if (pollingIntervalRef.current) return;
238
- pollingIntervalRef.current = setInterval(async () => {
239
- if (isProcessingRef.current) return;
240
- try {
241
- const response = await oxyServices.makeRequest('GET', `/auth/session/status/${sessionToken}`, undefined, {
242
- cache: false
243
- });
244
- if (response.authorized && response.sessionId) {
245
- cleanup();
246
- // Pass the original sessionToken (in closure) through; the claim
247
- // exchange needs it to mint the first access token.
248
- handleAuthSuccess(response.sessionId, sessionToken);
249
- } else if (response.status === 'cancelled') {
250
- cleanup();
251
- setError('Authorization was denied.');
252
- } else if (response.status === 'expired') {
253
- cleanup();
254
- setError('Session expired. Please try again.');
255
- }
256
- } catch (err) {
257
- // Transient poll error — the next tick retries. Logged, never thrown.
258
- debug.log('Auth polling error:', err);
259
- }
260
- }, POLLING_INTERVAL_MS);
261
- }, [oxyServices, handleAuthSuccess, cleanup]);
262
-
263
- // Connect to the auth-session socket for real-time updates.
264
- const connectSocket = (0, _react.useCallback)(sessionToken => {
265
- const baseURL = oxyServices.getBaseURL();
266
-
267
- // Connect to the auth-session namespace (no authentication required).
268
- const socket = (0, _socket.default)(`${baseURL}/auth-session`, {
269
- transports: ['websocket', 'polling'],
270
- reconnection: true,
271
- reconnectionAttempts: 3,
272
- reconnectionDelay: 1000
273
- });
274
- socketRef.current = socket;
275
- socket.on('connect', () => {
276
- debug.log('Auth socket connected');
277
- socket.emit('join', sessionToken);
278
- });
279
- socket.on('joined', () => {
280
- debug.log('Joined auth session room');
281
- });
282
- socket.on('auth_update', payload => {
283
- debug.log('Auth update received:', payload);
284
- if (payload.status === 'authorized' && payload.sessionId) {
285
- cleanup();
286
- // `sessionToken` is this flow's secret credential (in closure) — pass
287
- // it through so `handleAuthSuccess` can claim the first access token.
288
- handleAuthSuccess(payload.sessionId, sessionToken);
289
- } else if (payload.status === 'cancelled') {
290
- cleanup();
291
- setError('Authorization was denied.');
292
- } else if (payload.status === 'expired') {
293
- cleanup();
294
- setError('Session expired. Please try again.');
295
- }
296
- });
297
- socket.on('connect_error', err => {
298
- debug.log('Socket connection error, falling back to polling:', err instanceof Error ? err.message : null);
299
- // Realtime transport errored — fall back to polling. The poll is
300
- // already running (started unconditionally in `generateAuthSession`),
301
- // so `startPolling` here is a no-op backstop.
302
- socket.disconnect();
303
- startPolling(sessionToken);
304
- });
305
- socket.on('disconnect', () => {
306
- debug.log('Auth socket disconnected');
307
- });
308
- }, [oxyServices, handleAuthSuccess, cleanup, startPolling]);
309
-
310
- // Generate a new auth session.
311
- const generateAuthSession = (0, _react.useCallback)(async () => {
312
- setIsLoading(true);
313
- setError(null);
314
- // Reset the handoff fields for the fresh session (also clears them on retry).
315
- setAuthorizeCode(null);
316
- setQrPayload(null);
317
- isProcessingRef.current = false;
318
-
319
- // The cross-app device sign-in flow identifies the requesting app by its
320
- // real registered OAuth client id (ApplicationCredential publicKey).
321
- // Without it the API cannot resolve the consent identity, so we fail fast
322
- // with a clear configuration error rather than creating a session the
323
- // server would reject.
324
- if (!clientId) {
325
- setError('This app is not configured for sign-in (missing clientId).');
326
- setIsLoading(false);
327
- return;
328
- }
329
- try {
330
- const sessionToken = generateSessionToken();
331
- const expiresAt = Date.now() + AUTH_SESSION_EXPIRY_MS;
332
-
333
- // Register the auth session with the server. The response carries the
334
- // "Sign in with Oxy" handoff fields (public `authorizeCode` + structured
335
- // `qrPayload`) when the handoff backend is deployed; both are optional, so
336
- // the legacy `oxyauth://<token>` QR path keeps working without them.
337
- const createResponse = await oxyServices.makeRequest('POST', '/auth/session/create', {
338
- sessionToken,
339
- expiresAt,
340
- clientId
341
- }, {
342
- cache: false
343
- });
344
- setAuthSession({
345
- sessionToken,
346
- expiresAt
347
- });
348
- setAuthorizeCode(createResponse?.authorizeCode ?? null);
349
- setQrPayload(createResponse?.qrPayload ?? null);
350
- setIsWaiting(true);
351
-
352
- // Socket is the fast path; the poll is a transport-independent backstop
353
- // that guarantees completion even if the socket connects but silently
354
- // never delivers auth_update (RN transport / idle-timeout).
355
- connectSocket(sessionToken);
356
- startPolling(sessionToken);
357
- } catch (err) {
358
- setError((err instanceof Error ? err.message : null) || 'Failed to create auth session');
359
- } finally {
360
- setIsLoading(false);
361
- }
362
- }, [oxyServices, connectSocket, startPolling, clientId]);
363
-
364
- // Open the central Oxy auth approval surface for this device-flow session.
365
- // On web this is a centered popup; on native it opens the system browser,
366
- // carrying a `redirect_uri` so the deep-link return path can complete the
367
- // flow even if the socket/poll is slow.
368
- const openAuthApproval = (0, _react.useCallback)(async () => {
369
- if (!authSession) return;
370
- const authBaseUrl = resolveAuthWebBaseUrl(oxyServices.getBaseURL(), oxyServices.config?.authWebUrl);
371
- const webUrl = new URL('/authorize', authBaseUrl);
372
- webUrl.searchParams.set('token', authSession.sessionToken);
373
- if (_reactNative.Platform.OS === 'web') {
374
- // Open a separate approval window on web for the device-flow token.
375
- const width = 500;
376
- const height = 650;
377
- const screenWidth = window.screen?.width ?? width;
378
- const screenHeight = window.screen?.height ?? height;
379
- const left = (screenWidth - width) / 2;
380
- const top = (screenHeight - height) / 2;
381
- window.open(webUrl.toString(), 'oxy-auth-approval', `width=${width},height=${height},left=${left},top=${top}`);
382
- return;
383
- }
384
-
385
- // Native: carry a redirect URI so the auth web flow can bounce back in.
386
- const redirectUri = await resolveAuthRedirectUri(oxyServices.config?.authRedirectUri);
387
- if (redirectUri) {
388
- webUrl.searchParams.set('redirect_uri', redirectUri);
389
- }
390
- try {
391
- await _reactNative.Linking.openURL(webUrl.toString());
392
- } catch (err) {
393
- debug.error('Unable to open Oxy Auth:', err);
394
- setError('Unable to open Oxy Auth. Please try again or use the QR code.');
395
- }
396
- }, [authSession, oxyServices]);
397
-
398
- // Same-device "Sign in with Oxy" handoff: deep-link to the `qrPayload`
399
- // (`oxycommons://approve?...`) so the native Oxy identity app opens directly
400
- // to approve. The socket / poll already resolves the flow once the approval
401
- // lands, so this only needs to launch the deep link. No-op when the handoff
402
- // backend returned no `qrPayload`.
403
- const openSameDeviceApproval = (0, _react.useCallback)(async () => {
404
- if (!qrPayload) {
405
- return;
406
- }
407
- try {
408
- await _reactNative.Linking.openURL(qrPayload);
409
- } catch (err) {
410
- debug.error('Unable to open the Oxy app for approval:', err);
411
- setError('Unable to open the Oxy app. Scan the QR code from another device instead.');
412
- }
413
- }, [qrPayload]);
414
-
415
- // Tear down and recreate the session (the retry action).
416
- const retry = (0, _react.useCallback)(() => {
417
- cleanup();
418
- generateAuthSession();
419
- }, [generateAuthSession, cleanup]);
420
-
421
- // Handle a native deep-link return carrying the authorized session_id.
422
- const handleAuthRedirect = (0, _react.useCallback)(url => {
423
- const params = getRedirectParams(url);
424
- if (!params) {
425
- return;
426
- }
427
- if (params.error) {
428
- cleanup();
429
- setError('Authorization was denied.');
430
- return;
431
- }
432
- if (params.sessionId) {
433
- // The deep-link return carries only `session_id` — the secret
434
- // `sessionToken` for this flow lives in component state (generated in
435
- // `generateAuthSession`). Without it we cannot claim the first access
436
- // token, so the flow would 401 in `handleAuthSuccess`. If it is somehow
437
- // unavailable, fall through to the socket/poll path (which carries the
438
- // token in closure) rather than attempting an unauthenticated claim.
439
- const flowSessionToken = authSession?.sessionToken;
440
- if (!flowSessionToken) {
441
- return;
442
- }
443
- cleanup();
444
- handleAuthSuccess(params.sessionId, flowSessionToken);
445
- }
446
- }, [authSession, cleanup, handleAuthSuccess]);
447
-
448
- // Initialize the auth session once on mount.
449
- // biome-ignore lint/correctness/useExhaustiveDependencies: this must run exactly once on mount; re-running on `generateAuthSession` identity changes would recreate the session mid-flow.
450
- (0, _react.useEffect)(() => {
451
- generateAuthSession();
452
- // eslint-disable-next-line react-hooks/exhaustive-deps
453
- }, []);
454
-
455
- // Native-only: handle the deep-link return from the auth web flow. Gated to
456
- // native so the web container never carries this listener. The socket / poll
457
- // path still resolves the flow if no deep link arrives.
458
- (0, _react.useEffect)(() => {
459
- if (_reactNative.Platform.OS === 'web') {
460
- return;
461
- }
462
- const subscription = _reactNative.Linking.addEventListener('url', ({
463
- url
464
- }) => {
465
- linkingHandledRef.current = true;
466
- handleAuthRedirect(url);
467
- });
468
- _reactNative.Linking.getInitialURL().then(url => {
469
- if (url && !linkingHandledRef.current) {
470
- handleAuthRedirect(url);
471
- }
472
- }).catch(() => {
473
- // Ignore linking errors; auth will still resolve via socket/polling.
474
- });
475
- return () => {
476
- subscription.remove();
477
- };
478
- }, [handleAuthRedirect]);
479
-
480
- // Clean up subscriptions on unmount.
481
- (0, _react.useEffect)(() => {
482
- return () => {
483
- cleanup();
484
- };
485
- }, [cleanup]);
486
- const qrData = authSession ? `oxyauth://${authSession.sessionToken}` : '';
487
- return {
488
- authSession,
489
- qrData,
490
- authorizeCode,
491
- qrPayload,
492
- isLoading,
493
- error,
494
- isWaiting,
495
- openAuthApproval,
496
- openSameDeviceApproval,
497
- retry,
498
- cleanup
499
- };
500
- }
501
- //# sourceMappingURL=useOxyAuthSession.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_react","require","_reactNative","_socket","_interopRequireDefault","_core","_deviceFlowSignIn","e","__esModule","default","debug","createDebugLogger","OXY_ACCOUNTS_WEB_URL","exports","OXY_AUTH_WEB_URL","AUTH_SESSION_EXPIRY_MS","POLLING_INTERVAL_MS","resolveAuthWebBaseUrl","baseURL","authWebUrl","url","URL","port","origin","hostname","startsWith","slice","resolveAuthRedirectUri","authRedirectUri","initialUrl","Linking","getInitialURL","parsed","search","hash","toString","getRedirectParams","sessionId","searchParams","get","undefined","error","generateSessionToken","bytes","Uint8Array","crypto","getRandomValues","Array","from","b","padStart","join","useOxyAuthSession","oxyServices","clientId","commitSession","options","onSignedIn","authSession","setAuthSession","useState","isLoading","setIsLoading","setError","isWaiting","setIsWaiting","authorizeCode","setAuthorizeCode","qrPayload","setQrPayload","socketRef","useRef","pollingIntervalRef","isProcessingRef","linkingHandledRef","onSignedInRef","current","cleanup","useCallback","disconnect","clearInterval","handleAuthSuccess","sessionToken","Error","user","completeDeviceFlowSignIn","err","startPolling","setInterval","response","makeRequest","cache","authorized","status","log","connectSocket","getBaseURL","socket","io","transports","reconnection","reconnectionAttempts","reconnectionDelay","on","emit","payload","message","generateAuthSession","expiresAt","Date","now","createResponse","openAuthApproval","authBaseUrl","config","webUrl","set","Platform","OS","width","height","screenWidth","window","screen","screenHeight","left","top","open","redirectUri","openURL","openSameDeviceApproval","retry","handleAuthRedirect","params","flowSessionToken","useEffect","subscription","addEventListener","then","catch","remove","qrData"],"sourceRoot":"../../../../src","sources":["ui/hooks/useOxyAuthSession.ts"],"mappings":";;;;;;;AAsBA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,iBAAA,GAAAL,OAAA;AAAwE,SAAAG,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AA3BxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,MAAMG,KAAK,GAAG,IAAAC,uBAAiB,EAAC,mBAAmB,CAAC;;AAEpD;AACA;AACA;AACA;AACA;AACO,MAAMC,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA,GAAG,yBAAyB;;AAE7D;AACO,MAAME,gBAAgB,GAAAD,OAAA,CAAAC,gBAAA,GAAG,qBAAqB;;AAErD;AACO,MAAMC,sBAAsB,GAAAF,OAAA,CAAAE,sBAAA,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI;;AAEnD;AACO,MAAMC,mBAAmB,GAAAH,OAAA,CAAAG,mBAAA,GAAG,IAAI;;AAEvC;;AAQA;AACA;AACA;AACA;AACA;AACA;;AAgBA;;AAgEA;AACA;AACA;AACA;AACA,SAASC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