@thunderid/nextjs 0.2.1 → 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} +1 -7
  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 -990
  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/client/components/presentation/SignIn/SignIn.d.ts.map +1 -0
  104. package/dist/client/components/presentation/SignIn/SignIn.js +33 -0
  105. package/dist/client/components/presentation/SignIn/SignIn.js.map +1 -0
  106. package/dist/client/components/presentation/SignUp/SignUp.d.ts.map +1 -0
  107. package/dist/client/components/presentation/SignUp/SignUp.js +75 -0
  108. package/dist/client/components/presentation/SignUp/SignUp.js.map +1 -0
  109. package/dist/client/components/presentation/User/User.d.ts.map +1 -0
  110. package/dist/client/components/presentation/User/User.js +46 -0
  111. package/dist/client/components/presentation/User/User.js.map +1 -0
  112. package/dist/client/components/presentation/UserDropdown/UserDropdown.d.ts.map +1 -0
  113. package/dist/client/components/presentation/UserDropdown/UserDropdown.js +110 -0
  114. package/dist/client/components/presentation/UserDropdown/UserDropdown.js.map +1 -0
  115. package/dist/client/components/presentation/UserProfile/UserProfile.d.ts.map +1 -0
  116. package/dist/client/components/presentation/UserProfile/UserProfile.js +49 -0
  117. package/dist/client/components/presentation/UserProfile/UserProfile.js.map +1 -0
  118. package/dist/client/contexts/ThunderID/ThunderIDContext.d.ts.map +1 -0
  119. package/dist/client/contexts/ThunderID/ThunderIDContext.js +32 -0
  120. package/dist/client/contexts/ThunderID/ThunderIDContext.js.map +1 -0
  121. package/dist/{types/client → client}/contexts/ThunderID/ThunderIDProvider.d.ts +1 -8
  122. package/dist/client/contexts/ThunderID/ThunderIDProvider.d.ts.map +1 -0
  123. package/dist/client/contexts/ThunderID/ThunderIDProvider.js +159 -0
  124. package/dist/client/contexts/ThunderID/ThunderIDProvider.js.map +1 -0
  125. package/dist/client/contexts/ThunderID/useThunderID.d.ts.map +1 -0
  126. package/dist/client/contexts/ThunderID/useThunderID.js +17 -0
  127. package/dist/client/contexts/ThunderID/useThunderID.js.map +1 -0
  128. package/dist/{types/client → client}/index.d.ts +2 -10
  129. package/dist/client/index.d.ts.map +1 -0
  130. package/dist/client/index.js +13 -0
  131. package/dist/configs/InternalAuthAPIRoutesConfig.d.ts.map +1 -0
  132. package/dist/constants/sessionConstants.d.ts.map +1 -0
  133. package/dist/constants/sessionConstants.js +53 -0
  134. package/dist/constants/sessionConstants.js.map +1 -0
  135. package/dist/index.d.ts.map +1 -0
  136. package/dist/index.js +20 -934
  137. package/dist/models/api.d.ts.map +1 -0
  138. package/dist/models/config.d.ts.map +1 -0
  139. package/dist/server/ThunderIDProvider.d.ts.map +1 -0
  140. package/dist/server/ThunderIDProvider.js +111 -0
  141. package/dist/server/ThunderIDProvider.js.map +1 -0
  142. package/dist/server/actions/clearSession.d.ts.map +1 -0
  143. package/dist/server/actions/clearSession.js +39 -0
  144. package/dist/server/actions/clearSession.js.map +1 -0
  145. package/dist/server/actions/getAccessToken.d.ts.map +1 -0
  146. package/dist/{getAccessToken-oRxArjVC.js → server/actions/getAccessToken.js} +8 -5
  147. package/dist/server/actions/getAccessToken.js.map +1 -0
  148. package/dist/server/actions/getClientOrigin.d.ts.map +1 -0
  149. package/dist/server/actions/getClientOrigin.js +16 -0
  150. package/dist/server/actions/getClientOrigin.js.map +1 -0
  151. package/dist/server/actions/getSessionId.d.ts.map +1 -0
  152. package/dist/{getSessionId-_7hj8QSX.js → server/actions/getSessionId.js} +8 -5
  153. package/dist/server/actions/getSessionId.js.map +1 -0
  154. package/dist/server/actions/getSessionPayload.d.ts.map +1 -0
  155. package/dist/server/actions/getSessionPayload.js +27 -0
  156. package/dist/server/actions/getSessionPayload.js.map +1 -0
  157. package/dist/server/actions/getUserAction.d.ts.map +1 -0
  158. package/dist/server/actions/getUserAction.js +30 -0
  159. package/dist/server/actions/getUserAction.js.map +1 -0
  160. package/dist/server/actions/getUserProfileAction.d.ts.map +1 -0
  161. package/dist/server/actions/getUserProfileAction.js +34 -0
  162. package/dist/server/actions/getUserProfileAction.js.map +1 -0
  163. package/dist/server/actions/handleOAuthCallbackAction.d.ts.map +1 -0
  164. package/dist/server/actions/handleOAuthCallbackAction.js +87 -0
  165. package/dist/server/actions/handleOAuthCallbackAction.js.map +1 -0
  166. package/dist/server/actions/isSignedIn.d.ts.map +1 -0
  167. package/dist/server/actions/isSignedIn.js +40 -0
  168. package/dist/server/actions/isSignedIn.js.map +1 -0
  169. package/dist/server/actions/refreshToken.d.ts.map +1 -0
  170. package/dist/server/actions/refreshToken.js +58 -0
  171. package/dist/server/actions/refreshToken.js.map +1 -0
  172. package/dist/server/actions/signInAction.d.ts.map +1 -0
  173. package/dist/server/actions/signInAction.js +92 -0
  174. package/dist/server/actions/signInAction.js.map +1 -0
  175. package/dist/server/actions/signOutAction.d.ts.map +1 -0
  176. package/dist/server/actions/signOutAction.js +55 -0
  177. package/dist/server/actions/signOutAction.js.map +1 -0
  178. package/dist/server/actions/signUpAction.d.ts.map +1 -0
  179. package/dist/server/actions/signUpAction.js +27 -0
  180. package/dist/server/actions/signUpAction.js.map +1 -0
  181. package/dist/server/actions/updateUserProfileAction.d.ts.map +1 -0
  182. package/dist/server/actions/updateUserProfileAction.js +30 -0
  183. package/dist/server/actions/updateUserProfileAction.js.map +1 -0
  184. package/dist/server/getClient.d.ts.map +1 -0
  185. package/dist/server/getClient.js +19 -0
  186. package/dist/server/getClient.js.map +1 -0
  187. package/dist/{types/server → server}/index.d.ts +3 -0
  188. package/dist/server/index.d.ts.map +1 -0
  189. package/dist/server/index.js +6 -0
  190. package/dist/server/proxy/createRouteMatcher.d.ts.map +1 -0
  191. package/dist/server/proxy/createRouteMatcher.js +35 -0
  192. package/dist/server/proxy/createRouteMatcher.js.map +1 -0
  193. package/dist/{types/server/middleware/thunderIDMiddleware.d.ts → server/proxy/thunderIDProxy.d.ts} +13 -13
  194. package/dist/server/proxy/thunderIDProxy.d.ts.map +1 -0
  195. package/dist/server/proxy/thunderIDProxy.js +180 -0
  196. package/dist/server/proxy/thunderIDProxy.js.map +1 -0
  197. package/dist/server/thunderid.d.ts.map +1 -0
  198. package/dist/server/thunderid.js +27 -0
  199. package/dist/server/thunderid.js.map +1 -0
  200. package/dist/utils/SessionManager.d.ts.map +1 -0
  201. package/dist/utils/SessionManager.js +147 -0
  202. package/dist/utils/SessionManager.js.map +1 -0
  203. package/dist/utils/createRouteMatcher.d.ts.map +1 -0
  204. package/dist/utils/decorateConfigWithNextEnv.d.ts.map +1 -0
  205. package/dist/utils/decorateConfigWithNextEnv.js +27 -0
  206. package/dist/utils/decorateConfigWithNextEnv.js.map +1 -0
  207. package/dist/utils/handleRefreshToken.d.ts.map +1 -0
  208. package/dist/utils/handleRefreshToken.js +62 -0
  209. package/dist/utils/handleRefreshToken.js.map +1 -0
  210. package/dist/utils/logger.d.ts.map +1 -0
  211. package/dist/utils/logger.js +9 -0
  212. package/dist/utils/logger.js.map +1 -0
  213. package/dist/utils/sessionUtils.d.ts.map +1 -0
  214. package/dist/utils/sessionUtils.js +39 -0
  215. package/dist/utils/sessionUtils.js.map +1 -0
  216. package/package.json +6 -16
  217. package/dist/SessionManager-BvmZ19QF.js +0 -1384
  218. package/dist/cache-DOmEIb7_.js +0 -6329
  219. package/dist/cjs/SessionManager-x03qrCM_.js +0 -1397
  220. package/dist/cjs/cache-Bw8u7jYk.js +0 -6332
  221. package/dist/cjs/dynamic-rendering-DY0EUx64.js +0 -1510
  222. package/dist/cjs/getAccessToken-eJk739AD.js +0 -22
  223. package/dist/cjs/getSessionId-BXqdO0BZ.js +0 -28
  224. package/dist/cjs/getSessionId-j-ERy_WP.js +0 -5
  225. package/dist/cjs/index2.cjs +0 -8
  226. package/dist/cjs/middleware.cjs +0 -5151
  227. package/dist/cjs/segment-CViTHaAn.js +0 -52
  228. package/dist/cjs/server-ABSmm73r.js +0 -2426
  229. package/dist/dynamic-rendering-CXn-s32e.js +0 -1429
  230. package/dist/getSessionId-6IipYdCB.js +0 -5
  231. package/dist/index2.js +0 -7
  232. package/dist/middleware.js +0 -5152
  233. package/dist/segment-DRUZ6e3T.js +0 -47
  234. package/dist/server-BUNp5d6D.js +0 -2376
  235. package/dist/types/ThunderIDNextClient.d.ts.map +0 -1
  236. package/dist/types/client/components/actions/SignInButton/SignInButton.d.ts.map +0 -1
  237. package/dist/types/client/components/actions/SignOutButton/SignOutButton.d.ts.map +0 -1
  238. package/dist/types/client/components/actions/SignUpButton/SignUpButton.d.ts.map +0 -1
  239. package/dist/types/client/components/control/Loading/Loading.d.ts.map +0 -1
  240. package/dist/types/client/components/control/SignedIn/SignedIn.d.ts.map +0 -1
  241. package/dist/types/client/components/control/SignedOut/SignedOut.d.ts.map +0 -1
  242. package/dist/types/client/components/presentation/CreateOrganization/CreateOrganization.d.ts +0 -68
  243. package/dist/types/client/components/presentation/CreateOrganization/CreateOrganization.d.ts.map +0 -1
  244. package/dist/types/client/components/presentation/Organization/Organization.d.ts +0 -67
  245. package/dist/types/client/components/presentation/Organization/Organization.d.ts.map +0 -1
  246. package/dist/types/client/components/presentation/OrganizationList/OrganizationList.d.ts +0 -93
  247. package/dist/types/client/components/presentation/OrganizationList/OrganizationList.d.ts.map +0 -1
  248. package/dist/types/client/components/presentation/OrganizationProfile/OrganizationProfile.d.ts +0 -120
  249. package/dist/types/client/components/presentation/OrganizationProfile/OrganizationProfile.d.ts.map +0 -1
  250. package/dist/types/client/components/presentation/OrganizationSwitcher/OrganizationSwitcher.d.ts +0 -72
  251. package/dist/types/client/components/presentation/OrganizationSwitcher/OrganizationSwitcher.d.ts.map +0 -1
  252. package/dist/types/client/components/presentation/SignIn/SignIn.d.ts.map +0 -1
  253. package/dist/types/client/components/presentation/SignUp/SignUp.d.ts.map +0 -1
  254. package/dist/types/client/components/presentation/User/User.d.ts.map +0 -1
  255. package/dist/types/client/components/presentation/UserDropdown/UserDropdown.d.ts.map +0 -1
  256. package/dist/types/client/components/presentation/UserProfile/UserProfile.d.ts.map +0 -1
  257. package/dist/types/client/contexts/ThunderID/ThunderIDContext.d.ts.map +0 -1
  258. package/dist/types/client/contexts/ThunderID/ThunderIDProvider.d.ts.map +0 -1
  259. package/dist/types/client/contexts/ThunderID/useThunderID.d.ts.map +0 -1
  260. package/dist/types/client/index.d.ts.map +0 -1
  261. package/dist/types/configs/InternalAuthAPIRoutesConfig.d.ts.map +0 -1
  262. package/dist/types/constants/sessionConstants.d.ts.map +0 -1
  263. package/dist/types/index.d.ts.map +0 -1
  264. package/dist/types/middleware.d.ts +0 -35
  265. package/dist/types/middleware.d.ts.map +0 -1
  266. package/dist/types/models/api.d.ts.map +0 -1
  267. package/dist/types/models/config.d.ts.map +0 -1
  268. package/dist/types/server/ThunderIDProvider.d.ts.map +0 -1
  269. package/dist/types/server/actions/clearSession.d.ts.map +0 -1
  270. package/dist/types/server/actions/createOrganization.d.ts +0 -24
  271. package/dist/types/server/actions/createOrganization.d.ts.map +0 -1
  272. package/dist/types/server/actions/getAccessToken.d.ts.map +0 -1
  273. package/dist/types/server/actions/getAllOrganizations.d.ts +0 -24
  274. package/dist/types/server/actions/getAllOrganizations.d.ts.map +0 -1
  275. package/dist/types/server/actions/getBrandingPreference.d.ts +0 -24
  276. package/dist/types/server/actions/getBrandingPreference.d.ts.map +0 -1
  277. package/dist/types/server/actions/getClientOrigin.d.ts.map +0 -1
  278. package/dist/types/server/actions/getCurrentOrganizationAction.d.ts +0 -31
  279. package/dist/types/server/actions/getCurrentOrganizationAction.d.ts.map +0 -1
  280. package/dist/types/server/actions/getMyOrganizations.d.ts +0 -24
  281. package/dist/types/server/actions/getMyOrganizations.d.ts.map +0 -1
  282. package/dist/types/server/actions/getOrganizationAction.d.ts +0 -31
  283. package/dist/types/server/actions/getOrganizationAction.d.ts.map +0 -1
  284. package/dist/types/server/actions/getSessionId.d.ts.map +0 -1
  285. package/dist/types/server/actions/getSessionPayload.d.ts.map +0 -1
  286. package/dist/types/server/actions/getUserAction.d.ts.map +0 -1
  287. package/dist/types/server/actions/getUserProfileAction.d.ts.map +0 -1
  288. package/dist/types/server/actions/handleOAuthCallbackAction.d.ts.map +0 -1
  289. package/dist/types/server/actions/isSignedIn.d.ts.map +0 -1
  290. package/dist/types/server/actions/refreshToken.d.ts.map +0 -1
  291. package/dist/types/server/actions/signInAction.d.ts.map +0 -1
  292. package/dist/types/server/actions/signOutAction.d.ts.map +0 -1
  293. package/dist/types/server/actions/signUpAction.d.ts.map +0 -1
  294. package/dist/types/server/actions/switchOrganization.d.ts +0 -24
  295. package/dist/types/server/actions/switchOrganization.d.ts.map +0 -1
  296. package/dist/types/server/actions/updateUserProfileAction.d.ts.map +0 -1
  297. package/dist/types/server/getClient.d.ts.map +0 -1
  298. package/dist/types/server/index.d.ts.map +0 -1
  299. package/dist/types/server/middleware/createRouteMatcher.d.ts.map +0 -1
  300. package/dist/types/server/middleware/thunderIDMiddleware.d.ts.map +0 -1
  301. package/dist/types/server/thunderid.d.ts.map +0 -1
  302. package/dist/types/utils/SessionManager.d.ts.map +0 -1
  303. package/dist/types/utils/createRouteMatcher.d.ts.map +0 -1
  304. package/dist/types/utils/decorateConfigWithNextEnv.d.ts.map +0 -1
  305. package/dist/types/utils/handleRefreshToken.d.ts.map +0 -1
  306. package/dist/types/utils/logger.d.ts.map +0 -1
  307. package/dist/types/utils/sessionUtils.d.ts.map +0 -1
  308. /package/dist/{types/client → client}/components/actions/SignInButton/SignInButton.d.ts +0 -0
  309. /package/dist/{types/client → client}/components/actions/SignOutButton/SignOutButton.d.ts +0 -0
  310. /package/dist/{types/client → client}/components/actions/SignUpButton/SignUpButton.d.ts +0 -0
  311. /package/dist/{types/client → client}/components/control/Loading/Loading.d.ts +0 -0
  312. /package/dist/{types/client → client}/components/control/SignedIn/SignedIn.d.ts +0 -0
  313. /package/dist/{types/client → client}/components/control/SignedOut/SignedOut.d.ts +0 -0
  314. /package/dist/{types/client → client}/components/presentation/SignIn/SignIn.d.ts +0 -0
  315. /package/dist/{types/client → client}/components/presentation/SignUp/SignUp.d.ts +0 -0
  316. /package/dist/{types/client → client}/components/presentation/User/User.d.ts +0 -0
  317. /package/dist/{types/client → client}/components/presentation/UserDropdown/UserDropdown.d.ts +0 -0
  318. /package/dist/{types/client → client}/components/presentation/UserProfile/UserProfile.d.ts +0 -0
  319. /package/dist/{types/client → client}/contexts/ThunderID/ThunderIDContext.d.ts +0 -0
  320. /package/dist/{types/client → client}/contexts/ThunderID/useThunderID.d.ts +0 -0
  321. /package/dist/{types/configs → configs}/InternalAuthAPIRoutesConfig.d.ts +0 -0
  322. /package/dist/{types/constants → constants}/sessionConstants.d.ts +0 -0
  323. /package/dist/{types/index.d.ts → index.d.ts} +0 -0
  324. /package/dist/{types/models → models}/api.d.ts +0 -0
  325. /package/dist/{types/models → models}/config.d.ts +0 -0
  326. /package/dist/{types/server → server}/ThunderIDProvider.d.ts +0 -0
  327. /package/dist/{types/server → server}/actions/clearSession.d.ts +0 -0
  328. /package/dist/{types/server → server}/actions/getAccessToken.d.ts +0 -0
  329. /package/dist/{types/server → server}/actions/getClientOrigin.d.ts +0 -0
  330. /package/dist/{types/server → server}/actions/getSessionId.d.ts +0 -0
  331. /package/dist/{types/server → server}/actions/getSessionPayload.d.ts +0 -0
  332. /package/dist/{types/server → server}/actions/getUserAction.d.ts +0 -0
  333. /package/dist/{types/server → server}/actions/getUserProfileAction.d.ts +0 -0
  334. /package/dist/{types/server → server}/actions/handleOAuthCallbackAction.d.ts +0 -0
  335. /package/dist/{types/server → server}/actions/isSignedIn.d.ts +0 -0
  336. /package/dist/{types/server → server}/actions/refreshToken.d.ts +0 -0
  337. /package/dist/{types/server → server}/actions/signInAction.d.ts +0 -0
  338. /package/dist/{types/server → server}/actions/signOutAction.d.ts +0 -0
  339. /package/dist/{types/server → server}/actions/signUpAction.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,990 +1,35 @@
