@e-llm-studio/instant-learning 1.3.0-alpha.39 → 1.3.0-alpha.41
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/RuleContent/AddScopeModal.js +1 -1
- package/dist/cjs/features/LearningManagement/components/InstantLearningModal.js +1 -1
- package/dist/cjs/features/LearningManagement/store/useLMSConfigStore.js +1 -1
- package/dist/features/LearningManagement/LearningManagement.js +1 -1
- package/dist/features/LearningManagement/RuleContent/AddScopeModal.js +1 -1
- package/dist/features/LearningManagement/components/InstantLearningModal.js +1 -1
- package/dist/features/LearningManagement/store/useLMSConfigStore.js +1 -1
- package/dist/types/src/features/LearningManagement/LearningManagementTest.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/RuleContent/AddScopeModal.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/apis/scopeApis.d.ts +7 -0
- package/dist/types/src/features/LearningManagement/apis/scopeApis.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/components/InstantLearningModal.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/store/useLMSConfigStore.d.ts +3 -0
- package/dist/types/src/features/LearningManagement/store/useLMSConfigStore.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/cjs/features/LearningManagement/assets/Search-result(add new).svg.js +0 -2
- package/dist/cjs/features/LearningManagement/assets/Search-result(add new).svg.js.map +0 -1
- package/dist/cjs/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.js +0 -2
- package/dist/cjs/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.js.map +0 -1
- package/dist/features/LearningManagement/assets/Search-result(add new).svg.js +0 -2
- package/dist/features/LearningManagement/assets/Search-result(add new).svg.js.map +0 -1
- package/dist/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.js +0 -2
- package/dist/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.js.map +0 -1
- package/dist/types/src/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.d.ts +0 -12
- package/dist/types/src/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.d.ts.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("zustand"),t=require("./useLearningTemplateStore.js"),n={pageTitle:"",middleDrawer:{scope:"",addScope:"",addSubScope:"",addScopeDialog:{title:"",subtitle:"",scopeName:"",learningApprovalSettings:{title:"",approvalRequired:{title:"",subtitle:""},publishWithoutApproval:{title:"",subtitle:""}},submitButton:"",cancel:""},treeMenu:{search:"",submenu:{learnings:"",access:"",changeHistory:""},contextMenu:{addScope:"",rename:"",delete:"",addSubScope:""}}},learnings:{header:{title:"",exportButton:"",addNewLearningButton:""},tier:{showTierHeader:!0,tierHeader:"",subtitle:"",tierHeaderNoOfLearnings:"",deleteDialog:{title:"",description:"",cancel:"",submit:""},learning:{inheritance:"",actions:{disable:"",enable:"",approve:"",reject:"",delete:""},approveDialog:{title:"",desc:"",footer:"",cancel:"",approveLearning:""},rejectDialog:{title:"",desc:"",feedbackTitle:"",feedbackPlaceholder:"",deleteCheckboxLabel:"",cancel:"",rejectLearning:""},deleteDialog:{title:"",desc:"",warningText:"",cancelText:"",deleteText:""}}}},emptyStateLearning:{title:"",desc:"",createNewLearning:"",noAccessTitle:"",noAccessDesc:"",requestAccessButton:""},agents:{LearningTerm:""}},a={showScope:!1,showConfiguration:!1,welcomeMessage:"Hi! 👋 I'm your Instant Learning Concierge.",welcomeMessageSubtitle:"How would you like to get started? You can select an option below or describe the rule you'd like to create.",actions:[{label:"Separation rule",value:"I would want to add a separation rule"},{label:"Max priority rule",value:"I would want to set a max priority rule"},{label:"Break code matching",value:"I would want to add a break code matching rule"},{label:"Inventory code matching",value:"I would want to add a inventory window matching rule"},{label:"Enter a rule description",value:"I want to add a rule description"},{label:"Tester Genie",value:"Loading prompt..."}],chatTitle:"Teach Me OTJ - {scope} - Add Learning",chatTitleEdit:"Teach Me OTJ - {scope} - Edit Learning",formTitle:"Rule setup",setupLabel:"Configure your IL",ruleTitle:"Main Rule Name",scopeLabel:"Define Scope",tierLabel:"Select Tiers",ruleDescriptionTitle:"Learning Explanation",whenToApplyTitle:"Trigger Events (When to Apply)",addWhenToApplyBtnLabel:"Add WTA",whenNotToApplyTitle:"Exclusion Events (When NOT to Apply)",addWhenNotToApplyBtnLabel:"Add WNTA",configTitle:"Advanced Settings",saveBtnLabel:"Save Rule",saveBtnLoadingLabel:"Saving Rule...",chatTextareaPlaceholder:"Tell me more about this learning.."},
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("zustand"),t=require("./useLearningTemplateStore.js"),n={pageTitle:"",middleDrawer:{scope:"",addScope:"",addSubScope:"",addScopeDialog:{title:"",globalTitle:"",subtitle:"",globalSubtitle:"",scopeName:"",learningApprovalSettings:{title:"",approvalRequired:{title:"",subtitle:""},publishWithoutApproval:{title:"",subtitle:""}},submitButton:"",cancel:""},treeMenu:{search:"",submenu:{learnings:"",access:"",changeHistory:""},contextMenu:{addScope:"",rename:"",delete:"",addSubScope:""}}},learnings:{header:{title:"",exportButton:"",addNewLearningButton:""},tier:{showTierHeader:!0,tierHeader:"",subtitle:"",tierHeaderNoOfLearnings:"",deleteDialog:{title:"",description:"",cancel:"",submit:""},learning:{inheritance:"",actions:{disable:"",enable:"",approve:"",reject:"",delete:""},approveDialog:{title:"",desc:"",footer:"",cancel:"",approveLearning:""},rejectDialog:{title:"",desc:"",feedbackTitle:"",feedbackPlaceholder:"",deleteCheckboxLabel:"",cancel:"",rejectLearning:""},deleteDialog:{title:"",desc:"",warningText:"",cancelText:"",deleteText:""}}}},emptyStateLearning:{title:"",desc:"",createNewLearning:"",createGlobalScope:"",noAccessTitle:"",noAccessDesc:"",requestAccessButton:""},agents:{LearningTerm:""}},a={showScope:!1,showConfiguration:!1,welcomeMessage:"Hi! 👋 I'm your Instant Learning Concierge.",welcomeMessageSubtitle:"How would you like to get started? You can select an option below or describe the rule you'd like to create.",actions:[{label:"Separation rule",value:"I would want to add a separation rule"},{label:"Max priority rule",value:"I would want to set a max priority rule"},{label:"Break code matching",value:"I would want to add a break code matching rule"},{label:"Inventory code matching",value:"I would want to add a inventory window matching rule"},{label:"Enter a rule description",value:"I want to add a rule description"},{label:"Tester Genie",value:"Loading prompt..."}],chatTitle:"Teach Me OTJ - {scope} - Add Learning",chatTitleEdit:"Teach Me OTJ - {scope} - Edit Learning",formTitle:"Rule setup",setupLabel:"Configure your IL",ruleTitle:"Main Rule Name",scopeLabel:"Define Scope",tierLabel:"Select Tiers",ruleDescriptionTitle:"Learning Explanation",whenToApplyTitle:"Trigger Events (When to Apply)",addWhenToApplyBtnLabel:"Add WTA",whenNotToApplyTitle:"Exclusion Events (When NOT to Apply)",addWhenNotToApplyBtnLabel:"Add WNTA",configTitle:"Advanced Settings",saveBtnLabel:"Save Rule",saveBtnLoadingLabel:"Saving Rule...",chatTextareaPlaceholder:"Tell me more about this learning.."},l=e.create(function(e){return{lmsConfig:n,setLMSConfig:function(t){return e({lmsConfig:t})},clearLMSConfig:function(){return e({lmsConfig:n})}}});var i=e.create(function(e){return{teachMeConfig:null,setTeachMeConfig:function(t){return e({teachMeConfig:t})},clearTeachMeConfig:function(){return e({teachMeConfig:null})}}});exports.defaultLMSConfig=n,exports.defaultTeachMeConfig=a,exports.dt=function(e,n,a){if(t.useLearningTemplateStore.getState().backwardCompatibility)return null!=n?n:"";var i=l.getState().lmsConfig,o=e.split(".").reduce(function(e,t){return null==e?void 0:e[t]},i);return"string"!=typeof o||""===o?null!=n?n:e:o.replace(/\{(\w+)\}/g,function(e,t){var n;return String(null!==(n=null==a?void 0:a[t])&&void 0!==n?n:"{".concat(t,"}"))})},exports.dtt=function(e,t,n){var a=i.getState().teachMeConfig,l=e.split(".").reduce(function(e,t){return null==e?void 0:e[t]},a);return"string"!=typeof l?null!=t?t:e:l.replace(/\{(\w+)\}/g,function(e,t){var a;return String(null!==(a=null==n?void 0:n[t])&&void 0!==a?a:"{".concat(t,"}"))})},exports.dttWelcomeMessageParts=function(){var e,t,n=null!==(e=i.getState().teachMeConfig)&&void 0!==e?e:a;return{greeting:n.welcomeMessage||a.welcomeMessage,subtitle:n.welcomeMessageSubtitle||a.welcomeMessageSubtitle,actions:(null===(t=n.actions)||void 0===t?void 0:t.length)?n.actions:a.actions}},exports.useLMSConfigStore=l,exports.useTeachMeConfigStore=i;
|
|
2
2
|
//# sourceMappingURL=useLMSConfigStore.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e,__spreadArray as n,__awaiter as t,__generator as r}from"tslib";import{jsx as o,jsxs as s,Fragment as i}from"react/jsx-runtime";import{useState as a,useRef as c,useEffect as l}from"react";import{BookOpen as u,Users as d,History as p}from"lucide-react";import{useLearningTemplateStore as m}from"./store/useLearningTemplateStore.js";import{Toast as f}from"primereact/toast";import v from"./styles/LearningTemplateManagement.module.css.js";import g from"./LearningTemplateLayout.js";import h from"./components/EmptyLearningState.js";import y from"./store/useAuthStore.js";import{fetchTiers as S,getILInstance as b,fetchScopes as C,inheritScope as T,inheritScopeBackwardCompatible as L,createRuleSet as A,renameScope as E,deleteRuleSet as I,requestAccess as w}from"./apis/scopeApis.js";import{QUERY_PARAM_KEYS as O,setQueryParams as R}from"./hooks/useLearningTemplateQueryParams.js";import j from"./components/ConfirmationModal.js";import N from"./components/LearningTemplateManagementSkeleton.js";import{findNodePathById as _}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"),Ne=je[0],_e=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&&_e&&(ve(n),_e(r),qe.current=!0)}},[null==We?void 0:We.search,_e,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),_e("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=_((null==t?void 0:t.data)||null,n))&&o.length>1&&(s=o[o.length-2],ve(s),_e("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(N,{}):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=_((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)),_e(n),ve(e)},activeSectionId:Ne,scopeTreeData:dn,sectionsConfig:hn,onViewStation:function(e){Ge.current=fe,Be(e),_e("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,".createNewLearning"),"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{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};
|
|
2
2
|
//# sourceMappingURL=LearningManagement.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as o,__assign as r,__spreadArray as n}from"tslib";import{jsx as t,jsxs as i,Fragment as l}from"react/jsx-runtime";import{useState as a,useRef as c,useEffect as s}from"react";import{useMutation as d}from"@tanstack/react-query";import{X as u,Loader2 as p}from"lucide-react";import{Toast as m}from"primereact/toast";import{v4 as f}from"uuid";import h from"../components/StationOnboarding/StationAutocomplete.js";import g from"./AddScopeApprovalSearchComponent.js";import v from"../components/ScopeSkeletonLoader.js";import{Input as y}from"@mui/material";import b from"../store/useAuthStore.js";import{useAppSecRolesStore as S}from"../store/useAppSecRolesStore.js";import C from"../store/useEnvStore.js";import{createRuleSet as x,inheritScope as _}from"../apis/scopeApis.js";import{useLearningTemplateStore as w}from"../store/useLearningTemplateStore.js";import{IL_CONFIG_CONSTANTS as k}from"../config.js";import{dt as A}from"../store/useLMSConfigStore.js";import{MIDDLE_DRAWER_ADD_SCOPE_DT_PATH as R,MIDDLE_DRAWER_APPROVAL_SETTINGS_DT_PATH as I}from"../constants.js";var D=function(D){var q=D.isOpen,j=D.onClose,F=D.onCreate,z=D.hasGlobalRuleSet,L=D.parentId,E=a(""),B=E[0],W=E[1],N=a(""),G=N[0],M=N[1],P=a({}),T=P[0],O=P[1],K=c(null),U=b().user,H=S(function(e){return e.roles}),J=C(function(e){return e.rbacConfig}),Q=a(null),V=Q[0],X=Q[1],Y=a("approval_required"),Z=Y[0],$=Y[1],ee=a([]),oe=ee[0],re=ee[1],ne=a([]),te=ne[0],ie=ne[1],le=a(""),ae=le[0],ce=le[1],se=d({mutationFn:function(r){return e(void 0,void 0,void 0,function(){var e;return o(this,function(o){switch(o.label){case 0:return[4,x(r,null!==(e=null==U?void 0:U.accessToken)&&void 0!==e?e:"")];case 1:return[2,o.sent()]}})})},onSuccess:function(r){return e(void 0,void 0,void 0,function(){return o(this,function(e){return console.log("Rule Set Created Successfully",r),[2]})})}});se.data;var de=se.isPending,ue=se.mutateAsync;return s(function(){q&&(W(""),M(""),O({}),X(null),$("approval_required"),re([]),ie([]),ce(""))},[q]),q?de?t(v,{isLoading:de}):i("div",r({style:{position:"absolute",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0,0,0,0.3)"}},{children:[t(m,{ref:K}),i("div",r({style:{position:"relative",width:600,borderRadius:12,backgroundColor:"white",padding:24,boxShadow:"0 25px 50px -12px rgba(0,0,0,0.25)"}},{children:[i("div",r({style:{marginBottom:24,display:"flex",alignItems:"flex-start",justifyContent:"space-between"}},{children:[i("div",{children:[t("h2",r({style:{margin:0,fontSize:18,fontWeight:500,color:"#19213D"}},{children:A("".concat(R,".title"),"Add Scope")})),t("p",r({style:{margin:"4px 0 0 0",fontSize:14,fontWeight:400,color:"#666F8D"}},{children:A("".concat(R,".subtitle"),"This scope will be created under Global scope and will inherit its learnings by default.",{parent:"Global"})}))]}),t("button",r({onClick:j,style:{background:"none",border:"none",padding:0,cursor:"pointer",color:"#9CA3AF"}},{children:t(u,{size:24})}))]})),i("div",r({style:{display:"flex",flexDirection:"column",gap:20}},{children:[i("div",r({style:{position:"relative",display:"flex",flexDirection:"column",gap:6}},{children:[i("label",r({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:[t("span",r({style:{marginRight:4,fontSize:16,fontWeight:600,color:"#8F2C23"}},{children:"*"})),A("".concat(R,".scopeName"),"Scope Name")]})),"Custom"===B?t(h,{value:G,onChange:function(e){if(e.length>50)return M(e.slice(0,50)),void O(function(e){return r(r({},e),{name:"Scope Name must be 50 characters or fewer"})});M(e),O(function(e){return r(r({},e),{name:void 0})})},onStationSelect:function(e){X(e)},style:{border:T.name?"1px solid #8F2C23":void 0}}):t(y,{value:G,onChange:function(e){var o=e.target.value;if(o.length>50)return M(o.slice(0,50)),void O(function(e){return r(r({},e),{name:"Scope Name must be 50 characters or fewer"})});M(o),O(function(e){return r(r({},e),{name:void 0})})},style:{border:"1px solid ".concat(T.name?"#8F2C23":"#F0F2F5")},placeholder:"e.g. Global Learnings"}),T.name&&t("p",r({style:{margin:"4px 0 0 0",fontSize:12,color:"#8F2C23"}},{children:T.name}))]})),i("div",r({style:{display:"flex",flexDirection:"column",gap:12}},{children:[i("label",r({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:[t("span",r({style:{marginRight:4,fontSize:16,fontWeight:600,color:"#8F2C23"}},{children:"*"})),A("".concat(I,".title"),"Learning Approval Settings")]})),i("div",r({role:"radio","aria-checked":"approval_required"===Z,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:4},onClick:function(){return $("approval_required")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||$("approval_required")}},{children:[i("div",r({style:{display:"flex",alignItems:"center",gap:8}},{children:[t("div",r({style:{display:"flex",height:16,width:16,flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("approval_required"===Z?"#2563EB":"#CBD5E1")}},{children:"approval_required"===Z&&t("div",{style:{height:8,width:8,borderRadius:"50%",backgroundColor:"#2563EB"}})})),t("span",r({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:A("".concat(I,".approvalRequired.title"),"Approval Required Before Publishing")}))]})),t("p",r({style:{margin:0,marginLeft:24,fontSize:12,color:"#666F8D"}},{children:A("".concat(I,".approvalRequired.subtitle"),"Learnings require approval before publishing.")}))]})),"approval_required"===Z&&t(g,{selectedApprovers:oe,selectedGroupOfApprovers:te,onApproversChange:re,onGroupsChange:ie}),ae&&t("p",r({style:{margin:0,marginLeft:24,fontSize:12,color:"#8F2C23"}},{children:ae})),i("div",r({role:"radio","aria-checked":"publish_without"===Z,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:4},onClick:function(){$("publish_without"),ce("")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||($("publish_without"),ce(""))}},{children:[i("div",r({style:{display:"flex",alignItems:"center",gap:8}},{children:[t("div",r({style:{display:"flex",height:16,width:16,flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("publish_without"===Z?"#2563EB":"#CBD5E1")}},{children:"publish_without"===Z&&t("div",{style:{height:8,width:8,borderRadius:"50%",backgroundColor:"#2563EB"}})})),t("span",r({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:A("".concat(I,".publishWithoutApproval.title"),"Publish Without Approval")}))]})),t("p",r({style:{margin:0,marginLeft:24,fontSize:12,color:"#666F8D"}},{children:A("".concat(I,".publishWithoutApproval.subtitle"),"Learnings can be published directly.")}))]}))]})),i("div",r({style:{marginTop:32,display:"flex",justifyContent:"flex-end",gap:12}},{children:[t("button",r({onClick:j,style:{borderRadius:6,border:"1px solid #E2E8F0",padding:"8px 16px",fontSize:14,fontWeight:500,color:"#64748B",backgroundColor:"white",cursor:"pointer",opacity:de?.5:1},disabled:de},{children:A("".concat(R,".cancel"),"Cancel")})),t("button",r({onClick:function(){return e(void 0,void 0,void 0,function(){var e,r,t,i,l,a,c,s,d,u,p,m,h,g,v,y,b,S,C,x;return o(this,function(o){switch(o.label){case 0:if(e={},G.trim()?G.length>50&&(e.name="Scope Name must be 50 characters or fewer"):e.name="Scope Name is required","approval_required"===Z&&0===oe.length&&0===te.length&&ce("Please select at least one approver or approver group."),e.name)return O(e),[2];if("approval_required"===Z&&0===oe.length&&0===te.length)return[2];ce(""),o.label=1;case 1:return o.trys.push([1,7,,8]),r="approval_required"===Z,t=w.getState().backwardCompatibility,i=t?{topic:z?"genreRuleSet":"globalRuleSet",customScopeGroupName:k.CUSTOM_SCOPE_GROUP_NAME,scopeDescription:G,parentScopeId:null,customScopeName:G,customScopeId:f(),createByName:(null==U?void 0:U.firstname)||"System",createdBy:(null==U?void 0:U.email)||"system@audacy.com",approvalRequired:r,appsecData:{application:null==J?void 0:J.applicationId,module:null==J?void 0:J.moduleId,roles:n(n([],r?[{users:oe.map(function(e){return e.email}),groups:te.map(function(e){return e._id}),role:null!==(u=null===(d=H.find(function(e){return"Learning Manager"===e.name}))||void 0===d?void 0:d._id)&&void 0!==u?u:""}]:[],!0),[{users:[null==U?void 0:U.email],groups:[],role:null!==(m=null===(p=H.find(function(e){return"Instant Learning Admin"===e.name}))||void 0===p?void 0:p._id)&&void 0!==m?m:""}],!1)}}:{topic:z?"genreRuleSet":"globalRuleSet",scope_reference_id:null,scopeDescription:G,parentScopeId:null!=L?L:null,scopeName:G,scopeReferenceMetadata:{},scopeType:"Custom",applicationMappingId:w.getState().app_integration_id,approvalRequired:r,appsecData:{application:null==J?void 0:J.applicationId,module:null==J?void 0:J.moduleId,roles:n(n([],r?[{users:oe.map(function(e){return e.email}),groups:te.map(function(e){return e._id}),role:null!==(g=null===(h=H.find(function(e){return"Learning Manager"===e.name}))||void 0===h?void 0:h._id)&&void 0!==g?g:""}]:[],!0),[{users:[null==U?void 0:U.email],groups:[],role:null!==(y=null===(v=H.find(function(e){return"Instant Learning Admin"===e.name}))||void 0===v?void 0:v._id)&&void 0!==y?y:""}],!1)}},console.log("Add Scope payload:",i),[4,ue(i)];case 2:if(l=o.sent(),a=null===(b=null==l?void 0:l.data)||void 0===b?void 0:b.scopeId,t||!a||!L)return[3,6];o.label=3;case 3:return o.trys.push([3,5,,6]),[4,_({source_scope_id:L,target_scope_id:a,application_mapping_id:w.getState().app_integration_id||"",is_copy_parent_variant_id:!1})];case 4:return o.sent(),[3,6];case 5:return c=o.sent(),console.error("Failed to inherit rules for the new scope:",c),[3,6];case 6:return F(a),j(),[3,8];case 7:return s=o.sent(),console.error("An error occurred during scope creation.",s),null===(S=K.current)||void 0===S||S.show({severity:"error",summary:"Adding Scope Failed",detail:(null===(x=null===(C=null==s?void 0:s.response)||void 0===C?void 0:C.data)||void 0===x?void 0:x.message)||"There was an error creating the scope. Please try again."}),[3,8];case 8:return[2]}})})},style:{display:"flex",alignItems:"center",borderRadius:6,backgroundColor:"#2563EB",padding:"8px 16px",fontSize:14,fontWeight:500,color:"white",border:"none",cursor:"pointer",opacity:de||"Custom"===B&&!V?.5:1},disabled:de||"Custom"===B&&!V},{children:de?i(l,{children:[t(p,{className:"animate-spin",style:{marginRight:8,height:16,width:16,color:"white"}}),"Creating..."]}):A("".concat(R,".submitButton"),"Create Scope")}))]}))]}))]}))]})):null};export{D as default};
|
|
1
|
+
import{__awaiter as e,__generator as o,__assign as r,__spreadArray as n}from"tslib";import{jsx as t,jsxs as i,Fragment as l}from"react/jsx-runtime";import{useState as a,useRef as s,useEffect as c}from"react";import{useMutation as d}from"@tanstack/react-query";import{X as u,Loader2 as p}from"lucide-react";import{Toast as m}from"primereact/toast";import{v4 as f}from"uuid";import h from"../components/StationOnboarding/StationAutocomplete.js";import g from"./AddScopeApprovalSearchComponent.js";import v from"../components/ScopeSkeletonLoader.js";import{Input as b}from"@mui/material";import y from"../store/useAuthStore.js";import{useAppSecRolesStore as S}from"../store/useAppSecRolesStore.js";import C from"../store/useEnvStore.js";import{createRuleSet as x,inheritScope as _}from"../apis/scopeApis.js";import{useLearningTemplateStore as w}from"../store/useLearningTemplateStore.js";import{IL_CONFIG_CONSTANTS as k}from"../config.js";import{dt as A}from"../store/useLMSConfigStore.js";import{MIDDLE_DRAWER_ADD_SCOPE_DT_PATH as R,MIDDLE_DRAWER_APPROVAL_SETTINGS_DT_PATH as I}from"../constants.js";var D=function(D){var q=D.isOpen,j=D.onClose,F=D.onCreate,z=D.hasGlobalRuleSet,L=D.parentId,E=a(""),B=E[0],W=E[1],N=a(""),G=N[0],T=N[1],M=a({}),P=M[0],O=M[1],K=s(null),U=y().user,H=S(function(e){return e.roles}),J=C(function(e){return e.rbacConfig}),Q=a(null),V=Q[0],X=Q[1],Y=a("approval_required"),Z=Y[0],$=Y[1],ee=a([]),oe=ee[0],re=ee[1],ne=a([]),te=ne[0],ie=ne[1],le=a(""),ae=le[0],se=le[1],ce=d({mutationFn:function(r){return e(void 0,void 0,void 0,function(){var e;return o(this,function(o){switch(o.label){case 0:return[4,x(r,null!==(e=null==U?void 0:U.accessToken)&&void 0!==e?e:"")];case 1:return[2,o.sent()]}})})},onSuccess:function(r){return e(void 0,void 0,void 0,function(){return o(this,function(e){return console.log("Rule Set Created Successfully",r),[2]})})}});ce.data;var de=ce.isPending,ue=ce.mutateAsync;return c(function(){q&&(W(""),T(""),O({}),X(null),$("approval_required"),re([]),ie([]),se(""))},[q]),q?de?t(v,{isLoading:de}):i("div",r({style:{position:"absolute",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0,0,0,0.3)"}},{children:[t(m,{ref:K}),i("div",r({style:{position:"relative",width:600,borderRadius:12,backgroundColor:"white",padding:24,boxShadow:"0 25px 50px -12px rgba(0,0,0,0.25)"}},{children:[i("div",r({style:{marginBottom:24,display:"flex",alignItems:"flex-start",justifyContent:"space-between"}},{children:[i("div",{children:[t("h2",r({style:{margin:0,fontSize:18,fontWeight:500,color:"#19213D"}},{children:z?A("".concat(R,".title"),"Add Scope"):A("".concat(R,".globalTitle"),"Create Global Scope")})),t("p",r({style:{margin:"4px 0 0 0",fontSize:14,fontWeight:400,color:"#666F8D"}},{children:z?A("".concat(R,".subtitle"),"This scope will be created under Global scope and will inherit its learnings by default.",{parent:"Global"}):A("".concat(R,".globalSubtitle"),"This will be your Global scope that defines the base learnings shared across all stations.")}))]}),t("button",r({onClick:j,style:{background:"none",border:"none",padding:0,cursor:"pointer",color:"#9CA3AF"}},{children:t(u,{size:24})}))]})),i("div",r({style:{display:"flex",flexDirection:"column",gap:20}},{children:[i("div",r({style:{position:"relative",display:"flex",flexDirection:"column",gap:6}},{children:[i("label",r({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:[t("span",r({style:{marginRight:4,fontSize:16,fontWeight:600,color:"#8F2C23"}},{children:"*"})),A("".concat(R,".scopeName"),"Scope Name")]})),"Custom"===B?t(h,{value:G,onChange:function(e){if(e.length>50)return T(e.slice(0,50)),void O(function(e){return r(r({},e),{name:"Scope Name must be 50 characters or fewer"})});T(e),O(function(e){return r(r({},e),{name:void 0})})},onStationSelect:function(e){X(e)},style:{border:P.name?"1px solid #8F2C23":void 0}}):t(b,{value:G,onChange:function(e){var o=e.target.value;if(o.length>50)return T(o.slice(0,50)),void O(function(e){return r(r({},e),{name:"Scope Name must be 50 characters or fewer"})});T(o),O(function(e){return r(r({},e),{name:void 0})})},style:{border:"1px solid ".concat(P.name?"#8F2C23":"#F0F2F5")},placeholder:"e.g. Global Learnings"}),P.name&&t("p",r({style:{margin:"4px 0 0 0",fontSize:12,color:"#8F2C23"}},{children:P.name}))]})),i("div",r({style:{display:"flex",flexDirection:"column",gap:12}},{children:[i("label",r({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:[t("span",r({style:{marginRight:4,fontSize:16,fontWeight:600,color:"#8F2C23"}},{children:"*"})),A("".concat(I,".title"),"Learning Approval Settings")]})),i("div",r({role:"radio","aria-checked":"approval_required"===Z,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:4},onClick:function(){return $("approval_required")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||$("approval_required")}},{children:[i("div",r({style:{display:"flex",alignItems:"center",gap:8}},{children:[t("div",r({style:{display:"flex",height:16,width:16,flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("approval_required"===Z?"#2563EB":"#CBD5E1")}},{children:"approval_required"===Z&&t("div",{style:{height:8,width:8,borderRadius:"50%",backgroundColor:"#2563EB"}})})),t("span",r({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:A("".concat(I,".approvalRequired.title"),"Approval Required Before Publishing")}))]})),t("p",r({style:{margin:0,marginLeft:24,fontSize:12,color:"#666F8D"}},{children:A("".concat(I,".approvalRequired.subtitle"),"Learnings require approval before publishing.")}))]})),"approval_required"===Z&&t(g,{selectedApprovers:oe,selectedGroupOfApprovers:te,onApproversChange:re,onGroupsChange:ie}),ae&&t("p",r({style:{margin:0,marginLeft:24,fontSize:12,color:"#8F2C23"}},{children:ae})),i("div",r({role:"radio","aria-checked":"publish_without"===Z,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:4},onClick:function(){$("publish_without"),se("")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||($("publish_without"),se(""))}},{children:[i("div",r({style:{display:"flex",alignItems:"center",gap:8}},{children:[t("div",r({style:{display:"flex",height:16,width:16,flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("publish_without"===Z?"#2563EB":"#CBD5E1")}},{children:"publish_without"===Z&&t("div",{style:{height:8,width:8,borderRadius:"50%",backgroundColor:"#2563EB"}})})),t("span",r({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:A("".concat(I,".publishWithoutApproval.title"),"Publish Without Approval")}))]})),t("p",r({style:{margin:0,marginLeft:24,fontSize:12,color:"#666F8D"}},{children:A("".concat(I,".publishWithoutApproval.subtitle"),"Learnings can be published directly.")}))]}))]})),i("div",r({style:{marginTop:32,display:"flex",justifyContent:"flex-end",gap:12}},{children:[t("button",r({onClick:j,style:{borderRadius:6,border:"1px solid #E2E8F0",padding:"8px 16px",fontSize:14,fontWeight:500,color:"#64748B",backgroundColor:"white",cursor:"pointer",opacity:de?.5:1},disabled:de},{children:A("".concat(R,".cancel"),"Cancel")})),t("button",r({onClick:function(){return e(void 0,void 0,void 0,function(){var e,r,t,i,l,a,s,c,d,u,p,m,h,g,v,b,y,S,C,x;return o(this,function(o){switch(o.label){case 0:if(e={},G.trim()?G.length>50&&(e.name="Scope Name must be 50 characters or fewer"):e.name="Scope Name is required","approval_required"===Z&&0===oe.length&&0===te.length&&se("Please select at least one approver or approver group."),e.name)return O(e),[2];if("approval_required"===Z&&0===oe.length&&0===te.length)return[2];se(""),o.label=1;case 1:return o.trys.push([1,7,,8]),r="approval_required"===Z,t=w.getState().backwardCompatibility,i=t?{topic:z?"genreRuleSet":"globalRuleSet",customScopeGroupName:k.CUSTOM_SCOPE_GROUP_NAME,scopeDescription:G,parentScopeId:null,customScopeName:G,customScopeId:f(),createByName:(null==U?void 0:U.firstname)||"System",createdBy:(null==U?void 0:U.email)||"system@audacy.com",approvalRequired:r,appsecData:{application:null==J?void 0:J.applicationId,module:null==J?void 0:J.moduleId,roles:n(n([],r?[{users:oe.map(function(e){return e.email}),groups:te.map(function(e){return e._id}),role:null!==(u=null===(d=H.find(function(e){return"Learning Manager"===e.name}))||void 0===d?void 0:d._id)&&void 0!==u?u:""}]:[],!0),[{users:[null==U?void 0:U.email],groups:[],role:null!==(m=null===(p=H.find(function(e){return"Instant Learning Admin"===e.name}))||void 0===p?void 0:p._id)&&void 0!==m?m:""}],!1)}}:{topic:z?"genreRuleSet":"globalRuleSet",scope_reference_id:null,scopeDescription:G,parentScopeId:null!=L?L:null,scopeName:G,scopeReferenceMetadata:{},scopeType:"Custom",applicationMappingId:w.getState().app_integration_id,approvalRequired:r,appsecData:{application:null==J?void 0:J.applicationId,module:null==J?void 0:J.moduleId,roles:n(n([],r?[{users:oe.map(function(e){return e.email}),groups:te.map(function(e){return e._id}),role:null!==(g=null===(h=H.find(function(e){return"Learning Manager"===e.name}))||void 0===h?void 0:h._id)&&void 0!==g?g:""}]:[],!0),[{users:[null==U?void 0:U.email],groups:[],role:null!==(b=null===(v=H.find(function(e){return"Instant Learning Admin"===e.name}))||void 0===v?void 0:v._id)&&void 0!==b?b:""}],!1)}},console.log("Add Scope payload:",i),[4,ue(i)];case 2:if(l=o.sent(),a=null===(y=null==l?void 0:l.data)||void 0===y?void 0:y.scopeId,t||!a||!L)return[3,6];o.label=3;case 3:return o.trys.push([3,5,,6]),[4,_({source_scope_id:L,target_scope_id:a,application_mapping_id:w.getState().app_integration_id||"",is_copy_parent_variant_id:!1})];case 4:return o.sent(),[3,6];case 5:return s=o.sent(),console.error("Failed to inherit rules for the new scope:",s),[3,6];case 6:return F(a),j(),[3,8];case 7:return c=o.sent(),console.error("An error occurred during scope creation.",c),null===(S=K.current)||void 0===S||S.show({severity:"error",summary:"Adding Scope Failed",detail:(null===(x=null===(C=null==c?void 0:c.response)||void 0===C?void 0:C.data)||void 0===x?void 0:x.message)||"There was an error creating the scope. Please try again."}),[3,8];case 8:return[2]}})})},style:{display:"flex",alignItems:"center",borderRadius:6,backgroundColor:"#2563EB",padding:"8px 16px",fontSize:14,fontWeight:500,color:"white",border:"none",cursor:"pointer",opacity:de||"Custom"===B&&!V?.5:1},disabled:de||"Custom"===B&&!V},{children:de?i(l,{children:[t(p,{className:"animate-spin",style:{marginRight:8,height:16,width:16,color:"white"}}),"Creating..."]}):A("".concat(R,".submitButton"),"Create Scope")}))]}))]}))]}))]})):null};export{D as default};
|
|
2
2
|
//# sourceMappingURL=AddScopeModal.js.map
|