@contember/react-client-tenant 2.0.0-alpha.9 → 2.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/development/index.cjs +24 -0
- package/dist/development/index.cjs.map +1 -1
- package/dist/development/index.js +24 -0
- package/dist/development/index.js.map +1 -1
- package/dist/development/src/components/IdentityProvider.cjs.map +1 -1
- package/dist/development/src/components/IdentityProvider.js.map +1 -1
- package/dist/development/src/components/IdentityState.cjs.map +1 -1
- package/dist/development/src/components/IdentityState.js.map +1 -1
- package/dist/development/src/components/forms/ChangeMyPasswordForm.cjs.map +1 -1
- package/dist/development/src/components/forms/ChangeMyPasswordForm.js.map +1 -1
- package/dist/development/src/components/forms/CreateApiKeyForm.cjs.map +1 -1
- package/dist/development/src/components/forms/CreateApiKeyForm.js.map +1 -1
- package/dist/development/src/components/forms/CreateSessionTokenForm.cjs.map +1 -1
- package/dist/development/src/components/forms/CreateSessionTokenForm.js.map +1 -1
- package/dist/development/src/components/forms/InviteForm.cjs.map +1 -1
- package/dist/development/src/components/forms/InviteForm.js.map +1 -1
- package/dist/development/src/components/forms/LoginForm.cjs +1 -1
- package/dist/development/src/components/forms/LoginForm.cjs.map +1 -1
- package/dist/development/src/components/forms/LoginForm.js +1 -1
- package/dist/development/src/components/forms/LoginForm.js.map +1 -1
- package/dist/development/src/components/forms/OtpConfirmForm.cjs.map +1 -1
- package/dist/development/src/components/forms/OtpConfirmForm.js.map +1 -1
- package/dist/development/src/components/forms/OtpPrepareForm.cjs.map +1 -1
- package/dist/development/src/components/forms/OtpPrepareForm.js.map +1 -1
- package/dist/development/src/components/forms/PasswordResetForm.cjs +2 -1
- package/dist/development/src/components/forms/PasswordResetForm.cjs.map +1 -1
- package/dist/development/src/components/forms/PasswordResetForm.js +2 -1
- package/dist/development/src/components/forms/PasswordResetForm.js.map +1 -1
- package/dist/development/src/components/forms/PasswordResetRequestForm.cjs.map +1 -1
- package/dist/development/src/components/forms/PasswordResetRequestForm.js.map +1 -1
- 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 +54 -0
- package/dist/development/src/components/forms/PasswordlessSignInInitForm.cjs.map +1 -0
- package/dist/development/src/components/forms/PasswordlessSignInInitForm.js +54 -0
- package/dist/development/src/components/forms/PasswordlessSignInInitForm.js.map +1 -0
- package/dist/development/src/components/forms/TenantForm.cjs.map +1 -1
- package/dist/development/src/components/forms/TenantForm.js.map +1 -1
- package/dist/development/src/components/forms/UpdateProjectMemberForm.cjs.map +1 -1
- package/dist/development/src/components/forms/UpdateProjectMemberForm.js.map +1 -1
- package/dist/development/src/components/idp/IDP.cjs.map +1 -1
- package/dist/development/src/components/idp/IDP.js.map +1 -1
- package/dist/development/src/components/idp/IDPInitTrigger.cjs.map +1 -1
- package/dist/development/src/components/idp/IDPInitTrigger.js.map +1 -1
- package/dist/development/src/components/idp/IDPState.cjs.map +1 -1
- package/dist/development/src/components/idp/IDPState.js.map +1 -1
- package/dist/development/src/components/triggers/DisableOtpTrigger.cjs.map +1 -1
- package/dist/development/src/components/triggers/DisableOtpTrigger.js.map +1 -1
- package/dist/development/src/components/triggers/LogoutTrigger.cjs.map +1 -1
- package/dist/development/src/components/triggers/LogoutTrigger.js.map +1 -1
- package/dist/development/src/components/triggers/RemoveProjectMemberTrigger.cjs.map +1 -1
- package/dist/development/src/components/triggers/RemoveProjectMemberTrigger.js.map +1 -1
- package/dist/development/src/components/triggers/TenantActionTrigger.cjs.map +1 -1
- package/dist/development/src/components/triggers/TenantActionTrigger.js.map +1 -1
- 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.map +1 -1
- package/dist/development/src/hooks/mutations/apiKey/useCreateSessionTokenMutation.cjs +1 -1
- package/dist/development/src/hooks/mutations/apiKey/useCreateSessionTokenMutation.cjs.map +1 -1
- package/dist/development/src/hooks/mutations/apiKey/useCreateSessionTokenMutation.js +1 -1
- package/dist/development/src/hooks/mutations/apiKey/useCreateSessionTokenMutation.js.map +1 -1
- package/dist/development/src/hooks/mutations/auth/useSignInMutation.cjs +1 -1
- package/dist/development/src/hooks/mutations/auth/useSignInMutation.cjs.map +1 -1
- package/dist/development/src/hooks/mutations/auth/useSignInMutation.js +1 -1
- package/dist/development/src/hooks/mutations/auth/useSignInMutation.js.map +1 -1
- package/dist/development/src/hooks/mutations/idp/useInitSignInIDPMutation.cjs +1 -1
- package/dist/development/src/hooks/mutations/idp/useInitSignInIDPMutation.cjs.map +1 -1
- package/dist/development/src/hooks/mutations/idp/useInitSignInIDPMutation.js +1 -1
- package/dist/development/src/hooks/mutations/idp/useInitSignInIDPMutation.js.map +1 -1
- package/dist/development/src/hooks/mutations/idp/useSignInIdpMutation.cjs +1 -1
- package/dist/development/src/hooks/mutations/idp/useSignInIdpMutation.cjs.map +1 -1
- package/dist/development/src/hooks/mutations/idp/useSignInIdpMutation.js +1 -1
- package/dist/development/src/hooks/mutations/idp/useSignInIdpMutation.js.map +1 -1
- package/dist/development/src/hooks/mutations/invite/useInviteMutation.cjs +1 -1
- package/dist/development/src/hooks/mutations/invite/useInviteMutation.cjs.map +1 -1
- package/dist/development/src/hooks/mutations/invite/useInviteMutation.js +1 -1
- package/dist/development/src/hooks/mutations/invite/useInviteMutation.js.map +1 -1
- package/dist/development/src/hooks/mutations/passwordReset/useCreateResetPasswordRequestMutation.cjs.map +1 -1
- package/dist/development/src/hooks/mutations/passwordReset/useResetPasswordMutation.cjs.map +1 -1
- 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 +1 -1
- package/dist/development/src/hooks/queries/useMeQuery.cjs.map +1 -1
- package/dist/development/src/hooks/queries/useMeQuery.js +1 -1
- package/dist/development/src/hooks/queries/useMeQuery.js.map +1 -1
- package/dist/development/src/hooks/queries/useProjectMembersQuery.cjs +1 -1
- package/dist/development/src/hooks/queries/useProjectMembersQuery.cjs.map +1 -1
- package/dist/development/src/hooks/queries/useProjectMembersQuery.js +1 -1
- package/dist/development/src/hooks/queries/useProjectMembersQuery.js.map +1 -1
- package/dist/development/src/hooks/queries/useProjectMembershipsQuery.cjs.map +1 -1
- package/dist/development/src/hooks/queries/useProjectMembershipsQuery.js.map +1 -1
- package/dist/development/src/hooks/queries/useProjectRolesDefinitionQuery.cjs.map +1 -1
- package/dist/development/src/hooks/queries/useProjectRolesDefinitionQuery.js.map +1 -1
- package/dist/development/src/hooks/useFetchIdentity.cjs +2 -2
- package/dist/development/src/hooks/useFetchIdentity.cjs.map +1 -1
- package/dist/development/src/hooks/useFetchIdentity.js +3 -3
- package/dist/development/src/hooks/useFetchIdentity.js.map +1 -1
- package/dist/development/src/hooks/useLogout.cjs.map +1 -1
- package/dist/development/src/hooks/useLogout.js.map +1 -1
- 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.map +1 -1
- package/dist/development/src/hooks/useTenantApi.js.map +1 -1
- package/dist/development/src/hooks/useTenantMutation.cjs.map +1 -1
- package/dist/development/src/hooks/useTenantMutation.js.map +1 -1
- package/dist/development/src/hooks/useTenantQueryLoader.cjs.map +1 -1
- package/dist/development/src/hooks/useTenantQueryLoader.js.map +1 -1
- package/dist/development/src/internal/hooks/useHandleIDPResponse.cjs +1 -1
- package/dist/development/src/internal/hooks/useHandleIDPResponse.cjs.map +1 -1
- package/dist/development/src/internal/hooks/useHandleIDPResponse.js +1 -1
- package/dist/development/src/internal/hooks/useHandleIDPResponse.js.map +1 -1
- package/dist/development/src/internal/hooks/useIDPAutoInit.cjs.map +1 -1
- package/dist/development/src/internal/hooks/useIDPAutoInit.js.map +1 -1
- package/dist/development/src/internal/hooks/useIDPStateStore.cjs.map +1 -1
- package/dist/development/src/internal/hooks/useIDPStateStore.js.map +1 -1
- package/dist/development/src/internal/hooks/useInitIDPRedirect.cjs.map +1 -1
- package/dist/development/src/internal/hooks/useInitIDPRedirect.js.map +1 -1
- package/dist/development/src/internal/hooks/useLogoutInternal.cjs.map +1 -1
- package/dist/development/src/internal/hooks/useLogoutInternal.js.map +1 -1
- package/dist/development/src/internal/hooks/useRedirectToBacklink.cjs.map +1 -1
- package/dist/development/src/internal/hooks/useRedirectToBacklink.js.map +1 -1
- 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 +24 -0
- package/dist/production/index.cjs.map +1 -1
- package/dist/production/index.js +24 -0
- package/dist/production/index.js.map +1 -1
- package/dist/production/src/components/IdentityProvider.cjs.map +1 -1
- package/dist/production/src/components/IdentityProvider.js.map +1 -1
- package/dist/production/src/components/IdentityState.cjs.map +1 -1
- package/dist/production/src/components/IdentityState.js.map +1 -1
- package/dist/production/src/components/forms/ChangeMyPasswordForm.cjs.map +1 -1
- package/dist/production/src/components/forms/ChangeMyPasswordForm.js.map +1 -1
- package/dist/production/src/components/forms/CreateApiKeyForm.cjs.map +1 -1
- package/dist/production/src/components/forms/CreateApiKeyForm.js.map +1 -1
- package/dist/production/src/components/forms/CreateSessionTokenForm.cjs.map +1 -1
- package/dist/production/src/components/forms/CreateSessionTokenForm.js.map +1 -1
- package/dist/production/src/components/forms/InviteForm.cjs.map +1 -1
- package/dist/production/src/components/forms/InviteForm.js.map +1 -1
- package/dist/production/src/components/forms/LoginForm.cjs +1 -1
- package/dist/production/src/components/forms/LoginForm.cjs.map +1 -1
- package/dist/production/src/components/forms/LoginForm.js +1 -1
- package/dist/production/src/components/forms/LoginForm.js.map +1 -1
- package/dist/production/src/components/forms/OtpConfirmForm.cjs.map +1 -1
- package/dist/production/src/components/forms/OtpConfirmForm.js.map +1 -1
- package/dist/production/src/components/forms/OtpPrepareForm.cjs.map +1 -1
- package/dist/production/src/components/forms/OtpPrepareForm.js.map +1 -1
- package/dist/production/src/components/forms/PasswordResetForm.cjs +2 -1
- package/dist/production/src/components/forms/PasswordResetForm.cjs.map +1 -1
- package/dist/production/src/components/forms/PasswordResetForm.js +2 -1
- package/dist/production/src/components/forms/PasswordResetForm.js.map +1 -1
- package/dist/production/src/components/forms/PasswordResetRequestForm.cjs.map +1 -1
- package/dist/production/src/components/forms/PasswordResetRequestForm.js.map +1 -1
- 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 +46 -0
- package/dist/production/src/components/forms/PasswordlessSignInInitForm.cjs.map +1 -0
- package/dist/production/src/components/forms/PasswordlessSignInInitForm.js +46 -0
- package/dist/production/src/components/forms/PasswordlessSignInInitForm.js.map +1 -0
- package/dist/production/src/components/forms/TenantForm.cjs.map +1 -1
- package/dist/production/src/components/forms/TenantForm.js.map +1 -1
- package/dist/production/src/components/forms/UpdateProjectMemberForm.cjs.map +1 -1
- package/dist/production/src/components/forms/UpdateProjectMemberForm.js.map +1 -1
- package/dist/production/src/components/idp/IDP.cjs.map +1 -1
- package/dist/production/src/components/idp/IDP.js.map +1 -1
- package/dist/production/src/components/idp/IDPInitTrigger.cjs.map +1 -1
- package/dist/production/src/components/idp/IDPInitTrigger.js.map +1 -1
- package/dist/production/src/components/idp/IDPState.cjs.map +1 -1
- package/dist/production/src/components/idp/IDPState.js.map +1 -1
- package/dist/production/src/components/triggers/DisableOtpTrigger.cjs.map +1 -1
- package/dist/production/src/components/triggers/DisableOtpTrigger.js.map +1 -1
- package/dist/production/src/components/triggers/LogoutTrigger.cjs.map +1 -1
- package/dist/production/src/components/triggers/LogoutTrigger.js.map +1 -1
- package/dist/production/src/components/triggers/RemoveProjectMemberTrigger.cjs.map +1 -1
- package/dist/production/src/components/triggers/RemoveProjectMemberTrigger.js.map +1 -1
- package/dist/production/src/components/triggers/TenantActionTrigger.cjs.map +1 -1
- package/dist/production/src/components/triggers/TenantActionTrigger.js.map +1 -1
- 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.map +1 -1
- package/dist/production/src/hooks/mutations/apiKey/useCreateSessionTokenMutation.cjs +1 -1
- package/dist/production/src/hooks/mutations/apiKey/useCreateSessionTokenMutation.cjs.map +1 -1
- package/dist/production/src/hooks/mutations/apiKey/useCreateSessionTokenMutation.js +1 -1
- package/dist/production/src/hooks/mutations/apiKey/useCreateSessionTokenMutation.js.map +1 -1
- package/dist/production/src/hooks/mutations/auth/useSignInMutation.cjs +1 -1
- package/dist/production/src/hooks/mutations/auth/useSignInMutation.cjs.map +1 -1
- package/dist/production/src/hooks/mutations/auth/useSignInMutation.js +1 -1
- package/dist/production/src/hooks/mutations/auth/useSignInMutation.js.map +1 -1
- package/dist/production/src/hooks/mutations/idp/useInitSignInIDPMutation.cjs +1 -1
- package/dist/production/src/hooks/mutations/idp/useInitSignInIDPMutation.cjs.map +1 -1
- package/dist/production/src/hooks/mutations/idp/useInitSignInIDPMutation.js +1 -1
- package/dist/production/src/hooks/mutations/idp/useInitSignInIDPMutation.js.map +1 -1
- package/dist/production/src/hooks/mutations/idp/useSignInIdpMutation.cjs +1 -1
- package/dist/production/src/hooks/mutations/idp/useSignInIdpMutation.cjs.map +1 -1
- package/dist/production/src/hooks/mutations/idp/useSignInIdpMutation.js +1 -1
- package/dist/production/src/hooks/mutations/idp/useSignInIdpMutation.js.map +1 -1
- package/dist/production/src/hooks/mutations/invite/useInviteMutation.cjs +1 -1
- package/dist/production/src/hooks/mutations/invite/useInviteMutation.cjs.map +1 -1
- package/dist/production/src/hooks/mutations/invite/useInviteMutation.js +1 -1
- package/dist/production/src/hooks/mutations/invite/useInviteMutation.js.map +1 -1
- package/dist/production/src/hooks/mutations/passwordReset/useCreateResetPasswordRequestMutation.cjs.map +1 -1
- package/dist/production/src/hooks/mutations/passwordReset/useResetPasswordMutation.cjs.map +1 -1
- 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 +1 -1
- package/dist/production/src/hooks/queries/useMeQuery.cjs.map +1 -1
- package/dist/production/src/hooks/queries/useMeQuery.js +1 -1
- package/dist/production/src/hooks/queries/useMeQuery.js.map +1 -1
- package/dist/production/src/hooks/queries/useProjectMembersQuery.cjs +1 -1
- package/dist/production/src/hooks/queries/useProjectMembersQuery.cjs.map +1 -1
- package/dist/production/src/hooks/queries/useProjectMembersQuery.js +1 -1
- package/dist/production/src/hooks/queries/useProjectMembersQuery.js.map +1 -1
- package/dist/production/src/hooks/queries/useProjectMembershipsQuery.cjs.map +1 -1
- package/dist/production/src/hooks/queries/useProjectMembershipsQuery.js.map +1 -1
- package/dist/production/src/hooks/queries/useProjectRolesDefinitionQuery.cjs.map +1 -1
- package/dist/production/src/hooks/queries/useProjectRolesDefinitionQuery.js.map +1 -1
- package/dist/production/src/hooks/useFetchIdentity.cjs +2 -2
- package/dist/production/src/hooks/useFetchIdentity.cjs.map +1 -1
- package/dist/production/src/hooks/useFetchIdentity.js +3 -3
- package/dist/production/src/hooks/useFetchIdentity.js.map +1 -1
- package/dist/production/src/hooks/useLogout.cjs.map +1 -1
- package/dist/production/src/hooks/useLogout.js.map +1 -1
- 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.map +1 -1
- package/dist/production/src/hooks/useTenantApi.js.map +1 -1
- package/dist/production/src/hooks/useTenantMutation.cjs.map +1 -1
- package/dist/production/src/hooks/useTenantMutation.js.map +1 -1
- package/dist/production/src/hooks/useTenantQueryLoader.cjs.map +1 -1
- package/dist/production/src/hooks/useTenantQueryLoader.js.map +1 -1
- package/dist/production/src/internal/hooks/useHandleIDPResponse.cjs +1 -1
- package/dist/production/src/internal/hooks/useHandleIDPResponse.cjs.map +1 -1
- package/dist/production/src/internal/hooks/useHandleIDPResponse.js +1 -1
- package/dist/production/src/internal/hooks/useHandleIDPResponse.js.map +1 -1
- package/dist/production/src/internal/hooks/useIDPAutoInit.cjs.map +1 -1
- package/dist/production/src/internal/hooks/useIDPAutoInit.js.map +1 -1
- package/dist/production/src/internal/hooks/useIDPStateStore.cjs.map +1 -1
- package/dist/production/src/internal/hooks/useIDPStateStore.js.map +1 -1
- package/dist/production/src/internal/hooks/useInitIDPRedirect.cjs.map +1 -1
- package/dist/production/src/internal/hooks/useInitIDPRedirect.js.map +1 -1
- package/dist/production/src/internal/hooks/useLogoutInternal.cjs.map +1 -1
- package/dist/production/src/internal/hooks/useLogoutInternal.js.map +1 -1
- package/dist/production/src/internal/hooks/useRedirectToBacklink.cjs.map +1 -1
- package/dist/production/src/internal/hooks/useRedirectToBacklink.js.map +1 -1
- 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/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/index.d.ts +2 -0
- package/dist/types/components/forms/index.d.ts.map +1 -1
- package/dist/types/consts.d.ts +2 -0
- package/dist/types/consts.d.ts.map +1 -0
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/hooks/index.d.ts.map +1 -1
- package/dist/types/hooks/mutations/apiKey/useCreateSessionTokenMutation.d.ts +0 -6
- package/dist/types/hooks/mutations/apiKey/useCreateSessionTokenMutation.d.ts.map +1 -1
- package/dist/types/hooks/mutations/auth/useSignInMutation.d.ts +0 -6
- package/dist/types/hooks/mutations/auth/useSignInMutation.d.ts.map +1 -1
- package/dist/types/hooks/mutations/idp/useSignInIdpMutation.d.ts +6 -6
- package/dist/types/hooks/mutations/idp/useSignInIdpMutation.d.ts.map +1 -1
- package/dist/types/hooks/mutations/index.d.ts +2 -0
- package/dist/types/hooks/mutations/index.d.ts.map +1 -1
- package/dist/types/hooks/mutations/invite/useInviteMutation.d.ts +0 -6
- package/dist/types/hooks/mutations/invite/useInviteMutation.d.ts.map +1 -1
- 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/usePasswordlessOtpActivator.d.ts +19 -0
- package/dist/types/hooks/usePasswordlessOtpActivator.d.ts.map +1 -0
- package/dist/types/hooks/useTenantMutation.d.ts.map +1 -1
- 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 -1
- package/dist/types/types/Identity.d.ts +1 -0
- package/dist/types/types/Identity.d.ts.map +1 -1
- package/package.json +8 -7
- package/src/components/forms/LoginForm.tsx +1 -1
- package/src/components/forms/PasswordResetForm.tsx +1 -0
- package/src/components/forms/PasswordlessSignInForm.tsx +102 -0
- package/src/components/forms/PasswordlessSignInInitForm.tsx +68 -0
- package/src/components/forms/index.ts +2 -0
- package/src/consts.ts +1 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/mutations/apiKey/useCreateSessionTokenMutation.tsx +1 -1
- package/src/hooks/mutations/auth/useSignInMutation.ts +1 -1
- package/src/hooks/mutations/idp/useInitSignInIDPMutation.ts +1 -1
- package/src/hooks/mutations/idp/useSignInIdpMutation.ts +1 -1
- package/src/hooks/mutations/index.ts +2 -0
- package/src/hooks/mutations/invite/useInviteMutation.tsx +1 -1
- package/src/hooks/mutations/passwordless/index.ts +5 -0
- package/src/hooks/mutations/passwordless/useActivatePasswordlessOtpMutation.ts +19 -0
- package/src/hooks/mutations/passwordless/useDisableMyPasswordlessMutation.ts +14 -0
- package/src/hooks/mutations/passwordless/useEnableMyPasswordlessMutation.ts +14 -0
- package/src/hooks/mutations/passwordless/useInitSignInPasswordlessMutation.ts +22 -0
- package/src/hooks/mutations/passwordless/useSignInPasswordlessMutation.ts +24 -0
- package/src/hooks/mutations/profile/index.ts +2 -0
- package/src/hooks/mutations/profile/useChangeMyProfile.ts +13 -0
- package/src/hooks/mutations/profile/useChangeProfile.ts +13 -0
- package/src/hooks/queries/useMeQuery.ts +1 -1
- package/src/hooks/queries/useProjectMembersQuery.ts +1 -1
- package/src/hooks/useFetchIdentity.ts +3 -3
- package/src/hooks/usePasswordlessOtpActivator.ts +66 -0
- package/src/internal/hooks/useHandleIDPResponse.ts +1 -1
- package/src/internal/utils/hashing.ts +4 -0
- package/src/internal/utils/randomInt.ts +30 -0
- package/src/types/Identity.ts +1 -0
package/dist/development/src/hooks/mutations/passwordless/useInitSignInPasswordlessMutation.cjs
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const TenantApi = require("@contember/graphql-client-tenant");
|
|
4
|
+
const useTenantApi = require("../../useTenantApi.cjs");
|
|
5
|
+
const useTenantMutation = require("../../useTenantMutation.cjs");
|
|
6
|
+
function _interopNamespaceDefault(e) {
|
|
7
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
8
|
+
if (e) {
|
|
9
|
+
for (const k in e) {
|
|
10
|
+
if (k !== "default") {
|
|
11
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
12
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: () => e[k]
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
n.default = e;
|
|
20
|
+
return Object.freeze(n);
|
|
21
|
+
}
|
|
22
|
+
const TenantApi__namespace = /* @__PURE__ */ _interopNamespaceDefault(TenantApi);
|
|
23
|
+
const InitSignInPasswordlessMutationResult = TenantApi__namespace.initSignInPasswordlessResult$$;
|
|
24
|
+
const InitSignInPasswordlessMutation = TenantApi__namespace.mutation$.initSignInPasswordless(
|
|
25
|
+
TenantApi__namespace.initSignInPasswordlessResponse$$.error(TenantApi__namespace.initSignInPasswordlessError$$).result(InitSignInPasswordlessMutationResult),
|
|
26
|
+
(options) => options.alias("mutation")
|
|
27
|
+
);
|
|
28
|
+
const useInitSignInPasswordlessMutation = useTenantMutation.createTenantMutation(InitSignInPasswordlessMutation, {
|
|
29
|
+
apiToken: useTenantApi.LoginToken
|
|
30
|
+
});
|
|
31
|
+
exports.useInitSignInPasswordlessMutation = useInitSignInPasswordlessMutation;
|
|
32
|
+
//# sourceMappingURL=useInitSignInPasswordlessMutation.cjs.map
|
package/dist/development/src/hooks/mutations/passwordless/useInitSignInPasswordlessMutation.cjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInitSignInPasswordlessMutation.cjs","sources":["../../../../../../../packages/react-client-tenant/src/hooks/mutations/passwordless/useInitSignInPasswordlessMutation.ts"],"sourcesContent":["import * as TenantApi from '@contember/graphql-client-tenant'\nimport { LoginToken } from '../../useTenantApi'\nimport { createTenantMutation } from '../../useTenantMutation'\nimport { ModelType } from 'graphql-ts-client-api'\n\nconst InitSignInPasswordlessMutationResult = TenantApi.initSignInPasswordlessResult$$\nexport type InitSignInPasswordlessMutationResult = ModelType<typeof InitSignInPasswordlessMutationResult>\nconst InitSignInPasswordlessMutation = TenantApi\n\t.mutation$\n\t.initSignInPasswordless(\n\t\tTenantApi\n\t\t\t.initSignInPasswordlessResponse$$\n\t\t\t.error(TenantApi.initSignInPasswordlessError$$)\n\t\t\t.result(InitSignInPasswordlessMutationResult),\n\t\toptions => options.alias('mutation'),\n\t)\n\nexport const useInitSignInPasswordlessMutation = createTenantMutation(InitSignInPasswordlessMutation, {\n\tapiToken: LoginToken,\n})\n\nexport type InitSignInPasswordlessMutationVariables = Parameters<ReturnType<typeof useInitSignInPasswordlessMutation>>[0]\n"],"names":["TenantApi","createTenantMutation","LoginToken"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAKA,MAAM,uCAAuCA,qBAAU;AAEvD,MAAM,iCAAiCA,qBACrC,UACA;AAAA,EACAA,qBACE,iCACA,MAAMA,qBAAU,6BAA6B,EAC7C,OAAO,oCAAoC;AAAA,EAC7C,CAAA,YAAW,QAAQ,MAAM,UAAU;AACpC;AAEY,MAAA,oCAAoCC,uCAAqB,gCAAgC;AAAA,EACrG,UAAUC,aAAAA;AACX,CAAC;;"}
|
package/dist/development/src/hooks/mutations/passwordless/useInitSignInPasswordlessMutation.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as TenantApi from "@contember/graphql-client-tenant";
|
|
2
|
+
import { LoginToken } from "../../useTenantApi.js";
|
|
3
|
+
import { createTenantMutation } from "../../useTenantMutation.js";
|
|
4
|
+
const InitSignInPasswordlessMutationResult = TenantApi.initSignInPasswordlessResult$$;
|
|
5
|
+
const InitSignInPasswordlessMutation = TenantApi.mutation$.initSignInPasswordless(
|
|
6
|
+
TenantApi.initSignInPasswordlessResponse$$.error(TenantApi.initSignInPasswordlessError$$).result(InitSignInPasswordlessMutationResult),
|
|
7
|
+
(options) => options.alias("mutation")
|
|
8
|
+
);
|
|
9
|
+
const useInitSignInPasswordlessMutation = createTenantMutation(InitSignInPasswordlessMutation, {
|
|
10
|
+
apiToken: LoginToken
|
|
11
|
+
});
|
|
12
|
+
export {
|
|
13
|
+
useInitSignInPasswordlessMutation
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=useInitSignInPasswordlessMutation.js.map
|
package/dist/development/src/hooks/mutations/passwordless/useInitSignInPasswordlessMutation.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInitSignInPasswordlessMutation.js","sources":["../../../../../../../packages/react-client-tenant/src/hooks/mutations/passwordless/useInitSignInPasswordlessMutation.ts"],"sourcesContent":["import * as TenantApi from '@contember/graphql-client-tenant'\nimport { LoginToken } from '../../useTenantApi'\nimport { createTenantMutation } from '../../useTenantMutation'\nimport { ModelType } from 'graphql-ts-client-api'\n\nconst InitSignInPasswordlessMutationResult = TenantApi.initSignInPasswordlessResult$$\nexport type InitSignInPasswordlessMutationResult = ModelType<typeof InitSignInPasswordlessMutationResult>\nconst InitSignInPasswordlessMutation = TenantApi\n\t.mutation$\n\t.initSignInPasswordless(\n\t\tTenantApi\n\t\t\t.initSignInPasswordlessResponse$$\n\t\t\t.error(TenantApi.initSignInPasswordlessError$$)\n\t\t\t.result(InitSignInPasswordlessMutationResult),\n\t\toptions => options.alias('mutation'),\n\t)\n\nexport const useInitSignInPasswordlessMutation = createTenantMutation(InitSignInPasswordlessMutation, {\n\tapiToken: LoginToken,\n})\n\nexport type InitSignInPasswordlessMutationVariables = Parameters<ReturnType<typeof useInitSignInPasswordlessMutation>>[0]\n"],"names":[],"mappings":";;;AAKA,MAAM,uCAAuC,UAAU;AAEvD,MAAM,iCAAiC,UACrC,UACA;AAAA,EACA,UACE,iCACA,MAAM,UAAU,6BAA6B,EAC7C,OAAO,oCAAoC;AAAA,EAC7C,CAAA,YAAW,QAAQ,MAAM,UAAU;AACpC;AAEY,MAAA,oCAAoC,qBAAqB,gCAAgC;AAAA,EACrG,UAAU;AACX,CAAC;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const TenantApi = require("@contember/graphql-client-tenant");
|
|
4
|
+
const useTenantApi = require("../../useTenantApi.cjs");
|
|
5
|
+
const useTenantMutation = require("../../useTenantMutation.cjs");
|
|
6
|
+
function _interopNamespaceDefault(e) {
|
|
7
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
8
|
+
if (e) {
|
|
9
|
+
for (const k in e) {
|
|
10
|
+
if (k !== "default") {
|
|
11
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
12
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: () => e[k]
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
n.default = e;
|
|
20
|
+
return Object.freeze(n);
|
|
21
|
+
}
|
|
22
|
+
const TenantApi__namespace = /* @__PURE__ */ _interopNamespaceDefault(TenantApi);
|
|
23
|
+
const signInResultFragment = TenantApi__namespace.signInPasswordlessResult$$.person(TenantApi__namespace.person$.id.email.name);
|
|
24
|
+
const SignInPasswordlessMutation = TenantApi__namespace.mutation$.signInPasswordless(
|
|
25
|
+
TenantApi__namespace.signInPasswordlessResponse$$.error(TenantApi__namespace.signInPasswordlessError$$).result(signInResultFragment),
|
|
26
|
+
(options) => options.alias("mutation")
|
|
27
|
+
);
|
|
28
|
+
const useSignInPasswordlessMutation = useTenantMutation.createTenantMutation(SignInPasswordlessMutation, {
|
|
29
|
+
apiToken: useTenantApi.LoginToken
|
|
30
|
+
});
|
|
31
|
+
exports.useSignInPasswordlessMutation = useSignInPasswordlessMutation;
|
|
32
|
+
//# sourceMappingURL=useSignInPasswordlessMutation.cjs.map
|
package/dist/development/src/hooks/mutations/passwordless/useSignInPasswordlessMutation.cjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSignInPasswordlessMutation.cjs","sources":["../../../../../../../packages/react-client-tenant/src/hooks/mutations/passwordless/useSignInPasswordlessMutation.ts"],"sourcesContent":["import * as TenantApi from '@contember/graphql-client-tenant'\nimport { LoginToken } from '../../useTenantApi'\nimport { createTenantMutation } from '../../useTenantMutation'\nimport { ModelType } from 'graphql-ts-client-api'\n\nconst signInResultFragment = TenantApi.signInPasswordlessResult$$.person(TenantApi.person$.id.email.name)\n\nexport type SignInPasswordlessMutationResult = ModelType<typeof signInResultFragment>\n\nconst SignInPasswordlessMutation = TenantApi\n\t.mutation$\n\t.signInPasswordless(\n\t\tTenantApi\n\t\t\t.signInPasswordlessResponse$$\n\t\t\t.error(TenantApi.signInPasswordlessError$$)\n\t\t\t.result(signInResultFragment),\n\t\toptions => options.alias('mutation'),\n\t)\n\nexport const useSignInPasswordlessMutation = createTenantMutation(SignInPasswordlessMutation, {\n\tapiToken: LoginToken,\n})\n\nexport type SignInPasswordlessMutationVariables = Parameters<ReturnType<typeof useSignInPasswordlessMutation>>[0]\n"],"names":["TenantApi","createTenantMutation","LoginToken"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAKA,MAAM,uBAAuBA,qBAAU,2BAA2B,OAAOA,qBAAU,QAAQ,GAAG,MAAM,IAAI;AAIxG,MAAM,6BAA6BA,qBACjC,UACA;AAAA,EACAA,qBACE,6BACA,MAAMA,qBAAU,yBAAyB,EACzC,OAAO,oBAAoB;AAAA,EAC7B,CAAA,YAAW,QAAQ,MAAM,UAAU;AACpC;AAEY,MAAA,gCAAgCC,uCAAqB,4BAA4B;AAAA,EAC7F,UAAUC,aAAAA;AACX,CAAC;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as TenantApi from "@contember/graphql-client-tenant";
|
|
2
|
+
import { LoginToken } from "../../useTenantApi.js";
|
|
3
|
+
import { createTenantMutation } from "../../useTenantMutation.js";
|
|
4
|
+
const signInResultFragment = TenantApi.signInPasswordlessResult$$.person(TenantApi.person$.id.email.name);
|
|
5
|
+
const SignInPasswordlessMutation = TenantApi.mutation$.signInPasswordless(
|
|
6
|
+
TenantApi.signInPasswordlessResponse$$.error(TenantApi.signInPasswordlessError$$).result(signInResultFragment),
|
|
7
|
+
(options) => options.alias("mutation")
|
|
8
|
+
);
|
|
9
|
+
const useSignInPasswordlessMutation = createTenantMutation(SignInPasswordlessMutation, {
|
|
10
|
+
apiToken: LoginToken
|
|
11
|
+
});
|
|
12
|
+
export {
|
|
13
|
+
useSignInPasswordlessMutation
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=useSignInPasswordlessMutation.js.map
|
package/dist/development/src/hooks/mutations/passwordless/useSignInPasswordlessMutation.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSignInPasswordlessMutation.js","sources":["../../../../../../../packages/react-client-tenant/src/hooks/mutations/passwordless/useSignInPasswordlessMutation.ts"],"sourcesContent":["import * as TenantApi from '@contember/graphql-client-tenant'\nimport { LoginToken } from '../../useTenantApi'\nimport { createTenantMutation } from '../../useTenantMutation'\nimport { ModelType } from 'graphql-ts-client-api'\n\nconst signInResultFragment = TenantApi.signInPasswordlessResult$$.person(TenantApi.person$.id.email.name)\n\nexport type SignInPasswordlessMutationResult = ModelType<typeof signInResultFragment>\n\nconst SignInPasswordlessMutation = TenantApi\n\t.mutation$\n\t.signInPasswordless(\n\t\tTenantApi\n\t\t\t.signInPasswordlessResponse$$\n\t\t\t.error(TenantApi.signInPasswordlessError$$)\n\t\t\t.result(signInResultFragment),\n\t\toptions => options.alias('mutation'),\n\t)\n\nexport const useSignInPasswordlessMutation = createTenantMutation(SignInPasswordlessMutation, {\n\tapiToken: LoginToken,\n})\n\nexport type SignInPasswordlessMutationVariables = Parameters<ReturnType<typeof useSignInPasswordlessMutation>>[0]\n"],"names":[],"mappings":";;;AAKA,MAAM,uBAAuB,UAAU,2BAA2B,OAAO,UAAU,QAAQ,GAAG,MAAM,IAAI;AAIxG,MAAM,6BAA6B,UACjC,UACA;AAAA,EACA,UACE,6BACA,MAAM,UAAU,yBAAyB,EACzC,OAAO,oBAAoB;AAAA,EAC7B,CAAA,YAAW,QAAQ,MAAM,UAAU;AACpC;AAEY,MAAA,gCAAgC,qBAAqB,4BAA4B;AAAA,EAC7F,UAAU;AACX,CAAC;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const TenantApi = require("@contember/graphql-client-tenant");
|
|
4
|
+
const useTenantMutation = require("../../useTenantMutation.cjs");
|
|
5
|
+
function _interopNamespaceDefault(e) {
|
|
6
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
7
|
+
if (e) {
|
|
8
|
+
for (const k in e) {
|
|
9
|
+
if (k !== "default") {
|
|
10
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
11
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: () => e[k]
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
n.default = e;
|
|
19
|
+
return Object.freeze(n);
|
|
20
|
+
}
|
|
21
|
+
const TenantApi__namespace = /* @__PURE__ */ _interopNamespaceDefault(TenantApi);
|
|
22
|
+
const changeMyProfile = TenantApi__namespace.mutation$.changeMyProfile(
|
|
23
|
+
TenantApi__namespace.changeMyProfileResponse$$.error(TenantApi__namespace.changeMyProfileError$$),
|
|
24
|
+
(options) => options.alias("mutation")
|
|
25
|
+
);
|
|
26
|
+
const useChangeMyProfileMutation = useTenantMutation.createTenantMutation(changeMyProfile);
|
|
27
|
+
exports.changeMyProfile = changeMyProfile;
|
|
28
|
+
exports.useChangeMyProfileMutation = useChangeMyProfileMutation;
|
|
29
|
+
//# sourceMappingURL=useChangeMyProfile.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useChangeMyProfile.cjs","sources":["../../../../../../../packages/react-client-tenant/src/hooks/mutations/profile/useChangeMyProfile.ts"],"sourcesContent":["import * as TenantApi from '@contember/graphql-client-tenant'\nimport { createTenantMutation } from '../../useTenantMutation'\n\nexport const changeMyProfile = TenantApi.mutation$\n\t.changeMyProfile(\n\t\tTenantApi\n\t\t .changeMyProfileResponse$$\n\t\t .error(TenantApi.changeMyProfileError$$),\n\t\toptions => options.alias('mutation'),\n\t)\n\nexport const useChangeMyProfileMutation = createTenantMutation(changeMyProfile)\nexport type ChangeMyProfileMutationVariables = Parameters<ReturnType<typeof useChangeMyProfileMutation>>[0]\n"],"names":["TenantApi","createTenantMutation"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAGa,MAAA,kBAAkBA,qBAAU,UACvC;AAAA,EACAA,qBACG,0BACA,MAAMA,qBAAU,sBAAsB;AAAA,EACzC,CAAA,YAAW,QAAQ,MAAM,UAAU;AACpC;AAEY,MAAA,6BAA6BC,uCAAqB,eAAe;;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as TenantApi from "@contember/graphql-client-tenant";
|
|
2
|
+
import { createTenantMutation } from "../../useTenantMutation.js";
|
|
3
|
+
const changeMyProfile = TenantApi.mutation$.changeMyProfile(
|
|
4
|
+
TenantApi.changeMyProfileResponse$$.error(TenantApi.changeMyProfileError$$),
|
|
5
|
+
(options) => options.alias("mutation")
|
|
6
|
+
);
|
|
7
|
+
const useChangeMyProfileMutation = createTenantMutation(changeMyProfile);
|
|
8
|
+
export {
|
|
9
|
+
changeMyProfile,
|
|
10
|
+
useChangeMyProfileMutation
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=useChangeMyProfile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useChangeMyProfile.js","sources":["../../../../../../../packages/react-client-tenant/src/hooks/mutations/profile/useChangeMyProfile.ts"],"sourcesContent":["import * as TenantApi from '@contember/graphql-client-tenant'\nimport { createTenantMutation } from '../../useTenantMutation'\n\nexport const changeMyProfile = TenantApi.mutation$\n\t.changeMyProfile(\n\t\tTenantApi\n\t\t .changeMyProfileResponse$$\n\t\t .error(TenantApi.changeMyProfileError$$),\n\t\toptions => options.alias('mutation'),\n\t)\n\nexport const useChangeMyProfileMutation = createTenantMutation(changeMyProfile)\nexport type ChangeMyProfileMutationVariables = Parameters<ReturnType<typeof useChangeMyProfileMutation>>[0]\n"],"names":[],"mappings":";;AAGa,MAAA,kBAAkB,UAAU,UACvC;AAAA,EACA,UACG,0BACA,MAAM,UAAU,sBAAsB;AAAA,EACzC,CAAA,YAAW,QAAQ,MAAM,UAAU;AACpC;AAEY,MAAA,6BAA6B,qBAAqB,eAAe;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const TenantApi = require("@contember/graphql-client-tenant");
|
|
4
|
+
const useTenantMutation = require("../../useTenantMutation.cjs");
|
|
5
|
+
function _interopNamespaceDefault(e) {
|
|
6
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
7
|
+
if (e) {
|
|
8
|
+
for (const k in e) {
|
|
9
|
+
if (k !== "default") {
|
|
10
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
11
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: () => e[k]
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
n.default = e;
|
|
19
|
+
return Object.freeze(n);
|
|
20
|
+
}
|
|
21
|
+
const TenantApi__namespace = /* @__PURE__ */ _interopNamespaceDefault(TenantApi);
|
|
22
|
+
const changeProfile = TenantApi__namespace.mutation$.changeProfile(
|
|
23
|
+
TenantApi__namespace.changeProfileResponse$$.error(TenantApi__namespace.changeProfileError$$),
|
|
24
|
+
(options) => options.alias("mutation")
|
|
25
|
+
);
|
|
26
|
+
const useChangeProfileMutation = useTenantMutation.createTenantMutation(changeProfile);
|
|
27
|
+
exports.changeProfile = changeProfile;
|
|
28
|
+
exports.useChangeProfileMutation = useChangeProfileMutation;
|
|
29
|
+
//# sourceMappingURL=useChangeProfile.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useChangeProfile.cjs","sources":["../../../../../../../packages/react-client-tenant/src/hooks/mutations/profile/useChangeProfile.ts"],"sourcesContent":["import * as TenantApi from '@contember/graphql-client-tenant'\nimport { createTenantMutation } from '../../useTenantMutation'\n\nexport const changeProfile = TenantApi.mutation$\n\t.changeProfile(\n\t\tTenantApi\n\t\t .changeProfileResponse$$\n\t\t .error(TenantApi.changeProfileError$$),\n\t\toptions => options.alias('mutation'),\n\t)\n\nexport const useChangeProfileMutation = createTenantMutation(changeProfile)\nexport type ChangeProfileMutationVariables = Parameters<ReturnType<typeof useChangeProfileMutation>>[0]\n"],"names":["TenantApi","createTenantMutation"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAGa,MAAA,gBAAgBA,qBAAU,UACrC;AAAA,EACAA,qBACG,wBACA,MAAMA,qBAAU,oBAAoB;AAAA,EACvC,CAAA,YAAW,QAAQ,MAAM,UAAU;AACpC;AAEY,MAAA,2BAA2BC,uCAAqB,aAAa;;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as TenantApi from "@contember/graphql-client-tenant";
|
|
2
|
+
import { createTenantMutation } from "../../useTenantMutation.js";
|
|
3
|
+
const changeProfile = TenantApi.mutation$.changeProfile(
|
|
4
|
+
TenantApi.changeProfileResponse$$.error(TenantApi.changeProfileError$$),
|
|
5
|
+
(options) => options.alias("mutation")
|
|
6
|
+
);
|
|
7
|
+
const useChangeProfileMutation = createTenantMutation(changeProfile);
|
|
8
|
+
export {
|
|
9
|
+
changeProfile,
|
|
10
|
+
useChangeProfileMutation
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=useChangeProfile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useChangeProfile.js","sources":["../../../../../../../packages/react-client-tenant/src/hooks/mutations/profile/useChangeProfile.ts"],"sourcesContent":["import * as TenantApi from '@contember/graphql-client-tenant'\nimport { createTenantMutation } from '../../useTenantMutation'\n\nexport const changeProfile = TenantApi.mutation$\n\t.changeProfile(\n\t\tTenantApi\n\t\t .changeProfileResponse$$\n\t\t .error(TenantApi.changeProfileError$$),\n\t\toptions => options.alias('mutation'),\n\t)\n\nexport const useChangeProfileMutation = createTenantMutation(changeProfile)\nexport type ChangeProfileMutationVariables = Parameters<ReturnType<typeof useChangeProfileMutation>>[0]\n"],"names":[],"mappings":";;AAGa,MAAA,gBAAgB,UAAU,UACrC;AAAA,EACA,UACG,wBACA,MAAM,UAAU,oBAAoB;AAAA,EACvC,CAAA,YAAW,QAAQ,MAAM,UAAU;AACpC;AAEY,MAAA,2BAA2B,qBAAqB,aAAa;"}
|
|
@@ -20,7 +20,7 @@ function _interopNamespaceDefault(e) {
|
|
|
20
20
|
return Object.freeze(n);
|
|
21
21
|
}
|
|
22
22
|
const TenantApi__namespace = /* @__PURE__ */ _interopNamespaceDefault(TenantApi);
|
|
23
|
-
const identityFragment = TenantApi__namespace.identity$$.person(TenantApi__namespace.person
|
|
23
|
+
const identityFragment = TenantApi__namespace.identity$$.person(TenantApi__namespace.person$.id.email.name.otpEnabled).projects(
|
|
24
24
|
TenantApi__namespace.identityProjectRelation$.project(TenantApi__namespace.project$$).memberships(TenantApi__namespace.membership$$.variables(TenantApi__namespace.variableEntry$$))
|
|
25
25
|
).permissions(TenantApi__namespace.identityGlobalPermissions$$);
|
|
26
26
|
const useMeQuery = (options = {}) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMeQuery.cjs","sources":["../../../../../../packages/react-client-tenant/src/hooks/queries/useMeQuery.ts"],"sourcesContent":["import * as TenantApi from '@contember/graphql-client-tenant'\nimport { ModelType } from 'graphql-ts-client-api'\nimport { TenantApiOptions, useTenantApi } from '../useTenantApi'\nimport { useCallback } from 'react'\n\nconst identityFragment = TenantApi\n\t.identity$$\n\t.person(TenantApi.person
|
|
1
|
+
{"version":3,"file":"useMeQuery.cjs","sources":["../../../../../../packages/react-client-tenant/src/hooks/queries/useMeQuery.ts"],"sourcesContent":["import * as TenantApi from '@contember/graphql-client-tenant'\nimport { ModelType } from 'graphql-ts-client-api'\nimport { TenantApiOptions, useTenantApi } from '../useTenantApi'\nimport { useCallback } from 'react'\n\nconst identityFragment = TenantApi\n\t.identity$$\n\t.person(TenantApi.person$.id.email.name.otpEnabled)\n\t.projects(TenantApi\n\t\t.identityProjectRelation$\n\t\t.project(TenantApi.project$$)\n\t\t.memberships(TenantApi.membership$$.variables(TenantApi.variableEntry$$)),\n\t)\n\t.permissions(TenantApi.identityGlobalPermissions$$)\n\nexport type MeQueryData = ModelType<typeof identityFragment>\n\nexport const useMeQuery = (options: TenantApiOptions = {}) => {\n\tconst executor = useTenantApi(options)\n\treturn useCallback(async ({}: {}): Promise<MeQueryData> => {\n\t\treturn (await executor(TenantApi.query$.me(identityFragment))).me\n\t}, [executor])\n}\n"],"names":["TenantApi","useTenantApi","useCallback"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAKA,MAAM,mBAAmBA,qBACvB,WACA,OAAOA,qBAAU,QAAQ,GAAG,MAAM,KAAK,UAAU,EACjD;AAAA,EAASA,qBACR,yBACA,QAAQA,qBAAU,SAAS,EAC3B,YAAYA,qBAAU,aAAa,UAAUA,qBAAU,eAAe,CAAC;AACzE,EACC,YAAYA,qBAAU,2BAA2B;AAI5C,MAAM,aAAa,CAAC,UAA4B,OAAO;AACvD,QAAA,WAAWC,0BAAa,OAAO;AAC9B,SAAAC,MAAAA,YAAY,OAAO,OAAiC;AAC1D,YAAQ,MAAM,SAASF,qBAAU,OAAO,GAAG,gBAAgB,CAAC,GAAG;AAAA,EAAA,GAC7D,CAAC,QAAQ,CAAC;AACd;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as TenantApi from "@contember/graphql-client-tenant";
|
|
2
2
|
import { useTenantApi } from "../useTenantApi.js";
|
|
3
3
|
import { useCallback } from "react";
|
|
4
|
-
const identityFragment = TenantApi.identity$$.person(TenantApi.person
|
|
4
|
+
const identityFragment = TenantApi.identity$$.person(TenantApi.person$.id.email.name.otpEnabled).projects(
|
|
5
5
|
TenantApi.identityProjectRelation$.project(TenantApi.project$$).memberships(TenantApi.membership$$.variables(TenantApi.variableEntry$$))
|
|
6
6
|
).permissions(TenantApi.identityGlobalPermissions$$);
|
|
7
7
|
const useMeQuery = (options = {}) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMeQuery.js","sources":["../../../../../../packages/react-client-tenant/src/hooks/queries/useMeQuery.ts"],"sourcesContent":["import * as TenantApi from '@contember/graphql-client-tenant'\nimport { ModelType } from 'graphql-ts-client-api'\nimport { TenantApiOptions, useTenantApi } from '../useTenantApi'\nimport { useCallback } from 'react'\n\nconst identityFragment = TenantApi\n\t.identity$$\n\t.person(TenantApi.person
|
|
1
|
+
{"version":3,"file":"useMeQuery.js","sources":["../../../../../../packages/react-client-tenant/src/hooks/queries/useMeQuery.ts"],"sourcesContent":["import * as TenantApi from '@contember/graphql-client-tenant'\nimport { ModelType } from 'graphql-ts-client-api'\nimport { TenantApiOptions, useTenantApi } from '../useTenantApi'\nimport { useCallback } from 'react'\n\nconst identityFragment = TenantApi\n\t.identity$$\n\t.person(TenantApi.person$.id.email.name.otpEnabled)\n\t.projects(TenantApi\n\t\t.identityProjectRelation$\n\t\t.project(TenantApi.project$$)\n\t\t.memberships(TenantApi.membership$$.variables(TenantApi.variableEntry$$)),\n\t)\n\t.permissions(TenantApi.identityGlobalPermissions$$)\n\nexport type MeQueryData = ModelType<typeof identityFragment>\n\nexport const useMeQuery = (options: TenantApiOptions = {}) => {\n\tconst executor = useTenantApi(options)\n\treturn useCallback(async ({}: {}): Promise<MeQueryData> => {\n\t\treturn (await executor(TenantApi.query$.me(identityFragment))).me\n\t}, [executor])\n}\n"],"names":[],"mappings":";;;AAKA,MAAM,mBAAmB,UACvB,WACA,OAAO,UAAU,QAAQ,GAAG,MAAM,KAAK,UAAU,EACjD;AAAA,EAAS,UACR,yBACA,QAAQ,UAAU,SAAS,EAC3B,YAAY,UAAU,aAAa,UAAU,UAAU,eAAe,CAAC;AACzE,EACC,YAAY,UAAU,2BAA2B;AAI5C,MAAM,aAAa,CAAC,UAA4B,OAAO;AACvD,QAAA,WAAW,aAAa,OAAO;AAC9B,SAAA,YAAY,OAAO,OAAiC;AAC1D,YAAQ,MAAM,SAAS,UAAU,OAAO,GAAG,gBAAgB,CAAC,GAAG;AAAA,EAAA,GAC7D,CAAC,QAAQ,CAAC;AACd;"}
|
|
@@ -22,7 +22,7 @@ function _interopNamespaceDefault(e) {
|
|
|
22
22
|
}
|
|
23
23
|
const TenantApi__namespace = /* @__PURE__ */ _interopNamespaceDefault(TenantApi);
|
|
24
24
|
const projectIdentityRelationFragment = TenantApi__namespace.projectIdentityRelation$.identity(
|
|
25
|
-
TenantApi__namespace.identity$$.person(TenantApi__namespace.person
|
|
25
|
+
TenantApi__namespace.identity$$.person(TenantApi__namespace.person$.id.email.name.otpEnabled).apiKey(TenantApi__namespace.apiKey$$)
|
|
26
26
|
).memberships(TenantApi__namespace.membership$$.variables(TenantApi__namespace.variableEntry$$));
|
|
27
27
|
const useProjectMembersQuery = ({ headers, apiToken } = {}) => {
|
|
28
28
|
const executor = useTenantApi.useTenantApi({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useProjectMembersQuery.cjs","sources":["../../../../../../packages/react-client-tenant/src/hooks/queries/useProjectMembersQuery.ts"],"sourcesContent":["import * as TenantApi from '@contember/graphql-client-tenant'\nimport { ModelType, ParameterRef } from 'graphql-ts-client-api'\nimport { TenantApiOptions, useTenantApi } from '../useTenantApi'\nimport { useCallback } from 'react'\n\nconst projectIdentityRelationFragment = TenantApi\n\t.projectIdentityRelation$\n\t.identity(TenantApi.identity$$\n\t\t.person(TenantApi.person
|
|
1
|
+
{"version":3,"file":"useProjectMembersQuery.cjs","sources":["../../../../../../packages/react-client-tenant/src/hooks/queries/useProjectMembersQuery.ts"],"sourcesContent":["import * as TenantApi from '@contember/graphql-client-tenant'\nimport { ModelType, ParameterRef } from 'graphql-ts-client-api'\nimport { TenantApiOptions, useTenantApi } from '../useTenantApi'\nimport { useCallback } from 'react'\n\nconst projectIdentityRelationFragment = TenantApi\n\t.projectIdentityRelation$\n\t.identity(TenantApi.identity$$\n\t\t.person(TenantApi.person$.id.email.name.otpEnabled)\n\t\t.apiKey(TenantApi.apiKey$$)\n\t\t,\n\t)\n\t.memberships(TenantApi.membership$$.variables(TenantApi.variableEntry$$))\n\nexport type ProjectMembersQueryResult = readonly ModelType<typeof projectIdentityRelationFragment>[]\n\nexport type ProjectMembersQueryVariables =\n\t& {\n\t\tprojectSlug: string\n\t}\n\t& TenantApi.ProjectMembersInput\n\n\nexport const useProjectMembersQuery = ({ headers, apiToken }: TenantApiOptions = {}) => {\n\tconst executor = useTenantApi({\n\t\theaders,\n\t\tapiToken,\n\t})\n\treturn useCallback(async ({ projectSlug, ...membersInput }: ProjectMembersQueryVariables): Promise<ProjectMembersQueryResult> => {\n\t\tconst result = await executor(TenantApi.query$.projectBySlug({\n\t\t\tslug: ParameterRef.of('projectSlug'),\n\t\t}, TenantApi.project$.members({\n\t\t\tinput: ParameterRef.of('membersInput'),\n\t\t}, projectIdentityRelationFragment)), {\n\t\t\tvariables: {\n\t\t\t\tprojectSlug,\n\t\t\t\tmembersInput,\n\t\t\t},\n\t\t})\n\n\t\treturn result.projectBySlug?.members ?? []\n\t}, [executor])\n}\n"],"names":["TenantApi","useTenantApi","useCallback","ParameterRef"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAM,kCAAkCA,qBACtC,yBACA;AAAA,EAASA,qBAAU,WAClB,OAAOA,qBAAU,QAAQ,GAAG,MAAM,KAAK,UAAU,EACjD,OAAOA,qBAAU,QAAQ;AAE3B,EACC,YAAYA,qBAAU,aAAa,UAAUA,qBAAU,eAAe,CAAC;AAWlE,MAAM,yBAAyB,CAAC,EAAE,SAAS,SAAS,IAAsB,CAAA,MAAO;AACvF,QAAM,WAAWC,aAAAA,aAAa;AAAA,IAC7B;AAAA,IACA;AAAA,EAAA,CACA;AACD,SAAOC,kBAAY,OAAO,EAAE,aAAa,GAAG,mBAAqF;AAChI,UAAM,SAAS,MAAM,SAASF,qBAAU,OAAO,cAAc;AAAA,MAC5D,MAAMG,mBAAAA,aAAa,GAAG,aAAa;AAAA,IAAA,GACjCH,qBAAU,SAAS,QAAQ;AAAA,MAC7B,OAAOG,mBAAAA,aAAa,GAAG,cAAc;AAAA,IAAA,GACnC,+BAA+B,CAAC,GAAG;AAAA,MACrC,WAAW;AAAA,QACV;AAAA,QACA;AAAA,MAAA;AAAA,IACD,CACA;AAEM,WAAA,OAAO,eAAe,WAAW,CAAC;AAAA,EAAA,GACvC,CAAC,QAAQ,CAAC;AACd;;"}
|
|
@@ -3,7 +3,7 @@ import { ParameterRef } from "graphql-ts-client-api";
|
|
|
3
3
|
import { useTenantApi } from "../useTenantApi.js";
|
|
4
4
|
import { useCallback } from "react";
|
|
5
5
|
const projectIdentityRelationFragment = TenantApi.projectIdentityRelation$.identity(
|
|
6
|
-
TenantApi.identity$$.person(TenantApi.person
|
|
6
|
+
TenantApi.identity$$.person(TenantApi.person$.id.email.name.otpEnabled).apiKey(TenantApi.apiKey$$)
|
|
7
7
|
).memberships(TenantApi.membership$$.variables(TenantApi.variableEntry$$));
|
|
8
8
|
const useProjectMembersQuery = ({ headers, apiToken } = {}) => {
|
|
9
9
|
const executor = useTenantApi({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useProjectMembersQuery.js","sources":["../../../../../../packages/react-client-tenant/src/hooks/queries/useProjectMembersQuery.ts"],"sourcesContent":["import * as TenantApi from '@contember/graphql-client-tenant'\nimport { ModelType, ParameterRef } from 'graphql-ts-client-api'\nimport { TenantApiOptions, useTenantApi } from '../useTenantApi'\nimport { useCallback } from 'react'\n\nconst projectIdentityRelationFragment = TenantApi\n\t.projectIdentityRelation$\n\t.identity(TenantApi.identity$$\n\t\t.person(TenantApi.person
|
|
1
|
+
{"version":3,"file":"useProjectMembersQuery.js","sources":["../../../../../../packages/react-client-tenant/src/hooks/queries/useProjectMembersQuery.ts"],"sourcesContent":["import * as TenantApi from '@contember/graphql-client-tenant'\nimport { ModelType, ParameterRef } from 'graphql-ts-client-api'\nimport { TenantApiOptions, useTenantApi } from '../useTenantApi'\nimport { useCallback } from 'react'\n\nconst projectIdentityRelationFragment = TenantApi\n\t.projectIdentityRelation$\n\t.identity(TenantApi.identity$$\n\t\t.person(TenantApi.person$.id.email.name.otpEnabled)\n\t\t.apiKey(TenantApi.apiKey$$)\n\t\t,\n\t)\n\t.memberships(TenantApi.membership$$.variables(TenantApi.variableEntry$$))\n\nexport type ProjectMembersQueryResult = readonly ModelType<typeof projectIdentityRelationFragment>[]\n\nexport type ProjectMembersQueryVariables =\n\t& {\n\t\tprojectSlug: string\n\t}\n\t& TenantApi.ProjectMembersInput\n\n\nexport const useProjectMembersQuery = ({ headers, apiToken }: TenantApiOptions = {}) => {\n\tconst executor = useTenantApi({\n\t\theaders,\n\t\tapiToken,\n\t})\n\treturn useCallback(async ({ projectSlug, ...membersInput }: ProjectMembersQueryVariables): Promise<ProjectMembersQueryResult> => {\n\t\tconst result = await executor(TenantApi.query$.projectBySlug({\n\t\t\tslug: ParameterRef.of('projectSlug'),\n\t\t}, TenantApi.project$.members({\n\t\t\tinput: ParameterRef.of('membersInput'),\n\t\t}, projectIdentityRelationFragment)), {\n\t\t\tvariables: {\n\t\t\t\tprojectSlug,\n\t\t\t\tmembersInput,\n\t\t\t},\n\t\t})\n\n\t\treturn result.projectBySlug?.members ?? []\n\t}, [executor])\n}\n"],"names":[],"mappings":";;;;AAKA,MAAM,kCAAkC,UACtC,yBACA;AAAA,EAAS,UAAU,WAClB,OAAO,UAAU,QAAQ,GAAG,MAAM,KAAK,UAAU,EACjD,OAAO,UAAU,QAAQ;AAE3B,EACC,YAAY,UAAU,aAAa,UAAU,UAAU,eAAe,CAAC;AAWlE,MAAM,yBAAyB,CAAC,EAAE,SAAS,SAAS,IAAsB,CAAA,MAAO;AACvF,QAAM,WAAW,aAAa;AAAA,IAC7B;AAAA,IACA;AAAA,EAAA,CACA;AACD,SAAO,YAAY,OAAO,EAAE,aAAa,GAAG,mBAAqF;AAChI,UAAM,SAAS,MAAM,SAAS,UAAU,OAAO,cAAc;AAAA,MAC5D,MAAM,aAAa,GAAG,aAAa;AAAA,IAAA,GACjC,UAAU,SAAS,QAAQ;AAAA,MAC7B,OAAO,aAAa,GAAG,cAAc;AAAA,IAAA,GACnC,+BAA+B,CAAC,GAAG;AAAA,MACrC,WAAW;AAAA,QACV;AAAA,QACA;AAAA,MAAA;AAAA,IACD,CACA;AAEM,WAAA,OAAO,eAAe,WAAW,CAAC;AAAA,EAAA,GACvC,CAAC,QAAQ,CAAC;AACd;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useProjectMembershipsQuery.cjs","sources":["../../../../../../packages/react-client-tenant/src/hooks/queries/useProjectMembershipsQuery.ts"],"sourcesContent":["import * as TenantApi from '@contember/graphql-client-tenant'\nimport { ModelType, ParameterRef } from 'graphql-ts-client-api'\nimport { TenantApiOptions, useTenantApi } from '../useTenantApi'\nimport { useCallback } from 'react'\n\nconst projectMembershipsFragment = TenantApi.membership$$.variables(TenantApi.variableEntry$$)\n\nexport type ProjectMembershipsQueryResult = readonly ModelType<typeof projectMembershipsFragment>[]\n\nexport type ProjectMembershipsQueryVariables = {\n\tprojectSlug: string\n\tidentityId: string\n}\n\n\nexport const useProjectMembershipsQuery = (options: TenantApiOptions = {}) => {\n\tconst executor = useTenantApi(options)\n\treturn useCallback(async (input: ProjectMembershipsQueryVariables): Promise<ProjectMembershipsQueryResult> => {\n\t\tconst result = await executor(TenantApi.query$.projectMemberships(TenantApi.membership$$.variables(TenantApi.variableEntry$$)), {\n\t\t\tvariables: input,\n\t\t})\n\n\t\treturn result.projectMemberships ?? []\n\t}, [executor])\n}\n"],"names":["TenantApi","useTenantApi","useCallback"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAKmCA,qBAAU,aAAa,UAAUA,qBAAU,eAAe;AAUtF,MAAM,6BAA6B,CAAC,UAA4B,OAAO;AACvE,QAAA,WAAWC,0BAAa,OAAO;AAC9B,SAAAC,MAAAA,YAAY,OAAO,UAAoF;AAC7G,UAAM,SAAS,MAAM,SAASF,qBAAU,OAAO,mBAAmBA,qBAAU,aAAa,UAAUA,qBAAU,eAAe,CAAC,GAAG;AAAA,MAC/H,WAAW;AAAA,IAAA,CACX;AAEM,WAAA,OAAO,sBAAsB;
|
|
1
|
+
{"version":3,"file":"useProjectMembershipsQuery.cjs","sources":["../../../../../../packages/react-client-tenant/src/hooks/queries/useProjectMembershipsQuery.ts"],"sourcesContent":["import * as TenantApi from '@contember/graphql-client-tenant'\nimport { ModelType, ParameterRef } from 'graphql-ts-client-api'\nimport { TenantApiOptions, useTenantApi } from '../useTenantApi'\nimport { useCallback } from 'react'\n\nconst projectMembershipsFragment = TenantApi.membership$$.variables(TenantApi.variableEntry$$)\n\nexport type ProjectMembershipsQueryResult = readonly ModelType<typeof projectMembershipsFragment>[]\n\nexport type ProjectMembershipsQueryVariables = {\n\tprojectSlug: string\n\tidentityId: string\n}\n\n\nexport const useProjectMembershipsQuery = (options: TenantApiOptions = {}) => {\n\tconst executor = useTenantApi(options)\n\treturn useCallback(async (input: ProjectMembershipsQueryVariables): Promise<ProjectMembershipsQueryResult> => {\n\t\tconst result = await executor(TenantApi.query$.projectMemberships(TenantApi.membership$$.variables(TenantApi.variableEntry$$)), {\n\t\t\tvariables: input,\n\t\t})\n\n\t\treturn result.projectMemberships ?? []\n\t}, [executor])\n}\n"],"names":["TenantApi","useTenantApi","useCallback"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAKmCA,qBAAU,aAAa,UAAUA,qBAAU,eAAe;AAUtF,MAAM,6BAA6B,CAAC,UAA4B,OAAO;AACvE,QAAA,WAAWC,0BAAa,OAAO;AAC9B,SAAAC,MAAAA,YAAY,OAAO,UAAoF;AAC7G,UAAM,SAAS,MAAM,SAASF,qBAAU,OAAO,mBAAmBA,qBAAU,aAAa,UAAUA,qBAAU,eAAe,CAAC,GAAG;AAAA,MAC/H,WAAW;AAAA,IAAA,CACX;AAEM,WAAA,OAAO,sBAAsB,CAAC;AAAA,EAAA,GACnC,CAAC,QAAQ,CAAC;AACd;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useProjectMembershipsQuery.js","sources":["../../../../../../packages/react-client-tenant/src/hooks/queries/useProjectMembershipsQuery.ts"],"sourcesContent":["import * as TenantApi from '@contember/graphql-client-tenant'\nimport { ModelType, ParameterRef } from 'graphql-ts-client-api'\nimport { TenantApiOptions, useTenantApi } from '../useTenantApi'\nimport { useCallback } from 'react'\n\nconst projectMembershipsFragment = TenantApi.membership$$.variables(TenantApi.variableEntry$$)\n\nexport type ProjectMembershipsQueryResult = readonly ModelType<typeof projectMembershipsFragment>[]\n\nexport type ProjectMembershipsQueryVariables = {\n\tprojectSlug: string\n\tidentityId: string\n}\n\n\nexport const useProjectMembershipsQuery = (options: TenantApiOptions = {}) => {\n\tconst executor = useTenantApi(options)\n\treturn useCallback(async (input: ProjectMembershipsQueryVariables): Promise<ProjectMembershipsQueryResult> => {\n\t\tconst result = await executor(TenantApi.query$.projectMemberships(TenantApi.membership$$.variables(TenantApi.variableEntry$$)), {\n\t\t\tvariables: input,\n\t\t})\n\n\t\treturn result.projectMemberships ?? []\n\t}, [executor])\n}\n"],"names":[],"mappings":";;;AAKmC,UAAU,aAAa,UAAU,UAAU,eAAe;AAUtF,MAAM,6BAA6B,CAAC,UAA4B,OAAO;AACvE,QAAA,WAAW,aAAa,OAAO;AAC9B,SAAA,YAAY,OAAO,UAAoF;AAC7G,UAAM,SAAS,MAAM,SAAS,UAAU,OAAO,mBAAmB,UAAU,aAAa,UAAU,UAAU,eAAe,CAAC,GAAG;AAAA,MAC/H,WAAW;AAAA,IAAA,CACX;AAEM,WAAA,OAAO,sBAAsB;
|
|
1
|
+
{"version":3,"file":"useProjectMembershipsQuery.js","sources":["../../../../../../packages/react-client-tenant/src/hooks/queries/useProjectMembershipsQuery.ts"],"sourcesContent":["import * as TenantApi from '@contember/graphql-client-tenant'\nimport { ModelType, ParameterRef } from 'graphql-ts-client-api'\nimport { TenantApiOptions, useTenantApi } from '../useTenantApi'\nimport { useCallback } from 'react'\n\nconst projectMembershipsFragment = TenantApi.membership$$.variables(TenantApi.variableEntry$$)\n\nexport type ProjectMembershipsQueryResult = readonly ModelType<typeof projectMembershipsFragment>[]\n\nexport type ProjectMembershipsQueryVariables = {\n\tprojectSlug: string\n\tidentityId: string\n}\n\n\nexport const useProjectMembershipsQuery = (options: TenantApiOptions = {}) => {\n\tconst executor = useTenantApi(options)\n\treturn useCallback(async (input: ProjectMembershipsQueryVariables): Promise<ProjectMembershipsQueryResult> => {\n\t\tconst result = await executor(TenantApi.query$.projectMemberships(TenantApi.membership$$.variables(TenantApi.variableEntry$$)), {\n\t\t\tvariables: input,\n\t\t})\n\n\t\treturn result.projectMemberships ?? []\n\t}, [executor])\n}\n"],"names":[],"mappings":";;;AAKmC,UAAU,aAAa,UAAU,UAAU,eAAe;AAUtF,MAAM,6BAA6B,CAAC,UAA4B,OAAO;AACvE,QAAA,WAAW,aAAa,OAAO;AAC9B,SAAA,YAAY,OAAO,UAAoF;AAC7G,UAAM,SAAS,MAAM,SAAS,UAAU,OAAO,mBAAmB,UAAU,aAAa,UAAU,UAAU,eAAe,CAAC,GAAG;AAAA,MAC/H,WAAW;AAAA,IAAA,CACX;AAEM,WAAA,OAAO,sBAAsB,CAAC;AAAA,EAAA,GACnC,CAAC,QAAQ,CAAC;AACd;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useProjectRolesDefinitionQuery.cjs","sources":["../../../../../../packages/react-client-tenant/src/hooks/queries/useProjectRolesDefinitionQuery.ts"],"sourcesContent":["import * as TenantApi from '@contember/graphql-client-tenant'\nimport { ModelType } from 'graphql-ts-client-api'\nimport { TenantApiOptions, useTenantApi } from '../useTenantApi'\nimport { useCallback } from 'react'\n\nconst projectRolesDefinitionFragment = TenantApi.roleDefinition$$\n\t.variables(\n\t\tTenantApi.roleVariableDefinition$$\n\t\t\t.on(TenantApi.roleConditionVariableDefinition$$)\n\t\t\t.on(TenantApi.roleEntityVariableDefinition$$)\n\t\t\t.on(TenantApi.rolePredefinedVariableDefinition$$)\n\t\t,\n\t)\n\nexport type ProjectRoleDefinition = ModelType<typeof projectRolesDefinitionFragment>\nexport type ProjectRolesDefinitionQueryResult = readonly ProjectRoleDefinition[]\n\nconst projectRolesDefinitionQuery = TenantApi.query$\n\t.projectBySlug(\n\t\tTenantApi\n\t\t\t.project$\n\t\t\t.roles(projectRolesDefinitionFragment),\n\t)\n\nexport interface ProjectRolesDefinitionQueryVariables {\n\tslug: string\n}\n\nexport const useProjectRolesDefinitionQuery = ({ headers, apiToken }: TenantApiOptions = {}) => {\n\tconst executor = useTenantApi()\n\treturn useCallback(async (variables: ProjectRolesDefinitionQueryVariables): Promise<ProjectRolesDefinitionQueryResult> => {\n\t\treturn (await executor(projectRolesDefinitionQuery, { headers, apiToken, variables })).projectBySlug?.roles ?? []\n\t}, [apiToken, executor, headers])\n}\n"],"names":["TenantApi","useTenantApi","useCallback"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAKA,MAAM,iCAAiCA,qBAAU,iBAC/C;AAAA,EACAA,qBAAU,yBACR,GAAGA,qBAAU,iCAAiC,EAC9C,GAAGA,qBAAU,8BAA8B,EAC3C,GAAGA,qBAAU,kCAAkC;AAElD;AAKD,MAAM,8BAA8BA,qBAAU,OAC5C;AAAA,EACAA,qBACE,SACA,MAAM,8BAA8B;AACvC;AAMM,MAAM,iCAAiC,CAAC,EAAE,SAAS,SAAS,IAAsB,CAAA,MAAO;AAC/F,QAAM,WAAWC,aAAAA;
|
|
1
|
+
{"version":3,"file":"useProjectRolesDefinitionQuery.cjs","sources":["../../../../../../packages/react-client-tenant/src/hooks/queries/useProjectRolesDefinitionQuery.ts"],"sourcesContent":["import * as TenantApi from '@contember/graphql-client-tenant'\nimport { ModelType } from 'graphql-ts-client-api'\nimport { TenantApiOptions, useTenantApi } from '../useTenantApi'\nimport { useCallback } from 'react'\n\nconst projectRolesDefinitionFragment = TenantApi.roleDefinition$$\n\t.variables(\n\t\tTenantApi.roleVariableDefinition$$\n\t\t\t.on(TenantApi.roleConditionVariableDefinition$$)\n\t\t\t.on(TenantApi.roleEntityVariableDefinition$$)\n\t\t\t.on(TenantApi.rolePredefinedVariableDefinition$$)\n\t\t,\n\t)\n\nexport type ProjectRoleDefinition = ModelType<typeof projectRolesDefinitionFragment>\nexport type ProjectRolesDefinitionQueryResult = readonly ProjectRoleDefinition[]\n\nconst projectRolesDefinitionQuery = TenantApi.query$\n\t.projectBySlug(\n\t\tTenantApi\n\t\t\t.project$\n\t\t\t.roles(projectRolesDefinitionFragment),\n\t)\n\nexport interface ProjectRolesDefinitionQueryVariables {\n\tslug: string\n}\n\nexport const useProjectRolesDefinitionQuery = ({ headers, apiToken }: TenantApiOptions = {}) => {\n\tconst executor = useTenantApi()\n\treturn useCallback(async (variables: ProjectRolesDefinitionQueryVariables): Promise<ProjectRolesDefinitionQueryResult> => {\n\t\treturn (await executor(projectRolesDefinitionQuery, { headers, apiToken, variables })).projectBySlug?.roles ?? []\n\t}, [apiToken, executor, headers])\n}\n"],"names":["TenantApi","useTenantApi","useCallback"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAKA,MAAM,iCAAiCA,qBAAU,iBAC/C;AAAA,EACAA,qBAAU,yBACR,GAAGA,qBAAU,iCAAiC,EAC9C,GAAGA,qBAAU,8BAA8B,EAC3C,GAAGA,qBAAU,kCAAkC;AAElD;AAKD,MAAM,8BAA8BA,qBAAU,OAC5C;AAAA,EACAA,qBACE,SACA,MAAM,8BAA8B;AACvC;AAMM,MAAM,iCAAiC,CAAC,EAAE,SAAS,SAAS,IAAsB,CAAA,MAAO;AAC/F,QAAM,WAAWC,aAAAA,aAAa;AACvB,SAAAC,MAAAA,YAAY,OAAO,cAAgG;AACjH,YAAA,MAAM,SAAS,6BAA6B,EAAE,SAAS,UAAU,WAAW,GAAG,eAAe,SAAS,CAAC;AAAA,EAC9G,GAAA,CAAC,UAAU,UAAU,OAAO,CAAC;AACjC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useProjectRolesDefinitionQuery.js","sources":["../../../../../../packages/react-client-tenant/src/hooks/queries/useProjectRolesDefinitionQuery.ts"],"sourcesContent":["import * as TenantApi from '@contember/graphql-client-tenant'\nimport { ModelType } from 'graphql-ts-client-api'\nimport { TenantApiOptions, useTenantApi } from '../useTenantApi'\nimport { useCallback } from 'react'\n\nconst projectRolesDefinitionFragment = TenantApi.roleDefinition$$\n\t.variables(\n\t\tTenantApi.roleVariableDefinition$$\n\t\t\t.on(TenantApi.roleConditionVariableDefinition$$)\n\t\t\t.on(TenantApi.roleEntityVariableDefinition$$)\n\t\t\t.on(TenantApi.rolePredefinedVariableDefinition$$)\n\t\t,\n\t)\n\nexport type ProjectRoleDefinition = ModelType<typeof projectRolesDefinitionFragment>\nexport type ProjectRolesDefinitionQueryResult = readonly ProjectRoleDefinition[]\n\nconst projectRolesDefinitionQuery = TenantApi.query$\n\t.projectBySlug(\n\t\tTenantApi\n\t\t\t.project$\n\t\t\t.roles(projectRolesDefinitionFragment),\n\t)\n\nexport interface ProjectRolesDefinitionQueryVariables {\n\tslug: string\n}\n\nexport const useProjectRolesDefinitionQuery = ({ headers, apiToken }: TenantApiOptions = {}) => {\n\tconst executor = useTenantApi()\n\treturn useCallback(async (variables: ProjectRolesDefinitionQueryVariables): Promise<ProjectRolesDefinitionQueryResult> => {\n\t\treturn (await executor(projectRolesDefinitionQuery, { headers, apiToken, variables })).projectBySlug?.roles ?? []\n\t}, [apiToken, executor, headers])\n}\n"],"names":[],"mappings":";;;AAKA,MAAM,iCAAiC,UAAU,iBAC/C;AAAA,EACA,UAAU,yBACR,GAAG,UAAU,iCAAiC,EAC9C,GAAG,UAAU,8BAA8B,EAC3C,GAAG,UAAU,kCAAkC;AAElD;AAKD,MAAM,8BAA8B,UAAU,OAC5C;AAAA,EACA,UACE,SACA,MAAM,8BAA8B;AACvC;AAMM,MAAM,iCAAiC,CAAC,EAAE,SAAS,SAAS,IAAsB,CAAA,MAAO;AAC/F,QAAM,WAAW;
|
|
1
|
+
{"version":3,"file":"useProjectRolesDefinitionQuery.js","sources":["../../../../../../packages/react-client-tenant/src/hooks/queries/useProjectRolesDefinitionQuery.ts"],"sourcesContent":["import * as TenantApi from '@contember/graphql-client-tenant'\nimport { ModelType } from 'graphql-ts-client-api'\nimport { TenantApiOptions, useTenantApi } from '../useTenantApi'\nimport { useCallback } from 'react'\n\nconst projectRolesDefinitionFragment = TenantApi.roleDefinition$$\n\t.variables(\n\t\tTenantApi.roleVariableDefinition$$\n\t\t\t.on(TenantApi.roleConditionVariableDefinition$$)\n\t\t\t.on(TenantApi.roleEntityVariableDefinition$$)\n\t\t\t.on(TenantApi.rolePredefinedVariableDefinition$$)\n\t\t,\n\t)\n\nexport type ProjectRoleDefinition = ModelType<typeof projectRolesDefinitionFragment>\nexport type ProjectRolesDefinitionQueryResult = readonly ProjectRoleDefinition[]\n\nconst projectRolesDefinitionQuery = TenantApi.query$\n\t.projectBySlug(\n\t\tTenantApi\n\t\t\t.project$\n\t\t\t.roles(projectRolesDefinitionFragment),\n\t)\n\nexport interface ProjectRolesDefinitionQueryVariables {\n\tslug: string\n}\n\nexport const useProjectRolesDefinitionQuery = ({ headers, apiToken }: TenantApiOptions = {}) => {\n\tconst executor = useTenantApi()\n\treturn useCallback(async (variables: ProjectRolesDefinitionQueryVariables): Promise<ProjectRolesDefinitionQueryResult> => {\n\t\treturn (await executor(projectRolesDefinitionQuery, { headers, apiToken, variables })).projectBySlug?.roles ?? []\n\t}, [apiToken, executor, headers])\n}\n"],"names":[],"mappings":";;;AAKA,MAAM,iCAAiC,UAAU,iBAC/C;AAAA,EACA,UAAU,yBACR,GAAG,UAAU,iCAAiC,EAC9C,GAAG,UAAU,8BAA8B,EAC3C,GAAG,UAAU,kCAAkC;AAElD;AAKD,MAAM,8BAA8B,UAAU,OAC5C;AAAA,EACA,UACE,SACA,MAAM,8BAA8B;AACvC;AAMM,MAAM,iCAAiC,CAAC,EAAE,SAAS,SAAS,IAAsB,CAAA,MAAO;AAC/F,QAAM,WAAW,aAAa;AACvB,SAAA,YAAY,OAAO,cAAgG;AACjH,YAAA,MAAM,SAAS,6BAA6B,EAAE,SAAS,UAAU,WAAW,GAAG,eAAe,SAAS,CAAC;AAAA,EAC9G,GAAA,CAAC,UAAU,UAAU,OAAO,CAAC;AACjC;"}
|
|
@@ -21,6 +21,7 @@ const useFetchIdentity = () => {
|
|
|
21
21
|
state: "success",
|
|
22
22
|
identity: {
|
|
23
23
|
id: response.id,
|
|
24
|
+
roles: response.roles ?? [],
|
|
24
25
|
person: person ?? void 0,
|
|
25
26
|
projects: projects.map((it) => ({
|
|
26
27
|
name: it.project.name,
|
|
@@ -32,9 +33,8 @@ const useFetchIdentity = () => {
|
|
|
32
33
|
});
|
|
33
34
|
} catch (e) {
|
|
34
35
|
console.error(e);
|
|
35
|
-
if (
|
|
36
|
+
if (e instanceof reactClient.GraphQlClientError && e.response?.status === 401) {
|
|
36
37
|
logout({ noRedirect: true });
|
|
37
|
-
setIdentityState({ state: "cleared", identity: void 0 });
|
|
38
38
|
} else {
|
|
39
39
|
setIdentityState({ state: "failed", identity: void 0 });
|
|
40
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFetchIdentity.cjs","sources":["../../../../../packages/react-client-tenant/src/hooks/useFetchIdentity.ts"],"sourcesContent":["import { useCallback, useMemo, useState } from 'react'\nimport { Identity, IdentityMethods, IdentityStateValue } from '../types'\nimport { useSessionToken } from '@contember/react-client'\nimport { useLogoutInternal } from '../internal/hooks/useLogoutInternal'\nimport { useMeQuery } from './queries'\n\nexport const useFetchIdentity = (): [{ state: IdentityStateValue; identity: Identity | undefined }, IdentityMethods] => {\n\tconst sessionToken = useSessionToken()\n\tconst fetchMe = useMeQuery()\n\n\tconst [identityState, setIdentityState] = useState<ReturnType<typeof useFetchIdentity>[0]>({ state: sessionToken ? 'loading' : 'none', identity: undefined })\n\n\tconst clearIdentity = useCallback(() => setIdentityState({ state: 'cleared', identity: undefined }), [])\n\tconst logout = useLogoutInternal(clearIdentity)\n\n\tconst fetch = useCallback(async () => {\n\t\tsetIdentityState({ state: 'loading', identity: undefined })\n\t\ttry {\n\t\t\tconst response = await fetchMe({})\n\t\t\tconst person = response.person\n\t\t\tconst projects = response.projects\n\t\t\tconst permissions = response.permissions ?? { canCreateProject: false }\n\n\t\t\tsetIdentityState({\n\t\t\t\tstate: 'success',\n\t\t\t\tidentity: {\n\t\t\t\t\tid: response.id,\n\t\t\t\t\tperson: person ?? undefined,\n\t\t\t\t\tprojects: projects.map(it => ({\n\t\t\t\t\t\tname: it.project.name,\n\t\t\t\t\t\tslug: it.project.slug,\n\t\t\t\t\t\troles: it.memberships.map(it => it.role),\n\t\t\t\t\t})),\n\t\t\t\t\tpermissions,\n\t\t\t\t},\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t\tif (
|
|
1
|
+
{"version":3,"file":"useFetchIdentity.cjs","sources":["../../../../../packages/react-client-tenant/src/hooks/useFetchIdentity.ts"],"sourcesContent":["import { useCallback, useMemo, useState } from 'react'\nimport { Identity, IdentityMethods, IdentityStateValue } from '../types'\nimport { GraphQlClientError, useSessionToken } from '@contember/react-client'\nimport { useLogoutInternal } from '../internal/hooks/useLogoutInternal'\nimport { useMeQuery } from './queries'\n\nexport const useFetchIdentity = (): [{ state: IdentityStateValue; identity: Identity | undefined }, IdentityMethods] => {\n\tconst sessionToken = useSessionToken()\n\tconst fetchMe = useMeQuery()\n\n\tconst [identityState, setIdentityState] = useState<ReturnType<typeof useFetchIdentity>[0]>({ state: sessionToken ? 'loading' : 'none', identity: undefined })\n\n\tconst clearIdentity = useCallback(() => setIdentityState({ state: 'cleared', identity: undefined }), [])\n\tconst logout = useLogoutInternal(clearIdentity)\n\n\tconst fetch = useCallback(async () => {\n\t\tsetIdentityState({ state: 'loading', identity: undefined })\n\t\ttry {\n\t\t\tconst response = await fetchMe({})\n\t\t\tconst person = response.person\n\t\t\tconst projects = response.projects\n\t\t\tconst permissions = response.permissions ?? { canCreateProject: false }\n\n\t\t\tsetIdentityState({\n\t\t\t\tstate: 'success',\n\t\t\t\tidentity: {\n\t\t\t\t\tid: response.id,\n\t\t\t\t\troles: response.roles ?? [],\n\t\t\t\t\tperson: person ?? undefined,\n\t\t\t\t\tprojects: projects.map(it => ({\n\t\t\t\t\t\tname: it.project.name,\n\t\t\t\t\t\tslug: it.project.slug,\n\t\t\t\t\t\troles: it.memberships.map(it => it.role),\n\t\t\t\t\t})),\n\t\t\t\t\tpermissions,\n\t\t\t\t},\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t\tif (e instanceof GraphQlClientError && e.response?.status === 401) {\n\t\t\t\tlogout({ noRedirect: true })\n\t\t\t} else {\n\t\t\t\tsetIdentityState({ state: 'failed', identity: undefined })\n\t\t\t}\n\t\t}\n\t}, [fetchMe, logout])\n\n\treturn [\n\t\tidentityState,\n\t\tuseMemo((): IdentityMethods => ({\n\t\t\tclearIdentity,\n\t\t\trefreshIdentity: fetch,\n\t\t}), [clearIdentity, fetch]),\n\t]\n}\n"],"names":["useSessionToken","useMeQuery","useState","useCallback","useLogoutInternal","it","GraphQlClientError","useMemo"],"mappings":";;;;;;AAMO,MAAM,mBAAmB,MAAwF;AACvH,QAAM,eAAeA,YAAAA,gBAAgB;AACrC,QAAM,UAAUC,WAAAA,WAAW;AAE3B,QAAM,CAAC,eAAe,gBAAgB,IAAIC,MAAiD,SAAA,EAAE,OAAO,eAAe,YAAY,QAAQ,UAAU,OAAA,CAAW;AAE5J,QAAM,gBAAgBC,MAAAA,YAAY,MAAM,iBAAiB,EAAE,OAAO,WAAW,UAAU,OAAW,CAAA,GAAG,CAAA,CAAE;AACjG,QAAA,SAASC,oCAAkB,aAAa;AAExC,QAAA,QAAQD,MAAAA,YAAY,YAAY;AACrC,qBAAiB,EAAE,OAAO,WAAW,UAAU,QAAW;AACtD,QAAA;AACH,YAAM,WAAW,MAAM,QAAQ,EAAE;AACjC,YAAM,SAAS,SAAS;AACxB,YAAM,WAAW,SAAS;AAC1B,YAAM,cAAc,SAAS,eAAe,EAAE,kBAAkB,MAAM;AAErD,uBAAA;AAAA,QAChB,OAAO;AAAA,QACP,UAAU;AAAA,UACT,IAAI,SAAS;AAAA,UACb,OAAO,SAAS,SAAS,CAAC;AAAA,UAC1B,QAAQ,UAAU;AAAA,UAClB,UAAU,SAAS,IAAI,CAAO,QAAA;AAAA,YAC7B,MAAM,GAAG,QAAQ;AAAA,YACjB,MAAM,GAAG,QAAQ;AAAA,YACjB,OAAO,GAAG,YAAY,IAAI,CAAAE,QAAMA,IAAG,IAAI;AAAA,UAAA,EACtC;AAAA,UACF;AAAA,QAAA;AAAA,MACD,CACA;AAAA,aACO,GAAG;AACX,cAAQ,MAAM,CAAC;AACf,UAAI,aAAaC,YAAAA,sBAAsB,EAAE,UAAU,WAAW,KAAK;AAC3D,eAAA,EAAE,YAAY,MAAM;AAAA,MAAA,OACrB;AACN,yBAAiB,EAAE,OAAO,UAAU,UAAU,QAAW;AAAA,MAAA;AAAA,IAC1D;AAAA,EACD,GACE,CAAC,SAAS,MAAM,CAAC;AAEb,SAAA;AAAA,IACN;AAAA,IACAC,MAAAA,QAAQ,OAAwB;AAAA,MAC/B;AAAA,MACA,iBAAiB;AAAA,IAAA,IACd,CAAC,eAAe,KAAK,CAAC;AAAA,EAC3B;AACD;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState, useCallback, useMemo } from "react";
|
|
2
|
-
import { useSessionToken } from "@contember/react-client";
|
|
2
|
+
import { useSessionToken, GraphQlClientError } from "@contember/react-client";
|
|
3
3
|
import { useLogoutInternal } from "../internal/hooks/useLogoutInternal.js";
|
|
4
4
|
import { useMeQuery } from "./queries/useMeQuery.js";
|
|
5
5
|
const useFetchIdentity = () => {
|
|
@@ -19,6 +19,7 @@ const useFetchIdentity = () => {
|
|
|
19
19
|
state: "success",
|
|
20
20
|
identity: {
|
|
21
21
|
id: response.id,
|
|
22
|
+
roles: response.roles ?? [],
|
|
22
23
|
person: person ?? void 0,
|
|
23
24
|
projects: projects.map((it) => ({
|
|
24
25
|
name: it.project.name,
|
|
@@ -30,9 +31,8 @@ const useFetchIdentity = () => {
|
|
|
30
31
|
});
|
|
31
32
|
} catch (e) {
|
|
32
33
|
console.error(e);
|
|
33
|
-
if (
|
|
34
|
+
if (e instanceof GraphQlClientError && e.response?.status === 401) {
|
|
34
35
|
logout({ noRedirect: true });
|
|
35
|
-
setIdentityState({ state: "cleared", identity: void 0 });
|
|
36
36
|
} else {
|
|
37
37
|
setIdentityState({ state: "failed", identity: void 0 });
|
|
38
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFetchIdentity.js","sources":["../../../../../packages/react-client-tenant/src/hooks/useFetchIdentity.ts"],"sourcesContent":["import { useCallback, useMemo, useState } from 'react'\nimport { Identity, IdentityMethods, IdentityStateValue } from '../types'\nimport { useSessionToken } from '@contember/react-client'\nimport { useLogoutInternal } from '../internal/hooks/useLogoutInternal'\nimport { useMeQuery } from './queries'\n\nexport const useFetchIdentity = (): [{ state: IdentityStateValue; identity: Identity | undefined }, IdentityMethods] => {\n\tconst sessionToken = useSessionToken()\n\tconst fetchMe = useMeQuery()\n\n\tconst [identityState, setIdentityState] = useState<ReturnType<typeof useFetchIdentity>[0]>({ state: sessionToken ? 'loading' : 'none', identity: undefined })\n\n\tconst clearIdentity = useCallback(() => setIdentityState({ state: 'cleared', identity: undefined }), [])\n\tconst logout = useLogoutInternal(clearIdentity)\n\n\tconst fetch = useCallback(async () => {\n\t\tsetIdentityState({ state: 'loading', identity: undefined })\n\t\ttry {\n\t\t\tconst response = await fetchMe({})\n\t\t\tconst person = response.person\n\t\t\tconst projects = response.projects\n\t\t\tconst permissions = response.permissions ?? { canCreateProject: false }\n\n\t\t\tsetIdentityState({\n\t\t\t\tstate: 'success',\n\t\t\t\tidentity: {\n\t\t\t\t\tid: response.id,\n\t\t\t\t\tperson: person ?? undefined,\n\t\t\t\t\tprojects: projects.map(it => ({\n\t\t\t\t\t\tname: it.project.name,\n\t\t\t\t\t\tslug: it.project.slug,\n\t\t\t\t\t\troles: it.memberships.map(it => it.role),\n\t\t\t\t\t})),\n\t\t\t\t\tpermissions,\n\t\t\t\t},\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t\tif (
|
|
1
|
+
{"version":3,"file":"useFetchIdentity.js","sources":["../../../../../packages/react-client-tenant/src/hooks/useFetchIdentity.ts"],"sourcesContent":["import { useCallback, useMemo, useState } from 'react'\nimport { Identity, IdentityMethods, IdentityStateValue } from '../types'\nimport { GraphQlClientError, useSessionToken } from '@contember/react-client'\nimport { useLogoutInternal } from '../internal/hooks/useLogoutInternal'\nimport { useMeQuery } from './queries'\n\nexport const useFetchIdentity = (): [{ state: IdentityStateValue; identity: Identity | undefined }, IdentityMethods] => {\n\tconst sessionToken = useSessionToken()\n\tconst fetchMe = useMeQuery()\n\n\tconst [identityState, setIdentityState] = useState<ReturnType<typeof useFetchIdentity>[0]>({ state: sessionToken ? 'loading' : 'none', identity: undefined })\n\n\tconst clearIdentity = useCallback(() => setIdentityState({ state: 'cleared', identity: undefined }), [])\n\tconst logout = useLogoutInternal(clearIdentity)\n\n\tconst fetch = useCallback(async () => {\n\t\tsetIdentityState({ state: 'loading', identity: undefined })\n\t\ttry {\n\t\t\tconst response = await fetchMe({})\n\t\t\tconst person = response.person\n\t\t\tconst projects = response.projects\n\t\t\tconst permissions = response.permissions ?? { canCreateProject: false }\n\n\t\t\tsetIdentityState({\n\t\t\t\tstate: 'success',\n\t\t\t\tidentity: {\n\t\t\t\t\tid: response.id,\n\t\t\t\t\troles: response.roles ?? [],\n\t\t\t\t\tperson: person ?? undefined,\n\t\t\t\t\tprojects: projects.map(it => ({\n\t\t\t\t\t\tname: it.project.name,\n\t\t\t\t\t\tslug: it.project.slug,\n\t\t\t\t\t\troles: it.memberships.map(it => it.role),\n\t\t\t\t\t})),\n\t\t\t\t\tpermissions,\n\t\t\t\t},\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t\tif (e instanceof GraphQlClientError && e.response?.status === 401) {\n\t\t\t\tlogout({ noRedirect: true })\n\t\t\t} else {\n\t\t\t\tsetIdentityState({ state: 'failed', identity: undefined })\n\t\t\t}\n\t\t}\n\t}, [fetchMe, logout])\n\n\treturn [\n\t\tidentityState,\n\t\tuseMemo((): IdentityMethods => ({\n\t\t\tclearIdentity,\n\t\t\trefreshIdentity: fetch,\n\t\t}), [clearIdentity, fetch]),\n\t]\n}\n"],"names":["it"],"mappings":";;;;AAMO,MAAM,mBAAmB,MAAwF;AACvH,QAAM,eAAe,gBAAgB;AACrC,QAAM,UAAU,WAAW;AAE3B,QAAM,CAAC,eAAe,gBAAgB,IAAI,SAAiD,EAAE,OAAO,eAAe,YAAY,QAAQ,UAAU,OAAA,CAAW;AAE5J,QAAM,gBAAgB,YAAY,MAAM,iBAAiB,EAAE,OAAO,WAAW,UAAU,OAAW,CAAA,GAAG,CAAA,CAAE;AACjG,QAAA,SAAS,kBAAkB,aAAa;AAExC,QAAA,QAAQ,YAAY,YAAY;AACrC,qBAAiB,EAAE,OAAO,WAAW,UAAU,QAAW;AACtD,QAAA;AACH,YAAM,WAAW,MAAM,QAAQ,EAAE;AACjC,YAAM,SAAS,SAAS;AACxB,YAAM,WAAW,SAAS;AAC1B,YAAM,cAAc,SAAS,eAAe,EAAE,kBAAkB,MAAM;AAErD,uBAAA;AAAA,QAChB,OAAO;AAAA,QACP,UAAU;AAAA,UACT,IAAI,SAAS;AAAA,UACb,OAAO,SAAS,SAAS,CAAC;AAAA,UAC1B,QAAQ,UAAU;AAAA,UAClB,UAAU,SAAS,IAAI,CAAO,QAAA;AAAA,YAC7B,MAAM,GAAG,QAAQ;AAAA,YACjB,MAAM,GAAG,QAAQ;AAAA,YACjB,OAAO,GAAG,YAAY,IAAI,CAAAA,QAAMA,IAAG,IAAI;AAAA,UAAA,EACtC;AAAA,UACF;AAAA,QAAA;AAAA,MACD,CACA;AAAA,aACO,GAAG;AACX,cAAQ,MAAM,CAAC;AACf,UAAI,aAAa,sBAAsB,EAAE,UAAU,WAAW,KAAK;AAC3D,eAAA,EAAE,YAAY,MAAM;AAAA,MAAA,OACrB;AACN,yBAAiB,EAAE,OAAO,UAAU,UAAU,QAAW;AAAA,MAAA;AAAA,IAC1D;AAAA,EACD,GACE,CAAC,SAAS,MAAM,CAAC;AAEb,SAAA;AAAA,IACN;AAAA,IACA,QAAQ,OAAwB;AAAA,MAC/B;AAAA,MACA,iBAAiB;AAAA,IAAA,IACd,CAAC,eAAe,KAAK,CAAC;AAAA,EAC3B;AACD;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLogout.cjs","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":["useIdentityMethods","useLogoutInternal"],"mappings":";;;;AAGO,MAAM,YAAY,MAAM;AACxB,QAAA,EAAE,
|
|
1
|
+
{"version":3,"file":"useLogout.cjs","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":["useIdentityMethods","useLogoutInternal"],"mappings":";;;;AAGO,MAAM,YAAY,MAAM;AACxB,QAAA,EAAE,cAAc,IAAIA,4BAAmB;AAC7C,SAAOC,kBAAAA,kBAAkB,aAAa;AACvC;;"}
|
|
@@ -1 +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;AACxB,QAAA,EAAE,
|
|
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;AACxB,QAAA,EAAE,cAAc,IAAI,mBAAmB;AAC7C,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\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,MAAoG;AACjI,QAAM,oBAAoB,aAAa,QAAQA,OAAAA,gCAAgC,KAAK;AACpF,QAAM,YAAY,IAAI,gBAAgB,OAAO,SAAS,MAAM;AACtD,QAAA,YAAY,UAAU,IAAI,YAAY;AACtC,QAAA,QAAQ,UAAU,IAAI,OAAO;AAEnC,SAAO,EAAE,uBAAuB,mBAAmB,cAAc,WAAW,UAAU,MAAM;AAC7F;AASa,MAAA,8BAA8B,CAAC,EAAE,YAAY,GAAG,WAAW,mBAGpE,IAAA,OAAO;AACV,QAAM,EAAE,uBAAuB,cAAc,SAAA,IAAa,sBAAsB;AAChF,QAAM,cAAcC,mCAAAA,mCAAmC;AAEvD,QAAM,CAAC,OAAO,QAAQ,IAAIC,eAA2C,MAAM;AAC1E,QAAI,gBAAgB,UAAU;AAC7B,UAAI,0BAA0B,cAAc;AACpC,eAAA,EAAE,MAAM,iBAAiB;AAAA,MAAA,OAC1B;AACC,eAAA,EAAE,MAAM,uBAAuB;AAAA,MAAA;AAAA,IACvC;AAEM,WAAA,EAAE,MAAM,QAAQ;AAAA,EAAA,CACvB;AAEDC,QAAAA,UAAU,MAAM;AACf,KAAC,YAAY;AACR,UAAA,MAAM,SAAS,kBAAkB;AAC9B,cAAA,UAAUC,UAAAA,aAAa,WAAW,QAAQ;AAC5C,YAAA;AACG,gBAAA,SAAS,MAAM,YAAY;AAAA,YAChC,WAAW;AAAA,YACX,OAAO;AAAA,YACP,SAAS,MAAMC,sBAAc,WAAW,OAAO;AAAA,UAAA,CAC/C;AACG,cAAA,CAAC,OAAO,IAAI;AACf,qBAAS,EAAE,MAAM,yBAAyB,OAAO,OAAO,OAAO;AAAA,UAAA,OACzD;AACN,qBAAS,EAAE,MAAM,iBAAiB,KAAK,SAAS;AAAA,UAAA;AAAA,iBAEzC,GAAG;AACX,kBAAQ,MAAM,CAAC;AACf,mBAAS,EAAE,MAAM,yBAAyB,OAAO,iBAAiB;AAAA,QAAA;AAAA,MACnE;AAAA,IACD,GACE;AAAA,EAAA,GACD,CAAC,aAAa,uBAAuB,UAAU,WAAW,MAAM,MAAM,cAAc,QAAQ,CAAC;AAEzF,SAAA;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
|