@thunderid/nextjs 0.2.0 → 0.2.2

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 (349) hide show
  1. package/dist/{types/ThunderIDNextClient.d.ts → ThunderIDNextClient.d.ts} +2 -9
  2. package/dist/ThunderIDNextClient.d.ts.map +1 -0
  3. package/dist/ThunderIDNextClient.js +161 -0
  4. package/dist/ThunderIDNextClient.js.map +1 -0
  5. package/dist/cjs/ThunderIDNextClient.cjs +163 -0
  6. package/dist/cjs/ThunderIDNextClient.cjs.map +1 -0
  7. package/dist/cjs/_virtual/rolldown_runtime.cjs +25 -0
  8. package/dist/cjs/client/components/actions/SignInButton/SignInButton.cjs +79 -0
  9. package/dist/cjs/client/components/actions/SignInButton/SignInButton.cjs.map +1 -0
  10. package/dist/cjs/client/components/actions/SignOutButton/SignOutButton.cjs +61 -0
  11. package/dist/cjs/client/components/actions/SignOutButton/SignOutButton.cjs.map +1 -0
  12. package/dist/cjs/client/components/actions/SignUpButton/SignUpButton.cjs +91 -0
  13. package/dist/cjs/client/components/actions/SignUpButton/SignUpButton.cjs.map +1 -0
  14. package/dist/cjs/client/components/control/SignedIn/SignedIn.cjs +34 -0
  15. package/dist/cjs/client/components/control/SignedIn/SignedIn.cjs.map +1 -0
  16. package/dist/cjs/client/components/control/SignedOut/SignedOut.cjs +34 -0
  17. package/dist/cjs/client/components/control/SignedOut/SignedOut.cjs.map +1 -0
  18. package/dist/cjs/client/components/presentation/SignIn/SignIn.cjs +37 -0
  19. package/dist/cjs/client/components/presentation/SignIn/SignIn.cjs.map +1 -0
  20. package/dist/cjs/client/components/presentation/SignUp/SignUp.cjs +79 -0
  21. package/dist/cjs/client/components/presentation/SignUp/SignUp.cjs.map +1 -0
  22. package/dist/cjs/client/components/presentation/User/User.cjs +49 -0
  23. package/dist/cjs/client/components/presentation/User/User.cjs.map +1 -0
  24. package/dist/cjs/client/components/presentation/UserDropdown/UserDropdown.cjs +114 -0
  25. package/dist/cjs/client/components/presentation/UserDropdown/UserDropdown.cjs.map +1 -0
  26. package/dist/cjs/client/components/presentation/UserProfile/UserProfile.cjs +52 -0
  27. package/dist/cjs/client/components/presentation/UserProfile/UserProfile.cjs.map +1 -0
  28. package/dist/cjs/client/contexts/ThunderID/ThunderIDContext.cjs +34 -0
  29. package/dist/cjs/client/contexts/ThunderID/ThunderIDContext.cjs.map +1 -0
  30. package/dist/cjs/client/contexts/ThunderID/ThunderIDProvider.cjs +165 -0
  31. package/dist/cjs/client/contexts/ThunderID/ThunderIDProvider.cjs.map +1 -0
  32. package/dist/cjs/client/contexts/ThunderID/useThunderID.cjs +19 -0
  33. package/dist/cjs/client/contexts/ThunderID/useThunderID.cjs.map +1 -0
  34. package/dist/cjs/client/index.cjs +11 -0
  35. package/dist/cjs/constants/sessionConstants.cjs +55 -0
  36. package/dist/cjs/constants/sessionConstants.cjs.map +1 -0
  37. package/dist/cjs/index.cjs +35 -1037
  38. package/dist/cjs/server/ThunderIDProvider.cjs +114 -0
  39. package/dist/cjs/server/ThunderIDProvider.cjs.map +1 -0
  40. package/dist/cjs/server/actions/clearSession.cjs +41 -0
  41. package/dist/cjs/server/actions/clearSession.cjs.map +1 -0
  42. package/dist/cjs/server/actions/getAccessToken.cjs +27 -0
  43. package/dist/cjs/server/actions/getAccessToken.cjs.map +1 -0
  44. package/dist/cjs/server/actions/getClientOrigin.cjs +18 -0
  45. package/dist/cjs/server/actions/getClientOrigin.cjs.map +1 -0
  46. package/dist/cjs/server/actions/getSessionId.cjs +28 -0
  47. package/dist/cjs/server/actions/getSessionId.cjs.map +1 -0
  48. package/dist/cjs/server/actions/getSessionPayload.cjs +29 -0
  49. package/dist/cjs/server/actions/getSessionPayload.cjs.map +1 -0
  50. package/dist/cjs/server/actions/getUserAction.cjs +30 -0
  51. package/dist/cjs/server/actions/getUserAction.cjs.map +1 -0
  52. package/dist/cjs/server/actions/getUserProfileAction.cjs +34 -0
  53. package/dist/cjs/server/actions/getUserProfileAction.cjs.map +1 -0
  54. package/dist/cjs/server/actions/handleOAuthCallbackAction.cjs +89 -0
  55. package/dist/cjs/server/actions/handleOAuthCallbackAction.cjs.map +1 -0
  56. package/dist/cjs/server/actions/isSignedIn.cjs +40 -0
  57. package/dist/cjs/server/actions/isSignedIn.cjs.map +1 -0
  58. package/dist/cjs/server/actions/refreshToken.cjs +61 -0
  59. package/dist/cjs/server/actions/refreshToken.cjs.map +1 -0
  60. package/dist/cjs/server/actions/signInAction.cjs +95 -0
  61. package/dist/cjs/server/actions/signInAction.cjs.map +1 -0
  62. package/dist/cjs/server/actions/signOutAction.cjs +57 -0
  63. package/dist/cjs/server/actions/signOutAction.cjs.map +1 -0
  64. package/dist/cjs/server/actions/signUpAction.cjs +27 -0
  65. package/dist/cjs/server/actions/signUpAction.cjs.map +1 -0
  66. package/dist/cjs/server/actions/updateUserProfileAction.cjs +30 -0
  67. package/dist/cjs/server/actions/updateUserProfileAction.cjs.map +1 -0
  68. package/dist/cjs/server/getClient.cjs +19 -0
  69. package/dist/cjs/server/getClient.cjs.map +1 -0
  70. package/dist/cjs/server/index.cjs +9 -0
  71. package/dist/cjs/server/proxy/createRouteMatcher.cjs +36 -0
  72. package/dist/cjs/server/proxy/createRouteMatcher.cjs.map +1 -0
  73. package/dist/cjs/server/proxy/thunderIDProxy.cjs +182 -0
  74. package/dist/cjs/server/proxy/thunderIDProxy.cjs.map +1 -0
  75. package/dist/cjs/server/thunderid.cjs +27 -0
  76. package/dist/cjs/server/thunderid.cjs.map +1 -0
  77. package/dist/cjs/utils/SessionManager.cjs +150 -0
  78. package/dist/cjs/utils/SessionManager.cjs.map +1 -0
  79. package/dist/cjs/utils/decorateConfigWithNextEnv.cjs +28 -0
  80. package/dist/cjs/utils/decorateConfigWithNextEnv.cjs.map +1 -0
  81. package/dist/cjs/utils/handleRefreshToken.cjs +62 -0
  82. package/dist/cjs/utils/handleRefreshToken.cjs.map +1 -0
  83. package/dist/cjs/utils/logger.cjs +11 -0
  84. package/dist/cjs/utils/logger.cjs.map +1 -0
  85. package/dist/cjs/utils/sessionUtils.cjs +40 -0
  86. package/dist/cjs/utils/sessionUtils.cjs.map +1 -0
  87. package/dist/client/components/actions/SignInButton/SignInButton.d.ts.map +1 -0
  88. package/dist/client/components/actions/SignInButton/SignInButton.js +73 -0
  89. package/dist/client/components/actions/SignInButton/SignInButton.js.map +1 -0
  90. package/dist/client/components/actions/SignOutButton/SignOutButton.d.ts.map +1 -0
  91. package/dist/client/components/actions/SignOutButton/SignOutButton.js +57 -0
  92. package/dist/client/components/actions/SignOutButton/SignOutButton.js.map +1 -0
  93. package/dist/client/components/actions/SignUpButton/SignUpButton.d.ts.map +1 -0
  94. package/dist/client/components/actions/SignUpButton/SignUpButton.js +85 -0
  95. package/dist/client/components/actions/SignUpButton/SignUpButton.js.map +1 -0
  96. package/dist/client/components/control/Loading/Loading.d.ts.map +1 -0
  97. package/dist/client/components/control/SignedIn/SignedIn.d.ts.map +1 -0
  98. package/dist/client/components/control/SignedIn/SignedIn.js +32 -0
  99. package/dist/client/components/control/SignedIn/SignedIn.js.map +1 -0
  100. package/dist/client/components/control/SignedOut/SignedOut.d.ts.map +1 -0
  101. package/dist/client/components/control/SignedOut/SignedOut.js +32 -0
  102. package/dist/client/components/control/SignedOut/SignedOut.js.map +1 -0
  103. package/dist/{types/client → client}/components/presentation/SignIn/SignIn.d.ts +0 -38
  104. package/dist/client/components/presentation/SignIn/SignIn.d.ts.map +1 -0
  105. package/dist/client/components/presentation/SignIn/SignIn.js +33 -0
  106. package/dist/client/components/presentation/SignIn/SignIn.js.map +1 -0
  107. package/dist/client/components/presentation/SignUp/SignUp.d.ts.map +1 -0
  108. package/dist/client/components/presentation/SignUp/SignUp.js +75 -0
  109. package/dist/client/components/presentation/SignUp/SignUp.js.map +1 -0
  110. package/dist/client/components/presentation/User/User.d.ts.map +1 -0
  111. package/dist/client/components/presentation/User/User.js +46 -0
  112. package/dist/client/components/presentation/User/User.js.map +1 -0
  113. package/dist/client/components/presentation/UserDropdown/UserDropdown.d.ts.map +1 -0
  114. package/dist/client/components/presentation/UserDropdown/UserDropdown.js +110 -0
  115. package/dist/client/components/presentation/UserDropdown/UserDropdown.js.map +1 -0
  116. package/dist/client/components/presentation/UserProfile/UserProfile.d.ts.map +1 -0
  117. package/dist/client/components/presentation/UserProfile/UserProfile.js +49 -0
  118. package/dist/client/components/presentation/UserProfile/UserProfile.js.map +1 -0
  119. package/dist/client/contexts/ThunderID/ThunderIDContext.d.ts.map +1 -0
  120. package/dist/client/contexts/ThunderID/ThunderIDContext.js +32 -0
  121. package/dist/client/contexts/ThunderID/ThunderIDContext.js.map +1 -0
  122. package/dist/{types/client → client}/contexts/ThunderID/ThunderIDProvider.d.ts +1 -8
  123. package/dist/client/contexts/ThunderID/ThunderIDProvider.d.ts.map +1 -0
  124. package/dist/client/contexts/ThunderID/ThunderIDProvider.js +159 -0
  125. package/dist/client/contexts/ThunderID/ThunderIDProvider.js.map +1 -0
  126. package/dist/client/contexts/ThunderID/useThunderID.d.ts.map +1 -0
  127. package/dist/client/contexts/ThunderID/useThunderID.js +17 -0
  128. package/dist/client/contexts/ThunderID/useThunderID.js.map +1 -0
  129. package/dist/{types/client → client}/index.d.ts +2 -10
  130. package/dist/client/index.d.ts.map +1 -0
  131. package/dist/client/index.js +13 -0
  132. package/dist/configs/InternalAuthAPIRoutesConfig.d.ts.map +1 -0
  133. package/dist/constants/sessionConstants.d.ts.map +1 -0
  134. package/dist/constants/sessionConstants.js +53 -0
  135. package/dist/constants/sessionConstants.js.map +1 -0
  136. package/dist/index.d.ts.map +1 -0
  137. package/dist/index.js +20 -981
  138. package/dist/models/api.d.ts.map +1 -0
  139. package/dist/models/config.d.ts.map +1 -0
  140. package/dist/server/ThunderIDProvider.d.ts.map +1 -0
  141. package/dist/server/ThunderIDProvider.js +111 -0
  142. package/dist/server/ThunderIDProvider.js.map +1 -0
  143. package/dist/server/actions/clearSession.d.ts.map +1 -0
  144. package/dist/server/actions/clearSession.js +39 -0
  145. package/dist/server/actions/clearSession.js.map +1 -0
  146. package/dist/server/actions/getAccessToken.d.ts.map +1 -0
  147. package/dist/{getAccessToken-DCP_zasP.js → server/actions/getAccessToken.js} +8 -5
  148. package/dist/server/actions/getAccessToken.js.map +1 -0
  149. package/dist/server/actions/getClientOrigin.d.ts.map +1 -0
  150. package/dist/server/actions/getClientOrigin.js +16 -0
  151. package/dist/server/actions/getClientOrigin.js.map +1 -0
  152. package/dist/server/actions/getSessionId.d.ts.map +1 -0
  153. package/dist/{getSessionId-Ctmvpfgp.js → server/actions/getSessionId.js} +8 -5
  154. package/dist/server/actions/getSessionId.js.map +1 -0
  155. package/dist/server/actions/getSessionPayload.d.ts.map +1 -0
  156. package/dist/server/actions/getSessionPayload.js +27 -0
  157. package/dist/server/actions/getSessionPayload.js.map +1 -0
  158. package/dist/server/actions/getUserAction.d.ts.map +1 -0
  159. package/dist/server/actions/getUserAction.js +30 -0
  160. package/dist/server/actions/getUserAction.js.map +1 -0
  161. package/dist/server/actions/getUserProfileAction.d.ts.map +1 -0
  162. package/dist/server/actions/getUserProfileAction.js +34 -0
  163. package/dist/server/actions/getUserProfileAction.js.map +1 -0
  164. package/dist/server/actions/handleOAuthCallbackAction.d.ts.map +1 -0
  165. package/dist/server/actions/handleOAuthCallbackAction.js +87 -0
  166. package/dist/server/actions/handleOAuthCallbackAction.js.map +1 -0
  167. package/dist/server/actions/isSignedIn.d.ts.map +1 -0
  168. package/dist/server/actions/isSignedIn.js +40 -0
  169. package/dist/server/actions/isSignedIn.js.map +1 -0
  170. package/dist/server/actions/refreshToken.d.ts.map +1 -0
  171. package/dist/server/actions/refreshToken.js +58 -0
  172. package/dist/server/actions/refreshToken.js.map +1 -0
  173. package/dist/{types/server → server}/actions/signInAction.d.ts +3 -3
  174. package/dist/server/actions/signInAction.d.ts.map +1 -0
  175. package/dist/server/actions/signInAction.js +92 -0
  176. package/dist/server/actions/signInAction.js.map +1 -0
  177. package/dist/server/actions/signOutAction.d.ts.map +1 -0
  178. package/dist/server/actions/signOutAction.js +55 -0
  179. package/dist/server/actions/signOutAction.js.map +1 -0
  180. package/dist/{types/server/actions/getMyOrganizations.d.ts → server/actions/signUpAction.d.ts} +10 -5
  181. package/dist/server/actions/signUpAction.d.ts.map +1 -0
  182. package/dist/server/actions/signUpAction.js +27 -0
  183. package/dist/server/actions/signUpAction.js.map +1 -0
  184. package/dist/server/actions/updateUserProfileAction.d.ts.map +1 -0
  185. package/dist/server/actions/updateUserProfileAction.js +30 -0
  186. package/dist/server/actions/updateUserProfileAction.js.map +1 -0
  187. package/dist/server/getClient.d.ts.map +1 -0
  188. package/dist/server/getClient.js +19 -0
  189. package/dist/server/getClient.js.map +1 -0
  190. package/dist/{types/server → server}/index.d.ts +3 -0
  191. package/dist/server/index.d.ts.map +1 -0
  192. package/dist/server/index.js +6 -0
  193. package/dist/server/proxy/createRouteMatcher.d.ts.map +1 -0
  194. package/dist/server/proxy/createRouteMatcher.js +35 -0
  195. package/dist/server/proxy/createRouteMatcher.js.map +1 -0
  196. package/dist/{types/server/middleware/thunderIDMiddleware.d.ts → server/proxy/thunderIDProxy.d.ts} +13 -13
  197. package/dist/server/proxy/thunderIDProxy.d.ts.map +1 -0
  198. package/dist/server/proxy/thunderIDProxy.js +180 -0
  199. package/dist/server/proxy/thunderIDProxy.js.map +1 -0
  200. package/dist/server/thunderid.d.ts.map +1 -0
  201. package/dist/server/thunderid.js +27 -0
  202. package/dist/server/thunderid.js.map +1 -0
  203. package/dist/utils/SessionManager.d.ts.map +1 -0
  204. package/dist/utils/SessionManager.js +147 -0
  205. package/dist/utils/SessionManager.js.map +1 -0
  206. package/dist/utils/createRouteMatcher.d.ts.map +1 -0
  207. package/dist/utils/decorateConfigWithNextEnv.d.ts.map +1 -0
  208. package/dist/utils/decorateConfigWithNextEnv.js +27 -0
  209. package/dist/utils/decorateConfigWithNextEnv.js.map +1 -0
  210. package/dist/utils/handleRefreshToken.d.ts.map +1 -0
  211. package/dist/utils/handleRefreshToken.js +62 -0
  212. package/dist/utils/handleRefreshToken.js.map +1 -0
  213. package/dist/utils/logger.d.ts.map +1 -0
  214. package/dist/utils/logger.js +9 -0
  215. package/dist/utils/logger.js.map +1 -0
  216. package/dist/utils/sessionUtils.d.ts.map +1 -0
  217. package/dist/utils/sessionUtils.js +39 -0
  218. package/dist/utils/sessionUtils.js.map +1 -0
  219. package/package.json +12 -22
  220. package/dist/SessionManager-BPpyyzfa.js +0 -1384
  221. package/dist/cache-B9tFVOO5.js +0 -8047
  222. package/dist/cjs/SessionManager-SBxwYnwV.js +0 -1397
  223. package/dist/cjs/cache-0QwhuLuy.js +0 -8050
  224. package/dist/cjs/dynamic-rendering-W7rdgerZ.js +0 -1540
  225. package/dist/cjs/getAccessToken-EiHUciAb.js +0 -22
  226. package/dist/cjs/getSessionId-BUDHvxX2.js +0 -5
  227. package/dist/cjs/getSessionId-Do242Vmz.js +0 -28
  228. package/dist/cjs/index2.cjs +0 -8
  229. package/dist/cjs/middleware.cjs +0 -5151
  230. package/dist/cjs/segment-CPZPzHDj.js +0 -52
  231. package/dist/cjs/server-BAGHs6kk.js +0 -2468
  232. package/dist/dynamic-rendering-CkPpk5pF.js +0 -1441
  233. package/dist/getSessionId-pG-rZbaH.js +0 -5
  234. package/dist/index2.js +0 -7
  235. package/dist/middleware.js +0 -5152
  236. package/dist/segment-D3vdYYI5.js +0 -47
  237. package/dist/server-Bn2BrWaL.js +0 -2418
  238. package/dist/types/ThunderIDNextClient.d.ts.map +0 -1
  239. package/dist/types/client/components/actions/SignInButton/SignInButton.d.ts.map +0 -1
  240. package/dist/types/client/components/actions/SignOutButton/SignOutButton.d.ts.map +0 -1
  241. package/dist/types/client/components/actions/SignUpButton/SignUpButton.d.ts.map +0 -1
  242. package/dist/types/client/components/control/Loading/Loading.d.ts.map +0 -1
  243. package/dist/types/client/components/control/SignedIn/SignedIn.d.ts.map +0 -1
  244. package/dist/types/client/components/control/SignedOut/SignedOut.d.ts.map +0 -1
  245. package/dist/types/client/components/presentation/CreateOrganization/CreateOrganization.d.ts +0 -68
  246. package/dist/types/client/components/presentation/CreateOrganization/CreateOrganization.d.ts.map +0 -1
  247. package/dist/types/client/components/presentation/Organization/Organization.d.ts +0 -67
  248. package/dist/types/client/components/presentation/Organization/Organization.d.ts.map +0 -1
  249. package/dist/types/client/components/presentation/OrganizationList/OrganizationList.d.ts +0 -93
  250. package/dist/types/client/components/presentation/OrganizationList/OrganizationList.d.ts.map +0 -1
  251. package/dist/types/client/components/presentation/OrganizationProfile/OrganizationProfile.d.ts +0 -120
  252. package/dist/types/client/components/presentation/OrganizationProfile/OrganizationProfile.d.ts.map +0 -1
  253. package/dist/types/client/components/presentation/OrganizationSwitcher/OrganizationSwitcher.d.ts +0 -72
  254. package/dist/types/client/components/presentation/OrganizationSwitcher/OrganizationSwitcher.d.ts.map +0 -1
  255. package/dist/types/client/components/presentation/SignIn/SignIn.d.ts.map +0 -1
  256. package/dist/types/client/components/presentation/SignUp/SignUp.d.ts.map +0 -1
  257. package/dist/types/client/components/presentation/User/User.d.ts.map +0 -1
  258. package/dist/types/client/components/presentation/UserDropdown/UserDropdown.d.ts.map +0 -1
  259. package/dist/types/client/components/presentation/UserProfile/UserProfile.d.ts.map +0 -1
  260. package/dist/types/client/contexts/ThunderID/ThunderIDContext.d.ts.map +0 -1
  261. package/dist/types/client/contexts/ThunderID/ThunderIDProvider.d.ts.map +0 -1
  262. package/dist/types/client/contexts/ThunderID/useThunderID.d.ts.map +0 -1
  263. package/dist/types/client/index.d.ts.map +0 -1
  264. package/dist/types/configs/InternalAuthAPIRoutesConfig.d.ts.map +0 -1
  265. package/dist/types/constants/sessionConstants.d.ts.map +0 -1
  266. package/dist/types/index.d.ts.map +0 -1
  267. package/dist/types/middleware.d.ts +0 -35
  268. package/dist/types/middleware.d.ts.map +0 -1
  269. package/dist/types/models/api.d.ts.map +0 -1
  270. package/dist/types/models/config.d.ts.map +0 -1
  271. package/dist/types/server/ThunderIDProvider.d.ts.map +0 -1
  272. package/dist/types/server/actions/clearSession.d.ts.map +0 -1
  273. package/dist/types/server/actions/createOrganization.d.ts +0 -24
  274. package/dist/types/server/actions/createOrganization.d.ts.map +0 -1
  275. package/dist/types/server/actions/getAccessToken.d.ts.map +0 -1
  276. package/dist/types/server/actions/getAllOrganizations.d.ts +0 -24
  277. package/dist/types/server/actions/getAllOrganizations.d.ts.map +0 -1
  278. package/dist/types/server/actions/getBrandingPreference.d.ts +0 -24
  279. package/dist/types/server/actions/getBrandingPreference.d.ts.map +0 -1
  280. package/dist/types/server/actions/getClientOrigin.d.ts.map +0 -1
  281. package/dist/types/server/actions/getCurrentOrganizationAction.d.ts +0 -31
  282. package/dist/types/server/actions/getCurrentOrganizationAction.d.ts.map +0 -1
  283. package/dist/types/server/actions/getMyOrganizations.d.ts.map +0 -1
  284. package/dist/types/server/actions/getOrganizationAction.d.ts +0 -31
  285. package/dist/types/server/actions/getOrganizationAction.d.ts.map +0 -1
  286. package/dist/types/server/actions/getSessionId.d.ts.map +0 -1
  287. package/dist/types/server/actions/getSessionPayload.d.ts.map +0 -1
  288. package/dist/types/server/actions/getUserAction.d.ts.map +0 -1
  289. package/dist/types/server/actions/getUserProfileAction.d.ts.map +0 -1
  290. package/dist/types/server/actions/handleOAuthCallbackAction.d.ts.map +0 -1
  291. package/dist/types/server/actions/isSignedIn.d.ts.map +0 -1
  292. package/dist/types/server/actions/refreshToken.d.ts.map +0 -1
  293. package/dist/types/server/actions/signInAction.d.ts.map +0 -1
  294. package/dist/types/server/actions/signOutAction.d.ts.map +0 -1
  295. package/dist/types/server/actions/signUpAction.d.ts +0 -36
  296. package/dist/types/server/actions/signUpAction.d.ts.map +0 -1
  297. package/dist/types/server/actions/switchOrganization.d.ts +0 -24
  298. package/dist/types/server/actions/switchOrganization.d.ts.map +0 -1
  299. package/dist/types/server/actions/updateUserProfileAction.d.ts.map +0 -1
  300. package/dist/types/server/getClient.d.ts.map +0 -1
  301. package/dist/types/server/index.d.ts.map +0 -1
  302. package/dist/types/server/middleware/createRouteMatcher.d.ts.map +0 -1
  303. package/dist/types/server/middleware/thunderIDMiddleware.d.ts.map +0 -1
  304. package/dist/types/server/thunderid.d.ts.map +0 -1
  305. package/dist/types/utils/SessionManager.d.ts.map +0 -1
  306. package/dist/types/utils/createRouteMatcher.d.ts.map +0 -1
  307. package/dist/types/utils/decorateConfigWithNextEnv.d.ts.map +0 -1
  308. package/dist/types/utils/handleRefreshToken.d.ts.map +0 -1
  309. package/dist/types/utils/logger.d.ts.map +0 -1
  310. package/dist/types/utils/sessionUtils.d.ts.map +0 -1
  311. /package/dist/{types/client → client}/components/actions/SignInButton/SignInButton.d.ts +0 -0
  312. /package/dist/{types/client → client}/components/actions/SignOutButton/SignOutButton.d.ts +0 -0
  313. /package/dist/{types/client → client}/components/actions/SignUpButton/SignUpButton.d.ts +0 -0
  314. /package/dist/{types/client → client}/components/control/Loading/Loading.d.ts +0 -0
  315. /package/dist/{types/client → client}/components/control/SignedIn/SignedIn.d.ts +0 -0
  316. /package/dist/{types/client → client}/components/control/SignedOut/SignedOut.d.ts +0 -0
  317. /package/dist/{types/client → client}/components/presentation/SignUp/SignUp.d.ts +0 -0
  318. /package/dist/{types/client → client}/components/presentation/User/User.d.ts +0 -0
  319. /package/dist/{types/client → client}/components/presentation/UserDropdown/UserDropdown.d.ts +0 -0
  320. /package/dist/{types/client → client}/components/presentation/UserProfile/UserProfile.d.ts +0 -0
  321. /package/dist/{types/client → client}/contexts/ThunderID/ThunderIDContext.d.ts +0 -0
  322. /package/dist/{types/client → client}/contexts/ThunderID/useThunderID.d.ts +0 -0
  323. /package/dist/{types/configs → configs}/InternalAuthAPIRoutesConfig.d.ts +0 -0
  324. /package/dist/{types/constants → constants}/sessionConstants.d.ts +0 -0
  325. /package/dist/{types/index.d.ts → index.d.ts} +0 -0
  326. /package/dist/{types/models → models}/api.d.ts +0 -0
  327. /package/dist/{types/models → models}/config.d.ts +0 -0
  328. /package/dist/{types/server → server}/ThunderIDProvider.d.ts +0 -0
  329. /package/dist/{types/server → server}/actions/clearSession.d.ts +0 -0
  330. /package/dist/{types/server → server}/actions/getAccessToken.d.ts +0 -0
  331. /package/dist/{types/server → server}/actions/getClientOrigin.d.ts +0 -0
  332. /package/dist/{types/server → server}/actions/getSessionId.d.ts +0 -0
  333. /package/dist/{types/server → server}/actions/getSessionPayload.d.ts +0 -0
  334. /package/dist/{types/server → server}/actions/getUserAction.d.ts +0 -0
  335. /package/dist/{types/server → server}/actions/getUserProfileAction.d.ts +0 -0
  336. /package/dist/{types/server → server}/actions/handleOAuthCallbackAction.d.ts +0 -0
  337. /package/dist/{types/server → server}/actions/isSignedIn.d.ts +0 -0
  338. /package/dist/{types/server → server}/actions/refreshToken.d.ts +0 -0
  339. /package/dist/{types/server → server}/actions/signOutAction.d.ts +0 -0
  340. /package/dist/{types/server → server}/actions/updateUserProfileAction.d.ts +0 -0
  341. /package/dist/{types/server → server}/getClient.d.ts +0 -0
  342. /package/dist/{types/server/middleware → server/proxy}/createRouteMatcher.d.ts +0 -0
  343. /package/dist/{types/server → server}/thunderid.d.ts +0 -0
  344. /package/dist/{types/utils → utils}/SessionManager.d.ts +0 -0
  345. /package/dist/{types/utils → utils}/createRouteMatcher.d.ts +0 -0
  346. /package/dist/{types/utils → utils}/decorateConfigWithNextEnv.d.ts +0 -0
  347. /package/dist/{types/utils → utils}/handleRefreshToken.d.ts +0 -0
  348. /package/dist/{types/utils → utils}/logger.d.ts +0 -0
  349. /package/dist/{types/utils → utils}/sessionUtils.d.ts +0 -0
