@contember/react-client-tenant 2.1.0-alpha.36 → 2.1.0-alpha.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/development/index.cjs +159 -0
- package/dist/development/index.cjs.map +1 -0
- package/dist/development/index.js +159 -0
- package/dist/development/index.js.map +1 -0
- package/dist/development/src/components/IdentityProvider.cjs +38 -0
- package/dist/development/src/components/IdentityProvider.cjs.map +1 -0
- package/dist/development/src/components/IdentityProvider.js +38 -0
- package/dist/development/src/components/IdentityProvider.js.map +1 -0
- package/dist/development/src/components/IdentityState.cjs +14 -0
- package/dist/development/src/components/IdentityState.cjs.map +1 -0
- package/dist/development/src/components/IdentityState.js +14 -0
- package/dist/development/src/components/IdentityState.js.map +1 -0
- package/dist/development/src/components/forms/ChangeMyPasswordForm.cjs +59 -0
- package/dist/development/src/components/forms/ChangeMyPasswordForm.cjs.map +1 -0
- package/dist/development/src/components/forms/ChangeMyPasswordForm.js +59 -0
- package/dist/development/src/components/forms/ChangeMyPasswordForm.js.map +1 -0
- package/dist/development/src/components/forms/CreateApiKeyForm.cjs +57 -0
- package/dist/development/src/components/forms/CreateApiKeyForm.cjs.map +1 -0
- package/dist/development/src/components/forms/CreateApiKeyForm.js +57 -0
- package/dist/development/src/components/forms/CreateApiKeyForm.js.map +1 -0
- package/dist/development/src/components/forms/CreateSessionTokenForm.cjs +50 -0
- package/dist/development/src/components/forms/CreateSessionTokenForm.cjs.map +1 -0
- package/dist/development/src/components/forms/CreateSessionTokenForm.js +50 -0
- package/dist/development/src/components/forms/CreateSessionTokenForm.js.map +1 -0
- package/dist/development/src/components/forms/InviteForm.cjs +62 -0
- package/dist/development/src/components/forms/InviteForm.cjs.map +1 -0
- package/dist/development/src/components/forms/InviteForm.js +62 -0
- package/dist/development/src/components/forms/InviteForm.js.map +1 -0
- package/dist/development/src/components/forms/LoginForm.cjs +87 -0
- package/dist/development/src/components/forms/LoginForm.cjs.map +1 -0
- package/dist/development/src/components/forms/LoginForm.js +87 -0
- package/dist/development/src/components/forms/LoginForm.js.map +1 -0
- package/dist/development/src/components/forms/OtpConfirmForm.cjs +49 -0
- package/dist/development/src/components/forms/OtpConfirmForm.cjs.map +1 -0
- package/dist/development/src/components/forms/OtpConfirmForm.js +49 -0
- package/dist/development/src/components/forms/OtpConfirmForm.js.map +1 -0
- package/dist/development/src/components/forms/OtpPrepareForm.cjs +36 -0
- package/dist/development/src/components/forms/OtpPrepareForm.cjs.map +1 -0
- package/dist/development/src/components/forms/OtpPrepareForm.js +36 -0
- package/dist/development/src/components/forms/OtpPrepareForm.js.map +1 -0
- package/dist/development/src/components/forms/PasswordResetForm.cjs +63 -0
- package/dist/development/src/components/forms/PasswordResetForm.cjs.map +1 -0
- package/dist/development/src/components/forms/PasswordResetForm.js +63 -0
- package/dist/development/src/components/forms/PasswordResetForm.js.map +1 -0
- package/dist/development/src/components/forms/PasswordResetRequestForm.cjs +49 -0
- package/dist/development/src/components/forms/PasswordResetRequestForm.cjs.map +1 -0
- package/dist/development/src/components/forms/PasswordResetRequestForm.js +49 -0
- package/dist/development/src/components/forms/PasswordResetRequestForm.js.map +1 -0
- package/dist/development/src/components/forms/PasswordlessSignInForm.cjs +79 -0
- package/dist/development/src/components/forms/PasswordlessSignInForm.cjs.map +1 -0
- package/dist/development/src/components/forms/PasswordlessSignInForm.js +79 -0
- package/dist/development/src/components/forms/PasswordlessSignInForm.js.map +1 -0
- package/dist/development/src/components/forms/PasswordlessSignInInitForm.cjs +59 -0
- package/dist/development/src/components/forms/PasswordlessSignInInitForm.cjs.map +1 -0
- package/dist/development/src/components/forms/PasswordlessSignInInitForm.js +59 -0
- package/dist/development/src/components/forms/PasswordlessSignInInitForm.js.map +1 -0
- package/dist/development/src/components/forms/TenantForm.cjs +101 -0
- package/dist/development/src/components/forms/TenantForm.cjs.map +1 -0
- package/dist/development/src/components/forms/TenantForm.js +101 -0
- package/dist/development/src/components/forms/TenantForm.js.map +1 -0
- package/dist/development/src/components/forms/UpdateProjectMemberForm.cjs +64 -0
- package/dist/development/src/components/forms/UpdateProjectMemberForm.cjs.map +1 -0
- package/dist/development/src/components/forms/UpdateProjectMemberForm.js +64 -0
- package/dist/development/src/components/forms/UpdateProjectMemberForm.js.map +1 -0
- package/dist/development/src/components/idp/IDP.cjs +56 -0
- package/dist/development/src/components/idp/IDP.cjs.map +1 -0
- package/dist/development/src/components/idp/IDP.js +56 -0
- package/dist/development/src/components/idp/IDP.js.map +1 -0
- package/dist/development/src/components/idp/IDPInitTrigger.cjs +16 -0
- package/dist/development/src/components/idp/IDPInitTrigger.cjs.map +1 -0
- package/dist/development/src/components/idp/IDPInitTrigger.js +16 -0
- package/dist/development/src/components/idp/IDPInitTrigger.js.map +1 -0
- package/dist/development/src/components/idp/IDPState.cjs +14 -0
- package/dist/development/src/components/idp/IDPState.cjs.map +1 -0
- package/dist/development/src/components/idp/IDPState.js +14 -0
- package/dist/development/src/components/idp/IDPState.js.map +1 -0
- package/dist/development/src/components/triggers/DisableOtpTrigger.cjs +32 -0
- package/dist/development/src/components/triggers/DisableOtpTrigger.cjs.map +1 -0
- package/dist/development/src/components/triggers/DisableOtpTrigger.js +32 -0
- package/dist/development/src/components/triggers/DisableOtpTrigger.js.map +1 -0
- package/dist/development/src/components/triggers/LogoutTrigger.cjs +16 -0
- package/dist/development/src/components/triggers/LogoutTrigger.cjs.map +1 -0
- package/dist/development/src/components/triggers/LogoutTrigger.js +16 -0
- package/dist/development/src/components/triggers/LogoutTrigger.js.map +1 -0
- package/dist/development/src/components/triggers/RemoveProjectMemberTrigger.cjs +17 -0
- package/dist/development/src/components/triggers/RemoveProjectMemberTrigger.cjs.map +1 -0
- package/dist/development/src/components/triggers/RemoveProjectMemberTrigger.js +17 -0
- package/dist/development/src/components/triggers/RemoveProjectMemberTrigger.js.map +1 -0
- package/dist/development/src/components/triggers/TenantActionTrigger.cjs +37 -0
- package/dist/development/src/components/triggers/TenantActionTrigger.cjs.map +1 -0
- package/dist/development/src/components/triggers/TenantActionTrigger.js +37 -0
- package/dist/development/src/components/triggers/TenantActionTrigger.js.map +1 -0
- package/dist/development/src/consts.cjs +5 -0
- package/dist/development/src/consts.cjs.map +1 -0
- package/dist/development/src/consts.js +5 -0
- package/dist/development/src/consts.js.map +1 -0
- package/dist/development/src/contexts.cjs +34 -0
- package/dist/development/src/contexts.cjs.map +1 -0
- package/dist/development/src/contexts.js +34 -0
- package/dist/development/src/contexts.js.map +1 -0
- package/dist/development/src/hooks/mutations/apiKey/useCreateApiKeyMutation.cjs +30 -0
- package/dist/development/src/hooks/mutations/apiKey/useCreateApiKeyMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/apiKey/useCreateApiKeyMutation.js +13 -0
- package/dist/development/src/hooks/mutations/apiKey/useCreateApiKeyMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/apiKey/useCreateGlobalApiKeyMutation.cjs +30 -0
- package/dist/development/src/hooks/mutations/apiKey/useCreateGlobalApiKeyMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/apiKey/useCreateGlobalApiKeyMutation.js +13 -0
- package/dist/development/src/hooks/mutations/apiKey/useCreateGlobalApiKeyMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/apiKey/useCreateSessionTokenMutation.cjs +30 -0
- package/dist/development/src/hooks/mutations/apiKey/useCreateSessionTokenMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/apiKey/useCreateSessionTokenMutation.js +13 -0
- package/dist/development/src/hooks/mutations/apiKey/useCreateSessionTokenMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/apiKey/useDisableApiKeyMutation.cjs +29 -0
- package/dist/development/src/hooks/mutations/apiKey/useDisableApiKeyMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/apiKey/useDisableApiKeyMutation.js +12 -0
- package/dist/development/src/hooks/mutations/apiKey/useDisableApiKeyMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/auth/useChangeMyPasswordMutation.cjs +29 -0
- package/dist/development/src/hooks/mutations/auth/useChangeMyPasswordMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/auth/useChangeMyPasswordMutation.js +12 -0
- package/dist/development/src/hooks/mutations/auth/useChangeMyPasswordMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/auth/useSignInMutation.cjs +33 -0
- package/dist/development/src/hooks/mutations/auth/useSignInMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/auth/useSignInMutation.js +16 -0
- package/dist/development/src/hooks/mutations/auth/useSignInMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/auth/useSignOutMutation.cjs +29 -0
- package/dist/development/src/hooks/mutations/auth/useSignOutMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/auth/useSignOutMutation.js +12 -0
- package/dist/development/src/hooks/mutations/auth/useSignOutMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/idp/useInitSignInIDPMutation.cjs +31 -0
- package/dist/development/src/hooks/mutations/idp/useInitSignInIDPMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/idp/useInitSignInIDPMutation.js +14 -0
- package/dist/development/src/hooks/mutations/idp/useInitSignInIDPMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/idp/useSignInIdpMutation.cjs +36 -0
- package/dist/development/src/hooks/mutations/idp/useSignInIdpMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/idp/useSignInIdpMutation.js +19 -0
- package/dist/development/src/hooks/mutations/idp/useSignInIdpMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/invite/useInviteMutation.cjs +30 -0
- package/dist/development/src/hooks/mutations/invite/useInviteMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/invite/useInviteMutation.js +13 -0
- package/dist/development/src/hooks/mutations/invite/useInviteMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/memberships/useAddProjectMemberMutation.cjs +29 -0
- package/dist/development/src/hooks/mutations/memberships/useAddProjectMemberMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/memberships/useAddProjectMemberMutation.js +12 -0
- package/dist/development/src/hooks/mutations/memberships/useAddProjectMemberMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/memberships/useRemoveProjectMemberMutation.cjs +29 -0
- package/dist/development/src/hooks/mutations/memberships/useRemoveProjectMemberMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/memberships/useRemoveProjectMemberMutation.js +12 -0
- package/dist/development/src/hooks/mutations/memberships/useRemoveProjectMemberMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/memberships/useUpdateProjectMemberMutation.cjs +29 -0
- package/dist/development/src/hooks/mutations/memberships/useUpdateProjectMemberMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/memberships/useUpdateProjectMemberMutation.js +12 -0
- package/dist/development/src/hooks/mutations/memberships/useUpdateProjectMemberMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/otp/useConfirmOtpMutation.cjs +29 -0
- package/dist/development/src/hooks/mutations/otp/useConfirmOtpMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/otp/useConfirmOtpMutation.js +12 -0
- package/dist/development/src/hooks/mutations/otp/useConfirmOtpMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/otp/useDisableOtpMutation.cjs +29 -0
- package/dist/development/src/hooks/mutations/otp/useDisableOtpMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/otp/useDisableOtpMutation.js +12 -0
- package/dist/development/src/hooks/mutations/otp/useDisableOtpMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/otp/usePrepareOtpMutation.cjs +30 -0
- package/dist/development/src/hooks/mutations/otp/usePrepareOtpMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/otp/usePrepareOtpMutation.js +13 -0
- package/dist/development/src/hooks/mutations/otp/usePrepareOtpMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/passwordReset/useCreateResetPasswordRequestMutation.cjs +32 -0
- package/dist/development/src/hooks/mutations/passwordReset/useCreateResetPasswordRequestMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/passwordReset/useCreateResetPasswordRequestMutation.js +15 -0
- package/dist/development/src/hooks/mutations/passwordReset/useCreateResetPasswordRequestMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/passwordReset/useResetPasswordMutation.cjs +32 -0
- package/dist/development/src/hooks/mutations/passwordReset/useResetPasswordMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/passwordReset/useResetPasswordMutation.js +15 -0
- package/dist/development/src/hooks/mutations/passwordReset/useResetPasswordMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/passwordless/useActivatePasswordlessOtpMutation.cjs +31 -0
- package/dist/development/src/hooks/mutations/passwordless/useActivatePasswordlessOtpMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/passwordless/useActivatePasswordlessOtpMutation.js +14 -0
- package/dist/development/src/hooks/mutations/passwordless/useActivatePasswordlessOtpMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/passwordless/useDisableMyPasswordlessMutation.cjs +28 -0
- package/dist/development/src/hooks/mutations/passwordless/useDisableMyPasswordlessMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/passwordless/useDisableMyPasswordlessMutation.js +11 -0
- package/dist/development/src/hooks/mutations/passwordless/useDisableMyPasswordlessMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/passwordless/useEnableMyPasswordlessMutation.cjs +28 -0
- package/dist/development/src/hooks/mutations/passwordless/useEnableMyPasswordlessMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/passwordless/useEnableMyPasswordlessMutation.js +11 -0
- package/dist/development/src/hooks/mutations/passwordless/useEnableMyPasswordlessMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/passwordless/useInitSignInPasswordlessMutation.cjs +32 -0
- package/dist/development/src/hooks/mutations/passwordless/useInitSignInPasswordlessMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/passwordless/useInitSignInPasswordlessMutation.js +15 -0
- package/dist/development/src/hooks/mutations/passwordless/useInitSignInPasswordlessMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/passwordless/useSignInPasswordlessMutation.cjs +32 -0
- package/dist/development/src/hooks/mutations/passwordless/useSignInPasswordlessMutation.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/passwordless/useSignInPasswordlessMutation.js +15 -0
- package/dist/development/src/hooks/mutations/passwordless/useSignInPasswordlessMutation.js.map +1 -0
- package/dist/development/src/hooks/mutations/profile/useChangeMyProfile.cjs +29 -0
- package/dist/development/src/hooks/mutations/profile/useChangeMyProfile.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/profile/useChangeMyProfile.js +12 -0
- package/dist/development/src/hooks/mutations/profile/useChangeMyProfile.js.map +1 -0
- package/dist/development/src/hooks/mutations/profile/useChangeProfile.cjs +29 -0
- package/dist/development/src/hooks/mutations/profile/useChangeProfile.cjs.map +1 -0
- package/dist/development/src/hooks/mutations/profile/useChangeProfile.js +12 -0
- package/dist/development/src/hooks/mutations/profile/useChangeProfile.js.map +1 -0
- package/dist/development/src/hooks/queries/useMeQuery.cjs +33 -0
- package/dist/development/src/hooks/queries/useMeQuery.cjs.map +1 -0
- package/dist/development/src/hooks/queries/useMeQuery.js +16 -0
- package/dist/development/src/hooks/queries/useMeQuery.js.map +1 -0
- package/dist/development/src/hooks/queries/useProjectMembersQuery.cjs +53 -0
- package/dist/development/src/hooks/queries/useProjectMembersQuery.cjs.map +1 -0
- package/dist/development/src/hooks/queries/useProjectMembersQuery.js +36 -0
- package/dist/development/src/hooks/queries/useProjectMembersQuery.js.map +1 -0
- package/dist/development/src/hooks/queries/useProjectMembershipsQuery.cjs +34 -0
- package/dist/development/src/hooks/queries/useProjectMembershipsQuery.cjs.map +1 -0
- package/dist/development/src/hooks/queries/useProjectMembershipsQuery.js +17 -0
- package/dist/development/src/hooks/queries/useProjectMembershipsQuery.js.map +1 -0
- package/dist/development/src/hooks/queries/useProjectRolesDefinitionQuery.cjs +36 -0
- package/dist/development/src/hooks/queries/useProjectRolesDefinitionQuery.cjs.map +1 -0
- package/dist/development/src/hooks/queries/useProjectRolesDefinitionQuery.js +19 -0
- package/dist/development/src/hooks/queries/useProjectRolesDefinitionQuery.js.map +1 -0
- package/dist/development/src/hooks/useFetchIdentity.cjs +55 -0
- package/dist/development/src/hooks/useFetchIdentity.cjs.map +1 -0
- package/dist/development/src/hooks/useFetchIdentity.js +55 -0
- package/dist/development/src/hooks/useFetchIdentity.js.map +1 -0
- package/dist/development/src/hooks/useLogout.cjs +10 -0
- package/dist/development/src/hooks/useLogout.cjs.map +1 -0
- package/dist/development/src/hooks/useLogout.js +10 -0
- package/dist/development/src/hooks/useLogout.js.map +1 -0
- package/dist/development/src/hooks/usePasswordlessOtpActivator.cjs +53 -0
- package/dist/development/src/hooks/usePasswordlessOtpActivator.cjs.map +1 -0
- package/dist/development/src/hooks/usePasswordlessOtpActivator.js +53 -0
- package/dist/development/src/hooks/usePasswordlessOtpActivator.js.map +1 -0
- package/dist/development/src/hooks/useTenantApi.cjs +36 -0
- package/dist/development/src/hooks/useTenantApi.cjs.map +1 -0
- package/dist/development/src/hooks/useTenantApi.js +36 -0
- package/dist/development/src/hooks/useTenantApi.js.map +1 -0
- package/dist/development/src/hooks/useTenantMutation.cjs +33 -0
- package/dist/development/src/hooks/useTenantMutation.cjs.map +1 -0
- package/dist/development/src/hooks/useTenantMutation.js +33 -0
- package/dist/development/src/hooks/useTenantMutation.js.map +1 -0
- package/dist/development/src/hooks/useTenantQueryLoader.cjs +36 -0
- package/dist/development/src/hooks/useTenantQueryLoader.cjs.map +1 -0
- package/dist/development/src/hooks/useTenantQueryLoader.js +36 -0
- package/dist/development/src/hooks/useTenantQueryLoader.js.map +1 -0
- package/dist/development/src/internal/hooks/useHandleIDPResponse.cjs +51 -0
- package/dist/development/src/internal/hooks/useHandleIDPResponse.cjs.map +1 -0
- package/dist/development/src/internal/hooks/useHandleIDPResponse.js +51 -0
- package/dist/development/src/internal/hooks/useHandleIDPResponse.js.map +1 -0
- package/dist/development/src/internal/hooks/useIDPAutoInit.cjs +19 -0
- package/dist/development/src/internal/hooks/useIDPAutoInit.cjs.map +1 -0
- package/dist/development/src/internal/hooks/useIDPAutoInit.js +19 -0
- package/dist/development/src/internal/hooks/useIDPAutoInit.js.map +1 -0
- package/dist/development/src/internal/hooks/useIDPStateStore.cjs +19 -0
- package/dist/development/src/internal/hooks/useIDPStateStore.cjs.map +1 -0
- package/dist/development/src/internal/hooks/useIDPStateStore.js +19 -0
- package/dist/development/src/internal/hooks/useIDPStateStore.js.map +1 -0
- package/dist/development/src/internal/hooks/useInitIDPRedirect.cjs +44 -0
- package/dist/development/src/internal/hooks/useInitIDPRedirect.cjs.map +1 -0
- package/dist/development/src/internal/hooks/useInitIDPRedirect.js +44 -0
- package/dist/development/src/internal/hooks/useInitIDPRedirect.js.map +1 -0
- package/dist/development/src/internal/hooks/useLogoutInternal.cjs +35 -0
- package/dist/development/src/internal/hooks/useLogoutInternal.cjs.map +1 -0
- package/dist/development/src/internal/hooks/useLogoutInternal.js +35 -0
- package/dist/development/src/internal/hooks/useLogoutInternal.js.map +1 -0
- package/dist/development/src/internal/hooks/useRedirectToBacklink.cjs +36 -0
- package/dist/development/src/internal/hooks/useRedirectToBacklink.cjs.map +1 -0
- package/dist/development/src/internal/hooks/useRedirectToBacklink.js +36 -0
- package/dist/development/src/internal/hooks/useRedirectToBacklink.js.map +1 -0
- package/dist/development/src/internal/utils/getBaseHref.cjs +8 -0
- package/dist/development/src/internal/utils/getBaseHref.cjs.map +1 -0
- package/dist/development/src/internal/utils/getBaseHref.js +8 -0
- package/dist/development/src/internal/utils/getBaseHref.js.map +1 -0
- package/dist/development/src/internal/utils/hashing.cjs +8 -0
- package/dist/development/src/internal/utils/hashing.cjs.map +1 -0
- package/dist/development/src/internal/utils/hashing.js +8 -0
- package/dist/development/src/internal/utils/hashing.js.map +1 -0
- package/dist/development/src/internal/utils/randomInt.cjs +29 -0
- package/dist/development/src/internal/utils/randomInt.cjs.map +1 -0
- package/dist/development/src/internal/utils/randomInt.js +29 -0
- package/dist/development/src/internal/utils/randomInt.js.map +1 -0
- package/dist/production/index.cjs +159 -0
- package/dist/production/index.cjs.map +1 -0
- package/dist/production/index.js +159 -0
- package/dist/production/index.js.map +1 -0
- package/dist/production/src/components/IdentityProvider.cjs +26 -0
- package/dist/production/src/components/IdentityProvider.cjs.map +1 -0
- package/dist/production/src/components/IdentityProvider.js +26 -0
- package/dist/production/src/components/IdentityProvider.js.map +1 -0
- package/dist/production/src/components/IdentityState.cjs +10 -0
- package/dist/production/src/components/IdentityState.cjs.map +1 -0
- package/dist/production/src/components/IdentityState.js +10 -0
- package/dist/production/src/components/IdentityState.js.map +1 -0
- package/dist/production/src/components/forms/ChangeMyPasswordForm.cjs +51 -0
- package/dist/production/src/components/forms/ChangeMyPasswordForm.cjs.map +1 -0
- package/dist/production/src/components/forms/ChangeMyPasswordForm.js +51 -0
- package/dist/production/src/components/forms/ChangeMyPasswordForm.js.map +1 -0
- package/dist/production/src/components/forms/CreateApiKeyForm.cjs +49 -0
- package/dist/production/src/components/forms/CreateApiKeyForm.cjs.map +1 -0
- package/dist/production/src/components/forms/CreateApiKeyForm.js +49 -0
- package/dist/production/src/components/forms/CreateApiKeyForm.js.map +1 -0
- package/dist/production/src/components/forms/CreateSessionTokenForm.cjs +42 -0
- package/dist/production/src/components/forms/CreateSessionTokenForm.cjs.map +1 -0
- package/dist/production/src/components/forms/CreateSessionTokenForm.js +42 -0
- package/dist/production/src/components/forms/CreateSessionTokenForm.js.map +1 -0
- package/dist/production/src/components/forms/InviteForm.cjs +54 -0
- package/dist/production/src/components/forms/InviteForm.cjs.map +1 -0
- package/dist/production/src/components/forms/InviteForm.js +54 -0
- package/dist/production/src/components/forms/InviteForm.js.map +1 -0
- package/dist/production/src/components/forms/LoginForm.cjs +79 -0
- package/dist/production/src/components/forms/LoginForm.cjs.map +1 -0
- package/dist/production/src/components/forms/LoginForm.js +79 -0
- package/dist/production/src/components/forms/LoginForm.js.map +1 -0
- package/dist/production/src/components/forms/OtpConfirmForm.cjs +41 -0
- package/dist/production/src/components/forms/OtpConfirmForm.cjs.map +1 -0
- package/dist/production/src/components/forms/OtpConfirmForm.js +41 -0
- package/dist/production/src/components/forms/OtpConfirmForm.js.map +1 -0
- package/dist/production/src/components/forms/OtpPrepareForm.cjs +28 -0
- package/dist/production/src/components/forms/OtpPrepareForm.cjs.map +1 -0
- package/dist/production/src/components/forms/OtpPrepareForm.js +28 -0
- package/dist/production/src/components/forms/OtpPrepareForm.js.map +1 -0
- package/dist/production/src/components/forms/PasswordResetForm.cjs +55 -0
- package/dist/production/src/components/forms/PasswordResetForm.cjs.map +1 -0
- package/dist/production/src/components/forms/PasswordResetForm.js +55 -0
- package/dist/production/src/components/forms/PasswordResetForm.js.map +1 -0
- package/dist/production/src/components/forms/PasswordResetRequestForm.cjs +41 -0
- package/dist/production/src/components/forms/PasswordResetRequestForm.cjs.map +1 -0
- package/dist/production/src/components/forms/PasswordResetRequestForm.js +41 -0
- package/dist/production/src/components/forms/PasswordResetRequestForm.js.map +1 -0
- package/dist/production/src/components/forms/PasswordlessSignInForm.cjs +71 -0
- package/dist/production/src/components/forms/PasswordlessSignInForm.cjs.map +1 -0
- package/dist/production/src/components/forms/PasswordlessSignInForm.js +71 -0
- package/dist/production/src/components/forms/PasswordlessSignInForm.js.map +1 -0
- package/dist/production/src/components/forms/PasswordlessSignInInitForm.cjs +51 -0
- package/dist/production/src/components/forms/PasswordlessSignInInitForm.cjs.map +1 -0
- package/dist/production/src/components/forms/PasswordlessSignInInitForm.js +51 -0
- package/dist/production/src/components/forms/PasswordlessSignInInitForm.js.map +1 -0
- package/dist/production/src/components/forms/TenantForm.cjs +89 -0
- package/dist/production/src/components/forms/TenantForm.cjs.map +1 -0
- package/dist/production/src/components/forms/TenantForm.js +89 -0
- package/dist/production/src/components/forms/TenantForm.js.map +1 -0
- package/dist/production/src/components/forms/UpdateProjectMemberForm.cjs +56 -0
- package/dist/production/src/components/forms/UpdateProjectMemberForm.cjs.map +1 -0
- package/dist/production/src/components/forms/UpdateProjectMemberForm.js +56 -0
- package/dist/production/src/components/forms/UpdateProjectMemberForm.js.map +1 -0
- package/dist/production/src/components/idp/IDP.cjs +48 -0
- package/dist/production/src/components/idp/IDP.cjs.map +1 -0
- package/dist/production/src/components/idp/IDP.js +48 -0
- package/dist/production/src/components/idp/IDP.js.map +1 -0
- package/dist/production/src/components/idp/IDPInitTrigger.cjs +12 -0
- package/dist/production/src/components/idp/IDPInitTrigger.cjs.map +1 -0
- package/dist/production/src/components/idp/IDPInitTrigger.js +12 -0
- package/dist/production/src/components/idp/IDPInitTrigger.js.map +1 -0
- package/dist/production/src/components/idp/IDPState.cjs +10 -0
- package/dist/production/src/components/idp/IDPState.cjs.map +1 -0
- package/dist/production/src/components/idp/IDPState.js +10 -0
- package/dist/production/src/components/idp/IDPState.js.map +1 -0
- package/dist/production/src/components/triggers/DisableOtpTrigger.cjs +24 -0
- package/dist/production/src/components/triggers/DisableOtpTrigger.cjs.map +1 -0
- package/dist/production/src/components/triggers/DisableOtpTrigger.js +24 -0
- package/dist/production/src/components/triggers/DisableOtpTrigger.js.map +1 -0
- package/dist/production/src/components/triggers/LogoutTrigger.cjs +12 -0
- package/dist/production/src/components/triggers/LogoutTrigger.cjs.map +1 -0
- package/dist/production/src/components/triggers/LogoutTrigger.js +12 -0
- package/dist/production/src/components/triggers/LogoutTrigger.js.map +1 -0
- package/dist/production/src/components/triggers/RemoveProjectMemberTrigger.cjs +13 -0
- package/dist/production/src/components/triggers/RemoveProjectMemberTrigger.cjs.map +1 -0
- package/dist/production/src/components/triggers/RemoveProjectMemberTrigger.js +13 -0
- package/dist/production/src/components/triggers/RemoveProjectMemberTrigger.js.map +1 -0
- package/dist/production/src/components/triggers/TenantActionTrigger.cjs +33 -0
- package/dist/production/src/components/triggers/TenantActionTrigger.cjs.map +1 -0
- package/dist/production/src/components/triggers/TenantActionTrigger.js +33 -0
- package/dist/production/src/components/triggers/TenantActionTrigger.js.map +1 -0
- package/dist/production/src/consts.cjs +5 -0
- package/dist/production/src/consts.cjs.map +1 -0
- package/dist/production/src/consts.js +5 -0
- package/dist/production/src/consts.js.map +1 -0
- package/dist/production/src/contexts.cjs +34 -0
- package/dist/production/src/contexts.cjs.map +1 -0
- package/dist/production/src/contexts.js +34 -0
- package/dist/production/src/contexts.js.map +1 -0
- package/dist/production/src/hooks/mutations/apiKey/useCreateApiKeyMutation.cjs +30 -0
- package/dist/production/src/hooks/mutations/apiKey/useCreateApiKeyMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/apiKey/useCreateApiKeyMutation.js +13 -0
- package/dist/production/src/hooks/mutations/apiKey/useCreateApiKeyMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/apiKey/useCreateGlobalApiKeyMutation.cjs +30 -0
- package/dist/production/src/hooks/mutations/apiKey/useCreateGlobalApiKeyMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/apiKey/useCreateGlobalApiKeyMutation.js +13 -0
- package/dist/production/src/hooks/mutations/apiKey/useCreateGlobalApiKeyMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/apiKey/useCreateSessionTokenMutation.cjs +30 -0
- package/dist/production/src/hooks/mutations/apiKey/useCreateSessionTokenMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/apiKey/useCreateSessionTokenMutation.js +13 -0
- package/dist/production/src/hooks/mutations/apiKey/useCreateSessionTokenMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/apiKey/useDisableApiKeyMutation.cjs +29 -0
- package/dist/production/src/hooks/mutations/apiKey/useDisableApiKeyMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/apiKey/useDisableApiKeyMutation.js +12 -0
- package/dist/production/src/hooks/mutations/apiKey/useDisableApiKeyMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/auth/useChangeMyPasswordMutation.cjs +29 -0
- package/dist/production/src/hooks/mutations/auth/useChangeMyPasswordMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/auth/useChangeMyPasswordMutation.js +12 -0
- package/dist/production/src/hooks/mutations/auth/useChangeMyPasswordMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/auth/useSignInMutation.cjs +33 -0
- package/dist/production/src/hooks/mutations/auth/useSignInMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/auth/useSignInMutation.js +16 -0
- package/dist/production/src/hooks/mutations/auth/useSignInMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/auth/useSignOutMutation.cjs +29 -0
- package/dist/production/src/hooks/mutations/auth/useSignOutMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/auth/useSignOutMutation.js +12 -0
- package/dist/production/src/hooks/mutations/auth/useSignOutMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/idp/useInitSignInIDPMutation.cjs +31 -0
- package/dist/production/src/hooks/mutations/idp/useInitSignInIDPMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/idp/useInitSignInIDPMutation.js +14 -0
- package/dist/production/src/hooks/mutations/idp/useInitSignInIDPMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/idp/useSignInIdpMutation.cjs +36 -0
- package/dist/production/src/hooks/mutations/idp/useSignInIdpMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/idp/useSignInIdpMutation.js +19 -0
- package/dist/production/src/hooks/mutations/idp/useSignInIdpMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/invite/useInviteMutation.cjs +30 -0
- package/dist/production/src/hooks/mutations/invite/useInviteMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/invite/useInviteMutation.js +13 -0
- package/dist/production/src/hooks/mutations/invite/useInviteMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/memberships/useAddProjectMemberMutation.cjs +29 -0
- package/dist/production/src/hooks/mutations/memberships/useAddProjectMemberMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/memberships/useAddProjectMemberMutation.js +12 -0
- package/dist/production/src/hooks/mutations/memberships/useAddProjectMemberMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/memberships/useRemoveProjectMemberMutation.cjs +29 -0
- package/dist/production/src/hooks/mutations/memberships/useRemoveProjectMemberMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/memberships/useRemoveProjectMemberMutation.js +12 -0
- package/dist/production/src/hooks/mutations/memberships/useRemoveProjectMemberMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/memberships/useUpdateProjectMemberMutation.cjs +29 -0
- package/dist/production/src/hooks/mutations/memberships/useUpdateProjectMemberMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/memberships/useUpdateProjectMemberMutation.js +12 -0
- package/dist/production/src/hooks/mutations/memberships/useUpdateProjectMemberMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/otp/useConfirmOtpMutation.cjs +29 -0
- package/dist/production/src/hooks/mutations/otp/useConfirmOtpMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/otp/useConfirmOtpMutation.js +12 -0
- package/dist/production/src/hooks/mutations/otp/useConfirmOtpMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/otp/useDisableOtpMutation.cjs +29 -0
- package/dist/production/src/hooks/mutations/otp/useDisableOtpMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/otp/useDisableOtpMutation.js +12 -0
- package/dist/production/src/hooks/mutations/otp/useDisableOtpMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/otp/usePrepareOtpMutation.cjs +30 -0
- package/dist/production/src/hooks/mutations/otp/usePrepareOtpMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/otp/usePrepareOtpMutation.js +13 -0
- package/dist/production/src/hooks/mutations/otp/usePrepareOtpMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/passwordReset/useCreateResetPasswordRequestMutation.cjs +32 -0
- package/dist/production/src/hooks/mutations/passwordReset/useCreateResetPasswordRequestMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/passwordReset/useCreateResetPasswordRequestMutation.js +15 -0
- package/dist/production/src/hooks/mutations/passwordReset/useCreateResetPasswordRequestMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/passwordReset/useResetPasswordMutation.cjs +32 -0
- package/dist/production/src/hooks/mutations/passwordReset/useResetPasswordMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/passwordReset/useResetPasswordMutation.js +15 -0
- package/dist/production/src/hooks/mutations/passwordReset/useResetPasswordMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/passwordless/useActivatePasswordlessOtpMutation.cjs +31 -0
- package/dist/production/src/hooks/mutations/passwordless/useActivatePasswordlessOtpMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/passwordless/useActivatePasswordlessOtpMutation.js +14 -0
- package/dist/production/src/hooks/mutations/passwordless/useActivatePasswordlessOtpMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/passwordless/useDisableMyPasswordlessMutation.cjs +28 -0
- package/dist/production/src/hooks/mutations/passwordless/useDisableMyPasswordlessMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/passwordless/useDisableMyPasswordlessMutation.js +11 -0
- package/dist/production/src/hooks/mutations/passwordless/useDisableMyPasswordlessMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/passwordless/useEnableMyPasswordlessMutation.cjs +28 -0
- package/dist/production/src/hooks/mutations/passwordless/useEnableMyPasswordlessMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/passwordless/useEnableMyPasswordlessMutation.js +11 -0
- package/dist/production/src/hooks/mutations/passwordless/useEnableMyPasswordlessMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/passwordless/useInitSignInPasswordlessMutation.cjs +32 -0
- package/dist/production/src/hooks/mutations/passwordless/useInitSignInPasswordlessMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/passwordless/useInitSignInPasswordlessMutation.js +15 -0
- package/dist/production/src/hooks/mutations/passwordless/useInitSignInPasswordlessMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/passwordless/useSignInPasswordlessMutation.cjs +32 -0
- package/dist/production/src/hooks/mutations/passwordless/useSignInPasswordlessMutation.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/passwordless/useSignInPasswordlessMutation.js +15 -0
- package/dist/production/src/hooks/mutations/passwordless/useSignInPasswordlessMutation.js.map +1 -0
- package/dist/production/src/hooks/mutations/profile/useChangeMyProfile.cjs +29 -0
- package/dist/production/src/hooks/mutations/profile/useChangeMyProfile.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/profile/useChangeMyProfile.js +12 -0
- package/dist/production/src/hooks/mutations/profile/useChangeMyProfile.js.map +1 -0
- package/dist/production/src/hooks/mutations/profile/useChangeProfile.cjs +29 -0
- package/dist/production/src/hooks/mutations/profile/useChangeProfile.cjs.map +1 -0
- package/dist/production/src/hooks/mutations/profile/useChangeProfile.js +12 -0
- package/dist/production/src/hooks/mutations/profile/useChangeProfile.js.map +1 -0
- package/dist/production/src/hooks/queries/useMeQuery.cjs +33 -0
- package/dist/production/src/hooks/queries/useMeQuery.cjs.map +1 -0
- package/dist/production/src/hooks/queries/useMeQuery.js +16 -0
- package/dist/production/src/hooks/queries/useMeQuery.js.map +1 -0
- package/dist/production/src/hooks/queries/useProjectMembersQuery.cjs +53 -0
- package/dist/production/src/hooks/queries/useProjectMembersQuery.cjs.map +1 -0
- package/dist/production/src/hooks/queries/useProjectMembersQuery.js +36 -0
- package/dist/production/src/hooks/queries/useProjectMembersQuery.js.map +1 -0
- package/dist/production/src/hooks/queries/useProjectMembershipsQuery.cjs +34 -0
- package/dist/production/src/hooks/queries/useProjectMembershipsQuery.cjs.map +1 -0
- package/dist/production/src/hooks/queries/useProjectMembershipsQuery.js +17 -0
- package/dist/production/src/hooks/queries/useProjectMembershipsQuery.js.map +1 -0
- package/dist/production/src/hooks/queries/useProjectRolesDefinitionQuery.cjs +36 -0
- package/dist/production/src/hooks/queries/useProjectRolesDefinitionQuery.cjs.map +1 -0
- package/dist/production/src/hooks/queries/useProjectRolesDefinitionQuery.js +19 -0
- package/dist/production/src/hooks/queries/useProjectRolesDefinitionQuery.js.map +1 -0
- package/dist/production/src/hooks/useFetchIdentity.cjs +55 -0
- package/dist/production/src/hooks/useFetchIdentity.cjs.map +1 -0
- package/dist/production/src/hooks/useFetchIdentity.js +55 -0
- package/dist/production/src/hooks/useFetchIdentity.js.map +1 -0
- package/dist/production/src/hooks/useLogout.cjs +10 -0
- package/dist/production/src/hooks/useLogout.cjs.map +1 -0
- package/dist/production/src/hooks/useLogout.js +10 -0
- package/dist/production/src/hooks/useLogout.js.map +1 -0
- package/dist/production/src/hooks/usePasswordlessOtpActivator.cjs +53 -0
- package/dist/production/src/hooks/usePasswordlessOtpActivator.cjs.map +1 -0
- package/dist/production/src/hooks/usePasswordlessOtpActivator.js +53 -0
- package/dist/production/src/hooks/usePasswordlessOtpActivator.js.map +1 -0
- package/dist/production/src/hooks/useTenantApi.cjs +36 -0
- package/dist/production/src/hooks/useTenantApi.cjs.map +1 -0
- package/dist/production/src/hooks/useTenantApi.js +36 -0
- package/dist/production/src/hooks/useTenantApi.js.map +1 -0
- package/dist/production/src/hooks/useTenantMutation.cjs +33 -0
- package/dist/production/src/hooks/useTenantMutation.cjs.map +1 -0
- package/dist/production/src/hooks/useTenantMutation.js +33 -0
- package/dist/production/src/hooks/useTenantMutation.js.map +1 -0
- package/dist/production/src/hooks/useTenantQueryLoader.cjs +36 -0
- package/dist/production/src/hooks/useTenantQueryLoader.cjs.map +1 -0
- package/dist/production/src/hooks/useTenantQueryLoader.js +36 -0
- package/dist/production/src/hooks/useTenantQueryLoader.js.map +1 -0
- package/dist/production/src/internal/hooks/useHandleIDPResponse.cjs +51 -0
- package/dist/production/src/internal/hooks/useHandleIDPResponse.cjs.map +1 -0
- package/dist/production/src/internal/hooks/useHandleIDPResponse.js +51 -0
- package/dist/production/src/internal/hooks/useHandleIDPResponse.js.map +1 -0
- package/dist/production/src/internal/hooks/useIDPAutoInit.cjs +19 -0
- package/dist/production/src/internal/hooks/useIDPAutoInit.cjs.map +1 -0
- package/dist/production/src/internal/hooks/useIDPAutoInit.js +19 -0
- package/dist/production/src/internal/hooks/useIDPAutoInit.js.map +1 -0
- package/dist/production/src/internal/hooks/useIDPStateStore.cjs +19 -0
- package/dist/production/src/internal/hooks/useIDPStateStore.cjs.map +1 -0
- package/dist/production/src/internal/hooks/useIDPStateStore.js +19 -0
- package/dist/production/src/internal/hooks/useIDPStateStore.js.map +1 -0
- package/dist/production/src/internal/hooks/useInitIDPRedirect.cjs +44 -0
- package/dist/production/src/internal/hooks/useInitIDPRedirect.cjs.map +1 -0
- package/dist/production/src/internal/hooks/useInitIDPRedirect.js +44 -0
- package/dist/production/src/internal/hooks/useInitIDPRedirect.js.map +1 -0
- package/dist/production/src/internal/hooks/useLogoutInternal.cjs +35 -0
- package/dist/production/src/internal/hooks/useLogoutInternal.cjs.map +1 -0
- package/dist/production/src/internal/hooks/useLogoutInternal.js +35 -0
- package/dist/production/src/internal/hooks/useLogoutInternal.js.map +1 -0
- package/dist/production/src/internal/hooks/useRedirectToBacklink.cjs +36 -0
- package/dist/production/src/internal/hooks/useRedirectToBacklink.cjs.map +1 -0
- package/dist/production/src/internal/hooks/useRedirectToBacklink.js +36 -0
- package/dist/production/src/internal/hooks/useRedirectToBacklink.js.map +1 -0
- package/dist/production/src/internal/utils/getBaseHref.cjs +8 -0
- package/dist/production/src/internal/utils/getBaseHref.cjs.map +1 -0
- package/dist/production/src/internal/utils/getBaseHref.js +8 -0
- package/dist/production/src/internal/utils/getBaseHref.js.map +1 -0
- package/dist/production/src/internal/utils/hashing.cjs +8 -0
- package/dist/production/src/internal/utils/hashing.cjs.map +1 -0
- package/dist/production/src/internal/utils/hashing.js +8 -0
- package/dist/production/src/internal/utils/hashing.js.map +1 -0
- package/dist/production/src/internal/utils/randomInt.cjs +29 -0
- package/dist/production/src/internal/utils/randomInt.cjs.map +1 -0
- package/dist/production/src/internal/utils/randomInt.js +29 -0
- package/dist/production/src/internal/utils/randomInt.js.map +1 -0
- package/dist/types/components/IdentityProvider.d.ts +6 -0
- package/dist/types/components/IdentityProvider.d.ts.map +1 -0
- package/dist/types/components/IdentityState.d.ts +8 -0
- package/dist/types/components/IdentityState.d.ts.map +1 -0
- package/dist/types/components/forms/ChangeMyPasswordForm.d.ts +19 -0
- package/dist/types/components/forms/ChangeMyPasswordForm.d.ts.map +1 -0
- package/dist/types/components/forms/CreateApiKeyForm.d.ts +23 -0
- package/dist/types/components/forms/CreateApiKeyForm.d.ts.map +1 -0
- package/dist/types/components/forms/CreateSessionTokenForm.d.ts +22 -0
- package/dist/types/components/forms/CreateSessionTokenForm.d.ts.map +1 -0
- package/dist/types/components/forms/InviteForm.d.ts +25 -0
- package/dist/types/components/forms/InviteForm.d.ts.map +1 -0
- package/dist/types/components/forms/LoginForm.d.ts +20 -0
- package/dist/types/components/forms/LoginForm.d.ts.map +1 -0
- package/dist/types/components/forms/OtpConfirmForm.d.ts +17 -0
- package/dist/types/components/forms/OtpConfirmForm.d.ts.map +1 -0
- package/dist/types/components/forms/OtpPrepareForm.d.ts +19 -0
- package/dist/types/components/forms/OtpPrepareForm.d.ts.map +1 -0
- package/dist/types/components/forms/PasswordResetForm.d.ts +20 -0
- package/dist/types/components/forms/PasswordResetForm.d.ts.map +1 -0
- package/dist/types/components/forms/PasswordResetRequestForm.d.ts +17 -0
- package/dist/types/components/forms/PasswordResetRequestForm.d.ts.map +1 -0
- package/dist/types/components/forms/PasswordlessSignInForm.d.ts +22 -0
- package/dist/types/components/forms/PasswordlessSignInForm.d.ts.map +1 -0
- package/dist/types/components/forms/PasswordlessSignInInitForm.d.ts +20 -0
- package/dist/types/components/forms/PasswordlessSignInInitForm.d.ts.map +1 -0
- package/dist/types/components/forms/TenantForm.d.ts +37 -0
- package/dist/types/components/forms/TenantForm.d.ts.map +1 -0
- package/dist/types/components/forms/UpdateProjectMemberForm.d.ts +19 -0
- package/dist/types/components/forms/UpdateProjectMemberForm.d.ts.map +1 -0
- package/dist/types/components/forms/index.d.ts +13 -0
- package/dist/types/components/forms/index.d.ts.map +1 -0
- package/dist/types/components/idp/IDP.d.ts +12 -0
- package/dist/types/components/idp/IDP.d.ts.map +1 -0
- package/dist/types/components/idp/IDPInitTrigger.d.ts +7 -0
- package/dist/types/components/idp/IDPInitTrigger.d.ts.map +1 -0
- package/dist/types/components/idp/IDPState.d.ts +8 -0
- package/dist/types/components/idp/IDPState.d.ts.map +1 -0
- package/dist/types/components/idp/index.d.ts +4 -0
- package/dist/types/components/idp/index.d.ts.map +1 -0
- package/dist/types/components/index.d.ts +6 -0
- package/dist/types/components/index.d.ts.map +1 -0
- package/dist/types/components/triggers/DisableOtpTrigger.d.ts +8 -0
- package/dist/types/components/triggers/DisableOtpTrigger.d.ts.map +1 -0
- package/dist/types/components/triggers/LogoutTrigger.d.ts +5 -0
- package/dist/types/components/triggers/LogoutTrigger.d.ts.map +1 -0
- package/dist/types/components/triggers/RemoveProjectMemberTrigger.d.ts +9 -0
- package/dist/types/components/triggers/RemoveProjectMemberTrigger.d.ts.map +1 -0
- package/dist/types/components/triggers/TenantActionTrigger.d.ts +22 -0
- package/dist/types/components/triggers/TenantActionTrigger.d.ts.map +1 -0
- package/dist/types/components/triggers/index.d.ts +4 -0
- package/dist/types/components/triggers/index.d.ts.map +1 -0
- package/dist/types/consts.d.ts +2 -0
- package/dist/types/consts.d.ts.map +1 -0
- package/dist/types/contexts.d.ts +20 -0
- package/dist/types/contexts.d.ts.map +1 -0
- package/dist/types/hooks/index.d.ts +9 -0
- package/dist/types/hooks/index.d.ts.map +1 -0
- package/dist/types/hooks/mutations/apiKey/index.d.ts +5 -0
- package/dist/types/hooks/mutations/apiKey/index.d.ts.map +1 -0
- package/dist/types/hooks/mutations/apiKey/useCreateApiKeyMutation.d.ts +83 -0
- package/dist/types/hooks/mutations/apiKey/useCreateApiKeyMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/apiKey/useCreateGlobalApiKeyMutation.d.ts +73 -0
- package/dist/types/hooks/mutations/apiKey/useCreateGlobalApiKeyMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/apiKey/useCreateSessionTokenMutation.d.ts +59 -0
- package/dist/types/hooks/mutations/apiKey/useCreateSessionTokenMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/apiKey/useDisableApiKeyMutation.d.ts +21 -0
- package/dist/types/hooks/mutations/apiKey/useDisableApiKeyMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/auth/index.d.ts +4 -0
- package/dist/types/hooks/mutations/auth/index.d.ts.map +1 -0
- package/dist/types/hooks/mutations/auth/useChangeMyPasswordMutation.d.ts +23 -0
- package/dist/types/hooks/mutations/auth/useChangeMyPasswordMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/auth/useSignInMutation.d.ts +65 -0
- package/dist/types/hooks/mutations/auth/useSignInMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/auth/useSignOutMutation.d.ts +21 -0
- package/dist/types/hooks/mutations/auth/useSignOutMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/idp/index.d.ts +3 -0
- package/dist/types/hooks/mutations/idp/index.d.ts.map +1 -0
- package/dist/types/hooks/mutations/idp/useInitSignInIDPMutation.d.ts +19 -0
- package/dist/types/hooks/mutations/idp/useInitSignInIDPMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/idp/useSignInIdpMutation.d.ts +76 -0
- package/dist/types/hooks/mutations/idp/useSignInIdpMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/index.d.ts +10 -0
- package/dist/types/hooks/mutations/index.d.ts.map +1 -0
- package/dist/types/hooks/mutations/invite/index.d.ts +2 -0
- package/dist/types/hooks/mutations/invite/index.d.ts.map +1 -0
- package/dist/types/hooks/mutations/invite/useInviteMutation.d.ts +97 -0
- package/dist/types/hooks/mutations/invite/useInviteMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/memberships/index.d.ts +4 -0
- package/dist/types/hooks/mutations/memberships/index.d.ts.map +1 -0
- package/dist/types/hooks/mutations/memberships/useAddProjectMemberMutation.d.ts +33 -0
- package/dist/types/hooks/mutations/memberships/useAddProjectMemberMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/memberships/useRemoveProjectMemberMutation.d.ts +23 -0
- package/dist/types/hooks/mutations/memberships/useRemoveProjectMemberMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/memberships/useUpdateProjectMemberMutation.d.ts +33 -0
- package/dist/types/hooks/mutations/memberships/useUpdateProjectMemberMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/otp/index.d.ts +4 -0
- package/dist/types/hooks/mutations/otp/index.d.ts.map +1 -0
- package/dist/types/hooks/mutations/otp/useConfirmOtpMutation.d.ts +21 -0
- package/dist/types/hooks/mutations/otp/useConfirmOtpMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/otp/useDisableOtpMutation.d.ts +17 -0
- package/dist/types/hooks/mutations/otp/useDisableOtpMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/otp/usePrepareOtpMutation.d.ts +25 -0
- package/dist/types/hooks/mutations/otp/usePrepareOtpMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/passwordReset/index.d.ts +3 -0
- package/dist/types/hooks/mutations/passwordReset/index.d.ts.map +1 -0
- package/dist/types/hooks/mutations/passwordReset/useCreateResetPasswordRequestMutation.d.ts +23 -0
- package/dist/types/hooks/mutations/passwordReset/useCreateResetPasswordRequestMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/passwordReset/useResetPasswordMutation.d.ts +25 -0
- package/dist/types/hooks/mutations/passwordReset/useResetPasswordMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/passwordless/index.d.ts +6 -0
- package/dist/types/hooks/mutations/passwordless/index.d.ts.map +1 -0
- package/dist/types/hooks/mutations/passwordless/useActivatePasswordlessOtpMutation.d.ts +8 -0
- package/dist/types/hooks/mutations/passwordless/useActivatePasswordlessOtpMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/passwordless/useDisableMyPasswordlessMutation.d.ts +3 -0
- package/dist/types/hooks/mutations/passwordless/useDisableMyPasswordlessMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/passwordless/useEnableMyPasswordlessMutation.d.ts +3 -0
- package/dist/types/hooks/mutations/passwordless/useEnableMyPasswordlessMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/passwordless/useInitSignInPasswordlessMutation.d.ts +19 -0
- package/dist/types/hooks/mutations/passwordless/useInitSignInPasswordlessMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/passwordless/useSignInPasswordlessMutation.d.ts +34 -0
- package/dist/types/hooks/mutations/passwordless/useSignInPasswordlessMutation.d.ts.map +1 -0
- package/dist/types/hooks/mutations/profile/index.d.ts +3 -0
- package/dist/types/hooks/mutations/profile/index.d.ts.map +1 -0
- package/dist/types/hooks/mutations/profile/useChangeMyProfile.d.ts +21 -0
- package/dist/types/hooks/mutations/profile/useChangeMyProfile.d.ts.map +1 -0
- package/dist/types/hooks/mutations/profile/useChangeProfile.d.ts +23 -0
- package/dist/types/hooks/mutations/profile/useChangeProfile.d.ts.map +1 -0
- package/dist/types/hooks/queries/index.d.ts +5 -0
- package/dist/types/hooks/queries/index.d.ts.map +1 -0
- package/dist/types/hooks/queries/useMeQuery.d.ts +52 -0
- package/dist/types/hooks/queries/useMeQuery.d.ts.map +1 -0
- package/dist/types/hooks/queries/useProjectMembersQuery.d.ts +43 -0
- package/dist/types/hooks/queries/useProjectMembersQuery.d.ts.map +1 -0
- package/dist/types/hooks/queries/useProjectMembershipsQuery.d.ts +20 -0
- package/dist/types/hooks/queries/useProjectMembershipsQuery.d.ts.map +1 -0
- package/dist/types/hooks/queries/useProjectRolesDefinitionQuery.d.ts +66 -0
- package/dist/types/hooks/queries/useProjectRolesDefinitionQuery.d.ts.map +1 -0
- package/dist/types/hooks/useFetchIdentity.d.ts +6 -0
- package/dist/types/hooks/useFetchIdentity.d.ts.map +1 -0
- package/dist/types/hooks/useLogout.d.ts +4 -0
- package/dist/types/hooks/useLogout.d.ts.map +1 -0
- package/dist/types/hooks/usePasswordlessOtpActivator.d.ts +19 -0
- package/dist/types/hooks/usePasswordlessOtpActivator.d.ts.map +1 -0
- package/dist/types/hooks/useTenantApi.d.ts +12 -0
- package/dist/types/hooks/useTenantApi.d.ts.map +1 -0
- package/dist/types/hooks/useTenantMutation.d.ts +25 -0
- package/dist/types/hooks/useTenantMutation.d.ts.map +1 -0
- package/dist/types/hooks/useTenantQueryLoader.d.ts +17 -0
- package/dist/types/hooks/useTenantQueryLoader.d.ts.map +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/internal/hooks/useHandleIDPResponse.d.ts +11 -0
- package/dist/types/internal/hooks/useHandleIDPResponse.d.ts.map +1 -0
- package/dist/types/internal/hooks/useIDPAutoInit.d.ts +2 -0
- package/dist/types/internal/hooks/useIDPAutoInit.d.ts.map +1 -0
- package/dist/types/internal/hooks/useIDPStateStore.d.ts +9 -0
- package/dist/types/internal/hooks/useIDPStateStore.d.ts.map +1 -0
- package/dist/types/internal/hooks/useInitIDPRedirect.d.ts +16 -0
- package/dist/types/internal/hooks/useInitIDPRedirect.d.ts.map +1 -0
- package/dist/types/internal/hooks/useLogoutInternal.d.ts +4 -0
- package/dist/types/internal/hooks/useLogoutInternal.d.ts.map +1 -0
- package/dist/types/internal/hooks/useRedirectToBacklink.d.ts +6 -0
- package/dist/types/internal/hooks/useRedirectToBacklink.d.ts.map +1 -0
- package/dist/types/internal/utils/getBaseHref.d.ts +2 -0
- package/dist/types/internal/utils/getBaseHref.d.ts.map +1 -0
- package/dist/types/internal/utils/hashing.d.ts +2 -0
- package/dist/types/internal/utils/hashing.d.ts.map +1 -0
- package/dist/types/internal/utils/randomInt.d.ts +3 -0
- package/dist/types/internal/utils/randomInt.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/dist/types/types/Identity.d.ts +20 -0
- package/dist/types/types/Identity.d.ts.map +1 -0
- package/dist/types/types/IdentityMethods.d.ts +5 -0
- package/dist/types/types/IdentityMethods.d.ts.map +1 -0
- package/dist/types/types/IdentityStateValue.d.ts +2 -0
- package/dist/types/types/IdentityStateValue.d.ts.map +1 -0
- package/dist/types/types/forms.d.ts +18 -0
- package/dist/types/types/forms.d.ts.map +1 -0
- package/dist/types/types/idp.d.ts +30 -0
- package/dist/types/types/idp.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +6 -0
- package/dist/types/types/index.d.ts.map +1 -0
- package/package.json +11 -11
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PasswordlessSignInForm.js","sources":["../../../../../../packages/react-client-tenant/src/components/forms/PasswordlessSignInForm.tsx"],"sourcesContent":["import * as TenantApi from '@contember/graphql-client-tenant'\nimport { useSetSessionToken } from '@contember/react-client'\nimport { ReactElement, useCallback, useMemo } from 'react'\nimport { useForm } from '../../contexts'\nimport { SignInPasswordlessMutationResult, useSignInPasswordlessMutation } from '../../hooks'\nimport { useRedirectToBacklinkCallback } from '../../internal/hooks/useRedirectToBacklink'\nimport { FormContextValue, FormError, FormState } from '../../types/forms'\nimport { TenantForm } from './TenantForm'\n\nexport type PasswordlessSignInFormValues = {\n\ttoken: string\n\totpToken: string\n}\n\nexport type PasswordlessSignInFormErrorCode =\n\t| TenantApi.SignInPasswordlessErrorCode\n\t| 'FIELD_REQUIRED'\n\t| 'INVALID_VALUE'\n\t| 'UNKNOWN_ERROR'\n\nexport type PasswordlessSignInFormState =\n\t| FormState\n\t| 'otp-required'\n\nexport type PasswordlessSignInFormError = FormError<PasswordlessSignInFormValues, PasswordlessSignInFormErrorCode>\n\nexport type PasswordlessSignInFormContextValue = FormContextValue<\n\tPasswordlessSignInFormValues,\n\tPasswordlessSignInFormErrorCode,\n\tPasswordlessSignInFormState\n>\n\nexport interface PasswordlessSignInFormProps {\n\trequestId: string\n\tvalidationType: TenantApi.PasswordlessValidationType\n\ttoken?: string\n\texpiration?: number\n\tchildren: ReactElement\n\tonSuccess?: () => void\n}\n\nexport const usePasswordlessSignInForm = useForm as () => PasswordlessSignInFormContextValue\n\nconst headers = {\n\t'X-Contember-Token-Path': 'data.mutation.result.token',\n}\nconst DEFAULT_LOGIN_EXPIRATION = 14 * 24 * 60 // 14 days\n\nexport const PasswordlessSignInForm = (\n\t{ children, onSuccess, requestId, validationType, token, expiration = DEFAULT_LOGIN_EXPIRATION }: PasswordlessSignInFormProps,\n) => {\n\tconst signIn = useSignInPasswordlessMutation({ headers })\n\tconst redirectToBacklink = useRedirectToBacklinkCallback()\n\tconst setSessionToken = useSetSessionToken()\n\treturn (\n\t\t<TenantForm<PasswordlessSignInFormContextValue, SignInPasswordlessMutationResult>\n\t\t\tonSuccess={args => {\n\t\t\t\tonSuccess?.()\n\t\t\t\tsetSessionToken(args.result.token)\n\t\t\t\tredirectToBacklink()\n\t\t\t}}\n\t\t\terrorMapping={errorToField}\n\t\t\tinitialValues={useMemo(() => ({\n\t\t\t\ttoken: token ?? '',\n\t\t\t\totpToken: '',\n\t\t\t}), [token])}\n\t\t\tvalidate={({ values, state }) => {\n\t\t\t\tif (!values.token) {\n\t\t\t\t\treturn [{ code: 'FIELD_REQUIRED', field: 'token' }]\n\t\t\t\t}\n\t\t\t\tif (!values.otpToken && state === 'otp-required') {\n\t\t\t\t\treturn [{ code: 'FIELD_REQUIRED', field: 'otpToken' }]\n\t\t\t\t} else if (values.otpToken && !values.otpToken.match(/^\\d{6}$/)) {\n\t\t\t\t\treturn [{ code: 'INVALID_VALUE', field: 'otpToken' }]\n\t\t\t\t}\n\t\t\t\treturn []\n\t\t\t}}\n\t\t\texecute={useCallback(async ({ values }) => {\n\t\t\t\tconst result = await signIn({\n\t\t\t\t\trequestId,\n\t\t\t\t\texpiration,\n\t\t\t\t\ttoken: values.token,\n\t\t\t\t\tmfaOtp: values.otpToken || undefined,\n\t\t\t\t\tvalidationType,\n\t\t\t\t})\n\t\t\t\tif (!result.ok && result.error === 'OTP_REQUIRED') {\n\t\t\t\t\treturn { ...result, state: 'otp-required' }\n\t\t\t\t}\n\n\t\t\t\treturn result\n\t\t\t}, [expiration, requestId, signIn, validationType])}\n\t\t>\n\t\t\t{children}\n\t\t</TenantForm>\n\t)\n}\nconst errorToField: Record<TenantApi.SignInPasswordlessErrorCode, keyof PasswordlessSignInFormValues | undefined> = {\n\tPERSON_DISABLED: undefined,\n\tTOKEN_EXPIRED: 'token',\n\tTOKEN_NOT_FOUND: 'token',\n\tTOKEN_USED: 'token',\n\tTOKEN_INVALID: 'token',\n\tINVALID_OTP_TOKEN: 'otpToken',\n\tOTP_REQUIRED: undefined,\n}\n"],"names":["this"],"mappings":";;;;;;;AAyCO,MAAM,4BAA4B;AAEzC,MAAM,UAAU;AAAA,EACf,0BAA0B;AAC3B;AACA,MAAM,2BAA2B,KAAK,KAAK;AAEpC,MAAM,yBAAyB,CACrC,EAAE,UAAU,WAAW,WAAW,gBAAgB,OAAO,aAAa,+BAClE;AACJ,QAAM,SAAS,8BAA8B,EAAE,SAAS;AACxD,QAAM,qBAAqB,8BAAA;AAC3B,QAAM,kBAAkB,mBAAA;AACxB,SACC;AAAA,IAAC;AAAA,IAAA;AAAA,MACA,WAAW,CAAA,SAAQ;AAClB,oBAAA;AACA,wBAAgB,KAAK,OAAO,KAAK;AACjC,2BAAA;AAAA,MACD;AAAA,MACA,cAAc;AAAA,MACd,eAAe,QAAQ,OAAO;AAAA,QAC7B,OAAO,SAAS;AAAA,QAChB,UAAU;AAAA,MAAA,IACP,CAAC,KAAK,CAAC;AAAA,MACX,UAAU,CAAC,EAAE,QAAQ,YAAY;AAChC,YAAI,CAAC,OAAO,OAAO;AAClB,iBAAO,CAAC,EAAE,MAAM,kBAAkB,OAAO,SAAS;AAAA,QACnD;AACA,YAAI,CAAC,OAAO,YAAY,UAAU,gBAAgB;AACjD,iBAAO,CAAC,EAAE,MAAM,kBAAkB,OAAO,YAAY;AAAA,QACtD,WAAW,OAAO,YAAY,CAAC,OAAO,SAAS,MAAM,SAAS,GAAG;AAChE,iBAAO,CAAC,EAAE,MAAM,iBAAiB,OAAO,YAAY;AAAA,QACrD;AACA,eAAO,CAAA;AAAA,MACR;AAAA,MACA,SAAS,YAAY,OAAO,EAAE,aAAa;AAC1C,cAAM,SAAS,MAAM,OAAO;AAAA,UAC3B;AAAA,UACA;AAAA,UACA,OAAO,OAAO;AAAA,UACd,QAAQ,OAAO,YAAY;AAAA,UAC3B;AAAA,QAAA,CACA;AACD,YAAI,CAAC,OAAO,MAAM,OAAO,UAAU,gBAAgB;AAClD,iBAAO,EAAE,GAAG,QAAQ,OAAO,eAAA;AAAA,QAC5B;AAEA,eAAO;AAAA,MACR,GAAG,CAAC,YAAY,WAAW,QAAQ,cAAc,CAAC;AAAA,MAEjD;AAAA,IAAA;AAAA,IArCF;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAA;AAAAA,EAAA;AAwCF;AACA,MAAM,eAA8G;AAAA,EACnH,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,mBAAmB;AAAA,EACnB,cAAc;AACf;"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxDevRuntime = require("react/jsx-dev-runtime");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const TenantForm = require("./TenantForm.cjs");
|
|
6
|
+
const contexts = require("../../contexts.cjs");
|
|
7
|
+
const consts = require("../../consts.cjs");
|
|
8
|
+
const useRedirectToBacklink = require("../../internal/hooks/useRedirectToBacklink.cjs");
|
|
9
|
+
const useInitSignInPasswordlessMutation = require("../../hooks/mutations/passwordless/useInitSignInPasswordlessMutation.cjs");
|
|
10
|
+
const usePasswordlessSignInInitForm = contexts.useForm;
|
|
11
|
+
const PasswordlessSignInInitForm = ({ children, onSuccess }) => {
|
|
12
|
+
const initSignIn = useInitSignInPasswordlessMutation.useInitSignInPasswordlessMutation();
|
|
13
|
+
const saveBacklink = useRedirectToBacklink.useSaveBacklink({
|
|
14
|
+
storage: "local"
|
|
15
|
+
});
|
|
16
|
+
return /* @__PURE__ */ jsxDevRuntime.jsxDEV(
|
|
17
|
+
TenantForm.TenantForm,
|
|
18
|
+
{
|
|
19
|
+
onSuccess: (res) => {
|
|
20
|
+
localStorage.setItem(consts.PASSWORDLESS_REQUEST_STORAGE_KEY, res.result.requestId);
|
|
21
|
+
saveBacklink();
|
|
22
|
+
onSuccess?.(res);
|
|
23
|
+
},
|
|
24
|
+
errorMapping: errorToField,
|
|
25
|
+
initialValues: React.useMemo(() => ({
|
|
26
|
+
email: ""
|
|
27
|
+
}), []),
|
|
28
|
+
validate: ({ values }) => {
|
|
29
|
+
if (!values.email) {
|
|
30
|
+
return [{ code: "FIELD_REQUIRED", field: "email" }];
|
|
31
|
+
} else if (!values.email.match(/^.+@.+$/)) {
|
|
32
|
+
return [{ code: "INVALID_VALUE", field: "email" }];
|
|
33
|
+
}
|
|
34
|
+
return [];
|
|
35
|
+
},
|
|
36
|
+
execute: React.useCallback(async ({ values }) => {
|
|
37
|
+
return await initSignIn({
|
|
38
|
+
email: values.email
|
|
39
|
+
});
|
|
40
|
+
}, [initSignIn]),
|
|
41
|
+
children
|
|
42
|
+
},
|
|
43
|
+
void 0,
|
|
44
|
+
false,
|
|
45
|
+
{
|
|
46
|
+
fileName: "/home/runner/work/contember/contember/packages/react-client-tenant/src/components/forms/PasswordlessSignInInitForm.tsx",
|
|
47
|
+
lineNumber: 40,
|
|
48
|
+
columnNumber: 3
|
|
49
|
+
},
|
|
50
|
+
void 0
|
|
51
|
+
);
|
|
52
|
+
};
|
|
53
|
+
const errorToField = {
|
|
54
|
+
PERSON_NOT_FOUND: "email",
|
|
55
|
+
PASSWORDLESS_DISABLED: void 0
|
|
56
|
+
};
|
|
57
|
+
exports.PasswordlessSignInInitForm = PasswordlessSignInInitForm;
|
|
58
|
+
exports.usePasswordlessSignInInitForm = usePasswordlessSignInInitForm;
|
|
59
|
+
//# sourceMappingURL=PasswordlessSignInInitForm.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PasswordlessSignInInitForm.cjs","sources":["../../../../../../packages/react-client-tenant/src/components/forms/PasswordlessSignInInitForm.tsx"],"sourcesContent":["import { ReactElement, useCallback, useMemo } from 'react'\nimport * as TenantApi from '@contember/graphql-client-tenant'\nimport { TenantForm } from './TenantForm'\nimport { FormContextValue, FormError, FormState } from '../../types/forms'\nimport { useForm } from '../../contexts'\nimport { InitSignInPasswordlessMutationResult, useInitSignInPasswordlessMutation } from '../../hooks'\nimport { PASSWORDLESS_REQUEST_STORAGE_KEY } from '../../consts'\nimport { useSaveBacklink } from '../../internal/hooks/useRedirectToBacklink'\n\nexport type PasswordlessSignInInitFormValues = {\n\temail: string\n}\n\nexport type PasswordlessSignInInitFormErrorCode =\n\t| TenantApi.InitSignInPasswordlessErrorCode\n\t| 'FIELD_REQUIRED'\n\t| 'INVALID_VALUE'\n\t| 'UNKNOWN_ERROR'\n\nexport type PasswordlessSignInInitFormState = FormState\n\nexport type PasswordlessSignInInitFormError = FormError<PasswordlessSignInInitFormValues, PasswordlessSignInInitFormErrorCode>\n\nexport type PasswordlessSignInInitFormContextValue = FormContextValue<PasswordlessSignInInitFormValues, PasswordlessSignInInitFormErrorCode>\n\nexport interface PasswordlessSignInInitFormProps {\n\tchildren: ReactElement\n\tonSuccess?: (args: { result: InitSignInPasswordlessMutationResult }) => void\n}\n\nexport const usePasswordlessSignInInitForm = useForm as () => PasswordlessSignInInitFormContextValue\n\nexport const PasswordlessSignInInitForm = ({ children, onSuccess }: PasswordlessSignInInitFormProps) => {\n\tconst initSignIn = useInitSignInPasswordlessMutation()\n\tconst saveBacklink = useSaveBacklink({\n\t\tstorage: 'local',\n\t})\n\n\treturn (\n\t\t<TenantForm<PasswordlessSignInInitFormContextValue, InitSignInPasswordlessMutationResult>\n\t\t\tonSuccess={res => {\n\t\t\t\tlocalStorage.setItem(PASSWORDLESS_REQUEST_STORAGE_KEY, res.result.requestId)\n\t\t\t\tsaveBacklink()\n\t\t\t\tonSuccess?.(res)\n\t\t\t}}\n\t\t\terrorMapping={errorToField}\n\t\t\tinitialValues={useMemo(() => ({\n\t\t\t\temail: '',\n\t\t\t}), [])}\n\t\t\tvalidate={({ values }) => {\n\t\t\t\tif (!values.email) {\n\t\t\t\t\treturn [{ code: 'FIELD_REQUIRED', field: 'email' }]\n\t\t\t\t} else if (!values.email.match(/^.+@.+$/)) {\n\t\t\t\t\treturn [{ code: 'INVALID_VALUE', field: 'email' }]\n\t\t\t\t}\n\t\t\t\treturn []\n\t\t\t}}\n\t\t\texecute={useCallback(async ({ values }) => {\n\t\t\t\treturn await initSignIn({\n\t\t\t\t\temail: values.email,\n\t\t\t\t})\n\t\t\t}, [initSignIn])}\n\t\t>\n\t\t\t{children}\n\t\t</TenantForm>\n\t)\n}\nconst errorToField: Record<TenantApi.InitSignInPasswordlessErrorCode, keyof PasswordlessSignInInitFormValues | undefined> = {\n\tPERSON_NOT_FOUND: 'email',\n\tPASSWORDLESS_DISABLED: undefined,\n}\n"],"names":["useForm","useInitSignInPasswordlessMutation","useSaveBacklink","jsxDEV","TenantForm","PASSWORDLESS_REQUEST_STORAGE_KEY","useMemo","useCallback","this"],"mappings":";;;;;;;;;AA8BO,MAAM,gCAAgCA,SAAAA;AAEtC,MAAM,6BAA6B,CAAC,EAAE,UAAU,gBAAiD;AACvG,QAAM,aAAaC,kCAAAA,kCAAA;AACnB,QAAM,eAAeC,sBAAAA,gBAAgB;AAAA,IACpC,SAAS;AAAA,EAAA,CACT;AAED,SACCC,8BAAAA;AAAAA,IAACC,WAAAA;AAAAA,IAAA;AAAA,MACA,WAAW,CAAA,QAAO;AACjB,qBAAa,QAAQC,OAAAA,kCAAkC,IAAI,OAAO,SAAS;AAC3E,qBAAA;AACA,oBAAY,GAAG;AAAA,MAChB;AAAA,MACA,cAAc;AAAA,MACd,eAAeC,MAAAA,QAAQ,OAAO;AAAA,QAC7B,OAAO;AAAA,MAAA,IACJ,CAAA,CAAE;AAAA,MACN,UAAU,CAAC,EAAE,aAAa;AACzB,YAAI,CAAC,OAAO,OAAO;AAClB,iBAAO,CAAC,EAAE,MAAM,kBAAkB,OAAO,SAAS;AAAA,QACnD,WAAW,CAAC,OAAO,MAAM,MAAM,SAAS,GAAG;AAC1C,iBAAO,CAAC,EAAE,MAAM,iBAAiB,OAAO,SAAS;AAAA,QAClD;AACA,eAAO,CAAA;AAAA,MACR;AAAA,MACA,SAASC,MAAAA,YAAY,OAAO,EAAE,aAAa;AAC1C,eAAO,MAAM,WAAW;AAAA,UACvB,OAAO,OAAO;AAAA,QAAA,CACd;AAAA,MACF,GAAG,CAAC,UAAU,CAAC;AAAA,MAEd;AAAA,IAAA;AAAA,IAxBF;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAC;AAAAA,EAAA;AA2BF;AACA,MAAM,eAAsH;AAAA,EAC3H,kBAAkB;AAAA,EAClB,uBAAuB;AACxB;;;"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
2
|
+
import { useCallback, useMemo } from "react";
|
|
3
|
+
import { TenantForm } from "./TenantForm.js";
|
|
4
|
+
import { useForm } from "../../contexts.js";
|
|
5
|
+
import { PASSWORDLESS_REQUEST_STORAGE_KEY } from "../../consts.js";
|
|
6
|
+
import { useSaveBacklink } from "../../internal/hooks/useRedirectToBacklink.js";
|
|
7
|
+
import { useInitSignInPasswordlessMutation } from "../../hooks/mutations/passwordless/useInitSignInPasswordlessMutation.js";
|
|
8
|
+
const usePasswordlessSignInInitForm = useForm;
|
|
9
|
+
const PasswordlessSignInInitForm = ({ children, onSuccess }) => {
|
|
10
|
+
const initSignIn = useInitSignInPasswordlessMutation();
|
|
11
|
+
const saveBacklink = useSaveBacklink({
|
|
12
|
+
storage: "local"
|
|
13
|
+
});
|
|
14
|
+
return /* @__PURE__ */ jsxDEV(
|
|
15
|
+
TenantForm,
|
|
16
|
+
{
|
|
17
|
+
onSuccess: (res) => {
|
|
18
|
+
localStorage.setItem(PASSWORDLESS_REQUEST_STORAGE_KEY, res.result.requestId);
|
|
19
|
+
saveBacklink();
|
|
20
|
+
onSuccess?.(res);
|
|
21
|
+
},
|
|
22
|
+
errorMapping: errorToField,
|
|
23
|
+
initialValues: useMemo(() => ({
|
|
24
|
+
email: ""
|
|
25
|
+
}), []),
|
|
26
|
+
validate: ({ values }) => {
|
|
27
|
+
if (!values.email) {
|
|
28
|
+
return [{ code: "FIELD_REQUIRED", field: "email" }];
|
|
29
|
+
} else if (!values.email.match(/^.+@.+$/)) {
|
|
30
|
+
return [{ code: "INVALID_VALUE", field: "email" }];
|
|
31
|
+
}
|
|
32
|
+
return [];
|
|
33
|
+
},
|
|
34
|
+
execute: useCallback(async ({ values }) => {
|
|
35
|
+
return await initSignIn({
|
|
36
|
+
email: values.email
|
|
37
|
+
});
|
|
38
|
+
}, [initSignIn]),
|
|
39
|
+
children
|
|
40
|
+
},
|
|
41
|
+
void 0,
|
|
42
|
+
false,
|
|
43
|
+
{
|
|
44
|
+
fileName: "/home/runner/work/contember/contember/packages/react-client-tenant/src/components/forms/PasswordlessSignInInitForm.tsx",
|
|
45
|
+
lineNumber: 40,
|
|
46
|
+
columnNumber: 3
|
|
47
|
+
},
|
|
48
|
+
void 0
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
const errorToField = {
|
|
52
|
+
PERSON_NOT_FOUND: "email",
|
|
53
|
+
PASSWORDLESS_DISABLED: void 0
|
|
54
|
+
};
|
|
55
|
+
export {
|
|
56
|
+
PasswordlessSignInInitForm,
|
|
57
|
+
usePasswordlessSignInInitForm
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=PasswordlessSignInInitForm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PasswordlessSignInInitForm.js","sources":["../../../../../../packages/react-client-tenant/src/components/forms/PasswordlessSignInInitForm.tsx"],"sourcesContent":["import { ReactElement, useCallback, useMemo } from 'react'\nimport * as TenantApi from '@contember/graphql-client-tenant'\nimport { TenantForm } from './TenantForm'\nimport { FormContextValue, FormError, FormState } from '../../types/forms'\nimport { useForm } from '../../contexts'\nimport { InitSignInPasswordlessMutationResult, useInitSignInPasswordlessMutation } from '../../hooks'\nimport { PASSWORDLESS_REQUEST_STORAGE_KEY } from '../../consts'\nimport { useSaveBacklink } from '../../internal/hooks/useRedirectToBacklink'\n\nexport type PasswordlessSignInInitFormValues = {\n\temail: string\n}\n\nexport type PasswordlessSignInInitFormErrorCode =\n\t| TenantApi.InitSignInPasswordlessErrorCode\n\t| 'FIELD_REQUIRED'\n\t| 'INVALID_VALUE'\n\t| 'UNKNOWN_ERROR'\n\nexport type PasswordlessSignInInitFormState = FormState\n\nexport type PasswordlessSignInInitFormError = FormError<PasswordlessSignInInitFormValues, PasswordlessSignInInitFormErrorCode>\n\nexport type PasswordlessSignInInitFormContextValue = FormContextValue<PasswordlessSignInInitFormValues, PasswordlessSignInInitFormErrorCode>\n\nexport interface PasswordlessSignInInitFormProps {\n\tchildren: ReactElement\n\tonSuccess?: (args: { result: InitSignInPasswordlessMutationResult }) => void\n}\n\nexport const usePasswordlessSignInInitForm = useForm as () => PasswordlessSignInInitFormContextValue\n\nexport const PasswordlessSignInInitForm = ({ children, onSuccess }: PasswordlessSignInInitFormProps) => {\n\tconst initSignIn = useInitSignInPasswordlessMutation()\n\tconst saveBacklink = useSaveBacklink({\n\t\tstorage: 'local',\n\t})\n\n\treturn (\n\t\t<TenantForm<PasswordlessSignInInitFormContextValue, InitSignInPasswordlessMutationResult>\n\t\t\tonSuccess={res => {\n\t\t\t\tlocalStorage.setItem(PASSWORDLESS_REQUEST_STORAGE_KEY, res.result.requestId)\n\t\t\t\tsaveBacklink()\n\t\t\t\tonSuccess?.(res)\n\t\t\t}}\n\t\t\terrorMapping={errorToField}\n\t\t\tinitialValues={useMemo(() => ({\n\t\t\t\temail: '',\n\t\t\t}), [])}\n\t\t\tvalidate={({ values }) => {\n\t\t\t\tif (!values.email) {\n\t\t\t\t\treturn [{ code: 'FIELD_REQUIRED', field: 'email' }]\n\t\t\t\t} else if (!values.email.match(/^.+@.+$/)) {\n\t\t\t\t\treturn [{ code: 'INVALID_VALUE', field: 'email' }]\n\t\t\t\t}\n\t\t\t\treturn []\n\t\t\t}}\n\t\t\texecute={useCallback(async ({ values }) => {\n\t\t\t\treturn await initSignIn({\n\t\t\t\t\temail: values.email,\n\t\t\t\t})\n\t\t\t}, [initSignIn])}\n\t\t>\n\t\t\t{children}\n\t\t</TenantForm>\n\t)\n}\nconst errorToField: Record<TenantApi.InitSignInPasswordlessErrorCode, keyof PasswordlessSignInInitFormValues | undefined> = {\n\tPERSON_NOT_FOUND: 'email',\n\tPASSWORDLESS_DISABLED: undefined,\n}\n"],"names":["this"],"mappings":";;;;;;;AA8BO,MAAM,gCAAgC;AAEtC,MAAM,6BAA6B,CAAC,EAAE,UAAU,gBAAiD;AACvG,QAAM,aAAa,kCAAA;AACnB,QAAM,eAAe,gBAAgB;AAAA,IACpC,SAAS;AAAA,EAAA,CACT;AAED,SACC;AAAA,IAAC;AAAA,IAAA;AAAA,MACA,WAAW,CAAA,QAAO;AACjB,qBAAa,QAAQ,kCAAkC,IAAI,OAAO,SAAS;AAC3E,qBAAA;AACA,oBAAY,GAAG;AAAA,MAChB;AAAA,MACA,cAAc;AAAA,MACd,eAAe,QAAQ,OAAO;AAAA,QAC7B,OAAO;AAAA,MAAA,IACJ,CAAA,CAAE;AAAA,MACN,UAAU,CAAC,EAAE,aAAa;AACzB,YAAI,CAAC,OAAO,OAAO;AAClB,iBAAO,CAAC,EAAE,MAAM,kBAAkB,OAAO,SAAS;AAAA,QACnD,WAAW,CAAC,OAAO,MAAM,MAAM,SAAS,GAAG;AAC1C,iBAAO,CAAC,EAAE,MAAM,iBAAiB,OAAO,SAAS;AAAA,QAClD;AACA,eAAO,CAAA;AAAA,MACR;AAAA,MACA,SAAS,YAAY,OAAO,EAAE,aAAa;AAC1C,eAAO,MAAM,WAAW;AAAA,UACvB,OAAO,OAAO;AAAA,QAAA,CACd;AAAA,MACF,GAAG,CAAC,UAAU,CAAC;AAAA,MAEd;AAAA,IAAA;AAAA,IAxBF;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAA;AAAAA,EAAA;AA2BF;AACA,MAAM,eAAsH;AAAA,EAC3H,kBAAkB;AAAA,EAClB,uBAAuB;AACxB;"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxDevRuntime = require("react/jsx-dev-runtime");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const reactSlot = require("@radix-ui/react-slot");
|
|
6
|
+
const contexts = require("../../contexts.cjs");
|
|
7
|
+
const reactUtils = require("@contember/react-utils");
|
|
8
|
+
const SlotForm = reactSlot.Slot;
|
|
9
|
+
const TenantForm = ({
|
|
10
|
+
children,
|
|
11
|
+
initialValues,
|
|
12
|
+
loading,
|
|
13
|
+
errorMapping,
|
|
14
|
+
validate: validateIn,
|
|
15
|
+
execute: executeIn,
|
|
16
|
+
onSuccess: onSuccessIn,
|
|
17
|
+
onChange: onChangeIn
|
|
18
|
+
}) => {
|
|
19
|
+
const [values, setValues] = React.useState(initialValues);
|
|
20
|
+
const [errors, setErrors] = React.useState([]);
|
|
21
|
+
const [state, setState] = React.useState(loading ? "loading" : "initial");
|
|
22
|
+
React.useEffect(() => {
|
|
23
|
+
if (loading) {
|
|
24
|
+
setState("loading");
|
|
25
|
+
}
|
|
26
|
+
}, [loading]);
|
|
27
|
+
React.useEffect(() => {
|
|
28
|
+
if (state === "loading" && !loading) {
|
|
29
|
+
setValues(initialValues);
|
|
30
|
+
setState("initial");
|
|
31
|
+
}
|
|
32
|
+
}, [initialValues, loading, state]);
|
|
33
|
+
const validate = reactUtils.useReferentiallyStableCallback(validateIn || (() => void 0));
|
|
34
|
+
const onSuccess = reactUtils.useReferentiallyStableCallback(onSuccessIn || (() => void 0));
|
|
35
|
+
const execute = reactUtils.useReferentiallyStableCallback(executeIn);
|
|
36
|
+
const submit = reactUtils.useReferentiallyStableCallback(async (event) => {
|
|
37
|
+
event?.preventDefault();
|
|
38
|
+
const errors2 = validate?.({ values, state }) ?? [];
|
|
39
|
+
setErrors(errors2);
|
|
40
|
+
if (errors2.length > 0) {
|
|
41
|
+
setState("error");
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
setState("submitting");
|
|
45
|
+
try {
|
|
46
|
+
const response = await execute({ values, state });
|
|
47
|
+
if (!response.ok) {
|
|
48
|
+
const error = response.error;
|
|
49
|
+
setState(response.state ?? "error");
|
|
50
|
+
setErrors([{
|
|
51
|
+
code: error || "UNKNOWN_ERROR",
|
|
52
|
+
developerMessage: response.developerMessage,
|
|
53
|
+
field: errorMapping && error && error in errorMapping ? errorMapping[error] : void 0
|
|
54
|
+
}]);
|
|
55
|
+
} else {
|
|
56
|
+
setState("success");
|
|
57
|
+
setValues(initialValues);
|
|
58
|
+
onSuccess?.({ result: "result" in response ? response.result : void 0 });
|
|
59
|
+
}
|
|
60
|
+
} catch (e) {
|
|
61
|
+
console.error(e);
|
|
62
|
+
setState("error");
|
|
63
|
+
setErrors([{
|
|
64
|
+
code: "UNKNOWN_ERROR",
|
|
65
|
+
developerMessage: typeof e === "string" ? e : e && typeof e === "object" && "message" in e && typeof e.message === "string" ? e.message : void 0
|
|
66
|
+
}]);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
const onChange = reactUtils.useReferentiallyStableCallback(onChangeIn || (() => void 0));
|
|
70
|
+
React.useEffect(() => {
|
|
71
|
+
onChange?.({ values, state, submit });
|
|
72
|
+
}, [onChange, state, submit, values]);
|
|
73
|
+
const setValue = React.useCallback((field, value) => setValues((values2) => ({ ...values2, [field]: value })), []);
|
|
74
|
+
return /* @__PURE__ */ jsxDevRuntime.jsxDEV(
|
|
75
|
+
contexts.FormContext.Provider,
|
|
76
|
+
{
|
|
77
|
+
value: {
|
|
78
|
+
values,
|
|
79
|
+
setValues,
|
|
80
|
+
state,
|
|
81
|
+
errors,
|
|
82
|
+
setValue
|
|
83
|
+
},
|
|
84
|
+
children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(SlotForm, { onSubmit: submit, children }, void 0, false, {
|
|
85
|
+
fileName: "/home/runner/work/contember/contember/packages/react-client-tenant/src/components/forms/TenantForm.tsx",
|
|
86
|
+
lineNumber: 115,
|
|
87
|
+
columnNumber: 4
|
|
88
|
+
}, void 0)
|
|
89
|
+
},
|
|
90
|
+
void 0,
|
|
91
|
+
false,
|
|
92
|
+
{
|
|
93
|
+
fileName: "/home/runner/work/contember/contember/packages/react-client-tenant/src/components/forms/TenantForm.tsx",
|
|
94
|
+
lineNumber: 106,
|
|
95
|
+
columnNumber: 3
|
|
96
|
+
},
|
|
97
|
+
void 0
|
|
98
|
+
);
|
|
99
|
+
};
|
|
100
|
+
exports.TenantForm = TenantForm;
|
|
101
|
+
//# sourceMappingURL=TenantForm.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TenantForm.cjs","sources":["../../../../../../packages/react-client-tenant/src/components/forms/TenantForm.tsx"],"sourcesContent":["import { ComponentType, ReactElement, useCallback, useEffect, useState } from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { FormContextValue } from '../../types/forms'\nimport { FormContext } from '../../contexts'\nimport { useReferentiallyStableCallback } from '@contember/react-utils'\n\nconst SlotForm = Slot as ComponentType<React.FormHTMLAttributes<HTMLFormElement>>\n\ntype ExecuteResult<T extends FormContextValue<any, any, any>, OkResult = undefined> =\n\t| ({ ok: true } & (OkResult extends undefined ? {} : { result: OkResult }))\n\t| { ok: false; error?: T['errors'][number]['code']; developerMessage?: string; state?: T['state'] }\n\nexport interface TenantFormProps<T extends FormContextValue<any, any, any>, OkResult = undefined> {\n\tchildren: ReactElement\n\tloading?: boolean\n\tinitialValues: T['values']\n\terrorMapping?: Partial<Record<T['errors'][number]['code'], keyof T['values']>>\n\tvalidate?: (args: { values: T['values']; state: T['state'] }) => T['errors'] | undefined\n\texecute: (args: { values: T['values']; state: T['state'] }) => Promise<ExecuteResult<T, OkResult>>\n\tonSuccess?: (args: { result: OkResult }) => void\n\tonChange?: (args: { values: T['values']; state: T['state']; submit: () => Promise<void> }) => void\n}\n\nexport const TenantForm = <T extends FormContextValue<any, any, any>, OkResult = undefined>({\n\tchildren,\n\tinitialValues,\n\tloading,\n\terrorMapping,\n\tvalidate: validateIn,\n\texecute: executeIn,\n\tonSuccess: onSuccessIn,\n\tonChange: onChangeIn,\n}: TenantFormProps<T, OkResult>) => {\n\tconst [values, setValues] = useState<T['values']>(initialValues)\n\n\tconst [errors, setErrors] = useState<T['errors']>([])\n\tconst [state, setState] = useState<T['state']>(loading ? 'loading' : 'initial')\n\n\tuseEffect(() => {\n\t\tif (loading) {\n\t\t\tsetState('loading')\n\t\t}\n\t}, [loading])\n\n\tuseEffect(() => {\n\t\tif (state === 'loading' && !loading) {\n\t\t\tsetValues(initialValues)\n\t\t\tsetState('initial')\n\t\t}\n\t}, [initialValues, loading, state])\n\n\tconst validate = useReferentiallyStableCallback(validateIn || (() => undefined))\n\tconst onSuccess = useReferentiallyStableCallback(onSuccessIn || (() => undefined))\n\tconst execute = useReferentiallyStableCallback(executeIn)\n\n\tconst submit = useReferentiallyStableCallback(async (event?: React.FormEvent) => {\n\t\tevent?.preventDefault()\n\t\tconst errors = validate?.({ values, state }) ?? []\n\t\tsetErrors(errors)\n\n\t\tif (errors.length > 0) {\n\t\t\tsetState('error')\n\t\t\treturn\n\t\t}\n\n\t\tsetState('submitting')\n\n\t\ttry {\n\t\t\tconst response = await execute({ values, state })\n\n\t\t\tif (!response.ok) {\n\t\t\t\tconst error = response.error\n\t\t\t\tsetState(response.state ?? 'error')\n\t\t\t\tsetErrors([{\n\t\t\t\t\tcode: error || 'UNKNOWN_ERROR',\n\t\t\t\t\tdeveloperMessage: response.developerMessage,\n\t\t\t\t\tfield: errorMapping && error && error in errorMapping ? errorMapping[error] : undefined,\n\t\t\t\t}])\n\t\t\t} else {\n\t\t\t\tsetState('success')\n\t\t\t\tsetValues(initialValues)\n\t\t\t\tonSuccess?.({ result: 'result' in response ? response.result : undefined as OkResult })\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t\tsetState('error')\n\t\t\tsetErrors([{\n\t\t\t\tcode: 'UNKNOWN_ERROR',\n\t\t\t\tdeveloperMessage: typeof e === 'string'\n\t\t\t\t\t? e\n\t\t\t\t\t: (e && typeof e === 'object' && 'message' in e && typeof e.message === 'string')\n\t\t\t\t\t? e.message\n\t\t\t\t\t: undefined,\n\t\t\t}])\n\t\t}\n\t})\n\n\tconst onChange = useReferentiallyStableCallback(onChangeIn || (() => undefined))\n\tuseEffect(() => {\n\t\tonChange?.({ values, state, submit })\n\t}, [onChange, state, submit, values])\n\n\tconst setValue = useCallback((field: string, value: string) => setValues(values => ({ ...values, [field]: value })), [])\n\n\treturn (\n\t\t<FormContext.Provider\n\t\t\tvalue={{\n\t\t\t\tvalues,\n\t\t\t\tsetValues,\n\t\t\t\tstate,\n\t\t\t\terrors,\n\t\t\t\tsetValue: setValue,\n\t\t\t} as unknown as T}\n\t\t>\n\t\t\t<SlotForm onSubmit={submit}>\n\t\t\t\t{children}\n\t\t\t</SlotForm>\n\t\t</FormContext.Provider>\n\t)\n}\n"],"names":["Slot","useState","useEffect","useReferentiallyStableCallback","errors","useCallback","values","jsxDEV","FormContext","this"],"mappings":";;;;;;;AAMA,MAAM,WAAWA,UAAAA;AAiBV,MAAM,aAAa,CAAkE;AAAA,EAC3F;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV,SAAS;AAAA,EACT,WAAW;AAAA,EACX,UAAU;AACX,MAAoC;AACnC,QAAM,CAAC,QAAQ,SAAS,IAAIC,MAAAA,SAAsB,aAAa;AAE/D,QAAM,CAAC,QAAQ,SAAS,IAAIA,MAAAA,SAAsB,CAAA,CAAE;AACpD,QAAM,CAAC,OAAO,QAAQ,IAAIA,MAAAA,SAAqB,UAAU,YAAY,SAAS;AAE9EC,QAAAA,UAAU,MAAM;AACf,QAAI,SAAS;AACZ,eAAS,SAAS;AAAA,IACnB;AAAA,EACD,GAAG,CAAC,OAAO,CAAC;AAEZA,QAAAA,UAAU,MAAM;AACf,QAAI,UAAU,aAAa,CAAC,SAAS;AACpC,gBAAU,aAAa;AACvB,eAAS,SAAS;AAAA,IACnB;AAAA,EACD,GAAG,CAAC,eAAe,SAAS,KAAK,CAAC;AAElC,QAAM,WAAWC,WAAAA,+BAA+B,eAAe,MAAM,OAAU;AAC/E,QAAM,YAAYA,WAAAA,+BAA+B,gBAAgB,MAAM,OAAU;AACjF,QAAM,UAAUA,WAAAA,+BAA+B,SAAS;AAExD,QAAM,SAASA,0CAA+B,OAAO,UAA4B;AAChF,WAAO,eAAA;AACP,UAAMC,UAAS,WAAW,EAAE,QAAQ,MAAA,CAAO,KAAK,CAAA;AAChD,cAAUA,OAAM;AAEhB,QAAIA,QAAO,SAAS,GAAG;AACtB,eAAS,OAAO;AAChB;AAAA,IACD;AAEA,aAAS,YAAY;AAErB,QAAI;AACH,YAAM,WAAW,MAAM,QAAQ,EAAE,QAAQ,OAAO;AAEhD,UAAI,CAAC,SAAS,IAAI;AACjB,cAAM,QAAQ,SAAS;AACvB,iBAAS,SAAS,SAAS,OAAO;AAClC,kBAAU,CAAC;AAAA,UACV,MAAM,SAAS;AAAA,UACf,kBAAkB,SAAS;AAAA,UAC3B,OAAO,gBAAgB,SAAS,SAAS,eAAe,aAAa,KAAK,IAAI;AAAA,QAAA,CAC9E,CAAC;AAAA,MACH,OAAO;AACN,iBAAS,SAAS;AAClB,kBAAU,aAAa;AACvB,oBAAY,EAAE,QAAQ,YAAY,WAAW,SAAS,SAAS,QAAuB;AAAA,MACvF;AAAA,IACD,SAAS,GAAG;AACX,cAAQ,MAAM,CAAC;AACf,eAAS,OAAO;AAChB,gBAAU,CAAC;AAAA,QACV,MAAM;AAAA,QACN,kBAAkB,OAAO,MAAM,WAC5B,IACC,KAAK,OAAO,MAAM,YAAY,aAAa,KAAK,OAAO,EAAE,YAAY,WACtE,EAAE,UACF;AAAA,MAAA,CACH,CAAC;AAAA,IACH;AAAA,EACD,CAAC;AAED,QAAM,WAAWD,WAAAA,+BAA+B,eAAe,MAAM,OAAU;AAC/ED,QAAAA,UAAU,MAAM;AACf,eAAW,EAAE,QAAQ,OAAO,OAAA,CAAQ;AAAA,EACrC,GAAG,CAAC,UAAU,OAAO,QAAQ,MAAM,CAAC;AAEpC,QAAM,WAAWG,MAAAA,YAAY,CAAC,OAAe,UAAkB,UAAU,CAAAC,aAAW,EAAE,GAAGA,SAAQ,CAAC,KAAK,GAAG,QAAQ,GAAG,CAAA,CAAE;AAEvH,SACCC,8BAAAA;AAAAA,IAACC,SAAAA,YAAY;AAAA,IAAZ;AAAA,MACA,OAAO;AAAA,QACN;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MAAA;AAAA,MAGD,UAAAD,8BAAAA,OAAC,UAAA,EAAS,UAAU,QAClB,SAAA,GADF,QAAA,OAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MAAA,GAAAE,MAEA;AAAA,IAAA;AAAA,IAXD;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAA;AAAAA,EAAA;AAcF;;"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
2
|
+
import { useState, useEffect, useCallback } from "react";
|
|
3
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
4
|
+
import { FormContext } from "../../contexts.js";
|
|
5
|
+
import { useReferentiallyStableCallback } from "@contember/react-utils";
|
|
6
|
+
const SlotForm = Slot;
|
|
7
|
+
const TenantForm = ({
|
|
8
|
+
children,
|
|
9
|
+
initialValues,
|
|
10
|
+
loading,
|
|
11
|
+
errorMapping,
|
|
12
|
+
validate: validateIn,
|
|
13
|
+
execute: executeIn,
|
|
14
|
+
onSuccess: onSuccessIn,
|
|
15
|
+
onChange: onChangeIn
|
|
16
|
+
}) => {
|
|
17
|
+
const [values, setValues] = useState(initialValues);
|
|
18
|
+
const [errors, setErrors] = useState([]);
|
|
19
|
+
const [state, setState] = useState(loading ? "loading" : "initial");
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (loading) {
|
|
22
|
+
setState("loading");
|
|
23
|
+
}
|
|
24
|
+
}, [loading]);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (state === "loading" && !loading) {
|
|
27
|
+
setValues(initialValues);
|
|
28
|
+
setState("initial");
|
|
29
|
+
}
|
|
30
|
+
}, [initialValues, loading, state]);
|
|
31
|
+
const validate = useReferentiallyStableCallback(validateIn || (() => void 0));
|
|
32
|
+
const onSuccess = useReferentiallyStableCallback(onSuccessIn || (() => void 0));
|
|
33
|
+
const execute = useReferentiallyStableCallback(executeIn);
|
|
34
|
+
const submit = useReferentiallyStableCallback(async (event) => {
|
|
35
|
+
event?.preventDefault();
|
|
36
|
+
const errors2 = validate?.({ values, state }) ?? [];
|
|
37
|
+
setErrors(errors2);
|
|
38
|
+
if (errors2.length > 0) {
|
|
39
|
+
setState("error");
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
setState("submitting");
|
|
43
|
+
try {
|
|
44
|
+
const response = await execute({ values, state });
|
|
45
|
+
if (!response.ok) {
|
|
46
|
+
const error = response.error;
|
|
47
|
+
setState(response.state ?? "error");
|
|
48
|
+
setErrors([{
|
|
49
|
+
code: error || "UNKNOWN_ERROR",
|
|
50
|
+
developerMessage: response.developerMessage,
|
|
51
|
+
field: errorMapping && error && error in errorMapping ? errorMapping[error] : void 0
|
|
52
|
+
}]);
|
|
53
|
+
} else {
|
|
54
|
+
setState("success");
|
|
55
|
+
setValues(initialValues);
|
|
56
|
+
onSuccess?.({ result: "result" in response ? response.result : void 0 });
|
|
57
|
+
}
|
|
58
|
+
} catch (e) {
|
|
59
|
+
console.error(e);
|
|
60
|
+
setState("error");
|
|
61
|
+
setErrors([{
|
|
62
|
+
code: "UNKNOWN_ERROR",
|
|
63
|
+
developerMessage: typeof e === "string" ? e : e && typeof e === "object" && "message" in e && typeof e.message === "string" ? e.message : void 0
|
|
64
|
+
}]);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
const onChange = useReferentiallyStableCallback(onChangeIn || (() => void 0));
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
onChange?.({ values, state, submit });
|
|
70
|
+
}, [onChange, state, submit, values]);
|
|
71
|
+
const setValue = useCallback((field, value) => setValues((values2) => ({ ...values2, [field]: value })), []);
|
|
72
|
+
return /* @__PURE__ */ jsxDEV(
|
|
73
|
+
FormContext.Provider,
|
|
74
|
+
{
|
|
75
|
+
value: {
|
|
76
|
+
values,
|
|
77
|
+
setValues,
|
|
78
|
+
state,
|
|
79
|
+
errors,
|
|
80
|
+
setValue
|
|
81
|
+
},
|
|
82
|
+
children: /* @__PURE__ */ jsxDEV(SlotForm, { onSubmit: submit, children }, void 0, false, {
|
|
83
|
+
fileName: "/home/runner/work/contember/contember/packages/react-client-tenant/src/components/forms/TenantForm.tsx",
|
|
84
|
+
lineNumber: 115,
|
|
85
|
+
columnNumber: 4
|
|
86
|
+
}, void 0)
|
|
87
|
+
},
|
|
88
|
+
void 0,
|
|
89
|
+
false,
|
|
90
|
+
{
|
|
91
|
+
fileName: "/home/runner/work/contember/contember/packages/react-client-tenant/src/components/forms/TenantForm.tsx",
|
|
92
|
+
lineNumber: 106,
|
|
93
|
+
columnNumber: 3
|
|
94
|
+
},
|
|
95
|
+
void 0
|
|
96
|
+
);
|
|
97
|
+
};
|
|
98
|
+
export {
|
|
99
|
+
TenantForm
|
|
100
|
+
};
|
|
101
|
+
//# sourceMappingURL=TenantForm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TenantForm.js","sources":["../../../../../../packages/react-client-tenant/src/components/forms/TenantForm.tsx"],"sourcesContent":["import { ComponentType, ReactElement, useCallback, useEffect, useState } from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { FormContextValue } from '../../types/forms'\nimport { FormContext } from '../../contexts'\nimport { useReferentiallyStableCallback } from '@contember/react-utils'\n\nconst SlotForm = Slot as ComponentType<React.FormHTMLAttributes<HTMLFormElement>>\n\ntype ExecuteResult<T extends FormContextValue<any, any, any>, OkResult = undefined> =\n\t| ({ ok: true } & (OkResult extends undefined ? {} : { result: OkResult }))\n\t| { ok: false; error?: T['errors'][number]['code']; developerMessage?: string; state?: T['state'] }\n\nexport interface TenantFormProps<T extends FormContextValue<any, any, any>, OkResult = undefined> {\n\tchildren: ReactElement\n\tloading?: boolean\n\tinitialValues: T['values']\n\terrorMapping?: Partial<Record<T['errors'][number]['code'], keyof T['values']>>\n\tvalidate?: (args: { values: T['values']; state: T['state'] }) => T['errors'] | undefined\n\texecute: (args: { values: T['values']; state: T['state'] }) => Promise<ExecuteResult<T, OkResult>>\n\tonSuccess?: (args: { result: OkResult }) => void\n\tonChange?: (args: { values: T['values']; state: T['state']; submit: () => Promise<void> }) => void\n}\n\nexport const TenantForm = <T extends FormContextValue<any, any, any>, OkResult = undefined>({\n\tchildren,\n\tinitialValues,\n\tloading,\n\terrorMapping,\n\tvalidate: validateIn,\n\texecute: executeIn,\n\tonSuccess: onSuccessIn,\n\tonChange: onChangeIn,\n}: TenantFormProps<T, OkResult>) => {\n\tconst [values, setValues] = useState<T['values']>(initialValues)\n\n\tconst [errors, setErrors] = useState<T['errors']>([])\n\tconst [state, setState] = useState<T['state']>(loading ? 'loading' : 'initial')\n\n\tuseEffect(() => {\n\t\tif (loading) {\n\t\t\tsetState('loading')\n\t\t}\n\t}, [loading])\n\n\tuseEffect(() => {\n\t\tif (state === 'loading' && !loading) {\n\t\t\tsetValues(initialValues)\n\t\t\tsetState('initial')\n\t\t}\n\t}, [initialValues, loading, state])\n\n\tconst validate = useReferentiallyStableCallback(validateIn || (() => undefined))\n\tconst onSuccess = useReferentiallyStableCallback(onSuccessIn || (() => undefined))\n\tconst execute = useReferentiallyStableCallback(executeIn)\n\n\tconst submit = useReferentiallyStableCallback(async (event?: React.FormEvent) => {\n\t\tevent?.preventDefault()\n\t\tconst errors = validate?.({ values, state }) ?? []\n\t\tsetErrors(errors)\n\n\t\tif (errors.length > 0) {\n\t\t\tsetState('error')\n\t\t\treturn\n\t\t}\n\n\t\tsetState('submitting')\n\n\t\ttry {\n\t\t\tconst response = await execute({ values, state })\n\n\t\t\tif (!response.ok) {\n\t\t\t\tconst error = response.error\n\t\t\t\tsetState(response.state ?? 'error')\n\t\t\t\tsetErrors([{\n\t\t\t\t\tcode: error || 'UNKNOWN_ERROR',\n\t\t\t\t\tdeveloperMessage: response.developerMessage,\n\t\t\t\t\tfield: errorMapping && error && error in errorMapping ? errorMapping[error] : undefined,\n\t\t\t\t}])\n\t\t\t} else {\n\t\t\t\tsetState('success')\n\t\t\t\tsetValues(initialValues)\n\t\t\t\tonSuccess?.({ result: 'result' in response ? response.result : undefined as OkResult })\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t\tsetState('error')\n\t\t\tsetErrors([{\n\t\t\t\tcode: 'UNKNOWN_ERROR',\n\t\t\t\tdeveloperMessage: typeof e === 'string'\n\t\t\t\t\t? e\n\t\t\t\t\t: (e && typeof e === 'object' && 'message' in e && typeof e.message === 'string')\n\t\t\t\t\t? e.message\n\t\t\t\t\t: undefined,\n\t\t\t}])\n\t\t}\n\t})\n\n\tconst onChange = useReferentiallyStableCallback(onChangeIn || (() => undefined))\n\tuseEffect(() => {\n\t\tonChange?.({ values, state, submit })\n\t}, [onChange, state, submit, values])\n\n\tconst setValue = useCallback((field: string, value: string) => setValues(values => ({ ...values, [field]: value })), [])\n\n\treturn (\n\t\t<FormContext.Provider\n\t\t\tvalue={{\n\t\t\t\tvalues,\n\t\t\t\tsetValues,\n\t\t\t\tstate,\n\t\t\t\terrors,\n\t\t\t\tsetValue: setValue,\n\t\t\t} as unknown as T}\n\t\t>\n\t\t\t<SlotForm onSubmit={submit}>\n\t\t\t\t{children}\n\t\t\t</SlotForm>\n\t\t</FormContext.Provider>\n\t)\n}\n"],"names":["errors","values","this"],"mappings":";;;;;AAMA,MAAM,WAAW;AAiBV,MAAM,aAAa,CAAkE;AAAA,EAC3F;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV,SAAS;AAAA,EACT,WAAW;AAAA,EACX,UAAU;AACX,MAAoC;AACnC,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAsB,aAAa;AAE/D,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAsB,CAAA,CAAE;AACpD,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAqB,UAAU,YAAY,SAAS;AAE9E,YAAU,MAAM;AACf,QAAI,SAAS;AACZ,eAAS,SAAS;AAAA,IACnB;AAAA,EACD,GAAG,CAAC,OAAO,CAAC;AAEZ,YAAU,MAAM;AACf,QAAI,UAAU,aAAa,CAAC,SAAS;AACpC,gBAAU,aAAa;AACvB,eAAS,SAAS;AAAA,IACnB;AAAA,EACD,GAAG,CAAC,eAAe,SAAS,KAAK,CAAC;AAElC,QAAM,WAAW,+BAA+B,eAAe,MAAM,OAAU;AAC/E,QAAM,YAAY,+BAA+B,gBAAgB,MAAM,OAAU;AACjF,QAAM,UAAU,+BAA+B,SAAS;AAExD,QAAM,SAAS,+BAA+B,OAAO,UAA4B;AAChF,WAAO,eAAA;AACP,UAAMA,UAAS,WAAW,EAAE,QAAQ,MAAA,CAAO,KAAK,CAAA;AAChD,cAAUA,OAAM;AAEhB,QAAIA,QAAO,SAAS,GAAG;AACtB,eAAS,OAAO;AAChB;AAAA,IACD;AAEA,aAAS,YAAY;AAErB,QAAI;AACH,YAAM,WAAW,MAAM,QAAQ,EAAE,QAAQ,OAAO;AAEhD,UAAI,CAAC,SAAS,IAAI;AACjB,cAAM,QAAQ,SAAS;AACvB,iBAAS,SAAS,SAAS,OAAO;AAClC,kBAAU,CAAC;AAAA,UACV,MAAM,SAAS;AAAA,UACf,kBAAkB,SAAS;AAAA,UAC3B,OAAO,gBAAgB,SAAS,SAAS,eAAe,aAAa,KAAK,IAAI;AAAA,QAAA,CAC9E,CAAC;AAAA,MACH,OAAO;AACN,iBAAS,SAAS;AAClB,kBAAU,aAAa;AACvB,oBAAY,EAAE,QAAQ,YAAY,WAAW,SAAS,SAAS,QAAuB;AAAA,MACvF;AAAA,IACD,SAAS,GAAG;AACX,cAAQ,MAAM,CAAC;AACf,eAAS,OAAO;AAChB,gBAAU,CAAC;AAAA,QACV,MAAM;AAAA,QACN,kBAAkB,OAAO,MAAM,WAC5B,IACC,KAAK,OAAO,MAAM,YAAY,aAAa,KAAK,OAAO,EAAE,YAAY,WACtE,EAAE,UACF;AAAA,MAAA,CACH,CAAC;AAAA,IACH;AAAA,EACD,CAAC;AAED,QAAM,WAAW,+BAA+B,eAAe,MAAM,OAAU;AAC/E,YAAU,MAAM;AACf,eAAW,EAAE,QAAQ,OAAO,OAAA,CAAQ;AAAA,EACrC,GAAG,CAAC,UAAU,OAAO,QAAQ,MAAM,CAAC;AAEpC,QAAM,WAAW,YAAY,CAAC,OAAe,UAAkB,UAAU,CAAAC,aAAW,EAAE,GAAGA,SAAQ,CAAC,KAAK,GAAG,QAAQ,GAAG,CAAA,CAAE;AAEvH,SACC;AAAA,IAAC,YAAY;AAAA,IAAZ;AAAA,MACA,OAAO;AAAA,QACN;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MAAA;AAAA,MAGD,UAAA,uBAAC,UAAA,EAAS,UAAU,QAClB,SAAA,GADF,QAAA,OAAA;AAAA,QAAA,UAAA;AAAA,QAAA,YAAA;AAAA,QAAA,cAAA;AAAA,MAAA,GAAAC,MAEA;AAAA,IAAA;AAAA,IAXD;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAA;AAAAA,EAAA;AAcF;"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxDevRuntime = require("react/jsx-dev-runtime");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const TenantForm = require("./TenantForm.cjs");
|
|
6
|
+
const contexts = require("../../contexts.cjs");
|
|
7
|
+
const useUpdateProjectMemberMutation = require("../../hooks/mutations/memberships/useUpdateProjectMemberMutation.cjs");
|
|
8
|
+
const useTenantQueryLoader = require("../../hooks/useTenantQueryLoader.cjs");
|
|
9
|
+
const useProjectMembershipsQuery = require("../../hooks/queries/useProjectMembershipsQuery.cjs");
|
|
10
|
+
const useUpdateProjectMemberForm = contexts.useForm;
|
|
11
|
+
const UpdateProjectMemberForm = ({ children, onSuccess, identityId, projectSlug }) => {
|
|
12
|
+
const updateProjectMember = useUpdateProjectMemberMutation.useUpdateProjectMemberMutation();
|
|
13
|
+
const [state] = useTenantQueryLoader.useTenantQueryLoader(useProjectMembershipsQuery.useProjectMembershipsQuery(), { projectSlug, identityId });
|
|
14
|
+
const [memberships, setMemberships] = React.useState();
|
|
15
|
+
React.useEffect(() => {
|
|
16
|
+
setMemberships(state.state === "success" ? state.data : void 0);
|
|
17
|
+
}, [state]);
|
|
18
|
+
return /* @__PURE__ */ jsxDevRuntime.jsxDEV(
|
|
19
|
+
TenantForm.TenantForm,
|
|
20
|
+
{
|
|
21
|
+
onSuccess,
|
|
22
|
+
loading: memberships === void 0,
|
|
23
|
+
initialValues: memberships ? { memberships } : { memberships: [] },
|
|
24
|
+
onChange: ({ values, submit }) => {
|
|
25
|
+
setMemberships(values?.memberships);
|
|
26
|
+
},
|
|
27
|
+
validate: ({ values }) => {
|
|
28
|
+
const errors = [];
|
|
29
|
+
if (values.memberships.length === 0) {
|
|
30
|
+
errors.push({ code: "FIELD_REQUIRED", field: "memberships" });
|
|
31
|
+
}
|
|
32
|
+
return errors;
|
|
33
|
+
},
|
|
34
|
+
execute: async ({ values }) => {
|
|
35
|
+
return await updateProjectMember({
|
|
36
|
+
identityId,
|
|
37
|
+
projectSlug,
|
|
38
|
+
memberships: values.memberships
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
errorMapping: errorToField,
|
|
42
|
+
children
|
|
43
|
+
},
|
|
44
|
+
void 0,
|
|
45
|
+
false,
|
|
46
|
+
{
|
|
47
|
+
fileName: "/home/runner/work/contember/contember/packages/react-client-tenant/src/components/forms/UpdateProjectMemberForm.tsx",
|
|
48
|
+
lineNumber: 42,
|
|
49
|
+
columnNumber: 3
|
|
50
|
+
},
|
|
51
|
+
void 0
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
const errorToField = {
|
|
55
|
+
INVALID_MEMBERSHIP: "memberships",
|
|
56
|
+
PROJECT_NOT_FOUND: void 0,
|
|
57
|
+
ROLE_NOT_FOUND: "memberships",
|
|
58
|
+
VARIABLE_EMPTY: "memberships",
|
|
59
|
+
VARIABLE_NOT_FOUND: "memberships",
|
|
60
|
+
NOT_MEMBER: void 0
|
|
61
|
+
};
|
|
62
|
+
exports.UpdateProjectMemberForm = UpdateProjectMemberForm;
|
|
63
|
+
exports.useUpdateProjectMemberForm = useUpdateProjectMemberForm;
|
|
64
|
+
//# sourceMappingURL=UpdateProjectMemberForm.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UpdateProjectMemberForm.cjs","sources":["../../../../../../packages/react-client-tenant/src/components/forms/UpdateProjectMemberForm.tsx"],"sourcesContent":["import { ReactElement, useEffect, useState } from 'react'\nimport { TenantForm } from './TenantForm'\nimport { FormContextValue, FormError, FormState } from '../../types'\nimport { useForm } from '../../contexts'\nimport { MembershipInput, UpdateProjectMemberErrorCode } from '@contember/graphql-client-tenant'\nimport { useProjectMembershipsQuery, useTenantQueryLoader, useUpdateProjectMemberMutation } from '../../hooks'\n\nexport type UpdateProjectMemberFormValues = {\n\tmemberships: readonly MembershipInput[]\n}\n\nexport type UpdateProjectMemberFormErrorCode =\n\t| UpdateProjectMemberErrorCode\n\t| 'UNKNOWN_ERROR'\n\t| 'FIELD_REQUIRED'\n\nexport type UpdateProjectMemberFormState = FormState\n\nexport type UpdateProjectMemberFormError = FormError<UpdateProjectMemberFormValues, UpdateProjectMemberFormErrorCode>\n\nexport type UpdateProjectMemberFormContextValue = FormContextValue<UpdateProjectMemberFormValues, UpdateProjectMemberFormErrorCode>\n\nexport interface UpdateProjectMemberFormProps {\n\tchildren: ReactElement\n\tidentityId: string\n\tprojectSlug: string\n\tonSuccess?: (args: {}) => void\n}\n\nexport const useUpdateProjectMemberForm = useForm as () => UpdateProjectMemberFormContextValue\n\nexport const UpdateProjectMemberForm = ({ children, onSuccess, identityId, projectSlug }: UpdateProjectMemberFormProps) => {\n\tconst updateProjectMember = useUpdateProjectMemberMutation()\n\tconst [state] = useTenantQueryLoader(useProjectMembershipsQuery(), { projectSlug, identityId })\n\tconst [memberships, setMemberships] = useState<readonly MembershipInput[]>()\n\n\tuseEffect(() => {\n\t\tsetMemberships(state.state === 'success' ? state.data : undefined)\n\t}, [state])\n\n\treturn (\n\t\t<TenantForm<UpdateProjectMemberFormContextValue>\n\t\t\tonSuccess={onSuccess}\n\t\t\tloading={memberships === undefined}\n\t\t\tinitialValues={memberships ? { memberships } : { memberships: [] }}\n\t\t\tonChange={({ values, submit }) => {\n\t\t\t\tsetMemberships(values?.memberships)\n\t\t\t}}\n\t\t\tvalidate={({ values }) => {\n\t\t\t\tconst errors: UpdateProjectMemberFormError[] = []\n\t\t\t\tif (values.memberships.length === 0) {\n\t\t\t\t\terrors.push({ code: 'FIELD_REQUIRED', field: 'memberships' })\n\t\t\t\t}\n\t\t\t\treturn errors\n\t\t\t}}\n\t\t\texecute={async ({ values }) => {\n\t\t\t\treturn await updateProjectMember({\n\t\t\t\t\tidentityId,\n\t\t\t\t\tprojectSlug,\n\t\t\t\t\tmemberships: values.memberships,\n\t\t\t\t})\n\t\t\t}}\n\t\t\terrorMapping={errorToField}\n\t\t>\n\t\t\t{children}\n\t\t</TenantForm>\n\t)\n}\n\nconst errorToField: Record<UpdateProjectMemberErrorCode, keyof UpdateProjectMemberFormValues | undefined> = {\n\tINVALID_MEMBERSHIP: 'memberships',\n\tPROJECT_NOT_FOUND: undefined,\n\tROLE_NOT_FOUND: 'memberships',\n\tVARIABLE_EMPTY: 'memberships',\n\tVARIABLE_NOT_FOUND: 'memberships',\n\tNOT_MEMBER: undefined,\n}\n"],"names":["useForm","useUpdateProjectMemberMutation","useTenantQueryLoader","useProjectMembershipsQuery","useState","useEffect","jsxDEV","TenantForm","this"],"mappings":";;;;;;;;;AA6BO,MAAM,6BAA6BA,SAAAA;AAEnC,MAAM,0BAA0B,CAAC,EAAE,UAAU,WAAW,YAAY,kBAAgD;AAC1H,QAAM,sBAAsBC,+BAAAA,+BAAA;AAC5B,QAAM,CAAC,KAAK,IAAIC,qBAAAA,qBAAqBC,2BAAAA,8BAA8B,EAAE,aAAa,YAAY;AAC9F,QAAM,CAAC,aAAa,cAAc,IAAIC,eAAA;AAEtCC,QAAAA,UAAU,MAAM;AACf,mBAAe,MAAM,UAAU,YAAY,MAAM,OAAO,MAAS;AAAA,EAClE,GAAG,CAAC,KAAK,CAAC;AAEV,SACCC,8BAAAA;AAAAA,IAACC,WAAAA;AAAAA,IAAA;AAAA,MACA;AAAA,MACA,SAAS,gBAAgB;AAAA,MACzB,eAAe,cAAc,EAAE,YAAA,IAAgB,EAAE,aAAa,CAAA,EAAC;AAAA,MAC/D,UAAU,CAAC,EAAE,QAAQ,aAAa;AACjC,uBAAe,QAAQ,WAAW;AAAA,MACnC;AAAA,MACA,UAAU,CAAC,EAAE,aAAa;AACzB,cAAM,SAAyC,CAAA;AAC/C,YAAI,OAAO,YAAY,WAAW,GAAG;AACpC,iBAAO,KAAK,EAAE,MAAM,kBAAkB,OAAO,eAAe;AAAA,QAC7D;AACA,eAAO;AAAA,MACR;AAAA,MACA,SAAS,OAAO,EAAE,aAAa;AAC9B,eAAO,MAAM,oBAAoB;AAAA,UAChC;AAAA,UACA;AAAA,UACA,aAAa,OAAO;AAAA,QAAA,CACpB;AAAA,MACF;AAAA,MACA,cAAc;AAAA,MAEb;AAAA,IAAA;AAAA,IAvBF;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAC;AAAAA,EAAA;AA0BF;AAEA,MAAM,eAAsG;AAAA,EAC3G,oBAAoB;AAAA,EACpB,mBAAmB;AAAA,EACnB,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,oBAAoB;AAAA,EACpB,YAAY;AACb;;;"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
3
|
+
import { TenantForm } from "./TenantForm.js";
|
|
4
|
+
import { useForm } from "../../contexts.js";
|
|
5
|
+
import { useUpdateProjectMemberMutation } from "../../hooks/mutations/memberships/useUpdateProjectMemberMutation.js";
|
|
6
|
+
import { useTenantQueryLoader } from "../../hooks/useTenantQueryLoader.js";
|
|
7
|
+
import { useProjectMembershipsQuery } from "../../hooks/queries/useProjectMembershipsQuery.js";
|
|
8
|
+
const useUpdateProjectMemberForm = useForm;
|
|
9
|
+
const UpdateProjectMemberForm = ({ children, onSuccess, identityId, projectSlug }) => {
|
|
10
|
+
const updateProjectMember = useUpdateProjectMemberMutation();
|
|
11
|
+
const [state] = useTenantQueryLoader(useProjectMembershipsQuery(), { projectSlug, identityId });
|
|
12
|
+
const [memberships, setMemberships] = useState();
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
setMemberships(state.state === "success" ? state.data : void 0);
|
|
15
|
+
}, [state]);
|
|
16
|
+
return /* @__PURE__ */ jsxDEV(
|
|
17
|
+
TenantForm,
|
|
18
|
+
{
|
|
19
|
+
onSuccess,
|
|
20
|
+
loading: memberships === void 0,
|
|
21
|
+
initialValues: memberships ? { memberships } : { memberships: [] },
|
|
22
|
+
onChange: ({ values, submit }) => {
|
|
23
|
+
setMemberships(values?.memberships);
|
|
24
|
+
},
|
|
25
|
+
validate: ({ values }) => {
|
|
26
|
+
const errors = [];
|
|
27
|
+
if (values.memberships.length === 0) {
|
|
28
|
+
errors.push({ code: "FIELD_REQUIRED", field: "memberships" });
|
|
29
|
+
}
|
|
30
|
+
return errors;
|
|
31
|
+
},
|
|
32
|
+
execute: async ({ values }) => {
|
|
33
|
+
return await updateProjectMember({
|
|
34
|
+
identityId,
|
|
35
|
+
projectSlug,
|
|
36
|
+
memberships: values.memberships
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
errorMapping: errorToField,
|
|
40
|
+
children
|
|
41
|
+
},
|
|
42
|
+
void 0,
|
|
43
|
+
false,
|
|
44
|
+
{
|
|
45
|
+
fileName: "/home/runner/work/contember/contember/packages/react-client-tenant/src/components/forms/UpdateProjectMemberForm.tsx",
|
|
46
|
+
lineNumber: 42,
|
|
47
|
+
columnNumber: 3
|
|
48
|
+
},
|
|
49
|
+
void 0
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
const errorToField = {
|
|
53
|
+
INVALID_MEMBERSHIP: "memberships",
|
|
54
|
+
PROJECT_NOT_FOUND: void 0,
|
|
55
|
+
ROLE_NOT_FOUND: "memberships",
|
|
56
|
+
VARIABLE_EMPTY: "memberships",
|
|
57
|
+
VARIABLE_NOT_FOUND: "memberships",
|
|
58
|
+
NOT_MEMBER: void 0
|
|
59
|
+
};
|
|
60
|
+
export {
|
|
61
|
+
UpdateProjectMemberForm,
|
|
62
|
+
useUpdateProjectMemberForm
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=UpdateProjectMemberForm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UpdateProjectMemberForm.js","sources":["../../../../../../packages/react-client-tenant/src/components/forms/UpdateProjectMemberForm.tsx"],"sourcesContent":["import { ReactElement, useEffect, useState } from 'react'\nimport { TenantForm } from './TenantForm'\nimport { FormContextValue, FormError, FormState } from '../../types'\nimport { useForm } from '../../contexts'\nimport { MembershipInput, UpdateProjectMemberErrorCode } from '@contember/graphql-client-tenant'\nimport { useProjectMembershipsQuery, useTenantQueryLoader, useUpdateProjectMemberMutation } from '../../hooks'\n\nexport type UpdateProjectMemberFormValues = {\n\tmemberships: readonly MembershipInput[]\n}\n\nexport type UpdateProjectMemberFormErrorCode =\n\t| UpdateProjectMemberErrorCode\n\t| 'UNKNOWN_ERROR'\n\t| 'FIELD_REQUIRED'\n\nexport type UpdateProjectMemberFormState = FormState\n\nexport type UpdateProjectMemberFormError = FormError<UpdateProjectMemberFormValues, UpdateProjectMemberFormErrorCode>\n\nexport type UpdateProjectMemberFormContextValue = FormContextValue<UpdateProjectMemberFormValues, UpdateProjectMemberFormErrorCode>\n\nexport interface UpdateProjectMemberFormProps {\n\tchildren: ReactElement\n\tidentityId: string\n\tprojectSlug: string\n\tonSuccess?: (args: {}) => void\n}\n\nexport const useUpdateProjectMemberForm = useForm as () => UpdateProjectMemberFormContextValue\n\nexport const UpdateProjectMemberForm = ({ children, onSuccess, identityId, projectSlug }: UpdateProjectMemberFormProps) => {\n\tconst updateProjectMember = useUpdateProjectMemberMutation()\n\tconst [state] = useTenantQueryLoader(useProjectMembershipsQuery(), { projectSlug, identityId })\n\tconst [memberships, setMemberships] = useState<readonly MembershipInput[]>()\n\n\tuseEffect(() => {\n\t\tsetMemberships(state.state === 'success' ? state.data : undefined)\n\t}, [state])\n\n\treturn (\n\t\t<TenantForm<UpdateProjectMemberFormContextValue>\n\t\t\tonSuccess={onSuccess}\n\t\t\tloading={memberships === undefined}\n\t\t\tinitialValues={memberships ? { memberships } : { memberships: [] }}\n\t\t\tonChange={({ values, submit }) => {\n\t\t\t\tsetMemberships(values?.memberships)\n\t\t\t}}\n\t\t\tvalidate={({ values }) => {\n\t\t\t\tconst errors: UpdateProjectMemberFormError[] = []\n\t\t\t\tif (values.memberships.length === 0) {\n\t\t\t\t\terrors.push({ code: 'FIELD_REQUIRED', field: 'memberships' })\n\t\t\t\t}\n\t\t\t\treturn errors\n\t\t\t}}\n\t\t\texecute={async ({ values }) => {\n\t\t\t\treturn await updateProjectMember({\n\t\t\t\t\tidentityId,\n\t\t\t\t\tprojectSlug,\n\t\t\t\t\tmemberships: values.memberships,\n\t\t\t\t})\n\t\t\t}}\n\t\t\terrorMapping={errorToField}\n\t\t>\n\t\t\t{children}\n\t\t</TenantForm>\n\t)\n}\n\nconst errorToField: Record<UpdateProjectMemberErrorCode, keyof UpdateProjectMemberFormValues | undefined> = {\n\tINVALID_MEMBERSHIP: 'memberships',\n\tPROJECT_NOT_FOUND: undefined,\n\tROLE_NOT_FOUND: 'memberships',\n\tVARIABLE_EMPTY: 'memberships',\n\tVARIABLE_NOT_FOUND: 'memberships',\n\tNOT_MEMBER: undefined,\n}\n"],"names":["this"],"mappings":";;;;;;;AA6BO,MAAM,6BAA6B;AAEnC,MAAM,0BAA0B,CAAC,EAAE,UAAU,WAAW,YAAY,kBAAgD;AAC1H,QAAM,sBAAsB,+BAAA;AAC5B,QAAM,CAAC,KAAK,IAAI,qBAAqB,8BAA8B,EAAE,aAAa,YAAY;AAC9F,QAAM,CAAC,aAAa,cAAc,IAAI,SAAA;AAEtC,YAAU,MAAM;AACf,mBAAe,MAAM,UAAU,YAAY,MAAM,OAAO,MAAS;AAAA,EAClE,GAAG,CAAC,KAAK,CAAC;AAEV,SACC;AAAA,IAAC;AAAA,IAAA;AAAA,MACA;AAAA,MACA,SAAS,gBAAgB;AAAA,MACzB,eAAe,cAAc,EAAE,YAAA,IAAgB,EAAE,aAAa,CAAA,EAAC;AAAA,MAC/D,UAAU,CAAC,EAAE,QAAQ,aAAa;AACjC,uBAAe,QAAQ,WAAW;AAAA,MACnC;AAAA,MACA,UAAU,CAAC,EAAE,aAAa;AACzB,cAAM,SAAyC,CAAA;AAC/C,YAAI,OAAO,YAAY,WAAW,GAAG;AACpC,iBAAO,KAAK,EAAE,MAAM,kBAAkB,OAAO,eAAe;AAAA,QAC7D;AACA,eAAO;AAAA,MACR;AAAA,MACA,SAAS,OAAO,EAAE,aAAa;AAC9B,eAAO,MAAM,oBAAoB;AAAA,UAChC;AAAA,UACA;AAAA,UACA,aAAa,OAAO;AAAA,QAAA,CACpB;AAAA,MACF;AAAA,MACA,cAAc;AAAA,MAEb;AAAA,IAAA;AAAA,IAvBF;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAAA;AAAAA,EAAA;AA0BF;AAEA,MAAM,eAAsG;AAAA,EAC3G,oBAAoB;AAAA,EACpB,mBAAmB;AAAA,EACnB,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,oBAAoB;AAAA,EACpB,YAAY;AACb;"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxDevRuntime = require("react/jsx-dev-runtime");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const contexts = require("../../contexts.cjs");
|
|
6
|
+
const useHandleIDPResponse = require("../../internal/hooks/useHandleIDPResponse.cjs");
|
|
7
|
+
const useIDPAutoInit = require("../../internal/hooks/useIDPAutoInit.cjs");
|
|
8
|
+
const useInitIDPRedirect = require("../../internal/hooks/useInitIDPRedirect.cjs");
|
|
9
|
+
const IDP = ({ children, onResponseError, onInitError, onLogin, expiration, redirectUrl }) => {
|
|
10
|
+
const hasOauthResponse = React.useMemo(() => {
|
|
11
|
+
const params = new URLSearchParams(window.location.search);
|
|
12
|
+
return params.has("state") && (params.has("code") || params.has("id_token"));
|
|
13
|
+
}, []);
|
|
14
|
+
const autoInit = useIDPAutoInit.useIDPAutoInitProvider();
|
|
15
|
+
const [state, setState] = React.useState(() => {
|
|
16
|
+
if (hasOauthResponse) {
|
|
17
|
+
return { type: "processing_response" };
|
|
18
|
+
}
|
|
19
|
+
if (autoInit) {
|
|
20
|
+
return { type: "processing_init" };
|
|
21
|
+
}
|
|
22
|
+
return { type: "nothing" };
|
|
23
|
+
});
|
|
24
|
+
useHandleIDPResponse.useHandleIDPResponse({ hasOauthResponse, setState, onLogin, expiration, redirectUrl });
|
|
25
|
+
const initRedirect = useInitIDPRedirect.useInitIDPRedirect({ setState, redirectUrl });
|
|
26
|
+
const isFirstRender = React.useRef(true);
|
|
27
|
+
React.useEffect(() => {
|
|
28
|
+
if (!autoInit) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (!isFirstRender.current) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
isFirstRender.current = false;
|
|
35
|
+
initRedirect({ provider: autoInit });
|
|
36
|
+
}, [autoInit, initRedirect]);
|
|
37
|
+
React.useEffect(() => {
|
|
38
|
+
if (state.type === "init_failed" && onInitError) {
|
|
39
|
+
onInitError(state.error);
|
|
40
|
+
}
|
|
41
|
+
if (state.type === "response_failed" && onResponseError) {
|
|
42
|
+
onResponseError(state.error);
|
|
43
|
+
}
|
|
44
|
+
}, [onInitError, onResponseError, state]);
|
|
45
|
+
return /* @__PURE__ */ jsxDevRuntime.jsxDEV(contexts.IDPStateContextProvider.Provider, { value: state, children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(contexts.IDPMethodsContextProvider.Provider, { value: { initRedirect }, children }, void 0, false, {
|
|
46
|
+
fileName: "/home/runner/work/contember/contember/packages/react-client-tenant/src/components/idp/IDP.tsx",
|
|
47
|
+
lineNumber: 60,
|
|
48
|
+
columnNumber: 4
|
|
49
|
+
}, void 0) }, void 0, false, {
|
|
50
|
+
fileName: "/home/runner/work/contember/contember/packages/react-client-tenant/src/components/idp/IDP.tsx",
|
|
51
|
+
lineNumber: 59,
|
|
52
|
+
columnNumber: 3
|
|
53
|
+
}, void 0);
|
|
54
|
+
};
|
|
55
|
+
exports.IDP = IDP;
|
|
56
|
+
//# sourceMappingURL=IDP.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IDP.cjs","sources":["../../../../../../packages/react-client-tenant/src/components/idp/IDP.tsx"],"sourcesContent":["import { ReactNode, useEffect, useMemo, useRef, useState } from 'react'\nimport { IDPMethodsContextProvider, IDPStateContextProvider } from '../../contexts'\nimport { IDPInitError, IDPResponseError, IDPStateValue } from '../../types/idp'\nimport { useHandleIDPResponse } from '../../internal/hooks/useHandleIDPResponse'\nimport { useIDPAutoInitProvider } from '../../internal/hooks/useIDPAutoInit'\nimport { useInitIDPRedirect } from '../../internal/hooks/useInitIDPRedirect'\n\nexport interface IDPProps {\n\tchildren: ReactNode\n\tonLogin?: () => void\n\tonInitError?: (error: IDPInitError) => void\n\tonResponseError?: (error: IDPResponseError) => void\n\texpiration?: number\n\tredirectUrl?: string\n}\n\nexport const IDP = ({ children, onResponseError, onInitError, onLogin, expiration, redirectUrl }: IDPProps) => {\n\tconst hasOauthResponse = useMemo(() => {\n\t\tconst params = new URLSearchParams(window.location.search)\n\t\treturn params.has('state') && (params.has('code') || params.has('id_token'))\n\t}, [])\n\n\tconst autoInit = useIDPAutoInitProvider()\n\tconst [state, setState] = useState<IDPStateValue>(() => {\n\t\tif (hasOauthResponse) {\n\t\t\treturn { type: 'processing_response' }\n\t\t}\n\t\tif (autoInit) {\n\t\t\treturn { type: 'processing_init' }\n\t\t}\n\t\treturn { type: 'nothing' }\n\t})\n\tuseHandleIDPResponse({ hasOauthResponse, setState, onLogin, expiration: expiration, redirectUrl })\n\n\tconst initRedirect = useInitIDPRedirect({ setState, redirectUrl })\n\n\tconst isFirstRender = useRef(true)\n\tuseEffect(() => {\n\t\tif (!autoInit) {\n\t\t\treturn\n\t\t}\n\t\tif (!isFirstRender.current) {\n\t\t\treturn\n\t\t}\n\t\tisFirstRender.current = false\n\t\tinitRedirect({ provider: autoInit })\n\t}, [autoInit, initRedirect])\n\n\tuseEffect(() => {\n\t\tif (state.type === 'init_failed' && onInitError) {\n\t\t\tonInitError(state.error)\n\t\t}\n\t\tif (state.type === 'response_failed' && onResponseError) {\n\t\t\tonResponseError(state.error)\n\t\t}\n\t}, [onInitError, onResponseError, state])\n\n\treturn (\n\t\t<IDPStateContextProvider.Provider value={state}>\n\t\t\t<IDPMethodsContextProvider.Provider value={{ initRedirect }}>\n\t\t\t\t{children}\n\t\t\t</IDPMethodsContextProvider.Provider>\n\t\t</IDPStateContextProvider.Provider>\n\t)\n}\n"],"names":["useMemo","useIDPAutoInitProvider","useState","useHandleIDPResponse","useInitIDPRedirect","useRef","useEffect","jsxDEV","IDPStateContextProvider","IDPMethodsContextProvider","this"],"mappings":";;;;;;;;AAgBO,MAAM,MAAM,CAAC,EAAE,UAAU,iBAAiB,aAAa,SAAS,YAAY,kBAA4B;AAC9G,QAAM,mBAAmBA,MAAAA,QAAQ,MAAM;AACtC,UAAM,SAAS,IAAI,gBAAgB,OAAO,SAAS,MAAM;AACzD,WAAO,OAAO,IAAI,OAAO,MAAM,OAAO,IAAI,MAAM,KAAK,OAAO,IAAI,UAAU;AAAA,EAC3E,GAAG,CAAA,CAAE;AAEL,QAAM,WAAWC,eAAAA,uBAAA;AACjB,QAAM,CAAC,OAAO,QAAQ,IAAIC,MAAAA,SAAwB,MAAM;AACvD,QAAI,kBAAkB;AACrB,aAAO,EAAE,MAAM,sBAAA;AAAA,IAChB;AACA,QAAI,UAAU;AACb,aAAO,EAAE,MAAM,kBAAA;AAAA,IAChB;AACA,WAAO,EAAE,MAAM,UAAA;AAAA,EAChB,CAAC;AACDC,uBAAAA,qBAAqB,EAAE,kBAAkB,UAAU,SAAS,YAAwB,aAAa;AAEjG,QAAM,eAAeC,mBAAAA,mBAAmB,EAAE,UAAU,aAAa;AAEjE,QAAM,gBAAgBC,MAAAA,OAAO,IAAI;AACjCC,QAAAA,UAAU,MAAM;AACf,QAAI,CAAC,UAAU;AACd;AAAA,IACD;AACA,QAAI,CAAC,cAAc,SAAS;AAC3B;AAAA,IACD;AACA,kBAAc,UAAU;AACxB,iBAAa,EAAE,UAAU,UAAU;AAAA,EACpC,GAAG,CAAC,UAAU,YAAY,CAAC;AAE3BA,QAAAA,UAAU,MAAM;AACf,QAAI,MAAM,SAAS,iBAAiB,aAAa;AAChD,kBAAY,MAAM,KAAK;AAAA,IACxB;AACA,QAAI,MAAM,SAAS,qBAAqB,iBAAiB;AACxD,sBAAgB,MAAM,KAAK;AAAA,IAC5B;AAAA,EACD,GAAG,CAAC,aAAa,iBAAiB,KAAK,CAAC;AAExC,SACCC,8BAAAA,OAACC,SAAAA,wBAAwB,UAAxB,EAAiC,OAAO,OACxC,UAAAD,8BAAAA,OAACE,SAAAA,0BAA0B,UAA1B,EAAmC,OAAO,EAAE,aAAA,GAC3C,SAAA,GADF,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAC,MAEA,EAAA,GAHD,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAIA;AAEF;;"}
|