@thunderid/nextjs 1.12.0 → 1.14.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 (283) hide show
  1. package/dist/ThunderIDNextClient.d.ts +8 -1
  2. package/dist/ThunderIDNextClient.d.ts.map +1 -1
  3. package/dist/ThunderIDNextClient.js +10 -0
  4. package/dist/ThunderIDNextClient.js.map +1 -1
  5. package/dist/cjs/ThunderIDNextClient.cjs +10 -0
  6. package/dist/cjs/ThunderIDNextClient.cjs.map +1 -1
  7. package/dist/cjs/client/components/account/OrganizationUnitSwitcher/OrganizationUnitSwitcher.cjs +116 -0
  8. package/dist/cjs/client/components/account/OrganizationUnitSwitcher/OrganizationUnitSwitcher.cjs.map +1 -0
  9. package/dist/cjs/client/components/account/UserProfile/UserProfile.cjs +11 -1
  10. package/dist/cjs/client/components/account/UserProfile/UserProfile.cjs.map +1 -1
  11. package/dist/cjs/client/components/account/VerifyAttribute/VerifyAttribute.cjs +80 -0
  12. package/dist/cjs/client/components/account/VerifyAttribute/VerifyAttribute.cjs.map +1 -0
  13. package/dist/cjs/client/components/auth/SignIn/SignIn.cjs +3 -2
  14. package/dist/cjs/client/components/auth/SignIn/SignIn.cjs.map +1 -1
  15. package/dist/cjs/client/components/{admin → management}/AgentCreate/AgentCreate.cjs +1 -1
  16. package/dist/cjs/client/components/management/AgentCreate/AgentCreate.cjs.map +1 -0
  17. package/dist/cjs/client/components/{admin → management}/AgentDetails/AgentDetails.cjs +1 -1
  18. package/dist/cjs/client/components/management/AgentDetails/AgentDetails.cjs.map +1 -0
  19. package/dist/cjs/client/components/{admin → management}/AgentList/AgentList.cjs +1 -1
  20. package/dist/cjs/client/components/management/AgentList/AgentList.cjs.map +1 -0
  21. package/dist/cjs/client/components/{admin → management}/ApplicationCreate/ApplicationCreate.cjs +1 -1
  22. package/dist/cjs/client/components/management/ApplicationCreate/ApplicationCreate.cjs.map +1 -0
  23. package/dist/cjs/client/components/{admin → management}/ApplicationDetails/ApplicationDetails.cjs +1 -1
  24. package/dist/cjs/client/components/management/ApplicationDetails/ApplicationDetails.cjs.map +1 -0
  25. package/dist/cjs/client/components/{admin → management}/ApplicationList/ApplicationList.cjs +1 -1
  26. package/dist/cjs/client/components/management/ApplicationList/ApplicationList.cjs.map +1 -0
  27. package/dist/cjs/client/components/{admin → management}/GroupCreate/GroupCreate.cjs +1 -1
  28. package/dist/cjs/client/components/management/GroupCreate/GroupCreate.cjs.map +1 -0
  29. package/dist/cjs/client/components/management/GroupDetails/GroupDetails.cjs +28 -0
  30. package/dist/cjs/client/components/management/GroupDetails/GroupDetails.cjs.map +1 -0
  31. package/dist/cjs/client/components/{admin → management}/GroupList/GroupList.cjs +1 -1
  32. package/dist/cjs/client/components/management/GroupList/GroupList.cjs.map +1 -0
  33. package/dist/cjs/client/components/{admin → management}/GroupMembers/GroupMembers.cjs +1 -1
  34. package/dist/cjs/client/components/management/GroupMembers/GroupMembers.cjs.map +1 -0
  35. package/dist/cjs/client/components/management/OrganizationUnitCreate/OrganizationUnitCreate.cjs +28 -0
  36. package/dist/cjs/client/components/management/OrganizationUnitCreate/OrganizationUnitCreate.cjs.map +1 -0
  37. package/dist/cjs/client/components/management/OrganizationUnitDetails/OrganizationUnitDetails.cjs +28 -0
  38. package/dist/cjs/client/components/management/OrganizationUnitDetails/OrganizationUnitDetails.cjs.map +1 -0
  39. package/dist/cjs/client/components/management/OrganizationUnitList/OrganizationUnitList.cjs +28 -0
  40. package/dist/cjs/client/components/management/OrganizationUnitList/OrganizationUnitList.cjs.map +1 -0
  41. package/dist/cjs/client/components/management/ProjectCreate/ProjectCreate.cjs +28 -0
  42. package/dist/cjs/client/components/management/ProjectCreate/ProjectCreate.cjs.map +1 -0
  43. package/dist/cjs/client/components/management/ProjectDetails/ProjectDetails.cjs +28 -0
  44. package/dist/cjs/client/components/management/ProjectDetails/ProjectDetails.cjs.map +1 -0
  45. package/dist/cjs/client/components/management/ProjectList/ProjectList.cjs +28 -0
  46. package/dist/cjs/client/components/management/ProjectList/ProjectList.cjs.map +1 -0
  47. package/dist/cjs/client/components/management/ProjectSwitcher/ProjectSwitcher.cjs +30 -0
  48. package/dist/cjs/client/components/management/ProjectSwitcher/ProjectSwitcher.cjs.map +1 -0
  49. package/dist/cjs/client/components/{admin → management}/RoleAssignments/RoleAssignments.cjs +1 -1
  50. package/dist/cjs/client/components/management/RoleAssignments/RoleAssignments.cjs.map +1 -0
  51. package/dist/cjs/client/components/{admin → management}/RoleCreate/RoleCreate.cjs +1 -1
  52. package/dist/cjs/client/components/management/RoleCreate/RoleCreate.cjs.map +1 -0
  53. package/dist/cjs/client/components/management/RoleDetails/RoleDetails.cjs +28 -0
  54. package/dist/cjs/client/components/management/RoleDetails/RoleDetails.cjs.map +1 -0
  55. package/dist/cjs/client/components/{admin → management}/RoleList/RoleList.cjs +1 -1
  56. package/dist/cjs/client/components/management/RoleList/RoleList.cjs.map +1 -0
  57. package/dist/cjs/client/components/{admin → management}/RolePermissions/RolePermissions.cjs +1 -1
  58. package/dist/cjs/client/components/management/RolePermissions/RolePermissions.cjs.map +1 -0
  59. package/dist/cjs/client/components/management/SharingPolicies/SharingPolicies.cjs +28 -0
  60. package/dist/cjs/client/components/management/SharingPolicies/SharingPolicies.cjs.map +1 -0
  61. package/dist/cjs/client/components/{admin → management}/UserCreate/UserCreate.cjs +1 -1
  62. package/dist/cjs/client/components/management/UserCreate/UserCreate.cjs.map +1 -0
  63. package/dist/cjs/client/components/{admin → management}/UserDetails/UserDetails.cjs +1 -1
  64. package/dist/cjs/client/components/management/UserDetails/UserDetails.cjs.map +1 -0
  65. package/dist/cjs/client/components/{admin → management}/UserList/UserList.cjs +1 -1
  66. package/dist/cjs/client/components/management/UserList/UserList.cjs.map +1 -0
  67. package/dist/cjs/client/contexts/ThunderID/ThunderIDProvider.cjs +65 -2
  68. package/dist/cjs/client/contexts/ThunderID/ThunderIDProvider.cjs.map +1 -1
  69. package/dist/cjs/client/index.cjs +29 -17
  70. package/dist/cjs/index.cjs +100 -16
  71. package/dist/cjs/server/actions/account/getAccessibleOrganizationUnitsAction.cjs +53 -0
  72. package/dist/cjs/server/actions/account/getAccessibleOrganizationUnitsAction.cjs.map +1 -0
  73. package/dist/cjs/server/actions/account/getCurrentOrganizationUnitAction.cjs +31 -0
  74. package/dist/cjs/server/actions/account/getCurrentOrganizationUnitAction.cjs.map +1 -0
  75. package/dist/cjs/server/actions/auth/executeSelfFlowAction.cjs +47 -0
  76. package/dist/cjs/server/actions/auth/executeSelfFlowAction.cjs.map +1 -0
  77. package/dist/cjs/server/actions/auth/switchOrganizationUnitAction.cjs +85 -0
  78. package/dist/cjs/server/actions/auth/switchOrganizationUnitAction.cjs.map +1 -0
  79. package/dist/cjs/server/thunderid.cjs +16 -0
  80. package/dist/cjs/server/thunderid.cjs.map +1 -1
  81. package/dist/client/components/account/OrganizationUnitSwitcher/OrganizationUnitSwitcher.d.ts +24 -0
  82. package/dist/client/components/account/OrganizationUnitSwitcher/OrganizationUnitSwitcher.d.ts.map +1 -0
  83. package/dist/client/components/account/OrganizationUnitSwitcher/OrganizationUnitSwitcher.js +112 -0
  84. package/dist/client/components/account/OrganizationUnitSwitcher/OrganizationUnitSwitcher.js.map +1 -0
  85. package/dist/client/components/account/UserProfile/UserProfile.d.ts +7 -1
  86. package/dist/client/components/account/UserProfile/UserProfile.d.ts.map +1 -1
  87. package/dist/client/components/account/UserProfile/UserProfile.js +12 -2
  88. package/dist/client/components/account/UserProfile/UserProfile.js.map +1 -1
  89. package/dist/client/components/account/VerifyAttribute/VerifyAttribute.d.ts +41 -0
  90. package/dist/client/components/account/VerifyAttribute/VerifyAttribute.d.ts.map +1 -0
  91. package/dist/client/components/account/VerifyAttribute/VerifyAttribute.js +75 -0
  92. package/dist/client/components/account/VerifyAttribute/VerifyAttribute.js.map +1 -0
  93. package/dist/client/components/auth/SignIn/SignIn.d.ts +7 -1
  94. package/dist/client/components/auth/SignIn/SignIn.d.ts.map +1 -1
  95. package/dist/client/components/auth/SignIn/SignIn.js +3 -2
  96. package/dist/client/components/auth/SignIn/SignIn.js.map +1 -1
  97. package/dist/client/components/management/AgentCreate/AgentCreate.d.ts.map +1 -0
  98. package/dist/client/components/{admin → management}/AgentCreate/AgentCreate.js +1 -1
  99. package/dist/client/components/management/AgentCreate/AgentCreate.js.map +1 -0
  100. package/dist/client/components/management/AgentDetails/AgentDetails.d.ts.map +1 -0
  101. package/dist/client/components/{admin → management}/AgentDetails/AgentDetails.js +1 -1
  102. package/dist/client/components/management/AgentDetails/AgentDetails.js.map +1 -0
  103. package/dist/client/components/management/AgentList/AgentList.d.ts.map +1 -0
  104. package/dist/client/components/{admin → management}/AgentList/AgentList.js +1 -1
  105. package/dist/client/components/management/AgentList/AgentList.js.map +1 -0
  106. package/dist/client/components/management/ApplicationCreate/ApplicationCreate.d.ts.map +1 -0
  107. package/dist/client/components/{admin → management}/ApplicationCreate/ApplicationCreate.js +1 -1
  108. package/dist/client/components/management/ApplicationCreate/ApplicationCreate.js.map +1 -0
  109. package/dist/client/components/management/ApplicationDetails/ApplicationDetails.d.ts.map +1 -0
  110. package/dist/client/components/{admin → management}/ApplicationDetails/ApplicationDetails.js +1 -1
  111. package/dist/client/components/management/ApplicationDetails/ApplicationDetails.js.map +1 -0
  112. package/dist/client/components/management/ApplicationList/ApplicationList.d.ts.map +1 -0
  113. package/dist/client/components/{admin → management}/ApplicationList/ApplicationList.js +1 -1
  114. package/dist/client/components/management/ApplicationList/ApplicationList.js.map +1 -0
  115. package/dist/client/components/management/GroupCreate/GroupCreate.d.ts.map +1 -0
  116. package/dist/client/components/{admin → management}/GroupCreate/GroupCreate.js +1 -1
  117. package/dist/client/components/management/GroupCreate/GroupCreate.js.map +1 -0
  118. package/dist/client/components/management/GroupDetails/GroupDetails.d.ts +17 -0
  119. package/dist/client/components/management/GroupDetails/GroupDetails.d.ts.map +1 -0
  120. package/dist/client/components/management/GroupDetails/GroupDetails.js +25 -0
  121. package/dist/client/components/management/GroupDetails/GroupDetails.js.map +1 -0
  122. package/dist/client/components/management/GroupList/GroupList.d.ts.map +1 -0
  123. package/dist/client/components/{admin → management}/GroupList/GroupList.js +1 -1
  124. package/dist/client/components/management/GroupList/GroupList.js.map +1 -0
  125. package/dist/client/components/management/GroupMembers/GroupMembers.d.ts.map +1 -0
  126. package/dist/client/components/{admin → management}/GroupMembers/GroupMembers.js +1 -1
  127. package/dist/client/components/management/GroupMembers/GroupMembers.js.map +1 -0
  128. package/dist/client/components/management/OrganizationUnitCreate/OrganizationUnitCreate.d.ts +17 -0
  129. package/dist/client/components/management/OrganizationUnitCreate/OrganizationUnitCreate.d.ts.map +1 -0
  130. package/dist/client/components/management/OrganizationUnitCreate/OrganizationUnitCreate.js +25 -0
  131. package/dist/client/components/management/OrganizationUnitCreate/OrganizationUnitCreate.js.map +1 -0
  132. package/dist/client/components/management/OrganizationUnitDetails/OrganizationUnitDetails.d.ts +17 -0
  133. package/dist/client/components/management/OrganizationUnitDetails/OrganizationUnitDetails.d.ts.map +1 -0
  134. package/dist/client/components/management/OrganizationUnitDetails/OrganizationUnitDetails.js +25 -0
  135. package/dist/client/components/management/OrganizationUnitDetails/OrganizationUnitDetails.js.map +1 -0
  136. package/dist/client/components/management/OrganizationUnitList/OrganizationUnitList.d.ts +17 -0
  137. package/dist/client/components/management/OrganizationUnitList/OrganizationUnitList.d.ts.map +1 -0
  138. package/dist/client/components/management/OrganizationUnitList/OrganizationUnitList.js +25 -0
  139. package/dist/client/components/management/OrganizationUnitList/OrganizationUnitList.js.map +1 -0
  140. package/dist/client/components/management/ProjectCreate/ProjectCreate.d.ts +17 -0
  141. package/dist/client/components/management/ProjectCreate/ProjectCreate.d.ts.map +1 -0
  142. package/dist/client/components/management/ProjectCreate/ProjectCreate.js +25 -0
  143. package/dist/client/components/management/ProjectCreate/ProjectCreate.js.map +1 -0
  144. package/dist/client/components/management/ProjectDetails/ProjectDetails.d.ts +17 -0
  145. package/dist/client/components/management/ProjectDetails/ProjectDetails.d.ts.map +1 -0
  146. package/dist/client/components/management/ProjectDetails/ProjectDetails.js +25 -0
  147. package/dist/client/components/management/ProjectDetails/ProjectDetails.js.map +1 -0
  148. package/dist/client/components/management/ProjectList/ProjectList.d.ts +17 -0
  149. package/dist/client/components/management/ProjectList/ProjectList.d.ts.map +1 -0
  150. package/dist/client/components/management/ProjectList/ProjectList.js +25 -0
  151. package/dist/client/components/management/ProjectList/ProjectList.js.map +1 -0
  152. package/dist/client/components/management/ProjectSwitcher/ProjectSwitcher.d.ts +19 -0
  153. package/dist/client/components/management/ProjectSwitcher/ProjectSwitcher.d.ts.map +1 -0
  154. package/dist/client/components/management/ProjectSwitcher/ProjectSwitcher.js +27 -0
  155. package/dist/client/components/management/ProjectSwitcher/ProjectSwitcher.js.map +1 -0
  156. package/dist/client/components/management/RoleAssignments/RoleAssignments.d.ts.map +1 -0
  157. package/dist/client/components/{admin → management}/RoleAssignments/RoleAssignments.js +1 -1
  158. package/dist/client/components/management/RoleAssignments/RoleAssignments.js.map +1 -0
  159. package/dist/client/components/management/RoleCreate/RoleCreate.d.ts.map +1 -0
  160. package/dist/client/components/{admin → management}/RoleCreate/RoleCreate.js +1 -1
  161. package/dist/client/components/management/RoleCreate/RoleCreate.js.map +1 -0
  162. package/dist/client/components/management/RoleDetails/RoleDetails.d.ts +17 -0
  163. package/dist/client/components/management/RoleDetails/RoleDetails.d.ts.map +1 -0
  164. package/dist/client/components/management/RoleDetails/RoleDetails.js +25 -0
  165. package/dist/client/components/management/RoleDetails/RoleDetails.js.map +1 -0
  166. package/dist/client/components/management/RoleList/RoleList.d.ts.map +1 -0
  167. package/dist/client/components/{admin → management}/RoleList/RoleList.js +1 -1
  168. package/dist/client/components/management/RoleList/RoleList.js.map +1 -0
  169. package/dist/client/components/management/RolePermissions/RolePermissions.d.ts.map +1 -0
  170. package/dist/client/components/{admin → management}/RolePermissions/RolePermissions.js +1 -1
  171. package/dist/client/components/management/RolePermissions/RolePermissions.js.map +1 -0
  172. package/dist/client/components/management/SharingPolicies/SharingPolicies.d.ts +17 -0
  173. package/dist/client/components/management/SharingPolicies/SharingPolicies.d.ts.map +1 -0
  174. package/dist/client/components/management/SharingPolicies/SharingPolicies.js +25 -0
  175. package/dist/client/components/management/SharingPolicies/SharingPolicies.js.map +1 -0
  176. package/dist/client/components/management/UserCreate/UserCreate.d.ts.map +1 -0
  177. package/dist/client/components/{admin → management}/UserCreate/UserCreate.js +1 -1
  178. package/dist/client/components/management/UserCreate/UserCreate.js.map +1 -0
  179. package/dist/client/components/management/UserDetails/UserDetails.d.ts.map +1 -0
  180. package/dist/client/components/{admin → management}/UserDetails/UserDetails.js +1 -1
  181. package/dist/client/components/management/UserDetails/UserDetails.js.map +1 -0
  182. package/dist/client/components/management/UserList/UserList.d.ts.map +1 -0
  183. package/dist/client/components/{admin → management}/UserList/UserList.js +1 -1
  184. package/dist/client/components/management/UserList/UserList.js.map +1 -0
  185. package/dist/client/contexts/ThunderID/ThunderIDProvider.d.ts.map +1 -1
  186. package/dist/client/contexts/ThunderID/ThunderIDProvider.js +67 -4
  187. package/dist/client/contexts/ThunderID/ThunderIDProvider.js.map +1 -1
  188. package/dist/client/index.d.ts +57 -33
  189. package/dist/client/index.d.ts.map +1 -1
  190. package/dist/client/index.js +29 -17
  191. package/dist/client/management.d.ts +3 -0
  192. package/dist/client/management.d.ts.map +1 -0
  193. package/dist/client/management.js +6 -0
  194. package/dist/index.js +30 -18
  195. package/dist/server/actions/account/getAccessibleOrganizationUnitsAction.d.ts +20 -0
  196. package/dist/server/actions/account/getAccessibleOrganizationUnitsAction.d.ts.map +1 -0
  197. package/dist/server/actions/account/getAccessibleOrganizationUnitsAction.js +51 -0
  198. package/dist/server/actions/account/getAccessibleOrganizationUnitsAction.js.map +1 -0
  199. package/dist/server/actions/account/getCurrentOrganizationUnitAction.d.ts +10 -0
  200. package/dist/server/actions/account/getCurrentOrganizationUnitAction.d.ts.map +1 -0
  201. package/dist/server/actions/account/getCurrentOrganizationUnitAction.js +28 -0
  202. package/dist/server/actions/account/getCurrentOrganizationUnitAction.js.map +1 -0
  203. package/dist/server/actions/auth/executeSelfFlowAction.d.ts +20 -0
  204. package/dist/server/actions/auth/executeSelfFlowAction.d.ts.map +1 -0
  205. package/dist/server/actions/auth/executeSelfFlowAction.js +45 -0
  206. package/dist/server/actions/auth/executeSelfFlowAction.js.map +1 -0
  207. package/dist/server/actions/auth/switchOrganizationUnitAction.d.ts +30 -0
  208. package/dist/server/actions/auth/switchOrganizationUnitAction.d.ts.map +1 -0
  209. package/dist/server/actions/auth/switchOrganizationUnitAction.js +82 -0
  210. package/dist/server/actions/auth/switchOrganizationUnitAction.js.map +1 -0
  211. package/dist/server/thunderid.d.ts +2 -1
  212. package/dist/server/thunderid.d.ts.map +1 -1
  213. package/dist/server/thunderid.js +14 -0
  214. package/dist/server/thunderid.js.map +1 -1
  215. package/package.json +3 -3
  216. package/dist/cjs/client/components/admin/AgentCreate/AgentCreate.cjs.map +0 -1
  217. package/dist/cjs/client/components/admin/AgentDetails/AgentDetails.cjs.map +0 -1
  218. package/dist/cjs/client/components/admin/AgentList/AgentList.cjs.map +0 -1
  219. package/dist/cjs/client/components/admin/ApplicationCreate/ApplicationCreate.cjs.map +0 -1
  220. package/dist/cjs/client/components/admin/ApplicationDetails/ApplicationDetails.cjs.map +0 -1
  221. package/dist/cjs/client/components/admin/ApplicationList/ApplicationList.cjs.map +0 -1
  222. package/dist/cjs/client/components/admin/GroupCreate/GroupCreate.cjs.map +0 -1
  223. package/dist/cjs/client/components/admin/GroupList/GroupList.cjs.map +0 -1
  224. package/dist/cjs/client/components/admin/GroupMembers/GroupMembers.cjs.map +0 -1
  225. package/dist/cjs/client/components/admin/RoleAssignments/RoleAssignments.cjs.map +0 -1
  226. package/dist/cjs/client/components/admin/RoleCreate/RoleCreate.cjs.map +0 -1
  227. package/dist/cjs/client/components/admin/RoleList/RoleList.cjs.map +0 -1
  228. package/dist/cjs/client/components/admin/RolePermissions/RolePermissions.cjs.map +0 -1
  229. package/dist/cjs/client/components/admin/UserCreate/UserCreate.cjs.map +0 -1
  230. package/dist/cjs/client/components/admin/UserDetails/UserDetails.cjs.map +0 -1
  231. package/dist/cjs/client/components/admin/UserList/UserList.cjs.map +0 -1
  232. package/dist/client/admin.d.ts +0 -3
  233. package/dist/client/admin.d.ts.map +0 -1
  234. package/dist/client/admin.js +0 -6
  235. package/dist/client/components/admin/AgentCreate/AgentCreate.d.ts.map +0 -1
  236. package/dist/client/components/admin/AgentCreate/AgentCreate.js.map +0 -1
  237. package/dist/client/components/admin/AgentDetails/AgentDetails.d.ts.map +0 -1
  238. package/dist/client/components/admin/AgentDetails/AgentDetails.js.map +0 -1
  239. package/dist/client/components/admin/AgentList/AgentList.d.ts.map +0 -1
  240. package/dist/client/components/admin/AgentList/AgentList.js.map +0 -1
  241. package/dist/client/components/admin/ApplicationCreate/ApplicationCreate.d.ts.map +0 -1
  242. package/dist/client/components/admin/ApplicationCreate/ApplicationCreate.js.map +0 -1
  243. package/dist/client/components/admin/ApplicationDetails/ApplicationDetails.d.ts.map +0 -1
  244. package/dist/client/components/admin/ApplicationDetails/ApplicationDetails.js.map +0 -1
  245. package/dist/client/components/admin/ApplicationList/ApplicationList.d.ts.map +0 -1
  246. package/dist/client/components/admin/ApplicationList/ApplicationList.js.map +0 -1
  247. package/dist/client/components/admin/GroupCreate/GroupCreate.d.ts.map +0 -1
  248. package/dist/client/components/admin/GroupCreate/GroupCreate.js.map +0 -1
  249. package/dist/client/components/admin/GroupList/GroupList.d.ts.map +0 -1
  250. package/dist/client/components/admin/GroupList/GroupList.js.map +0 -1
  251. package/dist/client/components/admin/GroupMembers/GroupMembers.d.ts.map +0 -1
  252. package/dist/client/components/admin/GroupMembers/GroupMembers.js.map +0 -1
  253. package/dist/client/components/admin/RoleAssignments/RoleAssignments.d.ts.map +0 -1
  254. package/dist/client/components/admin/RoleAssignments/RoleAssignments.js.map +0 -1
  255. package/dist/client/components/admin/RoleCreate/RoleCreate.d.ts.map +0 -1
  256. package/dist/client/components/admin/RoleCreate/RoleCreate.js.map +0 -1
  257. package/dist/client/components/admin/RoleList/RoleList.d.ts.map +0 -1
  258. package/dist/client/components/admin/RoleList/RoleList.js.map +0 -1
  259. package/dist/client/components/admin/RolePermissions/RolePermissions.d.ts.map +0 -1
  260. package/dist/client/components/admin/RolePermissions/RolePermissions.js.map +0 -1
  261. package/dist/client/components/admin/UserCreate/UserCreate.d.ts.map +0 -1
  262. package/dist/client/components/admin/UserCreate/UserCreate.js.map +0 -1
  263. package/dist/client/components/admin/UserDetails/UserDetails.d.ts.map +0 -1
  264. package/dist/client/components/admin/UserDetails/UserDetails.js.map +0 -1
  265. package/dist/client/components/admin/UserList/UserList.d.ts.map +0 -1
  266. package/dist/client/components/admin/UserList/UserList.js.map +0 -1
  267. /package/dist/cjs/client/{admin.cjs → management.cjs} +0 -0
  268. /package/dist/client/components/{admin → management}/AgentCreate/AgentCreate.d.ts +0 -0
  269. /package/dist/client/components/{admin → management}/AgentDetails/AgentDetails.d.ts +0 -0
  270. /package/dist/client/components/{admin → management}/AgentList/AgentList.d.ts +0 -0
  271. /package/dist/client/components/{admin → management}/ApplicationCreate/ApplicationCreate.d.ts +0 -0
  272. /package/dist/client/components/{admin → management}/ApplicationDetails/ApplicationDetails.d.ts +0 -0
  273. /package/dist/client/components/{admin → management}/ApplicationList/ApplicationList.d.ts +0 -0
  274. /package/dist/client/components/{admin → management}/GroupCreate/GroupCreate.d.ts +0 -0
  275. /package/dist/client/components/{admin → management}/GroupList/GroupList.d.ts +0 -0
  276. /package/dist/client/components/{admin → management}/GroupMembers/GroupMembers.d.ts +0 -0
  277. /package/dist/client/components/{admin → management}/RoleAssignments/RoleAssignments.d.ts +0 -0
  278. /package/dist/client/components/{admin → management}/RoleCreate/RoleCreate.d.ts +0 -0
  279. /package/dist/client/components/{admin → management}/RoleList/RoleList.d.ts +0 -0
  280. /package/dist/client/components/{admin → management}/RolePermissions/RolePermissions.d.ts +0 -0
  281. /package/dist/client/components/{admin → management}/UserCreate/UserCreate.d.ts +0 -0
  282. /package/dist/client/components/{admin → management}/UserDetails/UserDetails.d.ts +0 -0
  283. /package/dist/client/components/{admin → management}/UserList/UserList.d.ts +0 -0
