@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
@@ -0,0 +1,764 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = require("react");
8
+ var _reactNative = require("react-native");
9
+ var _reactNativeGestureHandler = require("react-native-gesture-handler");
10
+ var _vectorIcons = require("@expo/vector-icons");
11
+ var _reactNativeQrcodeSvg = _interopRequireDefault(require("react-native-qrcode-svg"));
12
+ var _avatar = require("@oxyhq/bloom/avatar");
13
+ var _button = require("@oxyhq/bloom/button");
14
+ var _typography = require("@oxyhq/bloom/typography");
15
+ var _theme = require("@oxyhq/bloom/theme");
16
+ var _reactQuery = require("@tanstack/react-query");
17
+ var _OxyContext = require("../context/OxyContext.js");
18
+ var _useI18n = require("../hooks/useI18n.js");
19
+ var _OxyLogo = _interopRequireDefault(require("./OxyLogo.js"));
20
+ var _jsxRuntime = require("react/jsx-runtime");
21
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
22
+ /**
23
+ * OxyAccountDialog — the ONE unified account dialog for `@oxyhq/services`.
24
+ *
25
+ * A thin React Native binding over the headless `AccountDialogController` in
26
+ * `@oxyhq/core` (bound via `useSyncExternalStore`), presented as a bottom-sheet
27
+ * modal. It REPLACES the five drifting device/account surfaces the SDK shipped
28
+ * before (`ProfileMenu`, `AccountMenu`, `AccountSwitcher`, `SignInAccountChooser`,
29
+ * and `SignInModal`) with a single implementation whose data + state machine live
30
+ * in core, so the RN and web (auth-sdk) bindings render the SAME list from the
31
+ * SAME logic and cannot diverge.
32
+ *
33
+ * Views (from `snapshot.view`):
34
+ * - `accounts` — the unified `SwitchableAccount[]` list (device sign-ins ∪ graph
35
+ * accounts). Tapping a row switches through `controller.switchTo(accountId)`
36
+ * (the uniform switch), the active row is flagged, and a "+ Add account" row
37
+ * opens the sign-in entry. This is what `ProfileButton` opens.
38
+ * - `add` / `signin` — the sign-in entry: primary "Sign in with Oxy" (device
39
+ * flow), "Scan a QR", and a secondary "Use a password" hand-off that opens
40
+ * auth.oxy.so (password + 2FA are NOT in the SDK).
41
+ * - `qr` — the cross-device QR handoff + its waiting state.
42
+ *
43
+ * Per-account color re-theming uses Bloom's `APP_COLOR_PRESETS` + `BloomColorScope`
44
+ * (same visual language auth.oxy.so uses). Base theming is `useTheme()` + a
45
+ * `StyleSheet`, so the dialog renders correctly in EVERY consumer — including apps
46
+ * that do not use NativeWind (e.g. the accounts app). Modal contents are wrapped
47
+ * in `<GestureHandlerRootView>` because RN's `Modal` renders into its own window.
48
+ */
49
+
50
+ /** Diameter of a row avatar. */const ROW_AVATAR_SIZE = 40;
51
+ /** High-contrast QR colors — intentionally fixed (NOT themed) for scan reliability. */
52
+ const QR_PLATE_BG = '#FFFFFF';
53
+ const QR_FOREGROUND = '#000000';
54
+ const QR_SIZE = 196;
55
+ const isWeb = _reactNative.Platform.OS === 'web';
56
+
57
+ /**
58
+ * Resolve an account's stored color (a named Bloom preset, e.g. `'purple'`) to
59
+ * a concrete brand hex for the row accent. Falls back to the theme primary when
60
+ * the account has no color or the value is not a recognized preset, so the accent
61
+ * renders in EVERY consumer regardless of NativeWind availability.
62
+ */
63
+ function resolveAccentHex(color, fallback) {
64
+ const preset = toPreset(color);
65
+ return preset ? _theme.APP_COLOR_PRESETS[preset].hex : fallback;
66
+ }
67
+
68
+ /** Narrow a stored color string to a known `AppColorName`, or `undefined`. */
69
+ function toPreset(color) {
70
+ if (!color) return undefined;
71
+ return _theme.APP_COLOR_NAMES.includes(color) ? color : undefined;
72
+ }
73
+ /**
74
+ * The unified account dialog. Mounted once by `OxyProvider`; opened imperatively
75
+ * via `useOxy().openAccountDialog(view?)` (or the back-compat `showSignInModal`).
76
+ */
77
+ const OxyAccountDialog = () => {
78
+ const {
79
+ accountDialogController: controller,
80
+ isAccountDialogOpen,
81
+ closeAccountDialog,
82
+ showBottomSheet,
83
+ logoutAll,
84
+ refreshAccounts
85
+ } = (0, _OxyContext.useOxy)();
86
+ const theme = (0, _theme.useTheme)();
87
+ const {
88
+ t
89
+ } = (0, _useI18n.useI18n)();
90
+ const queryClient = (0, _reactQuery.useQueryClient)();
91
+
92
+ // Bind the headless controller. `getSnapshot` returns a stable reference
93
+ // between changes, so it is `useSyncExternalStore`-safe. Guard the no-provider
94
+ // loading state (`controller` is `null`) with an inert store.
95
+ const subscribe = (0, _react.useCallback)(listener => controller ? controller.subscribe(listener) : () => undefined, [controller]);
96
+ const getSnapshot = (0, _react.useCallback)(() => controller ? controller.getSnapshot() : EMPTY_SNAPSHOT, [controller]);
97
+ const snapshot = (0, _react.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
98
+ const [switching, setSwitching] = (0, _react.useState)(false);
99
+ const handleSwitch = (0, _react.useCallback)(async accountId => {
100
+ if (!controller || switching) return;
101
+ if (accountId === snapshot.activeAccountId) {
102
+ closeAccountDialog();
103
+ return;
104
+ }
105
+ setSwitching(true);
106
+ try {
107
+ await controller.switchTo(accountId);
108
+ // A switch succeeds unless the controller recorded an error. On success
109
+ // reload the app's account graph and drop cached account-scoped data so
110
+ // the new active identity re-fetches — the same side effects the
111
+ // context's own `switchToAccount` performs.
112
+ if (!controller.getSnapshot().error) {
113
+ void refreshAccounts();
114
+ queryClient.invalidateQueries();
115
+ closeAccountDialog();
116
+ }
117
+ } finally {
118
+ setSwitching(false);
119
+ }
120
+ }, [controller, switching, snapshot.activeAccountId, closeAccountDialog, refreshAccounts, queryClient]);
121
+ const handleManage = (0, _react.useCallback)(() => {
122
+ closeAccountDialog();
123
+ showBottomSheet?.('ManageAccount');
124
+ }, [closeAccountDialog, showBottomSheet]);
125
+ const handleSignOutAll = (0, _react.useCallback)(() => {
126
+ closeAccountDialog();
127
+ void logoutAll();
128
+ }, [closeAccountDialog, logoutAll]);
129
+ const handlers = (0, _react.useMemo)(() => ({
130
+ onSwitch: accountId => {
131
+ void handleSwitch(accountId);
132
+ },
133
+ onAdd: () => controller?.add(),
134
+ onManage: handleManage,
135
+ onClose: closeAccountDialog
136
+ }), [handleSwitch, controller, handleManage, closeAccountDialog]);
137
+ if (!isAccountDialogOpen || !controller) {
138
+ return null;
139
+ }
140
+ const {
141
+ view
142
+ } = snapshot;
143
+ const showBack = view === 'qr' || view === 'add' && snapshot.accounts.length > 0;
144
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Modal, {
145
+ visible: true,
146
+ transparent: true,
147
+ animationType: isWeb ? 'fade' : 'slide',
148
+ statusBarTranslucent: true,
149
+ onRequestClose: closeAccountDialog,
150
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeGestureHandler.GestureHandlerRootView, {
151
+ style: styles.root,
152
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
153
+ style: [styles.backdrop, {
154
+ backgroundColor: theme.colors.overlay
155
+ }],
156
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
157
+ style: _reactNative.StyleSheet.absoluteFill,
158
+ onPress: closeAccountDialog,
159
+ accessibilityLabel: t('common.actions.close') || 'Close',
160
+ accessibilityRole: "button"
161
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
162
+ style: [styles.card, isWeb ? styles.cardCentered : styles.cardSheet, {
163
+ backgroundColor: theme.colors.card,
164
+ borderColor: theme.colors.border
165
+ }],
166
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(DialogHeader, {
167
+ snapshot: snapshot,
168
+ theme: theme,
169
+ t: t,
170
+ showBack: showBack,
171
+ onBack: () => controller.setView('accounts'),
172
+ onClose: closeAccountDialog
173
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ScrollView, {
174
+ style: styles.body,
175
+ contentContainerStyle: styles.bodyContent,
176
+ showsVerticalScrollIndicator: false,
177
+ children: view === 'accounts' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(AccountsView, {
178
+ snapshot: snapshot,
179
+ theme: theme,
180
+ t: t,
181
+ handlers: handlers
182
+ }) : view === 'qr' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(QrView, {
183
+ snapshot: snapshot,
184
+ theme: theme,
185
+ t: t,
186
+ onRetry: () => void controller.showQr()
187
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(SignInView, {
188
+ snapshot: snapshot,
189
+ theme: theme,
190
+ t: t,
191
+ handlers: handlers,
192
+ onSignInWithOxy: () => void controller.signInWithOxy(),
193
+ onScanQr: () => void controller.showQr(),
194
+ onUsePassword: () => controller.openPasswordAtOxyAuth({
195
+ returnUrl: isWeb ? currentHref() : undefined
196
+ })
197
+ })
198
+ })]
199
+ })]
200
+ })
201
+ })
202
+ });
203
+ };
204
+
205
+ // ---------------------------------------------------------------------------
206
+ // Header
207
+ // ---------------------------------------------------------------------------
208
+
209
+ const DialogHeader = ({
210
+ snapshot,
211
+ theme,
212
+ t,
213
+ showBack,
214
+ onBack,
215
+ onClose
216
+ }) => {
217
+ const {
218
+ title,
219
+ subtitle
220
+ } = headerCopy(snapshot.view, snapshot.accounts.length, t);
221
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
222
+ style: styles.header,
223
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
224
+ style: styles.headerBar,
225
+ children: [showBack ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
226
+ onPress: onBack,
227
+ style: [styles.iconButton, {
228
+ backgroundColor: theme.colors.backgroundSecondary
229
+ }],
230
+ accessibilityRole: "button",
231
+ accessibilityLabel: t('common.actions.back') || 'Back',
232
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_vectorIcons.MaterialCommunityIcons, {
233
+ name: "chevron-left",
234
+ size: 22,
235
+ color: theme.colors.textSecondary
236
+ })
237
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
238
+ style: styles.iconButton
239
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyLogo.default, {
240
+ variant: "icon",
241
+ size: 34,
242
+ fillColor: theme.colors.primary
243
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
244
+ onPress: onClose,
245
+ style: [styles.iconButton, {
246
+ backgroundColor: theme.colors.backgroundSecondary
247
+ }],
248
+ accessibilityRole: "button",
249
+ accessibilityLabel: t('common.actions.close') || 'Close',
250
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_vectorIcons.MaterialCommunityIcons, {
251
+ name: "close",
252
+ size: 20,
253
+ color: theme.colors.textSecondary
254
+ })
255
+ })]
256
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_typography.Text, {
257
+ style: [styles.title, {
258
+ color: theme.colors.text
259
+ }],
260
+ numberOfLines: 1,
261
+ children: title
262
+ }), subtitle ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_typography.Text, {
263
+ style: [styles.subtitle, {
264
+ color: theme.colors.textSecondary
265
+ }],
266
+ numberOfLines: 2,
267
+ children: subtitle
268
+ }) : null]
269
+ });
270
+ };
271
+
272
+ // ---------------------------------------------------------------------------
273
+ // Accounts view
274
+ // ---------------------------------------------------------------------------
275
+
276
+ const AccountsView = ({
277
+ snapshot,
278
+ theme,
279
+ t,
280
+ handlers
281
+ }) => {
282
+ if (snapshot.loading && snapshot.accounts.length === 0) {
283
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
284
+ style: styles.centeredBlock,
285
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_vectorIcons.MaterialCommunityIcons, {
286
+ name: "loading",
287
+ size: 24,
288
+ color: theme.colors.textSecondary
289
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_typography.Text, {
290
+ style: [styles.mutedText, {
291
+ color: theme.colors.textSecondary
292
+ }],
293
+ children: t('accountSwitcher.loading') || 'Loading accounts…'
294
+ })]
295
+ });
296
+ }
297
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
298
+ style: styles.rows,
299
+ children: [snapshot.accounts.map(account => /*#__PURE__*/(0, _jsxRuntime.jsx)(AccountRow, {
300
+ account: account,
301
+ theme: theme,
302
+ switching: snapshot.switchingAccountId === account.accountId,
303
+ disabled: snapshot.switchingAccountId !== null,
304
+ onPress: () => handlers.onSwitch(account.accountId)
305
+ }, account.accountId)), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
306
+ style: [styles.addRow, {
307
+ borderColor: theme.colors.border
308
+ }],
309
+ onPress: handlers.onAdd,
310
+ accessibilityRole: "button",
311
+ accessibilityLabel: t('signin.addAccountTitle') || 'Add another account',
312
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
313
+ style: [styles.addBadge, {
314
+ borderColor: theme.colors.border
315
+ }],
316
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_vectorIcons.MaterialCommunityIcons, {
317
+ name: "plus",
318
+ size: 20,
319
+ color: theme.colors.textSecondary
320
+ })
321
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_typography.Text, {
322
+ style: [styles.rowName, {
323
+ color: theme.colors.textSecondary
324
+ }],
325
+ children: t('signin.addAccountTitle') || 'Add another account'
326
+ })]
327
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
328
+ style: styles.footerLinks,
329
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
330
+ onPress: handlers.onManage,
331
+ accessibilityRole: "button",
332
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_typography.Text, {
333
+ style: [styles.linkText, {
334
+ color: theme.colors.primary
335
+ }],
336
+ children: t('accountMenu.manage') || 'Manage accounts'
337
+ })
338
+ })
339
+ })]
340
+ });
341
+ };
342
+ const AccountRow = ({
343
+ account,
344
+ theme,
345
+ switching,
346
+ disabled,
347
+ onPress
348
+ }) => {
349
+ const accent = resolveAccentHex(account.color, theme.colors.primary);
350
+ const rowStyle = [styles.accountRow, {
351
+ borderColor: account.isCurrent ? accent : theme.colors.border,
352
+ backgroundColor: theme.colors.card
353
+ }, disabled && !switching ? styles.rowDisabled : null];
354
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_theme.BloomColorScope, {
355
+ colorPreset: toPreset(account.color),
356
+ asChild: true,
357
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
358
+ style: rowStyle,
359
+ onPress: onPress,
360
+ disabled: disabled,
361
+ accessibilityRole: "button",
362
+ accessibilityState: {
363
+ selected: account.isCurrent,
364
+ disabled
365
+ },
366
+ accessibilityLabel: account.displayName,
367
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
368
+ style: [styles.avatarRing, {
369
+ borderColor: account.isCurrent ? accent : 'transparent'
370
+ }],
371
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_avatar.Avatar, {
372
+ source: account.user.avatar ?? undefined,
373
+ variant: "thumb",
374
+ name: account.displayName,
375
+ size: ROW_AVATAR_SIZE
376
+ })
377
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
378
+ style: styles.rowMeta,
379
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_typography.Text, {
380
+ style: [styles.rowName, {
381
+ color: theme.colors.text
382
+ }],
383
+ numberOfLines: 1,
384
+ children: account.displayName
385
+ }), account.email ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_typography.Text, {
386
+ style: [styles.rowHandle, {
387
+ color: theme.colors.textSecondary
388
+ }],
389
+ numberOfLines: 1,
390
+ children: account.email
391
+ }) : null]
392
+ }), switching ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_vectorIcons.MaterialCommunityIcons, {
393
+ name: "loading",
394
+ size: 20,
395
+ color: accent
396
+ }) : account.isCurrent ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_vectorIcons.MaterialCommunityIcons, {
397
+ name: "check-circle",
398
+ size: 20,
399
+ color: accent
400
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_vectorIcons.MaterialCommunityIcons, {
401
+ name: "chevron-right",
402
+ size: 20,
403
+ color: theme.colors.textSecondary
404
+ })]
405
+ })
406
+ });
407
+ };
408
+
409
+ // ---------------------------------------------------------------------------
410
+ // Sign-in view (add / signin)
411
+ // ---------------------------------------------------------------------------
412
+
413
+ const SignInView = ({
414
+ snapshot,
415
+ theme,
416
+ t,
417
+ handlers,
418
+ onSignInWithOxy,
419
+ onScanQr,
420
+ onUsePassword
421
+ }) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
422
+ style: styles.signInBlock,
423
+ children: [snapshot.accounts.length > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
424
+ style: styles.rows,
425
+ children: [snapshot.accounts.map(account => /*#__PURE__*/(0, _jsxRuntime.jsx)(AccountRow, {
426
+ account: account,
427
+ theme: theme,
428
+ switching: snapshot.switchingAccountId === account.accountId,
429
+ disabled: snapshot.switchingAccountId !== null,
430
+ onPress: () => handlers.onSwitch(account.accountId)
431
+ }, account.accountId)), /*#__PURE__*/(0, _jsxRuntime.jsx)(Dividerish, {
432
+ theme: theme,
433
+ label: t('signin.or') || 'or'
434
+ })]
435
+ }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_button.Button, {
436
+ variant: "primary",
437
+ onPress: onSignInWithOxy,
438
+ style: styles.primaryButton,
439
+ children: "Sign in with Oxy"
440
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_button.Button, {
441
+ variant: "secondary",
442
+ onPress: onScanQr,
443
+ style: styles.secondaryButton,
444
+ children: t('accountSwitcher.scanQr') || 'Scan a QR from another device'
445
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
446
+ onPress: onUsePassword,
447
+ accessibilityRole: "button",
448
+ style: styles.passwordLink,
449
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_typography.Text, {
450
+ style: [styles.linkText, {
451
+ color: theme.colors.textSecondary
452
+ }],
453
+ children: "Use a password instead"
454
+ })
455
+ })]
456
+ });
457
+ const Dividerish = ({
458
+ theme,
459
+ label
460
+ }) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
461
+ style: styles.dividerRow,
462
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
463
+ style: [styles.dividerLine, {
464
+ backgroundColor: theme.colors.border
465
+ }]
466
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_typography.Text, {
467
+ style: [styles.dividerText, {
468
+ color: theme.colors.textSecondary
469
+ }],
470
+ children: label
471
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
472
+ style: [styles.dividerLine, {
473
+ backgroundColor: theme.colors.border
474
+ }]
475
+ })]
476
+ });
477
+
478
+ // ---------------------------------------------------------------------------
479
+ // QR view
480
+ // ---------------------------------------------------------------------------
481
+
482
+ const QrView = ({
483
+ snapshot,
484
+ theme,
485
+ t,
486
+ onRetry
487
+ }) => {
488
+ const {
489
+ signIn
490
+ } = snapshot;
491
+ if (signIn.phase === 'error') {
492
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
493
+ style: styles.centeredBlock,
494
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_typography.Text, {
495
+ style: [styles.errorText, {
496
+ color: theme.colors.error
497
+ }],
498
+ children: signIn.error || 'Sign-in failed. Please try again.'
499
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_button.Button, {
500
+ variant: "secondary",
501
+ onPress: onRetry,
502
+ style: styles.secondaryButton,
503
+ children: t('common.actions.tryAgain') || 'Try again'
504
+ })]
505
+ });
506
+ }
507
+ if (signIn.phase === 'starting' || signIn.phase === 'authorized' || !signIn.qrPayload) {
508
+ const label = signIn.phase === 'authorized' ? t('signin.status.signingIn') || 'Signing in…' : t('accountSwitcher.loading') || 'Preparing sign-in…';
509
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
510
+ style: styles.centeredBlock,
511
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_vectorIcons.MaterialCommunityIcons, {
512
+ name: "loading",
513
+ size: 26,
514
+ color: theme.colors.primary
515
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_typography.Text, {
516
+ style: [styles.mutedText, {
517
+ color: theme.colors.textSecondary
518
+ }],
519
+ children: label
520
+ })]
521
+ });
522
+ }
523
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
524
+ style: styles.centeredBlock,
525
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
526
+ style: styles.qrPlate,
527
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeQrcodeSvg.default, {
528
+ value: signIn.qrPayload,
529
+ size: QR_SIZE,
530
+ backgroundColor: QR_PLATE_BG,
531
+ color: QR_FOREGROUND
532
+ })
533
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_typography.Text, {
534
+ style: [styles.mutedText, {
535
+ color: theme.colors.textSecondary
536
+ }],
537
+ children: t('accountSwitcher.scanWithOxy') || 'Scan with any Oxy app and approve.'
538
+ })]
539
+ });
540
+ };
541
+
542
+ // ---------------------------------------------------------------------------
543
+ // Copy + helpers
544
+ // ---------------------------------------------------------------------------
545
+
546
+ function headerCopy(view, accountCount, t) {
547
+ switch (view) {
548
+ case 'accounts':
549
+ return {
550
+ title: t('accountSwitcher.sections.yourAccounts') || 'Your accounts',
551
+ subtitle: t('signin.chooser.subtitle') || 'Choose which account to continue with.'
552
+ };
553
+ case 'qr':
554
+ return {
555
+ title: t('accountSwitcher.scanTitle') || 'Scan with Oxy',
556
+ subtitle: t('accountSwitcher.scanSubtitle') || 'Approve from your phone.'
557
+ };
558
+ default:
559
+ return accountCount > 0 ? {
560
+ title: t('signin.addAccountTitle') || 'Add another account',
561
+ subtitle: t('signin.addAccountSubtitle') || 'Sign in with another account.'
562
+ } : {
563
+ title: t('signin.title') || 'Sign in',
564
+ subtitle: t('signin.subtitle') || 'One identity for the whole ecosystem.'
565
+ };
566
+ }
567
+ }
568
+
569
+ /** Current document URL on web; `undefined` where `location` is absent. */
570
+ function currentHref() {
571
+ const location = globalThis.location;
572
+ return typeof location?.href === 'string' ? location.href : undefined;
573
+ }
574
+ const EMPTY_SNAPSHOT = {
575
+ view: 'accounts',
576
+ accounts: [],
577
+ activeAccountId: null,
578
+ loading: false,
579
+ error: null,
580
+ switchingAccountId: null,
581
+ signIn: {
582
+ phase: 'idle',
583
+ authorizeCode: null,
584
+ qrPayload: null,
585
+ expiresAt: null,
586
+ error: null
587
+ }
588
+ };
589
+ const styles = _reactNative.StyleSheet.create({
590
+ root: {
591
+ flex: 1
592
+ },
593
+ backdrop: {
594
+ flex: 1,
595
+ justifyContent: isWeb ? 'center' : 'flex-end',
596
+ alignItems: 'center'
597
+ },
598
+ card: {
599
+ width: '100%',
600
+ maxWidth: 420,
601
+ borderWidth: _reactNative.StyleSheet.hairlineWidth,
602
+ paddingHorizontal: 20,
603
+ paddingTop: 16,
604
+ paddingBottom: 24
605
+ },
606
+ cardCentered: {
607
+ borderRadius: 28
608
+ },
609
+ cardSheet: {
610
+ borderTopLeftRadius: 28,
611
+ borderTopRightRadius: 28
612
+ },
613
+ header: {
614
+ alignItems: 'center',
615
+ marginBottom: 12
616
+ },
617
+ headerBar: {
618
+ width: '100%',
619
+ flexDirection: 'row',
620
+ alignItems: 'center',
621
+ justifyContent: 'space-between',
622
+ marginBottom: 8
623
+ },
624
+ iconButton: {
625
+ width: 32,
626
+ height: 32,
627
+ borderRadius: 16,
628
+ alignItems: 'center',
629
+ justifyContent: 'center'
630
+ },
631
+ title: {
632
+ fontSize: 22,
633
+ fontWeight: '800',
634
+ letterSpacing: -0.4,
635
+ textAlign: 'center',
636
+ marginTop: 6
637
+ },
638
+ subtitle: {
639
+ fontSize: 14,
640
+ lineHeight: 19,
641
+ textAlign: 'center',
642
+ marginTop: 4
643
+ },
644
+ body: {
645
+ width: '100%'
646
+ },
647
+ bodyContent: {
648
+ paddingTop: 4,
649
+ paddingBottom: 4
650
+ },
651
+ rows: {
652
+ width: '100%',
653
+ gap: 8
654
+ },
655
+ accountRow: {
656
+ flexDirection: 'row',
657
+ alignItems: 'center',
658
+ gap: 12,
659
+ borderWidth: _reactNative.StyleSheet.hairlineWidth,
660
+ borderRadius: 16,
661
+ paddingVertical: 10,
662
+ paddingHorizontal: 12
663
+ },
664
+ rowDisabled: {
665
+ opacity: 0.6
666
+ },
667
+ avatarRing: {
668
+ borderRadius: 9999,
669
+ borderWidth: 2,
670
+ padding: 1
671
+ },
672
+ rowMeta: {
673
+ flex: 1,
674
+ minWidth: 0
675
+ },
676
+ rowName: {
677
+ fontSize: 15,
678
+ fontWeight: '600'
679
+ },
680
+ rowHandle: {
681
+ fontSize: 12.5,
682
+ marginTop: 1
683
+ },
684
+ addRow: {
685
+ flexDirection: 'row',
686
+ alignItems: 'center',
687
+ gap: 12,
688
+ borderWidth: _reactNative.StyleSheet.hairlineWidth,
689
+ borderStyle: 'dashed',
690
+ borderRadius: 16,
691
+ paddingVertical: 10,
692
+ paddingHorizontal: 12,
693
+ marginTop: 8
694
+ },
695
+ addBadge: {
696
+ width: ROW_AVATAR_SIZE,
697
+ height: ROW_AVATAR_SIZE,
698
+ borderRadius: 9999,
699
+ borderWidth: _reactNative.StyleSheet.hairlineWidth,
700
+ alignItems: 'center',
701
+ justifyContent: 'center'
702
+ },
703
+ footerLinks: {
704
+ alignItems: 'center',
705
+ marginTop: 16
706
+ },
707
+ linkText: {
708
+ fontSize: 14,
709
+ fontWeight: '600'
710
+ },
711
+ signInBlock: {
712
+ width: '100%'
713
+ },
714
+ primaryButton: {
715
+ width: '100%',
716
+ borderRadius: 14,
717
+ marginTop: 8
718
+ },
719
+ secondaryButton: {
720
+ width: '100%',
721
+ borderRadius: 14,
722
+ marginTop: 10
723
+ },
724
+ passwordLink: {
725
+ alignSelf: 'center',
726
+ paddingVertical: 10,
727
+ marginTop: 12
728
+ },
729
+ dividerRow: {
730
+ flexDirection: 'row',
731
+ alignItems: 'center',
732
+ width: '100%',
733
+ marginVertical: 14
734
+ },
735
+ dividerLine: {
736
+ flex: 1,
737
+ height: _reactNative.StyleSheet.hairlineWidth
738
+ },
739
+ dividerText: {
740
+ marginHorizontal: 12,
741
+ fontSize: 13
742
+ },
743
+ centeredBlock: {
744
+ alignItems: 'center',
745
+ justifyContent: 'center',
746
+ gap: 12,
747
+ paddingVertical: 24
748
+ },
749
+ mutedText: {
750
+ fontSize: 14,
751
+ textAlign: 'center'
752
+ },
753
+ errorText: {
754
+ fontSize: 14,
755
+ textAlign: 'center'
756
+ },
757
+ qrPlate: {
758
+ padding: 16,
759
+ borderRadius: 16,
760
+ backgroundColor: QR_PLATE_BG
761
+ }
762
+ });
763
+ var _default = exports.default = OxyAccountDialog;
764
+ //# sourceMappingURL=OxyAccountDialog.js.map