@e-llm-studio/instant-learning 1.3.0-alpha.44 → 1.3.0-alpha.45
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/IL-OTJ/ValueTypeWrappers/TeachMePlugin.js +1 -1
- package/dist/cjs/features/IL-OTJ/ValueTypeWrappers/TeachMeWrapper.js +1 -1
- package/dist/cjs/features/LearningManagement/AuditLog/AuditLog.js +1 -1
- package/dist/cjs/features/LearningManagement/LearningManagement.js +1 -1
- package/dist/cjs/features/LearningManagement/RuleContent/RuleContent.js +1 -1
- package/dist/cjs/features/LearningManagement/apis/apiConfig.js +1 -1
- package/dist/cjs/features/LearningManagement/apis/scopeApis.js +1 -1
- package/dist/cjs/features/LearningManagement/components/EmptyLearningState.js +1 -1
- package/dist/cjs/features/LearningManagement/components/InstantLearningModal.js +1 -1
- package/dist/cjs/features/LearningManagement/components/ScopeTree/TreeNode.js +1 -1
- package/dist/cjs/features/LearningManagement/store/useLMSConfigStore.js +1 -1
- package/dist/cjs/plugins/ValueTypes/Guidelines/GuidelinesTeachMeRenderer.js +1 -1
- package/dist/features/IL-OTJ/ValueTypeWrappers/TeachMePlugin.js +1 -1
- package/dist/features/IL-OTJ/ValueTypeWrappers/TeachMeWrapper.js +1 -1
- package/dist/features/LearningManagement/AuditLog/AuditLog.js +1 -1
- package/dist/features/LearningManagement/LearningManagement.js +1 -1
- package/dist/features/LearningManagement/RuleContent/RuleContent.js +1 -1
- package/dist/features/LearningManagement/apis/apiConfig.js +1 -1
- package/dist/features/LearningManagement/apis/scopeApis.js +1 -1
- package/dist/features/LearningManagement/components/EmptyLearningState.js +1 -1
- package/dist/features/LearningManagement/components/InstantLearningModal.js +1 -1
- package/dist/features/LearningManagement/components/ScopeTree/TreeNode.js +1 -1
- package/dist/features/LearningManagement/store/useLMSConfigStore.js +1 -1
- package/dist/plugins/ValueTypes/Guidelines/GuidelinesTeachMeRenderer.js +1 -1
- package/dist/types/src/features/IL-OTJ/ValueTypeWrappers/TeachMePlugin.d.ts +1 -0
- package/dist/types/src/features/IL-OTJ/ValueTypeWrappers/TeachMePlugin.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/ValueTypeWrappers/TeachMeWrapper.d.ts +1 -0
- package/dist/types/src/features/IL-OTJ/ValueTypeWrappers/TeachMeWrapper.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/AuditLog/AuditLog.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/LearningManagement.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/apiConfig.d.ts +2 -0
- package/dist/types/src/features/LearningManagement/apis/apiConfig.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/apis/scopeApis.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/components/EmptyLearningState.d.ts +6 -0
- package/dist/types/src/features/LearningManagement/components/EmptyLearningState.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/components/ScopeTree/TreeNode.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/store/useLMSConfigStore.d.ts +1 -0
- package/dist/types/src/features/LearningManagement/store/useLMSConfigStore.d.ts.map +1 -1
- package/dist/types/src/plugins/ValueTypes/Category/CategoryTeachMeRenderer.d.ts +1 -0
- package/dist/types/src/plugins/ValueTypes/Category/CategoryTeachMeRenderer.d.ts.map +1 -1
- package/dist/types/src/plugins/ValueTypes/Guidelines/GuidelinesTeachMeRenderer.d.ts +1 -0
- package/dist/types/src/plugins/ValueTypes/Guidelines/GuidelinesTeachMeRenderer.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/cjs/features/LearningManagement/assets/Search-result(add new).svg.js +0 -2
- package/dist/cjs/features/LearningManagement/assets/Search-result(add new).svg.js.map +0 -1
- package/dist/cjs/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.js +0 -2
- package/dist/cjs/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.js.map +0 -1
- package/dist/features/LearningManagement/assets/Search-result(add new).svg.js +0 -2
- package/dist/features/LearningManagement/assets/Search-result(add new).svg.js.map +0 -1
- package/dist/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.js +0 -2
- package/dist/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.js.map +0 -1
- package/dist/types/src/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.d.ts +0 -12
- package/dist/types/src/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.d.ts.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),o=require("react/jsx-runtime"),n=require("lucide-react"),i=require("../../styles/ScopeTree.module.css.js"),d=require("./TreeNodeHeader.js"),t=require("./TreeSectionItem.js"),r=require("./TreeAddAction.js"),l=require("../../store/useLMSConfigStore.js"),a=require("../../constants.js"),c=function(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),o=require("react/jsx-runtime"),n=require("lucide-react"),i=require("../../styles/ScopeTree.module.css.js"),d=require("./TreeNodeHeader.js"),t=require("./TreeSectionItem.js"),r=require("./TreeAddAction.js"),l=require("../../store/useLMSConfigStore.js"),a=require("../../constants.js"),s=require("../../store/useLearningTemplateStore.js"),c=function(u){var p,h,v,C,m=u.node,T=u.depth,g=void 0===T?0:T,b=u.nodePath,f=void 0===b?[]:b,_=u.expandedNodeIds,S=u.activeSelection,y=u.onToggleExpand,A=u.onSectionSelect,D=u.onNodeOptionsClick,x=u.onAddChild,E=u.onRenameChild,j=u.onDeleteChild,L=u.canDeleteScope,N=u.canEditScope,P=u.canCreateScope,q=u.searchQuery,R=u.sectionsConfig,k=void 0===R?[]:R,I=u.nodeTypesConfig,w=void 0===I?[]:I,M=u.forceVisible,O=void 0!==M&&M,H=e.__spreadArray(e.__spreadArray([],f,!0),[m.id],!1),W=_.has(m.id),V=s.useLearningTemplateStore.getState().backwardCompatibility,Q=l.dt("".concat(a.MIDDLE_DRAWER_DT_PATH,".scope")),Y=!!S&&S.nodePath[S.nodePath.length-1]===m.id,K=!!S&&(S.nodePath.includes(m.id)&&!Y),U=function(e,o){if(!o)return!0;var n=o.toLowerCase();return!!e.name.toLowerCase().includes(n)||!!e.children&&e.children.some(function(e){return U(e,o)})};if(!O&&!U(m,q||""))return null;var X=g>=w.length-1?w[w.length-1]:w[g],z=!!(null==X?void 0:X.addChildType),B=!L||L(m.id),F=!N||N(m.id),G=!P||P(m.id),J=m.children&&m.children.length>0,Z=!B||J,$=B?J?"This scope cannot be deleted because other scopes inherit learnings from it.":void 0:"You do not have permission to delete this scope.",ee=G?void 0:"You do not have permission to add a scope here.",oe=!q||m.name.toLowerCase().includes(q.toLowerCase());return o.jsxs("div",e.__assign({className:i.default.nodeWrapper,style:{"--tree-depth":g}},{children:[o.jsx(d.TreeNodeHeader,{nodeType:m.type,name:m.name,isExpanded:W,isSelected:Y,isAncestor:K,childrenCount:null===(p=m.children)||void 0===p?void 0:p.length,onToggleExpand:function(e){e.stopPropagation(),y(m.id)},onClick:function(){A(H,"learnings")},searchQuery:q,menuOptions:e.__spreadArray(e.__spreadArray([],z?[{label:X.addChildLabel||"Add Child",icon:n.Plus,onClick:function(){return null==x?void 0:x(m.id,X.addChildType,m.name)},disabled:!G,tooltip:ee}]:[],!0),[{label:"".concat(l.dt("".concat(a.MIDDLE_DRAWER_CONTEXT_MENU_DT_PATH,".rename"),"Rename")),icon:n.Pencil,onClick:function(){return null==E?void 0:E(m.id,m.name)},disabled:!F||"station"===(null===(h=null==m?void 0:m.type)||void 0===h?void 0:h.toLocaleLowerCase()),tooltip:F?void 0:"You do not have permission to rename this scope."},{label:"station"===(null===(v=null==m?void 0:m.type)||void 0===v?void 0:v.toLowerCase())?"Delete Station":V?"Delete Scope":"".concat(l.dt("".concat(a.MIDDLE_DRAWER_CONTEXT_MENU_DT_PATH,".delete"),"Delete ".concat((null==X?void 0:X.label)||"Node"),{scope:Q})),icon:n.Trash2,onClick:function(){var e;return null==j?void 0:j(m.id,m.name,(null===(e=m.metrics)||void 0===e?void 0:e.learningsCount)||0)},disabled:Z,tooltip:$,className:"text-red-500 hover:text-red-600 hover:bg-red-50"}],!1)}),W&&o.jsxs("div",e.__assign({className:i.default.childrenWrapper},{children:[k.filter(function(e){return!e.isVisible||e.isVisible(m,g)}).map(function(e){var n;return o.jsx(t.TreeSectionItem,{icon:e.icon,label:e.label,badgeCount:e.badgeKey?null===(n=m.metrics)||void 0===n?void 0:n[e.badgeKey]:void 0,isActive:Y&&(null==S?void 0:S.sectionId)===e.id,onClick:function(){return A(H,e.id)}},"".concat(m.id,"-").concat(e.id))}),null===(C=m.children)||void 0===C?void 0:C.map(function(e){return o.jsx(c,{node:e,depth:g+1,nodePath:H,expandedNodeIds:_,activeSelection:S,onToggleExpand:y,onSectionSelect:A,onNodeOptionsClick:D,onAddChild:x,onRenameChild:E,onDeleteChild:j,canDeleteScope:L,canEditScope:N,canCreateScope:P,searchQuery:q,forceVisible:oe,sectionsConfig:k,nodeTypesConfig:w},e.id)}),z&&o.jsx(r.TreeAddAction,{label:X.addChildLabel||"Add Child",onAdd:function(){return null==x?void 0:x(m.id,X.addChildType,m.name)},disabled:!G,tooltip:ee})]}))]}))};exports.TreeNode=c;
|
|
2
2
|
//# sourceMappingURL=TreeNode.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("zustand"),t=require("./useLearningTemplateStore.js"),n={pageTitle:"",middleDrawer:{scope:"",addScope:"",addSubScope:"",addScopeDialog:{title:"",globalTitle:"",subtitle:"",globalSubtitle:"",scopeName:"",learningApprovalSettings:{title:"",approvalRequired:{title:"",subtitle:""},publishWithoutApproval:{title:"",subtitle:""}},submitButton:"",cancel:""},treeMenu:{search:"",submenu:{learnings:"",access:"",changeHistory:""},contextMenu:{addScope:"",rename:"",delete:"",addSubScope:""}}},learnings:{header:{title:"",exportButton:"",addNewLearningButton:""},tier:{showTierHeader:!0,tierHeader:"",subtitle:"",tierHeaderNoOfLearnings:"",deleteDialog:{title:"",description:"",cancel:"",submit:""},learning:{inheritance:"",actions:{disable:"",enable:"",approve:"",reject:"",delete:""},approveDialog:{title:"",desc:"",footer:"",cancel:"",approveLearning:""},rejectDialog:{title:"",desc:"",feedbackTitle:"",feedbackPlaceholder:"",deleteCheckboxLabel:"",cancel:"",rejectLearning:""},deleteDialog:{title:"",desc:"",warningText:"",cancelText:"",deleteText:""}}}},emptyStateLearning:{title:"",desc:"",createNewLearning:"",createGlobalScope:"",noAccessTitle:"",noAccessDesc:"",requestAccessButton:""},agents:{LearningTerm:""}},a={showScope:!1,showConfiguration:!1,welcomeMessage:"Hi! 👋 I'm your Instant Learning Concierge.",welcomeMessageSubtitle:"How would you like to get started? You can select an option below or describe the rule you'd like to create.",actions:[{label:"Separation rule",value:"I would want to add a separation rule"},{label:"Max priority rule",value:"I would want to set a max priority rule"},{label:"Break code matching",value:"I would want to add a break code matching rule"},{label:"Inventory code matching",value:"I would want to add a inventory window matching rule"},{label:"Enter a rule description",value:"I want to add a rule description"},{label:"Tester Genie",value:"Loading prompt..."}],chatTitle:"Teach Me OTJ - {scope} - Add Learning",chatTitleEdit:"Teach Me OTJ - {scope} - Edit Learning",formTitle:"Rule setup",setupLabel:"Configure your IL",ruleTitle:"Main Rule Name",scopeLabel:"Define Scope",tierLabel:"Select Tiers",ruleDescriptionTitle:"Learning Explanation",whenToApplyTitle:"Trigger Events (When to Apply)",addWhenToApplyBtnLabel:"Add WTA",whenNotToApplyTitle:"Exclusion Events (When NOT to Apply)",addWhenNotToApplyBtnLabel:"Add WNTA",configTitle:"Advanced Settings",saveBtnLabel:"Save Rule",saveBtnLoadingLabel:"Saving Rule...",chatTextareaPlaceholder:"Tell me more about this learning.."},l=e.create(function(e){return{lmsConfig:n,setLMSConfig:function(t){return e({lmsConfig:t})},clearLMSConfig:function(){return e({lmsConfig:n})}}});var i=e.create(function(e){return{teachMeConfig:null,setTeachMeConfig:function(t){return e({teachMeConfig:t})},clearTeachMeConfig:function(){return e({teachMeConfig:null})}}});exports.defaultLMSConfig=n,exports.defaultTeachMeConfig=a,exports.dt=function(e,n,a){if(t.useLearningTemplateStore.getState().backwardCompatibility)return null!=n?n:"";var i=l.getState().lmsConfig,o=e.split(".").reduce(function(e,t){return null==e?void 0:e[t]},i);return"string"!=typeof o||""===o?null!=n?n:e:o.replace(/\{(\w+)\}/g,function(e,t){var n;return String(null!==(n=null==a?void 0:a[t])&&void 0!==n?n:"{".concat(t,"}"))})},exports.dtt=function(e,t,n){var a=i.getState().teachMeConfig,l=e.split(".").reduce(function(e,t){return null==e?void 0:e[t]},a);return"string"!=typeof l?null!=t?t:e:l.replace(/\{(\w+)\}/g,function(e,t){var a;return String(null!==(a=null==n?void 0:n[t])&&void 0!==a?a:"{".concat(t,"}"))})},exports.dttWelcomeMessageParts=function(){var e,t,n=null!==(e=i.getState().teachMeConfig)&&void 0!==e?e:a;return{greeting:n.welcomeMessage||a.welcomeMessage,subtitle:n.welcomeMessageSubtitle||a.welcomeMessageSubtitle,actions:(null===(t=n.actions)||void 0===t?void 0:t.length)?n.actions:a.actions}},exports.useLMSConfigStore=l,exports.useTeachMeConfigStore=i;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("zustand"),t=require("./useLearningTemplateStore.js"),n={pageTitle:"",middleDrawer:{scope:"",addScope:"",addSubScope:"",addScopeDialog:{title:"",globalTitle:"",subtitle:"",globalSubtitle:"",scopeName:"",learningApprovalSettings:{title:"",approvalRequired:{title:"",subtitle:""},publishWithoutApproval:{title:"",subtitle:""}},submitButton:"",cancel:""},treeMenu:{search:"",submenu:{learnings:"",access:"",changeHistory:""},contextMenu:{addScope:"",rename:"",delete:"",addSubScope:""}}},learnings:{header:{title:"",exportButton:"",addNewLearningButton:""},tier:{showTierHeader:!0,tierHeader:"",subtitle:"",tierHeaderNoOfLearnings:"",deleteDialog:{title:"",description:"",cancel:"",submit:""},learning:{inheritance:"",actions:{disable:"",enable:"",approve:"",reject:"",delete:""},approveDialog:{title:"",desc:"",footer:"",cancel:"",approveLearning:""},rejectDialog:{title:"",desc:"",feedbackTitle:"",feedbackPlaceholder:"",deleteCheckboxLabel:"",cancel:"",rejectLearning:""},deleteDialog:{title:"",desc:"",warningText:"",cancelText:"",deleteText:""}}}},emptyStateLearning:{title:"",desc:"",createNewLearning:"",createGlobalScope:"",noAccessTitle:"",noAccessDesc:"",requestAccessButton:"",requestSentButton:""},agents:{LearningTerm:""}},a={showScope:!1,showConfiguration:!1,welcomeMessage:"Hi! 👋 I'm your Instant Learning Concierge.",welcomeMessageSubtitle:"How would you like to get started? You can select an option below or describe the rule you'd like to create.",actions:[{label:"Separation rule",value:"I would want to add a separation rule"},{label:"Max priority rule",value:"I would want to set a max priority rule"},{label:"Break code matching",value:"I would want to add a break code matching rule"},{label:"Inventory code matching",value:"I would want to add a inventory window matching rule"},{label:"Enter a rule description",value:"I want to add a rule description"},{label:"Tester Genie",value:"Loading prompt..."}],chatTitle:"Teach Me OTJ - {scope} - Add Learning",chatTitleEdit:"Teach Me OTJ - {scope} - Edit Learning",formTitle:"Rule setup",setupLabel:"Configure your IL",ruleTitle:"Main Rule Name",scopeLabel:"Define Scope",tierLabel:"Select Tiers",ruleDescriptionTitle:"Learning Explanation",whenToApplyTitle:"Trigger Events (When to Apply)",addWhenToApplyBtnLabel:"Add WTA",whenNotToApplyTitle:"Exclusion Events (When NOT to Apply)",addWhenNotToApplyBtnLabel:"Add WNTA",configTitle:"Advanced Settings",saveBtnLabel:"Save Rule",saveBtnLoadingLabel:"Saving Rule...",chatTextareaPlaceholder:"Tell me more about this learning.."},l=e.create(function(e){return{lmsConfig:n,setLMSConfig:function(t){return e({lmsConfig:t})},clearLMSConfig:function(){return e({lmsConfig:n})}}});var i=e.create(function(e){return{teachMeConfig:null,setTeachMeConfig:function(t){return e({teachMeConfig:t})},clearTeachMeConfig:function(){return e({teachMeConfig:null})}}});exports.defaultLMSConfig=n,exports.defaultTeachMeConfig=a,exports.dt=function(e,n,a){if(t.useLearningTemplateStore.getState().backwardCompatibility)return null!=n?n:"";var i=l.getState().lmsConfig,o=e.split(".").reduce(function(e,t){return null==e?void 0:e[t]},i);return"string"!=typeof o||""===o?null!=n?n:e:o.replace(/\{(\w+)\}/g,function(e,t){var n;return String(null!==(n=null==a?void 0:a[t])&&void 0!==n?n:"{".concat(t,"}"))})},exports.dtt=function(e,t,n){var a=i.getState().teachMeConfig,l=e.split(".").reduce(function(e,t){return null==e?void 0:e[t]},a);return"string"!=typeof l?null!=t?t:e:l.replace(/\{(\w+)\}/g,function(e,t){var a;return String(null!==(a=null==n?void 0:n[t])&&void 0!==a?a:"{".concat(t,"}"))})},exports.dttWelcomeMessageParts=function(){var e,t,n=null!==(e=i.getState().teachMeConfig)&&void 0!==e?e:a;return{greeting:n.welcomeMessage||a.welcomeMessage,subtitle:n.welcomeMessageSubtitle||a.welcomeMessageSubtitle,actions:(null===(t=n.actions)||void 0===t?void 0:t.length)?n.actions:a.actions}},exports.useLMSConfigStore=l,exports.useTeachMeConfigStore=i;
|
|
2
2
|
//# sourceMappingURL=useLMSConfigStore.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("react/jsx-runtime"),t=require("react"),n=require("lucide-react");require("../../../features/IL-OTJ/_components/atoms/Textarea/Textarea.js"),require("../../../features/IL-OTJ/_components/InputDataReasoningCard.js"),require("../../../features/IL-OTJ/_components/TooltipComponent.js");var a=require("../../../features/IL-OTJ/_components/templates/TemplatesMap/templatesMap.js");require("../../../features/IL-OTJ/store/CitationsContext.js"),require("@mui/material"),require("uuid"),require("@mui/material/Tooltip"),require("react-markdown"),require("rehype-raw"),require("axios"),require("@e-llm-studio/streaming-response"),require("@e-llm-studio/watch-me-work"),require("../../../features/IL-OTJ/_components/ChatComponents/ChatHeader.js"),require("remark-gfm"),require("../../../features/IL-OTJ/_components/MarkdownComponents/MarkdownElements.js"),require("../../../features/IL-OTJ/_components/CitationLink.js"),require("@e-llm-studio/citation"),require("@viswa-test/test-citation"),require("../../../features/LearningManagement/store/useLearningTemplateStore.js"),require("primereact/toast"),require("../../../features/LearningManagement/apis/scopeApis.js"),require("../../../features/LearningManagement/store/usePermissionsStore.js"),require("../../../features/LearningManagement/store/useLMSConfigStore.js"),require("../../../features/LearningManagement/components/ToolTip.js"),require("../../../features/LearningManagement/store/useAuthStore.js"),require("@mui/icons-material/Check"),require("@mui/icons-material/CloseRounded"),require("@tanstack/react-query"),require("../../../features/LearningManagement/store/useEnvStore.js"),require("date-fns"),require("framer-motion"),require("@mui/icons-material/Close");var i=require("../../../features/IL-OTJ/ILOTJ.js");require("../../../features/LearningManagement/store/useConfigStore.js"),require("../../../features/LearningManagement/config.js"),require("react-dom/server");var o=require("../../../features/IL-OTJ/_components/AccordianSection.js");require("appsec-ui"),require("@radix-ui/react-tooltip"),require("../../../features/LearningManagement/components/StationOnboarding/InputField.js"),require("../../../features/LearningManagement/store/useAppSecRolesStore.js"),require("@e-llm-studio/audit-log"),require("@e-llm-studio/audit-log/dist/styles.css"),require("../../../features/LearningManagement/AuditLog/ChangeLogDiff.js"),require("react-router-dom");var s={order_rules:{enabled:!1,global_min_separation_seconds:0},advertiser_rules:{enabled:!1,global_min_separation_seconds:0},inventory_rules:{respect_inventory_code:!1},break_code_rules:{respect_break_code:!1},is_default_enabled:!1},u=[{label:"Global Scope",value:"global"},{label:"Genre Scope",value:"genre"},{label:"Custom Scope",value:"custom"}],l=["Tier 1"];exports.default=function(){var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("react/jsx-runtime"),t=require("react"),n=require("lucide-react");require("../../../features/IL-OTJ/_components/atoms/Textarea/Textarea.js"),require("../../../features/IL-OTJ/_components/InputDataReasoningCard.js"),require("../../../features/IL-OTJ/_components/TooltipComponent.js");var a=require("../../../features/IL-OTJ/_components/templates/TemplatesMap/templatesMap.js");require("../../../features/IL-OTJ/store/CitationsContext.js"),require("@mui/material"),require("uuid"),require("@mui/material/Tooltip"),require("react-markdown"),require("rehype-raw"),require("axios"),require("@e-llm-studio/streaming-response"),require("@e-llm-studio/watch-me-work"),require("../../../features/IL-OTJ/_components/ChatComponents/ChatHeader.js"),require("remark-gfm"),require("../../../features/IL-OTJ/_components/MarkdownComponents/MarkdownElements.js"),require("../../../features/IL-OTJ/_components/CitationLink.js"),require("@e-llm-studio/citation"),require("@viswa-test/test-citation"),require("../../../features/LearningManagement/store/useLearningTemplateStore.js"),require("primereact/toast"),require("../../../features/LearningManagement/apis/scopeApis.js"),require("../../../features/LearningManagement/store/usePermissionsStore.js"),require("../../../features/LearningManagement/store/useLMSConfigStore.js"),require("../../../features/LearningManagement/components/ToolTip.js"),require("../../../features/LearningManagement/store/useAuthStore.js"),require("@mui/icons-material/Check"),require("@mui/icons-material/CloseRounded"),require("@tanstack/react-query"),require("../../../features/LearningManagement/store/useEnvStore.js"),require("date-fns"),require("framer-motion"),require("@mui/icons-material/Close");var i=require("../../../features/IL-OTJ/ILOTJ.js");require("../../../features/LearningManagement/store/useConfigStore.js"),require("../../../features/LearningManagement/config.js"),require("react-dom/server");var o=require("../../../features/IL-OTJ/_components/AccordianSection.js");require("appsec-ui"),require("@radix-ui/react-tooltip"),require("../../../features/LearningManagement/components/StationOnboarding/InputField.js"),require("../../../features/LearningManagement/store/useAppSecRolesStore.js"),require("@e-llm-studio/audit-log"),require("@e-llm-studio/audit-log/dist/styles.css"),require("../../../features/LearningManagement/AuditLog/ChangeLogDiff.js"),require("react-router-dom");var s={order_rules:{enabled:!1,global_min_separation_seconds:0},advertiser_rules:{enabled:!1,global_min_separation_seconds:0},inventory_rules:{respect_inventory_code:!1},break_code_rules:{respect_break_code:!1},is_default_enabled:!1},u=[{label:"Global Scope",value:"global"},{label:"Genre Scope",value:"genre"},{label:"Custom Scope",value:"custom"}],l=["Tier 1"];exports.default=function(c){c.baseURL;var d=t.useState(!0),p=d[0],_=d[1],m=t.useState(""),g=m[0],f=m[1],b=t.useState(""),q=b[0],y=b[1],h=t.useState({station:"",tiers:["Tier 1"]}),v=h[0],T=h[1],L=t.useState([]),k=L[0],C=L[1],S=t.useState([]),j=S[0],w=S[1],A=t.useState(s),x=A[0],I=A[1],M=t.useCallback(function(r,t){T(function(n){var a;return e.__assign(e.__assign({},n),((a={})[r]=t,a))})},[]),O=t.useCallback(function(r,t){I(function(n){var a=e.__assign({},n);switch(r){case"order_rules":case"advertiser_rules":a[r]="boolean"==typeof t?e.__assign(e.__assign({},n[r]),{enabled:t}):{enabled:t.enabled,global_min_separation_seconds:t.global_min_separation_seconds};break;case"inventory_rules":a.inventory_rules={respect_inventory_code:"boolean"==typeof t?t:t.respect_inventory_code};break;case"break_code_rules":a.break_code_rules={respect_break_code:"boolean"==typeof t?t:t.respect_break_code};break;case"is_default_enabled":a.is_default_enabled="boolean"==typeof t?t:!!t}return a})},[]),G=function(r){r(function(r){return e.__spreadArray(e.__spreadArray([],r,!0),[{id:Date.now(),text:"",reasoning:""}],!1)})},J=function(e,r){e(function(e){return e.filter(function(e){return e.id!==r})})},N=function(r,t,n){r(function(r){return r.map(function(r){return String(r.id)===String(t)?e.__assign(e.__assign({},r),{text:n}):r})})},W=[e.__assign({key:"order_rules",label:"Order"},x.order_rules),e.__assign({key:"advertiser_rules",label:"Advertiser"},x.advertiser_rules)],D=[{key:"inventory_rules",label:"Inventory code",enabled:x.inventory_rules.respect_inventory_code},{key:"break_code_rules",label:"Break Code",enabled:x.break_code_rules.respect_break_code},{key:"is_default_enabled",label:"Default Variant",enabled:x.is_default_enabled}],R={"Add Guideline":"I would want to add a separation rule","Search Guideline":"I would want to set a max priority rule","Type your query":"I would want to add a break code matching rule"},B="<p><span>Hi! 👋 I'm your Instant Learning Concierge.</span>\n <span>How would you like to get started? You can select an option below or describe the Guideline you’d like to create.</span>\n ".concat(["Add Guideline","Search Guideline","Type your query"].map(function(e){return'<button class="clickable-button" data-value="'.concat(R[e],'">').concat(e,"</button>")}).join(""),"</p>");return r.jsx(i.default,{open:p,closeFunction:function(){return _(!1)},chatAssistantName:"defaultAssistant",organizationName:"techolution",baseUrl:"https://devllmstudio.creativeworkspace.ai",baseWebsocketUrl:"wss://devllmstudio.creativeworkspace.ai/graphql",ThinkingBulbIconComponent:r.jsx(n.Lightbulb,{}),customSections:r.jsx(r.Fragment,{}),isUseNormalChat:!0,chatTitle:"Create New Guideline",formTitle:"Guideline Details",initialChatMessage:B,template:a.TemplateList.BaseTemplate,templateProps:{state:{title:g,description:q,scopeData:v,whenToApplyConditions:k,whenNotToApplyConditions:j,configData:x,citations:[],citation:{}},handlers:{onTitleChange:function(e){var r,t;return f(null!==(t=null===(r=null==e?void 0:e.target)||void 0===r?void 0:r.value)&&void 0!==t?t:e)},onDescriptionChange:function(e){var r,t;return y(null!==(t=null===(r=null==e?void 0:e.target)||void 0===r?void 0:r.value)&&void 0!==t?t:e)},onAddWhenToApply:function(){return G(C)},onRemoveWhenToApply:function(e){return J(C,e)},onEditWhenToApply:function(e,r){return N(C,e,r)},onAddWhenNotToApply:function(){return G(w)},onRemoveWhenNotToApply:function(e){return J(w,e)},onEditWhenNotToApply:function(e,r){return N(w,e,r)},onScopeChange:M,onConfigChange:O},uiState:{showScope:!1,showConfiguration:!1,titleLabel:"Guideline Name",scopeLabel:"Define Scope",tierLabel:"Select Tier",descriptionLabel:"Guideline Description",whenToApplyLabel:"When to apply this Guideline (When to Apply)",whenNotToApplyLabel:"When not to apply this Guideline (When NOT to Apply)",configLabel:"Advanced Settings",stationOptions:u,tierOptions:l,separationItems:W,toggles:D},customNodes:{afterTitle:r.jsx(o.default,e.__assign({title:{type:"other",label:"Guideline"}},{children:r.jsx("p",e.__assign({style:{padding:"12px",fontSize:"14px",color:"#64748b"}},{children:"HealthCare"}))})),top:r.jsxs("div",e.__assign({style:{marginBottom:"12px",padding:"8px",backgroundColor:"#f0f4ff",borderRadius:"4px"}},{children:[r.jsx("strong",{children:"Guideline Template:"})," This is an ILOTJ TeachMe customized for Guideline Value Type"]}))}}})};
|
|
2
2
|
//# sourceMappingURL=GuidelinesTeachMeRenderer.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e}from"tslib";import{jsx as i}from"react/jsx-runtime";import{useEffect as n}from"react";import r from"./TeachMeWrapper.js";import t from"../../../plugins/ValueTypes/Default/DefaultTeachMeRenderer.js";import o from"../../../plugins/ValueTypes/RadioTrafficLearning/RadioTrafficLearningRenderer.js";import a from"../../../plugins/ValueTypes/Guidelines/GuidelinesTeachMeRenderer.js";import{useTeachMeConfigStore as l}from"../../LearningManagement/store/useLMSConfigStore.js";import{useLearningTemplateStore as
|
|
1
|
+
import{__assign as e}from"tslib";import{jsx as i}from"react/jsx-runtime";import{useEffect as n}from"react";import r from"./TeachMeWrapper.js";import t from"../../../plugins/ValueTypes/Default/DefaultTeachMeRenderer.js";import o from"../../../plugins/ValueTypes/RadioTrafficLearning/RadioTrafficLearningRenderer.js";import a from"../../../plugins/ValueTypes/Guidelines/GuidelinesTeachMeRenderer.js";import{useTeachMeConfigStore as l}from"../../LearningManagement/store/useLMSConfigStore.js";import{useLearningTemplateStore as s}from"../../LearningManagement/store/useLearningTemplateStore.js";var u={Default:t,"Radio Traffic Learning":o,Guidelines:a},p=function(t){var o,a=t.app_integration_id,p=t.isOpen,f=t.onClose,m=t.pluginPayload,d=t.token,g=t.mode,c=t.baseURL,T=l(function(e){return e.setTeachMeConfig});return l(function(e){return e.clearTeachMeConfig}),n(function(){(null==m?void 0:m.teachMe)&&T(m.teachMe),(null==m?void 0:m.tiers)&&s.getState().setTiers(null==m?void 0:m.tiers)},[m]),i(r,{app_integration_id:a,isOpen:p,onClose:f,token:d,templateRegistry:u,baseURL:c,initialScope:null!==(o=null==m?void 0:m.initialScope)&&void 0!==o?o:"",ruleSet:null==m?void 0:m.ruleSet,pluginPayload:e(e({},m),{mode:g})})};export{u as TemplateRegistry,p as default};
|
|
2
2
|
//# sourceMappingURL=TeachMePlugin.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e,__awaiter as t,__generator as r}from"tslib";import{jsx as
|
|
1
|
+
import{__assign as e,__awaiter as t,__generator as r}from"tslib";import{jsx as n,jsxs as i}from"react/jsx-runtime";import{useState as a,useEffect as o}from"react";import{Box as s,CircularProgress as c,Dialog as l,DialogTitle as p,Typography as d,IconButton as u,DialogContent as f}from"@mui/material";import m from"@mui/icons-material/Close";import{useLearningTemplateStore as h}from"../../LearningManagement/store/useLearningTemplateStore.js";var g=function(){var t=a(!0),r=t[0],o=t[1];return i(l,e({open:r,onClose:function(){return o(!1)},fullWidth:!0,maxWidth:"lg",PaperProps:{sx:{borderRadius:"16px",minHeight:"70vh",overflow:"hidden"}}},{children:[i(p,e({sx:{display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:"1px solid #e0e0e0",px:3,py:2}},{children:[n(d,e({variant:"h6",fontWeight:600},{children:"Teach Me"})),n(u,e({onClick:function(){return o(!1)}},{children:n(m,{})}))]})),n(f,e({dividers:!0,sx:{p:3,backgroundColor:"#fafafa"}},{children:"There is some issue with the selected template. Kindly check steps to resolve."}))]}))},v=function(i){var l=i.templateRegistry,p=void 0===l?{}:l,d=h(function(e){return e.backwardCompatibility}),u=h(function(e){return i.app_integration_id?e.templateMap[i.app_integration_id]:void 0}),f=h(function(e){return e.setTemplateData}),m=d?"Radio Traffic Learning":u,v=a(!m),_=v[0],y=v[1],b=a(!1),x=b[0],w=b[1];if(o(function(){if(i.isOpen){if(!d&&!i.app_integration_id)return console.error("TeachMeWrapper requires an app_integration_id when backward compatibility is disabled."),w(!0),void y(!1);if(m)y(!1);else{t(void 0,void 0,void 0,function(){var e,n;return r(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,3,4]),y(!0),w(!1),[4,(o=i.app_integration_id,s=i.token,t(void 0,void 0,void 0,function(){var e,t;return r(this,function(r){switch(r.label){case 0:return[4,fetch("".concat(i.baseURL,"/instant_learning/ilotj/application/getValueType/").concat(o),{headers:{Authorization:"Bearer ".concat(s)}})];case 1:if(!(e=r.sent()).ok)throw new Error("Failed to fetch value type");return[4,e.json()];case 2:return t=r.sent(),console.log("Fetched value type data:",t),!t||Array.isArray(t.data)&&0===t.data.length?[2,null]:[2,t.data[0].value_type_name||t.valueTypeName||t.templateName]}})}))];case 1:return e=a.sent(),f(i.app_integration_id,e),[3,4];case 2:return n=a.sent(),console.error(n),w(!0),i.app_integration_id&&f(i.app_integration_id,"ERROR"),[3,4];case 3:return y(!1),[7];case 4:return[2]}var o,s})})}}},[i.isOpen,i.app_integration_id,m,i.token,f,d]),_)return n(s,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:n(c,{size:32})}));if(x||!m)return n(g,{});var k=p[m&&p[m]?m:"Default"];return k?n(k,e({},i)):(console.warn("No renderer found for template: ".concat(m)),n(g,{}))};export{v as default};
|
|
2
2
|
//# sourceMappingURL=TeachMeWrapper.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e}from"tslib";import{jsxs as t,jsx as o}from"react/jsx-runtime";import{useState as i,useMemo as n,useEffect as a}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 c}from"lucide-react";import s from"./ChangeLogDiff.js";import{dt as d}from"../store/useLMSConfigStore.js";import p from"../RBAC/AccessPanel.module.css.js";import{usePermissionsStore as h}from"../store/usePermissionsStore.js";import g from"../store/useEnvStore.js";var
|
|
1
|
+
import{__assign as e}from"tslib";import{jsxs as t,jsx as o}from"react/jsx-runtime";import{useState as i,useMemo as n,useEffect as a}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 c}from"lucide-react";import s from"./ChangeLogDiff.js";import{dt as d}from"../store/useLMSConfigStore.js";import p from"../RBAC/AccessPanel.module.css.js";import{usePermissionsStore as h}from"../store/usePermissionsStore.js";import g from"../store/useEnvStore.js";import{useConfigStore as u}from"../store/useConfigStore.js";var m=function(m){var f=m.configId,b=m.ruleData,y=m.scopeId,x=m.scopeName,v=(null==x?void 0:x.trim())||"Selected",S=i("scope"),w=S[0],C=S[1],A=u.getState().configuration,T=h(function(e){return e.hasPermission}),L=g(function(e){var t;return(null===(t=e.rbacConfig)||void 0===t?void 0:t.applicationResourceId)||""}),k=Boolean(y&&T("ilotj.scope.changeLog.view",y)),D=Boolean(L&&T("ilotj.application.changeLog.view",L)),B=n(function(){var e=[];return y&&e.push(y),e},[b,y]);a(function(){console.log("Flattened External Resource IDs:",B)},[B]);var I={configId:f,getData:{baseUrl:A.BASE_APPMOD_URL||"https://dev.appmod.ai",endpoint:"/changelog/audit-log/fetch"},distinctValuesApi:{baseUrl:A.BASE_APPMOD_URL||"https://dev.appmod.ai",endpoint:"/changelog/audit-log/distinct-values"},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,a=(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)"}),r=t.changeTitle?t.changeTitle.replace(/_/g," "):"—";return o("span",e({style:{color:a.color,backgroundColor:a.backgroundColor,border:"1px solid ".concat(a.borderColor),boxShadow:a.boxShadow,padding:"6px 12px",borderRadius:"999px",fontSize:"12px",lineHeight:1,fontWeight:600,display:"inline-block",minWidth:"76px",textAlign:"center",textTransform:"capitalize"}},{children:r}))},style:{width:"15%",textAlign:"center"}},{key:"customChangeSummary",header:"Change Summary",body:function(e){var t;return o(s,{change:null!==(t=e.actionText)&&void 0!==t?t:"-"})},style:{width:"30%",minWidth:"200px"}},{key:"redirectLink",header:"Link",body:function(i){var n,a=(null===(n=i.metadata)||void 0===n?void 0:n.redirect_url)||i.redirect_url;return a?o("div",e({style:{display:"flex",justifyContent:"center",alignItems:"center"}},{children:t("a",e({href:a,target:"_blank",rel:"noopener noreferrer",style:{display:"flex",alignItems:"center",gap:"6px",color:"#2563eb",textDecoration:"none",fontWeight:500,fontSize:"13px"}},{children:["View ",o(c,{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),a=n.toLocaleDateString("en-US",{month:"short",day:"2-digit",year:"numeric"}),r=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:a})),o("span",{children:r})]}))},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}}}};return t("div",e({style:{padding:"24px",fontFamily:"Arial, sans-serif"}},{children:[t("div",e({style:{marginBottom:"16px",paddingBottom:"4px"}},{children:[o("h1",e({style:{margin:0,color:"#334155",fontSize:"20px",fontWeight:700,lineHeight:1.25}},{children:d("history.title","".concat(v," - Audit Log"),{scope_name:v})})),o("p",e({style:{margin:"8px 0 0",color:"#667085",fontSize:"16px",fontWeight:500,lineHeight:1}},{children:d("history.subtitle","Track all learning updates and modifications with the ".concat(v," scope."),{scope_name:v})}))]})),t("div",e({className:p.accessTabs,role:"tablist","aria-label":"Audit log level"},{children:[o("button",e({type:"button",role:"tab","aria-selected":"scope"===w,className:"".concat(p.accessTab," ").concat("scope"===w?p.accessTabActive:""),onClick:function(){return C("scope")},disabled:!k,title:k?"":"You do not have permission to view scope level change log"},{children:d("history.scopeLevel","Scope Level")})),o("button",e({type:"button",role:"tab","aria-selected":"application"===w,className:"".concat(p.accessTab," ").concat("application"===w?p.accessTabActive:""),onClick:function(){return C("application")},disabled:!D,title:D?"":"You do not have permission to view application level change log"},{children:d("history.applicationLevel","Application Level")}))]})),"scope"===w?o(r,e({},I,{query:{externalResourceId:B.length>0?B:[""],paginationLimit:10}}),"scope-audit-log"):o(r,e({},I,{query:{externalResourceId:[],paginationLimit:10}}),"application-audit-log")]}))};export{m as default};
|
|
2
2
|
//# sourceMappingURL=AuditLog.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e,__spreadArray as n,__awaiter as t,__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 c,useEffect as l}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,getILInstance as b,fetchScopes as C,inheritScope as T,inheritScopeBackwardCompatible as L,createRuleSet as A,renameScope as E,deleteRuleSet as I,requestAccess as w}from"./apis/scopeApis.js";import{QUERY_PARAM_KEYS as O,setQueryParams as R}from"./hooks/useLearningTemplateQueryParams.js";import j from"./components/ConfirmationModal.js";import _ from"./components/LearningTemplateManagementSkeleton.js";import{findNodeById as N,findNodePathById as k}from"./utils/treeUtils.js";import D from"./store/useEnvStore.js";import{useConfigStore as M}from"./store/useConfigStore.js";import{TooltipProvider as P}from"./components/ToolTip.js";import U from"./components/CreateRuleSetLegacyModal.js";import{usePermissionsStore as B}from"./store/usePermissionsStore.js";import{useAppSecRolesStore as G}from"./store/useAppSecRolesStore.js";import{useGetAppSecRolesQuery as F}from"./queries/useApprovalQueries.js";import{useLMSConfigQuery as q}from"./queries/useLMSConfigQuery.js";import x from"./RuleContent/AddScopeModal.js";import H from"./components/RuleContentSkeleton.js";import Q from"./components/ErrorStateDisplay.js";import{useLocation as z}from"react-router-dom";import K from"./shared/SuccessToastContent.js";import V from"./shared/ErrorToastContent.js";import W from"./RuleContent/RenameScopeModal.js";import{dt as Y}from"./store/useLMSConfigStore.js";import{MIDDLE_DRAWER_DT_PATH as J,MIDDLE_DRAWER_CONTEXT_MENU_DT_PATH as X,EMPTY_STATE_DT_PATH as Z}from"./constants.js";function $($){var ee,ne,te,re=this,oe=$.userDetails,se=$.llmStudioUrl,ie=$.audacyBackendUrl,ae=$.ilLabels,ce=$.config,le=$.rbacConfig,ue=$.auditLogConfig,de=$.app_integration_id,pe=$.backwardCompatibility,me=void 0!==pe&&pe,fe=$.modeId,ve=m(function(e){return e.selectedRuleSetId}),ge=m(function(e){return e.setSelectedRuleSetId}),he=m(function(e){return e.error}),ye=m(function(e){return e.setError}),Se=m(function(e){return e.setStations}),be=m(function(e){return e.scopeTreeData}),Ce=m(function(e){return e.setScopeTreeData}),Te=a({isOpen:!1,type:"GLOBAL"}),Le=Te[0],Ae=Te[1],Ee=a(!1),Ie=Ee[0],we=Ee[1],Oe=a(!1),Re=Oe[0],je=Oe[1],_e=a("learnings"),Ne=_e[0],ke=_e[1],De=a(null),Me=De[0],Pe=De[1],Ue=a(null),Be=Ue[0],Ge=Ue[1],Fe=c(null),qe=c(null),xe=c(!1),He=c(null),Qe=y();Qe.user;var ze=Qe.setUser,Ke=M(),Ve=Ke.setConfig,We=Ke.setIlLabels,Ye=function(){try{return z()}catch(e){return{search:""}}}();l(function(){if(!xe.current){var e=new URLSearchParams(window.location.search),n=e.get(O.RULESET_ID),t=e.get(O.SECTION),r=t&&hn.has(t)?t:"learnings";(null==n?void 0:n.length)&&ge&&ke&&(ge(n),ke(r),xe.current=!0)}},[null==Ye?void 0:Ye.search,ke,ge]);var Je=B(function(e){return e.fetchPermissions}),Xe=B(function(e){return e.hasPermission}),Ze=G(function(e){return e.setRoles}),$e=D(function(e){return e.appsecRbacUrl})===le.appsecRbacUrl,en=F(le.applicationId,$e).data,nn=q(null!=de?de:"",me),tn=nn.isLoading,rn=nn.isError,on=nn.refetch;nn.isSuccess;var sn=a(0),an=sn[0],cn=sn[1];l(function(){if(!me&&de&&se){t(re,void 0,void 0,function(){var e,n,t,o,s,i;return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,b(de)];case 1:return e=r.sent(),"number"==typeof(n=null===(i=null===(s=null===(o=null==e?void 0:e.data)||void 0===o?void 0:o.learningManagement)||void 0===s?void 0:s.scopeAndHierarchy)||void 0===i?void 0:i.maxHierarchyLevels)&&n>0&&cn(n-1),[3,3];case 2:return t=r.sent(),console.error("Failed to fetch IL instance for hierarchy levels:",t),[3,3];case 3:return[2]}})})}},[de,se]),l(function(){en&&Ze(en.map(function(e){return{_id:e._id,name:e.name}}))},[en,Ze]),l(function(){var e;console.log("userDetails",oe),ze(oe),console.log("llmStudioUrl",se),console.log("audacyBackendUrl",ie),D.getState().setLlmStudioUrl(se),D.getState().setAudacyBackendUrl(ie),D.getState().setRbacConfig(le),D.getState().setAuditLogConfig(ue),Ve(ce),We(ae),m.getState().setAppIntegrationId(null!=de?de:null),m.getState().setBackwardCompatibility(me),m.getState().setToken(null!==(e=null==oe?void 0:oe.accessToken)&&void 0!==e?e:null)},[oe,ze,se,ie,le,ue,ce,Ve,ae,We,de,me]),l(function(){(null==oe?void 0:oe.accessToken)&&se&&S()},[de,null==oe?void 0:oe.accessToken,se]);var ln=function(n){return void 0===n&&(n=!0),t(re,void 0,void 0,function(){var t,o,s,i,a,c,l,u;return r(this,function(r){switch(r.label){case 0:n&&we(!0),ye(null),r.label=1;case 1:return r.trys.push([1,4,5,6]),[4,Je(le.applicationId)];case 2:return r.sent(),t=function(n){if(!B.getState().hasPermission("ilotj.scope.view",n.id))return null;var r=n.children?n.children.map(function(e){return t(e)}).filter(function(e){return null!==e}):[];return e(e({},n),{children:r})},[4,C(de,oe.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=t(s))?(Pe(null),Ce({data:i}),qe.current?(ge(qe.current),ke("learnings"),qe.current=null):(a=m.getState().selectedRuleSetId,c=a?N(i,a):null,a&&c||ge(i.id))):(Pe(null!==(u=s.id)&&void 0!==u?u:null),Ce(null)):(Pe(null),Ce(null))),[3,6];case 4:return l=r.sent(),console.error("Failed to fetch rule sets or permissions",l),ye("Failed to load data. Please try again later."),[3,6];case 5:return we(!1),[7];case 6:return[2]}})})};l(function(){var e;(null===(e=null==oe?void 0:oe.accessToken)||void 0===e?void 0:e.length)&&$e?ln(!0):console.warn("Error: Trying to fetch rules without access token",oe)},[null==oe?void 0:oe.accessToken,ye,Se,le.applicationId,$e]);var un=function(n,o,s){return t(re,void 0,void 0,function(){var t,o,s,i,a,c,l,u;return r(this,function(r){switch(r.label){case 0:je(!0),r.label=1;case 1:return r.trys.push([1,4,5,6]),[4,I(n,oe.accessToken)];case 2:return r.sent(),m.getState().selectedRuleSetId===n&&(t=m.getState().scopeTreeData,(o=k((null==t?void 0:t.data)||null,n))&&o.length>1&&(s=o[o.length-2],ge(s),ke("learnings"))),[4,ln(!0)];case 3:return r.sent(),Ae(function(n){return e(e({},n),{isOpen:!1})}),null===(a=He.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===(c=He.current)||void 0===c||c.show({severity:"error",summary:"Delete Failed",detail:(null===(u=null===(l=null==i?void 0:i.response)||void 0===l?void 0:l.data)||void 0===u?void 0:u.message)||"There was an error deleting the scope. Please try again."}),[3,6];case 5:return je(!1),[7];case 6:return[2]}})})},dn=be,pn=Be?{data:{id:Be.stationId,name:Be.stationName,type:"STATION",metrics:{learningsCount:Be.learningsCount,stationsCount:0},children:[]}}:dn,mn=!!(null==pn?void 0:pn.data);null===(ee=null==pn?void 0:pn.data)||void 0===ee||ee.type;var fn=B(function(e){return e.hasGlobalPermission})("ilotj.scope.global.create",le.applicationResourceId||"");if(tn)return o("div",e({className:v.learningManagementContainer},{children:o(H,{})}));if(rn)return o("div",e({className:v.learningManagementContainer},{children:o(Q,{errorMessage:"Failed to load configuration. Please try again.",onRetry:function(){return on()},title:"Error Loading Configuration"})}));var vn=n(n([{type:"GLOBAL",label:"Global",addChildLabel:"".concat(Y("".concat(J,".addScope"),"Add Scope")),addChildType:"SCOPE"}],Array.from({length:an},function(){return e({type:"SCOPE",label:Y("".concat(J,".scope"),"Scope")},!me&&{addChildLabel:Y("".concat(X,".addSubScope"),"Add Subscope"),addChildType:"SUBSCOPE"})}),!0),me?[]:[{type:"SUBSCOPE",label:Y("".concat(J,".subScope"),"Subscope")}],!0),gn=[{id:"learnings",label:Y("".concat(J,".treeMenu.submenu.learnings"),"Learnings"),icon:u,badgeKey:"learningsCount"},{id:"access",label:Y("".concat(J,".treeMenu.submenu.access"),"Access"),icon:d},{id:"history",label:Y("".concat(J,".treeMenu.submenu.changeHistory"),"Change History"),icon:p}],hn=new Set(gn.map(function(e){return e.id})),yn=Be?gn.filter(function(e){return"stations"!==e.id}):gn;return o(P,{children:s("div",e({className:v.learningManagementContainer},{children:[o("div",e({className:v.mainWrapper},{children:Ie?o(_,{}):he?s("div",e({className:v.errorContainer},{children:[o("div",e({className:v.errorTitle},{children:"Error Loading Data"})),o("p",e({className:v.errorDesc},{children:he})),o("button",e({onClick:function(){return ln(!0)},className:v.tryAgainBtn},{children:"Try Again"}))]})):mn?o(g,{onOpenCreateModal:function(){return Ae({isOpen:!0,type:"GLOBAL"})},onAddChild:function(e,n,t){return Ae({isOpen:!0,type:n,parentId:e,parentName:t})},onRenameChild:function(e,n){return Ae({isOpen:!0,type:"RENAME",scopeId:e,initialName:n})},onDeleteChild:function(e,n,o){return t(re,void 0,void 0,function(){var t,s,i;return r(this,function(r){switch(r.label){case 0:return t=m.getState().scopeTreeData,s=k((null==t?void 0:t.data)||null,e),i=!!s&&3===s.length,0!==o?[3,2]:[4,un(e)];case 1:return r.sent(),[3,3];case 2:Ae({isOpen:!0,type:"DELETE",scopeId:e,initialName:n,isSubscope:i}),r.label=3;case 3:return[2]}})})},canDeleteScope:function(e){return Xe("ilotj.scope.delete",e)},canEditScope:function(e){return Xe("ilotj.scope.edit",e)},canCreateScope:function(e){return Xe("ilotj.scope.create",e)},onSectionSelect:function(e,n){var t;console.log("Section Selected:",{scopeId:e,sectionId:n}),R(((t={})[O.SECTION]="learnings"===n?null:n,t[O.RULESET_ID]=e,t)),ke(n),ge(e)},activeSectionId:Ne,scopeTreeData:pn,sectionsConfig:yn,onViewStation:function(e){Fe.current=ve,Ge(e),ke("learnings"),ge(e.stationId)},onRefreshRuleSets:function(e,n){void 0===e&&(e=!0),n&&(qe.current=n),ln(e)},nodeTypesConfig:vn,app_integration_id:de,token:oe.accessToken,modeId:fe}):o(h,{onCreate:function(){return Ae({isOpen:!0,type:"GLOBAL"})},title:Y("".concat(Z,".title"),"No Global Scope has been added!"),desc:Y("".concat(Z,".desc"),"Start by creating a Global scope to define base learnings that apply across all stations."),button:Y("".concat(Z,".createGlobalScope"),"Create Global Scope"),canCreateRule:fn,noAccessTitle:Y("".concat(Z,".noAccessTitle"),"Access Restricted"),noAccessDesc:Y("".concat(Z,".noAccessDesc"),"You do not have access for this application."),requestAccessButton:Y("".concat(Z,".requestAccessButton"),"Request Access"),onRequestAccess:function(){return t(re,void 0,void 0,function(){var e,n,t,s,i,a,c,l,u;return r(this,function(r){switch(r.label){case 0:if(!(e=(null===(s=null===(t=m.getState().scopeTreeData)||void 0===t?void 0:t.data)||void 0===s?void 0:s.id)||Me))return null===(i=He.current)||void 0===i||i.show({severity:"error",sticky:!1,className:v.errorToast,content:o(V,{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,w(e)];case 2:return r.sent(),null===(a=He.current)||void 0===a||a.show({severity:"success",sticky:!1,life:3e3,className:v.successToast,content:o(K,{message:"Access request submitted successfully!"})}),[3,4];case 3:return n=r.sent(),null===(c=He.current)||void 0===c||c.show({severity:"error",sticky:!1,className:v.errorToast,content:o(V,{message:(null===(u=null===(l=null==n?void 0:n.response)||void 0===l?void 0:l.data)||void 0===u?void 0:u.detail)||"Failed to request access. Please try again."})}),[3,4];case 4:return[2]}})})}})})),o(f,{ref:He,pt:{root:{style:{zIndex:9999}}}}),me&&Le.isOpen&&"DELETE"!==Le.type&&"RENAME"!==Le.type?o(U,{isOpen:!0,onClose:function(){return Ae(e(e({},Le),{isOpen:!1}))},onSubmit:function(n){return t(re,void 0,void 0,function(){var t,o,s,i,a,c,l,u,d,p,f,v,g,h,y,S,b,C,E,I;return r(this,function(r){switch(r.label){case 0:je(!0),t=m.getState().backwardCompatibility,r.label=1;case 1:return r.trys.push([1,12,13,14]),o=void 0,t&&"object"==typeof n?o=n:(s=n,i="SCOPE"===Le.type&&Le.parentId,a=i?"genreRuleSet":Le.type,o={topic:a,scope_reference_id:null,scopeDescription:"demo",parentScopeId:Le.parentId||null,scopeName:s,scopeReferenceMetadata:{},applicationMappingId:de}),[4,A(o,oe.accessToken)];case 2:if(c=r.sent(),!(l=null===(h=null==c?void 0:c.data)||void 0===h?void 0:h.scopeId))return[3,10];if(qe.current=l,u=t&&(null===(y=o.topic)||void 0===y?void 0:y.toLowerCase().includes("genre")),d=!t&&"GLOBAL"!==Le.type&&Le.parentId,!u&&!d)return[3,10];if(!(p=t?null===(b=null===(S=m.getState().scopeTreeData)||void 0===S?void 0:S.data)||void 0===b?void 0:b.id:Le.parentId))return[3,10];if(!me)return[3,7];r.label=3;case 3:return r.trys.push([3,5,,6]),[4,L({source_scope_id:p,target_scope_id:l})];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,T({source_scope_id:p,target_scope_id:l,application_mapping_id:de||"",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,ln(!0)];case 11:return r.sent(),Ae(function(n){return e(e({},n),{isOpen:!1})}),[3,14];case 12:throw g=r.sent(),console.error("An error occurred during scope creation.",g),null===(C=He.current)||void 0===C||C.show({severity:"error",summary:"Creation Failed",detail:(null===(I=null===(E=null==g?void 0:g.response)||void 0===E?void 0:E.data)||void 0===I?void 0:I.message)||"There was an error creating the scope. Please try again."}),g;case 13:return je(!1),[7];case 14:return[2]}})})},hasGlobalRuleSet:mn,canCreateGlobal:fn,globalScopeId:null!==(te=null===(ne=null==be?void 0:be.data)||void 0===ne?void 0:ne.id)&&void 0!==te?te:null}):s(i,{children:[o(x,{isOpen:Le.isOpen&&"DELETE"!==Le.type&&"RENAME"!==Le.type,onClose:function(){return Ae(e(e({},Le),{isOpen:!1}))},onCreate:function(e){e&&(qe.current=e),ln(!0)},hasGlobalRuleSet:mn,parentId:Le.parentId}),o(W,{isOpen:Le.isOpen&&"RENAME"===Le.type,onClose:function(){return Ae(e(e({},Le),{isOpen:!1}))},onSave:function(n){return t(re,void 0,void 0,function(){var t,s,i,a,c,l;return r(this,function(r){switch(r.label){case 0:je(!0),r.label=1;case 1:return r.trys.push([1,4,5,6]),Le.scopeId?(t=m.getState().backwardCompatibility,s=t?{scope_id:Le.scopeId,scope_name:n}:{scope_id:Le.scopeId,scope_type:"Custom",scope_name:n,description:"demo",application_mapping_id:de},[4,E(s,oe.accessToken)]):[2];case 2:return r.sent(),[4,ln(!0)];case 3:return r.sent(),Ae(function(n){return e(e({},n),{isOpen:!1})}),[3,6];case 4:throw i=r.sent(),console.error("An error occurred during scope rename.",i),null===(a=He.current)||void 0===a||a.show({severity:"error",sticky:!1,className:v.errorToast,content:o(V,{message:(null===(l=null===(c=null==i?void 0:i.response)||void 0===c?void 0:c.data)||void 0===l?void 0:l.message)||"There was an error renaming the scope. Please try again."})}),i;case 5:return je(!1),[7];case 6:return[2]}})})},initialName:Le.initialName})]}),o(j,{isOpen:Le.isOpen&&"DELETE"===Le.type,onCancel:function(){return Ae(e(e({},Le),{isOpen:!1}))},onConfirm:function(){return un(Le.scopeId,Le.initialName,Le.isSubscope)},title:"Delete Scope",description:s(i,{children:["Deleting ",o("span",e({className:v.highlight},{children:Le.initialName||"this scope"}))," will permanently remove all Learnings, Access rules, and Change History inside it. This cannot be undone."]}),confirmText:"Delete",confirmBgColor:"#EF4444",isLoading:Re})]}))})}export{$ as default};
|
|
1
|
+
import{__assign as e,__spreadArray 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 c,useEffect as l}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 S from"./store/useAuthStore.js";import{fetchTiers as y,getILInstance as b,fetchScopes as C,inheritScope as T,inheritScopeBackwardCompatible as A,createRuleSet as L,renameScope as E,deleteRuleSet as I,requestAccess as R}from"./apis/scopeApis.js";import{QUERY_PARAM_KEYS as w,setQueryParams as O}from"./hooks/useLearningTemplateQueryParams.js";import j from"./components/ConfirmationModal.js";import _ from"./components/LearningTemplateManagementSkeleton.js";import{findNodeById as N,findNodePathById as k}from"./utils/treeUtils.js";import D from"./store/useEnvStore.js";import{useConfigStore as M}from"./store/useConfigStore.js";import{TooltipProvider as P}from"./components/ToolTip.js";import B from"./components/CreateRuleSetLegacyModal.js";import{usePermissionsStore as U}from"./store/usePermissionsStore.js";import{useAppSecRolesStore as q}from"./store/useAppSecRolesStore.js";import{useGetAppSecRolesQuery as G}from"./queries/useApprovalQueries.js";import{useLMSConfigQuery as F}from"./queries/useLMSConfigQuery.js";import x from"./RuleContent/AddScopeModal.js";import H from"./components/RuleContentSkeleton.js";import Q from"./components/ErrorStateDisplay.js";import{useLocation as z}from"react-router-dom";import K from"./shared/SuccessToastContent.js";import V from"./shared/ErrorToastContent.js";import W from"./RuleContent/RenameScopeModal.js";import{dt as Y}from"./store/useLMSConfigStore.js";import{MIDDLE_DRAWER_DT_PATH as J,MIDDLE_DRAWER_CONTEXT_MENU_DT_PATH as X,EMPTY_STATE_DT_PATH as Z}from"./constants.js";function $($){var ee,te,ne,re=this,oe=$.userDetails,se=$.llmStudioUrl,ie=$.audacyBackendUrl,ae=$.ilLabels,ce=$.config,le=$.rbacConfig,ue=$.auditLogConfig,de=$.app_integration_id,pe=$.backwardCompatibility,me=void 0!==pe&&pe,fe=$.modeId,ve=m(function(e){return e.selectedRuleSetId}),ge=m(function(e){return e.setSelectedRuleSetId}),he=m(function(e){return e.error}),Se=m(function(e){return e.setError}),ye=m(function(e){return e.setStations}),be=m(function(e){return e.scopeTreeData}),Ce=m(function(e){return e.setScopeTreeData}),Te=a({isOpen:!1,type:"GLOBAL"}),Ae=Te[0],Le=Te[1],Ee=a(!1),Ie=Ee[0],Re=Ee[1],we=a(!1),Oe=we[0],je=we[1],_e=a("learnings"),Ne=_e[0],ke=_e[1],De=a(null),Me=De[0],Pe=De[1],Be=a(null),Ue=Be[0],qe=Be[1],Ge=a(!1),Fe=Ge[0],xe=Ge[1],He=a(!1),Qe=He[0],ze=He[1],Ke=c(null),Ve=c(null),We=c(!1),Ye=c(null),Je=S();Je.user;var Xe=Je.setUser,Ze=M(),$e=Ze.setConfig,et=Ze.setIlLabels,tt=function(){try{return z()}catch(e){return{search:""}}}();l(function(){if(!We.current){var e=new URLSearchParams(window.location.search),t=e.get(w.RULESET_ID),n=e.get(w.SECTION),r=n&&Tt.has(n)?n:"learnings";(null==t?void 0:t.length)&&ge&&ke&&(ge(t),ke(r),We.current=!0)}},[null==tt?void 0:tt.search,ke,ge]);var nt=U(function(e){return e.fetchPermissions}),rt=U(function(e){return e.hasPermission}),ot=q(function(e){return e.setRoles}),st=D(function(e){return e.appsecRbacUrl})===le.appsecRbacUrl,it=G(le.applicationId,st).data,at=F(null!=de?de:"",me),ct=at.isLoading,lt=at.isError,ut=at.refetch;at.isSuccess;var dt=a(0),pt=dt[0],mt=dt[1];l(function(){if(!me&&de&&se){n(re,void 0,void 0,function(){var e,t,n,o,s,i;return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,b(de)];case 1:return e=r.sent(),"number"==typeof(t=null===(i=null===(s=null===(o=null==e?void 0:e.data)||void 0===o?void 0:o.learningManagement)||void 0===s?void 0:s.scopeAndHierarchy)||void 0===i?void 0:i.maxHierarchyLevels)&&t>0&&mt(t-1),[3,3];case 2:return n=r.sent(),console.error("Failed to fetch IL instance for hierarchy levels:",n),[3,3];case 3:return[2]}})})}},[de,se]),l(function(){it&&ot(it.map(function(e){return{_id:e._id,name:e.name}}))},[it,ot]),l(function(){var e;console.log("userDetails",oe),Xe(oe),console.log("llmStudioUrl",se),console.log("audacyBackendUrl",ie),D.getState().setLlmStudioUrl(se),D.getState().setAudacyBackendUrl(ie),D.getState().setRbacConfig(le),D.getState().setAuditLogConfig(ue),$e(ce),et(ae),m.getState().setAppIntegrationId(null!=de?de:null),m.getState().setBackwardCompatibility(me),m.getState().setToken(null!==(e=null==oe?void 0:oe.accessToken)&&void 0!==e?e:null)},[oe,Xe,se,ie,le,ue,ce,$e,ae,et,de,me]),l(function(){(null==oe?void 0:oe.accessToken)&&se&&y()},[de,null==oe?void 0:oe.accessToken,se]);var ft=function(t){return void 0===t&&(t=!0),n(re,void 0,void 0,function(){var n,o,s,i,a,c,l,u;return r(this,function(r){switch(r.label){case 0:t&&Re(!0),Se(null),r.label=1;case 1:return r.trys.push([1,4,5,6]),[4,nt(le.applicationId)];case 2:return r.sent(),n=function(t){if(!U.getState().hasPermission("ilotj.scope.view",t.id))return null;var r=t.children?t.children.map(function(e){return n(e)}).filter(function(e){return null!==e}):[];return e(e({},t),{children:r})},[4,C(de,oe.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))?(Pe(null),Ce({data:i}),Ve.current?(ge(Ve.current),ke("learnings"),Ve.current=null):(a=m.getState().selectedRuleSetId,c=a?N(i,a):null,a&&c||ge(i.id))):(Pe(null!==(u=s.id)&&void 0!==u?u:null),Ce(null)):(Pe(null),Ce(null))),[3,6];case 4:return l=r.sent(),console.error("Failed to fetch rule sets or permissions",l),Se("Failed to load data. Please try again later."),[3,6];case 5:return Re(!1),[7];case 6:return[2]}})})};l(function(){var e;(null===(e=null==oe?void 0:oe.accessToken)||void 0===e?void 0:e.length)&&st?ft(!0):console.warn("Error: Trying to fetch rules without access token",oe)},[null==oe?void 0:oe.accessToken,Se,ye,le.applicationId,st]);var vt=function(t,o,s){return n(re,void 0,void 0,function(){var n,o,s,i,a,c,l,u;return r(this,function(r){switch(r.label){case 0:je(!0),r.label=1;case 1:return r.trys.push([1,4,5,6]),[4,I(t,oe.accessToken)];case 2:return r.sent(),m.getState().selectedRuleSetId===t&&(n=m.getState().scopeTreeData,(o=k((null==n?void 0:n.data)||null,t))&&o.length>1&&(s=o[o.length-2],ge(s),ke("learnings"))),[4,ft(!0)];case 3:return r.sent(),Le(function(t){return e(e({},t),{isOpen:!1})}),null===(a=Ye.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===(c=Ye.current)||void 0===c||c.show({severity:"error",summary:"Delete Failed",detail:(null===(u=null===(l=null==i?void 0:i.response)||void 0===l?void 0:l.data)||void 0===u?void 0:u.message)||"There was an error deleting the scope. Please try again."}),[3,6];case 5:return je(!1),[7];case 6:return[2]}})})},gt=be,ht=Ue?{data:{id:Ue.stationId,name:Ue.stationName,type:"STATION",metrics:{learningsCount:Ue.learningsCount,stationsCount:0},children:[]}}:gt,St=!!(null==ht?void 0:ht.data);null===(ee=null==ht?void 0:ht.data)||void 0===ee||ee.type;var yt=U(function(e){return e.hasGlobalPermission})("ilotj.scope.global.create",le.applicationResourceId||"");if(ct)return o("div",e({className:v.learningManagementContainer},{children:o(H,{})}));if(lt)return o("div",e({className:v.learningManagementContainer},{children:o(Q,{errorMessage:"Failed to load configuration. Please try again.",onRetry:function(){return ut()},title:"Error Loading Configuration"})}));var bt=t(t([{type:"GLOBAL",label:"Global",addChildLabel:"".concat(Y("".concat(J,".addScope"),"Add Scope")),addChildType:"SCOPE"}],Array.from({length:pt},function(){return e({type:"SCOPE",label:Y("".concat(J,".scope"),"Scope")},!me&&{addChildLabel:Y("".concat(X,".addSubScope"),"Add Subscope"),addChildType:"SUBSCOPE"})}),!0),me?[]:[{type:"SUBSCOPE",label:Y("".concat(J,".subScope"),"Subscope")}],!0),Ct=[{id:"learnings",label:Y("".concat(J,".treeMenu.submenu.learnings"),"Learnings"),icon:u,badgeKey:"learningsCount"},{id:"access",label:Y("".concat(J,".treeMenu.submenu.access"),"Access"),icon:d},{id:"history",label:Y("".concat(J,".treeMenu.submenu.changeHistory"),"Change History"),icon:p}],Tt=new Set(Ct.map(function(e){return e.id})),At=Ue?Ct.filter(function(e){return"stations"!==e.id}):Ct;return o(P,{children:s("div",e({className:v.learningManagementContainer},{children:[o("div",e({className:v.mainWrapper},{children:Ie?o(_,{}):he?s("div",e({className:v.errorContainer},{children:[o("div",e({className:v.errorTitle},{children:"Error Loading Data"})),o("p",e({className:v.errorDesc},{children:he})),o("button",e({onClick:function(){return ft(!0)},className:v.tryAgainBtn},{children:"Try Again"}))]})):St?o(g,{onOpenCreateModal:function(){return Le({isOpen:!0,type:"GLOBAL"})},onAddChild:function(e,t,n){return Le({isOpen:!0,type:t,parentId:e,parentName:n})},onRenameChild:function(e,t){return Le({isOpen:!0,type:"RENAME",scopeId:e,initialName:t})},onDeleteChild:function(e,t,o){return n(re,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=k((null==n?void 0:n.data)||null,e),i=!!s&&3===s.length,0!==o?[3,2]:[4,vt(e)];case 1:return r.sent(),[3,3];case 2:Le({isOpen:!0,type:"DELETE",scopeId:e,initialName:t,isSubscope:i}),r.label=3;case 3:return[2]}})})},canDeleteScope:function(e){return rt("ilotj.scope.delete",e)},canEditScope:function(e){return rt("ilotj.scope.edit",e)},canCreateScope:function(e){return rt("ilotj.scope.create",e)},onSectionSelect:function(e,t){var n;console.log("Section Selected:",{scopeId:e,sectionId:t}),O(((n={})[w.SECTION]="learnings"===t?null:t,n[w.RULESET_ID]=e,n)),ke(t),ge(e)},activeSectionId:Ne,scopeTreeData:ht,sectionsConfig:At,onViewStation:function(e){Ke.current=ve,qe(e),ke("learnings"),ge(e.stationId)},onRefreshRuleSets:function(e,t){void 0===e&&(e=!0),t&&(Ve.current=t),ft(e)},nodeTypesConfig:bt,app_integration_id:de,token:oe.accessToken,modeId:fe}):o(h,{onCreate:function(){return Le({isOpen:!0,type:"GLOBAL"})},title:Y("".concat(Z,".title"),"No Global Scope has been added!"),desc:Y("".concat(Z,".desc"),"Start by creating a Global scope to define base learnings that apply across all stations."),button:Y("".concat(Z,".createGlobalScope"),"Create Global Scope"),canCreateRule:yt,noAccessTitle:Y("".concat(Z,".noAccessTitle"),"Access Restricted"),noAccessDesc:Y("".concat(Z,".noAccessDesc"),"You do not have access for this application."),requestAccessButton:Y("".concat(Z,".requestAccessButton"),"Request Access"),requestSentButton:Y("".concat(Z,".requestSentButton"),"Request Sent"),onRequestAccess:function(){return n(re,void 0,void 0,function(){var e,t,n,s,i,a,c,l,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)||Me))return null===(i=Ye.current)||void 0===i||i.show({severity:"error",sticky:!1,className:v.errorToast,content:o(V,{message:"Unable to identify the global scope for this access request."})}),[2];xe(!0),r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,R(e)];case 2:return r.sent(),ze(!0),null===(a=Ye.current)||void 0===a||a.show({severity:"success",sticky:!1,life:3e3,className:v.successToast,content:o(K,{message:"Access request submitted successfully!"})}),[3,5];case 3:return t=r.sent(),null===(c=Ye.current)||void 0===c||c.show({severity:"error",sticky:!1,className:v.errorToast,content:o(V,{message:(null===(u=null===(l=null==t?void 0:t.response)||void 0===l?void 0:l.data)||void 0===u?void 0:u.detail)||"Failed to request access. Please try again."})}),[3,5];case 4:return xe(!1),[7];case 5:return[2]}})})},isRequestingAccess:Fe,isAccessRequested:Qe})})),o(f,{ref:Ye,pt:{root:{style:{zIndex:9999}}}}),me&&Ae.isOpen&&"DELETE"!==Ae.type&&"RENAME"!==Ae.type?o(B,{isOpen:!0,onClose:function(){return Le(e(e({},Ae),{isOpen:!1}))},onSubmit:function(t){return n(re,void 0,void 0,function(){var n,o,s,i,a,c,l,u,d,p,f,v,g,h,S,y,b,C,E,I;return r(this,function(r){switch(r.label){case 0:je(!0),n=m.getState().backwardCompatibility,r.label=1;case 1:return r.trys.push([1,12,13,14]),o=void 0,n&&"object"==typeof t?o=t:(s=t,i="SCOPE"===Ae.type&&Ae.parentId,a=i?"genreRuleSet":Ae.type,o={topic:a,scope_reference_id:null,scopeDescription:"demo",parentScopeId:Ae.parentId||null,scopeName:s,scopeReferenceMetadata:{},applicationMappingId:de}),[4,L(o,oe.accessToken)];case 2:if(c=r.sent(),!(l=null===(h=null==c?void 0:c.data)||void 0===h?void 0:h.scopeId))return[3,10];if(Ve.current=l,u=n&&(null===(S=o.topic)||void 0===S?void 0:S.toLowerCase().includes("genre")),d=!n&&"GLOBAL"!==Ae.type&&Ae.parentId,!u&&!d)return[3,10];if(!(p=n?null===(b=null===(y=m.getState().scopeTreeData)||void 0===y?void 0:y.data)||void 0===b?void 0:b.id:Ae.parentId))return[3,10];if(!me)return[3,7];r.label=3;case 3:return r.trys.push([3,5,,6]),[4,A({source_scope_id:p,target_scope_id:l})];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,T({source_scope_id:p,target_scope_id:l,application_mapping_id:de||"",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,ft(!0)];case 11:return r.sent(),Le(function(t){return e(e({},t),{isOpen:!1})}),[3,14];case 12:throw g=r.sent(),console.error("An error occurred during scope creation.",g),null===(C=Ye.current)||void 0===C||C.show({severity:"error",summary:"Creation Failed",detail:(null===(I=null===(E=null==g?void 0:g.response)||void 0===E?void 0:E.data)||void 0===I?void 0:I.message)||"There was an error creating the scope. Please try again."}),g;case 13:return je(!1),[7];case 14:return[2]}})})},hasGlobalRuleSet:St,canCreateGlobal:yt,globalScopeId:null!==(ne=null===(te=null==be?void 0:be.data)||void 0===te?void 0:te.id)&&void 0!==ne?ne:null}):s(i,{children:[o(x,{isOpen:Ae.isOpen&&"DELETE"!==Ae.type&&"RENAME"!==Ae.type,onClose:function(){return Le(e(e({},Ae),{isOpen:!1}))},onCreate:function(e){e&&(Ve.current=e),ft(!0)},hasGlobalRuleSet:St,parentId:Ae.parentId}),o(W,{isOpen:Ae.isOpen&&"RENAME"===Ae.type,onClose:function(){return Le(e(e({},Ae),{isOpen:!1}))},onSave:function(t){return n(re,void 0,void 0,function(){var n,s,i,a,c,l;return r(this,function(r){switch(r.label){case 0:je(!0),r.label=1;case 1:return r.trys.push([1,4,5,6]),Ae.scopeId?(n=m.getState().backwardCompatibility,s=n?{scope_id:Ae.scopeId,scope_name:t}:{scope_id:Ae.scopeId,scope_type:"Custom",scope_name:t,description:"demo",application_mapping_id:de},[4,E(s,oe.accessToken)]):[2];case 2:return r.sent(),[4,ft(!0)];case 3:return r.sent(),Le(function(t){return e(e({},t),{isOpen:!1})}),[3,6];case 4:throw i=r.sent(),console.error("An error occurred during scope rename.",i),null===(a=Ye.current)||void 0===a||a.show({severity:"error",sticky:!1,className:v.errorToast,content:o(V,{message:(null===(l=null===(c=null==i?void 0:i.response)||void 0===c?void 0:c.data)||void 0===l?void 0:l.message)||"There was an error renaming the scope. Please try again."})}),i;case 5:return je(!1),[7];case 6:return[2]}})})},initialName:Ae.initialName})]}),o(j,{isOpen:Ae.isOpen&&"DELETE"===Ae.type,onCancel:function(){return Le(e(e({},Ae),{isOpen:!1}))},onConfirm:function(){return vt(Ae.scopeId,Ae.initialName,Ae.isSubscope)},title:"Delete Scope",description:s(i,{children:["Deleting ",o("span",e({className:v.highlight},{children:Ae.initialName||"this scope"}))," will permanently remove all Learnings, Access rules, and Change History inside it. This cannot be undone."]}),confirmText:"Delete",confirmBgColor:"#EF4444",isLoading:Oe})]}))})}export{$ as default};
|
|
2
2
|
//# sourceMappingURL=LearningManagement.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as t,__spreadArray as n,__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 T}from"primereact/toast";import y from"./ContentLogic.js";import w from"../components/ErrorStateDisplay.js";import S from"../shared/SuccessToastContent.js";import C from"../shared/ErrorToastContent.js";import{findNodeById as j}from"../utils/treeUtils.js";import R from"../styles/LearningContent.module.css.js";import b from"../components/ConfirmationModal.js";import{dt as I}from"../store/useLMSConfigStore.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 D}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 x from"../../IL-OTJ/ValueTypeWrappers/TeachMePlugin.js";import{LEARNING_DT_PATH as _,VARIANT_DT_PATH as L,TIER_DT_PATH as k}from"../constants.js";import"../store/usePermissionsStore.js";import"appsec-ui";import"../store/useAuthStore.js";import"../store/useEnvStore.js";import"@radix-ui/react-tooltip";import"../components/StationOnboarding/InputField.js";import"../store/useConfigStore.js";import"../config.js";import"../store/useAppSecRolesStore.js";import"@tanstack/react-query";import"@e-llm-studio/audit-log";import"@e-llm-studio/audit-log/dist/styles.css";import"../AuditLog/ChangeLogDiff.js";import"../components/ToolTip.js";import"react-router-dom";var O=function(O){var M,A=O.noRulesTitle,N=void 0===A?"No rules have been added !":A,E=O.noRulesDesc,V=void 0===E?"Start by adding rules that should apply across all stations.":E,F=O.noRulesButtonText,P=void 0===F?"Create New Rule":F,B=O.deleteRuleSuccessMessage,J=void 0===B?"Rule deleted successfully!":B,U=O.deleteVariantSuccessMessage,W=void 0===U?"Variant deleted successfully!":U,q=O.deleteRuleErrorMessage,G=void 0===q?"Failed to delete rule. Please try again.":q,H=O.deleteVariantErrorMessage,$=void 0===H?"Failed to delete variant. Please try again.":H,z=O.deleteModalTitle,K=void 0===z?"Delete":z,Q=O.deleteRuleModalWarning,X=void 0===Q?"This will permanently delete the rule configuration.":Q,Y=O.deleteVariantModalWarning,Z=void 0===Y?"This will permanently delete the variant configuration.":Y,ee=O.deleteConfirmText,te=void 0===ee?"Delete":ee,ne=O.onRefreshRuleSets,re=O.app_integration_id,oe=O.token,ie=O.modeId,le=c(function(e){return e.selectedRuleSetId}),ae=c(function(e){return e.scopeTreeData}),se=c(function(e){return e.sidebarTab}),ue=c(function(e){return e.setInitialRules}),ce=c(function(e){return e.currentRules}),de=c(function(e){return e.setRawAuditRuleData});c(function(e){return e.createdVariantInfo});var pe=c(function(e){return e.resetCreatedVariantInfo}),me=c(function(e){return e.isILModalTriggered}),fe=c(function(e){return e.setIsILModalTriggered}),ve=a(null),ge=s(!1),he=ge[0],Te=ge[1],ye=s(null),we=ye[0],Se=ye[1],Ce=s(null),je=Ce[0],Re=Ce[1],be=s(null),Ie=be[0],De=be[1],xe=s(null),_e=xe[0],Le=xe[1],ke=s(!1),Oe=ke[0],Me=ke[1],Ae=s(null),Ne=Ae[0],Ee=Ae[1],Ve=s(!1),Fe=Ve[0],Pe=Ve[1],Be=s(""),Je=Be[0],Ue=Be[1],We=s(null),qe=We[0],Ge=We[1],He=s(!1),$e=He[0],ze=He[1],Ke=s(!1),Qe=Ke[0],Xe=Ke[1],Ye=s("ruleDeletion"),Ze=Ye[0],et=Ye[1],tt=s(null),nt=tt[0],rt=tt[1],ot=s(!1),it=ot[0],lt=ot[1],at=s(!1),st=at[0],ut=at[1],ct=c.getState().tiers,dt=s(null),pt=dt[0],mt=dt[1],ft=s(null),vt=ft[0],gt=ft[1],ht=s(null),Tt=ht[0],yt=ht[1],wt=function(){Se(null),Re(null),Te(!0),Le(0)},St=function(){Te(!1),fe(!1),Se(null),Re(null),De(null),Le(null),Xe(!1),ut(!1),Ct(),mt(null),gt(null),yt(null),ne&&ne(!1,le||void 0)};u(function(){Ct()},[le,ue]),u(function(){me&&Te(!0)},[me]);var Ct=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,T,y,w,S,C,j,R;return t(this,function(t){switch(t.label){case 0:if(!le)return ue([]),[2];o||Me(!0),Ee(null),t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,p(le,oe)];case 2:return e=t.sent(),console.log("response==",e),(null==e?void 0:e.data)&&0!==Object.keys(e.data).length?(de(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)?n([],i.tiers,!0).sort(function(e,t){var n,r;return(null!==(n=e.tier_priority)&&void 0!==n?n:0)-(null!==(r=t.tier_priority)&&void 0!==r?r:0)}).map(function(e){return[e.name,e.value]}):Object.entries(i).filter(function(e){var t=e[0],n=e[1];return!l.has(t)&&Array.isArray(n)}),s=a.map(function(e){var t=e[1];return new Set(t.flatMap(function(e){var t,n;return null!==(n=null===(t=e.variants)||void 0===t?void 0:t.map(function(e){return e.link_id}).filter(Boolean))&&void 0!==n?n:[]}))}),u=s.flatMap(function(e){return Array.from(e)}),d=u.reduce(function(e,t){var n;return e[t]=(null!==(n=e[t])&&void 0!==n?n: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 t;return r(r({},e),{variants:null===(t=e.variants)||void 0===t?void 0:t.map(function(e){return r(r({},e),{isLinked:!!e.link_id&&m.has(e.link_id)})})})})},v=a.map(function(e,t){var n,r=e[0],o=e[1],i=ct.find(function(e){return e.tier_name===r}),l=r.replace(/tier(\d+)/i,"tier_$1");return{id:null!==(n=null==i?void 0:i.tier_id)&&void 0!==n?n:String(t+1),name:l.replace(/_/g," ").replace(/\b\w/g,function(e){return e.toUpperCase()}),ruleCount:o.length,description:0===t?"".concat(I("tier.subtitle","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===t,rules:f(o)}}),(g=c.getState().createdVariantInfo)&&g.length>0?(h=Object.fromEntries(a.map(function(e,t){return[e[0],String(t+1)]})),T=new Set(g.map(function(e){return h[e.tierName]}).filter(Boolean)),y=v.map(function(e){return r(r({},e),{isOpen:e.isOpen||T.has(e.id)})}),ue(y),(w=null===(R=null===(j=null===(C=g[0])||void 0===C?void 0:C.variants)||void 0===j?void 0:j[0])||void 0===R?void 0:R.id)?setTimeout(function(){var e=document.querySelector('[data-variant-id="'.concat(w,'"]'));e&&e.scrollIntoView({behavior:"smooth",block:"center"}),setTimeout(function(){return pe()},1e4)},500):pe()):ue(v),[3,5]):(ue([]),[2]);case 3:return S=t.sent(),console.error("Failed to fetch rule details",S),404!==(null==S?void 0:S.status)&&Ee((null==S?void 0:S.message)||"Failed to load rules. Please try again."),ue([]),[3,5];case 4:return o||Me(!1),[7];case 5:return[2]}})})},jt=le?j((null==ae?void 0:ae.data)||null,le):null,Rt=jt?{ruleSetId:jt.id,ruleSetName:jt.name,ruleSetDesc:"",ruleCount:null===(M=null==jt?void 0:jt.metrics)||void 0===M?void 0:M.learningsCount}:void 0,bt=Boolean(null==ae?void 0:ae.data),It=Boolean(le&&!jt&&bt),Dt=function(){if("stations"===se)return"custom";if(!jt)return"global";switch(jt.type){case"GLOBAL":default:return"global";case"SCOPE":return"genre";case"SUBSCOPE":case"Custom":return"custom"}},xt=function(e){var t;if(!e)return o("p",{children:I("".concat(k,".deleteDialog.description"),"Are you sure you want to delete this rule? This action cannot be undone.")});var n=null==ce?void 0:ce.flatMap(function(e){var t;return null!==(t=e.rules)&&void 0!==t?t:[]}).find(function(t){return t.ruleId===e});return o("p",{children:I("".concat(k,".deleteDialog.description"),"Are you sure you want to delete ".concat(null==n?void 0:n.ruleTitle," rule? This action cannot be undone."),{rule_title:null!==(t=null==n?void 0:n.ruleTitle)&&void 0!==t?t:""})})},_t={editingRule:we,editingTier:je,editingVariants:Ie,focusedVariantIndex:_e,setFocusedVariantIndex:Le,triggerAddVariant:Qe,triggerFixGaps:st,copiedRule:pt,copiedSourceTier:vt,copiedTargetTier:Tt,initialDraftMessage:Je,app_integration_id:re,modeId:ie};return Rt?i(l,{children:[o(T,{ref:ve}),o("div",r({className:R.container},{children:Oe?o(h,{}):Ne?o(w,{errorMessage:Ne,onRetry:Ct}):o(y,{onAddRule:wt,onDeleteRule:function(e){Ge(e)},onEditRule:function(e,t){Se(e),Re(t||null),De(e.variants||null),Le(null),Xe(!0),Te(!0)},onEditVariant:function(e,t,n,r){var o,i,l,a,s=null!==(l=null===(i=null===(o=null==ce?void 0:ce.find(function(e){return e.name===n}))||void 0===o?void 0:o.rules)||void 0===i?void 0:i.find(function(e){return e.ruleId===t}))&&void 0!==l?l:null==ce?void 0:ce.flatMap(function(e){return e.rules}).find(function(e){return e.ruleId===t});if(s){var u=null===(a=s.variants)||void 0===a?void 0:a.findIndex(function(t){return t.variantId===e.variantId}),c=void 0!==u&&-1!==u?u:0;Se(s),Re(n||null),De(s.variants||null),Le(c),Te(!0),"resolve_gaps"===r&&ut(!0)}},onDeleteVariant:function(e,t){rt({variantId:e,ruleId:t})},onExportRule:function(){return e(void 0,void 0,void 0,function(){var e,n,r,i,l,a,s;return t(this,function(t){switch(t.label){case 0:if(!le)return[2];Pe(!0),t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,m(le)];case 2:return e=t.sent(),n=window.URL.createObjectURL(e),(r=document.createElement("a")).href=n,i=(null==Rt?void 0:Rt.ruleSetName)?"".concat(Rt.ruleSetName.replace(/\s+/g,"_"),"_rules.csv"):"ruleset_".concat(le,".csv"),r.download=i,document.body.appendChild(r),r.click(),document.body.removeChild(r),window.URL.revokeObjectURL(n),null===(a=ve.current)||void 0===a||a.show({severity:"success",sticky:!1,life:3e3,className:R.successToast,content:o(S,{message:"Ruleset exported successfully!"})}),[3,5];case 3:return l=t.sent(),console.error("Export error:",l),null===(s=ve.current)||void 0===s||s.show({severity:"error",sticky:!1,className:R.errorToast,content:o(C,{message:l.message||"Failed to export ruleset. Please try again."})}),[3,5];case 4:return Pe(!1),[7];case 5:return[2]}})})},isExporting:Fe,onToggleSuccess:function(){return Ct(!0)},onReorderRules:function(n,r,i,l,a){return e(void 0,void 0,void 0,function(){var e,s,u;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,g(n,r,i,l,a)];case 1:return t.sent(),Ct(!0),null===(s=ve.current)||void 0===s||s.show({severity:"success",sticky:!1,life:3e3,className:R.successToast,content:o(S,{message:"Rule order changed successfully. Future rule applications will follow the updated order."})}),[3,3];case 2:return e=t.sent(),console.error("Failed to reorder rules:",e),Ct(!0),null===(u=ve.current)||void 0===u||u.show({severity:"error",sticky:!1,className:R.errorToast,content:o(C,{message:"Failed to update rule order. Please try again."})}),[3,3];case 3:return[2]}})})},onRefreshRuleSets:ne,setDeleteConfirmationUsedFor:et,onCopyToTier:function(e,t,n,r,o){var i,l,a=null===(l=null===(i=null==ce?void 0:ce.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===t});if(a){var s=["Add a new learning with the following details:","- Rule Title: ".concat(n),"- Description: ".concat(e.description),"- When to apply: ".concat(e.whenToApply),"- When NOT to apply: ".concat(e.whenNotToApply),"- Tier information: ".concat(o)].join("\n");Ue(s),mt(a),gt(r),yt(o),Se(null),Re(null),De(null),Le(null),Te(!0)}}})})),he&&o(D,{children:o(x,{isOpen:he,onClose:St,app_integration_id:re,token:oe,mode:"ADD",pluginPayload:r(r({},_t),{initialScope:Dt(),ruleSet:Rt})})}),o(b,{isOpen:!!qe,title:I("".concat(_,".deleteDialog.title"),K),description:xt(qe),warning:I("".concat(_,".deleteDialog.warningText"),X),confirmText:I("".concat(_,".deleteDialog.deleteText"),te),cancelText:I("".concat(_,".deleteDialog.cancelText"),"Cancel"),loadingText:I("".concat(_,".deleteDialog.loadingText"),"Deleting..."),confirmBgColor:"#EF4444",onConfirm:function(){return e(void 0,void 0,void 0,function(){var e,n,r,i,l;return t(this,function(t){switch(t.label){case 0:if(!qe)return[2];ze(!0),t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,f(qe)];case 2:return t.sent(),Ge(null),null===(n=ve.current)||void 0===n||n.show({severity:"success",sticky:!1,life:3e3,className:R.successToast,content:o(S,{message:J})}),Ct(),ne&&ne(!1,le||void 0),[3,5];case 3:return e=t.sent(),console.error("Failed to delete rule",e),null===(r=ve.current)||void 0===r||r.show({severity:"error",sticky:!1,className:R.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)||G})}),[3,5];case 4:return ze(!1),[7];case 5:return[2]}})})},onCancel:function(){return Ge(null)},isLoading:$e}),o(b,{isOpen:!!nt,title:I("".concat(L,".deleteVariant.title"),K),description:"variantDeletion"===Ze?o("span",{children:I("".concat(L,".deleteVariant.desc"),"Are you sure you want to delete this variant? This action cannot be undone.")}):xt((null==nt?void 0:nt.ruleId)||null),warning:I("".concat(L,".deleteVariant.warningText"),"ruleDeletion"===Ze?X:Z),confirmText:I("".concat(L,".deleteDialog.deleteText"),te),cancelText:I("".concat(L,".cancelText"),"Cancel"),loadingText:I("".concat(L,".loadingText"),"Deleting..."),confirmBgColor:"#EF4444",onConfirm:function(){return e(void 0,void 0,void 0,function(){var e,n,r,i,l;return t(this,function(t){switch(t.label){case 0:if(!nt)return[2];lt(!0),t.label=1;case 1:return t.trys.push([1,6,7,8]),"ruleDeletion"!==Ze?[3,3]:[4,v(nt.ruleId)];case 2:return t.sent(),[3,5];case 3:return[4,f(nt.variantId)];case 4:t.sent(),t.label=5;case 5:return rt(null),null===(n=ve.current)||void 0===n||n.show({severity:"success",sticky:!1,life:3e3,className:R.successToast,content:o(S,{message:"ruleDeletion"===Ze?J:W})}),Ct(),ne&&ne(!1,le||void 0),[3,8];case 6:return e=t.sent(),console.error("Failed to delete variant",e),null===(r=ve.current)||void 0===r||r.show({severity:"error",sticky:!1,className:R.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?G:$)})}),[3,8];case 7:return lt(!1),[7];case 8:return[2]}})})},onCancel:function(){return rt(null)},isLoading:it})]}):It?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==ne?void 0:ne(!0)},retryButtonText:"Refresh"}):i(l,{children:[o(d,{onCreate:wt,title:N,desc:V,button:P}),he&&o(D,{children:o(x,{isOpen:he,onClose:St,app_integration_id:re,token:oe,mode:"ADD",pluginPayload:r(r({},_t),{initialScope:Dt(),ruleSet:Rt})})})]})};export{O as default};
|
|
1
|
+
import{__awaiter as e,__generator as t,__spreadArray as n,__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 T}from"primereact/toast";import y from"./ContentLogic.js";import w from"../components/ErrorStateDisplay.js";import S from"../shared/SuccessToastContent.js";import C from"../shared/ErrorToastContent.js";import{findNodeById as R}from"../utils/treeUtils.js";import b from"../styles/LearningContent.module.css.js";import j from"../components/ConfirmationModal.js";import{dt as I}from"../store/useLMSConfigStore.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 D}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 x from"../../IL-OTJ/ValueTypeWrappers/TeachMePlugin.js";import{LEARNING_DT_PATH as _,VARIANT_DT_PATH as L,TIER_DT_PATH as k}from"../constants.js";import{useConfigStore as O}from"../store/useConfigStore.js";import"../store/usePermissionsStore.js";import"appsec-ui";import"../store/useAuthStore.js";import"../store/useEnvStore.js";import"@radix-ui/react-tooltip";import"../components/StationOnboarding/InputField.js";import"../config.js";import"../store/useAppSecRolesStore.js";import"@tanstack/react-query";import"@e-llm-studio/audit-log";import"@e-llm-studio/audit-log/dist/styles.css";import"../AuditLog/ChangeLogDiff.js";import"../components/ToolTip.js";import"react-router-dom";var A=function(A){var M,E=A.noRulesTitle,N=void 0===E?"No rules have been added !":E,V=A.noRulesDesc,F=void 0===V?"Start by adding rules that should apply across all stations.":V,B=A.noRulesButtonText,P=void 0===B?"Create New Rule":B,U=A.deleteRuleSuccessMessage,J=void 0===U?"Rule deleted successfully!":U,W=A.deleteVariantSuccessMessage,q=void 0===W?"Variant deleted successfully!":W,G=A.deleteRuleErrorMessage,H=void 0===G?"Failed to delete rule. Please try again.":G,$=A.deleteVariantErrorMessage,z=void 0===$?"Failed to delete variant. Please try again.":$,K=A.deleteModalTitle,Q=void 0===K?"Delete":K,X=A.deleteRuleModalWarning,Y=void 0===X?"This will permanently delete the rule configuration.":X,Z=A.deleteVariantModalWarning,ee=void 0===Z?"This will permanently delete the variant configuration.":Z,te=A.deleteConfirmText,ne=void 0===te?"Delete":te,re=A.onRefreshRuleSets,oe=A.app_integration_id,ie=A.token,le=A.modeId,ae=c(function(e){return e.selectedRuleSetId}),se=c(function(e){return e.scopeTreeData}),ue=c(function(e){return e.sidebarTab}),ce=c(function(e){return e.setInitialRules}),de=c(function(e){return e.currentRules}),pe=c(function(e){return e.setRawAuditRuleData});c(function(e){return e.createdVariantInfo});var me=c(function(e){return e.resetCreatedVariantInfo}),fe=c(function(e){return e.isILModalTriggered}),ve=c(function(e){return e.setIsILModalTriggered}),ge=a(null),he=O.getState().configuration,Te=s(!1),ye=Te[0],we=Te[1],Se=s(null),Ce=Se[0],Re=Se[1],be=s(null),je=be[0],Ie=be[1],De=s(null),xe=De[0],_e=De[1],Le=s(null),ke=Le[0],Oe=Le[1],Ae=s(!1),Me=Ae[0],Ee=Ae[1],Ne=s(null),Ve=Ne[0],Fe=Ne[1],Be=s(!1),Pe=Be[0],Ue=Be[1],Je=s(""),We=Je[0],qe=Je[1],Ge=s(null),He=Ge[0],$e=Ge[1],ze=s(!1),Ke=ze[0],Qe=ze[1],Xe=s(!1),Ye=Xe[0],Ze=Xe[1],et=s("ruleDeletion"),tt=et[0],nt=et[1],rt=s(null),ot=rt[0],it=rt[1],lt=s(!1),at=lt[0],st=lt[1],ut=s(!1),ct=ut[0],dt=ut[1],pt=c.getState().tiers,mt=s(null),ft=mt[0],vt=mt[1],gt=s(null),ht=gt[0],Tt=gt[1],yt=s(null),wt=yt[0],St=yt[1],Ct=function(){Re(null),Ie(null),we(!0),Oe(0)},Rt=function(){we(!1),ve(!1),Re(null),Ie(null),_e(null),Oe(null),Ze(!1),dt(!1),bt(),vt(null),Tt(null),St(null),re&&re(!1,ae||void 0)};u(function(){bt()},[ae,ce]),u(function(){fe&&we(!0)},[fe]);var bt=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,T,y,w,S,C,R,b;return t(this,function(t){switch(t.label){case 0:if(!ae)return ce([]),[2];o||Ee(!0),Fe(null),t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,p(ae,ie)];case 2:return e=t.sent(),console.log("response==",e),(null==e?void 0:e.data)&&0!==Object.keys(e.data).length?(pe(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)?n([],i.tiers,!0).sort(function(e,t){var n,r;return(null!==(n=e.tier_priority)&&void 0!==n?n:0)-(null!==(r=t.tier_priority)&&void 0!==r?r:0)}).map(function(e){return[e.name,e.value]}):Object.entries(i).filter(function(e){var t=e[0],n=e[1];return!l.has(t)&&Array.isArray(n)}),s=a.map(function(e){var t=e[1];return new Set(t.flatMap(function(e){var t,n;return null!==(n=null===(t=e.variants)||void 0===t?void 0:t.map(function(e){return e.link_id}).filter(Boolean))&&void 0!==n?n:[]}))}),u=s.flatMap(function(e){return Array.from(e)}),d=u.reduce(function(e,t){var n;return e[t]=(null!==(n=e[t])&&void 0!==n?n: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 t;return r(r({},e),{variants:null===(t=e.variants)||void 0===t?void 0:t.map(function(e){return r(r({},e),{isLinked:!!e.link_id&&m.has(e.link_id)})})})})},v=a.map(function(e,t){var n,r=e[0],o=e[1],i=pt.find(function(e){return e.tier_name===r}),l=r.replace(/tier(\d+)/i,"tier_$1");return{id:null!==(n=null==i?void 0:i.tier_id)&&void 0!==n?n:String(t+1),name:l.replace(/_/g," ").replace(/\b\w/g,function(e){return e.toUpperCase()}),ruleCount:o.length,description:0===t?"".concat(I("tier.subtitle","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===t,rules:f(o)}}),(g=c.getState().createdVariantInfo)&&g.length>0?(h=Object.fromEntries(a.map(function(e,t){return[e[0],String(t+1)]})),T=new Set(g.map(function(e){return h[e.tierName]}).filter(Boolean)),y=v.map(function(e){return r(r({},e),{isOpen:e.isOpen||T.has(e.id)})}),ce(y),(w=null===(b=null===(R=null===(C=g[0])||void 0===C?void 0:C.variants)||void 0===R?void 0:R[0])||void 0===b?void 0:b.id)?setTimeout(function(){var e=document.querySelector('[data-variant-id="'.concat(w,'"]'));e&&e.scrollIntoView({behavior:"smooth",block:"center"}),setTimeout(function(){return me()},1e4)},500):me()):ce(v),[3,5]):(ce([]),[2]);case 3:return S=t.sent(),console.error("Failed to fetch rule details",S),404!==(null==S?void 0:S.status)&&Fe((null==S?void 0:S.message)||"Failed to load rules. Please try again."),ce([]),[3,5];case 4:return o||Ee(!1),[7];case 5:return[2]}})})},jt=ae?R((null==se?void 0:se.data)||null,ae):null,It=jt?{ruleSetId:jt.id,ruleSetName:jt.name,ruleSetDesc:"",ruleCount:null===(M=null==jt?void 0:jt.metrics)||void 0===M?void 0:M.learningsCount}:void 0,Dt=Boolean(null==se?void 0:se.data),xt=Boolean(ae&&!jt&&Dt),_t=function(){if("stations"===ue)return"custom";if(!jt)return"global";switch(jt.type){case"GLOBAL":default:return"global";case"SCOPE":return"genre";case"SUBSCOPE":case"Custom":return"custom"}},Lt=function(e){var t;if(!e)return o("p",{children:I("".concat(k,".deleteDialog.description"),"Are you sure you want to delete this rule? This action cannot be undone.")});var n=null==de?void 0:de.flatMap(function(e){var t;return null!==(t=e.rules)&&void 0!==t?t:[]}).find(function(t){return t.ruleId===e});return o("p",{children:I("".concat(k,".deleteDialog.description"),"Are you sure you want to delete ".concat(null==n?void 0:n.ruleTitle," rule? This action cannot be undone."),{rule_title:null!==(t=null==n?void 0:n.ruleTitle)&&void 0!==t?t:""})})},kt={editingRule:Ce,editingTier:je,editingVariants:xe,focusedVariantIndex:ke,setFocusedVariantIndex:Oe,triggerAddVariant:Ye,triggerFixGaps:ct,copiedRule:ft,copiedSourceTier:ht,copiedTargetTier:wt,initialDraftMessage:We,app_integration_id:oe,modeId:le};return It?i(l,{children:[o(T,{ref:ge}),o("div",r({className:b.container},{children:Me?o(h,{}):Ve?o(w,{errorMessage:Ve,onRetry:bt}):o(y,{onAddRule:Ct,onDeleteRule:function(e){$e(e)},onEditRule:function(e,t){Re(e),Ie(t||null),_e(e.variants||null),Oe(null),Ze(!0),we(!0)},onEditVariant:function(e,t,n,r){var o,i,l,a,s=null!==(l=null===(i=null===(o=null==de?void 0:de.find(function(e){return e.name===n}))||void 0===o?void 0:o.rules)||void 0===i?void 0:i.find(function(e){return e.ruleId===t}))&&void 0!==l?l:null==de?void 0:de.flatMap(function(e){return e.rules}).find(function(e){return e.ruleId===t});if(s){var u=null===(a=s.variants)||void 0===a?void 0:a.findIndex(function(t){return t.variantId===e.variantId}),c=void 0!==u&&-1!==u?u:0;Re(s),Ie(n||null),_e(s.variants||null),Oe(c),we(!0),"resolve_gaps"===r&&dt(!0)}},onDeleteVariant:function(e,t){it({variantId:e,ruleId:t})},onExportRule:function(){return e(void 0,void 0,void 0,function(){var e,n,r,i,l,a,s;return t(this,function(t){switch(t.label){case 0:if(!ae)return[2];Ue(!0),t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,m(ae)];case 2:return e=t.sent(),n=window.URL.createObjectURL(e),(r=document.createElement("a")).href=n,i=(null==It?void 0:It.ruleSetName)?"".concat(It.ruleSetName.replace(/\s+/g,"_"),"_rules.csv"):"ruleset_".concat(ae,".csv"),r.download=i,document.body.appendChild(r),r.click(),document.body.removeChild(r),window.URL.revokeObjectURL(n),null===(a=ge.current)||void 0===a||a.show({severity:"success",sticky:!1,life:3e3,className:b.successToast,content:o(S,{message:"Ruleset exported successfully!"})}),[3,5];case 3:return l=t.sent(),console.error("Export error:",l),null===(s=ge.current)||void 0===s||s.show({severity:"error",sticky:!1,className:b.errorToast,content:o(C,{message:l.message||"Failed to export ruleset. Please try again."})}),[3,5];case 4:return Ue(!1),[7];case 5:return[2]}})})},isExporting:Pe,onToggleSuccess:function(){return bt(!0)},onReorderRules:function(n,r,i,l,a){return e(void 0,void 0,void 0,function(){var e,s,u;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,g(n,r,i,l,a)];case 1:return t.sent(),bt(!0),null===(s=ge.current)||void 0===s||s.show({severity:"success",sticky:!1,life:3e3,className:b.successToast,content:o(S,{message:"Rule order changed successfully. Future rule applications will follow the updated order."})}),[3,3];case 2:return e=t.sent(),console.error("Failed to reorder rules:",e),bt(!0),null===(u=ge.current)||void 0===u||u.show({severity:"error",sticky:!1,className:b.errorToast,content:o(C,{message:"Failed to update rule order. Please try again."})}),[3,3];case 3:return[2]}})})},onRefreshRuleSets:re,setDeleteConfirmationUsedFor:nt,onCopyToTier:function(e,t,n,r,o){var i,l,a=null===(l=null===(i=null==de?void 0:de.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===t});if(a){var s=["Add a new learning with the following details:","- Rule Title: ".concat(n),"- Description: ".concat(e.description),"- When to apply: ".concat(e.whenToApply),"- When NOT to apply: ".concat(e.whenNotToApply),"- Tier information: ".concat(o)].join("\n");qe(s),vt(a),Tt(r),St(o),Re(null),Ie(null),_e(null),Oe(null),we(!0)}}})})),ye&&o(D,{children:o(x,{isOpen:ye,onClose:Rt,app_integration_id:oe,token:ie,mode:"ADD",baseURL:null==he?void 0:he.BASE_URL,pluginPayload:r(r({},kt),{initialScope:_t(),ruleSet:It})})}),o(j,{isOpen:!!He,title:I("".concat(_,".deleteDialog.title"),Q),description:Lt(He),warning:I("".concat(_,".deleteDialog.warningText"),Y),confirmText:I("".concat(_,".deleteDialog.deleteText"),ne),cancelText:I("".concat(_,".deleteDialog.cancelText"),"Cancel"),loadingText:I("".concat(_,".deleteDialog.loadingText"),"Deleting..."),confirmBgColor:"#EF4444",onConfirm:function(){return e(void 0,void 0,void 0,function(){var e,n,r,i,l;return t(this,function(t){switch(t.label){case 0:if(!He)return[2];Qe(!0),t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,f(He)];case 2:return t.sent(),$e(null),null===(n=ge.current)||void 0===n||n.show({severity:"success",sticky:!1,life:3e3,className:b.successToast,content:o(S,{message:J})}),bt(),re&&re(!1,ae||void 0),[3,5];case 3:return e=t.sent(),console.error("Failed to delete rule",e),null===(r=ge.current)||void 0===r||r.show({severity:"error",sticky:!1,className:b.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)||H})}),[3,5];case 4:return Qe(!1),[7];case 5:return[2]}})})},onCancel:function(){return $e(null)},isLoading:Ke}),o(j,{isOpen:!!ot,title:I("".concat(L,".deleteVariant.title"),Q),description:"variantDeletion"===tt?o("span",{children:I("".concat(L,".deleteVariant.desc"),"Are you sure you want to delete this variant? This action cannot be undone.")}):Lt((null==ot?void 0:ot.ruleId)||null),warning:I("".concat(L,".deleteVariant.warningText"),"ruleDeletion"===tt?Y:ee),confirmText:I("".concat(L,".deleteDialog.deleteText"),ne),cancelText:I("".concat(L,".cancelText"),"Cancel"),loadingText:I("".concat(L,".loadingText"),"Deleting..."),confirmBgColor:"#EF4444",onConfirm:function(){return e(void 0,void 0,void 0,function(){var e,n,r,i,l;return t(this,function(t){switch(t.label){case 0:if(!ot)return[2];st(!0),t.label=1;case 1:return t.trys.push([1,6,7,8]),"ruleDeletion"!==tt?[3,3]:[4,v(ot.ruleId)];case 2:return t.sent(),[3,5];case 3:return[4,f(ot.variantId)];case 4:t.sent(),t.label=5;case 5:return it(null),null===(n=ge.current)||void 0===n||n.show({severity:"success",sticky:!1,life:3e3,className:b.successToast,content:o(S,{message:"ruleDeletion"===tt?J:q})}),bt(),re&&re(!1,ae||void 0),[3,8];case 6:return e=t.sent(),console.error("Failed to delete variant",e),null===(r=ge.current)||void 0===r||r.show({severity:"error",sticky:!1,className:b.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"===tt?H:z)})}),[3,8];case 7:return st(!1),[7];case 8:return[2]}})})},onCancel:function(){return it(null)},isLoading:at})]}):xt?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==re?void 0:re(!0)},retryButtonText:"Refresh"}):i(l,{children:[o(d,{onCreate:Ct,title:N,desc:F,button:P}),ye&&o(D,{children:o(x,{isOpen:ye,onClose:Rt,app_integration_id:oe,token:ie,mode:"ADD",baseURL:null==he?void 0:he.BASE_URL,pluginPayload:r(r({},kt),{initialScope:_t(),ruleSet:It})})})]})};export{A as default};
|
|
2
2
|
//# sourceMappingURL=RuleContent.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e={publishFeedback:"/instant_learning/ilotj/variants",submitChatFeedback:"/instant_learning/ilotj/feedback/teachme_otj",saveInstantLearningQuestion:"/instant_learning/getLearningQuestionId",fetchScopes:"/instant_learning/ilotj/scope",renameScope:"/instant_learning/ilotj/scope",getRulesInRuleSetById:"/instant_learning/ilotj/rules/scope",createRuleSet:"/instant_learning/ilotj/scope",fetchStationsByKeyword:"/backend/traffic-manager/station/search/{keyword}",saveRuleSet:"/backend/traffic-manager/station/ruleset",getRuleOverrideHistory:"/instant_learning/learnings/inheritance/change_log",deleteRuleSet:"/instant_learning/ilotj/scope/{ruleSetId}/{appIntegrationId}",deleteRule:"/instant_learning/ilotj/variant/{ruleId}/{appIntegrationId}",deleteQuestion:"/instant_learning/ilotj/question/{questionId}/{appIntegrationId}",deleteTier:"/instant_learning/ilotj/scope/{scopeId}/tier/{tierId}/{appIntegrationId}",updateVariant:"/instant_learning/v2/update/rule",inheritScope:"/instant_learning/ilotj/inherit-scope",updateStation:"/backend/traffic-manager/station/update",exportRuleSet:"/instant_learning/export-ruleset",toggleVariant:"/instant_learning/ilotj/toggle_variant",alterRulePriority:"/instant_learning/ilotj/alter-priority",fetchRulesByQuestionId:"/instant_learning/ilotj/rules/fetch_by_rule_id/{questionId}/{scopeId}/{appIntegrationId}?include_config=False",retrieveGenreScopes:"/instant_learning/learnings/retrieve_genre_scopes",searchScopes:"/instant_learning/learnings/search_scopes",sessionValidation:"/instant_learning/session-validation",getTiers:"/instant_learning/ilotj/tier/{appIntegrationId}",requestAccess:"/instant_learning/ilotj/request-access",getILInstance:"/instant_learning/ilotj/getData/"},n={submitChatFeedback:"/instant_learning/feedback/teachme_otj",fetchScopes:"/instant_learning/learning/fetch_by_scope/v2?custom_scope_group_name=Audacy-Traffic-Manager",createRuleSet:"/instant_learning/create-scope",deleteRuleSet:"/instant_learning/scope/{ruleSetId}/delete",getRulesInRuleSetById:"/instant_learning/learnings/rules/fetch_by_scope",publishFeedback:"/instant_learning/save",inheritScope:"/instant_learning/learnings/rules/inherit-scope",toggleVariant:"/instant_learning/toggle_variant",getTiers:"/instant_learning/retrieve_tiers",requestAccess:"/instant_learning/request-access",deleteQuestion:"/instant_learning/question/{questionId}",deleteRule:"/instant_learning/learning/{ruleId}/delete",deleteTier:"instant_learning/scopes/{scopeId}/tiers/{tierId}",fetchRulesByQuestionId:"/instant_learning/learnings/rules/fetch_by_rule_id/{questionId}/{scopeId}?include_config=True",renameScope:"/instant_learning/scope",alterRulePriority:"/instant_learning/v2/alterPriority"};export{e as API_ENDPOINTS,n as LEGACY_API_ENDPOINTS};
|
|
1
|
+
var e={publishFeedback:"/instant_learning/ilotj/variants",submitChatFeedback:"/instant_learning/ilotj/feedback/teachme_otj",saveInstantLearningQuestion:"/instant_learning/getLearningQuestionId",fetchScopes:"/instant_learning/ilotj/scope",renameScope:"/instant_learning/ilotj/scope",getRulesInRuleSetById:"/instant_learning/ilotj/rules/scope",createRuleSet:"/instant_learning/ilotj/scope",fetchStationsByKeyword:"/backend/traffic-manager/station/search/{keyword}",saveRuleSet:"/backend/traffic-manager/station/ruleset",getRuleOverrideHistory:"/instant_learning/learnings/inheritance/change_log",deleteRuleSet:"/instant_learning/ilotj/scope/{ruleSetId}/{appIntegrationId}",deleteRule:"/instant_learning/ilotj/variant/{ruleId}/{appIntegrationId}",deleteQuestion:"/instant_learning/ilotj/question/{questionId}/{appIntegrationId}",deleteTier:"/instant_learning/ilotj/scope/{scopeId}/tier/{tierId}/{appIntegrationId}",updateVariant:"/instant_learning/v2/update/rule",inheritScope:"/instant_learning/ilotj/inherit-scope",updateStation:"/backend/traffic-manager/station/update",exportRuleSet:"/instant_learning/export-ruleset",toggleVariant:"/instant_learning/ilotj/toggle_variant",alterRulePriority:"/instant_learning/ilotj/alter-priority",fetchRulesByQuestionId:"/instant_learning/ilotj/rules/fetch_by_rule_id/{questionId}/{scopeId}/{appIntegrationId}?include_config=False",retrieveGenreScopes:"/instant_learning/learnings/retrieve_genre_scopes",searchScopes:"/instant_learning/learnings/search_scopes",sessionValidation:"/instant_learning/session-validation",getTiers:"/instant_learning/ilotj/tier/{appIntegrationId}",requestAccess:"/instant_learning/ilotj/request-access",getILInstance:"/instant_learning/ilotj/getData/",updateVariantStatus:"/instant_learning/scopes/{scopeId}/variants/update_variant_status"},n={submitChatFeedback:"/instant_learning/feedback/teachme_otj",fetchScopes:"/instant_learning/learning/fetch_by_scope/v2?custom_scope_group_name=Audacy-Traffic-Manager",createRuleSet:"/instant_learning/create-scope",deleteRuleSet:"/instant_learning/scope/{ruleSetId}/delete",getRulesInRuleSetById:"/instant_learning/learnings/rules/fetch_by_scope",publishFeedback:"/instant_learning/save",inheritScope:"/instant_learning/learnings/rules/inherit-scope",toggleVariant:"/instant_learning/toggle_variant",getTiers:"/instant_learning/retrieve_tiers",requestAccess:"/instant_learning/request-access",deleteQuestion:"/instant_learning/question/{questionId}",deleteRule:"/instant_learning/learning/{ruleId}/delete",deleteTier:"instant_learning/scopes/{scopeId}/tiers/{tierId}",fetchRulesByQuestionId:"/instant_learning/learnings/rules/fetch_by_rule_id/{questionId}/{scopeId}?include_config=True",renameScope:"/instant_learning/scope",alterRulePriority:"/instant_learning/v2/alterPriority",updateVariantStatus:"/instant_learning/ilotj/variants/update_variant_status"};export{e as API_ENDPOINTS,n as LEGACY_API_ENDPOINTS};
|
|
2
2
|
//# sourceMappingURL=apiConfig.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as t,__assign as r}from"tslib";import n from"axios";import{API_ENDPOINTS as a,LEGACY_API_ENDPOINTS as i}from"./apiConfig.js";import o from"../store/useAuthStore.js";import s from"../store/useEnvStore.js";import{useLearningTemplateStore as c}from"../store/useLearningTemplateStore.js";import{IL_CONFIG_CONSTANTS as u}from"../config.js";var l=function(e){return e.interceptors.request.use(function(e){var t=o.getState().user,r=null==t?void 0:t.accessToken;return r&&(e.headers.Authorization="Bearer ".concat(r)),e}),e},d=function(e,t){return e.interceptors.request.use(function(e){return e.baseURL=t(),e}),e},p=d(l(n.create({headers:{"Content-Type":"application/json"}})),function(){return s.getState().audacyBackendUrl||""}),v=d(l(n.create({headers:{"Content-Type":"application/json"}})),function(){return s.getState().llmStudioUrl||""}),h=d(l(n.create({headers:{"Content-Type":"application/json"}})),function(){return s.getState().appsecRbacUrl||""}),g=d(l(n.create({headers:{"Content-Type":"application/json"}})),function(){return s.getState().appsecBaseUrl||""}),f=function(e){return d(l(n.create({headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(e)},withCredentials:!0})),function(){return s.getState().llmStudioUrl||""})},b=function(r,n){return e(void 0,void 0,void 0,function(){var e,n,o;return t(this,function(t){switch(t.label){case 0:e=c.getState().backwardCompatibility,t.label=1;case 1:return t.trys.push([1,3,,4]),n=e?i.publishFeedback:"".concat(a.publishFeedback),[4,v.post(n,r)];case 2:return[2,t.sent().data];case 3:throw o=t.sent(),console.error("Error publishing feedback to LLM Studio:",o),o;case 4:return[2]}})})},w=function(r){return e(void 0,void 0,void 0,function(){var e,n,o;return t(this,function(t){switch(t.label){case 0:e=c.getState().backwardCompatibility,n=e?i.submitChatFeedback:a.submitChatFeedback,t.label=1;case 1:return t.trys.push([1,3,,4]),[4,v.post(n,r)];case 2:return[2,t.sent().data];case 3:throw o=t.sent(),console.error("Error submitting chat feedback:",o),o;case 4:return[2]}})})},S=function(r){return e(void 0,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,v.post(a.saveInstantLearningQuestion,r)];case 1:return[2,t.sent().data];case 2:throw e=t.sent(),console.error("Error saving instant learning question:",e),e;case 3:return[2]}})})},y=function(r,n){return e(void 0,void 0,void 0,function(){var e,o,s;return t(this,function(t){switch(t.label){case 0:e=c.getState().backwardCompatibility,t.label=1;case 1:if(t.trys.push([1,3,,4]),!r&&!1===e)throw new Error("App Integration ID is not provided. Falling back to legacy endpoint for fetching scopes.");return o=e?i.fetchScopes:"".concat(a.fetchScopes,"/").concat(r),[4,f(n).get(o)];case 2:return[2,t.sent().data];case 3:throw s=t.sent(),console.error("Error fetching rule sets:",s),s;case 4:return[2]}})})},m=function(r,n){return e(void 0,void 0,void 0,function(){var e,o,s;return t(this,function(t){switch(t.label){case 0:e=c.getState().backwardCompatibility,t.label=1;case 1:return t.trys.push([1,3,,4]),o=e?i.renameScope:a.renameScope,[4,f(n).put(o,r)];case 2:return[2,t.sent().data];case 3:throw s=t.sent(),console.error("Error renaming scope:",s),s;case 4:return[2]}})})},_=function(r,n){return e(void 0,void 0,void 0,function(){var e,o,s,u;return t(this,function(t){switch(t.label){case 0:e=c.getState().backwardCompatibility,o=c.getState().app_integration_id,t.label=1;case 1:return t.trys.push([1,3,,4]),s=e?"".concat(i.getRulesInRuleSetById,"/").concat(r,"?include_config=True&sort_variant_by=createdAt"):"".concat(a.getRulesInRuleSetById,"/").concat(r,"/").concat(null!=o?o:""),[4,f(n).get(s)];case 2:return[2,t.sent().data];case 3:return u=t.sent(),console.error("Error fetching rules in rule set:",u),[3,4];case 4:return[2]}})})},I=function(r){return e(void 0,void 0,void 0,function(){var e,n,i,o;return t(this,function(t){switch(t.label){case 0:e=c.getState().backwardCompatibility,n=c.getState().app_integration_id,t.label=1;case 1:return t.trys.push([1,3,,4]),i=e?"".concat(a.getRuleOverrideHistory,"/").concat(r):"".concat(a.getRuleOverrideHistory,"/").concat(r,"/").concat(null!=n?n:""),[4,v.get(i)];case 2:return[2,t.sent().data];case 3:throw o=t.sent(),console.error("Error getting rule override history:",o),o;case 4:return[2]}})})},k=function(r,n){return e(void 0,void 0,void 0,function(){var e,o,s;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e=c.getState().backwardCompatibility,o=e?i.createRuleSet:a.createRuleSet,[4,f(n).post(o,r)];case 1:return[2,t.sent().data];case 2:throw s=t.sent(),console.error("Error creating rule set:",s),s;case 3:return[2]}})})},E=function(r,n){return void 0===n&&(n=!1),e(void 0,void 0,void 0,function(){var e,i;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e="".concat(a.fetchStationsByKeyword.replace("{keyword}",r),"?allow_existing=").concat(n),[4,p.get(e)];case 1:return[2,t.sent().data];case 2:throw i=t.sent(),console.error("Error fetching station name by keyword:",i),i;case 3:return[2]}})})},C=function(r,n){return e(void 0,void 0,void 0,function(){var e,o,s,u;return t(this,function(t){switch(t.label){case 0:e=c.getState().backwardCompatibility,o=c.getState().app_integration_id,t.label=1;case 1:return t.trys.push([1,3,,4]),s=void 0,s=e?i.deleteRuleSet.replace("{ruleSetId}",r):a.deleteRuleSet.replace("{ruleSetId}",r).replace("{appIntegrationId}",null!=o?o:""),[4,f(n).delete(s)];case 2:return[2,t.sent().data];case 3:throw u=t.sent(),console.error("Error deleting rule set:",u),u;case 4:return[2]}})})},R=function(r){return e(void 0,void 0,void 0,function(){var e,n,o,s,u;return t(this,function(t){switch(t.label){case 0:e=c.getState().backwardCompatibility,n=c.getState().app_integration_id,o=c.getState().token,t.label=1;case 1:return t.trys.push([1,6,,7]),e?(s=i.deleteRule.replace("{ruleId}",r),[4,v.delete(s)]):[3,3];case 2:return[2,t.sent().data];case 3:return s=a.deleteRule.replace("{ruleId}",r).replace("{appIntegrationId}",null!=n?n:""),[4,f(o).delete(s)];case 4:return[2,t.sent().data];case 5:return[3,7];case 6:throw u=t.sent(),console.error("Error deleting rule:",u),u;case 7:return[2]}})})},P=function(r){return e(void 0,void 0,void 0,function(){var e,n,o,s,u;return t(this,function(t){switch(t.label){case 0:e=c.getState().backwardCompatibility,n=c.getState().app_integration_id,o=c.getState().token,t.label=1;case 1:return t.trys.push([1,6,,7]),e?(s=i.deleteQuestion.replace("{questionId}",r),[4,v.delete(s)]):[3,3];case 2:return[2,t.sent().data];case 3:return s=a.deleteQuestion.replace("{questionId}",r).replace("{appIntegrationId}",null!=n?n:""),[4,f(o).delete(s)];case 4:return[2,t.sent().data];case 5:return[3,7];case 6:throw u=t.sent(),console.error("Error deleting question:",u),u;case 7:return[2]}})})},T=function(r,n){return e(void 0,void 0,void 0,function(){var e,o,s,u,l;return t(this,function(t){switch(t.label){case 0:e=c.getState().backwardCompatibility,o=c.getState().app_integration_id,s=c.getState().token,t.label=1;case 1:return t.trys.push([1,6,,7]),e?(u=i.deleteTier.replace("{scopeId}",r).replace("{tierId}",n),[4,v.delete(u)]):[3,3];case 2:return[2,t.sent().data];case 3:return u=a.deleteTier.replace("{scopeId}",r).replace("{tierId}",n).replace("{appIntegrationId}",null!=o?o:""),[4,f(s).delete(u)];case 4:return[2,t.sent().data];case 5:return[3,7];case 6:throw l=t.sent(),console.error("Error deleting tier:",l),l;case 7:return[2]}})})},A=function(r,n){return e(void 0,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,v.put(a.updateVariant,r)];case 1:return[2,t.sent().data];case 2:throw e=t.sent(),console.error("Error updating variant:",e),e;case 3:return[2]}})})},q=function(r){return e(void 0,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,v.post(i.inheritScope,r)];case 1:return[2,t.sent().data];case 2:throw e=t.sent(),console.error("Error inheriting scope:",e),e;case 3:return[2]}})})},j=function(r){return e(void 0,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,4,,5]),(null==r?void 0:r.application_mapping_id)?[4,v.post(a.inheritScope,r)]:[3,2];case 1:return[2,t.sent().data];case 2:throw Error("Fatal Error: Trying to call inherit API without appintegration ID");case 3:return[3,5];case 4:throw e=t.sent(),console.error("Error inheriting scope:",e),e;case 5:return[2]}})})},L=function(r){return e(void 0,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:if(!r)throw new Error("scopeId is required for exporting rule sets");t.label=1;case 1:return t.trys.push([1,3,,4]),[4,v.post(a.exportRuleSet,{scope_id:r},{responseType:"blob"})];case 2:return[2,t.sent().data];case 3:throw e=t.sent(),console.error("Error exporting rule set:",e),e;case 4:return[2]}})})},B=function(r,n,o){return e(void 0,void 0,void 0,function(){var e,o,s,u;return t(this,function(t){switch(t.label){case 0:e=c.getState().backwardCompatibility,o=c.getState().app_integration_id,s=c.getState().token,t.label=1;case 1:return t.trys.push([1,6,,7]),e?[4,f(s).patch(i.toggleVariant,{variant_ids:r,is_enabled:n})]:[3,3];case 2:return[2,t.sent().data];case 3:return[4,f(s).patch(a.toggleVariant,{variant_ids:r,application_mapping_id:o,is_enabled:n})];case 4:return[2,t.sent().data];case 5:return[3,7];case 6:throw u=t.sent(),console.error("Error toggling variant status:",u),u;case 7:return[2]}})})},O=function(){return e(void 0,void 0,void 0,function(){var e,r,n,o,s,l,d,p;return t(this,function(t){switch(t.label){case 0:e=c.getState().backwardCompatibility,r=c.getState().app_integration_id,n=c.getState().token,t.label=1;case 1:return t.trys.push([1,6,,7]),e?(o=u.CUSTOM_SCOPE_GROUP_NAME,[4,f(n).post(i.getTiers,{tier_group_name:o})]):[3,3];case 2:return s=t.sent(),c.getState().setTiers((null===(d=s.data)||void 0===d?void 0:d.response)||[]),[3,5];case 3:return[4,f(n).get(a.getTiers.replace("{appIntegrationId}",null!=r?r:""))];case 4:s=t.sent(),"success"===(null===(p=s.data)||void 0===p?void 0:p.status)&&c.getState().setTiers(s.data.data.map(function(e){return{tier_id:e.id,tier_name:e.tier_title,tier_priority:e.tier_priority}})),t.label=5;case 5:return[3,7];case 6:throw l=t.sent(),console.error("Error fetching tiers:",l),l;case 7:return[2]}})})},U=function(r,n,o,s,u){return e(void 0,void 0,void 0,function(){var e,l,d,p,v,h;return t(this,function(t){switch(t.label){case 0:e=c.getState().backwardCompatibility,l=c.getState().app_integration_id,d=c.getState().token,t.label=1;case 1:return t.trys.push([1,3,,4]),p=e?i.alterRulePriority:a.alterRulePriority,v=e?{scopeId:r,tierId:n,move:{movedRuleId:o,prevRuleId:s,nextRuleId:u}}:{scope_id:r,tier_id:n,move:{moved_rule_id:o,prev_rule_id:s,next_rule_id:u},application_mapping_id:l},[4,f(d).put(p,v)];case 2:return[2,t.sent().data];case 3:throw h=t.sent(),console.error("Error altering question priority:",h),h;case 4:return[2]}})})},x=function(r,n){return e(void 0,void 0,void 0,function(){var e,o,s,u,l;return t(this,function(t){switch(t.label){case 0:e=c.getState().backwardCompatibility,o=c.getState().app_integration_id,s=c.getState().token,t.label=1;case 1:return t.trys.push([1,6,,7]),e?(u=i.fetchRulesByQuestionId.replace("{questionId}",r).replace("{scopeId}",n),[4,v.get(u)]):[3,3];case 2:return[2,t.sent().data];case 3:return u=a.fetchRulesByQuestionId.replace("{appIntegrationId}",null!=o?o:"").replace("{questionId}",r).replace("{scopeId}",n),[4,f(s).get(u)];case 4:return[2,t.sent().data];case 5:return[3,7];case 6:throw l=t.sent(),console.error("Error fetching rules by question id:",l),l;case 7:return[2]}})})},z=function(r){return void 0===r&&(r={limit:"50",offset:"0"}),e(void 0,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,v.post(a.retrieveGenreScopes,r)];case 1:return[2,t.sent().data];case 2:throw e=t.sent(),console.error("Error retrieving genre scopes:",e),e;case 3:return[2]}})})},F=function(r){return e(void 0,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,v.post(a.searchScopes,r)];case 1:return[2,t.sent().data];case 2:throw e=t.sent(),console.error("Error searching scopes:",e),e;case 3:return[2]}})})},M=function(r){return e(void 0,void 0,void 0,function(){return t(this,function(e){return[2,new Promise(function(e){setTimeout(function(){e({data:[{stationId:"reetrtdfsds",stationName:"Hot 98.7",stationDesc:"Learnings that apply for Hot 98.7 Station",learningsCount:5},{stationId:"sta-102",stationName:"Smooth Jazz 102.1",stationDesc:"Learnings that apply for Smooth Jazz 102.1 Station",learningsCount:12},{stationId:"sta-103",stationName:"Rock 94",stationDesc:"Learnings that apply for Rock 94 Station",learningsCount:8}]})},500)})]})})},D=function(r,n){return e(void 0,void 0,void 0,function(){var e,a,i,o,s,c,u,l,d,p,v,h,f,b,w,S,y;return t(this,function(t){switch(t.label){case 0:a=(e=n||{}).isPopulateRoles,i=void 0!==a&&a,o=e.isPopulatePermissions,s=void 0!==o&&o,c=e.isPopulateApps,u=void 0!==c&&c,l=e.isPopulateEnvironments,d=void 0!==l&&l,p=e.isPopulateOperations,v=void 0!==p&&p,h=e.isPopulateGroups,f=void 0!==h&&h,b=e.isPopulateOrganization,w=void 0!==b&&b,S=new URLSearchParams({search:r,isPopulateRoles:String(i),isPopulatePermissions:String(s),isPopulateApps:String(u),isPopulateEnvironments:String(d),isPopulateOperations:String(v),isPopulateGroups:String(f),isPopulateOrganization:String(w)}),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,g.get("/api/user/get-by-query-v2?".concat(S.toString()))];case 2:return[2,t.sent().data];case 3:throw y=t.sent(),console.error("Failed to fetch users",y),y;case 4:return[2]}})})},Q=function(r){return void 0===r&&(r={}),e(void 0,void 0,void 0,function(){var e,n,a,i,o,s,c,u,l,d,p,v,g,f,b,w;return t(this,function(t){switch(t.label){case 0:e=r.appId,n=void 0===e?"":e,a=r.name,i=void 0===a?"":a,o=r.user,s=void 0===o?"":o,c=r.isActive,u=void 0===c||c,l=r.page,d=void 0===l?1:l,p=r.limit,v=void 0===p?10:p,g=r.pagination,f=void 0===g||g,b=new URLSearchParams({appId:n,name:i,user:s,isActive:String(u),page:String(d),limit:String(v),pagination:String(f)}),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,h.get("/groups?".concat(b.toString()))];case 2:return[2,t.sent().data];case 3:throw w=t.sent(),console.error("Failed to fetch user groups",w),w;case 4:return[2]}})})},G=function(n){var a=n.variant_ids,i=n.status,o=n.feedback,s=n.scopeId,u=n.is_deleted,l=n.appsecData;return e(void 0,void 0,void 0,function(){var e,n,d;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e=c.getState().app_integration_id,n=r({variant_ids:a,scope_id:s,application_mapping_id:e,status:i,feedback:o||"",is_deleted:null!=u&&u},l&&{appsecData:l}),[4,v.put("instant_learning/ilotj/variants/update_variant_status",n)];case 1:return[2,t.sent().data];case 2:throw d=t.sent(),console.log(d),d;case 3:return[2]}})})},H=function(r){return e(void 0,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,h.get("/roles?appId=".concat(r))];case 1:return[2,t.sent().data];case 2:throw e=t.sent(),console.error(e),e;case 3:return[2]}})})},N=function(r){return e(void 0,void 0,void 0,function(){var e,n,o,s,u,l,d;return t(this,function(t){switch(t.label){case 0:e=c.getState().backwardCompatibility,n=c.getState().app_integration_id,o=c.getState().token,s=window.location.href,u=s.indexOf("/mode"),l=-1!==u?s.substring(u+1):(window.location.pathname+window.location.search).substring(1),t.label=1;case 1:return t.trys.push([1,6,,7]),e?[4,v.post(i.requestAccess,{scope_id:r,mode_learning_endpoint:l})]:[3,3];case 2:return[2,t.sent().data];case 3:return[4,f(o).post(a.requestAccess,{scope_id:r,application_mapping_id:n,mode_learning_endpoint:l})];case 4:return[2,t.sent().data];case 5:return[3,7];case 6:throw d=t.sent(),console.error("Error requesting global scope access:",d),d;case 7:return[2]}})})};function V(n,a,i){var o,s,c,u,l;return e(this,void 0,void 0,function(){var e,d,p,v;return t(this,function(t){switch(t.label){case 0:return[4,fetch("".concat(n,"/instant_learning/ilotj/application/getValueType/").concat(a),{headers:{Authorization:"Bearer ".concat(i)}})];case 1:if(!(e=t.sent()).ok)throw new Error("Failed to fetch LMS config");return[4,e.json()];case 2:return!(d=t.sent())||Array.isArray(d.data)&&0===d.data.length?[2,{lmsConfig:null,teachMeConfig:null,template:null}]:(p=null===(o=d.data[0])||void 0===o?void 0:o.value_type_config,[2,{lmsConfig:(v=null!==(s=null==p?void 0:p.learningManagement)&&void 0!==s?s:null)?r(r({},v),{agents:null!==(c=null==p?void 0:p.agents)&&void 0!==c?c:{}}):null,teachMeConfig:null!==(u=null==p?void 0:p.teachMe)&&void 0!==u?u:null,template:null!==(l=null==p?void 0:p.template)&&void 0!==l?l:null}])}})})}var J=function(r){return e(void 0,void 0,void 0,function(){var e,n;return t(this,function(t){switch(t.label){case 0:e=c.getState().token,t.label=1;case 1:return t.trys.push([1,3,,4]),[4,f(e).get("".concat(a.getILInstance).concat(r))];case 2:return[2,t.sent().data];case 3:throw n=t.sent(),console.error("Error fetching IL instance:",n),n;case 4:return[2]}})})};export{G as ApproveOrRejectVariants,H as GetAppsecRoles,U as alterQuestionPriority,h as appsecApi,g as appsecApigetUser,Q as appsecGetUserGroups,D as appsecGetUsersByQueryLite,p as audacyApi,k as createRuleSet,v as default,P as deleteQuestion,R as deleteRule,C as deleteRuleSet,T as deleteTier,L as exportRuleSet,V as fetchLMSConfig,x as fetchRulesByQuestionId,y as fetchScopes,E as fetchStationsByKeyword,O as fetchTiers,J as getILInstance,I as getRuleOverrideHistory,_ as getRulesInRuleSetById,M as getStationsByScopeId,j as inheritScope,q as inheritScopeBackwardCompatible,f as llmApiWithToken,b as publishFeedback,m as renameScope,N as requestAccess,z as retrieveGenreScopes,S as saveInstantLearningQuestion,F as searchScopes,w as submitChatFeedback,B as toggleVariant,A as updateVariant};
|
|
1
|
+
import{__awaiter as e,__generator as t,__assign as r}from"tslib";import n from"axios";import{API_ENDPOINTS as a,LEGACY_API_ENDPOINTS as i}from"./apiConfig.js";import o from"../store/useAuthStore.js";import s from"../store/useEnvStore.js";import{useLearningTemplateStore as c}from"../store/useLearningTemplateStore.js";import{IL_CONFIG_CONSTANTS as u}from"../config.js";var l=function(e){return e.interceptors.request.use(function(e){var t=o.getState().user,r=null==t?void 0:t.accessToken;return r&&(e.headers.Authorization="Bearer ".concat(r)),e}),e},d=function(e,t){return e.interceptors.request.use(function(e){return e.baseURL=t(),e}),e},p=d(l(n.create({headers:{"Content-Type":"application/json"}})),function(){return s.getState().audacyBackendUrl||""}),v=d(l(n.create({headers:{"Content-Type":"application/json"}})),function(){return s.getState().llmStudioUrl||""}),h=d(l(n.create({headers:{"Content-Type":"application/json"}})),function(){return s.getState().appsecRbacUrl||""}),g=d(l(n.create({headers:{"Content-Type":"application/json"}})),function(){return s.getState().appsecBaseUrl||""}),f=function(e){return d(l(n.create({headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(e)},withCredentials:!0})),function(){return s.getState().llmStudioUrl||""})},b=function(r,n){return e(void 0,void 0,void 0,function(){var e,n,o;return t(this,function(t){switch(t.label){case 0:e=c.getState().backwardCompatibility,t.label=1;case 1:return t.trys.push([1,3,,4]),n=e?i.publishFeedback:"".concat(a.publishFeedback),[4,v.post(n,r)];case 2:return[2,t.sent().data];case 3:throw o=t.sent(),console.error("Error publishing feedback to LLM Studio:",o),o;case 4:return[2]}})})},w=function(r){return e(void 0,void 0,void 0,function(){var e,n,o;return t(this,function(t){switch(t.label){case 0:e=c.getState().backwardCompatibility,n=e?i.submitChatFeedback:a.submitChatFeedback,t.label=1;case 1:return t.trys.push([1,3,,4]),[4,v.post(n,r)];case 2:return[2,t.sent().data];case 3:throw o=t.sent(),console.error("Error submitting chat feedback:",o),o;case 4:return[2]}})})},S=function(r){return e(void 0,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,v.post(a.saveInstantLearningQuestion,r)];case 1:return[2,t.sent().data];case 2:throw e=t.sent(),console.error("Error saving instant learning question:",e),e;case 3:return[2]}})})},y=function(r,n){return e(void 0,void 0,void 0,function(){var e,o,s;return t(this,function(t){switch(t.label){case 0:e=c.getState().backwardCompatibility,t.label=1;case 1:if(t.trys.push([1,3,,4]),!r&&!1===e)throw new Error("App Integration ID is not provided. Falling back to legacy endpoint for fetching scopes.");return o=e?i.fetchScopes:"".concat(a.fetchScopes,"/").concat(r),[4,f(n).get(o)];case 2:return[2,t.sent().data];case 3:throw s=t.sent(),console.error("Error fetching rule sets:",s),s;case 4:return[2]}})})},m=function(r,n){return e(void 0,void 0,void 0,function(){var e,o,s;return t(this,function(t){switch(t.label){case 0:e=c.getState().backwardCompatibility,t.label=1;case 1:return t.trys.push([1,3,,4]),o=e?i.renameScope:a.renameScope,[4,f(n).put(o,r)];case 2:return[2,t.sent().data];case 3:throw s=t.sent(),console.error("Error renaming scope:",s),s;case 4:return[2]}})})},_=function(r,n){return e(void 0,void 0,void 0,function(){var e,o,s,u;return t(this,function(t){switch(t.label){case 0:e=c.getState().backwardCompatibility,o=c.getState().app_integration_id,t.label=1;case 1:return t.trys.push([1,3,,4]),s=e?"".concat(i.getRulesInRuleSetById,"/").concat(r,"?include_config=True&sort_variant_by=createdAt"):"".concat(a.getRulesInRuleSetById,"/").concat(r,"/").concat(null!=o?o:""),[4,f(n).get(s)];case 2:return[2,t.sent().data];case 3:return u=t.sent(),console.error("Error fetching rules in rule set:",u),[3,4];case 4:return[2]}})})},I=function(r){return e(void 0,void 0,void 0,function(){var e,n,i,o;return t(this,function(t){switch(t.label){case 0:e=c.getState().backwardCompatibility,n=c.getState().app_integration_id,t.label=1;case 1:return t.trys.push([1,3,,4]),i=e?"".concat(a.getRuleOverrideHistory,"/").concat(r):"".concat(a.getRuleOverrideHistory,"/").concat(r,"/").concat(null!=n?n:""),[4,v.get(i)];case 2:return[2,t.sent().data];case 3:throw o=t.sent(),console.error("Error getting rule override history:",o),o;case 4:return[2]}})})},k=function(r,n){return e(void 0,void 0,void 0,function(){var e,o,s;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e=c.getState().backwardCompatibility,o=e?i.createRuleSet:a.createRuleSet,[4,f(n).post(o,r)];case 1:return[2,t.sent().data];case 2:throw s=t.sent(),console.error("Error creating rule set:",s),s;case 3:return[2]}})})},C=function(r,n){return void 0===n&&(n=!1),e(void 0,void 0,void 0,function(){var e,i;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e="".concat(a.fetchStationsByKeyword.replace("{keyword}",r),"?allow_existing=").concat(n),[4,p.get(e)];case 1:return[2,t.sent().data];case 2:throw i=t.sent(),console.error("Error fetching station name by keyword:",i),i;case 3:return[2]}})})},E=function(r,n){return e(void 0,void 0,void 0,function(){var e,o,s,u;return t(this,function(t){switch(t.label){case 0:e=c.getState().backwardCompatibility,o=c.getState().app_integration_id,t.label=1;case 1:return t.trys.push([1,3,,4]),s=void 0,s=e?i.deleteRuleSet.replace("{ruleSetId}",r):a.deleteRuleSet.replace("{ruleSetId}",r).replace("{appIntegrationId}",null!=o?o:""),[4,f(n).delete(s)];case 2:return[2,t.sent().data];case 3:throw u=t.sent(),console.error("Error deleting rule set:",u),u;case 4:return[2]}})})},R=function(r){return e(void 0,void 0,void 0,function(){var e,n,o,s,u;return t(this,function(t){switch(t.label){case 0:e=c.getState().backwardCompatibility,n=c.getState().app_integration_id,o=c.getState().token,t.label=1;case 1:return t.trys.push([1,6,,7]),e?(s=i.deleteRule.replace("{ruleId}",r),[4,v.delete(s)]):[3,3];case 2:return[2,t.sent().data];case 3:return s=a.deleteRule.replace("{ruleId}",r).replace("{appIntegrationId}",null!=n?n:""),[4,f(o).delete(s)];case 4:return[2,t.sent().data];case 5:return[3,7];case 6:throw u=t.sent(),console.error("Error deleting rule:",u),u;case 7:return[2]}})})},P=function(r){return e(void 0,void 0,void 0,function(){var e,n,o,s,u;return t(this,function(t){switch(t.label){case 0:e=c.getState().backwardCompatibility,n=c.getState().app_integration_id,o=c.getState().token,t.label=1;case 1:return t.trys.push([1,6,,7]),e?(s=i.deleteQuestion.replace("{questionId}",r),[4,v.delete(s)]):[3,3];case 2:return[2,t.sent().data];case 3:return s=a.deleteQuestion.replace("{questionId}",r).replace("{appIntegrationId}",null!=n?n:""),[4,f(o).delete(s)];case 4:return[2,t.sent().data];case 5:return[3,7];case 6:throw u=t.sent(),console.error("Error deleting question:",u),u;case 7:return[2]}})})},T=function(r,n){return e(void 0,void 0,void 0,function(){var e,o,s,u,l;return t(this,function(t){switch(t.label){case 0:e=c.getState().backwardCompatibility,o=c.getState().app_integration_id,s=c.getState().token,t.label=1;case 1:return t.trys.push([1,6,,7]),e?(u=i.deleteTier.replace("{scopeId}",r).replace("{tierId}",n),[4,v.delete(u)]):[3,3];case 2:return[2,t.sent().data];case 3:return u=a.deleteTier.replace("{scopeId}",r).replace("{tierId}",n).replace("{appIntegrationId}",null!=o?o:""),[4,f(s).delete(u)];case 4:return[2,t.sent().data];case 5:return[3,7];case 6:throw l=t.sent(),console.error("Error deleting tier:",l),l;case 7:return[2]}})})},A=function(r,n){return e(void 0,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,v.put(a.updateVariant,r)];case 1:return[2,t.sent().data];case 2:throw e=t.sent(),console.error("Error updating variant:",e),e;case 3:return[2]}})})},q=function(r){return e(void 0,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,v.post(i.inheritScope,r)];case 1:return[2,t.sent().data];case 2:throw e=t.sent(),console.error("Error inheriting scope:",e),e;case 3:return[2]}})})},L=function(r){return e(void 0,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,4,,5]),(null==r?void 0:r.application_mapping_id)?[4,v.post(a.inheritScope,r)]:[3,2];case 1:return[2,t.sent().data];case 2:throw Error("Fatal Error: Trying to call inherit API without appintegration ID");case 3:return[3,5];case 4:throw e=t.sent(),console.error("Error inheriting scope:",e),e;case 5:return[2]}})})},j=function(r){return e(void 0,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:if(!r)throw new Error("scopeId is required for exporting rule sets");t.label=1;case 1:return t.trys.push([1,3,,4]),[4,v.post(a.exportRuleSet,{scope_id:r},{responseType:"blob"})];case 2:return[2,t.sent().data];case 3:throw e=t.sent(),console.error("Error exporting rule set:",e),e;case 4:return[2]}})})},B=function(r,n,o){return e(void 0,void 0,void 0,function(){var e,o,s,u;return t(this,function(t){switch(t.label){case 0:e=c.getState().backwardCompatibility,o=c.getState().app_integration_id,s=c.getState().token,t.label=1;case 1:return t.trys.push([1,6,,7]),e?[4,f(s).patch(i.toggleVariant,{variant_ids:r,is_enabled:n})]:[3,3];case 2:return[2,t.sent().data];case 3:return[4,f(s).patch(a.toggleVariant,{variant_ids:r,application_mapping_id:o,is_enabled:n})];case 4:return[2,t.sent().data];case 5:return[3,7];case 6:throw u=t.sent(),console.error("Error toggling variant status:",u),u;case 7:return[2]}})})},O=function(){return e(void 0,void 0,void 0,function(){var e,r,n,o,s,l,d,p;return t(this,function(t){switch(t.label){case 0:e=c.getState().backwardCompatibility,r=c.getState().app_integration_id,n=c.getState().token,t.label=1;case 1:return t.trys.push([1,6,,7]),e?(o=u.CUSTOM_SCOPE_GROUP_NAME,[4,f(n).post(i.getTiers,{tier_group_name:o})]):[3,3];case 2:return s=t.sent(),c.getState().setTiers((null===(d=s.data)||void 0===d?void 0:d.response)||[]),[3,5];case 3:return[4,f(n).get(a.getTiers.replace("{appIntegrationId}",null!=r?r:""))];case 4:s=t.sent(),"success"===(null===(p=s.data)||void 0===p?void 0:p.status)&&c.getState().setTiers(s.data.data.map(function(e){return{tier_id:e.id,tier_name:e.tier_title,tier_priority:e.tier_priority}})),t.label=5;case 5:return[3,7];case 6:throw l=t.sent(),console.error("Error fetching tiers:",l),l;case 7:return[2]}})})},U=function(r,n,o,s,u){return e(void 0,void 0,void 0,function(){var e,l,d,p,v,h;return t(this,function(t){switch(t.label){case 0:e=c.getState().backwardCompatibility,l=c.getState().app_integration_id,d=c.getState().token,t.label=1;case 1:return t.trys.push([1,3,,4]),p=e?i.alterRulePriority:a.alterRulePriority,v=e?{scopeId:r,tierId:n,move:{movedRuleId:o,prevRuleId:s,nextRuleId:u}}:{scope_id:r,tier_id:n,move:{moved_rule_id:o,prev_rule_id:s,next_rule_id:u},application_mapping_id:l},[4,f(d).put(p,v)];case 2:return[2,t.sent().data];case 3:throw h=t.sent(),console.error("Error altering question priority:",h),h;case 4:return[2]}})})},x=function(r,n){return e(void 0,void 0,void 0,function(){var e,o,s,u,l;return t(this,function(t){switch(t.label){case 0:e=c.getState().backwardCompatibility,o=c.getState().app_integration_id,s=c.getState().token,t.label=1;case 1:return t.trys.push([1,6,,7]),e?(u=i.fetchRulesByQuestionId.replace("{questionId}",r).replace("{scopeId}",n),[4,v.get(u)]):[3,3];case 2:return[2,t.sent().data];case 3:return u=a.fetchRulesByQuestionId.replace("{appIntegrationId}",null!=o?o:"").replace("{questionId}",r).replace("{scopeId}",n),[4,f(s).get(u)];case 4:return[2,t.sent().data];case 5:return[3,7];case 6:throw l=t.sent(),console.error("Error fetching rules by question id:",l),l;case 7:return[2]}})})},z=function(r){return void 0===r&&(r={limit:"50",offset:"0"}),e(void 0,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,v.post(a.retrieveGenreScopes,r)];case 1:return[2,t.sent().data];case 2:throw e=t.sent(),console.error("Error retrieving genre scopes:",e),e;case 3:return[2]}})})},F=function(r){return e(void 0,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,v.post(a.searchScopes,r)];case 1:return[2,t.sent().data];case 2:throw e=t.sent(),console.error("Error searching scopes:",e),e;case 3:return[2]}})})},D=function(r){return e(void 0,void 0,void 0,function(){return t(this,function(e){return[2,new Promise(function(e){setTimeout(function(){e({data:[{stationId:"reetrtdfsds",stationName:"Hot 98.7",stationDesc:"Learnings that apply for Hot 98.7 Station",learningsCount:5},{stationId:"sta-102",stationName:"Smooth Jazz 102.1",stationDesc:"Learnings that apply for Smooth Jazz 102.1 Station",learningsCount:12},{stationId:"sta-103",stationName:"Rock 94",stationDesc:"Learnings that apply for Rock 94 Station",learningsCount:8}]})},500)})]})})},M=function(r,n){return e(void 0,void 0,void 0,function(){var e,a,i,o,s,c,u,l,d,p,v,h,f,b,w,S,y;return t(this,function(t){switch(t.label){case 0:a=(e=n||{}).isPopulateRoles,i=void 0!==a&&a,o=e.isPopulatePermissions,s=void 0!==o&&o,c=e.isPopulateApps,u=void 0!==c&&c,l=e.isPopulateEnvironments,d=void 0!==l&&l,p=e.isPopulateOperations,v=void 0!==p&&p,h=e.isPopulateGroups,f=void 0!==h&&h,b=e.isPopulateOrganization,w=void 0!==b&&b,S=new URLSearchParams({search:r,isPopulateRoles:String(i),isPopulatePermissions:String(s),isPopulateApps:String(u),isPopulateEnvironments:String(d),isPopulateOperations:String(v),isPopulateGroups:String(f),isPopulateOrganization:String(w)}),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,g.get("/api/user/get-by-query-v2?".concat(S.toString()))];case 2:return[2,t.sent().data];case 3:throw y=t.sent(),console.error("Failed to fetch users",y),y;case 4:return[2]}})})},V=function(r){return void 0===r&&(r={}),e(void 0,void 0,void 0,function(){var e,n,a,i,o,s,c,u,l,d,p,v,g,f,b,w;return t(this,function(t){switch(t.label){case 0:e=r.appId,n=void 0===e?"":e,a=r.name,i=void 0===a?"":a,o=r.user,s=void 0===o?"":o,c=r.isActive,u=void 0===c||c,l=r.page,d=void 0===l?1:l,p=r.limit,v=void 0===p?10:p,g=r.pagination,f=void 0===g||g,b=new URLSearchParams({appId:n,name:i,user:s,isActive:String(u),page:String(d),limit:String(v),pagination:String(f)}),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,h.get("/groups?".concat(b.toString()))];case 2:return[2,t.sent().data];case 3:throw w=t.sent(),console.error("Failed to fetch user groups",w),w;case 4:return[2]}})})},Q=function(n){var o=n.variant_ids,s=n.status,u=n.feedback,l=n.scopeId,d=n.is_deleted,p=n.appsecData;return e(void 0,void 0,void 0,function(){var e,n,h,g,b,w;return t(this,function(t){switch(t.label){case 0:e=c.getState().backwardCompatibility,n=c.getState().app_integration_id,h=c.getState().token,t.label=1;case 1:return t.trys.push([1,6,,7]),e?(g=a.updateVariantStatus.replace("{scopeId}",l),b=r({variant_ids:o,status:s,feedback:u||"",is_deleted:null!=d&&d},p&&{appsecData:p}),[4,f(h).patch(g,b)]):[3,3];case 2:return[2,t.sent().data];case 3:return b=r({variant_ids:o,scope_id:l,application_mapping_id:n,status:s,feedback:u||"",is_deleted:null!=d&&d},p&&{appsecData:p}),[4,v.put(i.updateVariantStatus,b)];case 4:return[2,t.sent().data];case 5:return[3,7];case 6:throw w=t.sent(),console.log(w),w;case 7:return[2]}})})},G=function(r){return e(void 0,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,h.get("/roles?appId=".concat(r))];case 1:return[2,t.sent().data];case 2:throw e=t.sent(),console.error(e),e;case 3:return[2]}})})},H=function(r){return e(void 0,void 0,void 0,function(){var e,n,o,s,u,l,d;return t(this,function(t){switch(t.label){case 0:e=c.getState().backwardCompatibility,n=c.getState().app_integration_id,o=c.getState().token,s=window.location.href,u=s.indexOf("/mode"),l=-1!==u?s.substring(u+1):(window.location.pathname+window.location.search).substring(1),t.label=1;case 1:return t.trys.push([1,6,,7]),e?[4,v.post(i.requestAccess,{scope_id:r,mode_learning_endpoint:l})]:[3,3];case 2:return[2,t.sent().data];case 3:return[4,f(o).post(a.requestAccess,{scope_id:r,application_mapping_id:n,mode_learning_endpoint:l})];case 4:return[2,t.sent().data];case 5:return[3,7];case 6:throw d=t.sent(),console.error("Error requesting global scope access:",d),d;case 7:return[2]}})})};function N(n,a,i){var o,s,c,u,l;return e(this,void 0,void 0,function(){var e,d,p,v;return t(this,function(t){switch(t.label){case 0:return[4,fetch("".concat(n,"/instant_learning/ilotj/application/getValueType/").concat(a),{headers:{Authorization:"Bearer ".concat(i)}})];case 1:if(!(e=t.sent()).ok)throw new Error("Failed to fetch LMS config");return[4,e.json()];case 2:return!(d=t.sent())||Array.isArray(d.data)&&0===d.data.length?[2,{lmsConfig:null,teachMeConfig:null,template:null}]:(p=null===(o=d.data[0])||void 0===o?void 0:o.value_type_config,[2,{lmsConfig:(v=null!==(s=null==p?void 0:p.learningManagement)&&void 0!==s?s:null)?r(r({},v),{agents:null!==(c=null==p?void 0:p.agents)&&void 0!==c?c:{}}):null,teachMeConfig:null!==(u=null==p?void 0:p.teachMe)&&void 0!==u?u:null,template:null!==(l=null==p?void 0:p.template)&&void 0!==l?l:null}])}})})}var J=function(r){return e(void 0,void 0,void 0,function(){var e,n;return t(this,function(t){switch(t.label){case 0:e=c.getState().token,t.label=1;case 1:return t.trys.push([1,3,,4]),[4,f(e).get("".concat(a.getILInstance).concat(r))];case 2:return[2,t.sent().data];case 3:throw n=t.sent(),console.error("Error fetching IL instance:",n),n;case 4:return[2]}})})};export{Q as ApproveOrRejectVariants,G as GetAppsecRoles,U as alterQuestionPriority,h as appsecApi,g as appsecApigetUser,V as appsecGetUserGroups,M as appsecGetUsersByQueryLite,p as audacyApi,k as createRuleSet,v as default,P as deleteQuestion,R as deleteRule,E as deleteRuleSet,T as deleteTier,j as exportRuleSet,N as fetchLMSConfig,x as fetchRulesByQuestionId,y as fetchScopes,C as fetchStationsByKeyword,O as fetchTiers,J as getILInstance,I as getRuleOverrideHistory,_ as getRulesInRuleSetById,D as getStationsByScopeId,L as inheritScope,q as inheritScopeBackwardCompatible,f as llmApiWithToken,b as publishFeedback,m as renameScope,H as requestAccess,z as retrieveGenreScopes,S as saveInstantLearningQuestion,F as searchScopes,w as submitChatFeedback,B as toggleVariant,A as updateVariant};
|
|
2
2
|
//# sourceMappingURL=scopeApis.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e}from"tslib";import{jsx as c,jsxs as i}from"react/jsx-runtime";import{Plus as
|
|
1
|
+
import{__assign as e}from"tslib";import{jsx as c,jsxs as s,Fragment as i}from"react/jsx-runtime";import{Plus as n,Loader2 as t,Check as o,KeyRound as a}from"lucide-react";import l from"../styles/EmptyRuleState.module.css.js";var r=function(r){var d=r.onCreate,u=r.title,m=r.desc,v=r.button,h=r.canCreateRule,p=r.noAccessTitle,N=void 0===p?"You don't have access":p,q=r.noAccessDesc,L=void 0===q?"Request access to create a Global scope for this application.":q,R=r.requestAccessButton,f=void 0===R?"Request Access":R,A=r.requestSentButton,b=void 0===A?"Request Sent":A,g=r.onRequestAccess,z=r.isRequestingAccess,y=void 0!==z&&z,B=r.isAccessRequested,C=void 0!==B&&B,S=!(null!=h&&h),j=y||C;return c("div",e({className:l.container},{children:s("div",e({className:l.card},{children:[s("div",e({className:l.iconContainer},{children:[s("div",e({className:l.iconLines},{children:[c("div",{className:"".concat(l.iconLine," ").concat(l.iconLineLong)}),c("div",{className:"".concat(l.iconLine," ").concat(l.iconLineLong)}),c("div",{className:"".concat(l.iconLine," ").concat(l.iconLineShort)})]})),c("div",e({className:l.iconBadge},{children:c(n,{size:22})}))]})),c("h2",e({className:l.title},{children:S?N:u})),c("p",e({className:l.description},{children:S?L:m})),c("button",e({onClick:S?g:d,className:l.createButton,disabled:j,style:{opacity:j?.6:1,cursor:j?"not-allowed":"pointer"}},{children:s(i,S?y?{children:[c(t,{size:16,className:"animate-spin"})," Requesting..."]}:C?{children:[c(o,{size:16})," ",b]}:{children:[c(a,{size:16})," ",f]}:{children:[c(n,{size:16})," ",v]})}))]}))}))};export{r as default};
|
|
2
2
|
//# sourceMappingURL=EmptyLearningState.js.map
|