@iblai/iblai-js 2.3.0 → 2.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web-containers/source/index.esm.js +1372 -965
- package/dist/web-containers/source/next/index.esm.js +1332 -876
- package/package.json +3 -3
|
@@ -2,8 +2,8 @@ import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import React__default, { useState, useEffect, forwardRef, createElement as createElement$3, useLayoutEffect, createContext, useContext, useMemo, useReducer, useRef, useImperativeHandle, useCallback, isValidElement, Children, PureComponent, cloneElement, Component as Component$1, useId as useId$2, useDebugValue, lazy, Suspense } from 'react';
|
|
4
4
|
import * as dataLayer from '@iblai/data-layer';
|
|
5
|
-
import { useGetUserMetadataQuery, useGetUserMetadataEdxQuery, useUpdateUserMetadataMutation, useUpdateUserMetadataEdxMutation, useUploadProfileImageMutation, useResetPasswordMutation, useSelfRetireMutation, useCreateUserInstitutionMutation, useGetUserInstitutionsQuery, useCreateUserEducationMutation, useUpdateUserEducationMutation, useDeleteUserEducationMutation, useGetUserEducationQuery, useCreateUserCompanyMutation, useGetUserCompaniesQuery, useCreateUserExperienceMutation, useUpdateUserExperienceMutation, useDeleteUserExperienceMutation, useGetUserExperienceQuery, useGetUserResumeQuery, useCreateUserResumeMutation, useGetMySubscriptionsQuery, useGetItemSubscriptionQuery, useCancelSubscriptionMutation, useGetLearnerDetailsQuery, useGetUserEnrolledCoursesQuery, useGetUserEnrolledProgramsQuery, useGetUserCatalogPathwaysQuery, useGetUsersAsAssertionsQuery, useGetUserEarnedSkillsQuery, useGetUserReportedSkillsQuery, useGetUserDesiredSkillsQuery, useCreateGlobalMemoryMutation, useGetMemsearchStatusQuery, useGetUserMemorySettingsQuery, useUpdateUserMemorySettingsMutation, useGetGlobalMemoriesQuery, useDeleteGlobalMemoryMutation, useInviteUserMutation, usePlatformInvitationsQuery, useCreateCatalogInvitationCourseBulkMutation, useGetCatalogInvitationsCourseQuery, useLazyPlatformUsersQuery, useLazyPlatformUserGroupsQuery, useGetPersonnalizedSearchQuery, useCreateCatalogInvitationProgramBulkMutation, useGetCatalogInvitationsProgramQuery, useUpdateUserRoleMutation, useUpdateUserStatusMutation, useUpdatePlatformUserRoleWithPoliciesMutation, usePlatformUsersQuery, isPoliciesResponse, platformApiSlice, featureTags, useLazyGetRbacTeamsAccessListQuery, useCreateRbacTeamsAccessMutation, useGetRbacGroupsQuery, usePlatformUserGroupsQuery, useCreateRbacGroupMutation, useUpdateRbacGroupMutation, useDeleteRbacGroupMutation, useCreatePlatformUserGroupMutation, useUpdatePlatformUserGroupMutation, useDeletePlatformUserGroupMutation, useGetRbacGroupDetailsQuery, useGetPlatformUserGroupDetailsQuery, useGetRbacPermissionsMutation, useGetRbacRolesQuery, useCreateRbacRoleMutation, useUpdateRbacRoleMutation, useDeleteRbacRoleMutation, useGetRbacRoleDetailsQuery, useGetRbacActionsDefinitionQuery, useGetRbacResourceDiscoveryQuery, useGetRbacResourceListQuery, useGetRbacPoliciesQuery, useCreateRbacPolicyMutation, useUpdateRbacPolicyMutation, useDeleteRbacPolicyMutation, useGetRbacPolicyDetailsQuery, useGetWatchedGroupsQuery, useCreateWatchedGroupMutation, useUpdateWatchedGroupMutation, useDeleteWatchedGroupMutation, useAddWatchedUserMutation, useRemoveWatchedUserMutation, useAddWatcherMutation, useUpdateWatcherMutation, useDeleteWatcherMutation, useGetWatchedUsersQuery, useGetWatchersQuery, WATCHER_NOTIFICATION_EVENTS, WATCHER_NOTIFICATION_EVENT_LABELS, useGetApplicationFormsQuery, useGetApplicationFormDetailQuery, useCreateApplicationFormMutation, useUpdateApplicationFormMutation, useGetApplicationAdminDetailQuery, useInviteApplicationCandidateMutation, useLazyGetApplicationAttachmentFileQuery, useCreateApplicationWaiverMutation, useDeleteApplicationWaiverMutation, useSubmitApplicationOverrideMutation, useUpdateApplicationPlacementMutation, useDeleteApplicationCourseAssignmentMutation, useCreateApplicationNoteMutation, useUpdateApplicationNoteMutation, useDeleteApplicationNoteMutation, useTransitionApplicationMutation, useLinkApplicationCandidateMutation, useCreateApplicationPlacementsMutation, useGetCustomMentorsQuery, useCreateApplicationCourseAssignmentsMutation, useGetApplicationBlocksQuery, useDeleteApplicationBlockMutation, useGetApplicationsPipelineStatsQuery, useGetApplicationsPipelineQuery, useDeleteApiKeyMutation, useGetApiKeysQuery, useCreateApiKeyMutation, useCreateLLMCredentialMutation, useGetCredentialsSchemaQuery, useGetMaskedLLMCredentialsQuery, useGetLlmsQuery, useDeleteIntegrationCredentialMutation, useDeleteCredentialMutation, useCreateIntegrationCredentialMutation, useGetIntegrationCredentialsSchemaQuery, useGetMaskedIntegrationCredentialsQuery, useGetAccountBillingInfoQuery, useUpdateAutoRechargeInfoMutation, useTriggerAutoRechargeMutation, useCreateStripeCustomerPortalMutation, useSetPlatformConfigurationsMutation, useGetPlatformConfigurationsQuery, useUpdatePlatformMembershipMutation, useGetPlatformMembershipQuery, useGetCustomDomainsQuery, useCreateCustomDomainMutation, useDeleteCustomDomainMutation, useGetStudentMentorCreationStatusQuery, useSetStudentMentorCreationStatusMutation, coreApiSlice, recommendationPromptTypeEnum, useGetRecommendedPromptsListQuery, useCreateRecommendedPromptMutation, useUpdateRecommendedPromptMutation, useDeleteRecommendedPromptMutation, useLazyGetPublicPlatformImageAssetFileUrlQuery, useUpdateTenantMetadataMutation, useCreatePlatformImageAssetMutation, useGetProviderConfigQuery, useCreateProviderConfigMutation, useDeleteProviderConfigMutation, useGetExternalMappingQuery, useGetCredentialsListQuery, useCreateExternalMappingMutation, useDeleteExternalMappingMutation, useGetMemsearchConfigQuery, useUpdateMemsearchConfigMutation, useGetStripeConnectStatusQuery, useStartStripeConnectOnboardingMutation, useLazyGetStripeConnectDashboardQuery, useGetAiSearchMentorsQuery, useListPaywallsQuery, useListPricesQuery, useCreatePriceMutation, useUpdatePriceMutation, useDeletePriceMutation, useGetPaywallConfigQuery, useEnablePaywallMutation, useUpdatePaywallMutation, useLazyGetCourseMetaDataQuery, useLazyGetCourseCompletionOutlinesQuery, useLazyGetCourseEligibilityQuery, useLazyGetEdxSSOTokenQuery, useCreateCourseEnrollmentMutation, useCreateStripeCheckoutSessionMutation, useLazyGetCourseProgressQuery, useLazyGetCourseCompletionQuery, useUpdateExamAttemptMutation, useStartExamMutation, useLazyGetExamInfoQuery, useGetAgentSkillResourcesQuery, useCreateAgentSkillResourceMutation, useUpdateAgentSkillResourceMutation, useUploadAgentSkillResourceAssetMutation, useDeleteAgentSkillResourceMutation, useGetAgentSkillsQuery, useGetMentorSkillAssignmentsQuery, useCreateMentorSkillAssignmentMutation, useUpdateMentorSkillAssignmentMutation, useDeleteMentorSkillAssignmentMutation, useCreateAgentSkillMutation, useUpdateAgentSkillMutation, useDeleteAgentSkillMutation, resolveEffectiveAgentSkills, filterSlashSkills, useUpdateUserProjectMutation, useGetTrainingDocumentsQuery, useGetVectorDocumentsQuery, useGetMentorMemoriesListQuery, useGetMemoryCategoriesAdminQuery, useDeleteMentorMemoryMutation, useUpdateMentorMemoryMutation, useCreateMentorMemoryMutation, useLazyGetConnectedServiceAuthUrlQuery, useStarMentorMutation, useUnstarMentorMutation, useCreateUserProjectMutation, useDeleteUserProjectMutation, useGetUserProjectDetailsQuery, useEditTrainingDocumentMutation, useAddTrainingDocumentMutation, useLazyGetCredentialsQuery, useGetMentorSettingsQuery, useEditMentorMutation, useUploadLightLogoMutation, useUploadDarkLogoMutation, useUpdatePlatformInfoMutation, LOGO_ENDPOINTS, useCreateEvalDatasetMutation, useAddEvalDatasetItemsMutation, useUploadEvalDatasetCsvMutation, useDeleteEvalDatasetItemMutation, useListEvalDatasetItemsQuery, evalTotalPages, useListEvalDatasetsQuery, useGetUserProjectsQuery, useCreateSessionIdMutation, useGetMentorCategoriesQuery, useGetTenantChatPrivacyConfigQuery as useGetTenantChatPrivacyConfigQuery$1, useGetCallConfigurationsQuery, useCreateCallConfigurationMutation, useUpdateCallConfigurationMutation, chatPrivacyApiSlice, useDeleteMentorMutation, useForkMentorMutation, useGetToolsQuery, useLazyGetMCPServersQuery, useOauthFindMutation, useLazyStartOAuthFlowQuery, useCreateMCPServerMutation, usePartialUpdateMCPServerMutation, useCreateMCPServerConnectionMutation, usePatchMCPServerConnectionMutation, useGetConnectedServicesQuery, useGetMCPServersQuery, useGetMCPServerConnectionsQuery, useUpdateMCPServerMutation, useDeleteMCPServerMutation, useEditMentorJsonMutation, useDisconnectServiceMutation, useGetPromptCategoriesQuery, PRIVACY_ACTIONS, PRIVACY_ENTITY_TYPES, useGetVoicesQuery, useGetVoiceQuery, isBaseAgentMentor, useGetMentorGraderConfigurationQuery, useListGraderCriteriaQuery, useCreateMentorGraderConfigurationMutation, useUpdateMentorGraderConfigurationMutation, useCreateGraderCriterionMutation, useUpdateGraderCriterionMutation, useDeleteGraderCriterionMutation, useGetMentorPublicSettingsQuery, useGetChatHistoryFilterQuery, useGetChatHistoryQuery, useGetMentorSummariesQuery, useGetConversationMemoriesQuery, useGetSupportTicketsQuery, useGetSupportTicketMessagesQuery, useCreateSupportTicketMessageMutation, usePatchSupportTicketMutation, useCloseSupportTicketMutation, useCreateLtiMentorMutation, useUpdateLtiMentorMutation, useGetLtiMentorsQuery, useCreateLtiKeyMutation, useUpdateLtiKeyMutation, useDeleteLtiKeyMutation, useGetLtiKeysQuery, useCreateLtiToolMutation, useUpdateLtiToolMutation, useGetLtiToolsQuery, useGetPlatformInfoQuery, useCreatePromptMutation, useGetPromptsSearchQuery, useUpdatePromptMutation, useCreateRedirectTokenMutation, useGetShareableLinkQuery, useCreateShareableLinkMutation, useUpdateShareableLinkMutation, useCreateDisclaimerMutation, useUpdateDisclaimerMutation, useGetDisclaimersQuery, useUpdateRbacMentorAccessMutation, useGetRbacMentorAccessListQuery, useStartEvalRunMutation, useEvaluateEvalRunMutation, useGetEvalRunQuery, useDeleteEvalScoreMutation, useListEvalRunJudgesQuery, useCreateEvalScoreMutation, useDeleteEvalRunMutation, useExportEvalRunMutation, useListEvalRunsQuery, useLazyGetEvalRunQuery, evaluationsApiSlice, EVALUATIONS_TAGS, useGetPersonnalizedMentorsQuery, useCreateCallCredentialsMutation, useGetGuidedPromptsQuery, useUpdateChatSessionSharedMutation, useUpdateMessageFeedbackMutation, useLazyGetPromptsSearchQuery, useLazyGetGuidedPromptsQuery, useGetPublicMentorsQuery, useGetPeriodicAgentsQuery, useGetPeriodicAgentLogsListQuery, useCreatePeriodicAgentMutation, useDeletePeriodicAgentMutation, useDeletePromptMutation, useDeleteTrainingDocumentMutation, useGetTrainingDocumentRetrainScheduleQuery, useCreateTrainingDocumentRetrainScheduleMutation, useCreateMemoryCategoryMutation, useUpdateMemoryCategoryMutation, useDeleteMemoryCategoryMutation, useUpdateArtifactMutation, useLazyGetArtifactVersionQuery, useLazyListArtifactVersionsQuery, useSetCurrentVersionMutation, useListArtifactVersionsQuery, useLazyGetArtifactQuery, useLazyListArtifactsQuery, useEditSessionMutation } from '@iblai/data-layer';
|
|
6
|
-
import { getInitials, useTenantMetadata, WithPermissions, useStripeUpgrade, openExternalUrl, CHAT_AREA_SIZE, isAlphaNumeric32, checkRbacPermission, selectNumberOfActiveChatMessages, useUsername, selectStreaming, isLoggedIn, TOOLS, hasRemoteAiConfig, isSafariBrowser, useShowAttachment, useShowVoiceCall, useShowVoiceRecorder, useMentorSettings, selectShowingSharedChat, selectRbacPermissions, useShowFreeTrialDialog, useEmbedMode, chatInputSliceSelectors, useResponsive, useAccessingPublicRoute, useVisitingTenant, useModelFileUploadCapabilities, useChatFileUpload, useVoiceChat, selectAttachedFiles, MENTOR_CHAT_DOCUMENTS_EXTENSIONS, removeFile, chatInputSliceActions, chatActions, WithFormPermissions, useTenantContext, TimeTracker, advancedTabsProperties, defaultSessionIds, pickWritableFields, ANONYMOUS_USERNAME as ANONYMOUS_USERNAME$3, redirectToAuthSpaJoinTenant, selectActiveTab, useAxdToken, useWelcomeMessage, markdownToPlainText, useCachedSessionId, use402ErrorCheck, selectTokenEnabled, selectToken, useServiceWorker, useUserAgreement, useAdvancedChat, sendMessageToParentWebsite, useMentorTools, useFileDragDrop, eventBus, RemoteEvents, selectEnableChatActionsPopup, advancedTabs, isInIframe, getAuthSpaJoinUrl, addMessage, clearFiles, MENTOR_VISIBILITY } from '@iblai/web-utils';
|
|
5
|
+
import { useGetUserMetadataQuery, useGetUserMetadataEdxQuery, useUpdateUserMetadataMutation, useUpdateUserMetadataEdxMutation, useUploadProfileImageMutation, useResetPasswordMutation, useSelfRetireMutation, useCreateUserInstitutionMutation, useGetUserInstitutionsQuery, useCreateUserEducationMutation, useUpdateUserEducationMutation, useDeleteUserEducationMutation, useGetUserEducationQuery, useCreateUserCompanyMutation, useGetUserCompaniesQuery, useCreateUserExperienceMutation, useUpdateUserExperienceMutation, useDeleteUserExperienceMutation, useGetUserExperienceQuery, useGetUserResumeQuery, useCreateUserResumeMutation, useGetMySubscriptionsQuery, useGetItemSubscriptionQuery, useCancelSubscriptionMutation, useGetLearnerDetailsQuery, useGetUserEnrolledCoursesQuery, useGetUserEnrolledProgramsQuery, useGetUserCatalogPathwaysQuery, useGetUsersAsAssertionsQuery, useGetUserEarnedSkillsQuery, useGetUserReportedSkillsQuery, useGetUserDesiredSkillsQuery, useCreateGlobalMemoryMutation, useGetMemsearchStatusQuery, useGetUserMemorySettingsQuery, useUpdateUserMemorySettingsMutation, useGetGlobalMemoriesQuery, useDeleteGlobalMemoryMutation, useInviteUserMutation, usePlatformInvitationsQuery, useCreateCatalogInvitationCourseBulkMutation, useGetCatalogInvitationsCourseQuery, useLazyPlatformUsersQuery, useLazyPlatformUserGroupsQuery, useGetPersonnalizedSearchQuery, useCreateCatalogInvitationProgramBulkMutation, useGetCatalogInvitationsProgramQuery, useUpdateUserRoleMutation, useUpdateUserStatusMutation, useUpdatePlatformUserRoleWithPoliciesMutation, usePlatformUsersQuery, isPoliciesResponse, platformApiSlice, featureTags, useLazyGetRbacTeamsAccessListQuery, useCreateRbacTeamsAccessMutation, useGetRbacGroupsQuery, usePlatformUserGroupsQuery, useCreateRbacGroupMutation, useUpdateRbacGroupMutation, useDeleteRbacGroupMutation, useCreatePlatformUserGroupMutation, useUpdatePlatformUserGroupMutation, useDeletePlatformUserGroupMutation, useGetRbacGroupDetailsQuery, useGetPlatformUserGroupDetailsQuery, useGetRbacPermissionsMutation, useGetRbacRolesQuery, useCreateRbacRoleMutation, useUpdateRbacRoleMutation, useDeleteRbacRoleMutation, useGetRbacRoleDetailsQuery, useGetRbacActionsDefinitionQuery, useGetRbacResourceDiscoveryQuery, useGetRbacResourceListQuery, useGetRbacPoliciesQuery, useCreateRbacPolicyMutation, useUpdateRbacPolicyMutation, useDeleteRbacPolicyMutation, useGetRbacPolicyDetailsQuery, useGetWatchedGroupsQuery, useCreateWatchedGroupMutation, useUpdateWatchedGroupMutation, useDeleteWatchedGroupMutation, useAddWatchedUserMutation, useRemoveWatchedUserMutation, useAddWatcherMutation, useUpdateWatcherMutation, useDeleteWatcherMutation, useGetWatchedUsersQuery, useGetWatchersQuery, WATCHER_NOTIFICATION_EVENTS, WATCHER_NOTIFICATION_EVENT_LABELS, useGetApplicationFormsQuery, useGetApplicationFormDetailQuery, useCreateApplicationFormMutation, useUpdateApplicationFormMutation, useGetApplicationAdminDetailQuery, useInviteApplicationCandidateMutation, useLazyGetApplicationAttachmentFileQuery, useCreateApplicationWaiverMutation, useDeleteApplicationWaiverMutation, useSubmitApplicationOverrideMutation, useUpdateApplicationPlacementMutation, useDeleteApplicationCourseAssignmentMutation, useCreateApplicationNoteMutation, useUpdateApplicationNoteMutation, useDeleteApplicationNoteMutation, useTransitionApplicationMutation, useLinkApplicationCandidateMutation, useCreateApplicationPlacementsMutation, useGetCustomMentorsQuery, useCreateApplicationCourseAssignmentsMutation, useGetApplicationBlocksQuery, useDeleteApplicationBlockMutation, useGetApplicationsPipelineStatsQuery, useGetApplicationsPipelineQuery, useDeleteApiKeyMutation, useGetApiKeyQuery, useGetApiKeyFieldPermissionsQuery, useUpdateApiKeyMutation, useGetApiKeysQuery, unwrapApiTokenList, useCreateApiKeyMutation, useCreateLLMCredentialMutation, useGetCredentialsSchemaQuery, useGetMaskedLLMCredentialsQuery, useGetLlmsQuery, useDeleteIntegrationCredentialMutation, useDeleteCredentialMutation, useCreateIntegrationCredentialMutation, useGetIntegrationCredentialsSchemaQuery, useGetMaskedIntegrationCredentialsQuery, useGetAccountBillingInfoQuery, useUpdateAutoRechargeInfoMutation, useTriggerAutoRechargeMutation, useCreateStripeCustomerPortalMutation, useSetPlatformConfigurationsMutation, useGetPlatformConfigurationsQuery, useUpdatePlatformMembershipMutation, useGetPlatformMembershipQuery, useGetCustomDomainsQuery, useCreateCustomDomainMutation, useDeleteCustomDomainMutation, useGetStudentMentorCreationStatusQuery, useSetStudentMentorCreationStatusMutation, coreApiSlice, recommendationPromptTypeEnum, useGetRecommendedPromptsListQuery, useCreateRecommendedPromptMutation, useUpdateRecommendedPromptMutation, useDeleteRecommendedPromptMutation, useLazyGetPublicPlatformImageAssetFileUrlQuery, useUpdateTenantMetadataMutation, useCreatePlatformImageAssetMutation, useGetProviderConfigQuery, useCreateProviderConfigMutation, useDeleteProviderConfigMutation, useGetExternalMappingQuery, useGetCredentialsListQuery, useCreateExternalMappingMutation, useDeleteExternalMappingMutation, useGetMemsearchConfigQuery, useUpdateMemsearchConfigMutation, useGetStripeConnectStatusQuery, useStartStripeConnectOnboardingMutation, useLazyGetStripeConnectDashboardQuery, useGetAiSearchMentorsQuery, useListPaywallsQuery, useListPricesQuery, useCreatePriceMutation, useUpdatePriceMutation, useDeletePriceMutation, useGetPaywallConfigQuery, useEnablePaywallMutation, useUpdatePaywallMutation, useLazyGetCourseMetaDataQuery, useLazyGetCourseCompletionOutlinesQuery, useLazyGetCourseEligibilityQuery, useLazyGetEdxSSOTokenQuery, useCreateCourseEnrollmentMutation, useCreateStripeCheckoutSessionMutation, useLazyGetCourseProgressQuery, useLazyGetCourseCompletionQuery, useUpdateExamAttemptMutation, useStartExamMutation, useLazyGetExamInfoQuery, useGetAgentSkillResourcesQuery, useCreateAgentSkillResourceMutation, useUpdateAgentSkillResourceMutation, useUploadAgentSkillResourceAssetMutation, useDeleteAgentSkillResourceMutation, useGetAgentSkillsQuery, useGetMentorSkillAssignmentsQuery, useCreateMentorSkillAssignmentMutation, useUpdateMentorSkillAssignmentMutation, useDeleteMentorSkillAssignmentMutation, useCreateAgentSkillMutation, useUpdateAgentSkillMutation, useDeleteAgentSkillMutation, resolveEffectiveAgentSkills, filterSlashSkills, useUpdateUserProjectMutation, useGetTrainingDocumentsQuery, useGetVectorDocumentsQuery, useGetMentorMemoriesListQuery, useGetMemoryCategoriesAdminQuery, useDeleteMentorMemoryMutation, useUpdateMentorMemoryMutation, useCreateMentorMemoryMutation, useLazyGetConnectedServiceAuthUrlQuery, useStarMentorMutation, useUnstarMentorMutation, useCreateUserProjectMutation, useDeleteUserProjectMutation, useGetUserProjectDetailsQuery, useEditTrainingDocumentMutation, useAddTrainingDocumentMutation, useLazyGetCredentialsQuery, useGetMentorSettingsQuery, useEditMentorMutation, useUploadLightLogoMutation, useUploadDarkLogoMutation, useUpdatePlatformInfoMutation, LOGO_ENDPOINTS, useCreateEvalDatasetMutation, useAddEvalDatasetItemsMutation, useUploadEvalDatasetCsvMutation, useDeleteEvalDatasetItemMutation, useListEvalDatasetItemsQuery, evalTotalPages, useListEvalDatasetsQuery, useGetUserProjectsQuery, useCreateSessionIdMutation, useGetMentorCategoriesQuery, useGetTenantChatPrivacyConfigQuery as useGetTenantChatPrivacyConfigQuery$1, useGetCallConfigurationsQuery, useCreateCallConfigurationMutation, useUpdateCallConfigurationMutation, chatPrivacyApiSlice, useDeleteMentorMutation, useForkMentorMutation, useGetToolsQuery, useLazyGetMCPServersQuery, useOauthFindMutation, useLazyStartOAuthFlowQuery, useCreateMCPServerMutation, usePartialUpdateMCPServerMutation, useCreateMCPServerConnectionMutation, usePatchMCPServerConnectionMutation, useGetConnectedServicesQuery, useGetMCPServersQuery, useGetMCPServerConnectionsQuery, useUpdateMCPServerMutation, useDeleteMCPServerMutation, useEditMentorJsonMutation, useDisconnectServiceMutation, useGetPromptCategoriesQuery, PRIVACY_ACTIONS, PRIVACY_ENTITY_TYPES, useGetVoicesQuery, useGetVoiceQuery, isBaseAgentMentor, useGetMentorGraderConfigurationQuery, useListGraderCriteriaQuery, useCreateMentorGraderConfigurationMutation, useUpdateMentorGraderConfigurationMutation, useCreateGraderCriterionMutation, useUpdateGraderCriterionMutation, useDeleteGraderCriterionMutation, useGetMentorPublicSettingsQuery, useGetChatHistoryFilterQuery, useGetChatHistoryQuery, useGetMentorSummariesQuery, useGetConversationMemoriesQuery, useGetSupportTicketsQuery, useGetSupportTicketMessagesQuery, useCreateSupportTicketMessageMutation, usePatchSupportTicketMutation, useCloseSupportTicketMutation, useCreateLtiMentorMutation, useUpdateLtiMentorMutation, useGetLtiMentorsQuery, useCreateLtiKeyMutation, useUpdateLtiKeyMutation, useDeleteLtiKeyMutation, useGetLtiKeysQuery, useCreateLtiToolMutation, useUpdateLtiToolMutation, useGetLtiToolsQuery, useGetPlatformInfoQuery, useCreatePromptMutation, useGetPromptsSearchQuery, useUpdatePromptMutation, useCreateRedirectTokenMutation, useGetShareableLinkQuery, useCreateShareableLinkMutation, useUpdateShareableLinkMutation, useCreateDisclaimerMutation, useUpdateDisclaimerMutation, useGetDisclaimersQuery, useUpdateRbacMentorAccessMutation, useGetRbacMentorAccessListQuery, useStartEvalRunMutation, useEvaluateEvalRunMutation, useGetEvalRunQuery, useDeleteEvalScoreMutation, useListEvalRunJudgesQuery, useCreateEvalScoreMutation, useDeleteEvalRunMutation, useExportEvalRunMutation, useListEvalRunsQuery, useLazyGetEvalRunQuery, evaluationsApiSlice, EVALUATIONS_TAGS, useGetPersonnalizedMentorsQuery, useCreateCallCredentialsMutation, useGetGuidedPromptsQuery, useUpdateChatSessionSharedMutation, useUpdateMessageFeedbackMutation, useLazyGetPromptsSearchQuery, useLazyGetGuidedPromptsQuery, useGetPublicMentorsQuery, useGetPeriodicAgentsQuery, useGetPeriodicAgentLogsListQuery, useCreatePeriodicAgentMutation, useDeletePeriodicAgentMutation, useDeletePromptMutation, useDeleteTrainingDocumentMutation, useGetTrainingDocumentRetrainScheduleQuery, useCreateTrainingDocumentRetrainScheduleMutation, useCreateMemoryCategoryMutation, useUpdateMemoryCategoryMutation, useDeleteMemoryCategoryMutation, useUpdateArtifactMutation, useLazyGetArtifactVersionQuery, useLazyListArtifactVersionsQuery, useSetCurrentVersionMutation, useListArtifactVersionsQuery, useLazyGetArtifactQuery, useLazyListArtifactsQuery, useEditSessionMutation } from '@iblai/data-layer';
|
|
6
|
+
import { getInitials, useTenantMetadata, WithPermissions, canWriteField, useStripeUpgrade, openExternalUrl, CHAT_AREA_SIZE, isAlphaNumeric32, checkRbacPermission, selectNumberOfActiveChatMessages, useUsername, selectStreaming, isLoggedIn, TOOLS, hasRemoteAiConfig, isSafariBrowser, useShowAttachment, useShowVoiceCall, useShowVoiceRecorder, useMentorSettings, selectShowingSharedChat, selectRbacPermissions, useShowFreeTrialDialog, useEmbedMode, chatInputSliceSelectors, useResponsive, useAccessingPublicRoute, useVisitingTenant, useModelFileUploadCapabilities, useChatFileUpload, useVoiceChat, selectAttachedFiles, MENTOR_CHAT_DOCUMENTS_EXTENSIONS, removeFile, chatInputSliceActions, chatActions, WithFormPermissions, useTenantContext, TimeTracker, advancedTabsProperties, defaultSessionIds, pickWritableFields, ANONYMOUS_USERNAME as ANONYMOUS_USERNAME$3, redirectToAuthSpaJoinTenant, selectActiveTab, useAxdToken, useWelcomeMessage, markdownToPlainText, useCachedSessionId, use402ErrorCheck, selectTokenEnabled, selectToken, useServiceWorker, useUserAgreement, useAdvancedChat, sendMessageToParentWebsite, useMentorTools, useFileDragDrop, eventBus, RemoteEvents, selectEnableChatActionsPopup, advancedTabs, isInIframe, getAuthSpaJoinUrl, addMessage, clearFiles, MENTOR_VISIBILITY } from '@iblai/web-utils';
|
|
7
7
|
import { useDispatch, useSelector } from 'react-redux';
|
|
8
8
|
import { toast } from 'sonner';
|
|
9
9
|
import { useSearchParams, useParams, useRouter, usePathname } from 'next/navigation';
|
|
@@ -97804,6 +97804,18 @@ var apiTabDeleteApiModal2$3 = {
|
|
|
97804
97804
|
successMessage: "API Key deleted successfully",
|
|
97805
97805
|
errorMessage: "Failed to delete API Key"
|
|
97806
97806
|
};
|
|
97807
|
+
var apiTabEditApiModal$3 = {
|
|
97808
|
+
title: "Edit API Key",
|
|
97809
|
+
editAriaLabel: "Edit API Key",
|
|
97810
|
+
renameWarning: "The name identifies this key in the API. Renaming it changes that identifier.",
|
|
97811
|
+
expirationHelp: "Clear the date to let this key never expire.",
|
|
97812
|
+
save: "Save",
|
|
97813
|
+
saving: "Saving...",
|
|
97814
|
+
successToast: "API Key updated successfully",
|
|
97815
|
+
errorToast: "Failed to update API Key",
|
|
97816
|
+
loading: "Loading...",
|
|
97817
|
+
loadError: "Failed to load API Key"
|
|
97818
|
+
};
|
|
97807
97819
|
var apiTabLabels$3 = {
|
|
97808
97820
|
header: {
|
|
97809
97821
|
title: "API",
|
|
@@ -97814,6 +97826,7 @@ var apiTabLabels$3 = {
|
|
|
97814
97826
|
lineTwo: "Do not share your API key with others, or expose it in the browser or other client-side code. In order to protect the security of your account, IBL may also automatically rotate any API key that we’ve found has leaked publicly."
|
|
97815
97827
|
},
|
|
97816
97828
|
table: {
|
|
97829
|
+
banner: "These are authentication keys that you've generated for external applications to authenticate with your service. Keys are displayed only once when generated.",
|
|
97817
97830
|
nameColumn: "NAME",
|
|
97818
97831
|
createdColumn: "CREATED",
|
|
97819
97832
|
expiresColumn: "EXPIRES",
|
|
@@ -97854,6 +97867,21 @@ var apiTabLabels$3 = {
|
|
|
97854
97867
|
descriptionLineTwo: "If you lose your API key, you'll need to generate a new one."
|
|
97855
97868
|
}
|
|
97856
97869
|
};
|
|
97870
|
+
var apiTabTokenPolicies$3 = {
|
|
97871
|
+
modeLabel: "Permission Mode",
|
|
97872
|
+
ownerModeLabel: "Owner permissions",
|
|
97873
|
+
ownerModeDescription: "The key inherits the RBAC permissions of the user who created it.",
|
|
97874
|
+
tokenPoliciesModeLabel: "Token policies",
|
|
97875
|
+
tokenPoliciesModeDescription: "The key resolves permissions from the policies and groups assigned below.",
|
|
97876
|
+
policiesLabel: "Policies",
|
|
97877
|
+
policiesPlaceholder: "Search policies...",
|
|
97878
|
+
policiesHelp: "Policies assigned directly to this key.",
|
|
97879
|
+
groupsLabel: "Groups",
|
|
97880
|
+
groupsPlaceholder: "Search groups...",
|
|
97881
|
+
groupsHelp: "Groups whose policies this key inherits.",
|
|
97882
|
+
noneSelected: "None",
|
|
97883
|
+
clearExpiration: "Clear expiration date"
|
|
97884
|
+
};
|
|
97857
97885
|
var appSidebarIndex$3 = {
|
|
97858
97886
|
pinnedMessages: "Pinned Messages",
|
|
97859
97887
|
recentMessages: "Recent Messages"
|
|
@@ -102796,7 +102824,9 @@ var en = {
|
|
|
102796
102824
|
apiTabApiKeyModal: apiTabApiKeyModal$3,
|
|
102797
102825
|
apiTabCreateApiModal2: apiTabCreateApiModal2$3,
|
|
102798
102826
|
apiTabDeleteApiModal2: apiTabDeleteApiModal2$3,
|
|
102827
|
+
apiTabEditApiModal: apiTabEditApiModal$3,
|
|
102799
102828
|
apiTabLabels: apiTabLabels$3,
|
|
102829
|
+
apiTabTokenPolicies: apiTabTokenPolicies$3,
|
|
102800
102830
|
appSidebarIndex: appSidebarIndex$3,
|
|
102801
102831
|
appSidebarProjectItem: appSidebarProjectItem$3,
|
|
102802
102832
|
appSidebarProjectsSidebarDropdown: appSidebarProjectsSidebarDropdown$3,
|
|
@@ -103990,6 +104020,18 @@ var apiTabDeleteApiModal2$2 = {
|
|
|
103990
104020
|
successMessage: "Clé API supprimée avec succès",
|
|
103991
104021
|
errorMessage: "Échec de la suppression de la clé API"
|
|
103992
104022
|
};
|
|
104023
|
+
var apiTabEditApiModal$2 = {
|
|
104024
|
+
title: "Modifier la clé API",
|
|
104025
|
+
editAriaLabel: "Modifier la clé API",
|
|
104026
|
+
renameWarning: "Le nom identifie cette clé dans l'API. Le modifier change cet identifiant.",
|
|
104027
|
+
expirationHelp: "Effacez la date pour que cette clé n'expire jamais.",
|
|
104028
|
+
save: "Enregistrer",
|
|
104029
|
+
saving: "Enregistrement...",
|
|
104030
|
+
successToast: "Clé API mise à jour avec succès",
|
|
104031
|
+
errorToast: "Échec de la mise à jour de la clé API",
|
|
104032
|
+
loading: "Chargement...",
|
|
104033
|
+
loadError: "Échec du chargement de la clé API"
|
|
104034
|
+
};
|
|
103993
104035
|
var apiTabLabels$2 = {
|
|
103994
104036
|
header: {
|
|
103995
104037
|
title: "API",
|
|
@@ -104000,6 +104042,7 @@ var apiTabLabels$2 = {
|
|
|
104000
104042
|
lineTwo: "Ne partagez pas votre clé API avec d’autres personnes et ne l’exposez pas dans le navigateur ou dans un autre code côté client. Pour protéger la sécurité de votre compte, IBL peut également faire pivoter automatiquement toute clé API que nous avons détectée comme publiquement exposée."
|
|
104001
104043
|
},
|
|
104002
104044
|
table: {
|
|
104045
|
+
banner: "Voici les clés d'authentification que vous avez générées pour permettre à des applications externes de s'authentifier auprès de votre service. Les clés ne s'affichent qu'une seule fois, lors de leur génération.",
|
|
104003
104046
|
nameColumn: "NOM",
|
|
104004
104047
|
createdColumn: "CRÉÉ",
|
|
104005
104048
|
expiresColumn: "EXPIRE",
|
|
@@ -104040,6 +104083,21 @@ var apiTabLabels$2 = {
|
|
|
104040
104083
|
descriptionLineTwo: "Si vous perdez votre clé API, vous devrez en générer une nouvelle."
|
|
104041
104084
|
}
|
|
104042
104085
|
};
|
|
104086
|
+
var apiTabTokenPolicies$2 = {
|
|
104087
|
+
modeLabel: "Mode de permission",
|
|
104088
|
+
ownerModeLabel: "Permissions du propriétaire",
|
|
104089
|
+
ownerModeDescription: "La clé hérite des permissions RBAC de l'utilisateur qui l'a créée.",
|
|
104090
|
+
tokenPoliciesModeLabel: "Politiques du jeton",
|
|
104091
|
+
tokenPoliciesModeDescription: "La clé résout ses permissions à partir des politiques et des groupes attribués ci-dessous.",
|
|
104092
|
+
policiesLabel: "Politiques",
|
|
104093
|
+
policiesPlaceholder: "Rechercher des politiques...",
|
|
104094
|
+
policiesHelp: "Politiques attribuées directement à cette clé.",
|
|
104095
|
+
groupsLabel: "Groupes",
|
|
104096
|
+
groupsPlaceholder: "Rechercher des groupes...",
|
|
104097
|
+
groupsHelp: "Groupes dont cette clé hérite des politiques.",
|
|
104098
|
+
noneSelected: "Aucun",
|
|
104099
|
+
clearExpiration: "Effacer la date d'expiration"
|
|
104100
|
+
};
|
|
104043
104101
|
var appSidebarIndex$2 = {
|
|
104044
104102
|
pinnedMessages: "Messages épinglés",
|
|
104045
104103
|
recentMessages: "Messages récents"
|
|
@@ -108982,7 +109040,9 @@ var fr = {
|
|
|
108982
109040
|
apiTabApiKeyModal: apiTabApiKeyModal$2,
|
|
108983
109041
|
apiTabCreateApiModal2: apiTabCreateApiModal2$2,
|
|
108984
109042
|
apiTabDeleteApiModal2: apiTabDeleteApiModal2$2,
|
|
109043
|
+
apiTabEditApiModal: apiTabEditApiModal$2,
|
|
108985
109044
|
apiTabLabels: apiTabLabels$2,
|
|
109045
|
+
apiTabTokenPolicies: apiTabTokenPolicies$2,
|
|
108986
109046
|
appSidebarIndex: appSidebarIndex$2,
|
|
108987
109047
|
appSidebarProjectItem: appSidebarProjectItem$2,
|
|
108988
109048
|
appSidebarProjectsSidebarDropdown: appSidebarProjectsSidebarDropdown$2,
|
|
@@ -110176,6 +110236,18 @@ var apiTabDeleteApiModal2$1 = {
|
|
|
110176
110236
|
successMessage: "Clave API eliminada correctamente",
|
|
110177
110237
|
errorMessage: "Error al eliminar la clave API"
|
|
110178
110238
|
};
|
|
110239
|
+
var apiTabEditApiModal$1 = {
|
|
110240
|
+
title: "Editar clave API",
|
|
110241
|
+
editAriaLabel: "Editar clave API",
|
|
110242
|
+
renameWarning: "El nombre identifica esta clave en la API. Cambiarlo modifica ese identificador.",
|
|
110243
|
+
expirationHelp: "Borra la fecha para que esta clave nunca caduque.",
|
|
110244
|
+
save: "Guardar",
|
|
110245
|
+
saving: "Guardando...",
|
|
110246
|
+
successToast: "Clave API actualizada correctamente",
|
|
110247
|
+
errorToast: "No se pudo actualizar la clave API",
|
|
110248
|
+
loading: "Cargando...",
|
|
110249
|
+
loadError: "No se pudo cargar la clave API"
|
|
110250
|
+
};
|
|
110179
110251
|
var apiTabLabels$1 = {
|
|
110180
110252
|
header: {
|
|
110181
110253
|
title: "API",
|
|
@@ -110186,6 +110258,7 @@ var apiTabLabels$1 = {
|
|
|
110186
110258
|
lineTwo: "No comparta su clave API con otros ni la exponga en el navegador u otro código del lado del cliente. Para proteger la seguridad de su cuenta, IBL también puede rotar automáticamente cualquier clave API que hayamos detectado que se ha filtrado públicamente."
|
|
110187
110259
|
},
|
|
110188
110260
|
table: {
|
|
110261
|
+
banner: "Estas son las claves de autenticación que has generado para que aplicaciones externas se autentiquen con tu servicio. Las claves solo se muestran una vez, al generarlas.",
|
|
110189
110262
|
nameColumn: "NOMBRE",
|
|
110190
110263
|
createdColumn: "CREADO",
|
|
110191
110264
|
expiresColumn: "EXPIRA",
|
|
@@ -110226,6 +110299,21 @@ var apiTabLabels$1 = {
|
|
|
110226
110299
|
descriptionLineTwo: "Si pierde su clave API, deberá generar una nueva."
|
|
110227
110300
|
}
|
|
110228
110301
|
};
|
|
110302
|
+
var apiTabTokenPolicies$1 = {
|
|
110303
|
+
modeLabel: "Modo de permisos",
|
|
110304
|
+
ownerModeLabel: "Permisos del propietario",
|
|
110305
|
+
ownerModeDescription: "La clave hereda los permisos RBAC del usuario que la creó.",
|
|
110306
|
+
tokenPoliciesModeLabel: "Políticas del token",
|
|
110307
|
+
tokenPoliciesModeDescription: "La clave resuelve sus permisos a partir de las políticas y los grupos asignados a continuación.",
|
|
110308
|
+
policiesLabel: "Políticas",
|
|
110309
|
+
policiesPlaceholder: "Buscar políticas...",
|
|
110310
|
+
policiesHelp: "Políticas asignadas directamente a esta clave.",
|
|
110311
|
+
groupsLabel: "Grupos",
|
|
110312
|
+
groupsPlaceholder: "Buscar grupos...",
|
|
110313
|
+
groupsHelp: "Grupos cuyas políticas hereda esta clave.",
|
|
110314
|
+
noneSelected: "Ninguno",
|
|
110315
|
+
clearExpiration: "Borrar la fecha de caducidad"
|
|
110316
|
+
};
|
|
110229
110317
|
var appSidebarIndex$1 = {
|
|
110230
110318
|
pinnedMessages: "Mensajes anclados",
|
|
110231
110319
|
recentMessages: "Mensajes recientes"
|
|
@@ -115168,7 +115256,9 @@ var es = {
|
|
|
115168
115256
|
apiTabApiKeyModal: apiTabApiKeyModal$1,
|
|
115169
115257
|
apiTabCreateApiModal2: apiTabCreateApiModal2$1,
|
|
115170
115258
|
apiTabDeleteApiModal2: apiTabDeleteApiModal2$1,
|
|
115259
|
+
apiTabEditApiModal: apiTabEditApiModal$1,
|
|
115171
115260
|
apiTabLabels: apiTabLabels$1,
|
|
115261
|
+
apiTabTokenPolicies: apiTabTokenPolicies$1,
|
|
115172
115262
|
appSidebarIndex: appSidebarIndex$1,
|
|
115173
115263
|
appSidebarProjectItem: appSidebarProjectItem$1,
|
|
115174
115264
|
appSidebarProjectsSidebarDropdown: appSidebarProjectsSidebarDropdown$1,
|
|
@@ -116362,6 +116452,18 @@ var apiTabDeleteApiModal2 = {
|
|
|
116362
116452
|
successMessage: "API 密钥已成功删除",
|
|
116363
116453
|
errorMessage: "删除 API 密钥失败"
|
|
116364
116454
|
};
|
|
116455
|
+
var apiTabEditApiModal = {
|
|
116456
|
+
title: "编辑 API 密钥",
|
|
116457
|
+
editAriaLabel: "编辑 API 密钥",
|
|
116458
|
+
renameWarning: "名称是此密钥在 API 中的标识,修改名称会更改该标识。",
|
|
116459
|
+
expirationHelp: "清除日期可让此密钥永不过期。",
|
|
116460
|
+
save: "保存",
|
|
116461
|
+
saving: "保存中...",
|
|
116462
|
+
successToast: "API 密钥更新成功",
|
|
116463
|
+
errorToast: "更新 API 密钥失败",
|
|
116464
|
+
loading: "加载中...",
|
|
116465
|
+
loadError: "加载 API 密钥失败"
|
|
116466
|
+
};
|
|
116365
116467
|
var apiTabLabels = {
|
|
116366
116468
|
header: {
|
|
116367
116469
|
title: "API",
|
|
@@ -116372,6 +116474,7 @@ var apiTabLabels = {
|
|
|
116372
116474
|
lineTwo: "请勿将您的 API 密钥共享给他人,也勿将其暴露在浏览器或其他客户端代码中。为了保护您账户的安全,IBL 也可能会自动轮换我们发现已公开泄露的任何 API 密钥。"
|
|
116373
116475
|
},
|
|
116374
116476
|
table: {
|
|
116477
|
+
banner: "以下是您为外部应用程序生成的身份验证密钥,用于向您的服务进行身份验证。密钥仅在生成时显示一次。",
|
|
116375
116478
|
nameColumn: "名称",
|
|
116376
116479
|
createdColumn: "创建时间",
|
|
116377
116480
|
expiresColumn: "过期时间",
|
|
@@ -116412,6 +116515,21 @@ var apiTabLabels = {
|
|
|
116412
116515
|
descriptionLineTwo: "如果您丢失了 API 密钥,将需要重新生成一个新的。"
|
|
116413
116516
|
}
|
|
116414
116517
|
};
|
|
116518
|
+
var apiTabTokenPolicies = {
|
|
116519
|
+
modeLabel: "权限模式",
|
|
116520
|
+
ownerModeLabel: "所有者权限",
|
|
116521
|
+
ownerModeDescription: "此密钥继承创建者的 RBAC 权限。",
|
|
116522
|
+
tokenPoliciesModeLabel: "令牌策略",
|
|
116523
|
+
tokenPoliciesModeDescription: "此密钥根据下方分配的策略和群组解析权限。",
|
|
116524
|
+
policiesLabel: "策略",
|
|
116525
|
+
policiesPlaceholder: "搜索策略...",
|
|
116526
|
+
policiesHelp: "直接分配给此密钥的策略。",
|
|
116527
|
+
groupsLabel: "群组",
|
|
116528
|
+
groupsPlaceholder: "搜索群组...",
|
|
116529
|
+
groupsHelp: "此密钥继承其策略的群组。",
|
|
116530
|
+
noneSelected: "无",
|
|
116531
|
+
clearExpiration: "清除过期日期"
|
|
116532
|
+
};
|
|
116415
116533
|
var appSidebarIndex = {
|
|
116416
116534
|
pinnedMessages: "已固定的消息",
|
|
116417
116535
|
recentMessages: "最近消息"
|
|
@@ -121354,7 +121472,9 @@ var zh = {
|
|
|
121354
121472
|
apiTabApiKeyModal: apiTabApiKeyModal,
|
|
121355
121473
|
apiTabCreateApiModal2: apiTabCreateApiModal2,
|
|
121356
121474
|
apiTabDeleteApiModal2: apiTabDeleteApiModal2,
|
|
121475
|
+
apiTabEditApiModal: apiTabEditApiModal,
|
|
121357
121476
|
apiTabLabels: apiTabLabels,
|
|
121477
|
+
apiTabTokenPolicies: apiTabTokenPolicies,
|
|
121358
121478
|
appSidebarIndex: appSidebarIndex,
|
|
121359
121479
|
appSidebarProjectItem: appSidebarProjectItem,
|
|
121360
121480
|
appSidebarProjectsSidebarDropdown: appSidebarProjectsSidebarDropdown,
|
|
@@ -181357,56 +181477,78 @@ function DeleteApiModal$1({ isOpen, onClose, apiKey, tenantKey }) {
|
|
|
181357
181477
|
return (jsx(Dialog, { open: isOpen, onOpenChange: onClose, children: jsxs(DialogContent, { "aria-describedby": "delete-api-key-description", children: [jsx(DialogHeader, { children: jsx(DialogTitle, { className: "ibl-dialog-title", children: t('apiTabDeleteApiModal2.title') }) }), jsx("div", { className: "my-5", children: jsx("p", { className: "text-sm text-[#646464]", children: t('apiTabDeleteApiModal2.confirmationText', { name: apiKey.name }) }) }), jsxs(DialogFooter, { className: "gap-3", children: [jsx(Button$1, { variant: "outline", onClick: onClose, children: t('apiTabDeleteApiModal2.cancel') }), jsx(Button$1, { className: "bg-gradient-to-r from-[#2563EB] to-[#93C5FD] text-white hover:opacity-90", onClick: handleDeleteApiKey, disabled: isLoading, children: isLoading ? t('apiTabDeleteApiModal2.deleting') : t('apiTabDeleteApiModal2.delete') })] })] }) }));
|
|
181358
181478
|
}
|
|
181359
181479
|
|
|
181480
|
+
// Platform API token permission modes
|
|
181481
|
+
const API_TOKEN_MODES = {
|
|
181482
|
+
OWNER: 'owner',
|
|
181483
|
+
TOKEN_POLICIES: 'token_policies',
|
|
181484
|
+
};
|
|
181485
|
+
// Rows per page for the API keys table (the endpoint paginates only when page_size is sent)
|
|
181486
|
+
const API_KEYS_PAGE_SIZE = 10;
|
|
181487
|
+
// Result cap and debounce for the policy/group pickers
|
|
181488
|
+
const RBAC_PICKER_PAGE_SIZE = 20;
|
|
181489
|
+
const RBAC_SEARCH_DEBOUNCE_MS = 300;
|
|
181360
181490
|
/**
|
|
181361
|
-
*
|
|
181362
|
-
*
|
|
181491
|
+
* Used when the field-permissions request fails. An absent field means
|
|
181492
|
+
* "unprotected", so a failed lookup must not be read as "everything writable".
|
|
181363
181493
|
*/
|
|
181364
|
-
const
|
|
181494
|
+
const DENIED_TOKEN_POLICY_PERMISSIONS = {
|
|
181495
|
+
mode: { write: false },
|
|
181496
|
+
policies_to_add: { write: false },
|
|
181497
|
+
policies_to_remove: { write: false },
|
|
181498
|
+
groups_to_add: { write: false },
|
|
181499
|
+
groups_to_remove: { write: false },
|
|
181500
|
+
};
|
|
181365
181501
|
|
|
181366
|
-
|
|
181367
|
-
|
|
181368
|
-
|
|
181369
|
-
|
|
181370
|
-
|
|
181371
|
-
function closeDeleteApiModal() {
|
|
181372
|
-
setApiKeyToDelete(null);
|
|
181373
|
-
}
|
|
181374
|
-
function openDeleteApiModal(apiKey) {
|
|
181375
|
-
setApiKeyToDelete(apiKey);
|
|
181376
|
-
}
|
|
181377
|
-
return (jsxs(Fragment$1, { children: [jsxs("div", { className: "space-y-4", children: [jsx(InfoBanner, { icon: jsx(KeyRound, { className: "w-5 h-5" }), children: "These are authentication keys that you've generated for external applications to authenticate with your service. Keys are displayed only once when generated." }), jsx("div", { className: "bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg overflow-x-auto", children: jsxs("table", { className: "w-full text-sm", children: [jsx("thead", { className: "bg-gray-50 dark:bg-gray-700 border-b border-gray-200 dark:border-gray-600", children: jsxs("tr", { children: [jsx("th", { className: "px-6 py-3 text-left font-medium text-gray-500 dark:text-gray-400", children: "Name" }), jsx("th", { className: "px-6 py-3 text-left font-medium text-gray-500 dark:text-gray-400", children: "Created" }), jsx("th", { className: "px-6 py-3 text-left font-medium text-gray-500 dark:text-gray-400", children: "Expires" }), jsx("th", { className: "px-6 py-3 text-left font-medium text-gray-500 dark:text-gray-400 w-[50px]" })] }) }), jsx("tbody", { className: "divide-y divide-gray-200 dark:divide-gray-600", children: isApiKeysLoading ? (jsx("tr", { children: jsx("td", { colSpan: 4, className: "px-6 py-8 text-center text-sm text-gray-500", children: "Loading..." }) })) : (apiKeys === null || apiKeys === void 0 ? void 0 : apiKeys.length) === 0 ? (jsx("tr", { children: jsx("td", { colSpan: 4, className: "px-6 py-8 text-center text-sm text-gray-500", children: "No API keys found" }) })) : (apiKeys === null || apiKeys === void 0 ? void 0 : apiKeys.map((apiKey) => (jsxs("tr", { children: [jsx("td", { className: "px-6 py-4 whitespace-nowrap text-gray-900 dark:text-gray-100", children: apiKey.name }), jsx("td", { className: "px-6 py-4 whitespace-nowrap text-gray-600 dark:text-gray-300", children: apiKey.created ? format$1(apiKey.created, 'PPP') : 'N/A' }), jsx("td", { className: "px-6 py-4 whitespace-nowrap text-gray-600 dark:text-gray-300", children: apiKey.expires ? format$1(apiKey.expires, 'PPP') : 'N/A' }), jsx("td", { className: "px-6 py-4", children: jsx(Button$1, { variant: "ghost", size: "sm", className: "cursor-pointer", onClick: () => openDeleteApiModal({ name: apiKey.name }), children: jsx(Trash, { className: "h-4 w-4" }) }) })] }, apiKey.name)))) })] }) })] }), apiKeyToDelete && (jsx(DeleteApiModal$1, { isOpen: !!apiKeyToDelete, onClose: closeDeleteApiModal, apiKey: apiKeyToDelete, tenantKey: tenantKey }))] }));
|
|
181502
|
+
/** Seconds from now until `targetDate`, the unit the `expires_in` duration takes. */
|
|
181503
|
+
function secondsUntil(targetDate) {
|
|
181504
|
+
const oneDay = 24 * 60 * 60 * 1000;
|
|
181505
|
+
const daysDifference = Math.ceil((targetDate.getTime() - Date.now()) / oneDay);
|
|
181506
|
+
return daysDifference * 24 * 3600;
|
|
181378
181507
|
}
|
|
181379
|
-
|
|
181380
|
-
|
|
181381
|
-
|
|
181382
|
-
|
|
181383
|
-
|
|
181384
|
-
console.warn('Clipboard not supported');
|
|
181385
|
-
return;
|
|
181386
|
-
}
|
|
181387
|
-
// Try to save to clipboard then save it in the state if worked
|
|
181388
|
-
try {
|
|
181389
|
-
await navigator.clipboard.writeText(text);
|
|
181390
|
-
setStatus('success');
|
|
181391
|
-
setTimeout(() => {
|
|
181392
|
-
setStatus('idle');
|
|
181393
|
-
}, timeout);
|
|
181394
|
-
return;
|
|
181395
|
-
}
|
|
181396
|
-
catch (_a) {
|
|
181397
|
-
//Sentry.captureException(String(error));
|
|
181398
|
-
setStatus('error');
|
|
181399
|
-
return;
|
|
181400
|
-
}
|
|
181401
|
-
}, [timeout]);
|
|
181402
|
-
return { copy, status };
|
|
181508
|
+
function toSelections(associations) {
|
|
181509
|
+
return (associations !== null && associations !== void 0 ? associations : []).map((association) => ({
|
|
181510
|
+
value: String(association.id),
|
|
181511
|
+
label: association.name || `#${association.id}`,
|
|
181512
|
+
}));
|
|
181403
181513
|
}
|
|
181404
|
-
|
|
181405
|
-
|
|
181406
|
-
|
|
181407
|
-
|
|
181408
|
-
|
|
181409
|
-
|
|
181514
|
+
function ids(items) {
|
|
181515
|
+
return items.map((item) => Number(item.value));
|
|
181516
|
+
}
|
|
181517
|
+
/**
|
|
181518
|
+
* `mode` plus the policy/group deltas the endpoint expects, omitting any field
|
|
181519
|
+
* the caller cannot write and any empty delta. On create there is no
|
|
181520
|
+
* `initialMode`/`initial*`, so `mode` is always sent and every selection is an
|
|
181521
|
+
* addition; on edit only what actually changed is included.
|
|
181522
|
+
*/
|
|
181523
|
+
function buildTokenPolicyPayload({ mode, initialMode, policies, groups, initialPolicies = [], initialGroups = [], fieldPermissions, }) {
|
|
181524
|
+
const payload = {};
|
|
181525
|
+
if (mode !== initialMode && canWriteField(fieldPermissions, 'mode')) {
|
|
181526
|
+
payload.mode = mode;
|
|
181527
|
+
}
|
|
181528
|
+
if (mode !== API_TOKEN_MODES.TOKEN_POLICIES) {
|
|
181529
|
+
return payload;
|
|
181530
|
+
}
|
|
181531
|
+
const selectedPolicyIds = new Set(ids(policies));
|
|
181532
|
+
const initialPolicyIds = new Set(ids(initialPolicies));
|
|
181533
|
+
const selectedGroupIds = new Set(ids(groups));
|
|
181534
|
+
const initialGroupIds = new Set(ids(initialGroups));
|
|
181535
|
+
const policiesToAdd = [...selectedPolicyIds].filter((id) => !initialPolicyIds.has(id));
|
|
181536
|
+
const policiesToRemove = [...initialPolicyIds].filter((id) => !selectedPolicyIds.has(id));
|
|
181537
|
+
const groupsToAdd = [...selectedGroupIds].filter((id) => !initialGroupIds.has(id));
|
|
181538
|
+
const groupsToRemove = [...initialGroupIds].filter((id) => !selectedGroupIds.has(id));
|
|
181539
|
+
if (policiesToAdd.length && canWriteField(fieldPermissions, 'policies_to_add')) {
|
|
181540
|
+
payload.policies_to_add = policiesToAdd;
|
|
181541
|
+
}
|
|
181542
|
+
if (policiesToRemove.length && canWriteField(fieldPermissions, 'policies_to_remove')) {
|
|
181543
|
+
payload.policies_to_remove = policiesToRemove;
|
|
181544
|
+
}
|
|
181545
|
+
if (groupsToAdd.length && canWriteField(fieldPermissions, 'groups_to_add')) {
|
|
181546
|
+
payload.groups_to_add = groupsToAdd;
|
|
181547
|
+
}
|
|
181548
|
+
if (groupsToRemove.length && canWriteField(fieldPermissions, 'groups_to_remove')) {
|
|
181549
|
+
payload.groups_to_remove = groupsToRemove;
|
|
181550
|
+
}
|
|
181551
|
+
return payload;
|
|
181410
181552
|
}
|
|
181411
181553
|
|
|
181412
181554
|
const offsetFormatCache = {};
|
|
@@ -185121,6 +185263,1096 @@ function CalendarDayButton({ className, day, modifiers, ...props }) {
|
|
|
185121
185263
|
!modifiers.range_middle, "data-range-start": modifiers.range_start, "data-range-end": modifiers.range_end, "data-range-middle": modifiers.range_middle, className: cn('data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-accent-foreground flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70', defaultClassNames.day, className), ...props }));
|
|
185122
185264
|
}
|
|
185123
185265
|
|
|
185266
|
+
/** Inline calendar — a popover would close the surrounding dialog on select. */
|
|
185267
|
+
function ExpirationDateField({ value, onChange, helpText }) {
|
|
185268
|
+
const t = useT();
|
|
185269
|
+
const [isCalendarOpen, setIsCalendarOpen] = React__default.useState(false);
|
|
185270
|
+
return (jsxs("div", { className: "space-y-1.5", children: [jsx(Label$1, { className: "flex items-center text-sm font-medium text-[#646464]", children: t('apiTabLabels.createModal.expirationLabel') }), jsxs("div", { className: "flex items-center gap-2", children: [jsxs(Button$1, { type: "button", variant: "outline", "aria-haspopup": "dialog", "aria-expanded": isCalendarOpen, onClick: () => setIsCalendarOpen((open) => !open), className: cn('flex-1 pl-3 text-left font-normal', !value && 'text-muted-foreground'), children: [value ? (format$1(value, 'PPP')) : (jsx("span", { children: t('apiTabLabels.createModal.expirationPlaceholder') })), jsx(Calendar$1, { className: "ml-auto h-4 w-4 opacity-50" })] }), value && (jsx(Button$1, { type: "button", variant: "ghost", size: "icon", "aria-label": t('apiTabTokenPolicies.clearExpiration'), onClick: () => {
|
|
185271
|
+
onChange(null);
|
|
185272
|
+
setIsCalendarOpen(false);
|
|
185273
|
+
}, children: jsx(X$2, { className: "h-4 w-4" }) }))] }), isCalendarOpen && (jsx("div", { className: "mt-2 w-auto rounded-md border border-gray-200 dark:border-gray-700", children: jsx(Calendar, { mode: "single",
|
|
185274
|
+
// @ts-expect-error - Calendar selected prop expects Date but the field may be null
|
|
185275
|
+
selected: value, onSelect: (date) => {
|
|
185276
|
+
onChange(date !== null && date !== void 0 ? date : null);
|
|
185277
|
+
setIsCalendarOpen(false);
|
|
185278
|
+
}, disabled: (date) => date && date < new Date() }) })), helpText && jsx("p", { className: "text-xs text-muted-foreground", children: helpText })] }));
|
|
185279
|
+
}
|
|
185280
|
+
|
|
185281
|
+
// packages/core/primitive/src/primitive.tsx
|
|
185282
|
+
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
185283
|
+
return function handleEvent(event) {
|
|
185284
|
+
originalEventHandler?.(event);
|
|
185285
|
+
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
|
|
185286
|
+
return ourEventHandler?.(event);
|
|
185287
|
+
}
|
|
185288
|
+
};
|
|
185289
|
+
}
|
|
185290
|
+
|
|
185291
|
+
function createCollection(name) {
|
|
185292
|
+
const PROVIDER_NAME = name + "CollectionProvider";
|
|
185293
|
+
const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);
|
|
185294
|
+
const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(
|
|
185295
|
+
PROVIDER_NAME,
|
|
185296
|
+
{ collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
|
|
185297
|
+
);
|
|
185298
|
+
const CollectionProvider = (props) => {
|
|
185299
|
+
const { scope, children } = props;
|
|
185300
|
+
const ref = React__default.useRef(null);
|
|
185301
|
+
const itemMap = React__default.useRef(/* @__PURE__ */ new Map()).current;
|
|
185302
|
+
return /* @__PURE__ */ jsx(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
|
|
185303
|
+
};
|
|
185304
|
+
CollectionProvider.displayName = PROVIDER_NAME;
|
|
185305
|
+
const COLLECTION_SLOT_NAME = name + "CollectionSlot";
|
|
185306
|
+
const CollectionSlot = React__default.forwardRef(
|
|
185307
|
+
(props, forwardedRef) => {
|
|
185308
|
+
const { scope, children } = props;
|
|
185309
|
+
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
|
|
185310
|
+
const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);
|
|
185311
|
+
return /* @__PURE__ */ jsx(Slot$1, { ref: composedRefs, children });
|
|
185312
|
+
}
|
|
185313
|
+
);
|
|
185314
|
+
CollectionSlot.displayName = COLLECTION_SLOT_NAME;
|
|
185315
|
+
const ITEM_SLOT_NAME = name + "CollectionItemSlot";
|
|
185316
|
+
const ITEM_DATA_ATTR = "data-radix-collection-item";
|
|
185317
|
+
const CollectionItemSlot = React__default.forwardRef(
|
|
185318
|
+
(props, forwardedRef) => {
|
|
185319
|
+
const { scope, children, ...itemData } = props;
|
|
185320
|
+
const ref = React__default.useRef(null);
|
|
185321
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
185322
|
+
const context = useCollectionContext(ITEM_SLOT_NAME, scope);
|
|
185323
|
+
React__default.useEffect(() => {
|
|
185324
|
+
context.itemMap.set(ref, { ref, ...itemData });
|
|
185325
|
+
return () => void context.itemMap.delete(ref);
|
|
185326
|
+
});
|
|
185327
|
+
return /* @__PURE__ */ jsx(Slot$1, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
|
|
185328
|
+
}
|
|
185329
|
+
);
|
|
185330
|
+
CollectionItemSlot.displayName = ITEM_SLOT_NAME;
|
|
185331
|
+
function useCollection(scope) {
|
|
185332
|
+
const context = useCollectionContext(name + "CollectionConsumer", scope);
|
|
185333
|
+
const getItems = React__default.useCallback(() => {
|
|
185334
|
+
const collectionNode = context.collectionRef.current;
|
|
185335
|
+
if (!collectionNode) return [];
|
|
185336
|
+
const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
|
|
185337
|
+
const items = Array.from(context.itemMap.values());
|
|
185338
|
+
const orderedItems = items.sort(
|
|
185339
|
+
(a, b) => orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current)
|
|
185340
|
+
);
|
|
185341
|
+
return orderedItems;
|
|
185342
|
+
}, [context.collectionRef, context.itemMap]);
|
|
185343
|
+
return getItems;
|
|
185344
|
+
}
|
|
185345
|
+
return [
|
|
185346
|
+
{ Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },
|
|
185347
|
+
useCollection,
|
|
185348
|
+
createCollectionScope
|
|
185349
|
+
];
|
|
185350
|
+
}
|
|
185351
|
+
|
|
185352
|
+
// packages/react/use-layout-effect/src/useLayoutEffect.tsx
|
|
185353
|
+
var useLayoutEffect2 = Boolean(globalThis?.document) ? React.useLayoutEffect : () => {
|
|
185354
|
+
};
|
|
185355
|
+
|
|
185356
|
+
// packages/react/id/src/id.tsx
|
|
185357
|
+
var useReactId = React["useId".toString()] || (() => void 0);
|
|
185358
|
+
var count = 0;
|
|
185359
|
+
function useId(deterministicId) {
|
|
185360
|
+
const [id, setId] = React.useState(useReactId());
|
|
185361
|
+
useLayoutEffect2(() => {
|
|
185362
|
+
setId((reactId) => reactId ?? String(count++));
|
|
185363
|
+
}, [deterministicId]);
|
|
185364
|
+
return (id ? `radix-${id}` : "");
|
|
185365
|
+
}
|
|
185366
|
+
|
|
185367
|
+
// packages/react/use-callback-ref/src/useCallbackRef.tsx
|
|
185368
|
+
function useCallbackRef(callback) {
|
|
185369
|
+
const callbackRef = React.useRef(callback);
|
|
185370
|
+
React.useEffect(() => {
|
|
185371
|
+
callbackRef.current = callback;
|
|
185372
|
+
});
|
|
185373
|
+
return React.useMemo(() => (...args) => callbackRef.current?.(...args), []);
|
|
185374
|
+
}
|
|
185375
|
+
|
|
185376
|
+
// packages/react/use-controllable-state/src/useControllableState.tsx
|
|
185377
|
+
function useControllableState({
|
|
185378
|
+
prop,
|
|
185379
|
+
defaultProp,
|
|
185380
|
+
onChange = () => {
|
|
185381
|
+
}
|
|
185382
|
+
}) {
|
|
185383
|
+
const [uncontrolledProp, setUncontrolledProp] = useUncontrolledState({ defaultProp, onChange });
|
|
185384
|
+
const isControlled = prop !== void 0;
|
|
185385
|
+
const value = isControlled ? prop : uncontrolledProp;
|
|
185386
|
+
const handleChange = useCallbackRef(onChange);
|
|
185387
|
+
const setValue = React.useCallback(
|
|
185388
|
+
(nextValue) => {
|
|
185389
|
+
if (isControlled) {
|
|
185390
|
+
const setter = nextValue;
|
|
185391
|
+
const value2 = typeof nextValue === "function" ? setter(prop) : nextValue;
|
|
185392
|
+
if (value2 !== prop) handleChange(value2);
|
|
185393
|
+
} else {
|
|
185394
|
+
setUncontrolledProp(nextValue);
|
|
185395
|
+
}
|
|
185396
|
+
},
|
|
185397
|
+
[isControlled, prop, setUncontrolledProp, handleChange]
|
|
185398
|
+
);
|
|
185399
|
+
return [value, setValue];
|
|
185400
|
+
}
|
|
185401
|
+
function useUncontrolledState({
|
|
185402
|
+
defaultProp,
|
|
185403
|
+
onChange
|
|
185404
|
+
}) {
|
|
185405
|
+
const uncontrolledState = React.useState(defaultProp);
|
|
185406
|
+
const [value] = uncontrolledState;
|
|
185407
|
+
const prevValueRef = React.useRef(value);
|
|
185408
|
+
const handleChange = useCallbackRef(onChange);
|
|
185409
|
+
React.useEffect(() => {
|
|
185410
|
+
if (prevValueRef.current !== value) {
|
|
185411
|
+
handleChange(value);
|
|
185412
|
+
prevValueRef.current = value;
|
|
185413
|
+
}
|
|
185414
|
+
}, [value, prevValueRef, handleChange]);
|
|
185415
|
+
return uncontrolledState;
|
|
185416
|
+
}
|
|
185417
|
+
|
|
185418
|
+
// packages/react/direction/src/Direction.tsx
|
|
185419
|
+
var DirectionContext = React.createContext(void 0);
|
|
185420
|
+
function useDirection(localDir) {
|
|
185421
|
+
const globalDir = React.useContext(DirectionContext);
|
|
185422
|
+
return localDir || globalDir || "ltr";
|
|
185423
|
+
}
|
|
185424
|
+
|
|
185425
|
+
var ENTRY_FOCUS = "rovingFocusGroup.onEntryFocus";
|
|
185426
|
+
var EVENT_OPTIONS = { bubbles: false, cancelable: true };
|
|
185427
|
+
var GROUP_NAME = "RovingFocusGroup";
|
|
185428
|
+
var [Collection, useCollection, createCollectionScope] = createCollection(GROUP_NAME);
|
|
185429
|
+
var [createRovingFocusGroupContext, createRovingFocusGroupScope] = createContextScope(
|
|
185430
|
+
GROUP_NAME,
|
|
185431
|
+
[createCollectionScope]
|
|
185432
|
+
);
|
|
185433
|
+
var [RovingFocusProvider, useRovingFocusContext] = createRovingFocusGroupContext(GROUP_NAME);
|
|
185434
|
+
var RovingFocusGroup = React.forwardRef(
|
|
185435
|
+
(props, forwardedRef) => {
|
|
185436
|
+
return /* @__PURE__ */ jsx(Collection.Provider, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx(Collection.Slot, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx(RovingFocusGroupImpl, { ...props, ref: forwardedRef }) }) });
|
|
185437
|
+
}
|
|
185438
|
+
);
|
|
185439
|
+
RovingFocusGroup.displayName = GROUP_NAME;
|
|
185440
|
+
var RovingFocusGroupImpl = React.forwardRef((props, forwardedRef) => {
|
|
185441
|
+
const {
|
|
185442
|
+
__scopeRovingFocusGroup,
|
|
185443
|
+
orientation,
|
|
185444
|
+
loop = false,
|
|
185445
|
+
dir,
|
|
185446
|
+
currentTabStopId: currentTabStopIdProp,
|
|
185447
|
+
defaultCurrentTabStopId,
|
|
185448
|
+
onCurrentTabStopIdChange,
|
|
185449
|
+
onEntryFocus,
|
|
185450
|
+
preventScrollOnEntryFocus = false,
|
|
185451
|
+
...groupProps
|
|
185452
|
+
} = props;
|
|
185453
|
+
const ref = React.useRef(null);
|
|
185454
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
185455
|
+
const direction = useDirection(dir);
|
|
185456
|
+
const [currentTabStopId = null, setCurrentTabStopId] = useControllableState({
|
|
185457
|
+
prop: currentTabStopIdProp,
|
|
185458
|
+
defaultProp: defaultCurrentTabStopId,
|
|
185459
|
+
onChange: onCurrentTabStopIdChange
|
|
185460
|
+
});
|
|
185461
|
+
const [isTabbingBackOut, setIsTabbingBackOut] = React.useState(false);
|
|
185462
|
+
const handleEntryFocus = useCallbackRef(onEntryFocus);
|
|
185463
|
+
const getItems = useCollection(__scopeRovingFocusGroup);
|
|
185464
|
+
const isClickFocusRef = React.useRef(false);
|
|
185465
|
+
const [focusableItemsCount, setFocusableItemsCount] = React.useState(0);
|
|
185466
|
+
React.useEffect(() => {
|
|
185467
|
+
const node = ref.current;
|
|
185468
|
+
if (node) {
|
|
185469
|
+
node.addEventListener(ENTRY_FOCUS, handleEntryFocus);
|
|
185470
|
+
return () => node.removeEventListener(ENTRY_FOCUS, handleEntryFocus);
|
|
185471
|
+
}
|
|
185472
|
+
}, [handleEntryFocus]);
|
|
185473
|
+
return /* @__PURE__ */ jsx(
|
|
185474
|
+
RovingFocusProvider,
|
|
185475
|
+
{
|
|
185476
|
+
scope: __scopeRovingFocusGroup,
|
|
185477
|
+
orientation,
|
|
185478
|
+
dir: direction,
|
|
185479
|
+
loop,
|
|
185480
|
+
currentTabStopId,
|
|
185481
|
+
onItemFocus: React.useCallback(
|
|
185482
|
+
(tabStopId) => setCurrentTabStopId(tabStopId),
|
|
185483
|
+
[setCurrentTabStopId]
|
|
185484
|
+
),
|
|
185485
|
+
onItemShiftTab: React.useCallback(() => setIsTabbingBackOut(true), []),
|
|
185486
|
+
onFocusableItemAdd: React.useCallback(
|
|
185487
|
+
() => setFocusableItemsCount((prevCount) => prevCount + 1),
|
|
185488
|
+
[]
|
|
185489
|
+
),
|
|
185490
|
+
onFocusableItemRemove: React.useCallback(
|
|
185491
|
+
() => setFocusableItemsCount((prevCount) => prevCount - 1),
|
|
185492
|
+
[]
|
|
185493
|
+
),
|
|
185494
|
+
children: /* @__PURE__ */ jsx(
|
|
185495
|
+
Primitive$1.div,
|
|
185496
|
+
{
|
|
185497
|
+
tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,
|
|
185498
|
+
"data-orientation": orientation,
|
|
185499
|
+
...groupProps,
|
|
185500
|
+
ref: composedRefs,
|
|
185501
|
+
style: { outline: "none", ...props.style },
|
|
185502
|
+
onMouseDown: composeEventHandlers(props.onMouseDown, () => {
|
|
185503
|
+
isClickFocusRef.current = true;
|
|
185504
|
+
}),
|
|
185505
|
+
onFocus: composeEventHandlers(props.onFocus, (event) => {
|
|
185506
|
+
const isKeyboardFocus = !isClickFocusRef.current;
|
|
185507
|
+
if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut) {
|
|
185508
|
+
const entryFocusEvent = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS);
|
|
185509
|
+
event.currentTarget.dispatchEvent(entryFocusEvent);
|
|
185510
|
+
if (!entryFocusEvent.defaultPrevented) {
|
|
185511
|
+
const items = getItems().filter((item) => item.focusable);
|
|
185512
|
+
const activeItem = items.find((item) => item.active);
|
|
185513
|
+
const currentItem = items.find((item) => item.id === currentTabStopId);
|
|
185514
|
+
const candidateItems = [activeItem, currentItem, ...items].filter(
|
|
185515
|
+
Boolean
|
|
185516
|
+
);
|
|
185517
|
+
const candidateNodes = candidateItems.map((item) => item.ref.current);
|
|
185518
|
+
focusFirst(candidateNodes, preventScrollOnEntryFocus);
|
|
185519
|
+
}
|
|
185520
|
+
}
|
|
185521
|
+
isClickFocusRef.current = false;
|
|
185522
|
+
}),
|
|
185523
|
+
onBlur: composeEventHandlers(props.onBlur, () => setIsTabbingBackOut(false))
|
|
185524
|
+
}
|
|
185525
|
+
)
|
|
185526
|
+
}
|
|
185527
|
+
);
|
|
185528
|
+
});
|
|
185529
|
+
var ITEM_NAME$1 = "RovingFocusGroupItem";
|
|
185530
|
+
var RovingFocusGroupItem = React.forwardRef(
|
|
185531
|
+
(props, forwardedRef) => {
|
|
185532
|
+
const {
|
|
185533
|
+
__scopeRovingFocusGroup,
|
|
185534
|
+
focusable = true,
|
|
185535
|
+
active = false,
|
|
185536
|
+
tabStopId,
|
|
185537
|
+
...itemProps
|
|
185538
|
+
} = props;
|
|
185539
|
+
const autoId = useId();
|
|
185540
|
+
const id = tabStopId || autoId;
|
|
185541
|
+
const context = useRovingFocusContext(ITEM_NAME$1, __scopeRovingFocusGroup);
|
|
185542
|
+
const isCurrentTabStop = context.currentTabStopId === id;
|
|
185543
|
+
const getItems = useCollection(__scopeRovingFocusGroup);
|
|
185544
|
+
const { onFocusableItemAdd, onFocusableItemRemove } = context;
|
|
185545
|
+
React.useEffect(() => {
|
|
185546
|
+
if (focusable) {
|
|
185547
|
+
onFocusableItemAdd();
|
|
185548
|
+
return () => onFocusableItemRemove();
|
|
185549
|
+
}
|
|
185550
|
+
}, [focusable, onFocusableItemAdd, onFocusableItemRemove]);
|
|
185551
|
+
return /* @__PURE__ */ jsx(
|
|
185552
|
+
Collection.ItemSlot,
|
|
185553
|
+
{
|
|
185554
|
+
scope: __scopeRovingFocusGroup,
|
|
185555
|
+
id,
|
|
185556
|
+
focusable,
|
|
185557
|
+
active,
|
|
185558
|
+
children: /* @__PURE__ */ jsx(
|
|
185559
|
+
Primitive$1.span,
|
|
185560
|
+
{
|
|
185561
|
+
tabIndex: isCurrentTabStop ? 0 : -1,
|
|
185562
|
+
"data-orientation": context.orientation,
|
|
185563
|
+
...itemProps,
|
|
185564
|
+
ref: forwardedRef,
|
|
185565
|
+
onMouseDown: composeEventHandlers(props.onMouseDown, (event) => {
|
|
185566
|
+
if (!focusable) event.preventDefault();
|
|
185567
|
+
else context.onItemFocus(id);
|
|
185568
|
+
}),
|
|
185569
|
+
onFocus: composeEventHandlers(props.onFocus, () => context.onItemFocus(id)),
|
|
185570
|
+
onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
|
|
185571
|
+
if (event.key === "Tab" && event.shiftKey) {
|
|
185572
|
+
context.onItemShiftTab();
|
|
185573
|
+
return;
|
|
185574
|
+
}
|
|
185575
|
+
if (event.target !== event.currentTarget) return;
|
|
185576
|
+
const focusIntent = getFocusIntent(event, context.orientation, context.dir);
|
|
185577
|
+
if (focusIntent !== void 0) {
|
|
185578
|
+
if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return;
|
|
185579
|
+
event.preventDefault();
|
|
185580
|
+
const items = getItems().filter((item) => item.focusable);
|
|
185581
|
+
let candidateNodes = items.map((item) => item.ref.current);
|
|
185582
|
+
if (focusIntent === "last") candidateNodes.reverse();
|
|
185583
|
+
else if (focusIntent === "prev" || focusIntent === "next") {
|
|
185584
|
+
if (focusIntent === "prev") candidateNodes.reverse();
|
|
185585
|
+
const currentIndex = candidateNodes.indexOf(event.currentTarget);
|
|
185586
|
+
candidateNodes = context.loop ? wrapArray(candidateNodes, currentIndex + 1) : candidateNodes.slice(currentIndex + 1);
|
|
185587
|
+
}
|
|
185588
|
+
setTimeout(() => focusFirst(candidateNodes));
|
|
185589
|
+
}
|
|
185590
|
+
})
|
|
185591
|
+
}
|
|
185592
|
+
)
|
|
185593
|
+
}
|
|
185594
|
+
);
|
|
185595
|
+
}
|
|
185596
|
+
);
|
|
185597
|
+
RovingFocusGroupItem.displayName = ITEM_NAME$1;
|
|
185598
|
+
var MAP_KEY_TO_FOCUS_INTENT = {
|
|
185599
|
+
ArrowLeft: "prev",
|
|
185600
|
+
ArrowUp: "prev",
|
|
185601
|
+
ArrowRight: "next",
|
|
185602
|
+
ArrowDown: "next",
|
|
185603
|
+
PageUp: "first",
|
|
185604
|
+
Home: "first",
|
|
185605
|
+
PageDown: "last",
|
|
185606
|
+
End: "last"
|
|
185607
|
+
};
|
|
185608
|
+
function getDirectionAwareKey(key, dir) {
|
|
185609
|
+
if (dir !== "rtl") return key;
|
|
185610
|
+
return key === "ArrowLeft" ? "ArrowRight" : key === "ArrowRight" ? "ArrowLeft" : key;
|
|
185611
|
+
}
|
|
185612
|
+
function getFocusIntent(event, orientation, dir) {
|
|
185613
|
+
const key = getDirectionAwareKey(event.key, dir);
|
|
185614
|
+
if (orientation === "vertical" && ["ArrowLeft", "ArrowRight"].includes(key)) return void 0;
|
|
185615
|
+
if (orientation === "horizontal" && ["ArrowUp", "ArrowDown"].includes(key)) return void 0;
|
|
185616
|
+
return MAP_KEY_TO_FOCUS_INTENT[key];
|
|
185617
|
+
}
|
|
185618
|
+
function focusFirst(candidates, preventScroll = false) {
|
|
185619
|
+
const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;
|
|
185620
|
+
for (const candidate of candidates) {
|
|
185621
|
+
if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
185622
|
+
candidate.focus({ preventScroll });
|
|
185623
|
+
if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
185624
|
+
}
|
|
185625
|
+
}
|
|
185626
|
+
function wrapArray(array, startIndex) {
|
|
185627
|
+
return array.map((_, index) => array[(startIndex + index) % array.length]);
|
|
185628
|
+
}
|
|
185629
|
+
var Root$4 = RovingFocusGroup;
|
|
185630
|
+
var Item$1 = RovingFocusGroupItem;
|
|
185631
|
+
|
|
185632
|
+
// packages/react/use-size/src/useSize.tsx
|
|
185633
|
+
function useSize(element) {
|
|
185634
|
+
const [size, setSize] = React.useState(void 0);
|
|
185635
|
+
useLayoutEffect2(() => {
|
|
185636
|
+
if (element) {
|
|
185637
|
+
setSize({ width: element.offsetWidth, height: element.offsetHeight });
|
|
185638
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
185639
|
+
if (!Array.isArray(entries)) {
|
|
185640
|
+
return;
|
|
185641
|
+
}
|
|
185642
|
+
if (!entries.length) {
|
|
185643
|
+
return;
|
|
185644
|
+
}
|
|
185645
|
+
const entry = entries[0];
|
|
185646
|
+
let width;
|
|
185647
|
+
let height;
|
|
185648
|
+
if ("borderBoxSize" in entry) {
|
|
185649
|
+
const borderSizeEntry = entry["borderBoxSize"];
|
|
185650
|
+
const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;
|
|
185651
|
+
width = borderSize["inlineSize"];
|
|
185652
|
+
height = borderSize["blockSize"];
|
|
185653
|
+
} else {
|
|
185654
|
+
width = element.offsetWidth;
|
|
185655
|
+
height = element.offsetHeight;
|
|
185656
|
+
}
|
|
185657
|
+
setSize({ width, height });
|
|
185658
|
+
});
|
|
185659
|
+
resizeObserver.observe(element, { box: "border-box" });
|
|
185660
|
+
return () => resizeObserver.unobserve(element);
|
|
185661
|
+
} else {
|
|
185662
|
+
setSize(void 0);
|
|
185663
|
+
}
|
|
185664
|
+
}, [element]);
|
|
185665
|
+
return size;
|
|
185666
|
+
}
|
|
185667
|
+
|
|
185668
|
+
// packages/react/use-previous/src/usePrevious.tsx
|
|
185669
|
+
function usePrevious(value) {
|
|
185670
|
+
const ref = React.useRef({ value, previous: value });
|
|
185671
|
+
return React.useMemo(() => {
|
|
185672
|
+
if (ref.current.value !== value) {
|
|
185673
|
+
ref.current.previous = ref.current.value;
|
|
185674
|
+
ref.current.value = value;
|
|
185675
|
+
}
|
|
185676
|
+
return ref.current.previous;
|
|
185677
|
+
}, [value]);
|
|
185678
|
+
}
|
|
185679
|
+
|
|
185680
|
+
function useStateMachine$1(initialState, machine) {
|
|
185681
|
+
return React.useReducer((state, event) => {
|
|
185682
|
+
const nextState = machine[state][event];
|
|
185683
|
+
return nextState ?? state;
|
|
185684
|
+
}, initialState);
|
|
185685
|
+
}
|
|
185686
|
+
|
|
185687
|
+
// packages/react/presence/src/Presence.tsx
|
|
185688
|
+
var Presence = (props) => {
|
|
185689
|
+
const { present, children } = props;
|
|
185690
|
+
const presence = usePresence(present);
|
|
185691
|
+
const child = typeof children === "function" ? children({ present: presence.isPresent }) : React.Children.only(children);
|
|
185692
|
+
const ref = useComposedRefs(presence.ref, getElementRef(child));
|
|
185693
|
+
const forceMount = typeof children === "function";
|
|
185694
|
+
return forceMount || presence.isPresent ? React.cloneElement(child, { ref }) : null;
|
|
185695
|
+
};
|
|
185696
|
+
Presence.displayName = "Presence";
|
|
185697
|
+
function usePresence(present) {
|
|
185698
|
+
const [node, setNode] = React.useState();
|
|
185699
|
+
const stylesRef = React.useRef({});
|
|
185700
|
+
const prevPresentRef = React.useRef(present);
|
|
185701
|
+
const prevAnimationNameRef = React.useRef("none");
|
|
185702
|
+
const initialState = present ? "mounted" : "unmounted";
|
|
185703
|
+
const [state, send] = useStateMachine$1(initialState, {
|
|
185704
|
+
mounted: {
|
|
185705
|
+
UNMOUNT: "unmounted",
|
|
185706
|
+
ANIMATION_OUT: "unmountSuspended"
|
|
185707
|
+
},
|
|
185708
|
+
unmountSuspended: {
|
|
185709
|
+
MOUNT: "mounted",
|
|
185710
|
+
ANIMATION_END: "unmounted"
|
|
185711
|
+
},
|
|
185712
|
+
unmounted: {
|
|
185713
|
+
MOUNT: "mounted"
|
|
185714
|
+
}
|
|
185715
|
+
});
|
|
185716
|
+
React.useEffect(() => {
|
|
185717
|
+
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
185718
|
+
prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
|
|
185719
|
+
}, [state]);
|
|
185720
|
+
useLayoutEffect2(() => {
|
|
185721
|
+
const styles = stylesRef.current;
|
|
185722
|
+
const wasPresent = prevPresentRef.current;
|
|
185723
|
+
const hasPresentChanged = wasPresent !== present;
|
|
185724
|
+
if (hasPresentChanged) {
|
|
185725
|
+
const prevAnimationName = prevAnimationNameRef.current;
|
|
185726
|
+
const currentAnimationName = getAnimationName(styles);
|
|
185727
|
+
if (present) {
|
|
185728
|
+
send("MOUNT");
|
|
185729
|
+
} else if (currentAnimationName === "none" || styles?.display === "none") {
|
|
185730
|
+
send("UNMOUNT");
|
|
185731
|
+
} else {
|
|
185732
|
+
const isAnimating = prevAnimationName !== currentAnimationName;
|
|
185733
|
+
if (wasPresent && isAnimating) {
|
|
185734
|
+
send("ANIMATION_OUT");
|
|
185735
|
+
} else {
|
|
185736
|
+
send("UNMOUNT");
|
|
185737
|
+
}
|
|
185738
|
+
}
|
|
185739
|
+
prevPresentRef.current = present;
|
|
185740
|
+
}
|
|
185741
|
+
}, [present, send]);
|
|
185742
|
+
useLayoutEffect2(() => {
|
|
185743
|
+
if (node) {
|
|
185744
|
+
let timeoutId;
|
|
185745
|
+
const ownerWindow = node.ownerDocument.defaultView ?? window;
|
|
185746
|
+
const handleAnimationEnd = (event) => {
|
|
185747
|
+
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
185748
|
+
const isCurrentAnimation = currentAnimationName.includes(event.animationName);
|
|
185749
|
+
if (event.target === node && isCurrentAnimation) {
|
|
185750
|
+
send("ANIMATION_END");
|
|
185751
|
+
if (!prevPresentRef.current) {
|
|
185752
|
+
const currentFillMode = node.style.animationFillMode;
|
|
185753
|
+
node.style.animationFillMode = "forwards";
|
|
185754
|
+
timeoutId = ownerWindow.setTimeout(() => {
|
|
185755
|
+
if (node.style.animationFillMode === "forwards") {
|
|
185756
|
+
node.style.animationFillMode = currentFillMode;
|
|
185757
|
+
}
|
|
185758
|
+
});
|
|
185759
|
+
}
|
|
185760
|
+
}
|
|
185761
|
+
};
|
|
185762
|
+
const handleAnimationStart = (event) => {
|
|
185763
|
+
if (event.target === node) {
|
|
185764
|
+
prevAnimationNameRef.current = getAnimationName(stylesRef.current);
|
|
185765
|
+
}
|
|
185766
|
+
};
|
|
185767
|
+
node.addEventListener("animationstart", handleAnimationStart);
|
|
185768
|
+
node.addEventListener("animationcancel", handleAnimationEnd);
|
|
185769
|
+
node.addEventListener("animationend", handleAnimationEnd);
|
|
185770
|
+
return () => {
|
|
185771
|
+
ownerWindow.clearTimeout(timeoutId);
|
|
185772
|
+
node.removeEventListener("animationstart", handleAnimationStart);
|
|
185773
|
+
node.removeEventListener("animationcancel", handleAnimationEnd);
|
|
185774
|
+
node.removeEventListener("animationend", handleAnimationEnd);
|
|
185775
|
+
};
|
|
185776
|
+
} else {
|
|
185777
|
+
send("ANIMATION_END");
|
|
185778
|
+
}
|
|
185779
|
+
}, [node, send]);
|
|
185780
|
+
return {
|
|
185781
|
+
isPresent: ["mounted", "unmountSuspended"].includes(state),
|
|
185782
|
+
ref: React.useCallback((node2) => {
|
|
185783
|
+
if (node2) stylesRef.current = getComputedStyle(node2);
|
|
185784
|
+
setNode(node2);
|
|
185785
|
+
}, [])
|
|
185786
|
+
};
|
|
185787
|
+
}
|
|
185788
|
+
function getAnimationName(styles) {
|
|
185789
|
+
return styles?.animationName || "none";
|
|
185790
|
+
}
|
|
185791
|
+
function getElementRef(element) {
|
|
185792
|
+
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
185793
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
185794
|
+
if (mayWarn) {
|
|
185795
|
+
return element.ref;
|
|
185796
|
+
}
|
|
185797
|
+
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
185798
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
185799
|
+
if (mayWarn) {
|
|
185800
|
+
return element.props.ref;
|
|
185801
|
+
}
|
|
185802
|
+
return element.props.ref || element.ref;
|
|
185803
|
+
}
|
|
185804
|
+
|
|
185805
|
+
var RADIO_NAME = "Radio";
|
|
185806
|
+
var [createRadioContext, createRadioScope] = createContextScope(RADIO_NAME);
|
|
185807
|
+
var [RadioProvider, useRadioContext] = createRadioContext(RADIO_NAME);
|
|
185808
|
+
var Radio = React.forwardRef(
|
|
185809
|
+
(props, forwardedRef) => {
|
|
185810
|
+
const {
|
|
185811
|
+
__scopeRadio,
|
|
185812
|
+
name,
|
|
185813
|
+
checked = false,
|
|
185814
|
+
required,
|
|
185815
|
+
disabled,
|
|
185816
|
+
value = "on",
|
|
185817
|
+
onCheck,
|
|
185818
|
+
form,
|
|
185819
|
+
...radioProps
|
|
185820
|
+
} = props;
|
|
185821
|
+
const [button, setButton] = React.useState(null);
|
|
185822
|
+
const composedRefs = useComposedRefs(forwardedRef, (node) => setButton(node));
|
|
185823
|
+
const hasConsumerStoppedPropagationRef = React.useRef(false);
|
|
185824
|
+
const isFormControl = button ? form || !!button.closest("form") : true;
|
|
185825
|
+
return /* @__PURE__ */ jsxs(RadioProvider, { scope: __scopeRadio, checked, disabled, children: [
|
|
185826
|
+
/* @__PURE__ */ jsx(
|
|
185827
|
+
Primitive$1.button,
|
|
185828
|
+
{
|
|
185829
|
+
type: "button",
|
|
185830
|
+
role: "radio",
|
|
185831
|
+
"aria-checked": checked,
|
|
185832
|
+
"data-state": getState(checked),
|
|
185833
|
+
"data-disabled": disabled ? "" : void 0,
|
|
185834
|
+
disabled,
|
|
185835
|
+
value,
|
|
185836
|
+
...radioProps,
|
|
185837
|
+
ref: composedRefs,
|
|
185838
|
+
onClick: composeEventHandlers(props.onClick, (event) => {
|
|
185839
|
+
if (!checked) onCheck?.();
|
|
185840
|
+
if (isFormControl) {
|
|
185841
|
+
hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
|
|
185842
|
+
if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
|
|
185843
|
+
}
|
|
185844
|
+
})
|
|
185845
|
+
}
|
|
185846
|
+
),
|
|
185847
|
+
isFormControl && /* @__PURE__ */ jsx(
|
|
185848
|
+
BubbleInput,
|
|
185849
|
+
{
|
|
185850
|
+
control: button,
|
|
185851
|
+
bubbles: !hasConsumerStoppedPropagationRef.current,
|
|
185852
|
+
name,
|
|
185853
|
+
value,
|
|
185854
|
+
checked,
|
|
185855
|
+
required,
|
|
185856
|
+
disabled,
|
|
185857
|
+
form,
|
|
185858
|
+
style: { transform: "translateX(-100%)" }
|
|
185859
|
+
}
|
|
185860
|
+
)
|
|
185861
|
+
] });
|
|
185862
|
+
}
|
|
185863
|
+
);
|
|
185864
|
+
Radio.displayName = RADIO_NAME;
|
|
185865
|
+
var INDICATOR_NAME = "RadioIndicator";
|
|
185866
|
+
var RadioIndicator = React.forwardRef(
|
|
185867
|
+
(props, forwardedRef) => {
|
|
185868
|
+
const { __scopeRadio, forceMount, ...indicatorProps } = props;
|
|
185869
|
+
const context = useRadioContext(INDICATOR_NAME, __scopeRadio);
|
|
185870
|
+
return /* @__PURE__ */ jsx(Presence, { present: forceMount || context.checked, children: /* @__PURE__ */ jsx(
|
|
185871
|
+
Primitive$1.span,
|
|
185872
|
+
{
|
|
185873
|
+
"data-state": getState(context.checked),
|
|
185874
|
+
"data-disabled": context.disabled ? "" : void 0,
|
|
185875
|
+
...indicatorProps,
|
|
185876
|
+
ref: forwardedRef
|
|
185877
|
+
}
|
|
185878
|
+
) });
|
|
185879
|
+
}
|
|
185880
|
+
);
|
|
185881
|
+
RadioIndicator.displayName = INDICATOR_NAME;
|
|
185882
|
+
var BubbleInput = (props) => {
|
|
185883
|
+
const { control, checked, bubbles = true, ...inputProps } = props;
|
|
185884
|
+
const ref = React.useRef(null);
|
|
185885
|
+
const prevChecked = usePrevious(checked);
|
|
185886
|
+
const controlSize = useSize(control);
|
|
185887
|
+
React.useEffect(() => {
|
|
185888
|
+
const input = ref.current;
|
|
185889
|
+
const inputProto = window.HTMLInputElement.prototype;
|
|
185890
|
+
const descriptor = Object.getOwnPropertyDescriptor(inputProto, "checked");
|
|
185891
|
+
const setChecked = descriptor.set;
|
|
185892
|
+
if (prevChecked !== checked && setChecked) {
|
|
185893
|
+
const event = new Event("click", { bubbles });
|
|
185894
|
+
setChecked.call(input, checked);
|
|
185895
|
+
input.dispatchEvent(event);
|
|
185896
|
+
}
|
|
185897
|
+
}, [prevChecked, checked, bubbles]);
|
|
185898
|
+
return /* @__PURE__ */ jsx(
|
|
185899
|
+
"input",
|
|
185900
|
+
{
|
|
185901
|
+
type: "radio",
|
|
185902
|
+
"aria-hidden": true,
|
|
185903
|
+
defaultChecked: checked,
|
|
185904
|
+
...inputProps,
|
|
185905
|
+
tabIndex: -1,
|
|
185906
|
+
ref,
|
|
185907
|
+
style: {
|
|
185908
|
+
...props.style,
|
|
185909
|
+
...controlSize,
|
|
185910
|
+
position: "absolute",
|
|
185911
|
+
pointerEvents: "none",
|
|
185912
|
+
opacity: 0,
|
|
185913
|
+
margin: 0
|
|
185914
|
+
}
|
|
185915
|
+
}
|
|
185916
|
+
);
|
|
185917
|
+
};
|
|
185918
|
+
function getState(checked) {
|
|
185919
|
+
return checked ? "checked" : "unchecked";
|
|
185920
|
+
}
|
|
185921
|
+
var ARROW_KEYS = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"];
|
|
185922
|
+
var RADIO_GROUP_NAME = "RadioGroup";
|
|
185923
|
+
var [createRadioGroupContext] = createContextScope(RADIO_GROUP_NAME, [
|
|
185924
|
+
createRovingFocusGroupScope,
|
|
185925
|
+
createRadioScope
|
|
185926
|
+
]);
|
|
185927
|
+
var useRovingFocusGroupScope = createRovingFocusGroupScope();
|
|
185928
|
+
var useRadioScope = createRadioScope();
|
|
185929
|
+
var [RadioGroupProvider, useRadioGroupContext] = createRadioGroupContext(RADIO_GROUP_NAME);
|
|
185930
|
+
var RadioGroup$1 = React.forwardRef(
|
|
185931
|
+
(props, forwardedRef) => {
|
|
185932
|
+
const {
|
|
185933
|
+
__scopeRadioGroup,
|
|
185934
|
+
name,
|
|
185935
|
+
defaultValue,
|
|
185936
|
+
value: valueProp,
|
|
185937
|
+
required = false,
|
|
185938
|
+
disabled = false,
|
|
185939
|
+
orientation,
|
|
185940
|
+
dir,
|
|
185941
|
+
loop = true,
|
|
185942
|
+
onValueChange,
|
|
185943
|
+
...groupProps
|
|
185944
|
+
} = props;
|
|
185945
|
+
const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeRadioGroup);
|
|
185946
|
+
const direction = useDirection(dir);
|
|
185947
|
+
const [value, setValue] = useControllableState({
|
|
185948
|
+
prop: valueProp,
|
|
185949
|
+
defaultProp: defaultValue,
|
|
185950
|
+
onChange: onValueChange
|
|
185951
|
+
});
|
|
185952
|
+
return /* @__PURE__ */ jsx(
|
|
185953
|
+
RadioGroupProvider,
|
|
185954
|
+
{
|
|
185955
|
+
scope: __scopeRadioGroup,
|
|
185956
|
+
name,
|
|
185957
|
+
required,
|
|
185958
|
+
disabled,
|
|
185959
|
+
value,
|
|
185960
|
+
onValueChange: setValue,
|
|
185961
|
+
children: /* @__PURE__ */ jsx(
|
|
185962
|
+
Root$4,
|
|
185963
|
+
{
|
|
185964
|
+
asChild: true,
|
|
185965
|
+
...rovingFocusGroupScope,
|
|
185966
|
+
orientation,
|
|
185967
|
+
dir: direction,
|
|
185968
|
+
loop,
|
|
185969
|
+
children: /* @__PURE__ */ jsx(
|
|
185970
|
+
Primitive$1.div,
|
|
185971
|
+
{
|
|
185972
|
+
role: "radiogroup",
|
|
185973
|
+
"aria-required": required,
|
|
185974
|
+
"aria-orientation": orientation,
|
|
185975
|
+
"data-disabled": disabled ? "" : void 0,
|
|
185976
|
+
dir: direction,
|
|
185977
|
+
...groupProps,
|
|
185978
|
+
ref: forwardedRef
|
|
185979
|
+
}
|
|
185980
|
+
)
|
|
185981
|
+
}
|
|
185982
|
+
)
|
|
185983
|
+
}
|
|
185984
|
+
);
|
|
185985
|
+
}
|
|
185986
|
+
);
|
|
185987
|
+
RadioGroup$1.displayName = RADIO_GROUP_NAME;
|
|
185988
|
+
var ITEM_NAME = "RadioGroupItem";
|
|
185989
|
+
var RadioGroupItem$1 = React.forwardRef(
|
|
185990
|
+
(props, forwardedRef) => {
|
|
185991
|
+
const { __scopeRadioGroup, disabled, ...itemProps } = props;
|
|
185992
|
+
const context = useRadioGroupContext(ITEM_NAME, __scopeRadioGroup);
|
|
185993
|
+
const isDisabled = context.disabled || disabled;
|
|
185994
|
+
const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeRadioGroup);
|
|
185995
|
+
const radioScope = useRadioScope(__scopeRadioGroup);
|
|
185996
|
+
const ref = React.useRef(null);
|
|
185997
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
185998
|
+
const checked = context.value === itemProps.value;
|
|
185999
|
+
const isArrowKeyPressedRef = React.useRef(false);
|
|
186000
|
+
React.useEffect(() => {
|
|
186001
|
+
const handleKeyDown = (event) => {
|
|
186002
|
+
if (ARROW_KEYS.includes(event.key)) {
|
|
186003
|
+
isArrowKeyPressedRef.current = true;
|
|
186004
|
+
}
|
|
186005
|
+
};
|
|
186006
|
+
const handleKeyUp = () => isArrowKeyPressedRef.current = false;
|
|
186007
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
186008
|
+
document.addEventListener("keyup", handleKeyUp);
|
|
186009
|
+
return () => {
|
|
186010
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
186011
|
+
document.removeEventListener("keyup", handleKeyUp);
|
|
186012
|
+
};
|
|
186013
|
+
}, []);
|
|
186014
|
+
return /* @__PURE__ */ jsx(
|
|
186015
|
+
Item$1,
|
|
186016
|
+
{
|
|
186017
|
+
asChild: true,
|
|
186018
|
+
...rovingFocusGroupScope,
|
|
186019
|
+
focusable: !isDisabled,
|
|
186020
|
+
active: checked,
|
|
186021
|
+
children: /* @__PURE__ */ jsx(
|
|
186022
|
+
Radio,
|
|
186023
|
+
{
|
|
186024
|
+
disabled: isDisabled,
|
|
186025
|
+
required: context.required,
|
|
186026
|
+
checked,
|
|
186027
|
+
...radioScope,
|
|
186028
|
+
...itemProps,
|
|
186029
|
+
name: context.name,
|
|
186030
|
+
ref: composedRefs,
|
|
186031
|
+
onCheck: () => context.onValueChange(itemProps.value),
|
|
186032
|
+
onKeyDown: composeEventHandlers((event) => {
|
|
186033
|
+
if (event.key === "Enter") event.preventDefault();
|
|
186034
|
+
}),
|
|
186035
|
+
onFocus: composeEventHandlers(itemProps.onFocus, () => {
|
|
186036
|
+
if (isArrowKeyPressedRef.current) ref.current?.click();
|
|
186037
|
+
})
|
|
186038
|
+
}
|
|
186039
|
+
)
|
|
186040
|
+
}
|
|
186041
|
+
);
|
|
186042
|
+
}
|
|
186043
|
+
);
|
|
186044
|
+
RadioGroupItem$1.displayName = ITEM_NAME;
|
|
186045
|
+
var INDICATOR_NAME2 = "RadioGroupIndicator";
|
|
186046
|
+
var RadioGroupIndicator = React.forwardRef(
|
|
186047
|
+
(props, forwardedRef) => {
|
|
186048
|
+
const { __scopeRadioGroup, ...indicatorProps } = props;
|
|
186049
|
+
const radioScope = useRadioScope(__scopeRadioGroup);
|
|
186050
|
+
return /* @__PURE__ */ jsx(RadioIndicator, { ...radioScope, ...indicatorProps, ref: forwardedRef });
|
|
186051
|
+
}
|
|
186052
|
+
);
|
|
186053
|
+
RadioGroupIndicator.displayName = INDICATOR_NAME2;
|
|
186054
|
+
var Root2$3 = RadioGroup$1;
|
|
186055
|
+
var Item2 = RadioGroupItem$1;
|
|
186056
|
+
var Indicator = RadioGroupIndicator;
|
|
186057
|
+
|
|
186058
|
+
function RadioGroup({ className, ...props }) {
|
|
186059
|
+
return (jsx(Root2$3, { "data-slot": "radio-group", className: cn('grid gap-3', className), ...props }));
|
|
186060
|
+
}
|
|
186061
|
+
function RadioGroupItem({ className, ...props }) {
|
|
186062
|
+
return (jsx(Item2, { "data-slot": "radio-group-item", className: cn('border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50', className), ...props, children: jsx(Indicator, { "data-slot": "radio-group-indicator", className: "relative flex items-center justify-center", children: jsx(Circle, { className: "fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2" }) }) }));
|
|
186063
|
+
}
|
|
186064
|
+
|
|
186065
|
+
function SearchableMultiSelect({ items, selectedItems, onSelectionChange, searchQuery, onSearchChange, isLoading, placeholder = 'Search and select items...', getItemValue, getItemLabel, className, maxHeight = 'max-h-60', inputId, ariaDescribedBy, onSelectedItemAction, selectedItemActionIcon, selectedItemActionAriaLabel = 'View item details', }) {
|
|
186066
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
186067
|
+
const containerRef = useRef(null);
|
|
186068
|
+
// Handle outside click to close dropdown
|
|
186069
|
+
useEffect(() => {
|
|
186070
|
+
const handleClickOutside = (event) => {
|
|
186071
|
+
if (containerRef.current && !containerRef.current.contains(event.target)) {
|
|
186072
|
+
setIsOpen(false);
|
|
186073
|
+
}
|
|
186074
|
+
};
|
|
186075
|
+
if (isOpen) {
|
|
186076
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
186077
|
+
}
|
|
186078
|
+
return () => {
|
|
186079
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
186080
|
+
};
|
|
186081
|
+
}, [isOpen]);
|
|
186082
|
+
const handleSelectItem = (itemValue, itemLabel) => {
|
|
186083
|
+
const newSelection = selectedItems.some((item) => item.value === itemValue)
|
|
186084
|
+
? selectedItems.filter((item) => item.value !== itemValue)
|
|
186085
|
+
: [...selectedItems, { label: itemLabel, value: itemValue }];
|
|
186086
|
+
onSelectionChange(newSelection);
|
|
186087
|
+
};
|
|
186088
|
+
const handleRemoveItem = (itemValue) => {
|
|
186089
|
+
onSelectionChange(selectedItems.filter((item) => item.value !== itemValue));
|
|
186090
|
+
};
|
|
186091
|
+
return (jsxs("div", { className: cn('space-y-2', className), ref: containerRef, children: [jsxs("div", { className: "relative", children: [jsxs("div", { className: cn('flex min-h-[40px] w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background', 'focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2', 'cursor-pointer'), children: [jsxs("div", { className: "flex flex-1 items-center gap-2", children: [jsx(Search, { className: "h-4 w-4 text-muted-foreground" }), jsx("input", { type: "text", placeholder: placeholder, value: searchQuery, onChange: (e) => onSearchChange(e.target.value), onFocus: () => setIsOpen(true), id: inputId, "aria-describedby": ariaDescribedBy, className: "flex-1 bg-transparent outline-none placeholder:text-muted-foreground", onClick: (e) => e.stopPropagation() })] }), jsxs("div", { className: "flex items-center gap-1", children: [selectedItems.length > 0 && (jsx(Badge, { variant: "secondary", className: "text-xs", children: selectedItems.length })), jsx(X$2, { className: "h-4 w-4 text-muted-foreground cursor-pointer", onClick: (e) => {
|
|
186092
|
+
e.stopPropagation();
|
|
186093
|
+
onSelectionChange([]);
|
|
186094
|
+
onSearchChange('');
|
|
186095
|
+
setIsOpen(false);
|
|
186096
|
+
} })] })] }), isOpen && (jsx("div", { className: cn('absolute z-50 w-full mt-1 bg-white border rounded-md shadow-lg overflow-auto', maxHeight), children: isLoading ? (jsx("div", { className: "p-3 text-sm text-muted-foreground", children: "Loading..." })) : items.length > 0 ? (items.map((item) => {
|
|
186097
|
+
const itemValue = getItemValue(item);
|
|
186098
|
+
const itemLabel = getItemLabel(item);
|
|
186099
|
+
const isSelected = selectedItems.some((selected) => selected.value === itemValue);
|
|
186100
|
+
return (jsxs("div", { className: "flex items-center space-x-2 p-2 hover:bg-gray-50 cursor-pointer", onClick: () => handleSelectItem(itemValue, itemLabel), children: [jsx("div", { className: "flex items-center justify-center w-4 h-4", children: isSelected && jsx(Check, { className: "h-3 w-3 text-primary" }) }), jsx("span", { className: "text-sm", children: itemLabel })] }, itemValue));
|
|
186101
|
+
})) : (jsx("div", { className: "p-3 text-sm text-muted-foreground", children: searchQuery ? 'No items found' : 'Start typing to search items' })) }))] }), selectedItems.length > 0 && (jsx("div", { className: "flex gap-2 overflow-x-auto pb-2 scrollbar-thin scrollbar-thumb-gray-300 scrollbar-track-gray-100", children: selectedItems
|
|
186102
|
+
.slice()
|
|
186103
|
+
.reverse()
|
|
186104
|
+
.map((selectedItem) => {
|
|
186105
|
+
return (jsxs(Badge, { variant: "secondary", className: "text-xs whitespace-nowrap flex-shrink-0 font-normal", children: [selectedItem.label, onSelectedItemAction && (jsx("button", { type: "button", onClick: (event) => {
|
|
186106
|
+
event.preventDefault();
|
|
186107
|
+
event.stopPropagation();
|
|
186108
|
+
onSelectedItemAction(selectedItem);
|
|
186109
|
+
}, className: "ml-1 text-gray-500 hover:text-gray-700", "aria-label": selectedItemActionAriaLabel, children: selectedItemActionIcon !== null && selectedItemActionIcon !== void 0 ? selectedItemActionIcon : jsx(Eye, { className: "h-3 w-3" }) })), jsx("button", { type: "button", onClick: () => handleRemoveItem(selectedItem.value), className: "ml-1 text-gray-500 hover:text-gray-700", children: "\u00D7" })] }, selectedItem.value));
|
|
186110
|
+
}) }))] }));
|
|
186111
|
+
}
|
|
186112
|
+
|
|
186113
|
+
function useDebouncedValue$1(value, delay) {
|
|
186114
|
+
const [debouncedValue, setDebouncedValue] = React__default.useState(value);
|
|
186115
|
+
React__default.useEffect(() => {
|
|
186116
|
+
const timer = window.setTimeout(() => setDebouncedValue(value), delay);
|
|
186117
|
+
return () => window.clearTimeout(timer);
|
|
186118
|
+
}, [value, delay]);
|
|
186119
|
+
return debouncedValue;
|
|
186120
|
+
}
|
|
186121
|
+
function toList(response) {
|
|
186122
|
+
if (Array.isArray(response))
|
|
186123
|
+
return response;
|
|
186124
|
+
const results = response === null || response === void 0 ? void 0 : response.results;
|
|
186125
|
+
return Array.isArray(results) ? results : [];
|
|
186126
|
+
}
|
|
186127
|
+
function itemLabel(item) {
|
|
186128
|
+
return item.name || item.unique_id || `#${item.id}`;
|
|
186129
|
+
}
|
|
186130
|
+
/**
|
|
186131
|
+
* The platform-provisioned students group is not a meaningful scope for a
|
|
186132
|
+
* token. Matched exactly: user-created groups carry a timestamp-suffixed slug
|
|
186133
|
+
* (see GroupsTab's `generateUniqueId`), so only the provisioned group has this
|
|
186134
|
+
* bare id and a group like `students-cohort-2024` is still selectable.
|
|
186135
|
+
*/
|
|
186136
|
+
const EXCLUDED_GROUP_UNIQUE_ID = 'students';
|
|
186137
|
+
function isSelectableGroup(group) {
|
|
186138
|
+
var _a;
|
|
186139
|
+
return ((_a = group.unique_id) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== EXCLUDED_GROUP_UNIQUE_ID;
|
|
186140
|
+
}
|
|
186141
|
+
function ReadOnlySelection({ items, emptyLabel, }) {
|
|
186142
|
+
if (items.length === 0) {
|
|
186143
|
+
return jsx("p", { className: "text-sm text-muted-foreground", children: emptyLabel });
|
|
186144
|
+
}
|
|
186145
|
+
return (jsx("div", { className: "flex gap-2 overflow-x-auto pb-2 scrollbar-thin scrollbar-thumb-gray-300 scrollbar-track-gray-100", children: items.map((item) => (jsx(Badge, { variant: "secondary", className: "text-xs font-normal whitespace-nowrap shrink-0", children: item.label }, item.value))) }));
|
|
186146
|
+
}
|
|
186147
|
+
/**
|
|
186148
|
+
* Permission-mode selector plus the policy/group pickers a `token_policies`
|
|
186149
|
+
* token resolves its permissions from. Each control is gated on the write flag
|
|
186150
|
+
* the `field-permissions` endpoint reports; a field the caller cannot write is
|
|
186151
|
+
* rendered read-only instead of being hidden, so existing associations stay
|
|
186152
|
+
* visible while editing.
|
|
186153
|
+
*/
|
|
186154
|
+
function TokenPolicyFields({ tenantKey, mode, onModeChange, policies, onPoliciesChange, groups, onGroupsChange, fieldPermissions, idPrefix, }) {
|
|
186155
|
+
const t = useT();
|
|
186156
|
+
const [policySearch, setPolicySearch] = React__default.useState('');
|
|
186157
|
+
const [groupSearch, setGroupSearch] = React__default.useState('');
|
|
186158
|
+
const debouncedPolicySearch = useDebouncedValue$1(policySearch, RBAC_SEARCH_DEBOUNCE_MS);
|
|
186159
|
+
const debouncedGroupSearch = useDebouncedValue$1(groupSearch, RBAC_SEARCH_DEBOUNCE_MS);
|
|
186160
|
+
const canWriteMode = canWriteField(fieldPermissions, 'mode');
|
|
186161
|
+
const canWritePolicies = canWriteField(fieldPermissions, 'policies_to_add') ||
|
|
186162
|
+
canWriteField(fieldPermissions, 'policies_to_remove');
|
|
186163
|
+
const canWriteGroups = canWriteField(fieldPermissions, 'groups_to_add') ||
|
|
186164
|
+
canWriteField(fieldPermissions, 'groups_to_remove');
|
|
186165
|
+
const isTokenPolicyMode = mode === API_TOKEN_MODES.TOKEN_POLICIES;
|
|
186166
|
+
const { data: policiesResponse, isFetching: isPoliciesFetching } = useGetRbacPoliciesQuery({
|
|
186167
|
+
platformKey: tenantKey,
|
|
186168
|
+
name: debouncedPolicySearch || undefined,
|
|
186169
|
+
pageSize: RBAC_PICKER_PAGE_SIZE,
|
|
186170
|
+
includeUsers: false,
|
|
186171
|
+
includeGroups: false,
|
|
186172
|
+
}, { skip: !tenantKey || !isTokenPolicyMode || !canWritePolicies });
|
|
186173
|
+
const { data: groupsResponse, isFetching: isGroupsFetching } = useGetRbacGroupsQuery({
|
|
186174
|
+
platformKey: tenantKey,
|
|
186175
|
+
name: debouncedGroupSearch || undefined,
|
|
186176
|
+
pageSize: RBAC_PICKER_PAGE_SIZE,
|
|
186177
|
+
includeUsers: false,
|
|
186178
|
+
}, { skip: !tenantKey || !isTokenPolicyMode || !canWriteGroups });
|
|
186179
|
+
const policyOptions = React__default.useMemo(() => toList(policiesResponse), [policiesResponse]);
|
|
186180
|
+
const groupOptions = React__default.useMemo(() => toList(groupsResponse).filter(isSelectableGroup), [groupsResponse]);
|
|
186181
|
+
return (
|
|
186182
|
+
// min-w-0 so this grid item can shrink below the badge rows' min-content
|
|
186183
|
+
// width — without it the dialog scrolls instead of the badge row.
|
|
186184
|
+
jsxs("div", { className: "min-w-0 space-y-5", children: [jsxs("div", { className: "space-y-1.5", children: [jsx(Label$1, { className: "flex items-center text-sm font-medium text-[#646464]", children: t('apiTabTokenPolicies.modeLabel') }), canWriteMode ? (jsx(RadioGroup, { value: mode, onValueChange: (value) => onModeChange(value), className: "gap-2", children: [
|
|
186185
|
+
{
|
|
186186
|
+
value: API_TOKEN_MODES.OWNER,
|
|
186187
|
+
label: t('apiTabTokenPolicies.ownerModeLabel'),
|
|
186188
|
+
description: t('apiTabTokenPolicies.ownerModeDescription'),
|
|
186189
|
+
},
|
|
186190
|
+
{
|
|
186191
|
+
value: API_TOKEN_MODES.TOKEN_POLICIES,
|
|
186192
|
+
label: t('apiTabTokenPolicies.tokenPoliciesModeLabel'),
|
|
186193
|
+
description: t('apiTabTokenPolicies.tokenPoliciesModeDescription'),
|
|
186194
|
+
},
|
|
186195
|
+
].map((option) => (jsxs("div", { className: "flex items-start gap-2", children: [jsx(RadioGroupItem, { value: option.value, id: `${idPrefix}-mode-${option.value}`, className: "mt-0.5" }), jsxs("div", { className: "grid gap-0.5", children: [jsx(Label$1, { htmlFor: `${idPrefix}-mode-${option.value}`, className: "cursor-pointer text-sm font-medium", children: option.label }), jsx("p", { className: "text-xs text-muted-foreground", children: option.description })] })] }, option.value))) })) : (jsx("p", { className: "text-sm text-muted-foreground", children: mode === API_TOKEN_MODES.TOKEN_POLICIES
|
|
186196
|
+
? t('apiTabTokenPolicies.tokenPoliciesModeLabel')
|
|
186197
|
+
: t('apiTabTokenPolicies.ownerModeLabel') }))] }), isTokenPolicyMode && (jsxs(Fragment$1, { children: [jsxs("div", { className: "space-y-1.5", children: [jsx(Label$1, { className: "flex items-center text-sm font-medium text-[#646464]", htmlFor: `${idPrefix}-policies`, children: t('apiTabTokenPolicies.policiesLabel') }), canWritePolicies ? (jsx(SearchableMultiSelect, { items: policyOptions, selectedItems: policies, onSelectionChange: onPoliciesChange, searchQuery: policySearch, onSearchChange: setPolicySearch, isLoading: isPoliciesFetching, placeholder: t('apiTabTokenPolicies.policiesPlaceholder'), getItemValue: (policy) => String(policy.id), getItemLabel: itemLabel, inputId: `${idPrefix}-policies`, ariaDescribedBy: `${idPrefix}-policies-help` })) : (jsx(ReadOnlySelection, { items: policies, emptyLabel: t('apiTabTokenPolicies.noneSelected') })), jsx("p", { id: `${idPrefix}-policies-help`, className: "text-xs text-muted-foreground", children: t('apiTabTokenPolicies.policiesHelp') })] }), jsxs("div", { className: "space-y-1.5", children: [jsx(Label$1, { className: "flex items-center text-sm font-medium text-[#646464]", htmlFor: `${idPrefix}-groups`, children: t('apiTabTokenPolicies.groupsLabel') }), canWriteGroups ? (jsx(SearchableMultiSelect, { items: groupOptions, selectedItems: groups, onSelectionChange: onGroupsChange, searchQuery: groupSearch, onSearchChange: setGroupSearch, isLoading: isGroupsFetching, placeholder: t('apiTabTokenPolicies.groupsPlaceholder'), getItemValue: (group) => String(group.id), getItemLabel: itemLabel, inputId: `${idPrefix}-groups`, ariaDescribedBy: `${idPrefix}-groups-help` })) : (jsx(ReadOnlySelection, { items: groups, emptyLabel: t('apiTabTokenPolicies.noneSelected') })), jsx("p", { id: `${idPrefix}-groups-help`, className: "text-xs text-muted-foreground", children: t('apiTabTokenPolicies.groupsHelp') })] })] }))] }));
|
|
186198
|
+
}
|
|
186199
|
+
|
|
186200
|
+
const editApiFormSchema = z$2.object({
|
|
186201
|
+
name: z$2
|
|
186202
|
+
.string()
|
|
186203
|
+
.min(1, 'API Key name is required')
|
|
186204
|
+
.regex(/^[a-zA-Z0-9_-]+$/, 'can only contain letters, numbers, and hyphens'),
|
|
186205
|
+
expiration_date: z$2.date().nullable(),
|
|
186206
|
+
});
|
|
186207
|
+
function EditApiKeyForm({ token, tenantKey, fieldPermissions, onClose, }) {
|
|
186208
|
+
var _a;
|
|
186209
|
+
const t = useT();
|
|
186210
|
+
const [updateApiKey, { isLoading }] = useUpdateApiKeyMutation();
|
|
186211
|
+
const initialPolicies = React__default.useMemo(() => toSelections(token.policies), [token.policies]);
|
|
186212
|
+
const initialGroups = React__default.useMemo(() => toSelections(token.groups), [token.groups]);
|
|
186213
|
+
const initialExpiration = React__default.useMemo(() => (token.expires ? new Date(token.expires) : null), [token.expires]);
|
|
186214
|
+
const initialMode = (_a = token.mode) !== null && _a !== void 0 ? _a : API_TOKEN_MODES.OWNER;
|
|
186215
|
+
const [mode, setMode] = React__default.useState(initialMode);
|
|
186216
|
+
const [policies, setPolicies] = React__default.useState(initialPolicies);
|
|
186217
|
+
const [groups, setGroups] = React__default.useState(initialGroups);
|
|
186218
|
+
const form = useForm({
|
|
186219
|
+
defaultValues: {
|
|
186220
|
+
name: token.name,
|
|
186221
|
+
expiration_date: initialExpiration,
|
|
186222
|
+
},
|
|
186223
|
+
validators: {
|
|
186224
|
+
onChange: editApiFormSchema,
|
|
186225
|
+
},
|
|
186226
|
+
onSubmit: async ({ value }) => {
|
|
186227
|
+
var _a, _b, _c;
|
|
186228
|
+
const requestBody = buildTokenPolicyPayload({
|
|
186229
|
+
mode,
|
|
186230
|
+
initialMode,
|
|
186231
|
+
policies,
|
|
186232
|
+
groups,
|
|
186233
|
+
initialPolicies,
|
|
186234
|
+
initialGroups,
|
|
186235
|
+
fieldPermissions,
|
|
186236
|
+
});
|
|
186237
|
+
if (value.name !== token.name) {
|
|
186238
|
+
requestBody.name = value.name;
|
|
186239
|
+
}
|
|
186240
|
+
const nextExpiration = (_b = (_a = value.expiration_date) === null || _a === void 0 ? void 0 : _a.getTime()) !== null && _b !== void 0 ? _b : null;
|
|
186241
|
+
const previousExpiration = (_c = initialExpiration === null || initialExpiration === void 0 ? void 0 : initialExpiration.getTime()) !== null && _c !== void 0 ? _c : null;
|
|
186242
|
+
if (nextExpiration !== previousExpiration) {
|
|
186243
|
+
requestBody.expires_in = value.expiration_date
|
|
186244
|
+
? secondsUntil(value.expiration_date).toString()
|
|
186245
|
+
: null;
|
|
186246
|
+
}
|
|
186247
|
+
if (Object.keys(requestBody).length === 0) {
|
|
186248
|
+
onClose();
|
|
186249
|
+
return;
|
|
186250
|
+
}
|
|
186251
|
+
try {
|
|
186252
|
+
await updateApiKey({
|
|
186253
|
+
name: token.name,
|
|
186254
|
+
platformKey: tenantKey,
|
|
186255
|
+
requestBody,
|
|
186256
|
+
}).unwrap();
|
|
186257
|
+
toast.success(t('apiTabEditApiModal.successToast'));
|
|
186258
|
+
onClose();
|
|
186259
|
+
}
|
|
186260
|
+
catch (error) {
|
|
186261
|
+
console.error(JSON.stringify({ tenant: tenantKey, error }));
|
|
186262
|
+
toast.error(t('apiTabEditApiModal.errorToast'));
|
|
186263
|
+
}
|
|
186264
|
+
},
|
|
186265
|
+
});
|
|
186266
|
+
return (jsxs("form", { onSubmit: (formEvent) => {
|
|
186267
|
+
formEvent.preventDefault();
|
|
186268
|
+
formEvent.stopPropagation();
|
|
186269
|
+
form.handleSubmit();
|
|
186270
|
+
}, className: "mt-5 grid min-w-0 gap-5", children: [jsx(form.Field, { name: "name", children: (field) => {
|
|
186271
|
+
var _a, _b;
|
|
186272
|
+
const hasErrorAndIsDirty = ((_a = field.state.meta.errors) === null || _a === void 0 ? void 0 : _a.length) > 0 && field.state.meta.isDirty;
|
|
186273
|
+
return (jsxs("div", { className: "space-y-1.5", children: [jsxs(Label$1, { className: "flex items-center text-sm font-medium text-[#646464]", children: [t('apiTabCreateApiModal2.apiKeyName'), jsx("span", { className: "ml-1 text-red-500", children: "*" })] }), jsx(Input, { value: field.state.value, onChange: (event) => field.handleChange(event.target.value), autoComplete: "off" }), hasErrorAndIsDirty && (jsx("p", { className: "text-red-500 text-xs", children: (_b = field.state.meta.errors[0]) === null || _b === void 0 ? void 0 : _b.message })), field.state.value !== token.name && (jsxs("p", { className: "flex items-start gap-1.5 text-xs text-amber-700", children: [jsx(TriangleAlert, { className: "mt-0.5 h-3.5 w-3.5 shrink-0", "aria-hidden": "true" }), t('apiTabEditApiModal.renameWarning')] }))] }));
|
|
186274
|
+
} }), jsx(form.Field, { name: "expiration_date", children: (field) => (jsx(ExpirationDateField, { value: field.state.value, onChange: (date) => field.handleChange(date), helpText: t('apiTabEditApiModal.expirationHelp') })) }), jsx(TokenPolicyFields, { tenantKey: tenantKey, mode: mode, onModeChange: setMode, policies: policies, onPoliciesChange: setPolicies, groups: groups, onGroupsChange: setGroups, fieldPermissions: fieldPermissions, idPrefix: "edit-api-key" }), jsxs(DialogFooter, { className: "justify-end gap-3", children: [jsx(Button$1, { type: "button", variant: "outline", onClick: onClose, disabled: isLoading, children: t('apiTabDeleteApiModal2.cancel') }), jsx(form.Subscribe, { selector: (state) => ({ canSubmit: state.canSubmit }), children: ({ canSubmit }) => (jsx(Button$1, { type: "submit", disabled: !canSubmit || isLoading, className: "bg-gradient-to-r from-[#2563EB] to-[#93C5FD] text-white hover:opacity-90", children: isLoading ? t('apiTabEditApiModal.saving') : t('apiTabEditApiModal.save') })) })] })] }));
|
|
186275
|
+
}
|
|
186276
|
+
function EditApiModal({ isOpen, onClose, apiKeyName, tenantKey }) {
|
|
186277
|
+
var _a;
|
|
186278
|
+
const t = useT();
|
|
186279
|
+
const skip = !isOpen || !apiKeyName || !tenantKey;
|
|
186280
|
+
const { data: token, isError: isTokenError, isFetching: isTokenFetching, } = useGetApiKeyQuery({ name: apiKeyName, platformKey: tenantKey }, { skip });
|
|
186281
|
+
const { data: fieldPermissionsData, isError: isFieldPermissionsError, isLoading: isFieldPermissionsLoading, } = useGetApiKeyFieldPermissionsQuery({ platformKey: tenantKey }, { skip });
|
|
186282
|
+
// The detail payload wins when it embeds write flags, since those describe
|
|
186283
|
+
// this token rather than the create form.
|
|
186284
|
+
const fieldPermissions = (_a = token === null || token === void 0 ? void 0 : token.field_permissions) !== null && _a !== void 0 ? _a : (isFieldPermissionsError ? DENIED_TOKEN_POLICY_PERMISSIONS : fieldPermissionsData);
|
|
186285
|
+
// Both must settle first: an unresolved permission map reads as "all
|
|
186286
|
+
// writable", which would render controls the caller may not actually have.
|
|
186287
|
+
const isReady = Boolean(token) && !isFieldPermissionsLoading;
|
|
186288
|
+
return (jsx(Dialog, { open: isOpen, onOpenChange: onClose, children: jsxs(DialogContent, { "aria-describedby": "api-key-edit-description", className: "w-full max-w-md max-h-[85vh] overflow-y-auto", children: [jsx(DialogDescription, { className: "sr-only", children: t('apiTabEditApiModal.title') }), jsx(DialogHeader, { children: jsx(DialogTitle, { className: "ibl-dialog-title", children: t('apiTabEditApiModal.title') }) }), isReady && token ? (jsx(EditApiKeyForm, { token: token, tenantKey: tenantKey, fieldPermissions: fieldPermissions, onClose: onClose }, token.name)) : (jsx("p", { className: "py-6 text-center text-sm text-muted-foreground", children: isTokenError && !isTokenFetching
|
|
186289
|
+
? t('apiTabEditApiModal.loadError')
|
|
186290
|
+
: t('apiTabEditApiModal.loading') }))] }) }));
|
|
186291
|
+
}
|
|
186292
|
+
|
|
186293
|
+
/**
|
|
186294
|
+
* Blue informational banner used to describe a section, matching the RBAC
|
|
186295
|
+
* management tab styling (see `admin.tsx`).
|
|
186296
|
+
*/
|
|
186297
|
+
const InfoBanner = ({ icon, title, id, children, className }) => (jsxs("div", { className: `flex gap-3 items-center border rounded-lg p-4 bg-blue-50/60 border-blue-100 ${className !== null && className !== void 0 ? className : ''}`, children: [icon && (jsx("div", { className: "shrink-0 w-9 h-9 rounded-md flex items-center justify-center bg-blue-100 text-blue-600", children: icon })), jsxs("div", { className: "flex-1 min-w-0", children: [title && jsx("h3", { className: "text-sm font-semibold mb-1 text-blue-900", children: title }), jsx("p", { id: id, className: "text-sm text-gray-600 leading-relaxed", children: children })] })] }));
|
|
186298
|
+
|
|
186299
|
+
function IntegrationAutogeneratedTab({ tenantKey }) {
|
|
186300
|
+
const t = useT();
|
|
186301
|
+
const [page, setPage] = React__default.useState(1);
|
|
186302
|
+
const [apiKeyToDelete, setApiKeyToDelete] = React__default.useState(null);
|
|
186303
|
+
const [apiKeyToEdit, setApiKeyToEdit] = React__default.useState(null);
|
|
186304
|
+
const { data, isLoading: isApiKeysLoading } = useGetApiKeysQuery({
|
|
186305
|
+
platformKey: tenantKey,
|
|
186306
|
+
page,
|
|
186307
|
+
pageSize: API_KEYS_PAGE_SIZE,
|
|
186308
|
+
});
|
|
186309
|
+
const { tokens: apiKeys, count } = unwrapApiTokenList(data);
|
|
186310
|
+
const totalPages = Math.ceil(count / API_KEYS_PAGE_SIZE);
|
|
186311
|
+
function closeDeleteApiModal() {
|
|
186312
|
+
setApiKeyToDelete(null);
|
|
186313
|
+
}
|
|
186314
|
+
function openDeleteApiModal(apiKey) {
|
|
186315
|
+
setApiKeyToDelete(apiKey);
|
|
186316
|
+
}
|
|
186317
|
+
return (jsxs(Fragment$1, { children: [jsxs("div", { className: "space-y-4", children: [jsx(InfoBanner, { icon: jsx(KeyRound, { className: "w-5 h-5" }), children: t('apiTabLabels.table.banner') }), jsx("div", { className: "bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg overflow-x-auto", children: jsxs("table", { className: "w-full text-sm", children: [jsx("thead", { className: "bg-gray-50 dark:bg-gray-700 border-b border-gray-200 dark:border-gray-600", children: jsxs("tr", { children: [jsx("th", { className: "px-6 py-3 text-left font-medium text-gray-500 dark:text-gray-400", children: "Name" }), jsx("th", { className: "px-6 py-3 text-left font-medium text-gray-500 dark:text-gray-400", children: t('apiTabTokenPolicies.modeLabel') }), jsx("th", { className: "px-6 py-3 text-left font-medium text-gray-500 dark:text-gray-400", children: "Created" }), jsx("th", { className: "px-6 py-3 text-left font-medium text-gray-500 dark:text-gray-400", children: "Expires" }), jsx("th", { className: "px-6 py-3 text-left font-medium text-gray-500 dark:text-gray-400 w-[100px]" })] }) }), jsx("tbody", { className: "divide-y divide-gray-200 dark:divide-gray-600", children: isApiKeysLoading ? (jsx("tr", { children: jsx("td", { colSpan: 5, className: "px-6 py-8 text-center text-sm text-gray-500", children: "Loading..." }) })) : apiKeys.length === 0 ? (jsx("tr", { children: jsx("td", { colSpan: 5, className: "px-6 py-8 text-center text-sm text-gray-500", children: "No API keys found" }) })) : (apiKeys.map((apiKey) => (jsxs("tr", { children: [jsx("td", { className: "px-6 py-4 whitespace-nowrap text-gray-900 dark:text-gray-100", children: apiKey.name }), jsx("td", { className: "px-6 py-4 whitespace-nowrap", children: jsx(Badge, { variant: "secondary", className: "font-normal", children: apiKey.mode === API_TOKEN_MODES.TOKEN_POLICIES
|
|
186318
|
+
? t('apiTabTokenPolicies.tokenPoliciesModeLabel')
|
|
186319
|
+
: t('apiTabTokenPolicies.ownerModeLabel') }) }), jsx("td", { className: "px-6 py-4 whitespace-nowrap text-gray-600 dark:text-gray-300", children: apiKey.created ? format$1(apiKey.created, 'PPP') : 'N/A' }), jsx("td", { className: "px-6 py-4 whitespace-nowrap text-gray-600 dark:text-gray-300", children: apiKey.expires ? format$1(apiKey.expires, 'PPP') : 'N/A' }), jsx("td", { className: "px-6 py-4", children: jsxs("div", { className: "flex items-center gap-1", children: [jsx(Button$1, { variant: "ghost", size: "sm", className: "cursor-pointer", "aria-label": t('apiTabEditApiModal.editAriaLabel'), onClick: () => setApiKeyToEdit(apiKey.name), children: jsx(Pencil, { className: "h-4 w-4" }) }), jsx(Button$1, { variant: "ghost", size: "sm", className: "cursor-pointer", "aria-label": t('apiTabLabels.table.deleteAriaLabel'), onClick: () => openDeleteApiModal({ name: apiKey.name }), children: jsx(Trash, { className: "h-4 w-4" }) })] }) })] }, apiKey.name)))) })] }) }), totalPages > 1 && (jsx(IblPagination, { currentPage: page, totalPages: totalPages, onPageChange: setPage, disabled: isApiKeysLoading }))] }), apiKeyToDelete && (jsx(DeleteApiModal$1, { isOpen: !!apiKeyToDelete, onClose: closeDeleteApiModal, apiKey: apiKeyToDelete, tenantKey: tenantKey })), apiKeyToEdit && (jsx(EditApiModal, { isOpen: !!apiKeyToEdit, onClose: () => setApiKeyToEdit(null), apiKeyName: apiKeyToEdit, tenantKey: tenantKey }))] }));
|
|
186320
|
+
}
|
|
186321
|
+
|
|
186322
|
+
function useCopyToClipboard(timeout = 500) {
|
|
186323
|
+
const [status, setStatus] = useState('idle');
|
|
186324
|
+
const copy = useCallback(async (text) => {
|
|
186325
|
+
if (!(navigator === null || navigator === void 0 ? void 0 : navigator.clipboard)) {
|
|
186326
|
+
console.warn('Clipboard not supported');
|
|
186327
|
+
return;
|
|
186328
|
+
}
|
|
186329
|
+
// Try to save to clipboard then save it in the state if worked
|
|
186330
|
+
try {
|
|
186331
|
+
await navigator.clipboard.writeText(text);
|
|
186332
|
+
setStatus('success');
|
|
186333
|
+
setTimeout(() => {
|
|
186334
|
+
setStatus('idle');
|
|
186335
|
+
}, timeout);
|
|
186336
|
+
return;
|
|
186337
|
+
}
|
|
186338
|
+
catch (_a) {
|
|
186339
|
+
//Sentry.captureException(String(error));
|
|
186340
|
+
setStatus('error');
|
|
186341
|
+
return;
|
|
186342
|
+
}
|
|
186343
|
+
}, [timeout]);
|
|
186344
|
+
return { copy, status };
|
|
186345
|
+
}
|
|
186346
|
+
|
|
186347
|
+
function ApiKeyModal$1({ isOpen, onClose, apiKey }) {
|
|
186348
|
+
const t = useT();
|
|
186349
|
+
const { copy, status } = useCopyToClipboard(800);
|
|
186350
|
+
const Icon = status === 'success' ? Check : Copy;
|
|
186351
|
+
return (jsx(Dialog, { open: isOpen, onOpenChange: onClose, children: jsxs(DialogContent, { children: [jsx(DialogHeader, { children: jsx(DialogTitle, { className: "ibl-dialog-title", children: t('apiTabApiKeyModal.title') }) }), jsx(DialogDescription, { className: "sr-only", children: t('apiTabApiKeyModal.dialogDescription') }), jsxs("div", { className: "grid gap-6", children: [jsxs("p", { className: "text-sm text-muted-foreground grid gap-2", children: [jsx("span", { children: t('apiTabApiKeyModal.securityWarning') }), jsx("span", { children: t('apiTabApiKeyModal.lostKeyWarning') })] }), jsxs("div", { className: "flex items-center gap-4", children: [jsx(Input, { defaultValue: apiKey, readOnly: true }), jsx(Button$1, { size: "icon", className: "ibl-button-primary cursor-pointer", onClick: () => copy(apiKey), children: jsx(Icon, { className: "h-4 w-4" }) })] })] })] }) }));
|
|
186352
|
+
}
|
|
186353
|
+
|
|
186354
|
+
const NAME_FIELD_ID = 'create-api-key-name';
|
|
186355
|
+
const NAME_ERROR_ID = 'create-api-key-name-error';
|
|
185124
186356
|
const createApiFormSchema = z$2.object({
|
|
185125
186357
|
name: z$2
|
|
185126
186358
|
.string()
|
|
@@ -185132,28 +186364,29 @@ const createApiFormDefaultValues$1 = {
|
|
|
185132
186364
|
name: '',
|
|
185133
186365
|
expiration_date: null,
|
|
185134
186366
|
};
|
|
185135
|
-
function daysFromCurrentDate$1(targetDate) {
|
|
185136
|
-
const currentDate = new Date();
|
|
185137
|
-
const oneDay = 24 * 60 * 60 * 1000; // Number of milliseconds in a day
|
|
185138
|
-
const timeDifference = targetDate.getTime() - currentDate.getTime();
|
|
185139
|
-
const daysDifference = Math.ceil(timeDifference / oneDay);
|
|
185140
|
-
return daysDifference * 24 * 3600; // Number of seconds in a day
|
|
185141
|
-
}
|
|
185142
186367
|
function CreateApiModal$1({ isOpen, onClose, tenantKey, username }) {
|
|
185143
186368
|
const t = useT();
|
|
185144
186369
|
const [apiKey, setApiKey] = React__default.useState(null);
|
|
185145
|
-
const [
|
|
186370
|
+
const [mode, setMode] = React__default.useState(API_TOKEN_MODES.OWNER);
|
|
186371
|
+
const [policies, setPolicies] = React__default.useState([]);
|
|
186372
|
+
const [groups, setGroups] = React__default.useState([]);
|
|
185146
186373
|
const [createApiKey, { isLoading }] = useCreateApiKeyMutation();
|
|
186374
|
+
const { data: fieldPermissionsData, isError: isFieldPermissionsError, isLoading: isFieldPermissionsLoading, } = useGetApiKeyFieldPermissionsQuery({ platformKey: tenantKey }, { skip: !isOpen || !tenantKey });
|
|
186375
|
+
const fieldPermissions = isFieldPermissionsError
|
|
186376
|
+
? DENIED_TOKEN_POLICY_PERMISSIONS
|
|
186377
|
+
: fieldPermissionsData;
|
|
185147
186378
|
const form = useForm({
|
|
185148
186379
|
defaultValues: createApiFormDefaultValues$1,
|
|
185149
186380
|
validators: {
|
|
186381
|
+
// `onMount` runs the schema against the empty defaults so the required
|
|
186382
|
+
// name keeps Submit disabled from the start, rather than letting the
|
|
186383
|
+
// first click on a pristine form fail silently.
|
|
186384
|
+
onMount: createApiFormSchema,
|
|
185150
186385
|
onChange: createApiFormSchema,
|
|
185151
186386
|
},
|
|
185152
186387
|
onSubmit: async ({ value }) => {
|
|
185153
186388
|
try {
|
|
185154
|
-
const expirationSeconds = value.expiration_date
|
|
185155
|
-
? daysFromCurrentDate$1(value.expiration_date)
|
|
185156
|
-
: 0;
|
|
186389
|
+
const expirationSeconds = value.expiration_date ? secondsUntil(value.expiration_date) : 0;
|
|
185157
186390
|
const response = await createApiKey({
|
|
185158
186391
|
requestBody: {
|
|
185159
186392
|
username: username !== null && username !== void 0 ? username : '',
|
|
@@ -185163,11 +186396,18 @@ function CreateApiModal$1({ isOpen, onClose, tenantKey, username }) {
|
|
|
185163
186396
|
created: new Date().toISOString(),
|
|
185164
186397
|
expires: expirationSeconds === 0 ? '' : expirationSeconds.toString(),
|
|
185165
186398
|
expires_in: expirationSeconds === 0 ? undefined : expirationSeconds.toString(),
|
|
186399
|
+
...buildTokenPolicyPayload({ mode, policies, groups, fieldPermissions }),
|
|
185166
186400
|
},
|
|
185167
186401
|
}).unwrap();
|
|
185168
186402
|
toast.success(t('apiTabCreateApiModal2.apiKeyCreatedSuccessfully'));
|
|
185169
186403
|
form.reset();
|
|
186404
|
+
setMode(API_TOKEN_MODES.OWNER);
|
|
186405
|
+
setPolicies([]);
|
|
186406
|
+
setGroups([]);
|
|
186407
|
+
// The generated key lives outside this dialog, so closing the creation
|
|
186408
|
+
// form still leaves it on screen for the one time it is readable.
|
|
185170
186409
|
setApiKey(response.key);
|
|
186410
|
+
onClose();
|
|
185171
186411
|
}
|
|
185172
186412
|
catch (error) {
|
|
185173
186413
|
console.error(JSON.stringify(error));
|
|
@@ -185176,24 +186416,23 @@ function CreateApiModal$1({ isOpen, onClose, tenantKey, username }) {
|
|
|
185176
186416
|
}
|
|
185177
186417
|
},
|
|
185178
186418
|
});
|
|
185179
|
-
return (jsxs(Fragment$1, { children: [jsx(Dialog, { open: isOpen, onOpenChange: isLoading ? undefined : onClose, children: jsxs(DialogContent, { "aria-describedby": "api-key-creation-description", className: "w-full max-w-md", children: [jsx(DialogDescription, { className: "sr-only", children: t('apiTabCreateApiModal2.createApiKey') }), jsx(DialogHeader, { children: jsx(DialogTitle, { className: "ibl-dialog-title", children: t('apiTabCreateApiModal2.createApiKey') }) }), jsxs("form", { onSubmit: (formEvent) => {
|
|
186419
|
+
return (jsxs(Fragment$1, { children: [jsx(Dialog, { open: isOpen, onOpenChange: isLoading ? undefined : onClose, children: jsxs(DialogContent, { "aria-describedby": "api-key-creation-description", className: "w-full max-w-md max-h-[85vh] overflow-y-auto", children: [jsx(DialogDescription, { className: "sr-only", children: t('apiTabCreateApiModal2.createApiKey') }), jsx(DialogHeader, { children: jsx(DialogTitle, { className: "ibl-dialog-title", children: t('apiTabCreateApiModal2.createApiKey') }) }), jsxs("form", { onSubmit: (formEvent) => {
|
|
185180
186420
|
formEvent.preventDefault();
|
|
185181
186421
|
formEvent.stopPropagation();
|
|
185182
186422
|
form.handleSubmit();
|
|
185183
|
-
}, className: "mt-5 grid gap-5", children: [jsx(form.Field, { name: "name", children: (field) => {
|
|
185184
|
-
var _a
|
|
185185
|
-
const
|
|
185186
|
-
|
|
185187
|
-
|
|
185188
|
-
|
|
185189
|
-
|
|
185190
|
-
|
|
185191
|
-
|
|
185192
|
-
field.handleChange(date !== null && date !== void 0 ? date : null);
|
|
185193
|
-
setIsCalendarOpen(false);
|
|
185194
|
-
}, disabled: (date) => date && date < new Date() }) }))] })] })) }), jsx(DialogFooter, { className: "justify-end", children: jsx(form.Subscribe, { selector: (state) => ({
|
|
186423
|
+
}, className: "mt-5 grid min-w-0 gap-5", children: [jsx(form.Field, { name: "name", children: (field) => {
|
|
186424
|
+
var _a;
|
|
186425
|
+
const errorMessage = (_a = field.state.meta.errors[0]) === null || _a === void 0 ? void 0 : _a.message;
|
|
186426
|
+
// Wait for the user to engage with the field — typing or tabbing
|
|
186427
|
+
// away — before flagging it, so an untouched form is not red on
|
|
186428
|
+
// open, but an emptied or skipped field always explains itself.
|
|
186429
|
+
const showError = Boolean(errorMessage && (field.state.meta.isDirty || field.state.meta.isBlurred));
|
|
186430
|
+
return (jsxs("div", { className: "space-y-1.5", children: [jsxs(Label$1, { htmlFor: NAME_FIELD_ID, className: "flex items-center text-sm font-medium text-[#646464]", children: [t('apiTabCreateApiModal2.apiKeyName'), jsx("span", { className: "ml-1 text-red-500", children: "*" })] }), jsx(Input, { id: NAME_FIELD_ID, placeholder: t('apiTabCreateApiModal2.apiKeyNamePlaceholder'), value: field.state.value, onChange: (event) => field.handleChange(event.target.value), onBlur: field.handleBlur, autoComplete: "off", "aria-required": "true", "aria-invalid": showError, "aria-describedby": showError ? NAME_ERROR_ID : undefined }), showError && (jsx("p", { id: NAME_ERROR_ID, role: "alert", className: "text-red-500 text-xs", children: errorMessage }))] }));
|
|
186431
|
+
} }), jsx(form.Field, { name: "expiration_date", children: (field) => (jsx(ExpirationDateField, { value: field.state.value, onChange: (date) => field.handleChange(date) })) }), !isFieldPermissionsLoading && (jsx(TokenPolicyFields, { tenantKey: tenantKey, mode: mode, onModeChange: setMode, policies: policies, onPoliciesChange: setPolicies, groups: groups, onGroupsChange: setGroups, fieldPermissions: fieldPermissions, idPrefix: "create-api-key" })), jsx(DialogFooter, { className: "justify-end", children: jsx(form.Subscribe, { selector: (state) => ({
|
|
185195
186432
|
canSubmit: state.canSubmit,
|
|
185196
|
-
}), children: ({ canSubmit }) => (jsx(Button$1, { type: "submit", disabled: !canSubmit || isLoading, className: "bg-gradient-to-r from-[#2563EB] to-[#93C5FD] text-white hover:opacity-90", children: isLoading
|
|
186433
|
+
}), children: ({ canSubmit }) => (jsx(Button$1, { type: "submit", disabled: !canSubmit || isLoading, className: "bg-gradient-to-r from-[#2563EB] to-[#93C5FD] text-white hover:opacity-90", children: isLoading
|
|
186434
|
+
? t('apiTabLabels.createModal.submitting')
|
|
186435
|
+
: t('apiTabLabels.createModal.submit') })) }) })] })] }) }), apiKey && jsx(ApiKeyModal$1, { isOpen: true, onClose: () => setApiKey(null), apiKey: apiKey })] }));
|
|
185197
186436
|
}
|
|
185198
186437
|
|
|
185199
186438
|
// Dynamic schema based on selected provider
|
|
@@ -213981,11 +215220,11 @@ class Branch {
|
|
|
213981
215220
|
return;
|
|
213982
215221
|
}
|
|
213983
215222
|
if (remap) {
|
|
213984
|
-
addBefore.push(new Item
|
|
215223
|
+
addBefore.push(new Item(item.map));
|
|
213985
215224
|
let step = item.step.map(remap.slice(mapFrom)), map;
|
|
213986
215225
|
if (step && transform.maybeStep(step).doc) {
|
|
213987
215226
|
map = transform.mapping.maps[transform.mapping.maps.length - 1];
|
|
213988
|
-
addAfter.push(new Item
|
|
215227
|
+
addAfter.push(new Item(map, undefined, undefined, addAfter.length + addBefore.length));
|
|
213989
215228
|
}
|
|
213990
215229
|
mapFrom--;
|
|
213991
215230
|
if (map)
|
|
@@ -214008,7 +215247,7 @@ class Branch {
|
|
|
214008
215247
|
let oldItems = this.items, lastItem = !preserveItems && oldItems.length ? oldItems.get(oldItems.length - 1) : null;
|
|
214009
215248
|
for (let i = 0; i < transform.steps.length; i++) {
|
|
214010
215249
|
let step = transform.steps[i].invert(transform.docs[i]);
|
|
214011
|
-
let item = new Item
|
|
215250
|
+
let item = new Item(transform.mapping.maps[i], step, selection), merged;
|
|
214012
215251
|
if (merged = lastItem && lastItem.merge(item)) {
|
|
214013
215252
|
item = merged;
|
|
214014
215253
|
if (i)
|
|
@@ -214043,7 +215282,7 @@ class Branch {
|
|
|
214043
215282
|
addMaps(array) {
|
|
214044
215283
|
if (this.eventCount == 0)
|
|
214045
215284
|
return this;
|
|
214046
|
-
return new Branch(this.items.append(array.map(map => new Item
|
|
215285
|
+
return new Branch(this.items.append(array.map(map => new Item(map))), this.eventCount);
|
|
214047
215286
|
}
|
|
214048
215287
|
// When the collab module receives remote changes, the history has
|
|
214049
215288
|
// to know about those, so that it can adjust the steps that were
|
|
@@ -214070,15 +215309,15 @@ class Branch {
|
|
|
214070
215309
|
let selection = item.selection && item.selection.map(mapping.slice(iRebased + 1, pos));
|
|
214071
215310
|
if (selection)
|
|
214072
215311
|
eventCount++;
|
|
214073
|
-
rebasedItems.push(new Item
|
|
215312
|
+
rebasedItems.push(new Item(map, step, selection));
|
|
214074
215313
|
}
|
|
214075
215314
|
else {
|
|
214076
|
-
rebasedItems.push(new Item
|
|
215315
|
+
rebasedItems.push(new Item(map));
|
|
214077
215316
|
}
|
|
214078
215317
|
}, start);
|
|
214079
215318
|
let newMaps = [];
|
|
214080
215319
|
for (let i = rebasedCount; i < newUntil; i++)
|
|
214081
|
-
newMaps.push(new Item
|
|
215320
|
+
newMaps.push(new Item(mapping.maps[i]));
|
|
214082
215321
|
let items = this.items.slice(0, start).append(newMaps).append(rebasedItems);
|
|
214083
215322
|
let branch = new Branch(items, eventCount);
|
|
214084
215323
|
if (branch.emptyItemCount() > max_empty_items)
|
|
@@ -214115,7 +215354,7 @@ class Branch {
|
|
|
214115
215354
|
let selection = item.selection && item.selection.map(remap.slice(mapFrom));
|
|
214116
215355
|
if (selection)
|
|
214117
215356
|
events++;
|
|
214118
|
-
let newItem = new Item
|
|
215357
|
+
let newItem = new Item(map.invert(), step, selection), merged, last = items.length - 1;
|
|
214119
215358
|
if (merged = items.length && items[last].merge(newItem))
|
|
214120
215359
|
items[last] = merged;
|
|
214121
215360
|
else
|
|
@@ -214140,7 +215379,7 @@ function cutOffEvents(items, n) {
|
|
|
214140
215379
|
});
|
|
214141
215380
|
return items.slice(cutPoint);
|
|
214142
215381
|
}
|
|
214143
|
-
|
|
215382
|
+
class Item {
|
|
214144
215383
|
constructor(
|
|
214145
215384
|
// The (forward) step map for this item.
|
|
214146
215385
|
map,
|
|
@@ -214165,7 +215404,7 @@ let Item$1 = class Item {
|
|
|
214165
215404
|
return new Item(step.getMap().invert(), step, this.selection);
|
|
214166
215405
|
}
|
|
214167
215406
|
}
|
|
214168
|
-
}
|
|
215407
|
+
}
|
|
214169
215408
|
// The value of the state field that tracks undo/redo history for that
|
|
214170
215409
|
// state. Will be stored in the plugin state when the history plugin
|
|
214171
215410
|
// is active.
|
|
@@ -215332,67 +216571,6 @@ var index_default$4 = TextAlign;
|
|
|
215332
216571
|
// src/index.ts
|
|
215333
216572
|
var index_default$3 = Placeholder;
|
|
215334
216573
|
|
|
215335
|
-
// packages/core/primitive/src/primitive.tsx
|
|
215336
|
-
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
215337
|
-
return function handleEvent(event) {
|
|
215338
|
-
originalEventHandler?.(event);
|
|
215339
|
-
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
|
|
215340
|
-
return ourEventHandler?.(event);
|
|
215341
|
-
}
|
|
215342
|
-
};
|
|
215343
|
-
}
|
|
215344
|
-
|
|
215345
|
-
// packages/react/use-callback-ref/src/useCallbackRef.tsx
|
|
215346
|
-
function useCallbackRef(callback) {
|
|
215347
|
-
const callbackRef = React.useRef(callback);
|
|
215348
|
-
React.useEffect(() => {
|
|
215349
|
-
callbackRef.current = callback;
|
|
215350
|
-
});
|
|
215351
|
-
return React.useMemo(() => (...args) => callbackRef.current?.(...args), []);
|
|
215352
|
-
}
|
|
215353
|
-
|
|
215354
|
-
// packages/react/use-controllable-state/src/useControllableState.tsx
|
|
215355
|
-
function useControllableState({
|
|
215356
|
-
prop,
|
|
215357
|
-
defaultProp,
|
|
215358
|
-
onChange = () => {
|
|
215359
|
-
}
|
|
215360
|
-
}) {
|
|
215361
|
-
const [uncontrolledProp, setUncontrolledProp] = useUncontrolledState({ defaultProp, onChange });
|
|
215362
|
-
const isControlled = prop !== void 0;
|
|
215363
|
-
const value = isControlled ? prop : uncontrolledProp;
|
|
215364
|
-
const handleChange = useCallbackRef(onChange);
|
|
215365
|
-
const setValue = React.useCallback(
|
|
215366
|
-
(nextValue) => {
|
|
215367
|
-
if (isControlled) {
|
|
215368
|
-
const setter = nextValue;
|
|
215369
|
-
const value2 = typeof nextValue === "function" ? setter(prop) : nextValue;
|
|
215370
|
-
if (value2 !== prop) handleChange(value2);
|
|
215371
|
-
} else {
|
|
215372
|
-
setUncontrolledProp(nextValue);
|
|
215373
|
-
}
|
|
215374
|
-
},
|
|
215375
|
-
[isControlled, prop, setUncontrolledProp, handleChange]
|
|
215376
|
-
);
|
|
215377
|
-
return [value, setValue];
|
|
215378
|
-
}
|
|
215379
|
-
function useUncontrolledState({
|
|
215380
|
-
defaultProp,
|
|
215381
|
-
onChange
|
|
215382
|
-
}) {
|
|
215383
|
-
const uncontrolledState = React.useState(defaultProp);
|
|
215384
|
-
const [value] = uncontrolledState;
|
|
215385
|
-
const prevValueRef = React.useRef(value);
|
|
215386
|
-
const handleChange = useCallbackRef(onChange);
|
|
215387
|
-
React.useEffect(() => {
|
|
215388
|
-
if (prevValueRef.current !== value) {
|
|
215389
|
-
handleChange(value);
|
|
215390
|
-
prevValueRef.current = value;
|
|
215391
|
-
}
|
|
215392
|
-
}, [value, prevValueRef, handleChange]);
|
|
215393
|
-
return uncontrolledState;
|
|
215394
|
-
}
|
|
215395
|
-
|
|
215396
216574
|
var NAME$3 = "Toggle";
|
|
215397
216575
|
var Toggle$1 = React.forwardRef((props, forwardedRef) => {
|
|
215398
216576
|
const { pressed: pressedProp, defaultPressed = false, onPressedChange, ...buttonProps } = props;
|
|
@@ -215419,7 +216597,7 @@ var Toggle$1 = React.forwardRef((props, forwardedRef) => {
|
|
|
215419
216597
|
);
|
|
215420
216598
|
});
|
|
215421
216599
|
Toggle$1.displayName = NAME$3;
|
|
215422
|
-
var Root$
|
|
216600
|
+
var Root$3 = Toggle$1;
|
|
215423
216601
|
|
|
215424
216602
|
const toggleVariants = cva('inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground', {
|
|
215425
216603
|
variants: {
|
|
@@ -215438,8 +216616,8 @@ const toggleVariants = cva('inline-flex items-center justify-center rounded-md t
|
|
|
215438
216616
|
size: 'default',
|
|
215439
216617
|
},
|
|
215440
216618
|
});
|
|
215441
|
-
const Toggle = React.forwardRef(({ className, variant, size, ...props }, ref) => (jsx(Root$
|
|
215442
|
-
Toggle.displayName = Root$
|
|
216619
|
+
const Toggle = React.forwardRef(({ className, variant, size, ...props }, ref) => (jsx(Root$3, { ref: ref, className: cn(toggleVariants({ variant, size, className })), ...props })));
|
|
216620
|
+
Toggle.displayName = Root$3.displayName;
|
|
215443
216621
|
|
|
215444
216622
|
// src/separator.tsx
|
|
215445
216623
|
var NAME$2 = "Separator";
|
|
@@ -215464,10 +216642,10 @@ Separator$1.displayName = NAME$2;
|
|
|
215464
216642
|
function isValidOrientation(orientation) {
|
|
215465
216643
|
return ORIENTATIONS.includes(orientation);
|
|
215466
216644
|
}
|
|
215467
|
-
var Root$
|
|
216645
|
+
var Root$2 = Separator$1;
|
|
215468
216646
|
|
|
215469
|
-
const Separator = React.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => (jsx(Root$
|
|
215470
|
-
Separator.displayName = Root$
|
|
216647
|
+
const Separator = React.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => (jsx(Root$2, { ref: ref, decorative: decorative, orientation: orientation, className: cn("shrink-0 bg-border", orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]", className), ...props })));
|
|
216648
|
+
Separator.displayName = Root$2.displayName;
|
|
215471
216649
|
|
|
215472
216650
|
// Custom Div extension to preserve div elements with inline styles
|
|
215473
216651
|
const Div = Node3.create({
|
|
@@ -216017,729 +217195,6 @@ function TenantSwitcher({ currentTenantKey, tenants, visitingTenant, onTenantCha
|
|
|
216017
217195
|
tenantList.map((tenant) => (jsx(SelectItem, { value: tenant === null || tenant === void 0 ? void 0 : tenant.key, children: (tenant === null || tenant === void 0 ? void 0 : tenant.name) || (tenant === null || tenant === void 0 ? void 0 : tenant.key) }, tenant === null || tenant === void 0 ? void 0 : tenant.key))) })] }))] }) }));
|
|
216018
217196
|
}
|
|
216019
217197
|
|
|
216020
|
-
function createCollection(name) {
|
|
216021
|
-
const PROVIDER_NAME = name + "CollectionProvider";
|
|
216022
|
-
const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);
|
|
216023
|
-
const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(
|
|
216024
|
-
PROVIDER_NAME,
|
|
216025
|
-
{ collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
|
|
216026
|
-
);
|
|
216027
|
-
const CollectionProvider = (props) => {
|
|
216028
|
-
const { scope, children } = props;
|
|
216029
|
-
const ref = React__default.useRef(null);
|
|
216030
|
-
const itemMap = React__default.useRef(/* @__PURE__ */ new Map()).current;
|
|
216031
|
-
return /* @__PURE__ */ jsx(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
|
|
216032
|
-
};
|
|
216033
|
-
CollectionProvider.displayName = PROVIDER_NAME;
|
|
216034
|
-
const COLLECTION_SLOT_NAME = name + "CollectionSlot";
|
|
216035
|
-
const CollectionSlot = React__default.forwardRef(
|
|
216036
|
-
(props, forwardedRef) => {
|
|
216037
|
-
const { scope, children } = props;
|
|
216038
|
-
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
|
|
216039
|
-
const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);
|
|
216040
|
-
return /* @__PURE__ */ jsx(Slot$1, { ref: composedRefs, children });
|
|
216041
|
-
}
|
|
216042
|
-
);
|
|
216043
|
-
CollectionSlot.displayName = COLLECTION_SLOT_NAME;
|
|
216044
|
-
const ITEM_SLOT_NAME = name + "CollectionItemSlot";
|
|
216045
|
-
const ITEM_DATA_ATTR = "data-radix-collection-item";
|
|
216046
|
-
const CollectionItemSlot = React__default.forwardRef(
|
|
216047
|
-
(props, forwardedRef) => {
|
|
216048
|
-
const { scope, children, ...itemData } = props;
|
|
216049
|
-
const ref = React__default.useRef(null);
|
|
216050
|
-
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
216051
|
-
const context = useCollectionContext(ITEM_SLOT_NAME, scope);
|
|
216052
|
-
React__default.useEffect(() => {
|
|
216053
|
-
context.itemMap.set(ref, { ref, ...itemData });
|
|
216054
|
-
return () => void context.itemMap.delete(ref);
|
|
216055
|
-
});
|
|
216056
|
-
return /* @__PURE__ */ jsx(Slot$1, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
|
|
216057
|
-
}
|
|
216058
|
-
);
|
|
216059
|
-
CollectionItemSlot.displayName = ITEM_SLOT_NAME;
|
|
216060
|
-
function useCollection(scope) {
|
|
216061
|
-
const context = useCollectionContext(name + "CollectionConsumer", scope);
|
|
216062
|
-
const getItems = React__default.useCallback(() => {
|
|
216063
|
-
const collectionNode = context.collectionRef.current;
|
|
216064
|
-
if (!collectionNode) return [];
|
|
216065
|
-
const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
|
|
216066
|
-
const items = Array.from(context.itemMap.values());
|
|
216067
|
-
const orderedItems = items.sort(
|
|
216068
|
-
(a, b) => orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current)
|
|
216069
|
-
);
|
|
216070
|
-
return orderedItems;
|
|
216071
|
-
}, [context.collectionRef, context.itemMap]);
|
|
216072
|
-
return getItems;
|
|
216073
|
-
}
|
|
216074
|
-
return [
|
|
216075
|
-
{ Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },
|
|
216076
|
-
useCollection,
|
|
216077
|
-
createCollectionScope
|
|
216078
|
-
];
|
|
216079
|
-
}
|
|
216080
|
-
|
|
216081
|
-
// packages/react/use-layout-effect/src/useLayoutEffect.tsx
|
|
216082
|
-
var useLayoutEffect2 = Boolean(globalThis?.document) ? React.useLayoutEffect : () => {
|
|
216083
|
-
};
|
|
216084
|
-
|
|
216085
|
-
// packages/react/id/src/id.tsx
|
|
216086
|
-
var useReactId = React["useId".toString()] || (() => void 0);
|
|
216087
|
-
var count = 0;
|
|
216088
|
-
function useId(deterministicId) {
|
|
216089
|
-
const [id, setId] = React.useState(useReactId());
|
|
216090
|
-
useLayoutEffect2(() => {
|
|
216091
|
-
setId((reactId) => reactId ?? String(count++));
|
|
216092
|
-
}, [deterministicId]);
|
|
216093
|
-
return (id ? `radix-${id}` : "");
|
|
216094
|
-
}
|
|
216095
|
-
|
|
216096
|
-
// packages/react/direction/src/Direction.tsx
|
|
216097
|
-
var DirectionContext = React.createContext(void 0);
|
|
216098
|
-
function useDirection(localDir) {
|
|
216099
|
-
const globalDir = React.useContext(DirectionContext);
|
|
216100
|
-
return localDir || globalDir || "ltr";
|
|
216101
|
-
}
|
|
216102
|
-
|
|
216103
|
-
var ENTRY_FOCUS = "rovingFocusGroup.onEntryFocus";
|
|
216104
|
-
var EVENT_OPTIONS = { bubbles: false, cancelable: true };
|
|
216105
|
-
var GROUP_NAME = "RovingFocusGroup";
|
|
216106
|
-
var [Collection, useCollection, createCollectionScope] = createCollection(GROUP_NAME);
|
|
216107
|
-
var [createRovingFocusGroupContext, createRovingFocusGroupScope] = createContextScope(
|
|
216108
|
-
GROUP_NAME,
|
|
216109
|
-
[createCollectionScope]
|
|
216110
|
-
);
|
|
216111
|
-
var [RovingFocusProvider, useRovingFocusContext] = createRovingFocusGroupContext(GROUP_NAME);
|
|
216112
|
-
var RovingFocusGroup = React.forwardRef(
|
|
216113
|
-
(props, forwardedRef) => {
|
|
216114
|
-
return /* @__PURE__ */ jsx(Collection.Provider, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx(Collection.Slot, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx(RovingFocusGroupImpl, { ...props, ref: forwardedRef }) }) });
|
|
216115
|
-
}
|
|
216116
|
-
);
|
|
216117
|
-
RovingFocusGroup.displayName = GROUP_NAME;
|
|
216118
|
-
var RovingFocusGroupImpl = React.forwardRef((props, forwardedRef) => {
|
|
216119
|
-
const {
|
|
216120
|
-
__scopeRovingFocusGroup,
|
|
216121
|
-
orientation,
|
|
216122
|
-
loop = false,
|
|
216123
|
-
dir,
|
|
216124
|
-
currentTabStopId: currentTabStopIdProp,
|
|
216125
|
-
defaultCurrentTabStopId,
|
|
216126
|
-
onCurrentTabStopIdChange,
|
|
216127
|
-
onEntryFocus,
|
|
216128
|
-
preventScrollOnEntryFocus = false,
|
|
216129
|
-
...groupProps
|
|
216130
|
-
} = props;
|
|
216131
|
-
const ref = React.useRef(null);
|
|
216132
|
-
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
216133
|
-
const direction = useDirection(dir);
|
|
216134
|
-
const [currentTabStopId = null, setCurrentTabStopId] = useControllableState({
|
|
216135
|
-
prop: currentTabStopIdProp,
|
|
216136
|
-
defaultProp: defaultCurrentTabStopId,
|
|
216137
|
-
onChange: onCurrentTabStopIdChange
|
|
216138
|
-
});
|
|
216139
|
-
const [isTabbingBackOut, setIsTabbingBackOut] = React.useState(false);
|
|
216140
|
-
const handleEntryFocus = useCallbackRef(onEntryFocus);
|
|
216141
|
-
const getItems = useCollection(__scopeRovingFocusGroup);
|
|
216142
|
-
const isClickFocusRef = React.useRef(false);
|
|
216143
|
-
const [focusableItemsCount, setFocusableItemsCount] = React.useState(0);
|
|
216144
|
-
React.useEffect(() => {
|
|
216145
|
-
const node = ref.current;
|
|
216146
|
-
if (node) {
|
|
216147
|
-
node.addEventListener(ENTRY_FOCUS, handleEntryFocus);
|
|
216148
|
-
return () => node.removeEventListener(ENTRY_FOCUS, handleEntryFocus);
|
|
216149
|
-
}
|
|
216150
|
-
}, [handleEntryFocus]);
|
|
216151
|
-
return /* @__PURE__ */ jsx(
|
|
216152
|
-
RovingFocusProvider,
|
|
216153
|
-
{
|
|
216154
|
-
scope: __scopeRovingFocusGroup,
|
|
216155
|
-
orientation,
|
|
216156
|
-
dir: direction,
|
|
216157
|
-
loop,
|
|
216158
|
-
currentTabStopId,
|
|
216159
|
-
onItemFocus: React.useCallback(
|
|
216160
|
-
(tabStopId) => setCurrentTabStopId(tabStopId),
|
|
216161
|
-
[setCurrentTabStopId]
|
|
216162
|
-
),
|
|
216163
|
-
onItemShiftTab: React.useCallback(() => setIsTabbingBackOut(true), []),
|
|
216164
|
-
onFocusableItemAdd: React.useCallback(
|
|
216165
|
-
() => setFocusableItemsCount((prevCount) => prevCount + 1),
|
|
216166
|
-
[]
|
|
216167
|
-
),
|
|
216168
|
-
onFocusableItemRemove: React.useCallback(
|
|
216169
|
-
() => setFocusableItemsCount((prevCount) => prevCount - 1),
|
|
216170
|
-
[]
|
|
216171
|
-
),
|
|
216172
|
-
children: /* @__PURE__ */ jsx(
|
|
216173
|
-
Primitive$1.div,
|
|
216174
|
-
{
|
|
216175
|
-
tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,
|
|
216176
|
-
"data-orientation": orientation,
|
|
216177
|
-
...groupProps,
|
|
216178
|
-
ref: composedRefs,
|
|
216179
|
-
style: { outline: "none", ...props.style },
|
|
216180
|
-
onMouseDown: composeEventHandlers(props.onMouseDown, () => {
|
|
216181
|
-
isClickFocusRef.current = true;
|
|
216182
|
-
}),
|
|
216183
|
-
onFocus: composeEventHandlers(props.onFocus, (event) => {
|
|
216184
|
-
const isKeyboardFocus = !isClickFocusRef.current;
|
|
216185
|
-
if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut) {
|
|
216186
|
-
const entryFocusEvent = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS);
|
|
216187
|
-
event.currentTarget.dispatchEvent(entryFocusEvent);
|
|
216188
|
-
if (!entryFocusEvent.defaultPrevented) {
|
|
216189
|
-
const items = getItems().filter((item) => item.focusable);
|
|
216190
|
-
const activeItem = items.find((item) => item.active);
|
|
216191
|
-
const currentItem = items.find((item) => item.id === currentTabStopId);
|
|
216192
|
-
const candidateItems = [activeItem, currentItem, ...items].filter(
|
|
216193
|
-
Boolean
|
|
216194
|
-
);
|
|
216195
|
-
const candidateNodes = candidateItems.map((item) => item.ref.current);
|
|
216196
|
-
focusFirst(candidateNodes, preventScrollOnEntryFocus);
|
|
216197
|
-
}
|
|
216198
|
-
}
|
|
216199
|
-
isClickFocusRef.current = false;
|
|
216200
|
-
}),
|
|
216201
|
-
onBlur: composeEventHandlers(props.onBlur, () => setIsTabbingBackOut(false))
|
|
216202
|
-
}
|
|
216203
|
-
)
|
|
216204
|
-
}
|
|
216205
|
-
);
|
|
216206
|
-
});
|
|
216207
|
-
var ITEM_NAME$1 = "RovingFocusGroupItem";
|
|
216208
|
-
var RovingFocusGroupItem = React.forwardRef(
|
|
216209
|
-
(props, forwardedRef) => {
|
|
216210
|
-
const {
|
|
216211
|
-
__scopeRovingFocusGroup,
|
|
216212
|
-
focusable = true,
|
|
216213
|
-
active = false,
|
|
216214
|
-
tabStopId,
|
|
216215
|
-
...itemProps
|
|
216216
|
-
} = props;
|
|
216217
|
-
const autoId = useId();
|
|
216218
|
-
const id = tabStopId || autoId;
|
|
216219
|
-
const context = useRovingFocusContext(ITEM_NAME$1, __scopeRovingFocusGroup);
|
|
216220
|
-
const isCurrentTabStop = context.currentTabStopId === id;
|
|
216221
|
-
const getItems = useCollection(__scopeRovingFocusGroup);
|
|
216222
|
-
const { onFocusableItemAdd, onFocusableItemRemove } = context;
|
|
216223
|
-
React.useEffect(() => {
|
|
216224
|
-
if (focusable) {
|
|
216225
|
-
onFocusableItemAdd();
|
|
216226
|
-
return () => onFocusableItemRemove();
|
|
216227
|
-
}
|
|
216228
|
-
}, [focusable, onFocusableItemAdd, onFocusableItemRemove]);
|
|
216229
|
-
return /* @__PURE__ */ jsx(
|
|
216230
|
-
Collection.ItemSlot,
|
|
216231
|
-
{
|
|
216232
|
-
scope: __scopeRovingFocusGroup,
|
|
216233
|
-
id,
|
|
216234
|
-
focusable,
|
|
216235
|
-
active,
|
|
216236
|
-
children: /* @__PURE__ */ jsx(
|
|
216237
|
-
Primitive$1.span,
|
|
216238
|
-
{
|
|
216239
|
-
tabIndex: isCurrentTabStop ? 0 : -1,
|
|
216240
|
-
"data-orientation": context.orientation,
|
|
216241
|
-
...itemProps,
|
|
216242
|
-
ref: forwardedRef,
|
|
216243
|
-
onMouseDown: composeEventHandlers(props.onMouseDown, (event) => {
|
|
216244
|
-
if (!focusable) event.preventDefault();
|
|
216245
|
-
else context.onItemFocus(id);
|
|
216246
|
-
}),
|
|
216247
|
-
onFocus: composeEventHandlers(props.onFocus, () => context.onItemFocus(id)),
|
|
216248
|
-
onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
|
|
216249
|
-
if (event.key === "Tab" && event.shiftKey) {
|
|
216250
|
-
context.onItemShiftTab();
|
|
216251
|
-
return;
|
|
216252
|
-
}
|
|
216253
|
-
if (event.target !== event.currentTarget) return;
|
|
216254
|
-
const focusIntent = getFocusIntent(event, context.orientation, context.dir);
|
|
216255
|
-
if (focusIntent !== void 0) {
|
|
216256
|
-
if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return;
|
|
216257
|
-
event.preventDefault();
|
|
216258
|
-
const items = getItems().filter((item) => item.focusable);
|
|
216259
|
-
let candidateNodes = items.map((item) => item.ref.current);
|
|
216260
|
-
if (focusIntent === "last") candidateNodes.reverse();
|
|
216261
|
-
else if (focusIntent === "prev" || focusIntent === "next") {
|
|
216262
|
-
if (focusIntent === "prev") candidateNodes.reverse();
|
|
216263
|
-
const currentIndex = candidateNodes.indexOf(event.currentTarget);
|
|
216264
|
-
candidateNodes = context.loop ? wrapArray(candidateNodes, currentIndex + 1) : candidateNodes.slice(currentIndex + 1);
|
|
216265
|
-
}
|
|
216266
|
-
setTimeout(() => focusFirst(candidateNodes));
|
|
216267
|
-
}
|
|
216268
|
-
})
|
|
216269
|
-
}
|
|
216270
|
-
)
|
|
216271
|
-
}
|
|
216272
|
-
);
|
|
216273
|
-
}
|
|
216274
|
-
);
|
|
216275
|
-
RovingFocusGroupItem.displayName = ITEM_NAME$1;
|
|
216276
|
-
var MAP_KEY_TO_FOCUS_INTENT = {
|
|
216277
|
-
ArrowLeft: "prev",
|
|
216278
|
-
ArrowUp: "prev",
|
|
216279
|
-
ArrowRight: "next",
|
|
216280
|
-
ArrowDown: "next",
|
|
216281
|
-
PageUp: "first",
|
|
216282
|
-
Home: "first",
|
|
216283
|
-
PageDown: "last",
|
|
216284
|
-
End: "last"
|
|
216285
|
-
};
|
|
216286
|
-
function getDirectionAwareKey(key, dir) {
|
|
216287
|
-
if (dir !== "rtl") return key;
|
|
216288
|
-
return key === "ArrowLeft" ? "ArrowRight" : key === "ArrowRight" ? "ArrowLeft" : key;
|
|
216289
|
-
}
|
|
216290
|
-
function getFocusIntent(event, orientation, dir) {
|
|
216291
|
-
const key = getDirectionAwareKey(event.key, dir);
|
|
216292
|
-
if (orientation === "vertical" && ["ArrowLeft", "ArrowRight"].includes(key)) return void 0;
|
|
216293
|
-
if (orientation === "horizontal" && ["ArrowUp", "ArrowDown"].includes(key)) return void 0;
|
|
216294
|
-
return MAP_KEY_TO_FOCUS_INTENT[key];
|
|
216295
|
-
}
|
|
216296
|
-
function focusFirst(candidates, preventScroll = false) {
|
|
216297
|
-
const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;
|
|
216298
|
-
for (const candidate of candidates) {
|
|
216299
|
-
if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
216300
|
-
candidate.focus({ preventScroll });
|
|
216301
|
-
if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
216302
|
-
}
|
|
216303
|
-
}
|
|
216304
|
-
function wrapArray(array, startIndex) {
|
|
216305
|
-
return array.map((_, index) => array[(startIndex + index) % array.length]);
|
|
216306
|
-
}
|
|
216307
|
-
var Root$2 = RovingFocusGroup;
|
|
216308
|
-
var Item = RovingFocusGroupItem;
|
|
216309
|
-
|
|
216310
|
-
// packages/react/use-size/src/useSize.tsx
|
|
216311
|
-
function useSize(element) {
|
|
216312
|
-
const [size, setSize] = React.useState(void 0);
|
|
216313
|
-
useLayoutEffect2(() => {
|
|
216314
|
-
if (element) {
|
|
216315
|
-
setSize({ width: element.offsetWidth, height: element.offsetHeight });
|
|
216316
|
-
const resizeObserver = new ResizeObserver((entries) => {
|
|
216317
|
-
if (!Array.isArray(entries)) {
|
|
216318
|
-
return;
|
|
216319
|
-
}
|
|
216320
|
-
if (!entries.length) {
|
|
216321
|
-
return;
|
|
216322
|
-
}
|
|
216323
|
-
const entry = entries[0];
|
|
216324
|
-
let width;
|
|
216325
|
-
let height;
|
|
216326
|
-
if ("borderBoxSize" in entry) {
|
|
216327
|
-
const borderSizeEntry = entry["borderBoxSize"];
|
|
216328
|
-
const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;
|
|
216329
|
-
width = borderSize["inlineSize"];
|
|
216330
|
-
height = borderSize["blockSize"];
|
|
216331
|
-
} else {
|
|
216332
|
-
width = element.offsetWidth;
|
|
216333
|
-
height = element.offsetHeight;
|
|
216334
|
-
}
|
|
216335
|
-
setSize({ width, height });
|
|
216336
|
-
});
|
|
216337
|
-
resizeObserver.observe(element, { box: "border-box" });
|
|
216338
|
-
return () => resizeObserver.unobserve(element);
|
|
216339
|
-
} else {
|
|
216340
|
-
setSize(void 0);
|
|
216341
|
-
}
|
|
216342
|
-
}, [element]);
|
|
216343
|
-
return size;
|
|
216344
|
-
}
|
|
216345
|
-
|
|
216346
|
-
// packages/react/use-previous/src/usePrevious.tsx
|
|
216347
|
-
function usePrevious(value) {
|
|
216348
|
-
const ref = React.useRef({ value, previous: value });
|
|
216349
|
-
return React.useMemo(() => {
|
|
216350
|
-
if (ref.current.value !== value) {
|
|
216351
|
-
ref.current.previous = ref.current.value;
|
|
216352
|
-
ref.current.value = value;
|
|
216353
|
-
}
|
|
216354
|
-
return ref.current.previous;
|
|
216355
|
-
}, [value]);
|
|
216356
|
-
}
|
|
216357
|
-
|
|
216358
|
-
function useStateMachine$1(initialState, machine) {
|
|
216359
|
-
return React.useReducer((state, event) => {
|
|
216360
|
-
const nextState = machine[state][event];
|
|
216361
|
-
return nextState ?? state;
|
|
216362
|
-
}, initialState);
|
|
216363
|
-
}
|
|
216364
|
-
|
|
216365
|
-
// packages/react/presence/src/Presence.tsx
|
|
216366
|
-
var Presence = (props) => {
|
|
216367
|
-
const { present, children } = props;
|
|
216368
|
-
const presence = usePresence(present);
|
|
216369
|
-
const child = typeof children === "function" ? children({ present: presence.isPresent }) : React.Children.only(children);
|
|
216370
|
-
const ref = useComposedRefs(presence.ref, getElementRef(child));
|
|
216371
|
-
const forceMount = typeof children === "function";
|
|
216372
|
-
return forceMount || presence.isPresent ? React.cloneElement(child, { ref }) : null;
|
|
216373
|
-
};
|
|
216374
|
-
Presence.displayName = "Presence";
|
|
216375
|
-
function usePresence(present) {
|
|
216376
|
-
const [node, setNode] = React.useState();
|
|
216377
|
-
const stylesRef = React.useRef({});
|
|
216378
|
-
const prevPresentRef = React.useRef(present);
|
|
216379
|
-
const prevAnimationNameRef = React.useRef("none");
|
|
216380
|
-
const initialState = present ? "mounted" : "unmounted";
|
|
216381
|
-
const [state, send] = useStateMachine$1(initialState, {
|
|
216382
|
-
mounted: {
|
|
216383
|
-
UNMOUNT: "unmounted",
|
|
216384
|
-
ANIMATION_OUT: "unmountSuspended"
|
|
216385
|
-
},
|
|
216386
|
-
unmountSuspended: {
|
|
216387
|
-
MOUNT: "mounted",
|
|
216388
|
-
ANIMATION_END: "unmounted"
|
|
216389
|
-
},
|
|
216390
|
-
unmounted: {
|
|
216391
|
-
MOUNT: "mounted"
|
|
216392
|
-
}
|
|
216393
|
-
});
|
|
216394
|
-
React.useEffect(() => {
|
|
216395
|
-
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
216396
|
-
prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
|
|
216397
|
-
}, [state]);
|
|
216398
|
-
useLayoutEffect2(() => {
|
|
216399
|
-
const styles = stylesRef.current;
|
|
216400
|
-
const wasPresent = prevPresentRef.current;
|
|
216401
|
-
const hasPresentChanged = wasPresent !== present;
|
|
216402
|
-
if (hasPresentChanged) {
|
|
216403
|
-
const prevAnimationName = prevAnimationNameRef.current;
|
|
216404
|
-
const currentAnimationName = getAnimationName(styles);
|
|
216405
|
-
if (present) {
|
|
216406
|
-
send("MOUNT");
|
|
216407
|
-
} else if (currentAnimationName === "none" || styles?.display === "none") {
|
|
216408
|
-
send("UNMOUNT");
|
|
216409
|
-
} else {
|
|
216410
|
-
const isAnimating = prevAnimationName !== currentAnimationName;
|
|
216411
|
-
if (wasPresent && isAnimating) {
|
|
216412
|
-
send("ANIMATION_OUT");
|
|
216413
|
-
} else {
|
|
216414
|
-
send("UNMOUNT");
|
|
216415
|
-
}
|
|
216416
|
-
}
|
|
216417
|
-
prevPresentRef.current = present;
|
|
216418
|
-
}
|
|
216419
|
-
}, [present, send]);
|
|
216420
|
-
useLayoutEffect2(() => {
|
|
216421
|
-
if (node) {
|
|
216422
|
-
let timeoutId;
|
|
216423
|
-
const ownerWindow = node.ownerDocument.defaultView ?? window;
|
|
216424
|
-
const handleAnimationEnd = (event) => {
|
|
216425
|
-
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
216426
|
-
const isCurrentAnimation = currentAnimationName.includes(event.animationName);
|
|
216427
|
-
if (event.target === node && isCurrentAnimation) {
|
|
216428
|
-
send("ANIMATION_END");
|
|
216429
|
-
if (!prevPresentRef.current) {
|
|
216430
|
-
const currentFillMode = node.style.animationFillMode;
|
|
216431
|
-
node.style.animationFillMode = "forwards";
|
|
216432
|
-
timeoutId = ownerWindow.setTimeout(() => {
|
|
216433
|
-
if (node.style.animationFillMode === "forwards") {
|
|
216434
|
-
node.style.animationFillMode = currentFillMode;
|
|
216435
|
-
}
|
|
216436
|
-
});
|
|
216437
|
-
}
|
|
216438
|
-
}
|
|
216439
|
-
};
|
|
216440
|
-
const handleAnimationStart = (event) => {
|
|
216441
|
-
if (event.target === node) {
|
|
216442
|
-
prevAnimationNameRef.current = getAnimationName(stylesRef.current);
|
|
216443
|
-
}
|
|
216444
|
-
};
|
|
216445
|
-
node.addEventListener("animationstart", handleAnimationStart);
|
|
216446
|
-
node.addEventListener("animationcancel", handleAnimationEnd);
|
|
216447
|
-
node.addEventListener("animationend", handleAnimationEnd);
|
|
216448
|
-
return () => {
|
|
216449
|
-
ownerWindow.clearTimeout(timeoutId);
|
|
216450
|
-
node.removeEventListener("animationstart", handleAnimationStart);
|
|
216451
|
-
node.removeEventListener("animationcancel", handleAnimationEnd);
|
|
216452
|
-
node.removeEventListener("animationend", handleAnimationEnd);
|
|
216453
|
-
};
|
|
216454
|
-
} else {
|
|
216455
|
-
send("ANIMATION_END");
|
|
216456
|
-
}
|
|
216457
|
-
}, [node, send]);
|
|
216458
|
-
return {
|
|
216459
|
-
isPresent: ["mounted", "unmountSuspended"].includes(state),
|
|
216460
|
-
ref: React.useCallback((node2) => {
|
|
216461
|
-
if (node2) stylesRef.current = getComputedStyle(node2);
|
|
216462
|
-
setNode(node2);
|
|
216463
|
-
}, [])
|
|
216464
|
-
};
|
|
216465
|
-
}
|
|
216466
|
-
function getAnimationName(styles) {
|
|
216467
|
-
return styles?.animationName || "none";
|
|
216468
|
-
}
|
|
216469
|
-
function getElementRef(element) {
|
|
216470
|
-
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
216471
|
-
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
216472
|
-
if (mayWarn) {
|
|
216473
|
-
return element.ref;
|
|
216474
|
-
}
|
|
216475
|
-
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
216476
|
-
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
216477
|
-
if (mayWarn) {
|
|
216478
|
-
return element.props.ref;
|
|
216479
|
-
}
|
|
216480
|
-
return element.props.ref || element.ref;
|
|
216481
|
-
}
|
|
216482
|
-
|
|
216483
|
-
var RADIO_NAME = "Radio";
|
|
216484
|
-
var [createRadioContext, createRadioScope] = createContextScope(RADIO_NAME);
|
|
216485
|
-
var [RadioProvider, useRadioContext] = createRadioContext(RADIO_NAME);
|
|
216486
|
-
var Radio = React.forwardRef(
|
|
216487
|
-
(props, forwardedRef) => {
|
|
216488
|
-
const {
|
|
216489
|
-
__scopeRadio,
|
|
216490
|
-
name,
|
|
216491
|
-
checked = false,
|
|
216492
|
-
required,
|
|
216493
|
-
disabled,
|
|
216494
|
-
value = "on",
|
|
216495
|
-
onCheck,
|
|
216496
|
-
form,
|
|
216497
|
-
...radioProps
|
|
216498
|
-
} = props;
|
|
216499
|
-
const [button, setButton] = React.useState(null);
|
|
216500
|
-
const composedRefs = useComposedRefs(forwardedRef, (node) => setButton(node));
|
|
216501
|
-
const hasConsumerStoppedPropagationRef = React.useRef(false);
|
|
216502
|
-
const isFormControl = button ? form || !!button.closest("form") : true;
|
|
216503
|
-
return /* @__PURE__ */ jsxs(RadioProvider, { scope: __scopeRadio, checked, disabled, children: [
|
|
216504
|
-
/* @__PURE__ */ jsx(
|
|
216505
|
-
Primitive$1.button,
|
|
216506
|
-
{
|
|
216507
|
-
type: "button",
|
|
216508
|
-
role: "radio",
|
|
216509
|
-
"aria-checked": checked,
|
|
216510
|
-
"data-state": getState(checked),
|
|
216511
|
-
"data-disabled": disabled ? "" : void 0,
|
|
216512
|
-
disabled,
|
|
216513
|
-
value,
|
|
216514
|
-
...radioProps,
|
|
216515
|
-
ref: composedRefs,
|
|
216516
|
-
onClick: composeEventHandlers(props.onClick, (event) => {
|
|
216517
|
-
if (!checked) onCheck?.();
|
|
216518
|
-
if (isFormControl) {
|
|
216519
|
-
hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
|
|
216520
|
-
if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
|
|
216521
|
-
}
|
|
216522
|
-
})
|
|
216523
|
-
}
|
|
216524
|
-
),
|
|
216525
|
-
isFormControl && /* @__PURE__ */ jsx(
|
|
216526
|
-
BubbleInput,
|
|
216527
|
-
{
|
|
216528
|
-
control: button,
|
|
216529
|
-
bubbles: !hasConsumerStoppedPropagationRef.current,
|
|
216530
|
-
name,
|
|
216531
|
-
value,
|
|
216532
|
-
checked,
|
|
216533
|
-
required,
|
|
216534
|
-
disabled,
|
|
216535
|
-
form,
|
|
216536
|
-
style: { transform: "translateX(-100%)" }
|
|
216537
|
-
}
|
|
216538
|
-
)
|
|
216539
|
-
] });
|
|
216540
|
-
}
|
|
216541
|
-
);
|
|
216542
|
-
Radio.displayName = RADIO_NAME;
|
|
216543
|
-
var INDICATOR_NAME = "RadioIndicator";
|
|
216544
|
-
var RadioIndicator = React.forwardRef(
|
|
216545
|
-
(props, forwardedRef) => {
|
|
216546
|
-
const { __scopeRadio, forceMount, ...indicatorProps } = props;
|
|
216547
|
-
const context = useRadioContext(INDICATOR_NAME, __scopeRadio);
|
|
216548
|
-
return /* @__PURE__ */ jsx(Presence, { present: forceMount || context.checked, children: /* @__PURE__ */ jsx(
|
|
216549
|
-
Primitive$1.span,
|
|
216550
|
-
{
|
|
216551
|
-
"data-state": getState(context.checked),
|
|
216552
|
-
"data-disabled": context.disabled ? "" : void 0,
|
|
216553
|
-
...indicatorProps,
|
|
216554
|
-
ref: forwardedRef
|
|
216555
|
-
}
|
|
216556
|
-
) });
|
|
216557
|
-
}
|
|
216558
|
-
);
|
|
216559
|
-
RadioIndicator.displayName = INDICATOR_NAME;
|
|
216560
|
-
var BubbleInput = (props) => {
|
|
216561
|
-
const { control, checked, bubbles = true, ...inputProps } = props;
|
|
216562
|
-
const ref = React.useRef(null);
|
|
216563
|
-
const prevChecked = usePrevious(checked);
|
|
216564
|
-
const controlSize = useSize(control);
|
|
216565
|
-
React.useEffect(() => {
|
|
216566
|
-
const input = ref.current;
|
|
216567
|
-
const inputProto = window.HTMLInputElement.prototype;
|
|
216568
|
-
const descriptor = Object.getOwnPropertyDescriptor(inputProto, "checked");
|
|
216569
|
-
const setChecked = descriptor.set;
|
|
216570
|
-
if (prevChecked !== checked && setChecked) {
|
|
216571
|
-
const event = new Event("click", { bubbles });
|
|
216572
|
-
setChecked.call(input, checked);
|
|
216573
|
-
input.dispatchEvent(event);
|
|
216574
|
-
}
|
|
216575
|
-
}, [prevChecked, checked, bubbles]);
|
|
216576
|
-
return /* @__PURE__ */ jsx(
|
|
216577
|
-
"input",
|
|
216578
|
-
{
|
|
216579
|
-
type: "radio",
|
|
216580
|
-
"aria-hidden": true,
|
|
216581
|
-
defaultChecked: checked,
|
|
216582
|
-
...inputProps,
|
|
216583
|
-
tabIndex: -1,
|
|
216584
|
-
ref,
|
|
216585
|
-
style: {
|
|
216586
|
-
...props.style,
|
|
216587
|
-
...controlSize,
|
|
216588
|
-
position: "absolute",
|
|
216589
|
-
pointerEvents: "none",
|
|
216590
|
-
opacity: 0,
|
|
216591
|
-
margin: 0
|
|
216592
|
-
}
|
|
216593
|
-
}
|
|
216594
|
-
);
|
|
216595
|
-
};
|
|
216596
|
-
function getState(checked) {
|
|
216597
|
-
return checked ? "checked" : "unchecked";
|
|
216598
|
-
}
|
|
216599
|
-
var ARROW_KEYS = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"];
|
|
216600
|
-
var RADIO_GROUP_NAME = "RadioGroup";
|
|
216601
|
-
var [createRadioGroupContext] = createContextScope(RADIO_GROUP_NAME, [
|
|
216602
|
-
createRovingFocusGroupScope,
|
|
216603
|
-
createRadioScope
|
|
216604
|
-
]);
|
|
216605
|
-
var useRovingFocusGroupScope = createRovingFocusGroupScope();
|
|
216606
|
-
var useRadioScope = createRadioScope();
|
|
216607
|
-
var [RadioGroupProvider, useRadioGroupContext] = createRadioGroupContext(RADIO_GROUP_NAME);
|
|
216608
|
-
var RadioGroup$1 = React.forwardRef(
|
|
216609
|
-
(props, forwardedRef) => {
|
|
216610
|
-
const {
|
|
216611
|
-
__scopeRadioGroup,
|
|
216612
|
-
name,
|
|
216613
|
-
defaultValue,
|
|
216614
|
-
value: valueProp,
|
|
216615
|
-
required = false,
|
|
216616
|
-
disabled = false,
|
|
216617
|
-
orientation,
|
|
216618
|
-
dir,
|
|
216619
|
-
loop = true,
|
|
216620
|
-
onValueChange,
|
|
216621
|
-
...groupProps
|
|
216622
|
-
} = props;
|
|
216623
|
-
const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeRadioGroup);
|
|
216624
|
-
const direction = useDirection(dir);
|
|
216625
|
-
const [value, setValue] = useControllableState({
|
|
216626
|
-
prop: valueProp,
|
|
216627
|
-
defaultProp: defaultValue,
|
|
216628
|
-
onChange: onValueChange
|
|
216629
|
-
});
|
|
216630
|
-
return /* @__PURE__ */ jsx(
|
|
216631
|
-
RadioGroupProvider,
|
|
216632
|
-
{
|
|
216633
|
-
scope: __scopeRadioGroup,
|
|
216634
|
-
name,
|
|
216635
|
-
required,
|
|
216636
|
-
disabled,
|
|
216637
|
-
value,
|
|
216638
|
-
onValueChange: setValue,
|
|
216639
|
-
children: /* @__PURE__ */ jsx(
|
|
216640
|
-
Root$2,
|
|
216641
|
-
{
|
|
216642
|
-
asChild: true,
|
|
216643
|
-
...rovingFocusGroupScope,
|
|
216644
|
-
orientation,
|
|
216645
|
-
dir: direction,
|
|
216646
|
-
loop,
|
|
216647
|
-
children: /* @__PURE__ */ jsx(
|
|
216648
|
-
Primitive$1.div,
|
|
216649
|
-
{
|
|
216650
|
-
role: "radiogroup",
|
|
216651
|
-
"aria-required": required,
|
|
216652
|
-
"aria-orientation": orientation,
|
|
216653
|
-
"data-disabled": disabled ? "" : void 0,
|
|
216654
|
-
dir: direction,
|
|
216655
|
-
...groupProps,
|
|
216656
|
-
ref: forwardedRef
|
|
216657
|
-
}
|
|
216658
|
-
)
|
|
216659
|
-
}
|
|
216660
|
-
)
|
|
216661
|
-
}
|
|
216662
|
-
);
|
|
216663
|
-
}
|
|
216664
|
-
);
|
|
216665
|
-
RadioGroup$1.displayName = RADIO_GROUP_NAME;
|
|
216666
|
-
var ITEM_NAME = "RadioGroupItem";
|
|
216667
|
-
var RadioGroupItem$1 = React.forwardRef(
|
|
216668
|
-
(props, forwardedRef) => {
|
|
216669
|
-
const { __scopeRadioGroup, disabled, ...itemProps } = props;
|
|
216670
|
-
const context = useRadioGroupContext(ITEM_NAME, __scopeRadioGroup);
|
|
216671
|
-
const isDisabled = context.disabled || disabled;
|
|
216672
|
-
const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeRadioGroup);
|
|
216673
|
-
const radioScope = useRadioScope(__scopeRadioGroup);
|
|
216674
|
-
const ref = React.useRef(null);
|
|
216675
|
-
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
216676
|
-
const checked = context.value === itemProps.value;
|
|
216677
|
-
const isArrowKeyPressedRef = React.useRef(false);
|
|
216678
|
-
React.useEffect(() => {
|
|
216679
|
-
const handleKeyDown = (event) => {
|
|
216680
|
-
if (ARROW_KEYS.includes(event.key)) {
|
|
216681
|
-
isArrowKeyPressedRef.current = true;
|
|
216682
|
-
}
|
|
216683
|
-
};
|
|
216684
|
-
const handleKeyUp = () => isArrowKeyPressedRef.current = false;
|
|
216685
|
-
document.addEventListener("keydown", handleKeyDown);
|
|
216686
|
-
document.addEventListener("keyup", handleKeyUp);
|
|
216687
|
-
return () => {
|
|
216688
|
-
document.removeEventListener("keydown", handleKeyDown);
|
|
216689
|
-
document.removeEventListener("keyup", handleKeyUp);
|
|
216690
|
-
};
|
|
216691
|
-
}, []);
|
|
216692
|
-
return /* @__PURE__ */ jsx(
|
|
216693
|
-
Item,
|
|
216694
|
-
{
|
|
216695
|
-
asChild: true,
|
|
216696
|
-
...rovingFocusGroupScope,
|
|
216697
|
-
focusable: !isDisabled,
|
|
216698
|
-
active: checked,
|
|
216699
|
-
children: /* @__PURE__ */ jsx(
|
|
216700
|
-
Radio,
|
|
216701
|
-
{
|
|
216702
|
-
disabled: isDisabled,
|
|
216703
|
-
required: context.required,
|
|
216704
|
-
checked,
|
|
216705
|
-
...radioScope,
|
|
216706
|
-
...itemProps,
|
|
216707
|
-
name: context.name,
|
|
216708
|
-
ref: composedRefs,
|
|
216709
|
-
onCheck: () => context.onValueChange(itemProps.value),
|
|
216710
|
-
onKeyDown: composeEventHandlers((event) => {
|
|
216711
|
-
if (event.key === "Enter") event.preventDefault();
|
|
216712
|
-
}),
|
|
216713
|
-
onFocus: composeEventHandlers(itemProps.onFocus, () => {
|
|
216714
|
-
if (isArrowKeyPressedRef.current) ref.current?.click();
|
|
216715
|
-
})
|
|
216716
|
-
}
|
|
216717
|
-
)
|
|
216718
|
-
}
|
|
216719
|
-
);
|
|
216720
|
-
}
|
|
216721
|
-
);
|
|
216722
|
-
RadioGroupItem$1.displayName = ITEM_NAME;
|
|
216723
|
-
var INDICATOR_NAME2 = "RadioGroupIndicator";
|
|
216724
|
-
var RadioGroupIndicator = React.forwardRef(
|
|
216725
|
-
(props, forwardedRef) => {
|
|
216726
|
-
const { __scopeRadioGroup, ...indicatorProps } = props;
|
|
216727
|
-
const radioScope = useRadioScope(__scopeRadioGroup);
|
|
216728
|
-
return /* @__PURE__ */ jsx(RadioIndicator, { ...radioScope, ...indicatorProps, ref: forwardedRef });
|
|
216729
|
-
}
|
|
216730
|
-
);
|
|
216731
|
-
RadioGroupIndicator.displayName = INDICATOR_NAME2;
|
|
216732
|
-
var Root2$3 = RadioGroup$1;
|
|
216733
|
-
var Item2 = RadioGroupItem$1;
|
|
216734
|
-
var Indicator = RadioGroupIndicator;
|
|
216735
|
-
|
|
216736
|
-
function RadioGroup({ className, ...props }) {
|
|
216737
|
-
return (jsx(Root2$3, { "data-slot": "radio-group", className: cn('grid gap-3', className), ...props }));
|
|
216738
|
-
}
|
|
216739
|
-
function RadioGroupItem({ className, ...props }) {
|
|
216740
|
-
return (jsx(Item2, { "data-slot": "radio-group-item", className: cn('border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50', className), ...props, children: jsx(Indicator, { "data-slot": "radio-group-indicator", className: "relative flex items-center justify-center", children: jsx(Circle, { className: "fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2" }) }) }));
|
|
216741
|
-
}
|
|
216742
|
-
|
|
216743
217198
|
var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
|
|
216744
217199
|
// @__NO_SIDE_EFFECTS__
|
|
216745
217200
|
function createSlottable(ownerName) {
|
|
@@ -263564,7 +264019,7 @@ function BasicSubTab({ form, labels, mentor, isDisabled, categories }) {
|
|
|
263564
264019
|
var _a;
|
|
263565
264020
|
return (jsxs("div", { className: "space-y-2", children: [jsxs(Label$1, { className: "flex items-center text-sm font-medium text-[#646464]", children: [labels.fields.category.label, jsx("span", { className: "ml-1 text-red-500", children: "*" })] }), jsxs(Popover, { children: [jsx(PopoverTrigger, { asChild: true, "aria-label": t('tabsSettingsTab.categorySelectAriaLabel'), children: jsxs(Button$1, { variant: "outline", role: "combobox", className: "w-full justify-between", disabled: isDisabled || disabled, children: [field.state.value
|
|
263566
264021
|
? (_a = categories === null || categories === void 0 ? void 0 : categories.find((category) => category.id === field.state.value)) === null || _a === void 0 ? void 0 : _a.name
|
|
263567
|
-
: labels.fields.category.triggerPlaceholder, jsx(ChevronsUpDown, { className: "opacity-50" })] }) }), jsx(PopoverContent, { className: "w-full max-w-[490px] p-0 sm:w-[400px] lg:w-[490px]", children: jsxs(Command, { children: [jsx(CommandInput, { placeholder: labels.fields.category.searchPlaceholder, className: "h-9" }), jsxs(CommandList, { children: [jsx(CommandEmpty, { children: labels.fields.category.emptyState }), jsx(CommandGroup, { children: categories === null || categories === void 0 ? void 0 : categories.map((category) => (jsxs(CommandItem, { value: category.id.toString(), onSelect: (currentValue) => {
|
|
264022
|
+
: labels.fields.category.triggerPlaceholder, jsx(ChevronsUpDown, { className: "opacity-50" })] }) }), jsx(PopoverContent, { className: "w-full max-w-[490px] p-0 sm:w-[400px] lg:w-[490px]", align: "start", portalled: false, children: jsxs(Command, { children: [jsx(CommandInput, { placeholder: labels.fields.category.searchPlaceholder, className: "h-9" }), jsxs(CommandList, { children: [jsx(CommandEmpty, { children: labels.fields.category.emptyState }), jsx(CommandGroup, { children: categories === null || categories === void 0 ? void 0 : categories.map((category) => (jsxs(CommandItem, { value: category.id.toString(), onSelect: (currentValue) => {
|
|
263568
264023
|
field.handleChange(Number(currentValue));
|
|
263569
264024
|
}, children: [category.name, jsx(Check, { className: cn('ml-auto', field.state.value === category.id ? 'opacity-100' : 'opacity-0') })] }, category.id))) })] })] }) })] })] }));
|
|
263570
264025
|
} })) })] }), jsx(WithFormPermissions, { name: "profile_image",
|
|
@@ -268722,9 +269177,10 @@ function AgentApiTab({ labels: labelsOverride }) {
|
|
|
268722
269177
|
const { tenantKey, username, rbacPermissions, executeGatedAction } = useAgentSettings();
|
|
268723
269178
|
const t = useT();
|
|
268724
269179
|
const labels = React__default.useMemo(() => resolveApiTabLabels(labelsOverride, t), [labelsOverride, t]);
|
|
268725
|
-
const { data:
|
|
269180
|
+
const { data: apiKeysResponse, isLoading: isApiKeysLoading } = useGetApiKeysQuery({
|
|
268726
269181
|
platformKey: tenantKey,
|
|
268727
269182
|
});
|
|
269183
|
+
const { tokens: apiKeys } = unwrapApiTokenList(apiKeysResponse);
|
|
268728
269184
|
const [showCreateApiModal, setShowCreateApiModal] = React__default.useState(false);
|
|
268729
269185
|
const [apiKeyToDelete, setApiKeyToDelete] = React__default.useState(null);
|
|
268730
269186
|
function closeCreateApiModal() {
|
|
@@ -268751,10 +269207,10 @@ function AgentApiTab({ labels: labelsOverride }) {
|
|
|
268751
269207
|
return (jsxs(Fragment$1, { children: [jsx("div", { className: "flex hidden h-[73px] flex-shrink-0 items-center border-b border-gray-200 bg-white p-4 lg:block", children: jsxs("div", { children: [jsx("h3", { className: "mb-1 text-base font-medium text-gray-900", children: labels.header.title }), jsx("p", { className: "text-xs text-gray-700", children: labels.header.description })] }) }), jsx("div", { className: "flex-1 space-y-4 p-3 lg:p-4", style: {
|
|
268752
269208
|
overflowY: 'auto',
|
|
268753
269209
|
overflowX: 'hidden',
|
|
268754
|
-
}, children: jsxs("div", { className: "space-y-6", children: [jsxs("div", { className: "space-y-4", children: [jsx("p", { className: "text-sm text-gray-700", children: labels.disclaimer.lineOne }), jsx("p", { className: "text-sm text-gray-700", children: labels.disclaimer.lineTwo })] }), isApiKeysLoading ? (jsx("div", { className: "flex w-full items-center justify-center py-10", children: jsx(Spinner, {}) })) : (jsx("div", { className: "rounded-md border", children: jsxs(Table$1, { className: "w-full", children: [jsx(TableHeader$1, { children: jsxs(TableRow$1, { children: [jsx(TableHead, { className: "p-2 text-left text-sm text-gray-700", children: labels.table.nameColumn }), jsx(TableHead, { className: "p-2 text-left text-sm text-gray-700", children: labels.table.createdColumn }), jsx(TableHead, { className: "p-2 text-left text-sm text-gray-700", children: labels.table.expiresColumn }), jsx(TableHead, { className: "p-2 text-left text-sm text-gray-700", "aria-label": labels.table.actionsColumn, children: jsx("span", { className: "sr-only", children: labels.table.actionsColumn }) })] }) }), jsx(TableBody, { children:
|
|
269210
|
+
}, children: jsxs("div", { className: "space-y-6", children: [jsxs("div", { className: "space-y-4", children: [jsx("p", { className: "text-sm text-gray-700", children: labels.disclaimer.lineOne }), jsx("p", { className: "text-sm text-gray-700", children: labels.disclaimer.lineTwo })] }), isApiKeysLoading ? (jsx("div", { className: "flex w-full items-center justify-center py-10", children: jsx(Spinner, {}) })) : (jsx("div", { className: "rounded-md border", children: jsxs(Table$1, { className: "w-full", children: [jsx(TableHeader$1, { children: jsxs(TableRow$1, { children: [jsx(TableHead, { className: "p-2 text-left text-sm text-gray-700", children: labels.table.nameColumn }), jsx(TableHead, { className: "p-2 text-left text-sm text-gray-700", children: labels.table.createdColumn }), jsx(TableHead, { className: "p-2 text-left text-sm text-gray-700", children: labels.table.expiresColumn }), jsx(TableHead, { className: "p-2 text-left text-sm text-gray-700", "aria-label": labels.table.actionsColumn, children: jsx("span", { className: "sr-only", children: labels.table.actionsColumn }) })] }) }), jsx(TableBody, { children: apiKeys.length === 0 ? (jsx(TableRow$1, { children: jsx(TableCell$1, { colSpan: 5, className: "p-4 text-center text-sm text-gray-700", children: labels.table.emptyState }) })) : (jsx(WithPermissions, { rbacResource: "/apitokens/#list", rbacPermissions: rbacPermissions !== null && rbacPermissions !== void 0 ? rbacPermissions : {}, children: ({ hasPermission }) => {
|
|
268755
269211
|
if (!hasPermission)
|
|
268756
269212
|
return (jsx(TableRow$1, { children: jsx(TableCell$1, { colSpan: 5, className: "p-4 text-center text-sm text-gray-700", children: labels.table.noPermission }) }));
|
|
268757
|
-
return (jsx(Fragment$1, { children: apiKeys
|
|
269213
|
+
return (jsx(Fragment$1, { children: apiKeys.map((apiKey) => (jsxs(TableRow$1, { className: "text-sm hover:bg-blue-50", children: [jsx(TableCell$1, { className: "p-2 whitespace-nowrap text-gray-700", children: apiKey.name }), jsx(TableCell$1, { className: "p-2 whitespace-nowrap text-gray-700", children: apiKey.created ? format$1(apiKey.created, 'PPP') : 'N/A' }), jsx(TableCell$1, { className: "p-2 whitespace-nowrap text-gray-700", children: apiKey.expires ? format$1(apiKey.expires, 'PPP') : 'N/A' }), jsx(TableCell$1, { className: "p-2", children: jsx(WithPermissions, { rbacResource: "/apitokens/#create", rbacPermissions: rbacPermissions !== null && rbacPermissions !== void 0 ? rbacPermissions : {}, children: ({ hasPermission }) => hasPermission && (jsxs(Button$1, { variant: "ghost", size: "sm", className: "cursor-pointer", onClick: () => handleDeleteClick(apiKey.name), children: [jsx(Trash, { className: "h-4 w-4" }), jsx("span", { className: "sr-only", children: labels.table.deleteAriaLabel })] })) }) })] }, apiKey.name))) }));
|
|
268758
269214
|
} })) })] }) })), jsx(WithPermissions, { rbacResource: "/apitokens/#create", rbacPermissions: rbacPermissions !== null && rbacPermissions !== void 0 ? rbacPermissions : {}, children: ({ hasPermission }) => hasPermission && (jsx(Button$1, { onClick: openCreateApiModal, className: "cursor-pointer bg-gradient-to-r from-[#2563EB] to-[#93C5FD] text-white hover:opacity-90", children: labels.actions.createNew })) }), jsx(CreateApiModal, { isOpen: showCreateApiModal, onClose: closeCreateApiModal, tenantKey: tenantKey, username: username !== null && username !== void 0 ? username : '', executeGatedAction: executeGatedAction, labels: labels.createModal, apiKeyModalLabels: labels.apiKeyModal }), apiKeyToDelete && (jsx(DeleteApiModal, { isOpen: !!apiKeyToDelete, onClose: closeDeleteApiModal, apiKey: apiKeyToDelete, tenantKey: tenantKey, labels: labels.deleteModal }))] }) })] }));
|
|
268759
269215
|
}
|
|
268760
269216
|
|