@@ -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,47 @@
1
+ 'use server';
2
+
3
+
4
+ const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
5
+ const require_getSessionId = require('../getSessionId.cjs');
6
+ const require_getClient = require('../../getClient.cjs');
7
+ let __thunderid_node = require("@thunderid/node");
8
+ __thunderid_node = require_rolldown_runtime.__toESM(__thunderid_node);
9
+
10
+ //#region src/server/actions/auth/executeSelfFlowAction.ts
11
+ /**
12
+ * Executes one step of a `SELF` flow, such as self attribute verification, for the signed-in
13
+ * user, with the access token of the server-held session. The request carries no session ID, token
14
+ * or user ID: the session comes from the request cookie, and only the fields of a step are forwarded.
15
+ * A new flow must be a `SELF` flow named by its handle.
16
+ *
17
+ * Never throws across the server action boundary. A failure carries only its HTTP status, never the
18
+ * reply of the server, which the browser reports as a refusal.
19
+ */
20
+ const executeSelfFlowAction = async (request) => {
21
+ const sessionId = await require_getSessionId.default();
22
+ if (!sessionId) return {
23
+ statusCode: 401,
24
+ success: false
25
+ };
26
+ const checked = (0, __thunderid_node.parseSelfFlowRequest)(request);
27
+ if ("invalid" in checked) return {
28
+ statusCode: 400,
29
+ success: false
30
+ };
31
+ try {
32
+ return {
33
+ data: await require_getClient.default().executeEmbeddedSelfFlow(checked.request, sessionId),
34
+ success: true
35
+ };
36
+ } catch (error) {
37
+ return error instanceof __thunderid_node.ThunderIDAPIError && error.statusCode ? {
38
+ statusCode: error.statusCode,
39
+ success: false
40
+ } : { success: false };
41
+ }
42
+ };
43
+ var executeSelfFlowAction_default = executeSelfFlowAction;
44
+
45
+ //#endregion
46
+ exports.default = executeSelfFlowAction_default;
47
+ //# sourceMappingURL=executeSelfFlowAction.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executeSelfFlowAction.cjs","names":["sessionId: string | undefined","getSessionId","checked: SelfFlowRequestParseResult","getClient","ThunderIDAPIError"],"sources":["../../../../../src/server/actions/auth/executeSelfFlowAction.ts"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\n'use server';\n\nimport {\n EmbeddedSelfFlowResponse,\n SelfFlowRequestParseResult,\n ThunderIDAPIError,\n parseSelfFlowRequest,\n} from '@thunderid/node';\nimport getClient from '../../getClient';\nimport getSessionId from '../getSessionId';\n\nexport type ExecuteSelfFlowActionResult =\n | {data: EmbeddedSelfFlowResponse; success: true}\n | {statusCode?: number; success: false};\n\n/**\n * Executes one step of a `SELF` flow, such as self attribute verification, for the signed-in\n * user, with the access token of the server-held session. The request carries no session ID, token\n * or user ID: the session comes from the request cookie, and only the fields of a step are forwarded.\n * A new flow must be a `SELF` flow named by its handle.\n *\n * Never throws across the server action boundary. A failure carries only its HTTP status, never the\n * reply of the server, which the browser reports as a refusal.\n */\nconst executeSelfFlowAction = async (request: unknown): Promise<ExecuteSelfFlowActionResult> => {\n const sessionId: string | undefined = await getSessionId();\n\n if (!sessionId) {\n return {statusCode: 401, success: false};\n }\n\n const checked: SelfFlowRequestParseResult = parseSelfFlowRequest(request);\n\n if ('invalid' in checked) {\n return {statusCode: 400, success: false};\n }\n\n try {\n const data: EmbeddedSelfFlowResponse = await getClient().executeEmbeddedSelfFlow(checked.request, sessionId);\n\n return {data, success: true};\n } catch (error) {\n return error instanceof ThunderIDAPIError && error.statusCode\n ? {statusCode: error.statusCode, success: false}\n : {success: false};\n }\n};\n\nexport default executeSelfFlowAction;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA2BA,MAAM,wBAAwB,OAAO,YAA2D;CAC9F,MAAMA,YAAgC,MAAMC,8BAAc;AAE1D,KAAI,CAAC,UACH,QAAO;EAAC,YAAY;EAAK,SAAS;EAAM;CAG1C,MAAMC,qDAA2D,QAAQ;AAEzE,KAAI,aAAa,QACf,QAAO;EAAC,YAAY;EAAK,SAAS;EAAM;AAG1C,KAAI;AAGF,SAAO;GAAC,MAF+B,MAAMC,2BAAW,CAAC,wBAAwB,QAAQ,SAAS,UAAU;GAE9F,SAAS;GAAK;UACrB,OAAO;AACd,SAAO,iBAAiBC,sCAAqB,MAAM,aAC/C;GAAC,YAAY,MAAM;GAAY,SAAS;GAAM,GAC9C,EAAC,SAAS,OAAM;;;AAIxB,oCAAe"}
@@ -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 UserProfile component.
5
5
  * Extends BaseUserProfileProps but makes the user prop optional since it will be obtained from useThunderID
