@e-llm-studio/instant-learning 1.3.0-alpha.1 → 1.3.0-alpha.11
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/cjs/features/LearningManagement/AuditLog/AuditLog.js +1 -1
- package/dist/cjs/features/LearningManagement/AuditLog/ChangeLogDiff.js +2 -0
- package/dist/cjs/features/LearningManagement/AuditLog/ChangeLogDiff.js.map +1 -0
- package/dist/cjs/features/LearningManagement/LearningManagement.js +1 -1
- package/dist/cjs/features/LearningManagement/RuleContent/RuleAccordionHeader.js +1 -1
- package/dist/cjs/features/LearningManagement/RuleContent/RuleContent.js +1 -1
- package/dist/cjs/features/LearningManagement/RuleContent/VariantCard.js +1 -1
- package/dist/cjs/features/LearningManagement/assets/Search-result(add new).svg.js +2 -0
- package/dist/cjs/features/LearningManagement/assets/Search-result(add new).svg.js.map +1 -0
- package/dist/cjs/features/LearningManagement/components/CreateLearningSetModal.js +2 -0
- package/dist/cjs/features/LearningManagement/components/CreateLearningSetModal.js.map +1 -0
- package/dist/cjs/features/LearningManagement/components/CreateRuleSetLegacyModal.js +1 -1
- package/dist/cjs/features/LearningManagement/components/InstantLearningModal.js +1 -1
- package/dist/cjs/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.js +2 -0
- package/dist/cjs/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.js.map +1 -0
- package/dist/cjs/features/LearningManagement/components/StationOnboarding/StationOnboardModal.js +1 -1
- package/dist/cjs/features/LearningManagement/styles/CreateLearningSetModal.module.css.js +2 -0
- package/dist/cjs/features/LearningManagement/styles/CreateLearningSetModal.module.css.js.map +1 -0
- package/dist/cjs/index.js +1 -1
- package/dist/features/LearningManagement/AuditLog/AuditLog.js +1 -1
- package/dist/features/LearningManagement/AuditLog/ChangeLogDiff.js +2 -0
- package/dist/features/LearningManagement/AuditLog/ChangeLogDiff.js.map +1 -0
- package/dist/features/LearningManagement/LearningManagement.js +1 -1
- package/dist/features/LearningManagement/RuleContent/RuleAccordionHeader.js +1 -1
- package/dist/features/LearningManagement/RuleContent/RuleContent.js +1 -1
- package/dist/features/LearningManagement/RuleContent/VariantCard.js +1 -1
- package/dist/features/LearningManagement/assets/Search-result(add new).svg.js +2 -0
- package/dist/features/LearningManagement/assets/Search-result(add new).svg.js.map +1 -0
- package/dist/features/LearningManagement/components/CreateLearningSetModal.js +2 -0
- package/dist/features/LearningManagement/components/CreateLearningSetModal.js.map +1 -0
- package/dist/features/LearningManagement/components/CreateRuleSetLegacyModal.js +1 -1
- package/dist/features/LearningManagement/components/InstantLearningModal.js +1 -1
- package/dist/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.js +2 -0
- package/dist/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.js.map +1 -0
- package/dist/features/LearningManagement/components/StationOnboarding/StationOnboardModal.js +1 -1
- package/dist/features/LearningManagement/styles/CreateLearningSetModal.module.css.js +2 -0
- package/dist/features/LearningManagement/styles/CreateLearningSetModal.module.css.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/types/src/AccordianHeadTest.d.ts +1 -2
- package/dist/types/src/AccordianHeadTest.d.ts.map +1 -1
- package/dist/types/src/App.d.ts +1 -2
- package/dist/types/src/App.d.ts.map +1 -1
- package/dist/types/src/CommonComponents/AccordianHead/AccordianHead.d.ts +1 -1
- package/dist/types/src/CommonComponents/AccordianHead/AccordianHead.d.ts.map +1 -1
- package/dist/types/src/CommonComponents/GradientSparkleIcon.d.ts +1 -2
- package/dist/types/src/CommonComponents/GradientSparkleIcon.d.ts.map +1 -1
- package/dist/types/src/CommonComponents/HelloWorld.d.ts +1 -1
- package/dist/types/src/CommonComponents/HelloWorld.d.ts.map +1 -1
- package/dist/types/src/CommonComponents/NoTableData.d.ts +1 -1
- package/dist/types/src/CommonComponents/NoTableData.d.ts.map +1 -1
- package/dist/types/src/CommonComponents/Spinner.d.ts +1 -2
- package/dist/types/src/CommonComponents/Spinner.d.ts.map +1 -1
- package/dist/types/src/GoogleFilePickerDemo.d.ts +1 -2
- package/dist/types/src/GoogleFilePickerDemo.d.ts.map +1 -1
- package/dist/types/src/ThinkingBulbIconComponent.d.ts +1 -2
- package/dist/types/src/ThinkingBulbIconComponent.d.ts.map +1 -1
- package/dist/types/src/features/DataSelector/DataSelector.d.ts +1 -1
- package/dist/types/src/features/DataSelector/DataSelector.d.ts.map +1 -1
- package/dist/types/src/features/DataSelector/components/DataSelectionOptionsScreen.d.ts +1 -1
- package/dist/types/src/features/DataSelector/components/DataSelectionOptionsScreen.d.ts.map +1 -1
- package/dist/types/src/features/DataSelector/components/RLEFDataPointsListInSelectedDataSetCollection.d.ts +1 -1
- package/dist/types/src/features/DataSelector/components/RLEFDataPointsListInSelectedDataSetCollection.d.ts.map +1 -1
- package/dist/types/src/features/DataSelector/components/RLEFDataSetCollectionsList.d.ts +1 -1
- package/dist/types/src/features/DataSelector/components/RLEFDataSetCollectionsList.d.ts.map +1 -1
- package/dist/types/src/features/DataSelector/components/RlefDataTabsComponent.d.ts +1 -1
- package/dist/types/src/features/DataSelector/components/RlefDataTabsComponent.d.ts.map +1 -1
- package/dist/types/src/features/DataSelector/components/RlefHistoricalCopilotData.d.ts +1 -2
- package/dist/types/src/features/DataSelector/components/RlefHistoricalCopilotData.d.ts.map +1 -1
- package/dist/types/src/features/DataSelector/components/SavedDataSetListScreen.d.ts +1 -2
- package/dist/types/src/features/DataSelector/components/SavedDataSetListScreen.d.ts.map +1 -1
- package/dist/types/src/features/DataSelector/components/SelectedDataList.d.ts +1 -1
- package/dist/types/src/features/DataSelector/components/SelectedDataList.d.ts.map +1 -1
- package/dist/types/src/features/DataSelector/components/subcomponents/DataSetElement/DataSetElement.d.ts +1 -1
- package/dist/types/src/features/DataSelector/components/subcomponents/DataSetElement/DataSetElement.d.ts.map +1 -1
- package/dist/types/src/features/DataSelector/components/subcomponents/Pagination/Pagination.d.ts +1 -2
- package/dist/types/src/features/DataSelector/components/subcomponents/Pagination/Pagination.d.ts.map +1 -1
- package/dist/types/src/features/DocumentLearning/_components/MessageRendering.d.ts +1 -2
- package/dist/types/src/features/DocumentLearning/_components/MessageRendering.d.ts.map +1 -1
- package/dist/types/src/features/DocumentLearning/_components/MinimizedThinkingSteps.d.ts +1 -2
- package/dist/types/src/features/DocumentLearning/_components/MinimizedThinkingSteps.d.ts.map +1 -1
- package/dist/types/src/features/DocumentLearning/_components/_svg/ArrowDown.d.ts +1 -2
- package/dist/types/src/features/DocumentLearning/_components/_svg/ArrowDown.d.ts.map +1 -1
- package/dist/types/src/features/DocumentLearning/_components/_svg/ArrowIconBlue.d.ts +1 -2
- package/dist/types/src/features/DocumentLearning/_components/_svg/ArrowIconBlue.d.ts.map +1 -1
- package/dist/types/src/features/DocumentLearning/_components/_svg/CompleteIconGreen.d.ts +1 -2
- package/dist/types/src/features/DocumentLearning/_components/_svg/CompleteIconGreen.d.ts.map +1 -1
- package/dist/types/src/features/DocumentLearning/_components/_svg/NewChatIcon.d.ts +1 -2
- package/dist/types/src/features/DocumentLearning/_components/_svg/NewChatIcon.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/ValueTypeWrappers/TeachMeWrapper.d.ts +1 -1
- package/dist/types/src/features/IL-OTJ/ValueTypeWrappers/TeachMeWrapper.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/AccordianSection.d.ts +1 -2
- package/dist/types/src/features/IL-OTJ/_components/AccordianSection.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/ChatComponents/ChatHeader.d.ts +1 -2
- package/dist/types/src/features/IL-OTJ/_components/ChatComponents/ChatHeader.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/ConflictingReasoningCard.d.ts +1 -1
- package/dist/types/src/features/IL-OTJ/_components/ConflictingReasoningCard.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/CriticalGaps.d.ts +1 -2
- package/dist/types/src/features/IL-OTJ/_components/CriticalGaps.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/GapExplanationAccordion.d.ts +1 -1
- package/dist/types/src/features/IL-OTJ/_components/GapExplanationAccordion.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/ILPopup.d.ts +1 -1
- package/dist/types/src/features/IL-OTJ/_components/ILPopup.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/MarkdownComponents/MarkdownElements.d.ts +3 -3
- package/dist/types/src/features/IL-OTJ/_components/MarkdownComponents/MarkdownElements.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/MarkdownComponents/MarkdownSelect.d.ts +1 -1
- package/dist/types/src/features/IL-OTJ/_components/MarkdownComponents/MarkdownSelect.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/MessageRendering/ClickableChatComponents.d.ts +3 -3
- package/dist/types/src/features/IL-OTJ/_components/MessageRendering/ClickableChatComponents.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/MessageRendering/MessageRendering.d.ts +1 -2
- package/dist/types/src/features/IL-OTJ/_components/MessageRendering/MessageRendering.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/MinimizedThinkingSteps.d.ts +1 -2
- package/dist/types/src/features/IL-OTJ/_components/MinimizedThinkingSteps.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/ViewFormUpdateCard.d.ts +1 -2
- package/dist/types/src/features/IL-OTJ/_components/ViewFormUpdateCard.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/ViewIdentifiedFieldsCard.d.ts +1 -2
- package/dist/types/src/features/IL-OTJ/_components/ViewIdentifiedFieldsCard.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/WatchMeWork/AgentStepsView.d.ts +1 -1
- package/dist/types/src/features/IL-OTJ/_components/WatchMeWork/AgentStepsView.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/WatchMeWork/StepDetailView.d.ts +1 -2
- package/dist/types/src/features/IL-OTJ/_components/WatchMeWork/StepDetailView.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/WatchMeWork/Thinkingstepshelper.d.ts +9 -9
- package/dist/types/src/features/IL-OTJ/_components/WatchMeWork/Thinkingstepshelper.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/WatchMeWork/WorkingIndicator.d.ts +1 -2
- package/dist/types/src/features/IL-OTJ/_components/WatchMeWork/WorkingIndicator.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/_svg/ArrowDown.d.ts +1 -2
- package/dist/types/src/features/IL-OTJ/_components/_svg/ArrowDown.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/_svg/ArrowIconBlue.d.ts +1 -2
- package/dist/types/src/features/IL-OTJ/_components/_svg/ArrowIconBlue.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/_svg/BookIcon.d.ts +1 -2
- package/dist/types/src/features/IL-OTJ/_components/_svg/BookIcon.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/_svg/ButtonCognitiveIcon.d.ts +1 -1
- package/dist/types/src/features/IL-OTJ/_components/_svg/ButtonCognitiveIcon.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/_svg/ChevronDown.d.ts +1 -2
- package/dist/types/src/features/IL-OTJ/_components/_svg/ChevronDown.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/_svg/ChevronIcon.d.ts +1 -1
- package/dist/types/src/features/IL-OTJ/_components/_svg/ChevronIcon.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/_svg/ChevronUp.d.ts +1 -2
- package/dist/types/src/features/IL-OTJ/_components/_svg/ChevronUp.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/_svg/CognitiveDecisioning.d.ts +1 -2
- package/dist/types/src/features/IL-OTJ/_components/_svg/CognitiveDecisioning.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/_svg/CompleteIconGreen.d.ts +1 -2
- package/dist/types/src/features/IL-OTJ/_components/_svg/CompleteIconGreen.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/_svg/GapIcon.d.ts +1 -1
- package/dist/types/src/features/IL-OTJ/_components/_svg/GapIcon.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/_svg/HumanWithBrainIcon.d.ts +1 -2
- package/dist/types/src/features/IL-OTJ/_components/_svg/HumanWithBrainIcon.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/_svg/InfoIcon.d.ts +1 -2
- package/dist/types/src/features/IL-OTJ/_components/_svg/InfoIcon.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/_svg/LeftAndRightArrow.d.ts +1 -1
- package/dist/types/src/features/IL-OTJ/_components/_svg/LeftAndRightArrow.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/_svg/Lightbulb.d.ts +1 -1
- package/dist/types/src/features/IL-OTJ/_components/_svg/Lightbulb.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/_svg/NewChatIcon.d.ts +1 -1
- package/dist/types/src/features/IL-OTJ/_components/_svg/NewChatIcon.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/_svg/PencilEdit.d.ts +1 -2
- package/dist/types/src/features/IL-OTJ/_components/_svg/PencilEdit.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/_svg/RadioButton.d.ts +1 -2
- package/dist/types/src/features/IL-OTJ/_components/_svg/RadioButton.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/_svg/RightSideIcons.d.ts +8 -9
- package/dist/types/src/features/IL-OTJ/_components/_svg/RightSideIcons.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/_svg/ScrollToBottom.d.ts +1 -2
- package/dist/types/src/features/IL-OTJ/_components/_svg/ScrollToBottom.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/_svg/SendButton.d.ts +1 -2
- package/dist/types/src/features/IL-OTJ/_components/_svg/SendButton.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/_svg/SparkleIcon.d.ts +1 -2
- package/dist/types/src/features/IL-OTJ/_components/_svg/SparkleIcon.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/_svg/TickIcon.d.ts +1 -1
- package/dist/types/src/features/IL-OTJ/_components/_svg/TickIcon.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/_svg/UserIcon.d.ts +1 -2
- package/dist/types/src/features/IL-OTJ/_components/_svg/UserIcon.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/_svg/WarningIcon.d.ts +1 -2
- package/dist/types/src/features/IL-OTJ/_components/_svg/WarningIcon.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/_svg/WatchMeWorkIcon.d.ts +1 -2
- package/dist/types/src/features/IL-OTJ/_components/_svg/WatchMeWorkIcon.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/atoms/Button/Button.d.ts +1 -1
- package/dist/types/src/features/IL-OTJ/_components/atoms/Button/Button.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/atoms/Dropdown/Dropdown.d.ts +1 -1
- package/dist/types/src/features/IL-OTJ/_components/atoms/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/atoms/Toggle/Toggle.d.ts +1 -2
- package/dist/types/src/features/IL-OTJ/_components/atoms/Toggle/Toggle.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/index.d.ts +1 -0
- package/dist/types/src/features/IL-OTJ/_components/index.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/molecules/Condition/ConditionList.d.ts +1 -1
- package/dist/types/src/features/IL-OTJ/_components/molecules/Condition/ConditionList.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/molecules/Sections/SectionWrapper.d.ts +1 -1
- package/dist/types/src/features/IL-OTJ/_components/molecules/Sections/SectionWrapper.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/molecules/SeperationRow/SeparationRow.d.ts +1 -2
- package/dist/types/src/features/IL-OTJ/_components/molecules/SeperationRow/SeparationRow.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/organisms/ConditionSection/ConditionSection.d.ts +1 -2
- package/dist/types/src/features/IL-OTJ/_components/organisms/ConditionSection/ConditionSection.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/organisms/ConfigSection/ConfigSection.d.ts +1 -2
- package/dist/types/src/features/IL-OTJ/_components/organisms/ConfigSection/ConfigSection.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/organisms/ScopeSection/ScopeSection.d.ts +1 -1
- package/dist/types/src/features/IL-OTJ/_components/organisms/ScopeSection/ScopeSection.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/organisms/TextSection/TextSection.d.ts +1 -2
- package/dist/types/src/features/IL-OTJ/_components/organisms/TextSection/TextSection.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/templates/RuleComparison/AgentComposerRuleComparison.d.ts +1 -2
- package/dist/types/src/features/IL-OTJ/_components/templates/RuleComparison/AgentComposerRuleComparison.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/templates/RuleComparison/RuleComparison.d.ts +1 -2
- package/dist/types/src/features/IL-OTJ/_components/templates/RuleComparison/RuleComparison.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/templates/RuleComparison/RuleComparisonNew.d.ts +1 -2
- package/dist/types/src/features/IL-OTJ/_components/templates/RuleComparison/RuleComparisonNew.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/templates/Testing/Testing.d.ts +1 -2
- package/dist/types/src/features/IL-OTJ/_components/templates/Testing/Testing.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/templates/TrafficManager/CreateRule.d.ts +1 -2
- package/dist/types/src/features/IL-OTJ/_components/templates/TrafficManager/CreateRule.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/templates/TrafficManager/TrafficManagerTemplate.d.ts +1 -2
- package/dist/types/src/features/IL-OTJ/_components/templates/TrafficManager/TrafficManagerTemplate.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/_components/templates/WorkflowComposer/WorkflowComposer.d.ts +1 -2
- package/dist/types/src/features/IL-OTJ/_components/templates/WorkflowComposer/WorkflowComposer.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/store/CitationsContext.d.ts +1 -1
- package/dist/types/src/features/IL-OTJ/store/CitationsContext.d.ts.map +1 -1
- package/dist/types/src/features/InstantLearning/_components/MessageRendering.d.ts +1 -2
- package/dist/types/src/features/InstantLearning/_components/MessageRendering.d.ts.map +1 -1
- package/dist/types/src/features/InstantLearning/_components/MinimizedThinkingSteps.d.ts +1 -2
- package/dist/types/src/features/InstantLearning/_components/MinimizedThinkingSteps.d.ts.map +1 -1
- package/dist/types/src/features/InstantLearning/_components/_svg/ArrowDown.d.ts +1 -2
- package/dist/types/src/features/InstantLearning/_components/_svg/ArrowDown.d.ts.map +1 -1
- package/dist/types/src/features/InstantLearning/_components/_svg/ArrowIconBlue.d.ts +1 -2
- package/dist/types/src/features/InstantLearning/_components/_svg/ArrowIconBlue.d.ts.map +1 -1
- package/dist/types/src/features/InstantLearning/_components/_svg/CompleteIconGreen.d.ts +1 -2
- package/dist/types/src/features/InstantLearning/_components/_svg/CompleteIconGreen.d.ts.map +1 -1
- package/dist/types/src/features/InstantLearning/_components/_svg/NewChatIcon.d.ts +1 -2
- package/dist/types/src/features/InstantLearning/_components/_svg/NewChatIcon.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/AuditLog/AuditLog.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/AuditLog/ChangeLogDiff.d.ts +15 -0
- package/dist/types/src/features/LearningManagement/AuditLog/ChangeLogDiff.d.ts.map +1 -0
- package/dist/types/src/features/LearningManagement/LearningManagement.d.ts +1 -2
- package/dist/types/src/features/LearningManagement/LearningManagement.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/LearningManagementTest.d.ts +1 -2
- package/dist/types/src/features/LearningManagement/LearningManagementTest.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/RuleContent/ApprovalLearningDialog.d.ts +1 -2
- package/dist/types/src/features/LearningManagement/RuleContent/ApprovalLearningDialog.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/RuleContent/RuleContent.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/apis/scopeApis.d.ts +2 -0
- package/dist/types/src/features/LearningManagement/apis/scopeApis.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/components/CardSkeleton.d.ts +1 -2
- package/dist/types/src/features/LearningManagement/components/CardSkeleton.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/components/CreateRuleSetLegacyModal.d.ts +1 -0
- package/dist/types/src/features/LearningManagement/components/CreateRuleSetLegacyModal.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/components/InstantLearningModal.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/components/LearningTemplateManagementSkeleton.d.ts +1 -2
- package/dist/types/src/features/LearningManagement/components/LearningTemplateManagementSkeleton.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/components/RuleContentSkeleton.d.ts +1 -2
- package/dist/types/src/features/LearningManagement/components/RuleContentSkeleton.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/components/Skeleton.d.ts +1 -1
- package/dist/types/src/features/LearningManagement/components/Skeleton.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.d.ts +12 -0
- package/dist/types/src/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.d.ts.map +1 -0
- package/dist/types/src/features/LearningManagement/queries/useApprovalQueries.d.ts +2 -0
- package/dist/types/src/features/LearningManagement/queries/useApprovalQueries.d.ts.map +1 -1
- package/dist/types/src/features/UploadData/Components/SelectDataFromGoogleDrive/SelectDataFromGoogleDrive.d.ts +1 -1
- package/dist/types/src/features/UploadData/Components/SelectDataFromGoogleDrive/SelectDataFromGoogleDrive.d.ts.map +1 -1
- package/dist/types/src/features/UploadData/Components/SelectDataFromGoogleDrive/SelectDataFromGoogleDriveButton.d.ts +1 -1
- package/dist/types/src/features/UploadData/Components/SelectDataFromGoogleDrive/SelectDataFromGoogleDriveButton.d.ts.map +1 -1
- package/dist/types/src/features/UploadData/Components/SelectDataFromLocalSystem/SelectDataFromLocalSystem.d.ts +1 -1
- package/dist/types/src/features/UploadData/Components/SelectDataFromLocalSystem/SelectDataFromLocalSystem.d.ts.map +1 -1
- package/dist/types/src/features/UploadData/Components/SelectDataFromLocalSystem/SelectDataFromLocalSystemButton.d.ts +1 -1
- package/dist/types/src/features/UploadData/Components/SelectDataFromLocalSystem/SelectDataFromLocalSystemButton.d.ts.map +1 -1
- package/dist/types/src/features/UploadData/Components/SelectDataFromRLEF/Components/Dataset-collection.d.ts +1 -1
- package/dist/types/src/features/UploadData/Components/SelectDataFromRLEF/Components/Dataset-collection.d.ts.map +1 -1
- package/dist/types/src/features/UploadData/Components/SelectDataFromRLEF/Components/DatasetCollectionInfo.d.ts +1 -1
- package/dist/types/src/features/UploadData/Components/SelectDataFromRLEF/Components/DatasetCollectionInfo.d.ts.map +1 -1
- package/dist/types/src/features/UploadData/Components/SelectDataFromRLEF/Components/ProjectTaskSelect.d.ts +1 -1
- package/dist/types/src/features/UploadData/Components/SelectDataFromRLEF/Components/ProjectTaskSelect.d.ts.map +1 -1
- package/dist/types/src/features/UploadData/Components/SelectDataFromRLEF/Components/Tooltip.d.ts +1 -1
- package/dist/types/src/features/UploadData/Components/SelectDataFromRLEF/Components/Tooltip.d.ts.map +1 -1
- package/dist/types/src/features/UploadData/Components/SelectDataFromRLEF/Components/dataset-collectionFilterColumnMenuComponents/ConfidenceScoreColumnMenu.d.ts +1 -2
- package/dist/types/src/features/UploadData/Components/SelectDataFromRLEF/Components/dataset-collectionFilterColumnMenuComponents/ConfidenceScoreColumnMenu.d.ts.map +1 -1
- package/dist/types/src/features/UploadData/Components/SelectDataFromRLEF/Components/dataset-collectionFilterColumnMenuComponents/LabelColumnMenu.d.ts +1 -2
- package/dist/types/src/features/UploadData/Components/SelectDataFromRLEF/Components/dataset-collectionFilterColumnMenuComponents/LabelColumnMenu.d.ts.map +1 -1
- package/dist/types/src/features/UploadData/Components/SelectDataFromRLEF/Components/dataset-collectionFilterColumnMenuComponents/TableColumnResetFilterButton.d.ts +1 -2
- package/dist/types/src/features/UploadData/Components/SelectDataFromRLEF/Components/dataset-collectionFilterColumnMenuComponents/TableColumnResetFilterButton.d.ts.map +1 -1
- package/dist/types/src/features/UploadData/Components/SelectDataFromRLEF/Components/dataset-collectionFilterColumnMenuComponents/TagColumnMenu.d.ts +1 -2
- package/dist/types/src/features/UploadData/Components/SelectDataFromRLEF/Components/dataset-collectionFilterColumnMenuComponents/TagColumnMenu.d.ts.map +1 -1
- package/dist/types/src/features/UploadData/Components/SelectDataFromRLEF/Components/dropdown-with-radio.d.ts +1 -1
- package/dist/types/src/features/UploadData/Components/SelectDataFromRLEF/Components/dropdown-with-radio.d.ts.map +1 -1
- package/dist/types/src/features/UploadData/Components/SelectDataFromRLEF/Components/input-label-with-info.d.ts +1 -1
- package/dist/types/src/features/UploadData/Components/SelectDataFromRLEF/Components/input-label-with-info.d.ts.map +1 -1
- package/dist/types/src/features/UploadData/Components/SelectDataFromRLEF/SelectDataFromRLEF.d.ts +1 -1
- package/dist/types/src/features/UploadData/Components/SelectDataFromRLEF/SelectDataFromRLEF.d.ts.map +1 -1
- package/dist/types/src/features/UploadData/Components/SelectDataFromRLEF/SelectDataFromRLEFButton.d.ts +1 -1
- package/dist/types/src/features/UploadData/Components/SelectDataFromRLEF/SelectDataFromRLEFButton.d.ts.map +1 -1
- package/dist/types/src/features/UploadData/Components/SelectDataFromSavedDataSet/SelectDataFromSavedDataSet.d.ts +1 -1
- package/dist/types/src/features/UploadData/Components/SelectDataFromSavedDataSet/SelectDataFromSavedDataSet.d.ts.map +1 -1
- package/dist/types/src/features/UploadData/Components/SelectDataFromSavedDataSet/SelectDataFromSavedDataSetButton.d.ts +1 -1
- package/dist/types/src/features/UploadData/Components/SelectDataFromSavedDataSet/SelectDataFromSavedDataSetButton.d.ts.map +1 -1
- package/dist/types/src/plugins/ValueTypes/RadioTrafficLearning/RadioTrafficLearningRenderer.d.ts +1 -2
- package/dist/types/src/plugins/ValueTypes/RadioTrafficLearning/RadioTrafficLearningRenderer.d.ts.map +1 -1
- package/dist/types/src/routes/Routes.d.ts +1 -2
- package/dist/types/src/routes/Routes.d.ts.map +1 -1
- package/dist/types/src/utils/CustomSkeleton.d.ts +1 -1
- package/dist/types/src/utils/CustomSkeleton.d.ts.map +1 -1
- package/dist/types/src/utils/SkeletonLoader.d.ts +1 -1
- package/dist/types/src/utils/SkeletonLoader.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),r=require("@mui/material"),o=require("lucide-react"),i=require("primereact/toast"),s=require("uuid"),a=require("../../assets/Search-result(add new).svg.js"),l=require("../../store/useAuthStore.js"),u=require("../../config.js"),c=require("../../apis/scopeApis.js"),d=require("./InputField.js"),p=require("./StationAutocomplete.js"),f=require("../CardSkeleton.js"),g=require("./OnboardingLoader.js"),x=require("./TemplateCard.js"),_=[{label:"5am to 7pm",value:"05:00 AM - 7:00 PM"},{label:"6am to 7pm",value:"06:00 AM - 7:00 PM"}],m=[{label:"Low Sellout",value:"Low Sellout"},{label:"High Sellout",value:"High Sellout"},{label:"None",value:""}],h=[{label:"None",value:"None"},{label:"Distribute spots evenly across all breaks in the hour",value:"Distribute spots evenly across all breaks in the hour"}];exports.default=function(v){var S,y=v.isOpen,b=v.onClose,j=v.onBoardStation,w=v.app_integration_id,C=v.token,T=v.stationNameParam,O=t.useState(null),F=O[0],N=O[1],B=t.useState([]),A=B[0],E=B[1],M=t.useState(0),D=M[0],q=M[1],I=t.useState(!0),k=I[0],P=I[1],R=t.useState(!1),z=R[0],L=R[1],W=t.useState([]),G=W[0],U=W[1],Y=t.useState(""),H=Y[0],K=Y[1],X=t.useState(""),J=X[0],Q=X[1],V=t.useState(!1),Z=V[0],$=V[1],ee=t.useState(!1),ne=ee[0],te=ee[1],re=t.useState(null),oe=re[0],ie=re[1],se=t.useState(!1),ae=se[0],le=se[1],ue=t.useState(0),ce=ue[0],de=ue[1],pe=t.useState(""),fe=pe[0],ge=pe[1],xe=l.default().user,_e=t.useRef(null),me=t.useRef(null),he=t.useRef(null),ve=t.useRef(null),Se=t.useState({region:"",primeTime:["06:00 AM - 7:00 PM"],genre:"Music",type:"",lowSelloutConfig:""}),ye=Se[0],be=Se[1],je=function(e,n){return e.find(function(e){return e.value===n})||null},we=t.useMemo(function(){return A.map(function(e){return{label:e.scope_name,value:e.scope_name}})},[A]),Ce=t.useMemo(function(){var e,n,t;if(!ye.genre)return null;var r=A.find(function(e){return e.scope_name===ye.genre});return r?{id:r.id,title:r.scope_name||"Unnamed Template",description:(null===(e=r.description)||void 0===e?void 0:e.trim())||"No description available.",inheritedText:(null===(n=r.inheritance)||void 0===n?void 0:n[0])||void 0,rulesCount:r.rules_count||0,tiersCount:r.tier_count||0,isCopy:null!==(t=r.is_copy)&&void 0!==t&&t}:null},[ye.genre,A]);t.useEffect(function(){return function(){he.current&&clearTimeout(he.current)}},[]);var Te=function(n){return e.__awaiter(void 0,void 0,void 0,function(){var t,r,o;return e.__generator(this,function(i){switch(i.label){case 0:if(z)return[2];L(!0),i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,c.retrieveGenreScopes({limit:"20",offset:String(n)})];case 2:return"success"===(null==(t=i.sent())?void 0:t.status)&&Array.isArray(null==t?void 0:t.data)?(r=t.data,E(function(t){if(0===n)return r;var o=new Set(t.map(function(e){return e.id})),i=r.filter(function(e){return!o.has(e.id)});return e.__spreadArray(e.__spreadArray([],t,!0),i,!0)}),r.length<20?P(!1):P(!0),q(n+20)):P(!1),[3,5];case 3:return o=i.sent(),console.error("[StationOnboard] Failed to fetch genre scopes:",o),P(!1),[3,5];case 4:return L(!1),[7];case 5:return[2]}})})};t.useEffect(function(){if(y&&(E([]),q(0),P(!0),Te(0),T)){ge(T);e.__awaiter(void 0,void 0,void 0,function(){var n,t,r;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,c.fetchStationsByKeyword(T,!0)];case 1:return!0===(null==(n=e.sent())?void 0:n.success)&&Array.isArray(null==n?void 0:n.data)&&(t=n.data.find(function(e){var n;return(null===(n=e.station_name)||void 0===n?void 0:n.toLowerCase())===T.toLowerCase()&&!e.ruleset_id}),t&&N(t)),[3,3];case 2:return r=e.sent(),console.error("[StationOnboard] Error auto-selecting station:",r),[3,3];case 3:return[2]}})})}},[y,T]);t.useEffect(function(){be(F?function(n){var t;return e.__assign(e.__assign({},n),{region:null!==(t=F.market)&&void 0!==t?t:""})}:{region:"",primeTime:["06:00 AM - 7:00 PM"],genre:"Music",type:"",lowSelloutConfig:""})},[F]),t.useEffect(function(){var e=setTimeout(function(){Q(H)},500);return function(){return clearTimeout(e)}},[H]),t.useEffect(function(){e.__awaiter(void 0,void 0,void 0,function(){var n,t,r;return e.__generator(this,function(e){switch(e.label){case 0:if(!J.trim())return U([]),[2];$(!0),e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,c.searchScopes({search_string:J})];case 2:return"success"===(null==(n=e.sent())?void 0:n.status)&&Array.isArray(null==n?void 0:n.data)?(t=n.data.map(function(e){var n,t,r;return{id:e.id,title:e.scope_name||"Unnamed Template",description:(null===(n=e.description)||void 0===n?void 0:n.trim())||"No description available.",inheritedText:(null===(t=e.inheritance)||void 0===t?void 0:t[0])||void 0,rulesCount:e.rules_count||0,tiersCount:e.tier_count||0,isCopy:null!==(r=e.is_copy)&&void 0!==r&&r}}),U(t)):U([]),[3,5];case 3:return r=e.sent(),console.error("[StationOnboard] Error searching scopes:",r),U([]),[3,5];case 4:return $(!1),[7];case 5:return[2]}})})},[J]),t.useEffect(function(){!J.trim()&&Ce&&ie(Ce.id)},[J,Ce]);var Oe=function(){setTimeout(function(){ve.current&&ve.current.scrollTo({top:ve.current.scrollHeight,behavior:"smooth"})},100)},Fe=function(){ge(""),N(null),be({region:"",primeTime:["06:00 AM - 7:00 PM"],genre:"Music",type:"",lowSelloutConfig:""}),U([]),K(""),ie(null),b()},Ne=function(n,t){var r;if("primeTime"!==n){var o=null!==(r=null==t?void 0:t.value)&&void 0!==r?r:"";be(function(t){var r;return e.__assign(e.__assign({},t),((r={})[n]=String(o),r))}),"genre"===n&&(te(!0),he.current&&clearTimeout(he.current),he.current=setTimeout(function(){var e=A.find(function(e){return e.scope_name===o});ie(e?e.id:null),te(!1)},800))}else{var i=(null==t?void 0:t.value)?String(t.value):"";be(function(n){return e.__assign(e.__assign({},n),{primeTime:i?[i]:[]})})}},Be=Boolean(F&&ye.region&&ye.primeTime.length>0&&ye.genre);return n.jsxs(r.Dialog,e.__assign({open:y,onClose:Fe,maxWidth:!1,disableEscapeKeyDown:!0,PaperProps:{sx:{width:"90vw",height:"90vh",borderRadius:"12px",display:"flex",flexDirection:"column",overflow:"hidden"}}},{children:[n.jsx(i.Toast,{ref:_e}),n.jsxs(r.Box,e.__assign({sx:{p:"20px 20px 20px 27px",borderBottom:"1px solid #F0F2F5",display:"flex",justifyContent:"space-between",alignItems:"center",bgcolor:"#fff"}},{children:[n.jsxs(r.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:.5}},{children:[n.jsx(r.Typography,e.__assign({sx:{fontSize:"18px",fontWeight:600,color:"#19213D"}},{children:"Onboard a Station"})),n.jsx(r.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:400,color:"#666F8D"}},{children:"Onboard a station to start configuring learnings."}))]})),n.jsx(r.IconButton,e.__assign({onClick:Fe,disabled:ae,sx:{color:"#19213D"}},{children:n.jsx(o.X,{size:24})}))]})),n.jsxs(r.DialogContent,e.__assign({sx:{p:0,bgcolor:"#F8FAFC",display:"flex",flexDirection:"row",overflow:"hidden",position:"relative"}},{children:[n.jsx(g.default,{isLoading:ae,currentStep:ce,onComplete:function(){le(!1);var e=me.current;Fe(),j(e||void 0),me.current=null}}),n.jsxs(r.Box,e.__assign({sx:{display:"flex",flex:1,paddingY:"14px",paddingX:"20px",gap:3,overflowY:"hidden"}},{children:[n.jsxs(r.Box,e.__assign({ref:ve,sx:{flex:1,bgcolor:"#fff",p:3,borderRadius:"16px",border:"1px solid #F0F2F5",height:"100%",overflowY:"auto"}},{children:[n.jsx(r.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:600,mb:.5,color:"#19213D"}},{children:"Basic Details"})),n.jsx(r.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#00000080",mb:"20px"}},{children:"Set up basic station details to unlock AI recommended scopes."})),n.jsxs(r.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[n.jsxs(r.Box,e.__assign({className:"space-y-1.5"},{children:[n.jsxs("label",e.__assign({className:"text-sm font-medium text-[#19213D]"},{children:[n.jsx("span",e.__assign({className:"mr-0.5 text-xs font-semibold text-[#8F2C23]"},{children:"*"})),"Station Name/Call Letters"]})),n.jsx(p.default,{value:fe,onChange:ge,onStationSelect:function(e){return N(e)}})]})),n.jsx(d.default,{required:!0,disabled:!0,label:"Region",placeholder:"Select Region",value:ye.region||void 0,isSearchable:!1}),n.jsx(d.default,{required:!0,label:"Prime Time Window",placeholder:"Select Prime Time",options:_,value:je(_,(null===(S=ye.primeTime)||void 0===S?void 0:S[0])||""),onOptionChange:function(e){return Ne("primeTime",e)},isSearchable:!1}),n.jsx(r.Box,e.__assign({onClick:Oe,sx:{width:"100%"}},{children:n.jsx(d.default,{required:!0,label:"Genre",placeholder:"Select Genre",options:we,value:je(we,ye.genre),onOptionChange:function(e){return Ne("genre",e)},isSearchable:!1,onMenuScrollToBottom:function(){!z&&k&&Te(D)},isLoadingOptions:z,hasMoreOptions:k})})),n.jsx(r.Box,e.__assign({onClick:Oe,sx:{width:"100%"}},{children:n.jsx(d.default,{label:"Station Type",placeholder:"None",options:m,value:je(m,ye.type),onOptionChange:function(n){Ne("type",n),"Low Sellout"!==(null==n?void 0:n.value)&&be(function(n){return e.__assign(e.__assign({},n),{lowSelloutConfig:""})})},isSearchable:!1})})),"Low Sellout"===ye.type&&n.jsx(r.Box,e.__assign({onClick:Oe,sx:{width:"100%"}},{children:n.jsx(d.default,{label:"Low Sell Out Configurations",placeholder:"Select Configuration",options:h,value:je(h,ye.lowSelloutConfig),onOptionChange:function(e){return Ne("lowSelloutConfig",e)},isSearchable:!1})}))]}))]})),n.jsx(r.Box,e.__assign({sx:{flex:1,bgcolor:"#fff",p:3,borderRadius:"12px",border:"1px solid #F0F2F5",display:"flex",flexDirection:"column",height:"100%",overflowY:"auto"}},{children:ye.genre?n.jsxs(n.Fragment,{children:[n.jsx(r.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:500,mb:1.5}},{children:"Matching scope for your station"})),n.jsx(r.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:2,mb:4}},{children:ne?n.jsx(f.default,{}):Ce?n.jsx(x.default,e.__assign({},Ce,{isSelected:oe===Ce.id,onSelect:ie}),Ce.id):null})),n.jsx(r.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:500,mb:1.5}},{children:"Other available stations"})),n.jsxs("div",e.__assign({className:"relative mb-4 w-full"},{children:[n.jsx("input",{type:"text",value:H,onChange:function(e){return K(e.target.value)},placeholder:"Search for station...",className:"w-full rounded-lg border border-[#E2E8F0] px-10 py-[7px] text-[12px] outline-none transition-all placeholder:text-[#BAC0CC] focus:border-blue-500 focus:ring-1 focus:ring-blue-500"}),n.jsx(o.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400",size:16})]})),n.jsxs(r.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:2}},{children:[Z&&n.jsx(f.default,{}),!Z&&0===G.length&&J.trim()&&n.jsxs(r.Typography,e.__assign({sx:{fontSize:"0.875rem",color:"#64748B",textAlign:"center",py:4}},{children:['No scopes found matching "',J,'".']})),!Z&&G.map(function(t){return n.jsx(x.default,e.__assign({},t,{isSelected:oe===t.id,onSelect:ie}),t.id)})]}))]}):n.jsxs(n.Fragment,{children:[n.jsx(r.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:500,mb:1.5}},{children:"Fill in the station details to load AI recommended scopes"})),n.jsx(r.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#64748B",mb:3}},{children:"AI will recommend the most relevant scope for this station."})),n.jsx(r.Box,e.__assign({sx:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",opacity:.5,py:10}},{children:n.jsx("img",{src:a.default,alt:"Empty Result"})}))]})}))]}))]})),n.jsxs(r.Box,e.__assign({sx:{p:"12px 20px",borderTop:"1px solid #F0F2F5",display:"flex",justifyContent:"flex-end",gap:2,bgcolor:"#fff"}},{children:[n.jsx("button",e.__assign({onClick:Fe,disabled:ae,style:{padding:"7px 10px",borderRadius:"6px",color:"#64748B",border:"1px solid #E2E8F0",backgroundColor:"#fff",cursor:"pointer",fontSize:"14px",fontWeight:500}},{children:"Cancel"})),n.jsx("button",e.__assign({onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var n,t,r,o,i,a,l,d,p,f,g,x,_,m,h,v,S,y;return e.__generator(this,function(b){switch(b.label){case 0:if(!F||!oe)return console.error("[StationOnboard] Missing required data for onboarding"),[2];n=Ce?e.__spreadArray([Ce],G,!0):G,t=n.find(function(e){return e.id===oe}),r=null!==(_=null==t?void 0:t.isCopy)&&void 0!==_&&_,le(!0),de(0),o=null,b.label=1;case 1:return b.trys.push([1,3,,4]),i={topic:"customRuleSet",customScopeGroupName:(null===u.IL_CONFIG_CONSTANTS||void 0===u.IL_CONFIG_CONSTANTS?void 0:u.IL_CONFIG_CONSTANTS.CUSTOM_SCOPE_GROUP_NAME)||"Audacy-Traffic-Manager",scopeDescription:F.station_name||"New Station",parentScopeId:null,customScopeName:F.station_name||"New Station",customScopeId:s.v4(),createByName:(null==xe?void 0:xe.firstname)||"System",createdBy:(null==xe?void 0:xe.email)||"system@audacy.com",applicationMappingId:w},console.log("[StationOnboard] Step 1: Creating rule set with payload:",i),[4,c.createRuleSet(i,C)];case 2:if(a=b.sent(),!(o=null===(m=null==a?void 0:a.data)||void 0===m?void 0:m.scopeId))throw new Error("Failed to create scope - no scopeId returned");return de(1),[3,4];case 3:return l=b.sent(),console.error("[StationOnboard] Error creating rule set:",l),null===(h=_e.current)||void 0===h||h.show({severity:"error",life:3e3,summary:"Error",detail:"Failed to create rule set. Please try again."}),le(!1),de(0),[2];case 4:return b.trys.push([4,6,,11]),d={market:F.market,region:F.region,primetime_windows:ye.primeTime,genre:ye.genre,station_type:""===ye.type?null:ye.type,low_sellout_configurations:"Low Sellout"===ye.type?ye.lowSelloutConfig:null,ruleset_id:o,station_guid:F.station_guid,station_name:F.station_name||"New Station"},console.log("[StationOnboard] Step 2: Updating station with payload:",d),[4,c.updateStation(d)];case 5:return b.sent(),de(2),[3,11];case 6:p=b.sent(),console.error("[StationOnboard] Error updating station, rolling back rule set:",p),409===p.status?(null===(v=_e.current)||void 0===v||v.show({severity:"error",life:2500,summary:"Error updating station",detail:"Station already Onboarded."}),N(null),ie(null),ge(""),be(function(n){return e.__assign(e.__assign({},n),{region:""})})):null===(S=_e.current)||void 0===S||S.show({severity:"error",life:2500,summary:"Error updating station",detail:"Please try again."}),b.label=7;case 7:return b.trys.push([7,9,,10]),[4,c.deleteRuleSet(o,C)];case 8:return b.sent(),[3,10];case 9:return f=b.sent(),console.error("[StationOnboard] Failed to rollback rule set deletion:",f),[3,10];case 10:return le(!1),de(0),[2];case 11:return b.trys.push([11,13,,14]),g={source_scope_id:oe,target_scope_id:o,is_copy_parent_variant_id:r},console.log("[StationOnboard] Step 3: Inheriting scope with payload:",g),[4,c.inheritScope(g)];case 12:return b.sent(),de(3),[3,14];case 13:return x=b.sent(),console.error("[StationOnboard] Error inheriting scope (no rollback):",x),null===(y=_e.current)||void 0===y||y.show({severity:"error",life:3e3,summary:"Error",detail:"Failed to apply rule template. Please try again."}),le(!1),de(0),[2];case 14:return me.current=o,[2]}})})},disabled:!Be||ae,style:{padding:"7px 10px",borderRadius:"6px",border:"none",backgroundColor:Be?"#2563EB":"#BFDBFE",color:"#fff",cursor:Be&&!ae?"pointer":"not-allowed",fontSize:"14px",fontWeight:500,display:"flex",alignItems:"center",gap:"7px"}},{children:ae?n.jsxs(n.Fragment,{children:[n.jsx(r.CircularProgress,{size:16,color:"inherit"}),n.jsx("span",{children:"Onboarding..."})]}):n.jsxs(n.Fragment,{children:[n.jsx("span",{children:"Onboard Station"}),n.jsx(o.ArrowRight,{size:16})]})}))]}))]}))};
|
|
2
|
+
//# sourceMappingURL=BackwardStationOnboardModal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BackwardStationOnboardModal.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/cjs/features/LearningManagement/components/StationOnboarding/StationOnboardModal.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),r=require("react"),i=require("@mui/material"),o=require("lucide-react"),t=require("primereact/toast"),s=require("uuid"),a=require("../../apis/scopeApis.js"),l=require("./StationAutocomplete.js"),u=require("../CardSkeleton.js"),c=require("./OnboardingLoader.js"),p=require("./TemplateCard.js"),d=require("../../styles/StationOnboardModal.module.css.js"),x=require("./InputField.js"),g=require("../../store/useAuthStore.js"),f=require("../../store/useConfigStore.js"),h=require("../../store/useLearningTemplateStore.js"),_=require("../../config.js"),m=require("../../store/useAppSecRolesStore.js"),v=require("../../store/useEnvStore.js"),y=require("../../RuleContent/AddScopeApprovalSearchComponent.js"),S=[{label:"PT - Pacific Time",value:"Pacific Time"},{label:"MT - Mountain Time",value:"Mountain Time"},{label:"CT - Central Time",value:"Central Time"},{label:"ET - Eastern Time",value:"Eastern Time"}],b=[{label:"6am to 7pm",value:"06:00 AM - 7:00 PM"},{label:"5am to 7pm",value:"05:00 AM - 7:00 PM"}],j=[{label:"Low Sellout",value:"Low Sellout"},{label:"High Sellout",value:"High Sellout"},{label:"None",value:""}],C=[{label:"None",value:"None"},{label:"Distribute spots evenly across all breaks in the hour",value:"Distribute spots evenly across all breaks in the hour"}];exports.default=function(w){var T,B=w.isOpen,F=w.onClose,E=w.onBoardStation,k=w.app_integration_id,q=w.token,D=r.useState(null),z=D[0],O=D[1],A=r.useState([]),R=A[0],I=A[1],L=r.useState(0),N=L[0],M=L[1],W=r.useState(!0),P=W[0],G=W[1],U=r.useState(!1),H=U[0],K=U[1],Y=r.useState([]),X=Y[0],Z=Y[1],V=r.useState(""),J=V[0],Q=V[1],$=r.useState(""),ee=$[0],ne=$[1],re=r.useState(!1),ie=re[0],oe=re[1],te=r.useState(!1),se=te[0],ae=te[1],le=r.useState(null),ue=le[0],ce=le[1],pe=r.useState(null);pe[0],pe[1];var de=r.useState(!1),xe=de[0],ge=de[1],fe=r.useState(0),he=fe[0],_e=fe[1],me=r.useState(""),ve=me[0],ye=me[1],Se=g.default().user,be=r.useRef(null),je=r.useRef(null),Ce=r.useRef(null),we=r.useRef(null);f.useConfigStore().configuration;var Te=r.useRef(null),Be=m.useAppSecRolesStore(function(e){return e.roles}),Fe=v.default(function(e){return e.rbacConfig}),Ee=r.useState("approval_required"),ke=Ee[0],qe=Ee[1],De=r.useState([]),ze=De[0],Oe=De[1],Ae=r.useState([]),Re=Ae[0],Ie=Ae[1],Le=r.useState(""),Ne=Le[0],Me=Le[1],We=r.useState({region:"",timezone:"",primeTime:[],genre:"",type:"",lowSelloutConfig:""}),Pe=We[0],Ge=We[1],Ue=function(e,n){return e.find(function(e){return e.value===n})||null},He=r.useMemo(function(){return R.map(function(e){return{label:e.scope_name,value:e.scope_name}})},[R]),Ke=r.useMemo(function(){var e,n,r;if(!Pe.genre)return null;var i=R.find(function(e){return e.scope_name===Pe.genre});return i?{id:i.id,title:i.scope_name||"Unnamed Template",description:(null===(e=i.description)||void 0===e?void 0:e.trim())||"No description available.",inheritedText:(null===(n=i.inheritance)||void 0===n?void 0:n[0])||void 0,rulesCount:i.rules_count||0,tiersCount:i.tier_count||0,isCopy:null!==(r=i.is_copy)&&void 0!==r&&r}:null},[Pe.genre,R]);r.useEffect(function(){return function(){Ce.current&&clearTimeout(Ce.current)}},[]);var Ye=function(n){return e.__awaiter(void 0,void 0,void 0,function(){var r,i,o;return e.__generator(this,function(t){switch(t.label){case 0:if(H)return[2];K(!0),t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,a.retrieveGenreScopes({limit:"20",offset:String(n)})];case 2:return"success"===(null==(r=t.sent())?void 0:r.status)&&Array.isArray(null==r?void 0:r.data)?(i=r.data,I(function(r){if(0===n)return i;var o=new Set(r.map(function(e){return e.id})),t=i.filter(function(e){return!o.has(e.id)});return e.__spreadArray(e.__spreadArray([],r,!0),t,!0)}),i.length<20?G(!1):G(!0),M(n+20)):G(!1),[3,5];case 3:return o=t.sent(),console.error("[StationOnboard] Failed to fetch genre scopes:",o),G(!1),[3,5];case 4:return K(!1),[7];case 5:return[2]}})})};r.useEffect(function(){B&&(I([]),M(0),G(!0),Ye(0))},[B]);r.useEffect(function(){Ge(z?function(n){var r;return e.__assign(e.__assign({},n),{region:null!==(r=z.market)&&void 0!==r?r:""})}:{region:"",timezone:"",primeTime:[],genre:"",type:"",lowSelloutConfig:""})},[z]),r.useEffect(function(){var e=setTimeout(function(){ne(J)},500);return function(){return clearTimeout(e)}},[J]),r.useEffect(function(){e.__awaiter(void 0,void 0,void 0,function(){var n,r,i,o;return e.__generator(this,function(e){switch(e.label){case 0:if(!ee.trim())return Z([]),[2];oe(!0),e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,a.searchScopes({search_string:ee.trim()})];case 2:return"success"===(null==(n=e.sent())?void 0:n.status)&&Array.isArray(null==n?void 0:n.data)?(r=n.data.filter(function(e){var n,r=null!==(n=e.inheritance)&&void 0!==n?n:[],i=r.indexOf(e.scope_name);return!(i<=0)&&r[i-1]===Pe.genre}),i=r.map(function(e){var n,r,i;return{id:e.id,title:e.scope_name||"Unnamed Template",description:(null===(n=e.description)||void 0===n?void 0:n.trim())||"No description available.",inheritedText:(null===(r=e.inheritance)||void 0===r?void 0:r[0])||void 0,rulesCount:e.rules_count||0,tiersCount:e.tier_count||0,isCopy:null!==(i=e.is_copy)&&void 0!==i&&i}}),Z(i)):Z([]),[3,5];case 3:return o=e.sent(),console.error("[StationOnboard] Error searching scopes:",o),Z([]),[3,5];case 4:return oe(!1),[7];case 5:return[2]}})})},[ee,Pe.genre]),r.useEffect(function(){!ee.trim()&&Ke&&ce(Ke.id)},[ee,Ke]);var Xe=function(){setTimeout(function(){we.current&&we.current.scrollTo({top:we.current.scrollHeight,behavior:"smooth"})},100)},Ze=function(){ye(""),O(null),Ge({region:"",timezone:"",primeTime:[],genre:"",type:"",lowSelloutConfig:""}),Z([]),Q(""),ce(null),qe("approval_required"),Oe([]),Ie([]),Me(""),F()},Ve=function(n,r){var i;if("primeTime"!==n){var o=null!==(i=null==r?void 0:r.value)&&void 0!==i?i:"";Ge(function(r){var i;return e.__assign(e.__assign({},r),((i={})[n]=String(o),i))}),"genre"===n&&(ae(!0),Ce.current&&clearTimeout(Ce.current),Ce.current=setTimeout(function(){var e=R.find(function(e){return e.scope_name===o});ce(e?e.id:null),ae(!1)},800))}else{var t=(null==r?void 0:r.value)?String(r.value):"";Ge(function(n){return e.__assign(e.__assign({},n),{primeTime:t?[t]:[]})})}},Je=Boolean(z&&Pe.region&&Pe.timezone&&Pe.primeTime.length>0&&Pe.genre);return n.jsxs(i.Dialog,e.__assign({open:B,onClose:Ze,maxWidth:!1,disableEscapeKeyDown:!0,PaperProps:{sx:{width:"90vw",height:"90vh",borderRadius:"12px",display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"sans-serif"}}},{children:[n.jsx(t.Toast,{ref:be}),n.jsxs(i.Box,e.__assign({sx:{p:"20px 20px 20px 27px",borderBottom:"1px solid #F0F2F5",display:"flex",justifyContent:"space-between",alignItems:"center",bgcolor:"#fff"}},{children:[n.jsxs(i.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:.5}},{children:[n.jsx(i.Typography,e.__assign({sx:{fontSize:"18px",fontWeight:600,color:"#19213D"}},{children:"Onboard a Station"})),n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:400,color:"#666F8D"}},{children:"Onboard a station to start configuring learnings."}))]})),n.jsx(i.IconButton,e.__assign({onClick:Ze,disabled:xe,sx:{color:"#19213D"}},{children:n.jsx(o.X,{size:24})}))]})),n.jsxs(i.DialogContent,e.__assign({sx:{p:0,bgcolor:"#F8FAFC",display:"flex",flexDirection:"row",overflow:"hidden",position:"relative"}},{children:[n.jsx(c.default,{isLoading:xe,currentStep:he,onComplete:function(){ge(!1);var e=je.current;Ze(),E(e||void 0),je.current=null}}),n.jsx(i.Box,e.__assign({sx:{display:"flex",flex:1,flexDirection:"column",paddingY:"14px",paddingX:"20px",gap:2,overflowY:"auto"}},{children:n.jsxs(i.Box,e.__assign({sx:{display:"flex",gap:3}},{children:[n.jsxs(i.Box,e.__assign({ref:we,sx:{flex:1,bgcolor:"#fff",p:3,borderRadius:"16px",border:"1px solid #F0F2F5"}},{children:[n.jsx(i.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:600,mb:.5,color:"#19213D"}},{children:"Basic Details"})),n.jsx(i.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#00000080",mb:"20px"}},{children:"Set up basic station details to unlock AI recommended scopes."})),n.jsxs(i.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[n.jsxs(i.Box,e.__assign({className:d.default.formGroup},{children:[n.jsxs("label",e.__assign({className:d.default.label},{children:[n.jsx("span",e.__assign({className:d.default.asterisk},{children:"*"})),"Station Name/Call Letters"]})),n.jsx(l.default,{value:ve,onChange:ye,onStationSelect:function(e){return O(e)}})]})),n.jsx(x.default,{required:!0,disabled:!0,label:"Region",placeholder:"Select Region",value:Pe.region||void 0,isSearchable:!1}),n.jsx(x.default,{required:!0,label:"TimeZone",placeholder:"Select TimeZone",options:S,value:Ue(S,Pe.timezone),onOptionChange:function(e){return Ve("timezone",e)},isSearchable:!1}),n.jsx(x.default,{required:!0,label:"Prime Time Window",placeholder:"Select Prime Time",options:b,value:Ue(b,(null===(T=Pe.primeTime)||void 0===T?void 0:T[0])||""),onOptionChange:function(e){return Ve("primeTime",e)},isSearchable:!1}),n.jsx(i.Box,e.__assign({onClick:Xe,sx:{width:"100%"}},{children:n.jsx(x.default,{label:"Station Type",placeholder:"None",options:j,value:Ue(j,Pe.type),onOptionChange:function(n){Ve("type",n),"Low Sellout"!==(null==n?void 0:n.value)&&Ge(function(n){return e.__assign(e.__assign({},n),{lowSelloutConfig:""})})},isSearchable:!1})})),"Low Sellout"===Pe.type&&n.jsx(i.Box,e.__assign({onClick:Xe,sx:{width:"100%"}},{children:n.jsx(x.default,{label:"Low Sell Out Configurations",placeholder:"Select Configuration",options:C,value:Ue(C,Pe.lowSelloutConfig),onOptionChange:function(e){return Ve("lowSelloutConfig",e)},isSearchable:!1})})),h.useLearningTemplateStore.getState().backwardCompatibility&&n.jsxs("div",e.__assign({ref:Te,style:{display:"flex",flexDirection:"column",marginTop:"12px"}},{children:[n.jsx(i.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:600,mb:.5,color:"#19213D"}},{children:"Approval Settings"})),n.jsx(i.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#00000080",mb:"20px"}},{children:"Configure who can approve learnings before they get published."})),n.jsxs("div",e.__assign({style:{marginBottom:"12px",fontSize:"12px",color:"#8F2C23",gap:"16px"}},{children:[n.jsxs("div",e.__assign({style:{marginBottom:"12px",fontSize:"12px",color:"#8F2C23",gap:"12px"}},{children:[n.jsxs("div",e.__assign({role:"radio","aria-checked":"approval_required"===ke,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:"4px",marginBottom:"8px"},onClick:function(){return qe("approval_required")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||qe("approval_required")}},{children:[n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[n.jsx("div",e.__assign({style:{display:"flex",height:"16px",width:"16px",flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("approval_required"===ke?"#2563EB":"#CBD5E1")}},{children:"approval_required"===ke&&n.jsx("div",{style:{height:"8px",width:"8px",borderRadius:"50%",backgroundColor:"#2563EB"}})})),n.jsx("span",e.__assign({style:{fontSize:"14px",fontWeight:500,color:"#19213D"}},{children:"Approval Required Before Publishing"}))]})),n.jsx("p",e.__assign({style:{margin:0,marginLeft:"24px",fontSize:"12px",color:"#666F8D"}},{children:"Learnings require approval before publishing."}))]})),n.jsxs("div",e.__assign({style:{gap:"16px"}},{children:["approval_required"===ke&&n.jsx(y.default,{selectedApprovers:ze,selectedGroupOfApprovers:Re,onApproversChange:function(e){Oe(e),Me("")},onGroupsChange:function(e){Ie(e),Me("")}}),Ne&&n.jsx("p",e.__assign({style:{margin:0,marginLeft:"24px",fontSize:"12px",color:"#8F2C23"}},{children:Ne}))]}))]})),n.jsxs("div",e.__assign({role:"radio","aria-checked":"publish_without"===ke,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:"4px"},onClick:function(){qe("publish_without"),Me("")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||(qe("publish_without"),Me(""))}},{children:[n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[n.jsx("div",e.__assign({style:{display:"flex",height:"16px",width:"16px",flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("publish_without"===ke?"#2563EB":"#CBD5E1")}},{children:"publish_without"===ke&&n.jsx("div",{style:{height:"8px",width:"8px",borderRadius:"50%",backgroundColor:"#2563EB"}})})),n.jsx("span",e.__assign({style:{fontSize:"14px",fontWeight:500,color:"#19213D"}},{children:"Publish Without Approval"}))]})),n.jsx("p",e.__assign({style:{margin:0,marginLeft:"24px",fontSize:"12px",color:"#666F8D"}},{children:"Learnings can be published directly."}))]}))]}))]}))]}))]})),n.jsxs(i.Box,e.__assign({sx:{flex:1,bgcolor:"#fff",p:3,borderRadius:"12px",border:"1px solid #F0F2F5",display:"flex",flexDirection:"column"}},{children:[n.jsxs(i.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:600,mb:.5,color:"#19213D"}},{children:[n.jsx("span",e.__assign({style:{color:"#E53E3E",marginRight:"2px"}},{children:"*"})),"Select a scope for your station"]})),n.jsx(i.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#64748B",mb:"16px"}},{children:"Your station will inherit the rules from the selected scope."})),n.jsx(i.Box,e.__assign({sx:{mb:2}},{children:n.jsx(x.default,{required:!0,label:"",placeholder:"Select Genre",options:He,value:Ue(He,Pe.genre),onOptionChange:function(e){return Ve("genre",e)},isSearchable:!1,onMenuScrollToBottom:function(){!H&&P&&Ye(N)},isLoadingOptions:H,hasMoreOptions:P})})),n.jsx(i.Box,e.__assign({sx:{mb:3}},{children:se?n.jsx(u.default,{}):Ke?n.jsxs(i.Box,e.__assign({sx:{border:"1.5px solid #2563EB",borderRadius:"10px",p:"14px 16px",bgcolor:"#EFF6FF",display:"flex",alignItems:"flex-start",gap:"12px"}},{children:[n.jsx(i.Box,e.__assign({sx:{width:36,height:36,borderRadius:"8px",bgcolor:"#DBEAFE",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0}},{children:n.jsxs("svg",e.__assign({width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"#2563EB",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:[n.jsx("circle",{cx:"12",cy:"12",r:"2"}),n.jsx("path",{d:"M16.24 7.76a6 6 0 0 1 0 8.49m-8.48-.01a6 6 0 0 1 0-8.49m11.31-2.82a10 10 0 0 1 0 14.14m-14.14 0a10 10 0 0 1 0-14.14"})]}))})),n.jsxs(i.Box,e.__assign({sx:{flex:1,minWidth:0}},{children:[n.jsx(i.Typography,e.__assign({sx:{fontSize:"0.875rem",fontWeight:600,color:"#1E3A5F",mb:"2px"}},{children:Ke.title})),n.jsx(i.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#2563EB",mb:"8px"}},{children:Ke.description})),n.jsxs(i.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"}},{children:[Ke.inheritedText&&n.jsxs(i.Box,e.__assign({component:"span",sx:{fontSize:"0.7rem",color:"#475569",bgcolor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"4px",px:"6px",py:"2px",display:"inline-flex",alignItems:"center",gap:"4px"}},{children:[n.jsxs("svg",e.__assign({width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:[n.jsx("polyline",{points:"15 3 21 3 21 9"}),n.jsx("path",{d:"M21 3L9 15"}),n.jsx("path",{d:"M3 21l6-6"})]})),Ke.inheritedText]})),n.jsxs(i.Box,e.__assign({component:"span",sx:{fontSize:"0.7rem",color:"#475569",bgcolor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"4px",px:"6px",py:"2px"}},{children:[Ke.rulesCount," rules"]})),n.jsxs(i.Box,e.__assign({component:"span",sx:{fontSize:"0.7rem",color:"#475569",bgcolor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"4px",px:"6px",py:"2px"}},{children:[Ke.tiersCount," Tiers"]}))]}))]}))]})):Pe.genre?null:n.jsx(i.Box,e.__assign({sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",opacity:.4,py:6,gap:1}},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#94A3B8"}},{children:"Select a genre to load the matching scope"}))}))})),Pe.genre&&n.jsxs(n.Fragment,{children:[n.jsxs(i.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:600,mb:.5,color:"#19213D"}},{children:["Select an Existing Station from the “",Pe.genre,"” Scope"," ",n.jsx(i.Typography,e.__assign({component:"span",sx:{fontSize:"1rem",fontWeight:400,color:"#64748B"}},{children:"(Optional)"}))]})),n.jsxs(i.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#64748B",mb:"12px"}},{children:["Please select an existing station under the “",Pe.genre,"” category to copy its learnings."]})),n.jsxs("div",e.__assign({className:d.default.searchWrapper,style:{marginBottom:"12px"}},{children:[n.jsx("input",{type:"text",value:J,onChange:function(e){return Q(e.target.value)},placeholder:"Search for station...",className:d.default.searchInput}),n.jsx(o.Search,{className:d.default.searchIcon,size:16})]})),n.jsxs(i.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:2}},{children:[ie&&n.jsx(u.default,{}),!ie&&0===X.length&&ee.trim()&&n.jsxs(i.Typography,e.__assign({sx:{fontSize:"0.875rem",color:"#64748B",textAlign:"center",py:4}},{children:['No scopes found matching "',ee,'".']})),!ie&&X.map(function(r){return n.jsx(p.default,e.__assign({},r,{isSelected:ue===r.id,onSelect:function(e){var n;ce(ue===e?null!==(n=null==Ke?void 0:Ke.id)&&void 0!==n?n:null:e)}}),r.id)})]}))]})]}))]}))}))]})),n.jsxs(i.Box,e.__assign({sx:{p:"12px 20px",borderTop:"1px solid #F0F2F5",display:"flex",justifyContent:"flex-end",gap:2,bgcolor:"#fff"}},{children:[n.jsx("button",e.__assign({onClick:Ze,disabled:xe,style:{padding:"7px 10px",borderRadius:"6px",color:"#64748B",border:"1px solid #E2E8F0",backgroundColor:"#fff",cursor:"pointer",fontSize:"14px",fontWeight:500}},{children:"Cancel"})),n.jsx("button",e.__assign({onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var n,r,i,o,t,l,u,c,p,d,x,g,f,m,v,y,S,b;return e.__generator(this,function(j){switch(j.label){case 0:if(!z||!ue)return console.error("[StationOnboard] Missing required data for onboarding"),[2];if(h.useLearningTemplateStore.getState().backwardCompatibility&&"approval_required"===ke&&0===ze.length&&0===Re.length)return Me("Please select at least one approver or approver group."),setTimeout(function(){var e;null===(e=Te.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"center"})},50),[2];Me(""),n=Ke?e.__spreadArray([Ke],X,!0):X,r=n.find(function(e){return e.id===ue}),null==r?void 0:r.isCopy,ge(!0),_e(0),i=null,j.label=1;case 1:return j.trys.push([1,3,,4]),o=h.useLearningTemplateStore.getState().backwardCompatibility,t=o?{topic:"customRuleSet",customScopeGroupName:_.IL_CONFIG_CONSTANTS.CUSTOM_SCOPE_GROUP_NAME,scopeDescription:z.station_name||"New Station",parentScopeId:null,customScopeName:z.station_name||"New Station",customScopeId:s.v4(),createByName:(null==Se?void 0:Se.firstname)||"System",createdBy:(null==Se?void 0:Se.email)||"system@audacy.com",scopeType:"Station",approvalRequired:"approval_required"===ke,audacyStationMetadata:{genre:Pe.genre,low_sellout_configurations:"Low Sellout"===Pe.type?Pe.lowSelloutConfig:null,market:z.market,primetime_windows:Pe.primeTime,region:z.region,station_guid:z.station_guid,station_type:""===Pe.type?null:Pe.type},appsecData:{application:null==Fe?void 0:Fe.applicationId,module:null==Fe?void 0:Fe.moduleId,roles:e.__spreadArray(e.__spreadArray([],"approval_required"===ke?[{users:ze.map(function(e){return e.email}),groups:Re.map(function(e){return e._id}),role:null!==(g=null===(x=Be.find(function(e){return"Learning Manager"===e.name}))||void 0===x?void 0:x._id)&&void 0!==g?g:""}]:[],!0),[{users:[null==Se?void 0:Se.email],groups:[],role:null!==(m=null===(f=Be.find(function(e){return"Instant Learning Admin"===e.name}))||void 0===f?void 0:f._id)&&void 0!==m?m:""}],!1)}}:{topic:"customRuleSet",scope_reference_id:null,scopeDescription:"demo",parentScopeId:null,scopeName:z.station_name||"New Station",scopeReferenceMetadata:{},applicationMappingId:k},console.log("[StationOnboard] Step 1: Creating rule set with payload:",t),[4,a.createRuleSet(t,q)];case 2:if(l=j.sent(),!(i=null===(v=null==l?void 0:l.data)||void 0===v?void 0:v.scopeId))throw new Error("Failed to create scope - no scopeId returned");return console.log("[StationOnboard] Step 1 Complete: Created scope with ID:",i),_e(1),[3,4];case 3:return u=j.sent(),console.error("[StationOnboard] Error creating rule set:",u),null===(y=be.current)||void 0===y||y.show({severity:"error",life:3e3,summary:"Error",detail:"Failed to create rule set. Please try again."}),ge(!1),_e(0),[2];case 4:return j.trys.push([4,6,,7]),c=null!==ue&&ue!==(null==Ke?void 0:Ke.id),p={source_scope_id:c?ue:null!==(S=null==Ke?void 0:Ke.id)&&void 0!==S?S:ue,target_scope_id:i,is_copy_parent_variant_id:c},console.log("[StationOnboard] Step 3: Inheriting scope with payload:",p),[4,a.inheritScopeBackwardCompatible(p)];case 5:return j.sent(),console.log("[StationOnboard] Step 3 Complete: Scope inherited"),_e(3),[3,7];case 6:return d=j.sent(),console.error("[StationOnboard] Error inheriting scope (no rollback):",d),null===(b=be.current)||void 0===b||b.show({severity:"error",life:3e3,summary:"Error",detail:"Failed to apply rule template. Please try again."}),ge(!1),_e(0),[2];case 7:return je.current=i,console.log("[StationOnboard] Onboarding completed successfully!"),[2]}})})},disabled:!Je||xe,style:{padding:"7px 10px",borderRadius:"6px",border:"none",backgroundColor:Je?"#2563EB":"#BFDBFE",color:"#fff",cursor:Je&&!xe?"pointer":"not-allowed",fontSize:"14px",fontWeight:500,display:"flex",alignItems:"center",gap:"7px"}},{children:xe?n.jsxs(n.Fragment,{children:[n.jsx(i.CircularProgress,{size:16,color:"inherit"}),n.jsx("span",{children:"Onboarding..."})]}):n.jsxs(n.Fragment,{children:[n.jsx("span",{children:"Onboard Station"}),n.jsx(o.ArrowRight,{size:16})]})}))]}))]}))};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),r=require("react"),i=require("@mui/material"),o=require("lucide-react"),t=require("primereact/toast"),s=require("uuid"),l=require("../../apis/scopeApis.js"),a=require("./StationAutocomplete.js"),u=require("../CardSkeleton.js"),c=require("./OnboardingLoader.js"),p=require("./TemplateCard.js"),d=require("../../styles/StationOnboardModal.module.css.js"),x=require("./InputField.js"),g=require("../../store/useAuthStore.js"),f=require("../../store/useConfigStore.js"),h=require("../../store/useLearningTemplateStore.js"),_=require("../../config.js"),m=require("../../store/useAppSecRolesStore.js"),v=require("../../store/useEnvStore.js"),y=require("../../RuleContent/AddScopeApprovalSearchComponent.js"),S=[{label:"PT - Pacific Time",value:"Pacific Time"},{label:"MT - Mountain Time",value:"Mountain Time"},{label:"CT - Central Time",value:"Central Time"},{label:"ET - Eastern Time",value:"Eastern Time"}],b=[{label:"6am to 7pm",value:"06:00 AM - 7:00 PM"},{label:"5am to 7pm",value:"05:00 AM - 7:00 PM"}],j=[{label:"Low Sellout",value:"Low Sellout"},{label:"High Sellout",value:"High Sellout"},{label:"None",value:""}],C=[{label:"None",value:"None"},{label:"Distribute spots evenly across all breaks in the hour",value:"Distribute spots evenly across all breaks in the hour"}];exports.default=function(w){var T,B=w.isOpen,F=w.onClose,E=w.onBoardStation,k=w.app_integration_id,q=w.token,D=r.useState(null),z=D[0],O=D[1],A=r.useState([]),R=A[0],I=A[1],L=r.useState(0),N=L[0],M=L[1],W=r.useState(!0),P=W[0],G=W[1],U=r.useState(!1),H=U[0],K=U[1],Y=r.useState([]),X=Y[0],Z=Y[1],V=r.useState(""),J=V[0],Q=V[1],$=r.useState(""),ee=$[0],ne=$[1],re=r.useState(!1),ie=re[0],oe=re[1],te=r.useState(!1),se=te[0],le=te[1],ae=r.useState(null),ue=ae[0],ce=ae[1],pe=r.useState(null);pe[0],pe[1];var de=r.useState(!1),xe=de[0],ge=de[1],fe=r.useState(0),he=fe[0],_e=fe[1],me=r.useState(""),ve=me[0],ye=me[1],Se=g.default().user,be=r.useRef(null),je=r.useRef(null),Ce=r.useRef(null),we=r.useRef(null);f.useConfigStore().configuration;var Te=r.useRef(null),Be=m.useAppSecRolesStore(function(e){return e.roles}),Fe=v.default(function(e){return e.rbacConfig}),Ee=r.useState("approval_required"),ke=Ee[0],qe=Ee[1],De=r.useState([]),ze=De[0],Oe=De[1],Ae=r.useState([]),Re=Ae[0],Ie=Ae[1],Le=r.useState(""),Ne=Le[0],Me=Le[1],We=r.useState({region:"",timezone:"",primeTime:[],genre:"",type:"",lowSelloutConfig:""}),Pe=We[0],Ge=We[1],Ue=function(e,n){return e.find(function(e){return e.value===n})||null},He=r.useMemo(function(){return R.map(function(e){return{label:e.scope_name,value:e.scope_name}})},[R]),Ke=r.useMemo(function(){var e,n,r;if(!Pe.genre)return null;var i=R.find(function(e){return e.scope_name===Pe.genre});return i?{id:i.id,title:i.scope_name||"Unnamed Template",description:(null===(e=i.description)||void 0===e?void 0:e.trim())||"No description available.",inheritedText:(null===(n=i.inheritance)||void 0===n?void 0:n[0])||void 0,rulesCount:i.rules_count||0,tiersCount:i.tier_count||0,isCopy:null!==(r=i.is_copy)&&void 0!==r&&r}:null},[Pe.genre,R]);r.useEffect(function(){return function(){Ce.current&&clearTimeout(Ce.current)}},[]);var Ye=function(n){return e.__awaiter(void 0,void 0,void 0,function(){var r,i,o;return e.__generator(this,function(t){switch(t.label){case 0:if(H)return[2];K(!0),t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,l.retrieveGenreScopes({limit:"20",offset:String(n)})];case 2:return"success"===(null==(r=t.sent())?void 0:r.status)&&Array.isArray(null==r?void 0:r.data)?(i=r.data,I(function(r){if(0===n)return i;var o=new Set(r.map(function(e){return e.id})),t=i.filter(function(e){return!o.has(e.id)});return e.__spreadArray(e.__spreadArray([],r,!0),t,!0)}),i.length<20?G(!1):G(!0),M(n+20)):G(!1),[3,5];case 3:return o=t.sent(),console.error("[StationOnboard] Failed to fetch genre scopes:",o),G(!1),[3,5];case 4:return K(!1),[7];case 5:return[2]}})})};r.useEffect(function(){B&&(I([]),M(0),G(!0),Ye(0))},[B]);r.useEffect(function(){Ge(z?function(n){var r;return e.__assign(e.__assign({},n),{region:null!==(r=z.market)&&void 0!==r?r:""})}:{region:"",timezone:"",primeTime:[],genre:"",type:"",lowSelloutConfig:""})},[z]),r.useEffect(function(){var e=setTimeout(function(){ne(J)},500);return function(){return clearTimeout(e)}},[J]),r.useEffect(function(){e.__awaiter(void 0,void 0,void 0,function(){var n,r,i,o;return e.__generator(this,function(e){switch(e.label){case 0:if(!ee.trim())return Z([]),[2];oe(!0),e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,l.searchScopes({search_string:ee.trim()})];case 2:return"success"===(null==(n=e.sent())?void 0:n.status)&&Array.isArray(null==n?void 0:n.data)?(r=n.data.filter(function(e){var n,r=null!==(n=e.inheritance)&&void 0!==n?n:[],i=r.indexOf(e.scope_name);return!(i<=0)&&r[i-1]===Pe.genre}),i=r.map(function(e){var n,r,i;return{id:e.id,title:e.scope_name||"Unnamed Template",description:(null===(n=e.description)||void 0===n?void 0:n.trim())||"No description available.",inheritedText:(null===(r=e.inheritance)||void 0===r?void 0:r[0])||void 0,rulesCount:e.rules_count||0,tiersCount:e.tier_count||0,isCopy:null!==(i=e.is_copy)&&void 0!==i&&i}}),Z(i)):Z([]),[3,5];case 3:return o=e.sent(),console.error("[StationOnboard] Error searching scopes:",o),Z([]),[3,5];case 4:return oe(!1),[7];case 5:return[2]}})})},[ee,Pe.genre]),r.useEffect(function(){!ee.trim()&&Ke&&ce(Ke.id)},[ee,Ke]);var Xe=function(){setTimeout(function(){we.current&&we.current.scrollTo({top:we.current.scrollHeight,behavior:"smooth"})},100)},Ze=function(){ye(""),O(null),Ge({region:"",timezone:"",primeTime:[],genre:"",type:"",lowSelloutConfig:""}),Z([]),Q(""),ce(null),qe("approval_required"),Oe([]),Ie([]),Me(""),F()},Ve=function(n,r){var i;if("primeTime"!==n){var o=null!==(i=null==r?void 0:r.value)&&void 0!==i?i:"";Ge(function(r){var i;return e.__assign(e.__assign({},r),((i={})[n]=String(o),i))}),"genre"===n&&(le(!0),Ce.current&&clearTimeout(Ce.current),Ce.current=setTimeout(function(){var e=R.find(function(e){return e.scope_name===o});ce(e?e.id:null),le(!1)},800))}else{var t=(null==r?void 0:r.value)?String(r.value):"";Ge(function(n){return e.__assign(e.__assign({},n),{primeTime:t?[t]:[]})})}},Je=Boolean(z&&Pe.region&&Pe.timezone&&Pe.primeTime.length>0&&Pe.genre);return n.jsxs(i.Dialog,e.__assign({open:B,onClose:Ze,maxWidth:!1,disableEscapeKeyDown:!0,PaperProps:{sx:{width:"90vw",height:"90vh",borderRadius:"12px",display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"sans-serif"}}},{children:[n.jsx(t.Toast,{ref:be}),n.jsxs(i.Box,e.__assign({sx:{p:"20px 20px 20px 27px",borderBottom:"1px solid #F0F2F5",display:"flex",justifyContent:"space-between",alignItems:"center",bgcolor:"#fff"}},{children:[n.jsxs(i.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:.5}},{children:[n.jsx(i.Typography,e.__assign({sx:{fontSize:"18px",fontWeight:600,color:"#19213D"}},{children:"Onboard a Station"})),n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:400,color:"#666F8D"}},{children:"Onboard a station to start configuring learnings."}))]})),n.jsx(i.IconButton,e.__assign({onClick:Ze,disabled:xe,sx:{color:"#19213D"}},{children:n.jsx(o.X,{size:24})}))]})),n.jsxs(i.DialogContent,e.__assign({sx:{p:0,bgcolor:"#F8FAFC",display:"flex",flexDirection:"row",overflow:"hidden",position:"relative"}},{children:[n.jsx(c.default,{isLoading:xe,currentStep:he,onComplete:function(){ge(!1);var e=je.current;Ze(),E(e||void 0),je.current=null}}),n.jsx(i.Box,e.__assign({sx:{display:"flex",flex:1,flexDirection:"column",paddingY:"14px",paddingX:"20px",gap:2,overflowY:"auto"}},{children:n.jsxs(i.Box,e.__assign({sx:{display:"flex",gap:3}},{children:[n.jsxs(i.Box,e.__assign({ref:we,sx:{flex:1,bgcolor:"#fff",p:3,borderRadius:"16px",border:"1px solid #F0F2F5"}},{children:[n.jsx(i.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:600,mb:.5,color:"#19213D"}},{children:"Basic Details"})),n.jsx(i.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#00000080",mb:"20px"}},{children:"Set up basic station details to unlock AI recommended scopes."})),n.jsxs(i.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[n.jsxs(i.Box,e.__assign({className:d.default.formGroup},{children:[n.jsxs("label",e.__assign({className:d.default.label},{children:[n.jsx("span",e.__assign({className:d.default.asterisk},{children:"*"})),"Station Name/Call Letters"]})),n.jsx(a.default,{value:ve,onChange:ye,onStationSelect:function(e){return O(e)}})]})),n.jsx(x.default,{required:!0,disabled:!0,label:"Region",placeholder:"Select Region",value:Pe.region||void 0,isSearchable:!1}),n.jsx(x.default,{required:!0,label:"TimeZone",placeholder:"Select TimeZone",options:S,value:Ue(S,Pe.timezone),onOptionChange:function(e){return Ve("timezone",e)},isSearchable:!1}),n.jsx(x.default,{required:!0,label:"Prime Time Window",placeholder:"Select Prime Time",options:b,value:Ue(b,(null===(T=Pe.primeTime)||void 0===T?void 0:T[0])||""),onOptionChange:function(e){return Ve("primeTime",e)},isSearchable:!1}),n.jsx(i.Box,e.__assign({onClick:Xe,sx:{width:"100%"}},{children:n.jsx(x.default,{label:"Station Type",placeholder:"None",options:j,value:Ue(j,Pe.type),onOptionChange:function(n){Ve("type",n),"Low Sellout"!==(null==n?void 0:n.value)&&Ge(function(n){return e.__assign(e.__assign({},n),{lowSelloutConfig:""})})},isSearchable:!1})})),"Low Sellout"===Pe.type&&n.jsx(i.Box,e.__assign({onClick:Xe,sx:{width:"100%"}},{children:n.jsx(x.default,{label:"Low Sell Out Configurations",placeholder:"Select Configuration",options:C,value:Ue(C,Pe.lowSelloutConfig),onOptionChange:function(e){return Ve("lowSelloutConfig",e)},isSearchable:!1})})),h.useLearningTemplateStore.getState().backwardCompatibility&&n.jsxs("div",e.__assign({ref:Te,style:{display:"flex",flexDirection:"column",marginTop:"12px"}},{children:[n.jsx(i.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:600,mb:.5,color:"#19213D"}},{children:"Approval Settings"})),n.jsx(i.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#00000080",mb:"20px"}},{children:"Configure who can approve learnings before they get published."})),n.jsxs("div",e.__assign({style:{marginBottom:"12px",fontSize:"12px",color:"#8F2C23",gap:"16px"}},{children:[n.jsxs("div",e.__assign({style:{marginBottom:"12px",fontSize:"12px",color:"#8F2C23",gap:"12px"}},{children:[n.jsxs("div",e.__assign({role:"radio","aria-checked":"approval_required"===ke,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:"4px",marginBottom:"8px"},onClick:function(){return qe("approval_required")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||qe("approval_required")}},{children:[n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[n.jsx("div",e.__assign({style:{display:"flex",height:"16px",width:"16px",flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("approval_required"===ke?"#2563EB":"#CBD5E1")}},{children:"approval_required"===ke&&n.jsx("div",{style:{height:"8px",width:"8px",borderRadius:"50%",backgroundColor:"#2563EB"}})})),n.jsx("span",e.__assign({style:{fontSize:"14px",fontWeight:500,color:"#19213D"}},{children:"Approval Required Before Publishing"}))]})),n.jsx("p",e.__assign({style:{margin:0,marginLeft:"24px",fontSize:"12px",color:"#666F8D"}},{children:"Learnings require approval before publishing."}))]})),n.jsxs("div",e.__assign({style:{gap:"16px"}},{children:["approval_required"===ke&&n.jsx(y.default,{selectedApprovers:ze,selectedGroupOfApprovers:Re,onApproversChange:function(e){Oe(e),Me("")},onGroupsChange:function(e){Ie(e),Me("")}}),Ne&&n.jsx("p",e.__assign({style:{margin:0,marginLeft:"24px",fontSize:"12px",color:"#8F2C23"}},{children:Ne}))]}))]})),n.jsxs("div",e.__assign({role:"radio","aria-checked":"publish_without"===ke,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:"4px"},onClick:function(){qe("publish_without"),Me("")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||(qe("publish_without"),Me(""))}},{children:[n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[n.jsx("div",e.__assign({style:{display:"flex",height:"16px",width:"16px",flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("publish_without"===ke?"#2563EB":"#CBD5E1")}},{children:"publish_without"===ke&&n.jsx("div",{style:{height:"8px",width:"8px",borderRadius:"50%",backgroundColor:"#2563EB"}})})),n.jsx("span",e.__assign({style:{fontSize:"14px",fontWeight:500,color:"#19213D"}},{children:"Publish Without Approval"}))]})),n.jsx("p",e.__assign({style:{margin:0,marginLeft:"24px",fontSize:"12px",color:"#666F8D"}},{children:"Learnings can be published directly."}))]}))]}))]}))]}))]})),n.jsxs(i.Box,e.__assign({sx:{flex:1,bgcolor:"#fff",p:3,borderRadius:"12px",border:"1px solid #F0F2F5",display:"flex",flexDirection:"column"}},{children:[n.jsxs(i.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:600,mb:.5,color:"#19213D"}},{children:[n.jsx("span",e.__assign({style:{color:"#E53E3E",marginRight:"2px"}},{children:"*"})),"Select a scope for your station"]})),n.jsx(i.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#64748B",mb:"16px"}},{children:"Your station will inherit the rules from the selected scope."})),n.jsx(i.Box,e.__assign({sx:{mb:2}},{children:n.jsx(x.default,{required:!0,label:"",placeholder:"Select Genre",options:He,value:Ue(He,Pe.genre),onOptionChange:function(e){return Ve("genre",e)},isSearchable:!1,onMenuScrollToBottom:function(){!H&&P&&Ye(N)},isLoadingOptions:H,hasMoreOptions:P})})),n.jsx(i.Box,e.__assign({sx:{mb:3}},{children:se?n.jsx(u.default,{}):Ke?n.jsxs(i.Box,e.__assign({sx:{border:"1.5px solid #2563EB",borderRadius:"10px",p:"14px 16px",bgcolor:"#EFF6FF",display:"flex",alignItems:"flex-start",gap:"12px"}},{children:[n.jsx(i.Box,e.__assign({sx:{width:36,height:36,borderRadius:"8px",bgcolor:"#DBEAFE",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0}},{children:n.jsxs("svg",e.__assign({width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"#2563EB",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:[n.jsx("circle",{cx:"12",cy:"12",r:"2"}),n.jsx("path",{d:"M16.24 7.76a6 6 0 0 1 0 8.49m-8.48-.01a6 6 0 0 1 0-8.49m11.31-2.82a10 10 0 0 1 0 14.14m-14.14 0a10 10 0 0 1 0-14.14"})]}))})),n.jsxs(i.Box,e.__assign({sx:{flex:1,minWidth:0}},{children:[n.jsx(i.Typography,e.__assign({sx:{fontSize:"0.875rem",fontWeight:600,color:"#1E3A5F",mb:"2px"}},{children:Ke.title})),n.jsx(i.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#2563EB",mb:"8px"}},{children:Ke.description})),n.jsxs(i.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"}},{children:[Ke.inheritedText&&n.jsxs(i.Box,e.__assign({component:"span",sx:{fontSize:"0.7rem",color:"#475569",bgcolor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"4px",px:"6px",py:"2px",display:"inline-flex",alignItems:"center",gap:"4px"}},{children:[n.jsxs("svg",e.__assign({width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:[n.jsx("polyline",{points:"15 3 21 3 21 9"}),n.jsx("path",{d:"M21 3L9 15"}),n.jsx("path",{d:"M3 21l6-6"})]})),Ke.inheritedText]})),n.jsxs(i.Box,e.__assign({component:"span",sx:{fontSize:"0.7rem",color:"#475569",bgcolor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"4px",px:"6px",py:"2px"}},{children:[Ke.rulesCount," rules"]})),n.jsxs(i.Box,e.__assign({component:"span",sx:{fontSize:"0.7rem",color:"#475569",bgcolor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"4px",px:"6px",py:"2px"}},{children:[Ke.tiersCount," Tiers"]}))]}))]}))]})):Pe.genre?null:n.jsx(i.Box,e.__assign({sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",opacity:.4,py:6,gap:1}},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#94A3B8"}},{children:"Select a genre to load the matching scope"}))}))})),Pe.genre&&n.jsxs(n.Fragment,{children:[n.jsxs(i.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:600,mb:.5,color:"#19213D"}},{children:["Select an Existing Station from the “",Pe.genre,"” Scope"," ",n.jsx(i.Typography,e.__assign({component:"span",sx:{fontSize:"1rem",fontWeight:400,color:"#64748B"}},{children:"(Optional)"}))]})),n.jsxs(i.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#64748B",mb:"12px"}},{children:["Please select an existing station under the “",Pe.genre,"” category to copy its learnings."]})),n.jsxs("div",e.__assign({className:d.default.searchWrapper,style:{marginBottom:"12px"}},{children:[n.jsx("input",{type:"text",value:J,onChange:function(e){return Q(e.target.value)},placeholder:"Search for station...",className:d.default.searchInput}),n.jsx(o.Search,{className:d.default.searchIcon,size:16})]})),n.jsxs(i.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:2}},{children:[ie&&n.jsx(u.default,{}),!ie&&0===X.length&&ee.trim()&&n.jsxs(i.Typography,e.__assign({sx:{fontSize:"0.875rem",color:"#64748B",textAlign:"center",py:4}},{children:['No scopes found matching "',ee,'".']})),!ie&&X.map(function(r){return n.jsx(p.default,e.__assign({},r,{isSelected:ue===r.id,onSelect:function(e){var n;ce(ue===e?null!==(n=null==Ke?void 0:Ke.id)&&void 0!==n?n:null:e)}}),r.id)})]}))]})]}))]}))}))]})),n.jsxs(i.Box,e.__assign({sx:{p:"12px 20px",borderTop:"1px solid #F0F2F5",display:"flex",justifyContent:"flex-end",gap:2,bgcolor:"#fff"}},{children:[n.jsx("button",e.__assign({onClick:Ze,disabled:xe,style:{padding:"7px 10px",borderRadius:"6px",color:"#64748B",border:"1px solid #E2E8F0",backgroundColor:"#fff",cursor:"pointer",fontSize:"14px",fontWeight:500}},{children:"Cancel"})),n.jsx("button",e.__assign({onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var n,r,i,o,t,a,u,c,p,d,x,g,f,m,v,y,S,b,j;return e.__generator(this,function(C){switch(C.label){case 0:if(!z||!ue)return console.error("[StationOnboard] Missing required data for onboarding"),[2];if(h.useLearningTemplateStore.getState().backwardCompatibility&&"approval_required"===ke&&0===ze.length&&0===Re.length)return Me("Please select at least one approver or approver group."),setTimeout(function(){var e;null===(e=Te.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"center"})},50),[2];Me(""),n=Ke?e.__spreadArray([Ke],X,!0):X,r=n.find(function(e){return e.id===ue}),null==r?void 0:r.isCopy,ge(!0),_e(0),i=null,C.label=1;case 1:return C.trys.push([1,3,,4]),o=h.useLearningTemplateStore.getState().backwardCompatibility,t=o?{topic:"customRuleSet",customScopeGroupName:_.IL_CONFIG_CONSTANTS.CUSTOM_SCOPE_GROUP_NAME,scopeDescription:z.station_name||"New Station",parentScopeId:null!==(x=null==Ke?void 0:Ke.id)&&void 0!==x?x:null,customScopeName:z.station_name||"New Station",customScopeId:s.v4(),createByName:(null==Se?void 0:Se.firstname)||"System",createdBy:(null==Se?void 0:Se.email)||"system@audacy.com",scopeType:"Station",approvalRequired:"approval_required"===ke,audacyStationMetadata:{genre:Pe.genre,low_sellout_configurations:"Low Sellout"===Pe.type?Pe.lowSelloutConfig:null,market:z.market,primetime_windows:Pe.primeTime,region:z.region,station_guid:z.station_guid,station_type:""===Pe.type?null:Pe.type},appsecData:{application:null==Fe?void 0:Fe.applicationId,module:null==Fe?void 0:Fe.moduleId,roles:e.__spreadArray(e.__spreadArray([],"approval_required"===ke?[{users:ze.map(function(e){return e.email}),groups:Re.map(function(e){return e._id}),role:null!==(f=null===(g=Be.find(function(e){return"Learning Manager"===e.name}))||void 0===g?void 0:g._id)&&void 0!==f?f:""}]:[],!0),[{users:[null==Se?void 0:Se.email],groups:[],role:null!==(v=null===(m=Be.find(function(e){return"Instant Learning Admin"===e.name}))||void 0===m?void 0:m._id)&&void 0!==v?v:""}],!1)}}:{topic:"customRuleSet",scope_reference_id:null,scopeDescription:"demo",parentScopeId:null,scopeName:z.station_name||"New Station",scopeReferenceMetadata:{},applicationMappingId:k},console.log("[StationOnboard] Step 1: Creating rule set with payload:",t),[4,l.createRuleSet(t,q)];case 2:if(a=C.sent(),!(i=null===(y=null==a?void 0:a.data)||void 0===y?void 0:y.scopeId))throw new Error("Failed to create scope - no scopeId returned");return console.log("[StationOnboard] Step 1 Complete: Created scope with ID:",i),_e(1),[3,4];case 3:return u=C.sent(),console.error("[StationOnboard] Error creating rule set:",u),null===(S=be.current)||void 0===S||S.show({severity:"error",life:3e3,summary:"Error",detail:"Failed to create rule set. Please try again."}),ge(!1),_e(0),[2];case 4:return C.trys.push([4,6,,7]),c=null!==ue&&ue!==(null==Ke?void 0:Ke.id),p={source_scope_id:c?ue:null!==(b=null==Ke?void 0:Ke.id)&&void 0!==b?b:ue,target_scope_id:i,is_copy_parent_variant_id:c},console.log("[StationOnboard] Step 3: Inheriting scope with payload:",p),[4,l.inheritScopeBackwardCompatible(p)];case 5:return C.sent(),console.log("[StationOnboard] Step 3 Complete: Scope inherited"),_e(3),[3,7];case 6:return d=C.sent(),console.error("[StationOnboard] Error inheriting scope (no rollback):",d),null===(j=be.current)||void 0===j||j.show({severity:"error",life:3e3,summary:"Error",detail:"Failed to apply rule template. Please try again."}),ge(!1),_e(0),[2];case 7:return je.current=i,console.log("[StationOnboard] Onboarding completed successfully!"),[2]}})})},disabled:!Je||xe,style:{padding:"7px 10px",borderRadius:"6px",border:"none",backgroundColor:Je?"#2563EB":"#BFDBFE",color:"#fff",cursor:Je&&!xe?"pointer":"not-allowed",fontSize:"14px",fontWeight:500,display:"flex",alignItems:"center",gap:"7px"}},{children:xe?n.jsxs(n.Fragment,{children:[n.jsx(i.CircularProgress,{size:16,color:"inherit"}),n.jsx("span",{children:"Onboarding..."})]}):n.jsxs(n.Fragment,{children:[n.jsx("span",{children:"Onboard Station"}),n.jsx(o.ArrowRight,{size:16})]})}))]}))]}))};
|
|
2
2
|
//# sourceMappingURL=StationOnboardModal.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});require("../../../node_modules/style-inject/dist/style-inject.es.js").default("@keyframes CreateLearningSetModal-module_spin__0BrCH{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.CreateLearningSetModal-module_overlay__iwLU2{align-items:center;background-color:#0000004d;bottom:0;display:flex;justify-content:center;left:0;position:absolute;right:0;top:0;z-index:9999}.CreateLearningSetModal-module_modal__TIP0O{background-color:#fff;border-radius:.75rem;box-shadow:0 25px 50px -12px #00000040;display:flex;flex-direction:column;max-width:90%;padding:1.5rem;position:relative;width:600px}.CreateLearningSetModal-module_header__alW8D{align-items:flex-start;display:flex;gap:1rem;justify-content:space-between;margin-bottom:1.5rem}.CreateLearningSetModal-module_headerContent__bxA6y{flex:1}.CreateLearningSetModal-module_title__vlj8Q{color:#19213d;font-size:1.125rem;font-weight:500;margin:0}.CreateLearningSetModal-module_description__TGliO{color:#666f8d;font-size:.875rem;font-weight:400;line-height:1.5;margin-top:.25rem}.CreateLearningSetModal-module_closeBtn__33qJN{align-items:center;background:#0000;border:none;border-radius:.375rem;color:#9ca3af;cursor:pointer;display:flex;justify-content:center;padding:.25rem;transition:color .2s,background-color .2s}.CreateLearningSetModal-module_closeBtn__33qJN:hover{background-color:#f3f4f6;color:#4b5563}.CreateLearningSetModal-module_closeBtn__33qJN:focus{outline:none}.CreateLearningSetModal-module_form__e8iCL{display:flex;flex-direction:column;gap:1.25rem}.CreateLearningSetModal-module_formGroup__RydF4{display:flex;flex-direction:column;gap:.375rem;position:relative}.CreateLearningSetModal-module_label__q-hkm{align-items:center;color:#19213d;display:flex;font-size:.875rem;font-weight:500}.CreateLearningSetModal-module_asterisk__cXpjU{color:#8f2c23;font-size:1rem;font-weight:600;margin-right:.25rem}.CreateLearningSetModal-module_inputField__nnq0-{background-color:#fff;border:1px solid #f0f2f5;border-radius:.375rem;box-sizing:border-box;color:#19213d;font-size:.875rem;outline:none;padding:.625rem .75rem;transition:border-color .2s,box-shadow .2s;width:100%}.CreateLearningSetModal-module_inputField__nnq0-::placeholder{color:#9ca3af}.CreateLearningSetModal-module_inputField__nnq0-:focus{border-color:#2563eb;box-shadow:0 0 0 2px #2563eb33}.CreateLearningSetModal-module_inputError__Q78Vy{border-color:#8f2c23}.CreateLearningSetModal-module_inputError__Q78Vy:focus{border-color:#8f2c23;box-shadow:0 0 0 2px #8f2c2333}.CreateLearningSetModal-module_errorMessage__z0WBC{color:#8f2c23;font-size:.75rem;font-weight:400;margin-top:.25rem}.CreateLearningSetModal-module_footer__qc-SJ{display:flex;gap:.75rem;justify-content:flex-end;margin-top:1rem}.CreateLearningSetModal-module_cancelBtn__YiIV7{background-color:initial;border:1px solid #e2e8f0;border-radius:.375rem;color:#64748b;cursor:pointer;font-size:.875rem;font-weight:500;padding:.5rem 1rem;transition:background-color .2s}.CreateLearningSetModal-module_cancelBtn__YiIV7:hover:not(:disabled){background-color:#f9fafb}.CreateLearningSetModal-module_cancelBtn__YiIV7:disabled{cursor:not-allowed;opacity:.5}.CreateLearningSetModal-module_confirmBtn__8oMwL{align-items:center;background-color:#2563eb;border:none;border-radius:.375rem;color:#fff;cursor:pointer;display:inline-flex;font-size:.875rem;font-weight:500;justify-content:center;padding:.5rem 1rem;transition:background-color .2s}.CreateLearningSetModal-module_confirmBtn__8oMwL:hover:not(:disabled){background-color:#1d4ed8}.CreateLearningSetModal-module_confirmBtn__8oMwL:disabled{cursor:not-allowed;opacity:.5}.CreateLearningSetModal-module_spinner__SERKD{animation:CreateLearningSetModal-module_spin__0BrCH 1s linear infinite;color:#fff;height:1rem;margin-right:.5rem;width:1rem}"),exports.default={overlay:"CreateLearningSetModal-module_overlay__iwLU2",modal:"CreateLearningSetModal-module_modal__TIP0O",header:"CreateLearningSetModal-module_header__alW8D",headerContent:"CreateLearningSetModal-module_headerContent__bxA6y",title:"CreateLearningSetModal-module_title__vlj8Q",description:"CreateLearningSetModal-module_description__TGliO",closeBtn:"CreateLearningSetModal-module_closeBtn__33qJN",form:"CreateLearningSetModal-module_form__e8iCL",formGroup:"CreateLearningSetModal-module_formGroup__RydF4",label:"CreateLearningSetModal-module_label__q-hkm",asterisk:"CreateLearningSetModal-module_asterisk__cXpjU",inputField:"CreateLearningSetModal-module_inputField__nnq0-",inputError:"CreateLearningSetModal-module_inputError__Q78Vy",errorMessage:"CreateLearningSetModal-module_errorMessage__z0WBC",footer:"CreateLearningSetModal-module_footer__qc-SJ",cancelBtn:"CreateLearningSetModal-module_cancelBtn__YiIV7",confirmBtn:"CreateLearningSetModal-module_confirmBtn__8oMwL",spinner:"CreateLearningSetModal-module_spinner__SERKD",spin:"CreateLearningSetModal-module_spin__0BrCH"};
|
|
2
|
+
//# sourceMappingURL=CreateLearningSetModal.module.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CreateLearningSetModal.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./features/InstantLearning/InstantLearning.js"),t=require("./features/WtaWnta/WtaWnta.js"),r=require("./features/DocumentLearning/DocumentLearning.js"),o=require("./features/IL-OTJ/ILOTJ.js"),n=require("./features/IL-OTJ/_components/atoms/Button/Button.js"),s=require("./features/IL-OTJ/_components/atoms/Dropdown/Dropdown.js"),a=require("./features/IL-OTJ/_components/atoms/Toggle/Toggle.js"),i=require("./features/IL-OTJ/_components/atoms/Textarea/Textarea.js"),p=require("./features/IL-OTJ/_components/molecules/Condition/ConditionList.js"),u=require("./features/IL-OTJ/_components/molecules/Sections/SectionWrapper.js"),c=require("./features/IL-OTJ/_components/molecules/SeperationRow/SeparationRow.js"),T=require("./features/IL-OTJ/_components/organisms/ConfigSection/ConfigSection.js"),x=require("./features/IL-OTJ/_components/organisms/TextSection/TextSection.js"),m=require("./features/IL-OTJ/_components/organisms/ScopeSection/ScopeSection.js"),f=require("./features/IL-OTJ/_components/organisms/ConditionSection/ConditionSection.js"),g=require("./features/IL-OTJ/_components/templates/TrafficManager/TrafficManagerTemplate.js"),l=require("./features/IL-OTJ/_components/templates/Testing/Testing.js"),L=require("./features/IL-OTJ/_components/templates/TemplatesMap/templatesMap.js"),d=require("./features/IL-OTJ/helpers/utils.js"),I=require("./features/IL-OTJ/store/CitationsContext.js"),S=require("./features/IL-OTJ/ILOTJTest.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./features/InstantLearning/InstantLearning.js"),t=require("./features/WtaWnta/WtaWnta.js"),r=require("./features/DocumentLearning/DocumentLearning.js"),o=require("./features/IL-OTJ/ILOTJ.js"),n=require("./features/IL-OTJ/_components/atoms/Button/Button.js"),s=require("./features/IL-OTJ/_components/atoms/Dropdown/Dropdown.js"),a=require("./features/IL-OTJ/_components/atoms/Toggle/Toggle.js"),i=require("./features/IL-OTJ/_components/atoms/Textarea/Textarea.js"),p=require("./features/IL-OTJ/_components/molecules/Condition/ConditionList.js"),u=require("./features/IL-OTJ/_components/molecules/Sections/SectionWrapper.js"),c=require("./features/IL-OTJ/_components/molecules/SeperationRow/SeparationRow.js"),T=require("./features/IL-OTJ/_components/organisms/ConfigSection/ConfigSection.js"),x=require("./features/IL-OTJ/_components/organisms/TextSection/TextSection.js"),m=require("./features/IL-OTJ/_components/organisms/ScopeSection/ScopeSection.js"),f=require("./features/IL-OTJ/_components/organisms/ConditionSection/ConditionSection.js"),g=require("./features/IL-OTJ/_components/templates/TrafficManager/TrafficManagerTemplate.js"),l=require("./features/IL-OTJ/_components/templates/Testing/Testing.js"),L=require("./features/IL-OTJ/_components/templates/TemplatesMap/templatesMap.js"),d=require("./features/IL-OTJ/helpers/utils.js"),I=require("./features/IL-OTJ/store/CitationsContext.js"),S=require("./features/IL-OTJ/ILOTJTest.js"),j=require("./features/LearningManagement/LearningManagement.js");require("tslib"),require("react/jsx-runtime"),exports.InstantLearning=e.default,exports.WtaWnta=t.default,exports.BookLearning=r.default,exports.ILOTJ=o.default,exports.Button=n.Button,exports.Dropdown=s.Dropdown,exports.Toggle=a.Toggle,exports.Textarea=i.Textarea,exports.ConditionList=p.ConditionList,exports.SectionWrapper=u.SectionWrapper,exports.SeparationRow=c.SeparationRow,exports.ConfigSection=T.ConfigSection,exports.TextSection=x.TextSection,exports.ScopeSection=m.ScopeSection,exports.ConditionSection=f.ConditionSection,exports.TrafficManagerTemplate=g.TrafficManagerTemplate,exports.Testing=l.Testing,Object.defineProperty(exports,"TemplateList",{enumerable:!0,get:function(){return L.TemplateList}}),exports.TemplateMap=L.TemplateMap,exports.extractAndParseResponse=d.extractAndParseResponse,exports.extractAndParseWithProperty=d.extractAndParseWithProperty,exports.extractTextFromChildren=d.extractTextFromChildren,exports.extractVariantIds=d.extractVariantIds,exports.parseValidationData=d.parseValidationData,exports.useHeaderObserver=d.useHeaderObserver,exports.CitationProvider=I.CitationProvider,exports.useCitations=I.useCitations,exports.getVariantInfo=S.getVariantInfo,exports.LearningManagement=j.default;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{__assign as e}from"tslib";import{jsxs as t,jsx as o}from"react/jsx-runtime";import{useMemo as i,useEffect as n}from"react";import{AuditLog as r}from"@e-llm-studio/audit-log";import"@e-llm-studio/audit-log/dist/styles.css";import{User as l,ExternalLink as a}from"lucide-react";import d from"./ChangeLogDiff.js";var c=function(c){var s=c.configId,h=c.ruleData,p=c.scopeId,g=c.scopeName,u=(null==g?void 0:g.trim())||"Selected",m=i(function(){var e=[];return p&&e.push(p),e},[h,p]);return n(function(){console.log("Flattened External Resource IDs:",m)},[m]),t("div",e({style:{padding:"24px",fontFamily:"Arial, sans-serif"}},{children:[t("div",e({style:{marginBottom:"16px",paddingBottom:"4px"}},{children:[t("h1",e({style:{margin:0,color:"#334155",fontSize:"20px",fontWeight:700,lineHeight:1.25}},{children:[u," - Audit Log"]})),t("p",e({style:{margin:"8px 0 0",color:"#667085",fontSize:"16px",fontWeight:500,lineHeight:1}},{children:["Track all learning updates and modifications with the ",u," scope."]}))]})),o(r,{configId:s,getData:{baseUrl:"https://dev.appmod.ai",endpoint:"/changelog/audit-log/fetch"},distinctValuesApi:{baseUrl:"https://dev.appmod.ai",endpoint:"/changelog/audit-log/distinct-values"},query:{externalResourceId:m.length>0?m:[""],paginationLimit:10},sidebar:{config:{showAnalystFilter:!0,showDateFilter:!0,showChangeTitleFilter:!0,showImpactPercentage:!1},labels:{title:"Filters",multiSelectLabel:"Modified By",multiSelectHint:"Filter by the user who made the change",changeTitleLabel:"Change Action",changeTitleHint:"Filter by Actions"}},table:{tableProps:{scrollable:!0,scrollHeight:"80vh",showGridlines:!0,size:"small",rowClassName:function(){return"custom-compact-row"},pt:{bodyCell:{style:{paddingTop:"4px",paddingBottom:"4px"}}}},hiddenColumns:["actions","changeSummary","changeDateTime","logId"],extraColumns:[{key:"modifiedBy",header:"Modified By",body:function(i){return t("div",e({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[o(l,{size:16,color:"#64748b",style:{flexShrink:0}}),o("span",e({style:{fontWeight:500}},{children:i.modifiedBy}))]}))},style:{width:"15%",minWidth:"140px"}},{key:"changeAction",header:"Action",body:function(t){var i,n,r=(i=t.changeTitle,(n=(i||"").toUpperCase()).includes("CREATE")?{color:"#2e7d32",backgroundColor:"#edf7ed",borderColor:"#c8e6c9",boxShadow:"0 1px 2px rgba(46, 125, 50, 0.08)"}:n.includes("UPDATE")||n.includes("TOGGLE")?{color:"#1565c0",backgroundColor:"#e3f2fd",borderColor:"#bbdefb",boxShadow:"0 1px 2px rgba(21, 101, 192, 0.08)"}:n.includes("DELETE")?{color:"#c62828",backgroundColor:"#fdeeed",borderColor:"#ffcdd2",boxShadow:"0 1px 2px rgba(198, 40, 40, 0.08)"}:{color:"#475569",backgroundColor:"#f8fafc",borderColor:"#cbd5e1",boxShadow:"0 1px 2px rgba(15, 23, 42, 0.06)"}),l=t.changeTitle?t.changeTitle.replace(/_/g," "):"—";return o("span",e({style:{color:r.color,backgroundColor:r.backgroundColor,border:"1px solid ".concat(r.borderColor),boxShadow:r.boxShadow,padding:"6px 12px",borderRadius:"999px",fontSize:"12px",lineHeight:1,fontWeight:600,display:"inline-block",minWidth:"76px",textAlign:"center",textTransform:"capitalize"}},{children:l}))},style:{width:"15%",textAlign:"center"}},{key:"customChangeSummary",header:"Change Summary",body:function(e){var t;return o(d,{change:null!==(t=e.actionText)&&void 0!==t?t:"-"})},style:{width:"30%",minWidth:"200px"}},{key:"redirectLink",header:"Link",body:function(i){var n,r=(null===(n=i.metadata)||void 0===n?void 0:n.redirect_url)||i.redirect_url;return r?o("div",e({style:{display:"flex",justifyContent:"center",alignItems:"center"}},{children:t("a",e({href:r,target:"_blank",rel:"noopener noreferrer",style:{display:"flex",alignItems:"center",gap:"6px",color:"#2563eb",textDecoration:"none",fontWeight:500,fontSize:"13px"}},{children:["View ",o(a,{size:14})]}))})):o("span",e({style:{color:"#94a3b8",display:"flex",justifyContent:"center"}},{children:"—"}))},style:{width:"10%",minWidth:"90px",textAlign:"center"}},{key:"customChangeDateTime",header:"Change Time and Date",body:function(i){if(!i.actionDate)return o("span",e({style:{color:"#94a3b8"}},{children:"—"}));var n=new Date(i.actionDate),r=n.toLocaleDateString("en-US",{month:"short",day:"2-digit",year:"numeric"}),l=n.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"});return t("div",e({style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"4px",fontSize:"13px",color:"#475569"}},{children:[o("span",e({style:{fontWeight:500}},{children:r})),o("span",{children:l})]}))},style:{width:"15%",minWidth:"150px",textAlign:"center"}}]},filters:{config:{showFilterButton:!0,showSort:!0,showDate:!0,showSearch:!0,sortOptions:{latest:!0,oldest:!0,impactHighToLow:!1,impactLowToHigh:!1}}}})]}))};export{c as default};
|
|
2
2
|
//# sourceMappingURL=AuditLog.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{__assign as e,__spreadArray as r}from"tslib";import{jsx as n,jsxs as t,Fragment as a}from"react/jsx-runtime";import{useState as i}from"react";import{Layers as o,BookOpen as l,GitBranch as d,ChevronUp as c,ChevronDown as p}from"lucide-react";var f={scope:{label:"Scope",icon:n(o,{size:11}),accent:"#6d28d9",accentBg:"#f5f3ff",accentBorder:"#ddd6fe"},learning:{label:"Learning",icon:n(l,{size:11}),accent:"#1d4ed8",accentBg:"#eff6ff",accentBorder:"#bfdbfe"},variant:{label:"Variant",icon:n(d,{size:11}),accent:"#b45309",accentBg:"#fffbeb",accentBorder:"#fde68a"}},s={label:"Change",icon:null,accent:"#475569",accentBg:"#f8fafc",accentBorder:"#e2e8f0"},u={created:{label:"Created",color:"#15803d",bg:"#f0fdf4",border:"#bbf7d0"},updated:{label:"Updated",color:"#92400e",bg:"#fffbeb",border:"#fde68a"},deleted:{label:"Deleted",color:"#b91c1c",bg:"#fef2f2",border:"#fecaca"}},g=function(e,n){var t=new Set(r(r([],Object.keys(e),!0),Object.keys(n),!0));return Array.from(t).filter(function(r){var t,a;return String(null!==(t=e[r])&&void 0!==t?t:"")!==String(null!==(a=n[r])&&void 0!==a?a:"")})},b=function(e,r){void 0===r&&(r=28);var n=Array.isArray(e)?e.join(", "):String(null!=e?e:"—");return n.length>r?n.slice(0,r)+"…":n||"—"},x=function(r){var t=r.cols;return n("div",e({style:{display:"grid",gridTemplateColumns:t.map(function(){return"1fr"}).join(" "),gap:"6px",padding:"2px 6px 4px",fontSize:"9px",fontWeight:700,color:"#94a3b8",textTransform:"uppercase",letterSpacing:"0.07em",borderBottom:"1px solid #e2e8f0",marginBottom:"2px"}},{children:t.map(function(e){return n("span",{children:e},e)})}))},h=function(r){var a=r.label,i=r.value,o=r.mode;return t("div",e({style:{display:"grid",gridTemplateColumns:"1fr 1.4fr",gap:"6px",alignItems:"start",padding:"3px 6px",borderRadius:"5px",fontSize:"11px",lineHeight:1.4}},{children:[n("span",e({style:{color:"#64748b",fontWeight:500}},{children:a})),n("span",e({style:{color:"created"===o?"#15803d":"#b91c1c",background:"created"===o?"#f0fdf4":"#fef2f2",border:"1px solid ".concat("created"===o?"#bbf7d0":"#fecaca"),borderRadius:"4px",padding:"1px 5px",wordBreak:"break-word",fontWeight:500},title:Array.isArray(i)?i.join(", "):String(null!=i?i:"—")},{children:b(i)}))]}))},y=function(r){var a=r.label,i=r.before,o=r.after,l=r.changed;return t("div",e({style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gap:"6px",alignItems:"start",padding:"3px 6px",borderRadius:"5px",background:l?"rgba(255,251,235,0.7)":"transparent",fontSize:"11px",lineHeight:1.4}},{children:[n("span",e({style:{color:"#64748b",fontWeight:500}},{children:a})),n("span",e({style:{color:l?"#b91c1c":"#94a3b8",background:l?"#fff1f0":"transparent",border:l?"1px solid #fecaca":"none",borderRadius:"4px",padding:l?"1px 5px":"0",textDecoration:l?"line-through":"none",wordBreak:"break-word",opacity:l?1:.6},title:Array.isArray(i)?i.join(", "):String(null!=i?i:"—")},{children:b(i)})),n("span",e({style:{color:l?"#15803d":"#475569",background:l?"#f0fdf4":"transparent",border:l?"1px solid #bbf7d0":"none",borderRadius:"4px",padding:l?"1px 5px":"0",fontWeight:l?600:400,wordBreak:"break-word"},title:Array.isArray(o)?o.join(", "):String(null!=o?o:"—")},{children:b(o)}))]}))},v=function(i){var o=i.mode,l=i.before,d=i.after,c=Array.from(new Set(r(r([],Object.keys(l),!0),Object.keys(d),!0))),p=g(l,d);if(0===c.length)return n("span",e({style:{fontSize:"11px",color:"#94a3b8",padding:"4px 6px"}},{children:"No details available"}));var f=c;return t(a,{children:[n(x,"updated"===o?{cols:["Field","Before","After"]}:{cols:["Field","created"===o?"Value":"Was"]}),f.map(function(e){return"updated"===o?n(y,{label:e,before:l[e],after:d[e],changed:p.includes(e)},e):n(h,{label:e,value:"created"===o?d[e]:l[e],mode:o},e)})]})},m=function(r){return n(v,e({},r))},S=function(r){return n(v,e({},r))},k=function(r){return n(v,e({},r))},w=function(a){var o,l,d,b,x,h=a.change,y=i(!1),w=y[0],B=y[1],j=function(e){if(!e)return null;if("object"==typeof e&&e.data)return e;if("string"==typeof e)try{var r=JSON.parse(e);if(null==r?void 0:r.data)return r}catch(e){return null}return null}(h);if(!j)return n("span",e({style:{color:"#334155",fontSize:"13px",lineHeight:1.5}},{children:"string"==typeof h?h:"—"}));var T=j.action,z=j.data,W=null!==(o=null==z?void 0:z.before)&&void 0!==o?o:{},A=null!==(l=null==z?void 0:z.after)&&void 0!==l?l:{},D=function(e,r){var n=e&&Object.keys(e).length>0,t=r&&Object.keys(r).length>0;return n&&t?"updated":t?"created":"deleted"}(W,A),O=null!==(b=null===(d=null==z?void 0:z.type)||void 0===d?void 0:d.toLowerCase())&&void 0!==b?b:"",R=null!==(x=f[O])&&void 0!==x?x:s,C=u[D],H=g(W,A),I=Array.from(new Set(r(r([],Object.keys(W),!0),Object.keys(A),!0))),L=I.length>0,V=function(e,r,n,t){var a="deleted"===r?n:t;switch(e){case"scope":return"Name: ".concat((null==a?void 0:a.name)||"—",", Description: ").concat((null==a?void 0:a.description)||"—",", Type: ").concat((null==a?void 0:a.scopeType)||"—");case"learning":return"Title: ".concat((null==a?void 0:a.LearningTitle)||"—",", Tier: ").concat((null==a?void 0:a.Tier)||"—");case"variant":return"Title: ".concat((null==a?void 0:a.Learning)||"—",", Description: ").concat((null==a?void 0:a["Variant Description"])||(null==a?void 0:a.VariantDescription)||(null==a?void 0:a.Description)||"—",", Tier: ").concat((null==a?void 0:a.Tier)||"—");default:return"Details available in table below."}}(O,D,W,A),N={mode:D,before:W,after:A};return t("div",e({style:{display:"flex",flexDirection:"column",gap:"8px",minWidth:0,padding:"4px 0"}},{children:[t("div",e({style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"wrap"}},{children:[t("span",e({style:{display:"inline-flex",alignItems:"center",gap:"3px",fontSize:"11px",fontWeight:600,color:R.accent,background:R.accentBg,border:"1px solid ".concat(R.accentBorder),borderRadius:"999px",padding:"2px 8px"}},{children:[R.icon,R.label]})),n("span",e({style:{fontSize:"11px",fontWeight:700,color:R.accent,background:R.accentBg,border:"1px solid ".concat(R.accentBorder),borderRadius:"999px",padding:"2px 8px",whiteSpace:"nowrap"}},{children:T})),t("span",e({style:{fontSize:"11px",fontWeight:600,color:C.color,background:C.bg,border:"1px solid ".concat(C.border),borderRadius:"999px",padding:"2px 8px",whiteSpace:"nowrap"}},{children:[C.label,"updated"===D&&H.length>0&&" · ".concat(H.length," field").concat(1!==H.length?"s":"")]}))]})),n("div",e({style:{fontSize:"13px",color:"#1e293b",fontWeight:400,lineHeight:1.5,marginLeft:"2px"}},{children:V})),L&&t("button",e({onClick:function(){return B(function(e){return!e})},style:{display:"inline-flex",alignItems:"center",gap:"4px",background:"none",border:"none",cursor:"pointer",color:R.accent,fontSize:"11px",fontWeight:600,padding:"2px",alignSelf:"flex-start",marginTop:"-2px"}},{children:[n(w?c:p,{size:13}),w?"Hide diff table":"Show details (".concat(I.length," fields)")]})),w&&L&&n("div",e({style:{display:"flex",flexDirection:"column",gap:"2px",background:"#f8fafc",border:"1px solid #e2e8f0",borderRadius:"8px",padding:"6px 4px 4px",overflow:"hidden",marginTop:"4px"}},{children:function(){switch(O){case"scope":return n(m,e({},N));case"learning":return n(S,e({},N));case"variant":return n(k,e({},N));default:return n(v,e({},N))}}()}))]}))};export{w as default};
|
|
2
|
+
//# sourceMappingURL=ChangeLogDiff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChangeLogDiff.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__spreadArray as e,__assign as t,__awaiter as n,__generator as r}from"tslib";import{jsx as o,jsxs as s,Fragment as i}from"react/jsx-runtime";import{useState as a,useRef as l,useEffect as c}from"react";import{BookOpen as u,Users as d,History as p}from"lucide-react";import{useLearningTemplateStore as m}from"./store/useLearningTemplateStore.js";import{Toast as f}from"primereact/toast";import v from"./styles/LearningTemplateManagement.module.css.js";import g from"./LearningTemplateLayout.js";import h from"./components/EmptyLearningState.js";import y from"./store/useAuthStore.js";import{fetchTiers as S,fetchScopes as b,inheritScope as C,inheritScopeBackwardCompatible as T,createRuleSet as E,renameScope as L,deleteRuleSet as A,requestAccess as O}from"./apis/scopeApis.js";import{QUERY_PARAM_KEYS as w,setQueryParams as I}from"./hooks/useLearningTemplateQueryParams.js";import R from"./components/ConfirmationModal.js";import j from"./components/LearningTemplateManagementSkeleton.js";import{findNodePathById as N}from"./utils/treeUtils.js";import k from"./store/useEnvStore.js";import{useConfigStore as D}from"./store/useConfigStore.js";import{TooltipProvider as _}from"./components/ToolTip.js";import P from"./components/CreateRuleSetLegacyModal.js";import{usePermissionsStore as U}from"./store/usePermissionsStore.js";import{useAppSecRolesStore as G}from"./store/useAppSecRolesStore.js";import{useGetAppSecRolesQuery as M}from"./queries/useApprovalQueries.js";import B from"./RuleContent/AddScopeModal.js";import{useLocation as F}from"react-router-dom";import q from"./shared/SuccessToastContent.js";import x from"./shared/ErrorToastContent.js";import H from"./RuleContent/RenameScopeModal.js";var Q=[{id:"learnings",label:"Learnings",icon:u,badgeKey:"learningsCount"},{id:"access",label:"Access",icon:d},{id:"history",label:"Change History",icon:p}],z=new Set(Q.map(function(e){return e.id}));function K(u){var d,p=this,K=u.userDetails,V=u.llmStudioUrl,W=u.audacyBackendUrl,Y=u.ilLabels,J=u.config,X=u.rbacConfig,Z=u.auditLogConfig,$=u.app_integration_id,ee=u.backwardCompatibility,te=void 0!==ee&&ee,ne=m(function(e){return e.selectedRuleSetId}),re=m(function(e){return e.setSelectedRuleSetId}),oe=m(function(e){return e.error}),se=m(function(e){return e.setError}),ie=m(function(e){return e.setStations}),ae=m(function(e){return e.scopeTreeData}),le=m(function(e){return e.setScopeTreeData}),ce=a({isOpen:!1,type:"GLOBAL"}),ue=ce[0],de=ce[1],pe=a(!1),me=pe[0],fe=pe[1],ve=a(!1),ge=ve[0],he=ve[1],ye=a("learnings"),Se=ye[0],be=ye[1],Ce=a(null),Te=Ce[0],Ee=Ce[1],Le=a(null),Ae=Le[0],Oe=Le[1],we=l(null),Ie=l(null),Re=l(null),je=y();je.user;var Ne=je.setUser,ke=D(),De=ke.setConfig,_e=ke.setIlLabels,Pe=e([{type:"GLOBAL",label:"Global",addChildLabel:"Add Scope",addChildType:"SCOPE"},t({type:"SCOPE",label:"Scope"},!te&&{addChildLabel:"Add Subscope",addChildType:"SUBSCOPE"})],te?[]:[{type:"SUBSCOPE",label:"Subscope"}],!0),Ue=function(){try{return F()}catch(e){return{search:""}}}();c(function(){var e=new URLSearchParams(window.location.search),t=e.get(w.RULESET_ID),n=e.get(w.SECTION),r=n&&z.has(n)?n:"learnings";(null==t?void 0:t.length)&&re&&be&&(re(t),be(r))},[null==Ue?void 0:Ue.search,be,re]);var Ge=U(function(e){return e.fetchPermissions}),Me=U(function(e){return e.hasPermission}),Be=G(function(e){return e.setRoles}),Fe=k(function(e){return e.appsecRbacUrl})===X.appsecRbacUrl,qe=M(X.applicationId,Fe).data;c(function(){qe&&Be(qe.map(function(e){return{_id:e._id,name:e.name}}))},[qe,Be]),c(function(){var e;console.log("userDetails",K),Ne(K),console.log("llmStudioUrl",V),console.log("audacyBackendUrl",W),k.getState().setLlmStudioUrl(V),k.getState().setAudacyBackendUrl(W),k.getState().setRbacConfig(X),k.getState().setAuditLogConfig(Z),De(J),_e(Y),m.getState().setAppIntegrationId(null!=$?$:null),m.getState().setBackwardCompatibility(te),m.getState().setToken(null!==(e=K.accessToken)&&void 0!==e?e:null)},[K,Ne,V,W,X,Z,J,De,Y,_e,$,te]),c(function(){(null==K?void 0:K.accessToken)&&V&&S()},[$,null==K?void 0:K.accessToken,V]);var xe=function(e){return void 0===e&&(e=!0),n(p,void 0,void 0,function(){var n,o,s,i,a,l;return r(this,function(r){switch(r.label){case 0:e&&fe(!0),se(null),r.label=1;case 1:return r.trys.push([1,4,5,6]),[4,Ge(X.applicationId)];case 2:return r.sent(),n=function(e){if(!U.getState().hasPermission("ilotj.scope.view",e.id))return null;var r=e.children?e.children.map(function(e){return n(e)}).filter(function(e){return null!==e}):[];return t(t({},e),{children:r})},[4,b($,K.accessToken)];case 3:return(o=r.sent())&&o.data&&o.data.data&&(s=o.data.data,Array.isArray(s)&&(s=s.length>0?s[0]:null),s?(i=n(s))?(Ee(null),le({data:i}),Ie.current?(re(Ie.current),be("learnings"),Ie.current=null):m.getState().selectedRuleSetId||re(i.id)):(Ee(null!==(l=s.id)&&void 0!==l?l:null),le(null)):(Ee(null),le(null))),[3,6];case 4:return a=r.sent(),console.error("Failed to fetch rule sets or permissions",a),se("Failed to load data. Please try again later."),[3,6];case 5:return fe(!1),[7];case 6:return[2]}})})};c(function(){var e;(null===(e=null==K?void 0:K.accessToken)||void 0===e?void 0:e.length)&&Fe?xe(!0):console.warn("Error: Trying to fetch rules without access token",K)},[null==K?void 0:K.accessToken,se,ie,X.applicationId,Fe]);var He=function(e){return n(p,void 0,void 0,function(){var n,s,i,a;return r(this,function(r){switch(r.label){case 0:he(!0),r.label=1;case 1:return r.trys.push([1,4,5,6]),ue.scopeId?[4,L({scope_id:ue.scopeId,scope_name:e})]:[2];case 2:return r.sent(),[4,xe(!0)];case 3:return r.sent(),de(function(e){return t(t({},e),{isOpen:!1})}),[3,6];case 4:throw n=r.sent(),console.error("An error occurred during scope rename.",n),null===(s=Re.current)||void 0===s||s.show({severity:"error",sticky:!1,className:v.errorToast,content:o(x,{message:(null===(a=null===(i=null==n?void 0:n.response)||void 0===i?void 0:i.data)||void 0===a?void 0:a.message)||"There was an error renaming the scope. Please try again."})}),n;case 5:return he(!1),[7];case 6:return[2]}})})},Qe=function(e,o,s){return n(p,void 0,void 0,function(){var n,o,s,i,a,l,c,u;return r(this,function(r){switch(r.label){case 0:he(!0),r.label=1;case 1:return r.trys.push([1,4,5,6]),[4,A(e,K.accessToken)];case 2:return r.sent(),m.getState().selectedRuleSetId===e&&(n=m.getState().scopeTreeData,(o=N((null==n?void 0:n.data)||null,e))&&o.length>1&&(s=o[o.length-2],re(s),be("learnings"))),[4,xe(!0)];case 3:return r.sent(),de(function(e){return t(t({},e),{isOpen:!1})}),null===(a=Re.current)||void 0===a||a.show({severity:"success",summary:"Deleted Successfully",detail:"The scope was permanently removed."}),[3,6];case 4:return i=r.sent(),console.error("An error occurred during scope deletion.",i),null===(l=Re.current)||void 0===l||l.show({severity:"error",summary:"Delete Failed",detail:(null===(u=null===(c=null==i?void 0:i.response)||void 0===c?void 0:c.data)||void 0===u?void 0:u.message)||"There was an error deleting the scope. Please try again."}),[3,6];case 5:return he(!1),[7];case 6:return[2]}})})},ze=ae,Ke=Ae?{data:{id:Ae.stationId,name:Ae.stationName,type:"STATION",metrics:{learningsCount:Ae.learningsCount,stationsCount:0},children:[]}}:ze,Ve=!!(null==Ke?void 0:Ke.data);null===(d=null==Ke?void 0:Ke.data)||void 0===d||d.type;var We=U(function(e){return e.hasGlobalPermission})("ilotj.scope.global.create",X.applicationResourceId||""),Ye=(Ae?Q.filter(function(e){return"stations"!==e.id}):Q).filter(function(e){return!(!te&&"access"===e.id)});return o(_,{children:s("div",t({className:v.learningManagementContainer},{children:[o("div",t({className:v.mainWrapper},{children:me?o(j,{}):oe?s("div",t({className:v.errorContainer},{children:[o("div",t({className:v.errorTitle},{children:"Error Loading Data"})),o("p",t({className:v.errorDesc},{children:oe})),o("button",t({onClick:function(){return xe(!0)},className:v.tryAgainBtn},{children:"Try Again"}))]})):Ve?o(g,{onOpenCreateModal:function(){return de({isOpen:!0,type:"GLOBAL"})},onAddChild:function(e,t,n){return de({isOpen:!0,type:t,parentId:e,parentName:n})},onRenameChild:function(e,t){return de({isOpen:!0,type:"RENAME",scopeId:e,initialName:t})},onDeleteChild:function(e,t,o){return n(p,void 0,void 0,function(){var n,s,i;return r(this,function(r){switch(r.label){case 0:return n=m.getState().scopeTreeData,s=N((null==n?void 0:n.data)||null,e),i=!!s&&3===s.length,0!==o?[3,2]:[4,Qe(e)];case 1:return r.sent(),[3,3];case 2:de({isOpen:!0,type:"DELETE",scopeId:e,initialName:t,isSubscope:i}),r.label=3;case 3:return[2]}})})},canDeleteScope:function(e){return Me("ilotj.scope.delete",e)},canEditScope:function(e){return Me("ilotj.scope.edit",e)},canCreateScope:function(e){return Me("ilotj.scope.create",e)},onSectionSelect:function(e,t){var n;console.log("Section Selected:",{scopeId:e,sectionId:t}),I(((n={})[w.SECTION]="learnings"===t?null:t,n)),be(t),re(e)},activeSectionId:Se,scopeTreeData:Ke,sectionsConfig:Ye,onViewStation:function(e){we.current=ne,Oe(e),be("learnings"),re(e.stationId)},onRefreshRuleSets:function(e,t){void 0===e&&(e=!0),t&&(Ie.current=t),xe(e)},nodeTypesConfig:Pe,app_integration_id:$,token:K.accessToken}):o(h,{onCreate:function(){return de({isOpen:!0,type:"GLOBAL"})},title:"No Global Scope has been added!",desc:"Start by creating a Global scope to define base learnings that apply across all stations.",button:"Create Global Scope",canCreateRule:We,noAccessTitle:"Access Restricted",noAccessDesc:"You do not have access to create a Global scope for this application.",onRequestAccess:function(){return n(p,void 0,void 0,function(){var e,t,n,s,i,a,l,c,u;return r(this,function(r){switch(r.label){case 0:if(!(e=(null===(s=null===(n=m.getState().scopeTreeData)||void 0===n?void 0:n.data)||void 0===s?void 0:s.id)||Te))return null===(i=Re.current)||void 0===i||i.show({severity:"error",sticky:!1,className:v.errorToast,content:o(x,{message:"Unable to identify the global scope for this access request."})}),[2];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,O(e)];case 2:return r.sent(),null===(a=Re.current)||void 0===a||a.show({severity:"success",sticky:!1,life:3e3,className:v.successToast,content:o(q,{message:"Access request submitted successfully!"})}),[3,4];case 3:return t=r.sent(),null===(l=Re.current)||void 0===l||l.show({severity:"error",sticky:!1,className:v.errorToast,content:o(x,{message:(null===(u=null===(c=null==t?void 0:t.response)||void 0===c?void 0:c.data)||void 0===u?void 0:u.detail)||"Failed to request access. Please try again."})}),[3,4];case 4:return[2]}})})}})})),o(f,{ref:Re,pt:{root:{style:{zIndex:9999}}}}),te&&ue.isOpen&&"DELETE"!==ue.type&&"RENAME"!==ue.type?o(P,{isOpen:!0,onClose:function(){return de(t(t({},ue),{isOpen:!1}))},onSubmit:function(e){return n(p,void 0,void 0,function(){var n,o,s,i,a,l,c,u,d,p,f,v,g,h,y,S,b,L,A,O;return r(this,function(r){switch(r.label){case 0:he(!0),n=m.getState().backwardCompatibility,r.label=1;case 1:return r.trys.push([1,12,13,14]),o=void 0,n&&"object"==typeof e?o=e:(s=e,i="SCOPE"===ue.type&&ue.parentId,a=i?"genreRuleSet":ue.type,o={topic:a,scope_reference_id:null,scopeDescription:"demo",parentScopeId:ue.parentId||null,scopeName:s,scopeReferenceMetadata:{},applicationMappingId:$}),[4,E(o,K.accessToken)];case 2:if(l=r.sent(),!(c=null===(h=null==l?void 0:l.data)||void 0===h?void 0:h.scopeId))return[3,10];if(Ie.current=c,u=n&&(null===(y=o.topic)||void 0===y?void 0:y.toLowerCase().includes("genre")),d=!n&&"GLOBAL"!==ue.type&&ue.parentId,!u&&!d)return[3,10];if(!(p=n?null===(b=null===(S=m.getState().scopeTreeData)||void 0===S?void 0:S.data)||void 0===b?void 0:b.id:ue.parentId))return[3,10];if(!te)return[3,7];r.label=3;case 3:return r.trys.push([3,5,,6]),[4,T({source_scope_id:p,target_scope_id:c})];case 4:return r.sent(),[3,6];case 5:return f=r.sent(),console.error("Failed to inherit rules for the new scope:",f),[3,6];case 6:return[3,10];case 7:return r.trys.push([7,9,,10]),[4,C({source_scope_id:p,target_scope_id:c,application_mapping_id:$||"",is_copy_parent_variant_id:!1})];case 8:return r.sent(),[3,10];case 9:return v=r.sent(),console.error("Failed to inherit rules for the new scope:",v),[3,10];case 10:return[4,xe(!0)];case 11:return r.sent(),de(function(e){return t(t({},e),{isOpen:!1})}),[3,14];case 12:throw g=r.sent(),console.error("An error occurred during scope creation.",g),null===(L=Re.current)||void 0===L||L.show({severity:"error",summary:"Creation Failed",detail:(null===(O=null===(A=null==g?void 0:g.response)||void 0===A?void 0:A.data)||void 0===O?void 0:O.message)||"There was an error creating the scope. Please try again."}),g;case 13:return he(!1),[7];case 14:return[2]}})})},hasGlobalRuleSet:Ve,canCreateGlobal:We}):s(i,{children:[o(B,{isOpen:ue.isOpen&&"DELETE"!==ue.type&&"RENAME"!==ue.type,onClose:function(){return de(t(t({},ue),{isOpen:!1}))},onCreate:function(e){return He(null!=e?e:"")},hasGlobalRuleSet:Ve}),o(H,{isOpen:ue.isOpen&&"RENAME"===ue.type,onClose:function(){return de(t(t({},ue),{isOpen:!1}))},onSave:He,initialName:ue.initialName})]}),o(R,{isOpen:ue.isOpen&&"DELETE"===ue.type,onCancel:function(){return de(t(t({},ue),{isOpen:!1}))},onConfirm:function(){return Qe(ue.scopeId,ue.initialName,ue.isSubscope)},title:"Delete Scope",description:s(i,{children:["Deleting ",o("span",t({className:v.highlight},{children:ue.initialName||"this scope"}))," will permanently remove all Learnings, Access rules, and Change History inside it. This cannot be undone."]}),confirmText:"Delete",confirmBgColor:"#EF4444",isLoading:ge})]}))})}export{K as default};
|
|
1
|
+
import{__spreadArray as e,__assign as t,__awaiter as n,__generator as r}from"tslib";import{jsx as o,jsxs as s,Fragment as i}from"react/jsx-runtime";import{useState as a,useRef as l,useEffect as c}from"react";import{BookOpen as u,Users as d,History as p}from"lucide-react";import{useLearningTemplateStore as m}from"./store/useLearningTemplateStore.js";import{Toast as f}from"primereact/toast";import v from"./styles/LearningTemplateManagement.module.css.js";import g from"./LearningTemplateLayout.js";import h from"./components/EmptyLearningState.js";import y from"./store/useAuthStore.js";import{fetchTiers as S,fetchScopes as b,inheritScope as C,inheritScopeBackwardCompatible as T,createRuleSet as E,renameScope as L,deleteRuleSet as A,requestAccess as I}from"./apis/scopeApis.js";import{QUERY_PARAM_KEYS as O,setQueryParams as w}from"./hooks/useLearningTemplateQueryParams.js";import R from"./components/ConfirmationModal.js";import j from"./components/LearningTemplateManagementSkeleton.js";import{findNodePathById as N}from"./utils/treeUtils.js";import k from"./store/useEnvStore.js";import{useConfigStore as D}from"./store/useConfigStore.js";import{TooltipProvider as _}from"./components/ToolTip.js";import P from"./components/CreateRuleSetLegacyModal.js";import{usePermissionsStore as U}from"./store/usePermissionsStore.js";import{useAppSecRolesStore as G}from"./store/useAppSecRolesStore.js";import{useGetAppSecRolesQuery as M}from"./queries/useApprovalQueries.js";import B from"./RuleContent/AddScopeModal.js";import{useLocation as F}from"react-router-dom";import q from"./shared/SuccessToastContent.js";import x from"./shared/ErrorToastContent.js";import H from"./RuleContent/RenameScopeModal.js";var Q=[{id:"learnings",label:"Learnings",icon:u,badgeKey:"learningsCount"},{id:"access",label:"Access",icon:d},{id:"history",label:"Change History",icon:p}],z=new Set(Q.map(function(e){return e.id}));function K(u){var d,p,K,V=this,W=u.userDetails,Y=u.llmStudioUrl,J=u.audacyBackendUrl,X=u.ilLabels,Z=u.config,$=u.rbacConfig,ee=u.auditLogConfig,te=u.app_integration_id,ne=u.backwardCompatibility,re=void 0!==ne&&ne,oe=m(function(e){return e.selectedRuleSetId}),se=m(function(e){return e.setSelectedRuleSetId}),ie=m(function(e){return e.error}),ae=m(function(e){return e.setError}),le=m(function(e){return e.setStations}),ce=m(function(e){return e.scopeTreeData}),ue=m(function(e){return e.setScopeTreeData}),de=a({isOpen:!1,type:"GLOBAL"}),pe=de[0],me=de[1],fe=a(!1),ve=fe[0],ge=fe[1],he=a(!1),ye=he[0],Se=he[1],be=a("learnings"),Ce=be[0],Te=be[1],Ee=a(null),Le=Ee[0],Ae=Ee[1],Ie=a(null),Oe=Ie[0],we=Ie[1],Re=l(null),je=l(null),Ne=l(!1),ke=l(null),De=y();De.user;var _e=De.setUser,Pe=D(),Ue=Pe.setConfig,Ge=Pe.setIlLabels,Me=e([{type:"GLOBAL",label:"Global",addChildLabel:"Add Scope",addChildType:"SCOPE"},t({type:"SCOPE",label:"Scope"},!re&&{addChildLabel:"Add Subscope",addChildType:"SUBSCOPE"})],re?[]:[{type:"SUBSCOPE",label:"Subscope"}],!0),Be=function(){try{return F()}catch(e){return{search:""}}}();c(function(){if(!Ne.current){var e=new URLSearchParams(window.location.search),t=e.get(O.RULESET_ID),n=e.get(O.SECTION),r=n&&z.has(n)?n:"learnings";(null==t?void 0:t.length)&&se&&Te&&(se(t),Te(r),Ne.current=!0)}},[null==Be?void 0:Be.search,Te,se]);var Fe=U(function(e){return e.fetchPermissions}),qe=U(function(e){return e.hasPermission}),xe=G(function(e){return e.setRoles}),He=k(function(e){return e.appsecRbacUrl})===$.appsecRbacUrl,Qe=M($.applicationId,He).data;c(function(){Qe&&xe(Qe.map(function(e){return{_id:e._id,name:e.name}}))},[Qe,xe]),c(function(){var e;console.log("userDetails",W),_e(W),console.log("llmStudioUrl",Y),console.log("audacyBackendUrl",J),k.getState().setLlmStudioUrl(Y),k.getState().setAudacyBackendUrl(J),k.getState().setRbacConfig($),k.getState().setAuditLogConfig(ee),Ue(Z),Ge(X),m.getState().setAppIntegrationId(null!=te?te:null),m.getState().setBackwardCompatibility(re),m.getState().setToken(null!==(e=W.accessToken)&&void 0!==e?e:null)},[W,_e,Y,J,$,ee,Z,Ue,X,Ge,te,re]),c(function(){(null==W?void 0:W.accessToken)&&Y&&S()},[te,null==W?void 0:W.accessToken,Y]);var ze=function(e){return void 0===e&&(e=!0),n(V,void 0,void 0,function(){var n,o,s,i,a,l;return r(this,function(r){switch(r.label){case 0:e&&ge(!0),ae(null),r.label=1;case 1:return r.trys.push([1,4,5,6]),[4,Fe($.applicationId)];case 2:return r.sent(),n=function(e){if(!U.getState().hasPermission("ilotj.scope.view",e.id))return null;var r=e.children?e.children.map(function(e){return n(e)}).filter(function(e){return null!==e}):[];return t(t({},e),{children:r})},[4,b(te,W.accessToken)];case 3:return(o=r.sent())&&o.data&&o.data.data&&(s=o.data.data,Array.isArray(s)&&(s=s.length>0?s[0]:null),s?(i=n(s))?(Ae(null),ue({data:i}),je.current?(se(je.current),Te("learnings"),je.current=null):m.getState().selectedRuleSetId||se(i.id)):(Ae(null!==(l=s.id)&&void 0!==l?l:null),ue(null)):(Ae(null),ue(null))),[3,6];case 4:return a=r.sent(),console.error("Failed to fetch rule sets or permissions",a),ae("Failed to load data. Please try again later."),[3,6];case 5:return ge(!1),[7];case 6:return[2]}})})};c(function(){var e;(null===(e=null==W?void 0:W.accessToken)||void 0===e?void 0:e.length)&&He?ze(!0):console.warn("Error: Trying to fetch rules without access token",W)},[null==W?void 0:W.accessToken,ae,le,$.applicationId,He]);var Ke=function(e){return n(V,void 0,void 0,function(){var n,s,i,a;return r(this,function(r){switch(r.label){case 0:Se(!0),r.label=1;case 1:return r.trys.push([1,4,5,6]),pe.scopeId?[4,L({scope_id:pe.scopeId,scope_name:e})]:[2];case 2:return r.sent(),[4,ze(!0)];case 3:return r.sent(),me(function(e){return t(t({},e),{isOpen:!1})}),[3,6];case 4:throw n=r.sent(),console.error("An error occurred during scope rename.",n),null===(s=ke.current)||void 0===s||s.show({severity:"error",sticky:!1,className:v.errorToast,content:o(x,{message:(null===(a=null===(i=null==n?void 0:n.response)||void 0===i?void 0:i.data)||void 0===a?void 0:a.message)||"There was an error renaming the scope. Please try again."})}),n;case 5:return Se(!1),[7];case 6:return[2]}})})},Ve=function(e,o,s){return n(V,void 0,void 0,function(){var n,o,s,i,a,l,c,u;return r(this,function(r){switch(r.label){case 0:Se(!0),r.label=1;case 1:return r.trys.push([1,4,5,6]),[4,A(e,W.accessToken)];case 2:return r.sent(),m.getState().selectedRuleSetId===e&&(n=m.getState().scopeTreeData,(o=N((null==n?void 0:n.data)||null,e))&&o.length>1&&(s=o[o.length-2],se(s),Te("learnings"))),[4,ze(!0)];case 3:return r.sent(),me(function(e){return t(t({},e),{isOpen:!1})}),null===(a=ke.current)||void 0===a||a.show({severity:"success",summary:"Deleted Successfully",detail:"The scope was permanently removed."}),[3,6];case 4:return i=r.sent(),console.error("An error occurred during scope deletion.",i),null===(l=ke.current)||void 0===l||l.show({severity:"error",summary:"Delete Failed",detail:(null===(u=null===(c=null==i?void 0:i.response)||void 0===c?void 0:c.data)||void 0===u?void 0:u.message)||"There was an error deleting the scope. Please try again."}),[3,6];case 5:return Se(!1),[7];case 6:return[2]}})})},We=ce,Ye=Oe?{data:{id:Oe.stationId,name:Oe.stationName,type:"STATION",metrics:{learningsCount:Oe.learningsCount,stationsCount:0},children:[]}}:We,Je=!!(null==Ye?void 0:Ye.data);null===(d=null==Ye?void 0:Ye.data)||void 0===d||d.type;var Xe=U(function(e){return e.hasGlobalPermission})("ilotj.scope.global.create",$.applicationResourceId||""),Ze=(Oe?Q.filter(function(e){return"stations"!==e.id}):Q).filter(function(e){return!(!re&&"access"===e.id)});return o(_,{children:s("div",t({className:v.learningManagementContainer},{children:[o("div",t({className:v.mainWrapper},{children:ve?o(j,{}):ie?s("div",t({className:v.errorContainer},{children:[o("div",t({className:v.errorTitle},{children:"Error Loading Data"})),o("p",t({className:v.errorDesc},{children:ie})),o("button",t({onClick:function(){return ze(!0)},className:v.tryAgainBtn},{children:"Try Again"}))]})):Je?o(g,{onOpenCreateModal:function(){return me({isOpen:!0,type:"GLOBAL"})},onAddChild:function(e,t,n){return me({isOpen:!0,type:t,parentId:e,parentName:n})},onRenameChild:function(e,t){return me({isOpen:!0,type:"RENAME",scopeId:e,initialName:t})},onDeleteChild:function(e,t,o){return n(V,void 0,void 0,function(){var n,s,i;return r(this,function(r){switch(r.label){case 0:return n=m.getState().scopeTreeData,s=N((null==n?void 0:n.data)||null,e),i=!!s&&3===s.length,0!==o?[3,2]:[4,Ve(e)];case 1:return r.sent(),[3,3];case 2:me({isOpen:!0,type:"DELETE",scopeId:e,initialName:t,isSubscope:i}),r.label=3;case 3:return[2]}})})},canDeleteScope:function(e){return qe("ilotj.scope.delete",e)},canEditScope:function(e){return qe("ilotj.scope.edit",e)},canCreateScope:function(e){return qe("ilotj.scope.create",e)},onSectionSelect:function(e,t){var n;console.log("Section Selected:",{scopeId:e,sectionId:t}),w(((n={})[O.SECTION]="learnings"===t?null:t,n)),Te(t),se(e)},activeSectionId:Ce,scopeTreeData:Ye,sectionsConfig:Ze,onViewStation:function(e){Re.current=oe,we(e),Te("learnings"),se(e.stationId)},onRefreshRuleSets:function(e,t){void 0===e&&(e=!0),t&&(je.current=t),ze(e)},nodeTypesConfig:Me,app_integration_id:te,token:W.accessToken}):o(h,{onCreate:function(){return me({isOpen:!0,type:"GLOBAL"})},title:"No Global Scope has been added!",desc:"Start by creating a Global scope to define base learnings that apply across all stations.",button:"Create Global Scope",canCreateRule:Xe,noAccessTitle:"Access Restricted",noAccessDesc:"You do not have access to create a Global scope for this application.",onRequestAccess:function(){return n(V,void 0,void 0,function(){var e,t,n,s,i,a,l,c,u;return r(this,function(r){switch(r.label){case 0:if(!(e=(null===(s=null===(n=m.getState().scopeTreeData)||void 0===n?void 0:n.data)||void 0===s?void 0:s.id)||Le))return null===(i=ke.current)||void 0===i||i.show({severity:"error",sticky:!1,className:v.errorToast,content:o(x,{message:"Unable to identify the global scope for this access request."})}),[2];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,I(e)];case 2:return r.sent(),null===(a=ke.current)||void 0===a||a.show({severity:"success",sticky:!1,life:3e3,className:v.successToast,content:o(q,{message:"Access request submitted successfully!"})}),[3,4];case 3:return t=r.sent(),null===(l=ke.current)||void 0===l||l.show({severity:"error",sticky:!1,className:v.errorToast,content:o(x,{message:(null===(u=null===(c=null==t?void 0:t.response)||void 0===c?void 0:c.data)||void 0===u?void 0:u.detail)||"Failed to request access. Please try again."})}),[3,4];case 4:return[2]}})})}})})),o(f,{ref:ke,pt:{root:{style:{zIndex:9999}}}}),re&&pe.isOpen&&"DELETE"!==pe.type&&"RENAME"!==pe.type?o(P,{isOpen:!0,onClose:function(){return me(t(t({},pe),{isOpen:!1}))},onSubmit:function(e){return n(V,void 0,void 0,function(){var n,o,s,i,a,l,c,u,d,p,f,v,g,h,y,S,b,L,A,I;return r(this,function(r){switch(r.label){case 0:Se(!0),n=m.getState().backwardCompatibility,r.label=1;case 1:return r.trys.push([1,12,13,14]),o=void 0,n&&"object"==typeof e?o=e:(s=e,i="SCOPE"===pe.type&&pe.parentId,a=i?"genreRuleSet":pe.type,o={topic:a,scope_reference_id:null,scopeDescription:"demo",parentScopeId:pe.parentId||null,scopeName:s,scopeReferenceMetadata:{},applicationMappingId:te}),[4,E(o,W.accessToken)];case 2:if(l=r.sent(),!(c=null===(h=null==l?void 0:l.data)||void 0===h?void 0:h.scopeId))return[3,10];if(je.current=c,u=n&&(null===(y=o.topic)||void 0===y?void 0:y.toLowerCase().includes("genre")),d=!n&&"GLOBAL"!==pe.type&&pe.parentId,!u&&!d)return[3,10];if(!(p=n?null===(b=null===(S=m.getState().scopeTreeData)||void 0===S?void 0:S.data)||void 0===b?void 0:b.id:pe.parentId))return[3,10];if(!re)return[3,7];r.label=3;case 3:return r.trys.push([3,5,,6]),[4,T({source_scope_id:p,target_scope_id:c})];case 4:return r.sent(),[3,6];case 5:return f=r.sent(),console.error("Failed to inherit rules for the new scope:",f),[3,6];case 6:return[3,10];case 7:return r.trys.push([7,9,,10]),[4,C({source_scope_id:p,target_scope_id:c,application_mapping_id:te||"",is_copy_parent_variant_id:!1})];case 8:return r.sent(),[3,10];case 9:return v=r.sent(),console.error("Failed to inherit rules for the new scope:",v),[3,10];case 10:return[4,ze(!0)];case 11:return r.sent(),me(function(e){return t(t({},e),{isOpen:!1})}),[3,14];case 12:throw g=r.sent(),console.error("An error occurred during scope creation.",g),null===(L=ke.current)||void 0===L||L.show({severity:"error",summary:"Creation Failed",detail:(null===(I=null===(A=null==g?void 0:g.response)||void 0===A?void 0:A.data)||void 0===I?void 0:I.message)||"There was an error creating the scope. Please try again."}),g;case 13:return Se(!1),[7];case 14:return[2]}})})},hasGlobalRuleSet:Je,canCreateGlobal:Xe,globalScopeId:null!==(K=null===(p=null==ce?void 0:ce.data)||void 0===p?void 0:p.id)&&void 0!==K?K:null}):s(i,{children:[o(B,{isOpen:pe.isOpen&&"DELETE"!==pe.type&&"RENAME"!==pe.type,onClose:function(){return me(t(t({},pe),{isOpen:!1}))},onCreate:function(e){return Ke(null!=e?e:"")},hasGlobalRuleSet:Je}),o(H,{isOpen:pe.isOpen&&"RENAME"===pe.type,onClose:function(){return me(t(t({},pe),{isOpen:!1}))},onSave:Ke,initialName:pe.initialName})]}),o(R,{isOpen:pe.isOpen&&"DELETE"===pe.type,onCancel:function(){return me(t(t({},pe),{isOpen:!1}))},onConfirm:function(){return Ve(pe.scopeId,pe.initialName,pe.isSubscope)},title:"Delete Scope",description:s(i,{children:["Deleting ",o("span",t({className:v.highlight},{children:pe.initialName||"this scope"}))," will permanently remove all Learnings, Access rules, and Change History inside it. This cannot be undone."]}),confirmText:"Delete",confirmBgColor:"#EF4444",isLoading:ye})]}))})}export{K as default};
|
|
2
2
|
//# sourceMappingURL=LearningManagement.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e,__awaiter as n,__generator as r}from"tslib";import{jsxs as o,Fragment as i,jsx as t}from"react/jsx-runtime";import{useRef as a,useState as l,useEffect as s}from"react";import{GripVertical as c,ChevronUp as u,ChevronDown as d}from"lucide-react";import{toggleVariant as p}from"../apis/scopeApis.js";import v from"../styles/RuleAccordion.module.css.js";import m from"../styles/CustomTooltip.module.css.js";import f from"./InheritanceBreadcrumb.js";import g from"../components/ConfirmationModal.js";import h from"../components/CustomTooltip.js";import b from"../store/useAuthStore.js";import{usePermissionsStore as j}from"../store/usePermissionsStore.js";import{useLearningTemplateStore as A}from"../store/useLearningTemplateStore.js";import
|
|
1
|
+
import{__assign as e,__awaiter as n,__generator as r}from"tslib";import{jsxs as o,Fragment as i,jsx as t}from"react/jsx-runtime";import{useRef as a,useState as l,useEffect as s}from"react";import{GripVertical as c,ChevronUp as u,ChevronDown as d}from"lucide-react";import{toggleVariant as p}from"../apis/scopeApis.js";import v from"../styles/RuleAccordion.module.css.js";import m from"../styles/CustomTooltip.module.css.js";import f from"./InheritanceBreadcrumb.js";import g from"../components/ConfirmationModal.js";import h from"../components/CustomTooltip.js";import b from"../store/useAuthStore.js";import{usePermissionsStore as j}from"../store/usePermissionsStore.js";import{useLearningTemplateStore as A}from"../store/useLearningTemplateStore.js";import I from"./ApprovalLearningDialog.js";import T from"./ApprovalActionButton.js";import C from"./PendingApprovalChip.js";import{useApproveOrRejectVariantsMutation as S}from"../queries/useApprovalQueries.js";import L from"../store/useEnvStore.js";import{Toast as N}from"primereact/toast";var y=function(y){var w,P,D,O,R,B,k,x,E,_,H,M,V,z=y.rule,F=y.idx,G=y.ruleSetId,q=y.isOpen,Q=y.onToggle,U=y.onDelete;y.onEdit,y.isGlobalScope;var Y=y.deleteButtonLabel,J=void 0===Y?"Delete":Y;y.editButtonLabel;var K=y.enableLearningRuleLabel,W=void 0===K?"Enable":K,X=y.disableLearningRuleLabel,Z=void 0===X?"Disable":X,$=y.onToggleSuccess,ee=y.dragControls,ne=b.getState().user,re=j(function(e){return e.hasPermission}),oe=re("ilotj.rule.delete",G),ie=re("ilotj.rule.enable",G),te=re("ilotj.rule.disable",G),ae=re("ilotj.rule.selfApprove",G),le=re("ilotj.rule.approve",G),se=re("ilotj.scope.approve",G),ce=re("ilotj.rule.pendingApproval.view",G),ue=re("ilotj.rule.variant.pendingApproval.edit",G),de=ae||le||se||ue,pe=ce||de,ve=S(),me=L(function(e){return e.rbacConfig}),fe=me?{application:null==me?void 0:me.applicationId,scopeLevelModuleId:null!==(w=null==me?void 0:me.moduleId)&&void 0!==w?w:"",applicationLevelModuleId:null!==(P=null==me?void 0:me.applicationModuleId)&&void 0!==P?P:"",applicationLevelResourceId:null!==(D=null==me?void 0:me.applicationResourceId)&&void 0!==D?D:""}:void 0,ge=a(null),he=l(!1),be=he[0],je=he[1],Ae=z.variants&&z.variants.length>0?!z.variants.every(function(e){return!1===e.is_enabled}):!1!==z.is_enabled,Ie=l(!1),Te=Ie[0],Ce=Ie[1],Se=null===(O=z.variants)||void 0===O?void 0:O.map(function(e){return e.inheritance||[]}).reduce(function(e,n){return n.length>e.length?n:e},[]),Le=null===(R=z.variants)||void 0===R?void 0:R.some(function(e){return null==e?void 0:e.isOverridden}),Ne=Ae?te:ie;z.inheritance&&z.inheritance.length>0&&(null===(B=z.inheritance)||void 0===B||B.length);var ye=null!==(x=null===(k=z.variants)||void 0===k?void 0:k.length)&&void 0!==x?x:0,we=l({isOpen:!1,mode:"approve"}),Pe=we[0],De=we[1],Oe=null!==(_=null===(E=z.variants)||void 0===E?void 0:E.filter(function(e){return"pending_approval"===e.approvalStatus}).length)&&void 0!==_?_:0,Re=A(function(e){return e.urlVariantId}),Be=A(function(e){return e.urlApprovalAction}),ke=A(function(e){return e.clearUrlApprovalParams});s(function(){var e;if(Re&&Be){var n=null===(e=z.variants)||void 0===e?void 0:e.find(function(e){return e.variantId===Re});n&&"pending_approval"===(null==n?void 0:n.approvalStatus)&&de&&(De({isOpen:!0,mode:Be}),ke())}},[Re,Be,z.variants,ke,de]);var xe=function(e,n){e.stopPropagation(),De({isOpen:!0,mode:n})},Ee=q?"".concat(v.accordionHeader," ").concat(v.accordionHeaderOpen):v.accordionHeader;return o(i,{children:[t(N,{ref:ge}),t("div",e({className:Ee,onClick:Q},{children:o("div",e({className:v.headerContent},{children:[o("div",e({className:v.headerTopRow},{children:[t("div",e({className:v.titleSection},{children:o("div",e({className:v.titleRow},{children:[t("div",e({className:v.dragHandle,title:"Drag to reorder",style:{touchAction:"none"},onPointerDown:function(e){e.stopPropagation(),null==ee||ee.start(e)}},{children:t(c,{size:18})})),o("span",e({className:v.ruleTitle},{children:[F+1,". ",z.ruleTitle]})),z.dataSource&&t("span",e({className:v.dataSourceTag},{children:null===(H=z.dataSource)||void 0===H?void 0:H.tag})),pe&&t(C,{count:Oe}),Le&&t(h,e({content:"Inherited from the ".concat((null==Se?void 0:Se.length)>=2?Se[Se.length-2]:"parent"," scope and overridden in this scope."),placement:"top",withArrow:!0,contentClassName:m.customTooltip,sideOffset:5},{children:t("span",e({className:v.overriddenTag},{children:"Overridden"}))})),!Ae&&t("span",e({className:v.learningDisabledPill},{children:"Disabled"}))]}))})),t("div",e({className:v.headerActions},{children:t("div",e({className:v.chevronIcon},{children:t(q?u:d,{size:20})}))}))]})),o("div",e({className:v.footerRow},{children:[t(f,{inheritance:Se||[]}),o("div",e({className:v.headerButtonGroup},{children:[Ne&&t("button",e({onClick:function(e){return n(void 0,void 0,void 0,function(){return r(this,function(n){return e.stopPropagation(),je(!0),[2]})})},disabled:Te,className:v.toggleLearningButton},{children:Ae?Z:W})),de&&Oe>1&&o(i,{children:[t(T,{variant:"approve",text:Oe>1?"Approve All":"Approve",onClick:function(e){return xe(e,"approve")}}),t(T,{variant:"reject",text:Oe>1?"Reject All":"Reject",onClick:function(e){return xe(e,"reject")}})]}),oe&&U&&t("button",e({className:v.deleteButton,onClick:function(e){e.stopPropagation(),null==U||U()}},{children:J}))]}))]}))]}))})),t(g,{isOpen:be,title:Ae?"Disable Learning?":"Enable Learning?",description:"Are you sure you want to ".concat(Ae?"disable":"enable"," this learning for ").concat(z.ruleTitle,"?"),warning:Ae?"This learning will no longer influence upcoming schedules. You can enable it again anytime.":"This learning will start influencing upcoming schedules again.",confirmText:Ae?"Disable":"Enable",cancelText:"Cancel",confirmBgColor:Ae?"#DC2626":"#16A34A",onConfirm:function(){return n(void 0,void 0,void 0,function(){var e,n,o;return r(this,function(r){switch(r.label){case 0:Ce(!0),r.label=1;case 1:return r.trys.push([1,3,4,5]),0===(e=(null===(o=z.variants)||void 0===o?void 0:o.map(function(e){return e.variantId}))||[]).length&&z.ruleId&&e.push(z.ruleId),null==ne?void 0:ne.email,[4,p(e,!Ae)];case 2:return r.sent(),null==$||$(),[3,5];case 3:return n=r.sent(),console.error("Failed to toggle rule variants",n),[3,5];case 4:return Ce(!1),je(!1),[7];case 5:return[2]}})})},onCancel:function(){return je(!1)},isLoading:Te}),t(I,{open:Pe.isOpen,mode:Pe.mode,onClose:function(){return De(function(n){return e(e({},n),{isOpen:!1})})},onSubmit:function(n){return function(n){var r,o,i=null!==(o=null===(r=z.variants)||void 0===r?void 0:r.filter(function(e){return"pending_approval"===e.approvalStatus}).map(function(e){return e.variantId}))&&void 0!==o?o:[];i.length&&G&&ve.mutate({variantIds:i,status:"approve"===Pe.mode?"approved":"rejected",feedback:n.feedback,scopeId:G,appsecData:fe},{onSuccess:function(){var n;De(function(n){return e(e({},n),{isOpen:!1})}),null==$||$(),null===(n=ge.current)||void 0===n||n.show({severity:"success",summary:"".concat(Pe.mode," Successfully"),detail:"approve"===Pe.mode?"Learning approved successfully":"Learning rejected successfully"})},onError:function(e){var n;console.error("An error occurred during rejecting.",e),null===(n=ge.current)||void 0===n||n.show({severity:"error",summary:"".concat(Pe.mode," Failed"),detail:"There was an error ".concat("approve"===Pe.mode?"approving":"rejecting"," the learning. Please try again.")})}})}(n)},variantInformation:"".concat(z.ruleTitle,"-").concat(ye>1?"Variants":"Variant 1"),ruleTitle:z.ruleTitle,pendingVariants:null!==(V=null===(M=z.variants)||void 0===M?void 0:M.filter(function(e){return"pending_approval"===e.approvalStatus}))&&void 0!==V?V:[],isPending:ve.isPending})]})};export{y as default};
|
|
2
2
|
//# sourceMappingURL=RuleAccordionHeader.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as n,__spreadArray as t,__assign as r}from"tslib";import{jsxs as o,Fragment as i,jsx as l}from"react/jsx-runtime";import{useRef as a,useState as s,useEffect as u}from"react";import{useLearningTemplateStore as c}from"../store/useLearningTemplateStore.js";import d from"../components/EmptyLearningState.js";import{getRulesInRuleSetById as p,exportRuleSet as m,deleteRule as f,deleteQuestion as v,alterQuestionPriority as g}from"../apis/scopeApis.js";import h from"../components/RuleContentSkeleton.js";import{Toast as y}from"primereact/toast";import T from"./ContentLogic.js";import w from"../components/ErrorStateDisplay.js";import b from"../shared/SuccessToastContent.js";import C from"../shared/ErrorToastContent.js";import{findNodeById as S}from"../utils/treeUtils.js";import I from"../styles/LearningContent.module.css.js";import R from"../components/ConfirmationModal.js";import"../../IL-OTJ/_components/atoms/Textarea/Textarea.js";import"lucide-react";import"../../IL-OTJ/_components/InputDataReasoningCard.js";import"../../IL-OTJ/_components/TooltipComponent.js";import"../../IL-OTJ/_components/templates/TemplatesMap/templatesMap.js";import{CitationProvider as _}from"../../IL-OTJ/store/CitationsContext.js";import"@mui/material";import"uuid";import"@mui/material/Tooltip";import"react-markdown";import"rehype-raw";import"axios";import"@e-llm-studio/streaming-response";import"@e-llm-studio/watch-me-work";import"../../IL-OTJ/_components/ChatComponents/ChatHeader.js";import"remark-gfm";import"../../IL-OTJ/_components/MarkdownComponents/MarkdownElements.js";import"../../IL-OTJ/_components/CitationLink.js";import"@e-llm-studio/citation";import"@viswa-test/test-citation";import"../LearningManagement.js";import j from"../../IL-OTJ/ValueTypeWrappers/TeachMePlugin.js";var k=function(k){var L,O=k.noRulesTitle,D=void 0===O?"No rules have been added !":O,M=k.noRulesDesc,x=void 0===M?"Start by adding rules that should apply across all stations.":M,N=k.noRulesButtonText,A=void 0===N?"Create New Rule":N,E=k.deleteRuleSuccessMessage,F=void 0===E?"Rule deleted successfully!":E,V=k.deleteVariantSuccessMessage,P=void 0===V?"Variant deleted successfully!":V,J=k.deleteRuleErrorMessage,U=void 0===J?"Failed to delete rule. Please try again.":J,B=k.deleteVariantErrorMessage,W=void 0===B?"Failed to delete variant. Please try again.":B,G=k.deleteModalTitle,q=void 0===G?"Delete":G,H=k.deleteRuleModalWarning,$=void 0===H?"This will permanently delete the rule configuration.":H,z=k.deleteVariantModalWarning,K=void 0===z?"This will permanently delete the variant configuration.":z,Q=k.deleteConfirmText,X=void 0===Q?"Delete":Q,Y=k.onRefreshRuleSets,Z=k.app_integration_id,ee=k.token,ne=c(function(e){return e.selectedRuleSetId}),te=c(function(e){return e.scopeTreeData}),re=c(function(e){return e.sidebarTab}),oe=c(function(e){return e.setInitialRules}),ie=c(function(e){return e.currentRules}),le=c(function(e){return e.setRawAuditRuleData});c(function(e){return e.createdVariantInfo});var ae=c(function(e){return e.resetCreatedVariantInfo}),se=c(function(e){return e.isILModalTriggered}),ue=c(function(e){return e.setIsILModalTriggered}),ce=a(null),de=s(!1),pe=de[0],me=de[1],fe=s(null),ve=fe[0],ge=fe[1],he=s(null),ye=he[0],Te=he[1],we=s(null),be=we[0],Ce=we[1],Se=s(null),Ie=Se[0],Re=Se[1],_e=s(!1),je=_e[0],ke=_e[1],Le=s(null),Oe=Le[0],De=Le[1],Me=s(!1),xe=Me[0],Ne=Me[1],Ae=s(""),Ee=Ae[0],Fe=Ae[1],Ve=s(null),Pe=Ve[0],Je=Ve[1],Ue=s(!1),Be=Ue[0],We=Ue[1],Ge=s(!1),qe=Ge[0],He=Ge[1],$e=s("ruleDeletion"),ze=$e[0],Ke=$e[1],Qe=s(null),Xe=Qe[0],Ye=Qe[1],Ze=s(!1),en=Ze[0],nn=Ze[1],tn=s(!1),rn=tn[0],on=tn[1],ln=c.getState().tiers,an=s(null),sn=an[0],un=an[1],cn=s(null),dn=cn[0],pn=cn[1],mn=s(null),fn=mn[0],vn=mn[1],gn=function(){ge(null),Te(null),me(!0),Re(0)},hn=function(){me(!1),ue(!1),ge(null),Te(null),Ce(null),Re(null),He(!1),on(!1),yn(),un(null),pn(null),vn(null),Y&&Y(!1,ne||void 0)};u(function(){yn()},[ne,oe]),u(function(){se&&me(!0)},[se]);var yn=function(o){return void 0===o&&(o=!1),e(void 0,void 0,void 0,function(){var e,i,l,a,s,u,d,m,f,v,g,h,y,T,w,b,C,S,I;return n(this,function(n){switch(n.label){case 0:if(!ne)return oe([]),[2];o||ke(!0),De(null),n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,p(ne,ee)];case 2:return e=n.sent(),console.log("response==",e),(null==e?void 0:e.data)&&0!==Object.keys(e.data).length?(le(e),i=e.data,console.log("rulesData==",i),l=new Set(["ruleSetName","ruleSetDesc","created_at","updated_at","created_by","updated_by"]),a=Array.isArray(i.tiers)?t([],i.tiers,!0).sort(function(e,n){var t,r;return(null!==(t=e.tier_priority)&&void 0!==t?t:0)-(null!==(r=n.tier_priority)&&void 0!==r?r:0)}).map(function(e){return[e.name,e.value]}):Object.entries(i).filter(function(e){var n=e[0],t=e[1];return!l.has(n)&&Array.isArray(t)}),s=a.map(function(e){var n=e[1];return new Set(n.flatMap(function(e){var n,t;return null!==(t=null===(n=e.variants)||void 0===n?void 0:n.map(function(e){return e.link_id}).filter(Boolean))&&void 0!==t?t:[]}))}),u=s.flatMap(function(e){return Array.from(e)}),d=u.reduce(function(e,n){var t;return e[n]=(null!==(t=e[n])&&void 0!==t?t:0)+1,e},{}),m=new Set(Object.entries(d).filter(function(e){return e[1]>1}).map(function(e){return e[0]})),f=function(e){return e.map(function(e){var n;return r(r({},e),{variants:null===(n=e.variants)||void 0===n?void 0:n.map(function(e){return r(r({},e),{isLinked:!!e.link_id&&m.has(e.link_id)})})})})},v=a.map(function(e,n){var t,r=e[0],o=e[1],i=ln.find(function(e){return e.tier_name===r}),l=r.replace(/tier(\d+)/i,"tier_$1");return{id:null!==(t=null==i?void 0:i.tier_id)&&void 0!==t?t:String(n+1),name:l.replace(/_/g," ").replace(/\b\w/g,function(e){return e.toUpperCase()}),ruleCount:o.length,description:0===n?"These are the system-wide learnings applied across all stations.":"These learnings apply after higher-priority tiers and may refine or relax default behavior.",isOpen:0===n,rules:f(o)}}),(g=c.getState().createdVariantInfo)&&g.length>0?(h=Object.fromEntries(a.map(function(e,n){return[e[0],String(n+1)]})),y=new Set(g.map(function(e){return h[e.tierName]}).filter(Boolean)),T=v.map(function(e){return r(r({},e),{isOpen:e.isOpen||y.has(e.id)})}),oe(T),(w=null===(I=null===(S=null===(C=g[0])||void 0===C?void 0:C.variants)||void 0===S?void 0:S[0])||void 0===I?void 0:I.id)?setTimeout(function(){var e=document.querySelector('[data-variant-id="'.concat(w,'"]'));e&&e.scrollIntoView({behavior:"smooth",block:"center"}),setTimeout(function(){return ae()},1e4)},500):ae()):oe(v),[3,5]):(oe([]),[2]);case 3:return b=n.sent(),console.error("Failed to fetch rule details",b),404!==(null==b?void 0:b.status)&&De((null==b?void 0:b.message)||"Failed to load rules. Please try again."),oe([]),[3,5];case 4:return o||ke(!1),[7];case 5:return[2]}})})},Tn=ne?S((null==te?void 0:te.data)||null,ne):null,wn=Tn?{ruleSetId:Tn.id,ruleSetName:Tn.name,ruleSetDesc:"",ruleCount:null===(L=null==Tn?void 0:Tn.metrics)||void 0===L?void 0:L.learningsCount}:void 0,bn=function(){if("stations"===re)return"custom";if(!Tn)return"global";switch(Tn.type){case"GLOBAL":default:return"global";case"SCOPE":return"genre";case"SUBSCOPE":case"Custom":return"custom"}},Cn=function(e){if(!e)return l("p",{children:"Are you sure you want to delete this rule? This action cannot be undone."});var n=null==ie?void 0:ie.flatMap(function(e){var n;return null!==(n=e.rules)&&void 0!==n?n:[]}).find(function(n){return n.ruleId===e});return o("p",{children:["Are you sure you want to delete"," ",l("span",r({className:I.semibold},{children:null==n?void 0:n.ruleTitle}))," rule? This action cannot be undone."]})},Sn={editingRule:ve,editingTier:ye,editingVariants:be,focusedVariantIndex:Ie,setFocusedVariantIndex:Re,triggerAddVariant:qe,triggerFixGaps:rn,copiedRule:sn,copiedSourceTier:dn,copiedTargetTier:fn,initialDraftMessage:Ee,app_integration_id:Z,modeId:"019dde79-0494-78d7-ba5b-54a35d20f0fc"};return o(i,wn?{children:[l(y,{ref:ce}),l("div",r({className:I.container},{children:je?l(h,{}):Oe?l(w,{errorMessage:Oe,onRetry:yn}):l(T,{onAddRule:gn,onDeleteRule:function(e){Je(e)},onEditRule:function(e,n){ge(e),Te(n||null),Ce(e.variants||null),Re(null),He(!0),me(!0)},onEditVariant:function(e,n,t,r){var o,i,l,a,s=null!==(l=null===(i=null===(o=null==ie?void 0:ie.find(function(e){return e.name===t}))||void 0===o?void 0:o.rules)||void 0===i?void 0:i.find(function(e){return e.ruleId===n}))&&void 0!==l?l:null==ie?void 0:ie.flatMap(function(e){return e.rules}).find(function(e){return e.ruleId===n});if(s){var u=null===(a=s.variants)||void 0===a?void 0:a.findIndex(function(n){return n.variantId===e.variantId}),c=void 0!==u&&-1!==u?u:0;ge(s),Te(t||null),Ce(s.variants||null),Re(c),me(!0),"resolve_gaps"===r&&on(!0)}},onDeleteVariant:function(e,n){Ye({variantId:e,ruleId:n})},onExportRule:function(){return e(void 0,void 0,void 0,function(){var e,t,r,o,i,a,s;return n(this,function(n){switch(n.label){case 0:if(!ne)return[2];Ne(!0),n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,m(ne)];case 2:return e=n.sent(),t=window.URL.createObjectURL(e),(r=document.createElement("a")).href=t,o=(null==wn?void 0:wn.ruleSetName)?"".concat(wn.ruleSetName.replace(/\s+/g,"_"),"_rules.csv"):"ruleset_".concat(ne,".csv"),r.download=o,document.body.appendChild(r),r.click(),document.body.removeChild(r),window.URL.revokeObjectURL(t),null===(a=ce.current)||void 0===a||a.show({severity:"success",sticky:!1,life:3e3,className:I.successToast,content:l(b,{message:"Ruleset exported successfully!"})}),[3,5];case 3:return i=n.sent(),console.error("Export error:",i),null===(s=ce.current)||void 0===s||s.show({severity:"error",sticky:!1,className:I.errorToast,content:l(C,{message:i.message||"Failed to export ruleset. Please try again."})}),[3,5];case 4:return Ne(!1),[7];case 5:return[2]}})})},isExporting:xe,onToggleSuccess:function(){return yn(!0)},onReorderRules:function(t,r,o,i,a){return e(void 0,void 0,void 0,function(){var e,s,u;return n(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,g(t,r,o,i,a)];case 1:return n.sent(),yn(!0),null===(s=ce.current)||void 0===s||s.show({severity:"success",sticky:!1,life:3e3,className:I.successToast,content:l(b,{message:"Rule order changed successfully. Future rule applications will follow the updated order."})}),[3,3];case 2:return e=n.sent(),console.error("Failed to reorder rules:",e),yn(!0),null===(u=ce.current)||void 0===u||u.show({severity:"error",sticky:!1,className:I.errorToast,content:l(C,{message:"Failed to update rule order. Please try again."})}),[3,3];case 3:return[2]}})})},onRefreshRuleSets:Y,setDeleteConfirmationUsedFor:Ke,onCopyToTier:function(e,n,t,r,o){var i,l,a=null===(l=null===(i=null==ie?void 0:ie.find(function(e){return e.name===r}))||void 0===i?void 0:i.rules)||void 0===l?void 0:l.find(function(e){return e.ruleId===n});if(a){var s=["Add a new learning with the following details:","- Rule Title: ".concat(t),"- Description: ".concat(e.description),"- When to apply: ".concat(e.whenToApply),"- When NOT to apply: ".concat(e.whenNotToApply),"- Tier information: ".concat(o)].join("\n");Fe(s),un(a),pn(r),vn(o),ge(null),Te(null),Ce(null),Re(null),me(!0)}}})})),pe&&l(_,{children:l(j,{isOpen:pe,onClose:hn,app_integration_id:Z,token:ee,mode:"ADD",pluginPayload:r(r({},Sn),{initialScope:bn(),ruleSet:wn})})}),l(R,{isOpen:!!Pe,title:q,description:Cn(Pe),warning:$,confirmText:X,confirmBgColor:"#EF4444",onConfirm:function(){return e(void 0,void 0,void 0,function(){var e,t,r,o,i;return n(this,function(n){switch(n.label){case 0:if(!Pe)return[2];We(!0),n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,f(Pe)];case 2:return n.sent(),Je(null),null===(t=ce.current)||void 0===t||t.show({severity:"success",sticky:!1,life:3e3,className:I.successToast,content:l(b,{message:F})}),yn(),Y&&Y(!1,ne||void 0),[3,5];case 3:return e=n.sent(),console.error("Failed to delete rule",e),null===(r=ce.current)||void 0===r||r.show({severity:"error",sticky:!1,className:I.errorToast,content:l(C,{message:(null===(i=null===(o=null==e?void 0:e.response)||void 0===o?void 0:o.data)||void 0===i?void 0:i.detail)||U})}),[3,5];case 4:return We(!1),[7];case 5:return[2]}})})},onCancel:function(){return Je(null)},isLoading:Be}),l(R,{isOpen:!!Xe,title:q,description:"variantDeletion"===ze?l("span",{children:"Are you sure you want to delete this variant? This action cannot be undone."}):Cn((null==Xe?void 0:Xe.ruleId)||null),warning:"ruleDeletion"===ze?$:K,confirmText:X,confirmBgColor:"#EF4444",onConfirm:function(){return e(void 0,void 0,void 0,function(){var e,t,r,o,i;return n(this,function(n){switch(n.label){case 0:if(!Xe)return[2];nn(!0),n.label=1;case 1:return n.trys.push([1,6,7,8]),"ruleDeletion"!==ze?[3,3]:[4,v(Xe.ruleId)];case 2:return n.sent(),[3,5];case 3:return[4,f(Xe.variantId)];case 4:n.sent(),n.label=5;case 5:return Ye(null),null===(t=ce.current)||void 0===t||t.show({severity:"success",sticky:!1,life:3e3,className:I.successToast,content:l(b,{message:"ruleDeletion"===ze?F:P})}),yn(),Y&&Y(!1,ne||void 0),[3,8];case 6:return e=n.sent(),console.error("Failed to delete variant",e),null===(r=ce.current)||void 0===r||r.show({severity:"error",sticky:!1,className:I.errorToast,content:l(C,{message:(null===(i=null===(o=null==e?void 0:e.response)||void 0===o?void 0:o.data)||void 0===i?void 0:i.detail)||("ruleDeletion"===ze?U:W)})}),[3,8];case 7:return nn(!1),[7];case 8:return[2]}})})},onCancel:function(){return Ye(null)},isLoading:en})]}:{children:[l(d,{onCreate:gn,title:D,desc:x,button:A}),pe&&l(_,{children:l(j,{isOpen:pe,onClose:hn,app_integration_id:Z,token:ee,mode:"ADD",pluginPayload:r(r({},Sn),{initialScope:bn(),ruleSet:wn})})})]})};export{k as default};
|
|
1
|
+
import{__awaiter as e,__generator as n,__spreadArray as t,__assign as r}from"tslib";import{jsx as o,jsxs as i,Fragment as l}from"react/jsx-runtime";import{useRef as a,useState as s,useEffect as u}from"react";import{useLearningTemplateStore as c}from"../store/useLearningTemplateStore.js";import d from"../components/EmptyLearningState.js";import{getRulesInRuleSetById as p,exportRuleSet as m,deleteRule as f,deleteQuestion as v,alterQuestionPriority as g}from"../apis/scopeApis.js";import h from"../components/RuleContentSkeleton.js";import{Toast as y}from"primereact/toast";import T from"./ContentLogic.js";import w from"../components/ErrorStateDisplay.js";import b from"../shared/SuccessToastContent.js";import C from"../shared/ErrorToastContent.js";import{findNodeById as R}from"../utils/treeUtils.js";import S from"../styles/LearningContent.module.css.js";import I from"../components/ConfirmationModal.js";import"../../IL-OTJ/_components/atoms/Textarea/Textarea.js";import"lucide-react";import"../../IL-OTJ/_components/InputDataReasoningCard.js";import"../../IL-OTJ/_components/TooltipComponent.js";import"../../IL-OTJ/_components/templates/TemplatesMap/templatesMap.js";import{CitationProvider as _}from"../../IL-OTJ/store/CitationsContext.js";import"@mui/material";import"uuid";import"@mui/material/Tooltip";import"react-markdown";import"rehype-raw";import"axios";import"@e-llm-studio/streaming-response";import"@e-llm-studio/watch-me-work";import"../../IL-OTJ/_components/ChatComponents/ChatHeader.js";import"remark-gfm";import"../../IL-OTJ/_components/MarkdownComponents/MarkdownElements.js";import"../../IL-OTJ/_components/CitationLink.js";import"@e-llm-studio/citation";import"@viswa-test/test-citation";import"../LearningManagement.js";import j from"../../IL-OTJ/ValueTypeWrappers/TeachMePlugin.js";var k=function(k){var L,O=k.noRulesTitle,D=void 0===O?"No rules have been added !":O,M=k.noRulesDesc,x=void 0===M?"Start by adding rules that should apply across all stations.":M,N=k.noRulesButtonText,A=void 0===N?"Create New Rule":N,E=k.deleteRuleSuccessMessage,F=void 0===E?"Rule deleted successfully!":E,V=k.deleteVariantSuccessMessage,P=void 0===V?"Variant deleted successfully!":V,B=k.deleteRuleErrorMessage,J=void 0===B?"Failed to delete rule. Please try again.":B,U=k.deleteVariantErrorMessage,W=void 0===U?"Failed to delete variant. Please try again.":U,G=k.deleteModalTitle,q=void 0===G?"Delete":G,H=k.deleteRuleModalWarning,$=void 0===H?"This will permanently delete the rule configuration.":H,z=k.deleteVariantModalWarning,K=void 0===z?"This will permanently delete the variant configuration.":z,Q=k.deleteConfirmText,X=void 0===Q?"Delete":Q,Y=k.onRefreshRuleSets,Z=k.app_integration_id,ee=k.token,ne=c(function(e){return e.selectedRuleSetId}),te=c(function(e){return e.scopeTreeData}),re=c(function(e){return e.sidebarTab}),oe=c(function(e){return e.setInitialRules}),ie=c(function(e){return e.currentRules}),le=c(function(e){return e.setRawAuditRuleData});c(function(e){return e.createdVariantInfo});var ae=c(function(e){return e.resetCreatedVariantInfo}),se=c(function(e){return e.isILModalTriggered}),ue=c(function(e){return e.setIsILModalTriggered}),ce=a(null),de=s(!1),pe=de[0],me=de[1],fe=s(null),ve=fe[0],ge=fe[1],he=s(null),ye=he[0],Te=he[1],we=s(null),be=we[0],Ce=we[1],Re=s(null),Se=Re[0],Ie=Re[1],_e=s(!1),je=_e[0],ke=_e[1],Le=s(null),Oe=Le[0],De=Le[1],Me=s(!1),xe=Me[0],Ne=Me[1],Ae=s(""),Ee=Ae[0],Fe=Ae[1],Ve=s(null),Pe=Ve[0],Be=Ve[1],Je=s(!1),Ue=Je[0],We=Je[1],Ge=s(!1),qe=Ge[0],He=Ge[1],$e=s("ruleDeletion"),ze=$e[0],Ke=$e[1],Qe=s(null),Xe=Qe[0],Ye=Qe[1],Ze=s(!1),en=Ze[0],nn=Ze[1],tn=s(!1),rn=tn[0],on=tn[1],ln=c.getState().tiers,an=s(null),sn=an[0],un=an[1],cn=s(null),dn=cn[0],pn=cn[1],mn=s(null),fn=mn[0],vn=mn[1],gn=function(){ge(null),Te(null),me(!0),Ie(0)},hn=function(){me(!1),ue(!1),ge(null),Te(null),Ce(null),Ie(null),He(!1),on(!1),yn(),un(null),pn(null),vn(null),Y&&Y(!1,ne||void 0)};u(function(){yn()},[ne,oe]),u(function(){se&&me(!0)},[se]);var yn=function(o){return void 0===o&&(o=!1),e(void 0,void 0,void 0,function(){var e,i,l,a,s,u,d,m,f,v,g,h,y,T,w,b,C,R,S;return n(this,function(n){switch(n.label){case 0:if(!ne)return oe([]),[2];o||ke(!0),De(null),n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,p(ne,ee)];case 2:return e=n.sent(),console.log("response==",e),(null==e?void 0:e.data)&&0!==Object.keys(e.data).length?(le(e),i=e.data,console.log("rulesData==",i),l=new Set(["ruleSetName","ruleSetDesc","created_at","updated_at","created_by","updated_by"]),a=Array.isArray(i.tiers)?t([],i.tiers,!0).sort(function(e,n){var t,r;return(null!==(t=e.tier_priority)&&void 0!==t?t:0)-(null!==(r=n.tier_priority)&&void 0!==r?r:0)}).map(function(e){return[e.name,e.value]}):Object.entries(i).filter(function(e){var n=e[0],t=e[1];return!l.has(n)&&Array.isArray(t)}),s=a.map(function(e){var n=e[1];return new Set(n.flatMap(function(e){var n,t;return null!==(t=null===(n=e.variants)||void 0===n?void 0:n.map(function(e){return e.link_id}).filter(Boolean))&&void 0!==t?t:[]}))}),u=s.flatMap(function(e){return Array.from(e)}),d=u.reduce(function(e,n){var t;return e[n]=(null!==(t=e[n])&&void 0!==t?t:0)+1,e},{}),m=new Set(Object.entries(d).filter(function(e){return e[1]>1}).map(function(e){return e[0]})),f=function(e){return e.map(function(e){var n;return r(r({},e),{variants:null===(n=e.variants)||void 0===n?void 0:n.map(function(e){return r(r({},e),{isLinked:!!e.link_id&&m.has(e.link_id)})})})})},v=a.map(function(e,n){var t,r=e[0],o=e[1],i=ln.find(function(e){return e.tier_name===r}),l=r.replace(/tier(\d+)/i,"tier_$1");return{id:null!==(t=null==i?void 0:i.tier_id)&&void 0!==t?t:String(n+1),name:l.replace(/_/g," ").replace(/\b\w/g,function(e){return e.toUpperCase()}),ruleCount:o.length,description:0===n?"These are the system-wide learnings applied across all stations.":"These learnings apply after higher-priority tiers and may refine or relax default behavior.",isOpen:0===n,rules:f(o)}}),(g=c.getState().createdVariantInfo)&&g.length>0?(h=Object.fromEntries(a.map(function(e,n){return[e[0],String(n+1)]})),y=new Set(g.map(function(e){return h[e.tierName]}).filter(Boolean)),T=v.map(function(e){return r(r({},e),{isOpen:e.isOpen||y.has(e.id)})}),oe(T),(w=null===(S=null===(R=null===(C=g[0])||void 0===C?void 0:C.variants)||void 0===R?void 0:R[0])||void 0===S?void 0:S.id)?setTimeout(function(){var e=document.querySelector('[data-variant-id="'.concat(w,'"]'));e&&e.scrollIntoView({behavior:"smooth",block:"center"}),setTimeout(function(){return ae()},1e4)},500):ae()):oe(v),[3,5]):(oe([]),[2]);case 3:return b=n.sent(),console.error("Failed to fetch rule details",b),404!==(null==b?void 0:b.status)&&De((null==b?void 0:b.message)||"Failed to load rules. Please try again."),oe([]),[3,5];case 4:return o||ke(!1),[7];case 5:return[2]}})})},Tn=ne?R((null==te?void 0:te.data)||null,ne):null,wn=Tn?{ruleSetId:Tn.id,ruleSetName:Tn.name,ruleSetDesc:"",ruleCount:null===(L=null==Tn?void 0:Tn.metrics)||void 0===L?void 0:L.learningsCount}:void 0,bn=Boolean(null==te?void 0:te.data),Cn=Boolean(ne&&!Tn&&bn),Rn=function(){if("stations"===re)return"custom";if(!Tn)return"global";switch(Tn.type){case"GLOBAL":default:return"global";case"SCOPE":return"genre";case"SUBSCOPE":case"Custom":return"custom"}},Sn=function(e){if(!e)return o("p",{children:"Are you sure you want to delete this rule? This action cannot be undone."});var n=null==ie?void 0:ie.flatMap(function(e){var n;return null!==(n=e.rules)&&void 0!==n?n:[]}).find(function(n){return n.ruleId===e});return i("p",{children:["Are you sure you want to delete"," ",o("span",r({className:S.semibold},{children:null==n?void 0:n.ruleTitle}))," rule? This action cannot be undone."]})},In={editingRule:ve,editingTier:ye,editingVariants:be,focusedVariantIndex:Se,setFocusedVariantIndex:Ie,triggerAddVariant:qe,triggerFixGaps:rn,copiedRule:sn,copiedSourceTier:dn,copiedTargetTier:fn,initialDraftMessage:Ee,app_integration_id:Z,modeId:"019dde79-0494-78d7-ba5b-54a35d20f0fc"};return wn?i(l,{children:[o(y,{ref:ce}),o("div",r({className:S.container},{children:je?o(h,{}):Oe?o(w,{errorMessage:Oe,onRetry:yn}):o(T,{onAddRule:gn,onDeleteRule:function(e){Be(e)},onEditRule:function(e,n){ge(e),Te(n||null),Ce(e.variants||null),Ie(null),He(!0),me(!0)},onEditVariant:function(e,n,t,r){var o,i,l,a,s=null!==(l=null===(i=null===(o=null==ie?void 0:ie.find(function(e){return e.name===t}))||void 0===o?void 0:o.rules)||void 0===i?void 0:i.find(function(e){return e.ruleId===n}))&&void 0!==l?l:null==ie?void 0:ie.flatMap(function(e){return e.rules}).find(function(e){return e.ruleId===n});if(s){var u=null===(a=s.variants)||void 0===a?void 0:a.findIndex(function(n){return n.variantId===e.variantId}),c=void 0!==u&&-1!==u?u:0;ge(s),Te(t||null),Ce(s.variants||null),Ie(c),me(!0),"resolve_gaps"===r&&on(!0)}},onDeleteVariant:function(e,n){Ye({variantId:e,ruleId:n})},onExportRule:function(){return e(void 0,void 0,void 0,function(){var e,t,r,i,l,a,s;return n(this,function(n){switch(n.label){case 0:if(!ne)return[2];Ne(!0),n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,m(ne)];case 2:return e=n.sent(),t=window.URL.createObjectURL(e),(r=document.createElement("a")).href=t,i=(null==wn?void 0:wn.ruleSetName)?"".concat(wn.ruleSetName.replace(/\s+/g,"_"),"_rules.csv"):"ruleset_".concat(ne,".csv"),r.download=i,document.body.appendChild(r),r.click(),document.body.removeChild(r),window.URL.revokeObjectURL(t),null===(a=ce.current)||void 0===a||a.show({severity:"success",sticky:!1,life:3e3,className:S.successToast,content:o(b,{message:"Ruleset exported successfully!"})}),[3,5];case 3:return l=n.sent(),console.error("Export error:",l),null===(s=ce.current)||void 0===s||s.show({severity:"error",sticky:!1,className:S.errorToast,content:o(C,{message:l.message||"Failed to export ruleset. Please try again."})}),[3,5];case 4:return Ne(!1),[7];case 5:return[2]}})})},isExporting:xe,onToggleSuccess:function(){return yn(!0)},onReorderRules:function(t,r,i,l,a){return e(void 0,void 0,void 0,function(){var e,s,u;return n(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,g(t,r,i,l,a)];case 1:return n.sent(),yn(!0),null===(s=ce.current)||void 0===s||s.show({severity:"success",sticky:!1,life:3e3,className:S.successToast,content:o(b,{message:"Rule order changed successfully. Future rule applications will follow the updated order."})}),[3,3];case 2:return e=n.sent(),console.error("Failed to reorder rules:",e),yn(!0),null===(u=ce.current)||void 0===u||u.show({severity:"error",sticky:!1,className:S.errorToast,content:o(C,{message:"Failed to update rule order. Please try again."})}),[3,3];case 3:return[2]}})})},onRefreshRuleSets:Y,setDeleteConfirmationUsedFor:Ke,onCopyToTier:function(e,n,t,r,o){var i,l,a=null===(l=null===(i=null==ie?void 0:ie.find(function(e){return e.name===r}))||void 0===i?void 0:i.rules)||void 0===l?void 0:l.find(function(e){return e.ruleId===n});if(a){var s=["Add a new learning with the following details:","- Rule Title: ".concat(t),"- Description: ".concat(e.description),"- When to apply: ".concat(e.whenToApply),"- When NOT to apply: ".concat(e.whenNotToApply),"- Tier information: ".concat(o)].join("\n");Fe(s),un(a),pn(r),vn(o),ge(null),Te(null),Ce(null),Ie(null),me(!0)}}})})),pe&&o(_,{children:o(j,{isOpen:pe,onClose:hn,app_integration_id:Z,token:ee,mode:"ADD",pluginPayload:r(r({},In),{initialScope:Rn(),ruleSet:wn})})}),o(I,{isOpen:!!Pe,title:q,description:Sn(Pe),warning:$,confirmText:X,confirmBgColor:"#EF4444",onConfirm:function(){return e(void 0,void 0,void 0,function(){var e,t,r,i,l;return n(this,function(n){switch(n.label){case 0:if(!Pe)return[2];We(!0),n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,f(Pe)];case 2:return n.sent(),Be(null),null===(t=ce.current)||void 0===t||t.show({severity:"success",sticky:!1,life:3e3,className:S.successToast,content:o(b,{message:F})}),yn(),Y&&Y(!1,ne||void 0),[3,5];case 3:return e=n.sent(),console.error("Failed to delete rule",e),null===(r=ce.current)||void 0===r||r.show({severity:"error",sticky:!1,className:S.errorToast,content:o(C,{message:(null===(l=null===(i=null==e?void 0:e.response)||void 0===i?void 0:i.data)||void 0===l?void 0:l.detail)||J})}),[3,5];case 4:return We(!1),[7];case 5:return[2]}})})},onCancel:function(){return Be(null)},isLoading:Ue}),o(I,{isOpen:!!Xe,title:q,description:"variantDeletion"===ze?o("span",{children:"Are you sure you want to delete this variant? This action cannot be undone."}):Sn((null==Xe?void 0:Xe.ruleId)||null),warning:"ruleDeletion"===ze?$:K,confirmText:X,confirmBgColor:"#EF4444",onConfirm:function(){return e(void 0,void 0,void 0,function(){var e,t,r,i,l;return n(this,function(n){switch(n.label){case 0:if(!Xe)return[2];nn(!0),n.label=1;case 1:return n.trys.push([1,6,7,8]),"ruleDeletion"!==ze?[3,3]:[4,v(Xe.ruleId)];case 2:return n.sent(),[3,5];case 3:return[4,f(Xe.variantId)];case 4:n.sent(),n.label=5;case 5:return Ye(null),null===(t=ce.current)||void 0===t||t.show({severity:"success",sticky:!1,life:3e3,className:S.successToast,content:o(b,{message:"ruleDeletion"===ze?F:P})}),yn(),Y&&Y(!1,ne||void 0),[3,8];case 6:return e=n.sent(),console.error("Failed to delete variant",e),null===(r=ce.current)||void 0===r||r.show({severity:"error",sticky:!1,className:S.errorToast,content:o(C,{message:(null===(l=null===(i=null==e?void 0:e.response)||void 0===i?void 0:i.data)||void 0===l?void 0:l.detail)||("ruleDeletion"===ze?J:W)})}),[3,8];case 7:return nn(!1),[7];case 8:return[2]}})})},onCancel:function(){return Ye(null)},isLoading:en})]}):Cn?o(w,{title:"Scope Not Found",errorMessage:"The selected scope does not exist. Please refresh the page or choose a valid scope.",onRetry:function(){return null==Y?void 0:Y(!0)},retryButtonText:"Refresh"}):i(l,{children:[o(d,{onCreate:gn,title:D,desc:x,button:A}),pe&&o(_,{children:o(j,{isOpen:pe,onClose:hn,app_integration_id:Z,token:ee,mode:"ADD",pluginPayload:r(r({},In),{initialScope:Rn(),ruleSet:wn})})})]})};export{k as default};
|
|
2
2
|
//# sourceMappingURL=RuleContent.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e,__awaiter as n,__generator as t}from"tslib";import{jsxs as i,jsx as r,Fragment as o}from"react/jsx-runtime";import{useState as a,useRef as l,useEffect as s}from"react";import{parseISO as c,isValid as d,format as u}from"date-fns";import{MoreVertical as p,Pause as v,Play as m,Copy as h,Eye as f,Info as g,TriangleAlert as y}from"lucide-react";import{toggleVariant as b}from"../apis/scopeApis.js";import{HistorySkeleton as T}from"./HistorySkeleton.js";import N from"./InheritanceBreadcrumb.js";import A from"./RuleConditionBlock.js";import C from"../styles/VariantCard.module.css.js";import j from"../styles/CustomTooltip.module.css.js";import w from"../components/CustomTooltip.js";import I from"../components/ConfirmationModal.js";import L from"./OverrideTimeline.js";import x from"../store/useAuthStore.js";import{usePermissionsStore as B}from"../store/usePermissionsStore.js";import D from"./PendingApprovalChip.js";import O from"./ApprovalActionButton.js";import k from"./ApprovalLearningDialog.js";import{useApproveOrRejectVariantsMutation as S}from"../queries/useApprovalQueries.js";import F from"../store/useEnvStore.js";var E=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return e.filter(Boolean).join(" ")},H=function(H){var P,V,W,M,_,z,R,U=H.ruleTitle,G=H.variant,q=H.variantIndex,Z=H.totalVariants,K=H.ruleId;H.pendingApprovalCount;var Q=H.ruleSetId,Y=H.tierName,$=H.displayLabel,J=H.onEdit,X=H.onDelete,ee=H.onFetchOverrideHistory,ne=H.editButtonLabel,te=void 0===ne?"Edit":ne,ie=H.deleteButtonLabel,re=void 0===ie?"Delete":ie,oe=H.whenToApplyLabel,ae=void 0===oe?"When to Apply":oe,le=H.whenNotToApplyLabel,se=void 0===le?"When Not to Apply":le,ce=H.noConditionsText,de=void 0===ce?"No conditions":ce,ue=H.viewOverrideLabel,pe=void 0===ue?"View Override History":ue,ve=H.hideOverrideLabel,me=void 0===ve?"Hide Override History":ve,he=H.enableLearningVariantLabel,fe=void 0===he?"Enable":he,ge=H.disableLearningVariantLabel,ye=void 0===ge?"Disable":ge,be=H.historyErrorMessage,Te=void 0===be?"Failed to load override history.":be,Ne=H.resolveGapsLabel,Ae=void 0===Ne?"This learning has some gaps":Ne,Ce=H.showActionsBar,je=void 0===Ce||Ce,we=H.showDescriptionBox,Ie=void 0===we||we,Le=H.showConditions,xe=void 0===Le||Le,Be=H.showInheritance,De=void 0===Be||Be,Oe=H.defaultApplyOpen,ke=void 0===Oe||Oe,Se=H.defaultNotApplyOpen,Fe=void 0===Se||Se,Ee=H.className,He=H.isHighlighted,Pe=void 0!==He&&He,Ve=H.highlightAction,We=H.highlightedTierNames,Me=H.highlightedVariantIds,_e=H.headerContent,ze=H.footerContent,Re=H.onToggleSuccess,Ue=H.setDeleteConfirmationUsedFor,Ge=H.onCopyToTier,qe=H.onSetInitialDraftMessage,Ze=x.getState().user,Ke=a(ke),Qe=Ke[0],Ye=Ke[1],$e=a(Fe),Je=$e[0],Xe=$e[1],en=a(!1),nn=en[0],tn=en[1],rn=a(!1),on=rn[0],an=rn[1],ln=a(null),sn=ln[0],cn=ln[1],dn=a(null),un=dn[0],pn=dn[1],vn=a(!1),mn=vn[0],hn=vn[1],fn=a(!1),gn=fn[0],yn=fn[1],bn=l(null),Tn=!1!==G.is_enabled,Nn=a(!1),An=Nn[0],Cn=Nn[1],jn=l(null),wn=a({isOpen:!1,mode:"approve"}),In=wn[0],Ln=wn[1],xn=S(),Bn=F(function(e){return e.rbacConfig}),Dn=Bn?{application:Bn.applicationId,scopeLevelModuleId:null!==(P=null==Bn?void 0:Bn.moduleId)&&void 0!==P?P:""}:void 0,On=B(function(e){return e.hasPermission}),kn=Q,Sn=G.inheritance&&G.inheritance.length>1,Fn=On("ilotj.rule.variant.edit",kn)||On(Sn?"ilotj.rule.variant.inherited.edit":"ilotj.rule.variant.nonInherited.edit",kn),En=On("ilotj.rule.variant.enable",kn)||On(Sn?"ilotj.rule.variant.inherited.enable":"ilotj.rule.variant.nonInherited.enable",kn),Hn=On("ilotj.rule.variant.disable",kn)||On(Sn?"ilotj.rule.variant.inherited.disable":"ilotj.rule.variant.nonInherited.disable",kn),Pn=On("ilotj.rule.variant.delete",kn),Vn=On("ilotj.rule.selfApprove",kn),Wn=On("ilotj.rule.approve",kn),Mn=On("ilotj.scope.approve",kn),_n=On("ilotj.rule.pendingApproval.view",kn),zn=On("ilotj.rule.variant.pendingApproval.edit",kn),Rn=Vn||Wn||Mn||zn,Un=_n||Rn,Gn="pending_approval"===(null==G?void 0:G.approvalStatus),qn="rejected"===(null==G?void 0:G.approvalStatus),Zn=Rn&&Gn;s(function(){var e=function(e){bn.current&&!bn.current.contains(e.target)&&hn(!1)};return document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}},[]);var Kn=(null===(V=null==sn?void 0:sn.wta)||void 0===V?void 0:V.changeLog)||[],Qn=(null===(W=null==sn?void 0:sn.wnta)||void 0===W?void 0:W.changeLog)||[],Yn=Pe&&We&&Y?We.filter(function(e){return e!==Y}):[],$n=Yn.length>0&&Y?Yn.every(function(e){return e>Y})?"↓":"↑":"↓",Jn=function(){if(Me)for(var e=Array.from(Me),n=0;n<e.length;n++)if(e[n]!==G.variantId){var t=document.querySelector('[data-variant-id="'.concat(e[n],'"]'));if(t){t.scrollIntoView({behavior:"smooth",block:"center"});break}}},Xn=function(e,n){e.stopPropagation(),Ln({isOpen:!0,mode:n})},et=function(e){if(!e)return"";try{var n=e.endsWith("Z")||/[+-]\d{2}:\d{2}$/.test(e)?e:"".concat(e,"Z"),t=c(n);return d(t)?u(t,"MMM d, yyyy 'at' h:mm a"):e}catch(n){return e}},nt=function(e){return e?e.includes("@")?e.split("@")[0].split(".").map(function(e){return e.charAt(0).toUpperCase()+e.slice(1)}).join(" "):e:""};return i("div",e({className:E(C.variantCard,Pe&&C.variantHighlight,Ee),"data-variant-id":G.variantId},{children:[i("div",e({className:C.variantHeader,style:{alignItems:"flex-start",gap:"0.75rem"}},{children:[i("div",e({className:C.variantLabelSection,style:{display:"flex",flexWrap:"wrap"}},{children:[r("span",e({className:C.variantLabel},{children:"Default"===G.variantType&&"Default"!==$?"Default | ".concat($):$})),Pe&&Ve&&r("span",e({className:E(C.actionChip,"new"===Ve?C.actionChipNew:C.actionChipUpdated)},{children:"new"===Ve?"Created":"Updated"})),(null==G?void 0:G.isOverridden)&&r(w,e({content:"Inherited from the ".concat((null===(M=G.inheritance)||void 0===M?void 0:M[(null===(_=G.inheritance)||void 0===_?void 0:_.length)-2])||"parent"," scope and overridden in this scope."),placement:"top",withArrow:!0,contentClassName:j.customTooltip,sideOffset:5},{children:r("span",e({className:C.overriddenTag},{children:"Overridden"}))})),Un&&Gn&&r(D,{}),qn&&r("span",e({style:{backgroundColor:"#FEF2F2",color:"#EF4444",border:"1px solid #FECACA",padding:"2px 8px",borderRadius:"9999px",fontSize:"0.75rem",fontWeight:500,display:"inline-flex",alignItems:"center"}},{children:"Rejected"})),!Tn&&r("span",e({className:C.learningDisabledPill},{children:"Disabled"})),De&&1!==Z&&0!==q&&r("div",e({className:C.inheritanceSection},{children:r(N,{inheritance:G.inheritance||[]})}))]})),je&&i("div",e({className:C.variantActions},{children:[Zn&&i(o,{children:[r(O,{variant:"approve",text:"Approve",onClick:function(e){return Xn(e,"approve")}}),r(O,{variant:"reject",text:"Reject",onClick:function(e){return Xn(e,"reject")}})]}),J&&Fn&&r("button",e({className:C.editButton,onClick:function(){null==J||J(G,K,Y,"edit")}},{children:te})),X&&Pn&&"Default"!==G.variantType&&r("button",e({className:C.deleteButton,onClick:function(){null==Ue||Ue("variantDeletion"),null==X||X(G.variantId,K)}},{children:re})),i("div",e({className:C.menuWrapper,ref:bn},{children:[r("button",e({onClick:function(){return hn(!mn)},className:"".concat(C.menuTrigger," ").concat(mn?C.menuTriggerActive:"")},{children:r(p,{size:16})})),mn&&i("div",e({className:C.menuDropdown},{children:[(Tn&&Hn||!Tn&&En)&&i("button",e({onClick:function(){return n(void 0,void 0,void 0,function(){return t(this,function(e){return hn(!1),Cn(!0),[2]})})},disabled:gn,className:"".concat(C.menuItem," ").concat(gn?C.menuItemDisabled:"")},{children:[r(Tn?v:m,{size:14}),Tn?ye:fe]})),Y&&i("button",e({onClick:function(){var e="Tier 1"===Y?"Tier 2":"Tier 1",n="Add a new learning in ".concat(e," with the following details:\nLearning Title: ").concat(U,"\nLearning Description: ").concat(G.description,"\nWhen to apply: ").concat(G.whenToApply,"\nWhen not to apply: ").concat(G.whenNotToApply);null==qe||qe(n),hn(!1),null==Ge||Ge(G,K,U||"",Y,e)},className:C.menuItem},{children:[r(h,{size:14}),"Copy to ","Tier 1"===Y?"Tier 2":"Tier 1"]})),ee&&(null!==(R=null===(z=G.inheritance)||void 0===z?void 0:z.length)&&void 0!==R?R:0)>1&&i("button",e({onClick:function(){hn(!1),n(void 0,void 0,void 0,function(){var e;return t(this,function(n){switch(n.label){case 0:if(nn)return tn(!1),[2];if(tn(!0),!ee)return[2];an(!0),pn(null),n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,ee(K,G.variantId)];case 2:return e=n.sent(),cn(e),[3,5];case 3:return n.sent(),pn(Te),[3,5];case 4:return an(!1),[7];case 5:return[2]}})})},className:C.menuItem},{children:[r(f,{size:14}),nn?me:pe]}))]}))]}))]}))]})),_e,Ie&&G.description&&i("div",e({className:C.descriptionBox},{children:[r("p",e({className:C.descriptionText},{children:G.description})),nn&&(on?r(T,{}):un?r("p",e({className:C.errorText},{children:un})):(null==sn?void 0:sn.ruleDescription)?r(L,{changeLog:sn.ruleDescription.changeLog}):r("p",e({className:C.noHistoryText},{children:"No override history found"})))]})),xe&&i("div",e({className:C.conditionsContainer},{children:[r(A,{type:"apply",conditions:G.whenToApply||"",isOpen:Qe,onToggle:function(){return Ye(!Qe)},labelText:ae,noConditionsText:de,showOverrideHistory:nn,isLoadingHistory:on,historyError:un,overrideHistoryData:Kn}),r(A,{type:"notApply",conditions:G.whenNotToApply||"",isOpen:Je,onToggle:function(){return Xe(!Je)},labelText:se,noConditionsText:de,showOverrideHistory:nn,isLoadingHistory:on,historyError:un,overrideHistoryData:Qn})]})),Pe&&Yn.length>0&&i("div",e({className:C.crossTierBanner},{children:[r(g,{className:C.crossTierBannerIcon}),i("span",e({className:C.crossTierBannerText},{children:["Also created in ",Yn.join(", "),"."]})),i("span",e({className:C.crossTierBannerLink,onClick:Jn,role:"button",tabIndex:0,onKeyDown:function(e){return"Enter"===e.key&&Jn()}},{children:["Scroll to view ",$n]}))]})),ze,(G.createdBy||G.createdAt)&&i("div",e({className:C.variantFooter},{children:[!0===G.is_user_accepted_risk&&i("div",e({className:C.resolveGaps},{children:[r(y,{size:14,color:"#EF4444"}),r("span",e({className:C.resolveGapsText},{children:Ae})),Fn&&r("button",e({onClick:function(){null==J||J(G,K,Y,"resolve_gaps")},className:C.resolveButton},{children:"Resolve"}))]})),r("div",e({className:C.variantFooterContent},{children:G.updatedBy||G.updatedAt?i(o,{children:[G.updatedBy&&r(w,e({content:G.createdBy?"Created by ".concat(nt(G.createdBy)):"",contentClassName:j.customTooltip,sideOffset:5,placement:"top"},{children:i("span",e({className:C.variantFooterItem},{children:["Updated by ",nt(G.updatedBy)]}))})),G.updatedBy&&G.updatedAt&&r("span",e({className:C.variantFooterSeparator},{children:"•"})),G.updatedAt&&r(w,e({content:G.createdAt?"Created at ".concat(et(G.createdAt)):"",contentClassName:j.customTooltip,sideOffset:5,placement:"top"},{children:r("span",e({className:C.variantFooterItem},{children:et(G.updatedAt)}))}))]}):i(o,{children:[G.createdBy&&i("span",e({className:C.variantFooterItem},{children:["Created by ",nt(G.createdBy)]})),G.createdBy&&G.createdAt&&r("span",e({className:C.variantFooterSeparator},{children:"•"})),G.createdAt&&r("span",e({className:C.variantFooterItem},{children:et(G.createdAt)}))]})}))]})),r(I,{isOpen:An,title:Tn?"Disable Learning":"Enable Learning",description:"Are you sure you want to ".concat(Tn?"disable":"enable"," learning for this variant in ").concat(U,"?"),warning:Tn?"This variant will no longer influence upcoming schedules. You can enable it again anytime.":"This variant will start influencing upcoming schedules again.",confirmText:Tn?"Disable":"Enable",cancelText:"Cancel",confirmBgColor:Tn?"#DC2626":"#16A34A",onConfirm:function(){return n(void 0,void 0,void 0,function(){var e;return t(this,function(n){switch(n.label){case 0:yn(!0),n.label=1;case 1:return n.trys.push([1,3,4,5]),null==Ze?void 0:Ze.email,[4,b([G.variantId],!Tn)];case 2:return n.sent(),null==Re||Re(),[3,5];case 3:return e=n.sent(),console.error("Failed to toggle variant",e),[3,5];case 4:return yn(!1),hn(!1),Cn(!1),[7];case 5:return[2]}})})},onCancel:function(){return Cn(!1)},isLoading:gn,position:"fixed"}),r(k,{open:In.isOpen,mode:In.mode,onClose:function(){return Ln(function(n){return e(e({},n),{isOpen:!1})})},onSubmit:function(n){Q&&xn.mutate({variantIds:[G.variantId],status:"approve"===In.mode?"approved":"rejected",feedback:n.feedback,is_deleted:n.deleteLearning,scopeId:Q,appsecData:Dn},{onSuccess:function(){var n;Ln(function(n){return e(e({},n),{isOpen:!1})}),null==Re||Re(),null===(n=jn.current)||void 0===n||n.show({severity:"success",summary:"".concat("approve"===In.mode?"Approved":"Rejected"," Successfully"),detail:"Learning ".concat("approve"===In.mode?"approved":"rejected"," successfully.")})},onError:function(e){var n;console.error("An error occurred.",e),null===(n=jn.current)||void 0===n||n.show({severity:"error",summary:"Action Failed",detail:"There was an error processing the learning. Please try again."})}})},variantInformation:"".concat(U," — ").concat($),ruleTitle:U,pendingVariants:[G],isPending:xn.isPending})]}))};export{H as default};
|
|
1
|
+
import{__assign as e,__awaiter as n,__generator as t}from"tslib";import{jsxs as i,jsx as r,Fragment as o}from"react/jsx-runtime";import{useState as a,useRef as l,useEffect as s}from"react";import{parseISO as c,isValid as d,format as u}from"date-fns";import{MoreVertical as p,Pause as v,Play as m,Copy as h,Eye as f,Info as g,TriangleAlert as y}from"lucide-react";import{toggleVariant as b}from"../apis/scopeApis.js";import{HistorySkeleton as T}from"./HistorySkeleton.js";import N from"./InheritanceBreadcrumb.js";import A from"./RuleConditionBlock.js";import C from"../styles/VariantCard.module.css.js";import j from"../styles/CustomTooltip.module.css.js";import w from"../components/CustomTooltip.js";import I from"../components/ConfirmationModal.js";import L from"./OverrideTimeline.js";import x from"../store/useAuthStore.js";import{usePermissionsStore as B}from"../store/usePermissionsStore.js";import D from"./PendingApprovalChip.js";import O from"./ApprovalActionButton.js";import k from"./ApprovalLearningDialog.js";import{useApproveOrRejectVariantsMutation as S}from"../queries/useApprovalQueries.js";import F from"../store/useEnvStore.js";var E=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return e.filter(Boolean).join(" ")},H=function(H){var M,P,R,V,W,_,z,U,G,q=H.ruleTitle,Z=H.variant,K=H.variantIndex,Q=H.totalVariants,Y=H.ruleId;H.pendingApprovalCount;var $=H.ruleSetId,J=H.tierName,X=H.displayLabel,ee=H.onEdit,ne=H.onDelete,te=H.onFetchOverrideHistory,ie=H.editButtonLabel,re=void 0===ie?"Edit":ie,oe=H.deleteButtonLabel,ae=void 0===oe?"Delete":oe,le=H.whenToApplyLabel,se=void 0===le?"When to Apply":le,ce=H.whenNotToApplyLabel,de=void 0===ce?"When Not to Apply":ce,ue=H.noConditionsText,pe=void 0===ue?"No conditions":ue,ve=H.viewOverrideLabel,me=void 0===ve?"View Override History":ve,he=H.hideOverrideLabel,fe=void 0===he?"Hide Override History":he,ge=H.enableLearningVariantLabel,ye=void 0===ge?"Enable":ge,be=H.disableLearningVariantLabel,Te=void 0===be?"Disable":be,Ne=H.historyErrorMessage,Ae=void 0===Ne?"Failed to load override history.":Ne,Ce=H.resolveGapsLabel,je=void 0===Ce?"This learning has some gaps":Ce,we=H.showActionsBar,Ie=void 0===we||we,Le=H.showDescriptionBox,xe=void 0===Le||Le,Be=H.showConditions,De=void 0===Be||Be,Oe=H.showInheritance,ke=void 0===Oe||Oe,Se=H.defaultApplyOpen,Fe=void 0===Se||Se,Ee=H.defaultNotApplyOpen,He=void 0===Ee||Ee,Me=H.className,Pe=H.isHighlighted,Re=void 0!==Pe&&Pe,Ve=H.highlightAction,We=H.highlightedTierNames,_e=H.highlightedVariantIds,ze=H.headerContent,Ue=H.footerContent,Ge=H.onToggleSuccess,qe=H.setDeleteConfirmationUsedFor,Ze=H.onCopyToTier,Ke=H.onSetInitialDraftMessage,Qe=x.getState().user,Ye=a(Fe),$e=Ye[0],Je=Ye[1],Xe=a(He),en=Xe[0],nn=Xe[1],tn=a(!1),rn=tn[0],on=tn[1],an=a(!1),ln=an[0],sn=an[1],cn=a(null),dn=cn[0],un=cn[1],pn=a(null),vn=pn[0],mn=pn[1],hn=a(!1),fn=hn[0],gn=hn[1],yn=a(!1),bn=yn[0],Tn=yn[1],Nn=l(null),An=!1!==Z.is_enabled,Cn=a(!1),jn=Cn[0],wn=Cn[1],In=l(null),Ln=a({isOpen:!1,mode:"approve"}),xn=Ln[0],Bn=Ln[1],Dn=S(),On=F(function(e){return e.rbacConfig}),kn=On?{application:On.applicationId,scopeLevelModuleId:null!==(M=null==On?void 0:On.moduleId)&&void 0!==M?M:"",applicationLevelModuleId:null!==(P=null==On?void 0:On.applicationModuleId)&&void 0!==P?P:"",applicationLevelResourceId:null!==(R=null==On?void 0:On.applicationResourceId)&&void 0!==R?R:""}:void 0,Sn=B(function(e){return e.hasPermission}),Fn=$,En=Z.inheritance&&Z.inheritance.length>1,Hn=Sn("ilotj.rule.variant.edit",Fn)||Sn(En?"ilotj.rule.variant.inherited.edit":"ilotj.rule.variant.nonInherited.edit",Fn),Mn=Sn("ilotj.rule.variant.enable",Fn)||Sn(En?"ilotj.rule.variant.inherited.enable":"ilotj.rule.variant.nonInherited.enable",Fn),Pn=Sn("ilotj.rule.variant.disable",Fn)||Sn(En?"ilotj.rule.variant.inherited.disable":"ilotj.rule.variant.nonInherited.disable",Fn),Rn=Sn("ilotj.rule.variant.delete",Fn),Vn=Sn("ilotj.rule.selfApprove",Fn),Wn=Sn("ilotj.rule.approve",Fn),_n=Sn("ilotj.scope.approve",Fn),zn=Sn("ilotj.rule.pendingApproval.view",Fn),Un=Sn("ilotj.rule.variant.pendingApproval.edit",Fn),Gn=Vn||Wn||_n||Un,qn=zn||Gn,Zn="pending_approval"===(null==Z?void 0:Z.approvalStatus),Kn="rejected"===(null==Z?void 0:Z.approvalStatus),Qn=Gn&&Zn;s(function(){var e=function(e){Nn.current&&!Nn.current.contains(e.target)&&gn(!1)};return document.addEventListener("mousedown",e),function(){return document.removeEventListener("mousedown",e)}},[]);var Yn=(null===(V=null==dn?void 0:dn.wta)||void 0===V?void 0:V.changeLog)||[],$n=(null===(W=null==dn?void 0:dn.wnta)||void 0===W?void 0:W.changeLog)||[],Jn=Re&&We&&J?We.filter(function(e){return e!==J}):[],Xn=Jn.length>0&&J?Jn.every(function(e){return e>J})?"↓":"↑":"↓",et=function(){if(_e)for(var e=Array.from(_e),n=0;n<e.length;n++)if(e[n]!==Z.variantId){var t=document.querySelector('[data-variant-id="'.concat(e[n],'"]'));if(t){t.scrollIntoView({behavior:"smooth",block:"center"});break}}},nt=function(e,n){e.stopPropagation(),Bn({isOpen:!0,mode:n})},tt=function(e){if(!e)return"";try{var n=e.endsWith("Z")||/[+-]\d{2}:\d{2}$/.test(e)?e:"".concat(e,"Z"),t=c(n);return d(t)?u(t,"MMM d, yyyy 'at' h:mm a"):e}catch(n){return e}},it=function(e){return e?e.includes("@")?e.split("@")[0].split(".").map(function(e){return e.charAt(0).toUpperCase()+e.slice(1)}).join(" "):e:""};return i("div",e({className:E(C.variantCard,Re&&C.variantHighlight,Me),"data-variant-id":Z.variantId},{children:[i("div",e({className:C.variantHeader,style:{alignItems:"flex-start",gap:"0.75rem"}},{children:[i("div",e({className:C.variantLabelSection,style:{display:"flex",flexWrap:"wrap"}},{children:[r("span",e({className:C.variantLabel},{children:"Default"===Z.variantType&&"Default"!==X?"Default | ".concat(X):X})),Re&&Ve&&r("span",e({className:E(C.actionChip,"new"===Ve?C.actionChipNew:C.actionChipUpdated)},{children:"new"===Ve?"Created":"Updated"})),(null==Z?void 0:Z.isOverridden)&&r(w,e({content:"Inherited from the ".concat((null===(_=Z.inheritance)||void 0===_?void 0:_[(null===(z=Z.inheritance)||void 0===z?void 0:z.length)-2])||"parent"," scope and overridden in this scope."),placement:"top",withArrow:!0,contentClassName:j.customTooltip,sideOffset:5},{children:r("span",e({className:C.overriddenTag},{children:"Overridden"}))})),qn&&Zn&&r(D,{}),Kn&&r("span",e({style:{backgroundColor:"#FEF2F2",color:"#EF4444",border:"1px solid #FECACA",padding:"2px 8px",borderRadius:"9999px",fontSize:"0.75rem",fontWeight:500,display:"inline-flex",alignItems:"center"}},{children:"Rejected"})),!An&&r("span",e({className:C.learningDisabledPill},{children:"Disabled"})),ke&&1!==Q&&0!==K&&r("div",e({className:C.inheritanceSection},{children:r(N,{inheritance:Z.inheritance||[]})}))]})),Ie&&i("div",e({className:C.variantActions},{children:[Qn&&i(o,{children:[r(O,{variant:"approve",text:"Approve",onClick:function(e){return nt(e,"approve")}}),r(O,{variant:"reject",text:"Reject",onClick:function(e){return nt(e,"reject")}})]}),ee&&Hn&&r("button",e({className:C.editButton,onClick:function(){null==ee||ee(Z,Y,J,"edit")}},{children:re})),ne&&Rn&&"Default"!==Z.variantType&&r("button",e({className:C.deleteButton,onClick:function(){null==qe||qe("variantDeletion"),null==ne||ne(Z.variantId,Y)}},{children:ae})),i("div",e({className:C.menuWrapper,ref:Nn},{children:[r("button",e({onClick:function(){return gn(!fn)},className:"".concat(C.menuTrigger," ").concat(fn?C.menuTriggerActive:"")},{children:r(p,{size:16})})),fn&&i("div",e({className:C.menuDropdown},{children:[(An&&Pn||!An&&Mn)&&i("button",e({onClick:function(){return n(void 0,void 0,void 0,function(){return t(this,function(e){return gn(!1),wn(!0),[2]})})},disabled:bn,className:"".concat(C.menuItem," ").concat(bn?C.menuItemDisabled:"")},{children:[r(An?v:m,{size:14}),An?Te:ye]})),J&&i("button",e({onClick:function(){var e="Tier 1"===J?"Tier 2":"Tier 1",n="Add a new learning in ".concat(e," with the following details:\nLearning Title: ").concat(q,"\nLearning Description: ").concat(Z.description,"\nWhen to apply: ").concat(Z.whenToApply,"\nWhen not to apply: ").concat(Z.whenNotToApply);null==Ke||Ke(n),gn(!1),null==Ze||Ze(Z,Y,q||"",J,e)},className:C.menuItem},{children:[r(h,{size:14}),"Copy to ","Tier 1"===J?"Tier 2":"Tier 1"]})),te&&(null!==(G=null===(U=Z.inheritance)||void 0===U?void 0:U.length)&&void 0!==G?G:0)>1&&i("button",e({onClick:function(){gn(!1),n(void 0,void 0,void 0,function(){var e;return t(this,function(n){switch(n.label){case 0:if(rn)return on(!1),[2];if(on(!0),!te)return[2];sn(!0),mn(null),n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,te(Y,Z.variantId)];case 2:return e=n.sent(),un(e),[3,5];case 3:return n.sent(),mn(Ae),[3,5];case 4:return sn(!1),[7];case 5:return[2]}})})},className:C.menuItem},{children:[r(f,{size:14}),rn?fe:me]}))]}))]}))]}))]})),ze,xe&&Z.description&&i("div",e({className:C.descriptionBox},{children:[r("p",e({className:C.descriptionText},{children:Z.description})),rn&&(ln?r(T,{}):vn?r("p",e({className:C.errorText},{children:vn})):(null==dn?void 0:dn.ruleDescription)?r(L,{changeLog:dn.ruleDescription.changeLog}):r("p",e({className:C.noHistoryText},{children:"No override history found"})))]})),De&&i("div",e({className:C.conditionsContainer},{children:[r(A,{type:"apply",conditions:Z.whenToApply||"",isOpen:$e,onToggle:function(){return Je(!$e)},labelText:se,noConditionsText:pe,showOverrideHistory:rn,isLoadingHistory:ln,historyError:vn,overrideHistoryData:Yn}),r(A,{type:"notApply",conditions:Z.whenNotToApply||"",isOpen:en,onToggle:function(){return nn(!en)},labelText:de,noConditionsText:pe,showOverrideHistory:rn,isLoadingHistory:ln,historyError:vn,overrideHistoryData:$n})]})),Re&&Jn.length>0&&i("div",e({className:C.crossTierBanner},{children:[r(g,{className:C.crossTierBannerIcon}),i("span",e({className:C.crossTierBannerText},{children:["Also created in ",Jn.join(", "),"."]})),i("span",e({className:C.crossTierBannerLink,onClick:et,role:"button",tabIndex:0,onKeyDown:function(e){return"Enter"===e.key&&et()}},{children:["Scroll to view ",Xn]}))]})),Ue,(Z.createdBy||Z.createdAt)&&i("div",e({className:C.variantFooter},{children:[!0===Z.is_user_accepted_risk&&i("div",e({className:C.resolveGaps},{children:[r(y,{size:14,color:"#EF4444"}),r("span",e({className:C.resolveGapsText},{children:je})),Hn&&r("button",e({onClick:function(){null==ee||ee(Z,Y,J,"resolve_gaps")},className:C.resolveButton},{children:"Resolve"}))]})),r("div",e({className:C.variantFooterContent},{children:Z.updatedBy||Z.updatedAt?i(o,{children:[Z.updatedBy&&r(w,e({content:Z.createdBy?"Created by ".concat(it(Z.createdBy)):"",contentClassName:j.customTooltip,sideOffset:5,placement:"top"},{children:i("span",e({className:C.variantFooterItem},{children:["Updated by ",it(Z.updatedBy)]}))})),Z.updatedBy&&Z.updatedAt&&r("span",e({className:C.variantFooterSeparator},{children:"•"})),Z.updatedAt&&r(w,e({content:Z.createdAt?"Created at ".concat(tt(Z.createdAt)):"",contentClassName:j.customTooltip,sideOffset:5,placement:"top"},{children:r("span",e({className:C.variantFooterItem},{children:tt(Z.updatedAt)}))}))]}):i(o,{children:[Z.createdBy&&i("span",e({className:C.variantFooterItem},{children:["Created by ",it(Z.createdBy)]})),Z.createdBy&&Z.createdAt&&r("span",e({className:C.variantFooterSeparator},{children:"•"})),Z.createdAt&&r("span",e({className:C.variantFooterItem},{children:tt(Z.createdAt)}))]})}))]})),r(I,{isOpen:jn,title:An?"Disable Learning":"Enable Learning",description:"Are you sure you want to ".concat(An?"disable":"enable"," learning for this variant in ").concat(q,"?"),warning:An?"This variant will no longer influence upcoming schedules. You can enable it again anytime.":"This variant will start influencing upcoming schedules again.",confirmText:An?"Disable":"Enable",cancelText:"Cancel",confirmBgColor:An?"#DC2626":"#16A34A",onConfirm:function(){return n(void 0,void 0,void 0,function(){var e;return t(this,function(n){switch(n.label){case 0:Tn(!0),n.label=1;case 1:return n.trys.push([1,3,4,5]),null==Qe?void 0:Qe.email,[4,b([Z.variantId],!An)];case 2:return n.sent(),null==Ge||Ge(),[3,5];case 3:return e=n.sent(),console.error("Failed to toggle variant",e),[3,5];case 4:return Tn(!1),gn(!1),wn(!1),[7];case 5:return[2]}})})},onCancel:function(){return wn(!1)},isLoading:bn,position:"fixed"}),r(k,{open:xn.isOpen,mode:xn.mode,onClose:function(){return Bn(function(n){return e(e({},n),{isOpen:!1})})},onSubmit:function(n){$&&Dn.mutate({variantIds:[Z.variantId],status:"approve"===xn.mode?"approved":"rejected",feedback:n.feedback,is_deleted:n.deleteLearning,scopeId:$,appsecData:kn},{onSuccess:function(){var n;Bn(function(n){return e(e({},n),{isOpen:!1})}),null==Ge||Ge(),null===(n=In.current)||void 0===n||n.show({severity:"success",summary:"".concat("approve"===xn.mode?"Approved":"Rejected"," Successfully"),detail:"Learning ".concat("approve"===xn.mode?"approved":"rejected"," successfully.")})},onError:function(e){var n;console.error("An error occurred.",e),null===(n=In.current)||void 0===n||n.show({severity:"error",summary:"Action Failed",detail:"There was an error processing the learning. Please try again."})}})},variantInformation:"".concat(q," — ").concat(X),ruleTitle:q,pendingVariants:[Z],isPending:Dn.isPending})]}))};export{H as default};
|
|
2
2
|
//# sourceMappingURL=VariantCard.js.map
|