@e-llm-studio/instant-learning 0.1.1-alpha.17 → 0.1.1-alpha.18

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 (20) hide show
  1. package/dist/cjs/features/LearningManagement/LearningManagement.js +1 -1
  2. package/dist/cjs/features/LearningManagement/apis/apiConfig.js +1 -1
  3. package/dist/cjs/features/LearningManagement/apis/scopeApis.js +1 -1
  4. package/dist/cjs/features/LearningManagement/components/InstantLearningModal.js +1 -1
  5. package/dist/cjs/features/LearningManagement/components/StationOnboarding/StationOnboardModal.js +1 -1
  6. package/dist/cjs/features/LearningManagement/store/useConfigStore.js +1 -1
  7. package/dist/cjs/plugins/valueTypes/Default/DefaultTeachMeRenderer.js +1 -1
  8. package/dist/features/LearningManagement/LearningManagement.js +1 -1
  9. package/dist/features/LearningManagement/apis/apiConfig.js +1 -1
  10. package/dist/features/LearningManagement/apis/scopeApis.js +1 -1
  11. package/dist/features/LearningManagement/components/InstantLearningModal.js +1 -1
  12. package/dist/features/LearningManagement/components/StationOnboarding/StationOnboardModal.js +1 -1
  13. package/dist/features/LearningManagement/store/useConfigStore.js +1 -1
  14. package/dist/plugins/valueTypes/Default/DefaultTeachMeRenderer.js +1 -1
  15. package/dist/types/src/features/LearningManagement/apis/scopeApis.d.ts +1 -1
  16. package/dist/types/src/features/LearningManagement/apis/scopeApis.d.ts.map +1 -1
  17. package/dist/types/src/features/LearningManagement/store/useConfigStore.d.ts.map +1 -1
  18. package/dist/types/src/plugins/valueTypes/Default/DefaultTeachMeRenderer.d.ts.map +1 -1
  19. package/dist/types/src/plugins/valueTypes/RadioTrafficLearning/RadioTrafficLearningRenderer.d.ts.map +1 -1
  20. package/package.json +1 -1