@@ -1,1037 +1,35 @@
1
- const require_dynamic_rendering = require('./dynamic-rendering-W7rdgerZ.js');
2
- require('./SessionManager-SBxwYnwV.js');
3
- const require_server = require('./server-BAGHs6kk.js');
4
- const require_getSessionId = require('./getSessionId-Do242Vmz.js');
5
- require('./segment-CPZPzHDj.js');
6
- let __thunderid_node = require("@thunderid/node");
7
- __thunderid_node = require_dynamic_rendering.__toESM(__thunderid_node);
8
- let react = require("react");
9
- react = require_dynamic_rendering.__toESM(react);
10
- let __thunderid_react = require("@thunderid/react");
11
- __thunderid_react = require_dynamic_rendering.__toESM(__thunderid_react);
12
-
13
- //#region src/client/contexts/ThunderID/useThunderID.ts
14
- const useThunderID = () => {
15
- const context = (0, react.useContext)(require_server.ThunderIDContext_default);
16
- if (!context) throw new Error("useThunderID must be used within an ThunderIDProvider");
17
- return context;
18
- };
19
- var useThunderID_default = useThunderID;
20
-
21
- //#endregion
22
- //#region src/client/components/presentation/Organization/Organization.tsx
23
- var import_jsx_runtime = /* @__PURE__ */ require_dynamic_rendering.__toESM(require_server.require_jsx_runtime());
24
- /**
25
- * A component that uses render props to expose the current organization object.
26
- * This component automatically retrieves the current organization from Organization context.
27
- *
28
- * @remarks This component is only supported in browser based React applications (CSR).
29
- *
30
- * @example
31
- * ```tsx
32
- * import { Organization } from '@thunderid/auth-react';
33
- *
34
- * const App = () => {
35
- * return (
36
- * <Organization fallback={<p>No organization selected</p>}>
37
- * {(organization) => (
38
- * <div>
39
- * <h1>Current Organization: {organization.name}!</h1>
40
- * <p>ID: {organization.id}</p>
41
- * <p>Role: {organization.role}</p>
42
- * {organization.memberCount && (
43
- * <p>Members: {organization.memberCount}</p>
44
- * )}
45
- * </div>
46
- * )}
47
- * </Organization>
48
- * );
49
- * }
50
- * ```
51
- */
52
- const Organization = ({ children, fallback = null }) => {
53
- const { currentOrganization } = (0, __thunderid_react.useOrganization)();
54
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(__thunderid_react.BaseOrganization, {
55
- organization: currentOrganization,
56
- fallback,
57
- children
58
- });
59
- };
60
- Organization.displayName = "Organization";
61
- var Organization_default = Organization;
62
-
63
- //#endregion
64
- //#region src/client/components/presentation/CreateOrganization/CreateOrganization.tsx
65
- /**
66
- * CreateOrganization component that provides organization creation functionality.
67
- * This component automatically integrates with the ThunderID and Organization contexts.
68
- *
69
- * @example
70
- * ```tsx
71
- * import { CreateOrganization } from '@thunderid/react';
72
- *
73
- * // Basic usage - uses default API and contexts
74
- * <CreateOrganization
75
- * onSuccess={(org) => console.log('Created:', org)}
76
- * onCancel={() => navigate('/organizations')}
77
- * />
78
- *
79
- * // With custom organization creation handler
80
- * <CreateOrganization
81
- * onCreateOrganization={async (payload) => {
82
- * const result = await myCustomAPI.createOrganization(payload);
83
- * return result;
84
- * }}
85
- * onSuccess={(org) => {
86
- * console.log('Organization created:', org.name);
87
- * // Custom success logic here
88
- * }}
89
- * />
90
- *
91
- * // With fallback for unauthenticated users
92
- * <CreateOrganization
93
- * fallback={<div>Please sign in to create an organization</div>}
94
- * />
95
- * ```
96
- */
97
- const CreateOrganization = ({ onCreateOrganization, fallback = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {}), onSuccess, defaultParentId,...props }) => {
98
- const { isSignedIn, baseUrl } = useThunderID_default();
99
- const { currentOrganization, revalidateMyOrganizations, createOrganization } = (0, __thunderid_react.useOrganization)();
100
- const [loading, setLoading] = (0, react.useState)(false);
101
- const [error, setError] = (0, react.useState)(null);
102
- if (!isSignedIn && fallback) return fallback;
103
- if (!isSignedIn) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {});
104
- const parentId = defaultParentId || currentOrganization?.id || "";
105
- const handleSubmit = async (payload) => {
106
- setLoading(true);
107
- setError(null);
108
- try {
109
- let result;
110
- if (onCreateOrganization) result = await onCreateOrganization(payload);
111
- else {
112
- if (!baseUrl) throw new Error("Base URL is required for organization creation");
113
- if (!createOrganization) throw new __thunderid_node.ThunderIDRuntimeError(`createOrganization function is not available.`, "CreateOrganization-handleSubmit-RuntimeError-001", "nextjs", "The createOrganization function must be provided by the Organization context.");
114
- result = await createOrganization({
115
- ...payload,
116
- parentId
117
- }, await require_getSessionId.getSessionId_default());
118
- }
119
- if (revalidateMyOrganizations) await revalidateMyOrganizations();
120
- if (onSuccess) onSuccess(result);
121
- } catch (createError) {
122
- setError(createError instanceof Error ? createError.message : "Failed to create organization");
123
- throw createError;
124
- } finally {
125
- setLoading(false);
126
- }
127
- };
128
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(__thunderid_react.BaseCreateOrganization, {
129
- onSubmit: handleSubmit,
130
- loading,
131
- error,
132
- defaultParentId: parentId,
133
- onSuccess,
134
- ...props
135
- });
136
- };
137
- var CreateOrganization_default = CreateOrganization;
138
-
139
- //#endregion
140
- //#region src/server/actions/getOrganizationAction.ts
141
- /**
142
- * Server action to create an organization.
143
- */
144
- const getOrganizationAction = async (organizationId, sessionId) => {
145
- try {
146
- return {
147
- data: { organization: await require_server.getClient_default().getOrganization(organizationId, sessionId) },
148
- error: null,
149
- success: true
150
- };
151
- } catch (error) {
152
- return {
153
- data: { user: {} },
154
- error: "Failed to get organization",
155
- success: false
156
- };
157
- }
158
- };
159
- var getOrganizationAction_default = getOrganizationAction;
160
-
161
- //#endregion
162
- //#region src/client/components/presentation/OrganizationProfile/OrganizationProfile.tsx
163
- /**
164
- * OrganizationProfile component displays organization information in a
165
- * structured and styled format. It automatically fetches organization details
166
- * using the provided organization ID and displays them using BaseOrganizationProfile.
167
- *
168
- * The component supports editing functionality, allowing users to modify organization
169
- * fields inline. Updates are automatically synced with the backend via the SCIM2 API.
170
- *
171
- * This component is the React-specific implementation that automatically
172
- * retrieves the organization data from ThunderID API.
173
- *
174
- * @example
175
- * ```tsx
176
- * // Basic usage with editing enabled (default)
177
- * <OrganizationProfile organizationId="0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1" />
178
- *
179
- * // Read-only mode
180
- * <OrganizationProfile
181
- * organizationId="0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1"
182
- * editable={false}
183
- * />
184
- *
185
- * // With card layout and custom fallbacks
186
- * <OrganizationProfile
187
- * organizationId="0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1"
188
- * cardLayout={true}
189
- * loadingFallback={<div>Loading organization...</div>}
190
- * errorFallback={<div>Failed to load organization</div>}
191
- * fallback={<div>No organization data available</div>}
192
- * />
193
- *
194
- * // With custom fields configuration and update callback
195
- * <OrganizationProfile
196
- * organizationId="0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1"
197
- * fields={[
198
- * { key: 'id', label: 'Organization ID', editable: false },
199
- * { key: 'name', label: 'Organization Name', editable: true },
200
- * { key: 'description', label: 'Description', editable: true, render: (value) => value || 'No description' },
201
- * { key: 'created', label: 'Created Date', editable: false, render: (value) => new Date(value).toLocaleDateString() },
202
- * { key: 'lastModified', label: 'Last Modified Date', editable: false, render: (value) => new Date(value).toLocaleDateString() },
203
- * { key: 'attributes', label: 'Custom Attributes', editable: true }
204
- * ]}
205
- * onUpdate={async (payload) => {
206
- * console.log('Organization updated:', payload);
207
- * // payload contains the updated field values
208
- * // The component automatically converts these to patch operations
209
- * }}
210
- * />
211
- *
212
- * // In popup mode
213
- * <OrganizationProfile
214
- * organizationId="0d5e071b-d3d3-475d-b3c6-1a20ee2fa9b1"
215
- * mode="popup"
216
- * open={isOpen}
217
- * onOpenChange={setIsOpen}
218
- * popupTitle="Edit Organization Profile"
219
- * />
220
- * ```
221
- */
222
- const OrganizationProfile = ({ organizationId, mode = "default", open = false, onOpenChange, onUpdate, popupTitle,...rest }) => {
223
- const { baseUrl } = useThunderID_default();
224
- const { t } = (0, __thunderid_react.useTranslation)();
225
- const [organization, setOrganization] = (0, react.useState)(null);
226
- const [, setLoading] = (0, react.useState)(true);
227
- const [, setError] = (0, react.useState)(false);
228
- const fetchOrganization = async () => {
229
- if (!baseUrl || !organizationId) {
230
- setLoading(false);
231
- setError(true);
232
- return;
233
- }
234
- try {
235
- setLoading(true);
236
- setError(false);
237
- const result = await getOrganizationAction_default(organizationId, await require_getSessionId.getSessionId_default());
238
- if (result.data?.organization) {
239
- setOrganization(result.data.organization);
240
- return;
241
- }
242
- setError(true);
243
- } catch (err) {
244
- require_server.logger_default.error("Failed to fetch organization:", err);
245
- setError(true);
246
- setOrganization(null);
247
- } finally {
248
- setLoading(false);
249
- }
250
- };
251
- (0, react.useEffect)(() => {
252
- fetchOrganization();
253
- }, [baseUrl, organizationId]);
254
- const handleOrganizationUpdate = async (payload) => {
255
- if (!baseUrl || !organizationId) return;
256
- try {
257
- await (0, __thunderid_node.updateOrganization)({
258
- baseUrl,
259
- operations: (0, __thunderid_node.createPatchOperations)(payload),
260
- organizationId
261
- });
262
- await fetchOrganization();
263
- if (onUpdate) await onUpdate(payload);
264
- } catch (err) {
265
- require_server.logger_default.error("Failed to update organization:", err);
266
- throw err;
267
- }
268
- };
269
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(__thunderid_react.BaseOrganizationProfile, {
270
- organization,
271
- onUpdate: handleOrganizationUpdate,
272
- mode: mode === "popup" ? "popup" : "inline",
273
- open,
274
- onOpenChange,
275
- title: popupTitle || t("organization.profile.heading"),
276
- ...rest
277
- });
278
- };
279
- var OrganizationProfile_default = OrganizationProfile;
280
-
281
- //#endregion
282
- //#region src/client/components/presentation/OrganizationList/OrganizationList.tsx
283
- /**
284
- * OrganizationList component that provides organization listing functionality with pagination.
285
- * This component uses the enhanced OrganizationContext, eliminating the polling issue and
286
- * providing better integration with the existing context system.
287
- *
288
- * @example
289
- * ```tsx
290
- * import { OrganizationList } from '@thunderid/react';
291
- *
292
- * // Basic usage
293
- * <OrganizationList />
294
- *
295
- * // With custom limit and filter
296
- * <OrganizationList
297
- * limit={20}
298
- * filter="active"
299
- * onOrganizationSelect={(org) => {
300
- * console.log('Selected organization:', org.name);
301
- * }}
302
- * />
303
- *
304
- * // As a popup dialog
305
- * <OrganizationList
306
- * mode="popup"
307
- * open={isOpen}
308
- * onOpenChange={setIsOpen}
309
- * title="Select Organization"
310
- * />
311
- *
312
- * // With custom organization renderer
313
- * <OrganizationList
314
- * renderOrganization={(org) => (
315
- * <div key={org.id}>
316
- * <h3>{org.name}</h3>
317
- * <p>Can switch: {org.canSwitch ? 'Yes' : 'No'}</p>
318
- * </div>
319
- * )}
320
- * />
321
- * ```
322
- */
323
- const OrganizationList = ({ onOrganizationSelect,...baseProps }) => {
324
- const { getAllOrganizations, error, isLoading, myOrganizations } = (0, __thunderid_react.useOrganization)();
325
- const [allOrganizations, setAllOrganizations] = (0, react.useState)({ organizations: [] });
326
- (0, react.useEffect)(() => {
327
- (async () => {
328
- setAllOrganizations(await getAllOrganizations());
329
- })();
330
- }, []);
331
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(__thunderid_react.BaseOrganizationList, {
332
- allOrganizations,
333
- myOrganizations,
334
- error,
335
- isLoading,
336
- onOrganizationSelect,
337
- ...baseProps
338
- });
339
- };
340
- var OrganizationList_default = OrganizationList;
341
-
342
- //#endregion
343
- //#region src/client/components/presentation/OrganizationSwitcher/OrganizationSwitcher.tsx
344
- /**
345
- * OrganizationSwitcher component that provides organization switching functionality.
346
- * This component automatically retrieves organizations from the OrganizationContext.
347
- * You can also override the organizations, currentOrganization, and onOrganizationSwitch
348
- * by passing them as props.
349
- *
350
- * @example
351
- * ```tsx
352
- * import { OrganizationSwitcher } from '@thunderid/react';
353
- *
354
- * // Basic usage - uses OrganizationContext
355
- * <OrganizationSwitcher />
356
- *
357
- * // With custom organization switch handler
358
- * <OrganizationSwitcher
359
- * onOrganizationSwitch={(org) => {
360
- * console.log('Switching to:', org.name);
361
- * // Custom logic here
362
- * }}
363
- * />
364
- *
365
- * // With fallback for unauthenticated users
366
- * <OrganizationSwitcher
367
- * fallback={<div>Please sign in to view organizations</div>}
368
- * />
369
- * ```
370
- */
371
- const OrganizationSwitcher = ({ currentOrganization: propCurrentOrganization, fallback = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {}), onOrganizationSwitch: propOnOrganizationSwitch, organizations: propOrganizations,...props }) => {
372
- const { isSignedIn } = useThunderID_default();
373
- const { currentOrganization: contextCurrentOrganization, myOrganizations: contextOrganizations, switchOrganization, isLoading, error } = (0, __thunderid_react.useOrganization)();
374
- const [isCreateOrgOpen, setIsCreateOrgOpen] = (0, react.useState)(false);
375
- const [isProfileOpen, setIsProfileOpen] = (0, react.useState)(false);
376
- const [isOrganizationListOpen, setIsOrganizationListOpen] = (0, react.useState)(false);
377
- const { t } = (0, __thunderid_react.useTranslation)();
378
- if (!isSignedIn && fallback) return fallback;
379
- if (!isSignedIn) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {});
380
- const organizations = propOrganizations || contextOrganizations || [];
381
- const currentOrganization = propCurrentOrganization || contextCurrentOrganization;
382
- const onOrganizationSwitch = propOnOrganizationSwitch || switchOrganization;
383
- const handleManageOrganizations = () => {
384
- setIsOrganizationListOpen(true);
385
- };
386
- const handleManageOrganization = () => {
387
- setIsProfileOpen(true);
388
- };
389
- const defaultMenuItems = [];
390
- if (currentOrganization) defaultMenuItems.push({
391
- icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(__thunderid_react.BuildingAlt, {}),
392
- label: t("organization.switcher.manage.organizations"),
393
- onClick: handleManageOrganizations
394
- });
395
- defaultMenuItems.push({
396
- icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", {
397
- width: "16",
398
- height: "16",
399
- viewBox: "0 0 24 24",
400
- fill: "none",
401
- stroke: "currentColor",
402
- strokeWidth: "2",
403
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M12 5v14m-7-7h14" })
404
- }),
405
- label: t("organization.switcher.create.organization"),
406
- onClick: () => setIsCreateOrgOpen(true)
407
- });
408
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
409
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(__thunderid_react.BaseOrganizationSwitcher, {
410
- organizations,
411
- currentOrganization,
412
- onOrganizationSwitch,
413
- loading: isLoading,
414
- error,
415
- menuItems: props.menuItems ? [...defaultMenuItems, ...props.menuItems] : defaultMenuItems,
416
- onManageProfile: handleManageOrganization,
417
- ...props
418
- }),
419
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CreateOrganization, {
420
- mode: "popup",
421
- open: isCreateOrgOpen,
422
- onOpenChange: setIsCreateOrgOpen,
423
- onSuccess: (org) => {
424
- if (org && onOrganizationSwitch) onOrganizationSwitch(org);
425
- setIsCreateOrgOpen(false);
426
- }
427
- }),
428
- currentOrganization && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(OrganizationProfile_default, {
429
- organizationId: currentOrganization.id,
430
- mode: "popup",
431
- open: isProfileOpen,
432
- onOpenChange: setIsProfileOpen,
433
- cardLayout: true,
434
- loadingFallback: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: t("organization.profile.loading") }),
435
- errorFallback: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: t("organization.profile.error") })
436
- }),
437
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(OrganizationList_default, {
438
- mode: "popup",
439
- open: isOrganizationListOpen,
440
- onOpenChange: setIsOrganizationListOpen,
441
- title: t("organization.switcher.manage.organizations"),
442
- onOrganizationSelect: (organization) => {
443
- if (onOrganizationSwitch) onOrganizationSwitch(organization);
444
- setIsOrganizationListOpen(false);
445
- }
446
- })
447
- ] });
448
- };
449
- var OrganizationSwitcher_default = OrganizationSwitcher;
450
-
451
- //#endregion
452
- //#region src/client/components/control/SignedIn/SignedIn.tsx
453
- /**
454
- * A component that only renders its children when the user is signed in.
455
- *
456
- * @example
457
- * ```tsx
458
- * import { SignedIn } from '@thunderid/auth-next';
459
- *
460
- * const App = () => {
461
- * return (
462
- * <SignedIn fallback={<p>Please sign in to continue</p>}>
463
- * <p>Welcome! You are signed in.</p>
464
- * </SignedIn>
465
- * );
466
- * }
467
- * ```
468
- */
469
- const SignedIn = ({ children, fallback = null }) => {
470
- const { isSignedIn } = useThunderID_default();
471
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: isSignedIn ? children : fallback });
472
- };
473
- var SignedIn_default = SignedIn;
474
-
475
- //#endregion
476
- //#region src/client/components/control/SignedOut/SignedOut.tsx
477
- /**
478
- * A component that only renders its children when the user is signed out.
479
- *
480
- * @example
481
- * ```tsx
482
- * import { SignedOut } from '@thunderid/auth-next';
483
- *
484
- * const App = () => {
485
- * return (
486
- * <SignedOut fallback={<p>Please sign out to continue</p>}>
487
- * <p>Welcome! You are signed out.</p>
488
- * </SignedOut>
489
- * );
490
- * }
491
- * ```
492
- */
493
- const SignedOut = ({ children, fallback = null }) => {
494
- const { isSignedIn } = useThunderID_default();
495
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: !isSignedIn ? children : fallback });
496
- };
497
- var SignedOut_default = SignedOut;
498
-
499
- //#endregion
500
- //#region src/client/components/actions/SignInButton/SignInButton.tsx
501
- var import_navigation$1 = /* @__PURE__ */ require_dynamic_rendering.__toESM(require_server.require_navigation());
502
- /**
503
- * SignInButton component that uses server actions for authentication in Next.js.
504
- *
505
- * @example Using render props
506
- * ```tsx
507
- * <SignInButton>
508
- * {({isLoading}) => (
509
- * <button type="submit" disabled={isLoading}>
510
- * {isLoading ? 'Signing in...' : 'Sign In'}
511
- * </button>
512
- * )}
513
- * </SignInButton>
514
- * ```
515
- *
516
- * @example Using traditional props
517
- * ```tsx
518
- * <SignInButton className="custom-button">Sign In</SignInButton>
519
- * ```
520
- *
521
- * @remarks
522
- * In Next.js with server actions, the sign-in is handled via the server action.
523
- * When using render props, the custom button should use `type="submit"` instead of `onClick={signIn}`.
524
- * The `signIn` function in render props is provided for API consistency but should not be used directly.
525
- */
526
- const SignInButton = (0, react.forwardRef)(({ className, style, children, preferences, onClick, signInOptions = {},...rest }, ref) => {
527
- const { signIn, signInUrl } = useThunderID_default();
528
- const router = (0, import_navigation$1.useRouter)();
529
- const { t } = (0, __thunderid_react.useTranslation)(preferences?.i18n);
530
- const handleOnClick = async (e) => {
531
- try {
532
- if (signInUrl) router.push(signInUrl);
533
- else if (signIn) await signIn(signInOptions);
534
- if (onClick) onClick(e);
535
- } catch (error) {
536
- throw new __thunderid_node.ThunderIDRuntimeError(`Sign in failed: ${error instanceof Error ? error.message : String(error)}`, "SignInButton-handleSignIn-RuntimeError-001", "nextjs", "Something went wrong while trying to sign in. Please try again later.");
537
- }
538
- };
539
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(__thunderid_react.BaseSignInButton, {
540
- className,
541
- style,
542
- ref,
543
- preferences,
544
- onClick: handleOnClick,
545
- ...rest,
546
- children: children ?? t("elements.buttons.signin.text")
547
- });
548
- });
549
- SignInButton.displayName = "SignInButton";
550
- var SignInButton_default = SignInButton;
551
-
552
- //#endregion
553
- //#region src/client/components/actions/SignUpButton/SignUpButton.tsx
554
- var import_navigation = /* @__PURE__ */ require_dynamic_rendering.__toESM(require_server.require_navigation());
555
- /**
556
- * SignUpButton component that supports both render props and traditional props patterns.
557
- * It redirects the user to the ThunderID sign-up page configured for the application.
558
- *
559
- * @remarks This component is only supported in browser based React applications (CSR).
560
- *
561
- * @example Using render props pattern
562
- * ```tsx
563
- * <SignUpButton>
564
- * {({ signUp, isLoading }) => (
565
- * <button onClick={signUp} disabled={isLoading}>
566
- * {isLoading ? 'Creating Account...' : 'Create Account'}
567
- * </button>
568
- * )}
569
- * </SignUpButton>
570
- * ```
571
- *
572
- * @example Using traditional props pattern
573
- * ```tsx
574
- * <SignUpButton className="custom-button">Create Account</SignUpButton>
575
- * ```
576
- *
577
- * @example Using component-level preferences
578
- * ```tsx
579
- * <SignUpButton
580
- * preferences={{
581
- * i18n: {
582
- * bundles: {
583
- * 'en-US': {
584
- * translations: {
585
- * 'buttons.signUp': 'Custom Sign Up Text'
586
- * }
587
- * }
588
- * }
589
- * }
590
- * }}
591
- * >
592
- * Custom Sign Up
593
- * </SignUpButton>
594
- * ```
595
- */
596
- const SignUpButton = (0, react.forwardRef)(({ children, onClick, preferences,...rest }, ref) => {
597
- const { signUp, signUpUrl } = useThunderID_default();
598
- const router = (0, import_navigation.useRouter)();
599
- const { t } = (0, __thunderid_react.useTranslation)(preferences?.i18n);
600
- const [isLoading, setIsLoading] = (0, react.useState)(false);
601
- const handleSignUp = async (e) => {
602
- try {
603
- setIsLoading(true);
604
- if (signUpUrl) router.push(signUpUrl);
605
- else if (signUp) await signUp();
606
- if (onClick) onClick(e);
607
- } catch (error) {
608
- throw new __thunderid_node.ThunderIDRuntimeError(`Sign up failed: ${error instanceof Error ? error.message : String(error)}`, "SignUpButton-handleSignUp-RuntimeError-001", "nextjs", "Something went wrong while trying to sign up. Please try again later.");
609
- } finally {
610
- setIsLoading(false);
611
- }
612
- };
613
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(__thunderid_react.BaseSignUpButton, {
614
- ref,
615
- onClick: handleSignUp,
616
- isLoading,
617
- signUp: handleSignUp,
618
- preferences,
619
- ...rest,
620
- children: children ?? t("elements.buttons.signup.text")
621
- });
622
- });
623
- SignUpButton.displayName = "SignUpButton";
624
- var SignUpButton_default = SignUpButton;
625
-
626
- //#endregion
627
- //#region src/client/components/presentation/SignIn/SignIn.tsx
628
- /**
629
- * A SignIn component for Next.js that provides native authentication flow.
630
- * This component delegates to the BaseSignIn from @thunderid/react and requires
631
- * the API functions to be provided as props.
632
- *
633
- * @remarks This component requires the authentication API functions to be provided
634
- * as props. For a complete working example, you'll need to implement the server-side
635
- * authentication endpoints or use the traditional OAuth flow with SignInButton.
636
- *
637
- * @example
638
- * ```tsx
639
- * import { SignIn } from '@thunderid/nextjs';
640
- * import { executeEmbeddedSignInFlow } from '@thunderid/browser';
641
- *
642
- * const LoginPage = () => {
643
- * const handleInitialize = async () => {
644
- * return await executeEmbeddedSignInFlow({
645
- * response_mode: 'direct',
646
- * });
647
- * };
648
- *
649
- * const handleSubmit = async (flow) => {
650
- * return await executeEmbeddedSignInFlow({ flow });
651
- * };
652
- *
653
- * return (
654
- * <SignIn
655
- * onInitialize={handleInitialize}
656
- * onSubmit={handleSubmit}
657
- * onSuccess={(authData) => {
658
- * console.log('Authentication successful:', authData);
659
- * }}
660
- * onError={(error) => {
661
- * console.error('Authentication failed:', error);
662
- * }}
663
- * size="medium"
664
- * variant="outlined"
665
- * afterSignInUrl="/dashboard"
666
- * />
667
- * );
668
- * };
669
- * ```
670
- */
671
- const SignIn = ({ size = "medium", variant = "outlined",...rest }) => {
672
- const { signIn, afterSignInUrl } = useThunderID_default();
673
- const handleInitialize = async () => signIn && await signIn({
674
- flowId: "",
675
- selectedAuthenticator: {
676
- authenticatorId: "",
677
- params: {}
678
- }
679
- });
680
- const handleOnSubmit = async (payload, request) => {
681
- if (!signIn) throw new __thunderid_node.ThunderIDRuntimeError("`signIn` function is not available.", "SignIn-handleOnSubmit-RuntimeError-001", "nextjs");
682
- return await signIn(payload, request);
683
- };
684
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(__thunderid_react.BaseSignIn, {
685
- afterSignInUrl,
686
- onInitialize: handleInitialize,
687
- onSubmit: handleOnSubmit,
688
- size,
689
- variant,
690
- ...rest
691
- });
692
- };
693
- SignIn.displayName = "SignIn";
694
- var SignIn_default = SignIn;
695
-
696
- //#endregion
697
- //#region src/client/components/actions/SignOutButton/SignOutButton.tsx
698
- /**
699
- * SignInButton component. This button initiates the sign-in process when clicked.
700
- *
701
- * @example
702
- * ```tsx
703
- * import { SignInButton } from '@thunderid/auth-react';
704
- *
705
- * const App = () => {
706
- * const buttonRef = useRef<HTMLButtonElement>(null);
707
- * return (
708
- * <SignInButton ref={buttonRef} className="custom-class" style={{ backgroundColor: 'blue' }}>
709
- * Sign In
710
- * </SignInButton>
711
- * );
712
- * }
713
- * ```
714
- */
715
- const SignOutButton = (0, react.forwardRef)(({ className, style, preferences, onClick, children,...rest }, ref) => {
716
- const { signOut } = useThunderID_default();
717
- const { t } = (0, __thunderid_react.useTranslation)(preferences?.i18n);
718
- const [isLoading, setIsLoading] = (0, react.useState)(false);
719
- const handleOnClick = async (e) => {
720
- try {
721
- setIsLoading(true);
722
- require_server.logger_default.debug("[SignOutButton] Initiating a sign-out from a button click");
723
- await signOut();
724
- if (onClick) onClick(e);
725
- } catch (error) {
726
- require_server.logger_default.error("[SignOutButton] Error occurred initiating sign-out from a button click:", error);
727
- } finally {
728
- setIsLoading(false);
729
- }
730
- };
731
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(__thunderid_react.BaseSignOutButton, {
732
- ref,
733
- onClick: handleOnClick,
734
- isLoading,
735
- preferences,
736
- ...rest,
737
- children: children ?? t("elements.buttons.signout.text")
738
- });
739
- });
740
- var SignOutButton_default = SignOutButton;
741
-
742
- //#endregion
743
- //#region src/client/components/presentation/User/User.tsx
744
- /**
745
- * A component that uses render props to expose the authenticated user object.
746
- * This component automatically retrieves the user from ThunderID context.
747
- *
748
- * @remarks This component is only supported in browser based React applications (CSR).
749
- *
750
- * @example
751
- * ```tsx
752
- * import { User } from '@thunderid/auth-react';
753
- *
754
- * const App = () => {
755
- * return (
756
- * <User fallback={<p>Please sign in</p>}>
757
- * {(user) => (
758
- * <div>
759
- * <h1>Welcome, {user.displayName}!</h1>
760
- * <p>Email: {user.email}</p>
761
- * </div>
762
- * )}
763
- * </User>
764
- * );
765
- * }
766
- * ```
767
- */
768
- const User = ({ children, fallback = null }) => {
769
- const { user } = useThunderID_default();
770
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(__thunderid_react.BaseUser, {
771
- user,
772
- fallback,
773
- children
774
- });
775
- };
776
- User.displayName = "User";
777
- var User_default = User;
778
-
779
- //#endregion
780
- //#region src/client/components/presentation/SignUp/SignUp.tsx
781
- /**
782
- * A styled SignUp component that provides embedded sign-up flow with pre-built styling.
783
- * This component handles the API calls for sign-up and delegates UI logic to BaseSignUp.
784
- *
785
- * @example
786
- * ```tsx
787
- * import { SignUp } from '@thunderid/react';
788
- *
789
- * const App = () => {
790
- * return (
791
- * <SignUp
792
- * onSuccess={(response) => {
793
- * console.log('Sign-up successful:', response);
794
- * // Handle successful sign-up (e.g., redirect, show confirmation)
795
- * }}
796
- * onError={(error) => {
797
- * console.error('Sign-up failed:', error);
798
- * }}
799
- * onComplete={(redirectUrl) => {
800
- * // Platform-specific redirect handling (e.g., Next.js router.push)
801
- * router.push(redirectUrl); // or window.location.href = redirectUrl
802
- * }}
803
- * size="medium"
804
- * variant="outlined"
805
- * afterSignUpUrl="/welcome"
806
- * />
807
- * );
808
- * };
809
- * ```
810
- */
811
- const SignUp = ({ className, size = "medium", variant = "outlined", afterSignUpUrl, onError }) => {
812
- const { signUp, applicationId: contextApplicationId, scopes } = useThunderID_default();
813
- /**
814
- * Initialize the sign-up flow.
815
- */
816
- const handleInitialize = async (payload) => {
817
- if (!signUp) throw new __thunderid_node.ThunderIDRuntimeError("`signUp` function is not available.", "SignUp-handleInitialize-RuntimeError-001", "nextjs");
818
- return await signUp(payload || {
819
- flowType: __thunderid_node.EmbeddedFlowType.Registration,
820
- ...contextApplicationId && { applicationId: contextApplicationId },
821
- ...scopes && { scopes }
822
- });
823
- };
824
- /**
825
- * Handle sign-up steps.
826
- */
827
- const handleOnSubmit = async (payload) => {
828
- if (!signUp) throw new __thunderid_node.ThunderIDRuntimeError("`signUp` function is not available.", "SignUp-handleOnSubmit-RuntimeError-001", "nextjs");
829
- return await signUp(payload);
830
- };
831
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(__thunderid_react.BaseSignUp, {
832
- afterSignUpUrl,
833
- onInitialize: handleInitialize,
834
- onSubmit: handleOnSubmit,
835
- onError,
836
- className,
837
- size,
838
- variant,
839
- isInitialized: true
840
- });
841
- };
842
- var SignUp_default = SignUp;
843
-
844
- //#endregion
845
- //#region src/client/components/presentation/UserProfile/UserProfile.tsx
846
- /**
847
- * UserProfile component displays the authenticated user's profile information in a
848
- * structured and styled format. It shows user details such as display name, email,
849
- * username, and other available profile information from ThunderID.
850
- *
851
- * This component is the React-specific implementation that uses the BaseUserProfile
852
- * and automatically retrieves the user data from ThunderID context if not provided.
853
- *
854
- * @example
855
- * ```tsx
856
- * // Basic usage - will use user from ThunderID context
857
- * <UserProfile />
858
- *
859
- * // With explicit user data
860
- * <UserProfile user={specificUser} />
861
- *
862
- * // With card layout and custom fallback
863
- * <UserProfile
864
- * cardLayout={true}
865
- * fallback={<div>Please sign in to view your profile</div>}
866
- * />
867
- * ```
868
- */
869
- const UserProfile = ({ ...rest }) => {
870
- const { profile, flattenedProfile, schemas, onUpdateProfile, updateProfile } = (0, __thunderid_react.useUser)();
871
- const handleProfileUpdate = async (payload) => {
872
- onUpdateProfile((await updateProfile(payload, await require_getSessionId.getSessionId_default()))?.data?.user);
873
- };
874
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(__thunderid_react.BaseUserProfile, {
875
- profile,
876
- flattenedProfile,
877
- schemas,
878
- onUpdate: handleProfileUpdate,
879
- ...rest
880
- });
881
- };
882
- var UserProfile_default = UserProfile;
883
-
884
- //#endregion
885
- //#region src/client/components/presentation/UserDropdown/UserDropdown.tsx
886
- /**
887
- * UserDropdown component displays a user avatar with a dropdown menu.
888
- * When clicked, it shows a popover with customizable menu items.
889
- * This component is the React-specific implementation that uses the BaseUserDropdown
890
- * and automatically retrieves the user data from ThunderID context.
891
- *
892
- * Supports render props for complete customization of the dropdown appearance and behavior.
893
- *
894
- * @example
895
- * ```tsx
896
- * // Basic usage - will use user from ThunderID context
897
- * <UserDropdown menuItems={[
898
- * { label: 'Profile', onClick: () => {} },
899
- * { label: 'Settings', href: '/settings' },
900
- * { label: 'Sign Out', onClick: () => {} }
901
- * ]} />
902
- *
903
- * // With custom configuration
904
- * <UserDropdown
905
- * showTriggerLabel={true}
906
- * avatarSize={40}
907
- * fallback={<div>Please sign in</div>}
908
- * />
909
- *
910
- * // Using render props for complete customization
911
- * <UserDropdown>
912
- * {({ user, isLoading, openProfile, signOut }) => (
913
- * <div>
914
- * <button onClick={openProfile}>
915
- * {user?.name || 'Loading...'}
916
- * </button>
917
- * <button onClick={signOut}>Logout</button>
918
- * </div>
919
- * )}
920
- * </UserDropdown>
921
- *
922
- * // Using partial render props
923
- * <UserDropdown
924
- * renderTrigger={({ user, openProfile }) => (
925
- * <button onClick={openProfile} className="custom-trigger">
926
- * Welcome, {user?.name}!
927
- * </button>
928
- * )}
929
- * />
930
- * ```
931
- */
932
- const UserDropdown = ({ children, renderTrigger, renderDropdown, onSignOut,...rest }) => {
933
- const { user, isLoading, signOut } = useThunderID_default();
934
- const [isProfileOpen, setIsProfileOpen] = (0, react.useState)(false);
935
- const handleManageProfile = () => {
936
- setIsProfileOpen(true);
937
- };
938
- const handleSignOut = () => {
939
- signOut();
940
- if (onSignOut) onSignOut();
941
- };
942
- const closeProfile = () => {
943
- setIsProfileOpen(false);
944
- };
945
- const renderProps = {
946
- closeProfile,
947
- isLoading,
948
- isProfileOpen,
949
- openProfile: handleManageProfile,
950
- signOut: handleSignOut,
951
- user
952
- };
953
- if (children) return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [children(renderProps), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UserProfile_default, {
954
- mode: "popup",
955
- open: isProfileOpen,
956
- onOpenChange: setIsProfileOpen
957
- })] });
958
- if (renderTrigger || renderDropdown) return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [renderTrigger ? renderTrigger(renderProps) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(__thunderid_react.BaseUserDropdown, {
959
- user,
960
- isLoading,
961
- onManageProfile: handleManageProfile,
962
- onSignOut: handleSignOut,
963
- ...rest
964
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UserProfile_default, {
965
- mode: "popup",
966
- open: isProfileOpen,
967
- onOpenChange: setIsProfileOpen
968
- })] });
969
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(__thunderid_react.BaseUserDropdown, {
970
- user,
971
- isLoading,
972
- onManageProfile: handleManageProfile,
973
- onSignOut: handleSignOut,
974
- ...rest
975
- }), isProfileOpen && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UserProfile_default, {
976
- mode: "popup",
977
- open: isProfileOpen,
978
- onOpenChange: setIsProfileOpen
979
- })] });
980
- };
981
- var UserDropdown_default = UserDropdown;
982
-
983
- //#endregion
984
- exports.CreateOrganization = CreateOrganization_default;
985
- Object.defineProperty(exports, 'CreateOrganizationProps', {
986
- enumerable: true,
987
- get: function () {
988
- return CreateOrganizationProps;
989
- }
990
- });
991
- exports.Organization = Organization_default;
992
- exports.OrganizationProfile = OrganizationProfile_default;
993
- Object.defineProperty(exports, 'OrganizationProfileProps', {
994
- enumerable: true,
995
- get: function () {
996
- return OrganizationProfileProps;
997
- }
998
- });
999
- Object.defineProperty(exports, 'OrganizationProps', {
1000
- enumerable: true,
1001
- get: function () {
1002
- return OrganizationProps;
1003
- }
1004
- });
1005
- exports.OrganizationSwitcher = OrganizationSwitcher_default;
1006
- Object.defineProperty(exports, 'OrganizationSwitcherProps', {
1007
- enumerable: true,
1008
- get: function () {
1009
- return OrganizationSwitcherProps;
1010
- }
1011
- });
1012
- exports.SignIn = SignIn_default;
1013
- exports.SignInButton = SignInButton_default;
1014
- exports.SignOutButton = SignOutButton_default;
1015
- exports.SignUp = SignUp_default;
1016
- exports.SignUpButton = SignUpButton_default;
1017
- exports.SignedIn = SignedIn_default;
1018
- Object.defineProperty(exports, 'SignedInProps', {
1019
- enumerable: true,
1020
- get: function () {
1021
- return SignedInProps;
1022
- }
1023
- });
1024
- exports.SignedOut = SignedOut_default;
1025
- Object.defineProperty(exports, 'SignedOutProps', {
1026
- enumerable: true,
1027
- get: function () {
1028
- return SignedOutProps;
1029
- }
1030
- });
1031
- exports.ThunderIDNext = require_server.ThunderIDNextClient_default;
1032
- exports.ThunderIDProvider = require_server.ThunderIDProvider_default;
1033
- exports.User = User_default;
1034
- exports.UserDropdown = UserDropdown_default;
1035
- exports.UserProfile = UserProfile_default;
1036
- exports.thunderid = require_server.thunderid_default;
1037
- exports.useThunderID = useThunderID_default;
1
+ const require_ThunderIDNextClient = require('./ThunderIDNextClient.cjs');
2
+ const require_thunderid = require('./server/thunderid.cjs');
3
+ const require_ThunderIDProvider = require('./server/ThunderIDProvider.cjs');
4
+ const require_thunderIDProxy = require('./server/proxy/thunderIDProxy.cjs');
5
+ const require_createRouteMatcher = require('./server/proxy/createRouteMatcher.cjs');
6
+ require('./server/index.cjs');
7
+ const require_useThunderID = require('./client/contexts/ThunderID/useThunderID.cjs');
8
+ const require_SignedIn = require('./client/components/control/SignedIn/SignedIn.cjs');
9
+ const require_SignedOut = require('./client/components/control/SignedOut/SignedOut.cjs');
10
+ const require_SignInButton = require('./client/components/actions/SignInButton/SignInButton.cjs');
11
+ const require_SignUpButton = require('./client/components/actions/SignUpButton/SignUpButton.cjs');
12
+ const require_SignIn = require('./client/components/presentation/SignIn/SignIn.cjs');
13
+ const require_SignOutButton = require('./client/components/actions/SignOutButton/SignOutButton.cjs');
14
+ const require_User = require('./client/components/presentation/User/User.cjs');
15
+ const require_SignUp = require('./client/components/presentation/SignUp/SignUp.cjs');
16
+ const require_UserProfile = require('./client/components/presentation/UserProfile/UserProfile.cjs');
17
+ const require_UserDropdown = require('./client/components/presentation/UserDropdown/UserDropdown.cjs');
18
+ require('./client/index.cjs');
19
+
20
+ exports.SignIn = require_SignIn.default;
21
+ exports.SignInButton = require_SignInButton.default;
22
+ exports.SignOutButton = require_SignOutButton.default;
23
+ exports.SignUp = require_SignUp.default;
24
+ exports.SignUpButton = require_SignUpButton.default;
25
+ exports.SignedIn = require_SignedIn.default;
26
+ exports.SignedOut = require_SignedOut.default;
27
+ exports.ThunderIDNext = require_ThunderIDNextClient.default;
28
+ exports.ThunderIDProvider = require_ThunderIDProvider.default;
29
+ exports.User = require_User.default;
30
+ exports.UserDropdown = require_UserDropdown.default;
31
+ exports.UserProfile = require_UserProfile.default;
32
+ exports.createRouteMatcher = require_createRouteMatcher.default;
33
+ exports.thunderIDProxy = require_thunderIDProxy.default;
34
+ exports.thunderid = require_thunderid.default;
35
+ exports.useThunderID = require_useThunderID.default;