6
6
  */
7
- export type UserProfileProps = Omit<BaseUserProfileProps, 'user' | 'profile' | 'flattenedProfile'>;
7
+ export type UserProfileProps = Omit<BaseUserProfileProps, 'user' | 'profile' | 'flattenedProfile'> & {
8
+ /**
9
+ * Handle of the `SELF` flow that verifies an attribute. Defaults to the server's shipped
10
+ * `default-self-attribute-verification-flow`.
11
+ */
12
+ verificationFlowHandle?: string;
13
+ };
8
14
  /**
9
15
  * UserProfile component displays the authenticated user's profile information in a
10
16
  * structured and styled format. It shows user details such as display name, email,
@@ -1 +1 @@
1
- {"version":3,"file":"UserProfile.d.ts","sourceRoot":"","sources":["../../../../../src/client/components/account/UserProfile/UserProfile.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAkB,oBAAoB,EAA0B,MAAM,kBAAkB,CAAC;AAChG,OAAO,EAAC,EAAE,EAAyB,MAAM,OAAO,CAAC;AAIjD;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,oBAAoB,EAAE,MAAM,GAAG,SAAS,GAAG,kBAAkB,CAAC,CAAC;AAEnG;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,QAAA,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CAmDrC,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"UserProfile.d.ts","sourceRoot":"","sources":["../../../../../src/client/components/account/UserProfile/UserProfile.tsx"],"names":[],"mappings":"AAMA,OAAO,EAEL,oBAAoB,EAIrB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAC,EAAE,EAAoC,MAAM,OAAO,CAAC;AAK5D;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,oBAAoB,EAAE,MAAM,GAAG,SAAS,GAAG,kBAAkB,CAAC,GAAG;IACnG;;;OAGG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,QAAA,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CAyErC,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -3,7 +3,8 @@
3
3
 
4
4
  import getSessionId_default from "../../../../server/actions/getSessionId.js";
5
5
  import useThunderID_default from "../../../contexts/ThunderID/useThunderID.js";
6
- import { deepMerge } from "@thunderid/node";
6
+ import VerifyAttribute_default from "../VerifyAttribute/VerifyAttribute.js";
7
+ import { AttributeVerificationConstants, deepMerge } from "@thunderid/node";
7
8
  import { BaseUserProfile, useTranslation, useUser } from "@thunderid/react";
8
9
  import { useState } from "react";
9
10
  import { jsx } from "react/jsx-runtime";
@@ -32,7 +33,7 @@ import { jsx } from "react/jsx-runtime";
32
33
  * />
33
34
  * ```
34
35
  */
