@thunderid/nextjs 1.13.0 → 1.14.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 (259) hide show
  1. package/dist/cjs/client/components/account/OrganizationUnitSwitcher/OrganizationUnitSwitcher.cjs +116 -0
  2. package/dist/cjs/client/components/account/OrganizationUnitSwitcher/OrganizationUnitSwitcher.cjs.map +1 -0
  3. package/dist/cjs/client/components/auth/SignIn/SignIn.cjs +3 -2
  4. package/dist/cjs/client/components/auth/SignIn/SignIn.cjs.map +1 -1
  5. package/dist/cjs/client/components/{admin → management}/AgentCreate/AgentCreate.cjs +1 -1
  6. package/dist/cjs/client/components/management/AgentCreate/AgentCreate.cjs.map +1 -0
  7. package/dist/cjs/client/components/{admin → management}/AgentDetails/AgentDetails.cjs +1 -1
  8. package/dist/cjs/client/components/management/AgentDetails/AgentDetails.cjs.map +1 -0
  9. package/dist/cjs/client/components/{admin → management}/AgentList/AgentList.cjs +1 -1
  10. package/dist/cjs/client/components/management/AgentList/AgentList.cjs.map +1 -0
  11. package/dist/cjs/client/components/{admin → management}/ApplicationCreate/ApplicationCreate.cjs +1 -1
  12. package/dist/cjs/client/components/management/ApplicationCreate/ApplicationCreate.cjs.map +1 -0
  13. package/dist/cjs/client/components/{admin → management}/ApplicationDetails/ApplicationDetails.cjs +1 -1
  14. package/dist/cjs/client/components/management/ApplicationDetails/ApplicationDetails.cjs.map +1 -0
  15. package/dist/cjs/client/components/{admin → management}/ApplicationList/ApplicationList.cjs +1 -1
  16. package/dist/cjs/client/components/management/ApplicationList/ApplicationList.cjs.map +1 -0
  17. package/dist/cjs/client/components/{admin → management}/GroupCreate/GroupCreate.cjs +1 -1
  18. package/dist/cjs/client/components/management/GroupCreate/GroupCreate.cjs.map +1 -0
  19. package/dist/cjs/client/components/management/GroupDetails/GroupDetails.cjs +28 -0
  20. package/dist/cjs/client/components/management/GroupDetails/GroupDetails.cjs.map +1 -0
  21. package/dist/cjs/client/components/{admin → management}/GroupList/GroupList.cjs +1 -1
  22. package/dist/cjs/client/components/management/GroupList/GroupList.cjs.map +1 -0
  23. package/dist/cjs/client/components/{admin → management}/GroupMembers/GroupMembers.cjs +1 -1
  24. package/dist/cjs/client/components/management/GroupMembers/GroupMembers.cjs.map +1 -0
  25. package/dist/cjs/client/components/management/OrganizationUnitCreate/OrganizationUnitCreate.cjs +28 -0
  26. package/dist/cjs/client/components/management/OrganizationUnitCreate/OrganizationUnitCreate.cjs.map +1 -0
  27. package/dist/cjs/client/components/management/OrganizationUnitDetails/OrganizationUnitDetails.cjs +28 -0
  28. package/dist/cjs/client/components/management/OrganizationUnitDetails/OrganizationUnitDetails.cjs.map +1 -0
  29. package/dist/cjs/client/components/management/OrganizationUnitList/OrganizationUnitList.cjs +28 -0
  30. package/dist/cjs/client/components/management/OrganizationUnitList/OrganizationUnitList.cjs.map +1 -0
  31. package/dist/cjs/client/components/management/ProjectCreate/ProjectCreate.cjs +28 -0
  32. package/dist/cjs/client/components/management/ProjectCreate/ProjectCreate.cjs.map +1 -0
  33. package/dist/cjs/client/components/management/ProjectDetails/ProjectDetails.cjs +28 -0
  34. package/dist/cjs/client/components/management/ProjectDetails/ProjectDetails.cjs.map +1 -0
  35. package/dist/cjs/client/components/management/ProjectList/ProjectList.cjs +28 -0
  36. package/dist/cjs/client/components/management/ProjectList/ProjectList.cjs.map +1 -0
  37. package/dist/cjs/client/components/management/ProjectSwitcher/ProjectSwitcher.cjs +30 -0
  38. package/dist/cjs/client/components/management/ProjectSwitcher/ProjectSwitcher.cjs.map +1 -0
  39. package/dist/cjs/client/components/{admin → management}/RoleAssignments/RoleAssignments.cjs +1 -1
  40. package/dist/cjs/client/components/management/RoleAssignments/RoleAssignments.cjs.map +1 -0
  41. package/dist/cjs/client/components/{admin → management}/RoleCreate/RoleCreate.cjs +1 -1
  42. package/dist/cjs/client/components/management/RoleCreate/RoleCreate.cjs.map +1 -0
  43. package/dist/cjs/client/components/management/RoleDetails/RoleDetails.cjs +28 -0
  44. package/dist/cjs/client/components/management/RoleDetails/RoleDetails.cjs.map +1 -0
  45. package/dist/cjs/client/components/{admin → management}/RoleList/RoleList.cjs +1 -1
  46. package/dist/cjs/client/components/management/RoleList/RoleList.cjs.map +1 -0
  47. package/dist/cjs/client/components/{admin → management}/RolePermissions/RolePermissions.cjs +1 -1
  48. package/dist/cjs/client/components/management/RolePermissions/RolePermissions.cjs.map +1 -0
  49. package/dist/cjs/client/components/management/SharingPolicies/SharingPolicies.cjs +28 -0
  50. package/dist/cjs/client/components/management/SharingPolicies/SharingPolicies.cjs.map +1 -0
  51. package/dist/cjs/client/components/{admin → management}/UserCreate/UserCreate.cjs +1 -1
  52. package/dist/cjs/client/components/management/UserCreate/UserCreate.cjs.map +1 -0
  53. package/dist/cjs/client/components/{admin → management}/UserDetails/UserDetails.cjs +1 -1
  54. package/dist/cjs/client/components/management/UserDetails/UserDetails.cjs.map +1 -0
  55. package/dist/cjs/client/components/{admin → management}/UserList/UserList.cjs +1 -1
  56. package/dist/cjs/client/components/management/UserList/UserList.cjs.map +1 -0
  57. package/dist/cjs/client/contexts/ThunderID/ThunderIDProvider.cjs +53 -2
  58. package/dist/cjs/client/contexts/ThunderID/ThunderIDProvider.cjs.map +1 -1
  59. package/dist/cjs/client/index.cjs +28 -17
  60. package/dist/cjs/index.cjs +98 -16
  61. package/dist/cjs/server/actions/account/getAccessibleOrganizationUnitsAction.cjs +53 -0
  62. package/dist/cjs/server/actions/account/getAccessibleOrganizationUnitsAction.cjs.map +1 -0
  63. package/dist/cjs/server/actions/account/getCurrentOrganizationUnitAction.cjs +31 -0
  64. package/dist/cjs/server/actions/account/getCurrentOrganizationUnitAction.cjs.map +1 -0
  65. package/dist/cjs/server/actions/auth/switchOrganizationUnitAction.cjs +85 -0
  66. package/dist/cjs/server/actions/auth/switchOrganizationUnitAction.cjs.map +1 -0
  67. package/dist/cjs/server/thunderid.cjs +16 -0
  68. package/dist/cjs/server/thunderid.cjs.map +1 -1
  69. package/dist/client/components/account/OrganizationUnitSwitcher/OrganizationUnitSwitcher.d.ts +24 -0
  70. package/dist/client/components/account/OrganizationUnitSwitcher/OrganizationUnitSwitcher.d.ts.map +1 -0
  71. package/dist/client/components/account/OrganizationUnitSwitcher/OrganizationUnitSwitcher.js +112 -0
  72. package/dist/client/components/account/OrganizationUnitSwitcher/OrganizationUnitSwitcher.js.map +1 -0
  73. package/dist/client/components/auth/SignIn/SignIn.d.ts +7 -1
  74. package/dist/client/components/auth/SignIn/SignIn.d.ts.map +1 -1
  75. package/dist/client/components/auth/SignIn/SignIn.js +3 -2
  76. package/dist/client/components/auth/SignIn/SignIn.js.map +1 -1
  77. package/dist/client/components/management/AgentCreate/AgentCreate.d.ts.map +1 -0
  78. package/dist/client/components/{admin → management}/AgentCreate/AgentCreate.js +1 -1
  79. package/dist/client/components/management/AgentCreate/AgentCreate.js.map +1 -0
  80. package/dist/client/components/management/AgentDetails/AgentDetails.d.ts.map +1 -0
  81. package/dist/client/components/{admin → management}/AgentDetails/AgentDetails.js +1 -1
  82. package/dist/client/components/management/AgentDetails/AgentDetails.js.map +1 -0
  83. package/dist/client/components/management/AgentList/AgentList.d.ts.map +1 -0
  84. package/dist/client/components/{admin → management}/AgentList/AgentList.js +1 -1
  85. package/dist/client/components/management/AgentList/AgentList.js.map +1 -0
  86. package/dist/client/components/management/ApplicationCreate/ApplicationCreate.d.ts.map +1 -0
  87. package/dist/client/components/{admin → management}/ApplicationCreate/ApplicationCreate.js +1 -1
  88. package/dist/client/components/management/ApplicationCreate/ApplicationCreate.js.map +1 -0
  89. package/dist/client/components/management/ApplicationDetails/ApplicationDetails.d.ts.map +1 -0
  90. package/dist/client/components/{admin → management}/ApplicationDetails/ApplicationDetails.js +1 -1
  91. package/dist/client/components/management/ApplicationDetails/ApplicationDetails.js.map +1 -0
  92. package/dist/client/components/management/ApplicationList/ApplicationList.d.ts.map +1 -0
  93. package/dist/client/components/{admin → management}/ApplicationList/ApplicationList.js +1 -1
  94. package/dist/client/components/management/ApplicationList/ApplicationList.js.map +1 -0
  95. package/dist/client/components/management/GroupCreate/GroupCreate.d.ts.map +1 -0
  96. package/dist/client/components/{admin → management}/GroupCreate/GroupCreate.js +1 -1
  97. package/dist/client/components/management/GroupCreate/GroupCreate.js.map +1 -0
  98. package/dist/client/components/management/GroupDetails/GroupDetails.d.ts +17 -0
  99. package/dist/client/components/management/GroupDetails/GroupDetails.d.ts.map +1 -0
  100. package/dist/client/components/management/GroupDetails/GroupDetails.js +25 -0
  101. package/dist/client/components/management/GroupDetails/GroupDetails.js.map +1 -0
  102. package/dist/client/components/management/GroupList/GroupList.d.ts.map +1 -0
  103. package/dist/client/components/{admin → management}/GroupList/GroupList.js +1 -1
  104. package/dist/client/components/management/GroupList/GroupList.js.map +1 -0
  105. package/dist/client/components/management/GroupMembers/GroupMembers.d.ts.map +1 -0
  106. package/dist/client/components/{admin → management}/GroupMembers/GroupMembers.js +1 -1
  107. package/dist/client/components/management/GroupMembers/GroupMembers.js.map +1 -0
  108. package/dist/client/components/management/OrganizationUnitCreate/OrganizationUnitCreate.d.ts +17 -0
  109. package/dist/client/components/management/OrganizationUnitCreate/OrganizationUnitCreate.d.ts.map +1 -0
  110. package/dist/client/components/management/OrganizationUnitCreate/OrganizationUnitCreate.js +25 -0
  111. package/dist/client/components/management/OrganizationUnitCreate/OrganizationUnitCreate.js.map +1 -0
  112. package/dist/client/components/management/OrganizationUnitDetails/OrganizationUnitDetails.d.ts +17 -0
  113. package/dist/client/components/management/OrganizationUnitDetails/OrganizationUnitDetails.d.ts.map +1 -0
  114. package/dist/client/components/management/OrganizationUnitDetails/OrganizationUnitDetails.js +25 -0
  115. package/dist/client/components/management/OrganizationUnitDetails/OrganizationUnitDetails.js.map +1 -0
  116. package/dist/client/components/management/OrganizationUnitList/OrganizationUnitList.d.ts +17 -0
  117. package/dist/client/components/management/OrganizationUnitList/OrganizationUnitList.d.ts.map +1 -0
  118. package/dist/client/components/management/OrganizationUnitList/OrganizationUnitList.js +25 -0
  119. package/dist/client/components/management/OrganizationUnitList/OrganizationUnitList.js.map +1 -0
  120. package/dist/client/components/management/ProjectCreate/ProjectCreate.d.ts +17 -0
  121. package/dist/client/components/management/ProjectCreate/ProjectCreate.d.ts.map +1 -0
  122. package/dist/client/components/management/ProjectCreate/ProjectCreate.js +25 -0
  123. package/dist/client/components/management/ProjectCreate/ProjectCreate.js.map +1 -0
  124. package/dist/client/components/management/ProjectDetails/ProjectDetails.d.ts +17 -0
  125. package/dist/client/components/management/ProjectDetails/ProjectDetails.d.ts.map +1 -0
  126. package/dist/client/components/management/ProjectDetails/ProjectDetails.js +25 -0
  127. package/dist/client/components/management/ProjectDetails/ProjectDetails.js.map +1 -0
  128. package/dist/client/components/management/ProjectList/ProjectList.d.ts +17 -0
  129. package/dist/client/components/management/ProjectList/ProjectList.d.ts.map +1 -0
  130. package/dist/client/components/management/ProjectList/ProjectList.js +25 -0
  131. package/dist/client/components/management/ProjectList/ProjectList.js.map +1 -0
  132. package/dist/client/components/management/ProjectSwitcher/ProjectSwitcher.d.ts +19 -0
  133. package/dist/client/components/management/ProjectSwitcher/ProjectSwitcher.d.ts.map +1 -0
  134. package/dist/client/components/management/ProjectSwitcher/ProjectSwitcher.js +27 -0
  135. package/dist/client/components/management/ProjectSwitcher/ProjectSwitcher.js.map +1 -0
  136. package/dist/client/components/management/RoleAssignments/RoleAssignments.d.ts.map +1 -0
  137. package/dist/client/components/{admin → management}/RoleAssignments/RoleAssignments.js +1 -1
  138. package/dist/client/components/management/RoleAssignments/RoleAssignments.js.map +1 -0
  139. package/dist/client/components/management/RoleCreate/RoleCreate.d.ts.map +1 -0
  140. package/dist/client/components/{admin → management}/RoleCreate/RoleCreate.js +1 -1
  141. package/dist/client/components/management/RoleCreate/RoleCreate.js.map +1 -0
  142. package/dist/client/components/management/RoleDetails/RoleDetails.d.ts +17 -0
  143. package/dist/client/components/management/RoleDetails/RoleDetails.d.ts.map +1 -0
  144. package/dist/client/components/management/RoleDetails/RoleDetails.js +25 -0
  145. package/dist/client/components/management/RoleDetails/RoleDetails.js.map +1 -0
  146. package/dist/client/components/management/RoleList/RoleList.d.ts.map +1 -0
  147. package/dist/client/components/{admin → management}/RoleList/RoleList.js +1 -1
  148. package/dist/client/components/management/RoleList/RoleList.js.map +1 -0
  149. package/dist/client/components/management/RolePermissions/RolePermissions.d.ts.map +1 -0
  150. package/dist/client/components/{admin → management}/RolePermissions/RolePermissions.js +1 -1
  151. package/dist/client/components/management/RolePermissions/RolePermissions.js.map +1 -0
  152. package/dist/client/components/management/SharingPolicies/SharingPolicies.d.ts +17 -0
  153. package/dist/client/components/management/SharingPolicies/SharingPolicies.d.ts.map +1 -0
  154. package/dist/client/components/management/SharingPolicies/SharingPolicies.js +25 -0
  155. package/dist/client/components/management/SharingPolicies/SharingPolicies.js.map +1 -0
  156. package/dist/client/components/management/UserCreate/UserCreate.d.ts.map +1 -0
  157. package/dist/client/components/{admin → management}/UserCreate/UserCreate.js +1 -1
  158. package/dist/client/components/management/UserCreate/UserCreate.js.map +1 -0
  159. package/dist/client/components/management/UserDetails/UserDetails.d.ts.map +1 -0
  160. package/dist/client/components/{admin → management}/UserDetails/UserDetails.js +1 -1
  161. package/dist/client/components/management/UserDetails/UserDetails.js.map +1 -0
  162. package/dist/client/components/management/UserList/UserList.d.ts.map +1 -0
  163. package/dist/client/components/{admin → management}/UserList/UserList.js +1 -1
  164. package/dist/client/components/management/UserList/UserList.js.map +1 -0
  165. package/dist/client/contexts/ThunderID/ThunderIDProvider.d.ts.map +1 -1
  166. package/dist/client/contexts/ThunderID/ThunderIDProvider.js +55 -4
  167. package/dist/client/contexts/ThunderID/ThunderIDProvider.js.map +1 -1
  168. package/dist/client/index.d.ts +55 -33
  169. package/dist/client/index.d.ts.map +1 -1
  170. package/dist/client/index.js +28 -17
  171. package/dist/client/management.d.ts +3 -0
  172. package/dist/client/management.d.ts.map +1 -0
  173. package/dist/client/management.js +6 -0
  174. package/dist/index.js +29 -18
  175. package/dist/server/actions/account/getAccessibleOrganizationUnitsAction.d.ts +20 -0
  176. package/dist/server/actions/account/getAccessibleOrganizationUnitsAction.d.ts.map +1 -0
  177. package/dist/server/actions/account/getAccessibleOrganizationUnitsAction.js +51 -0
  178. package/dist/server/actions/account/getAccessibleOrganizationUnitsAction.js.map +1 -0
  179. package/dist/server/actions/account/getCurrentOrganizationUnitAction.d.ts +10 -0
  180. package/dist/server/actions/account/getCurrentOrganizationUnitAction.d.ts.map +1 -0
  181. package/dist/server/actions/account/getCurrentOrganizationUnitAction.js +28 -0
  182. package/dist/server/actions/account/getCurrentOrganizationUnitAction.js.map +1 -0
  183. package/dist/server/actions/auth/switchOrganizationUnitAction.d.ts +30 -0
  184. package/dist/server/actions/auth/switchOrganizationUnitAction.d.ts.map +1 -0
  185. package/dist/server/actions/auth/switchOrganizationUnitAction.js +82 -0
  186. package/dist/server/actions/auth/switchOrganizationUnitAction.js.map +1 -0
  187. package/dist/server/thunderid.d.ts +2 -1
  188. package/dist/server/thunderid.d.ts.map +1 -1
  189. package/dist/server/thunderid.js +14 -0
  190. package/dist/server/thunderid.js.map +1 -1
  191. package/package.json +3 -3
  192. package/dist/cjs/client/components/admin/AgentCreate/AgentCreate.cjs.map +0 -1
  193. package/dist/cjs/client/components/admin/AgentDetails/AgentDetails.cjs.map +0 -1
  194. package/dist/cjs/client/components/admin/AgentList/AgentList.cjs.map +0 -1
  195. package/dist/cjs/client/components/admin/ApplicationCreate/ApplicationCreate.cjs.map +0 -1
  196. package/dist/cjs/client/components/admin/ApplicationDetails/ApplicationDetails.cjs.map +0 -1
  197. package/dist/cjs/client/components/admin/ApplicationList/ApplicationList.cjs.map +0 -1
  198. package/dist/cjs/client/components/admin/GroupCreate/GroupCreate.cjs.map +0 -1
  199. package/dist/cjs/client/components/admin/GroupList/GroupList.cjs.map +0 -1
  200. package/dist/cjs/client/components/admin/GroupMembers/GroupMembers.cjs.map +0 -1
  201. package/dist/cjs/client/components/admin/RoleAssignments/RoleAssignments.cjs.map +0 -1
  202. package/dist/cjs/client/components/admin/RoleCreate/RoleCreate.cjs.map +0 -1
  203. package/dist/cjs/client/components/admin/RoleList/RoleList.cjs.map +0 -1
  204. package/dist/cjs/client/components/admin/RolePermissions/RolePermissions.cjs.map +0 -1
  205. package/dist/cjs/client/components/admin/UserCreate/UserCreate.cjs.map +0 -1
  206. package/dist/cjs/client/components/admin/UserDetails/UserDetails.cjs.map +0 -1
  207. package/dist/cjs/client/components/admin/UserList/UserList.cjs.map +0 -1
  208. package/dist/client/admin.d.ts +0 -3
  209. package/dist/client/admin.d.ts.map +0 -1
  210. package/dist/client/admin.js +0 -6
  211. package/dist/client/components/admin/AgentCreate/AgentCreate.d.ts.map +0 -1
  212. package/dist/client/components/admin/AgentCreate/AgentCreate.js.map +0 -1
  213. package/dist/client/components/admin/AgentDetails/AgentDetails.d.ts.map +0 -1
  214. package/dist/client/components/admin/AgentDetails/AgentDetails.js.map +0 -1
  215. package/dist/client/components/admin/AgentList/AgentList.d.ts.map +0 -1
  216. package/dist/client/components/admin/AgentList/AgentList.js.map +0 -1
  217. package/dist/client/components/admin/ApplicationCreate/ApplicationCreate.d.ts.map +0 -1
  218. package/dist/client/components/admin/ApplicationCreate/ApplicationCreate.js.map +0 -1
  219. package/dist/client/components/admin/ApplicationDetails/ApplicationDetails.d.ts.map +0 -1
  220. package/dist/client/components/admin/ApplicationDetails/ApplicationDetails.js.map +0 -1
  221. package/dist/client/components/admin/ApplicationList/ApplicationList.d.ts.map +0 -1
  222. package/dist/client/components/admin/ApplicationList/ApplicationList.js.map +0 -1
  223. package/dist/client/components/admin/GroupCreate/GroupCreate.d.ts.map +0 -1
  224. package/dist/client/components/admin/GroupCreate/GroupCreate.js.map +0 -1
  225. package/dist/client/components/admin/GroupList/GroupList.d.ts.map +0 -1
  226. package/dist/client/components/admin/GroupList/GroupList.js.map +0 -1
  227. package/dist/client/components/admin/GroupMembers/GroupMembers.d.ts.map +0 -1
  228. package/dist/client/components/admin/GroupMembers/GroupMembers.js.map +0 -1
  229. package/dist/client/components/admin/RoleAssignments/RoleAssignments.d.ts.map +0 -1
  230. package/dist/client/components/admin/RoleAssignments/RoleAssignments.js.map +0 -1
  231. package/dist/client/components/admin/RoleCreate/RoleCreate.d.ts.map +0 -1
  232. package/dist/client/components/admin/RoleCreate/RoleCreate.js.map +0 -1
  233. package/dist/client/components/admin/RoleList/RoleList.d.ts.map +0 -1
  234. package/dist/client/components/admin/RoleList/RoleList.js.map +0 -1
  235. package/dist/client/components/admin/RolePermissions/RolePermissions.d.ts.map +0 -1
  236. package/dist/client/components/admin/RolePermissions/RolePermissions.js.map +0 -1
  237. package/dist/client/components/admin/UserCreate/UserCreate.d.ts.map +0 -1
  238. package/dist/client/components/admin/UserCreate/UserCreate.js.map +0 -1
  239. package/dist/client/components/admin/UserDetails/UserDetails.d.ts.map +0 -1
  240. package/dist/client/components/admin/UserDetails/UserDetails.js.map +0 -1
  241. package/dist/client/components/admin/UserList/UserList.d.ts.map +0 -1
  242. package/dist/client/components/admin/UserList/UserList.js.map +0 -1
  243. /package/dist/cjs/client/{admin.cjs → management.cjs} +0 -0
  244. /package/dist/client/components/{admin → management}/AgentCreate/AgentCreate.d.ts +0 -0
  245. /package/dist/client/components/{admin → management}/AgentDetails/AgentDetails.d.ts +0 -0
  246. /package/dist/client/components/{admin → management}/AgentList/AgentList.d.ts +0 -0
  247. /package/dist/client/components/{admin → management}/ApplicationCreate/ApplicationCreate.d.ts +0 -0
  248. /package/dist/client/components/{admin → management}/ApplicationDetails/ApplicationDetails.d.ts +0 -0
  249. /package/dist/client/components/{admin → management}/ApplicationList/ApplicationList.d.ts +0 -0
  250. /package/dist/client/components/{admin → management}/GroupCreate/GroupCreate.d.ts +0 -0
  251. /package/dist/client/components/{admin → management}/GroupList/GroupList.d.ts +0 -0
  252. /package/dist/client/components/{admin → management}/GroupMembers/GroupMembers.d.ts +0 -0
  253. /package/dist/client/components/{admin → management}/RoleAssignments/RoleAssignments.d.ts +0 -0
  254. /package/dist/client/components/{admin → management}/RoleCreate/RoleCreate.d.ts +0 -0
  255. /package/dist/client/components/{admin → management}/RoleList/RoleList.d.ts +0 -0
  256. /package/dist/client/components/{admin → management}/RolePermissions/RolePermissions.d.ts +0 -0
  257. /package/dist/client/components/{admin → management}/UserCreate/UserCreate.d.ts +0 -0
  258. /package/dist/client/components/{admin → management}/UserDetails/UserDetails.d.ts +0 -0
  259. /package/dist/client/components/{admin → management}/UserList/UserList.d.ts +0 -0
