@e-llm-studio/instant-learning 1.3.0-alpha.47 → 1.3.0-alpha.49

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.
Files changed (38) hide show
  1. package/dist/cjs/features/LearningManagement/AuditLog/AuditLog.js +1 -1
  2. package/dist/cjs/features/LearningManagement/LearningManagement.js +1 -1
  3. package/dist/cjs/features/LearningManagement/apis/apiConfig.js +1 -1
  4. package/dist/cjs/features/LearningManagement/apis/scopeApis.js +1 -1
  5. package/dist/cjs/features/LearningManagement/assets/Search-result(add new).svg.js +2 -0
  6. package/dist/cjs/features/LearningManagement/assets/Search-result(add new).svg.js.map +1 -0
  7. package/dist/cjs/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.js +2 -0
  8. package/dist/cjs/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.js.map +1 -0
  9. package/dist/cjs/features/LearningManagement/components/StationOnboarding/DayToggleSelector.js +2 -0
  10. package/dist/cjs/features/LearningManagement/components/StationOnboarding/DayToggleSelector.js.map +1 -0
  11. package/dist/cjs/features/LearningManagement/components/StationOnboarding/StationOnboardModal.js +1 -1
  12. package/dist/cjs/features/LearningManagement/store/useEnvStore.js +1 -1
  13. package/dist/features/LearningManagement/AuditLog/AuditLog.js +1 -1
  14. package/dist/features/LearningManagement/LearningManagement.js +1 -1
  15. package/dist/features/LearningManagement/apis/apiConfig.js +1 -1
  16. package/dist/features/LearningManagement/apis/scopeApis.js +1 -1
  17. package/dist/features/LearningManagement/assets/Search-result(add new).svg.js +2 -0
  18. package/dist/features/LearningManagement/assets/Search-result(add new).svg.js.map +1 -0
  19. package/dist/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.js +2 -0
  20. package/dist/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.js.map +1 -0
  21. package/dist/features/LearningManagement/components/StationOnboarding/DayToggleSelector.js +2 -0
  22. package/dist/features/LearningManagement/components/StationOnboarding/DayToggleSelector.js.map +1 -0
  23. package/dist/features/LearningManagement/components/StationOnboarding/StationOnboardModal.js +1 -1
  24. package/dist/features/LearningManagement/store/useEnvStore.js +1 -1
  25. package/dist/types/src/features/LearningManagement/LearningManagement.d.ts +6 -1
  26. package/dist/types/src/features/LearningManagement/LearningManagement.d.ts.map +1 -1
  27. package/dist/types/src/features/LearningManagement/LearningManagementTest.d.ts.map +1 -1
  28. package/dist/types/src/features/LearningManagement/apis/apiConfig.d.ts +1 -0
  29. package/dist/types/src/features/LearningManagement/apis/apiConfig.d.ts.map +1 -1
  30. package/dist/types/src/features/LearningManagement/apis/scopeApis.d.ts.map +1 -1
  31. package/dist/types/src/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.d.ts +12 -0
  32. package/dist/types/src/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.d.ts.map +1 -0
  33. package/dist/types/src/features/LearningManagement/components/StationOnboarding/DayToggleSelector.d.ts +13 -0
  34. package/dist/types/src/features/LearningManagement/components/StationOnboarding/DayToggleSelector.d.ts.map +1 -0
  35. package/dist/types/src/features/LearningManagement/components/StationOnboarding/StationOnboardModal.d.ts.map +1 -1
  36. package/dist/types/src/features/LearningManagement/store/useEnvStore.d.ts +2 -0
  37. package/dist/types/src/features/LearningManagement/store/useEnvStore.d.ts.map +1 -1
  38. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),i=require("react"),o=require("@e-llm-studio/audit-log");require("@e-llm-studio/audit-log/dist/styles.css");var n=require("lucide-react"),a=require("./ChangeLogDiff.js"),s=require("../store/useLMSConfigStore.js"),r=require("../RBAC/AccessPanel.module.css.js"),l=require("../store/usePermissionsStore.js"),c=require("../store/useEnvStore.js"),d=require("../store/useConfigStore.js");exports.default=function(u){var g=u.configId,p=u.ruleData,h=u.scopeId,x=u.scopeName,f=(null==x?void 0:x.trim())||"Selected",m=i.useState("scope"),b=m[0],y=m[1],_=d.useConfigStore.getState().configuration,v=l.usePermissionsStore(function(e){return e.hasPermission}),S=c.default(function(e){var t;return(null===(t=e.rbacConfig)||void 0===t?void 0:t.applicationResourceId)||""}),j=Boolean(h&&v("ilotj.scope.changeLog.view",h)),C=Boolean(S&&v("ilotj.application.changeLog.view",S)),w=i.useMemo(function(){var e=[];return h&&e.push(h),e},[p,h]);i.useEffect(function(){console.log("Flattened External Resource IDs:",w)},[w]);var A={configId:g,getData:{baseUrl:_.BASE_APPMOD_URL||"https://dev.appmod.ai",endpoint:"/changelog/audit-log/fetch"},distinctValuesApi:{baseUrl:_.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.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[t.jsx(n.User,{size:16,color:"#64748b",style:{flexShrink:0}}),t.jsx("span",e.__assign({style:{fontWeight:500}},{children:i.modifiedBy}))]}))},style:{width:"15%",minWidth:"140px"}},{key:"changeAction",header:"Action",body:function(i){var o,n,a=(o=i.changeTitle,(n=(o||"").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)"}),s=i.changeTitle?i.changeTitle.replace(/_/g," "):"—";return t.jsx("span",e.__assign({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:s}))},style:{width:"15%",textAlign:"center"}},{key:"customChangeSummary",header:"Change Summary",body:function(e){var i;return t.jsx(a.default,{change:null!==(i=e.actionText)&&void 0!==i?i:"-"})},style:{width:"30%",minWidth:"200px"}},{key:"redirectLink",header:"Link",body:function(i){var o,a=(null===(o=i.metadata)||void 0===o?void 0:o.redirect_url)||i.redirect_url;return a?t.jsx("div",e.__assign({style:{display:"flex",justifyContent:"center",alignItems:"center"}},{children:t.jsxs("a",e.__assign({href:a,target:"_blank",rel:"noopener noreferrer",style:{display:"flex",alignItems:"center",gap:"6px",color:"#2563eb",textDecoration:"none",fontWeight:500,fontSize:"13px"}},{children:["View ",t.jsx(n.ExternalLink,{size:14})]}))})):t.jsx("span",e.__assign({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 t.jsx("span",e.__assign({style:{color:"#94a3b8"}},{children:"—"}));var o=new Date(i.actionDate),n=o.toLocaleDateString("en-US",{month:"short",day:"2-digit",year:"numeric"}),a=o.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"});return t.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"4px",fontSize:"13px",color:"#475569"}},{children:[t.jsx("span",e.__assign({style:{fontWeight:500}},{children:n})),t.jsx("span",{children:a})]}))},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.jsxs("div",e.__assign({style:{padding:"24px",fontFamily:"Arial, sans-serif"}},{children:[t.jsxs("div",e.__assign({style:{marginBottom:"16px",paddingBottom:"4px"}},{children:[t.jsx("h1",e.__assign({style:{margin:0,color:"#334155",fontSize:"20px",fontWeight:700,lineHeight:1.25}},{children:s.dt("history.title","".concat(f," - Audit Log"),{scope_name:f})})),t.jsx("p",e.__assign({style:{margin:"8px 0 0",color:"#667085",fontSize:"16px",fontWeight:500,lineHeight:1}},{children:s.dt("history.subtitle","Track all learning updates and modifications with the ".concat(f," scope."),{scope_name:f})}))]})),t.jsxs("div",e.__assign({className:r.default.accessTabs,role:"tablist","aria-label":"Audit log level"},{children:[t.jsx("button",e.__assign({type:"button",role:"tab","aria-selected":"scope"===b,className:"".concat(r.default.accessTab," ").concat("scope"===b?r.default.accessTabActive:""),onClick:function(){return y("scope")},disabled:!j,title:j?"":"You do not have permission to view scope level change log"},{children:s.dt("history.scopeLevel","Scope Level")})),t.jsx("button",e.__assign({type:"button",role:"tab","aria-selected":"application"===b,className:"".concat(r.default.accessTab," ").concat("application"===b?r.default.accessTabActive:""),onClick:function(){return y("application")},disabled:!C,title:C?"":"You do not have permission to view application level change log"},{children:s.dt("history.applicationLevel","Application Level")}))]})),"scope"===b?t.jsx(o.AuditLog,e.__assign({},A,{query:{externalResourceId:w.length>0?w:[""],paginationLimit:10}}),"scope-audit-log"):t.jsx(o.AuditLog,e.__assign({},A,{query:{externalResourceId:[],paginationLimit:10}}),"application-audit-log")]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),i=require("react"),o=require("@e-llm-studio/audit-log");require("@e-llm-studio/audit-log/dist/styles.css");var n=require("lucide-react"),a=require("./ChangeLogDiff.js"),s=require("../store/useLMSConfigStore.js"),r=require("../RBAC/AccessPanel.module.css.js"),l=require("../store/usePermissionsStore.js"),c=require("../store/useEnvStore.js"),d=require("../store/useConfigStore.js");exports.default=function(u){var g=u.configId,p=u.ruleData,h=u.scopeId,x=u.scopeName,f=(null==x?void 0:x.trim())||"Selected",m=i.useState("scope"),b=m[0],y=m[1];d.useConfigStore.getState().configuration;var v=l.usePermissionsStore(function(e){return e.hasPermission}),_=c.default(function(e){var t;return(null===(t=e.rbacConfig)||void 0===t?void 0:t.applicationResourceId)||""}),w=Boolean(h&&v("ilotj.scope.changeLog.view",h)),j=Boolean(_&&v("ilotj.application.changeLog.view",_)),S=i.useMemo(function(){var e=[];return h&&e.push(h),e},[p,h]);i.useEffect(function(){console.log("Flattened External Resource IDs:",S)},[S]);var C={configId:g,getData:{baseUrl:window.location.origin.includes("local")?"https://dev.appmod.ai":window.location.origin,endpoint:"/changelog/audit-log/fetch"},distinctValuesApi:{baseUrl:window.location.origin.includes("local")?"https://dev.appmod.ai":window.location.origin,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.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[t.jsx(n.User,{size:16,color:"#64748b",style:{flexShrink:0}}),t.jsx("span",e.__assign({style:{fontWeight:500}},{children:i.modifiedBy}))]}))},style:{width:"15%",minWidth:"140px"}},{key:"changeAction",header:"Action",body:function(i){var o,n,a=(o=i.changeTitle,(n=(o||"").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)"}),s=i.changeTitle?i.changeTitle.replace(/_/g," "):"—";return t.jsx("span",e.__assign({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:s}))},style:{width:"15%",textAlign:"center"}},{key:"customChangeSummary",header:"Change Summary",body:function(e){var i;return t.jsx(a.default,{change:null!==(i=e.actionText)&&void 0!==i?i:"-"})},style:{width:"30%",minWidth:"200px"}},{key:"redirectLink",header:"Link",body:function(i){var o,a=(null===(o=i.metadata)||void 0===o?void 0:o.redirect_url)||i.redirect_url;return a?t.jsx("div",e.__assign({style:{display:"flex",justifyContent:"center",alignItems:"center"}},{children:t.jsxs("a",e.__assign({href:a,target:"_blank",rel:"noopener noreferrer",style:{display:"flex",alignItems:"center",gap:"6px",color:"#2563eb",textDecoration:"none",fontWeight:500,fontSize:"13px"}},{children:["View ",t.jsx(n.ExternalLink,{size:14})]}))})):t.jsx("span",e.__assign({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 t.jsx("span",e.__assign({style:{color:"#94a3b8"}},{children:"—"}));var o=new Date(i.actionDate),n=o.toLocaleDateString("en-US",{month:"short",day:"2-digit",year:"numeric"}),a=o.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"});return t.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"4px",fontSize:"13px",color:"#475569"}},{children:[t.jsx("span",e.__assign({style:{fontWeight:500}},{children:n})),t.jsx("span",{children:a})]}))},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.jsxs("div",e.__assign({style:{padding:"24px",fontFamily:"Arial, sans-serif"}},{children:[t.jsxs("div",e.__assign({style:{marginBottom:"16px",paddingBottom:"4px"}},{children:[t.jsx("h1",e.__assign({style:{margin:0,color:"#334155",fontSize:"20px",fontWeight:700,lineHeight:1.25}},{children:s.dt("history.title","".concat(f," - Audit Log"),{scope_name:f})})),t.jsx("p",e.__assign({style:{margin:"8px 0 0",color:"#667085",fontSize:"16px",fontWeight:500,lineHeight:1}},{children:s.dt("history.subtitle","Track all learning updates and modifications with the ".concat(f," scope."),{scope_name:f})}))]})),t.jsxs("div",e.__assign({className:r.default.accessTabs,role:"tablist","aria-label":"Audit log level"},{children:[t.jsx("button",e.__assign({type:"button",role:"tab","aria-selected":"scope"===b,className:"".concat(r.default.accessTab," ").concat("scope"===b?r.default.accessTabActive:""),onClick:function(){return y("scope")},disabled:!w,title:w?"":"You do not have permission to view scope level change log"},{children:s.dt("history.scopeLevel","Scope Level")})),t.jsx("button",e.__assign({type:"button",role:"tab","aria-selected":"application"===b,className:"".concat(r.default.accessTab," ").concat("application"===b?r.default.accessTabActive:""),onClick:function(){return y("application")},disabled:!j,title:j?"":"You do not have permission to view application level change log"},{children:s.dt("history.applicationLevel","Application Level")}))]})),"scope"===b?t.jsx(o.AuditLog,e.__assign({},C,{query:{externalResourceId:S.length>0?S:[""],paginationLimit:10}}),"scope-audit-log"):t.jsx(o.AuditLog,e.__assign({},C,{query:{externalResourceId:[],paginationLimit:10}}),"application-audit-log")]}))};
2
2
  //# sourceMappingURL=AuditLog.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),n=require("react"),r=require("lucide-react"),s=require("./store/useLearningTemplateStore.js"),a=require("primereact/toast"),i=require("./styles/LearningTemplateManagement.module.css.js"),o=require("./LearningTemplateLayout.js"),l=require("./components/EmptyLearningState.js"),u=require("./store/useAuthStore.js"),c=require("./apis/scopeApis.js"),d=require("./hooks/useLearningTemplateQueryParams.js"),p=require("./components/ConfirmationModal.js"),g=require("./components/LearningTemplateManagementSkeleton.js"),f=require("./utils/treeUtils.js"),_=require("./store/useEnvStore.js"),S=require("./store/useConfigStore.js"),m=require("./components/ToolTip.js"),v=require("./components/CreateRuleSetLegacyModal.js"),T=require("./store/usePermissionsStore.js"),h=require("./store/useAppSecRolesStore.js"),y=require("./queries/useApprovalQueries.js"),E=require("./queries/useLMSConfigQuery.js"),A=require("./RuleContent/AddScopeModal.js"),b=require("./components/RuleContentSkeleton.js"),L=require("./components/ErrorStateDisplay.js"),C=require("react-router-dom"),R=require("./shared/SuccessToastContent.js"),D=require("./shared/ErrorToastContent.js"),j=require("./RuleContent/RenameScopeModal.js"),I=require("./store/useLMSConfigStore.js"),P=require("./constants.js");exports.default=function(q){var w,M,O,N=this,x=q.userDetails,k=q.llmStudioUrl,B=q.audacyBackendUrl,U=q.ilLabels,H=q.config,Y=q.rbacConfig,G=q.auditLogConfig,F=q.app_integration_id,Q=q.backwardCompatibility,W=void 0!==Q&&Q,K=q.modeId,z=s.useLearningTemplateStore(function(e){return e.selectedRuleSetId}),V=s.useLearningTemplateStore(function(e){return e.setSelectedRuleSetId}),X=s.useLearningTemplateStore(function(e){return e.error}),J=s.useLearningTemplateStore(function(e){return e.setError}),Z=s.useLearningTemplateStore(function(e){return e.setStations}),$=s.useLearningTemplateStore(function(e){return e.scopeTreeData}),ee=s.useLearningTemplateStore(function(e){return e.setScopeTreeData}),te=n.useState({isOpen:!1,type:"GLOBAL"}),ne=te[0],re=te[1],se=n.useState(!1),ae=se[0],ie=se[1],oe=n.useState(!1),le=oe[0],ue=oe[1],ce=n.useState("learnings"),de=ce[0],pe=ce[1],ge=n.useState(null),fe=ge[0],_e=ge[1],Se=n.useState(null),me=Se[0],ve=Se[1],Te=n.useState(!1),he=Te[0],ye=Te[1],Ee=n.useState(!1),Ae=Ee[0],be=Ee[1],Le=n.useRef(null),Ce=n.useRef(null),Re=n.useRef(!1),De=n.useRef(null),je=u.default();je.user;var Ie=je.setUser,Pe=S.useConfigStore(),qe=Pe.setConfig,we=Pe.setIlLabels,Me=function(){try{return C.useLocation()}catch(e){return{search:""}}}();n.useEffect(function(){if(!Re.current){var e=new URLSearchParams(window.location.search),t=e.get(d.QUERY_PARAM_KEYS.RULESET_ID),n=e.get(d.QUERY_PARAM_KEYS.SECTION),r=n&&tt.has(n)?n:"learnings";(null==t?void 0:t.length)&&V&&pe&&(V(t),pe(r),Re.current=!0)}},[null==Me?void 0:Me.search,pe,V]);var Oe=T.usePermissionsStore(function(e){return e.fetchPermissions}),Ne=T.usePermissionsStore(function(e){return e.hasPermission}),xe=h.useAppSecRolesStore(function(e){return e.setRoles}),ke=_.default(function(e){return e.appsecRbacUrl})===Y.appsecRbacUrl,Be=y.useGetAppSecRolesQuery(Y.applicationId,ke).data,Ue=E.useLMSConfigQuery(null!=F?F:"",W),He=Ue.isLoading,Ye=Ue.isError,Ge=Ue.refetch;Ue.isSuccess;var Fe=n.useState(0),Qe=Fe[0],We=Fe[1];n.useEffect(function(){if(!W&&F&&k){e.__awaiter(N,void 0,void 0,function(){var t,n,r,s,a,i;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,c.getILInstance(F)];case 1:return t=e.sent(),"number"==typeof(n=null===(i=null===(a=null===(s=null==t?void 0:t.data)||void 0===s?void 0:s.learningManagement)||void 0===a?void 0:a.scopeAndHierarchy)||void 0===i?void 0:i.maxHierarchyLevels)&&n>0&&We(n-1),[3,3];case 2:return r=e.sent(),console.error("Failed to fetch IL instance for hierarchy levels:",r),[3,3];case 3:return[2]}})})}},[F,k]),n.useEffect(function(){Be&&xe(Be.map(function(e){return{_id:e._id,name:e.name}}))},[Be,xe]),n.useEffect(function(){var e;console.log("userDetails",x),Ie(x),console.log("llmStudioUrl",k),console.log("audacyBackendUrl",B),_.default.getState().setLlmStudioUrl(k),_.default.getState().setAudacyBackendUrl(B),_.default.getState().setRbacConfig(Y),_.default.getState().setAuditLogConfig(G),qe(H),we(U),s.useLearningTemplateStore.getState().setAppIntegrationId(null!=F?F:null),s.useLearningTemplateStore.getState().setBackwardCompatibility(W),s.useLearningTemplateStore.getState().setToken(null!==(e=null==x?void 0:x.accessToken)&&void 0!==e?e:null)},[x,Ie,k,B,Y,G,H,qe,U,we,F,W]),n.useEffect(function(){(null==x?void 0:x.accessToken)&&k&&c.fetchTiers()},[F,null==x?void 0:x.accessToken,k]);var Ke=function(t){return void 0===t&&(t=!0),e.__awaiter(N,void 0,void 0,function(){var n,r,a,i,o,l,u,d;return e.__generator(this,function(p){switch(p.label){case 0:t&&ie(!0),J(null),p.label=1;case 1:return p.trys.push([1,4,5,6]),[4,Oe(Y.applicationId)];case 2:return p.sent(),n=function(t){if(!T.usePermissionsStore.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.__assign(e.__assign({},t),{children:r})},[4,c.fetchScopes(F,x.accessToken)];case 3:return(r=p.sent())&&r.data&&r.data.data&&(a=r.data.data,Array.isArray(a)&&(a=a.length>0?a[0]:null),a?(i=n(a))?(_e(null),ee({data:i}),Ce.current?(V(Ce.current),pe("learnings"),Ce.current=null):(o=s.useLearningTemplateStore.getState().selectedRuleSetId,l=o?f.findNodeById(i,o):null,o&&l||V(i.id))):(_e(null!==(d=a.id)&&void 0!==d?d:null),ee(null)):(_e(null),ee(null))),[3,6];case 4:return u=p.sent(),console.error("Failed to fetch rule sets or permissions",u),J("Failed to load data. Please try again later."),[3,6];case 5:return ie(!1),[7];case 6:return[2]}})})};n.useEffect(function(){var e;(null===(e=null==x?void 0:x.accessToken)||void 0===e?void 0:e.length)&&ke?Ke(!0):console.warn("Error: Trying to fetch rules without access token",x)},[null==x?void 0:x.accessToken,J,Z,Y.applicationId,ke]);var ze=function(t,n,r){return e.__awaiter(N,void 0,void 0,function(){var n,r,a,i,o,l,u,d;return e.__generator(this,function(p){switch(p.label){case 0:ue(!0),p.label=1;case 1:return p.trys.push([1,4,5,6]),[4,c.deleteRuleSet(t,x.accessToken)];case 2:return p.sent(),s.useLearningTemplateStore.getState().selectedRuleSetId===t&&(n=s.useLearningTemplateStore.getState().scopeTreeData,(r=f.findNodePathById((null==n?void 0:n.data)||null,t))&&r.length>1&&(a=r[r.length-2],V(a),pe("learnings"))),[4,Ke(!0)];case 3:return p.sent(),re(function(t){return e.__assign(e.__assign({},t),{isOpen:!1})}),null===(o=De.current)||void 0===o||o.show({severity:"success",summary:"Deleted Successfully",detail:"The scope was permanently removed."}),[3,6];case 4:return i=p.sent(),console.error("An error occurred during scope deletion.",i),null===(l=De.current)||void 0===l||l.show({severity:"error",summary:"Delete Failed",detail:(null===(d=null===(u=null==i?void 0:i.response)||void 0===u?void 0:u.data)||void 0===d?void 0:d.message)||"There was an error deleting the scope. Please try again."}),[3,6];case 5:return ue(!1),[7];case 6:return[2]}})})},Ve=$,Xe=me?{data:{id:me.stationId,name:me.stationName,type:"STATION",metrics:{learningsCount:me.learningsCount,stationsCount:0},children:[]}}:Ve,Je=!!(null==Xe?void 0:Xe.data);null===(w=null==Xe?void 0:Xe.data)||void 0===w||w.type;var Ze=T.usePermissionsStore(function(e){return e.hasGlobalPermission})("ilotj.scope.global.create",Y.applicationResourceId||"");if(He)return t.jsx("div",e.__assign({className:i.default.learningManagementContainer},{children:t.jsx(b.default,{})}));if(Ye)return t.jsx("div",e.__assign({className:i.default.learningManagementContainer},{children:t.jsx(L.default,{errorMessage:"Failed to load configuration. Please try again.",onRetry:function(){return Ge()},title:"Error Loading Configuration"})}));var $e=e.__spreadArray(e.__spreadArray([{type:"GLOBAL",label:"Global",addChildLabel:"".concat(I.dt("".concat(P.MIDDLE_DRAWER_DT_PATH,".addScope"),"Add Scope")),addChildType:"SCOPE"}],Array.from({length:Qe},function(){return e.__assign({type:"SCOPE",label:I.dt("".concat(P.MIDDLE_DRAWER_DT_PATH,".scope"),"Scope")},!W&&{addChildLabel:I.dt("".concat(P.MIDDLE_DRAWER_CONTEXT_MENU_DT_PATH,".addSubScope"),"Add Subscope"),addChildType:"SUBSCOPE"})}),!0),W?[]:[{type:"SUBSCOPE",label:I.dt("".concat(P.MIDDLE_DRAWER_DT_PATH,".subScope"),"Subscope")}],!0),et=[{id:"learnings",label:I.dt("".concat(P.MIDDLE_DRAWER_DT_PATH,".treeMenu.submenu.learnings"),"Learnings"),icon:r.BookOpen,badgeKey:"learningsCount"},{id:"access",label:I.dt("".concat(P.MIDDLE_DRAWER_DT_PATH,".treeMenu.submenu.access"),"Access"),icon:r.Users},{id:"history",label:I.dt("".concat(P.MIDDLE_DRAWER_DT_PATH,".treeMenu.submenu.changeHistory"),"Change History"),icon:r.History}],tt=new Set(et.map(function(e){return e.id})),nt=me?et.filter(function(e){return"stations"!==e.id}):et;return t.jsx(m.TooltipProvider,{children:t.jsxs("div",e.__assign({className:i.default.learningManagementContainer},{children:[t.jsx("div",e.__assign({className:i.default.mainWrapper},{children:ae?t.jsx(g.default,{}):X?t.jsxs("div",e.__assign({className:i.default.errorContainer},{children:[t.jsx("div",e.__assign({className:i.default.errorTitle},{children:"Error Loading Data"})),t.jsx("p",e.__assign({className:i.default.errorDesc},{children:X})),t.jsx("button",e.__assign({onClick:function(){return Ke(!0)},className:i.default.tryAgainBtn},{children:"Try Again"}))]})):Je?t.jsx(o.default,{onOpenCreateModal:function(){return re({isOpen:!0,type:"GLOBAL"})},onAddChild:function(e,t,n){return re({isOpen:!0,type:t,parentId:e,parentName:n})},onRenameChild:function(e,t){return re({isOpen:!0,type:"RENAME",scopeId:e,initialName:t})},onDeleteChild:function(t,n,r){return e.__awaiter(N,void 0,void 0,function(){var a,i,o;return e.__generator(this,function(e){switch(e.label){case 0:return a=s.useLearningTemplateStore.getState().scopeTreeData,i=f.findNodePathById((null==a?void 0:a.data)||null,t),o=!!i&&3===i.length,0!==r?[3,2]:[4,ze(t)];case 1:return e.sent(),[3,3];case 2:re({isOpen:!0,type:"DELETE",scopeId:t,initialName:n,isSubscope:o}),e.label=3;case 3:return[2]}})})},canDeleteScope:function(e){return Ne("ilotj.scope.delete",e)},canEditScope:function(e){return Ne("ilotj.scope.edit",e)},canCreateScope:function(e){return Ne("ilotj.scope.create",e)},onSectionSelect:function(e,t){var n;console.log("Section Selected:",{scopeId:e,sectionId:t}),d.setQueryParams(((n={})[d.QUERY_PARAM_KEYS.SECTION]="learnings"===t?null:t,n[d.QUERY_PARAM_KEYS.RULESET_ID]=e,n)),pe(t),V(e)},activeSectionId:de,scopeTreeData:Xe,sectionsConfig:nt,onViewStation:function(e){Le.current=z,ve(e),pe("learnings"),V(e.stationId)},onRefreshRuleSets:function(e,t){void 0===e&&(e=!0),t&&(Ce.current=t),Ke(e)},nodeTypesConfig:$e,app_integration_id:F,token:x.accessToken,modeId:K}):t.jsx(l.default,{onCreate:function(){return re({isOpen:!0,type:"GLOBAL"})},title:I.dt("".concat(P.EMPTY_STATE_DT_PATH,".title"),"No Global Scope has been added!"),desc:I.dt("".concat(P.EMPTY_STATE_DT_PATH,".desc"),"Start by creating a Global scope to define base learnings that apply across all stations."),button:I.dt("".concat(P.EMPTY_STATE_DT_PATH,".createGlobalScope"),"Create Global Scope"),canCreateRule:Ze,noAccessTitle:I.dt("".concat(P.EMPTY_STATE_DT_PATH,".noAccessTitle"),"Access Restricted"),noAccessDesc:I.dt("".concat(P.EMPTY_STATE_DT_PATH,".noAccessDesc"),"You do not have access for this application."),requestAccessButton:I.dt("".concat(P.EMPTY_STATE_DT_PATH,".requestAccessButton"),"Request Access"),requestSentButton:I.dt("".concat(P.EMPTY_STATE_DT_PATH,".requestSentButton"),"Request Sent"),onRequestAccess:function(){return e.__awaiter(N,void 0,void 0,function(){var n,r,a,o,l,u,d,p,g;return e.__generator(this,function(e){switch(e.label){case 0:if(!(n=(null===(o=null===(a=s.useLearningTemplateStore.getState().scopeTreeData)||void 0===a?void 0:a.data)||void 0===o?void 0:o.id)||fe))return null===(l=De.current)||void 0===l||l.show({severity:"error",sticky:!1,className:i.default.errorToast,content:t.jsx(D.default,{message:"Unable to identify the global scope for this access request."})}),[2];ye(!0),e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,c.requestAccess(n)];case 2:return e.sent(),be(!0),null===(u=De.current)||void 0===u||u.show({severity:"success",sticky:!1,life:3e3,className:i.default.successToast,content:t.jsx(R.default,{message:"Access request submitted successfully!"})}),[3,5];case 3:return r=e.sent(),null===(d=De.current)||void 0===d||d.show({severity:"error",sticky:!1,className:i.default.errorToast,content:t.jsx(D.default,{message:(null===(g=null===(p=null==r?void 0:r.response)||void 0===p?void 0:p.data)||void 0===g?void 0:g.detail)||"Failed to request access. Please try again."})}),[3,5];case 4:return ye(!1),[7];case 5:return[2]}})})},isRequestingAccess:he,isAccessRequested:Ae})})),t.jsx(a.Toast,{ref:De,pt:{root:{style:{zIndex:9999}}}}),W&&ne.isOpen&&"DELETE"!==ne.type&&"RENAME"!==ne.type?t.jsx(v.default,{isOpen:!0,onClose:function(){return re(e.__assign(e.__assign({},ne),{isOpen:!1}))},onSubmit:function(t){return e.__awaiter(N,void 0,void 0,function(){var n,r,a,i,o,l,u,d,p,g,f,_,S,m,v,T,h,y,E,A;return e.__generator(this,function(b){switch(b.label){case 0:ue(!0),n=s.useLearningTemplateStore.getState().backwardCompatibility,b.label=1;case 1:return b.trys.push([1,12,13,14]),r=void 0,n&&"object"==typeof t?r=t:(a=t,i="SCOPE"===ne.type&&ne.parentId,o=i?"genreRuleSet":ne.type,r={topic:o,scope_reference_id:null,scopeDescription:"demo",parentScopeId:ne.parentId||null,scopeName:a,scopeReferenceMetadata:{},applicationMappingId:F}),[4,c.createRuleSet(r,x.accessToken)];case 2:if(l=b.sent(),!(u=null===(m=null==l?void 0:l.data)||void 0===m?void 0:m.scopeId))return[3,10];if(Ce.current=u,d=n&&(null===(v=r.topic)||void 0===v?void 0:v.toLowerCase().includes("genre")),p=!n&&"GLOBAL"!==ne.type&&ne.parentId,!d&&!p)return[3,10];if(!(g=n?null===(h=null===(T=s.useLearningTemplateStore.getState().scopeTreeData)||void 0===T?void 0:T.data)||void 0===h?void 0:h.id:ne.parentId))return[3,10];if(!W)return[3,7];b.label=3;case 3:return b.trys.push([3,5,,6]),[4,c.inheritScopeBackwardCompatible({source_scope_id:g,target_scope_id:u})];case 4:return b.sent(),[3,6];case 5:return f=b.sent(),console.error("Failed to inherit rules for the new scope:",f),[3,6];case 6:return[3,10];case 7:return b.trys.push([7,9,,10]),[4,c.inheritScope({source_scope_id:g,target_scope_id:u,application_mapping_id:F||"",is_copy_parent_variant_id:!1})];case 8:return b.sent(),[3,10];case 9:return _=b.sent(),console.error("Failed to inherit rules for the new scope:",_),[3,10];case 10:return[4,Ke(!0)];case 11:return b.sent(),re(function(t){return e.__assign(e.__assign({},t),{isOpen:!1})}),[3,14];case 12:throw S=b.sent(),console.error("An error occurred during scope creation.",S),null===(y=De.current)||void 0===y||y.show({severity:"error",summary:"Creation Failed",detail:(null===(A=null===(E=null==S?void 0:S.response)||void 0===E?void 0:E.data)||void 0===A?void 0:A.message)||"There was an error creating the scope. Please try again."}),S;case 13:return ue(!1),[7];case 14:return[2]}})})},hasGlobalRuleSet:Je,canCreateGlobal:Ze,globalScopeId:null!==(O=null===(M=null==$?void 0:$.data)||void 0===M?void 0:M.id)&&void 0!==O?O:null}):t.jsxs(t.Fragment,{children:[t.jsx(A.default,{isOpen:ne.isOpen&&"DELETE"!==ne.type&&"RENAME"!==ne.type,onClose:function(){return re(e.__assign(e.__assign({},ne),{isOpen:!1}))},onCreate:function(e){e&&(Ce.current=e),Ke(!0)},hasGlobalRuleSet:Je,parentId:ne.parentId}),t.jsx(j.default,{isOpen:ne.isOpen&&"RENAME"===ne.type,onClose:function(){return re(e.__assign(e.__assign({},ne),{isOpen:!1}))},onSave:function(n){return e.__awaiter(N,void 0,void 0,function(){var r,a,o,l,u,d;return e.__generator(this,function(p){switch(p.label){case 0:ue(!0),p.label=1;case 1:return p.trys.push([1,4,5,6]),ne.scopeId?(r=s.useLearningTemplateStore.getState().backwardCompatibility,a=r?{scope_id:ne.scopeId,scope_name:n}:{scope_id:ne.scopeId,scope_type:"Custom",scope_name:n,description:"demo",application_mapping_id:F},[4,c.renameScope(a,x.accessToken)]):[2];case 2:return p.sent(),[4,Ke(!0)];case 3:return p.sent(),re(function(t){return e.__assign(e.__assign({},t),{isOpen:!1})}),[3,6];case 4:throw o=p.sent(),console.error("An error occurred during scope rename.",o),null===(l=De.current)||void 0===l||l.show({severity:"error",sticky:!1,className:i.default.errorToast,content:t.jsx(D.default,{message:(null===(d=null===(u=null==o?void 0:o.response)||void 0===u?void 0:u.data)||void 0===d?void 0:d.message)||"There was an error renaming the scope. Please try again."})}),o;case 5:return ue(!1),[7];case 6:return[2]}})})},initialName:ne.initialName})]}),t.jsx(p.default,{isOpen:ne.isOpen&&"DELETE"===ne.type,onCancel:function(){return re(e.__assign(e.__assign({},ne),{isOpen:!1}))},onConfirm:function(){return ze(ne.scopeId,ne.initialName,ne.isSubscope)},title:"Delete Scope",description:t.jsxs(t.Fragment,{children:["Deleting ",t.jsx("span",e.__assign({className:i.default.highlight},{children:ne.initialName||"this scope"}))," will permanently remove all Learnings, Access rules, and Change History inside it. This cannot be undone."]}),confirmText:"Delete",confirmBgColor:"#EF4444",isLoading:le})]}))})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),n=require("react"),r=require("lucide-react"),s=require("./store/useLearningTemplateStore.js"),a=require("primereact/toast"),o=require("./styles/LearningTemplateManagement.module.css.js"),i=require("./LearningTemplateLayout.js"),l=require("./components/EmptyLearningState.js"),u=require("./store/useAuthStore.js"),c=require("./apis/scopeApis.js"),d=require("./hooks/useLearningTemplateQueryParams.js"),p=require("./components/ConfirmationModal.js"),g=require("./components/LearningTemplateManagementSkeleton.js"),f=require("./utils/treeUtils.js"),_=require("./store/useEnvStore.js"),S=require("./store/useConfigStore.js"),m=require("./components/ToolTip.js"),v=require("./components/CreateRuleSetLegacyModal.js"),T=require("./store/usePermissionsStore.js"),h=require("./store/useAppSecRolesStore.js"),y=require("./queries/useApprovalQueries.js"),E=require("./queries/useLMSConfigQuery.js"),A=require("./RuleContent/AddScopeModal.js"),L=require("./components/RuleContentSkeleton.js"),b=require("./components/ErrorStateDisplay.js"),R=require("react-router-dom"),C=require("./shared/SuccessToastContent.js"),D=require("./shared/ErrorToastContent.js"),j=require("./RuleContent/RenameScopeModal.js"),I=require("./store/useLMSConfigStore.js"),P=require("./constants.js");exports.default=function(q){var M,w,O,N=this,x=q.userDetails,k=q.llmStudioUrl,B=q.audacyBackendUrl,U=q.ilLabels,H=q.config,Y=q.rbacConfig,G=q.auditLogConfig,F=q.app_integration_id,Q=q.backwardCompatibility,W=void 0!==Q&&Q,K=q.modeId,z=q.modeDetails,V=s.useLearningTemplateStore(function(e){return e.selectedRuleSetId}),X=s.useLearningTemplateStore(function(e){return e.setSelectedRuleSetId}),J=s.useLearningTemplateStore(function(e){return e.error}),Z=s.useLearningTemplateStore(function(e){return e.setError}),$=s.useLearningTemplateStore(function(e){return e.setStations}),ee=s.useLearningTemplateStore(function(e){return e.scopeTreeData}),te=s.useLearningTemplateStore(function(e){return e.setScopeTreeData}),ne=n.useState({isOpen:!1,type:"GLOBAL"}),re=ne[0],se=ne[1],ae=n.useState(!1),oe=ae[0],ie=ae[1],le=n.useState(!1),ue=le[0],ce=le[1],de=n.useState("learnings"),pe=de[0],ge=de[1],fe=n.useState(null),_e=fe[0],Se=fe[1],me=n.useState(null),ve=me[0],Te=me[1],he=n.useState(!1),ye=he[0],Ee=he[1],Ae=n.useState(!1),Le=Ae[0],be=Ae[1],Re=n.useRef(null),Ce=n.useRef(null),De=n.useRef(!1),je=n.useRef(null),Ie=u.default();Ie.user;var Pe=Ie.setUser,qe=S.useConfigStore(),Me=qe.setConfig,we=qe.setIlLabels,Oe=function(){try{return R.useLocation()}catch(e){return{search:""}}}();n.useEffect(function(){if(!De.current){var e=new URLSearchParams(window.location.search),t=e.get(d.QUERY_PARAM_KEYS.RULESET_ID),n=e.get(d.QUERY_PARAM_KEYS.SECTION),r=n&&nt.has(n)?n:"learnings";(null==t?void 0:t.length)&&X&&ge&&(X(t),ge(r),De.current=!0)}},[null==Oe?void 0:Oe.search,ge,X]);var Ne=T.usePermissionsStore(function(e){return e.fetchPermissions}),xe=T.usePermissionsStore(function(e){return e.hasPermission}),ke=h.useAppSecRolesStore(function(e){return e.setRoles}),Be=_.default(function(e){return e.appsecRbacUrl})===Y.appsecRbacUrl,Ue=y.useGetAppSecRolesQuery(Y.applicationId,Be).data,He=E.useLMSConfigQuery(null!=F?F:"",W),Ye=He.isLoading,Ge=He.isError,Fe=He.refetch;He.isSuccess;var Qe=n.useState(0),We=Qe[0],Ke=Qe[1];n.useEffect(function(){if(!W&&F&&k){e.__awaiter(N,void 0,void 0,function(){var t,n,r,s,a,o;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,c.getILInstance(F)];case 1:return t=e.sent(),"number"==typeof(n=null===(o=null===(a=null===(s=null==t?void 0:t.data)||void 0===s?void 0:s.learningManagement)||void 0===a?void 0:a.scopeAndHierarchy)||void 0===o?void 0:o.maxHierarchyLevels)&&n>0&&Ke(n-1),[3,3];case 2:return r=e.sent(),console.error("Failed to fetch IL instance for hierarchy levels:",r),[3,3];case 3:return[2]}})})}},[F,k]),n.useEffect(function(){Ue&&ke(Ue.map(function(e){return{_id:e._id,name:e.name}}))},[Ue,ke]),n.useEffect(function(){var e;console.log("userDetails",x),Pe(x),console.log("llmStudioUrl",k),console.log("audacyBackendUrl",B),_.default.getState().setLlmStudioUrl(k),_.default.getState().setAudacyBackendUrl(B),_.default.getState().setRbacConfig(Y),_.default.getState().setAuditLogConfig(G),_.default.getState().setBaseModeName((null==z?void 0:z.modeNameFromURL)||null),Me(H),we(U),s.useLearningTemplateStore.getState().setAppIntegrationId(null!=F?F:null),s.useLearningTemplateStore.getState().setBackwardCompatibility(W),s.useLearningTemplateStore.getState().setToken(null!==(e=null==x?void 0:x.accessToken)&&void 0!==e?e:null)},[x,Pe,k,B,Y,G,H,Me,U,we,F,W,z]),n.useEffect(function(){(null==x?void 0:x.accessToken)&&k&&c.fetchTiers()},[F,null==x?void 0:x.accessToken,k]);var ze=function(t){return void 0===t&&(t=!0),e.__awaiter(N,void 0,void 0,function(){var n,r,a,o,i,l,u,d;return e.__generator(this,function(p){switch(p.label){case 0:t&&ie(!0),Z(null),p.label=1;case 1:return p.trys.push([1,4,5,6]),[4,Ne(Y.applicationId)];case 2:return p.sent(),n=function(t){if(!T.usePermissionsStore.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.__assign(e.__assign({},t),{children:r})},[4,c.fetchScopes(F,x.accessToken)];case 3:return(r=p.sent())&&r.data&&r.data.data&&(a=r.data.data,Array.isArray(a)&&(a=a.length>0?a[0]:null),a?(o=n(a))?(Se(null),te({data:o}),Ce.current?(X(Ce.current),ge("learnings"),Ce.current=null):(i=s.useLearningTemplateStore.getState().selectedRuleSetId,l=i?f.findNodeById(o,i):null,i&&l||X(o.id))):(Se(null!==(d=a.id)&&void 0!==d?d:null),te(null)):(Se(null),te(null))),[3,6];case 4:return u=p.sent(),console.error("Failed to fetch rule sets or permissions",u),Z("Failed to load data. Please try again later."),[3,6];case 5:return ie(!1),[7];case 6:return[2]}})})};n.useEffect(function(){var e;(null===(e=null==x?void 0:x.accessToken)||void 0===e?void 0:e.length)&&Be?ze(!0):console.warn("Error: Trying to fetch rules without access token",x)},[null==x?void 0:x.accessToken,Z,$,Y.applicationId,Be]);var Ve=function(t,n,r){return e.__awaiter(N,void 0,void 0,function(){var n,r,a,o,i,l,u,d;return e.__generator(this,function(p){switch(p.label){case 0:ce(!0),p.label=1;case 1:return p.trys.push([1,4,5,6]),[4,c.deleteRuleSet(t,x.accessToken)];case 2:return p.sent(),s.useLearningTemplateStore.getState().selectedRuleSetId===t&&(n=s.useLearningTemplateStore.getState().scopeTreeData,(r=f.findNodePathById((null==n?void 0:n.data)||null,t))&&r.length>1&&(a=r[r.length-2],X(a),ge("learnings"))),[4,ze(!0)];case 3:return p.sent(),se(function(t){return e.__assign(e.__assign({},t),{isOpen:!1})}),null===(i=je.current)||void 0===i||i.show({severity:"success",summary:"Deleted Successfully",detail:"The scope was permanently removed."}),[3,6];case 4:return o=p.sent(),console.error("An error occurred during scope deletion.",o),null===(l=je.current)||void 0===l||l.show({severity:"error",summary:"Delete Failed",detail:(null===(d=null===(u=null==o?void 0:o.response)||void 0===u?void 0:u.data)||void 0===d?void 0:d.message)||"There was an error deleting the scope. Please try again."}),[3,6];case 5:return ce(!1),[7];case 6:return[2]}})})},Xe=ee,Je=ve?{data:{id:ve.stationId,name:ve.stationName,type:"STATION",metrics:{learningsCount:ve.learningsCount,stationsCount:0},children:[]}}:Xe,Ze=!!(null==Je?void 0:Je.data);null===(M=null==Je?void 0:Je.data)||void 0===M||M.type;var $e=T.usePermissionsStore(function(e){return e.hasGlobalPermission})("ilotj.scope.global.create",Y.applicationResourceId||"");if(Ye)return t.jsx("div",e.__assign({className:o.default.learningManagementContainer},{children:t.jsx(L.default,{})}));if(Ge)return t.jsx("div",e.__assign({className:o.default.learningManagementContainer},{children:t.jsx(b.default,{errorMessage:"Failed to load configuration. Please try again.",onRetry:function(){return Fe()},title:"Error Loading Configuration"})}));var et=e.__spreadArray(e.__spreadArray([{type:"GLOBAL",label:"Global",addChildLabel:"".concat(I.dt("".concat(P.MIDDLE_DRAWER_DT_PATH,".addScope"),"Add Scope")),addChildType:"SCOPE"}],Array.from({length:We},function(){return e.__assign({type:"SCOPE",label:I.dt("".concat(P.MIDDLE_DRAWER_DT_PATH,".scope"),"Scope")},!W&&{addChildLabel:I.dt("".concat(P.MIDDLE_DRAWER_CONTEXT_MENU_DT_PATH,".addSubScope"),"Add Subscope"),addChildType:"SUBSCOPE"})}),!0),W?[]:[{type:"SUBSCOPE",label:I.dt("".concat(P.MIDDLE_DRAWER_DT_PATH,".subScope"),"Subscope")}],!0),tt=[{id:"learnings",label:I.dt("".concat(P.MIDDLE_DRAWER_DT_PATH,".treeMenu.submenu.learnings"),"Learnings"),icon:r.BookOpen,badgeKey:"learningsCount"},{id:"access",label:I.dt("".concat(P.MIDDLE_DRAWER_DT_PATH,".treeMenu.submenu.access"),"Access"),icon:r.Users},{id:"history",label:I.dt("".concat(P.MIDDLE_DRAWER_DT_PATH,".treeMenu.submenu.changeHistory"),"Change History"),icon:r.History}],nt=new Set(tt.map(function(e){return e.id})),rt=ve?tt.filter(function(e){return"stations"!==e.id}):tt;return t.jsx(m.TooltipProvider,{children:t.jsxs("div",e.__assign({className:o.default.learningManagementContainer},{children:[t.jsx("div",e.__assign({className:o.default.mainWrapper},{children:oe?t.jsx(g.default,{}):J?t.jsxs("div",e.__assign({className:o.default.errorContainer},{children:[t.jsx("div",e.__assign({className:o.default.errorTitle},{children:"Error Loading Data"})),t.jsx("p",e.__assign({className:o.default.errorDesc},{children:J})),t.jsx("button",e.__assign({onClick:function(){return ze(!0)},className:o.default.tryAgainBtn},{children:"Try Again"}))]})):Ze?t.jsx(i.default,{onOpenCreateModal:function(){return se({isOpen:!0,type:"GLOBAL"})},onAddChild:function(e,t,n){return se({isOpen:!0,type:t,parentId:e,parentName:n})},onRenameChild:function(e,t){return se({isOpen:!0,type:"RENAME",scopeId:e,initialName:t})},onDeleteChild:function(t,n,r){return e.__awaiter(N,void 0,void 0,function(){var a,o,i;return e.__generator(this,function(e){switch(e.label){case 0:return a=s.useLearningTemplateStore.getState().scopeTreeData,o=f.findNodePathById((null==a?void 0:a.data)||null,t),i=!!o&&3===o.length,0!==r?[3,2]:[4,Ve(t)];case 1:return e.sent(),[3,3];case 2:se({isOpen:!0,type:"DELETE",scopeId:t,initialName:n,isSubscope:i}),e.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,t){var n;console.log("Section Selected:",{scopeId:e,sectionId:t}),d.setQueryParams(((n={})[d.QUERY_PARAM_KEYS.SECTION]="learnings"===t?null:t,n[d.QUERY_PARAM_KEYS.RULESET_ID]=e,n)),ge(t),X(e)},activeSectionId:pe,scopeTreeData:Je,sectionsConfig:rt,onViewStation:function(e){Re.current=V,Te(e),ge("learnings"),X(e.stationId)},onRefreshRuleSets:function(e,t){void 0===e&&(e=!0),t&&(Ce.current=t),ze(e)},nodeTypesConfig:et,app_integration_id:F,token:x.accessToken,modeId:K}):t.jsx(l.default,{onCreate:function(){return se({isOpen:!0,type:"GLOBAL"})},title:I.dt("".concat(P.EMPTY_STATE_DT_PATH,".title"),"No Global Scope has been added!"),desc:I.dt("".concat(P.EMPTY_STATE_DT_PATH,".desc"),"Start by creating a Global scope to define base learnings that apply across all stations."),button:I.dt("".concat(P.EMPTY_STATE_DT_PATH,".createGlobalScope"),"Create Global Scope"),canCreateRule:$e,noAccessTitle:I.dt("".concat(P.EMPTY_STATE_DT_PATH,".noAccessTitle"),"Access Restricted"),noAccessDesc:I.dt("".concat(P.EMPTY_STATE_DT_PATH,".noAccessDesc"),"You do not have access for this application."),requestAccessButton:I.dt("".concat(P.EMPTY_STATE_DT_PATH,".requestAccessButton"),"Request Access"),requestSentButton:I.dt("".concat(P.EMPTY_STATE_DT_PATH,".requestSentButton"),"Request Sent"),onRequestAccess:function(){return e.__awaiter(N,void 0,void 0,function(){var n,r,a,i,l,u,d,p,g;return e.__generator(this,function(e){switch(e.label){case 0:if(!(n=(null===(i=null===(a=s.useLearningTemplateStore.getState().scopeTreeData)||void 0===a?void 0:a.data)||void 0===i?void 0:i.id)||_e))return null===(l=je.current)||void 0===l||l.show({severity:"error",sticky:!1,className:o.default.errorToast,content:t.jsx(D.default,{message:"Unable to identify the global scope for this access request."})}),[2];Ee(!0),e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,c.requestAccess(n)];case 2:return e.sent(),be(!0),null===(u=je.current)||void 0===u||u.show({severity:"success",sticky:!1,life:3e3,className:o.default.successToast,content:t.jsx(C.default,{message:"Access request submitted successfully!"})}),[3,5];case 3:return r=e.sent(),null===(d=je.current)||void 0===d||d.show({severity:"error",sticky:!1,className:o.default.errorToast,content:t.jsx(D.default,{message:(null===(g=null===(p=null==r?void 0:r.response)||void 0===p?void 0:p.data)||void 0===g?void 0:g.detail)||"Failed to request access. Please try again."})}),[3,5];case 4:return Ee(!1),[7];case 5:return[2]}})})},isRequestingAccess:ye,isAccessRequested:Le})})),t.jsx(a.Toast,{ref:je,pt:{root:{style:{zIndex:9999}}}}),W&&re.isOpen&&"DELETE"!==re.type&&"RENAME"!==re.type?t.jsx(v.default,{isOpen:!0,onClose:function(){return se(e.__assign(e.__assign({},re),{isOpen:!1}))},onSubmit:function(t){return e.__awaiter(N,void 0,void 0,function(){var n,r,a,o,i,l,u,d,p,g,f,_,S,m,v,T,h,y,E,A;return e.__generator(this,function(L){switch(L.label){case 0:ce(!0),n=s.useLearningTemplateStore.getState().backwardCompatibility,L.label=1;case 1:return L.trys.push([1,12,13,14]),r=void 0,n&&"object"==typeof t?r=t:(a=t,o="SCOPE"===re.type&&re.parentId,i=o?"genreRuleSet":re.type,r={topic:i,scope_reference_id:null,scopeDescription:"demo",parentScopeId:re.parentId||null,scopeName:a,scopeReferenceMetadata:{},applicationMappingId:F}),[4,c.createRuleSet(r,x.accessToken)];case 2:if(l=L.sent(),!(u=null===(m=null==l?void 0:l.data)||void 0===m?void 0:m.scopeId))return[3,10];if(Ce.current=u,d=n&&(null===(v=r.topic)||void 0===v?void 0:v.toLowerCase().includes("genre")),p=!n&&"GLOBAL"!==re.type&&re.parentId,!d&&!p)return[3,10];if(!(g=n?null===(h=null===(T=s.useLearningTemplateStore.getState().scopeTreeData)||void 0===T?void 0:T.data)||void 0===h?void 0:h.id:re.parentId))return[3,10];if(!W)return[3,7];L.label=3;case 3:return L.trys.push([3,5,,6]),[4,c.inheritScopeBackwardCompatible({source_scope_id:g,target_scope_id:u})];case 4:return L.sent(),[3,6];case 5:return f=L.sent(),console.error("Failed to inherit rules for the new scope:",f),[3,6];case 6:return[3,10];case 7:return L.trys.push([7,9,,10]),[4,c.inheritScope({source_scope_id:g,target_scope_id:u,application_mapping_id:F||"",is_copy_parent_variant_id:!1})];case 8:return L.sent(),[3,10];case 9:return _=L.sent(),console.error("Failed to inherit rules for the new scope:",_),[3,10];case 10:return[4,ze(!0)];case 11:return L.sent(),se(function(t){return e.__assign(e.__assign({},t),{isOpen:!1})}),[3,14];case 12:throw S=L.sent(),console.error("An error occurred during scope creation.",S),null===(y=je.current)||void 0===y||y.show({severity:"error",summary:"Creation Failed",detail:(null===(A=null===(E=null==S?void 0:S.response)||void 0===E?void 0:E.data)||void 0===A?void 0:A.message)||"There was an error creating the scope. Please try again."}),S;case 13:return ce(!1),[7];case 14:return[2]}})})},hasGlobalRuleSet:Ze,canCreateGlobal:$e,globalScopeId:null!==(O=null===(w=null==ee?void 0:ee.data)||void 0===w?void 0:w.id)&&void 0!==O?O:null}):t.jsxs(t.Fragment,{children:[t.jsx(A.default,{isOpen:re.isOpen&&"DELETE"!==re.type&&"RENAME"!==re.type,onClose:function(){return se(e.__assign(e.__assign({},re),{isOpen:!1}))},onCreate:function(e){e&&(Ce.current=e),ze(!0)},hasGlobalRuleSet:Ze,parentId:re.parentId}),t.jsx(j.default,{isOpen:re.isOpen&&"RENAME"===re.type,onClose:function(){return se(e.__assign(e.__assign({},re),{isOpen:!1}))},onSave:function(n){return e.__awaiter(N,void 0,void 0,function(){var r,a,i,l,u,d;return e.__generator(this,function(p){switch(p.label){case 0:ce(!0),p.label=1;case 1:return p.trys.push([1,4,5,6]),re.scopeId?(r=s.useLearningTemplateStore.getState().backwardCompatibility,a=r?{scope_id:re.scopeId,scope_name:n}:{scope_id:re.scopeId,scope_type:"Custom",scope_name:n,description:"demo",application_mapping_id:F},[4,c.renameScope(a,x.accessToken)]):[2];case 2:return p.sent(),[4,ze(!0)];case 3:return p.sent(),se(function(t){return e.__assign(e.__assign({},t),{isOpen:!1})}),[3,6];case 4:throw i=p.sent(),console.error("An error occurred during scope rename.",i),null===(l=je.current)||void 0===l||l.show({severity:"error",sticky:!1,className:o.default.errorToast,content:t.jsx(D.default,{message:(null===(d=null===(u=null==i?void 0:i.response)||void 0===u?void 0:u.data)||void 0===d?void 0:d.message)||"There was an error renaming the scope. Please try again."})}),i;case 5:return ce(!1),[7];case 6:return[2]}})})},initialName:re.initialName})]}),t.jsx(p.default,{isOpen:re.isOpen&&"DELETE"===re.type,onCancel:function(){return se(e.__assign(e.__assign({},re),{isOpen:!1}))},onConfirm:function(){return Ve(re.scopeId,re.initialName,re.isSubscope)},title:"Delete Scope",description:t.jsxs(t.Fragment,{children:["Deleting ",t.jsx("span",e.__assign({className:o.default.highlight},{children:re.initialName||"this scope"}))," will permanently remove all Learnings, Access rules, and Change History inside it. This cannot be undone."]}),confirmText:"Delete",confirmBgColor:"#EF4444",isLoading:ue})]}))})};
2
2
  //# sourceMappingURL=LearningManagement.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.API_ENDPOINTS={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"},exports.LEGACY_API_ENDPOINTS={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"};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.API_ENDPOINTS={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/ilotj/variant/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/ilotj/variants/update_variant_status"},exports.LEGACY_API_ENDPOINTS={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/scopes/{scopeId}/variants/update_variant_status",getRuleOverrideHistory:"/instant_learning/learnings/inheritance/change_log"};
2
2
  //# sourceMappingURL=apiConfig.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("axios"),r=require("./apiConfig.js"),a=require("../store/useAuthStore.js"),n=require("../store/useEnvStore.js"),o=require("../store/useLearningTemplateStore.js"),i=require("../config.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=s(t),u=function(e){return e.interceptors.request.use(function(e){var t=a.default.getState().user,r=null==t?void 0:t.accessToken;return r&&(e.headers.Authorization="Bearer ".concat(r)),e}),e},l=function(e,t){return e.interceptors.request.use(function(e){return e.baseURL=t(),e}),e},p=l(u(c.default.create({headers:{"Content-Type":"application/json"}})),function(){return n.default.getState().audacyBackendUrl||""}),d=l(u(c.default.create({headers:{"Content-Type":"application/json"}})),function(){return n.default.getState().llmStudioUrl||""}),_=l(u(c.default.create({headers:{"Content-Type":"application/json"}})),function(){return n.default.getState().appsecRbacUrl||""}),g=l(u(c.default.create({headers:{"Content-Type":"application/json"}})),function(){return n.default.getState().appsecBaseUrl||""}),S=function(e){return l(u(c.default.create({headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(e)},withCredentials:!0})),function(){return n.default.getState().llmStudioUrl||""})};exports.ApproveOrRejectVariants=function(t){var a=t.variant_ids,n=t.status,i=t.feedback,s=t.scopeId,c=t.is_deleted,u=t.appsecData;return e.__awaiter(void 0,void 0,void 0,function(){var t,l,p,_,g,h;return e.__generator(this,function(v){switch(v.label){case 0:t=o.useLearningTemplateStore.getState().backwardCompatibility,l=o.useLearningTemplateStore.getState().app_integration_id,p=o.useLearningTemplateStore.getState().token,v.label=1;case 1:return v.trys.push([1,6,,7]),t?(_=r.API_ENDPOINTS.updateVariantStatus.replace("{scopeId}",s),g=e.__assign({variant_ids:a,status:n,feedback:i||"",is_deleted:null!=c&&c},u&&{appsecData:u}),[4,S(p).patch(_,g)]):[3,3];case 2:return[2,v.sent().data];case 3:return g=e.__assign({variant_ids:a,scope_id:s,application_mapping_id:l,status:n,feedback:i||"",is_deleted:null!=c&&c},u&&{appsecData:u}),[4,d.put(r.LEGACY_API_ENDPOINTS.updateVariantStatus,g)];case 4:return[2,v.sent().data];case 5:return[3,7];case 6:throw h=v.sent(),console.log(h),h;case 7:return[2]}})})},exports.GetAppsecRoles=function(t){return e.__awaiter(void 0,void 0,void 0,function(){var r;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,_.get("/roles?appId=".concat(t))];case 1:return[2,e.sent().data];case 2:throw r=e.sent(),console.error(r),r;case 3:return[2]}})})},exports.alterQuestionPriority=function(t,a,n,i,s){return e.__awaiter(void 0,void 0,void 0,function(){var c,u,l,p,d,_;return e.__generator(this,function(e){switch(e.label){case 0:c=o.useLearningTemplateStore.getState().backwardCompatibility,u=o.useLearningTemplateStore.getState().app_integration_id,l=o.useLearningTemplateStore.getState().token,e.label=1;case 1:return e.trys.push([1,3,,4]),p=c?r.LEGACY_API_ENDPOINTS.alterRulePriority:r.API_ENDPOINTS.alterRulePriority,d=c?{scopeId:t,tierId:a,move:{movedRuleId:n,prevRuleId:i,nextRuleId:s}}:{scope_id:t,tier_id:a,move:{moved_rule_id:n,prev_rule_id:i,next_rule_id:s},application_mapping_id:u},[4,S(l).put(p,d)];case 2:return[2,e.sent().data];case 3:throw _=e.sent(),console.error("Error altering question priority:",_),_;case 4:return[2]}})})},exports.appsecApi=_,exports.appsecApigetUser=g,exports.appsecGetUserGroups=function(t){return void 0===t&&(t={}),e.__awaiter(void 0,void 0,void 0,function(){var r,a,n,o,i,s,c,u,l,p,d,g,S,h,v,f;return e.__generator(this,function(e){switch(e.label){case 0:r=t.appId,a=void 0===r?"":r,n=t.name,o=void 0===n?"":n,i=t.user,s=void 0===i?"":i,c=t.isActive,u=void 0===c||c,l=t.page,p=void 0===l?1:l,d=t.limit,g=void 0===d?10:d,S=t.pagination,h=void 0===S||S,v=new URLSearchParams({appId:a,name:o,user:s,isActive:String(u),page:String(p),limit:String(g),pagination:String(h)}),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,_.get("/groups?".concat(v.toString()))];case 2:return[2,e.sent().data];case 3:throw f=e.sent(),console.error("Failed to fetch user groups",f),f;case 4:return[2]}})})},exports.appsecGetUsersByQueryLite=function(t,r){return e.__awaiter(void 0,void 0,void 0,function(){var a,n,o,i,s,c,u,l,p,d,_,S,h,v,f,I,w;return e.__generator(this,function(e){switch(e.label){case 0:n=(a=r||{}).isPopulateRoles,o=void 0!==n&&n,i=a.isPopulatePermissions,s=void 0!==i&&i,c=a.isPopulateApps,u=void 0!==c&&c,l=a.isPopulateEnvironments,p=void 0!==l&&l,d=a.isPopulateOperations,_=void 0!==d&&d,S=a.isPopulateGroups,h=void 0!==S&&S,v=a.isPopulateOrganization,f=void 0!==v&&v,I=new URLSearchParams({search:t,isPopulateRoles:String(o),isPopulatePermissions:String(s),isPopulateApps:String(u),isPopulateEnvironments:String(p),isPopulateOperations:String(_),isPopulateGroups:String(h),isPopulateOrganization:String(f)}),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,g.get("/api/user/get-by-query-v2?".concat(I.toString()))];case 2:return[2,e.sent().data];case 3:throw w=e.sent(),console.error("Failed to fetch users",w),w;case 4:return[2]}})})},exports.audacyApi=p,exports.createRuleSet=function(t,a){return e.__awaiter(void 0,void 0,void 0,function(){var n,i,s;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),n=o.useLearningTemplateStore.getState().backwardCompatibility,i=n?r.LEGACY_API_ENDPOINTS.createRuleSet:r.API_ENDPOINTS.createRuleSet,[4,S(a).post(i,t)];case 1:return[2,e.sent().data];case 2:throw s=e.sent(),console.error("Error creating rule set:",s),s;case 3:return[2]}})})},exports.default=d,exports.deleteQuestion=function(t){return e.__awaiter(void 0,void 0,void 0,function(){var a,n,i,s,c;return e.__generator(this,function(e){switch(e.label){case 0:a=o.useLearningTemplateStore.getState().backwardCompatibility,n=o.useLearningTemplateStore.getState().app_integration_id,i=o.useLearningTemplateStore.getState().token,e.label=1;case 1:return e.trys.push([1,6,,7]),a?(s=r.LEGACY_API_ENDPOINTS.deleteQuestion.replace("{questionId}",t),[4,d.delete(s)]):[3,3];case 2:return[2,e.sent().data];case 3:return s=r.API_ENDPOINTS.deleteQuestion.replace("{questionId}",t).replace("{appIntegrationId}",null!=n?n:""),[4,S(i).delete(s)];case 4:return[2,e.sent().data];case 5:return[3,7];case 6:throw c=e.sent(),console.error("Error deleting question:",c),c;case 7:return[2]}})})},exports.deleteRule=function(t){return e.__awaiter(void 0,void 0,void 0,function(){var a,n,i,s,c;return e.__generator(this,function(e){switch(e.label){case 0:a=o.useLearningTemplateStore.getState().backwardCompatibility,n=o.useLearningTemplateStore.getState().app_integration_id,i=o.useLearningTemplateStore.getState().token,e.label=1;case 1:return e.trys.push([1,6,,7]),a?(s=r.LEGACY_API_ENDPOINTS.deleteRule.replace("{ruleId}",t),[4,d.delete(s)]):[3,3];case 2:return[2,e.sent().data];case 3:return s=r.API_ENDPOINTS.deleteRule.replace("{ruleId}",t).replace("{appIntegrationId}",null!=n?n:""),[4,S(i).delete(s)];case 4:return[2,e.sent().data];case 5:return[3,7];case 6:throw c=e.sent(),console.error("Error deleting rule:",c),c;case 7:return[2]}})})},exports.deleteRuleSet=function(t,a){return e.__awaiter(void 0,void 0,void 0,function(){var n,i,s,c;return e.__generator(this,function(e){switch(e.label){case 0:n=o.useLearningTemplateStore.getState().backwardCompatibility,i=o.useLearningTemplateStore.getState().app_integration_id,e.label=1;case 1:return e.trys.push([1,3,,4]),s=void 0,s=n?r.LEGACY_API_ENDPOINTS.deleteRuleSet.replace("{ruleSetId}",t):r.API_ENDPOINTS.deleteRuleSet.replace("{ruleSetId}",t).replace("{appIntegrationId}",null!=i?i:""),[4,S(a).delete(s)];case 2:return[2,e.sent().data];case 3:throw c=e.sent(),console.error("Error deleting rule set:",c),c;case 4:return[2]}})})},exports.deleteTier=function(t,a){return e.__awaiter(void 0,void 0,void 0,function(){var n,i,s,c,u;return e.__generator(this,function(e){switch(e.label){case 0:n=o.useLearningTemplateStore.getState().backwardCompatibility,i=o.useLearningTemplateStore.getState().app_integration_id,s=o.useLearningTemplateStore.getState().token,e.label=1;case 1:return e.trys.push([1,6,,7]),n?(c=r.LEGACY_API_ENDPOINTS.deleteTier.replace("{scopeId}",t).replace("{tierId}",a),[4,d.delete(c)]):[3,3];case 2:return[2,e.sent().data];case 3:return c=r.API_ENDPOINTS.deleteTier.replace("{scopeId}",t).replace("{tierId}",a).replace("{appIntegrationId}",null!=i?i:""),[4,S(s).delete(c)];case 4:return[2,e.sent().data];case 5:return[3,7];case 6:throw u=e.sent(),console.error("Error deleting tier:",u),u;case 7:return[2]}})})},exports.exportRuleSet=function(t){return e.__awaiter(void 0,void 0,void 0,function(){var a;return e.__generator(this,function(e){switch(e.label){case 0:if(!t)throw new Error("scopeId is required for exporting rule sets");e.label=1;case 1:return e.trys.push([1,3,,4]),[4,d.post(r.API_ENDPOINTS.exportRuleSet,{scope_id:t},{responseType:"blob"})];case 2:return[2,e.sent().data];case 3:throw a=e.sent(),console.error("Error exporting rule set:",a),a;case 4:return[2]}})})},exports.fetchLMSConfig=function(t,r,a){var n,o,i,s,c;return e.__awaiter(this,void 0,void 0,function(){var u,l,p,d;return e.__generator(this,function(_){switch(_.label){case 0:return[4,fetch("".concat(t,"/instant_learning/ilotj/application/getValueType/").concat(r),{headers:{Authorization:"Bearer ".concat(a)}})];case 1:if(!(u=_.sent()).ok)throw new Error("Failed to fetch LMS config");return[4,u.json()];case 2:return!(l=_.sent())||Array.isArray(l.data)&&0===l.data.length?[2,{lmsConfig:null,teachMeConfig:null,template:null}]:(p=null===(n=l.data[0])||void 0===n?void 0:n.value_type_config,[2,{lmsConfig:(d=null!==(o=null==p?void 0:p.learningManagement)&&void 0!==o?o:null)?e.__assign(e.__assign({},d),{agents:null!==(i=null==p?void 0:p.agents)&&void 0!==i?i:{}}):null,teachMeConfig:null!==(s=null==p?void 0:p.teachMe)&&void 0!==s?s:null,template:null!==(c=null==p?void 0:p.template)&&void 0!==c?c:null}])}})})},exports.fetchRulesByQuestionId=function(t,a){return e.__awaiter(void 0,void 0,void 0,function(){var n,i,s,c,u;return e.__generator(this,function(e){switch(e.label){case 0:n=o.useLearningTemplateStore.getState().backwardCompatibility,i=o.useLearningTemplateStore.getState().app_integration_id,s=o.useLearningTemplateStore.getState().token,e.label=1;case 1:return e.trys.push([1,6,,7]),n?(c=r.LEGACY_API_ENDPOINTS.fetchRulesByQuestionId.replace("{questionId}",t).replace("{scopeId}",a),[4,d.get(c)]):[3,3];case 2:return[2,e.sent().data];case 3:return c=r.API_ENDPOINTS.fetchRulesByQuestionId.replace("{appIntegrationId}",null!=i?i:"").replace("{questionId}",t).replace("{scopeId}",a),[4,S(s).get(c)];case 4:return[2,e.sent().data];case 5:return[3,7];case 6:throw u=e.sent(),console.error("Error fetching rules by question id:",u),u;case 7:return[2]}})})},exports.fetchScopes=function(t,a){return e.__awaiter(void 0,void 0,void 0,function(){var n,i,s;return e.__generator(this,function(e){switch(e.label){case 0:n=o.useLearningTemplateStore.getState().backwardCompatibility,e.label=1;case 1:if(e.trys.push([1,3,,4]),!t&&!1===n)throw new Error("App Integration ID is not provided. Falling back to legacy endpoint for fetching scopes.");return i=n?r.LEGACY_API_ENDPOINTS.fetchScopes:"".concat(r.API_ENDPOINTS.fetchScopes,"/").concat(t),[4,S(a).get(i)];case 2:return[2,e.sent().data];case 3:throw s=e.sent(),console.error("Error fetching rule sets:",s),s;case 4:return[2]}})})},exports.fetchStationsByKeyword=function(t,a){return void 0===a&&(a=!1),e.__awaiter(void 0,void 0,void 0,function(){var n,o;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),n="".concat(r.API_ENDPOINTS.fetchStationsByKeyword.replace("{keyword}",t),"?allow_existing=").concat(a),[4,p.get(n)];case 1:return[2,e.sent().data];case 2:throw o=e.sent(),console.error("Error fetching station name by keyword:",o),o;case 3:return[2]}})})},exports.fetchTiers=function(){return e.__awaiter(void 0,void 0,void 0,function(){var t,a,n,s,c,u,l,p;return e.__generator(this,function(e){switch(e.label){case 0:t=o.useLearningTemplateStore.getState().backwardCompatibility,a=o.useLearningTemplateStore.getState().app_integration_id,n=o.useLearningTemplateStore.getState().token,e.label=1;case 1:return e.trys.push([1,6,,7]),t?(s=i.IL_CONFIG_CONSTANTS.CUSTOM_SCOPE_GROUP_NAME,[4,S(n).post(r.LEGACY_API_ENDPOINTS.getTiers,{tier_group_name:s})]):[3,3];case 2:return c=e.sent(),o.useLearningTemplateStore.getState().setTiers((null===(l=c.data)||void 0===l?void 0:l.response)||[]),[3,5];case 3:return[4,S(n).get(r.API_ENDPOINTS.getTiers.replace("{appIntegrationId}",null!=a?a:""))];case 4:c=e.sent(),"success"===(null===(p=c.data)||void 0===p?void 0:p.status)&&o.useLearningTemplateStore.getState().setTiers(c.data.data.map(function(e){return{tier_id:e.id,tier_name:e.tier_title,tier_priority:e.tier_priority}})),e.label=5;case 5:return[3,7];case 6:throw u=e.sent(),console.error("Error fetching tiers:",u),u;case 7:return[2]}})})},exports.getILInstance=function(t){return e.__awaiter(void 0,void 0,void 0,function(){var a,n;return e.__generator(this,function(e){switch(e.label){case 0:a=o.useLearningTemplateStore.getState().token,e.label=1;case 1:return e.trys.push([1,3,,4]),[4,S(a).get("".concat(r.API_ENDPOINTS.getILInstance).concat(t))];case 2:return[2,e.sent().data];case 3:throw n=e.sent(),console.error("Error fetching IL instance:",n),n;case 4:return[2]}})})},exports.getRuleOverrideHistory=function(t){return e.__awaiter(void 0,void 0,void 0,function(){var a,n,i,s;return e.__generator(this,function(e){switch(e.label){case 0:a=o.useLearningTemplateStore.getState().backwardCompatibility,n=o.useLearningTemplateStore.getState().app_integration_id,e.label=1;case 1:return e.trys.push([1,3,,4]),i=a?"".concat(r.API_ENDPOINTS.getRuleOverrideHistory,"/").concat(t):"".concat(r.API_ENDPOINTS.getRuleOverrideHistory,"/").concat(t,"/").concat(null!=n?n:""),[4,d.get(i)];case 2:return[2,e.sent().data];case 3:throw s=e.sent(),console.error("Error getting rule override history:",s),s;case 4:return[2]}})})},exports.getRulesInRuleSetById=function(t,a){return e.__awaiter(void 0,void 0,void 0,function(){var n,i,s,c;return e.__generator(this,function(e){switch(e.label){case 0:n=o.useLearningTemplateStore.getState().backwardCompatibility,i=o.useLearningTemplateStore.getState().app_integration_id,e.label=1;case 1:return e.trys.push([1,3,,4]),s=n?"".concat(r.LEGACY_API_ENDPOINTS.getRulesInRuleSetById,"/").concat(t,"?include_config=True&sort_variant_by=createdAt"):"".concat(r.API_ENDPOINTS.getRulesInRuleSetById,"/").concat(t,"/").concat(null!=i?i:""),[4,S(a).get(s)];case 2:return[2,e.sent().data];case 3:return c=e.sent(),console.error("Error fetching rules in rule set:",c),[3,4];case 4:return[2]}})})},exports.getStationsByScopeId=function(t){return e.__awaiter(void 0,void 0,void 0,function(){return e.__generator(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)})]})})},exports.inheritScope=function(t){return e.__awaiter(void 0,void 0,void 0,function(){var a;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,4,,5]),(null==t?void 0:t.application_mapping_id)?[4,d.post(r.API_ENDPOINTS.inheritScope,t)]:[3,2];case 1:return[2,e.sent().data];case 2:throw Error("Fatal Error: Trying to call inherit API without appintegration ID");case 3:return[3,5];case 4:throw a=e.sent(),console.error("Error inheriting scope:",a),a;case 5:return[2]}})})},exports.inheritScopeBackwardCompatible=function(t){return e.__awaiter(void 0,void 0,void 0,function(){var a;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,d.post(r.LEGACY_API_ENDPOINTS.inheritScope,t)];case 1:return[2,e.sent().data];case 2:throw a=e.sent(),console.error("Error inheriting scope:",a),a;case 3:return[2]}})})},exports.llmApiWithToken=S,exports.publishFeedback=function(t,a){return e.__awaiter(void 0,void 0,void 0,function(){var a,n,i;return e.__generator(this,function(e){switch(e.label){case 0:a=o.useLearningTemplateStore.getState().backwardCompatibility,e.label=1;case 1:return e.trys.push([1,3,,4]),n=a?r.LEGACY_API_ENDPOINTS.publishFeedback:"".concat(r.API_ENDPOINTS.publishFeedback),[4,d.post(n,t)];case 2:return[2,e.sent().data];case 3:throw i=e.sent(),console.error("Error publishing feedback to LLM Studio:",i),i;case 4:return[2]}})})},exports.renameScope=function(t,a){return e.__awaiter(void 0,void 0,void 0,function(){var n,i,s;return e.__generator(this,function(e){switch(e.label){case 0:n=o.useLearningTemplateStore.getState().backwardCompatibility,e.label=1;case 1:return e.trys.push([1,3,,4]),i=n?r.LEGACY_API_ENDPOINTS.renameScope:r.API_ENDPOINTS.renameScope,[4,S(a).put(i,t)];case 2:return[2,e.sent().data];case 3:throw s=e.sent(),console.error("Error renaming scope:",s),s;case 4:return[2]}})})},exports.requestAccess=function(t){return e.__awaiter(void 0,void 0,void 0,function(){var a,n,i,s,c,u,l;return e.__generator(this,function(e){switch(e.label){case 0:a=o.useLearningTemplateStore.getState().backwardCompatibility,n=o.useLearningTemplateStore.getState().app_integration_id,i=o.useLearningTemplateStore.getState().token,s=window.location.href,c=s.indexOf("/mode"),u=-1!==c?s.substring(c+1):(window.location.pathname+window.location.search).substring(1),e.label=1;case 1:return e.trys.push([1,6,,7]),a?[4,d.post(r.LEGACY_API_ENDPOINTS.requestAccess,{scope_id:t,mode_learning_endpoint:u})]:[3,3];case 2:return[2,e.sent().data];case 3:return[4,S(i).post(r.API_ENDPOINTS.requestAccess,{scope_id:t,application_mapping_id:n,mode_learning_endpoint:u})];case 4:return[2,e.sent().data];case 5:return[3,7];case 6:throw l=e.sent(),console.error("Error requesting global scope access:",l),l;case 7:return[2]}})})},exports.retrieveGenreScopes=function(t){return void 0===t&&(t={limit:"50",offset:"0"}),e.__awaiter(void 0,void 0,void 0,function(){var a;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,d.post(r.API_ENDPOINTS.retrieveGenreScopes,t)];case 1:return[2,e.sent().data];case 2:throw a=e.sent(),console.error("Error retrieving genre scopes:",a),a;case 3:return[2]}})})},exports.saveInstantLearningQuestion=function(t){return e.__awaiter(void 0,void 0,void 0,function(){var a;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,d.post(r.API_ENDPOINTS.saveInstantLearningQuestion,t)];case 1:return[2,e.sent().data];case 2:throw a=e.sent(),console.error("Error saving instant learning question:",a),a;case 3:return[2]}})})},exports.searchScopes=function(t){return e.__awaiter(void 0,void 0,void 0,function(){var a;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,d.post(r.API_ENDPOINTS.searchScopes,t)];case 1:return[2,e.sent().data];case 2:throw a=e.sent(),console.error("Error searching scopes:",a),a;case 3:return[2]}})})},exports.submitChatFeedback=function(t){return e.__awaiter(void 0,void 0,void 0,function(){var a,n,i;return e.__generator(this,function(e){switch(e.label){case 0:a=o.useLearningTemplateStore.getState().backwardCompatibility,n=a?r.LEGACY_API_ENDPOINTS.submitChatFeedback:r.API_ENDPOINTS.submitChatFeedback,e.label=1;case 1:return e.trys.push([1,3,,4]),[4,d.post(n,t)];case 2:return[2,e.sent().data];case 3:throw i=e.sent(),console.error("Error submitting chat feedback:",i),i;case 4:return[2]}})})},exports.toggleVariant=function(t,a,n){return e.__awaiter(void 0,void 0,void 0,function(){var n,i,s,c;return e.__generator(this,function(e){switch(e.label){case 0:n=o.useLearningTemplateStore.getState().backwardCompatibility,i=o.useLearningTemplateStore.getState().app_integration_id,s=o.useLearningTemplateStore.getState().token,e.label=1;case 1:return e.trys.push([1,6,,7]),n?[4,S(s).patch(r.LEGACY_API_ENDPOINTS.toggleVariant,{variant_ids:t,is_enabled:a})]:[3,3];case 2:return[2,e.sent().data];case 3:return[4,S(s).patch(r.API_ENDPOINTS.toggleVariant,{variant_ids:t,application_mapping_id:i,is_enabled:a})];case 4:return[2,e.sent().data];case 5:return[3,7];case 6:throw c=e.sent(),console.error("Error toggling variant status:",c),c;case 7:return[2]}})})},exports.updateVariant=function(t,a){return e.__awaiter(void 0,void 0,void 0,function(){var a;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,d.put(r.API_ENDPOINTS.updateVariant,t)];case 1:return[2,e.sent().data];case 2:throw a=e.sent(),console.error("Error updating variant:",a),a;case 3:return[2]}})})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("axios"),r=require("./apiConfig.js"),a=require("../store/useAuthStore.js"),n=require("../store/useEnvStore.js"),o=require("../store/useLearningTemplateStore.js"),i=require("../config.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=s(t),u=function(e){return e.interceptors.request.use(function(e){var t=a.default.getState().user,r=null==t?void 0:t.accessToken;return r&&(e.headers.Authorization="Bearer ".concat(r)),e}),e},l=function(e,t){return e.interceptors.request.use(function(e){return e.baseURL=t(),e}),e},p=l(u(c.default.create({headers:{"Content-Type":"application/json"}})),function(){return n.default.getState().audacyBackendUrl||""}),d=l(u(c.default.create({headers:{"Content-Type":"application/json"}})),function(){return n.default.getState().llmStudioUrl||""}),_=l(u(c.default.create({headers:{"Content-Type":"application/json"}})),function(){return n.default.getState().appsecRbacUrl||""}),g=l(u(c.default.create({headers:{"Content-Type":"application/json"}})),function(){return n.default.getState().appsecBaseUrl||""}),S=function(e){return l(u(c.default.create({headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(e)},withCredentials:!0})),function(){return n.default.getState().llmStudioUrl||""})};exports.ApproveOrRejectVariants=function(t){var a=t.variant_ids,i=t.status,s=t.feedback,c=t.scopeId,u=t.is_deleted,l=t.appsecData;return e.__awaiter(void 0,void 0,void 0,function(){var t,p,_,g,h,v,f;return e.__generator(this,function(I){switch(I.label){case 0:t=o.useLearningTemplateStore.getState().backwardCompatibility,p=o.useLearningTemplateStore.getState().app_integration_id,_=o.useLearningTemplateStore.getState().token,g=n.default.getState().baseModeName,I.label=1;case 1:return I.trys.push([1,6,,7]),t?(v=r.LEGACY_API_ENDPOINTS.updateVariantStatus.replace("{scopeId}",c),h=e.__assign({variant_ids:a,status:i,feedback:s||"",is_deleted:null!=u&&u},l&&{appsecData:l}),[4,S(_).patch(v,h)]):[3,3];case 2:return[2,I.sent().data];case 3:return h=e.__assign({variant_ids:a,scope_id:c,application_mapping_id:p,status:i,feedback:s||"",is_deleted:null!=u&&u},l&&{appsecData:l}),v=r.API_ENDPOINTS.updateVariantStatus,g&&(v+="?mode_name=".concat(encodeURIComponent(g))),[4,d.put(v,h)];case 4:return[2,I.sent().data];case 5:return[3,7];case 6:throw f=I.sent(),console.log(f),f;case 7:return[2]}})})},exports.GetAppsecRoles=function(t){return e.__awaiter(void 0,void 0,void 0,function(){var r;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,_.get("/roles?appId=".concat(t))];case 1:return[2,e.sent().data];case 2:throw r=e.sent(),console.error(r),r;case 3:return[2]}})})},exports.alterQuestionPriority=function(t,a,n,i,s){return e.__awaiter(void 0,void 0,void 0,function(){var c,u,l,p,d,_;return e.__generator(this,function(e){switch(e.label){case 0:c=o.useLearningTemplateStore.getState().backwardCompatibility,u=o.useLearningTemplateStore.getState().app_integration_id,l=o.useLearningTemplateStore.getState().token,e.label=1;case 1:return e.trys.push([1,3,,4]),p=c?r.LEGACY_API_ENDPOINTS.alterRulePriority:r.API_ENDPOINTS.alterRulePriority,d=c?{scopeId:t,tierId:a,move:{movedRuleId:n,prevRuleId:i,nextRuleId:s}}:{scope_id:t,tier_id:a,move:{moved_rule_id:n,prev_rule_id:i,next_rule_id:s},application_mapping_id:u},[4,S(l).put(p,d)];case 2:return[2,e.sent().data];case 3:throw _=e.sent(),console.error("Error altering question priority:",_),_;case 4:return[2]}})})},exports.appsecApi=_,exports.appsecApigetUser=g,exports.appsecGetUserGroups=function(t){return void 0===t&&(t={}),e.__awaiter(void 0,void 0,void 0,function(){var r,a,n,o,i,s,c,u,l,p,d,g,S,h,v,f;return e.__generator(this,function(e){switch(e.label){case 0:r=t.appId,a=void 0===r?"":r,n=t.name,o=void 0===n?"":n,i=t.user,s=void 0===i?"":i,c=t.isActive,u=void 0===c||c,l=t.page,p=void 0===l?1:l,d=t.limit,g=void 0===d?10:d,S=t.pagination,h=void 0===S||S,v=new URLSearchParams({appId:a,name:o,user:s,isActive:String(u),page:String(p),limit:String(g),pagination:String(h)}),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,_.get("/groups?".concat(v.toString()))];case 2:return[2,e.sent().data];case 3:throw f=e.sent(),console.error("Failed to fetch user groups",f),f;case 4:return[2]}})})},exports.appsecGetUsersByQueryLite=function(t,r){return e.__awaiter(void 0,void 0,void 0,function(){var a,n,o,i,s,c,u,l,p,d,_,S,h,v,f,I,w;return e.__generator(this,function(e){switch(e.label){case 0:n=(a=r||{}).isPopulateRoles,o=void 0!==n&&n,i=a.isPopulatePermissions,s=void 0!==i&&i,c=a.isPopulateApps,u=void 0!==c&&c,l=a.isPopulateEnvironments,p=void 0!==l&&l,d=a.isPopulateOperations,_=void 0!==d&&d,S=a.isPopulateGroups,h=void 0!==S&&S,v=a.isPopulateOrganization,f=void 0!==v&&v,I=new URLSearchParams({search:t,isPopulateRoles:String(o),isPopulatePermissions:String(s),isPopulateApps:String(u),isPopulateEnvironments:String(p),isPopulateOperations:String(_),isPopulateGroups:String(h),isPopulateOrganization:String(f)}),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,g.get("/api/user/get-by-query-v2?".concat(I.toString()))];case 2:return[2,e.sent().data];case 3:throw w=e.sent(),console.error("Failed to fetch users",w),w;case 4:return[2]}})})},exports.audacyApi=p,exports.createRuleSet=function(t,a){return e.__awaiter(void 0,void 0,void 0,function(){var n,i,s;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),n=o.useLearningTemplateStore.getState().backwardCompatibility,i=n?r.LEGACY_API_ENDPOINTS.createRuleSet:r.API_ENDPOINTS.createRuleSet,[4,S(a).post(i,t)];case 1:return[2,e.sent().data];case 2:throw s=e.sent(),console.error("Error creating rule set:",s),s;case 3:return[2]}})})},exports.default=d,exports.deleteQuestion=function(t){return e.__awaiter(void 0,void 0,void 0,function(){var a,n,i,s,c;return e.__generator(this,function(e){switch(e.label){case 0:a=o.useLearningTemplateStore.getState().backwardCompatibility,n=o.useLearningTemplateStore.getState().app_integration_id,i=o.useLearningTemplateStore.getState().token,e.label=1;case 1:return e.trys.push([1,6,,7]),a?(s=r.LEGACY_API_ENDPOINTS.deleteQuestion.replace("{questionId}",t),[4,d.delete(s)]):[3,3];case 2:return[2,e.sent().data];case 3:return s=r.API_ENDPOINTS.deleteQuestion.replace("{questionId}",t).replace("{appIntegrationId}",null!=n?n:""),[4,S(i).delete(s)];case 4:return[2,e.sent().data];case 5:return[3,7];case 6:throw c=e.sent(),console.error("Error deleting question:",c),c;case 7:return[2]}})})},exports.deleteRule=function(t){return e.__awaiter(void 0,void 0,void 0,function(){var a,n,i,s,c;return e.__generator(this,function(e){switch(e.label){case 0:a=o.useLearningTemplateStore.getState().backwardCompatibility,n=o.useLearningTemplateStore.getState().app_integration_id,i=o.useLearningTemplateStore.getState().token,e.label=1;case 1:return e.trys.push([1,6,,7]),a?(s=r.LEGACY_API_ENDPOINTS.deleteRule.replace("{ruleId}",t),[4,d.delete(s)]):[3,3];case 2:return[2,e.sent().data];case 3:return s=r.API_ENDPOINTS.deleteRule.replace("{ruleId}",t).replace("{appIntegrationId}",null!=n?n:""),[4,S(i).delete(s)];case 4:return[2,e.sent().data];case 5:return[3,7];case 6:throw c=e.sent(),console.error("Error deleting rule:",c),c;case 7:return[2]}})})},exports.deleteRuleSet=function(t,a){return e.__awaiter(void 0,void 0,void 0,function(){var n,i,s,c;return e.__generator(this,function(e){switch(e.label){case 0:n=o.useLearningTemplateStore.getState().backwardCompatibility,i=o.useLearningTemplateStore.getState().app_integration_id,e.label=1;case 1:return e.trys.push([1,3,,4]),s=void 0,s=n?r.LEGACY_API_ENDPOINTS.deleteRuleSet.replace("{ruleSetId}",t):r.API_ENDPOINTS.deleteRuleSet.replace("{ruleSetId}",t).replace("{appIntegrationId}",null!=i?i:""),[4,S(a).delete(s)];case 2:return[2,e.sent().data];case 3:throw c=e.sent(),console.error("Error deleting rule set:",c),c;case 4:return[2]}})})},exports.deleteTier=function(t,a){return e.__awaiter(void 0,void 0,void 0,function(){var n,i,s,c,u;return e.__generator(this,function(e){switch(e.label){case 0:n=o.useLearningTemplateStore.getState().backwardCompatibility,i=o.useLearningTemplateStore.getState().app_integration_id,s=o.useLearningTemplateStore.getState().token,e.label=1;case 1:return e.trys.push([1,6,,7]),n?(c=r.LEGACY_API_ENDPOINTS.deleteTier.replace("{scopeId}",t).replace("{tierId}",a),[4,d.delete(c)]):[3,3];case 2:return[2,e.sent().data];case 3:return c=r.API_ENDPOINTS.deleteTier.replace("{scopeId}",t).replace("{tierId}",a).replace("{appIntegrationId}",null!=i?i:""),[4,S(s).delete(c)];case 4:return[2,e.sent().data];case 5:return[3,7];case 6:throw u=e.sent(),console.error("Error deleting tier:",u),u;case 7:return[2]}})})},exports.exportRuleSet=function(t){return e.__awaiter(void 0,void 0,void 0,function(){var a;return e.__generator(this,function(e){switch(e.label){case 0:if(!t)throw new Error("scopeId is required for exporting rule sets");e.label=1;case 1:return e.trys.push([1,3,,4]),[4,d.post(r.API_ENDPOINTS.exportRuleSet,{scope_id:t},{responseType:"blob"})];case 2:return[2,e.sent().data];case 3:throw a=e.sent(),console.error("Error exporting rule set:",a),a;case 4:return[2]}})})},exports.fetchLMSConfig=function(t,r,a){var n,o,i,s,c;return e.__awaiter(this,void 0,void 0,function(){var u,l,p,d;return e.__generator(this,function(_){switch(_.label){case 0:return[4,fetch("".concat(t,"/instant_learning/ilotj/application/getValueType/").concat(r),{headers:{Authorization:"Bearer ".concat(a)}})];case 1:if(!(u=_.sent()).ok)throw new Error("Failed to fetch LMS config");return[4,u.json()];case 2:return!(l=_.sent())||Array.isArray(l.data)&&0===l.data.length?[2,{lmsConfig:null,teachMeConfig:null,template:null}]:(p=null===(n=l.data[0])||void 0===n?void 0:n.value_type_config,[2,{lmsConfig:(d=null!==(o=null==p?void 0:p.learningManagement)&&void 0!==o?o:null)?e.__assign(e.__assign({},d),{agents:null!==(i=null==p?void 0:p.agents)&&void 0!==i?i:{}}):null,teachMeConfig:null!==(s=null==p?void 0:p.teachMe)&&void 0!==s?s:null,template:null!==(c=null==p?void 0:p.template)&&void 0!==c?c:null}])}})})},exports.fetchRulesByQuestionId=function(t,a){return e.__awaiter(void 0,void 0,void 0,function(){var n,i,s,c,u;return e.__generator(this,function(e){switch(e.label){case 0:n=o.useLearningTemplateStore.getState().backwardCompatibility,i=o.useLearningTemplateStore.getState().app_integration_id,s=o.useLearningTemplateStore.getState().token,e.label=1;case 1:return e.trys.push([1,6,,7]),n?(c=r.LEGACY_API_ENDPOINTS.fetchRulesByQuestionId.replace("{questionId}",t).replace("{scopeId}",a),[4,d.get(c)]):[3,3];case 2:return[2,e.sent().data];case 3:return c=r.API_ENDPOINTS.fetchRulesByQuestionId.replace("{appIntegrationId}",null!=i?i:"").replace("{questionId}",t).replace("{scopeId}",a),[4,S(s).get(c)];case 4:return[2,e.sent().data];case 5:return[3,7];case 6:throw u=e.sent(),console.error("Error fetching rules by question id:",u),u;case 7:return[2]}})})},exports.fetchScopes=function(t,a){return e.__awaiter(void 0,void 0,void 0,function(){var n,i,s;return e.__generator(this,function(e){switch(e.label){case 0:n=o.useLearningTemplateStore.getState().backwardCompatibility,e.label=1;case 1:if(e.trys.push([1,3,,4]),!t&&!1===n)throw new Error("App Integration ID is not provided. Falling back to legacy endpoint for fetching scopes.");return i=n?r.LEGACY_API_ENDPOINTS.fetchScopes:"".concat(r.API_ENDPOINTS.fetchScopes,"/").concat(t),[4,S(a).get(i)];case 2:return[2,e.sent().data];case 3:throw s=e.sent(),console.error("Error fetching rule sets:",s),s;case 4:return[2]}})})},exports.fetchStationsByKeyword=function(t,a){return void 0===a&&(a=!1),e.__awaiter(void 0,void 0,void 0,function(){var n,o;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),n="".concat(r.API_ENDPOINTS.fetchStationsByKeyword.replace("{keyword}",t),"?allow_existing=").concat(a),[4,p.get(n)];case 1:return[2,e.sent().data];case 2:throw o=e.sent(),console.error("Error fetching station name by keyword:",o),o;case 3:return[2]}})})},exports.fetchTiers=function(){return e.__awaiter(void 0,void 0,void 0,function(){var t,a,n,s,c,u,l,p;return e.__generator(this,function(e){switch(e.label){case 0:t=o.useLearningTemplateStore.getState().backwardCompatibility,a=o.useLearningTemplateStore.getState().app_integration_id,n=o.useLearningTemplateStore.getState().token,e.label=1;case 1:return e.trys.push([1,6,,7]),t?(s=i.IL_CONFIG_CONSTANTS.CUSTOM_SCOPE_GROUP_NAME,[4,S(n).post(r.LEGACY_API_ENDPOINTS.getTiers,{tier_group_name:s})]):[3,3];case 2:return c=e.sent(),o.useLearningTemplateStore.getState().setTiers((null===(l=c.data)||void 0===l?void 0:l.response)||[]),[3,5];case 3:return[4,S(n).get(r.API_ENDPOINTS.getTiers.replace("{appIntegrationId}",null!=a?a:""))];case 4:c=e.sent(),"success"===(null===(p=c.data)||void 0===p?void 0:p.status)&&o.useLearningTemplateStore.getState().setTiers(c.data.data.map(function(e){return{tier_id:e.id,tier_name:e.tier_title,tier_priority:e.tier_priority}})),e.label=5;case 5:return[3,7];case 6:throw u=e.sent(),console.error("Error fetching tiers:",u),u;case 7:return[2]}})})},exports.getILInstance=function(t){return e.__awaiter(void 0,void 0,void 0,function(){var a,n;return e.__generator(this,function(e){switch(e.label){case 0:a=o.useLearningTemplateStore.getState().token,e.label=1;case 1:return e.trys.push([1,3,,4]),[4,S(a).get("".concat(r.API_ENDPOINTS.getILInstance).concat(t))];case 2:return[2,e.sent().data];case 3:throw n=e.sent(),console.error("Error fetching IL instance:",n),n;case 4:return[2]}})})},exports.getRuleOverrideHistory=function(t){return e.__awaiter(void 0,void 0,void 0,function(){var a,n,i,s;return e.__generator(this,function(e){switch(e.label){case 0:a=o.useLearningTemplateStore.getState().backwardCompatibility,n=o.useLearningTemplateStore.getState().app_integration_id,e.label=1;case 1:return e.trys.push([1,3,,4]),i=a?"".concat(r.LEGACY_API_ENDPOINTS.getRuleOverrideHistory,"/").concat(t):"".concat(r.API_ENDPOINTS.getRuleOverrideHistory,"/").concat(t,"/").concat(null!=n?n:""),[4,d.get(i)];case 2:return[2,e.sent().data];case 3:throw s=e.sent(),console.error("Error getting rule override history:",s),s;case 4:return[2]}})})},exports.getRulesInRuleSetById=function(t,a){return e.__awaiter(void 0,void 0,void 0,function(){var n,i,s,c;return e.__generator(this,function(e){switch(e.label){case 0:n=o.useLearningTemplateStore.getState().backwardCompatibility,i=o.useLearningTemplateStore.getState().app_integration_id,e.label=1;case 1:return e.trys.push([1,3,,4]),s=n?"".concat(r.LEGACY_API_ENDPOINTS.getRulesInRuleSetById,"/").concat(t,"?include_config=True&sort_variant_by=createdAt"):"".concat(r.API_ENDPOINTS.getRulesInRuleSetById,"/").concat(t,"/").concat(null!=i?i:""),[4,S(a).get(s)];case 2:return[2,e.sent().data];case 3:return c=e.sent(),console.error("Error fetching rules in rule set:",c),[3,4];case 4:return[2]}})})},exports.getStationsByScopeId=function(t){return e.__awaiter(void 0,void 0,void 0,function(){return e.__generator(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)})]})})},exports.inheritScope=function(t){return e.__awaiter(void 0,void 0,void 0,function(){var a;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,4,,5]),(null==t?void 0:t.application_mapping_id)?[4,d.post(r.API_ENDPOINTS.inheritScope,t)]:[3,2];case 1:return[2,e.sent().data];case 2:throw Error("Fatal Error: Trying to call inherit API without appintegration ID");case 3:return[3,5];case 4:throw a=e.sent(),console.error("Error inheriting scope:",a),a;case 5:return[2]}})})},exports.inheritScopeBackwardCompatible=function(t){return e.__awaiter(void 0,void 0,void 0,function(){var a;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,d.post(r.LEGACY_API_ENDPOINTS.inheritScope,t)];case 1:return[2,e.sent().data];case 2:throw a=e.sent(),console.error("Error inheriting scope:",a),a;case 3:return[2]}})})},exports.llmApiWithToken=S,exports.publishFeedback=function(t,a){return e.__awaiter(void 0,void 0,void 0,function(){var a,n,i;return e.__generator(this,function(e){switch(e.label){case 0:a=o.useLearningTemplateStore.getState().backwardCompatibility,e.label=1;case 1:return e.trys.push([1,3,,4]),n=a?r.LEGACY_API_ENDPOINTS.publishFeedback:"".concat(r.API_ENDPOINTS.publishFeedback),[4,d.post(n,t)];case 2:return[2,e.sent().data];case 3:throw i=e.sent(),console.error("Error publishing feedback to LLM Studio:",i),i;case 4:return[2]}})})},exports.renameScope=function(t,a){return e.__awaiter(void 0,void 0,void 0,function(){var n,i,s;return e.__generator(this,function(e){switch(e.label){case 0:n=o.useLearningTemplateStore.getState().backwardCompatibility,e.label=1;case 1:return e.trys.push([1,3,,4]),i=n?r.LEGACY_API_ENDPOINTS.renameScope:r.API_ENDPOINTS.renameScope,[4,S(a).put(i,t)];case 2:return[2,e.sent().data];case 3:throw s=e.sent(),console.error("Error renaming scope:",s),s;case 4:return[2]}})})},exports.requestAccess=function(t){return e.__awaiter(void 0,void 0,void 0,function(){var a,n,i,s,c,u,l;return e.__generator(this,function(e){switch(e.label){case 0:a=o.useLearningTemplateStore.getState().backwardCompatibility,n=o.useLearningTemplateStore.getState().app_integration_id,i=o.useLearningTemplateStore.getState().token,s=window.location.href,c=s.indexOf("/mode"),u=-1!==c?s.substring(c+1):(window.location.pathname+window.location.search).substring(1),e.label=1;case 1:return e.trys.push([1,6,,7]),a?[4,d.post(r.LEGACY_API_ENDPOINTS.requestAccess,{scope_id:t,mode_learning_endpoint:u})]:[3,3];case 2:return[2,e.sent().data];case 3:return[4,S(i).post(r.API_ENDPOINTS.requestAccess,{scope_id:t,application_mapping_id:n,mode_learning_endpoint:u})];case 4:return[2,e.sent().data];case 5:return[3,7];case 6:throw l=e.sent(),console.error("Error requesting global scope access:",l),l;case 7:return[2]}})})},exports.retrieveGenreScopes=function(t){return void 0===t&&(t={limit:"50",offset:"0"}),e.__awaiter(void 0,void 0,void 0,function(){var a;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,d.post(r.API_ENDPOINTS.retrieveGenreScopes,t)];case 1:return[2,e.sent().data];case 2:throw a=e.sent(),console.error("Error retrieving genre scopes:",a),a;case 3:return[2]}})})},exports.saveInstantLearningQuestion=function(t){return e.__awaiter(void 0,void 0,void 0,function(){var a;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,d.post(r.API_ENDPOINTS.saveInstantLearningQuestion,t)];case 1:return[2,e.sent().data];case 2:throw a=e.sent(),console.error("Error saving instant learning question:",a),a;case 3:return[2]}})})},exports.searchScopes=function(t){return e.__awaiter(void 0,void 0,void 0,function(){var a;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,d.post(r.API_ENDPOINTS.searchScopes,t)];case 1:return[2,e.sent().data];case 2:throw a=e.sent(),console.error("Error searching scopes:",a),a;case 3:return[2]}})})},exports.submitChatFeedback=function(t){return e.__awaiter(void 0,void 0,void 0,function(){var a,n,i;return e.__generator(this,function(e){switch(e.label){case 0:a=o.useLearningTemplateStore.getState().backwardCompatibility,n=a?r.LEGACY_API_ENDPOINTS.submitChatFeedback:r.API_ENDPOINTS.submitChatFeedback,e.label=1;case 1:return e.trys.push([1,3,,4]),[4,d.post(n,t)];case 2:return[2,e.sent().data];case 3:throw i=e.sent(),console.error("Error submitting chat feedback:",i),i;case 4:return[2]}})})},exports.toggleVariant=function(t,a,n){return e.__awaiter(void 0,void 0,void 0,function(){var n,i,s,c;return e.__generator(this,function(e){switch(e.label){case 0:n=o.useLearningTemplateStore.getState().backwardCompatibility,i=o.useLearningTemplateStore.getState().app_integration_id,s=o.useLearningTemplateStore.getState().token,e.label=1;case 1:return e.trys.push([1,6,,7]),n?[4,S(s).patch(r.LEGACY_API_ENDPOINTS.toggleVariant,{variant_ids:t,is_enabled:a})]:[3,3];case 2:return[2,e.sent().data];case 3:return[4,S(s).patch(r.API_ENDPOINTS.toggleVariant,{variant_ids:t,application_mapping_id:i,is_enabled:a})];case 4:return[2,e.sent().data];case 5:return[3,7];case 6:throw c=e.sent(),console.error("Error toggling variant status:",c),c;case 7:return[2]}})})},exports.updateVariant=function(t,a){return e.__awaiter(void 0,void 0,void 0,function(){var a;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,d.put(r.API_ENDPOINTS.updateVariant,t)];case 1:return[2,e.sent().data];case 2:throw a=e.sent(),console.error("Error updating variant:",a),a;case 3:return[2]}})})};
2
2
  //# sourceMappingURL=scopeApis.js.map
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),require("react");exports.default="data:image/svg+xml,%3Csvg%20width%3D%22160%22%20height%3D%22153%22%20viewBox%3D%220%200%20160%20153%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M79.2744%20143.735C116.627%20143.735%20146.909%20113.508%20146.909%2076.223C146.909%2038.9359%20116.627%208.71106%2079.2744%208.71106C41.9192%208.71106%2011.6367%2038.9359%2011.6367%2076.223C11.6367%20113.508%2041.9192%20143.735%2079.2744%20143.735Z%22%20fill%3D%22%23F8FAFC%22%2F%3E%3Cpath%20d%3D%22M116.902%2030.8984H43.3269C38.7417%2030.8984%2035.0234%2034.7993%2035.0234%2039.6097H125.205C125.205%2034.7993%20121.489%2030.8984%20116.902%2030.8984Z%22%20fill%3D%22%23D0D9E4%22%2F%3E%3Cpath%20d%3D%22M35.0234%2039.6094H125.205V109.239C125.205%20112.335%20123.994%20115.304%20121.834%20117.494C119.674%20119.684%20116.745%20120.914%20113.692%20120.914H46.5394C43.4834%20120.914%2040.555%20119.684%2038.3973%20117.494C36.2372%20115.304%2035.0234%20112.335%2035.0234%20109.239V39.6094Z%22%20fill%3D%22%23F1F5F9%22%2F%3E%3Cpath%20d%3D%22M125.155%2039.6592V109.239C125.155%20112.322%20123.949%20115.279%20121.798%20117.459C119.647%20119.639%20116.731%20120.864%20113.691%20120.864H46.5391C43.4967%20120.864%2040.5809%20119.639%2038.4326%20117.459C36.2818%20115.279%2035.0732%20112.322%2035.0732%20109.239V39.6592H125.155Z%22%20stroke%3D%22%2364748B%22%20stroke-opacity%3D%220.1%22%20stroke-width%3D%220.1%22%2F%3E%3Cpath%20d%3D%22M70.571%2048.3203H48.9307C48.4799%2048.3203%2048.1133%2049.295%2048.1133%2050.4981C48.1133%2051.7012%2048.4799%2052.6759%2048.9307%2052.6759H70.571C71.0218%2052.6759%2071.386%2051.7012%2071.386%2050.4981C71.386%2049.295%2071.0218%2048.3203%2070.571%2048.3203Z%22%20fill%3D%22url%28%23paint0_linear_1020_82405%29%22%2F%3E%3Cpath%20d%3D%22M70.571%2067.1953H48.9307C48.4799%2067.1953%2048.1133%2068.17%2048.1133%2069.3731C48.1133%2070.5762%2048.4799%2071.5509%2048.9307%2071.5509H70.571C71.0218%2071.5509%2071.386%2070.5762%2071.386%2069.3731C71.386%2068.17%2071.0218%2067.1953%2070.571%2067.1953Z%22%20fill%3D%22url%28%23paint1_linear_1020_82405%29%22%2F%3E%3Cpath%20d%3D%22M70.571%2086.0703H48.9307C48.4799%2086.0703%2048.1133%2087.0468%2048.1133%2088.2493C48.1133%2089.4517%2048.4799%2090.4259%2048.9307%2090.4259H70.571C71.0218%2090.4259%2071.386%2089.4517%2071.386%2088.2493C71.386%2087.0468%2071.0218%2086.0703%2070.571%2086.0703Z%22%20fill%3D%22url%28%23paint2_linear_1020_82405%29%22%2F%3E%3Cpath%20d%3D%22M70.571%20104.945H48.9307C48.4799%20104.945%2048.1133%20105.922%2048.1133%20107.124C48.1133%20108.327%2048.4799%20109.301%2048.9307%20109.301H70.571C71.0218%20109.301%2071.386%20108.327%2071.386%20107.124C71.386%20105.922%2071.0218%20104.945%2070.571%20104.945Z%22%20fill%3D%22url%28%23paint3_linear_1020_82405%29%22%2F%3E%3Cpath%20d%3D%22M116.507%2048.3203H78.6367C77.8481%2048.3203%2077.207%2049.295%2077.207%2050.4981C77.207%2051.7012%2077.8481%2052.6759%2078.6367%2052.6759H116.507C117.296%2052.6759%20117.934%2051.7012%20117.934%2050.4981C117.934%2049.295%20117.296%2048.3203%20116.507%2048.3203Z%22%20fill%3D%22url%28%23paint4_linear_1020_82405%29%22%2F%3E%3Cpath%20d%3D%22M116.507%2086.0703H78.6367C77.8481%2086.0703%2077.207%2087.045%2077.207%2088.2481C77.207%2089.4512%2077.8481%2090.4259%2078.6367%2090.4259H116.507C117.296%2090.4259%20117.934%2089.4512%20117.934%2088.2481C117.934%2087.045%20117.296%2086.0703%20116.507%2086.0703Z%22%20fill%3D%22url%28%23paint5_linear_1020_82405%29%22%2F%3E%3Cpath%20d%3D%22M116.507%2067.1953H78.6367C77.8481%2067.1953%2077.207%2068.17%2077.207%2069.3731C77.207%2070.5762%2077.8481%2071.5509%2078.6367%2071.5509H116.507C117.296%2071.5509%20117.934%2070.5762%20117.934%2069.3731C117.934%2068.17%20117.296%2067.1953%20116.507%2067.1953Z%22%20fill%3D%22url%28%23paint6_linear_1020_82405%29%22%2F%3E%3Cpath%20d%3D%22M116.507%20104.945H78.6367C77.8481%20104.945%2077.207%20105.92%2077.207%20107.123C77.207%20108.326%2077.8481%20109.301%2078.6367%20109.301H116.507C117.296%20109.301%20117.934%20108.326%20117.934%20107.123C117.934%20105.92%20117.296%20104.945%20116.507%20104.945Z%22%20fill%3D%22url%28%23paint7_linear_1020_82405%29%22%2F%3E%3CforeignObject%20x%3D%2270.7116%22%20y%3D%2260.6843%22%20width%3D%2279.8961%22%20height%3D%2279.81%22%3E%3Cdiv%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml%22%20style%3D%22backdrop-filter%3Ablur%288.34px%29%3Bclip-path%3Aurl%28%23bgblur_0_1020_82405_clip_path%29%3Bheight%3A100%25%3Bwidth%3A100%25%22%3E%3C%2Fdiv%3E%3C%2FforeignObject%3E%3Cpath%20data-figma-bg-blur-radius%3D%2216.6751%22%20d%3D%22M110.659%20123.819C123.513%20123.819%20133.932%20113.419%20133.932%20100.589C133.932%2087.7597%20123.513%2077.3594%20110.659%2077.3594C97.8062%2077.3594%2087.3867%2087.7597%2087.3867%20100.589C87.3867%20113.419%2097.8062%20123.819%20110.659%20123.819Z%22%20fill%3D%22white%22%2F%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M110.659%2085.3419C111.63%2085.3458%20112.413%2086.1299%20112.411%2087.0961L112.395%2098.2651L123.584%2098.2817C124.555%2098.2856%20125.338%2099.0696%20125.339%20100.038C125.335%20101.007%20124.55%20101.789%20123.579%20101.79L112.39%20101.773L112.373%20112.942C112.372%20113.908%20111.586%20114.69%20110.615%20114.691C109.645%20114.687%20108.862%20113.903%20108.861%20112.935L108.877%20101.766L97.6878%20101.749C96.7198%20101.748%2095.9366%20100.964%2095.9355%2099.9948C95.9395%2099.0261%2096.725%2098.2443%2097.693%2098.2458L108.883%2098.2623L108.899%2087.0934C108.903%2086.1247%20109.689%2085.3429%20110.659%2085.3419Z%22%20fill%3D%22%23CBD5E1%22%2F%3E%3Cdefs%3E%3CclipPath%20id%3D%22bgblur_0_1020_82405_clip_path%22%20transform%3D%22translate%28-70.7116%20-60.6843%29%22%3E%3Cpath%20d%3D%22M110.659%20123.819C123.513%20123.819%20133.932%20113.419%20133.932%20100.589C133.932%2087.7597%20123.513%2077.3594%20110.659%2077.3594C97.8062%2077.3594%2087.3867%2087.7597%2087.3867%20100.589C87.3867%20113.419%2097.8062%20123.819%20110.659%20123.819Z%22%2F%3E%3C%2FclipPath%3E%3ClinearGradient%20id%3D%22paint0_linear_1020_82405%22%20x1%3D%2247.1291%22%20y1%3D%2252.497%22%20x2%3D%2272.7628%22%20y2%3D%2252.497%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23CBD5E1%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23F8F9FB%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint1_linear_1020_82405%22%20x1%3D%2247.1291%22%20y1%3D%2271.372%22%20x2%3D%2272.7628%22%20y2%3D%2271.372%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23CBD5E1%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23F8F9FB%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint2_linear_1020_82405%22%20x1%3D%2247.1291%22%20y1%3D%2290.247%22%20x2%3D%2272.7628%22%20y2%3D%2290.247%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23CBD5E1%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23F8F9FB%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint3_linear_1020_82405%22%20x1%3D%2247.1291%22%20y1%3D%22109.122%22%20x2%3D%2272.7628%22%20y2%3D%22109.122%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23CBD5E1%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23F8F9FB%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint4_linear_1020_82405%22%20x1%3D%2275.4847%22%20y1%3D%2252.497%22%20x2%3D%22120.344%22%20y2%3D%2252.497%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23CBD5E1%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23F8F9FB%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint5_linear_1020_82405%22%20x1%3D%2275.4847%22%20y1%3D%2290.247%22%20x2%3D%22120.344%22%20y2%3D%2290.247%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23CBD5E1%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23F8F9FB%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint6_linear_1020_82405%22%20x1%3D%2275.4847%22%20y1%3D%2271.372%22%20x2%3D%22120.344%22%20y2%3D%2271.372%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23CBD5E1%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23F8F9FB%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint7_linear_1020_82405%22%20x1%3D%2275.4847%22%20y1%3D%22109.122%22%20x2%3D%22120.344%22%20y2%3D%22109.122%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23CBD5E1%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23F8F9FB%22%2F%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%3C%2Fsvg%3E";
2
+ //# sourceMappingURL=Search-result(add new).svg.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Search-result(add new).svg.js","sources":["../../../../../src/features/LearningManagement/assets/Search-result(add new).svg"],"sourcesContent":["export default \"data:image/svg+xml,%3Csvg%20width%3D%22160%22%20height%3D%22153%22%20viewBox%3D%220%200%20160%20153%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M79.2744%20143.735C116.627%20143.735%20146.909%20113.508%20146.909%2076.223C146.909%2038.9359%20116.627%208.71106%2079.2744%208.71106C41.9192%208.71106%2011.6367%2038.9359%2011.6367%2076.223C11.6367%20113.508%2041.9192%20143.735%2079.2744%20143.735Z%22%20fill%3D%22%23F8FAFC%22%2F%3E%3Cpath%20d%3D%22M116.902%2030.8984H43.3269C38.7417%2030.8984%2035.0234%2034.7993%2035.0234%2039.6097H125.205C125.205%2034.7993%20121.489%2030.8984%20116.902%2030.8984Z%22%20fill%3D%22%23D0D9E4%22%2F%3E%3Cpath%20d%3D%22M35.0234%2039.6094H125.205V109.239C125.205%20112.335%20123.994%20115.304%20121.834%20117.494C119.674%20119.684%20116.745%20120.914%20113.692%20120.914H46.5394C43.4834%20120.914%2040.555%20119.684%2038.3973%20117.494C36.2372%20115.304%2035.0234%20112.335%2035.0234%20109.239V39.6094Z%22%20fill%3D%22%23F1F5F9%22%2F%3E%3Cpath%20d%3D%22M125.155%2039.6592V109.239C125.155%20112.322%20123.949%20115.279%20121.798%20117.459C119.647%20119.639%20116.731%20120.864%20113.691%20120.864H46.5391C43.4967%20120.864%2040.5809%20119.639%2038.4326%20117.459C36.2818%20115.279%2035.0732%20112.322%2035.0732%20109.239V39.6592H125.155Z%22%20stroke%3D%22%2364748B%22%20stroke-opacity%3D%220.1%22%20stroke-width%3D%220.1%22%2F%3E%3Cpath%20d%3D%22M70.571%2048.3203H48.9307C48.4799%2048.3203%2048.1133%2049.295%2048.1133%2050.4981C48.1133%2051.7012%2048.4799%2052.6759%2048.9307%2052.6759H70.571C71.0218%2052.6759%2071.386%2051.7012%2071.386%2050.4981C71.386%2049.295%2071.0218%2048.3203%2070.571%2048.3203Z%22%20fill%3D%22url%28%23paint0_linear_1020_82405%29%22%2F%3E%3Cpath%20d%3D%22M70.571%2067.1953H48.9307C48.4799%2067.1953%2048.1133%2068.17%2048.1133%2069.3731C48.1133%2070.5762%2048.4799%2071.5509%2048.9307%2071.5509H70.571C71.0218%2071.5509%2071.386%2070.5762%2071.386%2069.3731C71.386%2068.17%2071.0218%2067.1953%2070.571%2067.1953Z%22%20fill%3D%22url%28%23paint1_linear_1020_82405%29%22%2F%3E%3Cpath%20d%3D%22M70.571%2086.0703H48.9307C48.4799%2086.0703%2048.1133%2087.0468%2048.1133%2088.2493C48.1133%2089.4517%2048.4799%2090.4259%2048.9307%2090.4259H70.571C71.0218%2090.4259%2071.386%2089.4517%2071.386%2088.2493C71.386%2087.0468%2071.0218%2086.0703%2070.571%2086.0703Z%22%20fill%3D%22url%28%23paint2_linear_1020_82405%29%22%2F%3E%3Cpath%20d%3D%22M70.571%20104.945H48.9307C48.4799%20104.945%2048.1133%20105.922%2048.1133%20107.124C48.1133%20108.327%2048.4799%20109.301%2048.9307%20109.301H70.571C71.0218%20109.301%2071.386%20108.327%2071.386%20107.124C71.386%20105.922%2071.0218%20104.945%2070.571%20104.945Z%22%20fill%3D%22url%28%23paint3_linear_1020_82405%29%22%2F%3E%3Cpath%20d%3D%22M116.507%2048.3203H78.6367C77.8481%2048.3203%2077.207%2049.295%2077.207%2050.4981C77.207%2051.7012%2077.8481%2052.6759%2078.6367%2052.6759H116.507C117.296%2052.6759%20117.934%2051.7012%20117.934%2050.4981C117.934%2049.295%20117.296%2048.3203%20116.507%2048.3203Z%22%20fill%3D%22url%28%23paint4_linear_1020_82405%29%22%2F%3E%3Cpath%20d%3D%22M116.507%2086.0703H78.6367C77.8481%2086.0703%2077.207%2087.045%2077.207%2088.2481C77.207%2089.4512%2077.8481%2090.4259%2078.6367%2090.4259H116.507C117.296%2090.4259%20117.934%2089.4512%20117.934%2088.2481C117.934%2087.045%20117.296%2086.0703%20116.507%2086.0703Z%22%20fill%3D%22url%28%23paint5_linear_1020_82405%29%22%2F%3E%3Cpath%20d%3D%22M116.507%2067.1953H78.6367C77.8481%2067.1953%2077.207%2068.17%2077.207%2069.3731C77.207%2070.5762%2077.8481%2071.5509%2078.6367%2071.5509H116.507C117.296%2071.5509%20117.934%2070.5762%20117.934%2069.3731C117.934%2068.17%20117.296%2067.1953%20116.507%2067.1953Z%22%20fill%3D%22url%28%23paint6_linear_1020_82405%29%22%2F%3E%3Cpath%20d%3D%22M116.507%20104.945H78.6367C77.8481%20104.945%2077.207%20105.92%2077.207%20107.123C77.207%20108.326%2077.8481%20109.301%2078.6367%20109.301H116.507C117.296%20109.301%20117.934%20108.326%20117.934%20107.123C117.934%20105.92%20117.296%20104.945%20116.507%20104.945Z%22%20fill%3D%22url%28%23paint7_linear_1020_82405%29%22%2F%3E%3CforeignObject%20x%3D%2270.7116%22%20y%3D%2260.6843%22%20width%3D%2279.8961%22%20height%3D%2279.81%22%3E%3Cdiv%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml%22%20style%3D%22backdrop-filter%3Ablur%288.34px%29%3Bclip-path%3Aurl%28%23bgblur_0_1020_82405_clip_path%29%3Bheight%3A100%25%3Bwidth%3A100%25%22%3E%3C%2Fdiv%3E%3C%2FforeignObject%3E%3Cpath%20data-figma-bg-blur-radius%3D%2216.6751%22%20d%3D%22M110.659%20123.819C123.513%20123.819%20133.932%20113.419%20133.932%20100.589C133.932%2087.7597%20123.513%2077.3594%20110.659%2077.3594C97.8062%2077.3594%2087.3867%2087.7597%2087.3867%20100.589C87.3867%20113.419%2097.8062%20123.819%20110.659%20123.819Z%22%20fill%3D%22white%22%2F%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M110.659%2085.3419C111.63%2085.3458%20112.413%2086.1299%20112.411%2087.0961L112.395%2098.2651L123.584%2098.2817C124.555%2098.2856%20125.338%2099.0696%20125.339%20100.038C125.335%20101.007%20124.55%20101.789%20123.579%20101.79L112.39%20101.773L112.373%20112.942C112.372%20113.908%20111.586%20114.69%20110.615%20114.691C109.645%20114.687%20108.862%20113.903%20108.861%20112.935L108.877%20101.766L97.6878%20101.749C96.7198%20101.748%2095.9366%20100.964%2095.9355%2099.9948C95.9395%2099.0261%2096.725%2098.2443%2097.693%2098.2458L108.883%2098.2623L108.899%2087.0934C108.903%2086.1247%20109.689%2085.3429%20110.659%2085.3419Z%22%20fill%3D%22%23CBD5E1%22%2F%3E%3Cdefs%3E%3CclipPath%20id%3D%22bgblur_0_1020_82405_clip_path%22%20transform%3D%22translate%28-70.7116%20-60.6843%29%22%3E%3Cpath%20d%3D%22M110.659%20123.819C123.513%20123.819%20133.932%20113.419%20133.932%20100.589C133.932%2087.7597%20123.513%2077.3594%20110.659%2077.3594C97.8062%2077.3594%2087.3867%2087.7597%2087.3867%20100.589C87.3867%20113.419%2097.8062%20123.819%20110.659%20123.819Z%22%2F%3E%3C%2FclipPath%3E%3ClinearGradient%20id%3D%22paint0_linear_1020_82405%22%20x1%3D%2247.1291%22%20y1%3D%2252.497%22%20x2%3D%2272.7628%22%20y2%3D%2252.497%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23CBD5E1%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23F8F9FB%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint1_linear_1020_82405%22%20x1%3D%2247.1291%22%20y1%3D%2271.372%22%20x2%3D%2272.7628%22%20y2%3D%2271.372%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23CBD5E1%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23F8F9FB%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint2_linear_1020_82405%22%20x1%3D%2247.1291%22%20y1%3D%2290.247%22%20x2%3D%2272.7628%22%20y2%3D%2290.247%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23CBD5E1%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23F8F9FB%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint3_linear_1020_82405%22%20x1%3D%2247.1291%22%20y1%3D%22109.122%22%20x2%3D%2272.7628%22%20y2%3D%22109.122%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23CBD5E1%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23F8F9FB%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint4_linear_1020_82405%22%20x1%3D%2275.4847%22%20y1%3D%2252.497%22%20x2%3D%22120.344%22%20y2%3D%2252.497%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23CBD5E1%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23F8F9FB%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint5_linear_1020_82405%22%20x1%3D%2275.4847%22%20y1%3D%2290.247%22%20x2%3D%22120.344%22%20y2%3D%2290.247%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23CBD5E1%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23F8F9FB%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint6_linear_1020_82405%22%20x1%3D%2275.4847%22%20y1%3D%2271.372%22%20x2%3D%22120.344%22%20y2%3D%2271.372%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23CBD5E1%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23F8F9FB%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint7_linear_1020_82405%22%20x1%3D%2275.4847%22%20y1%3D%22109.122%22%20x2%3D%22120.344%22%20y2%3D%22109.122%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23CBD5E1%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23F8F9FB%22%2F%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%3C%2Fsvg%3E\""],"names":[],"mappings":"qGA0Ke"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),r=require("@mui/material"),o=require("lucide-react"),i=require("primereact/toast"),s=require("uuid"),a=require("../../assets/Search-result(add new).svg.js"),l=require("../../store/useAuthStore.js"),u=require("../../config.js"),c=require("../../apis/scopeApis.js"),d=require("./InputField.js"),p=require("./StationAutocomplete.js"),f=require("../CardSkeleton.js"),g=require("./OnboardingLoader.js"),x=require("./TemplateCard.js"),_=[{label:"5am to 7pm",value:"05:00 AM - 7:00 PM"},{label:"6am to 7pm",value:"06:00 AM - 7:00 PM"}],m=[{label:"Low Sellout",value:"Low Sellout"},{label:"High Sellout",value:"High Sellout"},{label:"None",value:""}],h=[{label:"None",value:"None"},{label:"Distribute spots evenly across all breaks in the hour",value:"Distribute spots evenly across all breaks in the hour"}];exports.default=function(v){var S,y=v.isOpen,b=v.onClose,j=v.onBoardStation,w=v.app_integration_id,C=v.token,T=v.stationNameParam,O=t.useState(null),F=O[0],N=O[1],B=t.useState([]),A=B[0],E=B[1],M=t.useState(0),D=M[0],q=M[1],I=t.useState(!0),k=I[0],P=I[1],R=t.useState(!1),z=R[0],L=R[1],W=t.useState([]),G=W[0],U=W[1],Y=t.useState(""),H=Y[0],K=Y[1],X=t.useState(""),J=X[0],Q=X[1],V=t.useState(!1),Z=V[0],$=V[1],ee=t.useState(!1),ne=ee[0],te=ee[1],re=t.useState(null),oe=re[0],ie=re[1],se=t.useState(!1),ae=se[0],le=se[1],ue=t.useState(0),ce=ue[0],de=ue[1],pe=t.useState(""),fe=pe[0],ge=pe[1],xe=l.default().user,_e=t.useRef(null),me=t.useRef(null),he=t.useRef(null),ve=t.useRef(null),Se=t.useState({region:"",primeTime:["06:00 AM - 7:00 PM"],genre:"Music",type:"",lowSelloutConfig:""}),ye=Se[0],be=Se[1],je=function(e,n){return e.find(function(e){return e.value===n})||null},we=t.useMemo(function(){return A.map(function(e){return{label:e.scope_name,value:e.scope_name}})},[A]),Ce=t.useMemo(function(){var e,n,t;if(!ye.genre)return null;var r=A.find(function(e){return e.scope_name===ye.genre});return r?{id:r.id,title:r.scope_name||"Unnamed Template",description:(null===(e=r.description)||void 0===e?void 0:e.trim())||"No description available.",inheritedText:(null===(n=r.inheritance)||void 0===n?void 0:n[0])||void 0,rulesCount:r.rules_count||0,tiersCount:r.tier_count||0,isCopy:null!==(t=r.is_copy)&&void 0!==t&&t}:null},[ye.genre,A]);t.useEffect(function(){return function(){he.current&&clearTimeout(he.current)}},[]);var Te=function(n){return e.__awaiter(void 0,void 0,void 0,function(){var t,r,o;return e.__generator(this,function(i){switch(i.label){case 0:if(z)return[2];L(!0),i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,c.retrieveGenreScopes({limit:"20",offset:String(n)})];case 2:return"success"===(null==(t=i.sent())?void 0:t.status)&&Array.isArray(null==t?void 0:t.data)?(r=t.data,E(function(t){if(0===n)return r;var o=new Set(t.map(function(e){return e.id})),i=r.filter(function(e){return!o.has(e.id)});return e.__spreadArray(e.__spreadArray([],t,!0),i,!0)}),r.length<20?P(!1):P(!0),q(n+20)):P(!1),[3,5];case 3:return o=i.sent(),console.error("[StationOnboard] Failed to fetch genre scopes:",o),P(!1),[3,5];case 4:return L(!1),[7];case 5:return[2]}})})};t.useEffect(function(){if(y&&(E([]),q(0),P(!0),Te(0),T)){ge(T);e.__awaiter(void 0,void 0,void 0,function(){var n,t,r;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,c.fetchStationsByKeyword(T,!0)];case 1:return!0===(null==(n=e.sent())?void 0:n.success)&&Array.isArray(null==n?void 0:n.data)&&(t=n.data.find(function(e){var n;return(null===(n=e.station_name)||void 0===n?void 0:n.toLowerCase())===T.toLowerCase()&&!e.ruleset_id}),t&&N(t)),[3,3];case 2:return r=e.sent(),console.error("[StationOnboard] Error auto-selecting station:",r),[3,3];case 3:return[2]}})})}},[y,T]);t.useEffect(function(){be(F?function(n){var t;return e.__assign(e.__assign({},n),{region:null!==(t=F.market)&&void 0!==t?t:""})}:{region:"",primeTime:["06:00 AM - 7:00 PM"],genre:"Music",type:"",lowSelloutConfig:""})},[F]),t.useEffect(function(){var e=setTimeout(function(){Q(H)},500);return function(){return clearTimeout(e)}},[H]),t.useEffect(function(){e.__awaiter(void 0,void 0,void 0,function(){var n,t,r;return e.__generator(this,function(e){switch(e.label){case 0:if(!J.trim())return U([]),[2];$(!0),e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,c.searchScopes({search_string:J})];case 2:return"success"===(null==(n=e.sent())?void 0:n.status)&&Array.isArray(null==n?void 0:n.data)?(t=n.data.map(function(e){var n,t,r;return{id:e.id,title:e.scope_name||"Unnamed Template",description:(null===(n=e.description)||void 0===n?void 0:n.trim())||"No description available.",inheritedText:(null===(t=e.inheritance)||void 0===t?void 0:t[0])||void 0,rulesCount:e.rules_count||0,tiersCount:e.tier_count||0,isCopy:null!==(r=e.is_copy)&&void 0!==r&&r}}),U(t)):U([]),[3,5];case 3:return r=e.sent(),console.error("[StationOnboard] Error searching scopes:",r),U([]),[3,5];case 4:return $(!1),[7];case 5:return[2]}})})},[J]),t.useEffect(function(){!J.trim()&&Ce&&ie(Ce.id)},[J,Ce]);var Oe=function(){setTimeout(function(){ve.current&&ve.current.scrollTo({top:ve.current.scrollHeight,behavior:"smooth"})},100)},Fe=function(){ge(""),N(null),be({region:"",primeTime:["06:00 AM - 7:00 PM"],genre:"Music",type:"",lowSelloutConfig:""}),U([]),K(""),ie(null),b()},Ne=function(n,t){var r;if("primeTime"!==n){var o=null!==(r=null==t?void 0:t.value)&&void 0!==r?r:"";be(function(t){var r;return e.__assign(e.__assign({},t),((r={})[n]=String(o),r))}),"genre"===n&&(te(!0),he.current&&clearTimeout(he.current),he.current=setTimeout(function(){var e=A.find(function(e){return e.scope_name===o});ie(e?e.id:null),te(!1)},800))}else{var i=(null==t?void 0:t.value)?String(t.value):"";be(function(n){return e.__assign(e.__assign({},n),{primeTime:i?[i]:[]})})}},Be=Boolean(F&&ye.region&&ye.primeTime.length>0&&ye.genre);return n.jsxs(r.Dialog,e.__assign({open:y,onClose:Fe,maxWidth:!1,disableEscapeKeyDown:!0,PaperProps:{sx:{width:"90vw",height:"90vh",borderRadius:"12px",display:"flex",flexDirection:"column",overflow:"hidden"}}},{children:[n.jsx(i.Toast,{ref:_e}),n.jsxs(r.Box,e.__assign({sx:{p:"20px 20px 20px 27px",borderBottom:"1px solid #F0F2F5",display:"flex",justifyContent:"space-between",alignItems:"center",bgcolor:"#fff"}},{children:[n.jsxs(r.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:.5}},{children:[n.jsx(r.Typography,e.__assign({sx:{fontSize:"18px",fontWeight:600,color:"#19213D"}},{children:"Onboard a Station"})),n.jsx(r.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:400,color:"#666F8D"}},{children:"Onboard a station to start configuring learnings."}))]})),n.jsx(r.IconButton,e.__assign({onClick:Fe,disabled:ae,sx:{color:"#19213D"}},{children:n.jsx(o.X,{size:24})}))]})),n.jsxs(r.DialogContent,e.__assign({sx:{p:0,bgcolor:"#F8FAFC",display:"flex",flexDirection:"row",overflow:"hidden",position:"relative"}},{children:[n.jsx(g.default,{isLoading:ae,currentStep:ce,onComplete:function(){le(!1);var e=me.current;Fe(),j(e||void 0),me.current=null}}),n.jsxs(r.Box,e.__assign({sx:{display:"flex",flex:1,paddingY:"14px",paddingX:"20px",gap:3,overflowY:"hidden"}},{children:[n.jsxs(r.Box,e.__assign({ref:ve,sx:{flex:1,bgcolor:"#fff",p:3,borderRadius:"16px",border:"1px solid #F0F2F5",height:"100%",overflowY:"auto"}},{children:[n.jsx(r.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:600,mb:.5,color:"#19213D"}},{children:"Basic Details"})),n.jsx(r.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#00000080",mb:"20px"}},{children:"Set up basic station details to unlock AI recommended scopes."})),n.jsxs(r.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[n.jsxs(r.Box,e.__assign({className:"space-y-1.5"},{children:[n.jsxs("label",e.__assign({className:"text-sm font-medium text-[#19213D]"},{children:[n.jsx("span",e.__assign({className:"mr-0.5 text-xs font-semibold text-[#8F2C23]"},{children:"*"})),"Station Name/Call Letters"]})),n.jsx(p.default,{value:fe,onChange:ge,onStationSelect:function(e){return N(e)}})]})),n.jsx(d.default,{required:!0,disabled:!0,label:"Region",placeholder:"Select Region",value:ye.region||void 0,isSearchable:!1}),n.jsx(d.default,{required:!0,label:"Prime Time Window",placeholder:"Select Prime Time",options:_,value:je(_,(null===(S=ye.primeTime)||void 0===S?void 0:S[0])||""),onOptionChange:function(e){return Ne("primeTime",e)},isSearchable:!1}),n.jsx(r.Box,e.__assign({onClick:Oe,sx:{width:"100%"}},{children:n.jsx(d.default,{required:!0,label:"Genre",placeholder:"Select Genre",options:we,value:je(we,ye.genre),onOptionChange:function(e){return Ne("genre",e)},isSearchable:!1,onMenuScrollToBottom:function(){!z&&k&&Te(D)},isLoadingOptions:z,hasMoreOptions:k})})),n.jsx(r.Box,e.__assign({onClick:Oe,sx:{width:"100%"}},{children:n.jsx(d.default,{label:"Station Type",placeholder:"None",options:m,value:je(m,ye.type),onOptionChange:function(n){Ne("type",n),"Low Sellout"!==(null==n?void 0:n.value)&&be(function(n){return e.__assign(e.__assign({},n),{lowSelloutConfig:""})})},isSearchable:!1})})),"Low Sellout"===ye.type&&n.jsx(r.Box,e.__assign({onClick:Oe,sx:{width:"100%"}},{children:n.jsx(d.default,{label:"Low Sell Out Configurations",placeholder:"Select Configuration",options:h,value:je(h,ye.lowSelloutConfig),onOptionChange:function(e){return Ne("lowSelloutConfig",e)},isSearchable:!1})}))]}))]})),n.jsx(r.Box,e.__assign({sx:{flex:1,bgcolor:"#fff",p:3,borderRadius:"12px",border:"1px solid #F0F2F5",display:"flex",flexDirection:"column",height:"100%",overflowY:"auto"}},{children:ye.genre?n.jsxs(n.Fragment,{children:[n.jsx(r.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:500,mb:1.5}},{children:"Matching scope for your station"})),n.jsx(r.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:2,mb:4}},{children:ne?n.jsx(f.default,{}):Ce?n.jsx(x.default,e.__assign({},Ce,{isSelected:oe===Ce.id,onSelect:ie}),Ce.id):null})),n.jsx(r.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:500,mb:1.5}},{children:"Other available stations"})),n.jsxs("div",e.__assign({className:"relative mb-4 w-full"},{children:[n.jsx("input",{type:"text",value:H,onChange:function(e){return K(e.target.value)},placeholder:"Search for station...",className:"w-full rounded-lg border border-[#E2E8F0] px-10 py-[7px] text-[12px] outline-none transition-all placeholder:text-[#BAC0CC] focus:border-blue-500 focus:ring-1 focus:ring-blue-500"}),n.jsx(o.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400",size:16})]})),n.jsxs(r.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:2}},{children:[Z&&n.jsx(f.default,{}),!Z&&0===G.length&&J.trim()&&n.jsxs(r.Typography,e.__assign({sx:{fontSize:"0.875rem",color:"#64748B",textAlign:"center",py:4}},{children:['No scopes found matching "',J,'".']})),!Z&&G.map(function(t){return n.jsx(x.default,e.__assign({},t,{isSelected:oe===t.id,onSelect:ie}),t.id)})]}))]}):n.jsxs(n.Fragment,{children:[n.jsx(r.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:500,mb:1.5}},{children:"Fill in the station details to load AI recommended scopes"})),n.jsx(r.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#64748B",mb:3}},{children:"AI will recommend the most relevant scope for this station."})),n.jsx(r.Box,e.__assign({sx:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",opacity:.5,py:10}},{children:n.jsx("img",{src:a.default,alt:"Empty Result"})}))]})}))]}))]})),n.jsxs(r.Box,e.__assign({sx:{p:"12px 20px",borderTop:"1px solid #F0F2F5",display:"flex",justifyContent:"flex-end",gap:2,bgcolor:"#fff"}},{children:[n.jsx("button",e.__assign({onClick:Fe,disabled:ae,style:{padding:"7px 10px",borderRadius:"6px",color:"#64748B",border:"1px solid #E2E8F0",backgroundColor:"#fff",cursor:"pointer",fontSize:"14px",fontWeight:500}},{children:"Cancel"})),n.jsx("button",e.__assign({onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var n,t,r,o,i,a,l,d,p,f,g,x,_,m,h,v,S,y;return e.__generator(this,function(b){switch(b.label){case 0:if(!F||!oe)return console.error("[StationOnboard] Missing required data for onboarding"),[2];n=Ce?e.__spreadArray([Ce],G,!0):G,t=n.find(function(e){return e.id===oe}),r=null!==(_=null==t?void 0:t.isCopy)&&void 0!==_&&_,le(!0),de(0),o=null,b.label=1;case 1:return b.trys.push([1,3,,4]),i={topic:"customRuleSet",customScopeGroupName:(null===u.IL_CONFIG_CONSTANTS||void 0===u.IL_CONFIG_CONSTANTS?void 0:u.IL_CONFIG_CONSTANTS.CUSTOM_SCOPE_GROUP_NAME)||"Audacy-Traffic-Manager",scopeDescription:F.station_name||"New Station",parentScopeId:null,customScopeName:F.station_name||"New Station",customScopeId:s.v4(),createByName:(null==xe?void 0:xe.firstname)||"System",createdBy:(null==xe?void 0:xe.email)||"system@audacy.com",applicationMappingId:w},console.log("[StationOnboard] Step 1: Creating rule set with payload:",i),[4,c.createRuleSet(i,C)];case 2:if(a=b.sent(),!(o=null===(m=null==a?void 0:a.data)||void 0===m?void 0:m.scopeId))throw new Error("Failed to create scope - no scopeId returned");return de(1),[3,4];case 3:return l=b.sent(),console.error("[StationOnboard] Error creating rule set:",l),null===(h=_e.current)||void 0===h||h.show({severity:"error",life:3e3,summary:"Error",detail:"Failed to create rule set. Please try again."}),le(!1),de(0),[2];case 4:return b.trys.push([4,6,,11]),d={market:F.market,region:F.region,primetime_windows:ye.primeTime,genre:ye.genre,station_type:""===ye.type?null:ye.type,low_sellout_configurations:"Low Sellout"===ye.type?ye.lowSelloutConfig:null,ruleset_id:o,station_guid:F.station_guid,station_name:F.station_name||"New Station"},console.log("[StationOnboard] Step 2: Updating station with payload:",d),[4,c.updateStation(d)];case 5:return b.sent(),de(2),[3,11];case 6:p=b.sent(),console.error("[StationOnboard] Error updating station, rolling back rule set:",p),409===p.status?(null===(v=_e.current)||void 0===v||v.show({severity:"error",life:2500,summary:"Error updating station",detail:"Station already Onboarded."}),N(null),ie(null),ge(""),be(function(n){return e.__assign(e.__assign({},n),{region:""})})):null===(S=_e.current)||void 0===S||S.show({severity:"error",life:2500,summary:"Error updating station",detail:"Please try again."}),b.label=7;case 7:return b.trys.push([7,9,,10]),[4,c.deleteRuleSet(o,C)];case 8:return b.sent(),[3,10];case 9:return f=b.sent(),console.error("[StationOnboard] Failed to rollback rule set deletion:",f),[3,10];case 10:return le(!1),de(0),[2];case 11:return b.trys.push([11,13,,14]),g={source_scope_id:oe,target_scope_id:o,is_copy_parent_variant_id:r},console.log("[StationOnboard] Step 3: Inheriting scope with payload:",g),[4,c.inheritScope(g)];case 12:return b.sent(),de(3),[3,14];case 13:return x=b.sent(),console.error("[StationOnboard] Error inheriting scope (no rollback):",x),null===(y=_e.current)||void 0===y||y.show({severity:"error",life:3e3,summary:"Error",detail:"Failed to apply rule template. Please try again."}),le(!1),de(0),[2];case 14:return me.current=o,[2]}})})},disabled:!Be||ae,style:{padding:"7px 10px",borderRadius:"6px",border:"none",backgroundColor:Be?"#2563EB":"#BFDBFE",color:"#fff",cursor:Be&&!ae?"pointer":"not-allowed",fontSize:"14px",fontWeight:500,display:"flex",alignItems:"center",gap:"7px"}},{children:ae?n.jsxs(n.Fragment,{children:[n.jsx(r.CircularProgress,{size:16,color:"inherit"}),n.jsx("span",{children:"Onboarding..."})]}):n.jsxs(n.Fragment,{children:[n.jsx("span",{children:"Onboard Station"}),n.jsx(o.ArrowRight,{size:16})]})}))]}))]}))};
2
+ //# sourceMappingURL=BackwardStationOnboardModal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BackwardStationOnboardModal.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),r={display:"flex",gap:"8px",flexWrap:"nowrap",padding:"10px 12px",backgroundColor:"#FAFAFA",border:"1px solid #E2E8F0",borderRadius:"8px",marginTop:"4px",minHeight:"54px",alignItems:"center",width:"70%",boxSizing:"border-box"},n={display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:"6px",fontSize:"0.815rem",fontWeight:500,cursor:"pointer",userSelect:"none",transition:"all 0.15s ease-in-out",height:"34px",flex:"1 0 calc((100% - (6 * 8px)) / 7)",minWidth:"0",position:"relative",boxSizing:"border-box"};exports.default=function(s){var o=s.label,t=s.subText,l=s.required,a=s.options,d=s.selectedValues,x=s.onChange;return i.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",width:"100%",marginBottom:"4px"}},{children:[i.jsxs("label",e.__assign({style:{fontSize:"0.875rem",fontWeight:500,color:"#19213D",marginBottom:"2px",display:"block"}},{children:[l&&i.jsx("span",e.__assign({style:{color:"#E53E3E",marginRight:"4px"}},{children:"*"})),o]})),t&&i.jsx("p",e.__assign({style:{margin:"0 0 6px 0",fontSize:"0.75rem",color:"#666F8D",lineHeight:"1.2"}},{children:t})),i.jsx("div",e.__assign({style:r},{children:a.map(function(r){var s=d.includes(String(r.value));return i.jsx("div",e.__assign({onClick:function(){return i=String(r.value),void(d.includes(i)?x(d.filter(function(e){return e!==i})):x(e.__spreadArray(e.__spreadArray([],d,!0),[i],!1)));var i},style:e.__assign(e.__assign({},n),{border:s?"1.5px solid #2563EB":"1px solid #E2E8F0",backgroundColor:s?"#EFF6FF":"#FFFFFF",color:s?"#2563EB":"#64748B",boxShadow:s?"0 1px 2px rgba(37, 99, 235, 0.05)":"0 1px 2px rgba(0, 0, 0, 0.02)"})},{children:i.jsx("span",{children:r.label})}),r.value)})}))]}))};
2
+ //# sourceMappingURL=DayToggleSelector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DayToggleSelector.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),r=require("react"),i=require("@mui/material"),o=require("lucide-react"),t=require("primereact/toast"),s=require("uuid"),a=require("../../apis/scopeApis.js"),l=require("./StationAutocomplete.js"),u=require("../CardSkeleton.js"),c=require("./OnboardingLoader.js"),d=require("./TemplateCard.js"),p=require("../../styles/StationOnboardModal.module.css.js"),x=require("./InputField.js"),g=require("../../store/useAuthStore.js"),f=require("../../store/useConfigStore.js"),h=require("../../store/useLearningTemplateStore.js"),_=require("../../config.js"),m=require("../../store/useAppSecRolesStore.js"),v=require("../../store/useEnvStore.js"),y=require("../../RuleContent/AddScopeApprovalSearchComponent.js"),S=[{label:"6am to 7pm",value:"06:00 AM - 7:00 PM"},{label:"5am to 7pm",value:"05:00 AM - 7:00 PM"}],b=[{label:"Low Sellout",value:"Low Sellout"},{label:"High Sellout",value:"High Sellout"},{label:"None",value:""}],j=[{label:"None",value:"None"},{label:"Distribute spots evenly across all breaks in the hour",value:"Distribute spots evenly across all breaks in the hour"}];exports.default=function(C){var w,B=C.isOpen,T=C.onClose,F=C.onBoardStation,E=C.app_integration_id,k=C.token,q=r.useState(null),A=q[0],D=q[1],O=r.useState([]),R=O[0],I=O[1],z=r.useState(0),L=z[0],M=z[1],N=r.useState(!0),P=N[0],W=N[1],G=r.useState(!1),K=G[0],U=G[1],H=r.useState([]),Y=H[0],X=H[1],V=r.useState(""),J=V[0],Q=V[1],Z=r.useState(""),$=Z[0],ee=Z[1],ne=r.useState(!1),re=ne[0],ie=ne[1],oe=r.useState(!1),te=oe[0],se=oe[1],ae=r.useState(null),le=ae[0],ue=ae[1],ce=r.useState(null);ce[0],ce[1];var de=r.useState(!1),pe=de[0],xe=de[1],ge=r.useState(0),fe=ge[0],he=ge[1],_e=r.useState(""),me=_e[0],ve=_e[1],ye=g.default().user,Se=r.useRef(null),be=r.useRef(null),je=r.useRef(null),Ce=r.useRef(null);f.useConfigStore().configuration;var we=r.useRef(null),Be=m.useAppSecRolesStore(function(e){return e.roles}),Te=v.default(function(e){return e.rbacConfig}),Fe=r.useState("approval_required"),Ee=Fe[0],ke=Fe[1],qe=r.useState([]),Ae=qe[0],De=qe[1],Oe=r.useState([]),Re=Oe[0],Ie=Oe[1],ze=r.useState(""),Le=ze[0],Me=ze[1],Ne=h.useLearningTemplateStore(function(e){return e.stationNameParam}),Pe=r.useState({region:"",primeTime:["06:00 AM - 7:00 PM"],genre:"Music",type:"",lowSelloutConfig:""}),We=Pe[0],Ge=Pe[1],Ke=function(e,n){return e.find(function(e){return e.value===n})||null},Ue=r.useMemo(function(){return R.map(function(e){return{label:e.scope_name,value:e.scope_name}})},[R]),He=r.useMemo(function(){var e,n,r;if(!We.genre)return null;var i=R.find(function(e){return e.scope_name===We.genre});return i?{id:i.id,title:i.scope_name||"Unnamed Template",description:(null===(e=i.description)||void 0===e?void 0:e.trim())||"No description available.",inheritedText:(null===(n=i.inheritance)||void 0===n?void 0:n[0])||void 0,rulesCount:i.rules_count||0,tiersCount:i.tier_count||0,isCopy:null!==(r=i.is_copy)&&void 0!==r&&r}:null},[We.genre,R]);r.useEffect(function(){return function(){je.current&&clearTimeout(je.current)}},[]);var Ye=function(n){return e.__awaiter(void 0,void 0,void 0,function(){var r,i,o;return e.__generator(this,function(t){switch(t.label){case 0:if(K)return[2];U(!0),t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,a.retrieveGenreScopes({limit:"20",offset:String(n)})];case 2:return"success"===(null==(r=t.sent())?void 0:r.status)&&Array.isArray(null==r?void 0:r.data)?(i=r.data,I(function(r){if(0===n)return i;var o=new Set(r.map(function(e){return e.id})),t=i.filter(function(e){return!o.has(e.id)});return e.__spreadArray(e.__spreadArray([],r,!0),t,!0)}),i.length<20?W(!1):W(!0),M(n+20)):W(!1),[3,5];case 3:return o=t.sent(),console.error("[StationOnboard] Failed to fetch genre scopes:",o),W(!1),[3,5];case 4:return U(!1),[7];case 5:return[2]}})})};r.useEffect(function(){if(B&&(I([]),M(0),W(!0),Ye(0),Ne)){ve(Ne);e.__awaiter(void 0,void 0,void 0,function(){var n,r,i;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,a.fetchStationsByKeyword(Ne,!0)];case 1:return!0===(null==(n=e.sent())?void 0:n.success)&&Array.isArray(null==n?void 0:n.data)&&(r=n.data.find(function(e){var n;return(null===(n=e.station_name)||void 0===n?void 0:n.toLowerCase())===Ne.toLowerCase()&&!e.ruleset_id}),r&&D(r)),[3,3];case 2:return i=e.sent(),console.error("[StationOnboard] Error auto-selecting station:",i),[3,3];case 3:return[2]}})})}},[B,Ne]);r.useEffect(function(){Ge(A?function(n){var r;return e.__assign(e.__assign({},n),{region:null!==(r=A.market)&&void 0!==r?r:""})}:{region:"",primeTime:["06:00 AM - 7:00 PM"],genre:"Music",type:"",lowSelloutConfig:""})},[A]),r.useEffect(function(){var e=setTimeout(function(){ee(J)},500);return function(){return clearTimeout(e)}},[J]),r.useEffect(function(){e.__awaiter(void 0,void 0,void 0,function(){var n,r,i,o;return e.__generator(this,function(e){switch(e.label){case 0:if(!$.trim())return X([]),[2];ie(!0),e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,a.searchScopes({search_string:$.trim()})];case 2:return"success"===(null==(n=e.sent())?void 0:n.status)&&Array.isArray(null==n?void 0:n.data)?(r=n.data.filter(function(e){var n,r=null!==(n=e.inheritance)&&void 0!==n?n:[],i=r.indexOf(e.scope_name);return!(i<=0)&&r[i-1]===We.genre}),i=r.map(function(e){var n,r,i;return{id:e.id,title:e.scope_name||"Unnamed Template",description:(null===(n=e.description)||void 0===n?void 0:n.trim())||"No description available.",inheritedText:(null===(r=e.inheritance)||void 0===r?void 0:r[0])||void 0,rulesCount:e.rules_count||0,tiersCount:e.tier_count||0,isCopy:null!==(i=e.is_copy)&&void 0!==i&&i}}),X(i)):X([]),[3,5];case 3:return o=e.sent(),console.error("[StationOnboard] Error searching scopes:",o),X([]),[3,5];case 4:return ie(!1),[7];case 5:return[2]}})})},[$,We.genre]),r.useEffect(function(){!$.trim()&&He&&ue(He.id)},[$,He]);var Xe=function(){setTimeout(function(){Ce.current&&Ce.current.scrollTo({top:Ce.current.scrollHeight,behavior:"smooth"})},100)},Ve=function(){ve(""),D(null),Ge({region:"",primeTime:["06:00 AM - 7:00 PM"],genre:"Music",type:"",lowSelloutConfig:""}),X([]),Q(""),ue(null),ke("approval_required"),De([]),Ie([]),Me(""),T()},Je=function(n,r){var i;if("primeTime"!==n){var o=null!==(i=null==r?void 0:r.value)&&void 0!==i?i:"";Ge(function(r){var i;return e.__assign(e.__assign({},r),((i={})[n]=String(o),i))}),"genre"===n&&(se(!0),je.current&&clearTimeout(je.current),je.current=setTimeout(function(){var e=R.find(function(e){return e.scope_name===o});ue(e?e.id:null),se(!1)},800))}else{var t=(null==r?void 0:r.value)?String(r.value):"";Ge(function(n){return e.__assign(e.__assign({},n),{primeTime:t?[t]:[]})})}},Qe=Boolean(A&&We.region&&We.primeTime.length>0&&We.genre);return n.jsxs(i.Dialog,e.__assign({open:B,onClose:Ve,maxWidth:!1,disableEscapeKeyDown:!0,PaperProps:{sx:{width:"90vw",height:"90vh",borderRadius:"12px",display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"sans-serif"}}},{children:[n.jsx(t.Toast,{ref:Se}),n.jsxs(i.Box,e.__assign({sx:{p:"20px 20px 20px 27px",borderBottom:"1px solid #F0F2F5",display:"flex",justifyContent:"space-between",alignItems:"center",bgcolor:"#fff"}},{children:[n.jsxs(i.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:.5}},{children:[n.jsx(i.Typography,e.__assign({sx:{fontSize:"18px",fontWeight:600,color:"#19213D"}},{children:"Onboard a Station"})),n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:400,color:"#666F8D"}},{children:"Onboard a station to start configuring learnings."}))]})),n.jsx(i.IconButton,e.__assign({onClick:Ve,disabled:pe,sx:{color:"#19213D"}},{children:n.jsx(o.X,{size:24})}))]})),n.jsxs(i.DialogContent,e.__assign({sx:{p:0,bgcolor:"#F8FAFC",display:"flex",flexDirection:"row",overflow:"hidden",position:"relative"}},{children:[n.jsx(c.default,{isLoading:pe,currentStep:fe,onComplete:function(){xe(!1);var e=be.current;Ve(),F(e||void 0),be.current=null}}),n.jsx(i.Box,e.__assign({sx:{display:"flex",flex:1,flexDirection:"column",paddingY:"14px",paddingX:"20px",gap:2,overflowY:"auto"}},{children:n.jsxs(i.Box,e.__assign({sx:{display:"flex",gap:3}},{children:[n.jsxs(i.Box,e.__assign({ref:Ce,sx:{flex:1,bgcolor:"#fff",p:3,borderRadius:"16px",border:"1px solid #F0F2F5"}},{children:[n.jsx(i.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:600,mb:.5,color:"#19213D"}},{children:"Basic Details"})),n.jsx(i.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#00000080",mb:"20px"}},{children:"Set up basic station details to unlock AI recommended scopes."})),n.jsxs(i.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[n.jsxs(i.Box,e.__assign({className:p.default.formGroup},{children:[n.jsxs("label",e.__assign({className:p.default.label},{children:[n.jsx("span",e.__assign({className:p.default.asterisk},{children:"*"})),"Station Name/Call Letters"]})),n.jsx(l.default,{value:me,onChange:ve,onStationSelect:function(e){return D(e)}})]})),n.jsx(x.default,{required:!0,disabled:!0,label:"Region",placeholder:"Select Region",value:We.region||void 0,isSearchable:!1}),n.jsx(x.default,{required:!0,label:"Prime Time Window",placeholder:"Select Prime Time",options:S,value:Ke(S,(null===(w=We.primeTime)||void 0===w?void 0:w[0])||""),onOptionChange:function(e){return Je("primeTime",e)},isSearchable:!1}),n.jsx(i.Box,e.__assign({onClick:Xe,sx:{width:"100%"}},{children:n.jsx(x.default,{label:"Station Sellout Type",placeholder:"None",options:b,value:Ke(b,We.type),onOptionChange:function(n){Je("type",n),"Low Sellout"!==(null==n?void 0:n.value)&&Ge(function(n){return e.__assign(e.__assign({},n),{lowSelloutConfig:""})})},isSearchable:!1})})),"Low Sellout"===We.type&&n.jsx(i.Box,e.__assign({onClick:Xe,sx:{width:"100%"}},{children:n.jsx(x.default,{label:"Low Sell Out Configurations",placeholder:"Select Configuration",options:j,value:Ke(j,We.lowSelloutConfig),onOptionChange:function(e){return Je("lowSelloutConfig",e)},isSearchable:!1})})),h.useLearningTemplateStore.getState().backwardCompatibility&&n.jsxs("div",e.__assign({ref:we,style:{display:"flex",flexDirection:"column",marginTop:"12px"}},{children:[n.jsx(i.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:600,mb:.5,color:"#19213D"}},{children:"Approval Settings"})),n.jsx(i.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#00000080",mb:"20px"}},{children:"Configure who can approve learnings before they get published."})),n.jsxs("div",e.__assign({style:{marginBottom:"12px",fontSize:"12px",color:"#8F2C23",gap:"16px"}},{children:[n.jsxs("div",e.__assign({style:{marginBottom:"12px",fontSize:"12px",color:"#8F2C23",gap:"12px"}},{children:[n.jsxs("div",e.__assign({role:"radio","aria-checked":"approval_required"===Ee,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:"4px",marginBottom:"8px"},onClick:function(){return ke("approval_required")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||ke("approval_required")}},{children:[n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[n.jsx("div",e.__assign({style:{display:"flex",height:"16px",width:"16px",flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("approval_required"===Ee?"#2563EB":"#CBD5E1")}},{children:"approval_required"===Ee&&n.jsx("div",{style:{height:"8px",width:"8px",borderRadius:"50%",backgroundColor:"#2563EB"}})})),n.jsx("span",e.__assign({style:{fontSize:"14px",fontWeight:500,color:"#19213D"}},{children:"Approval Required Before Publishing"}))]})),n.jsx("p",e.__assign({style:{margin:0,marginLeft:"24px",fontSize:"12px",color:"#666F8D"}},{children:"Learnings require approval before publishing."}))]})),n.jsxs("div",e.__assign({style:{gap:"16px"}},{children:["approval_required"===Ee&&n.jsx(y.default,{selectedApprovers:Ae,selectedGroupOfApprovers:Re,onApproversChange:function(e){De(e),Me("")},onGroupsChange:function(e){Ie(e),Me("")}}),Le&&n.jsx("p",e.__assign({style:{margin:0,marginLeft:"24px",fontSize:"12px",color:"#8F2C23"}},{children:Le}))]}))]})),n.jsxs("div",e.__assign({role:"radio","aria-checked":"publish_without"===Ee,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:"4px"},onClick:function(){ke("publish_without"),Me("")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||(ke("publish_without"),Me(""))}},{children:[n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[n.jsx("div",e.__assign({style:{display:"flex",height:"16px",width:"16px",flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("publish_without"===Ee?"#2563EB":"#CBD5E1")}},{children:"publish_without"===Ee&&n.jsx("div",{style:{height:"8px",width:"8px",borderRadius:"50%",backgroundColor:"#2563EB"}})})),n.jsx("span",e.__assign({style:{fontSize:"14px",fontWeight:500,color:"#19213D"}},{children:"Publish Without Approval"}))]})),n.jsx("p",e.__assign({style:{margin:0,marginLeft:"24px",fontSize:"12px",color:"#666F8D"}},{children:"Learnings can be published directly."}))]}))]}))]}))]}))]})),n.jsxs(i.Box,e.__assign({sx:{flex:1,bgcolor:"#fff",p:3,borderRadius:"12px",border:"1px solid #F0F2F5",display:"flex",flexDirection:"column"}},{children:[n.jsxs(i.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:600,mb:.5,color:"#19213D"}},{children:[n.jsx("span",e.__assign({style:{color:"#E53E3E",marginRight:"2px"}},{children:"*"})),"Select a scope for your station"]})),n.jsx(i.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#64748B",mb:"16px"}},{children:"Your station will inherit the rules from the selected scope."})),n.jsx(i.Box,e.__assign({sx:{mb:2}},{children:n.jsx(x.default,{required:!0,label:"",placeholder:"Select Genre",options:Ue,value:Ke(Ue,We.genre),onOptionChange:function(e){return Je("genre",e)},isSearchable:!1,onMenuScrollToBottom:function(){!K&&P&&Ye(L)},isLoadingOptions:K,hasMoreOptions:P})})),n.jsx(i.Box,e.__assign({sx:{mb:3}},{children:te?n.jsx(u.default,{}):He?n.jsxs(i.Box,e.__assign({sx:{border:"1.5px solid #2563EB",borderRadius:"10px",p:"14px 16px",bgcolor:"#EFF6FF",display:"flex",alignItems:"flex-start",gap:"12px"}},{children:[n.jsx(i.Box,e.__assign({sx:{width:36,height:36,borderRadius:"8px",bgcolor:"#DBEAFE",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0}},{children:n.jsxs("svg",e.__assign({width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"#2563EB",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:[n.jsx("circle",{cx:"12",cy:"12",r:"2"}),n.jsx("path",{d:"M16.24 7.76a6 6 0 0 1 0 8.49m-8.48-.01a6 6 0 0 1 0-8.49m11.31-2.82a10 10 0 0 1 0 14.14m-14.14 0a10 10 0 0 1 0-14.14"})]}))})),n.jsxs(i.Box,e.__assign({sx:{flex:1,minWidth:0}},{children:[n.jsx(i.Typography,e.__assign({sx:{fontSize:"0.875rem",fontWeight:600,color:"#1E3A5F",mb:"2px"}},{children:He.title})),n.jsx(i.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#2563EB",mb:"8px"}},{children:He.description})),n.jsxs(i.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"}},{children:[He.inheritedText&&n.jsxs(i.Box,e.__assign({component:"span",sx:{fontSize:"0.7rem",color:"#475569",bgcolor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"4px",px:"6px",py:"2px",display:"inline-flex",alignItems:"center",gap:"4px"}},{children:[n.jsxs("svg",e.__assign({width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:[n.jsx("polyline",{points:"15 3 21 3 21 9"}),n.jsx("path",{d:"M21 3L9 15"}),n.jsx("path",{d:"M3 21l6-6"})]})),He.inheritedText]})),n.jsxs(i.Box,e.__assign({component:"span",sx:{fontSize:"0.7rem",color:"#475569",bgcolor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"4px",px:"6px",py:"2px"}},{children:[He.rulesCount," rules"]})),n.jsxs(i.Box,e.__assign({component:"span",sx:{fontSize:"0.7rem",color:"#475569",bgcolor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"4px",px:"6px",py:"2px"}},{children:[He.tiersCount," Tiers"]}))]}))]}))]})):We.genre?null:n.jsx(i.Box,e.__assign({sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",opacity:.4,py:6,gap:1}},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#94A3B8"}},{children:"Select a genre to load the matching scope"}))}))})),We.genre&&n.jsxs(n.Fragment,{children:[n.jsxs(i.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:600,mb:.5,color:"#19213D"}},{children:["Select an Existing Station from the “",We.genre,"” Scope"," ",n.jsx(i.Typography,e.__assign({component:"span",sx:{fontSize:"1rem",fontWeight:400,color:"#64748B"}},{children:"(Optional)"}))]})),n.jsxs(i.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#64748B",mb:"12px"}},{children:["Please select an existing station under the “",We.genre,"” category to copy its learnings."]})),n.jsxs("div",e.__assign({className:p.default.searchWrapper,style:{marginBottom:"12px"}},{children:[n.jsx("input",{type:"text",value:J,onChange:function(e){return Q(e.target.value)},placeholder:"Search for station...",className:p.default.searchInput}),n.jsx(o.Search,{className:p.default.searchIcon,size:16})]})),n.jsxs(i.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:2}},{children:[re&&n.jsx(u.default,{}),!re&&0===Y.length&&$.trim()&&n.jsxs(i.Typography,e.__assign({sx:{fontSize:"0.875rem",color:"#64748B",textAlign:"center",py:4}},{children:['No scopes found matching "',$,'".']})),!re&&Y.map(function(r){return n.jsx(d.default,e.__assign({},r,{isSelected:le===r.id,onSelect:function(e){var n;ue(le===e?null!==(n=null==He?void 0:He.id)&&void 0!==n?n:null:e)}}),r.id)})]}))]})]}))]}))}))]})),n.jsxs(i.Box,e.__assign({sx:{p:"12px 20px",borderTop:"1px solid #F0F2F5",display:"flex",justifyContent:"flex-end",gap:2,bgcolor:"#fff"}},{children:[n.jsx("button",e.__assign({onClick:Ve,disabled:pe,style:{padding:"7px 10px",borderRadius:"6px",color:"#64748B",border:"1px solid #E2E8F0",backgroundColor:"#fff",cursor:"pointer",fontSize:"14px",fontWeight:500}},{children:"Cancel"})),n.jsx("button",e.__assign({onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var n,r,i,o,t,l,u,c,d,p,x,g,f,m,v,y,S,b,j;return e.__generator(this,function(C){switch(C.label){case 0:if(!A||!le)return console.error("[StationOnboard] Missing required data for onboarding"),[2];if(h.useLearningTemplateStore.getState().backwardCompatibility&&"approval_required"===Ee&&0===Ae.length&&0===Re.length)return Me("Please select at least one approver or approver group."),setTimeout(function(){var e;null===(e=we.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"center"})},50),[2];Me(""),n=He?e.__spreadArray([He],Y,!0):Y,r=n.find(function(e){return e.id===le}),null==r?void 0:r.isCopy,xe(!0),he(0),i=null,C.label=1;case 1:return C.trys.push([1,3,,4]),o=h.useLearningTemplateStore.getState().backwardCompatibility,t=o?{topic:"customRuleSet",customScopeGroupName:_.IL_CONFIG_CONSTANTS.CUSTOM_SCOPE_GROUP_NAME,scopeDescription:A.station_name||"New Station",parentScopeId:null!==(x=null==He?void 0:He.id)&&void 0!==x?x:null,customScopeName:A.station_name||"New Station",customScopeId:s.v4(),createByName:(null==ye?void 0:ye.firstname)||"System",createdBy:(null==ye?void 0:ye.email)||"system@audacy.com",scopeType:"Station",approvalRequired:"approval_required"===Ee,audacyStationMetadata:{genre:We.genre,low_sellout_configurations:"Low Sellout"===We.type?We.lowSelloutConfig:null,market:A.market,primetime_windows:We.primeTime,region:A.region,station_guid:A.station_guid,station_type:""===We.type?null:We.type},appsecData:{application:null==Te?void 0:Te.applicationId,module:null==Te?void 0:Te.moduleId,roles:e.__spreadArray(e.__spreadArray([],"approval_required"===Ee?[{users:Ae.map(function(e){return e.email}),groups:Re.map(function(e){return e._id}),role:null!==(f=null===(g=Be.find(function(e){return"Learning Manager"===e.name}))||void 0===g?void 0:g._id)&&void 0!==f?f:""}]:[],!0),[{users:[null==ye?void 0:ye.email],groups:[],role:null!==(v=null===(m=Be.find(function(e){return"Instant Learning Admin"===e.name}))||void 0===m?void 0:m._id)&&void 0!==v?v:""}],!1)}}:{topic:"customRuleSet",scope_reference_id:null,scopeDescription:"demo",parentScopeId:null,scopeName:A.station_name||"New Station",scopeReferenceMetadata:{},applicationMappingId:E},console.log("[StationOnboard] Step 1: Creating rule set with payload:",t),[4,a.createRuleSet(t,k)];case 2:if(l=C.sent(),!(i=null===(y=null==l?void 0:l.data)||void 0===y?void 0:y.scopeId))throw new Error("Failed to create scope - no scopeId returned");return console.log("[StationOnboard] Step 1 Complete: Created scope with ID:",i),he(1),[3,4];case 3:return u=C.sent(),console.error("[StationOnboard] Error creating rule set:",u),null===(S=Se.current)||void 0===S||S.show({severity:"error",life:3e3,summary:"Error",detail:"Failed to create rule set. Please try again."}),xe(!1),he(0),[2];case 4:return C.trys.push([4,6,,7]),c=null!==le&&le!==(null==He?void 0:He.id),d={source_scope_id:c?le:null!==(b=null==He?void 0:He.id)&&void 0!==b?b:le,target_scope_id:i,is_copy_parent_variant_id:c},console.log("[StationOnboard] Step 3: Inheriting scope with payload:",d),[4,a.inheritScopeBackwardCompatible(d)];case 5:return C.sent(),console.log("[StationOnboard] Step 3 Complete: Scope inherited"),he(3),[3,7];case 6:return p=C.sent(),console.error("[StationOnboard] Error inheriting scope (no rollback):",p),null===(j=Se.current)||void 0===j||j.show({severity:"error",life:3e3,summary:"Error",detail:"Failed to apply rule template. Please try again."}),xe(!1),he(0),[2];case 7:return be.current=i,console.log("[StationOnboard] Onboarding completed successfully!"),[2]}})})},disabled:!Qe||pe,style:{padding:"7px 10px",borderRadius:"6px",border:"none",backgroundColor:Qe?"#2563EB":"#BFDBFE",color:"#fff",cursor:Qe&&!pe?"pointer":"not-allowed",fontSize:"14px",fontWeight:500,display:"flex",alignItems:"center",gap:"7px"}},{children:pe?n.jsxs(n.Fragment,{children:[n.jsx(i.CircularProgress,{size:16,color:"inherit"}),n.jsx("span",{children:"Onboarding..."})]}):n.jsxs(n.Fragment,{children:[n.jsx("span",{children:"Onboard Station"}),n.jsx(o.ArrowRight,{size:16})]})}))]}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),r=require("react"),o=require("@mui/material"),i=require("lucide-react"),t=require("primereact/toast"),s=require("uuid"),a=require("../../apis/scopeApis.js"),l=require("./StationAutocomplete.js"),u=require("../CardSkeleton.js"),d=require("./OnboardingLoader.js"),c=require("./TemplateCard.js"),p=require("../../styles/StationOnboardModal.module.css.js"),g=require("./InputField.js"),x=require("../../store/useAuthStore.js"),f=require("../../store/useConfigStore.js"),h=require("../../store/useLearningTemplateStore.js"),_=require("../../config.js"),m=require("../../store/useAppSecRolesStore.js"),y=require("../../store/useEnvStore.js"),v=require("../../RuleContent/AddScopeApprovalSearchComponent.js"),S=require("./DayToggleSelector.js"),b=[{label:"6am to 7pm",value:"06:00 AM - 7:00 PM"},{label:"5am to 7pm",value:"05:00 AM - 7:00 PM"}],j=[{label:"Low Sellout",value:"Low Sellout"},{label:"High Sellout",value:"High Sellout"},{label:"None",value:""}],w=[{label:"None",value:"None"},{label:"Distribute spots evenly across all breaks in the hour",value:"Distribute spots evenly across all breaks in the hour"}],C=[{label:"Mon",value:"monday"},{label:"Tue",value:"tuesday"},{label:"Wed",value:"wednesday"},{label:"Thu",value:"thursday"},{label:"Fri",value:"friday"},{label:"Sat",value:"saturday"},{label:"Sun",value:"sunday"}];exports.default=function(T){var B,F=T.isOpen,E=T.onClose,D=T.onBoardStation,k=T.app_integration_id,q=T.token,A=r.useState(null),O=A[0],R=A[1],z=r.useState([]),I=z[0],L=z[1],M=r.useState(0),N=M[0],W=M[1],P=r.useState(!0),G=P[0],K=P[1],U=r.useState(!1),H=U[0],V=U[1],Y=r.useState([]),X=Y[0],J=Y[1],Q=r.useState(""),Z=Q[0],$=Q[1],ee=r.useState(""),ne=ee[0],re=ee[1],oe=r.useState(!1),ie=oe[0],te=oe[1],se=r.useState(!1),ae=se[0],le=se[1],ue=r.useState(null),de=ue[0],ce=ue[1],pe=r.useState(null);pe[0],pe[1];var ge=r.useState(!1),xe=ge[0],fe=ge[1],he=r.useState(0),_e=he[0],me=he[1],ye=r.useState(""),ve=ye[0],Se=ye[1],be=x.default().user,je=r.useRef(null),we=r.useRef(null),Ce=r.useRef(null),Te=r.useRef(null);f.useConfigStore().configuration;var Be=r.useRef(null),Fe=m.useAppSecRolesStore(function(e){return e.roles}),Ee=y.default(function(e){return e.rbacConfig}),De=r.useState("approval_required"),ke=De[0],qe=De[1],Ae=r.useState([]),Oe=Ae[0],Re=Ae[1],ze=r.useState([]),Ie=ze[0],Le=ze[1],Me=r.useState(""),Ne=Me[0],We=Me[1],Pe=h.useLearningTemplateStore(function(e){return e.stationNameParam}),Ge=r.useState({region:"",primeTime:["06:00 AM - 7:00 PM"],genre:"Music",type:"",lowSelloutConfig:"",source_days:["wednesday","thursday","friday","saturday"],target_days:["monday","tuesday","wednesday"]}),Ke=Ge[0],Ue=Ge[1],He=function(e,n){return e.find(function(e){return e.value===n})||null},Ve=r.useMemo(function(){return I.map(function(e){return{label:e.scope_name,value:e.scope_name}})},[I]),Ye=r.useMemo(function(){var e,n,r;if(!Ke.genre)return null;var o=I.find(function(e){return e.scope_name===Ke.genre});return o?{id:o.id,title:o.scope_name||"Unnamed Template",description:(null===(e=o.description)||void 0===e?void 0:e.trim())||"No description available.",inheritedText:(null===(n=o.inheritance)||void 0===n?void 0:n[0])||void 0,rulesCount:o.rules_count||0,tiersCount:o.tier_count||0,isCopy:null!==(r=o.is_copy)&&void 0!==r&&r}:null},[Ke.genre,I]);r.useEffect(function(){return function(){Ce.current&&clearTimeout(Ce.current)}},[]);var Xe=function(n){return e.__awaiter(void 0,void 0,void 0,function(){var r,o,i;return e.__generator(this,function(t){switch(t.label){case 0:if(H)return[2];V(!0),t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,a.retrieveGenreScopes({limit:"20",offset:String(n)})];case 2:return"success"===(null==(r=t.sent())?void 0:r.status)&&Array.isArray(null==r?void 0:r.data)?(o=r.data,L(function(r){if(0===n)return o;var i=new Set(r.map(function(e){return e.id})),t=o.filter(function(e){return!i.has(e.id)});return e.__spreadArray(e.__spreadArray([],r,!0),t,!0)}),o.length<20?K(!1):K(!0),W(n+20)):K(!1),[3,5];case 3:return i=t.sent(),console.error("[StationOnboard] Failed to fetch genre scopes:",i),K(!1),[3,5];case 4:return V(!1),[7];case 5:return[2]}})})};r.useEffect(function(){if(F&&(L([]),W(0),K(!0),Xe(0),Pe)){Se(Pe);e.__awaiter(void 0,void 0,void 0,function(){var n,r,o;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,a.fetchStationsByKeyword(Pe,!0)];case 1:return!0===(null==(n=e.sent())?void 0:n.success)&&Array.isArray(null==n?void 0:n.data)&&(r=n.data.find(function(e){var n;return(null===(n=e.station_name)||void 0===n?void 0:n.toLowerCase())===Pe.toLowerCase()&&!e.ruleset_id}),r&&R(r)),[3,3];case 2:return o=e.sent(),console.error("[StationOnboard] Error auto-selecting station:",o),[3,3];case 3:return[2]}})})}},[F,Pe]);r.useEffect(function(){Ue(O?function(n){var r;return e.__assign(e.__assign({},n),{region:null!==(r=O.market)&&void 0!==r?r:""})}:{region:"",primeTime:["06:00 AM - 7:00 PM"],genre:"Music",type:"",lowSelloutConfig:"",source_days:["wednesday","thursday","friday","saturday"],target_days:["monday","tuesday","wednesday"]})},[O]),r.useEffect(function(){var e=setTimeout(function(){re(Z)},500);return function(){return clearTimeout(e)}},[Z]),r.useEffect(function(){e.__awaiter(void 0,void 0,void 0,function(){var n,r,o,i;return e.__generator(this,function(e){switch(e.label){case 0:if(!ne.trim())return J([]),[2];te(!0),e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,a.searchScopes({search_string:ne.trim()})];case 2:return"success"===(null==(n=e.sent())?void 0:n.status)&&Array.isArray(null==n?void 0:n.data)?(r=n.data.filter(function(e){var n,r=null!==(n=e.inheritance)&&void 0!==n?n:[],o=r.indexOf(e.scope_name);return!(o<=0)&&r[o-1]===Ke.genre}),o=r.map(function(e){var n,r,o;return{id:e.id,title:e.scope_name||"Unnamed Template",description:(null===(n=e.description)||void 0===n?void 0:n.trim())||"No description available.",inheritedText:(null===(r=e.inheritance)||void 0===r?void 0:r[0])||void 0,rulesCount:e.rules_count||0,tiersCount:e.tier_count||0,isCopy:null!==(o=e.is_copy)&&void 0!==o&&o}}),J(o)):J([]),[3,5];case 3:return i=e.sent(),console.error("[StationOnboard] Error searching scopes:",i),J([]),[3,5];case 4:return te(!1),[7];case 5:return[2]}})})},[ne,Ke.genre]),r.useEffect(function(){!ne.trim()&&Ye&&ce(Ye.id)},[ne,Ye]);var Je=function(){setTimeout(function(){Te.current&&Te.current.scrollTo({top:Te.current.scrollHeight,behavior:"smooth"})},100)},Qe=function(){Se(""),R(null),Ue({region:"",primeTime:["06:00 AM - 7:00 PM"],genre:"Music",type:"",lowSelloutConfig:"",source_days:["wednesday","thursday","friday","saturday"],target_days:["monday","tuesday","wednesday"]}),J([]),$(""),ce(null),qe("approval_required"),Re([]),Le([]),We(""),E()},Ze=function(n,r){var o;if("primeTime"!==n)if("source_days"!==n&&"target_days"!==n){var i=null!==(o=null==r?void 0:r.value)&&void 0!==o?o:"";Ue(function(r){var o;return e.__assign(e.__assign({},r),((o={})[n]=String(i),o))}),"genre"===n&&(le(!0),Ce.current&&clearTimeout(Ce.current),Ce.current=setTimeout(function(){var e=I.find(function(e){return e.scope_name===i});ce(e?e.id:null),le(!1)},800))}else Ue(function(o){var i;return e.__assign(e.__assign({},o),((i={})[n]=r,i))});else{var t=(null==r?void 0:r.value)?String(r.value):"";Ue(function(n){return e.__assign(e.__assign({},n),{primeTime:t?[t]:[]})})}},$e=Boolean(O&&Ke.region&&Ke.primeTime.length>0&&Ke.genre);return n.jsxs(o.Dialog,e.__assign({open:F,onClose:Qe,maxWidth:!1,disableEscapeKeyDown:!0,PaperProps:{sx:{width:"90vw",height:"90vh",borderRadius:"12px",display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"sans-serif"}}},{children:[n.jsx(t.Toast,{ref:je}),n.jsxs(o.Box,e.__assign({sx:{p:"20px 20px 20px 27px",borderBottom:"1px solid #F0F2F5",display:"flex",justifyContent:"space-between",alignItems:"center",bgcolor:"#fff"}},{children:[n.jsxs(o.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:.5}},{children:[n.jsx(o.Typography,e.__assign({sx:{fontSize:"18px",fontWeight:600,color:"#19213D"}},{children:"Onboard a Station"})),n.jsx(o.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:400,color:"#666F8D"}},{children:"Onboard a station to start configuring learnings."}))]})),n.jsx(o.IconButton,e.__assign({onClick:Qe,disabled:xe,sx:{color:"#19213D"}},{children:n.jsx(i.X,{size:24})}))]})),n.jsxs(o.DialogContent,e.__assign({sx:{p:0,bgcolor:"#F8FAFC",display:"flex",flexDirection:"row",overflow:"hidden",position:"relative"}},{children:[n.jsx(d.default,{isLoading:xe,currentStep:_e,onComplete:function(){fe(!1);var e=we.current;Qe(),D(e||void 0),we.current=null}}),n.jsx(o.Box,e.__assign({sx:{display:"flex",flex:1,flexDirection:"column",paddingY:"14px",paddingX:"20px",gap:2,overflowY:"auto"}},{children:n.jsxs(o.Box,e.__assign({sx:{display:"flex",gap:3}},{children:[n.jsxs(o.Box,e.__assign({ref:Te,sx:{flex:1,bgcolor:"#fff",p:3,borderRadius:"16px",border:"1px solid #F0F2F5"}},{children:[n.jsx(o.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:600,mb:.5,color:"#19213D"}},{children:"Basic Details"})),n.jsx(o.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#00000080",mb:"20px"}},{children:"Set up basic station details to unlock AI recommended scopes."})),n.jsxs(o.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[n.jsxs(o.Box,e.__assign({className:p.default.formGroup},{children:[n.jsxs("label",e.__assign({className:p.default.label},{children:[n.jsx("span",e.__assign({className:p.default.asterisk},{children:"*"})),"Station Name/Call Letters"]})),n.jsx(l.default,{value:ve,onChange:Se,onStationSelect:function(e){return R(e)}})]})),n.jsx(g.default,{required:!0,disabled:!0,label:"Region",placeholder:"Select Region",value:Ke.region||void 0,isSearchable:!1}),n.jsx(g.default,{required:!0,label:"Prime Time Window",placeholder:"Select Prime Time",options:b,value:He(b,(null===(B=Ke.primeTime)||void 0===B?void 0:B[0])||""),onOptionChange:function(e){return Ze("primeTime",e)},isSearchable:!1}),n.jsx(o.Box,e.__assign({onClick:Je,sx:{width:"100%"}},{children:n.jsx(g.default,{label:"Station Sellout Type",placeholder:"None",options:j,value:He(j,Ke.type),onOptionChange:function(n){Ze("type",n),"Low Sellout"!==(null==n?void 0:n.value)&&Ue(function(n){return e.__assign(e.__assign({},n),{lowSelloutConfig:""})})},isSearchable:!1})})),"Low Sellout"===Ke.type&&n.jsx(o.Box,e.__assign({onClick:Je,sx:{width:"100%"}},{children:n.jsx(g.default,{label:"Low Sell Out Configurations",placeholder:"Select Configuration",options:w,value:He(w,Ke.lowSelloutConfig),onOptionChange:function(e){return Ze("lowSelloutConfig",e)},isSearchable:!1})})),n.jsxs(o.Box,e.__assign({onClick:Je,sx:{width:"100%",display:"flex",flexDirection:"column",gap:"20px"}},{children:[n.jsx(o.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:600,color:"#19213D"}},{children:"Front-Loading Configuration"})),n.jsx(S.default,{label:"Source Days",subText:"Days from which spots can be front loaded.",options:C,selectedValues:Ke.source_days,onChange:function(e){return Ze("source_days",e)}}),n.jsx(S.default,{label:"Target Days",subText:"Days where front loaded spots can be placed.",options:C,selectedValues:Ke.target_days,onChange:function(e){return Ze("target_days",e)}})]})),h.useLearningTemplateStore.getState().backwardCompatibility&&n.jsxs("div",e.__assign({ref:Be,style:{display:"flex",flexDirection:"column",marginTop:"12px"}},{children:[n.jsx(o.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:600,mb:.5,color:"#19213D"}},{children:"Approval Settings"})),n.jsx(o.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#00000080",mb:"20px"}},{children:"Configure who can approve learnings before they get published."})),n.jsxs("div",e.__assign({style:{marginBottom:"12px",fontSize:"12px",color:"#8F2C23",gap:"16px"}},{children:[n.jsxs("div",e.__assign({style:{marginBottom:"12px",fontSize:"12px",color:"#8F2C23",gap:"12px"}},{children:[n.jsxs("div",e.__assign({role:"radio","aria-checked":"approval_required"===ke,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:"4px",marginBottom:"8px"},onClick:function(){return qe("approval_required")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||qe("approval_required")}},{children:[n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[n.jsx("div",e.__assign({style:{display:"flex",height:"16px",width:"16px",flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("approval_required"===ke?"#2563EB":"#CBD5E1")}},{children:"approval_required"===ke&&n.jsx("div",{style:{height:"8px",width:"8px",borderRadius:"50%",backgroundColor:"#2563EB"}})})),n.jsx("span",e.__assign({style:{fontSize:"14px",fontWeight:500,color:"#19213D"}},{children:"Approval Required Before Publishing"}))]})),n.jsx("p",e.__assign({style:{margin:0,marginLeft:"24px",fontSize:"12px",color:"#666F8D"}},{children:"Learnings require approval before publishing."}))]})),n.jsxs("div",e.__assign({style:{gap:"16px"}},{children:["approval_required"===ke&&n.jsx(v.default,{selectedApprovers:Oe,selectedGroupOfApprovers:Ie,onApproversChange:function(e){Re(e),We("")},onGroupsChange:function(e){Le(e),We("")}}),Ne&&n.jsx("p",e.__assign({style:{margin:0,marginLeft:"24px",fontSize:"12px",color:"#8F2C23"}},{children:Ne}))]}))]})),n.jsxs("div",e.__assign({role:"radio","aria-checked":"publish_without"===ke,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:"4px"},onClick:function(){qe("publish_without"),We("")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||(qe("publish_without"),We(""))}},{children:[n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[n.jsx("div",e.__assign({style:{display:"flex",height:"16px",width:"16px",flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("publish_without"===ke?"#2563EB":"#CBD5E1")}},{children:"publish_without"===ke&&n.jsx("div",{style:{height:"8px",width:"8px",borderRadius:"50%",backgroundColor:"#2563EB"}})})),n.jsx("span",e.__assign({style:{fontSize:"14px",fontWeight:500,color:"#19213D"}},{children:"Publish Without Approval"}))]})),n.jsx("p",e.__assign({style:{margin:0,marginLeft:"24px",fontSize:"12px",color:"#666F8D"}},{children:"Learnings can be published directly."}))]}))]}))]}))]}))]})),n.jsxs(o.Box,e.__assign({sx:{flex:1,bgcolor:"#fff",p:3,borderRadius:"12px",border:"1px solid #F0F2F5",display:"flex",flexDirection:"column"}},{children:[n.jsxs(o.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:600,mb:.5,color:"#19213D"}},{children:[n.jsx("span",e.__assign({style:{color:"#E53E3E",marginRight:"2px"}},{children:"*"})),"Select a scope for your station"]})),n.jsx(o.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#64748B",mb:"16px"}},{children:"Your station will inherit the rules from the selected scope."})),n.jsx(o.Box,e.__assign({sx:{mb:2}},{children:n.jsx(g.default,{required:!0,label:"",placeholder:"Select Genre",options:Ve,value:He(Ve,Ke.genre),onOptionChange:function(e){return Ze("genre",e)},isSearchable:!1,onMenuScrollToBottom:function(){!H&&G&&Xe(N)},isLoadingOptions:H,hasMoreOptions:G})})),n.jsx(o.Box,e.__assign({sx:{mb:3}},{children:ae?n.jsx(u.default,{}):Ye?n.jsxs(o.Box,e.__assign({sx:{border:"1.5px solid #2563EB",borderRadius:"10px",p:"14px 16px",bgcolor:"#EFF6FF",display:"flex",alignItems:"flex-start",gap:"12px"}},{children:[n.jsx(o.Box,e.__assign({sx:{width:36,height:36,borderRadius:"8px",bgcolor:"#DBEAFE",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0}},{children:n.jsxs("svg",e.__assign({width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"#2563EB",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:[n.jsx("circle",{cx:"12",cy:"12",r:"2"}),n.jsx("path",{d:"M16.24 7.76a6 6 0 0 1 0 8.49m-8.48-.01a6 6 0 0 1 0-8.49m11.31-2.82a10 10 0 0 1 0 14.14m-14.14 0a10 10 0 0 1 0-14.14"})]}))})),n.jsxs(o.Box,e.__assign({sx:{flex:1,minWidth:0}},{children:[n.jsx(o.Typography,e.__assign({sx:{fontSize:"0.875rem",fontWeight:600,color:"#1E3A5F",mb:"2px"}},{children:Ye.title})),n.jsx(o.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#2563EB",mb:"8px"}},{children:Ye.description})),n.jsxs(o.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"}},{children:[Ye.inheritedText&&n.jsxs(o.Box,e.__assign({component:"span",sx:{fontSize:"0.7rem",color:"#475569",bgcolor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"4px",px:"6px",py:"2px",display:"inline-flex",alignItems:"center",gap:"4px"}},{children:[n.jsxs("svg",e.__assign({width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:[n.jsx("polyline",{points:"15 3 21 3 21 9"}),n.jsx("path",{d:"M21 3L9 15"}),n.jsx("path",{d:"M3 21l6-6"})]})),Ye.inheritedText]})),n.jsxs(o.Box,e.__assign({component:"span",sx:{fontSize:"0.7rem",color:"#475569",bgcolor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"4px",px:"6px",py:"2px"}},{children:[Ye.rulesCount," rules"]})),n.jsxs(o.Box,e.__assign({component:"span",sx:{fontSize:"0.7rem",color:"#475569",bgcolor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"4px",px:"6px",py:"2px"}},{children:[Ye.tiersCount," Tiers"]}))]}))]}))]})):Ke.genre?null:n.jsx(o.Box,e.__assign({sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",opacity:.4,py:6,gap:1}},{children:n.jsx(o.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#94A3B8"}},{children:"Select a genre to load the matching scope"}))}))})),Ke.genre&&n.jsxs(n.Fragment,{children:[n.jsxs(o.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:600,mb:.5,color:"#19213D"}},{children:["Select an Existing Station from the “",Ke.genre,"” Scope"," ",n.jsx(o.Typography,e.__assign({component:"span",sx:{fontSize:"1rem",fontWeight:400,color:"#64748B"}},{children:"(Optional)"}))]})),n.jsxs(o.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#64748B",mb:"12px"}},{children:["Please select an existing station under the “",Ke.genre,"” category to copy its learnings."]})),n.jsxs("div",e.__assign({className:p.default.searchWrapper,style:{marginBottom:"12px"}},{children:[n.jsx("input",{type:"text",value:Z,onChange:function(e){return $(e.target.value)},placeholder:"Search for station...",className:p.default.searchInput}),n.jsx(i.Search,{className:p.default.searchIcon,size:16})]})),n.jsxs(o.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:2}},{children:[ie&&n.jsx(u.default,{}),!ie&&0===X.length&&ne.trim()&&n.jsxs(o.Typography,e.__assign({sx:{fontSize:"0.875rem",color:"#64748B",textAlign:"center",py:4}},{children:['No scopes found matching "',ne,'".']})),!ie&&X.map(function(r){return n.jsx(c.default,e.__assign({},r,{isSelected:de===r.id,onSelect:function(e){var n;ce(de===e?null!==(n=null==Ye?void 0:Ye.id)&&void 0!==n?n:null:e)}}),r.id)})]}))]})]}))]}))}))]})),n.jsxs(o.Box,e.__assign({sx:{p:"12px 20px",borderTop:"1px solid #F0F2F5",display:"flex",justifyContent:"flex-end",gap:2,bgcolor:"#fff"}},{children:[n.jsx("button",e.__assign({onClick:Qe,disabled:xe,style:{padding:"7px 10px",borderRadius:"6px",color:"#64748B",border:"1px solid #E2E8F0",backgroundColor:"#fff",cursor:"pointer",fontSize:"14px",fontWeight:500}},{children:"Cancel"})),n.jsx("button",e.__assign({onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var n,r,o,i,t,l,u,d,c,p,g,x,f,m,y,v,S,b,j;return e.__generator(this,function(w){switch(w.label){case 0:if(!O||!de)return console.error("[StationOnboard] Missing required data for onboarding"),[2];if(h.useLearningTemplateStore.getState().backwardCompatibility&&"approval_required"===ke&&0===Oe.length&&0===Ie.length)return We("Please select at least one approver or approver group."),setTimeout(function(){var e;null===(e=Be.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"center"})},50),[2];We(""),n=Ye?e.__spreadArray([Ye],X,!0):X,r=n.find(function(e){return e.id===de}),null==r?void 0:r.isCopy,fe(!0),me(0),o=null,w.label=1;case 1:return w.trys.push([1,3,,4]),i=h.useLearningTemplateStore.getState().backwardCompatibility,t=i?{topic:"customRuleSet",customScopeGroupName:_.IL_CONFIG_CONSTANTS.CUSTOM_SCOPE_GROUP_NAME,scopeDescription:O.station_name||"New Station",parentScopeId:null!==(g=null==Ye?void 0:Ye.id)&&void 0!==g?g:null,customScopeName:O.station_name||"New Station",customScopeId:s.v4(),createByName:(null==be?void 0:be.firstname)||"System",createdBy:(null==be?void 0:be.email)||"system@audacy.com",scopeType:"Station",approvalRequired:"approval_required"===ke,audacyStationMetadata:{genre:Ke.genre,low_sellout_configurations:"Low Sellout"===Ke.type?Ke.lowSelloutConfig:null,market:O.market,primetime_windows:Ke.primeTime,region:O.region,station_guid:O.station_guid,station_type:""===Ke.type?null:Ke.type,source_days:Ke.source_days,target_days:Ke.target_days},appsecData:{application:null==Ee?void 0:Ee.applicationId,module:null==Ee?void 0:Ee.moduleId,roles:e.__spreadArray(e.__spreadArray([],"approval_required"===ke?[{users:Oe.map(function(e){return e.email}),groups:Ie.map(function(e){return e._id}),role:null!==(f=null===(x=Fe.find(function(e){return"Learning Manager"===e.name}))||void 0===x?void 0:x._id)&&void 0!==f?f:""}]:[],!0),[{users:[null==be?void 0:be.email],groups:[],role:null!==(y=null===(m=Fe.find(function(e){return"Instant Learning Admin"===e.name}))||void 0===m?void 0:m._id)&&void 0!==y?y:""}],!1)}}:{topic:"customRuleSet",scope_reference_id:null,scopeDescription:"demo",parentScopeId:null,scopeName:O.station_name||"New Station",scopeReferenceMetadata:{},applicationMappingId:k},console.log("[StationOnboard] Step 1: Creating rule set with payload:",t),[4,a.createRuleSet(t,q)];case 2:if(l=w.sent(),!(o=null===(v=null==l?void 0:l.data)||void 0===v?void 0:v.scopeId))throw new Error("Failed to create scope - no scopeId returned");return console.log("[StationOnboard] Step 1 Complete: Created scope with ID:",o),me(1),[3,4];case 3:return u=w.sent(),console.error("[StationOnboard] Error creating rule set:",u),null===(S=je.current)||void 0===S||S.show({severity:"error",life:3e3,summary:"Error",detail:"Failed to create rule set. Please try again."}),fe(!1),me(0),[2];case 4:return w.trys.push([4,6,,7]),d=null!==de&&de!==(null==Ye?void 0:Ye.id),c={source_scope_id:d?de:null!==(b=null==Ye?void 0:Ye.id)&&void 0!==b?b:de,target_scope_id:o,is_copy_parent_variant_id:d},console.log("[StationOnboard] Step 3: Inheriting scope with payload:",c),[4,a.inheritScopeBackwardCompatible(c)];case 5:return w.sent(),console.log("[StationOnboard] Step 3 Complete: Scope inherited"),me(3),[3,7];case 6:return p=w.sent(),console.error("[StationOnboard] Error inheriting scope (no rollback):",p),null===(j=je.current)||void 0===j||j.show({severity:"error",life:3e3,summary:"Error",detail:"Failed to apply rule template. Please try again."}),fe(!1),me(0),[2];case 7:return we.current=o,console.log("[StationOnboard] Onboarding completed successfully!"),[2]}})})},disabled:!$e||xe,style:{padding:"7px 10px",borderRadius:"6px",border:"none",backgroundColor:$e?"#2563EB":"#BFDBFE",color:"#fff",cursor:$e&&!xe?"pointer":"not-allowed",fontSize:"14px",fontWeight:500,display:"flex",alignItems:"center",gap:"7px"}},{children:xe?n.jsxs(n.Fragment,{children:[n.jsx(o.CircularProgress,{size:16,color:"inherit"}),n.jsx("span",{children:"Onboarding..."})]}):n.jsxs(n.Fragment,{children:[n.jsx("span",{children:"Onboard Station"}),n.jsx(i.ArrowRight,{size:16})]})}))]}))]}))};
2
2
  //# sourceMappingURL=StationOnboardModal.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("zustand").create(function(e){return{llmStudioUrl:"https://devllmstudio.creativeworkspace.ai",audacyBackendUrl:null,appsecRbacUrl:null,appsecBaseUrl:null,rbacConfig:null,auditLogConfig:null,setLlmStudioUrl:function(r){return e({llmStudioUrl:r})},setAudacyBackendUrl:function(r){return e({audacyBackendUrl:r})},setRbacConfig:function(r){return e({rbacConfig:r,appsecRbacUrl:r.appsecRbacUrl,appsecBaseUrl:r.appsecBaseUrl})},setAuditLogConfig:function(r){return e({auditLogConfig:r})}}});exports.default=e;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("zustand").create(function(e){return{llmStudioUrl:"https://devllmstudio.creativeworkspace.ai",audacyBackendUrl:null,appsecRbacUrl:null,appsecBaseUrl:null,rbacConfig:null,auditLogConfig:null,baseModeName:null,setLlmStudioUrl:function(a){return e({llmStudioUrl:a})},setAudacyBackendUrl:function(a){return e({audacyBackendUrl:a})},setRbacConfig:function(a){return e({rbacConfig:a,appsecRbacUrl:a.appsecRbacUrl,appsecBaseUrl:a.appsecBaseUrl})},setAuditLogConfig:function(a){return e({auditLogConfig:a})},setBaseModeName:function(a){return e({baseModeName:a})}}});exports.default=e;
2
2
  //# sourceMappingURL=useEnvStore.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";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};
1
+ import{__assign as e}from"tslib";import{jsxs as o,jsx as t}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 g}from"../store/usePermissionsStore.js";import h 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",w=i("scope"),C=w[0],S=w[1];u.getState().configuration;var T=g(function(e){return e.hasPermission}),L=h(function(e){var o;return(null===(o=e.rbacConfig)||void 0===o?void 0:o.applicationResourceId)||""}),A=Boolean(y&&T("ilotj.scope.changeLog.view",y)),k=Boolean(L&&T("ilotj.application.changeLog.view",L)),D=n(function(){var e=[];return y&&e.push(y),e},[b,y]);a(function(){console.log("Flattened External Resource IDs:",D)},[D]);var I={configId:f,getData:{baseUrl:window.location.origin.includes("local")?"https://dev.appmod.ai":window.location.origin,endpoint:"/changelog/audit-log/fetch"},distinctValuesApi:{baseUrl:window.location.origin.includes("local")?"https://dev.appmod.ai":window.location.origin,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 o("div",e({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[t(l,{size:16,color:"#64748b",style:{flexShrink:0}}),t("span",e({style:{fontWeight:500}},{children:i.modifiedBy}))]}))},style:{width:"15%",minWidth:"140px"}},{key:"changeAction",header:"Action",body:function(o){var i,n,a=(i=o.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=o.changeTitle?o.changeTitle.replace(/_/g," "):"—";return t("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 o;return t(s,{change:null!==(o=e.actionText)&&void 0!==o?o:"-"})},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?t("div",e({style:{display:"flex",justifyContent:"center",alignItems:"center"}},{children:o("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 ",t(c,{size:14})]}))})):t("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 t("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 o("div",e({style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"4px",fontSize:"13px",color:"#475569"}},{children:[t("span",e({style:{fontWeight:500}},{children:a})),t("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 o("div",e({style:{padding:"24px",fontFamily:"Arial, sans-serif"}},{children:[o("div",e({style:{marginBottom:"16px",paddingBottom:"4px"}},{children:[t("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})})),t("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})}))]})),o("div",e({className:p.accessTabs,role:"tablist","aria-label":"Audit log level"},{children:[t("button",e({type:"button",role:"tab","aria-selected":"scope"===C,className:"".concat(p.accessTab," ").concat("scope"===C?p.accessTabActive:""),onClick:function(){return S("scope")},disabled:!A,title:A?"":"You do not have permission to view scope level change log"},{children:d("history.scopeLevel","Scope Level")})),t("button",e({type:"button",role:"tab","aria-selected":"application"===C,className:"".concat(p.accessTab," ").concat("application"===C?p.accessTabActive:""),onClick:function(){return S("application")},disabled:!k,title:k?"":"You do not have permission to view application level change log"},{children:d("history.applicationLevel","Application Level")}))]})),"scope"===C?t(r,e({},I,{query:{externalResourceId:D.length>0?D:[""],paginationLimit:10}}),"scope-audit-log"):t(r,e({},I,{query:{externalResourceId:[],paginationLimit:10}}),"application-audit-log")]}))};export{m as default};
2
2
  //# sourceMappingURL=AuditLog.js.map