@contember/react-client-tenant 2.1.0-alpha.37 → 2.1.0-alpha.39
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/development/index.cjs +159 -0
- package/dist/development/index.cjs.map +1 -0
- package/dist/development/index.js +159 -0
- package/dist/development/index.js.map +1 -0
- package/dist/development/src/components/IdentityProvider.cjs +38 -0
- package/dist/development/src/components/IdentityProvider.cjs.map +1 -0
- package/dist/development/src/components/IdentityProvider.js +38 -0
- package/dist/development/src/components/IdentityProvider.js.map +1 -0
- package/dist/development/src/components/IdentityState.cjs +14 -0
- package/dist/development/src/components/IdentityState.cjs.map +1 -0
- package/dist/development/src/components/IdentityState.js +14 -0
- package/dist/development/src/components/IdentityState.js.map +1 -0
- package/dist/development/src/components/forms/ChangeMyPasswordForm.cjs +59 -0
- package/dist/development/src/components/forms/ChangeMyPasswordForm.cjs.map +1 -0
- package/dist/development/src/components/forms/ChangeMyPasswordForm.js +59 -0
- package/dist/development/src/components/forms/ChangeMyPasswordForm.js.map +1 -0
- package/dist/development/src/components/forms/CreateApiKeyForm.cjs +57 -0
- package/dist/development/src/components/forms/CreateApiKeyForm.cjs.map +1 -0
- package/dist/development/src/components/forms/CreateApiKeyForm.js +57 -0
- package/dist/development/src/components/forms/CreateApiKeyForm.js.map +1 -0
- package/dist/development/src/components/forms/CreateSessionTokenForm.cjs +50 -0
- package/dist/development/src/components/forms/CreateSessionTokenForm.cjs.map +1 -0
- package/dist/development/src/components/forms/CreateSessionTokenForm.js +50 -0
- package/dist/development/src/components/forms/CreateSessionTokenForm.js.map +1 -0
- package/dist/development/src/components/forms/InviteForm.cjs +62 -0
- package/dist/development/src/components/forms/InviteForm.cjs.map +1 -0
- package/dist/development/src/components/forms/InviteForm.js +62 -0
- package/dist/development/src/components/forms/InviteForm.js.map +1 -0
- package/dist/development/src/components/forms/LoginForm.cjs +87 -0
- package/dist/development/src/components/forms/LoginForm.cjs.map +1 -0
- package/dist/development/src/components/forms/LoginForm.js +87 -0
- package/dist/development/src/components/forms/LoginForm.js.map +1 -0
- package/dist/development/src/components/forms/OtpConfirmForm.cjs +49 -0
- package/dist/development/src/components/forms/OtpConfirmForm.cjs.map +1 -0
- package/dist/development/src/components/forms/OtpConfirmForm.js +49 -0
- package/dist/development/src/components/forms/OtpConfirmForm.js.map +1 -0
- package/dist/development/src/components/forms/OtpPrepareForm.cjs +36 -0
- package/dist/development/src/components/forms/OtpPrepareForm.cjs.map +1 -0
- package/dist/development/src/components/forms/OtpPrepareForm.js +36 -0
- package/dist/development/src/components/forms/OtpPrepareForm.js.map +1 -0
- package/dist/development/src/components/forms/PasswordResetForm.cjs +63 -0
- package/dist/development/src/components/forms/PasswordResetForm.cjs.map +1 -0
- package/dist/development/src/components/forms/PasswordResetForm.js +63 -0
- package/dist/development/src/components/forms/PasswordResetForm.js.map +1 -0
- package/dist/development/src/components/forms/PasswordResetRequestForm.cjs +49 -0
- package/dist/development/src/components/forms/PasswordResetRequestForm.cjs.map +1 -0
- package/dist/development/src/components/forms/PasswordResetRequestForm.js +49 -0
- package/dist/development/src/components/forms/PasswordResetRequestForm.js.map +1 -0
- package/dist/development/src/components/forms/PasswordlessSignInForm.cjs +79 -0
- package/dist/development/src/components/forms/PasswordlessSignInForm.cjs.map +1 -0
- package/dist/development/src/components/forms/PasswordlessSignInForm.js +79 -0
- package/dist/development/src/components/forms/PasswordlessSignInForm.js.map +1 -0
- package/dist/development/src/components/forms/PasswordlessSignInInitForm.cjs +59 -0
- package/dist/development/src/components/forms/PasswordlessSignInInitForm.cjs.map +1 -0
- package/dist/development/src/components/forms/PasswordlessSignInInitForm.js +59 -0
- package/dist/development/src/components/forms/PasswordlessSignInInitForm.js.map +1 -0
- package/dist/development/src/components/forms/TenantForm.cjs +101 -0
- package/dist/development/src/components/forms/TenantForm.cjs.map +1 -0
- package/dist/development/src/components/forms/TenantForm.js +101 -0
- package/dist/development/src/components/forms/TenantForm.js.map +1 -0
- package/dist/development/src/components/forms/UpdateProjectMemberForm.cjs +64 -0
- package/dist/development/src/components/forms/UpdateProjectMemberForm.cjs.map +1 -0
- package/dist/development/src/components/forms/UpdateProjectMemberForm.js +64 -0
- package/dist/development/src/components/forms/UpdateProjectMemberForm.js.map +1 -0
- package/dist/development/src/components/idp/IDP.cjs +56 -0
- package/dist/development/src/components/idp/IDP.cjs.map +1 -0
- package/dist/development/src/components/idp/IDP.js +56 -0
- package/dist/development/src/components/idp/IDP.js.map +1 -0
- package/dist/development/src/components/idp/IDPInitTrigger.cjs +16 -0
- package/dist/development/src/components/idp/IDPInitTrigger.cjs.map +1 -0
- package/dist/development/src/components/idp/IDPInitTrigger.js +16 -0
- package/dist/development/src/components/idp/IDPInitTrigger.js.map +1 -0
- package/dist/development/src/components/idp/IDPState.cjs +14 -0
- package/dist/development/src/components/idp/IDPState.cjs.map +1 -0
- package/dist/development/src/components/idp/IDPState.js +14 -0
- package/dist/development/src/components/idp/IDPState.js.map +1 -0
- package/dist/development/src/components/triggers/DisableOtpTrigger.cjs +32 -0
- package/dist/development/src/components/triggers/DisableOtpTrigger.cjs.map +1 -0
- package/dist/development/src/components/triggers/DisableOtpTrigger.js +32 -0
- package/dist/development/src/components/triggers/DisableOtpTrigger.js.map +1 -0
- package/dist/development/src/components/triggers/LogoutTrigger.cjs +16 -0
- package/dist/development/src/components/triggers/LogoutTrigger.cjs.map +1 -0
- package/dist/development/src/components/triggers/LogoutTrigger.js +16 -0
- package/dist/development/src/components/triggers/LogoutTrigger.js.map +1 -0
- package/dist/development/src/components/triggers/RemoveProjectMemberTrigger.cjs +17 -0
- package/dist/development/src/components/triggers/RemoveProjectMemberTrigger.cjs.map +1 -0
- package/dist/development/src/components/triggers/RemoveProjectMemberTrigger.js +17 -0
- package/dist/development/src/components/triggers/RemoveProjectMemberTrigger.js.map +1 -0
- package/dist/development/src/components/triggers/TenantActionTrigger.cjs +37 -0
- package/dist/development/src/components/triggers/TenantActionTrigger.cjs.map +1 -0
- package/dist/development/src/components/triggers/TenantActionTrigger.js +37 -0
- package/dist/development/src/components/triggers/TenantActionTrigger.js.map +1 -0
- package/dist/development/src/consts.cjs +5 -0
- package/dist/development/src/consts.cjs.map +1 -0
- package/dist/development/src/consts.js +5 -0
- package/dist/development/src/consts.js.map +1 -0
- package/dist/development/src/contexts.cjs +34 -0
- package/dist/development/src/contexts.cjs.map +1 -0
- package/dist/development/src/contexts.js +34 -0
- package/dist/development/src/contexts.js.map +1 -0
- package/dist/development/src/hooks/mutations/apiKey/useCreateApiKeyMutation.cjs +30 -0
- package/dist/development/src/hooks/mutations/apiKey/useCreateApiKeyMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/apiKey/useCreateApiKeyMutation.js +13 -0
- package/dist/development/src/hooks/mutations/apiKey/useCreateApiKeyMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/apiKey/useCreateGlobalApiKeyMutation.cjs +30 -0
- package/dist/development/src/hooks/mutations/apiKey/useCreateGlobalApiKeyMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/apiKey/useCreateGlobalApiKeyMutation.js +13 -0
- package/dist/development/src/hooks/mutations/apiKey/useCreateGlobalApiKeyMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/apiKey/useCreateSessionTokenMutation.cjs +30 -0
- package/dist/development/src/hooks/mutations/apiKey/useCreateSessionTokenMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/apiKey/useCreateSessionTokenMutation.js +13 -0
- package/dist/development/src/hooks/mutations/apiKey/useCreateSessionTokenMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/apiKey/useDisableApiKeyMutation.cjs +29 -0
- package/dist/development/src/hooks/mutations/apiKey/useDisableApiKeyMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/apiKey/useDisableApiKeyMutation.js +12 -0
- package/dist/development/src/hooks/mutations/apiKey/useDisableApiKeyMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/auth/useChangeMyPasswordMutation.cjs +29 -0
- package/dist/development/src/hooks/mutations/auth/useChangeMyPasswordMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/auth/useChangeMyPasswordMutation.js +12 -0
- package/dist/development/src/hooks/mutations/auth/useChangeMyPasswordMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/auth/useSignInMutation.cjs +33 -0
- package/dist/development/src/hooks/mutations/auth/useSignInMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/auth/useSignInMutation.js +16 -0
- package/dist/development/src/hooks/mutations/auth/useSignInMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/auth/useSignOutMutation.cjs +29 -0
- package/dist/development/src/hooks/mutations/auth/useSignOutMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/auth/useSignOutMutation.js +12 -0
- package/dist/development/src/hooks/mutations/auth/useSignOutMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/idp/useInitSignInIDPMutation.cjs +31 -0
- package/dist/development/src/hooks/mutations/idp/useInitSignInIDPMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/idp/useInitSignInIDPMutation.js +14 -0
- package/dist/development/src/hooks/mutations/idp/useInitSignInIDPMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/idp/useSignInIdpMutation.cjs +36 -0
- package/dist/development/src/hooks/mutations/idp/useSignInIdpMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/idp/useSignInIdpMutation.js +19 -0
- package/dist/development/src/hooks/mutations/idp/useSignInIdpMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/invite/useInviteMutation.cjs +30 -0
- package/dist/development/src/hooks/mutations/invite/useInviteMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/invite/useInviteMutation.js +13 -0
- package/dist/development/src/hooks/mutations/invite/useInviteMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/memberships/useAddProjectMemberMutation.cjs +29 -0
- package/dist/development/src/hooks/mutations/memberships/useAddProjectMemberMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/memberships/useAddProjectMemberMutation.js +12 -0
- package/dist/development/src/hooks/mutations/memberships/useAddProjectMemberMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/memberships/useRemoveProjectMemberMutation.cjs +29 -0
- package/dist/development/src/hooks/mutations/memberships/useRemoveProjectMemberMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/memberships/useRemoveProjectMemberMutation.js +12 -0
- package/dist/development/src/hooks/mutations/memberships/useRemoveProjectMemberMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/memberships/useUpdateProjectMemberMutation.cjs +29 -0
- package/dist/development/src/hooks/mutations/memberships/useUpdateProjectMemberMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/memberships/useUpdateProjectMemberMutation.js +12 -0
- package/dist/development/src/hooks/mutations/memberships/useUpdateProjectMemberMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/otp/useConfirmOtpMutation.cjs +29 -0
- package/dist/development/src/hooks/mutations/otp/useConfirmOtpMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/otp/useConfirmOtpMutation.js +12 -0
- package/dist/development/src/hooks/mutations/otp/useConfirmOtpMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/otp/useDisableOtpMutation.cjs +29 -0
- package/dist/development/src/hooks/mutations/otp/useDisableOtpMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/otp/useDisableOtpMutation.js +12 -0
- package/dist/development/src/hooks/mutations/otp/useDisableOtpMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/otp/usePrepareOtpMutation.cjs +30 -0
- package/dist/development/src/hooks/mutations/otp/usePrepareOtpMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/otp/usePrepareOtpMutation.js +13 -0
- package/dist/development/src/hooks/mutations/otp/usePrepareOtpMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/passwordReset/useCreateResetPasswordRequestMutation.cjs +32 -0
- package/dist/development/src/hooks/mutations/passwordReset/useCreateResetPasswordRequestMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/passwordReset/useCreateResetPasswordRequestMutation.js +15 -0
- package/dist/development/src/hooks/mutations/passwordReset/useCreateResetPasswordRequestMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/passwordReset/useResetPasswordMutation.cjs +32 -0
- package/dist/development/src/hooks/mutations/passwordReset/useResetPasswordMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/passwordReset/useResetPasswordMutation.js +15 -0
- package/dist/development/src/hooks/mutations/passwordReset/useResetPasswordMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/passwordless/useActivatePasswordlessOtpMutation.cjs +31 -0
- package/dist/development/src/hooks/mutations/passwordless/useActivatePasswordlessOtpMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/passwordless/useActivatePasswordlessOtpMutation.js +14 -0
- package/dist/development/src/hooks/mutations/passwordless/useActivatePasswordlessOtpMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/passwordless/useDisableMyPasswordlessMutation.cjs +28 -0
- package/dist/development/src/hooks/mutations/passwordless/useDisableMyPasswordlessMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/passwordless/useDisableMyPasswordlessMutation.js +11 -0
- package/dist/development/src/hooks/mutations/passwordless/useDisableMyPasswordlessMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/passwordless/useEnableMyPasswordlessMutation.cjs +28 -0
- package/dist/development/src/hooks/mutations/passwordless/useEnableMyPasswordlessMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/passwordless/useEnableMyPasswordlessMutation.js +11 -0
- package/dist/development/src/hooks/mutations/passwordless/useEnableMyPasswordlessMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/passwordless/useInitSignInPasswordlessMutation.cjs +32 -0
- package/dist/development/src/hooks/mutations/passwordless/useInitSignInPasswordlessMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/passwordless/useInitSignInPasswordlessMutation.js +15 -0
- package/dist/development/src/hooks/mutations/passwordless/useInitSignInPasswordlessMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/passwordless/useSignInPasswordlessMutation.cjs +32 -0
- package/dist/development/src/hooks/mutations/passwordless/useSignInPasswordlessMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/passwordless/useSignInPasswordlessMutation.js +15 -0
- package/dist/development/src/hooks/mutations/passwordless/useSignInPasswordlessMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/profile/useChangeMyProfile.cjs +29 -0
- package/dist/development/src/hooks/mutations/profile/useChangeMyProfile.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/profile/useChangeMyProfile.js +12 -0
- package/dist/development/src/hooks/mutations/profile/useChangeMyProfile.js.map +1 -0
- package/dist/development/src/hooks/mutations/profile/useChangeProfile.cjs +29 -0
- package/dist/development/src/hooks/mutations/profile/useChangeProfile.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/profile/useChangeProfile.js +12 -0
- package/dist/development/src/hooks/mutations/profile/useChangeProfile.js.map +1 -0
- package/dist/development/src/hooks/queries/useMeQuery.cjs +33 -0
- package/dist/development/src/hooks/queries/useMeQuery.cjs.map +1 -0
- package/dist/development/src/hooks/queries/useMeQuery.js +16 -0
- package/dist/development/src/hooks/queries/useMeQuery.js.map +1 -0
- package/dist/development/src/hooks/queries/useProjectMembersQuery.cjs +53 -0
- package/dist/development/src/hooks/queries/useProjectMembersQuery.cjs.map +1 -0
- package/dist/development/src/hooks/queries/useProjectMembersQuery.js +36 -0
- package/dist/development/src/hooks/queries/useProjectMembersQuery.js.map +1 -0
- package/dist/development/src/hooks/queries/useProjectMembershipsQuery.cjs +34 -0
- package/dist/development/src/hooks/queries/useProjectMembershipsQuery.cjs.map +1 -0
- package/dist/development/src/hooks/queries/useProjectMembershipsQuery.js +17 -0
- package/dist/development/src/hooks/queries/useProjectMembershipsQuery.js.map +1 -0
- package/dist/development/src/hooks/queries/useProjectRolesDefinitionQuery.cjs +36 -0
- package/dist/development/src/hooks/queries/useProjectRolesDefinitionQuery.cjs.map +1 -0
- package/dist/development/src/hooks/queries/useProjectRolesDefinitionQuery.js +19 -0
- package/dist/development/src/hooks/queries/useProjectRolesDefinitionQuery.js.map +1 -0
- package/dist/development/src/hooks/useFetchIdentity.cjs +55 -0
- package/dist/development/src/hooks/useFetchIdentity.cjs.map +1 -0
- package/dist/development/src/hooks/useFetchIdentity.js +55 -0
- package/dist/development/src/hooks/useFetchIdentity.js.map +1 -0
- package/dist/development/src/hooks/useLogout.cjs +10 -0
- package/dist/development/src/hooks/useLogout.cjs.map +1 -0
- package/dist/development/src/hooks/useLogout.js +10 -0
- package/dist/development/src/hooks/useLogout.js.map +1 -0
- package/dist/development/src/hooks/usePasswordlessOtpActivator.cjs +53 -0
- package/dist/development/src/hooks/usePasswordlessOtpActivator.cjs.map +1 -0
- package/dist/development/src/hooks/usePasswordlessOtpActivator.js +53 -0
- package/dist/development/src/hooks/usePasswordlessOtpActivator.js.map +1 -0
- package/dist/development/src/hooks/useTenantApi.cjs +36 -0
- package/dist/development/src/hooks/useTenantApi.cjs.map +1 -0
- package/dist/development/src/hooks/useTenantApi.js +36 -0
- package/dist/development/src/hooks/useTenantApi.js.map +1 -0
- package/dist/development/src/hooks/useTenantMutation.cjs +33 -0
- package/dist/development/src/hooks/useTenantMutation.cjs.map +1 -0
- package/dist/development/src/hooks/useTenantMutation.js +33 -0
- package/dist/development/src/hooks/useTenantMutation.js.map +1 -0
- package/dist/development/src/hooks/useTenantQueryLoader.cjs +36 -0
- package/dist/development/src/hooks/useTenantQueryLoader.cjs.map +1 -0
- package/dist/development/src/hooks/useTenantQueryLoader.js +36 -0
- package/dist/development/src/hooks/useTenantQueryLoader.js.map +1 -0
- package/dist/development/src/internal/hooks/useHandleIDPResponse.cjs +51 -0
- package/dist/development/src/internal/hooks/useHandleIDPResponse.cjs.map +1 -0
- package/dist/development/src/internal/hooks/useHandleIDPResponse.js +51 -0
- package/dist/development/src/internal/hooks/useHandleIDPResponse.js.map +1 -0
- package/dist/development/src/internal/hooks/useIDPAutoInit.cjs +19 -0
- package/dist/development/src/internal/hooks/useIDPAutoInit.cjs.map +1 -0
- package/dist/development/src/internal/hooks/useIDPAutoInit.js +19 -0
- package/dist/development/src/internal/hooks/useIDPAutoInit.js.map +1 -0
- package/dist/development/src/internal/hooks/useIDPStateStore.cjs +19 -0
- package/dist/development/src/internal/hooks/useIDPStateStore.cjs.map +1 -0
- package/dist/development/src/internal/hooks/useIDPStateStore.js +19 -0
- package/dist/development/src/internal/hooks/useIDPStateStore.js.map +1 -0
- package/dist/development/src/internal/hooks/useInitIDPRedirect.cjs +44 -0
- package/dist/development/src/internal/hooks/useInitIDPRedirect.cjs.map +1 -0
- package/dist/development/src/internal/hooks/useInitIDPRedirect.js +44 -0
- package/dist/development/src/internal/hooks/useInitIDPRedirect.js.map +1 -0
- package/dist/development/src/internal/hooks/useLogoutInternal.cjs +35 -0
- package/dist/development/src/internal/hooks/useLogoutInternal.cjs.map +1 -0
- package/dist/development/src/internal/hooks/useLogoutInternal.js +35 -0
- package/dist/development/src/internal/hooks/useLogoutInternal.js.map +1 -0
- package/dist/development/src/internal/hooks/useRedirectToBacklink.cjs +36 -0
- package/dist/development/src/internal/hooks/useRedirectToBacklink.cjs.map +1 -0
- package/dist/development/src/internal/hooks/useRedirectToBacklink.js +36 -0
- package/dist/development/src/internal/hooks/useRedirectToBacklink.js.map +1 -0
- package/dist/development/src/internal/utils/getBaseHref.cjs +8 -0
- package/dist/development/src/internal/utils/getBaseHref.cjs.map +1 -0
- package/dist/development/src/internal/utils/getBaseHref.js +8 -0
- package/dist/development/src/internal/utils/getBaseHref.js.map +1 -0
- package/dist/development/src/internal/utils/hashing.cjs +8 -0
- package/dist/development/src/internal/utils/hashing.cjs.map +1 -0
- package/dist/development/src/internal/utils/hashing.js +8 -0
- package/dist/development/src/internal/utils/hashing.js.map +1 -0
- package/dist/development/src/internal/utils/randomInt.cjs +29 -0
- package/dist/development/src/internal/utils/randomInt.cjs.map +1 -0
- package/dist/development/src/internal/utils/randomInt.js +29 -0
- package/dist/development/src/internal/utils/randomInt.js.map +1 -0
- package/dist/production/index.cjs +159 -0
- package/dist/production/index.cjs.map +1 -0
- package/dist/production/index.js +159 -0
- package/dist/production/index.js.map +1 -0
- package/dist/production/src/components/IdentityProvider.cjs +26 -0
- package/dist/production/src/components/IdentityProvider.cjs.map +1 -0
- package/dist/production/src/components/IdentityProvider.js +26 -0
- package/dist/production/src/components/IdentityProvider.js.map +1 -0
- package/dist/production/src/components/IdentityState.cjs +10 -0
- package/dist/production/src/components/IdentityState.cjs.map +1 -0
- package/dist/production/src/components/IdentityState.js +10 -0
- package/dist/production/src/components/IdentityState.js.map +1 -0
- package/dist/production/src/components/forms/ChangeMyPasswordForm.cjs +51 -0
- package/dist/production/src/components/forms/ChangeMyPasswordForm.cjs.map +1 -0
- package/dist/production/src/components/forms/ChangeMyPasswordForm.js +51 -0
- package/dist/production/src/components/forms/ChangeMyPasswordForm.js.map +1 -0
- package/dist/production/src/components/forms/CreateApiKeyForm.cjs +49 -0
- package/dist/production/src/components/forms/CreateApiKeyForm.cjs.map +1 -0
- package/dist/production/src/components/forms/CreateApiKeyForm.js +49 -0
- package/dist/production/src/components/forms/CreateApiKeyForm.js.map +1 -0
- package/dist/production/src/components/forms/CreateSessionTokenForm.cjs +42 -0
- package/dist/production/src/components/forms/CreateSessionTokenForm.cjs.map +1 -0
- package/dist/production/src/components/forms/CreateSessionTokenForm.js +42 -0
- package/dist/production/src/components/forms/CreateSessionTokenForm.js.map +1 -0
- package/dist/production/src/components/forms/InviteForm.cjs +54 -0
- package/dist/production/src/components/forms/InviteForm.cjs.map +1 -0
- package/dist/production/src/components/forms/InviteForm.js +54 -0
- package/dist/production/src/components/forms/InviteForm.js.map +1 -0
- package/dist/production/src/components/forms/LoginForm.cjs +79 -0
- package/dist/production/src/components/forms/LoginForm.cjs.map +1 -0
- package/dist/production/src/components/forms/LoginForm.js +79 -0
- package/dist/production/src/components/forms/LoginForm.js.map +1 -0
- package/dist/production/src/components/forms/OtpConfirmForm.cjs +41 -0
- package/dist/production/src/components/forms/OtpConfirmForm.cjs.map +1 -0
- package/dist/production/src/components/forms/OtpConfirmForm.js +41 -0
- package/dist/production/src/components/forms/OtpConfirmForm.js.map +1 -0
- package/dist/production/src/components/forms/OtpPrepareForm.cjs +28 -0
- package/dist/production/src/components/forms/OtpPrepareForm.cjs.map +1 -0
- package/dist/production/src/components/forms/OtpPrepareForm.js +28 -0
- package/dist/production/src/components/forms/OtpPrepareForm.js.map +1 -0
- package/dist/production/src/components/forms/PasswordResetForm.cjs +55 -0
- package/dist/production/src/components/forms/PasswordResetForm.cjs.map +1 -0
- package/dist/production/src/components/forms/PasswordResetForm.js +55 -0
- package/dist/production/src/components/forms/PasswordResetForm.js.map +1 -0
- package/dist/production/src/components/forms/PasswordResetRequestForm.cjs +41 -0
- package/dist/production/src/components/forms/PasswordResetRequestForm.cjs.map +1 -0
- package/dist/production/src/components/forms/PasswordResetRequestForm.js +41 -0
- package/dist/production/src/components/forms/PasswordResetRequestForm.js.map +1 -0
- package/dist/production/src/components/forms/PasswordlessSignInForm.cjs +71 -0
- package/dist/production/src/components/forms/PasswordlessSignInForm.cjs.map +1 -0
- package/dist/production/src/components/forms/PasswordlessSignInForm.js +71 -0
- package/dist/production/src/components/forms/PasswordlessSignInForm.js.map +1 -0
- package/dist/production/src/components/forms/PasswordlessSignInInitForm.cjs +51 -0
- package/dist/production/src/components/forms/PasswordlessSignInInitForm.cjs.map +1 -0
- package/dist/production/src/components/forms/PasswordlessSignInInitForm.js +51 -0
- package/dist/production/src/components/forms/PasswordlessSignInInitForm.js.map +1 -0
- package/dist/production/src/components/forms/TenantForm.cjs +89 -0
- package/dist/production/src/components/forms/TenantForm.cjs.map +1 -0
- package/dist/production/src/components/forms/TenantForm.js +89 -0
- package/dist/production/src/components/forms/TenantForm.js.map +1 -0
- package/dist/production/src/components/forms/UpdateProjectMemberForm.cjs +56 -0
- package/dist/production/src/components/forms/UpdateProjectMemberForm.cjs.map +1 -0
- package/dist/production/src/components/forms/UpdateProjectMemberForm.js +56 -0
- package/dist/production/src/components/forms/UpdateProjectMemberForm.js.map +1 -0
- package/dist/production/src/components/idp/IDP.cjs +48 -0
- package/dist/production/src/components/idp/IDP.cjs.map +1 -0
- package/dist/production/src/components/idp/IDP.js +48 -0
- package/dist/production/src/components/idp/IDP.js.map +1 -0
- package/dist/production/src/components/idp/IDPInitTrigger.cjs +12 -0
- package/dist/production/src/components/idp/IDPInitTrigger.cjs.map +1 -0
- package/dist/production/src/components/idp/IDPInitTrigger.js +12 -0
- package/dist/production/src/components/idp/IDPInitTrigger.js.map +1 -0
- package/dist/production/src/components/idp/IDPState.cjs +10 -0
- package/dist/production/src/components/idp/IDPState.cjs.map +1 -0
- package/dist/production/src/components/idp/IDPState.js +10 -0
- package/dist/production/src/components/idp/IDPState.js.map +1 -0
- package/dist/production/src/components/triggers/DisableOtpTrigger.cjs +24 -0
- package/dist/production/src/components/triggers/DisableOtpTrigger.cjs.map +1 -0
- package/dist/production/src/components/triggers/DisableOtpTrigger.js +24 -0
- package/dist/production/src/components/triggers/DisableOtpTrigger.js.map +1 -0
- package/dist/production/src/components/triggers/LogoutTrigger.cjs +12 -0
- package/dist/production/src/components/triggers/LogoutTrigger.cjs.map +1 -0
- package/dist/production/src/components/triggers/LogoutTrigger.js +12 -0
- package/dist/production/src/components/triggers/LogoutTrigger.js.map +1 -0
- package/dist/production/src/components/triggers/RemoveProjectMemberTrigger.cjs +13 -0
- package/dist/production/src/components/triggers/RemoveProjectMemberTrigger.cjs.map +1 -0
- package/dist/production/src/components/triggers/RemoveProjectMemberTrigger.js +13 -0
- package/dist/production/src/components/triggers/RemoveProjectMemberTrigger.js.map +1 -0
- package/dist/production/src/components/triggers/TenantActionTrigger.cjs +33 -0
- package/dist/production/src/components/triggers/TenantActionTrigger.cjs.map +1 -0
- package/dist/production/src/components/triggers/TenantActionTrigger.js +33 -0
- package/dist/production/src/components/triggers/TenantActionTrigger.js.map +1 -0
- package/dist/production/src/consts.cjs +5 -0
- package/dist/production/src/consts.cjs.map +1 -0
- package/dist/production/src/consts.js +5 -0
- package/dist/production/src/consts.js.map +1 -0
- package/dist/production/src/contexts.cjs +34 -0
- package/dist/production/src/contexts.cjs.map +1 -0
- package/dist/production/src/contexts.js +34 -0
- package/dist/production/src/contexts.js.map +1 -0
- package/dist/production/src/hooks/mutations/apiKey/useCreateApiKeyMutation.cjs +30 -0
- package/dist/production/src/hooks/mutations/apiKey/useCreateApiKeyMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/apiKey/useCreateApiKeyMutation.js +13 -0
- package/dist/production/src/hooks/mutations/apiKey/useCreateApiKeyMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/apiKey/useCreateGlobalApiKeyMutation.cjs +30 -0
- package/dist/production/src/hooks/mutations/apiKey/useCreateGlobalApiKeyMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/apiKey/useCreateGlobalApiKeyMutation.js +13 -0
- package/dist/production/src/hooks/mutations/apiKey/useCreateGlobalApiKeyMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/apiKey/useCreateSessionTokenMutation.cjs +30 -0
- package/dist/production/src/hooks/mutations/apiKey/useCreateSessionTokenMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/apiKey/useCreateSessionTokenMutation.js +13 -0
- package/dist/production/src/hooks/mutations/apiKey/useCreateSessionTokenMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/apiKey/useDisableApiKeyMutation.cjs +29 -0
- package/dist/production/src/hooks/mutations/apiKey/useDisableApiKeyMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/apiKey/useDisableApiKeyMutation.js +12 -0
- package/dist/production/src/hooks/mutations/apiKey/useDisableApiKeyMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/auth/useChangeMyPasswordMutation.cjs +29 -0
- package/dist/production/src/hooks/mutations/auth/useChangeMyPasswordMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/auth/useChangeMyPasswordMutation.js +12 -0
- package/dist/production/src/hooks/mutations/auth/useChangeMyPasswordMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/auth/useSignInMutation.cjs +33 -0
- package/dist/production/src/hooks/mutations/auth/useSignInMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/auth/useSignInMutation.js +16 -0
- package/dist/production/src/hooks/mutations/auth/useSignInMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/auth/useSignOutMutation.cjs +29 -0
- package/dist/production/src/hooks/mutations/auth/useSignOutMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/auth/useSignOutMutation.js +12 -0
- package/dist/production/src/hooks/mutations/auth/useSignOutMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/idp/useInitSignInIDPMutation.cjs +31 -0
- package/dist/production/src/hooks/mutations/idp/useInitSignInIDPMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/idp/useInitSignInIDPMutation.js +14 -0
- package/dist/production/src/hooks/mutations/idp/useInitSignInIDPMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/idp/useSignInIdpMutation.cjs +36 -0
- package/dist/production/src/hooks/mutations/idp/useSignInIdpMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/idp/useSignInIdpMutation.js +19 -0
- package/dist/production/src/hooks/mutations/idp/useSignInIdpMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/invite/useInviteMutation.cjs +30 -0
- package/dist/production/src/hooks/mutations/invite/useInviteMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/invite/useInviteMutation.js +13 -0
- package/dist/production/src/hooks/mutations/invite/useInviteMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/memberships/useAddProjectMemberMutation.cjs +29 -0
- package/dist/production/src/hooks/mutations/memberships/useAddProjectMemberMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/memberships/useAddProjectMemberMutation.js +12 -0
- package/dist/production/src/hooks/mutations/memberships/useAddProjectMemberMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/memberships/useRemoveProjectMemberMutation.cjs +29 -0
- package/dist/production/src/hooks/mutations/memberships/useRemoveProjectMemberMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/memberships/useRemoveProjectMemberMutation.js +12 -0
- package/dist/production/src/hooks/mutations/memberships/useRemoveProjectMemberMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/memberships/useUpdateProjectMemberMutation.cjs +29 -0
- package/dist/production/src/hooks/mutations/memberships/useUpdateProjectMemberMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/memberships/useUpdateProjectMemberMutation.js +12 -0
- package/dist/production/src/hooks/mutations/memberships/useUpdateProjectMemberMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/otp/useConfirmOtpMutation.cjs +29 -0
- package/dist/production/src/hooks/mutations/otp/useConfirmOtpMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/otp/useConfirmOtpMutation.js +12 -0
- package/dist/production/src/hooks/mutations/otp/useConfirmOtpMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/otp/useDisableOtpMutation.cjs +29 -0
- package/dist/production/src/hooks/mutations/otp/useDisableOtpMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/otp/useDisableOtpMutation.js +12 -0
- package/dist/production/src/hooks/mutations/otp/useDisableOtpMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/otp/usePrepareOtpMutation.cjs +30 -0
- package/dist/production/src/hooks/mutations/otp/usePrepareOtpMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/otp/usePrepareOtpMutation.js +13 -0
- package/dist/production/src/hooks/mutations/otp/usePrepareOtpMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/passwordReset/useCreateResetPasswordRequestMutation.cjs +32 -0
- package/dist/production/src/hooks/mutations/passwordReset/useCreateResetPasswordRequestMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/passwordReset/useCreateResetPasswordRequestMutation.js +15 -0
- package/dist/production/src/hooks/mutations/passwordReset/useCreateResetPasswordRequestMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/passwordReset/useResetPasswordMutation.cjs +32 -0
- package/dist/production/src/hooks/mutations/passwordReset/useResetPasswordMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/passwordReset/useResetPasswordMutation.js +15 -0
- package/dist/production/src/hooks/mutations/passwordReset/useResetPasswordMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/passwordless/useActivatePasswordlessOtpMutation.cjs +31 -0
- package/dist/production/src/hooks/mutations/passwordless/useActivatePasswordlessOtpMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/passwordless/useActivatePasswordlessOtpMutation.js +14 -0
- package/dist/production/src/hooks/mutations/passwordless/useActivatePasswordlessOtpMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/passwordless/useDisableMyPasswordlessMutation.cjs +28 -0
- package/dist/production/src/hooks/mutations/passwordless/useDisableMyPasswordlessMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/passwordless/useDisableMyPasswordlessMutation.js +11 -0
- package/dist/production/src/hooks/mutations/passwordless/useDisableMyPasswordlessMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/passwordless/useEnableMyPasswordlessMutation.cjs +28 -0
- package/dist/production/src/hooks/mutations/passwordless/useEnableMyPasswordlessMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/passwordless/useEnableMyPasswordlessMutation.js +11 -0
- package/dist/production/src/hooks/mutations/passwordless/useEnableMyPasswordlessMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/passwordless/useInitSignInPasswordlessMutation.cjs +32 -0
- package/dist/production/src/hooks/mutations/passwordless/useInitSignInPasswordlessMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/passwordless/useInitSignInPasswordlessMutation.js +15 -0
- package/dist/production/src/hooks/mutations/passwordless/useInitSignInPasswordlessMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/passwordless/useSignInPasswordlessMutation.cjs +32 -0
- package/dist/production/src/hooks/mutations/passwordless/useSignInPasswordlessMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/passwordless/useSignInPasswordlessMutation.js +15 -0
- package/dist/production/src/hooks/mutations/passwordless/useSignInPasswordlessMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/profile/useChangeMyProfile.cjs +29 -0
- package/dist/production/src/hooks/mutations/profile/useChangeMyProfile.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/profile/useChangeMyProfile.js +12 -0
- package/dist/production/src/hooks/mutations/profile/useChangeMyProfile.js.map +1 -0
- package/dist/production/src/hooks/mutations/profile/useChangeProfile.cjs +29 -0
- package/dist/production/src/hooks/mutations/profile/useChangeProfile.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/profile/useChangeProfile.js +12 -0
- package/dist/production/src/hooks/mutations/profile/useChangeProfile.js.map +1 -0
- package/dist/production/src/hooks/queries/useMeQuery.cjs +33 -0
- package/dist/production/src/hooks/queries/useMeQuery.cjs.map +1 -0
- package/dist/production/src/hooks/queries/useMeQuery.js +16 -0
- package/dist/production/src/hooks/queries/useMeQuery.js.map +1 -0
- package/dist/production/src/hooks/queries/useProjectMembersQuery.cjs +53 -0
- package/dist/production/src/hooks/queries/useProjectMembersQuery.cjs.map +1 -0
- package/dist/production/src/hooks/queries/useProjectMembersQuery.js +36 -0
- package/dist/production/src/hooks/queries/useProjectMembersQuery.js.map +1 -0
- package/dist/production/src/hooks/queries/useProjectMembershipsQuery.cjs +34 -0
- package/dist/production/src/hooks/queries/useProjectMembershipsQuery.cjs.map +1 -0
- package/dist/production/src/hooks/queries/useProjectMembershipsQuery.js +17 -0
- package/dist/production/src/hooks/queries/useProjectMembershipsQuery.js.map +1 -0
- package/dist/production/src/hooks/queries/useProjectRolesDefinitionQuery.cjs +36 -0
- package/dist/production/src/hooks/queries/useProjectRolesDefinitionQuery.cjs.map +1 -0
- package/dist/production/src/hooks/queries/useProjectRolesDefinitionQuery.js +19 -0
- package/dist/production/src/hooks/queries/useProjectRolesDefinitionQuery.js.map +1 -0
- package/dist/production/src/hooks/useFetchIdentity.cjs +55 -0
- package/dist/production/src/hooks/useFetchIdentity.cjs.map +1 -0
- package/dist/production/src/hooks/useFetchIdentity.js +55 -0
- package/dist/production/src/hooks/useFetchIdentity.js.map +1 -0
- package/dist/production/src/hooks/useLogout.cjs +10 -0
- package/dist/production/src/hooks/useLogout.cjs.map +1 -0
- package/dist/production/src/hooks/useLogout.js +10 -0
- package/dist/production/src/hooks/useLogout.js.map +1 -0
- package/dist/production/src/hooks/usePasswordlessOtpActivator.cjs +53 -0
- package/dist/production/src/hooks/usePasswordlessOtpActivator.cjs.map +1 -0
- package/dist/production/src/hooks/usePasswordlessOtpActivator.js +53 -0
- package/dist/production/src/hooks/usePasswordlessOtpActivator.js.map +1 -0
- package/dist/production/src/hooks/useTenantApi.cjs +36 -0
- package/dist/production/src/hooks/useTenantApi.cjs.map +1 -0
- package/dist/production/src/hooks/useTenantApi.js +36 -0
- package/dist/production/src/hooks/useTenantApi.js.map +1 -0
- package/dist/production/src/hooks/useTenantMutation.cjs +33 -0
- package/dist/production/src/hooks/useTenantMutation.cjs.map +1 -0
- package/dist/production/src/hooks/useTenantMutation.js +33 -0
- package/dist/production/src/hooks/useTenantMutation.js.map +1 -0
- package/dist/production/src/hooks/useTenantQueryLoader.cjs +36 -0
- package/dist/production/src/hooks/useTenantQueryLoader.cjs.map +1 -0
- package/dist/production/src/hooks/useTenantQueryLoader.js +36 -0
- package/dist/production/src/hooks/useTenantQueryLoader.js.map +1 -0
- package/dist/production/src/internal/hooks/useHandleIDPResponse.cjs +51 -0
- package/dist/production/src/internal/hooks/useHandleIDPResponse.cjs.map +1 -0
- package/dist/production/src/internal/hooks/useHandleIDPResponse.js +51 -0
- package/dist/production/src/internal/hooks/useHandleIDPResponse.js.map +1 -0
- package/dist/production/src/internal/hooks/useIDPAutoInit.cjs +19 -0
- package/dist/production/src/internal/hooks/useIDPAutoInit.cjs.map +1 -0
- package/dist/production/src/internal/hooks/useIDPAutoInit.js +19 -0
- package/dist/production/src/internal/hooks/useIDPAutoInit.js.map +1 -0
- package/dist/production/src/internal/hooks/useIDPStateStore.cjs +19 -0
- package/dist/production/src/internal/hooks/useIDPStateStore.cjs.map +1 -0
- package/dist/production/src/internal/hooks/useIDPStateStore.js +19 -0
- package/dist/production/src/internal/hooks/useIDPStateStore.js.map +1 -0
- package/dist/production/src/internal/hooks/useInitIDPRedirect.cjs +44 -0
- package/dist/production/src/internal/hooks/useInitIDPRedirect.cjs.map +1 -0
- package/dist/production/src/internal/hooks/useInitIDPRedirect.js +44 -0
- package/dist/production/src/internal/hooks/useInitIDPRedirect.js.map +1 -0
- package/dist/production/src/internal/hooks/useLogoutInternal.cjs +35 -0
- package/dist/production/src/internal/hooks/useLogoutInternal.cjs.map +1 -0
- package/dist/production/src/internal/hooks/useLogoutInternal.js +35 -0
- package/dist/production/src/internal/hooks/useLogoutInternal.js.map +1 -0
- package/dist/production/src/internal/hooks/useRedirectToBacklink.cjs +36 -0
- package/dist/production/src/internal/hooks/useRedirectToBacklink.cjs.map +1 -0
- package/dist/production/src/internal/hooks/useRedirectToBacklink.js +36 -0
- package/dist/production/src/internal/hooks/useRedirectToBacklink.js.map +1 -0
- package/dist/production/src/internal/utils/getBaseHref.cjs +8 -0
- package/dist/production/src/internal/utils/getBaseHref.cjs.map +1 -0
- package/dist/production/src/internal/utils/getBaseHref.js +8 -0
- package/dist/production/src/internal/utils/getBaseHref.js.map +1 -0
- package/dist/production/src/internal/utils/hashing.cjs +8 -0
- package/dist/production/src/internal/utils/hashing.cjs.map +1 -0
- package/dist/production/src/internal/utils/hashing.js +8 -0
- package/dist/production/src/internal/utils/hashing.js.map +1 -0
- package/dist/production/src/internal/utils/randomInt.cjs +29 -0
- package/dist/production/src/internal/utils/randomInt.cjs.map +1 -0
- package/dist/production/src/internal/utils/randomInt.js +29 -0
- package/dist/production/src/internal/utils/randomInt.js.map +1 -0
- package/dist/types/components/IdentityProvider.d.ts +6 -0
- package/dist/types/components/IdentityProvider.d.ts.map +1 -0
- package/dist/types/components/IdentityState.d.ts +8 -0
- package/dist/types/components/IdentityState.d.ts.map +1 -0
- package/dist/types/components/forms/ChangeMyPasswordForm.d.ts +19 -0
- package/dist/types/components/forms/ChangeMyPasswordForm.d.ts.map +1 -0
- package/dist/types/components/forms/CreateApiKeyForm.d.ts +23 -0
- package/dist/types/components/forms/CreateApiKeyForm.d.ts.map +1 -0
- package/dist/types/components/forms/CreateSessionTokenForm.d.ts +22 -0
- package/dist/types/components/forms/CreateSessionTokenForm.d.ts.map +1 -0
- package/dist/types/components/forms/InviteForm.d.ts +25 -0
- package/dist/types/components/forms/InviteForm.d.ts.map +1 -0
- package/dist/types/components/forms/LoginForm.d.ts +20 -0
- package/dist/types/components/forms/LoginForm.d.ts.map +1 -0
- package/dist/types/components/forms/OtpConfirmForm.d.ts +17 -0
- package/dist/types/components/forms/OtpConfirmForm.d.ts.map +1 -0
- package/dist/types/components/forms/OtpPrepareForm.d.ts +19 -0
- package/dist/types/components/forms/OtpPrepareForm.d.ts.map +1 -0
- package/dist/types/components/forms/PasswordResetForm.d.ts +20 -0
- package/dist/types/components/forms/PasswordResetForm.d.ts.map +1 -0
- package/dist/types/components/forms/PasswordResetRequestForm.d.ts +17 -0
- package/dist/types/components/forms/PasswordResetRequestForm.d.ts.map +1 -0
- package/dist/types/components/forms/PasswordlessSignInForm.d.ts +22 -0
- package/dist/types/components/forms/PasswordlessSignInForm.d.ts.map +1 -0
- package/dist/types/components/forms/PasswordlessSignInInitForm.d.ts +20 -0
- package/dist/types/components/forms/PasswordlessSignInInitForm.d.ts.map +1 -0
- package/dist/types/components/forms/TenantForm.d.ts +37 -0
- package/dist/types/components/forms/TenantForm.d.ts.map +1 -0
- package/dist/types/components/forms/UpdateProjectMemberForm.d.ts +19 -0
- package/dist/types/components/forms/UpdateProjectMemberForm.d.ts.map +1 -0
- package/dist/types/components/forms/index.d.ts +13 -0
- package/dist/types/components/forms/index.d.ts.map +1 -0
- package/dist/types/components/idp/IDP.d.ts +12 -0
- package/dist/types/components/idp/IDP.d.ts.map +1 -0
- package/dist/types/components/idp/IDPInitTrigger.d.ts +7 -0
- package/dist/types/components/idp/IDPInitTrigger.d.ts.map +1 -0
- package/dist/types/components/idp/IDPState.d.ts +8 -0
- package/dist/types/components/idp/IDPState.d.ts.map +1 -0
- package/dist/types/components/idp/index.d.ts +4 -0
- package/dist/types/components/idp/index.d.ts.map +1 -0
- package/dist/types/components/index.d.ts +6 -0
- package/dist/types/components/index.d.ts.map +1 -0
- package/dist/types/components/triggers/DisableOtpTrigger.d.ts +8 -0
- package/dist/types/components/triggers/DisableOtpTrigger.d.ts.map +1 -0
- package/dist/types/components/triggers/LogoutTrigger.d.ts +5 -0
- package/dist/types/components/triggers/LogoutTrigger.d.ts.map +1 -0
- package/dist/types/components/triggers/RemoveProjectMemberTrigger.d.ts +9 -0
- package/dist/types/components/triggers/RemoveProjectMemberTrigger.d.ts.map +1 -0
- package/dist/types/components/triggers/TenantActionTrigger.d.ts +22 -0
- package/dist/types/components/triggers/TenantActionTrigger.d.ts.map +1 -0
- package/dist/types/components/triggers/index.d.ts +4 -0
- package/dist/types/components/triggers/index.d.ts.map +1 -0
- package/dist/types/consts.d.ts +2 -0
- package/dist/types/consts.d.ts.map +1 -0
- package/dist/types/contexts.d.ts +20 -0
- package/dist/types/contexts.d.ts.map +1 -0
- package/dist/types/hooks/index.d.ts +9 -0
- package/dist/types/hooks/index.d.ts.map +1 -0
- package/dist/types/hooks/mutations/apiKey/index.d.ts +5 -0
- package/dist/types/hooks/mutations/apiKey/index.d.ts.map +1 -0
- package/dist/types/hooks/mutations/apiKey/useCreateApiKeyMutation.d.ts +83 -0
- package/dist/types/hooks/mutations/apiKey/useCreateApiKeyMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/apiKey/useCreateGlobalApiKeyMutation.d.ts +73 -0
- package/dist/types/hooks/mutations/apiKey/useCreateGlobalApiKeyMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/apiKey/useCreateSessionTokenMutation.d.ts +59 -0
- package/dist/types/hooks/mutations/apiKey/useCreateSessionTokenMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/apiKey/useDisableApiKeyMutation.d.ts +21 -0
- package/dist/types/hooks/mutations/apiKey/useDisableApiKeyMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/auth/index.d.ts +4 -0
- package/dist/types/hooks/mutations/auth/index.d.ts.map +1 -0
- package/dist/types/hooks/mutations/auth/useChangeMyPasswordMutation.d.ts +23 -0
- package/dist/types/hooks/mutations/auth/useChangeMyPasswordMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/auth/useSignInMutation.d.ts +65 -0
- package/dist/types/hooks/mutations/auth/useSignInMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/auth/useSignOutMutation.d.ts +21 -0
- package/dist/types/hooks/mutations/auth/useSignOutMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/idp/index.d.ts +3 -0
- package/dist/types/hooks/mutations/idp/index.d.ts.map +1 -0
- package/dist/types/hooks/mutations/idp/useInitSignInIDPMutation.d.ts +19 -0
- package/dist/types/hooks/mutations/idp/useInitSignInIDPMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/idp/useSignInIdpMutation.d.ts +76 -0
- package/dist/types/hooks/mutations/idp/useSignInIdpMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/index.d.ts +10 -0
- package/dist/types/hooks/mutations/index.d.ts.map +1 -0
- package/dist/types/hooks/mutations/invite/index.d.ts +2 -0
- package/dist/types/hooks/mutations/invite/index.d.ts.map +1 -0
- package/dist/types/hooks/mutations/invite/useInviteMutation.d.ts +97 -0
- package/dist/types/hooks/mutations/invite/useInviteMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/memberships/index.d.ts +4 -0
- package/dist/types/hooks/mutations/memberships/index.d.ts.map +1 -0
- package/dist/types/hooks/mutations/memberships/useAddProjectMemberMutation.d.ts +33 -0
- package/dist/types/hooks/mutations/memberships/useAddProjectMemberMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/memberships/useRemoveProjectMemberMutation.d.ts +23 -0
- package/dist/types/hooks/mutations/memberships/useRemoveProjectMemberMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/memberships/useUpdateProjectMemberMutation.d.ts +33 -0
- package/dist/types/hooks/mutations/memberships/useUpdateProjectMemberMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/otp/index.d.ts +4 -0
- package/dist/types/hooks/mutations/otp/index.d.ts.map +1 -0
- package/dist/types/hooks/mutations/otp/useConfirmOtpMutation.d.ts +21 -0
- package/dist/types/hooks/mutations/otp/useConfirmOtpMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/otp/useDisableOtpMutation.d.ts +17 -0
- package/dist/types/hooks/mutations/otp/useDisableOtpMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/otp/usePrepareOtpMutation.d.ts +25 -0
- package/dist/types/hooks/mutations/otp/usePrepareOtpMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/passwordReset/index.d.ts +3 -0
- package/dist/types/hooks/mutations/passwordReset/index.d.ts.map +1 -0
- package/dist/types/hooks/mutations/passwordReset/useCreateResetPasswordRequestMutation.d.ts +23 -0
- package/dist/types/hooks/mutations/passwordReset/useCreateResetPasswordRequestMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/passwordReset/useResetPasswordMutation.d.ts +25 -0
- package/dist/types/hooks/mutations/passwordReset/useResetPasswordMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/passwordless/index.d.ts +6 -0
- package/dist/types/hooks/mutations/passwordless/index.d.ts.map +1 -0
- package/dist/types/hooks/mutations/passwordless/useActivatePasswordlessOtpMutation.d.ts +8 -0
- package/dist/types/hooks/mutations/passwordless/useActivatePasswordlessOtpMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/passwordless/useDisableMyPasswordlessMutation.d.ts +3 -0
- package/dist/types/hooks/mutations/passwordless/useDisableMyPasswordlessMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/passwordless/useEnableMyPasswordlessMutation.d.ts +3 -0
- package/dist/types/hooks/mutations/passwordless/useEnableMyPasswordlessMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/passwordless/useInitSignInPasswordlessMutation.d.ts +19 -0
- package/dist/types/hooks/mutations/passwordless/useInitSignInPasswordlessMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/passwordless/useSignInPasswordlessMutation.d.ts +34 -0
- package/dist/types/hooks/mutations/passwordless/useSignInPasswordlessMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/profile/index.d.ts +3 -0
- package/dist/types/hooks/mutations/profile/index.d.ts.map +1 -0
- package/dist/types/hooks/mutations/profile/useChangeMyProfile.d.ts +21 -0
- package/dist/types/hooks/mutations/profile/useChangeMyProfile.d.ts.map +1 -0
- package/dist/types/hooks/mutations/profile/useChangeProfile.d.ts +23 -0
- package/dist/types/hooks/mutations/profile/useChangeProfile.d.ts.map +1 -0
- package/dist/types/hooks/queries/index.d.ts +5 -0
- package/dist/types/hooks/queries/index.d.ts.map +1 -0
- package/dist/types/hooks/queries/useMeQuery.d.ts +52 -0
- package/dist/types/hooks/queries/useMeQuery.d.ts.map +1 -0
- package/dist/types/hooks/queries/useProjectMembersQuery.d.ts +43 -0
- package/dist/types/hooks/queries/useProjectMembersQuery.d.ts.map +1 -0
- package/dist/types/hooks/queries/useProjectMembershipsQuery.d.ts +20 -0
- package/dist/types/hooks/queries/useProjectMembershipsQuery.d.ts.map +1 -0
- package/dist/types/hooks/queries/useProjectRolesDefinitionQuery.d.ts +66 -0
- package/dist/types/hooks/queries/useProjectRolesDefinitionQuery.d.ts.map +1 -0
- package/dist/types/hooks/useFetchIdentity.d.ts +6 -0
- package/dist/types/hooks/useFetchIdentity.d.ts.map +1 -0
- package/dist/types/hooks/useLogout.d.ts +4 -0
- package/dist/types/hooks/useLogout.d.ts.map +1 -0
- package/dist/types/hooks/usePasswordlessOtpActivator.d.ts +19 -0
- package/dist/types/hooks/usePasswordlessOtpActivator.d.ts.map +1 -0
- package/dist/types/hooks/useTenantApi.d.ts +12 -0
- package/dist/types/hooks/useTenantApi.d.ts.map +1 -0
- package/dist/types/hooks/useTenantMutation.d.ts +25 -0
- package/dist/types/hooks/useTenantMutation.d.ts.map +1 -0
- package/dist/types/hooks/useTenantQueryLoader.d.ts +17 -0
- package/dist/types/hooks/useTenantQueryLoader.d.ts.map +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/internal/hooks/useHandleIDPResponse.d.ts +11 -0
- package/dist/types/internal/hooks/useHandleIDPResponse.d.ts.map +1 -0
- package/dist/types/internal/hooks/useIDPAutoInit.d.ts +2 -0
- package/dist/types/internal/hooks/useIDPAutoInit.d.ts.map +1 -0
- package/dist/types/internal/hooks/useIDPStateStore.d.ts +9 -0
- package/dist/types/internal/hooks/useIDPStateStore.d.ts.map +1 -0
- package/dist/types/internal/hooks/useInitIDPRedirect.d.ts +16 -0
- package/dist/types/internal/hooks/useInitIDPRedirect.d.ts.map +1 -0
- package/dist/types/internal/hooks/useLogoutInternal.d.ts +4 -0
- package/dist/types/internal/hooks/useLogoutInternal.d.ts.map +1 -0
- package/dist/types/internal/hooks/useRedirectToBacklink.d.ts +6 -0
- package/dist/types/internal/hooks/useRedirectToBacklink.d.ts.map +1 -0
- package/dist/types/internal/utils/getBaseHref.d.ts +2 -0
- package/dist/types/internal/utils/getBaseHref.d.ts.map +1 -0
- package/dist/types/internal/utils/hashing.d.ts +2 -0
- package/dist/types/internal/utils/hashing.d.ts.map +1 -0
- package/dist/types/internal/utils/randomInt.d.ts +3 -0
- package/dist/types/internal/utils/randomInt.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/dist/types/types/Identity.d.ts +20 -0
- package/dist/types/types/Identity.d.ts.map +1 -0
- package/dist/types/types/IdentityMethods.d.ts +5 -0
- package/dist/types/types/IdentityMethods.d.ts.map +1 -0
- package/dist/types/types/IdentityStateValue.d.ts +2 -0
- package/dist/types/types/IdentityStateValue.d.ts.map +1 -0
- package/dist/types/types/forms.d.ts +18 -0
- package/dist/types/types/forms.d.ts.map +1 -0
- package/dist/types/types/idp.d.ts +30 -0
- package/dist/types/types/idp.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +6 -0
- package/dist/types/types/index.d.ts.map +1 -0
- package/package.json +11 -11
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useIdentityMethods } from "../contexts.js";
|
|
2
|
+
import { useLogoutInternal } from "../internal/hooks/useLogoutInternal.js";
|
|
3
|
+
const useLogout = () => {
|
|
4
|
+
const { clearIdentity } = useIdentityMethods();
|
|
5
|
+
return useLogoutInternal(clearIdentity);
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
useLogout
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=useLogout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLogout.js","sources":["../../../../../packages/react-client-tenant/src/hooks/useLogout.ts"],"sourcesContent":["import { useIdentityMethods } from '../contexts'\nimport { useLogoutInternal } from '../internal/hooks/useLogoutInternal'\n\nexport const useLogout = () => {\n\tconst { clearIdentity } = useIdentityMethods()\n\treturn useLogoutInternal(clearIdentity)\n}\n"],"names":[],"mappings":";;AAGO,MAAM,YAAY,MAAM;AAC9B,QAAM,EAAE,cAAA,IAAkB,mBAAA;AAC1B,SAAO,kBAAkB,aAAa;AACvC;"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const React = require("react");
|
|
4
|
+
const consts = require("../consts.cjs");
|
|
5
|
+
const randomInt = require("../internal/utils/randomInt.cjs");
|
|
6
|
+
const hashing = require("../internal/utils/hashing.cjs");
|
|
7
|
+
const useActivatePasswordlessOtpMutation = require("./mutations/passwordless/useActivatePasswordlessOtpMutation.cjs");
|
|
8
|
+
const usePasswordlessParams = () => {
|
|
9
|
+
const localStorageValue = localStorage.getItem(consts.PASSWORDLESS_REQUEST_STORAGE_KEY) ?? null;
|
|
10
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
11
|
+
const requestId = urlParams.get("request_id");
|
|
12
|
+
const token = urlParams.get("token");
|
|
13
|
+
return { localStorageRequestId: localStorageValue, urlRequestId: requestId, urlToken: token };
|
|
14
|
+
};
|
|
15
|
+
const usePasswordlessOtpActivator = ({ otpLength = 6, otpChars = "0123456789ABCDEF" } = {}) => {
|
|
16
|
+
const { localStorageRequestId, urlRequestId, urlToken } = usePasswordlessParams();
|
|
17
|
+
const activateOtp = useActivatePasswordlessOtpMutation.useActivatePasswordlessOtpMutation();
|
|
18
|
+
const [state, setState] = React.useState(() => {
|
|
19
|
+
if (urlRequestId && urlToken) {
|
|
20
|
+
if (localStorageRequestId !== urlRequestId) {
|
|
21
|
+
return { type: "otp_activating" };
|
|
22
|
+
} else {
|
|
23
|
+
return { type: "can_proceed_to_login" };
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return { type: "empty" };
|
|
27
|
+
});
|
|
28
|
+
React.useEffect(() => {
|
|
29
|
+
(async () => {
|
|
30
|
+
if (state.type === "otp_activating") {
|
|
31
|
+
const otpCode = randomInt.randomString(otpLength, otpChars);
|
|
32
|
+
try {
|
|
33
|
+
const result = await activateOtp({
|
|
34
|
+
requestId: urlRequestId,
|
|
35
|
+
token: urlToken,
|
|
36
|
+
otpHash: await hashing.calculateHash("SHA-256", otpCode)
|
|
37
|
+
});
|
|
38
|
+
if (!result.ok) {
|
|
39
|
+
setState({ type: "otp_activation_failed", error: result.error });
|
|
40
|
+
} else {
|
|
41
|
+
setState({ type: "otp_activated", otp: otpCode });
|
|
42
|
+
}
|
|
43
|
+
} catch (e) {
|
|
44
|
+
console.error(e);
|
|
45
|
+
setState({ type: "otp_activation_failed", error: "UNKNOWN_ERROR" });
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
})();
|
|
49
|
+
}, [activateOtp, localStorageRequestId, otpChars, otpLength, state.type, urlRequestId, urlToken]);
|
|
50
|
+
return state;
|
|
51
|
+
};
|
|
52
|
+
exports.usePasswordlessOtpActivator = usePasswordlessOtpActivator;
|
|
53
|
+
//# sourceMappingURL=usePasswordlessOtpActivator.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePasswordlessOtpActivator.cjs","sources":["../../../../../packages/react-client-tenant/src/hooks/usePasswordlessOtpActivator.ts"],"sourcesContent":["import { useEffect, useState } from 'react'\nimport { PASSWORDLESS_REQUEST_STORAGE_KEY } from '../consts'\nimport { useActivatePasswordlessOtpMutation } from './mutations'\nimport { randomString } from '../internal/utils/randomInt'\nimport { calculateHash } from '../internal/utils/hashing'\nimport { ActivatePasswordlessOtpErrorCode } from '@contember/graphql-client-tenant'\n\nconst usePasswordlessParams = (): { localStorageRequestId: string | null; urlRequestId: string | null; urlToken: string | null } => {\n\tconst localStorageValue = localStorage.getItem(PASSWORDLESS_REQUEST_STORAGE_KEY) ?? null\n\tconst urlParams = new URLSearchParams(window.location.search)\n\tconst requestId = urlParams.get('request_id')\n\tconst token = urlParams.get('token')\n\n\treturn { localStorageRequestId: localStorageValue, urlRequestId: requestId, urlToken: token }\n}\n\nexport type PasswordlessResponseHandlerState =\n\t| { type: 'empty' }\n\t| { type: 'otp_activating' }\n\t| { type: 'otp_activated'; otp: string }\n\t| { type: 'otp_activation_failed'; error: ActivatePasswordlessOtpErrorCode | 'UNKNOWN_ERROR' }\n\t| { type: 'can_proceed_to_login' }\n\nexport const usePasswordlessOtpActivator = ({ otpLength = 6, otpChars = '0123456789ABCDEF' }: {\n\totpLength?: number\n\totpChars?: string\n} = {}) => {\n\tconst { localStorageRequestId, urlRequestId, urlToken } = usePasswordlessParams()\n\tconst activateOtp = useActivatePasswordlessOtpMutation()\n\n\tconst [state, setState] = useState<PasswordlessResponseHandlerState>(() => {\n\t\tif (urlRequestId && urlToken) {\n\t\t\tif (localStorageRequestId !== urlRequestId) {\n\t\t\t\treturn { type: 'otp_activating' }\n\t\t\t} else {\n\t\t\t\treturn { type: 'can_proceed_to_login' }\n\t\t\t}\n\t\t}\n\t\treturn { type: 'empty' }\n\t})\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: intentional\n\tuseEffect(() => {\n\t\t;(async () => {\n\t\t\tif (state.type === 'otp_activating') {\n\t\t\t\tconst otpCode = randomString(otpLength, otpChars)\n\t\t\t\ttry {\n\t\t\t\t\tconst result = await activateOtp({\n\t\t\t\t\t\trequestId: urlRequestId!,\n\t\t\t\t\t\ttoken: urlToken!,\n\t\t\t\t\t\totpHash: await calculateHash('SHA-256', otpCode),\n\t\t\t\t\t})\n\t\t\t\t\tif (!result.ok) {\n\t\t\t\t\t\tsetState({ type: 'otp_activation_failed', error: result.error })\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsetState({ type: 'otp_activated', otp: otpCode })\n\t\t\t\t\t}\n\t\t\t\t} catch (e) {\n\t\t\t\t\tconsole.error(e)\n\t\t\t\t\tsetState({ type: 'otp_activation_failed', error: 'UNKNOWN_ERROR' })\n\t\t\t\t}\n\t\t\t}\n\t\t})()\n\t}, [activateOtp, localStorageRequestId, otpChars, otpLength, state.type, urlRequestId, urlToken])\n\n\treturn state\n}\n"],"names":["PASSWORDLESS_REQUEST_STORAGE_KEY","useActivatePasswordlessOtpMutation","useState","useEffect","randomString","calculateHash"],"mappings":";;;;;;;AAOA,MAAM,wBAAwB,MAAsG;AACnI,QAAM,oBAAoB,aAAa,QAAQA,OAAAA,gCAAgC,KAAK;AACpF,QAAM,YAAY,IAAI,gBAAgB,OAAO,SAAS,MAAM;AAC5D,QAAM,YAAY,UAAU,IAAI,YAAY;AAC5C,QAAM,QAAQ,UAAU,IAAI,OAAO;AAEnC,SAAO,EAAE,uBAAuB,mBAAmB,cAAc,WAAW,UAAU,MAAA;AACvF;AASO,MAAM,8BAA8B,CAAC,EAAE,YAAY,GAAG,WAAW,mBAAA,IAGpE,OAAO;AACV,QAAM,EAAE,uBAAuB,cAAc,SAAA,IAAa,sBAAA;AAC1D,QAAM,cAAcC,mCAAAA,mCAAA;AAEpB,QAAM,CAAC,OAAO,QAAQ,IAAIC,MAAAA,SAA2C,MAAM;AAC1E,QAAI,gBAAgB,UAAU;AAC7B,UAAI,0BAA0B,cAAc;AAC3C,eAAO,EAAE,MAAM,iBAAA;AAAA,MAChB,OAAO;AACN,eAAO,EAAE,MAAM,uBAAA;AAAA,MAChB;AAAA,IACD;AACA,WAAO,EAAE,MAAM,QAAA;AAAA,EAChB,CAAC;AAGDC,QAAAA,UAAU,MAAM;AACd,KAAC,YAAY;AACb,UAAI,MAAM,SAAS,kBAAkB;AACpC,cAAM,UAAUC,UAAAA,aAAa,WAAW,QAAQ;AAChD,YAAI;AACH,gBAAM,SAAS,MAAM,YAAY;AAAA,YAChC,WAAW;AAAA,YACX,OAAO;AAAA,YACP,SAAS,MAAMC,sBAAc,WAAW,OAAO;AAAA,UAAA,CAC/C;AACD,cAAI,CAAC,OAAO,IAAI;AACf,qBAAS,EAAE,MAAM,yBAAyB,OAAO,OAAO,OAAO;AAAA,UAChE,OAAO;AACN,qBAAS,EAAE,MAAM,iBAAiB,KAAK,SAAS;AAAA,UACjD;AAAA,QACD,SAAS,GAAG;AACX,kBAAQ,MAAM,CAAC;AACf,mBAAS,EAAE,MAAM,yBAAyB,OAAO,iBAAiB;AAAA,QACnE;AAAA,MACD;AAAA,IACD,GAAA;AAAA,EACD,GAAG,CAAC,aAAa,uBAAuB,UAAU,WAAW,MAAM,MAAM,cAAc,QAAQ,CAAC;AAEhG,SAAO;AACR;;"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { useState, useEffect } from "react";
|
|
2
|
+
import { PASSWORDLESS_REQUEST_STORAGE_KEY } from "../consts.js";
|
|
3
|
+
import { randomString } from "../internal/utils/randomInt.js";
|
|
4
|
+
import { calculateHash } from "../internal/utils/hashing.js";
|
|
5
|
+
import { useActivatePasswordlessOtpMutation } from "./mutations/passwordless/useActivatePasswordlessOtpMutation.js";
|
|
6
|
+
const usePasswordlessParams = () => {
|
|
7
|
+
const localStorageValue = localStorage.getItem(PASSWORDLESS_REQUEST_STORAGE_KEY) ?? null;
|
|
8
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
9
|
+
const requestId = urlParams.get("request_id");
|
|
10
|
+
const token = urlParams.get("token");
|
|
11
|
+
return { localStorageRequestId: localStorageValue, urlRequestId: requestId, urlToken: token };
|
|
12
|
+
};
|
|
13
|
+
const usePasswordlessOtpActivator = ({ otpLength = 6, otpChars = "0123456789ABCDEF" } = {}) => {
|
|
14
|
+
const { localStorageRequestId, urlRequestId, urlToken } = usePasswordlessParams();
|
|
15
|
+
const activateOtp = useActivatePasswordlessOtpMutation();
|
|
16
|
+
const [state, setState] = useState(() => {
|
|
17
|
+
if (urlRequestId && urlToken) {
|
|
18
|
+
if (localStorageRequestId !== urlRequestId) {
|
|
19
|
+
return { type: "otp_activating" };
|
|
20
|
+
} else {
|
|
21
|
+
return { type: "can_proceed_to_login" };
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return { type: "empty" };
|
|
25
|
+
});
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
(async () => {
|
|
28
|
+
if (state.type === "otp_activating") {
|
|
29
|
+
const otpCode = randomString(otpLength, otpChars);
|
|
30
|
+
try {
|
|
31
|
+
const result = await activateOtp({
|
|
32
|
+
requestId: urlRequestId,
|
|
33
|
+
token: urlToken,
|
|
34
|
+
otpHash: await calculateHash("SHA-256", otpCode)
|
|
35
|
+
});
|
|
36
|
+
if (!result.ok) {
|
|
37
|
+
setState({ type: "otp_activation_failed", error: result.error });
|
|
38
|
+
} else {
|
|
39
|
+
setState({ type: "otp_activated", otp: otpCode });
|
|
40
|
+
}
|
|
41
|
+
} catch (e) {
|
|
42
|
+
console.error(e);
|
|
43
|
+
setState({ type: "otp_activation_failed", error: "UNKNOWN_ERROR" });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
})();
|
|
47
|
+
}, [activateOtp, localStorageRequestId, otpChars, otpLength, state.type, urlRequestId, urlToken]);
|
|
48
|
+
return state;
|
|
49
|
+
};
|
|
50
|
+
export {
|
|
51
|
+
usePasswordlessOtpActivator
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=usePasswordlessOtpActivator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePasswordlessOtpActivator.js","sources":["../../../../../packages/react-client-tenant/src/hooks/usePasswordlessOtpActivator.ts"],"sourcesContent":["import { useEffect, useState } from 'react'\nimport { PASSWORDLESS_REQUEST_STORAGE_KEY } from '../consts'\nimport { useActivatePasswordlessOtpMutation } from './mutations'\nimport { randomString } from '../internal/utils/randomInt'\nimport { calculateHash } from '../internal/utils/hashing'\nimport { ActivatePasswordlessOtpErrorCode } from '@contember/graphql-client-tenant'\n\nconst usePasswordlessParams = (): { localStorageRequestId: string | null; urlRequestId: string | null; urlToken: string | null } => {\n\tconst localStorageValue = localStorage.getItem(PASSWORDLESS_REQUEST_STORAGE_KEY) ?? null\n\tconst urlParams = new URLSearchParams(window.location.search)\n\tconst requestId = urlParams.get('request_id')\n\tconst token = urlParams.get('token')\n\n\treturn { localStorageRequestId: localStorageValue, urlRequestId: requestId, urlToken: token }\n}\n\nexport type PasswordlessResponseHandlerState =\n\t| { type: 'empty' }\n\t| { type: 'otp_activating' }\n\t| { type: 'otp_activated'; otp: string }\n\t| { type: 'otp_activation_failed'; error: ActivatePasswordlessOtpErrorCode | 'UNKNOWN_ERROR' }\n\t| { type: 'can_proceed_to_login' }\n\nexport const usePasswordlessOtpActivator = ({ otpLength = 6, otpChars = '0123456789ABCDEF' }: {\n\totpLength?: number\n\totpChars?: string\n} = {}) => {\n\tconst { localStorageRequestId, urlRequestId, urlToken } = usePasswordlessParams()\n\tconst activateOtp = useActivatePasswordlessOtpMutation()\n\n\tconst [state, setState] = useState<PasswordlessResponseHandlerState>(() => {\n\t\tif (urlRequestId && urlToken) {\n\t\t\tif (localStorageRequestId !== urlRequestId) {\n\t\t\t\treturn { type: 'otp_activating' }\n\t\t\t} else {\n\t\t\t\treturn { type: 'can_proceed_to_login' }\n\t\t\t}\n\t\t}\n\t\treturn { type: 'empty' }\n\t})\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: intentional\n\tuseEffect(() => {\n\t\t;(async () => {\n\t\t\tif (state.type === 'otp_activating') {\n\t\t\t\tconst otpCode = randomString(otpLength, otpChars)\n\t\t\t\ttry {\n\t\t\t\t\tconst result = await activateOtp({\n\t\t\t\t\t\trequestId: urlRequestId!,\n\t\t\t\t\t\ttoken: urlToken!,\n\t\t\t\t\t\totpHash: await calculateHash('SHA-256', otpCode),\n\t\t\t\t\t})\n\t\t\t\t\tif (!result.ok) {\n\t\t\t\t\t\tsetState({ type: 'otp_activation_failed', error: result.error })\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsetState({ type: 'otp_activated', otp: otpCode })\n\t\t\t\t\t}\n\t\t\t\t} catch (e) {\n\t\t\t\t\tconsole.error(e)\n\t\t\t\t\tsetState({ type: 'otp_activation_failed', error: 'UNKNOWN_ERROR' })\n\t\t\t\t}\n\t\t\t}\n\t\t})()\n\t}, [activateOtp, localStorageRequestId, otpChars, otpLength, state.type, urlRequestId, urlToken])\n\n\treturn state\n}\n"],"names":[],"mappings":";;;;;AAOA,MAAM,wBAAwB,MAAsG;AACnI,QAAM,oBAAoB,aAAa,QAAQ,gCAAgC,KAAK;AACpF,QAAM,YAAY,IAAI,gBAAgB,OAAO,SAAS,MAAM;AAC5D,QAAM,YAAY,UAAU,IAAI,YAAY;AAC5C,QAAM,QAAQ,UAAU,IAAI,OAAO;AAEnC,SAAO,EAAE,uBAAuB,mBAAmB,cAAc,WAAW,UAAU,MAAA;AACvF;AASO,MAAM,8BAA8B,CAAC,EAAE,YAAY,GAAG,WAAW,mBAAA,IAGpE,OAAO;AACV,QAAM,EAAE,uBAAuB,cAAc,SAAA,IAAa,sBAAA;AAC1D,QAAM,cAAc,mCAAA;AAEpB,QAAM,CAAC,OAAO,QAAQ,IAAI,SAA2C,MAAM;AAC1E,QAAI,gBAAgB,UAAU;AAC7B,UAAI,0BAA0B,cAAc;AAC3C,eAAO,EAAE,MAAM,iBAAA;AAAA,MAChB,OAAO;AACN,eAAO,EAAE,MAAM,uBAAA;AAAA,MAChB;AAAA,IACD;AACA,WAAO,EAAE,MAAM,QAAA;AAAA,EAChB,CAAC;AAGD,YAAU,MAAM;AACd,KAAC,YAAY;AACb,UAAI,MAAM,SAAS,kBAAkB;AACpC,cAAM,UAAU,aAAa,WAAW,QAAQ;AAChD,YAAI;AACH,gBAAM,SAAS,MAAM,YAAY;AAAA,YAChC,WAAW;AAAA,YACX,OAAO;AAAA,YACP,SAAS,MAAM,cAAc,WAAW,OAAO;AAAA,UAAA,CAC/C;AACD,cAAI,CAAC,OAAO,IAAI;AACf,qBAAS,EAAE,MAAM,yBAAyB,OAAO,OAAO,OAAO;AAAA,UAChE,OAAO;AACN,qBAAS,EAAE,MAAM,iBAAiB,KAAK,SAAS;AAAA,UACjD;AAAA,QACD,SAAS,GAAG;AACX,kBAAQ,MAAM,CAAC;AACf,mBAAS,EAAE,MAAM,yBAAyB,OAAO,iBAAiB;AAAA,QACnE;AAAA,MACD;AAAA,IACD,GAAA;AAAA,EACD,GAAG,CAAC,aAAa,uBAAuB,UAAU,WAAW,MAAM,MAAM,cAAc,QAAQ,CAAC;AAEhG,SAAO;AACR;"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const reactClient = require("@contember/react-client");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const graphqlTsClientApi = require("graphql-ts-client-api");
|
|
6
|
+
const LoginToken = /* @__PURE__ */ Symbol("LoginToken");
|
|
7
|
+
const useTenantApi = ({ headers, apiToken } = {}) => {
|
|
8
|
+
const client = reactClient.useTenantGraphQlClient();
|
|
9
|
+
const loginToken = reactClient.useLoginToken();
|
|
10
|
+
return React.useCallback((fetcher, options) => {
|
|
11
|
+
const writer = new graphqlTsClientApi.TextWriter();
|
|
12
|
+
writer.text(`${fetcher.fetchableType.name.toLowerCase()}`);
|
|
13
|
+
if (fetcher.variableTypeMap.size !== 0) {
|
|
14
|
+
writer.scope({ type: "ARGUMENTS", multiLines: fetcher.variableTypeMap.size > 2, suffix: " " }, () => {
|
|
15
|
+
graphqlTsClientApi.util.iterateMap(fetcher.variableTypeMap, ([name, type]) => {
|
|
16
|
+
writer.seperator();
|
|
17
|
+
writer.text(`$${name}: ${type}`);
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
writer.text(fetcher.toString());
|
|
22
|
+
writer.text(fetcher.toFragmentString());
|
|
23
|
+
const apiTokenResolved = apiToken ?? options?.apiToken;
|
|
24
|
+
return client.execute(writer.toString(), {
|
|
25
|
+
variables: options?.variables,
|
|
26
|
+
headers: {
|
|
27
|
+
...headers,
|
|
28
|
+
...options?.headers
|
|
29
|
+
},
|
|
30
|
+
apiToken: apiTokenResolved === LoginToken ? loginToken : apiTokenResolved
|
|
31
|
+
});
|
|
32
|
+
}, [apiToken, client, headers, loginToken]);
|
|
33
|
+
};
|
|
34
|
+
exports.LoginToken = LoginToken;
|
|
35
|
+
exports.useTenantApi = useTenantApi;
|
|
36
|
+
//# sourceMappingURL=useTenantApi.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTenantApi.cjs","sources":["../../../../../packages/react-client-tenant/src/hooks/useTenantApi.ts"],"sourcesContent":["import { useLoginToken, useTenantGraphQlClient } from '@contember/react-client'\nimport { useCallback } from 'react'\nimport { Fetcher, TextWriter, util } from 'graphql-ts-client-api'\n\nexport const LoginToken = Symbol('LoginToken')\n\nexport type TenantApiOptions = {\n\treadonly headers?: Record<string, string>\n\treadonly apiToken?: string | typeof LoginToken\n}\n\nexport const useTenantApi = ({ headers, apiToken }: TenantApiOptions = {}) => {\n\tconst client = useTenantGraphQlClient()\n\tconst loginToken = useLoginToken()\n\n\treturn useCallback(<TData extends object, TVariables extends object>(\n\t\tfetcher: Fetcher<'Query' | 'Mutation', TData, TVariables>,\n\t\toptions?: {\n\t\t\treadonly variables?: TVariables\n\t\t\treadonly headers?: Record<string, string>\n\t\t\treadonly apiToken?: string | typeof LoginToken\n\t\t},\n\t): Promise<TData> => {\n\t\tconst writer = new TextWriter()\n\t\twriter.text(`${fetcher.fetchableType.name.toLowerCase()}`)\n\t\tif (fetcher.variableTypeMap.size !== 0) {\n\t\t\twriter.scope({ type: 'ARGUMENTS', multiLines: fetcher.variableTypeMap.size > 2, suffix: ' ' }, () => {\n\t\t\t\tutil.iterateMap(fetcher.variableTypeMap, ([name, type]) => {\n\t\t\t\t\twriter.seperator()\n\t\t\t\t\twriter.text(`$${name}: ${type}`)\n\t\t\t\t})\n\t\t\t})\n\t\t}\n\t\twriter.text(fetcher.toString())\n\t\twriter.text(fetcher.toFragmentString())\n\n\t\tconst apiTokenResolved = apiToken ?? options?.apiToken\n\t\treturn client.execute(writer.toString(), {\n\t\t\tvariables: options?.variables,\n\t\t\theaders: {\n\t\t\t\t...headers,\n\t\t\t\t...options?.headers,\n\t\t\t},\n\t\t\tapiToken: apiTokenResolved === LoginToken ? loginToken : apiTokenResolved,\n\t\t})\n\t}, [apiToken, client, headers, loginToken])\n}\n"],"names":["useTenantGraphQlClient","useLoginToken","useCallback","TextWriter","util"],"mappings":";;;;;AAIO,MAAM,oCAAoB,YAAY;AAOtC,MAAM,eAAe,CAAC,EAAE,SAAS,SAAA,IAA+B,CAAA,MAAO;AAC7E,QAAM,SAASA,YAAAA,uBAAA;AACf,QAAM,aAAaC,YAAAA,cAAA;AAEnB,SAAOC,MAAAA,YAAY,CAClB,SACA,YAKoB;AACpB,UAAM,SAAS,IAAIC,8BAAA;AACnB,WAAO,KAAK,GAAG,QAAQ,cAAc,KAAK,YAAA,CAAa,EAAE;AACzD,QAAI,QAAQ,gBAAgB,SAAS,GAAG;AACvC,aAAO,MAAM,EAAE,MAAM,aAAa,YAAY,QAAQ,gBAAgB,OAAO,GAAG,QAAQ,IAAA,GAAO,MAAM;AACpGC,2BAAAA,KAAK,WAAW,QAAQ,iBAAiB,CAAC,CAAC,MAAM,IAAI,MAAM;AAC1D,iBAAO,UAAA;AACP,iBAAO,KAAK,IAAI,IAAI,KAAK,IAAI,EAAE;AAAA,QAChC,CAAC;AAAA,MACF,CAAC;AAAA,IACF;AACA,WAAO,KAAK,QAAQ,UAAU;AAC9B,WAAO,KAAK,QAAQ,kBAAkB;AAEtC,UAAM,mBAAmB,YAAY,SAAS;AAC9C,WAAO,OAAO,QAAQ,OAAO,SAAA,GAAY;AAAA,MACxC,WAAW,SAAS;AAAA,MACpB,SAAS;AAAA,QACR,GAAG;AAAA,QACH,GAAG,SAAS;AAAA,MAAA;AAAA,MAEb,UAAU,qBAAqB,aAAa,aAAa;AAAA,IAAA,CACzD;AAAA,EACF,GAAG,CAAC,UAAU,QAAQ,SAAS,UAAU,CAAC;AAC3C;;;"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { useTenantGraphQlClient, useLoginToken } from "@contember/react-client";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import { TextWriter, util } from "graphql-ts-client-api";
|
|
4
|
+
const LoginToken = /* @__PURE__ */ Symbol("LoginToken");
|
|
5
|
+
const useTenantApi = ({ headers, apiToken } = {}) => {
|
|
6
|
+
const client = useTenantGraphQlClient();
|
|
7
|
+
const loginToken = useLoginToken();
|
|
8
|
+
return useCallback((fetcher, options) => {
|
|
9
|
+
const writer = new TextWriter();
|
|
10
|
+
writer.text(`${fetcher.fetchableType.name.toLowerCase()}`);
|
|
11
|
+
if (fetcher.variableTypeMap.size !== 0) {
|
|
12
|
+
writer.scope({ type: "ARGUMENTS", multiLines: fetcher.variableTypeMap.size > 2, suffix: " " }, () => {
|
|
13
|
+
util.iterateMap(fetcher.variableTypeMap, ([name, type]) => {
|
|
14
|
+
writer.seperator();
|
|
15
|
+
writer.text(`$${name}: ${type}`);
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
writer.text(fetcher.toString());
|
|
20
|
+
writer.text(fetcher.toFragmentString());
|
|
21
|
+
const apiTokenResolved = apiToken ?? options?.apiToken;
|
|
22
|
+
return client.execute(writer.toString(), {
|
|
23
|
+
variables: options?.variables,
|
|
24
|
+
headers: {
|
|
25
|
+
...headers,
|
|
26
|
+
...options?.headers
|
|
27
|
+
},
|
|
28
|
+
apiToken: apiTokenResolved === LoginToken ? loginToken : apiTokenResolved
|
|
29
|
+
});
|
|
30
|
+
}, [apiToken, client, headers, loginToken]);
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
LoginToken,
|
|
34
|
+
useTenantApi
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=useTenantApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTenantApi.js","sources":["../../../../../packages/react-client-tenant/src/hooks/useTenantApi.ts"],"sourcesContent":["import { useLoginToken, useTenantGraphQlClient } from '@contember/react-client'\nimport { useCallback } from 'react'\nimport { Fetcher, TextWriter, util } from 'graphql-ts-client-api'\n\nexport const LoginToken = Symbol('LoginToken')\n\nexport type TenantApiOptions = {\n\treadonly headers?: Record<string, string>\n\treadonly apiToken?: string | typeof LoginToken\n}\n\nexport const useTenantApi = ({ headers, apiToken }: TenantApiOptions = {}) => {\n\tconst client = useTenantGraphQlClient()\n\tconst loginToken = useLoginToken()\n\n\treturn useCallback(<TData extends object, TVariables extends object>(\n\t\tfetcher: Fetcher<'Query' | 'Mutation', TData, TVariables>,\n\t\toptions?: {\n\t\t\treadonly variables?: TVariables\n\t\t\treadonly headers?: Record<string, string>\n\t\t\treadonly apiToken?: string | typeof LoginToken\n\t\t},\n\t): Promise<TData> => {\n\t\tconst writer = new TextWriter()\n\t\twriter.text(`${fetcher.fetchableType.name.toLowerCase()}`)\n\t\tif (fetcher.variableTypeMap.size !== 0) {\n\t\t\twriter.scope({ type: 'ARGUMENTS', multiLines: fetcher.variableTypeMap.size > 2, suffix: ' ' }, () => {\n\t\t\t\tutil.iterateMap(fetcher.variableTypeMap, ([name, type]) => {\n\t\t\t\t\twriter.seperator()\n\t\t\t\t\twriter.text(`$${name}: ${type}`)\n\t\t\t\t})\n\t\t\t})\n\t\t}\n\t\twriter.text(fetcher.toString())\n\t\twriter.text(fetcher.toFragmentString())\n\n\t\tconst apiTokenResolved = apiToken ?? options?.apiToken\n\t\treturn client.execute(writer.toString(), {\n\t\t\tvariables: options?.variables,\n\t\t\theaders: {\n\t\t\t\t...headers,\n\t\t\t\t...options?.headers,\n\t\t\t},\n\t\t\tapiToken: apiTokenResolved === LoginToken ? loginToken : apiTokenResolved,\n\t\t})\n\t}, [apiToken, client, headers, loginToken])\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,oCAAoB,YAAY;AAOtC,MAAM,eAAe,CAAC,EAAE,SAAS,SAAA,IAA+B,CAAA,MAAO;AAC7E,QAAM,SAAS,uBAAA;AACf,QAAM,aAAa,cAAA;AAEnB,SAAO,YAAY,CAClB,SACA,YAKoB;AACpB,UAAM,SAAS,IAAI,WAAA;AACnB,WAAO,KAAK,GAAG,QAAQ,cAAc,KAAK,YAAA,CAAa,EAAE;AACzD,QAAI,QAAQ,gBAAgB,SAAS,GAAG;AACvC,aAAO,MAAM,EAAE,MAAM,aAAa,YAAY,QAAQ,gBAAgB,OAAO,GAAG,QAAQ,IAAA,GAAO,MAAM;AACpG,aAAK,WAAW,QAAQ,iBAAiB,CAAC,CAAC,MAAM,IAAI,MAAM;AAC1D,iBAAO,UAAA;AACP,iBAAO,KAAK,IAAI,IAAI,KAAK,IAAI,EAAE;AAAA,QAChC,CAAC;AAAA,MACF,CAAC;AAAA,IACF;AACA,WAAO,KAAK,QAAQ,UAAU;AAC9B,WAAO,KAAK,QAAQ,kBAAkB;AAEtC,UAAM,mBAAmB,YAAY,SAAS;AAC9C,WAAO,OAAO,QAAQ,OAAO,SAAA,GAAY;AAAA,MACxC,WAAW,SAAS;AAAA,MACpB,SAAS;AAAA,QACR,GAAG;AAAA,QACH,GAAG,SAAS;AAAA,MAAA;AAAA,MAEb,UAAU,qBAAqB,aAAa,aAAa;AAAA,IAAA,CACzD;AAAA,EACF,GAAG,CAAC,UAAU,QAAQ,SAAS,UAAU,CAAC;AAC3C;"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const useTenantApi = require("./useTenantApi.cjs");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const useTenantMutation = (fetcher, { headers, apiToken } = {}) => {
|
|
6
|
+
const tenantApi = useTenantApi.useTenantApi({ headers, apiToken });
|
|
7
|
+
return React.useCallback(async (variables) => {
|
|
8
|
+
const result = await tenantApi(
|
|
9
|
+
fetcher,
|
|
10
|
+
{
|
|
11
|
+
variables
|
|
12
|
+
}
|
|
13
|
+
);
|
|
14
|
+
if (!result.mutation?.ok) {
|
|
15
|
+
return {
|
|
16
|
+
ok: false,
|
|
17
|
+
error: result.mutation?.error?.code,
|
|
18
|
+
developerMessage: result.mutation?.error?.developerMessage
|
|
19
|
+
};
|
|
20
|
+
} else {
|
|
21
|
+
return { ok: true, result: result.mutation.result };
|
|
22
|
+
}
|
|
23
|
+
}, [fetcher, tenantApi]);
|
|
24
|
+
};
|
|
25
|
+
const createTenantMutation = (fetcher, defaultOptions) => {
|
|
26
|
+
return ({ headers, apiToken } = {}) => useTenantMutation(fetcher, {
|
|
27
|
+
headers: React.useMemo(() => ({ ...defaultOptions?.headers, ...headers }), [headers]),
|
|
28
|
+
apiToken: apiToken ?? defaultOptions?.apiToken
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
exports.createTenantMutation = createTenantMutation;
|
|
32
|
+
exports.useTenantMutation = useTenantMutation;
|
|
33
|
+
//# sourceMappingURL=useTenantMutation.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTenantMutation.cjs","sources":["../../../../../packages/react-client-tenant/src/hooks/useTenantMutation.ts"],"sourcesContent":["import { TenantApiOptions, useTenantApi } from './useTenantApi'\nimport { useCallback, useMemo } from 'react'\nimport { MutationFetcher } from '@contember/graphql-client-tenant'\n\nexport type TenantMutationOkResponse<Result> = { ok: true; result: Result }\nexport type TenantMutationErrorResponse<Error> = { ok: false; error: Error; developerMessage?: string }\nexport type TenantMutationResponse<Result, Error> = TenantMutationOkResponse<Result> | TenantMutationErrorResponse<Error>\n\nexport type TenantMutation<Result, Error> = {\n\treadonly mutation?: { readonly ok: boolean; readonly error?: { readonly code: Error; readonly developerMessage: string }; readonly result?: Result }\n}\n\nexport const useTenantMutation = <TResult, TError extends string = never, TVariables extends object = {}>(\n\tfetcher: MutationFetcher<TenantMutation<TResult, TError>, TVariables>,\n\t{ headers, apiToken }: TenantApiOptions = {},\n) => {\n\tconst tenantApi = useTenantApi({ headers, apiToken })\n\n\treturn useCallback(async (variables: TVariables): Promise<TenantMutationResponse<TResult, TError>> => {\n\t\tconst result = await tenantApi(\n\t\t\tfetcher,\n\t\t\t{\n\t\t\t\tvariables,\n\t\t\t},\n\t\t)\n\t\tif (!result.mutation?.ok) {\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\terror: result.mutation?.error?.code as TError,\n\t\t\t\tdeveloperMessage: result.mutation?.error?.developerMessage,\n\t\t\t}\n\t\t} else {\n\t\t\treturn { ok: true, result: result.mutation.result as TResult }\n\t\t}\n\t}, [fetcher, tenantApi])\n}\n\nexport const createTenantMutation = <TResult, TError extends string = never, TVariables extends object = {}>(\n\tfetcher: MutationFetcher<TenantMutation<TResult, TError>, TVariables>,\n\tdefaultOptions?: TenantApiOptions,\n) => {\n\treturn ({ headers, apiToken }: TenantApiOptions = {}) =>\n\t\tuseTenantMutation(fetcher, {\n\t\t\theaders: useMemo(() => ({ ...defaultOptions?.headers, ...headers }), [headers]),\n\t\t\tapiToken: apiToken ?? defaultOptions?.apiToken,\n\t\t})\n}\n"],"names":["useTenantApi","useCallback","useMemo"],"mappings":";;;;AAYO,MAAM,oBAAoB,CAChC,SACA,EAAE,SAAS,SAAA,IAA+B,CAAA,MACtC;AACJ,QAAM,YAAYA,aAAAA,aAAa,EAAE,SAAS,UAAU;AAEpD,SAAOC,MAAAA,YAAY,OAAO,cAA4E;AACrG,UAAM,SAAS,MAAM;AAAA,MACpB;AAAA,MACA;AAAA,QACC;AAAA,MAAA;AAAA,IACD;AAED,QAAI,CAAC,OAAO,UAAU,IAAI;AACzB,aAAO;AAAA,QACN,IAAI;AAAA,QACJ,OAAO,OAAO,UAAU,OAAO;AAAA,QAC/B,kBAAkB,OAAO,UAAU,OAAO;AAAA,MAAA;AAAA,IAE5C,OAAO;AACN,aAAO,EAAE,IAAI,MAAM,QAAQ,OAAO,SAAS,OAAA;AAAA,IAC5C;AAAA,EACD,GAAG,CAAC,SAAS,SAAS,CAAC;AACxB;AAEO,MAAM,uBAAuB,CACnC,SACA,mBACI;AACJ,SAAO,CAAC,EAAE,SAAS,SAAA,IAA+B,CAAA,MACjD,kBAAkB,SAAS;AAAA,IAC1B,SAASC,MAAAA,QAAQ,OAAO,EAAE,GAAG,gBAAgB,SAAS,GAAG,QAAA,IAAY,CAAC,OAAO,CAAC;AAAA,IAC9E,UAAU,YAAY,gBAAgB;AAAA,EAAA,CACtC;AACH;;;"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useTenantApi } from "./useTenantApi.js";
|
|
2
|
+
import { useMemo, useCallback } from "react";
|
|
3
|
+
const useTenantMutation = (fetcher, { headers, apiToken } = {}) => {
|
|
4
|
+
const tenantApi = useTenantApi({ headers, apiToken });
|
|
5
|
+
return useCallback(async (variables) => {
|
|
6
|
+
const result = await tenantApi(
|
|
7
|
+
fetcher,
|
|
8
|
+
{
|
|
9
|
+
variables
|
|
10
|
+
}
|
|
11
|
+
);
|
|
12
|
+
if (!result.mutation?.ok) {
|
|
13
|
+
return {
|
|
14
|
+
ok: false,
|
|
15
|
+
error: result.mutation?.error?.code,
|
|
16
|
+
developerMessage: result.mutation?.error?.developerMessage
|
|
17
|
+
};
|
|
18
|
+
} else {
|
|
19
|
+
return { ok: true, result: result.mutation.result };
|
|
20
|
+
}
|
|
21
|
+
}, [fetcher, tenantApi]);
|
|
22
|
+
};
|
|
23
|
+
const createTenantMutation = (fetcher, defaultOptions) => {
|
|
24
|
+
return ({ headers, apiToken } = {}) => useTenantMutation(fetcher, {
|
|
25
|
+
headers: useMemo(() => ({ ...defaultOptions?.headers, ...headers }), [headers]),
|
|
26
|
+
apiToken: apiToken ?? defaultOptions?.apiToken
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
export {
|
|
30
|
+
createTenantMutation,
|
|
31
|
+
useTenantMutation
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=useTenantMutation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTenantMutation.js","sources":["../../../../../packages/react-client-tenant/src/hooks/useTenantMutation.ts"],"sourcesContent":["import { TenantApiOptions, useTenantApi } from './useTenantApi'\nimport { useCallback, useMemo } from 'react'\nimport { MutationFetcher } from '@contember/graphql-client-tenant'\n\nexport type TenantMutationOkResponse<Result> = { ok: true; result: Result }\nexport type TenantMutationErrorResponse<Error> = { ok: false; error: Error; developerMessage?: string }\nexport type TenantMutationResponse<Result, Error> = TenantMutationOkResponse<Result> | TenantMutationErrorResponse<Error>\n\nexport type TenantMutation<Result, Error> = {\n\treadonly mutation?: { readonly ok: boolean; readonly error?: { readonly code: Error; readonly developerMessage: string }; readonly result?: Result }\n}\n\nexport const useTenantMutation = <TResult, TError extends string = never, TVariables extends object = {}>(\n\tfetcher: MutationFetcher<TenantMutation<TResult, TError>, TVariables>,\n\t{ headers, apiToken }: TenantApiOptions = {},\n) => {\n\tconst tenantApi = useTenantApi({ headers, apiToken })\n\n\treturn useCallback(async (variables: TVariables): Promise<TenantMutationResponse<TResult, TError>> => {\n\t\tconst result = await tenantApi(\n\t\t\tfetcher,\n\t\t\t{\n\t\t\t\tvariables,\n\t\t\t},\n\t\t)\n\t\tif (!result.mutation?.ok) {\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\terror: result.mutation?.error?.code as TError,\n\t\t\t\tdeveloperMessage: result.mutation?.error?.developerMessage,\n\t\t\t}\n\t\t} else {\n\t\t\treturn { ok: true, result: result.mutation.result as TResult }\n\t\t}\n\t}, [fetcher, tenantApi])\n}\n\nexport const createTenantMutation = <TResult, TError extends string = never, TVariables extends object = {}>(\n\tfetcher: MutationFetcher<TenantMutation<TResult, TError>, TVariables>,\n\tdefaultOptions?: TenantApiOptions,\n) => {\n\treturn ({ headers, apiToken }: TenantApiOptions = {}) =>\n\t\tuseTenantMutation(fetcher, {\n\t\t\theaders: useMemo(() => ({ ...defaultOptions?.headers, ...headers }), [headers]),\n\t\t\tapiToken: apiToken ?? defaultOptions?.apiToken,\n\t\t})\n}\n"],"names":[],"mappings":";;AAYO,MAAM,oBAAoB,CAChC,SACA,EAAE,SAAS,SAAA,IAA+B,CAAA,MACtC;AACJ,QAAM,YAAY,aAAa,EAAE,SAAS,UAAU;AAEpD,SAAO,YAAY,OAAO,cAA4E;AACrG,UAAM,SAAS,MAAM;AAAA,MACpB;AAAA,MACA;AAAA,QACC;AAAA,MAAA;AAAA,IACD;AAED,QAAI,CAAC,OAAO,UAAU,IAAI;AACzB,aAAO;AAAA,QACN,IAAI;AAAA,QACJ,OAAO,OAAO,UAAU,OAAO;AAAA,QAC/B,kBAAkB,OAAO,UAAU,OAAO;AAAA,MAAA;AAAA,IAE5C,OAAO;AACN,aAAO,EAAE,IAAI,MAAM,QAAQ,OAAO,SAAS,OAAA;AAAA,IAC5C;AAAA,EACD,GAAG,CAAC,SAAS,SAAS,CAAC;AACxB;AAEO,MAAM,uBAAuB,CACnC,SACA,mBACI;AACJ,SAAO,CAAC,EAAE,SAAS,SAAA,IAA+B,CAAA,MACjD,kBAAkB,SAAS;AAAA,IAC1B,SAAS,QAAQ,OAAO,EAAE,GAAG,gBAAgB,SAAS,GAAG,QAAA,IAAY,CAAC,OAAO,CAAC;AAAA,IAC9E,UAAU,YAAY,gBAAgB;AAAA,EAAA,CACtC;AACH;"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const React = require("react");
|
|
4
|
+
const reactUtils = require("@contember/react-utils");
|
|
5
|
+
const useTenantQueryLoader = (fetcher, variables) => {
|
|
6
|
+
const [state, setState] = React.useState({ state: "loading" });
|
|
7
|
+
const stateRef = React.useRef(state);
|
|
8
|
+
stateRef.current = state;
|
|
9
|
+
const variablesMemo = reactUtils.useObjectMemo(variables);
|
|
10
|
+
const reqId = React.useRef(0);
|
|
11
|
+
const triggerLoad = React.useCallback(async () => {
|
|
12
|
+
const currentReqId = ++reqId.current;
|
|
13
|
+
try {
|
|
14
|
+
if (stateRef.current.state === "success") {
|
|
15
|
+
setState({ state: "refreshing", data: stateRef.current.data });
|
|
16
|
+
}
|
|
17
|
+
const data = await fetcher(variablesMemo);
|
|
18
|
+
if (reqId.current !== currentReqId) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
setState({ state: "success", data });
|
|
22
|
+
} catch (e) {
|
|
23
|
+
console.error(e);
|
|
24
|
+
if (reqId.current !== currentReqId) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
setState({ state: "error", error: e });
|
|
28
|
+
}
|
|
29
|
+
}, [fetcher, variablesMemo]);
|
|
30
|
+
React.useEffect(() => {
|
|
31
|
+
triggerLoad();
|
|
32
|
+
}, [triggerLoad]);
|
|
33
|
+
return [state, { refresh: triggerLoad }];
|
|
34
|
+
};
|
|
35
|
+
exports.useTenantQueryLoader = useTenantQueryLoader;
|
|
36
|
+
//# sourceMappingURL=useTenantQueryLoader.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTenantQueryLoader.cjs","sources":["../../../../../packages/react-client-tenant/src/hooks/useTenantQueryLoader.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react'\nimport { useObjectMemo } from '@contember/react-utils'\n\nexport type TenantQueryLoaderState<Result> =\n\t| { state: 'loading' }\n\t| { state: 'error'; error: unknown }\n\t| { state: 'success'; data: Result }\n\t| { state: 'refreshing'; data: Result }\n\nexport type TenantQueryLoaderMethods = {\n\trefresh: () => void\n}\n\nexport const useTenantQueryLoader = <TVariables extends object, Result>(\n\tfetcher: (variables: TVariables) => Promise<Result>,\n\tvariables: TVariables,\n): [TenantQueryLoaderState<Result>, TenantQueryLoaderMethods] => {\n\tconst [state, setState] = useState<TenantQueryLoaderState<Result>>({ state: 'loading' })\n\tconst stateRef = useRef(state)\n\tstateRef.current = state\n\tconst variablesMemo = useObjectMemo(variables)\n\n\tconst reqId = useRef(0)\n\n\tconst triggerLoad = useCallback(async () => {\n\t\tconst currentReqId = ++reqId.current\n\t\ttry {\n\t\t\tif (stateRef.current.state === 'success') {\n\t\t\t\tsetState({ state: 'refreshing', data: stateRef.current.data })\n\t\t\t}\n\t\t\tconst data = await fetcher(variablesMemo)\n\t\t\tif (reqId.current !== currentReqId) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tsetState({ state: 'success', data })\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t\tif (reqId.current !== currentReqId) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tsetState({ state: 'error', error: e })\n\t\t}\n\t}, [fetcher, variablesMemo])\n\n\tuseEffect(() => {\n\t\ttriggerLoad()\n\t}, [triggerLoad])\n\n\treturn [state, { refresh: triggerLoad }]\n}\n"],"names":["useState","useRef","useObjectMemo","useCallback","useEffect"],"mappings":";;;;AAaO,MAAM,uBAAuB,CACnC,SACA,cACgE;AAChE,QAAM,CAAC,OAAO,QAAQ,IAAIA,MAAAA,SAAyC,EAAE,OAAO,WAAW;AACvF,QAAM,WAAWC,MAAAA,OAAO,KAAK;AAC7B,WAAS,UAAU;AACnB,QAAM,gBAAgBC,WAAAA,cAAc,SAAS;AAE7C,QAAM,QAAQD,MAAAA,OAAO,CAAC;AAEtB,QAAM,cAAcE,MAAAA,YAAY,YAAY;AAC3C,UAAM,eAAe,EAAE,MAAM;AAC7B,QAAI;AACH,UAAI,SAAS,QAAQ,UAAU,WAAW;AACzC,iBAAS,EAAE,OAAO,cAAc,MAAM,SAAS,QAAQ,MAAM;AAAA,MAC9D;AACA,YAAM,OAAO,MAAM,QAAQ,aAAa;AACxC,UAAI,MAAM,YAAY,cAAc;AACnC;AAAA,MACD;AACA,eAAS,EAAE,OAAO,WAAW,KAAA,CAAM;AAAA,IACpC,SAAS,GAAG;AACX,cAAQ,MAAM,CAAC;AACf,UAAI,MAAM,YAAY,cAAc;AACnC;AAAA,MACD;AACA,eAAS,EAAE,OAAO,SAAS,OAAO,GAAG;AAAA,IACtC;AAAA,EACD,GAAG,CAAC,SAAS,aAAa,CAAC;AAE3BC,QAAAA,UAAU,MAAM;AACf,gBAAA;AAAA,EACD,GAAG,CAAC,WAAW,CAAC;AAEhB,SAAO,CAAC,OAAO,EAAE,SAAS,aAAa;AACxC;;"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { useState, useRef, useCallback, useEffect } from "react";
|
|
2
|
+
import { useObjectMemo } from "@contember/react-utils";
|
|
3
|
+
const useTenantQueryLoader = (fetcher, variables) => {
|
|
4
|
+
const [state, setState] = useState({ state: "loading" });
|
|
5
|
+
const stateRef = useRef(state);
|
|
6
|
+
stateRef.current = state;
|
|
7
|
+
const variablesMemo = useObjectMemo(variables);
|
|
8
|
+
const reqId = useRef(0);
|
|
9
|
+
const triggerLoad = useCallback(async () => {
|
|
10
|
+
const currentReqId = ++reqId.current;
|
|
11
|
+
try {
|
|
12
|
+
if (stateRef.current.state === "success") {
|
|
13
|
+
setState({ state: "refreshing", data: stateRef.current.data });
|
|
14
|
+
}
|
|
15
|
+
const data = await fetcher(variablesMemo);
|
|
16
|
+
if (reqId.current !== currentReqId) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
setState({ state: "success", data });
|
|
20
|
+
} catch (e) {
|
|
21
|
+
console.error(e);
|
|
22
|
+
if (reqId.current !== currentReqId) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
setState({ state: "error", error: e });
|
|
26
|
+
}
|
|
27
|
+
}, [fetcher, variablesMemo]);
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
triggerLoad();
|
|
30
|
+
}, [triggerLoad]);
|
|
31
|
+
return [state, { refresh: triggerLoad }];
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
useTenantQueryLoader
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=useTenantQueryLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTenantQueryLoader.js","sources":["../../../../../packages/react-client-tenant/src/hooks/useTenantQueryLoader.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react'\nimport { useObjectMemo } from '@contember/react-utils'\n\nexport type TenantQueryLoaderState<Result> =\n\t| { state: 'loading' }\n\t| { state: 'error'; error: unknown }\n\t| { state: 'success'; data: Result }\n\t| { state: 'refreshing'; data: Result }\n\nexport type TenantQueryLoaderMethods = {\n\trefresh: () => void\n}\n\nexport const useTenantQueryLoader = <TVariables extends object, Result>(\n\tfetcher: (variables: TVariables) => Promise<Result>,\n\tvariables: TVariables,\n): [TenantQueryLoaderState<Result>, TenantQueryLoaderMethods] => {\n\tconst [state, setState] = useState<TenantQueryLoaderState<Result>>({ state: 'loading' })\n\tconst stateRef = useRef(state)\n\tstateRef.current = state\n\tconst variablesMemo = useObjectMemo(variables)\n\n\tconst reqId = useRef(0)\n\n\tconst triggerLoad = useCallback(async () => {\n\t\tconst currentReqId = ++reqId.current\n\t\ttry {\n\t\t\tif (stateRef.current.state === 'success') {\n\t\t\t\tsetState({ state: 'refreshing', data: stateRef.current.data })\n\t\t\t}\n\t\t\tconst data = await fetcher(variablesMemo)\n\t\t\tif (reqId.current !== currentReqId) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tsetState({ state: 'success', data })\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t\tif (reqId.current !== currentReqId) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tsetState({ state: 'error', error: e })\n\t\t}\n\t}, [fetcher, variablesMemo])\n\n\tuseEffect(() => {\n\t\ttriggerLoad()\n\t}, [triggerLoad])\n\n\treturn [state, { refresh: triggerLoad }]\n}\n"],"names":[],"mappings":";;AAaO,MAAM,uBAAuB,CACnC,SACA,cACgE;AAChE,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAyC,EAAE,OAAO,WAAW;AACvF,QAAM,WAAW,OAAO,KAAK;AAC7B,WAAS,UAAU;AACnB,QAAM,gBAAgB,cAAc,SAAS;AAE7C,QAAM,QAAQ,OAAO,CAAC;AAEtB,QAAM,cAAc,YAAY,YAAY;AAC3C,UAAM,eAAe,EAAE,MAAM;AAC7B,QAAI;AACH,UAAI,SAAS,QAAQ,UAAU,WAAW;AACzC,iBAAS,EAAE,OAAO,cAAc,MAAM,SAAS,QAAQ,MAAM;AAAA,MAC9D;AACA,YAAM,OAAO,MAAM,QAAQ,aAAa;AACxC,UAAI,MAAM,YAAY,cAAc;AACnC;AAAA,MACD;AACA,eAAS,EAAE,OAAO,WAAW,KAAA,CAAM;AAAA,IACpC,SAAS,GAAG;AACX,cAAQ,MAAM,CAAC;AACf,UAAI,MAAM,YAAY,cAAc;AACnC;AAAA,MACD;AACA,eAAS,EAAE,OAAO,SAAS,OAAO,GAAG;AAAA,IACtC;AAAA,EACD,GAAG,CAAC,SAAS,aAAa,CAAC;AAE3B,YAAU,MAAM;AACf,gBAAA;AAAA,EACD,GAAG,CAAC,WAAW,CAAC;AAEhB,SAAO,CAAC,OAAO,EAAE,SAAS,aAAa;AACxC;"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const React = require("react");
|
|
4
|
+
const reactClient = require("@contember/react-client");
|
|
5
|
+
const useIDPStateStore = require("./useIDPStateStore.cjs");
|
|
6
|
+
const getBaseHref = require("../utils/getBaseHref.cjs");
|
|
7
|
+
const useRedirectToBacklink = require("./useRedirectToBacklink.cjs");
|
|
8
|
+
const useSignInIdpMutation = require("../../hooks/mutations/idp/useSignInIdpMutation.cjs");
|
|
9
|
+
const headers = {
|
|
10
|
+
"X-Contember-Token-Path": "data.mutation.result.token"
|
|
11
|
+
};
|
|
12
|
+
const DEFAULT_LOGIN_EXPIRATION = 14 * 24 * 60;
|
|
13
|
+
const useHandleIDPResponse = ({ onLogin, expiration = DEFAULT_LOGIN_EXPIRATION, setState, hasOauthResponse, redirectUrl }) => {
|
|
14
|
+
const idpSignIn = useSignInIdpMutation.useSignInIDPMutation({ headers });
|
|
15
|
+
const setSessionToken = reactClient.useSetSessionToken();
|
|
16
|
+
const firstRenderRef = React.useRef(true);
|
|
17
|
+
const { get: loadIdpState } = useIDPStateStore.useIDPStateStore();
|
|
18
|
+
const redirectToBackLink = useRedirectToBacklink.useRedirectToBacklinkCallback();
|
|
19
|
+
React.useEffect(() => {
|
|
20
|
+
if (!hasOauthResponse || !firstRenderRef.current) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
firstRenderRef.current = false;
|
|
24
|
+
(async () => {
|
|
25
|
+
const idpState = loadIdpState();
|
|
26
|
+
if (!idpState) {
|
|
27
|
+
setState({ type: "response_failed", error: "INVALID_LOCAL_STATE" });
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const response = await idpSignIn({
|
|
31
|
+
data: {
|
|
32
|
+
url: window.location.href,
|
|
33
|
+
redirectUrl: redirectUrl || getBaseHref.getBaseHref(),
|
|
34
|
+
sessionData: idpState.sessionData
|
|
35
|
+
},
|
|
36
|
+
identityProvider: idpState.provider,
|
|
37
|
+
expiration
|
|
38
|
+
});
|
|
39
|
+
if (!response.ok) {
|
|
40
|
+
setState({ type: "response_failed", error: response.error || "UNKNOWN_ERROR" });
|
|
41
|
+
} else {
|
|
42
|
+
setSessionToken(response.result.token);
|
|
43
|
+
setState({ type: "success" });
|
|
44
|
+
onLogin?.();
|
|
45
|
+
redirectToBackLink();
|
|
46
|
+
}
|
|
47
|
+
})();
|
|
48
|
+
}, [idpSignIn, onLogin, setSessionToken, hasOauthResponse, loadIdpState, expiration, setState, redirectToBackLink, redirectUrl]);
|
|
49
|
+
};
|
|
50
|
+
exports.useHandleIDPResponse = useHandleIDPResponse;
|
|
51
|
+
//# sourceMappingURL=useHandleIDPResponse.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHandleIDPResponse.cjs","sources":["../../../../../../packages/react-client-tenant/src/internal/hooks/useHandleIDPResponse.ts"],"sourcesContent":["import { SetStateAction, useEffect, useRef } from 'react'\nimport { useSetSessionToken } from '@contember/react-client'\nimport { useIDPStateStore } from './useIDPStateStore'\nimport { getBaseHref } from '../utils/getBaseHref'\nimport { IDPStateValue } from '../../types/idp'\nimport { useSignInIDPMutation } from '../../hooks'\nimport { useRedirectToBacklinkCallback } from './useRedirectToBacklink'\n\nexport interface UseHandleIDPResponseProps {\n\tonLogin?: () => void\n\texpiration?: number\n\n\tsetState: (state: SetStateAction<IDPStateValue>) => void\n\thasOauthResponse: boolean\n\tredirectUrl?: string\n}\n\nconst headers = {\n\t'X-Contember-Token-Path': 'data.mutation.result.token',\n}\n\nconst DEFAULT_LOGIN_EXPIRATION = 14 * 24 * 60 // 14 days\n\nexport const useHandleIDPResponse = (\n\t{ onLogin, expiration = DEFAULT_LOGIN_EXPIRATION, setState, hasOauthResponse, redirectUrl }: UseHandleIDPResponseProps,\n): void => {\n\tconst idpSignIn = useSignInIDPMutation({ headers })\n\tconst setSessionToken = useSetSessionToken()\n\n\tconst firstRenderRef = useRef(true)\n\n\tconst { get: loadIdpState } = useIDPStateStore()\n\tconst redirectToBackLink = useRedirectToBacklinkCallback()\n\n\tuseEffect(() => {\n\t\tif (!hasOauthResponse || !firstRenderRef.current) {\n\t\t\treturn\n\t\t}\n\t\tfirstRenderRef.current = false\n\t\t;(async () => {\n\t\t\tconst idpState = loadIdpState()\n\t\t\tif (!idpState) {\n\t\t\t\tsetState({ type: 'response_failed', error: 'INVALID_LOCAL_STATE' })\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst response = await idpSignIn({\n\t\t\t\tdata: {\n\t\t\t\t\turl: window.location.href,\n\t\t\t\t\tredirectUrl: redirectUrl || getBaseHref(),\n\t\t\t\t\tsessionData: idpState.sessionData,\n\t\t\t\t},\n\t\t\t\tidentityProvider: idpState.provider,\n\t\t\t\texpiration,\n\t\t\t})\n\t\t\tif (!response.ok) {\n\t\t\t\tsetState({ type: 'response_failed', error: response.error || 'UNKNOWN_ERROR' })\n\t\t\t} else {\n\t\t\t\tsetSessionToken(response.result.token)\n\t\t\t\tsetState({ type: 'success' })\n\n\t\t\t\tonLogin?.()\n\t\t\t\tredirectToBackLink()\n\t\t\t}\n\t\t})()\n\t}, [idpSignIn, onLogin, setSessionToken, hasOauthResponse, loadIdpState, expiration, setState, redirectToBackLink, redirectUrl])\n}\n"],"names":["useSignInIDPMutation","useSetSessionToken","useRef","useIDPStateStore","useRedirectToBacklinkCallback","useEffect","getBaseHref"],"mappings":";;;;;;;;AAiBA,MAAM,UAAU;AAAA,EACf,0BAA0B;AAC3B;AAEA,MAAM,2BAA2B,KAAK,KAAK;AAEpC,MAAM,uBAAuB,CACnC,EAAE,SAAS,aAAa,0BAA0B,UAAU,kBAAkB,kBACpE;AACV,QAAM,YAAYA,qBAAAA,qBAAqB,EAAE,SAAS;AAClD,QAAM,kBAAkBC,YAAAA,mBAAA;AAExB,QAAM,iBAAiBC,MAAAA,OAAO,IAAI;AAElC,QAAM,EAAE,KAAK,aAAA,IAAiBC,kCAAA;AAC9B,QAAM,qBAAqBC,sBAAAA,8BAAA;AAE3BC,QAAAA,UAAU,MAAM;AACf,QAAI,CAAC,oBAAoB,CAAC,eAAe,SAAS;AACjD;AAAA,IACD;AACA,mBAAe,UAAU;AACxB,KAAC,YAAY;AACb,YAAM,WAAW,aAAA;AACjB,UAAI,CAAC,UAAU;AACd,iBAAS,EAAE,MAAM,mBAAmB,OAAO,uBAAuB;AAClE;AAAA,MACD;AAEA,YAAM,WAAW,MAAM,UAAU;AAAA,QAChC,MAAM;AAAA,UACL,KAAK,OAAO,SAAS;AAAA,UACrB,aAAa,eAAeC,wBAAA;AAAA,UAC5B,aAAa,SAAS;AAAA,QAAA;AAAA,QAEvB,kBAAkB,SAAS;AAAA,QAC3B;AAAA,MAAA,CACA;AACD,UAAI,CAAC,SAAS,IAAI;AACjB,iBAAS,EAAE,MAAM,mBAAmB,OAAO,SAAS,SAAS,iBAAiB;AAAA,MAC/E,OAAO;AACN,wBAAgB,SAAS,OAAO,KAAK;AACrC,iBAAS,EAAE,MAAM,WAAW;AAE5B,kBAAA;AACA,2BAAA;AAAA,MACD;AAAA,IACD,GAAA;AAAA,EACD,GAAG,CAAC,WAAW,SAAS,iBAAiB,kBAAkB,cAAc,YAAY,UAAU,oBAAoB,WAAW,CAAC;AAChI;;"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { useRef, useEffect } from "react";
|
|
2
|
+
import { useSetSessionToken } from "@contember/react-client";
|
|
3
|
+
import { useIDPStateStore } from "./useIDPStateStore.js";
|
|
4
|
+
import { getBaseHref } from "../utils/getBaseHref.js";
|
|
5
|
+
import { useRedirectToBacklinkCallback } from "./useRedirectToBacklink.js";
|
|
6
|
+
import { useSignInIDPMutation } from "../../hooks/mutations/idp/useSignInIdpMutation.js";
|
|
7
|
+
const headers = {
|
|
8
|
+
"X-Contember-Token-Path": "data.mutation.result.token"
|
|
9
|
+
};
|
|
10
|
+
const DEFAULT_LOGIN_EXPIRATION = 14 * 24 * 60;
|
|
11
|
+
const useHandleIDPResponse = ({ onLogin, expiration = DEFAULT_LOGIN_EXPIRATION, setState, hasOauthResponse, redirectUrl }) => {
|
|
12
|
+
const idpSignIn = useSignInIDPMutation({ headers });
|
|
13
|
+
const setSessionToken = useSetSessionToken();
|
|
14
|
+
const firstRenderRef = useRef(true);
|
|
15
|
+
const { get: loadIdpState } = useIDPStateStore();
|
|
16
|
+
const redirectToBackLink = useRedirectToBacklinkCallback();
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (!hasOauthResponse || !firstRenderRef.current) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
firstRenderRef.current = false;
|
|
22
|
+
(async () => {
|
|
23
|
+
const idpState = loadIdpState();
|
|
24
|
+
if (!idpState) {
|
|
25
|
+
setState({ type: "response_failed", error: "INVALID_LOCAL_STATE" });
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const response = await idpSignIn({
|
|
29
|
+
data: {
|
|
30
|
+
url: window.location.href,
|
|
31
|
+
redirectUrl: redirectUrl || getBaseHref(),
|
|
32
|
+
sessionData: idpState.sessionData
|
|
33
|
+
},
|
|
34
|
+
identityProvider: idpState.provider,
|
|
35
|
+
expiration
|
|
36
|
+
});
|
|
37
|
+
if (!response.ok) {
|
|
38
|
+
setState({ type: "response_failed", error: response.error || "UNKNOWN_ERROR" });
|
|
39
|
+
} else {
|
|
40
|
+
setSessionToken(response.result.token);
|
|
41
|
+
setState({ type: "success" });
|
|
42
|
+
onLogin?.();
|
|
43
|
+
redirectToBackLink();
|
|
44
|
+
}
|
|
45
|
+
})();
|
|
46
|
+
}, [idpSignIn, onLogin, setSessionToken, hasOauthResponse, loadIdpState, expiration, setState, redirectToBackLink, redirectUrl]);
|
|
47
|
+
};
|
|
48
|
+
export {
|
|
49
|
+
useHandleIDPResponse
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=useHandleIDPResponse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHandleIDPResponse.js","sources":["../../../../../../packages/react-client-tenant/src/internal/hooks/useHandleIDPResponse.ts"],"sourcesContent":["import { SetStateAction, useEffect, useRef } from 'react'\nimport { useSetSessionToken } from '@contember/react-client'\nimport { useIDPStateStore } from './useIDPStateStore'\nimport { getBaseHref } from '../utils/getBaseHref'\nimport { IDPStateValue } from '../../types/idp'\nimport { useSignInIDPMutation } from '../../hooks'\nimport { useRedirectToBacklinkCallback } from './useRedirectToBacklink'\n\nexport interface UseHandleIDPResponseProps {\n\tonLogin?: () => void\n\texpiration?: number\n\n\tsetState: (state: SetStateAction<IDPStateValue>) => void\n\thasOauthResponse: boolean\n\tredirectUrl?: string\n}\n\nconst headers = {\n\t'X-Contember-Token-Path': 'data.mutation.result.token',\n}\n\nconst DEFAULT_LOGIN_EXPIRATION = 14 * 24 * 60 // 14 days\n\nexport const useHandleIDPResponse = (\n\t{ onLogin, expiration = DEFAULT_LOGIN_EXPIRATION, setState, hasOauthResponse, redirectUrl }: UseHandleIDPResponseProps,\n): void => {\n\tconst idpSignIn = useSignInIDPMutation({ headers })\n\tconst setSessionToken = useSetSessionToken()\n\n\tconst firstRenderRef = useRef(true)\n\n\tconst { get: loadIdpState } = useIDPStateStore()\n\tconst redirectToBackLink = useRedirectToBacklinkCallback()\n\n\tuseEffect(() => {\n\t\tif (!hasOauthResponse || !firstRenderRef.current) {\n\t\t\treturn\n\t\t}\n\t\tfirstRenderRef.current = false\n\t\t;(async () => {\n\t\t\tconst idpState = loadIdpState()\n\t\t\tif (!idpState) {\n\t\t\t\tsetState({ type: 'response_failed', error: 'INVALID_LOCAL_STATE' })\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst response = await idpSignIn({\n\t\t\t\tdata: {\n\t\t\t\t\turl: window.location.href,\n\t\t\t\t\tredirectUrl: redirectUrl || getBaseHref(),\n\t\t\t\t\tsessionData: idpState.sessionData,\n\t\t\t\t},\n\t\t\t\tidentityProvider: idpState.provider,\n\t\t\t\texpiration,\n\t\t\t})\n\t\t\tif (!response.ok) {\n\t\t\t\tsetState({ type: 'response_failed', error: response.error || 'UNKNOWN_ERROR' })\n\t\t\t} else {\n\t\t\t\tsetSessionToken(response.result.token)\n\t\t\t\tsetState({ type: 'success' })\n\n\t\t\t\tonLogin?.()\n\t\t\t\tredirectToBackLink()\n\t\t\t}\n\t\t})()\n\t}, [idpSignIn, onLogin, setSessionToken, hasOauthResponse, loadIdpState, expiration, setState, redirectToBackLink, redirectUrl])\n}\n"],"names":[],"mappings":";;;;;;AAiBA,MAAM,UAAU;AAAA,EACf,0BAA0B;AAC3B;AAEA,MAAM,2BAA2B,KAAK,KAAK;AAEpC,MAAM,uBAAuB,CACnC,EAAE,SAAS,aAAa,0BAA0B,UAAU,kBAAkB,kBACpE;AACV,QAAM,YAAY,qBAAqB,EAAE,SAAS;AAClD,QAAM,kBAAkB,mBAAA;AAExB,QAAM,iBAAiB,OAAO,IAAI;AAElC,QAAM,EAAE,KAAK,aAAA,IAAiB,iBAAA;AAC9B,QAAM,qBAAqB,8BAAA;AAE3B,YAAU,MAAM;AACf,QAAI,CAAC,oBAAoB,CAAC,eAAe,SAAS;AACjD;AAAA,IACD;AACA,mBAAe,UAAU;AACxB,KAAC,YAAY;AACb,YAAM,WAAW,aAAA;AACjB,UAAI,CAAC,UAAU;AACd,iBAAS,EAAE,MAAM,mBAAmB,OAAO,uBAAuB;AAClE;AAAA,MACD;AAEA,YAAM,WAAW,MAAM,UAAU;AAAA,QAChC,MAAM;AAAA,UACL,KAAK,OAAO,SAAS;AAAA,UACrB,aAAa,eAAe,YAAA;AAAA,UAC5B,aAAa,SAAS;AAAA,QAAA;AAAA,QAEvB,kBAAkB,SAAS;AAAA,QAC3B;AAAA,MAAA,CACA;AACD,UAAI,CAAC,SAAS,IAAI;AACjB,iBAAS,EAAE,MAAM,mBAAmB,OAAO,SAAS,SAAS,iBAAiB;AAAA,MAC/E,OAAO;AACN,wBAAgB,SAAS,OAAO,KAAK;AACrC,iBAAS,EAAE,MAAM,WAAW;AAE5B,kBAAA;AACA,2BAAA;AAAA,MACD;AAAA,IACD,GAAA;AAAA,EACD,GAAG,CAAC,WAAW,SAAS,iBAAiB,kBAAkB,cAAc,YAAY,UAAU,oBAAoB,WAAW,CAAC;AAChI;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const React = require("react");
|
|
4
|
+
const useIDPAutoInitProvider = () => {
|
|
5
|
+
return React.useMemo(() => {
|
|
6
|
+
const params = new URLSearchParams(window.location.search);
|
|
7
|
+
const idp = params.get("idp");
|
|
8
|
+
if (idp !== null) {
|
|
9
|
+
return idp;
|
|
10
|
+
}
|
|
11
|
+
const backlink = params.get("backlink");
|
|
12
|
+
if (backlink !== null) {
|
|
13
|
+
const resolvedBacklink = new URL(backlink, window.location.href);
|
|
14
|
+
return resolvedBacklink.searchParams.get("idp");
|
|
15
|
+
}
|
|
16
|
+
}, []);
|
|
17
|
+
};
|
|
18
|
+
exports.useIDPAutoInitProvider = useIDPAutoInitProvider;
|
|
19
|
+
//# sourceMappingURL=useIDPAutoInit.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIDPAutoInit.cjs","sources":["../../../../../../packages/react-client-tenant/src/internal/hooks/useIDPAutoInit.ts"],"sourcesContent":["import { useMemo } from 'react'\n\nexport const useIDPAutoInitProvider = () => {\n\treturn useMemo(() => {\n\t\tconst params = new URLSearchParams(window.location.search)\n\t\tconst idp = params.get('idp')\n\t\tif (idp !== null) {\n\t\t\treturn idp\n\t\t}\n\t\tconst backlink = params.get('backlink')\n\n\t\tif (backlink !== null) {\n\t\t\tconst resolvedBacklink = new URL(backlink, window.location.href)\n\t\t\treturn resolvedBacklink.searchParams.get('idp')\n\t\t}\n\t}, [])\n}\n"],"names":["useMemo"],"mappings":";;;AAEO,MAAM,yBAAyB,MAAM;AAC3C,SAAOA,MAAAA,QAAQ,MAAM;AACpB,UAAM,SAAS,IAAI,gBAAgB,OAAO,SAAS,MAAM;AACzD,UAAM,MAAM,OAAO,IAAI,KAAK;AAC5B,QAAI,QAAQ,MAAM;AACjB,aAAO;AAAA,IACR;AACA,UAAM,WAAW,OAAO,IAAI,UAAU;AAEtC,QAAI,aAAa,MAAM;AACtB,YAAM,mBAAmB,IAAI,IAAI,UAAU,OAAO,SAAS,IAAI;AAC/D,aAAO,iBAAiB,aAAa,IAAI,KAAK;AAAA,IAC/C;AAAA,EACD,GAAG,CAAA,CAAE;AACN;;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
const useIDPAutoInitProvider = () => {
|
|
3
|
+
return useMemo(() => {
|
|
4
|
+
const params = new URLSearchParams(window.location.search);
|
|
5
|
+
const idp = params.get("idp");
|
|
6
|
+
if (idp !== null) {
|
|
7
|
+
return idp;
|
|
8
|
+
}
|
|
9
|
+
const backlink = params.get("backlink");
|
|
10
|
+
if (backlink !== null) {
|
|
11
|
+
const resolvedBacklink = new URL(backlink, window.location.href);
|
|
12
|
+
return resolvedBacklink.searchParams.get("idp");
|
|
13
|
+
}
|
|
14
|
+
}, []);
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
useIDPAutoInitProvider
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=useIDPAutoInit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIDPAutoInit.js","sources":["../../../../../../packages/react-client-tenant/src/internal/hooks/useIDPAutoInit.ts"],"sourcesContent":["import { useMemo } from 'react'\n\nexport const useIDPAutoInitProvider = () => {\n\treturn useMemo(() => {\n\t\tconst params = new URLSearchParams(window.location.search)\n\t\tconst idp = params.get('idp')\n\t\tif (idp !== null) {\n\t\t\treturn idp\n\t\t}\n\t\tconst backlink = params.get('backlink')\n\n\t\tif (backlink !== null) {\n\t\t\tconst resolvedBacklink = new URL(backlink, window.location.href)\n\t\t\treturn resolvedBacklink.searchParams.get('idp')\n\t\t}\n\t}, [])\n}\n"],"names":[],"mappings":";AAEO,MAAM,yBAAyB,MAAM;AAC3C,SAAO,QAAQ,MAAM;AACpB,UAAM,SAAS,IAAI,gBAAgB,OAAO,SAAS,MAAM;AACzD,UAAM,MAAM,OAAO,IAAI,KAAK;AAC5B,QAAI,QAAQ,MAAM;AACjB,aAAO;AAAA,IACR;AACA,UAAM,WAAW,OAAO,IAAI,UAAU;AAEtC,QAAI,aAAa,MAAM;AACtB,YAAM,mBAAmB,IAAI,IAAI,UAAU,OAAO,SAAS,IAAI;AAC/D,aAAO,iBAAiB,aAAa,IAAI,KAAK;AAAA,IAC/C;AAAA,EACD,GAAG,CAAA,CAAE;AACN;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const React = require("react");
|
|
4
|
+
const useIDPStateStore = () => {
|
|
5
|
+
return {
|
|
6
|
+
get: React.useCallback(() => {
|
|
7
|
+
const item = sessionStorage.getItem("idp");
|
|
8
|
+
if (!item) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
return JSON.parse(item);
|
|
12
|
+
}, []),
|
|
13
|
+
set: React.useCallback((state) => {
|
|
14
|
+
sessionStorage.setItem("idp", JSON.stringify(state));
|
|
15
|
+
}, [])
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
exports.useIDPStateStore = useIDPStateStore;
|
|
19
|
+
//# sourceMappingURL=useIDPStateStore.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIDPStateStore.cjs","sources":["../../../../../../packages/react-client-tenant/src/internal/hooks/useIDPStateStore.ts"],"sourcesContent":["import { useCallback } from 'react'\n\nexport type IDPState = { provider: string; sessionData: any }\n\nexport const useIDPStateStore = (): { get: () => IDPState | null; set: (state: IDPState) => void } => {\n\treturn {\n\t\tget: useCallback(() => {\n\t\t\tconst item = sessionStorage.getItem('idp')\n\t\t\tif (!item) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\treturn JSON.parse(item)\n\t\t}, []),\n\t\tset: useCallback((state: IDPState) => {\n\t\t\tsessionStorage.setItem('idp', JSON.stringify(state))\n\t\t}, []),\n\t}\n}\n"],"names":["useCallback"],"mappings":";;;AAIO,MAAM,mBAAmB,MAAsE;AACrG,SAAO;AAAA,IACN,KAAKA,MAAAA,YAAY,MAAM;AACtB,YAAM,OAAO,eAAe,QAAQ,KAAK;AACzC,UAAI,CAAC,MAAM;AACV,eAAO;AAAA,MACR;AACA,aAAO,KAAK,MAAM,IAAI;AAAA,IACvB,GAAG,CAAA,CAAE;AAAA,IACL,KAAKA,MAAAA,YAAY,CAAC,UAAoB;AACrC,qBAAe,QAAQ,OAAO,KAAK,UAAU,KAAK,CAAC;AAAA,IACpD,GAAG,CAAA,CAAE;AAAA,EAAA;AAEP;;"}
|