35
- const UserProfile = ({ preferences, editable = true,...rest }) => {
36
+ const UserProfile = ({ preferences, editable = true, verificationFlowHandle = AttributeVerificationConstants.DEFAULT_FLOW_HANDLE,...rest }) => {
36
37
  const { preferences: contextPreferences } = useThunderID_default();
37
38
  const { profile, flattenedProfile, onUpdateProfile, updateProfile, userSchema } = useUser();
38
39
  const resolvedPreferences = {
@@ -56,7 +57,16 @@ const UserProfile = ({ preferences, editable = true,...rest }) => {
56
57
  if (result.success) onUpdateProfile(result.data.user);
57
58
  else setError(result.error || t("user.profile.update.generic.error"));
58
59
  };
60
+ const renderVerification = ({ attribute, attributeDisplayName, onCancel }) => /* @__PURE__ */ jsx(VerifyAttribute_default, {
61
+ attribute,
62
+ attributeDisplayName,
63
+ flowHandle: verificationFlowHandle,
64
+ preferences: resolvedPreferences,
65
+ onCancel,
66
+ onDone: onCancel
67
+ }, attribute);
59
68
  return /* @__PURE__ */ jsx(BaseUserProfile, {
69
+ renderVerification: isEditableProfile ? renderVerification : void 0,
60
70
  profile,
61
71
  flattenedProfile,
62
72
  userSchema,
@@ -1 +1 @@
1
- {"version":3,"file":"UserProfile.js","names":["UserProfile: FC<UserProfileProps>","useThunderID","isEditableProfile: boolean","result: {data: {user: User}; error: string; success: boolean}","getSessionId"],"sources":["../../../../../src/client/components/account/UserProfile/UserProfile.tsx"],"sourcesContent":["// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\n'use client';\n\nimport {deepMerge, User} from '@thunderid/node';\nimport {BaseUserProfile, BaseUserProfileProps, useUser, useTranslation} from '@thunderid/react';\nimport {FC, ReactElement, useState} from 'react';\nimport useThunderID from '../../../contexts/ThunderID/useThunderID';\nimport getSessionId from '../../../../server/actions/getSessionId';\n\n/**\n * Props for the UserProfile component.\n * Extends BaseUserProfileProps but makes the user prop optional since it will be obtained from useThunderID\n */\nexport type UserProfileProps = Omit<BaseUserProfileProps, 'user' | 'profile' | 'flattenedProfile'>;\n\n/**\n * UserProfile component displays the authenticated user's profile information in a\n * structured and styled format. It shows user details such as display name, email,\n * username, and other available profile information from ThunderID.\n *\n * This component is the React-specific implementation that uses the BaseUserProfile\n * and automatically retrieves the user data from ThunderID context if not provided.\n *\n * @example\n * ```tsx\n * // Basic usage - will use user from ThunderID context\n * <UserProfile />\n *\n * // With explicit user data\n * <UserProfile user={specificUser} />\n *\n * // With card layout and custom fallback\n * <UserProfile\n * cardLayout={true}\n * fallback={<div>Please sign in to view your profile</div>}\n * />\n * ```\n */\nconst UserProfile: FC<UserProfileProps> = ({preferences, editable = true, ...rest}: UserProfileProps): ReactElement => {\n const {preferences: contextPreferences} = useThunderID();\n const {profile, flattenedProfile, onUpdateProfile, updateProfile, userSchema} = useUser();\n const resolvedPreferences = {\n ...contextPreferences,\n ...preferences,\n user: {\n ...contextPreferences?.user,\n ...preferences?.user,\n },\n };\n const {t} = useTranslation(resolvedPreferences?.i18n);\n const isEditableProfile: boolean = resolvedPreferences?.user?.fetchUserProfile === false ? false : editable;\n\n const [error, setError] = useState<string | null>(null);\n\n const handleProfileUpdate = async (payload: any): Promise<void> => {\n setError(null);\n\n const updatedAttributes = deepMerge((profile?.['attributes'] as Record<string, unknown>) ?? {}, payload);\n\n Object.keys(updatedAttributes).forEach((key) => {\n if (updatedAttributes[key] === undefined || updatedAttributes[key] === null) {\n delete updatedAttributes[key];\n }\n });\n\n const result: {data: {user: User}; error: string; success: boolean} = await updateProfile(\n {payload: updatedAttributes},\n await getSessionId(),\n );\n\n if (result.success) {\n onUpdateProfile(result.data.user);\n } else {\n setError(result.error || t('user.profile.update.generic.error'));\n }\n };\n\n return (\n <BaseUserProfile\n profile={profile!}\n flattenedProfile={flattenedProfile!}\n userSchema={userSchema}\n editable={isEditableProfile}\n onUpdate={isEditableProfile ? handleProfileUpdate : undefined}\n error={error}\n preferences={resolvedPreferences}\n {...rest}\n />\n );\n};\n\nexport default UserProfile;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,MAAMA,eAAqC,EAAC,aAAa,WAAW,KAAM,GAAG,WAA0C;CACrH,MAAM,EAAC,aAAa,uBAAsBC,sBAAc;CACxD,MAAM,EAAC,SAAS,kBAAkB,iBAAiB,eAAe,eAAc,SAAS;CACzF,MAAM,sBAAsB;EAC1B,GAAG;EACH,GAAG;EACH,MAAM;GACJ,GAAG,oBAAoB;GACvB,GAAG,aAAa;GACjB;EACF;CACD,MAAM,EAAC,MAAK,eAAe,qBAAqB,KAAK;CACrD,MAAMC,oBAA6B,qBAAqB,MAAM,qBAAqB,QAAQ,QAAQ;CAEnG,MAAM,CAAC,OAAO,YAAY,SAAwB,KAAK;CAEvD,MAAM,sBAAsB,OAAO,YAAgC;AACjE,WAAS,KAAK;EAEd,MAAM,oBAAoB,UAAW,UAAU,iBAA6C,EAAE,EAAE,QAAQ;AAExG,SAAO,KAAK,kBAAkB,CAAC,SAAS,QAAQ;AAC9C,OAAI,kBAAkB,SAAS,UAAa,kBAAkB,SAAS,KACrE,QAAO,kBAAkB;IAE3B;EAEF,MAAMC,SAAgE,MAAM,cAC1E,EAAC,SAAS,mBAAkB,EAC5B,MAAMC,sBAAc,CACrB;AAED,MAAI,OAAO,QACT,iBAAgB,OAAO,KAAK,KAAK;MAEjC,UAAS,OAAO,SAAS,EAAE,oCAAoC,CAAC;;AAIpE,QACE,oBAAC;EACU;EACS;EACN;EACZ,UAAU;EACV,UAAU,oBAAoB,sBAAsB;EAC7C;EACP,aAAa;EACb,GAAI;GACJ;;AAIN,0BAAe"}
1
+ {"version":3,"file":"UserProfile.js","names":["UserProfile: FC<UserProfileProps>","useThunderID","isEditableProfile: boolean","result: {data: {user: User}; error: string; success: boolean}","getSessionId","VerifyAttribute"],"sources":["../../../../../src/client/components/account/UserProfile/UserProfile.tsx"],"sourcesContent":["// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\n'use client';\n\nimport {AttributeVerificationConstants, deepMerge, User} from '@thunderid/node';\nimport {\n BaseUserProfile,\n BaseUserProfileProps,\n BaseUserProfileVerificationRenderProps,\n useUser,\n useTranslation,\n} from '@thunderid/react';\nimport {FC, ReactElement, ReactNode, useState} from 'react';\nimport useThunderID from '../../../contexts/ThunderID/useThunderID';\nimport getSessionId from '../../../../server/actions/getSessionId';\nimport VerifyAttribute from '../VerifyAttribute/VerifyAttribute';\n\n/**\n * Props for the UserProfile component.\n * Extends BaseUserProfileProps but makes the user prop optional since it will be obtained from useThunderID\n */\nexport type UserProfileProps = Omit<BaseUserProfileProps, 'user' | 'profile' | 'flattenedProfile'> & {\n /**\n * Handle of the `SELF` flow that verifies an attribute. Defaults to the server's shipped\n * `default-self-attribute-verification-flow`.\n */\n verificationFlowHandle?: string;\n};\n\n/**\n * UserProfile component displays the authenticated user's profile information in a\n * structured and styled format. It shows user details such as display name, email,\n * username, and other available profile information from ThunderID.\n *\n * This component is the React-specific implementation that uses the BaseUserProfile\n * and automatically retrieves the user data from ThunderID context if not provided.\n *\n * @example\n * ```tsx\n * // Basic usage - will use user from ThunderID context\n * <UserProfile />\n *\n * // With explicit user data\n * <UserProfile user={specificUser} />\n *\n * // With card layout and custom fallback\n * <UserProfile\n * cardLayout={true}\n * fallback={<div>Please sign in to view your profile</div>}\n * />\n * ```\n */\nconst UserProfile: FC<UserProfileProps> = ({\n preferences,\n editable = true,\n verificationFlowHandle = AttributeVerificationConstants.DEFAULT_FLOW_HANDLE,\n ...rest\n}: UserProfileProps): ReactElement => {\n const {preferences: contextPreferences} = useThunderID();\n const {profile, flattenedProfile, onUpdateProfile, updateProfile, userSchema} = useUser();\n const resolvedPreferences = {\n ...contextPreferences,\n ...preferences,\n user: {\n ...contextPreferences?.user,\n ...preferences?.user,\n },\n };\n const {t} = useTranslation(resolvedPreferences?.i18n);\n const isEditableProfile: boolean = resolvedPreferences?.user?.fetchUserProfile === false ? false : editable;\n\n const [error, setError] = useState<string | null>(null);\n\n const handleProfileUpdate = async (payload: any): Promise<void> => {\n setError(null);\n\n const updatedAttributes = deepMerge((profile?.['attributes'] as Record<string, unknown>) ?? {}, payload);\n\n Object.keys(updatedAttributes).forEach((key) => {\n if (updatedAttributes[key] === undefined || updatedAttributes[key] === null) {\n delete updatedAttributes[key];\n }\n });\n\n const result: {data: {user: User}; error: string; success: boolean} = await updateProfile(\n {payload: updatedAttributes},\n await getSessionId(),\n );\n\n if (result.success) {\n onUpdateProfile(result.data.user);\n } else {\n setError(result.error || t('user.profile.update.generic.error'));\n }\n };\n\n const renderVerification = ({\n attribute,\n attributeDisplayName,\n onCancel,\n }: BaseUserProfileVerificationRenderProps): ReactNode => (\n <VerifyAttribute\n key={attribute}\n attribute={attribute}\n attributeDisplayName={attributeDisplayName}\n flowHandle={verificationFlowHandle}\n preferences={resolvedPreferences}\n onCancel={onCancel}\n onDone={onCancel}\n />\n );\n\n return (\n <BaseUserProfile\n renderVerification={isEditableProfile ? renderVerification : undefined}\n profile={profile!}\n flattenedProfile={flattenedProfile!}\n userSchema={userSchema}\n editable={isEditableProfile}\n onUpdate={isEditableProfile ? handleProfileUpdate : undefined}\n error={error}\n preferences={resolvedPreferences}\n {...rest}\n />\n );\n};\n\nexport default UserProfile;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDA,MAAMA,eAAqC,EACzC,aACA,WAAW,MACX,yBAAyB,+BAA+B,oBACxD,GAAG,WACiC;CACpC,MAAM,EAAC,aAAa,uBAAsBC,sBAAc;CACxD,MAAM,EAAC,SAAS,kBAAkB,iBAAiB,eAAe,eAAc,SAAS;CACzF,MAAM,sBAAsB;EAC1B,GAAG;EACH,GAAG;EACH,MAAM;GACJ,GAAG,oBAAoB;GACvB,GAAG,aAAa;GACjB;EACF;CACD,MAAM,EAAC,MAAK,eAAe,qBAAqB,KAAK;CACrD,MAAMC,oBAA6B,qBAAqB,MAAM,qBAAqB,QAAQ,QAAQ;CAEnG,MAAM,CAAC,OAAO,YAAY,SAAwB,KAAK;CAEvD,MAAM,sBAAsB,OAAO,YAAgC;AACjE,WAAS,KAAK;EAEd,MAAM,oBAAoB,UAAW,UAAU,iBAA6C,EAAE,EAAE,QAAQ;AAExG,SAAO,KAAK,kBAAkB,CAAC,SAAS,QAAQ;AAC9C,OAAI,kBAAkB,SAAS,UAAa,kBAAkB,SAAS,KACrE,QAAO,kBAAkB;IAE3B;EAEF,MAAMC,SAAgE,MAAM,cAC1E,EAAC,SAAS,mBAAkB,EAC5B,MAAMC,sBAAc,CACrB;AAED,MAAI,OAAO,QACT,iBAAgB,OAAO,KAAK,KAAK;MAEjC,UAAS,OAAO,SAAS,EAAE,oCAAoC,CAAC;;CAIpE,MAAM,sBAAsB,EAC1B,WACA,sBACA,eAEA,oBAACC;EAEY;EACW;EACtB,YAAY;EACZ,aAAa;EACH;EACV,QAAQ;IANH,UAOL;AAGJ,QACE,oBAAC;EACC,oBAAoB,oBAAoB,qBAAqB;EACpD;EACS;EACN;EACZ,UAAU;EACV,UAAU,oBAAoB,sBAAsB;EAC7C;EACP,aAAa;EACb,GAAI;GACJ;;AAIN,0BAAe"}
@@ -0,0 +1,41 @@
1
+ import { BaseVerifyAttributeProps } from '@thunderid/react';
2
+ import { FC } from 'react';
3
+ /**
4
+ * Props for the VerifyAttribute component.
5
+ * Mirrors `@thunderid/react`'s `VerifyAttributeProps`, so a consumer moving between the React and
6
+ * Next.js SDKs doesn't need to change how they call it.
7
+ */
8
+ export type VerifyAttributeProps = Omit<BaseVerifyAttributeProps, 'onInitialize' | 'onSubmit' | 'isInitialized'> & {
9
+ /**
10
+ * Name of the signed-in user's attribute to verify, such as `email`. Only a top-level, single-valued
11
+ * `email` or `mobile` property of the user's schema can be verified; any other is refused without a
12
+ * request, through `onError`, with `VerifyAttribute-handleInitialize-RuntimeError-001`.
13
+ */
14
+ attribute: string;
15
+ /**
16
+ * Handle of the `SELF` flow to run. Defaults to the server's shipped
17
+ * `default-self-attribute-verification-flow`.
18
+ */
19
+ flowHandle?: string;
20
+ };
21
+ /**
22
+ * VerifyAttribute verifies one of the signed-in user's attributes, such as their email address, by
23
+ * running a self attribute verification flow named by `flowHandle`.
24
+ *
25
+ * This is the Next.js-specific implementation: it renders `BaseVerifyAttribute` from
26
+ * `@thunderid/react`, but runs every step through `executeSelfFlowAction` (a server action that
27
+ * attaches the server-held session's access token) instead of calling the ThunderID server from the
28
+ * browser. Once the server records the verification, and when the user selects Done after a link is
29
+ * sent, it re-reads the user's profile.
30
+ *
31
+ * Mount it with a `key` per attribute: each mount starts a new verification and sends a new code or
32
+ * link.
33
+ *
34
+ * @example
35
+ * ```tsx
36
+ * <VerifyAttribute attribute="email" onComplete={() => setOpen(false)} onCancel={() => setOpen(false)} />
37
+ * ```
38
+ */
39
+ declare const VerifyAttribute: FC<VerifyAttributeProps>;
40
+ export default VerifyAttribute;
41
+ //# sourceMappingURL=VerifyAttribute.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VerifyAttribute.d.ts","sourceRoot":"","sources":["../../../../../src/client/components/account/VerifyAttribute/VerifyAttribute.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAsB,wBAAwB,EAAU,MAAM,kBAAkB,CAAC;AACxF,OAAO,EAAC,EAAE,EAA4B,MAAM,OAAO,CAAC;AAMpD;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,wBAAwB,EAAE,cAAc,GAAG,UAAU,GAAG,eAAe,CAAC,GAAG;IACjH;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAmBF;;;;;;;;;;;;;;;;;GAiBG;AACH,QAAA,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CAyD7C,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -0,0 +1,75 @@
1
+ 'use client';
2
+
3
+
4
+ import useThunderID_default from "../../../contexts/ThunderID/useThunderID.js";
5
+ import executeSelfFlowAction_default from "../../../../server/actions/auth/executeSelfFlowAction.js";
6
+ import { AttributeVerificationConstants, EmbeddedFlowType, ThunderIDAPIError, ThunderIDRuntimeError, isVerifiableAttribute, startCase } from "@thunderid/node";
7
+ import { BaseVerifyAttribute, useUser } from "@thunderid/react";
8
+ import { useCallback } from "react";
9
+ import { jsx } from "react/jsx-runtime";
10
+
11
+ //#region src/client/components/account/VerifyAttribute/VerifyAttribute.tsx
12
+ const execute = async (payload) => {
13
+ const result = await executeSelfFlowAction_default(payload);
14
+ if (!result.success) throw new ThunderIDAPIError("SELF flow request failed", "VerifyAttribute-execute-ResponseError-001", "nextjs", result.statusCode);
15
+ return result.data;
16
+ };
17
+ /**
18
+ * VerifyAttribute verifies one of the signed-in user's attributes, such as their email address, by
19
+ * running a self attribute verification flow named by `flowHandle`.
20
+ *
21
+ * This is the Next.js-specific implementation: it renders `BaseVerifyAttribute` from
22
+ * `@thunderid/react`, but runs every step through `executeSelfFlowAction` (a server action that
23
+ * attaches the server-held session's access token) instead of calling the ThunderID server from the
24
+ * browser. Once the server records the verification, and when the user selects Done after a link is
25
+ * sent, it re-reads the user's profile.
26
+ *
27
+ * Mount it with a `key` per attribute: each mount starts a new verification and sends a new code or
28
+ * link.
29
+ *
30
+ * @example
31
+ * ```tsx
32
+ * <VerifyAttribute attribute="email" onComplete={() => setOpen(false)} onCancel={() => setOpen(false)} />
33
+ * ```
34
+ */
35
+ const VerifyAttribute = ({ attribute, attributeDisplayName, flowHandle = AttributeVerificationConstants.DEFAULT_FLOW_HANDLE, onComplete, onDone,...rest }) => {
36
+ const { isLoading } = useThunderID_default();
37
+ const { revalidateProfile, userSchema } = useUser();
38
+ const refreshProfile = useCallback(async () => {
39
+ try {
40
+ await revalidateProfile?.();
41
+ } catch {}
42
+ }, [revalidateProfile]);
43
+ const handleInitialize = useCallback(() => {
44
+ if (!isVerifiableAttribute(userSchema, attribute)) return Promise.reject(new ThunderIDRuntimeError(`Attribute "${attribute}" is not a verifiable email or mobile attribute.`, "VerifyAttribute-handleInitialize-RuntimeError-001", "nextjs", "Only a top-level, single-valued email or mobile attribute of the user schema can be verified."));
45
+ return execute({
46
+ flowType: EmbeddedFlowType.Self,
47
+ handle: flowHandle,
48
+ inputs: { [AttributeVerificationConstants.ATTRIBUTE_INPUT]: attribute }
49
+ });
50
+ }, [
51
+ attribute,
52
+ flowHandle,
53
+ userSchema
54
+ ]);
55
+ return /* @__PURE__ */ jsx(BaseVerifyAttribute, {
56
+ ...rest,
57
+ attributeDisplayName: attributeDisplayName ?? userSchema?.[attribute]?.displayName ?? startCase(attribute),
58
+ isInitialized: !isLoading,
59
+ onInitialize: handleInitialize,
60
+ onSubmit: execute,
61
+ onComplete: (response) => {
62
+ refreshProfile();
63
+ onComplete?.(response);
64
+ },
65
+ onDone: () => {
66
+ refreshProfile();
67
+ onDone?.();
68
+ }
69
+ });
70
+ };
71
+ var VerifyAttribute_default = VerifyAttribute;
72
+
73
+ //#endregion
74
+ export { VerifyAttribute_default as default };
75
+ //# sourceMappingURL=VerifyAttribute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VerifyAttribute.js","names":["result: ExecuteSelfFlowActionResult","executeSelfFlowAction","VerifyAttribute: FC<VerifyAttributeProps>","useThunderID"],"sources":["../../../../../src/client/components/account/VerifyAttribute/VerifyAttribute.tsx"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\n'use client';\n\nimport {\n AttributeVerificationConstants,\n EmbeddedFlowType,\n EmbeddedSelfFlowRequest,\n EmbeddedSelfFlowResponse,\n ThunderIDAPIError,\n ThunderIDRuntimeError,\n isVerifiableAttribute,\n startCase,\n} from '@thunderid/node';\nimport {BaseVerifyAttribute, BaseVerifyAttributeProps, useUser} from '@thunderid/react';\nimport {FC, ReactElement, useCallback} from 'react';\nimport executeSelfFlowAction, {\n ExecuteSelfFlowActionResult,\n} from '../../../../server/actions/auth/executeSelfFlowAction';\nimport useThunderID from '../../../contexts/ThunderID/useThunderID';\n\n/**\n * Props for the VerifyAttribute component.\n * Mirrors `@thunderid/react`'s `VerifyAttributeProps`, so a consumer moving between the React and\n * Next.js SDKs doesn't need to change how they call it.\n */\nexport type VerifyAttributeProps = Omit<BaseVerifyAttributeProps, 'onInitialize' | 'onSubmit' | 'isInitialized'> & {\n /**\n * Name of the signed-in user's attribute to verify, such as `email`. Only a top-level, single-valued\n * `email` or `mobile` property of the user's schema can be verified; any other is refused without a\n * request, through `onError`, with `VerifyAttribute-handleInitialize-RuntimeError-001`.\n */\n attribute: string;\n /**\n * Handle of the `SELF` flow to run. Defaults to the server's shipped\n * `default-self-attribute-verification-flow`.\n */\n flowHandle?: string;\n};\n\n// Runs one step through the server action, which attaches the session's access token. A failure\n// raises `VerifyAttribute-execute-ResponseError-001` with the refusal's status, never the server's reply.\nconst execute = async (payload: EmbeddedSelfFlowRequest): Promise<EmbeddedSelfFlowResponse> => {\n const result: ExecuteSelfFlowActionResult = await executeSelfFlowAction(payload);\n\n if (!result.success) {\n throw new ThunderIDAPIError(\n 'SELF flow request failed',\n 'VerifyAttribute-execute-ResponseError-001',\n 'nextjs',\n result.statusCode,\n );\n }\n\n return result.data;\n};\n\n/**\n * VerifyAttribute verifies one of the signed-in user's attributes, such as their email address, by\n * running a self attribute verification flow named by `flowHandle`.\n *\n * This is the Next.js-specific implementation: it renders `BaseVerifyAttribute` from\n * `@thunderid/react`, but runs every step through `executeSelfFlowAction` (a server action that\n * attaches the server-held session's access token) instead of calling the ThunderID server from the\n * browser. Once the server records the verification, and when the user selects Done after a link is\n * sent, it re-reads the user's profile.\n *\n * Mount it with a `key` per attribute: each mount starts a new verification and sends a new code or\n * link.\n *\n * @example\n * ```tsx\n * <VerifyAttribute attribute=\"email\" onComplete={() => setOpen(false)} onCancel={() => setOpen(false)} />\n * ```\n */\nconst VerifyAttribute: FC<VerifyAttributeProps> = ({\n attribute,\n attributeDisplayName,\n flowHandle = AttributeVerificationConstants.DEFAULT_FLOW_HANDLE,\n onComplete,\n onDone,\n ...rest\n}: VerifyAttributeProps): ReactElement => {\n const {isLoading} = useThunderID();\n const {revalidateProfile, userSchema} = useUser();\n\n // Re-reads the profile so the recorded verification shows; a failure leaves it stale, not broken.\n const refreshProfile = useCallback(async (): Promise<void> => {\n try {\n await revalidateProfile?.();\n } catch {\n // Non-fatal: the profile stays stale until the next re-read.\n }\n }, [revalidateProfile]);\n\n const handleInitialize = useCallback((): Promise<EmbeddedSelfFlowResponse> => {\n if (!isVerifiableAttribute(userSchema, attribute)) {\n return Promise.reject(\n new ThunderIDRuntimeError(\n `Attribute \"${attribute}\" is not a verifiable email or mobile attribute.`,\n 'VerifyAttribute-handleInitialize-RuntimeError-001',\n 'nextjs',\n 'Only a top-level, single-valued email or mobile attribute of the user schema can be verified.',\n ),\n );\n }\n\n return execute({\n flowType: EmbeddedFlowType.Self,\n handle: flowHandle,\n inputs: {[AttributeVerificationConstants.ATTRIBUTE_INPUT]: attribute},\n });\n }, [attribute, flowHandle, userSchema]);\n\n return (\n <BaseVerifyAttribute\n {...rest}\n attributeDisplayName={attributeDisplayName ?? userSchema?.[attribute]?.displayName ?? startCase(attribute)}\n // The schema decides whether the attribute can be verified, so wait for the session to load.\n isInitialized={!isLoading}\n onInitialize={handleInitialize}\n onSubmit={execute}\n onComplete={(response: EmbeddedSelfFlowResponse): void => {\n void refreshProfile();\n onComplete?.(response);\n }}\n onDone={(): void => {\n void refreshProfile();\n onDone?.();\n }}\n />\n );\n};\n\nexport default VerifyAttribute;\n"],"mappings":";;;;;;;;;;;AA2CA,MAAM,UAAU,OAAO,YAAwE;CAC7F,MAAMA,SAAsC,MAAMC,8BAAsB,QAAQ;AAEhF,KAAI,CAAC,OAAO,QACV,OAAM,IAAI,kBACR,4BACA,6CACA,UACA,OAAO,WACR;AAGH,QAAO,OAAO;;;;;;;;;;;;;;;;;;;;AAqBhB,MAAMC,mBAA6C,EACjD,WACA,sBACA,aAAa,+BAA+B,qBAC5C,YACA,OACA,GAAG,WACqC;CACxC,MAAM,EAAC,cAAaC,sBAAc;CAClC,MAAM,EAAC,mBAAmB,eAAc,SAAS;CAGjD,MAAM,iBAAiB,YAAY,YAA2B;AAC5D,MAAI;AACF,SAAM,qBAAqB;UACrB;IAGP,CAAC,kBAAkB,CAAC;CAEvB,MAAM,mBAAmB,kBAAqD;AAC5E,MAAI,CAAC,sBAAsB,YAAY,UAAU,CAC/C,QAAO,QAAQ,OACb,IAAI,sBACF,cAAc,UAAU,mDACxB,qDACA,UACA,gGACD,CACF;AAGH,SAAO,QAAQ;GACb,UAAU,iBAAiB;GAC3B,QAAQ;GACR,QAAQ,GAAE,+BAA+B,kBAAkB,WAAU;GACtE,CAAC;IACD;EAAC;EAAW;EAAY;EAAW,CAAC;AAEvC,QACE,oBAAC;EACC,GAAI;EACJ,sBAAsB,wBAAwB,aAAa,YAAY,eAAe,UAAU,UAAU;EAE1G,eAAe,CAAC;EAChB,cAAc;EACd,UAAU;EACV,aAAa,aAA6C;AACxD,GAAK,gBAAgB;AACrB,gBAAa,SAAS;;EAExB,cAAoB;AAClB,GAAK,gBAAgB;AACrB,aAAU;;GAEZ;;AAIN,8BAAe"}