1
- const require_dynamic_rendering = require('./dynamic-rendering-DY0EUx64.js');
2
- require('./SessionManager-x03qrCM_.js');
3
- const require_server = require('./server-ABSmm73r.js');
4
- const require_getSessionId = require('./getSessionId-BXqdO0BZ.js');
5
- require('./segment-CViTHaAn.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
- const SignIn = ({ size = "medium", variant = "outlined",...rest }) => {
634
- const { signIn } = useThunderID_default();
635
- const handleOnSubmit = async (payload, request) => {
636
- if (!signIn) throw new __thunderid_node.ThunderIDRuntimeError("`signIn` function is not available.", "SignIn-handleOnSubmit-RuntimeError-001", "nextjs");
637
- await signIn(payload, request);
638
- };
639
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(__thunderid_react.BaseSignIn, {
640
- onSubmit: handleOnSubmit,
641
- size,
642
- variant,
643
- ...rest
644
- });
645
- };
646
- SignIn.displayName = "SignIn";
647
- var SignIn_default = SignIn;
648
-
649
- //#endregion
650
- //#region src/client/components/actions/SignOutButton/SignOutButton.tsx
651
- /**
652
- * SignInButton component. This button initiates the sign-in process when clicked.
653
- *
654
- * @example
655
- * ```tsx
656
- * import { SignInButton } from '@thunderid/auth-react';
657
- *
658
- * const App = () => {
659
- * const buttonRef = useRef<HTMLButtonElement>(null);
660
- * return (
661
- * <SignInButton ref={buttonRef} className="custom-class" style={{ backgroundColor: 'blue' }}>
662
- * Sign In
663
- * </SignInButton>
664
- * );
665
- * }
666
- * ```
667
- */
668
- const SignOutButton = (0, react.forwardRef)(({ className, style, preferences, onClick, children,...rest }, ref) => {
669
- const { signOut } = useThunderID_default();
670
- const { t } = (0, __thunderid_react.useTranslation)(preferences?.i18n);
671
- const [isLoading, setIsLoading] = (0, react.useState)(false);
672
- const handleOnClick = async (e) => {
673
- try {
674
- setIsLoading(true);
675
- require_server.logger_default.debug("[SignOutButton] Initiating a sign-out from a button click");
676
- await signOut();
677
- if (onClick) onClick(e);
678
- } catch (error) {
679
- require_server.logger_default.error("[SignOutButton] Error occurred initiating sign-out from a button click:", error);
680
- } finally {
681
- setIsLoading(false);
682
- }
683
- };
684
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(__thunderid_react.BaseSignOutButton, {
685
- ref,
686
- onClick: handleOnClick,
687
- isLoading,
688
- preferences,
689
- ...rest,
690
- children: children ?? t("elements.buttons.signout.text")
691
- });
692
- });
693
- var SignOutButton_default = SignOutButton;
694
-
695
- //#endregion
696
- //#region src/client/components/presentation/User/User.tsx
697
- /**
698
- * A component that uses render props to expose the authenticated user object.
699
- * This component automatically retrieves the user from ThunderID context.
700
- *
701
- * @remarks This component is only supported in browser based React applications (CSR).
702
- *
703
- * @example
704
- * ```tsx
705
- * import { User } from '@thunderid/auth-react';
706
- *
707
- * const App = () => {
708
- * return (
709
- * <User fallback={<p>Please sign in</p>}>
710
- * {(user) => (
711
- * <div>
712
- * <h1>Welcome, {user.displayName}!</h1>
713
- * <p>Email: {user.email}</p>
714
- * </div>
715
- * )}
716
- * </User>
717
- * );
718
- * }
719
- * ```
720
- */
721
- const User = ({ children, fallback = null }) => {
722
- const { user } = useThunderID_default();
723
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(__thunderid_react.BaseUser, {
724
- user,
725
- fallback,
726
- children
727
- });
728
- };
729
- User.displayName = "User";
730
- var User_default = User;
731
-
732
- //#endregion
733
- //#region src/client/components/presentation/SignUp/SignUp.tsx
734
- /**
735
- * A styled SignUp component that provides embedded sign-up flow with pre-built styling.
736
- * This component handles the API calls for sign-up and delegates UI logic to BaseSignUp.
737
- *
738
- * @example
739
- * ```tsx
740
- * import { SignUp } from '@thunderid/react';
741
- *
742
- * const App = () => {
743
- * return (
744
- * <SignUp
745
- * onSuccess={(response) => {
746
- * console.log('Sign-up successful:', response);
747
- * // Handle successful sign-up (e.g., redirect, show confirmation)
748
- * }}
749
- * onError={(error) => {
750
- * console.error('Sign-up failed:', error);
751
- * }}
752
- * onComplete={(redirectUrl) => {
753
- * // Platform-specific redirect handling (e.g., Next.js router.push)
754
- * router.push(redirectUrl); // or window.location.href = redirectUrl
755
- * }}
756
- * size="medium"
757
- * variant="outlined"
758
- * afterSignUpUrl="/welcome"
759
- * />
760
- * );
761
- * };
762
- * ```
763
- */
764
- const SignUp = ({ className, size = "medium", variant = "outlined", afterSignUpUrl, onError }) => {
765
- const { signUp, applicationId: contextApplicationId, scopes } = useThunderID_default();
766
- /**
767
- * Initialize the sign-up flow.
768
- */
769
- const handleInitialize = async (payload) => {
770
- if (!signUp) throw new __thunderid_node.ThunderIDRuntimeError("`signUp` function is not available.", "SignUp-handleInitialize-RuntimeError-001", "nextjs");
771
- return await signUp(payload || {
772
- flowType: __thunderid_node.EmbeddedFlowType.Registration,
773
- ...contextApplicationId && { applicationId: contextApplicationId },
774
- ...scopes && { scopes }
775
- });
776
- };
777
- /**
778
- * Handle sign-up steps.
779
- */
780
- const handleOnSubmit = async (payload) => {
781
- if (!signUp) throw new __thunderid_node.ThunderIDRuntimeError("`signUp` function is not available.", "SignUp-handleOnSubmit-RuntimeError-001", "nextjs");
782
- return await signUp(payload);
783
- };
784
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(__thunderid_react.BaseSignUp, {
785
- afterSignUpUrl,
786
- onInitialize: handleInitialize,
787
- onSubmit: handleOnSubmit,
788
- onError,
789
- className,
790
- size,
791
- variant,
792
- isInitialized: true
793
- });
794
- };
795
- var SignUp_default = SignUp;
796
-
797
- //#endregion
798
- //#region src/client/components/presentation/UserProfile/UserProfile.tsx
799
- /**
800
- * UserProfile component displays the authenticated user's profile information in a
801
- * structured and styled format. It shows user details such as display name, email,
802
- * username, and other available profile information from ThunderID.
803
- *
804
- * This component is the React-specific implementation that uses the BaseUserProfile
805
- * and automatically retrieves the user data from ThunderID context if not provided.
806
- *
807
- * @example
808
- * ```tsx
809
- * // Basic usage - will use user from ThunderID context
810
- * <UserProfile />
811
- *
812
- * // With explicit user data
813
- * <UserProfile user={specificUser} />
814
- *
815
- * // With card layout and custom fallback
816
- * <UserProfile
817
- * cardLayout={true}
818
- * fallback={<div>Please sign in to view your profile</div>}
819
- * />
820
- * ```
821
- */
822
- const UserProfile = ({ ...rest }) => {
823
- const { profile, flattenedProfile, schemas, onUpdateProfile, updateProfile } = (0, __thunderid_react.useUser)();
824
- const handleProfileUpdate = async (payload) => {
825
- onUpdateProfile((await updateProfile(payload, await require_getSessionId.getSessionId_default()))?.data?.user);
826
- };
827
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(__thunderid_react.BaseUserProfile, {
828
- profile,
829
- flattenedProfile,
830
- schemas,
831
- onUpdate: handleProfileUpdate,
832
- ...rest
833
- });
834
- };
835
- var UserProfile_default = UserProfile;
836
-
837
- //#endregion
838
- //#region src/client/components/presentation/UserDropdown/UserDropdown.tsx
839
- /**
840
- * UserDropdown component displays a user avatar with a dropdown menu.
841
- * When clicked, it shows a popover with customizable menu items.
842
- * This component is the React-specific implementation that uses the BaseUserDropdown
843
- * and automatically retrieves the user data from ThunderID context.
844
- *
845
- * Supports render props for complete customization of the dropdown appearance and behavior.
846
- *
847
- * @example
848
- * ```tsx
849
- * // Basic usage - will use user from ThunderID context
850
- * <UserDropdown menuItems={[
851
- * { label: 'Profile', onClick: () => {} },
852
- * { label: 'Settings', href: '/settings' },
853
- * { label: 'Sign Out', onClick: () => {} }
854
- * ]} />
855
- *
856
- * // With custom configuration
857
- * <UserDropdown
858
- * showTriggerLabel={true}
859
- * avatarSize={40}
860
- * fallback={<div>Please sign in</div>}
861
- * />
862
- *
863
- * // Using render props for complete customization
864
- * <UserDropdown>
865
- * {({ user, isLoading, openProfile, signOut }) => (
866
- * <div>
867
- * <button onClick={openProfile}>
868
- * {user?.name || 'Loading...'}
869
- * </button>
870
- * <button onClick={signOut}>Logout</button>
871
- * </div>
872
- * )}
873
- * </UserDropdown>
874
- *
875
- * // Using partial render props
876
- * <UserDropdown
877
- * renderTrigger={({ user, openProfile }) => (
878
- * <button onClick={openProfile} className="custom-trigger">
879
- * Welcome, {user?.name}!
880
- * </button>
881
- * )}
882
- * />
883
- * ```
884
- */
885
- const UserDropdown = ({ children, renderTrigger, renderDropdown, onSignOut,...rest }) => {
886
- const { user, isLoading, signOut } = useThunderID_default();
887
- const [isProfileOpen, setIsProfileOpen] = (0, react.useState)(false);
888
- const handleManageProfile = () => {
889
- setIsProfileOpen(true);
890
- };
891
- const handleSignOut = () => {
892
- signOut();
893
- if (onSignOut) onSignOut();
894
- };
895
- const closeProfile = () => {
896
- setIsProfileOpen(false);
897
- };
898
- const renderProps = {
899
- closeProfile,
900
- isLoading,
901
- isProfileOpen,
902
- openProfile: handleManageProfile,
903
- signOut: handleSignOut,
904
- user
905
- };
906
- if (children) return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [children(renderProps), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UserProfile_default, {
907
- mode: "popup",
908
- open: isProfileOpen,
909
- onOpenChange: setIsProfileOpen
910
- })] });
911
- 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, {
912
- user,
913
- isLoading,
914
- onManageProfile: handleManageProfile,
915
- onSignOut: handleSignOut,
916
- ...rest
917
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UserProfile_default, {
918
- mode: "popup",
919
- open: isProfileOpen,
920
- onOpenChange: setIsProfileOpen
921
- })] });
922
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(__thunderid_react.BaseUserDropdown, {
923
- user,
924
- isLoading,
925
- onManageProfile: handleManageProfile,
926
- onSignOut: handleSignOut,
927
- ...rest
928
- }), isProfileOpen && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UserProfile_default, {
929
- mode: "popup",
930
- open: isProfileOpen,
931
- onOpenChange: setIsProfileOpen
932
- })] });
933
- };
934
- var UserDropdown_default = UserDropdown;
935
-
936
- //#endregion
937
- exports.CreateOrganization = CreateOrganization_default;
938
- Object.defineProperty(exports, 'CreateOrganizationProps', {
939
- enumerable: true,
940
- get: function () {
941
- return CreateOrganizationProps;
942
- }
943
- });
944
- exports.Organization = Organization_default;
945
- exports.OrganizationProfile = OrganizationProfile_default;
946
- Object.defineProperty(exports, 'OrganizationProfileProps', {
947
- enumerable: true,
948
- get: function () {
949
- return OrganizationProfileProps;
950
- }
951
- });
952
- Object.defineProperty(exports, 'OrganizationProps', {
953
- enumerable: true,
954
- get: function () {
955
- return OrganizationProps;
956
- }
957
- });
958
- exports.OrganizationSwitcher = OrganizationSwitcher_default;
959
- Object.defineProperty(exports, 'OrganizationSwitcherProps', {
960
- enumerable: true,
961
- get: function () {
962
- return OrganizationSwitcherProps;
963
- }
964
- });
965
- exports.SignIn = SignIn_default;
966
- exports.SignInButton = SignInButton_default;
967
- exports.SignOutButton = SignOutButton_default;
968
- exports.SignUp = SignUp_default;
969
- exports.SignUpButton = SignUpButton_default;
970
- exports.SignedIn = SignedIn_default;
971
- Object.defineProperty(exports, 'SignedInProps', {
972
- enumerable: true,
973
- get: function () {
974
- return SignedInProps;
975
- }
976
- });
977
- exports.SignedOut = SignedOut_default;
978
- Object.defineProperty(exports, 'SignedOutProps', {
979
- enumerable: true,
980
- get: function () {
981
- return SignedOutProps;
982
- }
983
- });
984
- exports.ThunderIDNext = require_server.ThunderIDNextClient_default;
985
- exports.ThunderIDProvider = require_server.ThunderIDProvider_default;
986
- exports.User = User_default;
987
- exports.UserDropdown = UserDropdown_default;
988
- exports.UserProfile = UserProfile_default;
989
- exports.thunderid = require_server.thunderid_default;
990
- 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;