@@ -1,2 +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("../../apis/scopeApis.js"),a=require("./StationAutocomplete.js"),l=require("../CardSkeleton.js"),u=require("./OnboardingLoader.js"),c=require("./TemplateCard.js"),d=require("../../styles/StationOnboardModal.module.css.js"),p=require("./InputField.js"),f=require("../../store/useAuthStore.js"),g=require("../../store/useConfigStore.js"),x=[{label:"PT - Pacific Time",value:"Pacific Time"},{label:"MT - Mountain Time",value:"Mountain Time"},{label:"CT - Central Time",value:"Central Time"},{label:"ET - Eastern Time",value:"Eastern Time"}],m=[{label:"6am to 7pm",value:"06:00 AM - 7:00 PM"},{label:"5am to 7pm",value:"05:00 AM - 7:00 PM"}],h=[{label:"Low Sellout",value:"Low Sellout"},{label:"High Sellout",value:"High Sellout"},{label:"None",value:""}],_=[{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,b=v.isOpen,y=v.onClose,j=v.onBoardStation,C=v.app_integration_id,w=v.token,T=t.useState(null),O=T[0],F=T[1],B=t.useState([]),z=B[0],E=B[1],D=t.useState(0),k=D[0],q=D[1],A=t.useState(!0),M=A[0],N=A[1],R=t.useState(!1),I=R[0],P=R[1],W=t.useState([]),L=W[0],G=W[1],Y=t.useState(""),H=Y[0],U=Y[1],X=t.useState(""),Z=X[0],K=X[1],J=t.useState(!1),Q=J[0],V=J[1],$=t.useState(!1),ee=$[0],ne=$[1],te=t.useState(null),re=te[0],oe=te[1],ie=t.useState(!1),se=ie[0],ae=ie[1],le=t.useState(0),ue=le[0],ce=le[1],de=t.useState(""),pe=de[0],fe=de[1];f.default().user;var ge=t.useRef(null),xe=t.useRef(null),me=t.useRef(null),he=t.useRef(null);g.useConfigStore().configuration;var _e=t.useState({region:"",timezone:"",primeTime:[],genre:"",type:"",lowSelloutConfig:""}),ve=_e[0],Se=_e[1],be=function(e,n){return e.find(function(e){return e.value===n})||null},ye=t.useMemo(function(){return z.map(function(e){return{label:e.scope_name,value:e.scope_name}})},[z]),je=t.useMemo(function(){var e,n,t;if(!ve.genre)return null;var r=z.find(function(e){return e.scope_name===ve.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},[ve.genre,z]);t.useEffect(function(){return function(){me.current&&clearTimeout(me.current)}},[]);var Ce=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(I)return[2];P(!0),i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,s.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?N(!1):N(!0),q(n+20)):N(!1),[3,5];case 3:return o=i.sent(),console.error("[StationOnboard] Failed to fetch genre scopes:",o),N(!1),[3,5];case 4:return P(!1),[7];case 5:return[2]}})})};t.useEffect(function(){b&&(E([]),q(0),N(!0),Ce(0))},[b]);t.useEffect(function(){Se(O?function(n){var t;return e.__assign(e.__assign({},n),{region:null!==(t=O.market)&&void 0!==t?t:""})}:{region:"",timezone:"",primeTime:[],genre:"",type:"",lowSelloutConfig:""})},[O]),t.useEffect(function(){var e=setTimeout(function(){K(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(!Z.trim())return G([]),[2];V(!0),e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,s.searchScopes({search_string:Z})];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}}),G(t)):G([]),[3,5];case 3:return r=e.sent(),console.error("[StationOnboard] Error searching scopes:",r),G([]),[3,5];case 4:return V(!1),[7];case 5:return[2]}})})},[Z]),t.useEffect(function(){!Z.trim()&&je&&oe(je.id)},[Z,je]);var we=function(){setTimeout(function(){he.current&&he.current.scrollTo({top:he.current.scrollHeight,behavior:"smooth"})},100)},Te=function(){fe(""),F(null),Se({region:"",timezone:"",primeTime:[],genre:"",type:"",lowSelloutConfig:""}),G([]),U(""),oe(null),y()},Oe=function(n,t){var r;if("primeTime"!==n){var o=null!==(r=null==t?void 0:t.value)&&void 0!==r?r:"";Se(function(t){var r;return e.__assign(e.__assign({},t),((r={})[n]=String(o),r))}),"genre"===n&&(ne(!0),me.current&&clearTimeout(me.current),me.current=setTimeout(function(){var e=z.find(function(e){return e.scope_name===o});oe(e?e.id:null),ne(!1)},800))}else{var i=(null==t?void 0:t.value)?String(t.value):"";Se(function(n){return e.__assign(e.__assign({},n),{primeTime:i?[i]:[]})})}},Fe=Boolean(O&&ve.region&&ve.timezone&&ve.primeTime.length>0&&ve.genre);return n.jsxs(r.Dialog,e.__assign({open:b,onClose:Te,maxWidth:!1,disableEscapeKeyDown:!0,PaperProps:{sx:{width:"90vw",height:"90vh",borderRadius:"12px",display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"sans-serif"}}},{children:[n.jsx(i.Toast,{ref:ge}),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:Te,disabled:se,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(u.default,{isLoading:se,currentStep:ue,onComplete:function(){ae(!1);var e=xe.current;Te(),j(e||void 0),xe.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:he,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:d.default.formGroup},{children:[n.jsxs("label",e.__assign({className:d.default.label},{children:[n.jsx("span",e.__assign({className:d.default.asterisk},{children:"*"})),"Station Name/Call Letters"]})),n.jsx(a.default,{value:pe,onChange:fe,onStationSelect:function(e){return F(e)}})]})),n.jsx(p.default,{required:!0,disabled:!0,label:"Region",placeholder:"Select Region",value:ve.region||void 0,isSearchable:!1}),n.jsx(p.default,{required:!0,label:"TimeZone",placeholder:"Select TimeZone",options:x,value:be(x,ve.timezone),onOptionChange:function(e){return Oe("timezone",e)},isSearchable:!1}),n.jsx(p.default,{required:!0,label:"Prime Time Window",placeholder:"Select Prime Time",options:m,value:be(m,(null===(S=ve.primeTime)||void 0===S?void 0:S[0])||""),onOptionChange:function(e){return Oe("primeTime",e)},isSearchable:!1}),n.jsx(r.Box,e.__assign({onClick:we,sx:{width:"100%"}},{children:n.jsx(p.default,{required:!0,label:"Genre",placeholder:"Select Genre",options:ye,value:be(ye,ve.genre),onOptionChange:function(e){return Oe("genre",e)},isSearchable:!1,onMenuScrollToBottom:function(){!I&&M&&Ce(k)},isLoadingOptions:I,hasMoreOptions:M})})),n.jsx(r.Box,e.__assign({onClick:we,sx:{width:"100%"}},{children:n.jsx(p.default,{label:"Station Type",placeholder:"None",options:h,value:be(h,ve.type),onOptionChange:function(n){Oe("type",n),"Low Sellout"!==(null==n?void 0:n.value)&&Se(function(n){return e.__assign(e.__assign({},n),{lowSelloutConfig:""})})},isSearchable:!1})})),"Low Sellout"===ve.type&&n.jsx(r.Box,e.__assign({onClick:we,sx:{width:"100%"}},{children:n.jsx(p.default,{label:"Low Sell Out Configurations",placeholder:"Select Configuration",options:_,value:be(_,ve.lowSelloutConfig),onOptionChange:function(e){return Oe("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:ve.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:ee?n.jsx(l.default,{}):je?n.jsx(c.default,e.__assign({},je,{isSelected:re===je.id,onSelect:oe}),je.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:d.default.searchWrapper},{children:[n.jsx("input",{type:"text",value:H,onChange:function(e){return U(e.target.value)},placeholder:"Search for station...",className:d.default.searchInput}),n.jsx(o.Search,{className:d.default.searchIcon,size:16})]})),n.jsxs(r.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:2}},{children:[Q&&n.jsx(l.default,{}),!Q&&0===L.length&&Z.trim()&&n.jsxs(r.Typography,e.__assign({sx:{fontSize:"0.875rem",color:"#64748B",textAlign:"center",py:4}},{children:['No scopes found matching "',Z,'".']})),!Q&&L.map(function(t){return n.jsx(c.default,e.__assign({},t,{isSelected:re===t.id,onSelect:oe}),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(o.BrushCleaning,{})}))]})}))]}))]})),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:Te,disabled:se,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,u,c,d,p,f,g,x,m,h,_,v;return e.__generator(this,function(S){switch(S.label){case 0:if(!O||!re)return console.error("[StationOnboard] Missing required data for onboarding"),[2];n=je?e.__spreadArray([je],L,!0):L,t=n.find(function(e){return e.id===re}),r=null!==(g=null==t?void 0:t.isCopy)&&void 0!==g&&g,ae(!0),ce(0),o=null,S.label=1;case 1:return S.trys.push([1,3,,4]),i={topic:"customRuleSet",scope_reference_id:null,scopeDescription:"demo",parentScopeId:null,scopeName:O.station_name||"New Station",scopeReferenceMetadata:{},applicationMappingId:C},console.log("[StationOnboard] Step 1: Creating rule set with payload:",i),[4,s.createRuleSet(i,w)];case 2:if(a=S.sent(),!(o=null===(x=null==a?void 0:a.data)||void 0===x?void 0:x.scopeId))throw new Error("Failed to create scope - no scopeId returned");return console.log("[StationOnboard] Step 1 Complete: Created scope with ID:",o),ce(1),[3,4];case 3:return l=S.sent(),console.error("[StationOnboard] Error creating rule set:",l),null===(m=ge.current)||void 0===m||m.show({severity:"error",life:3e3,summary:"Error",detail:"Failed to create rule set. Please try again."}),ae(!1),ce(0),[2];case 4:return S.trys.push([4,6,,11]),u={market:O.market,region:O.region,timezone:ve.timezone,primetime_windows:ve.primeTime,genre:ve.genre,station_type:""===ve.type?null:ve.type,low_sellout_configurations:"Low Sellout"===ve.type?ve.lowSelloutConfig:null,ruleset_id:o,station_guid:O.station_guid,station_name:O.station_name||"New Station"},console.log("[StationOnboard] Step 2: Updating station with payload:",u),[4,s.updateStation(u)];case 5:return S.sent(),console.log("[StationOnboard] Step 2 Complete: Station updated"),ce(2),[3,11];case 6:c=S.sent(),console.error("[StationOnboard] Error updating station, rolling back rule set:",c),409===c.status?(null===(h=ge.current)||void 0===h||h.show({severity:"error",life:2500,summary:"Error updating station",detail:"Station already Onboarded."}),F(null),oe(null),fe(""),Se(function(n){return e.__assign(e.__assign({},n),{region:""})})):null===(_=ge.current)||void 0===_||_.show({severity:"error",life:2500,summary:"Error updating station",detail:"Please try again."}),S.label=7;case 7:return S.trys.push([7,9,,10]),[4,s.deleteRuleSet(o)];case 8:return S.sent(),console.log("[StationOnboard] Rollback complete: Deleted rule set",o),[3,10];case 9:return d=S.sent(),console.error("[StationOnboard] Failed to rollback rule set deletion:",d),[3,10];case 10:return ae(!1),ce(0),[2];case 11:return S.trys.push([11,13,,14]),p={source_scope_id:re,target_scope_id:o,is_copy_parent_variant_id:r},console.log("[StationOnboard] Step 3: Inheriting scope with payload:",p),[4,s.inheritScope(p)];case 12:return S.sent(),console.log("[StationOnboard] Step 3 Complete: Scope inherited"),ce(3),[3,14];case 13:return f=S.sent(),console.error("[StationOnboard] Error inheriting scope (no rollback):",f),null===(v=ge.current)||void 0===v||v.show({severity:"error",life:3e3,summary:"Error",detail:"Failed to apply rule template. Please try again."}),ae(!1),ce(0),[2];case 14:return xe.current=o,console.log("[StationOnboard] Onboarding completed successfully!"),[2]}})})},disabled:!Fe||se,style:{padding:"7px 10px",borderRadius:"6px",border:"none",backgroundColor:Fe?"#2563EB":"#BFDBFE",color:"#fff",cursor:Fe&&!se?"pointer":"not-allowed",fontSize:"14px",fontWeight:500,display:"flex",alignItems:"center",gap:"7px"}},{children:se?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})]})}))]}))]}))};
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("../../apis/scopeApis.js"),a=require("./StationAutocomplete.js"),l=require("../CardSkeleton.js"),u=require("./OnboardingLoader.js"),c=require("./TemplateCard.js"),d=require("../../styles/StationOnboardModal.module.css.js"),p=require("./InputField.js"),f=require("../../store/useAuthStore.js"),g=require("../../store/useConfigStore.js"),x=[{label:"PT - Pacific Time",value:"Pacific Time"},{label:"MT - Mountain Time",value:"Mountain Time"},{label:"CT - Central Time",value:"Central Time"},{label:"ET - Eastern Time",value:"Eastern Time"}],m=[{label:"6am to 7pm",value:"06:00 AM - 7:00 PM"},{label:"5am to 7pm",value:"05:00 AM - 7:00 PM"}],h=[{label:"Low Sellout",value:"Low Sellout"},{label:"High Sellout",value:"High Sellout"},{label:"None",value:""}],_=[{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,b=v.isOpen,y=v.onClose,j=v.onBoardStation,C=v.app_integration_id,w=v.token,T=t.useState(null),O=T[0],F=T[1],B=t.useState([]),z=B[0],E=B[1],D=t.useState(0),k=D[0],q=D[1],A=t.useState(!0),M=A[0],N=A[1],R=t.useState(!1),I=R[0],P=R[1],W=t.useState([]),L=W[0],G=W[1],Y=t.useState(""),H=Y[0],U=Y[1],X=t.useState(""),Z=X[0],K=X[1],J=t.useState(!1),Q=J[0],V=J[1],$=t.useState(!1),ee=$[0],ne=$[1],te=t.useState(null),re=te[0],oe=te[1],ie=t.useState(!1),se=ie[0],ae=ie[1],le=t.useState(0),ue=le[0],ce=le[1],de=t.useState(""),pe=de[0],fe=de[1];f.default().user;var ge=t.useRef(null),xe=t.useRef(null),me=t.useRef(null),he=t.useRef(null);g.useConfigStore().configuration;var _e=t.useState({region:"",timezone:"",primeTime:[],genre:"",type:"",lowSelloutConfig:""}),ve=_e[0],Se=_e[1],be=function(e,n){return e.find(function(e){return e.value===n})||null},ye=t.useMemo(function(){return z.map(function(e){return{label:e.scope_name,value:e.scope_name}})},[z]),je=t.useMemo(function(){var e,n,t;if(!ve.genre)return null;var r=z.find(function(e){return e.scope_name===ve.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},[ve.genre,z]);t.useEffect(function(){return function(){me.current&&clearTimeout(me.current)}},[]);var Ce=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(I)return[2];P(!0),i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,s.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?N(!1):N(!0),q(n+20)):N(!1),[3,5];case 3:return o=i.sent(),console.error("[StationOnboard] Failed to fetch genre scopes:",o),N(!1),[3,5];case 4:return P(!1),[7];case 5:return[2]}})})};t.useEffect(function(){b&&(E([]),q(0),N(!0),Ce(0))},[b]);t.useEffect(function(){Se(O?function(n){var t;return e.__assign(e.__assign({},n),{region:null!==(t=O.market)&&void 0!==t?t:""})}:{region:"",timezone:"",primeTime:[],genre:"",type:"",lowSelloutConfig:""})},[O]),t.useEffect(function(){var e=setTimeout(function(){K(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(!Z.trim())return G([]),[2];V(!0),e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,s.searchScopes({search_string:Z})];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}}),G(t)):G([]),[3,5];case 3:return r=e.sent(),console.error("[StationOnboard] Error searching scopes:",r),G([]),[3,5];case 4:return V(!1),[7];case 5:return[2]}})})},[Z]),t.useEffect(function(){!Z.trim()&&je&&oe(je.id)},[Z,je]);var we=function(){setTimeout(function(){he.current&&he.current.scrollTo({top:he.current.scrollHeight,behavior:"smooth"})},100)},Te=function(){fe(""),F(null),Se({region:"",timezone:"",primeTime:[],genre:"",type:"",lowSelloutConfig:""}),G([]),U(""),oe(null),y()},Oe=function(n,t){var r;if("primeTime"!==n){var o=null!==(r=null==t?void 0:t.value)&&void 0!==r?r:"";Se(function(t){var r;return e.__assign(e.__assign({},t),((r={})[n]=String(o),r))}),"genre"===n&&(ne(!0),me.current&&clearTimeout(me.current),me.current=setTimeout(function(){var e=z.find(function(e){return e.scope_name===o});oe(e?e.id:null),ne(!1)},800))}else{var i=(null==t?void 0:t.value)?String(t.value):"";Se(function(n){return e.__assign(e.__assign({},n),{primeTime:i?[i]:[]})})}},Fe=Boolean(O&&ve.region&&ve.timezone&&ve.primeTime.length>0&&ve.genre);return n.jsxs(r.Dialog,e.__assign({open:b,onClose:Te,maxWidth:!1,disableEscapeKeyDown:!0,PaperProps:{sx:{width:"90vw",height:"90vh",borderRadius:"12px",display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"sans-serif"}}},{children:[n.jsx(i.Toast,{ref:ge}),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:Te,disabled:se,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(u.default,{isLoading:se,currentStep:ue,onComplete:function(){ae(!1);var e=xe.current;Te(),j(e||void 0),xe.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:he,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:d.default.formGroup},{children:[n.jsxs("label",e.__assign({className:d.default.label},{children:[n.jsx("span",e.__assign({className:d.default.asterisk},{children:"*"})),"Station Name/Call Letters"]})),n.jsx(a.default,{value:pe,onChange:fe,onStationSelect:function(e){return F(e)}})]})),n.jsx(p.default,{required:!0,disabled:!0,label:"Region",placeholder:"Select Region",value:ve.region||void 0,isSearchable:!1}),n.jsx(p.default,{required:!0,label:"TimeZone",placeholder:"Select TimeZone",options:x,value:be(x,ve.timezone),onOptionChange:function(e){return Oe("timezone",e)},isSearchable:!1}),n.jsx(p.default,{required:!0,label:"Prime Time Window",placeholder:"Select Prime Time",options:m,value:be(m,(null===(S=ve.primeTime)||void 0===S?void 0:S[0])||""),onOptionChange:function(e){return Oe("primeTime",e)},isSearchable:!1}),n.jsx(r.Box,e.__assign({onClick:we,sx:{width:"100%"}},{children:n.jsx(p.default,{required:!0,label:"Genre",placeholder:"Select Genre",options:ye,value:be(ye,ve.genre),onOptionChange:function(e){return Oe("genre",e)},isSearchable:!1,onMenuScrollToBottom:function(){!I&&M&&Ce(k)},isLoadingOptions:I,hasMoreOptions:M})})),n.jsx(r.Box,e.__assign({onClick:we,sx:{width:"100%"}},{children:n.jsx(p.default,{label:"Station Type",placeholder:"None",options:h,value:be(h,ve.type),onOptionChange:function(n){Oe("type",n),"Low Sellout"!==(null==n?void 0:n.value)&&Se(function(n){return e.__assign(e.__assign({},n),{lowSelloutConfig:""})})},isSearchable:!1})})),"Low Sellout"===ve.type&&n.jsx(r.Box,e.__assign({onClick:we,sx:{width:"100%"}},{children:n.jsx(p.default,{label:"Low Sell Out Configurations",placeholder:"Select Configuration",options:_,value:be(_,ve.lowSelloutConfig),onOptionChange:function(e){return Oe("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:ve.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:ee?n.jsx(l.default,{}):je?n.jsx(c.default,e.__assign({},je,{isSelected:re===je.id,onSelect:oe}),je.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:d.default.searchWrapper},{children:[n.jsx("input",{type:"text",value:H,onChange:function(e){return U(e.target.value)},placeholder:"Search for station...",className:d.default.searchInput}),n.jsx(o.Search,{className:d.default.searchIcon,size:16})]})),n.jsxs(r.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:2}},{children:[Q&&n.jsx(l.default,{}),!Q&&0===L.length&&Z.trim()&&n.jsxs(r.Typography,e.__assign({sx:{fontSize:"0.875rem",color:"#64748B",textAlign:"center",py:4}},{children:['No scopes found matching "',Z,'".']})),!Q&&L.map(function(t){return n.jsx(c.default,e.__assign({},t,{isSelected:re===t.id,onSelect:oe}),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(o.BrushCleaning,{})}))]})}))]}))]})),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:Te,disabled:se,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,u,c,d,p,f,g,x,m,h,_,v;return e.__generator(this,function(S){switch(S.label){case 0:if(!O||!re)return console.error("[StationOnboard] Missing required data for onboarding"),[2];n=je?e.__spreadArray([je],L,!0):L,t=n.find(function(e){return e.id===re}),r=null!==(g=null==t?void 0:t.isCopy)&&void 0!==g&&g,ae(!0),ce(0),o=null,S.label=1;case 1:return S.trys.push([1,3,,4]),i={topic:"customRuleSet",scope_reference_id:null,scopeDescription:"demo",parentScopeId:null,scopeName:O.station_name||"New Station",scopeReferenceMetadata:{},applicationMappingId:C},console.log("[StationOnboard] Step 1: Creating rule set with payload:",i),[4,s.createRuleSet(i,w)];case 2:if(a=S.sent(),!(o=null===(x=null==a?void 0:a.data)||void 0===x?void 0:x.scopeId))throw new Error("Failed to create scope - no scopeId returned");return console.log("[StationOnboard] Step 1 Complete: Created scope with ID:",o),ce(1),[3,4];case 3:return l=S.sent(),console.error("[StationOnboard] Error creating rule set:",l),null===(m=ge.current)||void 0===m||m.show({severity:"error",life:3e3,summary:"Error",detail:"Failed to create rule set. Please try again."}),ae(!1),ce(0),[2];case 4:return S.trys.push([4,6,,11]),u={market:O.market,region:O.region,timezone:ve.timezone,primetime_windows:ve.primeTime,genre:ve.genre,station_type:""===ve.type?null:ve.type,low_sellout_configurations:"Low Sellout"===ve.type?ve.lowSelloutConfig:null,ruleset_id:o,station_guid:O.station_guid,station_name:O.station_name||"New Station"},console.log("[StationOnboard] Step 2: Updating station with payload:",u),[4,s.updateStation(u)];case 5:return S.sent(),console.log("[StationOnboard] Step 2 Complete: Station updated"),ce(2),[3,11];case 6:c=S.sent(),console.error("[StationOnboard] Error updating station, rolling back rule set:",c),409===c.status?(null===(h=ge.current)||void 0===h||h.show({severity:"error",life:2500,summary:"Error updating station",detail:"Station already Onboarded."}),F(null),oe(null),fe(""),Se(function(n){return e.__assign(e.__assign({},n),{region:""})})):null===(_=ge.current)||void 0===_||_.show({severity:"error",life:2500,summary:"Error updating station",detail:"Please try again."}),S.label=7;case 7:return S.trys.push([7,9,,10]),[4,s.deleteRuleSet(o,w)];case 8:return S.sent(),console.log("[StationOnboard] Rollback complete: Deleted rule set",o),[3,10];case 9:return d=S.sent(),console.error("[StationOnboard] Failed to rollback rule set deletion:",d),[3,10];case 10:return ae(!1),ce(0),[2];case 11:return S.trys.push([11,13,,14]),p={source_scope_id:re,target_scope_id:o,is_copy_parent_variant_id:r},console.log("[StationOnboard] Step 3: Inheriting scope with payload:",p),[4,s.inheritScope(p)];case 12:return S.sent(),console.log("[StationOnboard] Step 3 Complete: Scope inherited"),ce(3),[3,14];case 13:return f=S.sent(),console.error("[StationOnboard] Error inheriting scope (no rollback):",f),null===(v=ge.current)||void 0===v||v.show({severity:"error",life:3e3,summary:"Error",detail:"Failed to apply rule template. Please try again."}),ae(!1),ce(0),[2];case 14:return xe.current=o,console.log("[StationOnboard] Onboarding completed successfully!"),[2]}})})},disabled:!Fe||se,style:{padding:"7px 10px",borderRadius:"6px",border:"none",backgroundColor:Fe?"#2563EB":"#BFDBFE",color:"#fff",cursor:Fe&&!se?"pointer":"not-allowed",fontSize:"14px",fontWeight:500,display:"flex",alignItems:"center",gap:"7px"}},{children:se?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
2
  //# sourceMappingURL=StationOnboardModal.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("zustand").create(function(n){return{configuration:null,ilLabels:{setupLabel:"Learning Setup",ruleTitle:"Learning Title",ruleDescriptionTitle:"Learning Description"},setConfig:function(e){return n(function(){return{configuration:e}})},setIlLabels:function(i){return n(function(n){return{ilLabels:e.__assign(e.__assign({},n.ilLabels),i)}})},resetConfig:function(){return n({configuration:null,ilLabels:{setupLabel:"Learning Setup",ruleTitle:"Learning Title",ruleDescriptionTitle:"Learning Description"}})}}});exports.useConfigStore=n;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("zustand"),t={"Separation rule":"I would want to add a separation rule","Max priority rule":"I would want to set a max priority rule","Break code matching":"I would want to add a break code matching rule","Inventory code matching":"I would want to add a inventory window matching rule","Enter a rule description":"I want to add a rule description","Tester Genie":"Loading prompt..."},r="<p><span>Hi! 👋 I'm your Instant Learning Concierge.</span>\n <span>How would you like to get started? You can select an option below or describe the rule you'd like to create.</span>\n ".concat(["Separation rule","Max priority rule","Break code matching","Inventory code matching","Enter a rule description","Tester Genie"].map(function(e){return'<button class="clickable-button" data-value="'.concat(t[e],'">').concat(e,"</button>")}).join(""),"</p>"),i=n.create(function(n){return{configuration:{INITIAL_CHAT_MESSAGE:r},ilLabels:{setupLabel:"Learning Setup",ruleTitle:"Learning Title",ruleDescriptionTitle:"Learning Description"},setConfig:function(e){return n(function(){return{configuration:e}})},setIlLabels:function(t){return n(function(n){return{ilLabels:e.__assign(e.__assign({},n.ilLabels),t)}})},resetConfig:function(){return n({configuration:null,ilLabels:{setupLabel:"Learning Setup",ruleTitle:"Learning Title",ruleDescriptionTitle:"Learning Description"}})}}});exports.useConfigStore=i;
2
2
  //# sourceMappingURL=useConfigStore.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");require("../../../features/IL-OTJ/_components/atoms/Textarea/Textarea.js"),require("../../../features/IL-OTJ/_components/InputDataReasoningCard.js"),require("../../../features/IL-OTJ/_components/TooltipComponent.js");var a=require("../../../features/IL-OTJ/_components/templates/TemplatesMap/templatesMap.js");require("../../../features/IL-OTJ/store/CitationsContext.js"),require("@mui/material"),require("uuid"),require("@mui/material/Tooltip"),require("react-markdown"),require("rehype-raw"),require("axios"),require("@e-llm-studio/streaming-response"),require("@e-llm-studio/watch-me-work"),require("../../../features/IL-OTJ/_components/ChatComponents/ChatHeader.js"),require("remark-gfm"),require("../../../features/IL-OTJ/_components/MarkdownComponents/MarkdownElements.js"),require("../../../features/IL-OTJ/_components/CitationLink.js"),require("@e-llm-studio/citation"),require("@viswa-test/test-citation"),require("../../../features/LearningManagement/store/useLearningTemplateStore.js"),require("primereact/toast"),require("../../../features/LearningManagement/apis/scopeApis.js"),require("../../../features/LearningManagement/components/ToolTip.js"),require("../../../features/LearningManagement/store/useAuthStore.js"),require("date-fns"),require("framer-motion"),require("@mui/icons-material/Close");var o=require("../../../features/IL-OTJ/_components/AccordianSection.js"),i=require("../../../features/IL-OTJ/ILOTJ.js");require("../../../features/LearningManagement/store/useConfigStore.js"),require("@radix-ui/react-tooltip"),require("../../../features/LearningManagement/components/StationOnboarding/InputField.js"),require("../../../features/LearningManagement/store/useEnvStore.js");var s={order_rules:{enabled:!1,global_min_separation_seconds:0},advertiser_rules:{enabled:!1,global_min_separation_seconds:0},inventory_rules:{respect_inventory_code:!1},break_code_rules:{respect_break_code:!1},is_default_enabled:!1},l=[{label:"Global Scope",value:"global"},{label:"Genre Scope",value:"genre"},{label:"Custom Scope",value:"custom"}],u=["Tier 1"];exports.default=function(){var c=n.useState(!0),d=c[0],p=c[1],_=n.useState(""),m=_[0],g=_[1],f=n.useState(""),b=f[0],v=f[1],h=n.useState({station:"",tiers:["Tier 1"]}),y=h[0],T=h[1],k=n.useState([]),q=k[0],w=k[1],L=n.useState([]),C=L[0],x=L[1],j=n.useState(s),S=j[0],I=j[1],A=n.useCallback(function(t,n){T(function(r){var a;return e.__assign(e.__assign({},r),((a={})[t]=n,a))})},[]),O=n.useCallback(function(t,n){I(function(r){var a=e.__assign({},r);switch(t){case"order_rules":case"advertiser_rules":a[t]="boolean"==typeof n?e.__assign(e.__assign({},r[t]),{enabled:n}):{enabled:n.enabled,global_min_separation_seconds:n.global_min_separation_seconds};break;case"inventory_rules":a.inventory_rules={respect_inventory_code:"boolean"==typeof n?n:n.respect_inventory_code};break;case"break_code_rules":a.break_code_rules={respect_break_code:"boolean"==typeof n?n:n.respect_break_code};break;case"is_default_enabled":a.is_default_enabled="boolean"==typeof n?n:!!n}return a})},[]),M=function(t){t(function(t){return e.__spreadArray(e.__spreadArray([],t,!0),[{id:Date.now(),text:"",reasoning:""}],!1)})},N=function(e,t){e(function(e){return e.filter(function(e){return e.id!==t})})},E=function(t,n,r){t(function(t){return t.map(function(t){return String(t.id)===String(n)?e.__assign(e.__assign({},t),{text:r}):t})})},J=[e.__assign({key:"order_rules",label:"Order"},S.order_rules),e.__assign({key:"advertiser_rules",label:"Advertiser"},S.advertiser_rules)],D=[{key:"inventory_rules",label:"Inventory code",enabled:S.inventory_rules.respect_inventory_code},{key:"break_code_rules",label:"Break Code",enabled:S.break_code_rules.respect_break_code},{key:"is_default_enabled",label:"Default Variant",enabled:S.is_default_enabled}],W={"Separation rule":"I would want to add a separation rule","Max priority rule":"I would want to set a max priority rule","Break code matching":"I would want to add a break code matching rule","Inventory code matching":"I would want to add a inventory window matching rule","Enter a rule description":"I want to add a rule description","Tester Genie":"Loading prompt..."},B="<p><span>Hi! 👋 I'm your Instant Learning Concierge.</span>\n <span>How would you like to get started? You can select an option below or describe the rule you’d like to create.</span>\n ".concat(["Separation rule","Max priority rule","Break code matching","Inventory code matching","Enter a rule description","Tester Genie"].map(function(e){return'<button class="clickable-button" data-value="'.concat(W[e],'">').concat(e,"</button>")}).join(""),"</p>");return t.jsx(i.default,{open:d,closeFunction:function(){return p(!1)},chatAssistantName:"defaultAssistant",organizationName:"techolution",baseUrl:"https://devllmstudio.creativeworkspace.ai",baseWebsocketUrl:"wss://devllmstudio.creativeworkspace.ai/graphql",ThinkingBulbIconComponent:t.jsx(r.Lightbulb,{}),customSections:t.jsx(t.Fragment,{}),isUseNormalChat:!0,chatTitle:"Create New Learning",formTitle:"Learning Details",initialChatMessage:B,template:a.TemplateList.BaseTemplate,templateProps:{state:{title:m,description:b,scopeData:y,whenToApplyConditions:q,whenNotToApplyConditions:C,configData:S,citations:[],citation:{}},handlers:{onTitleChange:function(e){var t,n;return g(null!==(n=null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.value)&&void 0!==n?n:e)},onDescriptionChange:function(e){var t,n;return v(null!==(n=null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.value)&&void 0!==n?n:e)},onAddWhenToApply:function(){return M(w)},onRemoveWhenToApply:function(e){return N(w,e)},onEditWhenToApply:function(e,t){return E(w,e,t)},onAddWhenNotToApply:function(){return M(x)},onRemoveWhenNotToApply:function(e){return N(x,e)},onEditWhenNotToApply:function(e,t){return E(x,e,t)},onScopeChange:A,onConfigChange:O},uiState:{showScope:!1,showConfiguration:!0,titleLabel:"Main Rule Name",scopeLabel:"Define Scope",tierLabel:"Select Tier",descriptionLabel:"Learning Explanation",whenToApplyLabel:"Trigger Events (When to Apply)",whenNotToApplyLabel:"Exclusion Events (When NOT to Apply)",configLabel:"Advanced Settings",stationOptions:l,tierOptions:u,separationItems:J,toggles:D},customNodes:{afterDescription:t.jsx(o.default,e.__assign({title:{type:"other",label:"Extra Context Panel"}},{children:t.jsx("p",e.__assign({style:{padding:"12px",fontSize:"14px",color:"#64748b"}},{children:"Because you decoupled the template, I can inject anything I want here without touching BaseTemplate logic!"}))})),afterTitle:t.jsxs("div",e.__assign({style:{marginBottom:"12px",padding:"8px",backgroundColor:"#f0f4ff",borderRadius:"4px"}},{children:[t.jsx("strong",{children:"Tip:"})," Use a clear and descriptive title for your rule to make it easily identifiable later."]}))}}})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),r=require("react"),n=require("lucide-react");require("../../../features/IL-OTJ/_components/atoms/Textarea/Textarea.js"),require("../../../features/IL-OTJ/_components/InputDataReasoningCard.js"),require("../../../features/IL-OTJ/_components/TooltipComponent.js");var a=require("../../../features/IL-OTJ/_components/templates/TemplatesMap/templatesMap.js");require("../../../features/IL-OTJ/store/CitationsContext.js"),require("@mui/material"),require("uuid"),require("@mui/material/Tooltip"),require("react-markdown"),require("rehype-raw"),require("axios"),require("@e-llm-studio/streaming-response"),require("@e-llm-studio/watch-me-work"),require("../../../features/IL-OTJ/_components/ChatComponents/ChatHeader.js"),require("remark-gfm"),require("../../../features/IL-OTJ/_components/MarkdownComponents/MarkdownElements.js"),require("../../../features/IL-OTJ/_components/CitationLink.js"),require("@e-llm-studio/citation"),require("@viswa-test/test-citation"),require("../../../features/LearningManagement/store/useLearningTemplateStore.js"),require("primereact/toast"),require("../../../features/LearningManagement/apis/scopeApis.js"),require("../../../features/LearningManagement/components/ToolTip.js"),require("../../../features/LearningManagement/store/useAuthStore.js"),require("date-fns"),require("framer-motion"),require("@mui/icons-material/Close");var o=require("../../../features/IL-OTJ/_components/AccordianSection.js"),i=require("../../../features/IL-OTJ/ILOTJ.js");require("../../../features/LearningManagement/store/useConfigStore.js"),require("@radix-ui/react-tooltip"),require("../../../features/LearningManagement/components/StationOnboarding/InputField.js"),require("../../../features/LearningManagement/store/useEnvStore.js");var s={order_rules:{enabled:!1,global_min_separation_seconds:0},advertiser_rules:{enabled:!1,global_min_separation_seconds:0},inventory_rules:{respect_inventory_code:!1},break_code_rules:{respect_break_code:!1},is_default_enabled:!1},l=[{label:"Global Scope",value:"global"},{label:"Genre Scope",value:"genre"},{label:"Custom Scope",value:"custom"}],u=["Tier 1"];exports.default=function(){var c=r.useState(!0),p=c[0],d=c[1],_=r.useState(""),f=_[0],m=_[1],g=r.useState(""),b=g[0],v=g[1],h=r.useState({station:"",tiers:["Tier 1"]}),y=h[0],T=h[1],q=r.useState([]),k=q[0],L=q[1],C=r.useState([]),j=C[0],x=C[1],S=r.useState(s),A=S[0],w=S[1],I=r.useCallback(function(t,r){T(function(n){var a;return e.__assign(e.__assign({},n),((a={})[t]=r,a))})},[]),O=r.useCallback(function(t,r){w(function(n){var a=e.__assign({},n);switch(t){case"order_rules":case"advertiser_rules":a[t]="boolean"==typeof r?e.__assign(e.__assign({},n[t]),{enabled:r}):{enabled:r.enabled,global_min_separation_seconds:r.global_min_separation_seconds};break;case"inventory_rules":a.inventory_rules={respect_inventory_code:"boolean"==typeof r?r:r.respect_inventory_code};break;case"break_code_rules":a.break_code_rules={respect_break_code:"boolean"==typeof r?r:r.respect_break_code};break;case"is_default_enabled":a.is_default_enabled="boolean"==typeof r?r:!!r}return a})},[]),M=function(t){t(function(t){return e.__spreadArray(e.__spreadArray([],t,!0),[{id:Date.now(),text:"",reasoning:""}],!1)})},N=function(e,t){e(function(e){return e.filter(function(e){return e.id!==t})})},J=function(t,r,n){t(function(t){return t.map(function(t){return String(t.id)===String(r)?e.__assign(e.__assign({},t),{text:n}):t})})},D=[e.__assign({key:"order_rules",label:"Order"},A.order_rules),e.__assign({key:"advertiser_rules",label:"Advertiser"},A.advertiser_rules)],E=[{key:"inventory_rules",label:"Inventory code",enabled:A.inventory_rules.respect_inventory_code},{key:"break_code_rules",label:"Break Code",enabled:A.break_code_rules.respect_break_code},{key:"is_default_enabled",label:"Default Variant",enabled:A.is_default_enabled}];return t.jsx(i.default,{open:p,closeFunction:function(){return d(!1)},chatAssistantName:"defaultAssistant",organizationName:"techolution",baseUrl:"https://devllmstudio.creativeworkspace.ai",baseWebsocketUrl:"wss://devllmstudio.creativeworkspace.ai/graphql",ThinkingBulbIconComponent:t.jsx(n.Lightbulb,{}),customSections:t.jsx(t.Fragment,{}),isUseNormalChat:!0,chatTitle:"Create New Learning",formTitle:"Learning Details",initialChatMessage:"Hey! How can I assist you?",template:a.TemplateList.BaseTemplate,templateProps:{state:{title:f,description:b,scopeData:y,whenToApplyConditions:k,whenNotToApplyConditions:j,configData:A,citations:[],citation:{}},handlers:{onTitleChange:function(e){var t,r;return m(null!==(r=null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.value)&&void 0!==r?r:e)},onDescriptionChange:function(e){var t,r;return v(null!==(r=null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.value)&&void 0!==r?r:e)},onAddWhenToApply:function(){return M(L)},onRemoveWhenToApply:function(e){return N(L,e)},onEditWhenToApply:function(e,t){return J(L,e,t)},onAddWhenNotToApply:function(){return M(x)},onRemoveWhenNotToApply:function(e){return N(x,e)},onEditWhenNotToApply:function(e,t){return J(x,e,t)},onScopeChange:I,onConfigChange:O},uiState:{showScope:!1,showConfiguration:!0,titleLabel:"Main Rule Name",scopeLabel:"Define Scope",tierLabel:"Select Tier",descriptionLabel:"Learning Explanation",whenToApplyLabel:"Trigger Events (When to Apply)",whenNotToApplyLabel:"Exclusion Events (When NOT to Apply)",configLabel:"Advanced Settings",stationOptions:l,tierOptions:u,separationItems:D,toggles:E},customNodes:{afterDescription:t.jsx(o.default,e.__assign({title:{type:"other",label:"Extra Context Panel"}},{children:t.jsx("p",e.__assign({style:{padding:"12px",fontSize:"14px",color:"#64748b"}},{children:"Because you decoupled the template, I can inject anything I want here without touching BaseTemplate logic!"}))})),afterTitle:t.jsxs("div",e.__assign({style:{marginBottom:"12px",padding:"8px",backgroundColor:"#f0f4ff",borderRadius:"4px"}},{children:[t.jsx("strong",{children:"Tip:"})," Use a clear and descriptive title for your rule to make it easily identifiable later."]}))}}})};
2
2
  //# sourceMappingURL=DefaultTeachMeRenderer.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e,__awaiter as t,__generator as n}from"tslib";import{jsxs as r,jsx as a,Fragment as o}from"react/jsx-runtime";import{useState as s,useRef as i,useEffect as l}from"react";import{BookOpen as c}from"lucide-react";import{useLearningTemplateStore as u}from"./store/useLearningTemplateStore.js";import{Toast as d}from"primereact/toast";import p from"./styles/LearningTemplateManagement.module.css.js";import m from"./LearningTemplateLayout.js";import f from"./components/EmptyLearningState.js";import g from"./store/useAuthStore.js";import{fetchScopes as S,inheritScope as h,createRuleSet as y,renameScope as v,updateStation as b,deleteRuleSet as C}from"./apis/scopeApis.js";import L from"./components/ConfirmationModal.js";import O from"./components/LearningTemplateManagementSkeleton.js";import{findNodePathById as E}from"./utils/treeUtils.js";import A from"./components/CreateLearningSetModal.js";import T from"./store/useEnvStore.js";import{useConfigStore as N}from"./store/useConfigStore.js";var I=[{id:"learnings",label:"Learnings",icon:c,badgeKey:"learningsCount"}],w=[{type:"GLOBAL",label:"Global",addChildLabel:"Add Scope",addChildType:"SCOPE"},{type:"SCOPE",label:"Scope"}];function B(c){var B,D=this,G=c.userDetails,P=c.tiers,R=c.llmStudioUrl,_=c.audacyBackendUrl,j=c.ilLabels,U=c.config,k=c.app_integration_id,M=u(function(e){return e.selectedRuleSetId}),F=u(function(e){return e.setSelectedRuleSetId}),x=u(function(e){return e.error}),V=u(function(e){return e.setError}),H=u(function(e){return e.setStations}),K=u(function(e){return e.scopeTreeData}),W=u(function(e){return e.setScopeTreeData}),q=s({isOpen:!1,type:"GLOBAL"}),z=q[0],J=q[1],Q=s(!1),X=Q[0],Y=Q[1],Z=s(!1),$=Z[0],ee=Z[1],te=s("learnings"),ne=te[0],re=te[1],ae=s(null),oe=ae[0],se=ae[1],ie=i(null),le=i(null),ce=i(null),ue=g();ue.user;var de=ue.setUser,pe=N(),me=pe.setConfig,fe=pe.setIlLabels;l(function(){console.log("userDetails",G),de(G),console.log("tiers",P),u.getState().setTiers(P),console.log("llmStudioUrl",R),console.log("audacyBackendUrl",_),T.getState().setLlmStudioUrl(R),T.getState().setAudacyBackendUrl(_),me(U),fe(j)},[G,de,P,R,_,U,me,j,fe]);var ge=function(e){return void 0===e&&(e=!0),t(D,void 0,void 0,function(){var t,r,a;return n(this,function(n){switch(n.label){case 0:e&&Y(!0),V(null),n.label=1;case 1:return n.trys.push([1,3,4,5]),console.log("Fetching rule sets...",G.accessToken),[4,S(k,G.accessToken)];case 2:return(t=n.sent())&&t.data&&t.data.data&&(r=t.data.data,Array.isArray(r)&&(r=r.length>0?r[0]:null),r?(W({data:r}),le.current?(F(le.current),re("learnings"),le.current=null):u.getState().selectedRuleSetId||F(r.id)):W(null)),[3,5];case 3:return a=n.sent(),console.error("Failed to fetch rule sets",a),V("Failed to load rule sets. Please try again later."),[3,5];case 4:return Y(!1),[7];case 5:return[2]}})})};l(function(){ge(!0)},[V,H]);var Se=function(r,a,o){return t(D,void 0,void 0,function(){var t,s,i,l,c,d,p,m,f;return n(this,function(n){switch(n.label){case 0:ee(!0),n.label=1;case 1:return n.trys.push([1,8,9,10]),[4,C(r)];case 2:if(n.sent(),u.getState().selectedRuleSetId===r&&(t=u.getState().scopeTreeData,(s=E((null==t?void 0:t.data)||null,r))&&s.length>1&&(i=s[s.length-2],F(i),re("learnings"))),!o||!a)return[3,6];n.label=3;case 3:return n.trys.push([3,5,,6]),[4,b({station_name:a,ruleset_id:""})];case 4:return n.sent(),[3,6];case 5:return l=n.sent(),console.error("Error unlinking station on subscope delete:",l),[3,6];case 6:return[4,ge(!0)];case 7:return n.sent(),J(function(t){return e(e({},t),{isOpen:!1})}),null===(d=ce.current)||void 0===d||d.show({severity:"success",summary:"Deleted Successfully",detail:"The scope was permanently removed."}),[3,10];case 8:return c=n.sent(),console.error("An error occurred during scope deletion.",c),null===(p=ce.current)||void 0===p||p.show({severity:"error",summary:"Delete Failed",detail:(null===(f=null===(m=null==c?void 0:c.response)||void 0===m?void 0:m.data)||void 0===f?void 0:f.message)||"There was an error deleting the scope. Please try again."}),[3,10];case 9:return ee(!1),[7];case 10:return[2]}})})},he=K,ye=oe?{data:{id:oe.stationId,name:oe.stationName,type:"STATION",metrics:{learningsCount:oe.learningsCount,stationsCount:0},children:[]}}:he,ve=!!(null==ye?void 0:ye.data);null===(B=null==ye?void 0:ye.data)||void 0===B||B.type;var be=oe?I.filter(function(e){return"stations"!==e.id}):I;return r("div",e({className:p.learningManagementContainer},{children:[a("div",e({className:p.mainWrapper},{children:X?a(O,{}):x?r("div",e({className:p.errorContainer},{children:[a("div",e({className:p.errorTitle},{children:"Error Loading Data"})),a("p",e({className:p.errorDesc},{children:x})),a("button",e({onClick:function(){return ge(!0)},className:p.tryAgainBtn},{children:"Try Again"}))]})):ve?a(m,{onOpenCreateModal:function(){return J({isOpen:!0,type:"GLOBAL"})},onAddChild:function(e,t,n){return J({isOpen:!0,type:t,parentId:e,parentName:n})},onRenameChild:function(e,t){return J({isOpen:!0,type:"RENAME",scopeId:e,initialName:t})},onDeleteChild:function(e,r,a){return t(D,void 0,void 0,function(){var t,o,s;return n(this,function(n){switch(n.label){case 0:return t=u.getState().scopeTreeData,o=E((null==t?void 0:t.data)||null,e),s=!!o&&3===o.length,0!==a?[3,2]:[4,Se(e,r,s)];case 1:return n.sent(),[3,3];case 2:J({isOpen:!0,type:"DELETE",scopeId:e,initialName:r,isSubscope:s}),n.label=3;case 3:return[2]}})})},onSectionSelect:function(e,t){console.log("Section Selected:",{scopeId:e,sectionId:t}),re(t),F(e)},activeSectionId:ne,scopeTreeData:ye,sectionsConfig:be,onViewStation:function(e){ie.current=M,se(e),re("learnings"),F(e.stationId)},onRefreshRuleSets:function(e,t){void 0===e&&(e=!0),t&&(le.current=t),ge(e)},nodeTypesConfig:w,app_integration_id:k,token:G.accessToken}):a(f,{onCreate:function(){return J({isOpen:!0,type:"GLOBAL"})},title:"No Global Scope has been added!",desc:"Start by creating a Global scope to define base learnings that apply across all stations.",button:"Create Global Scope"})})),a(d,{ref:ce}),a(A,{isOpen:z.isOpen&&"DELETE"!==z.type,onClose:function(){return J(e(e({},z),{isOpen:!1}))},onSubmit:"RENAME"===z.type?function(r){return t(D,void 0,void 0,function(){var t,a,o,s;return n(this,function(n){switch(n.label){case 0:ee(!0),n.label=1;case 1:return n.trys.push([1,4,5,6]),z.scopeId?[4,v({scope_id:z.scopeId,scope_name:r})]:[2];case 2:return n.sent(),[4,ge(!0)];case 3:return n.sent(),J(function(t){return e(e({},t),{isOpen:!1})}),[3,6];case 4:throw t=n.sent(),console.error("An error occurred during scope rename.",t),null===(a=ce.current)||void 0===a||a.show({severity:"error",summary:"Rename Failed",detail:(null===(s=null===(o=null==t?void 0:t.response)||void 0===o?void 0:o.data)||void 0===s?void 0:s.message)||"There was an error renaming the scope. Please try again."}),t;case 5:return ee(!1),[7];case 6:return[2]}})})}:function(r){return t(D,void 0,void 0,function(){var t,a,o,s,i,l,c,u,d,p,m;return n(this,function(n){switch(n.label){case 0:ee(!0),n.label=1;case 1:return n.trys.push([1,8,9,10]),t="SCOPE"===z.type&&z.parentId,a=t?"genreRuleSet":z.type,o={topic:a,scope_reference_id:null,scopeDescription:"demo",parentScopeId:z.parentId||null,scopeName:r,scopeReferenceMetadata:{},applicationMappingId:k},[4,y(o,G.accessToken)];case 2:if(s=n.sent(),!(i=null===(u=null==s?void 0:s.data)||void 0===u?void 0:u.scopeId))return[3,6];if(le.current=i,"GLOBAL"===z.type||!z.parentId)return[3,6];n.label=3;case 3:return n.trys.push([3,5,,6]),[4,h({source_scope_id:z.parentId,target_scope_id:i})];case 4:return n.sent(),[3,6];case 5:return l=n.sent(),console.error("Failed to inherit rules for the new scope:",l),[3,6];case 6:return[4,ge(!0)];case 7:return n.sent(),J(function(t){return e(e({},t),{isOpen:!1})}),[3,10];case 8:throw c=n.sent(),console.error("An error occurred during scope creation.",c),null===(d=ce.current)||void 0===d||d.show({severity:"error",summary:"Creation Failed",detail:(null===(m=null===(p=null==c?void 0:c.response)||void 0===p?void 0:p.data)||void 0===m?void 0:m.message)||"There was an error creating the scope. Please try again."}),c;case 9:return ee(!1),[7];case 10:return[2]}})})},isLoading:$,title:"GLOBAL"===z.type?"Create Global Scope":"SCOPE"===z.type?"Add Scope":"SUBSCOPE"===z.type?"Add Subscope":"Rename Scope",description:"GLOBAL"===z.type?"Create the Global scope to define base learnings that apply across all stations.":"SCOPE"===z.type?"This scope will be created under ".concat(z.parentName||"Global"," and will inherit its Learnings by default."):"SUBSCOPE"===z.type?"This subscope will be created under ".concat(z.parentName||"Scope"," and will inherit ").concat(z.parentName||"Scope","'s Learnings and Stations by default."):"",inputLabel:"GLOBAL"===z.type||"SCOPE"===z.type?"Scope Name":"SUBSCOPE"===z.type?"Subscope Name":"Scope Name",submitLabel:"GLOBAL"===z.type?"Create Scope":"SCOPE"===z.type?"Add Scope":"SUBSCOPE"===z.type?"Add Subscope":"Save",placeholder:"GLOBAL"===z.type?"Enter the global scope name":"SCOPE"===z.type?"Enter the scope name":"SUBSCOPE"===z.type?"Enter the subscope name":"Enter the new name",initialValue:"RENAME"===z.type?z.initialName:""}),a(L,{isOpen:z.isOpen&&"DELETE"===z.type,onCancel:function(){return J(e(e({},z),{isOpen:!1}))},onConfirm:function(){return Se(z.scopeId,z.initialName,z.isSubscope)},title:"Delete Scope",description:r(o,{children:["Deleting ",a("span",e({className:p.highlight},{children:z.initialName||"this scope"}))," will permanently remove all Learnings, Access rules, and Change History inside it. This cannot be undone."]}),confirmText:"Delete",confirmBgColor:"#EF4444",isLoading:$})]}))}export{B as default};
1
+ import{__assign as e,__awaiter as t,__generator as n}from"tslib";import{jsxs as r,jsx as a,Fragment as o}from"react/jsx-runtime";import{useState as s,useRef as i,useEffect as l}from"react";import{BookOpen as c}from"lucide-react";import{useLearningTemplateStore as u}from"./store/useLearningTemplateStore.js";import{Toast as d}from"primereact/toast";import p from"./styles/LearningTemplateManagement.module.css.js";import m from"./LearningTemplateLayout.js";import f from"./components/EmptyLearningState.js";import g from"./store/useAuthStore.js";import{fetchScopes as S,inheritScope as h,createRuleSet as y,renameScope as v,updateStation as b,deleteRuleSet as C}from"./apis/scopeApis.js";import L from"./components/ConfirmationModal.js";import O from"./components/LearningTemplateManagementSkeleton.js";import{findNodePathById as E}from"./utils/treeUtils.js";import T from"./components/CreateLearningSetModal.js";import A from"./store/useEnvStore.js";import{useConfigStore as N}from"./store/useConfigStore.js";var I=[{id:"learnings",label:"Learnings",icon:c,badgeKey:"learningsCount"}],w=[{type:"GLOBAL",label:"Global",addChildLabel:"Add Scope",addChildType:"SCOPE"},{type:"SCOPE",label:"Scope"}];function B(c){var B,D=this,G=c.userDetails,P=c.tiers,R=c.llmStudioUrl,_=c.audacyBackendUrl,j=c.ilLabels,U=c.config,k=c.app_integration_id,M=u(function(e){return e.selectedRuleSetId}),F=u(function(e){return e.setSelectedRuleSetId}),x=u(function(e){return e.error}),V=u(function(e){return e.setError}),H=u(function(e){return e.setStations}),K=u(function(e){return e.scopeTreeData}),W=u(function(e){return e.setScopeTreeData}),q=s({isOpen:!1,type:"GLOBAL"}),z=q[0],J=q[1],Q=s(!1),X=Q[0],Y=Q[1],Z=s(!1),$=Z[0],ee=Z[1],te=s("learnings"),ne=te[0],re=te[1],ae=s(null),oe=ae[0],se=ae[1],ie=i(null),le=i(null),ce=i(null),ue=g();ue.user;var de=ue.setUser,pe=N(),me=pe.setConfig,fe=pe.setIlLabels;l(function(){console.log("userDetails",G),de(G),console.log("tiers",P),u.getState().setTiers(P),console.log("llmStudioUrl",R),console.log("audacyBackendUrl",_),A.getState().setLlmStudioUrl(R),A.getState().setAudacyBackendUrl(_),me(U),fe(j)},[G,de,P,R,_,U,me,j,fe]);var ge=function(e){return void 0===e&&(e=!0),t(D,void 0,void 0,function(){var t,r,a;return n(this,function(n){switch(n.label){case 0:e&&Y(!0),V(null),n.label=1;case 1:return n.trys.push([1,3,4,5]),console.log("Fetching rule sets...",G.accessToken),[4,S(k,G.accessToken)];case 2:return(t=n.sent())&&t.data&&t.data.data&&(r=t.data.data,Array.isArray(r)&&(r=r.length>0?r[0]:null),r?(W({data:r}),le.current?(F(le.current),re("learnings"),le.current=null):u.getState().selectedRuleSetId||F(r.id)):W(null)),[3,5];case 3:return a=n.sent(),console.error("Failed to fetch rule sets",a),V("Failed to load rule sets. Please try again later."),[3,5];case 4:return Y(!1),[7];case 5:return[2]}})})};l(function(){ge(!0)},[V,H]);var Se=function(r,a,o){return t(D,void 0,void 0,function(){var t,s,i,l,c,d,p,m,f;return n(this,function(n){switch(n.label){case 0:ee(!0),n.label=1;case 1:return n.trys.push([1,8,9,10]),[4,C(r,G.accessToken)];case 2:if(n.sent(),u.getState().selectedRuleSetId===r&&(t=u.getState().scopeTreeData,(s=E((null==t?void 0:t.data)||null,r))&&s.length>1&&(i=s[s.length-2],F(i),re("learnings"))),!o||!a)return[3,6];n.label=3;case 3:return n.trys.push([3,5,,6]),[4,b({station_name:a,ruleset_id:""})];case 4:return n.sent(),[3,6];case 5:return l=n.sent(),console.error("Error unlinking station on subscope delete:",l),[3,6];case 6:return[4,ge(!0)];case 7:return n.sent(),J(function(t){return e(e({},t),{isOpen:!1})}),null===(d=ce.current)||void 0===d||d.show({severity:"success",summary:"Deleted Successfully",detail:"The scope was permanently removed."}),[3,10];case 8:return c=n.sent(),console.error("An error occurred during scope deletion.",c),null===(p=ce.current)||void 0===p||p.show({severity:"error",summary:"Delete Failed",detail:(null===(f=null===(m=null==c?void 0:c.response)||void 0===m?void 0:m.data)||void 0===f?void 0:f.message)||"There was an error deleting the scope. Please try again."}),[3,10];case 9:return ee(!1),[7];case 10:return[2]}})})},he=K,ye=oe?{data:{id:oe.stationId,name:oe.stationName,type:"STATION",metrics:{learningsCount:oe.learningsCount,stationsCount:0},children:[]}}:he,ve=!!(null==ye?void 0:ye.data);null===(B=null==ye?void 0:ye.data)||void 0===B||B.type;var be=oe?I.filter(function(e){return"stations"!==e.id}):I;return r("div",e({className:p.learningManagementContainer},{children:[a("div",e({className:p.mainWrapper},{children:X?a(O,{}):x?r("div",e({className:p.errorContainer},{children:[a("div",e({className:p.errorTitle},{children:"Error Loading Data"})),a("p",e({className:p.errorDesc},{children:x})),a("button",e({onClick:function(){return ge(!0)},className:p.tryAgainBtn},{children:"Try Again"}))]})):ve?a(m,{onOpenCreateModal:function(){return J({isOpen:!0,type:"GLOBAL"})},onAddChild:function(e,t,n){return J({isOpen:!0,type:t,parentId:e,parentName:n})},onRenameChild:function(e,t){return J({isOpen:!0,type:"RENAME",scopeId:e,initialName:t})},onDeleteChild:function(e,r,a){return t(D,void 0,void 0,function(){var t,o,s;return n(this,function(n){switch(n.label){case 0:return t=u.getState().scopeTreeData,o=E((null==t?void 0:t.data)||null,e),s=!!o&&3===o.length,0!==a?[3,2]:[4,Se(e,r,s)];case 1:return n.sent(),[3,3];case 2:J({isOpen:!0,type:"DELETE",scopeId:e,initialName:r,isSubscope:s}),n.label=3;case 3:return[2]}})})},onSectionSelect:function(e,t){console.log("Section Selected:",{scopeId:e,sectionId:t}),re(t),F(e)},activeSectionId:ne,scopeTreeData:ye,sectionsConfig:be,onViewStation:function(e){ie.current=M,se(e),re("learnings"),F(e.stationId)},onRefreshRuleSets:function(e,t){void 0===e&&(e=!0),t&&(le.current=t),ge(e)},nodeTypesConfig:w,app_integration_id:k,token:G.accessToken}):a(f,{onCreate:function(){return J({isOpen:!0,type:"GLOBAL"})},title:"No Global Scope has been added!",desc:"Start by creating a Global scope to define base learnings that apply across all stations.",button:"Create Global Scope"})})),a(d,{ref:ce}),a(T,{isOpen:z.isOpen&&"DELETE"!==z.type,onClose:function(){return J(e(e({},z),{isOpen:!1}))},onSubmit:"RENAME"===z.type?function(r){return t(D,void 0,void 0,function(){var t,a,o,s;return n(this,function(n){switch(n.label){case 0:ee(!0),n.label=1;case 1:return n.trys.push([1,4,5,6]),z.scopeId?[4,v({scope_id:z.scopeId,scope_name:r})]:[2];case 2:return n.sent(),[4,ge(!0)];case 3:return n.sent(),J(function(t){return e(e({},t),{isOpen:!1})}),[3,6];case 4:throw t=n.sent(),console.error("An error occurred during scope rename.",t),null===(a=ce.current)||void 0===a||a.show({severity:"error",summary:"Rename Failed",detail:(null===(s=null===(o=null==t?void 0:t.response)||void 0===o?void 0:o.data)||void 0===s?void 0:s.message)||"There was an error renaming the scope. Please try again."}),t;case 5:return ee(!1),[7];case 6:return[2]}})})}:function(r){return t(D,void 0,void 0,function(){var t,a,o,s,i,l,c,u,d,p,m;return n(this,function(n){switch(n.label){case 0:ee(!0),n.label=1;case 1:return n.trys.push([1,8,9,10]),t="SCOPE"===z.type&&z.parentId,a=t?"genreRuleSet":z.type,o={topic:a,scope_reference_id:null,scopeDescription:"demo",parentScopeId:z.parentId||null,scopeName:r,scopeReferenceMetadata:{},applicationMappingId:k},[4,y(o,G.accessToken)];case 2:if(s=n.sent(),!(i=null===(u=null==s?void 0:s.data)||void 0===u?void 0:u.scopeId))return[3,6];if(le.current=i,"GLOBAL"===z.type||!z.parentId)return[3,6];n.label=3;case 3:return n.trys.push([3,5,,6]),[4,h({source_scope_id:z.parentId,target_scope_id:i})];case 4:return n.sent(),[3,6];case 5:return l=n.sent(),console.error("Failed to inherit rules for the new scope:",l),[3,6];case 6:return[4,ge(!0)];case 7:return n.sent(),J(function(t){return e(e({},t),{isOpen:!1})}),[3,10];case 8:throw c=n.sent(),console.error("An error occurred during scope creation.",c),null===(d=ce.current)||void 0===d||d.show({severity:"error",summary:"Creation Failed",detail:(null===(m=null===(p=null==c?void 0:c.response)||void 0===p?void 0:p.data)||void 0===m?void 0:m.message)||"There was an error creating the scope. Please try again."}),c;case 9:return ee(!1),[7];case 10:return[2]}})})},isLoading:$,title:"GLOBAL"===z.type?"Create Global Scope":"SCOPE"===z.type?"Add Scope":"SUBSCOPE"===z.type?"Add Subscope":"Rename Scope",description:"GLOBAL"===z.type?"Create the Global scope to define base learnings that apply across all stations.":"SCOPE"===z.type?"This scope will be created under ".concat(z.parentName||"Global"," and will inherit its Learnings by default."):"SUBSCOPE"===z.type?"This subscope will be created under ".concat(z.parentName||"Scope"," and will inherit ").concat(z.parentName||"Scope","'s Learnings and Stations by default."):"",inputLabel:"GLOBAL"===z.type||"SCOPE"===z.type?"Scope Name":"SUBSCOPE"===z.type?"Subscope Name":"Scope Name",submitLabel:"GLOBAL"===z.type?"Create Scope":"SCOPE"===z.type?"Add Scope":"SUBSCOPE"===z.type?"Add Subscope":"Save",placeholder:"GLOBAL"===z.type?"Enter the global scope name":"SCOPE"===z.type?"Enter the scope name":"SUBSCOPE"===z.type?"Enter the subscope name":"Enter the new name",initialValue:"RENAME"===z.type?z.initialName:""}),a(L,{isOpen:z.isOpen&&"DELETE"===z.type,onCancel:function(){return J(e(e({},z),{isOpen:!1}))},onConfirm:function(){return Se(z.scopeId,z.initialName,z.isSubscope)},title:"Delete Scope",description:r(o,{children:["Deleting ",a("span",e({className:p.highlight},{children:z.initialName||"this scope"}))," will permanently remove all Learnings, Access rules, and Change History inside it. This cannot be undone."]}),confirmText:"Delete",confirmBgColor:"#EF4444",isLoading:$})]}))}export{B as default};
2
2
  //# sourceMappingURL=LearningManagement.js.map
@@ -1,2 +1,2 @@
1
- var e={publishFeedback:"/instant_learning/save",submitChatFeedback:"/instant_learning/feedback/teachme_otj",saveInstantLearningQuestion:"/instant_learning/getLearningQuestionId",fetchScopes:"/instant_learning/ilotj/scope",renameScope:"/instant_learning/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/scope/{ruleSetId}/delete",deleteRule:"/instant_learning/learning/{ruleId}/delete",deleteQuestion:"/instant_learning/question/{questionId}",deleteTier:"instant_learning/scopes/{scopeId}/tiers/{tierId}",updateVariant:"/instant_learning/v2/update/rule",inheritScope:"/instant_learning/learnings/rules/inherit-scope",updateStation:"/backend/traffic-manager/station/update",exportRuleSet:"/instant_learning/export-ruleset",toggleVariant:"/instant_learning/toggle_variant",alterRulePriority:"/instant_learning/v2/alterPriority",fetchRulesByQuestionId:"/instant_learning/learnings/rules/fetch_by_rule_id/{questionId}/{scopeId}?include_config=True",retrieveGenreScopes:"/instant_learning/learnings/retrieve_genre_scopes",searchScopes:"/instant_learning/learnings/search_scopes",sessionValidation:"/instant_learning/session-validation"};export{e as API_ENDPOINTS};
1
+ var e={publishFeedback:"/instant_learning/save",submitChatFeedback:"/instant_learning/feedback/teachme_otj",saveInstantLearningQuestion:"/instant_learning/getLearningQuestionId",fetchScopes:"/instant_learning/ilotj/scope",renameScope:"/instant_learning/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}",deleteRule:"/instant_learning/learning/{ruleId}/delete",deleteQuestion:"/instant_learning/question/{questionId}",deleteTier:"instant_learning/scopes/{scopeId}/tiers/{tierId}",updateVariant:"/instant_learning/v2/update/rule",inheritScope:"/instant_learning/learnings/rules/inherit-scope",updateStation:"/backend/traffic-manager/station/update",exportRuleSet:"/instant_learning/export-ruleset",toggleVariant:"/instant_learning/toggle_variant",alterRulePriority:"/instant_learning/v2/alterPriority",fetchRulesByQuestionId:"/instant_learning/learnings/rules/fetch_by_rule_id/{questionId}/{scopeId}?include_config=True",retrieveGenreScopes:"/instant_learning/learnings/retrieve_genre_scopes",searchScopes:"/instant_learning/learnings/search_scopes",sessionValidation:"/instant_learning/session-validation"};export{e as API_ENDPOINTS};
2
2
  //# sourceMappingURL=apiConfig.js.map
@@ -1,2 +1,2 @@
1
- import{__awaiter as e,__generator as t}from"tslib";import r from"axios";import{API_ENDPOINTS as n}from"./apiConfig.js";import o from"../store/useAuthStore.js";import s from"../store/useEnvStore.js";var i=function(e){return e.interceptors.request.use(function(e){var t=o.getState().user,r=null==t?void 0:t.accessToken;return r&&(e.headers.Authorization="Bearer ".concat(r)),e}),e},a=function(e,t){return e.interceptors.request.use(function(e){return e.baseURL=t(),e}),e},c=a(i(r.create({headers:{"Content-Type":"application/json"}})),function(){return s.getState().audacyBackendUrl||""}),u=a(i(r.create({headers:{"Content-Type":"application/json"}})),function(){return s.getState().llmStudioUrl||""}),d=function(e){return a(i(r.create({headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(e)},withCredentials:!0})),function(){return s.getState().llmStudioUrl||""})},l=function(r,o){return e(void 0,void 0,void 0,function(){var e,s;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e="".concat(n.publishFeedback,"?name=").concat(o,"&organizationName=techolution"),[4,u.post(e,r)];case 1:return[2,t.sent().data];case 2:throw s=t.sent(),console.error("Error publishing feedback to LLM Studio:",s),s;case 3:return[2]}})})},h=function(r){return e(void 0,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,u.post(n.submitChatFeedback,r)];case 1:return[2,t.sent().data];case 2:throw e=t.sent(),console.error("Error submitting chat feedback:",e),e;case 3:return[2]}})})},v=function(r){return e(void 0,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,u.post(n.saveInstantLearningQuestion,r)];case 1:return[2,t.sent().data];case 2:throw e=t.sent(),console.error("Error saving instant learning question:",e),e;case 3:return[2]}})})},f=function(r,o){return e(void 0,void 0,void 0,function(){var e,s;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e="".concat(n.fetchScopes,"/").concat(r),[4,d(o).get(e)];case 1:return[2,t.sent().data];case 2:throw s=t.sent(),console.error("Error fetching rule sets:",s),s;case 3:return[2]}})})},p=function(r){return e(void 0,void 0,void 0,function(){var e,o;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e="".concat(n.renameScope),[4,u.put(e,r)];case 1:return[2,t.sent().data];case 2:throw o=t.sent(),console.error("Error renaming scope:",o),o;case 3:return[2]}})})},g=function(r,o){return e(void 0,void 0,void 0,function(){var e,s;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e="".concat(n.getRulesInRuleSetById,"/").concat(r),[4,d(o).get(e)];case 1:return[2,t.sent().data];case 2:return s=t.sent(),console.error("Error fetching rules in rule set:",s),[3,3];case 3:return[2]}})})},w=function(r){return e(void 0,void 0,void 0,function(){var e,o;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e="".concat(n.getRuleOverrideHistory,"/").concat(r),[4,u.get(e)];case 1:return[2,t.sent().data];case 2:throw o=t.sent(),console.error("Error getting rule override history:",o),o;case 3:return[2]}})})},y=function(r,o){return e(void 0,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,d(o).post(n.createRuleSet,r)];case 1:return[2,t.sent().data];case 2:throw e=t.sent(),console.error("Error creating rule set:",e),e;case 3:return[2]}})})},b=function(r,o){return void 0===o&&(o=!1),e(void 0,void 0,void 0,function(){var e,s;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e="".concat(n.fetchStationsByKeyword.replace("{keyword}",r),"?allow_existing=").concat(o),[4,c.get(e)];case 1:return[2,t.sent().data];case 2:throw s=t.sent(),console.error("Error fetching station name by keyword:",s),s;case 3:return[2]}})})},m=function(r){return e(void 0,void 0,void 0,function(){var e,o;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e=n.deleteRuleSet.replace("{ruleSetId}",r),[4,u.delete(e)];case 1:return[2,t.sent().data];case 2:throw o=t.sent(),console.error("Error deleting rule set:",o),o;case 3:return[2]}})})},S=function(r){return e(void 0,void 0,void 0,function(){var e,o;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e=n.deleteRule.replace("{ruleId}",r),[4,u.delete(e)];case 1:return[2,t.sent().data];case 2:throw o=t.sent(),console.error("Error deleting rule:",o),o;case 3:return[2]}})})},E=function(r){return e(void 0,void 0,void 0,function(){var e,o;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e=n.deleteQuestion.replace("{questionId}",r),[4,u.delete(e)];case 1:return[2,t.sent().data];case 2:throw o=t.sent(),console.error("Error deleting question:",o),o;case 3:return[2]}})})},I=function(r,o){return e(void 0,void 0,void 0,function(){var e,s;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e=n.deleteTier.replace("{scopeId}",r).replace("{tierId}",o),[4,u.delete(e)];case 1:return[2,t.sent().data];case 2:throw s=t.sent(),console.error("Error deleting tier:",s),s;case 3:return[2]}})})},R=function(r,o){return e(void 0,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,u.put(n.updateVariant,r)];case 1:return[2,t.sent().data];case 2:throw e=t.sent(),console.error("Error updating variant:",e),e;case 3:return[2]}})})},k=function(r){return e(void 0,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,u.post(n.inheritScope,r)];case 1:return[2,t.sent().data];case 2:throw e=t.sent(),console.error("Error inheriting scope:",e),e;case 3:return[2]}})})},q=function(r){return e(void 0,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,c.post(n.updateStation,r)];case 1:return[2,t.sent().data];case 2:throw e=t.sent(),console.error("Error updating station:",e),e;case 3:return[2]}})})},C=function(r){return e(void 0,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:if(!r)throw new Error("scopeId is required for exporting rule sets");t.label=1;case 1:return t.trys.push([1,3,,4]),[4,u.post(n.exportRuleSet,{scope_id:r},{responseType:"blob"})];case 2:return[2,t.sent().data];case 3:throw e=t.sent(),console.error("Error exporting rule set:",e),e;case 4:return[2]}})})},x=function(r,o,s){return e(void 0,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,u.patch(n.toggleVariant,{variant_ids:r,is_enabled:o})];case 1:return[2,t.sent().data];case 2:throw e=t.sent(),console.error("Error toggling variant status:",e),e;case 3:return[2]}})})},z=function(r,o,s,i,a){return e(void 0,void 0,void 0,function(){var e,c;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e={scopeId:r,tierId:o,move:{movedRuleId:s,prevRuleId:i,nextRuleId:a}},[4,u.put(n.alterRulePriority,e)];case 1:return[2,t.sent().data];case 2:throw c=t.sent(),console.error("Error altering question priority:",c),c;case 3:return[2]}})})},L=function(r,o){return e(void 0,void 0,void 0,function(){var e,s;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e=n.fetchRulesByQuestionId.replace("{questionId}",r).replace("{scopeId}",o),[4,u.get(e)];case 1:return[2,t.sent().data];case 2:throw s=t.sent(),console.error("Error fetching rules by question id:",s),s;case 3:return[2]}})})},T=function(r){return void 0===r&&(r={limit:"50",offset:"0"}),e(void 0,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,u.post(n.retrieveGenreScopes,r)];case 1:return[2,t.sent().data];case 2:throw e=t.sent(),console.error("Error retrieving genre scopes:",e),e;case 3:return[2]}})})},j=function(r){return e(void 0,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,u.post(n.searchScopes,r)];case 1:return[2,t.sent().data];case 2:throw e=t.sent(),console.error("Error searching scopes:",e),e;case 3:return[2]}})})},B=function(r){return e(void 0,void 0,void 0,function(){return t(this,function(e){return[2,new Promise(function(e){setTimeout(function(){e({data:[{stationId:"reetrtdfsds",stationName:"Hot 98.7",stationDesc:"Learnings that apply for Hot 98.7 Station",learningsCount:5},{stationId:"sta-102",stationName:"Smooth Jazz 102.1",stationDesc:"Learnings that apply for Smooth Jazz 102.1 Station",learningsCount:12},{stationId:"sta-103",stationName:"Rock 94",stationDesc:"Learnings that apply for Rock 94 Station",learningsCount:8}]})},500)})]})})},_=function(r){return e(void 0,void 0,void 0,function(){var e,o,s,i;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,u.post(n.sessionValidation,r)];case 1:return e=t.sent(),[2,null!==(i=null===(s=e.data)||void 0===s?void 0:s.is_valid)&&void 0!==i&&i];case 2:return o=t.sent(),console.error("Error validating session:",o),[2,!1];case 3:return[2]}})})};export{z as alterQuestionPriority,c as audacyApi,y as createRuleSet,u as default,E as deleteQuestion,S as deleteRule,m as deleteRuleSet,I as deleteTier,C as exportRuleSet,L as fetchRulesByQuestionId,f as fetchScopes,b as fetchStationsByKeyword,w as getRuleOverrideHistory,g as getRulesInRuleSetById,B as getStationsByScopeId,k as inheritScope,d as llmApiWithToken,l as publishFeedback,p as renameScope,T as retrieveGenreScopes,v as saveInstantLearningQuestion,j as searchScopes,h as submitChatFeedback,x as toggleVariant,q as updateStation,R as updateVariant,_ as validateSession};
1
+ import{__awaiter as e,__generator as t}from"tslib";import r from"axios";import{API_ENDPOINTS as n}from"./apiConfig.js";import o from"../store/useAuthStore.js";import s from"../store/useEnvStore.js";var i=function(e){return e.interceptors.request.use(function(e){var t=o.getState().user,r=null==t?void 0:t.accessToken;return r&&(e.headers.Authorization="Bearer ".concat(r)),e}),e},a=function(e,t){return e.interceptors.request.use(function(e){return e.baseURL=t(),e}),e},c=a(i(r.create({headers:{"Content-Type":"application/json"}})),function(){return s.getState().audacyBackendUrl||""}),u=a(i(r.create({headers:{"Content-Type":"application/json"}})),function(){return s.getState().llmStudioUrl||""}),d=function(e){return a(i(r.create({headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(e)},withCredentials:!0})),function(){return s.getState().llmStudioUrl||""})},l=function(r,o){return e(void 0,void 0,void 0,function(){var e,s;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e="".concat(n.publishFeedback,"?name=").concat(o,"&organizationName=techolution"),[4,u.post(e,r)];case 1:return[2,t.sent().data];case 2:throw s=t.sent(),console.error("Error publishing feedback to LLM Studio:",s),s;case 3:return[2]}})})},h=function(r){return e(void 0,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,u.post(n.submitChatFeedback,r)];case 1:return[2,t.sent().data];case 2:throw e=t.sent(),console.error("Error submitting chat feedback:",e),e;case 3:return[2]}})})},v=function(r){return e(void 0,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,u.post(n.saveInstantLearningQuestion,r)];case 1:return[2,t.sent().data];case 2:throw e=t.sent(),console.error("Error saving instant learning question:",e),e;case 3:return[2]}})})},f=function(r,o){return e(void 0,void 0,void 0,function(){var e,s;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e="".concat(n.fetchScopes,"/").concat(r),[4,d(o).get(e)];case 1:return[2,t.sent().data];case 2:throw s=t.sent(),console.error("Error fetching rule sets:",s),s;case 3:return[2]}})})},p=function(r){return e(void 0,void 0,void 0,function(){var e,o;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e="".concat(n.renameScope),[4,u.put(e,r)];case 1:return[2,t.sent().data];case 2:throw o=t.sent(),console.error("Error renaming scope:",o),o;case 3:return[2]}})})},g=function(r,o){return e(void 0,void 0,void 0,function(){var e,s;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e="".concat(n.getRulesInRuleSetById,"/").concat(r),[4,d(o).get(e)];case 1:return[2,t.sent().data];case 2:return s=t.sent(),console.error("Error fetching rules in rule set:",s),[3,3];case 3:return[2]}})})},w=function(r){return e(void 0,void 0,void 0,function(){var e,o;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e="".concat(n.getRuleOverrideHistory,"/").concat(r),[4,u.get(e)];case 1:return[2,t.sent().data];case 2:throw o=t.sent(),console.error("Error getting rule override history:",o),o;case 3:return[2]}})})},y=function(r,o){return e(void 0,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,d(o).post(n.createRuleSet,r)];case 1:return[2,t.sent().data];case 2:throw e=t.sent(),console.error("Error creating rule set:",e),e;case 3:return[2]}})})},b=function(r,o){return void 0===o&&(o=!1),e(void 0,void 0,void 0,function(){var e,s;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e="".concat(n.fetchStationsByKeyword.replace("{keyword}",r),"?allow_existing=").concat(o),[4,c.get(e)];case 1:return[2,t.sent().data];case 2:throw s=t.sent(),console.error("Error fetching station name by keyword:",s),s;case 3:return[2]}})})},m=function(r,o){return e(void 0,void 0,void 0,function(){var e,s;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e=n.deleteRuleSet.replace("{ruleSetId}",r),[4,d(o).delete(e)];case 1:return[2,t.sent().data];case 2:throw s=t.sent(),console.error("Error deleting rule set:",s),s;case 3:return[2]}})})},S=function(r){return e(void 0,void 0,void 0,function(){var e,o;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e=n.deleteRule.replace("{ruleId}",r),[4,u.delete(e)];case 1:return[2,t.sent().data];case 2:throw o=t.sent(),console.error("Error deleting rule:",o),o;case 3:return[2]}})})},E=function(r){return e(void 0,void 0,void 0,function(){var e,o;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e=n.deleteQuestion.replace("{questionId}",r),[4,u.delete(e)];case 1:return[2,t.sent().data];case 2:throw o=t.sent(),console.error("Error deleting question:",o),o;case 3:return[2]}})})},I=function(r,o){return e(void 0,void 0,void 0,function(){var e,s;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e=n.deleteTier.replace("{scopeId}",r).replace("{tierId}",o),[4,u.delete(e)];case 1:return[2,t.sent().data];case 2:throw s=t.sent(),console.error("Error deleting tier:",s),s;case 3:return[2]}})})},R=function(r,o){return e(void 0,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,u.put(n.updateVariant,r)];case 1:return[2,t.sent().data];case 2:throw e=t.sent(),console.error("Error updating variant:",e),e;case 3:return[2]}})})},k=function(r){return e(void 0,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,u.post(n.inheritScope,r)];case 1:return[2,t.sent().data];case 2:throw e=t.sent(),console.error("Error inheriting scope:",e),e;case 3:return[2]}})})},q=function(r){return e(void 0,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,c.post(n.updateStation,r)];case 1:return[2,t.sent().data];case 2:throw e=t.sent(),console.error("Error updating station:",e),e;case 3:return[2]}})})},C=function(r){return e(void 0,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:if(!r)throw new Error("scopeId is required for exporting rule sets");t.label=1;case 1:return t.trys.push([1,3,,4]),[4,u.post(n.exportRuleSet,{scope_id:r},{responseType:"blob"})];case 2:return[2,t.sent().data];case 3:throw e=t.sent(),console.error("Error exporting rule set:",e),e;case 4:return[2]}})})},x=function(r,o,s){return e(void 0,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,u.patch(n.toggleVariant,{variant_ids:r,is_enabled:o})];case 1:return[2,t.sent().data];case 2:throw e=t.sent(),console.error("Error toggling variant status:",e),e;case 3:return[2]}})})},z=function(r,o,s,i,a){return e(void 0,void 0,void 0,function(){var e,c;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e={scopeId:r,tierId:o,move:{movedRuleId:s,prevRuleId:i,nextRuleId:a}},[4,u.put(n.alterRulePriority,e)];case 1:return[2,t.sent().data];case 2:throw c=t.sent(),console.error("Error altering question priority:",c),c;case 3:return[2]}})})},L=function(r,o){return e(void 0,void 0,void 0,function(){var e,s;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e=n.fetchRulesByQuestionId.replace("{questionId}",r).replace("{scopeId}",o),[4,u.get(e)];case 1:return[2,t.sent().data];case 2:throw s=t.sent(),console.error("Error fetching rules by question id:",s),s;case 3:return[2]}})})},T=function(r){return void 0===r&&(r={limit:"50",offset:"0"}),e(void 0,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,u.post(n.retrieveGenreScopes,r)];case 1:return[2,t.sent().data];case 2:throw e=t.sent(),console.error("Error retrieving genre scopes:",e),e;case 3:return[2]}})})},j=function(r){return e(void 0,void 0,void 0,function(){var e;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,u.post(n.searchScopes,r)];case 1:return[2,t.sent().data];case 2:throw e=t.sent(),console.error("Error searching scopes:",e),e;case 3:return[2]}})})},B=function(r){return e(void 0,void 0,void 0,function(){return t(this,function(e){return[2,new Promise(function(e){setTimeout(function(){e({data:[{stationId:"reetrtdfsds",stationName:"Hot 98.7",stationDesc:"Learnings that apply for Hot 98.7 Station",learningsCount:5},{stationId:"sta-102",stationName:"Smooth Jazz 102.1",stationDesc:"Learnings that apply for Smooth Jazz 102.1 Station",learningsCount:12},{stationId:"sta-103",stationName:"Rock 94",stationDesc:"Learnings that apply for Rock 94 Station",learningsCount:8}]})},500)})]})})};export{z as alterQuestionPriority,c as audacyApi,y as createRuleSet,u as default,E as deleteQuestion,S as deleteRule,m as deleteRuleSet,I as deleteTier,C as exportRuleSet,L as fetchRulesByQuestionId,f as fetchScopes,b as fetchStationsByKeyword,w as getRuleOverrideHistory,g as getRulesInRuleSetById,B as getStationsByScopeId,k as inheritScope,d as llmApiWithToken,l as publishFeedback,p as renameScope,T as retrieveGenreScopes,v as saveInstantLearningQuestion,j as searchScopes,h as submitChatFeedback,x as toggleVariant,q as updateStation,R as updateVariant};
2
2
  //# sourceMappingURL=scopeApis.js.map