@@ -21,25 +21,36 @@ const require_UserProfile = require('./client/components/account/UserProfile/Use
21
21
  const require_UserDropdown = require('./client/components/account/UserDropdown/UserDropdown.cjs');
22
22
  const require_UserAvatar = require('./client/components/account/UserAvatar/UserAvatar.cjs');
23
23
  const require_ChangeCredential = require('./client/components/account/ChangeCredential/ChangeCredential.cjs');
24
+ const require_OrganizationUnitSwitcher = require('./client/components/account/OrganizationUnitSwitcher/OrganizationUnitSwitcher.cjs');
24
25
  const require_UserSelect = require('./client/components/primitives/UserSelect/UserSelect.cjs');
25
26
  const require_AuthFlowSelect = require('./client/components/primitives/AuthFlowSelect/AuthFlowSelect.cjs');
26
27
  const require_UserTypeSelect = require('./client/components/primitives/UserTypeSelect/UserTypeSelect.cjs');
27
- const require_UserList = require('./client/components/admin/UserList/UserList.cjs');
28
- const require_UserCreate = require('./client/components/admin/UserCreate/UserCreate.cjs');
29
- const require_UserDetails = require('./client/components/admin/UserDetails/UserDetails.cjs');
30
- const require_GroupList = require('./client/components/admin/GroupList/GroupList.cjs');
31
- const require_GroupCreate = require('./client/components/admin/GroupCreate/GroupCreate.cjs');
32
- const require_GroupMembers = require('./client/components/admin/GroupMembers/GroupMembers.cjs');
33
- const require_RoleList = require('./client/components/admin/RoleList/RoleList.cjs');
34
- const require_RoleCreate = require('./client/components/admin/RoleCreate/RoleCreate.cjs');
35
- const require_RoleAssignments = require('./client/components/admin/RoleAssignments/RoleAssignments.cjs');
36
- const require_RolePermissions = require('./client/components/admin/RolePermissions/RolePermissions.cjs');
37
- const require_AgentList = require('./client/components/admin/AgentList/AgentList.cjs');
38
- const require_AgentCreate = require('./client/components/admin/AgentCreate/AgentCreate.cjs');
39
- const require_AgentDetails = require('./client/components/admin/AgentDetails/AgentDetails.cjs');
40
- const require_ApplicationList = require('./client/components/admin/ApplicationList/ApplicationList.cjs');
41
- const require_ApplicationCreate = require('./client/components/admin/ApplicationCreate/ApplicationCreate.cjs');
42
- const require_ApplicationDetails = require('./client/components/admin/ApplicationDetails/ApplicationDetails.cjs');
28
+ const require_UserList = require('./client/components/management/UserList/UserList.cjs');
29
+ const require_UserCreate = require('./client/components/management/UserCreate/UserCreate.cjs');
30
+ const require_UserDetails = require('./client/components/management/UserDetails/UserDetails.cjs');
31
+ const require_GroupList = require('./client/components/management/GroupList/GroupList.cjs');
32
+ const require_GroupCreate = require('./client/components/management/GroupCreate/GroupCreate.cjs');
33
+ const require_GroupMembers = require('./client/components/management/GroupMembers/GroupMembers.cjs');
34
+ const require_RoleList = require('./client/components/management/RoleList/RoleList.cjs');
35
+ const require_RoleCreate = require('./client/components/management/RoleCreate/RoleCreate.cjs');
36
+ const require_RoleAssignments = require('./client/components/management/RoleAssignments/RoleAssignments.cjs');
37
+ const require_RolePermissions = require('./client/components/management/RolePermissions/RolePermissions.cjs');
38
+ const require_GroupDetails = require('./client/components/management/GroupDetails/GroupDetails.cjs');
39
+ const require_RoleDetails = require('./client/components/management/RoleDetails/RoleDetails.cjs');
40
+ const require_AgentList = require('./client/components/management/AgentList/AgentList.cjs');
41
+ const require_AgentCreate = require('./client/components/management/AgentCreate/AgentCreate.cjs');
42
+ const require_AgentDetails = require('./client/components/management/AgentDetails/AgentDetails.cjs');
43
+ const require_ApplicationList = require('./client/components/management/ApplicationList/ApplicationList.cjs');
44
+ const require_ApplicationCreate = require('./client/components/management/ApplicationCreate/ApplicationCreate.cjs');
45
+ const require_ApplicationDetails = require('./client/components/management/ApplicationDetails/ApplicationDetails.cjs');
46
+ const require_ProjectList = require('./client/components/management/ProjectList/ProjectList.cjs');
47
+ const require_ProjectCreate = require('./client/components/management/ProjectCreate/ProjectCreate.cjs');
48
+ const require_ProjectDetails = require('./client/components/management/ProjectDetails/ProjectDetails.cjs');
49
+ const require_ProjectSwitcher = require('./client/components/management/ProjectSwitcher/ProjectSwitcher.cjs');
50
+ const require_OrganizationUnitList = require('./client/components/management/OrganizationUnitList/OrganizationUnitList.cjs');
51
+ const require_OrganizationUnitCreate = require('./client/components/management/OrganizationUnitCreate/OrganizationUnitCreate.cjs');
52
+ const require_OrganizationUnitDetails = require('./client/components/management/OrganizationUnitDetails/OrganizationUnitDetails.cjs');
53
+ const require_SharingPolicies = require('./client/components/management/SharingPolicies/SharingPolicies.cjs');
43
54
  const require_useGrantedPermissions = require('./client/hooks/management/useGrantedPermissions.cjs');
44
55
  require('./client/index.cjs');
45
56
  let __thunderid_react = require("@thunderid/react");
@@ -94,6 +105,12 @@ Object.defineProperty(exports, 'BaseGroupCreate', {
94
105
  return __thunderid_react.BaseGroupCreate;
95
106
  }
96
107
  });
