@e-llm-studio/instant-learning 1.3.0-alpha.41 → 1.3.0-alpha.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/features/LearningManagement/LearningManagement.js +1 -1
- package/dist/cjs/features/LearningManagement/assets/Search-result(add new).svg.js +2 -0
- package/dist/cjs/features/LearningManagement/assets/Search-result(add new).svg.js.map +1 -0
- package/dist/cjs/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.js +2 -0
- package/dist/cjs/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.js.map +1 -0
- package/dist/features/LearningManagement/LearningManagement.js +1 -1
- package/dist/features/LearningManagement/assets/Search-result(add new).svg.js +2 -0
- package/dist/features/LearningManagement/assets/Search-result(add new).svg.js.map +1 -0
- package/dist/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.js +2 -0
- package/dist/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.js.map +1 -0
- package/dist/types/src/features/LearningManagement/LearningManagement.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.d.ts +12 -0
- package/dist/types/src/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.d.ts.map +1 -0
- package/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"),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"),c=require("./store/useAuthStore.js"),u=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(w){var M,q,O,N=this,x=w.userDetails,k=w.llmStudioUrl,U=w.audacyBackendUrl,B=w.ilLabels,H=w.config,G=w.rbacConfig,Y=w.auditLogConfig,F=w.app_integration_id,Q=w.backwardCompatibility,W=void 0!==Q&&Q,K=w.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],ce=oe[1],ue=n.useState("learnings"),de=ue[0],pe=ue[1],ge=n.useState(null),fe=ge[0],_e=ge[1],Se=n.useState(null),me=Se[0],ve=Se[1],Te=n.useRef(null),he=n.useRef(null),ye=n.useRef(!1),Ee=n.useRef(null),Ae=c.default();Ae.user;var be=Ae.setUser,Le=S.useConfigStore(),Ce=Le.setConfig,Re=Le.setIlLabels,De=function(){try{return C.useLocation()}catch(e){return{search:""}}}();n.useEffect(function(){if(!ye.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&&Ve.has(n)?n:"learnings";(null==t?void 0:t.length)&&V&&pe&&(V(t),pe(r),ye.current=!0)}},[null==De?void 0:De.search,pe,V]);var je=T.usePermissionsStore(function(e){return e.fetchPermissions}),Ie=T.usePermissionsStore(function(e){return e.hasPermission}),Pe=h.useAppSecRolesStore(function(e){return e.setRoles}),we=_.default(function(e){return e.appsecRbacUrl})===G.appsecRbacUrl,Me=y.useGetAppSecRolesQuery(G.applicationId,we).data,qe=E.useLMSConfigQuery(null!=F?F:"",W),Oe=qe.isLoading,Ne=qe.isError,xe=qe.refetch;qe.isSuccess;var ke=n.useState(0),Ue=ke[0],Be=ke[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,u.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&&Be(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(){Me&&Pe(Me.map(function(e){return{_id:e._id,name:e.name}}))},[Me,Pe]),n.useEffect(function(){var e;console.log("userDetails",x),be(x),console.log("llmStudioUrl",k),console.log("audacyBackendUrl",U),_.default.getState().setLlmStudioUrl(k),_.default.getState().setAudacyBackendUrl(U),_.default.getState().setRbacConfig(G),_.default.getState().setAuditLogConfig(Y),Ce(H),Re(B),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,be,k,U,G,Y,H,Ce,B,Re,F,W]),n.useEffect(function(){(null==x?void 0:x.accessToken)&&k&&u.fetchTiers()},[F,null==x?void 0:x.accessToken,k]);var He=function(t){return void 0===t&&(t=!0),e.__awaiter(N,void 0,void 0,function(){var n,r,a,i,o,l;return e.__generator(this,function(c){switch(c.label){case 0:t&&ie(!0),J(null),c.label=1;case 1:return c.trys.push([1,4,5,6]),[4,je(G.applicationId)];case 2:return c.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,u.fetchScopes(F,x.accessToken)];case 3:return(r=c.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}),he.current?(V(he.current),pe("learnings"),he.current=null):s.useLearningTemplateStore.getState().selectedRuleSetId||V(i.id)):(_e(null!==(l=a.id)&&void 0!==l?l:null),ee(null)):(_e(null),ee(null))),[3,6];case 4:return o=c.sent(),console.error("Failed to fetch rule sets or permissions",o),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)&&we?He(!0):console.warn("Error: Trying to fetch rules without access token",x)},[null==x?void 0:x.accessToken,J,Z,G.applicationId,we]);var Ge=function(t,n,r){return e.__awaiter(N,void 0,void 0,function(){var n,r,a,i,o,l,c,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,u.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,He(!0)];case 3:return p.sent(),re(function(t){return e.__assign(e.__assign({},t),{isOpen:!1})}),null===(o=Ee.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=Ee.current)||void 0===l||l.show({severity:"error",summary:"Delete Failed",detail:(null===(d=null===(c=null==i?void 0:i.response)||void 0===c?void 0:c.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]}})})},Ye=$,Fe=me?{data:{id:me.stationId,name:me.stationName,type:"STATION",metrics:{learningsCount:me.learningsCount,stationsCount:0},children:[]}}:Ye,Qe=!!(null==Fe?void 0:Fe.data);null===(M=null==Fe?void 0:Fe.data)||void 0===M||M.type;var We=T.usePermissionsStore(function(e){return e.hasGlobalPermission})("ilotj.scope.global.create",G.applicationResourceId||"");if(Oe)return t.jsx("div",e.__assign({className:i.default.learningManagementContainer},{children:t.jsx(b.default,{})}));if(Ne)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 xe()},title:"Error Loading Configuration"})}));var Ke=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:Ue},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),ze=[{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}],Ve=new Set(ze.map(function(e){return e.id})),Xe=me?ze.filter(function(e){return"stations"!==e.id}):ze;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 He(!0)},className:i.default.tryAgainBtn},{children:"Try Again"}))]})):Qe?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,Ge(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 Ie("ilotj.scope.delete",e)},canEditScope:function(e){return Ie("ilotj.scope.edit",e)},canCreateScope:function(e){return Ie("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:Fe,sectionsConfig:Xe,onViewStation:function(e){Te.current=z,ve(e),pe("learnings"),V(e.stationId)},onRefreshRuleSets:function(e,t){void 0===e&&(e=!0),t&&(he.current=t),He(e)},nodeTypesConfig:Ke,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:We,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"),onRequestAccess:function(){return e.__awaiter(N,void 0,void 0,function(){var n,r,a,o,l,c,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=Ee.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];e.label=1;case 1:return e.trys.push([1,3,,4]),[4,u.requestAccess(n)];case 2:return e.sent(),null===(c=Ee.current)||void 0===c||c.show({severity:"success",sticky:!1,life:3e3,className:i.default.successToast,content:t.jsx(R.default,{message:"Access request submitted successfully!"})}),[3,4];case 3:return r=e.sent(),null===(d=Ee.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,4];case 4:return[2]}})})}})})),t.jsx(a.Toast,{ref:Ee,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,c,d,p,g,f,_,S,m,v,T,h,y,E,A;return e.__generator(this,function(b){switch(b.label){case 0:ce(!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,u.createRuleSet(r,x.accessToken)];case 2:if(l=b.sent(),!(c=null===(m=null==l?void 0:l.data)||void 0===m?void 0:m.scopeId))return[3,10];if(he.current=c,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,u.inheritScopeBackwardCompatible({source_scope_id:g,target_scope_id:c})];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,u.inheritScope({source_scope_id:g,target_scope_id:c,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,He(!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=Ee.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:Qe,canCreateGlobal:We,globalScopeId:null!==(O=null===(q=null==$?void 0:$.data)||void 0===q?void 0:q.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&&(he.current=e),He(!0)},hasGlobalRuleSet:Qe,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,c,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]),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,u.renameScope(a,x.accessToken)]):[2];case 2:return p.sent(),[4,He(!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=Ee.current)||void 0===l||l.show({severity:"error",sticky:!1,className:i.default.errorToast,content:t.jsx(D.default,{message:(null===(d=null===(c=null==o?void 0:o.response)||void 0===c?void 0:c.data)||void 0===d?void 0:d.message)||"There was an error renaming the scope. Please try again."})}),o;case 5:return ce(!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 Ge(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"),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(w){var M,q,O,N=this,x=w.userDetails,k=w.llmStudioUrl,U=w.audacyBackendUrl,B=w.ilLabels,H=w.config,G=w.rbacConfig,Y=w.auditLogConfig,F=w.app_integration_id,Q=w.backwardCompatibility,W=void 0!==Q&&Q,K=w.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.useRef(null),he=n.useRef(null),ye=n.useRef(!1),Ee=n.useRef(null),Ae=u.default();Ae.user;var be=Ae.setUser,Le=S.useConfigStore(),Ce=Le.setConfig,Re=Le.setIlLabels,De=function(){try{return C.useLocation()}catch(e){return{search:""}}}();n.useEffect(function(){if(!ye.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&&Ve.has(n)?n:"learnings";(null==t?void 0:t.length)&&V&&pe&&(V(t),pe(r),ye.current=!0)}},[null==De?void 0:De.search,pe,V]);var je=T.usePermissionsStore(function(e){return e.fetchPermissions}),Ie=T.usePermissionsStore(function(e){return e.hasPermission}),Pe=h.useAppSecRolesStore(function(e){return e.setRoles}),we=_.default(function(e){return e.appsecRbacUrl})===G.appsecRbacUrl,Me=y.useGetAppSecRolesQuery(G.applicationId,we).data,qe=E.useLMSConfigQuery(null!=F?F:"",W),Oe=qe.isLoading,Ne=qe.isError,xe=qe.refetch;qe.isSuccess;var ke=n.useState(0),Ue=ke[0],Be=ke[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&&Be(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(){Me&&Pe(Me.map(function(e){return{_id:e._id,name:e.name}}))},[Me,Pe]),n.useEffect(function(){var e;console.log("userDetails",x),be(x),console.log("llmStudioUrl",k),console.log("audacyBackendUrl",U),_.default.getState().setLlmStudioUrl(k),_.default.getState().setAudacyBackendUrl(U),_.default.getState().setRbacConfig(G),_.default.getState().setAuditLogConfig(Y),Ce(H),Re(B),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,be,k,U,G,Y,H,Ce,B,Re,F,W]),n.useEffect(function(){(null==x?void 0:x.accessToken)&&k&&c.fetchTiers()},[F,null==x?void 0:x.accessToken,k]);var He=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,je(G.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}),he.current?(V(he.current),pe("learnings"),he.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)&&we?He(!0):console.warn("Error: Trying to fetch rules without access token",x)},[null==x?void 0:x.accessToken,J,Z,G.applicationId,we]);var Ge=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,He(!0)];case 3:return p.sent(),re(function(t){return e.__assign(e.__assign({},t),{isOpen:!1})}),null===(o=Ee.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=Ee.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]}})})},Ye=$,Fe=me?{data:{id:me.stationId,name:me.stationName,type:"STATION",metrics:{learningsCount:me.learningsCount,stationsCount:0},children:[]}}:Ye,Qe=!!(null==Fe?void 0:Fe.data);null===(M=null==Fe?void 0:Fe.data)||void 0===M||M.type;var We=T.usePermissionsStore(function(e){return e.hasGlobalPermission})("ilotj.scope.global.create",G.applicationResourceId||"");if(Oe)return t.jsx("div",e.__assign({className:i.default.learningManagementContainer},{children:t.jsx(b.default,{})}));if(Ne)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 xe()},title:"Error Loading Configuration"})}));var Ke=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:Ue},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),ze=[{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}],Ve=new Set(ze.map(function(e){return e.id})),Xe=me?ze.filter(function(e){return"stations"!==e.id}):ze;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 He(!0)},className:i.default.tryAgainBtn},{children:"Try Again"}))]})):Qe?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,Ge(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 Ie("ilotj.scope.delete",e)},canEditScope:function(e){return Ie("ilotj.scope.edit",e)},canCreateScope:function(e){return Ie("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:Fe,sectionsConfig:Xe,onViewStation:function(e){Te.current=z,ve(e),pe("learnings"),V(e.stationId)},onRefreshRuleSets:function(e,t){void 0===e&&(e=!0),t&&(he.current=t),He(e)},nodeTypesConfig:Ke,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:We,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"),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=Ee.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];e.label=1;case 1:return e.trys.push([1,3,,4]),[4,c.requestAccess(n)];case 2:return e.sent(),null===(u=Ee.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,4];case 3:return r=e.sent(),null===(d=Ee.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,4];case 4:return[2]}})})}})})),t.jsx(a.Toast,{ref:Ee,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(he.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,He(!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=Ee.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:Qe,canCreateGlobal:We,globalScopeId:null!==(O=null===(q=null==$?void 0:$.data)||void 0===q?void 0:q.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&&(he.current=e),He(!0)},hasGlobalRuleSet:Qe,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,He(!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=Ee.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 Ge(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})]}))})};
|
|
2
2
|
//# sourceMappingURL=LearningManagement.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":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e,__spreadArray as n,__awaiter as t,__generator as r}from"tslib";import{jsx as o,jsxs as s,Fragment as i}from"react/jsx-runtime";import{useState as a,useRef as c,useEffect as l}from"react";import{BookOpen as u,Users as d,History as p}from"lucide-react";import{useLearningTemplateStore as m}from"./store/useLearningTemplateStore.js";import{Toast as f}from"primereact/toast";import v from"./styles/LearningTemplateManagement.module.css.js";import g from"./LearningTemplateLayout.js";import h from"./components/EmptyLearningState.js";import y from"./store/useAuthStore.js";import{fetchTiers as S,getILInstance as b,fetchScopes as C,inheritScope as T,inheritScopeBackwardCompatible as L,createRuleSet as A,renameScope as E,deleteRuleSet as I,requestAccess as w}from"./apis/scopeApis.js";import{QUERY_PARAM_KEYS as O,setQueryParams as R}from"./hooks/useLearningTemplateQueryParams.js";import j from"./components/ConfirmationModal.js";import _ from"./components/LearningTemplateManagementSkeleton.js";import{findNodePathById as N}from"./utils/treeUtils.js";import k from"./store/useEnvStore.js";import{useConfigStore as D}from"./store/useConfigStore.js";import{TooltipProvider as M}from"./components/ToolTip.js";import P from"./components/CreateRuleSetLegacyModal.js";import{usePermissionsStore as U}from"./store/usePermissionsStore.js";import{useAppSecRolesStore as B}from"./store/useAppSecRolesStore.js";import{useGetAppSecRolesQuery as G}from"./queries/useApprovalQueries.js";import{useLMSConfigQuery as F}from"./queries/useLMSConfigQuery.js";import q from"./RuleContent/AddScopeModal.js";import x from"./components/RuleContentSkeleton.js";import H from"./components/ErrorStateDisplay.js";import{useLocation as Q}from"react-router-dom";import z from"./shared/SuccessToastContent.js";import K from"./shared/ErrorToastContent.js";import V from"./RuleContent/RenameScopeModal.js";import{dt as W}from"./store/useLMSConfigStore.js";import{MIDDLE_DRAWER_DT_PATH as Y,MIDDLE_DRAWER_CONTEXT_MENU_DT_PATH as J,EMPTY_STATE_DT_PATH as X}from"./constants.js";function Z(Z){var $,ee,ne,te=this,re=Z.userDetails,oe=Z.llmStudioUrl,se=Z.audacyBackendUrl,ie=Z.ilLabels,ae=Z.config,ce=Z.rbacConfig,le=Z.auditLogConfig,ue=Z.app_integration_id,de=Z.backwardCompatibility,pe=void 0!==de&&de,me=Z.modeId,fe=m(function(e){return e.selectedRuleSetId}),ve=m(function(e){return e.setSelectedRuleSetId}),ge=m(function(e){return e.error}),he=m(function(e){return e.setError}),ye=m(function(e){return e.setStations}),Se=m(function(e){return e.scopeTreeData}),be=m(function(e){return e.setScopeTreeData}),Ce=a({isOpen:!1,type:"GLOBAL"}),Te=Ce[0],Le=Ce[1],Ae=a(!1),Ee=Ae[0],Ie=Ae[1],we=a(!1),Oe=we[0],Re=we[1],je=a("learnings"),_e=je[0],Ne=je[1],ke=a(null),De=ke[0],Me=ke[1],Pe=a(null),Ue=Pe[0],Be=Pe[1],Ge=c(null),Fe=c(null),qe=c(!1),xe=c(null),He=y();He.user;var Qe=He.setUser,ze=D(),Ke=ze.setConfig,Ve=ze.setIlLabels,We=function(){try{return Q()}catch(e){return{search:""}}}();l(function(){if(!qe.current){var e=new URLSearchParams(window.location.search),n=e.get(O.RULESET_ID),t=e.get(O.SECTION),r=t&&gn.has(t)?t:"learnings";(null==n?void 0:n.length)&&ve&&Ne&&(ve(n),Ne(r),qe.current=!0)}},[null==We?void 0:We.search,Ne,ve]);var Ye=U(function(e){return e.fetchPermissions}),Je=U(function(e){return e.hasPermission}),Xe=B(function(e){return e.setRoles}),Ze=k(function(e){return e.appsecRbacUrl})===ce.appsecRbacUrl,$e=G(ce.applicationId,Ze).data,en=F(null!=ue?ue:"",pe),nn=en.isLoading,tn=en.isError,rn=en.refetch;en.isSuccess;var on=a(0),sn=on[0],an=on[1];l(function(){if(!pe&&ue&&oe){t(te,void 0,void 0,function(){var e,n,t,o,s,i;return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,b(ue)];case 1:return e=r.sent(),"number"==typeof(n=null===(i=null===(s=null===(o=null==e?void 0:e.data)||void 0===o?void 0:o.learningManagement)||void 0===s?void 0:s.scopeAndHierarchy)||void 0===i?void 0:i.maxHierarchyLevels)&&n>0&&an(n-1),[3,3];case 2:return t=r.sent(),console.error("Failed to fetch IL instance for hierarchy levels:",t),[3,3];case 3:return[2]}})})}},[ue,oe]),l(function(){$e&&Xe($e.map(function(e){return{_id:e._id,name:e.name}}))},[$e,Xe]),l(function(){var e;console.log("userDetails",re),Qe(re),console.log("llmStudioUrl",oe),console.log("audacyBackendUrl",se),k.getState().setLlmStudioUrl(oe),k.getState().setAudacyBackendUrl(se),k.getState().setRbacConfig(ce),k.getState().setAuditLogConfig(le),Ke(ae),Ve(ie),m.getState().setAppIntegrationId(null!=ue?ue:null),m.getState().setBackwardCompatibility(pe),m.getState().setToken(null!==(e=null==re?void 0:re.accessToken)&&void 0!==e?e:null)},[re,Qe,oe,se,ce,le,ae,Ke,ie,Ve,ue,pe]),l(function(){(null==re?void 0:re.accessToken)&&oe&&S()},[ue,null==re?void 0:re.accessToken,oe]);var cn=function(n){return void 0===n&&(n=!0),t(te,void 0,void 0,function(){var t,o,s,i,a,c;return r(this,function(r){switch(r.label){case 0:n&&Ie(!0),he(null),r.label=1;case 1:return r.trys.push([1,4,5,6]),[4,Ye(ce.applicationId)];case 2:return r.sent(),t=function(n){if(!U.getState().hasPermission("ilotj.scope.view",n.id))return null;var r=n.children?n.children.map(function(e){return t(e)}).filter(function(e){return null!==e}):[];return e(e({},n),{children:r})},[4,C(ue,re.accessToken)];case 3:return(o=r.sent())&&o.data&&o.data.data&&(s=o.data.data,Array.isArray(s)&&(s=s.length>0?s[0]:null),s?(i=t(s))?(Me(null),be({data:i}),Fe.current?(ve(Fe.current),Ne("learnings"),Fe.current=null):m.getState().selectedRuleSetId||ve(i.id)):(Me(null!==(c=s.id)&&void 0!==c?c:null),be(null)):(Me(null),be(null))),[3,6];case 4:return a=r.sent(),console.error("Failed to fetch rule sets or permissions",a),he("Failed to load data. Please try again later."),[3,6];case 5:return Ie(!1),[7];case 6:return[2]}})})};l(function(){var e;(null===(e=null==re?void 0:re.accessToken)||void 0===e?void 0:e.length)&&Ze?cn(!0):console.warn("Error: Trying to fetch rules without access token",re)},[null==re?void 0:re.accessToken,he,ye,ce.applicationId,Ze]);var ln=function(n,o,s){return t(te,void 0,void 0,function(){var t,o,s,i,a,c,l,u;return r(this,function(r){switch(r.label){case 0:Re(!0),r.label=1;case 1:return r.trys.push([1,4,5,6]),[4,I(n,re.accessToken)];case 2:return r.sent(),m.getState().selectedRuleSetId===n&&(t=m.getState().scopeTreeData,(o=N((null==t?void 0:t.data)||null,n))&&o.length>1&&(s=o[o.length-2],ve(s),Ne("learnings"))),[4,cn(!0)];case 3:return r.sent(),Le(function(n){return e(e({},n),{isOpen:!1})}),null===(a=xe.current)||void 0===a||a.show({severity:"success",summary:"Deleted Successfully",detail:"The scope was permanently removed."}),[3,6];case 4:return i=r.sent(),console.error("An error occurred during scope deletion.",i),null===(c=xe.current)||void 0===c||c.show({severity:"error",summary:"Delete Failed",detail:(null===(u=null===(l=null==i?void 0:i.response)||void 0===l?void 0:l.data)||void 0===u?void 0:u.message)||"There was an error deleting the scope. Please try again."}),[3,6];case 5:return Re(!1),[7];case 6:return[2]}})})},un=Se,dn=Ue?{data:{id:Ue.stationId,name:Ue.stationName,type:"STATION",metrics:{learningsCount:Ue.learningsCount,stationsCount:0},children:[]}}:un,pn=!!(null==dn?void 0:dn.data);null===($=null==dn?void 0:dn.data)||void 0===$||$.type;var mn=U(function(e){return e.hasGlobalPermission})("ilotj.scope.global.create",ce.applicationResourceId||"");if(nn)return o("div",e({className:v.learningManagementContainer},{children:o(x,{})}));if(tn)return o("div",e({className:v.learningManagementContainer},{children:o(H,{errorMessage:"Failed to load configuration. Please try again.",onRetry:function(){return rn()},title:"Error Loading Configuration"})}));var fn=n(n([{type:"GLOBAL",label:"Global",addChildLabel:"".concat(W("".concat(Y,".addScope"),"Add Scope")),addChildType:"SCOPE"}],Array.from({length:sn},function(){return e({type:"SCOPE",label:W("".concat(Y,".scope"),"Scope")},!pe&&{addChildLabel:W("".concat(J,".addSubScope"),"Add Subscope"),addChildType:"SUBSCOPE"})}),!0),pe?[]:[{type:"SUBSCOPE",label:W("".concat(Y,".subScope"),"Subscope")}],!0),vn=[{id:"learnings",label:W("".concat(Y,".treeMenu.submenu.learnings"),"Learnings"),icon:u,badgeKey:"learningsCount"},{id:"access",label:W("".concat(Y,".treeMenu.submenu.access"),"Access"),icon:d},{id:"history",label:W("".concat(Y,".treeMenu.submenu.changeHistory"),"Change History"),icon:p}],gn=new Set(vn.map(function(e){return e.id})),hn=Ue?vn.filter(function(e){return"stations"!==e.id}):vn;return o(M,{children:s("div",e({className:v.learningManagementContainer},{children:[o("div",e({className:v.mainWrapper},{children:Ee?o(_,{}):ge?s("div",e({className:v.errorContainer},{children:[o("div",e({className:v.errorTitle},{children:"Error Loading Data"})),o("p",e({className:v.errorDesc},{children:ge})),o("button",e({onClick:function(){return cn(!0)},className:v.tryAgainBtn},{children:"Try Again"}))]})):pn?o(g,{onOpenCreateModal:function(){return Le({isOpen:!0,type:"GLOBAL"})},onAddChild:function(e,n,t){return Le({isOpen:!0,type:n,parentId:e,parentName:t})},onRenameChild:function(e,n){return Le({isOpen:!0,type:"RENAME",scopeId:e,initialName:n})},onDeleteChild:function(e,n,o){return t(te,void 0,void 0,function(){var t,s,i;return r(this,function(r){switch(r.label){case 0:return t=m.getState().scopeTreeData,s=N((null==t?void 0:t.data)||null,e),i=!!s&&3===s.length,0!==o?[3,2]:[4,ln(e)];case 1:return r.sent(),[3,3];case 2:Le({isOpen:!0,type:"DELETE",scopeId:e,initialName:n,isSubscope:i}),r.label=3;case 3:return[2]}})})},canDeleteScope:function(e){return Je("ilotj.scope.delete",e)},canEditScope:function(e){return Je("ilotj.scope.edit",e)},canCreateScope:function(e){return Je("ilotj.scope.create",e)},onSectionSelect:function(e,n){var t;console.log("Section Selected:",{scopeId:e,sectionId:n}),R(((t={})[O.SECTION]="learnings"===n?null:n,t[O.RULESET_ID]=e,t)),Ne(n),ve(e)},activeSectionId:_e,scopeTreeData:dn,sectionsConfig:hn,onViewStation:function(e){Ge.current=fe,Be(e),Ne("learnings"),ve(e.stationId)},onRefreshRuleSets:function(e,n){void 0===e&&(e=!0),n&&(Fe.current=n),cn(e)},nodeTypesConfig:fn,app_integration_id:ue,token:re.accessToken,modeId:me}):o(h,{onCreate:function(){return Le({isOpen:!0,type:"GLOBAL"})},title:W("".concat(X,".title"),"No Global Scope has been added!"),desc:W("".concat(X,".desc"),"Start by creating a Global scope to define base learnings that apply across all stations."),button:W("".concat(X,".createGlobalScope"),"Create Global Scope"),canCreateRule:mn,noAccessTitle:W("".concat(X,".noAccessTitle"),"Access Restricted"),noAccessDesc:W("".concat(X,".noAccessDesc"),"You do not have access for this application."),requestAccessButton:W("".concat(X,".requestAccessButton"),"Request Access"),onRequestAccess:function(){return t(te,void 0,void 0,function(){var e,n,t,s,i,a,c,l,u;return r(this,function(r){switch(r.label){case 0:if(!(e=(null===(s=null===(t=m.getState().scopeTreeData)||void 0===t?void 0:t.data)||void 0===s?void 0:s.id)||De))return null===(i=xe.current)||void 0===i||i.show({severity:"error",sticky:!1,className:v.errorToast,content:o(K,{message:"Unable to identify the global scope for this access request."})}),[2];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,w(e)];case 2:return r.sent(),null===(a=xe.current)||void 0===a||a.show({severity:"success",sticky:!1,life:3e3,className:v.successToast,content:o(z,{message:"Access request submitted successfully!"})}),[3,4];case 3:return n=r.sent(),null===(c=xe.current)||void 0===c||c.show({severity:"error",sticky:!1,className:v.errorToast,content:o(K,{message:(null===(u=null===(l=null==n?void 0:n.response)||void 0===l?void 0:l.data)||void 0===u?void 0:u.detail)||"Failed to request access. Please try again."})}),[3,4];case 4:return[2]}})})}})})),o(f,{ref:xe,pt:{root:{style:{zIndex:9999}}}}),pe&&Te.isOpen&&"DELETE"!==Te.type&&"RENAME"!==Te.type?o(P,{isOpen:!0,onClose:function(){return Le(e(e({},Te),{isOpen:!1}))},onSubmit:function(n){return t(te,void 0,void 0,function(){var t,o,s,i,a,c,l,u,d,p,f,v,g,h,y,S,b,C,E,I;return r(this,function(r){switch(r.label){case 0:Re(!0),t=m.getState().backwardCompatibility,r.label=1;case 1:return r.trys.push([1,12,13,14]),o=void 0,t&&"object"==typeof n?o=n:(s=n,i="SCOPE"===Te.type&&Te.parentId,a=i?"genreRuleSet":Te.type,o={topic:a,scope_reference_id:null,scopeDescription:"demo",parentScopeId:Te.parentId||null,scopeName:s,scopeReferenceMetadata:{},applicationMappingId:ue}),[4,A(o,re.accessToken)];case 2:if(c=r.sent(),!(l=null===(h=null==c?void 0:c.data)||void 0===h?void 0:h.scopeId))return[3,10];if(Fe.current=l,u=t&&(null===(y=o.topic)||void 0===y?void 0:y.toLowerCase().includes("genre")),d=!t&&"GLOBAL"!==Te.type&&Te.parentId,!u&&!d)return[3,10];if(!(p=t?null===(b=null===(S=m.getState().scopeTreeData)||void 0===S?void 0:S.data)||void 0===b?void 0:b.id:Te.parentId))return[3,10];if(!pe)return[3,7];r.label=3;case 3:return r.trys.push([3,5,,6]),[4,L({source_scope_id:p,target_scope_id:l})];case 4:return r.sent(),[3,6];case 5:return f=r.sent(),console.error("Failed to inherit rules for the new scope:",f),[3,6];case 6:return[3,10];case 7:return r.trys.push([7,9,,10]),[4,T({source_scope_id:p,target_scope_id:l,application_mapping_id:ue||"",is_copy_parent_variant_id:!1})];case 8:return r.sent(),[3,10];case 9:return v=r.sent(),console.error("Failed to inherit rules for the new scope:",v),[3,10];case 10:return[4,cn(!0)];case 11:return r.sent(),Le(function(n){return e(e({},n),{isOpen:!1})}),[3,14];case 12:throw g=r.sent(),console.error("An error occurred during scope creation.",g),null===(C=xe.current)||void 0===C||C.show({severity:"error",summary:"Creation Failed",detail:(null===(I=null===(E=null==g?void 0:g.response)||void 0===E?void 0:E.data)||void 0===I?void 0:I.message)||"There was an error creating the scope. Please try again."}),g;case 13:return Re(!1),[7];case 14:return[2]}})})},hasGlobalRuleSet:pn,canCreateGlobal:mn,globalScopeId:null!==(ne=null===(ee=null==Se?void 0:Se.data)||void 0===ee?void 0:ee.id)&&void 0!==ne?ne:null}):s(i,{children:[o(q,{isOpen:Te.isOpen&&"DELETE"!==Te.type&&"RENAME"!==Te.type,onClose:function(){return Le(e(e({},Te),{isOpen:!1}))},onCreate:function(e){e&&(Fe.current=e),cn(!0)},hasGlobalRuleSet:pn,parentId:Te.parentId}),o(V,{isOpen:Te.isOpen&&"RENAME"===Te.type,onClose:function(){return Le(e(e({},Te),{isOpen:!1}))},onSave:function(n){return t(te,void 0,void 0,function(){var t,s,i,a,c,l;return r(this,function(r){switch(r.label){case 0:Re(!0),r.label=1;case 1:return r.trys.push([1,4,5,6]),Te.scopeId?(t=m.getState().backwardCompatibility,s=t?{scope_id:Te.scopeId,scope_name:n}:{scope_id:Te.scopeId,scope_type:"Custom",scope_name:n,description:"demo",application_mapping_id:ue},[4,E(s,re.accessToken)]):[2];case 2:return r.sent(),[4,cn(!0)];case 3:return r.sent(),Le(function(n){return e(e({},n),{isOpen:!1})}),[3,6];case 4:throw i=r.sent(),console.error("An error occurred during scope rename.",i),null===(a=xe.current)||void 0===a||a.show({severity:"error",sticky:!1,className:v.errorToast,content:o(K,{message:(null===(l=null===(c=null==i?void 0:i.response)||void 0===c?void 0:c.data)||void 0===l?void 0:l.message)||"There was an error renaming the scope. Please try again."})}),i;case 5:return Re(!1),[7];case 6:return[2]}})})},initialName:Te.initialName})]}),o(j,{isOpen:Te.isOpen&&"DELETE"===Te.type,onCancel:function(){return Le(e(e({},Te),{isOpen:!1}))},onConfirm:function(){return ln(Te.scopeId,Te.initialName,Te.isSubscope)},title:"Delete Scope",description:s(i,{children:["Deleting ",o("span",e({className:v.highlight},{children:Te.initialName||"this scope"}))," will permanently remove all Learnings, Access rules, and Change History inside it. This cannot be undone."]}),confirmText:"Delete",confirmBgColor:"#EF4444",isLoading:Oe})]}))})}export{Z as default};
|
|
1
|
+
import{__assign as e,__spreadArray as n,__awaiter as t,__generator as r}from"tslib";import{jsx as o,jsxs as s,Fragment as i}from"react/jsx-runtime";import{useState as a,useRef as c,useEffect as l}from"react";import{BookOpen as u,Users as d,History as p}from"lucide-react";import{useLearningTemplateStore as m}from"./store/useLearningTemplateStore.js";import{Toast as f}from"primereact/toast";import v from"./styles/LearningTemplateManagement.module.css.js";import g from"./LearningTemplateLayout.js";import h from"./components/EmptyLearningState.js";import y from"./store/useAuthStore.js";import{fetchTiers as S,getILInstance as b,fetchScopes as C,inheritScope as T,inheritScopeBackwardCompatible as L,createRuleSet as A,renameScope as E,deleteRuleSet as I,requestAccess as w}from"./apis/scopeApis.js";import{QUERY_PARAM_KEYS as O,setQueryParams as R}from"./hooks/useLearningTemplateQueryParams.js";import j from"./components/ConfirmationModal.js";import _ from"./components/LearningTemplateManagementSkeleton.js";import{findNodeById as N,findNodePathById as k}from"./utils/treeUtils.js";import D from"./store/useEnvStore.js";import{useConfigStore as M}from"./store/useConfigStore.js";import{TooltipProvider as P}from"./components/ToolTip.js";import U from"./components/CreateRuleSetLegacyModal.js";import{usePermissionsStore as B}from"./store/usePermissionsStore.js";import{useAppSecRolesStore as G}from"./store/useAppSecRolesStore.js";import{useGetAppSecRolesQuery as F}from"./queries/useApprovalQueries.js";import{useLMSConfigQuery as q}from"./queries/useLMSConfigQuery.js";import x from"./RuleContent/AddScopeModal.js";import H from"./components/RuleContentSkeleton.js";import Q from"./components/ErrorStateDisplay.js";import{useLocation as z}from"react-router-dom";import K from"./shared/SuccessToastContent.js";import V from"./shared/ErrorToastContent.js";import W from"./RuleContent/RenameScopeModal.js";import{dt as Y}from"./store/useLMSConfigStore.js";import{MIDDLE_DRAWER_DT_PATH as J,MIDDLE_DRAWER_CONTEXT_MENU_DT_PATH as X,EMPTY_STATE_DT_PATH as Z}from"./constants.js";function $($){var ee,ne,te,re=this,oe=$.userDetails,se=$.llmStudioUrl,ie=$.audacyBackendUrl,ae=$.ilLabels,ce=$.config,le=$.rbacConfig,ue=$.auditLogConfig,de=$.app_integration_id,pe=$.backwardCompatibility,me=void 0!==pe&&pe,fe=$.modeId,ve=m(function(e){return e.selectedRuleSetId}),ge=m(function(e){return e.setSelectedRuleSetId}),he=m(function(e){return e.error}),ye=m(function(e){return e.setError}),Se=m(function(e){return e.setStations}),be=m(function(e){return e.scopeTreeData}),Ce=m(function(e){return e.setScopeTreeData}),Te=a({isOpen:!1,type:"GLOBAL"}),Le=Te[0],Ae=Te[1],Ee=a(!1),Ie=Ee[0],we=Ee[1],Oe=a(!1),Re=Oe[0],je=Oe[1],_e=a("learnings"),Ne=_e[0],ke=_e[1],De=a(null),Me=De[0],Pe=De[1],Ue=a(null),Be=Ue[0],Ge=Ue[1],Fe=c(null),qe=c(null),xe=c(!1),He=c(null),Qe=y();Qe.user;var ze=Qe.setUser,Ke=M(),Ve=Ke.setConfig,We=Ke.setIlLabels,Ye=function(){try{return z()}catch(e){return{search:""}}}();l(function(){if(!xe.current){var e=new URLSearchParams(window.location.search),n=e.get(O.RULESET_ID),t=e.get(O.SECTION),r=t&&hn.has(t)?t:"learnings";(null==n?void 0:n.length)&&ge&&ke&&(ge(n),ke(r),xe.current=!0)}},[null==Ye?void 0:Ye.search,ke,ge]);var Je=B(function(e){return e.fetchPermissions}),Xe=B(function(e){return e.hasPermission}),Ze=G(function(e){return e.setRoles}),$e=D(function(e){return e.appsecRbacUrl})===le.appsecRbacUrl,en=F(le.applicationId,$e).data,nn=q(null!=de?de:"",me),tn=nn.isLoading,rn=nn.isError,on=nn.refetch;nn.isSuccess;var sn=a(0),an=sn[0],cn=sn[1];l(function(){if(!me&&de&&se){t(re,void 0,void 0,function(){var e,n,t,o,s,i;return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,b(de)];case 1:return e=r.sent(),"number"==typeof(n=null===(i=null===(s=null===(o=null==e?void 0:e.data)||void 0===o?void 0:o.learningManagement)||void 0===s?void 0:s.scopeAndHierarchy)||void 0===i?void 0:i.maxHierarchyLevels)&&n>0&&cn(n-1),[3,3];case 2:return t=r.sent(),console.error("Failed to fetch IL instance for hierarchy levels:",t),[3,3];case 3:return[2]}})})}},[de,se]),l(function(){en&&Ze(en.map(function(e){return{_id:e._id,name:e.name}}))},[en,Ze]),l(function(){var e;console.log("userDetails",oe),ze(oe),console.log("llmStudioUrl",se),console.log("audacyBackendUrl",ie),D.getState().setLlmStudioUrl(se),D.getState().setAudacyBackendUrl(ie),D.getState().setRbacConfig(le),D.getState().setAuditLogConfig(ue),Ve(ce),We(ae),m.getState().setAppIntegrationId(null!=de?de:null),m.getState().setBackwardCompatibility(me),m.getState().setToken(null!==(e=null==oe?void 0:oe.accessToken)&&void 0!==e?e:null)},[oe,ze,se,ie,le,ue,ce,Ve,ae,We,de,me]),l(function(){(null==oe?void 0:oe.accessToken)&&se&&S()},[de,null==oe?void 0:oe.accessToken,se]);var ln=function(n){return void 0===n&&(n=!0),t(re,void 0,void 0,function(){var t,o,s,i,a,c,l,u;return r(this,function(r){switch(r.label){case 0:n&&we(!0),ye(null),r.label=1;case 1:return r.trys.push([1,4,5,6]),[4,Je(le.applicationId)];case 2:return r.sent(),t=function(n){if(!B.getState().hasPermission("ilotj.scope.view",n.id))return null;var r=n.children?n.children.map(function(e){return t(e)}).filter(function(e){return null!==e}):[];return e(e({},n),{children:r})},[4,C(de,oe.accessToken)];case 3:return(o=r.sent())&&o.data&&o.data.data&&(s=o.data.data,Array.isArray(s)&&(s=s.length>0?s[0]:null),s?(i=t(s))?(Pe(null),Ce({data:i}),qe.current?(ge(qe.current),ke("learnings"),qe.current=null):(a=m.getState().selectedRuleSetId,c=a?N(i,a):null,a&&c||ge(i.id))):(Pe(null!==(u=s.id)&&void 0!==u?u:null),Ce(null)):(Pe(null),Ce(null))),[3,6];case 4:return l=r.sent(),console.error("Failed to fetch rule sets or permissions",l),ye("Failed to load data. Please try again later."),[3,6];case 5:return we(!1),[7];case 6:return[2]}})})};l(function(){var e;(null===(e=null==oe?void 0:oe.accessToken)||void 0===e?void 0:e.length)&&$e?ln(!0):console.warn("Error: Trying to fetch rules without access token",oe)},[null==oe?void 0:oe.accessToken,ye,Se,le.applicationId,$e]);var un=function(n,o,s){return t(re,void 0,void 0,function(){var t,o,s,i,a,c,l,u;return r(this,function(r){switch(r.label){case 0:je(!0),r.label=1;case 1:return r.trys.push([1,4,5,6]),[4,I(n,oe.accessToken)];case 2:return r.sent(),m.getState().selectedRuleSetId===n&&(t=m.getState().scopeTreeData,(o=k((null==t?void 0:t.data)||null,n))&&o.length>1&&(s=o[o.length-2],ge(s),ke("learnings"))),[4,ln(!0)];case 3:return r.sent(),Ae(function(n){return e(e({},n),{isOpen:!1})}),null===(a=He.current)||void 0===a||a.show({severity:"success",summary:"Deleted Successfully",detail:"The scope was permanently removed."}),[3,6];case 4:return i=r.sent(),console.error("An error occurred during scope deletion.",i),null===(c=He.current)||void 0===c||c.show({severity:"error",summary:"Delete Failed",detail:(null===(u=null===(l=null==i?void 0:i.response)||void 0===l?void 0:l.data)||void 0===u?void 0:u.message)||"There was an error deleting the scope. Please try again."}),[3,6];case 5:return je(!1),[7];case 6:return[2]}})})},dn=be,pn=Be?{data:{id:Be.stationId,name:Be.stationName,type:"STATION",metrics:{learningsCount:Be.learningsCount,stationsCount:0},children:[]}}:dn,mn=!!(null==pn?void 0:pn.data);null===(ee=null==pn?void 0:pn.data)||void 0===ee||ee.type;var fn=B(function(e){return e.hasGlobalPermission})("ilotj.scope.global.create",le.applicationResourceId||"");if(tn)return o("div",e({className:v.learningManagementContainer},{children:o(H,{})}));if(rn)return o("div",e({className:v.learningManagementContainer},{children:o(Q,{errorMessage:"Failed to load configuration. Please try again.",onRetry:function(){return on()},title:"Error Loading Configuration"})}));var vn=n(n([{type:"GLOBAL",label:"Global",addChildLabel:"".concat(Y("".concat(J,".addScope"),"Add Scope")),addChildType:"SCOPE"}],Array.from({length:an},function(){return e({type:"SCOPE",label:Y("".concat(J,".scope"),"Scope")},!me&&{addChildLabel:Y("".concat(X,".addSubScope"),"Add Subscope"),addChildType:"SUBSCOPE"})}),!0),me?[]:[{type:"SUBSCOPE",label:Y("".concat(J,".subScope"),"Subscope")}],!0),gn=[{id:"learnings",label:Y("".concat(J,".treeMenu.submenu.learnings"),"Learnings"),icon:u,badgeKey:"learningsCount"},{id:"access",label:Y("".concat(J,".treeMenu.submenu.access"),"Access"),icon:d},{id:"history",label:Y("".concat(J,".treeMenu.submenu.changeHistory"),"Change History"),icon:p}],hn=new Set(gn.map(function(e){return e.id})),yn=Be?gn.filter(function(e){return"stations"!==e.id}):gn;return o(P,{children:s("div",e({className:v.learningManagementContainer},{children:[o("div",e({className:v.mainWrapper},{children:Ie?o(_,{}):he?s("div",e({className:v.errorContainer},{children:[o("div",e({className:v.errorTitle},{children:"Error Loading Data"})),o("p",e({className:v.errorDesc},{children:he})),o("button",e({onClick:function(){return ln(!0)},className:v.tryAgainBtn},{children:"Try Again"}))]})):mn?o(g,{onOpenCreateModal:function(){return Ae({isOpen:!0,type:"GLOBAL"})},onAddChild:function(e,n,t){return Ae({isOpen:!0,type:n,parentId:e,parentName:t})},onRenameChild:function(e,n){return Ae({isOpen:!0,type:"RENAME",scopeId:e,initialName:n})},onDeleteChild:function(e,n,o){return t(re,void 0,void 0,function(){var t,s,i;return r(this,function(r){switch(r.label){case 0:return t=m.getState().scopeTreeData,s=k((null==t?void 0:t.data)||null,e),i=!!s&&3===s.length,0!==o?[3,2]:[4,un(e)];case 1:return r.sent(),[3,3];case 2:Ae({isOpen:!0,type:"DELETE",scopeId:e,initialName:n,isSubscope:i}),r.label=3;case 3:return[2]}})})},canDeleteScope:function(e){return Xe("ilotj.scope.delete",e)},canEditScope:function(e){return Xe("ilotj.scope.edit",e)},canCreateScope:function(e){return Xe("ilotj.scope.create",e)},onSectionSelect:function(e,n){var t;console.log("Section Selected:",{scopeId:e,sectionId:n}),R(((t={})[O.SECTION]="learnings"===n?null:n,t[O.RULESET_ID]=e,t)),ke(n),ge(e)},activeSectionId:Ne,scopeTreeData:pn,sectionsConfig:yn,onViewStation:function(e){Fe.current=ve,Ge(e),ke("learnings"),ge(e.stationId)},onRefreshRuleSets:function(e,n){void 0===e&&(e=!0),n&&(qe.current=n),ln(e)},nodeTypesConfig:vn,app_integration_id:de,token:oe.accessToken,modeId:fe}):o(h,{onCreate:function(){return Ae({isOpen:!0,type:"GLOBAL"})},title:Y("".concat(Z,".title"),"No Global Scope has been added!"),desc:Y("".concat(Z,".desc"),"Start by creating a Global scope to define base learnings that apply across all stations."),button:Y("".concat(Z,".createGlobalScope"),"Create Global Scope"),canCreateRule:fn,noAccessTitle:Y("".concat(Z,".noAccessTitle"),"Access Restricted"),noAccessDesc:Y("".concat(Z,".noAccessDesc"),"You do not have access for this application."),requestAccessButton:Y("".concat(Z,".requestAccessButton"),"Request Access"),onRequestAccess:function(){return t(re,void 0,void 0,function(){var e,n,t,s,i,a,c,l,u;return r(this,function(r){switch(r.label){case 0:if(!(e=(null===(s=null===(t=m.getState().scopeTreeData)||void 0===t?void 0:t.data)||void 0===s?void 0:s.id)||Me))return null===(i=He.current)||void 0===i||i.show({severity:"error",sticky:!1,className:v.errorToast,content:o(V,{message:"Unable to identify the global scope for this access request."})}),[2];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,w(e)];case 2:return r.sent(),null===(a=He.current)||void 0===a||a.show({severity:"success",sticky:!1,life:3e3,className:v.successToast,content:o(K,{message:"Access request submitted successfully!"})}),[3,4];case 3:return n=r.sent(),null===(c=He.current)||void 0===c||c.show({severity:"error",sticky:!1,className:v.errorToast,content:o(V,{message:(null===(u=null===(l=null==n?void 0:n.response)||void 0===l?void 0:l.data)||void 0===u?void 0:u.detail)||"Failed to request access. Please try again."})}),[3,4];case 4:return[2]}})})}})})),o(f,{ref:He,pt:{root:{style:{zIndex:9999}}}}),me&&Le.isOpen&&"DELETE"!==Le.type&&"RENAME"!==Le.type?o(U,{isOpen:!0,onClose:function(){return Ae(e(e({},Le),{isOpen:!1}))},onSubmit:function(n){return t(re,void 0,void 0,function(){var t,o,s,i,a,c,l,u,d,p,f,v,g,h,y,S,b,C,E,I;return r(this,function(r){switch(r.label){case 0:je(!0),t=m.getState().backwardCompatibility,r.label=1;case 1:return r.trys.push([1,12,13,14]),o=void 0,t&&"object"==typeof n?o=n:(s=n,i="SCOPE"===Le.type&&Le.parentId,a=i?"genreRuleSet":Le.type,o={topic:a,scope_reference_id:null,scopeDescription:"demo",parentScopeId:Le.parentId||null,scopeName:s,scopeReferenceMetadata:{},applicationMappingId:de}),[4,A(o,oe.accessToken)];case 2:if(c=r.sent(),!(l=null===(h=null==c?void 0:c.data)||void 0===h?void 0:h.scopeId))return[3,10];if(qe.current=l,u=t&&(null===(y=o.topic)||void 0===y?void 0:y.toLowerCase().includes("genre")),d=!t&&"GLOBAL"!==Le.type&&Le.parentId,!u&&!d)return[3,10];if(!(p=t?null===(b=null===(S=m.getState().scopeTreeData)||void 0===S?void 0:S.data)||void 0===b?void 0:b.id:Le.parentId))return[3,10];if(!me)return[3,7];r.label=3;case 3:return r.trys.push([3,5,,6]),[4,L({source_scope_id:p,target_scope_id:l})];case 4:return r.sent(),[3,6];case 5:return f=r.sent(),console.error("Failed to inherit rules for the new scope:",f),[3,6];case 6:return[3,10];case 7:return r.trys.push([7,9,,10]),[4,T({source_scope_id:p,target_scope_id:l,application_mapping_id:de||"",is_copy_parent_variant_id:!1})];case 8:return r.sent(),[3,10];case 9:return v=r.sent(),console.error("Failed to inherit rules for the new scope:",v),[3,10];case 10:return[4,ln(!0)];case 11:return r.sent(),Ae(function(n){return e(e({},n),{isOpen:!1})}),[3,14];case 12:throw g=r.sent(),console.error("An error occurred during scope creation.",g),null===(C=He.current)||void 0===C||C.show({severity:"error",summary:"Creation Failed",detail:(null===(I=null===(E=null==g?void 0:g.response)||void 0===E?void 0:E.data)||void 0===I?void 0:I.message)||"There was an error creating the scope. Please try again."}),g;case 13:return je(!1),[7];case 14:return[2]}})})},hasGlobalRuleSet:mn,canCreateGlobal:fn,globalScopeId:null!==(te=null===(ne=null==be?void 0:be.data)||void 0===ne?void 0:ne.id)&&void 0!==te?te:null}):s(i,{children:[o(x,{isOpen:Le.isOpen&&"DELETE"!==Le.type&&"RENAME"!==Le.type,onClose:function(){return Ae(e(e({},Le),{isOpen:!1}))},onCreate:function(e){e&&(qe.current=e),ln(!0)},hasGlobalRuleSet:mn,parentId:Le.parentId}),o(W,{isOpen:Le.isOpen&&"RENAME"===Le.type,onClose:function(){return Ae(e(e({},Le),{isOpen:!1}))},onSave:function(n){return t(re,void 0,void 0,function(){var t,s,i,a,c,l;return r(this,function(r){switch(r.label){case 0:je(!0),r.label=1;case 1:return r.trys.push([1,4,5,6]),Le.scopeId?(t=m.getState().backwardCompatibility,s=t?{scope_id:Le.scopeId,scope_name:n}:{scope_id:Le.scopeId,scope_type:"Custom",scope_name:n,description:"demo",application_mapping_id:de},[4,E(s,oe.accessToken)]):[2];case 2:return r.sent(),[4,ln(!0)];case 3:return r.sent(),Ae(function(n){return e(e({},n),{isOpen:!1})}),[3,6];case 4:throw i=r.sent(),console.error("An error occurred during scope rename.",i),null===(a=He.current)||void 0===a||a.show({severity:"error",sticky:!1,className:v.errorToast,content:o(V,{message:(null===(l=null===(c=null==i?void 0:i.response)||void 0===c?void 0:c.data)||void 0===l?void 0:l.message)||"There was an error renaming the scope. Please try again."})}),i;case 5:return je(!1),[7];case 6:return[2]}})})},initialName:Le.initialName})]}),o(j,{isOpen:Le.isOpen&&"DELETE"===Le.type,onCancel:function(){return Ae(e(e({},Le),{isOpen:!1}))},onConfirm:function(){return un(Le.scopeId,Le.initialName,Le.isSubscope)},title:"Delete Scope",description:s(i,{children:["Deleting ",o("span",e({className:v.highlight},{children:Le.initialName||"this scope"}))," will permanently remove all Learnings, Access rules, and Change History inside it. This cannot be undone."]}),confirmText:"Delete",confirmBgColor:"#EF4444",isLoading:Re})]}))})}export{$ as default};
|
|
2
2
|
//# sourceMappingURL=LearningManagement.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"react";var t="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";export{t as default};
|
|
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":["EmptyResultIconSVG"],"mappings":"cA0KA,IAAAA,EAAe"}
|
package/dist/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{__assign as e,__awaiter as r,__generator as n,__spreadArray as t}from"tslib";import{jsxs as o,jsx as i,Fragment as l}from"react/jsx-runtime";import{useState as a,useRef as s,useMemo as u,useEffect as c}from"react";import{Dialog as d,Box as p,Typography as f,IconButton as m,DialogContent as h,CircularProgress as g}from"@mui/material";import{X as v,Search as b,ArrowRight as x}from"lucide-react";import{Toast as S}from"primereact/toast";import{v4 as y}from"uuid";import w from"../../assets/Search-result(add new).svg.js";import C from"../../store/useAuthStore.js";import{IL_CONFIG_CONSTANTS as _}from"../../config.js";import{retrieveGenreScopes as O,fetchStationsByKeyword as F,searchScopes as T,inheritScope as A,deleteRuleSet as N,updateStation as M,createRuleSet as E}from"../../apis/scopeApis.js";import k from"./InputField.js";import D from"./StationAutocomplete.js";import z from"../CardSkeleton.js";import P from"./OnboardingLoader.js";import B from"./TemplateCard.js";var j=[{label:"5am to 7pm",value:"05:00 AM - 7:00 PM"},{label:"6am to 7pm",value:"06:00 AM - 7:00 PM"}],I=[{label:"Low Sellout",value:"Low Sellout"},{label:"High Sellout",value:"High Sellout"},{label:"None",value:""}],L=[{label:"None",value:"None"},{label:"Distribute spots evenly across all breaks in the hour",value:"Distribute spots evenly across all breaks in the hour"}],R=function(R){var W,U=R.isOpen,q=R.onClose,G=R.onBoardStation,Y=R.app_integration_id,H=R.token,K=R.stationNameParam,X=a(null),J=X[0],Q=X[1],V=a([]),Z=V[0],$=V[1],ee=a(0),re=ee[0],ne=ee[1],te=a(!0),oe=te[0],ie=te[1],le=a(!1),ae=le[0],se=le[1],ue=a([]),ce=ue[0],de=ue[1],pe=a(""),fe=pe[0],me=pe[1],he=a(""),ge=he[0],ve=he[1],be=a(!1),xe=be[0],Se=be[1],ye=a(!1),we=ye[0],Ce=ye[1],_e=a(null),Oe=_e[0],Fe=_e[1],Te=a(!1),Ae=Te[0],Ne=Te[1],Me=a(0),Ee=Me[0],ke=Me[1],De=a(""),ze=De[0],Pe=De[1],Be=C().user,je=s(null),Ie=s(null),Le=s(null),Re=s(null),We=a({region:"",primeTime:["06:00 AM - 7:00 PM"],genre:"Music",type:"",lowSelloutConfig:""}),Ue=We[0],qe=We[1],Ge=function(e,r){return e.find(function(e){return e.value===r})||null},Ye=u(function(){return Z.map(function(e){return{label:e.scope_name,value:e.scope_name}})},[Z]),He=u(function(){var e,r,n;if(!Ue.genre)return null;var t=Z.find(function(e){return e.scope_name===Ue.genre});return t?{id:t.id,title:t.scope_name||"Unnamed Template",description:(null===(e=t.description)||void 0===e?void 0:e.trim())||"No description available.",inheritedText:(null===(r=t.inheritance)||void 0===r?void 0:r[0])||void 0,rulesCount:t.rules_count||0,tiersCount:t.tier_count||0,isCopy:null!==(n=t.is_copy)&&void 0!==n&&n}:null},[Ue.genre,Z]);c(function(){return function(){Le.current&&clearTimeout(Le.current)}},[]);var Ke=function(e){return r(void 0,void 0,void 0,function(){var r,o,i;return n(this,function(n){switch(n.label){case 0:if(ae)return[2];se(!0),n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,O({limit:"20",offset:String(e)})];case 2:return"success"===(null==(r=n.sent())?void 0:r.status)&&Array.isArray(null==r?void 0:r.data)?(o=r.data,$(function(r){if(0===e)return o;var n=new Set(r.map(function(e){return e.id})),i=o.filter(function(e){return!n.has(e.id)});return t(t([],r,!0),i,!0)}),o.length<20?ie(!1):ie(!0),ne(e+20)):ie(!1),[3,5];case 3:return i=n.sent(),console.error("[StationOnboard] Failed to fetch genre scopes:",i),ie(!1),[3,5];case 4:return se(!1),[7];case 5:return[2]}})})};c(function(){if(U&&($([]),ne(0),ie(!0),Ke(0),K)){Pe(K);r(void 0,void 0,void 0,function(){var e,r,t;return n(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,F(K,!0)];case 1:return!0===(null==(e=n.sent())?void 0:e.success)&&Array.isArray(null==e?void 0:e.data)&&(r=e.data.find(function(e){var r;return(null===(r=e.station_name)||void 0===r?void 0:r.toLowerCase())===K.toLowerCase()&&!e.ruleset_id}),r&&Q(r)),[3,3];case 2:return t=n.sent(),console.error("[StationOnboard] Error auto-selecting station:",t),[3,3];case 3:return[2]}})})}},[U,K]);c(function(){qe(J?function(r){var n;return e(e({},r),{region:null!==(n=J.market)&&void 0!==n?n:""})}:{region:"",primeTime:["06:00 AM - 7:00 PM"],genre:"Music",type:"",lowSelloutConfig:""})},[J]),c(function(){var e=setTimeout(function(){ve(fe)},500);return function(){return clearTimeout(e)}},[fe]),c(function(){r(void 0,void 0,void 0,function(){var e,r,t;return n(this,function(n){switch(n.label){case 0:if(!ge.trim())return de([]),[2];Se(!0),n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,T({search_string:ge})];case 2:return"success"===(null==(e=n.sent())?void 0:e.status)&&Array.isArray(null==e?void 0:e.data)?(r=e.data.map(function(e){var r,n,t;return{id:e.id,title:e.scope_name||"Unnamed Template",description:(null===(r=e.description)||void 0===r?void 0:r.trim())||"No description available.",inheritedText:(null===(n=e.inheritance)||void 0===n?void 0:n[0])||void 0,rulesCount:e.rules_count||0,tiersCount:e.tier_count||0,isCopy:null!==(t=e.is_copy)&&void 0!==t&&t}}),de(r)):de([]),[3,5];case 3:return t=n.sent(),console.error("[StationOnboard] Error searching scopes:",t),de([]),[3,5];case 4:return Se(!1),[7];case 5:return[2]}})})},[ge]),c(function(){!ge.trim()&&He&&Fe(He.id)},[ge,He]);var Xe=function(){setTimeout(function(){Re.current&&Re.current.scrollTo({top:Re.current.scrollHeight,behavior:"smooth"})},100)},Je=function(){Pe(""),Q(null),qe({region:"",primeTime:["06:00 AM - 7:00 PM"],genre:"Music",type:"",lowSelloutConfig:""}),de([]),me(""),Fe(null),q()},Qe=function(r,n){var t;if("primeTime"!==r){var o=null!==(t=null==n?void 0:n.value)&&void 0!==t?t:"";qe(function(n){var t;return e(e({},n),((t={})[r]=String(o),t))}),"genre"===r&&(Ce(!0),Le.current&&clearTimeout(Le.current),Le.current=setTimeout(function(){var e=Z.find(function(e){return e.scope_name===o});Fe(e?e.id:null),Ce(!1)},800))}else{var i=(null==n?void 0:n.value)?String(n.value):"";qe(function(r){return e(e({},r),{primeTime:i?[i]:[]})})}},Ve=Boolean(J&&Ue.region&&Ue.primeTime.length>0&&Ue.genre);return o(d,e({open:U,onClose:Je,maxWidth:!1,disableEscapeKeyDown:!0,PaperProps:{sx:{width:"90vw",height:"90vh",borderRadius:"12px",display:"flex",flexDirection:"column",overflow:"hidden"}}},{children:[i(S,{ref:je}),o(p,e({sx:{p:"20px 20px 20px 27px",borderBottom:"1px solid #F0F2F5",display:"flex",justifyContent:"space-between",alignItems:"center",bgcolor:"#fff"}},{children:[o(p,e({sx:{display:"flex",flexDirection:"column",gap:.5}},{children:[i(f,e({sx:{fontSize:"18px",fontWeight:600,color:"#19213D"}},{children:"Onboard a Station"})),i(f,e({sx:{fontSize:"16px",fontWeight:400,color:"#666F8D"}},{children:"Onboard a station to start configuring learnings."}))]})),i(m,e({onClick:Je,disabled:Ae,sx:{color:"#19213D"}},{children:i(v,{size:24})}))]})),o(h,e({sx:{p:0,bgcolor:"#F8FAFC",display:"flex",flexDirection:"row",overflow:"hidden",position:"relative"}},{children:[i(P,{isLoading:Ae,currentStep:Ee,onComplete:function(){Ne(!1);var e=Ie.current;Je(),G(e||void 0),Ie.current=null}}),o(p,e({sx:{display:"flex",flex:1,paddingY:"14px",paddingX:"20px",gap:3,overflowY:"hidden"}},{children:[o(p,e({ref:Re,sx:{flex:1,bgcolor:"#fff",p:3,borderRadius:"16px",border:"1px solid #F0F2F5",height:"100%",overflowY:"auto"}},{children:[i(f,e({sx:{fontSize:"1rem",fontWeight:600,mb:.5,color:"#19213D"}},{children:"Basic Details"})),i(f,e({sx:{fontSize:"0.75rem",color:"#00000080",mb:"20px"}},{children:"Set up basic station details to unlock AI recommended scopes."})),o(p,e({sx:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[o(p,e({className:"space-y-1.5"},{children:[o("label",e({className:"text-sm font-medium text-[#19213D]"},{children:[i("span",e({className:"mr-0.5 text-xs font-semibold text-[#8F2C23]"},{children:"*"})),"Station Name/Call Letters"]})),i(D,{value:ze,onChange:Pe,onStationSelect:function(e){return Q(e)}})]})),i(k,{required:!0,disabled:!0,label:"Region",placeholder:"Select Region",value:Ue.region||void 0,isSearchable:!1}),i(k,{required:!0,label:"Prime Time Window",placeholder:"Select Prime Time",options:j,value:Ge(j,(null===(W=Ue.primeTime)||void 0===W?void 0:W[0])||""),onOptionChange:function(e){return Qe("primeTime",e)},isSearchable:!1}),i(p,e({onClick:Xe,sx:{width:"100%"}},{children:i(k,{required:!0,label:"Genre",placeholder:"Select Genre",options:Ye,value:Ge(Ye,Ue.genre),onOptionChange:function(e){return Qe("genre",e)},isSearchable:!1,onMenuScrollToBottom:function(){!ae&&oe&&Ke(re)},isLoadingOptions:ae,hasMoreOptions:oe})})),i(p,e({onClick:Xe,sx:{width:"100%"}},{children:i(k,{label:"Station Type",placeholder:"None",options:I,value:Ge(I,Ue.type),onOptionChange:function(r){Qe("type",r),"Low Sellout"!==(null==r?void 0:r.value)&&qe(function(r){return e(e({},r),{lowSelloutConfig:""})})},isSearchable:!1})})),"Low Sellout"===Ue.type&&i(p,e({onClick:Xe,sx:{width:"100%"}},{children:i(k,{label:"Low Sell Out Configurations",placeholder:"Select Configuration",options:L,value:Ge(L,Ue.lowSelloutConfig),onOptionChange:function(e){return Qe("lowSelloutConfig",e)},isSearchable:!1})}))]}))]})),i(p,e({sx:{flex:1,bgcolor:"#fff",p:3,borderRadius:"12px",border:"1px solid #F0F2F5",display:"flex",flexDirection:"column",height:"100%",overflowY:"auto"}},{children:Ue.genre?o(l,{children:[i(f,e({sx:{fontSize:"1rem",fontWeight:500,mb:1.5}},{children:"Matching scope for your station"})),i(p,e({sx:{display:"flex",flexDirection:"column",gap:2,mb:4}},{children:we?i(z,{}):He?i(B,e({},He,{isSelected:Oe===He.id,onSelect:Fe}),He.id):null})),i(f,e({sx:{fontSize:"1rem",fontWeight:500,mb:1.5}},{children:"Other available stations"})),o("div",e({className:"relative mb-4 w-full"},{children:[i("input",{type:"text",value:fe,onChange:function(e){return me(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"}),i(b,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400",size:16})]})),o(p,e({sx:{display:"flex",flexDirection:"column",gap:2}},{children:[xe&&i(z,{}),!xe&&0===ce.length&&ge.trim()&&o(f,e({sx:{fontSize:"0.875rem",color:"#64748B",textAlign:"center",py:4}},{children:['No scopes found matching "',ge,'".']})),!xe&&ce.map(function(r){return i(B,e({},r,{isSelected:Oe===r.id,onSelect:Fe}),r.id)})]}))]}):o(l,{children:[i(f,e({sx:{fontSize:"1rem",fontWeight:500,mb:1.5}},{children:"Fill in the station details to load AI recommended scopes"})),i(f,e({sx:{fontSize:"0.75rem",color:"#64748B",mb:3}},{children:"AI will recommend the most relevant scope for this station."})),i(p,e({sx:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",opacity:.5,py:10}},{children:i("img",{src:w,alt:"Empty Result"})}))]})}))]}))]})),o(p,e({sx:{p:"12px 20px",borderTop:"1px solid #F0F2F5",display:"flex",justifyContent:"flex-end",gap:2,bgcolor:"#fff"}},{children:[i("button",e({onClick:Je,disabled:Ae,style:{padding:"7px 10px",borderRadius:"6px",color:"#64748B",border:"1px solid #E2E8F0",backgroundColor:"#fff",cursor:"pointer",fontSize:"14px",fontWeight:500}},{children:"Cancel"})),i("button",e({onClick:function(){return r(void 0,void 0,void 0,function(){var r,o,i,l,a,s,u,c,d,p,f,m,h,g,v,b,x,S;return n(this,function(n){switch(n.label){case 0:if(!J||!Oe)return console.error("[StationOnboard] Missing required data for onboarding"),[2];r=He?t([He],ce,!0):ce,o=r.find(function(e){return e.id===Oe}),i=null!==(h=null==o?void 0:o.isCopy)&&void 0!==h&&h,Ne(!0),ke(0),l=null,n.label=1;case 1:return n.trys.push([1,3,,4]),a={topic:"customRuleSet",customScopeGroupName:(null==_?void 0:_.CUSTOM_SCOPE_GROUP_NAME)||"Audacy-Traffic-Manager",scopeDescription:J.station_name||"New Station",parentScopeId:null,customScopeName:J.station_name||"New Station",customScopeId:y(),createByName:(null==Be?void 0:Be.firstname)||"System",createdBy:(null==Be?void 0:Be.email)||"system@audacy.com",applicationMappingId:Y},console.log("[StationOnboard] Step 1: Creating rule set with payload:",a),[4,E(a,H)];case 2:if(s=n.sent(),!(l=null===(g=null==s?void 0:s.data)||void 0===g?void 0:g.scopeId))throw new Error("Failed to create scope - no scopeId returned");return ke(1),[3,4];case 3:return u=n.sent(),console.error("[StationOnboard] Error creating rule set:",u),null===(v=je.current)||void 0===v||v.show({severity:"error",life:3e3,summary:"Error",detail:"Failed to create rule set. Please try again."}),Ne(!1),ke(0),[2];case 4:return n.trys.push([4,6,,11]),c={market:J.market,region:J.region,primetime_windows:Ue.primeTime,genre:Ue.genre,station_type:""===Ue.type?null:Ue.type,low_sellout_configurations:"Low Sellout"===Ue.type?Ue.lowSelloutConfig:null,ruleset_id:l,station_guid:J.station_guid,station_name:J.station_name||"New Station"},console.log("[StationOnboard] Step 2: Updating station with payload:",c),[4,M(c)];case 5:return n.sent(),ke(2),[3,11];case 6:d=n.sent(),console.error("[StationOnboard] Error updating station, rolling back rule set:",d),409===d.status?(null===(b=je.current)||void 0===b||b.show({severity:"error",life:2500,summary:"Error updating station",detail:"Station already Onboarded."}),Q(null),Fe(null),Pe(""),qe(function(r){return e(e({},r),{region:""})})):null===(x=je.current)||void 0===x||x.show({severity:"error",life:2500,summary:"Error updating station",detail:"Please try again."}),n.label=7;case 7:return n.trys.push([7,9,,10]),[4,N(l,H)];case 8:return n.sent(),[3,10];case 9:return p=n.sent(),console.error("[StationOnboard] Failed to rollback rule set deletion:",p),[3,10];case 10:return Ne(!1),ke(0),[2];case 11:return n.trys.push([11,13,,14]),f={source_scope_id:Oe,target_scope_id:l,is_copy_parent_variant_id:i},console.log("[StationOnboard] Step 3: Inheriting scope with payload:",f),[4,A(f)];case 12:return n.sent(),ke(3),[3,14];case 13:return m=n.sent(),console.error("[StationOnboard] Error inheriting scope (no rollback):",m),null===(S=je.current)||void 0===S||S.show({severity:"error",life:3e3,summary:"Error",detail:"Failed to apply rule template. Please try again."}),Ne(!1),ke(0),[2];case 14:return Ie.current=l,[2]}})})},disabled:!Ve||Ae,style:{padding:"7px 10px",borderRadius:"6px",border:"none",backgroundColor:Ve?"#2563EB":"#BFDBFE",color:"#fff",cursor:Ve&&!Ae?"pointer":"not-allowed",fontSize:"14px",fontWeight:500,display:"flex",alignItems:"center",gap:"7px"}},{children:o(l,Ae?{children:[i(g,{size:16,color:"inherit"}),i("span",{children:"Onboarding..."})]}:{children:[i("span",{children:"Onboard Station"}),i(x,{size:16})]})}))]}))]}))};export{R as default};
|
|
2
|
+
//# sourceMappingURL=BackwardStationOnboardModal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BackwardStationOnboardModal.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LearningManagement.d.ts","sourceRoot":"","sources":["../../../../../src/features/LearningManagement/LearningManagement.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AASnD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAWrC,OAAoB,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAmC9E,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,QAAQ,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC5D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,UAAU,uBAAuB;IAC/B,WAAW,EAAE,IAAI,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,GAAG,CAAC;IACZ,UAAU,EAAE,UAAU,CAAC;IACvB,cAAc,EAAE,cAAc,CAAC;IAC/B,QAAQ,EAAE;QACR,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,oBAAoB,EAAE,MAAM,CAAC;KAC9B,CAAA;IACD,MAAM,CAAC,EAAC,MAAM,CAAA;IACd,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED;;;GAGG;AACH,iBAAS,kBAAkB,CAAC,EAC1B,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,QAAQ,EACR,MAAM,EACN,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,qBAA2B,EAC3B,MAAM,EACP,EAAE,uBAAuB,
|
|
1
|
+
{"version":3,"file":"LearningManagement.d.ts","sourceRoot":"","sources":["../../../../../src/features/LearningManagement/LearningManagement.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AASnD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAWrC,OAAoB,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAmC9E,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,QAAQ,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC5D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,UAAU,uBAAuB;IAC/B,WAAW,EAAE,IAAI,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,GAAG,CAAC;IACZ,UAAU,EAAE,UAAU,CAAC;IACvB,cAAc,EAAE,cAAc,CAAC;IAC/B,QAAQ,EAAE;QACR,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,oBAAoB,EAAE,MAAM,CAAC;KAC9B,CAAA;IACD,MAAM,CAAC,EAAC,MAAM,CAAA;IACd,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED;;;GAGG;AACH,iBAAS,kBAAkB,CAAC,EAC1B,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,QAAQ,EACR,MAAM,EACN,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,qBAA2B,EAC3B,MAAM,EACP,EAAE,uBAAuB,qBA8sBzB;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface StationOnboardModalProps {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
onBoardStation: (scopeId?: string) => void;
|
|
6
|
+
app_integration_id?: string;
|
|
7
|
+
token: string;
|
|
8
|
+
stationNameParam?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const BackwardStationOnboardModal: React.FC<StationOnboardModalProps>;
|
|
11
|
+
export default BackwardStationOnboardModal;
|
|
12
|
+
//# sourceMappingURL=BackwardStationOnboardModal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BackwardStationOnboardModal.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AA+DpE,UAAU,wBAAwB;IAChC,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,cAAc,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,QAAA,MAAM,2BAA2B,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAitBnE,CAAC;AAEF,eAAe,2BAA2B,CAAC"}
|