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