108
+ Object.defineProperty(exports, 'BaseGroupDetails', {
109
+ enumerable: true,
110
+ get: function () {
111
+ return __thunderid_react.BaseGroupDetails;
112
+ }
113
+ });
97
114
  Object.defineProperty(exports, 'BaseGroupList', {
98
115
  enumerable: true,
99
116
  get: function () {
@@ -106,6 +123,48 @@ Object.defineProperty(exports, 'BaseGroupMembers', {
106
123
  return __thunderid_react.BaseGroupMembers;
107
124
  }
108
125
  });
126
+ Object.defineProperty(exports, 'BaseOrganizationUnitCreate', {
127
+ enumerable: true,
128
+ get: function () {
129
+ return __thunderid_react.BaseOrganizationUnitCreate;
130
+ }
131
+ });
132
+ Object.defineProperty(exports, 'BaseOrganizationUnitDetails', {
133
+ enumerable: true,
134
+ get: function () {
135
+ return __thunderid_react.BaseOrganizationUnitDetails;
136
+ }
137
+ });
138
+ Object.defineProperty(exports, 'BaseOrganizationUnitList', {
139
+ enumerable: true,
140
+ get: function () {
141
+ return __thunderid_react.BaseOrganizationUnitList;
142
+ }
143
+ });
144
+ Object.defineProperty(exports, 'BaseProjectCreate', {
145
+ enumerable: true,
146
+ get: function () {
147
+ return __thunderid_react.BaseProjectCreate;
148
+ }
149
+ });
150
+ Object.defineProperty(exports, 'BaseProjectDetails', {
151
+ enumerable: true,
152
+ get: function () {
153
+ return __thunderid_react.BaseProjectDetails;
154
+ }
155
+ });
156
+ Object.defineProperty(exports, 'BaseProjectList', {
157
+ enumerable: true,
158
+ get: function () {
159
+ return __thunderid_react.BaseProjectList;
160
+ }
161
+ });
162
+ Object.defineProperty(exports, 'BaseProjectSwitcher', {
163
+ enumerable: true,
164
+ get: function () {
165
+ return __thunderid_react.BaseProjectSwitcher;
166
+ }
167
+ });
109
168
  Object.defineProperty(exports, 'BaseRoleAssignments', {
110
169
  enumerable: true,
111
170
  get: function () {
@@ -118,6 +177,12 @@ Object.defineProperty(exports, 'BaseRoleCreate', {
118
177
  return __thunderid_react.BaseRoleCreate;
119
178
  }
120
179
  });
180
+ Object.defineProperty(exports, 'BaseRoleDetails', {
181
+ enumerable: true,
182
+ get: function () {
183
+ return __thunderid_react.BaseRoleDetails;
184
+ }
185
+ });
121
186
  Object.defineProperty(exports, 'BaseRoleList', {
122
187
  enumerable: true,
123
188
  get: function () {
@@ -130,6 +195,12 @@ Object.defineProperty(exports, 'BaseRolePermissions', {
130
195
  return __thunderid_react.BaseRolePermissions;
131
196
  }
132
197
  });
198
+ Object.defineProperty(exports, 'BaseSharingPolicies', {
199
+ enumerable: true,
200
+ get: function () {
201
+ return __thunderid_react.BaseSharingPolicies;
202
+ }
203
+ });
133
204
  Object.defineProperty(exports, 'BaseUserCreate', {
134
205
  enumerable: true,
135
206
  get: function () {
@@ -151,12 +222,23 @@ Object.defineProperty(exports, 'BaseUserList', {
151
222
  exports.ChangeCredential = require_ChangeCredential.default;
152
223
  exports.DeviceGrant = require_DeviceGrant.default;
153
224
  exports.GroupCreate = require_GroupCreate.default;
225
+ exports.GroupDetails = require_GroupDetails.default;
154
226
  exports.GroupList = require_GroupList.default;
155
227
  exports.GroupMembers = require_GroupMembers.default;
228
+ exports.OrganizationUnitCreate = require_OrganizationUnitCreate.default;
229
+ exports.OrganizationUnitDetails = require_OrganizationUnitDetails.default;
230
+ exports.OrganizationUnitList = require_OrganizationUnitList.default;
231
+ exports.OrganizationUnitSwitcher = require_OrganizationUnitSwitcher.default;
232
+ exports.ProjectCreate = require_ProjectCreate.default;
233
+ exports.ProjectDetails = require_ProjectDetails.default;
234
+ exports.ProjectList = require_ProjectList.default;
235
+ exports.ProjectSwitcher = require_ProjectSwitcher.default;
156
236
  exports.RoleAssignments = require_RoleAssignments.default;
157
237
  exports.RoleCreate = require_RoleCreate.default;
238
+ exports.RoleDetails = require_RoleDetails.default;
158
239
  exports.RoleList = require_RoleList.default;
159
240
  exports.RolePermissions = require_RolePermissions.default;
241
+ exports.SharingPolicies = require_SharingPolicies.default;
160
242
  exports.SignIn = require_SignIn.default;
161
243
  exports.SignInButton = require_SignInButton.default;
162
244
  exports.SignOutButton = require_SignOutButton.default;
@@ -0,0 +1,53 @@
1
+ 'use server';
2
+
3
+
4
+ const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
5
+ const require_getClient = require('../../getClient.cjs');
6
+ const require_getAccessToken = require('../getAccessToken.cjs');
7
+ let __thunderid_node = require("@thunderid/node");
8
+ __thunderid_node = require_rolldown_runtime.__toESM(__thunderid_node);
9
+
10
+ //#region src/server/actions/account/getAccessibleOrganizationUnitsAction.ts
11
+ /**
12
+ * Lists the organization units the signed-in user can access (`/users/me/ous`) with the session's
13
+ * access token, which stays on the server. Only `scope`, `limit` and `offset` are taken from the caller;
14
+ * the session is the one in the request's cookie.
15
+ *
16
+ * Failures are returned rather than thrown, so the error crosses the server action boundary with its
17
+ * status and code, and without the server's message.
18
+ */
19
+ const getAccessibleOrganizationUnitsAction = async ({ limit, offset, scope } = {}) => {
20
+ const accessToken = await require_getAccessToken.default();
21
+ if (!accessToken) return {
22
+ statusCode: 401,
23
+ success: false
24
+ };
25
+ try {
26
+ const client = require_getClient.default();
27
+ if (!client.isInitialized) await client.initialize({});
28
+ const config = await client.getConfiguration();
29
+ return {
30
+ data: await (0, __thunderid_node.getAccessibleOrganizationUnits)({
31
+ baseUrl: config.baseUrl,
32
+ headers: { Authorization: `Bearer ${accessToken}` },
33
+ limit,
34
+ offset,
35
+ scope: scope === "siblings" ? "siblings" : void 0,
36
+ url: (0, __thunderid_node.resolveResourceEndpoint)("usersMeOrganizationUnits", config)
37
+ }),
38
+ success: true
39
+ };
40
+ } catch (error) {
41
+ if (error instanceof __thunderid_node.ThunderIDAPIError) return {
42
+ code: error.code,
43
+ statusCode: error.statusCode,
44
+ success: false
45
+ };
46
+ return { success: false };
47
+ }
48
+ };
49
+ var getAccessibleOrganizationUnitsAction_default = getAccessibleOrganizationUnitsAction;
50
+
51
+ //#endregion
52
+ exports.default = getAccessibleOrganizationUnitsAction_default;
53
+ //# sourceMappingURL=getAccessibleOrganizationUnitsAction.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAccessibleOrganizationUnitsAction.cjs","names":["accessToken: string | undefined","getAccessToken","getClient","config: ThunderIDNextConfig","ThunderIDAPIError"],"sources":["../../../../../src/server/actions/account/getAccessibleOrganizationUnitsAction.ts"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\n'use server';\n\nimport {\n AccessibleOrganizationUnitList,\n AccessibleOrganizationUnitsOptions,\n ThunderIDAPIError,\n getAccessibleOrganizationUnits,\n resolveResourceEndpoint,\n} from '@thunderid/node';\nimport {ThunderIDNextConfig} from '../../../models/config';\nimport getClient from '../../getClient';\nimport getAccessToken from '../getAccessToken';\n\nexport type GetAccessibleOrganizationUnitsActionResult =\n | {data: AccessibleOrganizationUnitList; success: true}\n | {code?: string; statusCode?: number; success: false};\n\n/**\n * Lists the organization units the signed-in user can access (`/users/me/ous`) with the session's\n * access token, which stays on the server. Only `scope`, `limit` and `offset` are taken from the caller;\n * the session is the one in the request's cookie.\n *\n * Failures are returned rather than thrown, so the error crosses the server action boundary with its\n * status and code, and without the server's message.\n */\nconst getAccessibleOrganizationUnitsAction = async ({\n limit,\n offset,\n scope,\n}: AccessibleOrganizationUnitsOptions = {}): Promise<GetAccessibleOrganizationUnitsActionResult> => {\n const accessToken: string | undefined = await getAccessToken();\n\n if (!accessToken) {\n return {statusCode: 401, success: false};\n }\n\n try {\n const client = getClient();\n\n if (!client.isInitialized) {\n await client.initialize({} as ThunderIDNextConfig);\n }\n\n const config: ThunderIDNextConfig = await client.getConfiguration();\n const data: AccessibleOrganizationUnitList = await getAccessibleOrganizationUnits({\n baseUrl: config.baseUrl,\n headers: {Authorization: `Bearer ${accessToken}`},\n limit,\n offset,\n scope: scope === 'siblings' ? 'siblings' : undefined,\n url: resolveResourceEndpoint('usersMeOrganizationUnits', config),\n });\n\n return {data, success: true};\n } catch (error) {\n if (error instanceof ThunderIDAPIError) {\n return {code: error.code, statusCode: error.statusCode, success: false};\n }\n\n return {success: false};\n }\n};\n\nexport default getAccessibleOrganizationUnitsAction;\n"],"mappings":";;;;;;;;;;;;;;;;;;AA4BA,MAAM,uCAAuC,OAAO,EAClD,OACA,QACA,UACsC,EAAE,KAA0D;CAClG,MAAMA,cAAkC,MAAMC,gCAAgB;AAE9D,KAAI,CAAC,YACH,QAAO;EAAC,YAAY;EAAK,SAAS;EAAM;AAG1C,KAAI;EACF,MAAM,SAASC,2BAAW;AAE1B,MAAI,CAAC,OAAO,cACV,OAAM,OAAO,WAAW,EAAE,CAAwB;EAGpD,MAAMC,SAA8B,MAAM,OAAO,kBAAkB;AAUnE,SAAO;GAAC,MATqC,2DAAqC;IAChF,SAAS,OAAO;IAChB,SAAS,EAAC,eAAe,UAAU,eAAc;IACjD;IACA;IACA,OAAO,UAAU,aAAa,aAAa;IAC3C,mDAA6B,4BAA4B,OAAO;IACjE,CAAC;GAEY,SAAS;GAAK;UACrB,OAAO;AACd,MAAI,iBAAiBC,mCACnB,QAAO;GAAC,MAAM,MAAM;GAAM,YAAY,MAAM;GAAY,SAAS;GAAM;AAGzE,SAAO,EAAC,SAAS,OAAM;;;AAI3B,mDAAe"}
@@ -0,0 +1,31 @@
1
+ 'use server';
2
+
3
+
4
+ const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
5
+ const require_getAccessToken = require('../getAccessToken.cjs');
6
+ let __thunderid_node = require("@thunderid/node");
7
+ __thunderid_node = require_rolldown_runtime.__toESM(__thunderid_node);
8
+ let jose = require("jose");
9
+ jose = require_rolldown_runtime.__toESM(jose);
10
+
11
+ //#region src/server/actions/account/getCurrentOrganizationUnitAction.ts
12
+ /**
13
+ * Reads the organization unit the signed-in session was issued for from the `ouId`, `ouHandle` and
14
+ * `ouName` claims of the session's token, or `null` when they are absent (an access token carries
15
+ * `ouId` only when the application's token configuration asks for it). For display only, never for
16
+ * an authorization decision.
17
+ */
18
+ const getCurrentOrganizationUnitAction = async () => {
19
+ const accessToken = await require_getAccessToken.default();
20
+ if (!accessToken) return null;
21
+ try {
22
+ return (0, __thunderid_node.getCurrentOrganizationUnitFromClaims)((0, jose.decodeJwt)(accessToken));
23
+ } catch {
24
+ return null;
25
+ }
26
+ };
27
+ var getCurrentOrganizationUnitAction_default = getCurrentOrganizationUnitAction;
28
+
29
+ //#endregion
30
+ exports.default = getCurrentOrganizationUnitAction_default;
31
+ //# sourceMappingURL=getCurrentOrganizationUnitAction.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getCurrentOrganizationUnitAction.cjs","names":["accessToken: string | undefined","getAccessToken"],"sources":["../../../../../src/server/actions/account/getCurrentOrganizationUnitAction.ts"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\n'use server';\n\nimport {CurrentOrganizationUnit, getCurrentOrganizationUnitFromClaims} from '@thunderid/node';\nimport {decodeJwt} from 'jose';\nimport getAccessToken from '../getAccessToken';\n\n/**\n * Reads the organization unit the signed-in session was issued for from the `ouId`, `ouHandle` and\n * `ouName` claims of the session's token, or `null` when they are absent (an access token carries\n * `ouId` only when the application's token configuration asks for it). For display only, never for\n * an authorization decision.\n */\nconst getCurrentOrganizationUnitAction = async (): Promise<CurrentOrganizationUnit | null> => {\n const accessToken: string | undefined = await getAccessToken();\n\n if (!accessToken) {\n return null;\n }\n\n try {\n return getCurrentOrganizationUnitFromClaims(decodeJwt(accessToken) as Record<string, unknown>);\n } catch {\n return null;\n }\n};\n\nexport default getCurrentOrganizationUnitAction;\n"],"mappings":";;;;;;;;;;;;;;;;;AAeA,MAAM,mCAAmC,YAAqD;CAC5F,MAAMA,cAAkC,MAAMC,gCAAgB;AAE9D,KAAI,CAAC,YACH,QAAO;AAGT,KAAI;AACF,wFAAsD,YAAY,CAA4B;SACxF;AACN,SAAO;;;AAIX,+CAAe"}
@@ -0,0 +1,85 @@
1
+ 'use server';
2
+
3
+
4
+ const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
5
+ const require_SessionManager = require('../../../utils/SessionManager.cjs');
6
+ const require_getSessionId = require('../getSessionId.cjs');
7
+ const require_getClient = require('../../getClient.cjs');
8
+ const require_signInAction = require('./signInAction.cjs');
9
+ let __thunderid_node = require("@thunderid/node");
10
+ __thunderid_node = require_rolldown_runtime.__toESM(__thunderid_node);
11
+ let next_headers = require("next/headers");
12
+ next_headers = require_rolldown_runtime.__toESM(next_headers);
13
+
14
+ //#region src/server/actions/auth/switchOrganizationUnitAction.ts
15
+ /**
16
+ * Starts a switch of the signed-in session to the organization unit `organizationUnitId`.
17
+ *
18
+ * - Redirect mode returns the unit's authorization URL (`{baseUrl}/ou/{ouId}/oauth2/authorize`) to send
19
+ * the browser to, and marks the session so the OAuth callback redeems the code for it: the code is
20
+ * redeemed at the unit's token endpoint and replaces the session. With `redirect: false` it fails
21
+ * with `interaction_required` instead, since a server cannot switch silently.
22
+ * - Embedded mode starts an `AUTHENTICATION` flow with `ouId`. When the SSO session is reused the flow
23
+ * completes at once and its assertion replaces the session cookie; a flow that needs input fails
24
+ * with `interaction_required`.
25
+ *
26
+ * The previous session stays as it was on any failure. The error code is one of
27
+ * `OrganizationUnitSwitchErrorCodes`.
28
+ */
29
+ const switchOrganizationUnitAction = async (organizationUnitId, options = {}) => {
30
+ if (typeof organizationUnitId !== "string" || organizationUnitId.trim() === "") return {
31
+ code: __thunderid_node.OrganizationUnitSwitchErrorCodes.InvalidOrganizationUnit,
32
+ statusCode: 400,
33
+ success: false
34
+ };
35
+ const sessionId = await require_getSessionId.default();
36
+ if (!sessionId) return {
37
+ code: __thunderid_node.OrganizationUnitSwitchErrorCodes.Failed,
38
+ statusCode: 401,
39
+ success: false
40
+ };
41
+ try {
42
+ const client = require_getClient.default();
43
+ if (!client.isInitialized) await client.initialize({});
44
+ const config = await client.getConfiguration();
45
+ if (config.mode === "embedded") {
46
+ const result = await require_signInAction.default({
47
+ applicationId: config.applicationId,
48
+ flowType: __thunderid_node.EmbeddedFlowType.Authentication,
49
+ ouId: organizationUnitId
50
+ });
51
+ if (result.success && result.data?.afterSignInUrl) return {
52
+ data: { switched: true },
53
+ success: true
54
+ };
55
+ if (result.success) return {
56
+ code: __thunderid_node.OrganizationUnitSwitchErrorCodes.InteractionRequired,
57
+ success: false
58
+ };
59
+ return {
60
+ code: (result.error ?? "").includes("FES-1023") ? __thunderid_node.OrganizationUnitSwitchErrorCodes.UnauthorizedClient : __thunderid_node.OrganizationUnitSwitchErrorCodes.Failed,
61
+ success: false
62
+ };
63
+ }
64
+ if (options.redirect === false) return {
65
+ code: __thunderid_node.OrganizationUnitSwitchErrorCodes.InteractionRequired,
66
+ success: false
67
+ };
68
+ const signInUrl = await client.getAuthorizeRequestUrl({ organizationUnitId }, sessionId);
69
+ (await (0, next_headers.cookies)()).set(require_SessionManager.default.getTempSessionCookieName(), await require_SessionManager.default.createTempSession(sessionId), require_SessionManager.default.getTempSessionCookieOptions());
70
+ return {
71
+ data: { signInUrl },
72
+ success: true
73
+ };
74
+ } catch {
75
+ return {
76
+ code: __thunderid_node.OrganizationUnitSwitchErrorCodes.Failed,
77
+ success: false
78
+ };
79
+ }
80
+ };
81
+ var switchOrganizationUnitAction_default = switchOrganizationUnitAction;
82
+
83
+ //#endregion
84
+ exports.default = switchOrganizationUnitAction_default;
85
+ //# sourceMappingURL=switchOrganizationUnitAction.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"switchOrganizationUnitAction.cjs","names":["OrganizationUnitSwitchErrorCodes","sessionId: string | undefined","getSessionId","getClient","config: ThunderIDNextConfig","result: Awaited<ReturnType<typeof signInAction>>","signInAction","EmbeddedFlowType","signInUrl: string","SessionManager"],"sources":["../../../../../src/server/actions/auth/switchOrganizationUnitAction.ts"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\n'use server';\n\nimport {EmbeddedFlowType, OrganizationUnitSwitchErrorCodes} from '@thunderid/node';\nimport {cookies} from 'next/headers';\nimport signInAction from './signInAction';\nimport {ThunderIDNextConfig} from '../../../models/config';\nimport SessionManager from '../../../utils/SessionManager';\nimport getClient from '../../getClient';\nimport getSessionId from '../getSessionId';\n\ntype RequestCookies = Awaited<ReturnType<typeof cookies>>;\n\nexport type SwitchOrganizationUnitActionResult =\n | {data: {signInUrl?: string; switched?: boolean}; success: true}\n | {code: string; statusCode?: number; success: false};\n\n/**\n * Starts a switch of the signed-in session to the organization unit `organizationUnitId`.\n *\n * - Redirect mode returns the unit's authorization URL (`{baseUrl}/ou/{ouId}/oauth2/authorize`) to send\n * the browser to, and marks the session so the OAuth callback redeems the code for it: the code is\n * redeemed at the unit's token endpoint and replaces the session. With `redirect: false` it fails\n * with `interaction_required` instead, since a server cannot switch silently.\n * - Embedded mode starts an `AUTHENTICATION` flow with `ouId`. When the SSO session is reused the flow\n * completes at once and its assertion replaces the session cookie; a flow that needs input fails\n * with `interaction_required`.\n *\n * The previous session stays as it was on any failure. The error code is one of\n * `OrganizationUnitSwitchErrorCodes`.\n */\nconst switchOrganizationUnitAction = async (\n organizationUnitId: string,\n options: {redirect?: boolean} = {},\n): Promise<SwitchOrganizationUnitActionResult> => {\n if (typeof organizationUnitId !== 'string' || organizationUnitId.trim() === '') {\n return {code: OrganizationUnitSwitchErrorCodes.InvalidOrganizationUnit, statusCode: 400, success: false};\n }\n\n const sessionId: string | undefined = await getSessionId();\n\n if (!sessionId) {\n return {code: OrganizationUnitSwitchErrorCodes.Failed, statusCode: 401, success: false};\n }\n\n try {\n const client = getClient();\n\n if (!client.isInitialized) {\n await client.initialize({} as ThunderIDNextConfig);\n }\n\n const config: ThunderIDNextConfig = await client.getConfiguration();\n\n if (config.mode === 'embedded') {\n const result: Awaited<ReturnType<typeof signInAction>> = await signInAction({\n applicationId: config.applicationId,\n flowType: EmbeddedFlowType.Authentication,\n ouId: organizationUnitId,\n });\n\n if (result.success && (result.data as {afterSignInUrl?: string} | undefined)?.afterSignInUrl) {\n return {data: {switched: true}, success: true};\n }\n\n if (result.success) {\n return {code: OrganizationUnitSwitchErrorCodes.InteractionRequired, success: false};\n }\n\n // FES-1023: a unit the application is not accessible from, or one that does not exist.\n return {\n code: (result.error ?? '').includes('FES-1023')\n ? OrganizationUnitSwitchErrorCodes.UnauthorizedClient\n : OrganizationUnitSwitchErrorCodes.Failed,\n success: false,\n };\n }\n\n if (options.redirect === false) {\n return {code: OrganizationUnitSwitchErrorCodes.InteractionRequired, success: false};\n }\n\n const signInUrl: string = await client.getAuthorizeRequestUrl({organizationUnitId}, sessionId);\n const cookieStore: RequestCookies = await cookies();\n\n // The OAuth callback finds the session it completes through the temporary session cookie.\n cookieStore.set(\n SessionManager.getTempSessionCookieName(),\n await SessionManager.createTempSession(sessionId),\n SessionManager.getTempSessionCookieOptions(),\n );\n\n return {data: {signInUrl}, success: true};\n } catch {\n return {code: OrganizationUnitSwitchErrorCodes.Failed, success: false};\n }\n};\n\nexport default switchOrganizationUnitAction;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAM,+BAA+B,OACnC,oBACA,UAAgC,EAAE,KACc;AAChD,KAAI,OAAO,uBAAuB,YAAY,mBAAmB,MAAM,KAAK,GAC1E,QAAO;EAAC,MAAMA,kDAAiC;EAAyB,YAAY;EAAK,SAAS;EAAM;CAG1G,MAAMC,YAAgC,MAAMC,8BAAc;AAE1D,KAAI,CAAC,UACH,QAAO;EAAC,MAAMF,kDAAiC;EAAQ,YAAY;EAAK,SAAS;EAAM;AAGzF,KAAI;EACF,MAAM,SAASG,2BAAW;AAE1B,MAAI,CAAC,OAAO,cACV,OAAM,OAAO,WAAW,EAAE,CAAwB;EAGpD,MAAMC,SAA8B,MAAM,OAAO,kBAAkB;AAEnE,MAAI,OAAO,SAAS,YAAY;GAC9B,MAAMC,SAAmD,MAAMC,6BAAa;IAC1E,eAAe,OAAO;IACtB,UAAUC,kCAAiB;IAC3B,MAAM;IACP,CAAC;AAEF,OAAI,OAAO,WAAY,OAAO,MAAgD,eAC5E,QAAO;IAAC,MAAM,EAAC,UAAU,MAAK;IAAE,SAAS;IAAK;AAGhD,OAAI,OAAO,QACT,QAAO;IAAC,MAAMP,kDAAiC;IAAqB,SAAS;IAAM;AAIrF,UAAO;IACL,OAAO,OAAO,SAAS,IAAI,SAAS,WAAW,GAC3CA,kDAAiC,qBACjCA,kDAAiC;IACrC,SAAS;IACV;;AAGH,MAAI,QAAQ,aAAa,MACvB,QAAO;GAAC,MAAMA,kDAAiC;GAAqB,SAAS;GAAM;EAGrF,MAAMQ,YAAoB,MAAM,OAAO,uBAAuB,EAAC,oBAAmB,EAAE,UAAU;AAI9F,GAHoC,iCAAe,EAGvC,IACVC,+BAAe,0BAA0B,EACzC,MAAMA,+BAAe,kBAAkB,UAAU,EACjDA,+BAAe,6BAA6B,CAC7C;AAED,SAAO;GAAC,MAAM,EAAC,WAAU;GAAE,SAAS;GAAK;SACnC;AACN,SAAO;GAAC,MAAMT,kDAAiC;GAAQ,SAAS;GAAM;;;AAI1E,2CAAe"}
@@ -1,5 +1,9 @@
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
1
2
  const require_getSessionId = require('./actions/getSessionId.cjs');
2
3
  const require_getClient = require('./getClient.cjs');
4
+ const require_getAccessibleOrganizationUnitsAction = require('./actions/account/getAccessibleOrganizationUnitsAction.cjs');
5
+ let __thunderid_node = require("@thunderid/node");
6
+ __thunderid_node = require_rolldown_runtime.__toESM(__thunderid_node);
3
7
 
4
8
  //#region src/server/thunderid.ts
5
9
  const thunderid = async () => {
@@ -13,8 +17,20 @@ const thunderid = async () => {
13
17
  const reInitialize = async (config) => {
14
18
  return require_getClient.default().reInitialize(config);
15
19
  };
20
+ /**
21
+ * Lists the organization units the signed-in user of this request can access (`/users/me/ous`).
22
+ *
23
+ * @throws {ThunderIDAPIError} With the status and code of the failure; the server's message is not
24
+ * carried.
25
+ */
26
+ const getAccessibleOrganizationUnits = async (options) => {
27
+ const result = await require_getAccessibleOrganizationUnitsAction.default(options);
28
+ if (!result.success) throw new __thunderid_node.ThunderIDAPIError("Failed to list the accessible organization units", result.code ?? "getAccessibleOrganizationUnits-ResponseError-001", "nextjs", result.statusCode);
29
+ return result.data;
30
+ };
16
31
  return {
17
32
  exchangeToken,
33
+ getAccessibleOrganizationUnits,
18
34
  getAccessToken,
19
35
  getSessionId,
20
36
  reInitialize
@@ -1 +1 @@
1
- {"version":3,"file":"thunderid.cjs","names":["getClient","getSessionIdAction"],"sources":["../../../src/server/thunderid.ts"],"sourcesContent":["// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {TokenExchangeRequestConfig, TokenResponse} from '@thunderid/node';\nimport getSessionIdAction from './actions/getSessionId';\nimport getClient from './getClient';\nimport {ThunderIDNextConfig} from '../models/config';\n\nconst thunderid = async (): Promise<{\n exchangeToken: (config: TokenExchangeRequestConfig, sessionId: string) => Promise<TokenResponse | Response>;\n getAccessToken: (sessionId: string) => Promise<string>;\n getSessionId: () => Promise<string | undefined>;\n reInitialize: (config: Partial<ThunderIDNextConfig>) => Promise<boolean>;\n}> => {\n const getAccessToken = async (sessionId: string): Promise<string> => {\n const client = getClient();\n return client.getAccessToken(sessionId);\n };\n\n const getSessionId = async (): Promise<string | undefined> => getSessionIdAction();\n\n const exchangeToken = async (\n config: TokenExchangeRequestConfig,\n sessionId: string,\n ): Promise<TokenResponse | Response> => {\n const client = getClient();\n return client.exchangeToken(config, sessionId);\n };\n\n const reInitialize = async (config: Partial<ThunderIDNextConfig>): Promise<boolean> => {\n const client = getClient();\n return client.reInitialize(config);\n };\n\n return {\n exchangeToken,\n getAccessToken,\n getSessionId,\n reInitialize,\n };\n};\n\nexport default thunderid;\n"],"mappings":";;;;AAQA,MAAM,YAAY,YAKZ;CACJ,MAAM,iBAAiB,OAAO,cAAuC;AAEnE,SADeA,2BAAW,CACZ,eAAe,UAAU;;CAGzC,MAAM,eAAe,YAAyCC,8BAAoB;CAElF,MAAM,gBAAgB,OACpB,QACA,cACsC;AAEtC,SADeD,2BAAW,CACZ,cAAc,QAAQ,UAAU;;CAGhD,MAAM,eAAe,OAAO,WAA2D;AAErF,SADeA,2BAAW,CACZ,aAAa,OAAO;;AAGpC,QAAO;EACL;EACA;EACA;EACA;EACD;;AAGH,wBAAe"}
1
+ {"version":3,"file":"thunderid.cjs","names":["getClient","getSessionIdAction","result: GetAccessibleOrganizationUnitsActionResult","getAccessibleOrganizationUnitsAction","ThunderIDAPIError"],"sources":["../../../src/server/thunderid.ts"],"sourcesContent":["// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n AccessibleOrganizationUnitList,\n AccessibleOrganizationUnitsOptions,\n ThunderIDAPIError,\n TokenExchangeRequestConfig,\n TokenResponse,\n} from '@thunderid/node';\nimport getAccessibleOrganizationUnitsAction, {\n GetAccessibleOrganizationUnitsActionResult,\n} from './actions/account/getAccessibleOrganizationUnitsAction';\nimport getSessionIdAction from './actions/getSessionId';\nimport getClient from './getClient';\nimport {ThunderIDNextConfig} from '../models/config';\n\nconst thunderid = async (): Promise<{\n exchangeToken: (config: TokenExchangeRequestConfig, sessionId: string) => Promise<TokenResponse | Response>;\n getAccessibleOrganizationUnits: (\n options?: AccessibleOrganizationUnitsOptions,\n ) => Promise<AccessibleOrganizationUnitList>;\n getAccessToken: (sessionId: string) => Promise<string>;\n getSessionId: () => Promise<string | undefined>;\n reInitialize: (config: Partial<ThunderIDNextConfig>) => Promise<boolean>;\n}> => {\n const getAccessToken = async (sessionId: string): Promise<string> => {\n const client = getClient();\n return client.getAccessToken(sessionId);\n };\n\n const getSessionId = async (): Promise<string | undefined> => getSessionIdAction();\n\n const exchangeToken = async (\n config: TokenExchangeRequestConfig,\n sessionId: string,\n ): Promise<TokenResponse | Response> => {\n const client = getClient();\n return client.exchangeToken(config, sessionId);\n };\n\n const reInitialize = async (config: Partial<ThunderIDNextConfig>): Promise<boolean> => {\n const client = getClient();\n return client.reInitialize(config);\n };\n\n /**\n * Lists the organization units the signed-in user of this request can access (`/users/me/ous`).\n *\n * @throws {ThunderIDAPIError} With the status and code of the failure; the server's message is not\n * carried.\n */\n const getAccessibleOrganizationUnits = async (\n options?: AccessibleOrganizationUnitsOptions,\n ): Promise<AccessibleOrganizationUnitList> => {\n const result: GetAccessibleOrganizationUnitsActionResult = await getAccessibleOrganizationUnitsAction(options);\n\n if (!result.success) {\n throw new ThunderIDAPIError(\n 'Failed to list the accessible organization units',\n result.code ?? 'getAccessibleOrganizationUnits-ResponseError-001',\n 'nextjs',\n result.statusCode,\n );\n }\n\n return result.data;\n };\n\n return {\n exchangeToken,\n getAccessibleOrganizationUnits,\n getAccessToken,\n getSessionId,\n reInitialize,\n };\n};\n\nexport default thunderid;\n"],"mappings":";;;;;;;;AAiBA,MAAM,YAAY,YAQZ;CACJ,MAAM,iBAAiB,OAAO,cAAuC;AAEnE,SADeA,2BAAW,CACZ,eAAe,UAAU;;CAGzC,MAAM,eAAe,YAAyCC,8BAAoB;CAElF,MAAM,gBAAgB,OACpB,QACA,cACsC;AAEtC,SADeD,2BAAW,CACZ,cAAc,QAAQ,UAAU;;CAGhD,MAAM,eAAe,OAAO,WAA2D;AAErF,SADeA,2BAAW,CACZ,aAAa,OAAO;;;;;;;;CASpC,MAAM,iCAAiC,OACrC,YAC4C;EAC5C,MAAME,SAAqD,MAAMC,qDAAqC,QAAQ;AAE9G,MAAI,CAAC,OAAO,QACV,OAAM,IAAIC,mCACR,oDACA,OAAO,QAAQ,oDACf,UACA,OAAO,WACR;AAGH,SAAO,OAAO;;AAGhB,QAAO;EACL;EACA;EACA;EACA;EACA;EACD;;AAGH,wBAAe"}
@@ -0,0 +1,24 @@
1
+ import { OrganizationUnitSwitcherProps as ReactOrganizationUnitSwitcherProps } from '@thunderid/react';
2
+ import { FC } from 'react';
3
+ /**
4
+ * Props for the OrganizationUnitSwitcher component. Mirrors `@thunderid/react`'s
5
+ * `OrganizationUnitSwitcherProps`, so a consumer moving between the React and Next.js SDKs calls it the
6
+ * same way.
7
+ */
8
+ export type OrganizationUnitSwitcherProps = ReactOrganizationUnitSwitcherProps;
9
+ /**
10
+ * Lists the organization units the signed-in user can access, marks the current one, and switches the
11
+ * session to another.
12
+ *
13
+ * This is the Next.js implementation: it renders `BaseOrganizationUnitSwitcher` from `@thunderid/react`,
14
+ * reads the units through `getAccessibleOrganizationUnitsAction` (a server action, so the access token
15
+ * stays on the server), and switches through the provider's `switchOrganizationUnit`.
16
+ *
17
+ * @example
18
+ * ```tsx
19
+ * <OrganizationUnitSwitcher scope="siblings" />
20
+ * ```
21
+ */
22
+ declare const OrganizationUnitSwitcher: FC<OrganizationUnitSwitcherProps>;
23
+ export default OrganizationUnitSwitcher;
24
+ //# sourceMappingURL=OrganizationUnitSwitcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OrganizationUnitSwitcher.d.ts","sourceRoot":"","sources":["../../../../../src/client/components/account/OrganizationUnitSwitcher/OrganizationUnitSwitcher.tsx"],"names":[],"mappings":"AAMA,OAAO,EAEL,6BAA6B,IAAI,kCAAkC,EAGpE,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAC,EAAE,EAAkE,MAAM,OAAO,CAAC;AAM1F;;;;GAIG;AACH,MAAM,MAAM,6BAA6B,GAAG,kCAAkC,CAAC;AAE/E;;;;;;;;;;;;GAYG;AACH,QAAA,MAAM,wBAAwB,EAAE,EAAE,CAAC,6BAA6B,CA8G/D,CAAC;AAEF,eAAe,wBAAwB,CAAC"}
@@ -0,0 +1,112 @@
1
+ 'use client';
2
+
3
+
4
+ import getAccessibleOrganizationUnitsAction_default from "../../../../server/actions/account/getAccessibleOrganizationUnitsAction.js";
5
+ import useThunderID_default from "../../../contexts/ThunderID/useThunderID.js";
6
+ import { BaseOrganizationUnitSwitcher, getOrganizationUnitSwitchErrorKey, useTranslation } from "@thunderid/react";
7
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
8
+ import { jsx } from "react/jsx-runtime";
9
+
10
+ //#region src/client/components/account/OrganizationUnitSwitcher/OrganizationUnitSwitcher.tsx
11
+ /**
12
+ * Lists the organization units the signed-in user can access, marks the current one, and switches the
13
+ * session to another.
14
+ *
15
+ * This is the Next.js implementation: it renders `BaseOrganizationUnitSwitcher` from `@thunderid/react`,
16
+ * reads the units through `getAccessibleOrganizationUnitsAction` (a server action, so the access token
17
+ * stays on the server), and switches through the provider's `switchOrganizationUnit`.
18
+ *
19
+ * @example
20
+ * ```tsx
21
+ * <OrganizationUnitSwitcher scope="siblings" />
22
+ * ```
23
+ */
24
+ const OrganizationUnitSwitcher = ({ limit = 10, onError, onSelect, onSwitch, preferences, scope, switchOptions,...rest }) => {
25
+ const { currentOrganizationUnit, isSignedIn, preferences: contextPreferences, switchOrganizationUnit } = useThunderID_default();
26
+ const resolvedPreferences = useMemo(() => ({
27
+ ...contextPreferences,
28
+ ...preferences
29
+ }), [contextPreferences, preferences]);
30
+ const { t } = useTranslation(resolvedPreferences?.i18n);
31
+ const [list, setList] = useState(null);
32
+ const [offset, setOffset] = useState(0);
33
+ const [isLoading, setIsLoading] = useState(false);
34
+ const [error, setError] = useState(null);
35
+ const [switchingId, setSwitchingId] = useState(null);
36
+ const requestRef = useRef(0);
37
+ const latestRef = useRef({
38
+ onError,
39
+ t
40
+ });
41
+ latestRef.current = {
42
+ onError,
43
+ t
44
+ };
45
+ const load = useCallback(async (pageOffset) => {
46
+ const request = requestRef.current + 1;
47
+ requestRef.current = request;
48
+ setIsLoading(true);
49
+ setError(null);
50
+ const result = await getAccessibleOrganizationUnitsAction_default({
51
+ limit,
52
+ offset: pageOffset,
53
+ scope
54
+ });
55
+ if (requestRef.current !== request) return;
56
+ if (result.success) setList(result.data);
57
+ else {
58
+ setError(latestRef.current.t("organization_unit.switcher.error.load"));
59
+ latestRef.current.onError?.(result);
60
+ }
61
+ setIsLoading(false);
62
+ }, [limit, scope]);
63
+ useEffect(() => {
64
+ if (isSignedIn) load(offset);
65
+ }, [
66
+ isSignedIn,
67
+ load,
68
+ offset
69
+ ]);
70
+ const handleSwitch = async (unit) => {
71
+ if (onSelect) {
72
+ onSelect(unit);
73
+ return;
74
+ }
75
+ if (!switchOrganizationUnit) return;
76
+ setError(null);
77
+ setSwitchingId(unit.id);
78
+ try {
79
+ const user = await switchOrganizationUnit(unit.id, switchOptions);
80
+ if (user) {
81
+ onSwitch?.(unit, user);
82
+ await load(offset);
83
+ }
84
+ } catch (caught) {
85
+ setError(t(getOrganizationUnitSwitchErrorKey(caught), { name: unit.name }));
86
+ onError?.(caught);
87
+ } finally {
88
+ setSwitchingId(null);
89
+ }
90
+ };
91
+ return /* @__PURE__ */ jsx(BaseOrganizationUnitSwitcher, {
92
+ ...rest,
93
+ current: (list?.current === "" ? void 0 : list?.current) ?? currentOrganizationUnit?.id ?? null,
94
+ error,
95
+ isLoading,
96
+ limit,
97
+ offset,
98
+ organizationUnits: list?.organizationUnits ?? [],
99
+ preferences: resolvedPreferences,
100
+ switchingId,
101
+ totalResults: list?.totalResults ?? 0,
102
+ onPageChange: setOffset,
103
+ onSwitch: (unit) => {
104
+ handleSwitch(unit);
105
+ }
106
+ });
107
+ };
108
+ var OrganizationUnitSwitcher_default = OrganizationUnitSwitcher;
109
+
110
+ //#endregion
111
+ export { OrganizationUnitSwitcher_default as default };
112
+ //# sourceMappingURL=OrganizationUnitSwitcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OrganizationUnitSwitcher.js","names":["OrganizationUnitSwitcher: FC<OrganizationUnitSwitcherProps>","useThunderID","request: number","result: GetAccessibleOrganizationUnitsActionResult","getAccessibleOrganizationUnitsAction","user: User | undefined","caught: unknown"],"sources":["../../../../../src/client/components/account/OrganizationUnitSwitcher/OrganizationUnitSwitcher.tsx"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\n'use client';\n\nimport {AccessibleOrganizationUnit, AccessibleOrganizationUnitList, User} from '@thunderid/node';\nimport {\n BaseOrganizationUnitSwitcher,\n OrganizationUnitSwitcherProps as ReactOrganizationUnitSwitcherProps,\n getOrganizationUnitSwitchErrorKey,\n useTranslation,\n} from '@thunderid/react';\nimport {FC, ReactElement, useCallback, useEffect, useMemo, useRef, useState} from 'react';\nimport getAccessibleOrganizationUnitsAction, {\n GetAccessibleOrganizationUnitsActionResult,\n} from '../../../../server/actions/account/getAccessibleOrganizationUnitsAction';\nimport useThunderID from '../../../contexts/ThunderID/useThunderID';\n\n/**\n * Props for the OrganizationUnitSwitcher component. Mirrors `@thunderid/react`'s\n * `OrganizationUnitSwitcherProps`, so a consumer moving between the React and Next.js SDKs calls it the\n * same way.\n */\nexport type OrganizationUnitSwitcherProps = ReactOrganizationUnitSwitcherProps;\n\n/**\n * Lists the organization units the signed-in user can access, marks the current one, and switches the\n * session to another.\n *\n * This is the Next.js implementation: it renders `BaseOrganizationUnitSwitcher` from `@thunderid/react`,\n * reads the units through `getAccessibleOrganizationUnitsAction` (a server action, so the access token\n * stays on the server), and switches through the provider's `switchOrganizationUnit`.\n *\n * @example\n * ```tsx\n * <OrganizationUnitSwitcher scope=\"siblings\" />\n * ```\n */\nconst OrganizationUnitSwitcher: FC<OrganizationUnitSwitcherProps> = ({\n limit = 10,\n onError,\n onSelect,\n onSwitch,\n preferences,\n scope,\n switchOptions,\n ...rest\n}: OrganizationUnitSwitcherProps): ReactElement => {\n const {currentOrganizationUnit, isSignedIn, preferences: contextPreferences, switchOrganizationUnit} = useThunderID();\n\n const resolvedPreferences = useMemo(\n () => ({...contextPreferences, ...preferences}),\n [contextPreferences, preferences],\n );\n const {t} = useTranslation(resolvedPreferences?.i18n);\n\n const [list, setList] = useState<AccessibleOrganizationUnitList | null>(null);\n const [offset, setOffset] = useState<number>(0);\n const [isLoading, setIsLoading] = useState<boolean>(false);\n const [error, setError] = useState<string | null>(null);\n const [switchingId, setSwitchingId] = useState<string | null>(null);\n const requestRef = useRef<number>(0);\n // The latest callbacks, read when a load settles, so a new `onError` on each render does not reload.\n const latestRef = useRef<{onError?: (error: unknown) => void; t: typeof t}>({onError, t});\n latestRef.current = {onError, t};\n\n const load = useCallback(\n async (pageOffset: number): Promise<void> => {\n const request: number = requestRef.current + 1;\n requestRef.current = request;\n setIsLoading(true);\n setError(null);\n\n const result: GetAccessibleOrganizationUnitsActionResult = await getAccessibleOrganizationUnitsAction({\n limit,\n offset: pageOffset,\n scope,\n });\n\n if (requestRef.current !== request) {\n return;\n }\n\n if (result.success) {\n setList(result.data);\n } else {\n setError(latestRef.current.t('organization_unit.switcher.error.load'));\n latestRef.current.onError?.(result);\n }\n\n setIsLoading(false);\n },\n [limit, scope],\n );\n\n useEffect(() => {\n if (isSignedIn) {\n void load(offset);\n }\n }, [isSignedIn, load, offset]);\n\n const handleSwitch = async (unit: AccessibleOrganizationUnit): Promise<void> => {\n if (onSelect) {\n onSelect(unit);\n\n return;\n }\n\n if (!switchOrganizationUnit) {\n return;\n }\n\n setError(null);\n setSwitchingId(unit.id);\n\n try {\n const user: User | undefined = await switchOrganizationUnit(unit.id, switchOptions);\n\n if (user) {\n onSwitch?.(unit, user);\n await load(offset);\n }\n } catch (caught: unknown) {\n setError(t(getOrganizationUnitSwitchErrorKey(caught), {name: unit.name}));\n onError?.(caught);\n } finally {\n setSwitchingId(null);\n }\n };\n\n return (\n <BaseOrganizationUnitSwitcher\n {...rest}\n current={(list?.current === '' ? undefined : list?.current) ?? currentOrganizationUnit?.id ?? null}\n error={error}\n isLoading={isLoading}\n limit={limit}\n offset={offset}\n organizationUnits={list?.organizationUnits ?? []}\n preferences={resolvedPreferences}\n switchingId={switchingId}\n totalResults={list?.totalResults ?? 0}\n onPageChange={setOffset}\n onSwitch={(unit: AccessibleOrganizationUnit): void => {\n void handleSwitch(unit);\n }}\n />\n );\n};\n\nexport default OrganizationUnitSwitcher;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAsCA,MAAMA,4BAA+D,EACnE,QAAQ,IACR,SACA,UACA,UACA,aACA,OACA,cACA,GAAG,WAC8C;CACjD,MAAM,EAAC,yBAAyB,YAAY,aAAa,oBAAoB,2BAA0BC,sBAAc;CAErH,MAAM,sBAAsB,eACnB;EAAC,GAAG;EAAoB,GAAG;EAAY,GAC9C,CAAC,oBAAoB,YAAY,CAClC;CACD,MAAM,EAAC,MAAK,eAAe,qBAAqB,KAAK;CAErD,MAAM,CAAC,MAAM,WAAW,SAAgD,KAAK;CAC7E,MAAM,CAAC,QAAQ,aAAa,SAAiB,EAAE;CAC/C,MAAM,CAAC,WAAW,gBAAgB,SAAkB,MAAM;CAC1D,MAAM,CAAC,OAAO,YAAY,SAAwB,KAAK;CACvD,MAAM,CAAC,aAAa,kBAAkB,SAAwB,KAAK;CACnE,MAAM,aAAa,OAAe,EAAE;CAEpC,MAAM,YAAY,OAA0D;EAAC;EAAS;EAAE,CAAC;AACzF,WAAU,UAAU;EAAC;EAAS;EAAE;CAEhC,MAAM,OAAO,YACX,OAAO,eAAsC;EAC3C,MAAMC,UAAkB,WAAW,UAAU;AAC7C,aAAW,UAAU;AACrB,eAAa,KAAK;AAClB,WAAS,KAAK;EAEd,MAAMC,SAAqD,MAAMC,6CAAqC;GACpG;GACA,QAAQ;GACR;GACD,CAAC;AAEF,MAAI,WAAW,YAAY,QACzB;AAGF,MAAI,OAAO,QACT,SAAQ,OAAO,KAAK;OACf;AACL,YAAS,UAAU,QAAQ,EAAE,wCAAwC,CAAC;AACtE,aAAU,QAAQ,UAAU,OAAO;;AAGrC,eAAa,MAAM;IAErB,CAAC,OAAO,MAAM,CACf;AAED,iBAAgB;AACd,MAAI,WACF,CAAK,KAAK,OAAO;IAElB;EAAC;EAAY;EAAM;EAAO,CAAC;CAE9B,MAAM,eAAe,OAAO,SAAoD;AAC9E,MAAI,UAAU;AACZ,YAAS,KAAK;AAEd;;AAGF,MAAI,CAAC,uBACH;AAGF,WAAS,KAAK;AACd,iBAAe,KAAK,GAAG;AAEvB,MAAI;GACF,MAAMC,OAAyB,MAAM,uBAAuB,KAAK,IAAI,cAAc;AAEnF,OAAI,MAAM;AACR,eAAW,MAAM,KAAK;AACtB,UAAM,KAAK,OAAO;;WAEbC,QAAiB;AACxB,YAAS,EAAE,kCAAkC,OAAO,EAAE,EAAC,MAAM,KAAK,MAAK,CAAC,CAAC;AACzE,aAAU,OAAO;YACT;AACR,kBAAe,KAAK;;;AAIxB,QACE,oBAAC;EACC,GAAI;EACJ,UAAU,MAAM,YAAY,KAAK,SAAY,MAAM,YAAY,yBAAyB,MAAM;EACvF;EACI;EACJ;EACC;EACR,mBAAmB,MAAM,qBAAqB,EAAE;EAChD,aAAa;EACA;EACb,cAAc,MAAM,gBAAgB;EACpC,cAAc;EACd,WAAW,SAA2C;AACpD,GAAK,aAAa,KAAK;;GAEzB;;AAIN,uCAAe"}
@@ -4,7 +4,13 @@ import { FC } from 'react';
4
4
  * Props for the SignIn component.
5
5
  * Extends BaseSignInProps for full compatibility with the React BaseSignIn component
6
6
  */
7
- export type SignInProps = Pick<BaseSignInProps, 'children' | 'className' | 'id' | 'onSuccess' | 'onError' | 'variant' | 'size'>;
7
+ export type SignInProps = Pick<BaseSignInProps, 'children' | 'className' | 'id' | 'onSuccess' | 'onError' | 'variant' | 'size'> & {
8
+ /**
9
+ * Bounds the sign-in to this organization unit. Sent as `ouId` on the request that starts the
10
+ * `AUTHENTICATION` flow only, never on a continuation.
11
+ */
12
+ organizationUnitId?: string;
13
+ };
8
14
  /**
9
15
  * A SignIn component for Next.js that provides native authentication flow.
10
16
  * This component delegates to the BaseSignIn from @thunderid/react. Unlike BaseSignUp,
@@ -1 +1 @@
1
- {"version":3,"file":"SignIn.d.ts","sourceRoot":"","sources":["../../../../../src/client/components/auth/SignIn/SignIn.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAa,eAAe,EAAwC,MAAM,kBAAkB,CAAC;AACpG,OAAO,EAAC,EAAE,EAA8B,MAAM,OAAO,CAAC;AAGtD;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,IAAI,CAC5B,eAAe,EACf,UAAU,GAAG,WAAW,GAAG,IAAI,GAAG,WAAW,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,CAC/E,CAAC;AAEF;;;;;GAKG;AACH,QAAA,MAAM,MAAM,EAAE,EAAE,CAAC,WAAW,CAmG3B,CAAC;AAIF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"SignIn.d.ts","sourceRoot":"","sources":["../../../../../src/client/components/auth/SignIn/SignIn.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAa,eAAe,EAAwC,MAAM,kBAAkB,CAAC;AACpG,OAAO,EAAC,EAAE,EAA8B,MAAM,OAAO,CAAC;AAGtD;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,IAAI,CAC5B,eAAe,EACf,UAAU,GAAG,WAAW,GAAG,IAAI,GAAG,WAAW,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,CAC/E,GAAG;IACF;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF;;;;;GAKG;AACH,QAAA,MAAM,MAAM,EAAE,EAAE,CAAC,WAAW,CA0G3B,CAAC;AAIF,eAAe,MAAM,CAAC"}
@@ -14,7 +14,7 @@ import { jsx } from "react/jsx-runtime";
14
14
  * BaseSignIn does not manage its own flow state, so this component initiates the flow
15
15
  * (using the server-action-backed `signIn`) and tracks `components`/`executionId` itself.
16
16
  */
17
- const SignIn = ({ size = "medium", variant = "outlined", onError,...rest }) => {
17
+ const SignIn = ({ size = "medium", variant = "outlined", onError, organizationUnitId,...rest }) => {
18
18
  const { signIn, applicationId, scopes } = useThunderID_default();
19
19
  const { t } = useTranslation();
20
20
  const [components, setComponents] = useState([]);
@@ -44,7 +44,8 @@ const SignIn = ({ size = "medium", variant = "outlined", onError,...rest }) => {
44
44
  const response = await signIn({
45
45
  applicationId,
46
46
  flowType: EmbeddedFlowType.Authentication,
47
- ...scopes && { scopes }
47
+ ...scopes && { scopes },
48
+ ...organizationUnitId && { ouId: organizationUnitId }
48
49
  }, {});
49
50
  if (response) applyFlowResponse(response);
50
51
  } catch (error) {