@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.
- package/dist/{types/ThunderIDNextClient.d.ts → ThunderIDNextClient.d.ts} +1 -7
- package/dist/ThunderIDNextClient.d.ts.map +1 -0
- package/dist/ThunderIDNextClient.js +161 -0
- package/dist/ThunderIDNextClient.js.map +1 -0
- package/dist/cjs/ThunderIDNextClient.cjs +163 -0
- package/dist/cjs/ThunderIDNextClient.cjs.map +1 -0
- package/dist/cjs/_virtual/rolldown_runtime.cjs +25 -0
- package/dist/cjs/client/components/actions/SignInButton/SignInButton.cjs +79 -0
- package/dist/cjs/client/components/actions/SignInButton/SignInButton.cjs.map +1 -0
- package/dist/cjs/client/components/actions/SignOutButton/SignOutButton.cjs +61 -0
- package/dist/cjs/client/components/actions/SignOutButton/SignOutButton.cjs.map +1 -0
- package/dist/cjs/client/components/actions/SignUpButton/SignUpButton.cjs +91 -0
- package/dist/cjs/client/components/actions/SignUpButton/SignUpButton.cjs.map +1 -0
- package/dist/cjs/client/components/control/SignedIn/SignedIn.cjs +34 -0
- package/dist/cjs/client/components/control/SignedIn/SignedIn.cjs.map +1 -0
- package/dist/cjs/client/components/control/SignedOut/SignedOut.cjs +34 -0
- package/dist/cjs/client/components/control/SignedOut/SignedOut.cjs.map +1 -0
- package/dist/cjs/client/components/presentation/SignIn/SignIn.cjs +37 -0
- package/dist/cjs/client/components/presentation/SignIn/SignIn.cjs.map +1 -0
- package/dist/cjs/client/components/presentation/SignUp/SignUp.cjs +79 -0
- package/dist/cjs/client/components/presentation/SignUp/SignUp.cjs.map +1 -0
- package/dist/cjs/client/components/presentation/User/User.cjs +49 -0
- package/dist/cjs/client/components/presentation/User/User.cjs.map +1 -0
- package/dist/cjs/client/components/presentation/UserDropdown/UserDropdown.cjs +114 -0
- package/dist/cjs/client/components/presentation/UserDropdown/UserDropdown.cjs.map +1 -0
- package/dist/cjs/client/components/presentation/UserProfile/UserProfile.cjs +52 -0
- package/dist/cjs/client/components/presentation/UserProfile/UserProfile.cjs.map +1 -0
- package/dist/cjs/client/contexts/ThunderID/ThunderIDContext.cjs +34 -0
- package/dist/cjs/client/contexts/ThunderID/ThunderIDContext.cjs.map +1 -0
- package/dist/cjs/client/contexts/ThunderID/ThunderIDProvider.cjs +165 -0
- package/dist/cjs/client/contexts/ThunderID/ThunderIDProvider.cjs.map +1 -0
- package/dist/cjs/client/contexts/ThunderID/useThunderID.cjs +19 -0
- package/dist/cjs/client/contexts/ThunderID/useThunderID.cjs.map +1 -0
- package/dist/cjs/client/index.cjs +11 -0
- package/dist/cjs/constants/sessionConstants.cjs +55 -0
- package/dist/cjs/constants/sessionConstants.cjs.map +1 -0
- package/dist/cjs/index.cjs +35 -990
- package/dist/cjs/server/ThunderIDProvider.cjs +114 -0
- package/dist/cjs/server/ThunderIDProvider.cjs.map +1 -0
- package/dist/cjs/server/actions/clearSession.cjs +41 -0
- package/dist/cjs/server/actions/clearSession.cjs.map +1 -0
- package/dist/cjs/server/actions/getAccessToken.cjs +27 -0
- package/dist/cjs/server/actions/getAccessToken.cjs.map +1 -0
- package/dist/cjs/server/actions/getClientOrigin.cjs +18 -0
- package/dist/cjs/server/actions/getClientOrigin.cjs.map +1 -0
- package/dist/cjs/server/actions/getSessionId.cjs +28 -0
- package/dist/cjs/server/actions/getSessionId.cjs.map +1 -0
- package/dist/cjs/server/actions/getSessionPayload.cjs +29 -0
- package/dist/cjs/server/actions/getSessionPayload.cjs.map +1 -0
- package/dist/cjs/server/actions/getUserAction.cjs +30 -0
- package/dist/cjs/server/actions/getUserAction.cjs.map +1 -0
- package/dist/cjs/server/actions/getUserProfileAction.cjs +34 -0
- package/dist/cjs/server/actions/getUserProfileAction.cjs.map +1 -0
- package/dist/cjs/server/actions/handleOAuthCallbackAction.cjs +89 -0
- package/dist/cjs/server/actions/handleOAuthCallbackAction.cjs.map +1 -0
- package/dist/cjs/server/actions/isSignedIn.cjs +40 -0
- package/dist/cjs/server/actions/isSignedIn.cjs.map +1 -0
- package/dist/cjs/server/actions/refreshToken.cjs +61 -0
- package/dist/cjs/server/actions/refreshToken.cjs.map +1 -0
- package/dist/cjs/server/actions/signInAction.cjs +95 -0
- package/dist/cjs/server/actions/signInAction.cjs.map +1 -0
- package/dist/cjs/server/actions/signOutAction.cjs +57 -0
- package/dist/cjs/server/actions/signOutAction.cjs.map +1 -0
- package/dist/cjs/server/actions/signUpAction.cjs +27 -0
- package/dist/cjs/server/actions/signUpAction.cjs.map +1 -0
- package/dist/cjs/server/actions/updateUserProfileAction.cjs +30 -0
- package/dist/cjs/server/actions/updateUserProfileAction.cjs.map +1 -0
- package/dist/cjs/server/getClient.cjs +19 -0
- package/dist/cjs/server/getClient.cjs.map +1 -0
- package/dist/cjs/server/index.cjs +9 -0
- package/dist/cjs/server/proxy/createRouteMatcher.cjs +36 -0
- package/dist/cjs/server/proxy/createRouteMatcher.cjs.map +1 -0
- package/dist/cjs/server/proxy/thunderIDProxy.cjs +182 -0
- package/dist/cjs/server/proxy/thunderIDProxy.cjs.map +1 -0
- package/dist/cjs/server/thunderid.cjs +27 -0
- package/dist/cjs/server/thunderid.cjs.map +1 -0
- package/dist/cjs/utils/SessionManager.cjs +150 -0
- package/dist/cjs/utils/SessionManager.cjs.map +1 -0
- package/dist/cjs/utils/decorateConfigWithNextEnv.cjs +28 -0
- package/dist/cjs/utils/decorateConfigWithNextEnv.cjs.map +1 -0
- package/dist/cjs/utils/handleRefreshToken.cjs +62 -0
- package/dist/cjs/utils/handleRefreshToken.cjs.map +1 -0
- package/dist/cjs/utils/logger.cjs +11 -0
- package/dist/cjs/utils/logger.cjs.map +1 -0
- package/dist/cjs/utils/sessionUtils.cjs +40 -0
- package/dist/cjs/utils/sessionUtils.cjs.map +1 -0
- package/dist/client/components/actions/SignInButton/SignInButton.d.ts.map +1 -0
- package/dist/client/components/actions/SignInButton/SignInButton.js +73 -0
- package/dist/client/components/actions/SignInButton/SignInButton.js.map +1 -0
- package/dist/client/components/actions/SignOutButton/SignOutButton.d.ts.map +1 -0
- package/dist/client/components/actions/SignOutButton/SignOutButton.js +57 -0
- package/dist/client/components/actions/SignOutButton/SignOutButton.js.map +1 -0
- package/dist/client/components/actions/SignUpButton/SignUpButton.d.ts.map +1 -0
- package/dist/client/components/actions/SignUpButton/SignUpButton.js +85 -0
- package/dist/client/components/actions/SignUpButton/SignUpButton.js.map +1 -0
- package/dist/client/components/control/Loading/Loading.d.ts.map +1 -0
- package/dist/client/components/control/SignedIn/SignedIn.d.ts.map +1 -0
- package/dist/client/components/control/SignedIn/SignedIn.js +32 -0
- package/dist/client/components/control/SignedIn/SignedIn.js.map +1 -0
- package/dist/client/components/control/SignedOut/SignedOut.d.ts.map +1 -0
- package/dist/client/components/control/SignedOut/SignedOut.js +32 -0
- package/dist/client/components/control/SignedOut/SignedOut.js.map +1 -0
- package/dist/client/components/presentation/SignIn/SignIn.d.ts.map +1 -0
- package/dist/client/components/presentation/SignIn/SignIn.js +33 -0
- package/dist/client/components/presentation/SignIn/SignIn.js.map +1 -0
- package/dist/client/components/presentation/SignUp/SignUp.d.ts.map +1 -0
- package/dist/client/components/presentation/SignUp/SignUp.js +75 -0
- package/dist/client/components/presentation/SignUp/SignUp.js.map +1 -0
- package/dist/client/components/presentation/User/User.d.ts.map +1 -0
- package/dist/client/components/presentation/User/User.js +46 -0
- package/dist/client/components/presentation/User/User.js.map +1 -0
- package/dist/client/components/presentation/UserDropdown/UserDropdown.d.ts.map +1 -0
- package/dist/client/components/presentation/UserDropdown/UserDropdown.js +110 -0
- package/dist/client/components/presentation/UserDropdown/UserDropdown.js.map +1 -0
- package/dist/client/components/presentation/UserProfile/UserProfile.d.ts.map +1 -0
- package/dist/client/components/presentation/UserProfile/UserProfile.js +49 -0
- package/dist/client/components/presentation/UserProfile/UserProfile.js.map +1 -0
- package/dist/client/contexts/ThunderID/ThunderIDContext.d.ts.map +1 -0
- package/dist/client/contexts/ThunderID/ThunderIDContext.js +32 -0
- package/dist/client/contexts/ThunderID/ThunderIDContext.js.map +1 -0
- package/dist/{types/client → client}/contexts/ThunderID/ThunderIDProvider.d.ts +1 -8
- package/dist/client/contexts/ThunderID/ThunderIDProvider.d.ts.map +1 -0
- package/dist/client/contexts/ThunderID/ThunderIDProvider.js +159 -0
- package/dist/client/contexts/ThunderID/ThunderIDProvider.js.map +1 -0
- package/dist/client/contexts/ThunderID/useThunderID.d.ts.map +1 -0
- package/dist/client/contexts/ThunderID/useThunderID.js +17 -0
- package/dist/client/contexts/ThunderID/useThunderID.js.map +1 -0
- package/dist/{types/client → client}/index.d.ts +2 -10
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +13 -0
- package/dist/configs/InternalAuthAPIRoutesConfig.d.ts.map +1 -0
- package/dist/constants/sessionConstants.d.ts.map +1 -0
- package/dist/constants/sessionConstants.js +53 -0
- package/dist/constants/sessionConstants.js.map +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -934
- package/dist/models/api.d.ts.map +1 -0
- package/dist/models/config.d.ts.map +1 -0
- package/dist/server/ThunderIDProvider.d.ts.map +1 -0
- package/dist/server/ThunderIDProvider.js +111 -0
- package/dist/server/ThunderIDProvider.js.map +1 -0
- package/dist/server/actions/clearSession.d.ts.map +1 -0
- package/dist/server/actions/clearSession.js +39 -0
- package/dist/server/actions/clearSession.js.map +1 -0
- package/dist/server/actions/getAccessToken.d.ts.map +1 -0
- package/dist/{getAccessToken-oRxArjVC.js → server/actions/getAccessToken.js} +8 -5
- package/dist/server/actions/getAccessToken.js.map +1 -0
- package/dist/server/actions/getClientOrigin.d.ts.map +1 -0
- package/dist/server/actions/getClientOrigin.js +16 -0
- package/dist/server/actions/getClientOrigin.js.map +1 -0
- package/dist/server/actions/getSessionId.d.ts.map +1 -0
- package/dist/{getSessionId-_7hj8QSX.js → server/actions/getSessionId.js} +8 -5
- package/dist/server/actions/getSessionId.js.map +1 -0
- package/dist/server/actions/getSessionPayload.d.ts.map +1 -0
- package/dist/server/actions/getSessionPayload.js +27 -0
- package/dist/server/actions/getSessionPayload.js.map +1 -0
- package/dist/server/actions/getUserAction.d.ts.map +1 -0
- package/dist/server/actions/getUserAction.js +30 -0
- package/dist/server/actions/getUserAction.js.map +1 -0
- package/dist/server/actions/getUserProfileAction.d.ts.map +1 -0
- package/dist/server/actions/getUserProfileAction.js +34 -0
- package/dist/server/actions/getUserProfileAction.js.map +1 -0
- package/dist/server/actions/handleOAuthCallbackAction.d.ts.map +1 -0
- package/dist/server/actions/handleOAuthCallbackAction.js +87 -0
- package/dist/server/actions/handleOAuthCallbackAction.js.map +1 -0
- package/dist/server/actions/isSignedIn.d.ts.map +1 -0
- package/dist/server/actions/isSignedIn.js +40 -0
- package/dist/server/actions/isSignedIn.js.map +1 -0
- package/dist/server/actions/refreshToken.d.ts.map +1 -0
- package/dist/server/actions/refreshToken.js +58 -0
- package/dist/server/actions/refreshToken.js.map +1 -0
- package/dist/server/actions/signInAction.d.ts.map +1 -0
- package/dist/server/actions/signInAction.js +92 -0
- package/dist/server/actions/signInAction.js.map +1 -0
- package/dist/server/actions/signOutAction.d.ts.map +1 -0
- package/dist/server/actions/signOutAction.js +55 -0
- package/dist/server/actions/signOutAction.js.map +1 -0
- package/dist/server/actions/signUpAction.d.ts.map +1 -0
- package/dist/server/actions/signUpAction.js +27 -0
- package/dist/server/actions/signUpAction.js.map +1 -0
- package/dist/server/actions/updateUserProfileAction.d.ts.map +1 -0
- package/dist/server/actions/updateUserProfileAction.js +30 -0
- package/dist/server/actions/updateUserProfileAction.js.map +1 -0
- package/dist/server/getClient.d.ts.map +1 -0
- package/dist/server/getClient.js +19 -0
- package/dist/server/getClient.js.map +1 -0
- package/dist/{types/server → server}/index.d.ts +3 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +6 -0
- package/dist/server/proxy/createRouteMatcher.d.ts.map +1 -0
- package/dist/server/proxy/createRouteMatcher.js +35 -0
- package/dist/server/proxy/createRouteMatcher.js.map +1 -0
- package/dist/{types/server/middleware/thunderIDMiddleware.d.ts → server/proxy/thunderIDProxy.d.ts} +13 -13
- package/dist/server/proxy/thunderIDProxy.d.ts.map +1 -0
- package/dist/server/proxy/thunderIDProxy.js +180 -0
- package/dist/server/proxy/thunderIDProxy.js.map +1 -0
- package/dist/server/thunderid.d.ts.map +1 -0
- package/dist/server/thunderid.js +27 -0
- package/dist/server/thunderid.js.map +1 -0
- package/dist/utils/SessionManager.d.ts.map +1 -0
- package/dist/utils/SessionManager.js +147 -0
- package/dist/utils/SessionManager.js.map +1 -0
- package/dist/utils/createRouteMatcher.d.ts.map +1 -0
- package/dist/utils/decorateConfigWithNextEnv.d.ts.map +1 -0
- package/dist/utils/decorateConfigWithNextEnv.js +27 -0
- package/dist/utils/decorateConfigWithNextEnv.js.map +1 -0
- package/dist/utils/handleRefreshToken.d.ts.map +1 -0
- package/dist/utils/handleRefreshToken.js +62 -0
- package/dist/utils/handleRefreshToken.js.map +1 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +9 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/sessionUtils.d.ts.map +1 -0
- package/dist/utils/sessionUtils.js +39 -0
- package/dist/utils/sessionUtils.js.map +1 -0
- package/package.json +6 -16
- package/dist/SessionManager-BvmZ19QF.js +0 -1384
- package/dist/cache-DOmEIb7_.js +0 -6329
- package/dist/cjs/SessionManager-x03qrCM_.js +0 -1397
- package/dist/cjs/cache-Bw8u7jYk.js +0 -6332
- package/dist/cjs/dynamic-rendering-DY0EUx64.js +0 -1510
- package/dist/cjs/getAccessToken-eJk739AD.js +0 -22
- package/dist/cjs/getSessionId-BXqdO0BZ.js +0 -28
- package/dist/cjs/getSessionId-j-ERy_WP.js +0 -5
- package/dist/cjs/index2.cjs +0 -8
- package/dist/cjs/middleware.cjs +0 -5151
- package/dist/cjs/segment-CViTHaAn.js +0 -52
- package/dist/cjs/server-ABSmm73r.js +0 -2426
- package/dist/dynamic-rendering-CXn-s32e.js +0 -1429
- package/dist/getSessionId-6IipYdCB.js +0 -5
- package/dist/index2.js +0 -7
- package/dist/middleware.js +0 -5152
- package/dist/segment-DRUZ6e3T.js +0 -47
- package/dist/server-BUNp5d6D.js +0 -2376
- package/dist/types/ThunderIDNextClient.d.ts.map +0 -1
- package/dist/types/client/components/actions/SignInButton/SignInButton.d.ts.map +0 -1
- package/dist/types/client/components/actions/SignOutButton/SignOutButton.d.ts.map +0 -1
- package/dist/types/client/components/actions/SignUpButton/SignUpButton.d.ts.map +0 -1
- package/dist/types/client/components/control/Loading/Loading.d.ts.map +0 -1
- package/dist/types/client/components/control/SignedIn/SignedIn.d.ts.map +0 -1
- package/dist/types/client/components/control/SignedOut/SignedOut.d.ts.map +0 -1
- package/dist/types/client/components/presentation/CreateOrganization/CreateOrganization.d.ts +0 -68
- package/dist/types/client/components/presentation/CreateOrganization/CreateOrganization.d.ts.map +0 -1
- package/dist/types/client/components/presentation/Organization/Organization.d.ts +0 -67
- package/dist/types/client/components/presentation/Organization/Organization.d.ts.map +0 -1
- package/dist/types/client/components/presentation/OrganizationList/OrganizationList.d.ts +0 -93
- package/dist/types/client/components/presentation/OrganizationList/OrganizationList.d.ts.map +0 -1
- package/dist/types/client/components/presentation/OrganizationProfile/OrganizationProfile.d.ts +0 -120
- package/dist/types/client/components/presentation/OrganizationProfile/OrganizationProfile.d.ts.map +0 -1
- package/dist/types/client/components/presentation/OrganizationSwitcher/OrganizationSwitcher.d.ts +0 -72
- package/dist/types/client/components/presentation/OrganizationSwitcher/OrganizationSwitcher.d.ts.map +0 -1
- package/dist/types/client/components/presentation/SignIn/SignIn.d.ts.map +0 -1
- package/dist/types/client/components/presentation/SignUp/SignUp.d.ts.map +0 -1
- package/dist/types/client/components/presentation/User/User.d.ts.map +0 -1
- package/dist/types/client/components/presentation/UserDropdown/UserDropdown.d.ts.map +0 -1
- package/dist/types/client/components/presentation/UserProfile/UserProfile.d.ts.map +0 -1
- package/dist/types/client/contexts/ThunderID/ThunderIDContext.d.ts.map +0 -1
- package/dist/types/client/contexts/ThunderID/ThunderIDProvider.d.ts.map +0 -1
- package/dist/types/client/contexts/ThunderID/useThunderID.d.ts.map +0 -1
- package/dist/types/client/index.d.ts.map +0 -1
- package/dist/types/configs/InternalAuthAPIRoutesConfig.d.ts.map +0 -1
- package/dist/types/constants/sessionConstants.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/middleware.d.ts +0 -35
- package/dist/types/middleware.d.ts.map +0 -1
- package/dist/types/models/api.d.ts.map +0 -1
- package/dist/types/models/config.d.ts.map +0 -1
- package/dist/types/server/ThunderIDProvider.d.ts.map +0 -1
- package/dist/types/server/actions/clearSession.d.ts.map +0 -1
- package/dist/types/server/actions/createOrganization.d.ts +0 -24
- package/dist/types/server/actions/createOrganization.d.ts.map +0 -1
- package/dist/types/server/actions/getAccessToken.d.ts.map +0 -1
- package/dist/types/server/actions/getAllOrganizations.d.ts +0 -24
- package/dist/types/server/actions/getAllOrganizations.d.ts.map +0 -1
- package/dist/types/server/actions/getBrandingPreference.d.ts +0 -24
- package/dist/types/server/actions/getBrandingPreference.d.ts.map +0 -1
- package/dist/types/server/actions/getClientOrigin.d.ts.map +0 -1
- package/dist/types/server/actions/getCurrentOrganizationAction.d.ts +0 -31
- package/dist/types/server/actions/getCurrentOrganizationAction.d.ts.map +0 -1
- package/dist/types/server/actions/getMyOrganizations.d.ts +0 -24
- package/dist/types/server/actions/getMyOrganizations.d.ts.map +0 -1
- package/dist/types/server/actions/getOrganizationAction.d.ts +0 -31
- package/dist/types/server/actions/getOrganizationAction.d.ts.map +0 -1
- package/dist/types/server/actions/getSessionId.d.ts.map +0 -1
- package/dist/types/server/actions/getSessionPayload.d.ts.map +0 -1
- package/dist/types/server/actions/getUserAction.d.ts.map +0 -1
- package/dist/types/server/actions/getUserProfileAction.d.ts.map +0 -1
- package/dist/types/server/actions/handleOAuthCallbackAction.d.ts.map +0 -1
- package/dist/types/server/actions/isSignedIn.d.ts.map +0 -1
- package/dist/types/server/actions/refreshToken.d.ts.map +0 -1
- package/dist/types/server/actions/signInAction.d.ts.map +0 -1
- package/dist/types/server/actions/signOutAction.d.ts.map +0 -1
- package/dist/types/server/actions/signUpAction.d.ts.map +0 -1
- package/dist/types/server/actions/switchOrganization.d.ts +0 -24
- package/dist/types/server/actions/switchOrganization.d.ts.map +0 -1
- package/dist/types/server/actions/updateUserProfileAction.d.ts.map +0 -1
- package/dist/types/server/getClient.d.ts.map +0 -1
- package/dist/types/server/index.d.ts.map +0 -1
- package/dist/types/server/middleware/createRouteMatcher.d.ts.map +0 -1
- package/dist/types/server/middleware/thunderIDMiddleware.d.ts.map +0 -1
- package/dist/types/server/thunderid.d.ts.map +0 -1
- package/dist/types/utils/SessionManager.d.ts.map +0 -1
- package/dist/types/utils/createRouteMatcher.d.ts.map +0 -1
- package/dist/types/utils/decorateConfigWithNextEnv.d.ts.map +0 -1
- package/dist/types/utils/handleRefreshToken.d.ts.map +0 -1
- package/dist/types/utils/logger.d.ts.map +0 -1
- package/dist/types/utils/sessionUtils.d.ts.map +0 -1
- /package/dist/{types/client → client}/components/actions/SignInButton/SignInButton.d.ts +0 -0
- /package/dist/{types/client → client}/components/actions/SignOutButton/SignOutButton.d.ts +0 -0
- /package/dist/{types/client → client}/components/actions/SignUpButton/SignUpButton.d.ts +0 -0
- /package/dist/{types/client → client}/components/control/Loading/Loading.d.ts +0 -0
- /package/dist/{types/client → client}/components/control/SignedIn/SignedIn.d.ts +0 -0
- /package/dist/{types/client → client}/components/control/SignedOut/SignedOut.d.ts +0 -0
- /package/dist/{types/client → client}/components/presentation/SignIn/SignIn.d.ts +0 -0
- /package/dist/{types/client → client}/components/presentation/SignUp/SignUp.d.ts +0 -0
- /package/dist/{types/client → client}/components/presentation/User/User.d.ts +0 -0
- /package/dist/{types/client → client}/components/presentation/UserDropdown/UserDropdown.d.ts +0 -0
- /package/dist/{types/client → client}/components/presentation/UserProfile/UserProfile.d.ts +0 -0
- /package/dist/{types/client → client}/contexts/ThunderID/ThunderIDContext.d.ts +0 -0
- /package/dist/{types/client → client}/contexts/ThunderID/useThunderID.d.ts +0 -0
- /package/dist/{types/configs → configs}/InternalAuthAPIRoutesConfig.d.ts +0 -0
- /package/dist/{types/constants → constants}/sessionConstants.d.ts +0 -0
- /package/dist/{types/index.d.ts → index.d.ts} +0 -0
- /package/dist/{types/models → models}/api.d.ts +0 -0
- /package/dist/{types/models → models}/config.d.ts +0 -0
- /package/dist/{types/server → server}/ThunderIDProvider.d.ts +0 -0
- /package/dist/{types/server → server}/actions/clearSession.d.ts +0 -0
- /package/dist/{types/server → server}/actions/getAccessToken.d.ts +0 -0
- /package/dist/{types/server → server}/actions/getClientOrigin.d.ts +0 -0
- /package/dist/{types/server → server}/actions/getSessionId.d.ts +0 -0
- /package/dist/{types/server → server}/actions/getSessionPayload.d.ts +0 -0
- /package/dist/{types/server → server}/actions/getUserAction.d.ts +0 -0
- /package/dist/{types/server → server}/actions/getUserProfileAction.d.ts +0 -0
- /package/dist/{types/server → server}/actions/handleOAuthCallbackAction.d.ts +0 -0
- /package/dist/{types/server → server}/actions/isSignedIn.d.ts +0 -0
- /package/dist/{types/server → server}/actions/refreshToken.d.ts +0 -0
- /package/dist/{types/server → server}/actions/signInAction.d.ts +0 -0
- /package/dist/{types/server → server}/actions/signOutAction.d.ts +0 -0
- /package/dist/{types/server → server}/actions/signUpAction.d.ts +0 -0
- /package/dist/{types/server → server}/actions/updateUserProfileAction.d.ts +0 -0
- /package/dist/{types/server → server}/getClient.d.ts +0 -0
- /package/dist/{types/server/middleware → server/proxy}/createRouteMatcher.d.ts +0 -0
- /package/dist/{types/server → server}/thunderid.d.ts +0 -0
- /package/dist/{types/utils → utils}/SessionManager.d.ts +0 -0
- /package/dist/{types/utils → utils}/createRouteMatcher.d.ts +0 -0
- /package/dist/{types/utils → utils}/decorateConfigWithNextEnv.d.ts +0 -0
- /package/dist/{types/utils → utils}/handleRefreshToken.d.ts +0 -0
- /package/dist/{types/utils → utils}/logger.d.ts +0 -0
- /package/dist/{types/utils → utils}/sessionUtils.d.ts +0 -0
package/dist/index.js
CHANGED
|
@@ -1,934 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
import "./
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import "./
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
const SignIn = ({ size = "medium", variant = "outlined",...rest }) => {
|
|
631
|
-
const { signIn } = useThunderID_default();
|
|
632
|
-
const handleOnSubmit = async (payload, request) => {
|
|
633
|
-
if (!signIn) throw new ThunderIDRuntimeError("`signIn` function is not available.", "SignIn-handleOnSubmit-RuntimeError-001", "nextjs");
|
|
634
|
-
await signIn(payload, request);
|
|
635
|
-
};
|
|
636
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BaseSignIn, {
|
|
637
|
-
onSubmit: handleOnSubmit,
|
|
638
|
-
size,
|
|
639
|
-
variant,
|
|
640
|
-
...rest
|
|
641
|
-
});
|
|
642
|
-
};
|
|
643
|
-
SignIn.displayName = "SignIn";
|
|
644
|
-
var SignIn_default = SignIn;
|
|
645
|
-
|
|
646
|
-
//#endregion
|
|
647
|
-
//#region src/client/components/actions/SignOutButton/SignOutButton.tsx
|
|
648
|
-
/**
|
|
649
|
-
* SignInButton component. This button initiates the sign-in process when clicked.
|
|
650
|
-
*
|
|
651
|
-
* @example
|
|
652
|
-
* ```tsx
|
|
653
|
-
* import { SignInButton } from '@thunderid/auth-react';
|
|
654
|
-
*
|
|
655
|
-
* const App = () => {
|
|
656
|
-
* const buttonRef = useRef<HTMLButtonElement>(null);
|
|
657
|
-
* return (
|
|
658
|
-
* <SignInButton ref={buttonRef} className="custom-class" style={{ backgroundColor: 'blue' }}>
|
|
659
|
-
* Sign In
|
|
660
|
-
* </SignInButton>
|
|
661
|
-
* );
|
|
662
|
-
* }
|
|
663
|
-
* ```
|
|
664
|
-
*/
|
|
665
|
-
const SignOutButton = forwardRef(({ className, style, preferences, onClick, children,...rest }, ref) => {
|
|
666
|
-
const { signOut } = useThunderID_default();
|
|
667
|
-
const { t } = useTranslation(preferences?.i18n);
|
|
668
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
669
|
-
const handleOnClick = async (e) => {
|
|
670
|
-
try {
|
|
671
|
-
setIsLoading(true);
|
|
672
|
-
logger_default.debug("[SignOutButton] Initiating a sign-out from a button click");
|
|
673
|
-
await signOut();
|
|
674
|
-
if (onClick) onClick(e);
|
|
675
|
-
} catch (error) {
|
|
676
|
-
logger_default.error("[SignOutButton] Error occurred initiating sign-out from a button click:", error);
|
|
677
|
-
} finally {
|
|
678
|
-
setIsLoading(false);
|
|
679
|
-
}
|
|
680
|
-
};
|
|
681
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BaseSignOutButton, {
|
|
682
|
-
ref,
|
|
683
|
-
onClick: handleOnClick,
|
|
684
|
-
isLoading,
|
|
685
|
-
preferences,
|
|
686
|
-
...rest,
|
|
687
|
-
children: children ?? t("elements.buttons.signout.text")
|
|
688
|
-
});
|
|
689
|
-
});
|
|
690
|
-
var SignOutButton_default = SignOutButton;
|
|
691
|
-
|
|
692
|
-
//#endregion
|
|
693
|
-
//#region src/client/components/presentation/User/User.tsx
|
|
694
|
-
/**
|
|
695
|
-
* A component that uses render props to expose the authenticated user object.
|
|
696
|
-
* This component automatically retrieves the user from ThunderID context.
|
|
697
|
-
*
|
|
698
|
-
* @remarks This component is only supported in browser based React applications (CSR).
|
|
699
|
-
*
|
|
700
|
-
* @example
|
|
701
|
-
* ```tsx
|
|
702
|
-
* import { User } from '@thunderid/auth-react';
|
|
703
|
-
*
|
|
704
|
-
* const App = () => {
|
|
705
|
-
* return (
|
|
706
|
-
* <User fallback={<p>Please sign in</p>}>
|
|
707
|
-
* {(user) => (
|
|
708
|
-
* <div>
|
|
709
|
-
* <h1>Welcome, {user.displayName}!</h1>
|
|
710
|
-
* <p>Email: {user.email}</p>
|
|
711
|
-
* </div>
|
|
712
|
-
* )}
|
|
713
|
-
* </User>
|
|
714
|
-
* );
|
|
715
|
-
* }
|
|
716
|
-
* ```
|
|
717
|
-
*/
|
|
718
|
-
const User = ({ children, fallback = null }) => {
|
|
719
|
-
const { user } = useThunderID_default();
|
|
720
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BaseUser, {
|
|
721
|
-
user,
|
|
722
|
-
fallback,
|
|
723
|
-
children
|
|
724
|
-
});
|
|
725
|
-
};
|
|
726
|
-
User.displayName = "User";
|
|
727
|
-
var User_default = User;
|
|
728
|
-
|
|
729
|
-
//#endregion
|
|
730
|
-
//#region src/client/components/presentation/SignUp/SignUp.tsx
|
|
731
|
-
/**
|
|
732
|
-
* A styled SignUp component that provides embedded sign-up flow with pre-built styling.
|
|
733
|
-
* This component handles the API calls for sign-up and delegates UI logic to BaseSignUp.
|
|
734
|
-
*
|
|
735
|
-
* @example
|
|
736
|
-
* ```tsx
|
|
737
|
-
* import { SignUp } from '@thunderid/react';
|
|
738
|
-
*
|
|
739
|
-
* const App = () => {
|
|
740
|
-
* return (
|
|
741
|
-
* <SignUp
|
|
742
|
-
* onSuccess={(response) => {
|
|
743
|
-
* console.log('Sign-up successful:', response);
|
|
744
|
-
* // Handle successful sign-up (e.g., redirect, show confirmation)
|
|
745
|
-
* }}
|
|
746
|
-
* onError={(error) => {
|
|
747
|
-
* console.error('Sign-up failed:', error);
|
|
748
|
-
* }}
|
|
749
|
-
* onComplete={(redirectUrl) => {
|
|
750
|
-
* // Platform-specific redirect handling (e.g., Next.js router.push)
|
|
751
|
-
* router.push(redirectUrl); // or window.location.href = redirectUrl
|
|
752
|
-
* }}
|
|
753
|
-
* size="medium"
|
|
754
|
-
* variant="outlined"
|
|
755
|
-
* afterSignUpUrl="/welcome"
|
|
756
|
-
* />
|
|
757
|
-
* );
|
|
758
|
-
* };
|
|
759
|
-
* ```
|
|
760
|
-
*/
|
|
761
|
-
const SignUp = ({ className, size = "medium", variant = "outlined", afterSignUpUrl, onError }) => {
|
|
762
|
-
const { signUp, applicationId: contextApplicationId, scopes } = useThunderID_default();
|
|
763
|
-
/**
|
|
764
|
-
* Initialize the sign-up flow.
|
|
765
|
-
*/
|
|
766
|
-
const handleInitialize = async (payload) => {
|
|
767
|
-
if (!signUp) throw new ThunderIDRuntimeError("`signUp` function is not available.", "SignUp-handleInitialize-RuntimeError-001", "nextjs");
|
|
768
|
-
return await signUp(payload || {
|
|
769
|
-
flowType: EmbeddedFlowType.Registration,
|
|
770
|
-
...contextApplicationId && { applicationId: contextApplicationId },
|
|
771
|
-
...scopes && { scopes }
|
|
772
|
-
});
|
|
773
|
-
};
|
|
774
|
-
/**
|
|
775
|
-
* Handle sign-up steps.
|
|
776
|
-
*/
|
|
777
|
-
const handleOnSubmit = async (payload) => {
|
|
778
|
-
if (!signUp) throw new ThunderIDRuntimeError("`signUp` function is not available.", "SignUp-handleOnSubmit-RuntimeError-001", "nextjs");
|
|
779
|
-
return await signUp(payload);
|
|
780
|
-
};
|
|
781
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BaseSignUp, {
|
|
782
|
-
afterSignUpUrl,
|
|
783
|
-
onInitialize: handleInitialize,
|
|
784
|
-
onSubmit: handleOnSubmit,
|
|
785
|
-
onError,
|
|
786
|
-
className,
|
|
787
|
-
size,
|
|
788
|
-
variant,
|
|
789
|
-
isInitialized: true
|
|
790
|
-
});
|
|
791
|
-
};
|
|
792
|
-
var SignUp_default = SignUp;
|
|
793
|
-
|
|
794
|
-
//#endregion
|
|
795
|
-
//#region src/client/components/presentation/UserProfile/UserProfile.tsx
|
|
796
|
-
/**
|
|
797
|
-
* UserProfile component displays the authenticated user's profile information in a
|
|
798
|
-
* structured and styled format. It shows user details such as display name, email,
|
|
799
|
-
* username, and other available profile information from ThunderID.
|
|
800
|
-
*
|
|
801
|
-
* This component is the React-specific implementation that uses the BaseUserProfile
|
|
802
|
-
* and automatically retrieves the user data from ThunderID context if not provided.
|
|
803
|
-
*
|
|
804
|
-
* @example
|
|
805
|
-
* ```tsx
|
|
806
|
-
* // Basic usage - will use user from ThunderID context
|
|
807
|
-
* <UserProfile />
|
|
808
|
-
*
|
|
809
|
-
* // With explicit user data
|
|
810
|
-
* <UserProfile user={specificUser} />
|
|
811
|
-
*
|
|
812
|
-
* // With card layout and custom fallback
|
|
813
|
-
* <UserProfile
|
|
814
|
-
* cardLayout={true}
|
|
815
|
-
* fallback={<div>Please sign in to view your profile</div>}
|
|
816
|
-
* />
|
|
817
|
-
* ```
|
|
818
|
-
*/
|
|
819
|
-
const UserProfile = ({ ...rest }) => {
|
|
820
|
-
const { profile, flattenedProfile, schemas, onUpdateProfile, updateProfile } = useUser();
|
|
821
|
-
const handleProfileUpdate = async (payload) => {
|
|
822
|
-
onUpdateProfile((await updateProfile(payload, await getSessionId_default()))?.data?.user);
|
|
823
|
-
};
|
|
824
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BaseUserProfile, {
|
|
825
|
-
profile,
|
|
826
|
-
flattenedProfile,
|
|
827
|
-
schemas,
|
|
828
|
-
onUpdate: handleProfileUpdate,
|
|
829
|
-
...rest
|
|
830
|
-
});
|
|
831
|
-
};
|
|
832
|
-
var UserProfile_default = UserProfile;
|
|
833
|
-
|
|
834
|
-
//#endregion
|
|
835
|
-
//#region src/client/components/presentation/UserDropdown/UserDropdown.tsx
|
|
836
|
-
/**
|
|
837
|
-
* UserDropdown component displays a user avatar with a dropdown menu.
|
|
838
|
-
* When clicked, it shows a popover with customizable menu items.
|
|
839
|
-
* This component is the React-specific implementation that uses the BaseUserDropdown
|
|
840
|
-
* and automatically retrieves the user data from ThunderID context.
|
|
841
|
-
*
|
|
842
|
-
* Supports render props for complete customization of the dropdown appearance and behavior.
|
|
843
|
-
*
|
|
844
|
-
* @example
|
|
845
|
-
* ```tsx
|
|
846
|
-
* // Basic usage - will use user from ThunderID context
|
|
847
|
-
* <UserDropdown menuItems={[
|
|
848
|
-
* { label: 'Profile', onClick: () => {} },
|
|
849
|
-
* { label: 'Settings', href: '/settings' },
|
|
850
|
-
* { label: 'Sign Out', onClick: () => {} }
|
|
851
|
-
* ]} />
|
|
852
|
-
*
|
|
853
|
-
* // With custom configuration
|
|
854
|
-
* <UserDropdown
|
|
855
|
-
* showTriggerLabel={true}
|
|
856
|
-
* avatarSize={40}
|
|
857
|
-
* fallback={<div>Please sign in</div>}
|
|
858
|
-
* />
|
|
859
|
-
*
|
|
860
|
-
* // Using render props for complete customization
|
|
861
|
-
* <UserDropdown>
|
|
862
|
-
* {({ user, isLoading, openProfile, signOut }) => (
|
|
863
|
-
* <div>
|
|
864
|
-
* <button onClick={openProfile}>
|
|
865
|
-
* {user?.name || 'Loading...'}
|
|
866
|
-
* </button>
|
|
867
|
-
* <button onClick={signOut}>Logout</button>
|
|
868
|
-
* </div>
|
|
869
|
-
* )}
|
|
870
|
-
* </UserDropdown>
|
|
871
|
-
*
|
|
872
|
-
* // Using partial render props
|
|
873
|
-
* <UserDropdown
|
|
874
|
-
* renderTrigger={({ user, openProfile }) => (
|
|
875
|
-
* <button onClick={openProfile} className="custom-trigger">
|
|
876
|
-
* Welcome, {user?.name}!
|
|
877
|
-
* </button>
|
|
878
|
-
* )}
|
|
879
|
-
* />
|
|
880
|
-
* ```
|
|
881
|
-
*/
|
|
882
|
-
const UserDropdown = ({ children, renderTrigger, renderDropdown, onSignOut,...rest }) => {
|
|
883
|
-
const { user, isLoading, signOut } = useThunderID_default();
|
|
884
|
-
const [isProfileOpen, setIsProfileOpen] = useState(false);
|
|
885
|
-
const handleManageProfile = () => {
|
|
886
|
-
setIsProfileOpen(true);
|
|
887
|
-
};
|
|
888
|
-
const handleSignOut = () => {
|
|
889
|
-
signOut();
|
|
890
|
-
if (onSignOut) onSignOut();
|
|
891
|
-
};
|
|
892
|
-
const closeProfile = () => {
|
|
893
|
-
setIsProfileOpen(false);
|
|
894
|
-
};
|
|
895
|
-
const renderProps = {
|
|
896
|
-
closeProfile,
|
|
897
|
-
isLoading,
|
|
898
|
-
isProfileOpen,
|
|
899
|
-
openProfile: handleManageProfile,
|
|
900
|
-
signOut: handleSignOut,
|
|
901
|
-
user
|
|
902
|
-
};
|
|
903
|
-
if (children) return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [children(renderProps), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UserProfile_default, {
|
|
904
|
-
mode: "popup",
|
|
905
|
-
open: isProfileOpen,
|
|
906
|
-
onOpenChange: setIsProfileOpen
|
|
907
|
-
})] });
|
|
908
|
-
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, {
|
|
909
|
-
user,
|
|
910
|
-
isLoading,
|
|
911
|
-
onManageProfile: handleManageProfile,
|
|
912
|
-
onSignOut: handleSignOut,
|
|
913
|
-
...rest
|
|
914
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UserProfile_default, {
|
|
915
|
-
mode: "popup",
|
|
916
|
-
open: isProfileOpen,
|
|
917
|
-
onOpenChange: setIsProfileOpen
|
|
918
|
-
})] });
|
|
919
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(BaseUserDropdown, {
|
|
920
|
-
user,
|
|
921
|
-
isLoading,
|
|
922
|
-
onManageProfile: handleManageProfile,
|
|
923
|
-
onSignOut: handleSignOut,
|
|
924
|
-
...rest
|
|
925
|
-
}), isProfileOpen && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UserProfile_default, {
|
|
926
|
-
mode: "popup",
|
|
927
|
-
open: isProfileOpen,
|
|
928
|
-
onOpenChange: setIsProfileOpen
|
|
929
|
-
})] });
|
|
930
|
-
};
|
|
931
|
-
var UserDropdown_default = UserDropdown;
|
|
932
|
-
|
|
933
|
-
//#endregion
|
|
934
|
-
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 };
|