@e-llm-studio/instant-learning 1.3.0-alpha.162 → 1.3.0-alpha.165
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/README.md +5 -3
- package/dist/ContinueWithTemplateModal.js +1 -1
- package/dist/ILMarketplaceWrapper.js +1 -1
- package/dist/ILMarketplaceWrapper.module.css.js +1 -1
- package/dist/cjs/ContinueWithTemplateModal.js +1 -1
- package/dist/cjs/ILMarketplaceWrapper.js +1 -1
- package/dist/cjs/ILMarketplaceWrapper.module.css.js +1 -1
- package/dist/cjs/features/IL-marketplace/components/GuidelineLibrary.js +1 -1
- package/dist/cjs/features/IL-marketplace/components/GuidelineLibraryCard.js +1 -1
- package/dist/cjs/features/IL-marketplace/constants.js +1 -1
- package/dist/cjs/features/LSCGuidelinesCart/Cart/Cart.js +2 -0
- package/dist/cjs/features/LSCGuidelinesCart/Cart/Cart.js.map +1 -0
- package/dist/cjs/features/LSCGuidelinesCart/Cart/Cart.styles.js +2 -0
- package/dist/cjs/features/LSCGuidelinesCart/Cart/Cart.styles.js.map +1 -0
- package/dist/cjs/features/LSCGuidelinesCart/GuidelineCard.js +2 -0
- package/dist/cjs/features/LSCGuidelinesCart/GuidelineCard.js.map +1 -0
- package/dist/cjs/features/LSCGuidelinesCart/GuidelineCard.styles.js +2 -0
- package/dist/cjs/features/LSCGuidelinesCart/GuidelineCard.styles.js.map +1 -0
- package/dist/cjs/features/LSCGuidelinesCart/GuidelinesLandingPage.js +2 -0
- package/dist/cjs/features/LSCGuidelinesCart/GuidelinesLandingPage.js.map +1 -0
- package/dist/cjs/features/LSCGuidelinesCart/GuidelinesLandingPage.styles.js +2 -0
- package/dist/cjs/features/LSCGuidelinesCart/GuidelinesLandingPage.styles.js.map +1 -0
- package/dist/cjs/features/LSCGuidelinesCart/LearningManagementWrapper.js +2 -0
- package/dist/cjs/features/LSCGuidelinesCart/LearningManagementWrapper.js.map +1 -0
- package/dist/cjs/features/LSCGuidelinesCart/api.js +2 -0
- package/dist/cjs/features/LSCGuidelinesCart/api.js.map +1 -0
- package/dist/cjs/features/LSCGuidelinesCart/endpoints.js +2 -0
- package/dist/cjs/features/LSCGuidelinesCart/endpoints.js.map +1 -0
- package/dist/cjs/features/LSCGuidelinesCart/transformSelectedGuidelineData.js +2 -0
- package/dist/cjs/features/LSCGuidelinesCart/transformSelectedGuidelineData.js.map +1 -0
- 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/CreateLearningSetModal.js +2 -0
- package/dist/cjs/features/LearningManagement/components/CreateLearningSetModal.js.map +1 -0
- package/dist/cjs/features/LearningManagement/components/ScopeSkeletonLoader.js +1 -1
- package/dist/cjs/features/LearningManagement/store/useLMSConfigStore.js +1 -1
- package/dist/cjs/features/LearningManagement/styles/CreateLearningSetModal.module.css.js +2 -0
- package/dist/cjs/features/LearningManagement/styles/CreateLearningSetModal.module.css.js.map +1 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/schema-driven/utils/PayloadUtils.js +1 -1
- package/dist/features/IL-marketplace/components/GuidelineLibrary.js +1 -1
- package/dist/features/IL-marketplace/components/GuidelineLibraryCard.js +1 -1
- package/dist/features/IL-marketplace/constants.js +1 -1
- package/dist/features/LSCGuidelinesCart/Cart/Cart.js +2 -0
- package/dist/features/LSCGuidelinesCart/Cart/Cart.js.map +1 -0
- package/dist/features/LSCGuidelinesCart/Cart/Cart.styles.js +2 -0
- package/dist/features/LSCGuidelinesCart/Cart/Cart.styles.js.map +1 -0
- package/dist/features/LSCGuidelinesCart/GuidelineCard.js +2 -0
- package/dist/features/LSCGuidelinesCart/GuidelineCard.js.map +1 -0
- package/dist/features/LSCGuidelinesCart/GuidelineCard.styles.js +2 -0
- package/dist/features/LSCGuidelinesCart/GuidelineCard.styles.js.map +1 -0
- package/dist/features/LSCGuidelinesCart/GuidelinesLandingPage.js +2 -0
- package/dist/features/LSCGuidelinesCart/GuidelinesLandingPage.js.map +1 -0
- package/dist/features/LSCGuidelinesCart/GuidelinesLandingPage.styles.js +2 -0
- package/dist/features/LSCGuidelinesCart/GuidelinesLandingPage.styles.js.map +1 -0
- package/dist/features/LSCGuidelinesCart/LearningManagementWrapper.js +2 -0
- package/dist/features/LSCGuidelinesCart/LearningManagementWrapper.js.map +1 -0
- package/dist/features/LSCGuidelinesCart/api.js +2 -0
- package/dist/features/LSCGuidelinesCart/api.js.map +1 -0
- package/dist/features/LSCGuidelinesCart/endpoints.js +2 -0
- package/dist/features/LSCGuidelinesCart/endpoints.js.map +1 -0
- package/dist/features/LSCGuidelinesCart/transformSelectedGuidelineData.js +2 -0
- package/dist/features/LSCGuidelinesCart/transformSelectedGuidelineData.js.map +1 -0
- package/dist/features/LearningManagement/LearningManagement.js +1 -1
- package/dist/features/LearningManagement/RuleContent/AddScopeModal.js +1 -1
- package/dist/features/LearningManagement/components/CreateLearningSetModal.js +2 -0
- package/dist/features/LearningManagement/components/CreateLearningSetModal.js.map +1 -0
- package/dist/features/LearningManagement/components/ScopeSkeletonLoader.js +1 -1
- package/dist/features/LearningManagement/store/useLMSConfigStore.js +1 -1
- package/dist/features/LearningManagement/styles/CreateLearningSetModal.module.css.js +2 -0
- package/dist/features/LearningManagement/styles/CreateLearningSetModal.module.css.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/schema-driven/utils/PayloadUtils.js +1 -1
- package/dist/types/src/ContinueWithTemplateModal.d.ts +8 -1
- package/dist/types/src/ContinueWithTemplateModal.d.ts.map +1 -1
- package/dist/types/src/ILMarketplaceWrapper.d.ts +7 -1
- package/dist/types/src/ILMarketplaceWrapper.d.ts.map +1 -1
- package/dist/types/src/features/IL-OTJ/ValueTypeWrappers/TeachMePlugin.d.ts +6 -1
- package/dist/types/src/features/IL-OTJ/ValueTypeWrappers/TeachMePlugin.d.ts.map +1 -1
- package/dist/types/src/features/IL-marketplace/components/GuidelineLibrary.d.ts +4 -2
- package/dist/types/src/features/IL-marketplace/components/GuidelineLibrary.d.ts.map +1 -1
- package/dist/types/src/features/IL-marketplace/components/GuidelineLibraryCard.d.ts +4 -2
- package/dist/types/src/features/IL-marketplace/components/GuidelineLibraryCard.d.ts.map +1 -1
- package/dist/types/src/features/IL-marketplace/constants.d.ts +4 -0
- package/dist/types/src/features/IL-marketplace/constants.d.ts.map +1 -1
- package/dist/types/src/features/IL-marketplace/types.d.ts +13 -0
- package/dist/types/src/features/IL-marketplace/types.d.ts.map +1 -1
- package/dist/types/src/features/LSCGuidelinesCart/Cart/Cart.d.ts +10 -0
- package/dist/types/src/features/LSCGuidelinesCart/Cart/Cart.d.ts.map +1 -0
- package/dist/types/src/features/LSCGuidelinesCart/Cart/Cart.styles.d.ts +6 -0
- package/dist/types/src/features/LSCGuidelinesCart/Cart/Cart.styles.d.ts.map +1 -0
- package/dist/types/src/features/LSCGuidelinesCart/GuidelineCard.d.ts +11 -0
- package/dist/types/src/features/LSCGuidelinesCart/GuidelineCard.d.ts.map +1 -0
- package/dist/types/src/features/LSCGuidelinesCart/GuidelineCard.styles.d.ts +6 -0
- package/dist/types/src/features/LSCGuidelinesCart/GuidelineCard.styles.d.ts.map +1 -0
- package/dist/types/src/features/LSCGuidelinesCart/GuidelinesLandingPage.d.ts +16 -0
- package/dist/types/src/features/LSCGuidelinesCart/GuidelinesLandingPage.d.ts.map +1 -0
- package/dist/types/src/features/LSCGuidelinesCart/GuidelinesLandingPage.styles.d.ts +6 -0
- package/dist/types/src/features/LSCGuidelinesCart/GuidelinesLandingPage.styles.d.ts.map +1 -0
- package/dist/types/src/features/LSCGuidelinesCart/LearningManagementWrapper.d.ts +19 -0
- package/dist/types/src/features/LSCGuidelinesCart/LearningManagementWrapper.d.ts.map +1 -0
- package/dist/types/src/features/LSCGuidelinesCart/api.d.ts +4 -0
- package/dist/types/src/features/LSCGuidelinesCart/api.d.ts.map +1 -0
- package/dist/types/src/features/LSCGuidelinesCart/endpoints.d.ts +5 -0
- package/dist/types/src/features/LSCGuidelinesCart/endpoints.d.ts.map +1 -0
- package/dist/types/src/features/LSCGuidelinesCart/interfacesApi.d.ts +25 -0
- package/dist/types/src/features/LSCGuidelinesCart/interfacesApi.d.ts.map +1 -0
- package/dist/types/src/features/LSCGuidelinesCart/transformSelectedGuidelineData.d.ts +18 -0
- package/dist/types/src/features/LSCGuidelinesCart/transformSelectedGuidelineData.d.ts.map +1 -0
- package/dist/types/src/features/LearningManagement/LearningManagement.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/RuleContent/AddScopeModal.d.ts +0 -3
- package/dist/types/src/features/LearningManagement/RuleContent/AddScopeModal.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/components/ScopeSkeletonLoader.d.ts +4 -0
- package/dist/types/src/features/LearningManagement/components/ScopeSkeletonLoader.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/store/useExternalWorkflowStore.d.ts +5 -0
- package/dist/types/src/features/LearningManagement/store/useExternalWorkflowStore.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/dist/types/src/index.d.ts +2 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/schema-driven/utils/PayloadUtils.d.ts.map +1 -1
- 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("../../api/transport.js"),s=require("lucide-react"),a=require("./store/useLearningTemplateStore.js"),i=require("primereact/toast"),o=require("./styles/LearningTemplateManagement.module.css.js"),l=require("./LearningTemplateLayout.js"),u=require("./components/EmptyLearningState.js"),c=require("./store/useAuthStore.js"),d=require("./apis/scopeApis.js"),p=require("./hooks/useLearningTemplateQueryParams.js"),f=require("./components/ConfirmationModal.js"),g=require("./components/LearningTemplateManagementSkeleton.js"),v=require("./utils/treeUtils.js"),_=require("./store/useEnvStore.js"),S=require("./store/useConfigStore.js"),m=require("./components/ToolTip.js"),h=require("./components/CreateRuleSetLegacyModal.js"),T=require("./store/usePermissionsStore.js"),y=require("./store/useAppSecRolesStore.js"),A=require("./queries/useApprovalQueries.js"),C=require("./queries/useLMSConfigQuery.js"),E=require("./RuleContent/AddScopeModal.js"),L=require("./components/RuleContentSkeleton.js"),b=require("./components/ErrorStateDisplay.js"),R=require("react-router-dom"),D=require("./shared/SuccessToastContent.js"),I=require("./shared/ErrorToastContent.js"),j=require("./RuleContent/RenameScopeModal.js"),P=require("./store/useLMSConfigStore.js"),M=require("./constants.js");exports.default=function(q){var w,O,N,x,k,U,B,H,G,Y,F,Q=this,W=q.userDetails,K=q.llmStudioUrl,z=q.audacyBackendUrl,V=q.ilLabels,X=q.config,J=q.rbacConfig,Z=q.auditLogConfig,$=q.app_integration_id,ee=q.backwardCompatibility,te=void 0!==ee&&ee,ne=q.cognitiveCompareCompatibility,re=void 0!==ne&&ne,se=q.modeId,ae=q.modeDetails,ie=q.pluginPayload,oe=q.axiosConfig,le=q.isILMarketplace,ue=q.guidelineContentProps,ce=q.treeOverrides;r.applyAxiosConfig(oe);var de=[{id:"learnings",label:P.dt("".concat(M.MIDDLE_DRAWER_DT_PATH,".treeMenu.submenu.learnings"),"Learnings"),icon:s.BookOpen,badgeKey:"learningsCount"},{id:"access",label:P.dt("".concat(M.MIDDLE_DRAWER_DT_PATH,".treeMenu.submenu.access"),"Access"),icon:s.Users},{id:"history",label:P.dt("".concat(M.MIDDLE_DRAWER_DT_PATH,".treeMenu.submenu.changeHistory"),"Change History"),icon:s.History}],pe=(null==ce?void 0:ce.sectionsConfig)?ce.sectionsConfig.filter(function(e){return de.some(function(t){return t.id===e.id})}):de,fe=new Set(pe.map(function(e){return e.id})),ge=null!==(O=null===(w=pe[0])||void 0===w?void 0:w.id)&&void 0!==O?O:"learnings",ve=p.useRuleTemplateQueryParams().clearLearningParams,_e=a.useLearningTemplateStore(function(e){return e.selectedRuleSetId}),Se=a.useLearningTemplateStore(function(e){return e.setSelectedRuleSetId}),me=a.useLearningTemplateStore(function(e){return e.setIlInstanceId}),he=a.useLearningTemplateStore(function(e){return e.error}),Te=a.useLearningTemplateStore(function(e){return e.setError}),ye=a.useLearningTemplateStore(function(e){return e.setStations}),Ae=a.useLearningTemplateStore(function(e){return e.scopeTreeData}),Ce=a.useLearningTemplateStore(function(e){return e.setScopeTreeData}),Ee=n.useState({isOpen:!1,type:"GLOBAL"}),Le=Ee[0],be=Ee[1],Re=n.useState(!1),De=Re[0],Ie=Re[1],je=n.useState(!1),Pe=je[0],Me=je[1],qe=n.useState(ge),we=qe[0],Oe=qe[1],Ne=n.useState(null),xe=Ne[0],ke=Ne[1],Ue=n.useState(!1),Be=Ue[0],He=Ue[1],Ge=n.useState(null),Ye=Ge[0];Ge[1];var Fe=n.useState(!1),Qe=Fe[0],We=Fe[1],Ke=n.useState(!1),ze=Ke[0],Ve=Ke[1];n.useRef(null);var Xe=n.useRef(null),Je=n.useRef(!1),Ze=n.useRef(null),$e=c.default();$e.user;var et=$e.setUser,tt=S.useConfigStore(),nt=tt.setConfig,rt=tt.setIlLabels,st=function(){try{return R.useLocation()}catch(e){return{search:""}}}(),at=function(){try{return R.useSearchParams()[1]}catch(e){return null}}(),it=n.useCallback(function(e){if(at){var t=new URLSearchParams(window.location.search);Object.entries(e).forEach(function(e){var n=e[0],r=e[1];null==r||""===r?t.delete(n):t.set(n,r)}),at(t,{replace:!0})}else p.setQueryParams(e)},[at]);n.useEffect(function(){if(!Je.current){var e=new URLSearchParams(window.location.search),t=e.get(p.QUERY_PARAM_KEYS.RULESET_ID),n=e.get(p.QUERY_PARAM_KEYS.SECTION),r=n&&(null==fe?void 0:fe.has(n))?n:ge;(null==t?void 0:t.length)&&Se&&Oe&&(Se(t),Oe(r),Je.current=!0)}},[null==st?void 0:st.search,Oe,Se]),n.useEffect(function(){return function(){ve()}},[ve]),n.useEffect(function(){var e;_e&&it(((e={})[p.QUERY_PARAM_KEYS.RULESET_ID]=_e,e))},[_e,it]),n.useEffect(function(){var t;(null==ie?void 0:ie.learningManagement)&&P.useLMSConfigStore.getState().setLMSConfig(e.__assign(e.__assign({},ie.learningManagement),{agents:null!==(t=ie.agents)&&void 0!==t?t:{}}))},[ie]);var ot=T.usePermissionsStore(function(e){return e.fetchPermissions}),lt=T.usePermissionsStore(function(e){return e.hasPermission}),ut=y.useAppSecRolesStore(function(e){return e.setRoles}),ct=_.default(function(e){return e.appsecRbacUrl})===J.appsecRbacUrl,dt=A.useGetAppSecRolesQuery(J.applicationId,ct).data,pt=C.useLMSConfigQuery(null!=$?$:"",te),ft=pt.isLoading,gt=pt.isError,vt=pt.refetch;pt.isSuccess;var _t=n.useState(0),St=_t[0],mt=_t[1];n.useEffect(function(){if(!te&&$&&K){e.__awaiter(Q,void 0,void 0,function(){var t,n,r,s,a,i,o;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,d.getILInstance($)];case 1:return t=e.sent(),(null===(s=null==t?void 0:t.data)||void 0===s?void 0:s.ILInstanceId)&&me(t.data.ILInstanceId),"number"==typeof(n=null===(o=null===(i=null===(a=null==t?void 0:t.data)||void 0===a?void 0:a.learningManagement)||void 0===i?void 0:i.scopeAndHierarchy)||void 0===o?void 0:o.maxHierarchyLevels)&&n>0&&mt(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]}})})}},[$,K]),n.useEffect(function(){dt&&ut(dt.map(function(e){return{_id:e._id,name:e.name}}))},[dt,ut]),n.useEffect(function(){var e;console.log("userDetails",W),et(W),console.log("llmStudioUrl",K),console.log("audacyBackendUrl",z),_.default.getState().setLlmStudioUrl(K),_.default.getState().setAudacyBackendUrl(z),_.default.getState().setRbacConfig(J),_.default.getState().setAuditLogConfig(Z),_.default.getState().setBaseModeName((null==ae?void 0:ae.modeNameFromURL)||null),nt(X),rt(V),a.useLearningTemplateStore.getState().setAppIntegrationId(null!=$?$:null),a.useLearningTemplateStore.getState().setBackwardCompatibility(te),a.useLearningTemplateStore.getState().setCognitiveCompareCompatibility(null!=re&&re),a.useLearningTemplateStore.getState().setToken(null!==(e=null==W?void 0:W.accessToken)&&void 0!==e?e:null)},[W,et,K,z,J,Z,X,nt,V,rt,$,te,re,ae]),n.useEffect(function(){(null==W?void 0:W.accessToken)&&K&&(le||d.fetchTiers())},[$,null==W?void 0:W.accessToken,K,le]);var ht=function(t){return void 0===t&&(t=!0),e.__awaiter(Q,void 0,void 0,function(){var n,r,s,i,o,l,u,c,p,f,g,_;return e.__generator(this,function(S){switch(S.label){case 0:t&&Ie(!0),Te(null),S.label=1;case 1:return S.trys.push([1,7,8,9]),[4,ot(J.applicationId)];case 2:S.sent(),n=function(t){var r=T.usePermissionsStore.getState().hasPermission("ilotj.scope.view",t.id),s=t.children?t.children.map(function(e){return n(e)}).filter(function(e){return null!==e}):[];return r||0!==s.length?e.__assign(e.__assign({},t),{hasAccess:r,children:s}):null},r=void 0,S.label=3;case 3:return S.trys.push([3,5,,6]),[4,d.fetchScopes($,W.accessToken)];case 4:return r=S.sent(),[3,6];case 5:if(s=S.sent(),403===(null===(g=null==s?void 0:s.response)||void 0===g?void 0:g.status))return Ce(null),ke(J.applicationResourceId||null),He(!0),[2];throw s;case 6:return r&&r.data&&r.data.data&&(i=r.data.data,Array.isArray(i)&&(i=i.length>0?i[0]:null),i?(o=n(i))?(ke(null),He(!1),Ce({data:o}),Xe.current?(Se(Xe.current),Oe(ge),Xe.current=null):(l=a.useLearningTemplateStore.getState().selectedRuleSetId,u=l?v.findNodeById(o,l):null,l&&u||(c=function(e){if(e.hasAccess)return e;for(var t=0,n=e.children||[];t<n.length;t++){var r=n[t],s=c(r);if(s)return s}return null},p=c(o),Se(p?p.id:o.id)))):(ke(null!==(_=i.id)&&void 0!==_?_:null),He(!1),Ce(null)):(ke(null),He(!1),Ce(null))),[3,9];case 7:return f=S.sent(),console.error("Failed to fetch rule sets or permissions",f),Te("Failed to load data. Please try again later."),[3,9];case 8:return Ie(!1),[7];case 9:return[2]}})})};n.useEffect(function(){var e;(null===(e=null==W?void 0:W.accessToken)||void 0===e?void 0:e.length)&&ct?ht(!0):console.warn("Error: Trying to fetch rules without access token",W)},[null==W?void 0:W.accessToken,Te,ye,J.applicationId,ct]);var Tt=function(t,n,r){return e.__awaiter(Q,void 0,void 0,function(){var n,r,s,i,o,l,u,c;return e.__generator(this,function(p){switch(p.label){case 0:Me(!0),p.label=1;case 1:return p.trys.push([1,4,5,6]),[4,d.deleteRuleSet(t,W.accessToken)];case 2:return p.sent(),a.useLearningTemplateStore.getState().selectedRuleSetId===t&&(n=a.useLearningTemplateStore.getState().scopeTreeData,(r=v.findNodePathById((null==n?void 0:n.data)||null,t))&&r.length>1&&(s=r[r.length-2],Se(s),Oe(ge))),[4,ht(!0)];case 3:return p.sent(),be(function(t){return e.__assign(e.__assign({},t),{isOpen:!1})}),null===(o=Ze.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=Ze.current)||void 0===l||l.show({severity:"error",summary:"Delete Failed",detail:(null===(c=null===(u=null==i?void 0:i.response)||void 0===u?void 0:u.data)||void 0===c?void 0:c.message)||"There was an error deleting the scope. Please try again."}),[3,6];case 5:return Me(!1),[7];case 6:return[2]}})})},yt=Ae,At=Ye?{data:{id:Ye.stationId,name:Ye.stationName,type:"STATION",metrics:{learningsCount:Ye.learningsCount,stationsCount:0},children:[]}}:yt,Ct=!!(null==At?void 0:At.data);null===(N=null==At?void 0:At.data)||void 0===N||N.type;var Et=T.usePermissionsStore(function(e){return e.hasGlobalPermission})("ilotj.scope.global.create",J.applicationResourceId||""),Lt=function(n){return e.__awaiter(Q,void 0,void 0,function(){var r,s,i,l,u,c,p,f,g,v;return e.__generator(this,function(e){switch(e.label){case 0:if(!(r="string"==typeof n?n:(null===(c=null===(u=a.useLearningTemplateStore.getState().scopeTreeData)||void 0===u?void 0:u.data)||void 0===c?void 0:c.id)||xe)&&!Be)return null===(p=Ze.current)||void 0===p||p.show({severity:"error",sticky:!1,className:o.default.errorToast,content:t.jsx(I.default,{message:"Unable to identify the global scope for this access request."})}),[2];We(!0),e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,d.requestAccess(r,Be)];case 2:return e.sent(),Ve(!0),null===(f=Ze.current)||void 0===f||f.show({severity:"success",sticky:!1,life:3e3,className:o.default.successToast,content:t.jsx(D.default,{message:"Access request submitted successfully!"})}),[3,5];case 3:return s=e.sent(),i=null===(g=null==s?void 0:s.response)||void 0===g?void 0:g.data,l="GLOBAL_SCOPE_NOT_FOUND"===(null==i?void 0:i.code)?"Unable to identify the global scope for this access request.":(null==i?void 0:i.detail)||(null==i?void 0:i.message)||"Failed to request access. Please try again.",null===(v=Ze.current)||void 0===v||v.show({severity:"error",sticky:!1,className:o.default.errorToast,content:t.jsx(I.default,{message:l})}),[3,5];case 4:return We(!1),[7];case 5:return[2]}})})};if(ft)return t.jsx("div",e.__assign({className:o.default.learningManagementContainer},{children:t.jsx(L.default,{})}));if(gt)return t.jsx("div",e.__assign({className:o.default.learningManagementContainer},{children:t.jsx(b.default,{errorMessage:"Failed to load configuration. Please try again.",onRetry:function(){return vt()},title:"Error Loading Configuration"})}));var bt=e.__spreadArray(e.__spreadArray([{type:"GLOBAL",label:"Global",addChildLabel:"".concat(P.dt("".concat(M.MIDDLE_DRAWER_DT_PATH,".addScope"),"Add Scope")),addChildType:"SCOPE"}],Array.from({length:St},function(){return e.__assign({type:"SCOPE",label:P.dt("".concat(M.MIDDLE_DRAWER_DT_PATH,".scope"),"Scope")},!te&&{addChildLabel:P.dt("".concat(M.MIDDLE_DRAWER_CONTEXT_MENU_DT_PATH,".addSubScope"),"Add Subscope"),addChildType:"SUBSCOPE"})}),!0),te?[]:[{type:"SUBSCOPE",label:P.dt("".concat(M.MIDDLE_DRAWER_DT_PATH,".subScope"),"Subscope")}],!0),Rt=Ye?pe.filter(function(e){return"stations"!==e.id}):pe,Dt=function(e,t){void 0===e&&(e=!0),t&&(Xe.current=t),ht(e)},It=function(){return Dt(!0)},jt=null!==(x=null==ce?void 0:ce.nodeTypesConfig)&&void 0!==x?x:bt,Pt=(null==ce?void 0:ce.onOpenCreateModal)?function(){return ce.onOpenCreateModal(It)}:function(){return be({isOpen:!0,type:"GLOBAL"})},Mt=(null==ce?void 0:ce.onAddChild)?function(e,t,n){return ce.onAddChild(e,t,n,It)}:function(e,t,n){return be({isOpen:!0,type:t,parentId:e,parentName:n})},qt=(null==ce?void 0:ce.onRenameChild)?function(e,t){return ce.onRenameChild(e,t,It)}:function(e,t){return be({isOpen:!0,type:"RENAME",scopeId:e,initialName:t})},wt=(null==ce?void 0:ce.onDeleteChild)?function(e,t,n){return ce.onDeleteChild(e,t,n,It)}:function(t,n,r){return e.__awaiter(Q,void 0,void 0,function(){var s,i,o;return e.__generator(this,function(e){switch(e.label){case 0:return s=a.useLearningTemplateStore.getState().scopeTreeData,i=v.findNodePathById((null==s?void 0:s.data)||null,t),o=!!i&&3===i.length,0!==r?[3,2]:[4,Tt(t)];case 1:return e.sent(),[3,3];case 2:be({isOpen:!0,type:"DELETE",scopeId:t,initialName:n,isSubscope:o}),e.label=3;case 3:return[2]}})})},Ot=null!==(k=null==ce?void 0:ce.onSectionSelect)&&void 0!==k?k:function(e,t){var n;console.log("Section Selected:",{scopeId:e,sectionId:t}),it(((n={})[p.QUERY_PARAM_KEYS.SECTION]=t===ge?null:t,n)),Oe(t),Se(e),Ve(!1)},Nt=null!==(U=null==ce?void 0:ce.onRefreshRuleSets)&&void 0!==U?U:Dt,xt=null!==(B=null==ce?void 0:ce.canCreateScope)&&void 0!==B?B:function(e){return lt("ilotj.scope.create",e)},kt=null!==(H=null==ce?void 0:ce.canEditScope)&&void 0!==H?H:function(e){return lt("ilotj.scope.edit",e)},Ut=null!==(G=null==ce?void 0:ce.canDeleteScope)&&void 0!==G?G:function(e){return lt("ilotj.scope.delete",e)};return t.jsx(m.TooltipProvider,{children:t.jsxs("div",e.__assign({className:o.default.learningManagementContainer},{children:[t.jsx("div",e.__assign({className:o.default.mainWrapper},{children:De?t.jsx(g.default,{}):he?t.jsxs("div",e.__assign({className:o.default.errorContainer},{children:[t.jsx("div",e.__assign({className:o.default.errorTitle},{children:"Error Loading Data"})),t.jsx("p",e.__assign({className:o.default.errorDesc},{children:he})),t.jsx("button",e.__assign({onClick:function(){return ht(!0)},className:o.default.tryAgainBtn},{children:"Try Again"}))]})):Ct?t.jsx(l.default,{onOpenCreateModal:Pt,onAddChild:Mt,onRenameChild:qt,onDeleteChild:wt,canDeleteScope:Ut,canEditScope:kt,canCreateScope:xt,onSectionSelect:Ot,activeSectionId:we,scopeTreeData:At,sectionsConfig:Rt,onViewStation:function(e){Ot(e.stationId,ge)},onRefreshRuleSets:Nt,nodeTypesConfig:jt,app_integration_id:$,token:W.accessToken,modeId:se,onRequestAccess:Lt,isRequestingAccess:Qe,isAccessRequested:ze,isILMarketplace:le,guidelineContentProps:ue}):t.jsx(u.default,{onCreate:function(){return be({isOpen:!0,type:"GLOBAL"})},title:P.dt("".concat(M.EMPTY_STATE_DT_PATH,".title"),"No Global Scope has been added!"),desc:P.dt("".concat(M.EMPTY_STATE_DT_PATH,".desc"),"Start by creating a Global scope to define base learnings that apply across all stations."),button:P.dt("".concat(M.EMPTY_STATE_DT_PATH,".createGlobalScope"),"Create Global Scope"),canCreateRule:Et,noAccessTitle:P.dt("".concat(M.EMPTY_STATE_DT_PATH,".noAccessTitle"),"Access Restricted"),noAccessDesc:P.dt("".concat(M.EMPTY_STATE_DT_PATH,".noAccessDesc"),"You do not have access for this application."),requestAccessButton:P.dt("".concat(M.EMPTY_STATE_DT_PATH,".requestAccessButton"),"Request Access"),requestSentButton:P.dt("".concat(M.EMPTY_STATE_DT_PATH,".requestSentButton"),"Request Sent"),onRequestAccess:Lt,isRequestingAccess:Qe,isAccessRequested:ze})})),t.jsx(i.Toast,{ref:Ze,pt:{root:{style:{zIndex:9999}}}}),te&&Le.isOpen&&"DELETE"!==Le.type&&"RENAME"!==Le.type?t.jsx(h.default,{isOpen:!0,onClose:function(){return be(e.__assign(e.__assign({},Le),{isOpen:!1}))},onSubmit:function(t){return e.__awaiter(Q,void 0,void 0,function(){var n,r,s,i,o,l,u,c,p,f,g,v,_,S,m,h,T,y,A,C;return e.__generator(this,function(E){switch(E.label){case 0:Me(!0),n=a.useLearningTemplateStore.getState().backwardCompatibility,E.label=1;case 1:return E.trys.push([1,12,13,14]),r=void 0,n&&"object"==typeof t?r=t:(s=t,i="SCOPE"===Le.type&&Le.parentId,o=i?"genreRuleSet":Le.type,r={topic:o,scope_reference_id:null,scopeDescription:"demo",parentScopeId:Le.parentId||null,scopeName:s,scopeReferenceMetadata:{},applicationMappingId:$}),[4,d.createRuleSet(r,W.accessToken)];case 2:if(l=E.sent(),!(u=null===(S=null==l?void 0:l.data)||void 0===S?void 0:S.scopeId))return[3,10];if(Xe.current=u,c=n&&(null===(m=r.topic)||void 0===m?void 0:m.toLowerCase().includes("genre")),p=!n&&"GLOBAL"!==Le.type&&Le.parentId,!c&&!p)return[3,10];if(!(f=n?null===(T=null===(h=a.useLearningTemplateStore.getState().scopeTreeData)||void 0===h?void 0:h.data)||void 0===T?void 0:T.id:Le.parentId))return[3,10];if(!te)return[3,7];E.label=3;case 3:return E.trys.push([3,5,,6]),[4,d.inheritScopeBackwardCompatible({source_scope_id:f,target_scope_id:u})];case 4:return E.sent(),[3,6];case 5:return g=E.sent(),console.error("Failed to inherit rules for the new scope:",g),[3,6];case 6:return[3,10];case 7:return E.trys.push([7,9,,10]),[4,d.inheritScope({source_scope_id:f,target_scope_id:u,application_mapping_id:$||"",is_copy_parent_variant_id:!1})];case 8:return E.sent(),[3,10];case 9:return v=E.sent(),console.error("Failed to inherit rules for the new scope:",v),[3,10];case 10:return[4,ht(!0)];case 11:return E.sent(),be(function(t){return e.__assign(e.__assign({},t),{isOpen:!1})}),[3,14];case 12:throw _=E.sent(),console.error("An error occurred during scope creation.",_),null===(y=Ze.current)||void 0===y||y.show({severity:"error",summary:"Creation Failed",detail:(null===(C=null===(A=null==_?void 0:_.response)||void 0===A?void 0:A.data)||void 0===C?void 0:C.message)||"There was an error creating the scope. Please try again."}),_;case 13:return Me(!1),[7];case 14:return[2]}})})},hasGlobalRuleSet:Ct,canCreateGlobal:Et,globalScopeId:null!==(F=null===(Y=null==Ae?void 0:Ae.data)||void 0===Y?void 0:Y.id)&&void 0!==F?F:null}):t.jsxs(t.Fragment,{children:[t.jsx(E.default,{isOpen:Le.isOpen&&"DELETE"!==Le.type&&"RENAME"!==Le.type,onClose:function(){return be(e.__assign(e.__assign({},Le),{isOpen:!1}))},onCreate:function(e){e&&(Xe.current=e),ht(!0)},hasGlobalRuleSet:Ct,parentId:Le.parentId}),t.jsx(j.default,{isOpen:Le.isOpen&&"RENAME"===Le.type,onClose:function(){return be(e.__assign(e.__assign({},Le),{isOpen:!1}))},onSave:function(n){return e.__awaiter(Q,void 0,void 0,function(){var r,s,i,l,u,c;return e.__generator(this,function(p){switch(p.label){case 0:Me(!0),p.label=1;case 1:return p.trys.push([1,4,5,6]),Le.scopeId?(r=a.useLearningTemplateStore.getState().backwardCompatibility,s=r?{scope_id:Le.scopeId,scope_name:n}:{scope_id:Le.scopeId,scope_type:"Custom",scope_name:n,application_mapping_id:$},[4,d.renameScope(s,W.accessToken)]):[2];case 2:return p.sent(),[4,ht(!0)];case 3:return p.sent(),be(function(t){return e.__assign(e.__assign({},t),{isOpen:!1})}),[3,6];case 4:throw i=p.sent(),console.error("An error occurred during scope rename.",i),null===(l=Ze.current)||void 0===l||l.show({severity:"error",sticky:!1,className:o.default.errorToast,content:t.jsx(I.default,{message:(null===(c=null===(u=null==i?void 0:i.response)||void 0===u?void 0:u.data)||void 0===c?void 0:c.message)||"There was an error renaming the scope. Please try again."})}),i;case 5:return Me(!1),[7];case 6:return[2]}})})},initialName:Le.initialName})]}),t.jsx(f.default,{isOpen:Le.isOpen&&"DELETE"===Le.type,onCancel:function(){return be(e.__assign(e.__assign({},Le),{isOpen:!1}))},onConfirm:function(){return Tt(Le.scopeId,Le.initialName,Le.isSubscope)},title:"Delete Scope",description:t.jsxs(t.Fragment,{children:["Deleting ",t.jsx("span",e.__assign({className:o.default.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:Pe})]}))})};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),n=require("react"),r=require("../../api/transport.js"),s=require("lucide-react"),a=require("./store/useLearningTemplateStore.js"),i=require("primereact/toast"),o=require("./styles/LearningTemplateManagement.module.css.js"),l=require("./LearningTemplateLayout.js"),u=require("./components/EmptyLearningState.js"),c=require("./store/useAuthStore.js"),d=require("./apis/scopeApis.js"),p=require("./hooks/useLearningTemplateQueryParams.js"),f=require("./components/ConfirmationModal.js"),g=require("./components/LearningTemplateManagementSkeleton.js"),v=require("./utils/treeUtils.js"),_=require("./store/useEnvStore.js"),S=require("./store/useConfigStore.js"),m=require("./components/ToolTip.js"),h=require("./components/CreateRuleSetLegacyModal.js"),T=require("./store/usePermissionsStore.js"),y=require("./store/useAppSecRolesStore.js"),C=require("./queries/useApprovalQueries.js"),E=require("./queries/useLMSConfigQuery.js"),A=require("./RuleContent/AddScopeModal.js"),L=require("./components/RuleContentSkeleton.js"),b=require("./components/ErrorStateDisplay.js"),R=require("react-router-dom"),D=require("./shared/SuccessToastContent.js"),I=require("./shared/ErrorToastContent.js"),P=require("./RuleContent/RenameScopeModal.js"),j=require("./store/useLMSConfigStore.js"),M=require("./constants.js");exports.default=function(q){var O,w,N,k,x,U,B,H,G,Y,F,Q=this,W=q.userDetails,K=q.llmStudioUrl,z=q.audacyBackendUrl,V=q.ilLabels,X=q.config,J=q.rbacConfig,Z=q.auditLogConfig,$=q.app_integration_id,ee=q.backwardCompatibility,te=void 0!==ee&&ee,ne=q.cognitiveCompareCompatibility,re=void 0!==ne&&ne,se=q.modeId,ae=q.modeDetails,ie=q.pluginPayload,oe=q.axiosConfig,le=q.isILMarketplace,ue=q.guidelineContentProps,ce=q.treeOverrides;r.applyAxiosConfig(oe);var de=[{id:"learnings",label:j.dt("".concat(M.MIDDLE_DRAWER_DT_PATH,".treeMenu.submenu.learnings"),"Learnings"),icon:s.BookOpen,badgeKey:"learningsCount"},{id:"access",label:j.dt("".concat(M.MIDDLE_DRAWER_DT_PATH,".treeMenu.submenu.access"),"Access"),icon:s.Users},{id:"history",label:j.dt("".concat(M.MIDDLE_DRAWER_DT_PATH,".treeMenu.submenu.changeHistory"),"Change History"),icon:s.History}],pe=(null==ce?void 0:ce.sectionsConfig)?ce.sectionsConfig.filter(function(e){return de.some(function(t){return t.id===e.id})}):de,fe=new Set(pe.map(function(e){return e.id})),ge=null!==(w=null===(O=pe[0])||void 0===O?void 0:O.id)&&void 0!==w?w:"learnings",ve=p.useRuleTemplateQueryParams().clearLearningParams,_e=a.useLearningTemplateStore(function(e){return e.selectedRuleSetId}),Se=a.useLearningTemplateStore(function(e){return e.setSelectedRuleSetId}),me=a.useLearningTemplateStore(function(e){return e.setIlInstanceId}),he=a.useLearningTemplateStore(function(e){return e.error}),Te=a.useLearningTemplateStore(function(e){return e.setError}),ye=a.useLearningTemplateStore(function(e){return e.setStations}),Ce=a.useLearningTemplateStore(function(e){return e.scopeTreeData}),Ee=a.useLearningTemplateStore(function(e){return e.setScopeTreeData}),Ae=n.useState({isOpen:!1,type:"GLOBAL"}),Le=Ae[0],be=Ae[1],Re=n.useState(!1),De=Re[0],Ie=Re[1],Pe=n.useState(!1),je=Pe[0],Me=Pe[1],qe=n.useState(ge),Oe=qe[0],we=qe[1],Ne=n.useState(null),ke=Ne[0],xe=Ne[1],Ue=n.useState(!1),Be=Ue[0],He=Ue[1],Ge=n.useState(null),Ye=Ge[0];Ge[1];var Fe=n.useState(!1),Qe=Fe[0],We=Fe[1],Ke=n.useState(!1),ze=Ke[0],Ve=Ke[1];n.useRef(null);var Xe=n.useRef(null),Je=n.useRef(!1),Ze=n.useRef(null),$e=c.default();$e.user;var et=$e.setUser,tt=S.useConfigStore(),nt=tt.setConfig,rt=tt.setIlLabels,st=function(){try{return R.useLocation()}catch(e){return{search:""}}}(),at=function(){try{return R.useSearchParams()[1]}catch(e){return null}}(),it=n.useCallback(function(e){if(at){var t=new URLSearchParams(window.location.search);Object.entries(e).forEach(function(e){var n=e[0],r=e[1];null==r||""===r?t.delete(n):t.set(n,r)}),at(t,{replace:!0})}else p.setQueryParams(e)},[at]);n.useEffect(function(){if(!Je.current){var e=new URLSearchParams(window.location.search),t=e.get(p.QUERY_PARAM_KEYS.RULESET_ID),n=e.get(p.QUERY_PARAM_KEYS.SECTION),r=n&&(null==fe?void 0:fe.has(n))?n:ge;(null==t?void 0:t.length)&&Se&&we&&(Se(t),we(r),Je.current=!0)}},[null==st?void 0:st.search,we,Se]),n.useEffect(function(){return function(){ve()}},[ve]),n.useEffect(function(){var e;_e&&it(((e={})[p.QUERY_PARAM_KEYS.RULESET_ID]=_e,e))},[_e,it]),n.useEffect(function(){var t;(null==ie?void 0:ie.learningManagement)&&j.useLMSConfigStore.getState().setLMSConfig(e.__assign(e.__assign({},ie.learningManagement),{agents:null!==(t=ie.agents)&&void 0!==t?t:{}}))},[ie]);var ot=T.usePermissionsStore(function(e){return e.fetchPermissions}),lt=T.usePermissionsStore(function(e){return e.hasPermission}),ut=y.useAppSecRolesStore(function(e){return e.setRoles}),ct=_.default(function(e){return e.appsecRbacUrl})===J.appsecRbacUrl,dt=C.useGetAppSecRolesQuery(J.applicationId,ct).data,pt=E.useLMSConfigQuery(null!=$?$:"",te),ft=pt.isLoading,gt=pt.isError,vt=pt.refetch;pt.isSuccess;var _t=n.useState(0),St=_t[0],mt=_t[1];n.useEffect(function(){if(!te&&$&&K){e.__awaiter(Q,void 0,void 0,function(){var t,n,r,s,a,i,o;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,d.getILInstance($)];case 1:return t=e.sent(),(null===(s=null==t?void 0:t.data)||void 0===s?void 0:s.ILInstanceId)&&me(t.data.ILInstanceId),"number"==typeof(n=null===(o=null===(i=null===(a=null==t?void 0:t.data)||void 0===a?void 0:a.learningManagement)||void 0===i?void 0:i.scopeAndHierarchy)||void 0===o?void 0:o.maxHierarchyLevels)&&n>0&&mt(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]}})})}},[$,K]),n.useEffect(function(){dt&&ut(dt.map(function(e){return{_id:e._id,name:e.name}}))},[dt,ut]),n.useEffect(function(){var e;console.log("userDetails",W),et(W),console.log("llmStudioUrl",K),console.log("audacyBackendUrl",z),_.default.getState().setLlmStudioUrl(K),_.default.getState().setAudacyBackendUrl(z),_.default.getState().setRbacConfig(J),_.default.getState().setAuditLogConfig(Z),_.default.getState().setBaseModeName((null==ae?void 0:ae.modeNameFromURL)||null),nt(X),rt(V),a.useLearningTemplateStore.getState().setAppIntegrationId(null!=$?$:null),a.useLearningTemplateStore.getState().setBackwardCompatibility(te),a.useLearningTemplateStore.getState().setCognitiveCompareCompatibility(null!=re&&re),a.useLearningTemplateStore.getState().setToken(null!==(e=null==W?void 0:W.accessToken)&&void 0!==e?e:null)},[W,et,K,z,J,Z,X,nt,V,rt,$,te,re,ae]),n.useEffect(function(){(null==W?void 0:W.accessToken)&&K&&(le||d.fetchTiers())},[$,null==W?void 0:W.accessToken,K,le]);var ht=function(t){return void 0===t&&(t=!0),e.__awaiter(Q,void 0,void 0,function(){var n,r,s,i,o,l,u,c,p,f,g,_;return e.__generator(this,function(S){switch(S.label){case 0:t&&Ie(!0),Te(null),S.label=1;case 1:return S.trys.push([1,7,8,9]),[4,ot(J.applicationId)];case 2:S.sent(),n=function(t){var r=T.usePermissionsStore.getState().hasPermission("ilotj.scope.view",t.id),s=t.children?t.children.map(function(e){return n(e)}).filter(function(e){return null!==e}):[];return r||0!==s.length?e.__assign(e.__assign({},t),{hasAccess:r,children:s}):null},r=void 0,S.label=3;case 3:return S.trys.push([3,5,,6]),[4,d.fetchScopes($,W.accessToken)];case 4:return r=S.sent(),[3,6];case 5:if(s=S.sent(),403===(null===(g=null==s?void 0:s.response)||void 0===g?void 0:g.status))return Ee(null),xe(J.applicationResourceId||null),He(!0),[2];throw s;case 6:return r&&r.data&&r.data.data&&(i=r.data.data,Array.isArray(i)&&(i=i.length>0?i[0]:null),i?(o=n(i))?(xe(null),He(!1),Ee({data:o}),Xe.current?(Se(Xe.current),we(ge),Xe.current=null):(l=a.useLearningTemplateStore.getState().selectedRuleSetId,u=l?v.findNodeById(o,l):null,l&&u||(c=function(e){if(e.hasAccess)return e;for(var t=0,n=e.children||[];t<n.length;t++){var r=n[t],s=c(r);if(s)return s}return null},p=c(o),Se(p?p.id:o.id)))):(xe(null!==(_=i.id)&&void 0!==_?_:null),He(!1),Ee(null)):(xe(null),He(!1),Ee(null))),[3,9];case 7:return f=S.sent(),console.error("Failed to fetch rule sets or permissions",f),Te("Failed to load data. Please try again later."),[3,9];case 8:return Ie(!1),[7];case 9:return[2]}})})};n.useEffect(function(){var e;(null===(e=null==W?void 0:W.accessToken)||void 0===e?void 0:e.length)&&ct?ht(!0):console.warn("Error: Trying to fetch rules without access token",W)},[null==W?void 0:W.accessToken,Te,ye,J.applicationId,ct]);var Tt=function(t,n,r){return e.__awaiter(Q,void 0,void 0,function(){var n,r,s,i,o,l,u,c;return e.__generator(this,function(p){switch(p.label){case 0:Me(!0),p.label=1;case 1:return p.trys.push([1,4,5,6]),[4,d.deleteRuleSet(t,W.accessToken)];case 2:return p.sent(),a.useLearningTemplateStore.getState().selectedRuleSetId===t&&(n=a.useLearningTemplateStore.getState().scopeTreeData,(r=v.findNodePathById((null==n?void 0:n.data)||null,t))&&r.length>1&&(s=r[r.length-2],Se(s),we(ge))),[4,ht(!0)];case 3:return p.sent(),be(function(t){return e.__assign(e.__assign({},t),{isOpen:!1})}),null===(o=Ze.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=Ze.current)||void 0===l||l.show({severity:"error",summary:"Delete Failed",detail:(null===(c=null===(u=null==i?void 0:i.response)||void 0===u?void 0:u.data)||void 0===c?void 0:c.message)||"There was an error deleting the scope. Please try again."}),[3,6];case 5:return Me(!1),[7];case 6:return[2]}})})},yt=Ce,Ct=Ye?{data:{id:Ye.stationId,name:Ye.stationName,type:"STATION",metrics:{learningsCount:Ye.learningsCount,stationsCount:0},children:[]}}:yt,Et=!!(null==Ct?void 0:Ct.data);null===(N=null==Ct?void 0:Ct.data)||void 0===N||N.type;var At=T.usePermissionsStore(function(e){return e.hasGlobalPermission})("ilotj.scope.global.create",J.applicationResourceId||""),Lt=function(n){return e.__awaiter(Q,void 0,void 0,function(){var r,s,i,l,u,c,p,f,g,v;return e.__generator(this,function(e){switch(e.label){case 0:if(!(r="string"==typeof n?n:(null===(c=null===(u=a.useLearningTemplateStore.getState().scopeTreeData)||void 0===u?void 0:u.data)||void 0===c?void 0:c.id)||ke)&&!Be)return null===(p=Ze.current)||void 0===p||p.show({severity:"error",sticky:!1,className:o.default.errorToast,content:t.jsx(I.default,{message:"Unable to identify the global scope for this access request."})}),[2];We(!0),e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,d.requestAccess(r,Be)];case 2:return e.sent(),Ve(!0),null===(f=Ze.current)||void 0===f||f.show({severity:"success",sticky:!1,life:3e3,className:o.default.successToast,content:t.jsx(D.default,{message:"Access request submitted successfully!"})}),[3,5];case 3:return s=e.sent(),i=null===(g=null==s?void 0:s.response)||void 0===g?void 0:g.data,l="GLOBAL_SCOPE_NOT_FOUND"===(null==i?void 0:i.code)?"Unable to identify the global scope for this access request.":(null==i?void 0:i.detail)||(null==i?void 0:i.message)||"Failed to request access. Please try again.",null===(v=Ze.current)||void 0===v||v.show({severity:"error",sticky:!1,className:o.default.errorToast,content:t.jsx(I.default,{message:l})}),[3,5];case 4:return We(!1),[7];case 5:return[2]}})})};if(ft)return t.jsx("div",e.__assign({className:o.default.learningManagementContainer},{children:t.jsx(L.default,{})}));if(gt)return t.jsx("div",e.__assign({className:o.default.learningManagementContainer},{children:t.jsx(b.default,{errorMessage:"Failed to load configuration. Please try again.",onRetry:function(){return vt()},title:"Error Loading Configuration"})}));var bt=e.__spreadArray(e.__spreadArray([{type:"GLOBAL",label:"Global",addChildLabel:"".concat(j.dt("".concat(M.MIDDLE_DRAWER_DT_PATH,".addScope"),"Add Scope")),addChildType:"SCOPE"}],Array.from({length:St},function(){return e.__assign({type:"SCOPE",label:j.dt("".concat(M.MIDDLE_DRAWER_DT_PATH,".scope"),"Scope")},!te&&{addChildLabel:j.dt("".concat(M.MIDDLE_DRAWER_CONTEXT_MENU_DT_PATH,".addSubScope"),"Add Subscope"),addChildType:"SUBSCOPE"})}),!0),te?[]:[{type:"SUBSCOPE",label:j.dt("".concat(M.MIDDLE_DRAWER_DT_PATH,".subScope"),"Subscope")}],!0),Rt=Ye?pe.filter(function(e){return"stations"!==e.id}):pe,Dt=function(e,t){void 0===e&&(e=!0),t&&(Xe.current=t),ht(e)},It=function(){return Dt(!0)},Pt=null!==(k=null==ce?void 0:ce.nodeTypesConfig)&&void 0!==k?k:bt,jt=(null==ce?void 0:ce.onOpenCreateModal)?function(){return ce.onOpenCreateModal(It)}:function(){return be({isOpen:!0,type:"GLOBAL"})},Mt=(null==ce?void 0:ce.onAddChild)?function(e,t,n){return ce.onAddChild(e,t,n,It)}:function(e,t,n){return be({isOpen:!0,type:t,parentId:e,parentName:n})},qt=(null==ce?void 0:ce.onRenameChild)?function(e,t){return ce.onRenameChild(e,t,It)}:function(e,t){return be({isOpen:!0,type:"RENAME",scopeId:e,initialName:t})},Ot=(null==ce?void 0:ce.onDeleteChild)?function(e,t,n){return ce.onDeleteChild(e,t,n,It)}:function(t,n,r){return e.__awaiter(Q,void 0,void 0,function(){var s,i,o;return e.__generator(this,function(e){switch(e.label){case 0:return s=a.useLearningTemplateStore.getState().scopeTreeData,i=v.findNodePathById((null==s?void 0:s.data)||null,t),o=!!i&&3===i.length,0!==r?[3,2]:[4,Tt(t)];case 1:return e.sent(),[3,3];case 2:be({isOpen:!0,type:"DELETE",scopeId:t,initialName:n,isSubscope:o}),e.label=3;case 3:return[2]}})})},wt=null!==(x=null==ce?void 0:ce.onSectionSelect)&&void 0!==x?x:function(e,t){var n;console.log("Section Selected:",{scopeId:e,sectionId:t}),it(((n={})[p.QUERY_PARAM_KEYS.SECTION]=t===ge?null:t,n)),we(t),Se(e),Ve(!1)},Nt=null!==(U=null==ce?void 0:ce.onRefreshRuleSets)&&void 0!==U?U:Dt,kt=null!==(B=null==ce?void 0:ce.canCreateScope)&&void 0!==B?B:function(e){return lt("ilotj.scope.create",e)},xt=null!==(H=null==ce?void 0:ce.canEditScope)&&void 0!==H?H:function(e){return lt("ilotj.scope.edit",e)},Ut=null!==(G=null==ce?void 0:ce.canDeleteScope)&&void 0!==G?G:function(e){return lt("ilotj.scope.delete",e)};return t.jsx(m.TooltipProvider,{children:t.jsxs("div",e.__assign({className:o.default.learningManagementContainer},{children:[t.jsx("div",e.__assign({className:o.default.mainWrapper},{children:De?t.jsx(g.default,{}):he?t.jsxs("div",e.__assign({className:o.default.errorContainer},{children:[t.jsx("div",e.__assign({className:o.default.errorTitle},{children:"Error Loading Data"})),t.jsx("p",e.__assign({className:o.default.errorDesc},{children:he})),t.jsx("button",e.__assign({onClick:function(){return ht(!0)},className:o.default.tryAgainBtn},{children:"Try Again"}))]})):Et?t.jsx(l.default,{onOpenCreateModal:jt,onAddChild:Mt,onRenameChild:qt,onDeleteChild:Ot,canDeleteScope:Ut,canEditScope:xt,canCreateScope:kt,onSectionSelect:wt,activeSectionId:Oe,scopeTreeData:Ct,sectionsConfig:Rt,onViewStation:function(e){wt(e.stationId,ge)},onRefreshRuleSets:Nt,nodeTypesConfig:Pt,app_integration_id:$,token:W.accessToken,modeId:se,onRequestAccess:Lt,isRequestingAccess:Qe,isAccessRequested:ze,isILMarketplace:le,guidelineContentProps:ue}):t.jsx(u.default,{onCreate:function(){return be({isOpen:!0,type:"GLOBAL"})},title:j.dt("".concat(M.EMPTY_STATE_DT_PATH,".title"),"No Global Scope has been added!"),desc:j.dt("".concat(M.EMPTY_STATE_DT_PATH,".desc"),"Start by creating a Global scope to define base learnings that apply across all stations."),button:j.dt("".concat(M.EMPTY_STATE_DT_PATH,".createGlobalScope"),"Create Global Scope"),canCreateRule:At,noAccessTitle:j.dt("".concat(M.EMPTY_STATE_DT_PATH,".noAccessTitle"),"Access Restricted"),noAccessDesc:j.dt("".concat(M.EMPTY_STATE_DT_PATH,".noAccessDesc"),"You do not have access for this application."),requestAccessButton:j.dt("".concat(M.EMPTY_STATE_DT_PATH,".requestAccessButton"),"Request Access"),requestSentButton:j.dt("".concat(M.EMPTY_STATE_DT_PATH,".requestSentButton"),"Request Sent"),onRequestAccess:Lt,isRequestingAccess:Qe,isAccessRequested:ze})})),t.jsx(i.Toast,{ref:Ze,pt:{root:{style:{zIndex:9999}}}}),te&&Le.isOpen&&"DELETE"!==Le.type&&"RENAME"!==Le.type?t.jsx(h.default,{isOpen:!0,onClose:function(){return be(e.__assign(e.__assign({},Le),{isOpen:!1}))},onSubmit:function(t){return e.__awaiter(Q,void 0,void 0,function(){var n,r,s,i,o,l,u,c,p,f,g,v,_,S,m,h,T,y,C,E;return e.__generator(this,function(A){switch(A.label){case 0:Me(!0),n=a.useLearningTemplateStore.getState().backwardCompatibility,A.label=1;case 1:return A.trys.push([1,12,13,14]),r=void 0,n&&"object"==typeof t?r=t:(s=t,i="SCOPE"===Le.type&&Le.parentId,o=i?"genreRuleSet":Le.type,r={topic:o,scope_reference_id:null,scopeDescription:"demo",parentScopeId:Le.parentId||null,scopeName:s,scopeReferenceMetadata:{},applicationMappingId:$}),[4,d.createRuleSet(r,W.accessToken)];case 2:if(l=A.sent(),!(u=null===(S=null==l?void 0:l.data)||void 0===S?void 0:S.scopeId))return[3,10];if(Xe.current=u,c=n&&(null===(m=r.topic)||void 0===m?void 0:m.toLowerCase().includes("genre")),p=!n&&"GLOBAL"!==Le.type&&Le.parentId,!c&&!p)return[3,10];if(!(f=n?null===(T=null===(h=a.useLearningTemplateStore.getState().scopeTreeData)||void 0===h?void 0:h.data)||void 0===T?void 0:T.id:Le.parentId))return[3,10];if(!te)return[3,7];A.label=3;case 3:return A.trys.push([3,5,,6]),[4,d.inheritScopeBackwardCompatible({source_scope_id:f,target_scope_id:u})];case 4:return A.sent(),[3,6];case 5:return g=A.sent(),console.error("Failed to inherit rules for the new scope:",g),[3,6];case 6:return[3,10];case 7:return A.trys.push([7,9,,10]),[4,d.inheritScope({source_scope_id:f,target_scope_id:u,application_mapping_id:$||"",is_copy_parent_variant_id:!1})];case 8:return A.sent(),[3,10];case 9:return v=A.sent(),console.error("Failed to inherit rules for the new scope:",v),[3,10];case 10:return[4,ht(!0)];case 11:return A.sent(),be(function(t){return e.__assign(e.__assign({},t),{isOpen:!1})}),[3,14];case 12:throw _=A.sent(),console.error("An error occurred during scope creation.",_),null===(y=Ze.current)||void 0===y||y.show({severity:"error",summary:"Creation Failed",detail:(null===(E=null===(C=null==_?void 0:_.response)||void 0===C?void 0:C.data)||void 0===E?void 0:E.message)||"There was an error creating the scope. Please try again."}),_;case 13:return Me(!1),[7];case 14:return[2]}})})},hasGlobalRuleSet:Et,canCreateGlobal:At,globalScopeId:null!==(F=null===(Y=null==Ce?void 0:Ce.data)||void 0===Y?void 0:Y.id)&&void 0!==F?F:null}):t.jsxs(t.Fragment,{children:[t.jsx(A.default,{isOpen:Le.isOpen&&"DELETE"!==Le.type&&"RENAME"!==Le.type,onClose:function(){return be(e.__assign(e.__assign({},Le),{isOpen:!1}))},onCreate:function(e){e&&(Xe.current=e),ht(!0)},hasGlobalRuleSet:Et,parentId:Le.parentId,parentName:Le.parentName,childType:"SUBSCOPE"===Le.type?"SUBSCOPE":"SCOPE",isILMarketplace:le}),t.jsx(P.default,{isOpen:Le.isOpen&&"RENAME"===Le.type,onClose:function(){return be(e.__assign(e.__assign({},Le),{isOpen:!1}))},onSave:function(n){return e.__awaiter(Q,void 0,void 0,function(){var r,s,i,l,u,c;return e.__generator(this,function(p){switch(p.label){case 0:Me(!0),p.label=1;case 1:return p.trys.push([1,4,5,6]),Le.scopeId?(r=a.useLearningTemplateStore.getState().backwardCompatibility,s=r?{scope_id:Le.scopeId,scope_name:n}:{scope_id:Le.scopeId,scope_type:"Custom",scope_name:n,application_mapping_id:$},[4,d.renameScope(s,W.accessToken)]):[2];case 2:return p.sent(),[4,ht(!0)];case 3:return p.sent(),be(function(t){return e.__assign(e.__assign({},t),{isOpen:!1})}),[3,6];case 4:throw i=p.sent(),console.error("An error occurred during scope rename.",i),null===(l=Ze.current)||void 0===l||l.show({severity:"error",sticky:!1,className:o.default.errorToast,content:t.jsx(I.default,{message:(null===(c=null===(u=null==i?void 0:i.response)||void 0===u?void 0:u.data)||void 0===c?void 0:c.message)||"There was an error renaming the scope. Please try again."})}),i;case 5:return Me(!1),[7];case 6:return[2]}})})},initialName:Le.initialName})]}),t.jsx(f.default,{isOpen:Le.isOpen&&"DELETE"===Le.type,onCancel:function(){return be(e.__assign(e.__assign({},Le),{isOpen:!1}))},onConfirm:function(){return Tt(Le.scopeId,Le.initialName,Le.isSubscope)},title:"Delete Scope",description:t.jsxs(t.Fragment,{children:["Deleting ",t.jsx("span",e.__assign({className:o.default.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:je})]}))})};
|
|
2
2
|
//# sourceMappingURL=LearningManagement.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),i=require("react"),r=require("@tanstack/react-query"),t=require("lucide-react"),o=require("primereact/toast"),a=require("uuid"),s=require("../components/StationOnboarding/StationAutocomplete.js"),l=require("./AddScopeApprovalSearchComponent.js"),d=require("../components/ScopeSkeletonLoader.js"),u=require("@mui/material"),c=require("../store/useAuthStore.js"),p=require("../store/useAppSecRolesStore.js"),_=require("../store/useEnvStore.js"),g=require("../apis/scopeApis.js"),h=require("../store/useLearningTemplateStore.js"),f=require("../config.js"),m=require("../store/useLMSConfigStore.js"),v=require("../constants.js");exports.default=function(S){var y=S.isOpen,b=S.onClose,D=S.onCreate,x=S.hasGlobalRuleSet,A=S.parentId,C=S.isILMarketplace,E=void 0!==C&&C,j=S.onCreateMarketplaceDomain,R=S.childType,T=S.parentName,I=i.useState(""),P=I[0],w=I[1],L=i.useState(""),q=L[0],k=L[1],O=i.useState({}),W=O[0],M=O[1],F=i.useRef(null),N=c.default().user,B=p.useAppSecRolesStore(function(e){return e.roles}),G=_.default(function(e){return e.rbacConfig}),z=i.useState(!1),H=z[0],U=z[1],V=i.useState(null),K=V[0],X=V[1],J=i.useState("approval_required"),Q=J[0],Y=J[1],Z=i.useState([]),$=Z[0],ee=Z[1],ne=i.useState([]),ie=ne[0],re=ne[1],te=i.useState(!1);te[0];var oe=te[1],ae=E?"SUBSCOPE"===R?"Subdomain Name":"Domain Name":m.dt("".concat(v.MIDDLE_DRAWER_ADD_SCOPE_DT_PATH,".scopeName"),"Scope Name"),se=r.useMutation({mutationFn:function(n){return e.__awaiter(void 0,void 0,void 0,function(){var i;return e.__generator(this,function(e){switch(e.label){case 0:return[4,g.createRuleSet(n,null!==(i=null==N?void 0:N.accessToken)&&void 0!==i?i:"")];case 1:return[2,e.sent()]}})})},onSuccess:function(n){return e.__awaiter(void 0,void 0,void 0,function(){var i,r;return e.__generator(this,function(e){return console.log("Rule Set Created Successfully",n),null===(i=F.current)||void 0===i||i.show({severity:"success",summary:"Scope Created",detail:(null===(r=null==n?void 0:n.data)||void 0===r?void 0:r.message)||"Scope created successfully",life:3e3}),[2]})})},onError:function(e){var n,i,r;console.error("Create scope failed",e),null===(n=F.current)||void 0===n||n.show({severity:"error",summary:"Creation Failed",detail:(null===(r=null===(i=null==e?void 0:e.response)||void 0===i?void 0:i.data)||void 0===r?void 0:r.message)||"There was an error creating the scope. Please try again."})}});se.data;var le=se.isPending,de=se.mutateAsync;return i.useEffect(function(){y&&(w(""),k(""),M({}),X(null),Y("approval_required"),ee([]),re([]))},[y]),y?n.jsxs("div",e.__assign({style:{position:"absolute",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0,0,0,0.3)"}},{children:[n.jsx(o.Toast,{ref:F}),le||H?n.jsx(d.default,{isLoading:le||H}):n.jsxs("div",e.__assign({style:{position:"relative",width:600,borderRadius:12,backgroundColor:"white",padding:24,boxShadow:"0 25px 50px -12px rgba(0,0,0,0.25)"}},{children:[n.jsxs("div",e.__assign({style:{marginBottom:24,display:"flex",alignItems:"flex-start",justifyContent:"space-between"}},{children:[n.jsxs("div",{children:[n.jsx("h2",e.__assign({style:{margin:0,fontSize:18,fontWeight:500,color:"#19213D"}},{children:E?"SUBSCOPE"===R?"Add Subdomain":"Add Domain":x?m.dt("".concat(v.MIDDLE_DRAWER_ADD_SCOPE_DT_PATH,".title"),"Add Scope"):m.dt("".concat(v.MIDDLE_DRAWER_ADD_SCOPE_DT_PATH,".globalTitle"),"Create Global Scope")})),n.jsx("p",e.__assign({style:{margin:"4px 0 0 0",fontSize:14,fontWeight:400,color:"#666F8D"}},{children:E?T?"This ".concat("SUBSCOPE"===R?"subdomain":"domain"," will be created under '").concat(T,"'."):"This ".concat("SUBSCOPE"===R?"subdomain":"domain"," will be created under the selected parent domain."):x?m.dt("".concat(v.MIDDLE_DRAWER_ADD_SCOPE_DT_PATH,".subtitle"),"This scope will be created under Global scope and will inherit its learnings by default.",{parent:"Global"}):m.dt("".concat(v.MIDDLE_DRAWER_ADD_SCOPE_DT_PATH,".globalSubtitle"),"This will be your Global scope that defines the base learnings shared across all stations.")}))]}),n.jsx("button",e.__assign({onClick:b,style:{background:"none",border:"none",padding:0,cursor:"pointer",color:"#9CA3AF"}},{children:n.jsx(t.X,{size:24})}))]})),n.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:20}},{children:[n.jsxs("div",e.__assign({style:{position:"relative",display:"flex",flexDirection:"column",gap:6}},{children:[n.jsxs("label",e.__assign({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:[n.jsx("span",e.__assign({style:{marginRight:4,fontSize:16,fontWeight:600,color:"#8F2C23"}},{children:"*"})),ae]})),"Custom"===P?n.jsx(s.default,{value:q,onChange:function(n){if(n.length>50)return k(n.slice(0,50)),void M(function(n){return e.__assign(e.__assign({},n),{name:"".concat(ae," must be 50 characters or fewer")})});k(n),M(function(n){return e.__assign(e.__assign({},n),{name:void 0})})},onStationSelect:function(e){X(e)},style:{border:W.name?"1px solid #8F2C23":void 0}}):n.jsx(u.Input,{value:q,onChange:function(n){var i=n.target.value;if(i.length>50)return k(i.slice(0,50)),void M(function(n){return e.__assign(e.__assign({},n),{name:"".concat(ae," must be 50 characters or fewer")})});k(i),M(function(n){return e.__assign(e.__assign({},n),{name:void 0})})},style:{border:"1px solid ".concat(W.name?"#8F2C23":"#F0F2F5")},placeholder:E?"e.g. MarketPlace":"e.g. Global Learnings"}),W.name&&n.jsx("p",e.__assign({style:{margin:"4px 0 0 0",fontSize:12,color:"#8F2C23"}},{children:W.name}))]})),!E&&n.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:12}},{children:[n.jsxs("label",e.__assign({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:[n.jsx("span",e.__assign({style:{marginRight:4,fontSize:16,fontWeight:600,color:"#8F2C23"}},{children:"*"})),m.dt("".concat(v.MIDDLE_DRAWER_APPROVAL_SETTINGS_DT_PATH,".title"),"Learning Approval Settings")]})),n.jsxs("div",e.__assign({role:"radio","aria-checked":"approval_required"===Q,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:4},onClick:function(){return Y("approval_required")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||Y("approval_required")}},{children:[n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:8}},{children:[n.jsx("div",e.__assign({style:{display:"flex",height:16,width:16,flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("approval_required"===Q?"#2563EB":"#CBD5E1")}},{children:"approval_required"===Q&&n.jsx("div",{style:{height:8,width:8,borderRadius:"50%",backgroundColor:"#2563EB"}})})),n.jsx("span",e.__assign({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:m.dt("".concat(v.MIDDLE_DRAWER_APPROVAL_SETTINGS_DT_PATH,".approvalRequired.title"),"Approval Required Before Publishing")}))]})),n.jsx("p",e.__assign({style:{margin:0,marginLeft:24,fontSize:12,color:"#666F8D"}},{children:m.dt("".concat(v.MIDDLE_DRAWER_APPROVAL_SETTINGS_DT_PATH,".approvalRequired.subtitle"),"Learnings require approval before publishing.")}))]})),"approval_required"===Q&&n.jsx(l.default,{selectedApprovers:$,selectedGroupOfApprovers:ie,onApproversChange:ee,onGroupsChange:re}),n.jsxs("div",e.__assign({role:"radio","aria-checked":"publish_without"===Q,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:4},onClick:function(){Y("publish_without")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||Y("publish_without")}},{children:[n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:8}},{children:[n.jsx("div",e.__assign({style:{display:"flex",height:16,width:16,flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("publish_without"===Q?"#2563EB":"#CBD5E1")}},{children:"publish_without"===Q&&n.jsx("div",{style:{height:8,width:8,borderRadius:"50%",backgroundColor:"#2563EB"}})})),n.jsx("span",e.__assign({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:m.dt("".concat(v.MIDDLE_DRAWER_APPROVAL_SETTINGS_DT_PATH,".publishWithoutApproval.title"),"Publish Without Approval")}))]})),n.jsx("p",e.__assign({style:{margin:0,marginLeft:24,fontSize:12,color:"#666F8D"}},{children:m.dt("".concat(v.MIDDLE_DRAWER_APPROVAL_SETTINGS_DT_PATH,".publishWithoutApproval.subtitle"),"Learnings can be published directly.")}))]}))]})),n.jsxs("div",e.__assign({style:{marginTop:32,display:"flex",justifyContent:"flex-end",gap:12}},{children:[n.jsx("button",e.__assign({onClick:b,style:{borderRadius:6,border:"1px solid #E2E8F0",padding:"8px 16px",fontSize:14,fontWeight:500,color:"#64748B",backgroundColor:"white",cursor:"pointer",opacity:le?.5:1},disabled:le},{children:m.dt("".concat(v.MIDDLE_DRAWER_ADD_SCOPE_DT_PATH,".cancel"),"Cancel")})),n.jsx("button",e.__assign({onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var n,i,r,t,o,s,l,d,u,c,p,_,m,v,S,y,C,R,T,I,P,w;return e.__generator(this,function(L){switch(L.label){case 0:if(n={},q.trim()?q.length>50&&(n.name="".concat(ae," must be 50 characters or fewer")):n.name="".concat(ae," is required"),n.name)return M(n),[2];L.label=1;case 1:return L.trys.push([1,10,11,12]),U(!0),E?[4,null==j?void 0:j(q)]:[3,3];case 2:return i=L.sent(),D(null==i?void 0:i.scopeId),b(),[2];case 3:return r="approval_required"===Q,t=h.useLearningTemplateStore.getState().backwardCompatibility,o=$.length>0||ie.length>0,s=t?{topic:x?"genreRuleSet":"globalRuleSet",customScopeGroupName:f.IL_CONFIG_CONSTANTS.CUSTOM_SCOPE_GROUP_NAME,scopeDescription:q,parentScopeId:null,customScopeName:q,customScopeId:a.v4(),createByName:(null==N?void 0:N.firstname)||"System",createdBy:(null==N?void 0:N.email)||"system@audacy.com",approvalRequired:r,appsecData:{application:null==G?void 0:G.applicationId,module:null==G?void 0:G.moduleId,roles:e.__spreadArray(e.__spreadArray([],r&&o?[{users:$.map(function(e){return e.email}),groups:ie.map(function(e){return e._id}),role:null!==(_=null===(p=B.find(function(e){return"Learning Manager"===e.name}))||void 0===p?void 0:p._id)&&void 0!==_?_:""}]:[],!0),[{users:[null==N?void 0:N.email],groups:[],role:null!==(v=null===(m=B.find(function(e){return"Instant Learning Admin"===e.name}))||void 0===m?void 0:m._id)&&void 0!==v?v:""}],!1)}}:{topic:x?"genreRuleSet":"globalRuleSet",scope_reference_id:null,scopeDescription:q,parentScopeId:null!=A?A:null,scopeName:q,scopeReferenceMetadata:{},scopeType:"Custom",applicationMappingId:h.useLearningTemplateStore.getState().app_integration_id,approvalRequired:r,appsecData:{application:null==G?void 0:G.applicationId,module:null==G?void 0:G.moduleId,roles:e.__spreadArray(e.__spreadArray([],r&&o?[{users:$.map(function(e){return e.email}),groups:ie.map(function(e){return e._id}),role:null!==(y=null===(S=B.find(function(e){return"Learning Manager"===e.name}))||void 0===S?void 0:S._id)&&void 0!==y?y:""}]:[],!0),[{users:[null==N?void 0:N.email],groups:[],role:null!==(R=null===(C=B.find(function(e){return"Instant Learning Admin"===e.name}))||void 0===C?void 0:C._id)&&void 0!==R?R:""}],!1)}},console.log("Add Scope payload:",s),[4,de(s)];case 4:if(l=L.sent(),d=null===(T=null==l?void 0:l.data)||void 0===T?void 0:T.scopeId,t||!d||!A)return[3,9];oe(!0),L.label=5;case 5:return L.trys.push([5,7,8,9]),[4,g.inheritScope({source_scope_id:A,target_scope_id:d,application_mapping_id:h.useLearningTemplateStore.getState().app_integration_id||"",is_copy_parent_variant_id:!1})];case 6:return L.sent(),[3,9];case 7:return u=L.sent(),console.error("Failed to inherit rules for the new scope:",u),[3,9];case 8:return oe(!1),[7];case 9:return D(d),b(),[3,12];case 10:return c=L.sent(),console.error("An error occurred during scope creation.",c),null===(I=F.current)||void 0===I||I.show({severity:"error",summary:"Adding Scope Failed",detail:(null===(w=null===(P=null==c?void 0:c.response)||void 0===P?void 0:P.data)||void 0===w?void 0:w.message)||"There was an error creating the scope. Please try again."}),[3,12];case 11:return U(!1),[7];case 12: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:le||"Custom"===P&&!K?.5:1},disabled:le||"Custom"===P&&!K},{children:le?n.jsxs(n.Fragment,{children:[n.jsx(t.Loader2,{className:"animate-spin",style:{marginRight:8,height:16,width:16,color:"white"}}),"Creating..."]}):E?"SUBSCOPE"===R?"Create Subdomain":"Create Domain":m.dt("".concat(v.MIDDLE_DRAWER_ADD_SCOPE_DT_PATH,".submitButton"),"Create Scope")}))]}))]}))]}))]})):null};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),n=require("react"),r=require("@tanstack/react-query"),i=require("lucide-react"),o=require("primereact/toast"),a=require("uuid"),s=require("../components/StationOnboarding/StationAutocomplete.js"),l=require("./AddScopeApprovalSearchComponent.js"),c=require("../components/ScopeSkeletonLoader.js"),u=require("@mui/material"),d=require("../store/useAuthStore.js"),p=require("../store/useAppSecRolesStore.js"),_=require("../store/useEnvStore.js"),g=require("../apis/scopeApis.js"),h=require("../store/useLearningTemplateStore.js"),f=require("../config.js"),S=require("../store/useLMSConfigStore.js"),v=require("../constants.js");exports.default=function(m){var D=m.isOpen,b=m.onClose,y=m.onCreate,x=m.hasGlobalRuleSet,A=m.parentId,C=m.isILMarketplace,E=void 0!==C&&C,R=m.childType,T=m.parentName,j=n.useState(""),P=j[0],I=j[1],w=n.useState(""),L=w[0],q=w[1],O=n.useState({}),W=O[0],k=O[1],M=n.useRef(null),F=d.default().user,N=p.useAppSecRolesStore(function(e){return e.roles}),B=_.default(function(e){return e.rbacConfig}),G=n.useState(!1),z=G[0],H=G[1],U=n.useState(null),V=U[0],K=U[1],X=n.useState("approval_required"),J=X[0],Q=X[1],Y=n.useState([]),Z=Y[0],$=Y[1],ee=n.useState([]),te=ee[0],ne=ee[1],re=n.useState(!1);re[0];var ie=re[1],oe=S.dt("middleDrawer.subScope","Subscope"),ae="SUBSCOPE"===R?S.dt("".concat(v.MIDDLE_DRAWER_ADD_SCOPE_DT_PATH,".subScopeName"),"".concat(oe," Name")):S.dt("".concat(v.MIDDLE_DRAWER_ADD_SCOPE_DT_PATH,".scopeName"),"Scope Name"),se=r.useMutation({mutationFn:function(t){return e.__awaiter(void 0,void 0,void 0,function(){var n;return e.__generator(this,function(e){switch(e.label){case 0:return[4,g.createRuleSet(t,null!==(n=null==F?void 0:F.accessToken)&&void 0!==n?n:"")];case 1:return[2,e.sent()]}})})},onSuccess:function(t){return e.__awaiter(void 0,void 0,void 0,function(){var n,r;return e.__generator(this,function(e){return console.log("Rule Set Created Successfully",t),null===(n=M.current)||void 0===n||n.show({severity:"success",summary:"Scope Created",detail:(null===(r=null==t?void 0:t.data)||void 0===r?void 0:r.message)||"Scope created successfully",life:3e3}),[2]})})},onError:function(e){var t,n,r;console.error("Create scope failed",e),null===(t=M.current)||void 0===t||t.show({severity:"error",summary:"Creation Failed",detail:(null===(r=null===(n=null==e?void 0:e.response)||void 0===n?void 0:n.data)||void 0===r?void 0:r.message)||"There was an error creating the scope. Please try again."})}});se.data;var le=se.isPending,ce=se.mutateAsync;if(n.useEffect(function(){D&&(I(""),q(""),k({}),K(null),Q("approval_required"),$([]),ne([]))},[D]),!D)return null;var ue="SUBSCOPE"===R?S.dt("".concat(v.MIDDLE_DRAWER_ADD_SCOPE_DT_PATH,".subScopeTitle"),S.dt("middleDrawer.addSubScope","Add Subscope")):x?S.dt("".concat(v.MIDDLE_DRAWER_ADD_SCOPE_DT_PATH,".title"),"Add Scope"):S.dt("".concat(v.MIDDLE_DRAWER_ADD_SCOPE_DT_PATH,".globalTitle"),"Create Global Scope"),de="SUBSCOPE"===R?S.interpolate(S.dt("".concat(v.MIDDLE_DRAWER_ADD_SCOPE_DT_PATH,".subScopeSubtitle"),"This ".concat(oe.toLowerCase()," will be created under {parent} and will inherit its Knowledgebases by default.")),{parent:T||S.dt("middleDrawer.scope","the selected scope")}):x?S.dt("".concat(v.MIDDLE_DRAWER_ADD_SCOPE_DT_PATH,".subtitle"),"This scope will be created under Global scope and will inherit its learnings by default.",{parent:"Global"}):S.dt("".concat(v.MIDDLE_DRAWER_ADD_SCOPE_DT_PATH,".globalSubtitle"),"This will be your Global scope that defines the base learnings shared across all stations."),pe="SUBSCOPE"===R?"Setting up your ".concat(oe,"…"):x?"Setting up your ".concat(S.dt("middleDrawer.scope","Scope"),"…"):"Setting up your Global Scope…";return t.jsxs("div",e.__assign({style:{position:"absolute",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0,0,0,0.3)"}},{children:[t.jsx(o.Toast,{ref:M}),le||z?t.jsx(c.default,{isLoading:le||z,title:pe,subtitle:de}):t.jsxs("div",e.__assign({style:{position:"relative",width:600,borderRadius:12,backgroundColor:"white",padding:24,boxShadow:"0 25px 50px -12px rgba(0,0,0,0.25)"}},{children:[t.jsxs("div",e.__assign({style:{marginBottom:24,display:"flex",alignItems:"flex-start",justifyContent:"space-between"}},{children:[t.jsxs("div",{children:[t.jsx("h2",e.__assign({style:{margin:0,fontSize:18,fontWeight:500,color:"#19213D"}},{children:ue})),t.jsx("p",e.__assign({style:{margin:"4px 0 0 0",fontSize:14,fontWeight:400,color:"#666F8D"}},{children:de}))]}),t.jsx("button",e.__assign({onClick:b,style:{background:"none",border:"none",padding:0,cursor:"pointer",color:"#9CA3AF"}},{children:t.jsx(i.X,{size:24})}))]})),t.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:20}},{children:[t.jsxs("div",e.__assign({style:{position:"relative",display:"flex",flexDirection:"column",gap:6}},{children:[t.jsxs("label",e.__assign({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:[t.jsx("span",e.__assign({style:{marginRight:4,fontSize:16,fontWeight:600,color:"#8F2C23"}},{children:"*"})),ae]})),"Custom"===P?t.jsx(s.default,{value:L,onChange:function(t){if(t.length>50)return q(t.slice(0,50)),void k(function(t){return e.__assign(e.__assign({},t),{name:"".concat(ae," must be 50 characters or fewer")})});q(t),k(function(t){return e.__assign(e.__assign({},t),{name:void 0})})},onStationSelect:function(e){K(e)},style:{border:W.name?"1px solid #8F2C23":void 0}}):t.jsx(u.Input,{value:L,onChange:function(t){var n=t.target.value;if(n.length>50)return q(n.slice(0,50)),void k(function(t){return e.__assign(e.__assign({},t),{name:"".concat(ae," must be 50 characters or fewer")})});q(n),k(function(t){return e.__assign(e.__assign({},t),{name:void 0})})},style:{border:"1px solid ".concat(W.name?"#8F2C23":"#F0F2F5")},placeholder:E?"e.g. MarketPlace":"e.g. Global Learnings"}),W.name&&t.jsx("p",e.__assign({style:{margin:"4px 0 0 0",fontSize:12,color:"#8F2C23"}},{children:W.name}))]})),!E&&t.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:12}},{children:[t.jsxs("label",e.__assign({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:[t.jsx("span",e.__assign({style:{marginRight:4,fontSize:16,fontWeight:600,color:"#8F2C23"}},{children:"*"})),S.dt("".concat(v.MIDDLE_DRAWER_APPROVAL_SETTINGS_DT_PATH,".title"),"Learning Approval Settings")]})),t.jsxs("div",e.__assign({role:"radio","aria-checked":"approval_required"===J,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:4},onClick:function(){return Q("approval_required")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||Q("approval_required")}},{children:[t.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:8}},{children:[t.jsx("div",e.__assign({style:{display:"flex",height:16,width:16,flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("approval_required"===J?"#2563EB":"#CBD5E1")}},{children:"approval_required"===J&&t.jsx("div",{style:{height:8,width:8,borderRadius:"50%",backgroundColor:"#2563EB"}})})),t.jsx("span",e.__assign({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:S.dt("".concat(v.MIDDLE_DRAWER_APPROVAL_SETTINGS_DT_PATH,".approvalRequired.title"),"Approval Required Before Publishing")}))]})),t.jsx("p",e.__assign({style:{margin:0,marginLeft:24,fontSize:12,color:"#666F8D"}},{children:S.dt("".concat(v.MIDDLE_DRAWER_APPROVAL_SETTINGS_DT_PATH,".approvalRequired.subtitle"),"Learnings require approval before publishing.")}))]})),"approval_required"===J&&t.jsx(l.default,{selectedApprovers:Z,selectedGroupOfApprovers:te,onApproversChange:$,onGroupsChange:ne}),t.jsxs("div",e.__assign({role:"radio","aria-checked":"publish_without"===J,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:4},onClick:function(){Q("publish_without")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||Q("publish_without")}},{children:[t.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:8}},{children:[t.jsx("div",e.__assign({style:{display:"flex",height:16,width:16,flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("publish_without"===J?"#2563EB":"#CBD5E1")}},{children:"publish_without"===J&&t.jsx("div",{style:{height:8,width:8,borderRadius:"50%",backgroundColor:"#2563EB"}})})),t.jsx("span",e.__assign({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:S.dt("".concat(v.MIDDLE_DRAWER_APPROVAL_SETTINGS_DT_PATH,".publishWithoutApproval.title"),"Publish Without Approval")}))]})),t.jsx("p",e.__assign({style:{margin:0,marginLeft:24,fontSize:12,color:"#666F8D"}},{children:S.dt("".concat(v.MIDDLE_DRAWER_APPROVAL_SETTINGS_DT_PATH,".publishWithoutApproval.subtitle"),"Learnings can be published directly.")}))]}))]})),t.jsxs("div",e.__assign({style:{marginTop:32,display:"flex",justifyContent:"flex-end",gap:12}},{children:[t.jsx("button",e.__assign({onClick:b,style:{borderRadius:6,border:"1px solid #E2E8F0",padding:"8px 16px",fontSize:14,fontWeight:500,color:"#64748B",backgroundColor:"white",cursor:"pointer",opacity:le?.5:1},disabled:le},{children:S.dt("".concat(v.MIDDLE_DRAWER_ADD_SCOPE_DT_PATH,".cancel"),"Cancel")})),t.jsx("button",e.__assign({onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var t,n,r,i,o,s,l,c,u,d,p,_,S,v,m,D,C,E,R,T,j;return e.__generator(this,function(P){switch(P.label){case 0:if(t={},L.trim()?L.length>50&&(t.name="".concat(ae," must be 50 characters or fewer")):t.name="".concat(ae," is required"),t.name)return k(t),[2];P.label=1;case 1:return P.trys.push([1,8,9,10]),H(!0),n="approval_required"===J,r=h.useLearningTemplateStore.getState().backwardCompatibility,i=Z.length>0||te.length>0,o=r?{topic:x?"genreRuleSet":"globalRuleSet",customScopeGroupName:f.IL_CONFIG_CONSTANTS.CUSTOM_SCOPE_GROUP_NAME,scopeDescription:L,parentScopeId:null,customScopeName:L,customScopeId:a.v4(),createByName:(null==F?void 0:F.firstname)||"System",createdBy:(null==F?void 0:F.email)||"system@audacy.com",approvalRequired:n,appsecData:{application:null==B?void 0:B.applicationId,module:null==B?void 0:B.moduleId,roles:e.__spreadArray(e.__spreadArray([],n&&i?[{users:Z.map(function(e){return e.email}),groups:te.map(function(e){return e._id}),role:null!==(p=null===(d=N.find(function(e){return"Learning Manager"===e.name}))||void 0===d?void 0:d._id)&&void 0!==p?p:""}]:[],!0),[{users:[null==F?void 0:F.email],groups:[],role:null!==(S=null===(_=N.find(function(e){return"Instant Learning Admin"===e.name}))||void 0===_?void 0:_._id)&&void 0!==S?S:""}],!1)}}:{topic:x?"genreRuleSet":"globalRuleSet",scope_reference_id:null,scopeDescription:L,parentScopeId:null!=A?A:null,scopeName:L,scopeReferenceMetadata:{},scopeType:"Custom",applicationMappingId:h.useLearningTemplateStore.getState().app_integration_id,approvalRequired:n,appsecData:{application:null==B?void 0:B.applicationId,module:null==B?void 0:B.moduleId,roles:e.__spreadArray(e.__spreadArray([],n&&i?[{users:Z.map(function(e){return e.email}),groups:te.map(function(e){return e._id}),role:null!==(m=null===(v=N.find(function(e){return"Learning Manager"===e.name}))||void 0===v?void 0:v._id)&&void 0!==m?m:""}]:[],!0),[{users:[null==F?void 0:F.email],groups:[],role:null!==(C=null===(D=N.find(function(e){return"Instant Learning Admin"===e.name}))||void 0===D?void 0:D._id)&&void 0!==C?C:""}],!1)}},console.log("Add Scope payload:",o),[4,ce(o)];case 2:if(s=P.sent(),l=null===(E=null==s?void 0:s.data)||void 0===E?void 0:E.scopeId,r||!l||!A)return[3,7];ie(!0),P.label=3;case 3:return P.trys.push([3,5,6,7]),[4,g.inheritScope({source_scope_id:A,target_scope_id:l,application_mapping_id:h.useLearningTemplateStore.getState().app_integration_id||"",is_copy_parent_variant_id:!1})];case 4:return P.sent(),[3,7];case 5:return c=P.sent(),console.error("Failed to inherit rules for the new scope:",c),[3,7];case 6:return ie(!1),[7];case 7:return y(l),b(),[3,10];case 8:return u=P.sent(),console.error("An error occurred during scope creation.",u),null===(R=M.current)||void 0===R||R.show({severity:"error",summary:"Adding Scope Failed",detail:(null===(j=null===(T=null==u?void 0:u.response)||void 0===T?void 0:T.data)||void 0===j?void 0:j.message)||"There was an error creating the scope. Please try again."}),[3,10];case 9:return H(!1),[7];case 10: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:le||"Custom"===P&&!V?.5:1},disabled:le||"Custom"===P&&!V},{children:le?t.jsxs(t.Fragment,{children:[t.jsx(i.Loader2,{className:"animate-spin",style:{marginRight:8,height:16,width:16,color:"white"}}),"Creating..."]}):E?"SUBSCOPE"===R?"Create Subdomain":"Create Domain":S.dt("".concat(v.MIDDLE_DRAWER_ADD_SCOPE_DT_PATH,".submitButton"),"Create Scope")}))]}))]}))]}))]}))};
|
|
2
2
|
//# sourceMappingURL=AddScopeModal.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),s=require("react/jsx-runtime"),a=require("react"),l=require("lucide-react"),i=require("../styles/CreateLearningSetModal.module.css.js");exports.default=function(n){var r=n.isOpen,t=n.onClose,d=n.onSubmit,c=n.title,u=n.description,o=n.inputLabel,_=n.submitLabel,f=n.placeholder,m=void 0===f?"":f,v=n.initialValue,g=void 0===v?"":v,h=n.isLoading,x=void 0!==h&&h,j=a.useState(""),p=j[0],b=j[1],N=a.useState(null),C=N[0],q=N[1];if(a.useEffect(function(){r&&(b(g),q(null))},[r,g]),!r)return null;return s.jsx("div",e.__assign({className:i.default.overlay},{children:s.jsxs("div",e.__assign({className:i.default.modal},{children:[s.jsxs("div",e.__assign({className:i.default.header},{children:[s.jsxs("div",e.__assign({className:i.default.headerContent},{children:[s.jsx("h2",e.__assign({className:i.default.title},{children:c})),u&&s.jsx("p",e.__assign({className:i.default.description},{children:u}))]})),s.jsx("button",e.__assign({onClick:t,className:i.default.closeBtn,disabled:x},{children:s.jsx(l.X,{size:24})}))]})),s.jsx("div",e.__assign({className:i.default.form},{children:s.jsxs("div",e.__assign({className:i.default.formGroup},{children:[s.jsxs("label",e.__assign({className:i.default.label},{children:[s.jsx("span",e.__assign({className:i.default.asterisk},{children:"*"})),o]})),s.jsx("input",{type:"text",value:p,onChange:function(e){var s=e.target.value;if(s.length>50)return b(s.slice(0,50)),void q("Maximum 50 characters allowed");b(s),C&&q(null)},className:"".concat(i.default.inputField," ").concat(C?i.default.inputError:""),placeholder:m,disabled:x}),C&&s.jsx("p",e.__assign({className:i.default.errorMessage},{children:C}))]}))})),s.jsxs("div",e.__assign({className:i.default.footer},{children:[s.jsx("button",e.__assign({onClick:t,className:i.default.cancelBtn,disabled:x},{children:"Cancel"})),s.jsx("button",e.__assign({onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var s,a,l;return e.__generator(this,function(e){switch(e.label){case 0:if(!(p.trim()?(q(null),1):(q("".concat(o.replace("*","").trim()," is required")),0)))return[2];e.label=1;case 1:return e.trys.push([1,3,,4]),[4,d(p)];case 2:return e.sent(),t(),[3,4];case 3:return s=e.sent(),console.error("Error in submission",s),409===(null==s?void 0:s.status)?(q(null===(l=null===(a=null==s?void 0:s.response)||void 0===a?void 0:a.data)||void 0===l?void 0:l.message),[2]):(q((null==s?void 0:s.message)||"An error occurred. Please try again."),[3,4]);case 4:return[2]}})})},className:i.default.confirmBtn,disabled:x},{children:x?s.jsxs(s.Fragment,{children:[s.jsx(l.Loader2,{className:i.default.spinner}),"Save"===_?"Saving...":"Creating..."]}):_}))]}))]}))}))};
|
|
2
|
+
//# sourceMappingURL=CreateLearningSetModal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CreateLearningSetModal.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var i=require("tslib"),e=require("react/jsx-runtime"),t=require("lucide-react"),n=function(t){var n=t.width,s=void 0===n?"100%":n,r=t.height,x=void 0===r?"10px":r,o=t.style;return e.jsx("div",{style:i.__assign({width:s,height:x,backgroundColor:"#E2E8F0",borderRadius:"4px",backgroundImage:"linear-gradient(90deg, #E2E8F0 0px, #F1F5F9 40px, #E2E8F0 80px)",backgroundSize:"200px 100%",animation:"shimmer 1.5s ease-in-out infinite"},o)})},s=function(){return e.jsxs("div",i.__assign({style:{display:"flex",flexDirection:"column",gap:"12px",padding:"24px",backgroundColor:"#fff",borderRadius:"12px",border:"1px solid #E2E8F0",width:"100%"}},{children:[e.jsx(n,{width:"100%",height:"12px"}),e.jsx(n,{width:"85%",height:"10px"}),e.jsx("div",{style:{height:"8px"}}),e.jsx(n,{width:"60%",height:"12px"}),e.jsx(n,{width:"90%",height:"10px"}),e.jsx(n,{width:"75%",height:"10px"}),e.jsx("div",{style:{height:"8px"}}),e.jsx(n,{width:"40%",height:"12px"}),e.jsx(n,{width:"100%",height:"10px"}),e.jsx(n,{width:"80%",height:"10px"}),e.jsx("div",{style:{height:"8px"}}),e.jsx(n,{width:"55%",height:"12px"}),e.jsx(n,{width:"95%",height:"10px"}),e.jsx(n,{width:"70%",height:"10px"}),e.jsx(n,{width:"45%",height:"12px"}),e.jsx(n,{width:"88%",height:"10px"})]}))};exports.default=function(n){
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var i=require("tslib"),e=require("react/jsx-runtime"),t=require("lucide-react"),n=function(t){var n=t.width,s=void 0===n?"100%":n,r=t.height,x=void 0===r?"10px":r,o=t.style;return e.jsx("div",{style:i.__assign({width:s,height:x,backgroundColor:"#E2E8F0",borderRadius:"4px",backgroundImage:"linear-gradient(90deg, #E2E8F0 0px, #F1F5F9 40px, #E2E8F0 80px)",backgroundSize:"200px 100%",animation:"shimmer 1.5s ease-in-out infinite"},o)})},s=function(){return e.jsxs("div",i.__assign({style:{display:"flex",flexDirection:"column",gap:"12px",padding:"24px",backgroundColor:"#fff",borderRadius:"12px",border:"1px solid #E2E8F0",width:"100%"}},{children:[e.jsx(n,{width:"100%",height:"12px"}),e.jsx(n,{width:"85%",height:"10px"}),e.jsx("div",{style:{height:"8px"}}),e.jsx(n,{width:"60%",height:"12px"}),e.jsx(n,{width:"90%",height:"10px"}),e.jsx(n,{width:"75%",height:"10px"}),e.jsx("div",{style:{height:"8px"}}),e.jsx(n,{width:"40%",height:"12px"}),e.jsx(n,{width:"100%",height:"10px"}),e.jsx(n,{width:"80%",height:"10px"}),e.jsx("div",{style:{height:"8px"}}),e.jsx(n,{width:"55%",height:"12px"}),e.jsx(n,{width:"95%",height:"10px"}),e.jsx(n,{width:"70%",height:"10px"}),e.jsx(n,{width:"45%",height:"12px"}),e.jsx(n,{width:"88%",height:"10px"})]}))};exports.default=function(n){var r=n.isLoading,x=n.title,o=n.subtitle;return r?e.jsxs(e.Fragment,{children:[e.jsx("style",{children:"\n @keyframes shimmer {\n 0% {\n background-position: -200px 0;\n }\n 100% {\n background-position: calc(200px + 100%) 0;\n }\n }\n"}),e.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:99}}),e.jsxs("div",i.__assign({style:{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",backgroundColor:"#fff",borderRadius:"16px",boxShadow:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)",padding:"48px",maxWidth:"1000px",width:"70%",maxHeight:"90vh",display:"flex",flexDirection:"row",gap:"48px",zIndex:100,animation:"fadeIn 0.3s ease-out"}},{children:[e.jsxs("div",i.__assign({style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center"}},{children:[e.jsx("div",i.__assign({style:{marginBottom:"16px"}},{children:e.jsx(t.Sparkles,{size:32,color:"#7C3AED"})})),e.jsx("h2",i.__assign({style:{fontSize:"1.5rem",fontWeight:600,color:"#0F172A",margin:"0 0 8px 0"}},{children:null!=x?x:"Setting up your scope…"})),e.jsx("p",i.__assign({style:{fontSize:"0.875rem",color:"#64748B",margin:"0",lineHeight:"1.5"}},{children:null!=o?o:"Inheriting Learnings from Global. This will only take a moment."}))]})),e.jsx("div",i.__assign({style:{flex:1.5,display:"flex",alignItems:"center",justifyContent:"center",minWidth:"350px"}},{children:e.jsx(s,{})}))]})),e.jsx("style",{children:"\n @keyframes fadeIn {\n from {\n opacity: 0;\n transform: translate(-50%, -48%);\n }\n to {\n opacity: 1;\n transform: translate(-50%, -50%);\n }\n }\n "})]}):null};
|
|
2
2
|
//# sourceMappingURL=ScopeSkeletonLoader.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("zustand"),t=require("./useLearningTemplateStore.js"),n={pageTitle:"",middleDrawer:{scope:"",addScope:"",addSubScope:"",addScopeDialog:{title:"",globalTitle:"",subtitle:"",globalSubtitle:"",scopeName:"",learningApprovalSettings:{title:"",approvalRequired:{title:"",subtitle:""},publishWithoutApproval:{title:"",subtitle:""}},submitButton:"",cancel:""},treeMenu:{search:"",submenu:{learnings:"",access:"",changeHistory:""},contextMenu:{addScope:"",rename:"",delete:"",addSubScope:""}},scopeDisplayLimit:{enabled:"",count:"",compactView:"false",applyToLevels:"",viewMoreText:"",title:"",description:"",searchPlaceholder:"",onboardBtn:"",viewText:""}},learnings:{header:{title:"",exportButton:"",addNewLearningButton:""},tier:{showTierHeader:!0,tierHeader:"",subtitle:"",tierHeaderNoOfLearnings:"",deleteDialog:{title:"",description:"",cancel:"",submit:""},learning:{inheritance:"",actions:{disable:"",enable:"",approve:"",reject:"",delete:""},approveDialog:{title:"",desc:"",footer:"",cancel:"",approveLearning:""},rejectDialog:{title:"",desc:"",feedbackTitle:"",feedbackPlaceholder:"",deleteCheckboxLabel:"",cancel:"",rejectLearning:""},deleteDialog:{title:"",desc:"",warningText:"",cancelText:"",deleteText:""}}}},emptyStateLearning:{title:"",desc:"",createNewLearning:"",createGlobalScope:"",noAccessTitle:"",noAccessDesc:"",requestAccessButton:"",requestSentButton:""},agents:{LearningTerm:""},externalWorkflowMetaData:{enableExternalWorkflow:!0,current_mode:"",sub_mode:"",next_mode:"",externalWorkflowModal:{heading:"",options:{saveDraft:{title:"",desc:"",footerDesc:""},configureNow:{title:"",desc:"",footerDesc:""}}}}},a={showScope:!1,showConfiguration:!1,variantFlow:!0,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.."},o=e.create(function(e){return{lmsConfig:n,setLMSConfig:function(t){return e({lmsConfig:t})},clearLMSConfig:function(){return e({lmsConfig:n})}}});var l=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 l=o.getState().lmsConfig,i=e.split(".").reduce(function(e,t){return null==e?void 0:e[t]},l);return"string"!=typeof i||""===i?null!=n?n:e:i.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=l.getState().teachMeConfig,o=e.split(".").reduce(function(e,t){return null==e?void 0:e[t]},a);return"string"!=typeof o?null!=t?t:e:o.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=l.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.interpolate=function(e,t){return e.replace(/\{(\w+)\}/g,function(e,n){var a;return String(null!==(a=null==t?void 0:t[n])&&void 0!==a?a:"{".concat(n,"}"))})},exports.useLMSConfigStore=o,exports.useTeachMeConfigStore=l;
|
|
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:"",subScopeTitle:"",subtitle:"",globalSubtitle:"",subScopeSubtitle:"",scopeName:"",subScopeName:"",learningApprovalSettings:{title:"",approvalRequired:{title:"",subtitle:""},publishWithoutApproval:{title:"",subtitle:""}},submitButton:"",cancel:""},treeMenu:{search:"",submenu:{learnings:"",access:"",changeHistory:""},contextMenu:{addScope:"",rename:"",delete:"",addSubScope:""}},scopeDisplayLimit:{enabled:"",count:"",compactView:"false",applyToLevels:"",viewMoreText:"",title:"",description:"",searchPlaceholder:"",onboardBtn:"",viewText:""}},learnings:{header:{title:"",exportButton:"",addNewLearningButton:""},tier:{showTierHeader:!0,tierHeader:"",subtitle:"",tierHeaderNoOfLearnings:"",deleteDialog:{title:"",description:"",cancel:"",submit:""},learning:{inheritance:"",actions:{disable:"",enable:"",approve:"",reject:"",delete:""},approveDialog:{title:"",desc:"",footer:"",cancel:"",approveLearning:""},rejectDialog:{title:"",desc:"",feedbackTitle:"",feedbackPlaceholder:"",deleteCheckboxLabel:"",cancel:"",rejectLearning:""},deleteDialog:{title:"",desc:"",warningText:"",cancelText:"",deleteText:""}}}},emptyStateLearning:{title:"",desc:"",createNewLearning:"",createGlobalScope:"",noAccessTitle:"",noAccessDesc:"",requestAccessButton:"",requestSentButton:""},agents:{LearningTerm:""},externalWorkflowMetaData:{enableExternalWorkflow:!0,current_mode:"",sub_mode:"",next_mode:"",externalWorkflowModal:{heading:"",options:{saveDraft:{title:"",desc:"",footerDesc:""},configureNow:{title:"",desc:"",footerDesc:""}}}}},a={showScope:!1,showConfiguration:!1,variantFlow:!0,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.."},o=e.create(function(e){return{lmsConfig:n,setLMSConfig:function(t){return e({lmsConfig:t})},clearLMSConfig:function(){return e({lmsConfig:n})}}});var l=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 l=o.getState().lmsConfig,i=e.split(".").reduce(function(e,t){return null==e?void 0:e[t]},l);return"string"!=typeof i||""===i?null!=n?n:e:i.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=l.getState().teachMeConfig,o=e.split(".").reduce(function(e,t){return null==e?void 0:e[t]},a);return"string"!=typeof o?null!=t?t:e:o.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=l.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.interpolate=function(e,t){return e.replace(/\{(\w+)\}/g,function(e,n){var a;return String(null!==(a=null==t?void 0:t[n])&&void 0!==a?a:"{".concat(n,"}"))})},exports.useLMSConfigStore=o,exports.useTeachMeConfigStore=l;
|
|
2
2
|
//# sourceMappingURL=useLMSConfigStore.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});require("../../../node_modules/style-inject/dist/style-inject.es.js").default("@keyframes CreateLearningSetModal-module_spin__0BrCH{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.CreateLearningSetModal-module_overlay__iwLU2{align-items:center;background-color:#0000004d;bottom:0;display:flex;justify-content:center;left:0;position:absolute;right:0;top:0;z-index:9999}.CreateLearningSetModal-module_modal__TIP0O{background-color:#fff;border-radius:.75rem;box-shadow:0 25px 50px -12px #00000040;display:flex;flex-direction:column;max-width:90%;padding:1.5rem;position:relative;width:600px}.CreateLearningSetModal-module_header__alW8D{align-items:flex-start;display:flex;gap:1rem;justify-content:space-between;margin-bottom:1.5rem}.CreateLearningSetModal-module_headerContent__bxA6y{flex:1}.CreateLearningSetModal-module_title__vlj8Q{color:#19213d;font-size:1.125rem;font-weight:500;margin:0}.CreateLearningSetModal-module_description__TGliO{color:#666f8d;font-size:.875rem;font-weight:400;line-height:1.5;margin-top:.25rem}.CreateLearningSetModal-module_closeBtn__33qJN{align-items:center;background:#0000;border:none;border-radius:.375rem;color:#9ca3af;cursor:pointer;display:flex;justify-content:center;padding:.25rem;transition:color .2s,background-color .2s}.CreateLearningSetModal-module_closeBtn__33qJN:hover{background-color:#f3f4f6;color:#4b5563}.CreateLearningSetModal-module_closeBtn__33qJN:focus{outline:none}.CreateLearningSetModal-module_form__e8iCL{display:flex;flex-direction:column;gap:1.25rem}.CreateLearningSetModal-module_formGroup__RydF4{display:flex;flex-direction:column;gap:.375rem;position:relative}.CreateLearningSetModal-module_label__q-hkm{align-items:center;color:#19213d;display:flex;font-size:.875rem;font-weight:500}.CreateLearningSetModal-module_asterisk__cXpjU{color:#8f2c23;font-size:1rem;font-weight:600;margin-right:.25rem}.CreateLearningSetModal-module_inputField__nnq0-{background-color:#fff;border:1px solid #f0f2f5;border-radius:.375rem;box-sizing:border-box;color:#19213d;font-size:.875rem;outline:none;padding:.625rem .75rem;transition:border-color .2s,box-shadow .2s;width:100%}.CreateLearningSetModal-module_inputField__nnq0-::placeholder{color:#9ca3af}.CreateLearningSetModal-module_inputField__nnq0-:focus{border-color:#2563eb;box-shadow:0 0 0 2px #2563eb33}.CreateLearningSetModal-module_inputError__Q78Vy{border-color:#8f2c23}.CreateLearningSetModal-module_inputError__Q78Vy:focus{border-color:#8f2c23;box-shadow:0 0 0 2px #8f2c2333}.CreateLearningSetModal-module_errorMessage__z0WBC{color:#8f2c23;font-size:.75rem;font-weight:400;margin-top:.25rem}.CreateLearningSetModal-module_footer__qc-SJ{display:flex;gap:.75rem;justify-content:flex-end;margin-top:1rem}.CreateLearningSetModal-module_cancelBtn__YiIV7{background-color:initial;border:1px solid #e2e8f0;border-radius:.375rem;color:#64748b;cursor:pointer;font-size:.875rem;font-weight:500;padding:.5rem 1rem;transition:background-color .2s}.CreateLearningSetModal-module_cancelBtn__YiIV7:hover:not(:disabled){background-color:#f9fafb}.CreateLearningSetModal-module_cancelBtn__YiIV7:disabled{cursor:not-allowed;opacity:.5}.CreateLearningSetModal-module_confirmBtn__8oMwL{align-items:center;background-color:#2563eb;border:none;border-radius:.375rem;color:#fff;cursor:pointer;display:inline-flex;font-size:.875rem;font-weight:500;justify-content:center;padding:.5rem 1rem;transition:background-color .2s}.CreateLearningSetModal-module_confirmBtn__8oMwL:hover:not(:disabled){background-color:#1d4ed8}.CreateLearningSetModal-module_confirmBtn__8oMwL:disabled{cursor:not-allowed;opacity:.5}.CreateLearningSetModal-module_spinner__SERKD{animation:CreateLearningSetModal-module_spin__0BrCH 1s linear infinite;color:#fff;height:1rem;margin-right:.5rem;width:1rem}"),exports.default={overlay:"CreateLearningSetModal-module_overlay__iwLU2",modal:"CreateLearningSetModal-module_modal__TIP0O",header:"CreateLearningSetModal-module_header__alW8D",headerContent:"CreateLearningSetModal-module_headerContent__bxA6y",title:"CreateLearningSetModal-module_title__vlj8Q",description:"CreateLearningSetModal-module_description__TGliO",closeBtn:"CreateLearningSetModal-module_closeBtn__33qJN",form:"CreateLearningSetModal-module_form__e8iCL",formGroup:"CreateLearningSetModal-module_formGroup__RydF4",label:"CreateLearningSetModal-module_label__q-hkm",asterisk:"CreateLearningSetModal-module_asterisk__cXpjU",inputField:"CreateLearningSetModal-module_inputField__nnq0-",inputError:"CreateLearningSetModal-module_inputError__Q78Vy",errorMessage:"CreateLearningSetModal-module_errorMessage__z0WBC",footer:"CreateLearningSetModal-module_footer__qc-SJ",cancelBtn:"CreateLearningSetModal-module_cancelBtn__YiIV7",confirmBtn:"CreateLearningSetModal-module_confirmBtn__8oMwL",spinner:"CreateLearningSetModal-module_spinner__SERKD",spin:"CreateLearningSetModal-module_spin__0BrCH"};
|
|
2
|
+
//# sourceMappingURL=CreateLearningSetModal.module.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CreateLearningSetModal.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./features/InstantLearning/InstantLearning.js"),t=require("./features/WtaWnta/WtaWnta.js"),r=require("./features/DocumentLearning/DocumentLearning.js"),i=require("./features/IL-OTJ/ILOTJ.js"),n=require("./features/IL-OTJ/_components/atoms/Button/Button.js"),a=require("./features/IL-OTJ/_components/atoms/Dropdown/Dropdown.js"),s=require("./features/IL-OTJ/_components/atoms/Toggle/Toggle.js"),o=require("./features/IL-OTJ/_components/atoms/Textarea/Textarea.js"),u=require("./features/IL-OTJ/_components/molecules/Condition/ConditionList.js"),p=require("./features/IL-OTJ/_components/molecules/Sections/SectionWrapper.js"),l=require("./features/IL-OTJ/_components/molecules/SeperationRow/SeparationRow.js"),d=require("./features/IL-OTJ/_components/organisms/ConfigSection/ConfigSection.js"),c=require("./features/IL-OTJ/_components/organisms/TextSection/TextSection.js"),m=require("./features/IL-OTJ/_components/organisms/ScopeSection/ScopeSection.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./features/InstantLearning/InstantLearning.js"),t=require("./features/WtaWnta/WtaWnta.js"),r=require("./features/DocumentLearning/DocumentLearning.js"),i=require("./features/IL-OTJ/ILOTJ.js"),n=require("./features/IL-OTJ/_components/atoms/Button/Button.js"),a=require("./features/IL-OTJ/_components/atoms/Dropdown/Dropdown.js"),s=require("./features/IL-OTJ/_components/atoms/Toggle/Toggle.js"),o=require("./features/IL-OTJ/_components/atoms/Textarea/Textarea.js"),u=require("./features/IL-OTJ/_components/molecules/Condition/ConditionList.js"),p=require("./features/IL-OTJ/_components/molecules/Sections/SectionWrapper.js"),l=require("./features/IL-OTJ/_components/molecules/SeperationRow/SeparationRow.js"),d=require("./features/IL-OTJ/_components/organisms/ConfigSection/ConfigSection.js"),c=require("./features/IL-OTJ/_components/organisms/TextSection/TextSection.js"),m=require("./features/IL-OTJ/_components/organisms/ScopeSection/ScopeSection.js"),L=require("./features/IL-OTJ/_components/organisms/ConditionSection/ConditionSection.js"),x=require("./features/IL-OTJ/_components/templates/TrafficManager/TrafficManagerTemplate.js"),I=require("./features/IL-OTJ/_components/templates/Testing/Testing.js"),G=require("./features/IL-OTJ/_components/templates/TemplatesMap/templatesMap.js"),g=require("./features/IL-OTJ/helpers/utils.js"),T=require("./features/IL-OTJ/store/CitationsContext.js"),f=require("./features/IL-OTJ/ILOTJTest.js"),C=require("./features/LearningManagement/LearningManagement.js"),S=require("./ILMarketplaceWrapper.js"),j=require("./features/IL-OTJ/ValueTypeWrappers/TeachMePlugin.js");require("./features/LearningManagement/LearningManagementTest.js");var q=require("./api/transport.js"),_=require("./ContinueWithTemplateModal.js"),A=require("./features/IL-marketplace/components/GuidelineCart.js"),D=require("./features/IL-marketplace/components/GuidelineCartHeader.js"),k=require("./features/IL-marketplace/components/GuidelineCartItem.js"),E=require("./features/IL-marketplace/components/GuidelineEmptyState.js"),O=require("./features/IL-marketplace/components/GuidelineHeader.js"),M=require("./features/IL-marketplace/components/GuidelineIconButton.js"),W=require("./features/IL-marketplace/components/GuidelineLandingPage.js"),P=require("./features/IL-marketplace/components/GuidelineFilterPanel.js"),y=require("./features/IL-marketplace/components/GuidelineLibrary.js"),F=require("./features/IL-marketplace/components/GuidelineLibraryCard.js"),B=require("./features/IL-marketplace/components/LearningManagementWrapper.js"),J=require("./features/IL-marketplace/components/GuidelineProceedButton.js"),b=require("./features/IL-marketplace/components/GuidelineSelectButton.js"),h=require("./features/IL-marketplace/components/GuidelineCardMenu.js"),R=require("./features/IL-marketplace/components/GuidelineConfirmDialog.js"),U=require("./features/IL-marketplace/hooks/useGuidelineSelection.js"),v=require("./features/IL-marketplace/constants.js"),N=require("./features/IL-marketplace/utils.js"),w=require("./features/IL-marketplace/workspace/workspace.runtime.js"),V=require("./features/IL-marketplace/workspace/useGuidelineWorkspace.js"),H=require("./features/IL-marketplace/services/guideline.session.js"),K=require("./features/IL-marketplace/services/instant-learning.api.js"),Q=require("./features/IL-marketplace/utils/guidelineOverlay.js"),Y=require("./features/IL-marketplace/utils/guidelineFiles.js"),z=require("./features/IL-marketplace/services/guideline.cart.api.js"),X=require("./features/IL-marketplace/queryClient.js");exports.InstantLearning=e.default,exports.WtaWnta=t.default,exports.BookLearning=r.default,exports.ILOTJ=i.default,exports.Button=n.Button,exports.Dropdown=a.Dropdown,exports.Toggle=s.Toggle,exports.Textarea=o.Textarea,exports.ConditionList=u.ConditionList,exports.SectionWrapper=p.SectionWrapper,exports.SeparationRow=l.SeparationRow,exports.ConfigSection=d.ConfigSection,exports.TextSection=c.TextSection,exports.ScopeSection=m.ScopeSection,exports.ConditionSection=L.ConditionSection,exports.TrafficManagerTemplate=x.TrafficManagerTemplate,exports.Testing=I.Testing,Object.defineProperty(exports,"TemplateList",{enumerable:!0,get:function(){return G.TemplateList}}),exports.TemplateMap=G.TemplateMap,exports.extractAndParseResponse=g.extractAndParseResponse,exports.extractAndParseWithProperty=g.extractAndParseWithProperty,exports.extractTextFromChildren=g.extractTextFromChildren,exports.extractVariantIds=g.extractVariantIds,exports.parseValidationData=g.parseValidationData,exports.useHeaderObserver=g.useHeaderObserver,exports.CitationProvider=T.CitationProvider,exports.useCitations=T.useCitations,exports.dummyDat=f.dummyDat,exports.getVariantInfo=f.getVariantInfo,exports.LearningManagement=C.default,exports.ILMarketplaceWrapper=S.default,exports.IL_MARKETPLACE_TAB_ID=S.IL_MARKETPLACE_TAB_ID,exports.MY_KNOWLEDGE_BASES_TAB_ID=S.MY_KNOWLEDGE_BASES_TAB_ID,exports.SAVED_TAB_ID=S.SAVED_TAB_ID,exports.TeachMePlugin=j.default,exports.TemplateRegistry=j.TemplateRegistry,exports.setApiDebug=q.setApiDebug,exports.ContinueWithTemplateModal=_.default,exports.GuidelineCart=A.GuidelineCart,exports.GuidelineCartHeader=D.GuidelineCartHeader,exports.GuidelineCartItem=k.GuidelineCartItem,exports.GuidelineEmptyState=E.GuidelineEmptyState,exports.GuidelineHeader=O.GuidelineHeader,exports.GuidelineIconButton=M.GuidelineIconButton,exports.GuidelineLandingPage=W.GuidelineLandingPage,exports.GuidelineFilterPanel=P.GuidelineFilterPanel,exports.GuidelineLibrary=y.GuidelineLibrary,exports.GuidelineLibraryCard=F.GuidelineLibraryCard,exports.LearningManagementWrapper=B.LearningManagementWrapper,exports.GuidelineProceedButton=J.GuidelineProceedButton,exports.GuidelineSelectButton=b.GuidelineSelectButton,exports.GuidelineCardMenu=h.GuidelineCardMenu,exports.createGuidelineCardMenuItems=h.createGuidelineCardMenuItems,exports.GuidelineConfirmDialog=R.GuidelineConfirmDialog,exports.useGuidelineSelection=U.useGuidelineSelection,exports.CONFIGURABLE_GUIDELINE_STATUSES=v.CONFIGURABLE_GUIDELINE_STATUSES,exports.DEFAULT_GUIDELINE_ARTIFACT_TEMPLATE=v.DEFAULT_GUIDELINE_ARTIFACT_TEMPLATE,exports.DEFAULT_GUIDELINE_LABELS=v.DEFAULT_GUIDELINE_LABELS,exports.STATUS_ACTION_MODE_NAME=v.STATUS_ACTION_MODE_NAME,exports.createGuidelineId=N.createGuidelineId,exports.cx=N.cx,exports.defaultFormatAddedOnLabel=N.defaultFormatAddedOnLabel,exports.getAppIntegrationId=N.getAppIntegrationId,exports.getGuidelineDate=N.getGuidelineDate,exports.getGuidelineDescription=N.getGuidelineDescription,exports.getGuidelineDisplayDescription=N.getGuidelineDisplayDescription,exports.getGuidelineId=N.getGuidelineId,exports.getGuidelineTitle=N.getGuidelineTitle,exports.isInstantLearningGuideline=N.isInstantLearningGuideline,exports.mergeGuidelineLabels=N.mergeGuidelineLabels,exports.getGuidelineWorkspaceActions=w.getGuidelineWorkspaceActions,exports.getGuidelineWorkspaceSnapshot=w.getGuidelineWorkspaceSnapshot,exports.useGuidelineWorkspace=V.useGuidelineWorkspace,exports.useGuidelineWorkspaceActions=V.useGuidelineWorkspaceActions,exports.useOptionalGuidelineWorkspace=V.useOptionalGuidelineWorkspace,exports.useOptionalGuidelineWorkspaceActions=V.useOptionalGuidelineWorkspaceActions,exports.clearGuidelineCartClearPending=H.clearGuidelineCartClearPending,exports.clearInstantLearningGuidelineCartPresent=H.clearInstantLearningGuidelineCartPresent,exports.getGuidelineSessionId=H.getGuidelineSessionId,exports.markGuidelineCartClearPending=H.markGuidelineCartClearPending,exports.rotateGuidelineSessionId=H.rotateGuidelineSessionId,exports.removeInstantLearningGuidelinesFromCart=K.removeInstantLearningGuidelinesFromCart,exports.closeGuidelineOverlayWithSync=Q.closeGuidelineOverlayWithSync,exports.dataCartFileToGuidelineFileItem=Y.dataCartFileToGuidelineFileItem,exports.getDataCartFilesFromResponse=Y.getDataCartFilesFromResponse,exports.isGuidelineDataCartFile=Y.isGuidelineDataCartFile,exports.mergeGuidelineFiles=Y.mergeGuidelineFiles,exports.syncGuidelineCartWithMemstore=z.syncGuidelineCartWithMemstore,exports.guidelineQueryClient=X.guidelineQueryClient;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../store/useDynamicFormStore.js"),r=require("./aiReasoning.js"),t=function(e,r){return{cleanKey:e.replace("global.",""),isGlobal:e.startsWith("global.")||!r}},i=function(e){return!0===(null==e?void 0:e.is_repeatable_variant)||"VariantListWrapper"===(null==e?void 0:e.bpa_ui_component)};exports.applyResponseToStore=function(o,n,a,l,p){var s,u;if(n&&"object"==typeof n){var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../store/useDynamicFormStore.js"),r=require("./aiReasoning.js"),t=function(e,r){return{cleanKey:e.replace("global.",""),isGlobal:e.startsWith("global.")||!r}},i=function(e){return!0===(null==e?void 0:e.is_repeatable_variant)||"VariantListWrapper"===(null==e?void 0:e.bpa_ui_component)};exports.applyResponseToStore=function(o,n,a,l,p){var s,u;if(n&&"object"==typeof n){var c=e.useDynamicFormStore.getState(),d=c.setGlobalField,y=c.setVariantField,f=c.setGlobalReasoning,v=c.setVariantReasoning,_=!!a&&void 0!==l,b=Symbol("not-found"),g=null!==(u=null===(s=n.learning_metadata)||void 0===s?void 0:s.properties)&&void 0!==u?u:n.learning_metadata,h={rule_title:["title","ruleTitle"],rule_description:["description","variant_description"],wta:["whenToApply","when_to_apply"],wnta:["whenNotToApply","when_not_to_apply"]},j=function(e,o){void 0===o&&(o=!1),e&&Object.entries(e).forEach(function(e){var s=e[0],u=e[1];if(u.ui_only){if(i(u))return;u.properties&&j(u.properties,o)}else{if(u.data_key&&(!0===u.ai_generated||(null==p?void 0:p.hydrateAll))){var c=t(u.data_key,o),m=c.cleanKey,F=c.isGlobal,O=function(e,r){var t;if(r){if(Object.prototype.hasOwnProperty.call(n,e))return n[e];var i=null===(t=h[e])||void 0===t?void 0:t.find(function(e){return Object.prototype.hasOwnProperty.call(n,e)});return i?n[i]:b}if(g&&"object"==typeof g&&e in g){var o=g[e];return o&&"object"==typeof o&&!Array.isArray(o)&&"value"in o?o.value:o}return b}(s,!!u.core_field);if(O!==b&&("array"!==u.type&&Array.isArray(O)&&(O=O.join("\n")),void 0!==O)){var A=null;if(!("ConditionSection"===u.bpa_ui_component)&&"string"==typeof O&&O.includes("<ai_reasoning>")){var S=r.stripAiReasoning(O);O=S.clean,A=S.raw}F?(d(m,O),A&&f(m,A)):_&&(y(a,l,m,O),A&&v(a,l,m,A))}}u.properties&&!i(u)&&j(u.properties,o)}})},m=(null==o?void 0:o.properties)||{};(null==p?void 0:p.variantOnly)||j(m,!1);var F=Object.values(m).find(i);F&&F.properties&&j(F.properties,!0)}},exports.areRequiredFieldsFilled=function(r,o){var n=e.useDynamicFormStore.getState(),a=n.getGlobalField,l=n.getVariantField,p=(null==r?void 0:r.properties)||{},s=!0,u=function(e,r,o){e&&Object.entries(e).forEach(function(e){var n=e[1];if(!n.ui_only||!i(n)){if(n.data_key&&n.is_required){var p=t(n.data_key,void 0!==r),c=p.cleanKey;(function(e){return null!=e&&(Array.isArray(e)?e.length>0:"string"!=typeof e||""!==e.trim())})(p.isGlobal?a(c):l(r,o,c))||(s=!1)}n.properties&&!i(n)&&u(n.properties,r,o)}})};u(p);var c=Object.values(p).find(i);return(null==c?void 0:c.properties)&&o.forEach(function(e,r){e.forEach(function(e,t){u(c.properties,r,t)})}),s},exports.generatePayloadFromSchema=function(o,n,a){var l=e.useDynamicFormStore.getState(),p=l.getGlobalField,s=l.getVariantField,u={},c={},d=[],y=function(e,o){void 0===o&&(o=!1),e&&Object.entries(e).forEach(function(e){var l=e[0],f=e[1];if(f.ui_only){if(i(f))return;f.properties&&y(f.properties,o)}else{if(f.data_key){var v=t(f.data_key,o),_=v.cleanKey,b=v.isGlobal?p(_):s(n,a,_);void 0===b&&(b="array"===f.type?[]:"boolean"!==f.type&&("object"===f.type?{}:"")),"string"==typeof b&&b.includes("<ai_reasoning>")&&(b=r.stripAiReasoning(b).clean),f.core_field?u[l]=b:(c[l]=b,f.is_required&&!d.includes(l)&&d.push(l))}f.properties&&!i(f)&&y(f.properties,o)}})},f=(null==o?void 0:o.properties)||{};y(f,!1);var v=Object.values(f).find(i);return v&&v.properties&&y(v.properties,!0),{rootPayload:u,learningMetadata:{properties:c,required:d}}};
|
|
2
2
|
//# sourceMappingURL=PayloadUtils.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e}from"tslib";import{jsxs as i,jsx as l}from"react/jsx-runtime";import{useState as a,Fragment as
|
|
1
|
+
import{__assign as e}from"tslib";import{jsxs as i,jsx as l}from"react/jsx-runtime";import{useState as a,Fragment as t}from"react";import{ChevronRight as r,ChevronLeft as o}from"lucide-react";import{cx as n}from"../utils.js";import d from"./GuidelineLibrary.module.css.js";import{GuidelineLibraryTab as s}from"./GuidelineLibraryTab.js";import{GuidelineLibraryContent as c}from"./GuidelineLibraryContent.js";import{TreeSidebar as u}from"@e-llm-studio/creative-workspace-ui-component";var b=[0,1,1,2,0,1,2,1];function p(){return l("div",e({className:d.treeSidebarSkeleton},{children:b.map(function(a,t){return i("div",e({className:d.treeSidebarSkeletonRow,style:{paddingLeft:"".concat(1.25*a,"rem")}},{children:[l("div",{className:d.treeSidebarSkeletonIcon}),l("div",{className:d.treeSidebarSkeletonLine,style:{width:"".concat(65-10*a,"%")}})]}),t)})}))}function m(b){var m=b.guidelines,h=b.guidelineSections,v=b.cartGuidelineIds,L=b.emptyTitle,S=b.emptyDescription,y=b.addToCartLabel,C=b.addedToCartLabel,g=b.selectLabel,T=b.selectedLabel,f=b.exploreLabel,G=b.showMoreLabel,w=b.showLessLabel,N=b.initialVisibleCount,k=void 0===N?4:N;b.showRecentlyUsedTab;var D=b.onToggleGuideline,x=b.onPreviewGuideline,I=b.onExploreILGuideline,P=b.classNames,W=b.styles,B=b.customIcons,E=b.subTitleLayout,O=b.formatAddedOnLabel,H=b.onEditGuideline,V=b.onDuplicateGuideline,j=b.onDeleteGuideline,A=b.hideEditOption,M=b.hideDuplicateOption,R=b.hideDeleteOption,U=b.onTabSelection,q=b.searchProps;b.treeSearchProps;var z=b.filterProps,F=b.showDashboardButton,J=void 0!==F&&F,K=b.onDashboardClick,Q=b.isLoading,X=b.instantLearning,Y=b.fetchWishlistStatus,Z=b.onWishlistToggle,$=b.onVersionSelect,_=b.treeSidebarProps,ee=b.isTreeSidebarLoading,ie=b.cartAction,le=b.isILMarketplace,ae=void 0!==le&&le,te=b.handleViewButtonCallback,re=b.handlePreviewButtonCallback;b.statusActions;var oe=b.scopeLabel,ne=void 0===oe?"Scope":oe,de=a(!1),se=de[0],ce=de[1];return i("section",e({className:n(d.library,null==P?void 0:P.library),style:null==W?void 0:W.library},{children:[i("div",e({className:n(d.libraryTabsContainer,null==P?void 0:P.libraryTabs),style:null==W?void 0:W.libraryTabs},{children:[l("div",e({className:d.libraryTabsScrollArea},{children:null==h?void 0:h.map(function(e){return l(t,{children:l(s,{section:e,classNames:P,styles:W,onTabSelection:U})},e.id)})})),ie]})),i("div",e({className:n(d.guidelineLibraryContent,null==P?void 0:P.guideLineLibraryContent),style:null==W?void 0:W.guideLineLibraryContent},{children:[_&&i("div",e({className:n(d.treeSidebarWrapper,se?d.treeSidebarCollapsed:d.treeSidebarExpanded,null==P?void 0:P.treeSidebarWrapper,se&&(null==P?void 0:P.treeSidebarCollapsedWrapper)),style:e(e({},null==W?void 0:W.treeSidebarWrapper),se&&(null==W?void 0:W.treeSidebarCollapsedWrapper))},{children:[i("div",e({className:n(d.treeSidebarHeading,se&&d.treeSidebarHeadingCollapsed,null==P?void 0:P.treeSidebarHeading),style:null==W?void 0:W.treeSidebarHeading},{children:[!se&&l("p",e({className:n(d.treeSidebarHeadingText,null==P?void 0:P.treeSidebarHeadingText),style:null==W?void 0:W.treeSidebarHeadingText},{children:ne})),l("button",e({type:"button",onClick:function(){return ce(function(e){return!e})},"aria-label":se?"Expand scope sidebar":"Collapse scope sidebar","aria-expanded":!se,title:se?"Expand scope sidebar":"Collapse scope sidebar",className:n(d.treeSidebarCollapseButton,null==P?void 0:P.treeSidebarCollapseButton),style:null==W?void 0:W.treeSidebarCollapseButton},{children:l(se?r:o,{strokeWidth:2,className:n(d.treeSidebarCollapseIcon,null==P?void 0:P.treeSidebarCollapseIcon),style:null==W?void 0:W.treeSidebarCollapseIcon})}))]})),!se&&(ee?l(p,{}):l(u,e({},_)))]})),l(c,{guidelines:m,cartGuidelineIds:v,addToCartLabel:y,addedToCartLabel:C,selectLabel:g,selectedLabel:T,exploreLabel:f,showMoreLabel:G,showLessLabel:w,initialVisibleCount:k,onToggleGuideline:D,onPreviewGuideline:x,onExploreILGuideline:I,classNames:P,styles:W,customIcons:B,subTitleLayout:E,formatAddedOnLabel:O,onEditGuideline:H,onDuplicateGuideline:V,onDeleteGuideline:j,hideEditOption:A,hideDuplicateOption:M,hideDeleteOption:R,searchProps:q,filterProps:z,showDashboardButton:J,onDashboardClick:K,isLoading:Q,emptyTitle:L,emptyDescription:S,instantLearning:X,fetchWishlistStatus:Y,onWishlistToggle:Z,onVersionSelect:$,isILMarketplace:ae,handleViewButtonCallback:te,handlePreviewButtonCallback:re})]}))]}))}export{m as GuidelineLibrary};
|
|
2
2
|
//# sourceMappingURL=GuidelineLibrary.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e,__spreadArray as t,__awaiter as i,__generator as l}from"tslib";import{jsx as r,jsxs as n,Fragment as a}from"react/jsx-runtime";import{useRef as o,useState as s,useEffect as c}from"react";import{Check as d,Plus as u,Share as h,Share2 as p,ChevronDown as m,EllipsisVertical as v,Heart as b,Eye as y}from"lucide-react";import f from"./GuidelineLibraryCard.module.css.js";import{getGuidelineId as C,getGuidelineTitle as N,getGuidelineDisplayDescription as w,getGuidelineDate as g,isInstantLearningGuideline as B,cx as k}from"../utils.js";import{GuidelineIconButton as D}from"./GuidelineIconButton.js";import{createGuidelineCardMenuItems as S,GuidelineCardMenu as L}from"./GuidelineCardMenu.js";import{GuidelineConfirmDialog as T}from"./GuidelineConfirmDialog.js";import{GuidelineStatusChip as W}from"./GuidelineStatusChip.js";function I(I){var P,A,_,j,G,x,O,F,M=this,H=I.guideline,V=I.isSelected,E=I.addToCartLabel,R=I.addedToCartLabel,U=I.selectLabel,q=void 0===U?"Select":U,z=I.selectedLabel,J=void 0===z?"Selected":z,K=I.onToggle,Q=I.onPreview,X=I.onExplore;I.onEdit;var Y=I.onDuplicate,Z=I.onDelete;I.hideEditOption,I.hideDuplicateOption;var $=I.hideDeleteOption,ee=void 0!==$&&$;I.editOptionLabel,I.duplicateOptionLabel;var te=I.deleteOptionLabel,ie=void 0===te?"Delete":te,le=I.duplicateConfirmTitle,re=void 0===le?"Duplicate Guideline":le,ne=I.duplicateConfirmDescription,ae=I.duplicateConfirmLabel,oe=void 0===ae?"Duplicate":ae,se=I.deleteConfirmTitle,ce=void 0===se?"Delete Guideline":se,de=I.deleteConfirmDescription,ue=I.deleteConfirmLabel,he=void 0===ue?"Delete":ue,pe=I.classNames,me=I.styles,ve=I.customIcons,be=I.subTitleLayout,ye=I.instantLearning,fe=I.formatAddedOnLabel;I.fetchWishlistStatus;var Ce=I.onWishlistToggle,Ne=I.onVersionSelect,we=I.isILMarketplace,ge=void 0!==we&&we,Be=I.handleViewButtonCallback,ke=I.handlePreviewButtonCallback,De=C(H),Se=N(H),Le=w(H),Te=fe(g(H)),We=null===(P=H.created_by)||void 0===P?void 0:P.trim(),Ie=[We?"Created by ".concat(We):"",Te].filter(Boolean).join(" • "),Pe=new Date(g(H)||Date.now()),Ae="template"===be,_e=Pe.toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"}),je=Pe.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}),Ge="".concat(_e," at ").concat(je),xe=[We?"Created by ".concat(We):"",Ge].filter(Boolean).join(" • "),Oe=null!==(_=null!==(A=H.content_type_title)&&void 0!==A?A:H.category)&&void 0!==_?_:"Requirement AI Template",Fe=B(H),Me=!0===H.is_legacy,He=H.status,Ve=V?null!==(j=null==ve?void 0:ve.selectedIcon)&&void 0!==j?j:r(d,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2.6}):null!==(G=null==ve?void 0:ve.unselectedIcon)&&void 0!==G?G:r(u,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2.6}),Ee=null!==(x=null==ve?void 0:ve.shareIcon)&&void 0!==x?x:r(h,{className:"h-5 w-5",strokeWidth:2.2}),Re=Fe?q:E,Ue=Fe?J:R,qe=Fe?H.topic_name:void 0,ze=null===(O=H.application_mapping_ids)||void 0===O?void 0:O[0],Je=null!==(F=H.version_list)&&void 0!==F?F:[],Ke=H.version,Qe=ge&&Je.length>0,Xe=o(null),Ye=s(!1),Ze=Ye[0],$e=Ye[1],et=s(!1),tt=et[0],it=et[1],lt=s(!1),rt=lt[0],nt=lt[1],at=s(!1),ot=at[0],st=at[1],ct=s(!1),dt=ct[0],ut=ct[1],ht=s(!1);ht[0];var pt=ht[1],mt=s(!!H.is_wishlisted),vt=mt[0],bt=mt[1],yt=s(!1),ft=yt[0],Ct=yt[1],Nt=null!=ne?ne:'Are you sure you want to duplicate "'.concat(Se,'"? A copy will be created with "(1)" appended to the title.'),wt=null!=de?de:'Are you sure you want to delete "'.concat(Se,'"? This action cannot be undone.');c(function(){bt(!!H.is_wishlisted)},[H.is_wishlisted]);var gt=function(){ge&&ke?ke(H):Fe&&X?X(H):Q(H)},Bt=function(e){ge&&Be?Be(H):K(e)},kt=S({onDelete:function(){return st(!0)},deleteLabel:ie,hideDelete:ee||!Z}),Dt=kt.some(function(e){return!e.hidden});return n(a,{children:[n("article",e({onClick:function(e){e.target.closest('button, a, input, select, textarea, [role="button"]')||gt()},className:k(f.libraryCard,null==pe?void 0:pe.libraryCard),style:null==me?void 0:me.libraryCard},{children:[n("div",e({className:k(f.libraryCardHeader,null==pe?void 0:pe.libraryCardHeader),style:null==me?void 0:me.libraryCardHeader},{children:[n("div",e({className:f.libraryCardHeaderContent},{children:[n("div",e({className:f.libraryCardTitleWrapper},{children:[Me&&r("span",e({className:f.legacyBadge},{children:"Legacy"})),r("h3",e({className:k(f.libraryCardTitle,null==pe?void 0:pe.libraryCardTitle),style:null==me?void 0:me.libraryCardTitle,title:Se},{children:Se})),Fe&&r(W,{status:He})]})),"template"===be?r("p",e({className:k(f.libraryCardDate,null==pe?void 0:pe.libraryCardDate),style:null==me?void 0:me.libraryCardDate,title:xe},{children:xe})):Ie?r("p",e({className:k(f.libraryCardDate,null==pe?void 0:pe.libraryCardDate),style:null==me?void 0:me.libraryCardDate,title:Ie},{children:Ie})):null]})),n("div",e({className:k(f.libraryCardActions,null==pe?void 0:pe.libraryCardActions),style:null==me?void 0:me.libraryCardActions},{children:[Fe&&!Ae&&!ge&&r(D,e({slot:"shareGuideline",label:"Share ".concat(Se),title:"Share",onClick:function(){return pt(!0)},classNames:pe,styles:me},{children:r(p,{className:f.shareIcon,strokeWidth:2.2})})),Qe&&n("div",e({className:f.versionSelectWrapper},{children:[r("select",e({value:Ke,disabled:tt,onClick:function(e){return e.stopPropagation()},onChange:function(e){var t;e.stopPropagation(),t=Number(e.target.value),i(M,void 0,void 0,function(){var e;return l(this,function(i){switch(i.label){case 0:if(!Ne||t===Ke)return[2];it(!0),i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,Ne(H,t)];case 2:return i.sent(),[3,5];case 3:return e=i.sent(),console.error("Version switch failed:",e),[3,5];case 4:return it(!1),[7];case 5:return[2]}})})},className:f.versionSelect,"aria-label":"Select version for ".concat(Se),title:"Select version"},{children:t([],Je,!0).sort(function(e,t){return t-e}).map(function(t){return n("option",e({value:t},{children:["v",t]}),t)})})),r(m,{className:f.versionSelectChevron,strokeWidth:2.2})]})),n("div",e({className:"relative"},{children:[r(D,e({slot:"libraryCardMoreButton",label:"More options for ".concat(Se),title:"More options",onClick:function(){return Dt?$e(function(e){return!e}):void 0},classNames:pe,styles:me,ref:Xe},{children:r(v,{className:f.moreIcon,strokeWidth:2.2})})),Dt&&r(L,{open:Ze,onClose:function(){return $e(!1)},anchorRef:Xe,items:kt,classNames:pe,styles:me})]}))]}))]})),r("p",e({className:k(f.libraryCardDescription,null==pe?void 0:pe.libraryCardDescription),style:null==me?void 0:me.libraryCardDescription,title:Le},{children:Le})),Ae&&n("p",e({className:f.contentTypeLabel},{children:["Content Type :"," ",r("span",e({className:f.contentTypeLabelValue},{children:Oe}))]})),qe&&n("p",e({className:f.topicLabel},{children:[r("span",e({className:"flex-shrink-0"},{children:"Topic:"})),r("span",e({className:f.topicLabelBadge},{children:qe}))]})),n("div",e({className:k(f.libraryCardFooter,null==pe?void 0:pe.libraryCardFooter),style:null==me?void 0:me.libraryCardFooter},Fe?{children:[n("div",e({className:f.libraryCardFooterActions},{children:[!Me&&r("button",e({type:"button",onClick:function(e){return i(M,void 0,void 0,function(){var t,i;return l(this,function(l){switch(l.label){case 0:if(e.stopPropagation(),!Ce||!(null==ye?void 0:ye.token)||!ze)return[2];t=!vt,Ct(!0),l.label=1;case 1:return l.trys.push([1,3,4,5]),[4,Ce(ze,t,ye.token)];case 2:return l.sent(),bt(t),[3,5];case 3:return i=l.sent(),console.error("Wishlist operation failed:",i),[3,5];case 4:return Ct(!1),[7];case 5:return[2]}})})},disabled:ft,className:k(f.wishlistButton,vt?f.wishlistButtonWishlisted:f.wishlistButtonNotWishlisted,ft&&f.wishlistButtonDisabled),"aria-label":vt?"Remove ".concat(Se," from wishlist"):"Add ".concat(Se," to wishlist")},{children:r(b,{className:f.wishlistIcon,fill:vt?"currentColor":"none",strokeWidth:2.2})})),r("button",e({type:"button",onClick:gt,className:f.previewButton,"aria-label":"Preview ".concat(Se),title:"Preview"},{children:r(y,{className:f.previewIcon,strokeWidth:2.2})})),Ae&&!ge&&r("button",e({type:"button",onClick:function(e){e.stopPropagation(),pt(!0)},className:f.previewButton,"aria-label":"Share ".concat(Se),title:"Share"},{children:Ee}))]})),n("button",e({type:"button",onClick:function(){return Bt(De)},"aria-pressed":V,className:k(f.selectButton,V?f.selectButtonSelected:f.selectButtonNotSelected,null==pe?void 0:pe.libraryCardSelectButton),style:null==me?void 0:me.libraryCardSelectButton},{children:[Ve,r("span",e({className:f.selectButtonLabel},{children:V?Ue:Re}))]}))]}:{children:[r("div",e({className:f.libraryCardFooterActions},{children:r("button",e({type:"button",onClick:gt,className:f.previewButton,"aria-label":"Preview ".concat(Se),title:"Preview"},{children:r(y,{className:f.previewIcon,strokeWidth:2.2})}))})),n("button",e({type:"button",onClick:function(){return Bt(De)},"aria-pressed":V,className:k(f.selectButton,f.selectButtonFullWidth,V?f.selectButtonSelected:f.selectButtonNotSelected,null==pe?void 0:pe.libraryCardSelectButton),style:null==me?void 0:me.libraryCardSelectButton},{children:[Ve,r("span",e({className:f.selectButtonLabel},{children:V?Ue:Re}))]}))]}))]})),r(T,{open:rt,onClose:function(){return nt(!1)},onConfirm:function(){return i(M,void 0,void 0,function(){return l(this,function(e){switch(e.label){case 0:if(!Y)return[2];ut(!0),e.label=1;case 1:return e.trys.push([1,,3,4]),[4,Promise.resolve(Y(H))];case 2:return e.sent(),[3,4];case 3:return ut(!1),nt(!1),[7];case 4:return[2]}})})},title:re,description:Nt,confirmLabel:oe,loading:dt,classNames:pe,styles:me}),r(T,{open:ot,onClose:function(){return st(!1)},onConfirm:function(){return i(M,void 0,void 0,function(){return l(this,function(e){switch(e.label){case 0:if(!Z)return[2];ut(!0),e.label=1;case 1:return e.trys.push([1,,3,4]),[4,Promise.resolve(Z(H))];case 2:return e.sent(),[3,4];case 3:return ut(!1),st(!1),[7];case 4:return[2]}})})},title:ce,description:wt,confirmLabel:he,variant:"danger",loading:dt,classNames:pe,styles:me})]})}export{I as GuidelineLibraryCard};
|
|
1
|
+
import{__assign as e,__spreadArray as t,__awaiter as l,__generator as i}from"tslib";import{jsx as n,jsxs as r,Fragment as a}from"react/jsx-runtime";import{useRef as o,useState as s,useEffect as c}from"react";import{Check as d,Plus as u,Share as v,Share2 as m,ChevronDown as h,EllipsisVertical as p,Heart as b,Eye as y}from"lucide-react";import f from"./GuidelineLibraryCard.module.css.js";import{STATUS_ACTION_MODE_NAME as C,CONFIGURABLE_GUIDELINE_STATUSES as N}from"../constants.js";import{getGuidelineId as w,getGuidelineTitle as g,getGuidelineDisplayDescription as L,getGuidelineDate as B,isInstantLearningGuideline as k,cx as D}from"../utils.js";import{GuidelineIconButton as S}from"./GuidelineIconButton.js";import{createGuidelineCardMenuItems as T,GuidelineCardMenu as W}from"./GuidelineCardMenu.js";import{GuidelineConfirmDialog as A}from"./GuidelineConfirmDialog.js";import{GuidelineStatusChip as I}from"./GuidelineStatusChip.js";function P(P){var _,j,G,x,O,F,M,H,V,E,R=this,U=P.guideline,q=P.isSelected,z=P.addToCartLabel,J=P.addedToCartLabel,K=P.selectLabel,Q=void 0===K?"Select":K,X=P.selectedLabel,Y=void 0===X?"Selected":X,Z=P.onToggle,$=P.onPreview,ee=P.onExplore;P.onEdit;var te=P.onDuplicate,le=P.onDelete;P.hideEditOption,P.hideDuplicateOption;var ie=P.hideDeleteOption,ne=void 0!==ie&&ie;P.editOptionLabel,P.duplicateOptionLabel;var re=P.deleteOptionLabel,ae=void 0===re?"Delete":re,oe=P.duplicateConfirmTitle,se=void 0===oe?"Duplicate Guideline":oe,ce=P.duplicateConfirmDescription,de=P.duplicateConfirmLabel,ue=void 0===de?"Duplicate":de,ve=P.deleteConfirmTitle,me=void 0===ve?"Delete Guideline":ve,he=P.deleteConfirmDescription,pe=P.deleteConfirmLabel,be=void 0===pe?"Delete":pe,ye=P.classNames,fe=P.styles,Ce=P.customIcons,Ne=P.subTitleLayout,we=P.instantLearning,ge=P.formatAddedOnLabel;P.fetchWishlistStatus;var Le=P.onWishlistToggle,Be=P.onVersionSelect,ke=P.isILMarketplace,De=void 0!==ke&&ke,Se=P.handleViewButtonCallback,Te=P.handlePreviewButtonCallback,We=P.statusActions,Ae=w(U),Ie=g(U),Pe=L(U),_e=ge(B(U)),je=null===(_=U.created_by)||void 0===_?void 0:_.trim(),Ge=[je?"Created by ".concat(je):"",_e].filter(Boolean).join(" • "),xe=new Date(B(U)||Date.now()),Oe="template"===Ne,Fe=xe.toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"}),Me=xe.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}),He="".concat(Fe," at ").concat(Me),Ve=[je?"Created by ".concat(je):"",He].filter(Boolean).join(" • "),Ee=null!==(G=null!==(j=U.content_type_title)&&void 0!==j?j:U.category)&&void 0!==G?G:"Requirement AI Template",Re=k(U),Ue=!0===U.is_legacy,qe=U.status,ze=q?null!==(x=null==Ce?void 0:Ce.selectedIcon)&&void 0!==x?x:n(d,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2.6}):null!==(O=null==Ce?void 0:Ce.unselectedIcon)&&void 0!==O?O:n(u,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2.6}),Je=null!==(F=null==Ce?void 0:Ce.shareIcon)&&void 0!==F?F:n(v,{className:"h-5 w-5",strokeWidth:2.2}),Ke=Re?Q:z,Qe=Re?Y:J,Xe=(null==We?void 0:We.modeName)===C,Ye=N.includes((null!=qe?qe:"").trim().toLowerCase()),Ze=Xe?Ye?null!==(M=null==We?void 0:We.configureLabel)&&void 0!==M?M:"Configure":null!==(H=null==We?void 0:We.testLabel)&&void 0!==H?H:"Test Template":q?Qe:Ke,$e=Re?U.topic_name:void 0,et=null===(V=U.application_mapping_ids)||void 0===V?void 0:V[0],tt=null!==(E=U.version_list)&&void 0!==E?E:[],lt=U.version,it=De&&tt.length>0,nt=o(null),rt=s(!1),at=rt[0],ot=rt[1],st=s(!1),ct=st[0],dt=st[1],ut=s(!1),vt=ut[0],mt=ut[1],ht=s(!1),pt=ht[0],bt=ht[1],yt=s(!1),ft=yt[0],Ct=yt[1],Nt=s(!1);Nt[0];var wt=Nt[1],gt=s(!!U.is_wishlisted),Lt=gt[0],Bt=gt[1],kt=s(!1),Dt=kt[0],St=kt[1],Tt=null!=ce?ce:'Are you sure you want to duplicate "'.concat(Ie,'"? A copy will be created with "(1)" appended to the title.'),Wt=null!=he?he:'Are you sure you want to delete "'.concat(Ie,'"? This action cannot be undone.');c(function(){Bt(!!U.is_wishlisted)},[U.is_wishlisted]);var At=function(){De&&Te?Te(U):Re&&ee?ee(U):$(U)},It=function(e){var t,l;Xe?Ye?null===(t=null==We?void 0:We.onConfigure)||void 0===t||t.call(We,U):null===(l=null==We?void 0:We.onTest)||void 0===l||l.call(We,U):De&&Se?Se(U):Z(e)},Pt=T({onDelete:function(){return bt(!0)},deleteLabel:ae,hideDelete:ne||!le}),_t=Pt.some(function(e){return!e.hidden});return r(a,{children:[r("article",e({onClick:function(e){e.target.closest('button, a, input, select, textarea, [role="button"]')||At()},className:D(f.libraryCard,null==ye?void 0:ye.libraryCard),style:null==fe?void 0:fe.libraryCard},{children:[r("div",e({className:D(f.libraryCardHeader,null==ye?void 0:ye.libraryCardHeader),style:null==fe?void 0:fe.libraryCardHeader},{children:[r("div",e({className:f.libraryCardHeaderContent},{children:[r("div",e({className:f.libraryCardTitleWrapper},{children:[Ue&&n("span",e({className:f.legacyBadge},{children:"Legacy"})),n("h3",e({className:D(f.libraryCardTitle,null==ye?void 0:ye.libraryCardTitle),style:null==fe?void 0:fe.libraryCardTitle,title:Ie},{children:Ie})),Re&&n(I,{status:qe})]})),"template"===Ne?n("p",e({className:D(f.libraryCardDate,null==ye?void 0:ye.libraryCardDate),style:null==fe?void 0:fe.libraryCardDate,title:Ve},{children:Ve})):Ge?n("p",e({className:D(f.libraryCardDate,null==ye?void 0:ye.libraryCardDate),style:null==fe?void 0:fe.libraryCardDate,title:Ge},{children:Ge})):null]})),r("div",e({className:D(f.libraryCardActions,null==ye?void 0:ye.libraryCardActions),style:null==fe?void 0:fe.libraryCardActions},{children:[Re&&!Oe&&!De&&n(S,e({slot:"shareGuideline",label:"Share ".concat(Ie),title:"Share",onClick:function(){return wt(!0)},classNames:ye,styles:fe},{children:n(m,{className:f.shareIcon,strokeWidth:2.2})})),it&&r("div",e({className:f.versionSelectWrapper},{children:[n("select",e({value:lt,disabled:ct,onClick:function(e){return e.stopPropagation()},onChange:function(e){var t;e.stopPropagation(),t=Number(e.target.value),l(R,void 0,void 0,function(){var e;return i(this,function(l){switch(l.label){case 0:if(!Be||t===lt)return[2];dt(!0),l.label=1;case 1:return l.trys.push([1,3,4,5]),[4,Be(U,t)];case 2:return l.sent(),[3,5];case 3:return e=l.sent(),console.error("Version switch failed:",e),[3,5];case 4:return dt(!1),[7];case 5:return[2]}})})},className:f.versionSelect,"aria-label":"Select version for ".concat(Ie),title:"Select version"},{children:t([],tt,!0).sort(function(e,t){return t-e}).map(function(t){return r("option",e({value:t},{children:["v",t]}),t)})})),n(h,{className:f.versionSelectChevron,strokeWidth:2.2})]})),r("div",e({className:"relative"},{children:[n(S,e({slot:"libraryCardMoreButton",label:"More options for ".concat(Ie),title:"More options",onClick:function(){return _t?ot(function(e){return!e}):void 0},classNames:ye,styles:fe,ref:nt},{children:n(p,{className:f.moreIcon,strokeWidth:2.2})})),_t&&n(W,{open:at,onClose:function(){return ot(!1)},anchorRef:nt,items:Pt,classNames:ye,styles:fe})]}))]}))]})),n("p",e({className:D(f.libraryCardDescription,null==ye?void 0:ye.libraryCardDescription),style:null==fe?void 0:fe.libraryCardDescription,title:Pe},{children:Pe})),Oe&&r("p",e({className:f.contentTypeLabel},{children:["Content Type :"," ",n("span",e({className:f.contentTypeLabelValue},{children:Ee}))]})),$e&&r("p",e({className:f.topicLabel},{children:[n("span",e({className:"flex-shrink-0"},{children:"Topic:"})),n("span",e({className:f.topicLabelBadge},{children:$e}))]})),r("div",e({className:D(f.libraryCardFooter,null==ye?void 0:ye.libraryCardFooter),style:null==fe?void 0:fe.libraryCardFooter},Re?{children:[r("div",e({className:f.libraryCardFooterActions},{children:[!Ue&&n("button",e({type:"button",onClick:function(e){return l(R,void 0,void 0,function(){var t,l;return i(this,function(i){switch(i.label){case 0:if(e.stopPropagation(),!Le||!(null==we?void 0:we.token)||!et)return[2];t=!Lt,St(!0),i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,Le(et,t,we.token)];case 2:return i.sent(),Bt(t),[3,5];case 3:return l=i.sent(),console.error("Wishlist operation failed:",l),[3,5];case 4:return St(!1),[7];case 5:return[2]}})})},disabled:Dt,className:D(f.wishlistButton,Lt?f.wishlistButtonWishlisted:f.wishlistButtonNotWishlisted,Dt&&f.wishlistButtonDisabled),"aria-label":Lt?"Remove ".concat(Ie," from wishlist"):"Add ".concat(Ie," to wishlist")},{children:n(b,{className:f.wishlistIcon,fill:Lt?"currentColor":"none",strokeWidth:2.2})})),n("button",e({type:"button",onClick:At,className:f.previewButton,"aria-label":"Preview ".concat(Ie),title:"Preview"},{children:n(y,{className:f.previewIcon,strokeWidth:2.2})})),Oe&&!De&&n("button",e({type:"button",onClick:function(e){e.stopPropagation(),wt(!0)},className:f.previewButton,"aria-label":"Share ".concat(Ie),title:"Share"},{children:Je}))]})),r("button",e({type:"button",onClick:function(){return It(Ae)},"aria-pressed":q,className:D(f.selectButton,q?f.selectButtonSelected:f.selectButtonNotSelected,null==ye?void 0:ye.libraryCardSelectButton),style:null==fe?void 0:fe.libraryCardSelectButton},{children:[ze,n("span",e({className:f.selectButtonLabel},{children:Ze}))]}))]}:{children:[n("div",e({className:f.libraryCardFooterActions},{children:n("button",e({type:"button",onClick:At,className:f.previewButton,"aria-label":"Preview ".concat(Ie),title:"Preview"},{children:n(y,{className:f.previewIcon,strokeWidth:2.2})}))})),r("button",e({type:"button",onClick:function(){return It(Ae)},"aria-pressed":q,className:D(f.selectButton,f.selectButtonFullWidth,q?f.selectButtonSelected:f.selectButtonNotSelected,null==ye?void 0:ye.libraryCardSelectButton),style:null==fe?void 0:fe.libraryCardSelectButton},{children:[ze,n("span",e({className:f.selectButtonLabel},{children:Ze}))]}))]}))]})),n(A,{open:vt,onClose:function(){return mt(!1)},onConfirm:function(){return l(R,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:if(!te)return[2];Ct(!0),e.label=1;case 1:return e.trys.push([1,,3,4]),[4,Promise.resolve(te(U))];case 2:return e.sent(),[3,4];case 3:return Ct(!1),mt(!1),[7];case 4:return[2]}})})},title:se,description:Tt,confirmLabel:ue,loading:ft,classNames:ye,styles:fe}),n(A,{open:pt,onClose:function(){return bt(!1)},onConfirm:function(){return l(R,void 0,void 0,function(){return i(this,function(e){switch(e.label){case 0:if(!le)return[2];Ct(!0),e.label=1;case 1:return e.trys.push([1,,3,4]),[4,Promise.resolve(le(U))];case 2:return e.sent(),[3,4];case 3:return Ct(!1),bt(!1),[7];case 4:return[2]}})})},title:me,description:Wt,confirmLabel:be,variant:"danger",loading:ft,classNames:ye,styles:fe})]})}export{P as GuidelineLibraryCard};
|
|
2
2
|
//# sourceMappingURL=GuidelineLibraryCard.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e={landingBreadcrumbLabel:"Agent Guidelines",landingTitle:"Set Your Agent's Guidelines",landingDescription:"Add a set of guidelines that shape how your agent behaves, responds, and interprets.",landingDebugLabel:"Know more about debug mode",landingAddGuidelineLabel:"Add New Set of Guidelines",savedTabLabel:"Saved",recentTabLabel:"Recently used",libraryEmptyTitle:"No saved guidelines",libraryEmptyDescription:"Create a new guideline to start building your session rules.",libraryAddToCart:"Add to Cart",libraryAddedToCart:"Added to Cart",librarySelect:"Select",librarySelected:"Selected",libraryExplore:"Explore",libraryShowMore:"Show more guidelines",libraryShowLess:"Show fewer guidelines",cartTitle:"Guideline Cart",cartDescription:"Guidelines added to your current session",emptyCartTitle:"No guidelines added",emptyCartDescription:"Your selected guidelines will appear here.",proceedButton:"Proceed with Selected",addGuidelineLabel:"Add guideline",selectedBadge:function(e){return"".concat(e," Selected")},landingDebugTooltipContent:"Debug Mode is a transparency and control mechanism designed to intercept prompt submissions before they are dispatched to the LLM to help users test and debug with different guidelines rapidly. It serves as an approval gate, allowing users to verify, configure, and approve the guideline payload for a specific query.",createGuidelinesTooltipContent:"Topics are used to optimize guideline ingestion and retrieval. Select the closest matching topic for the best results.",popoverDebugTooltipContent:"Debug Mode is a transparency and control mechanism designed to intercept prompt submissions before they are dispatched to the LLM to help users test and debug with different guidelines rapidly. It serves as an approval gate, allowing users to verify, configure, and approve the guideline payload for a specific query."},
|
|
1
|
+
var e="RequirementV3",t=["draft"],a={landingBreadcrumbLabel:"Agent Guidelines",landingTitle:"Set Your Agent's Guidelines",landingDescription:"Add a set of guidelines that shape how your agent behaves, responds, and interprets.",landingDebugLabel:"Know more about debug mode",landingAddGuidelineLabel:"Add New Set of Guidelines",savedTabLabel:"Saved",recentTabLabel:"Recently used",libraryEmptyTitle:"No saved guidelines",libraryEmptyDescription:"Create a new guideline to start building your session rules.",libraryAddToCart:"Add to Cart",libraryAddedToCart:"Added to Cart",librarySelect:"Select",librarySelected:"Selected",libraryExplore:"Explore",libraryShowMore:"Show more guidelines",libraryShowLess:"Show fewer guidelines",cartTitle:"Guideline Cart",cartDescription:"Guidelines added to your current session",emptyCartTitle:"No guidelines added",emptyCartDescription:"Your selected guidelines will appear here.",proceedButton:"Proceed with Selected",addGuidelineLabel:"Add guideline",selectedBadge:function(e){return"".concat(e," Selected")},landingDebugTooltipContent:"Debug Mode is a transparency and control mechanism designed to intercept prompt submissions before they are dispatched to the LLM to help users test and debug with different guidelines rapidly. It serves as an approval gate, allowing users to verify, configure, and approve the guideline payload for a specific query.",createGuidelinesTooltipContent:"Topics are used to optimize guideline ingestion and retrieval. Select the closest matching topic for the best results.",popoverDebugTooltipContent:"Debug Mode is a transparency and control mechanism designed to intercept prompt submissions before they are dispatched to the LLM to help users test and debug with different guidelines rapidly. It serves as an approval gate, allowing users to verify, configure, and approve the guideline payload for a specific query."},i={data:{_id:"",artifactId:"",artifactTitle:"",artifactTitleIDs:[],artifactData:{final_response_gs_url:"",citationsSnapshot:{image_citations:[],appmod_citations:[],audio_citations:[],file_citations:[],web_citations:[],pdf_citations:[],gpt_citations:[]},projectIdSnapshot:"",userStorySnapshot:[],breadCrumbsSnapShot:[],activePageSnapShot:"",aiReasoningsSnapshot:[],dataSources_files:{},knowledgeBaseSnapshot:[],projectAnalyserSummarySnapshot:[],chatHistorySnapshot:[],persistedDataFilesSnapshot:{},risk_gap_items_json:{},selectedCodebasesSnapshot:[],selectedUserStoryTypeSnapshot:""},dataSources_files:{},modeName:"",modeId:null,artifactSubTitle:"",isLoading:!1,widgetName:"user story",userEmail:"",optionalData:{},created_at:"",updated_at:""},counter:{ai_reasoning_id_counter:0,pdf_citation_id_counter:0,section_number:0}},o={applicationName:"Instant Learning Mode",applicationId:"6a329da7232364c90e1b6a00",moduleId:"6a329da7232364c90e1b6a42",applicationModuleId:"6a329da7232364c90e1b6a3e",applicationResourceId:"6a32a08c232364c90e1b6a56",appsecRbacUrl:"https://dev-cw-appsec.techo.camp/granularApi",appsecBaseUrl:"https://dev-cw-appsec.techo.camp"},n={IMAGES:"images",MEETING_RECORDINGS:"meeting-recordings",DOCUMENTS:"documents",STORMEE_CONVERSATIONS:"stormee-conversations",REQUIREMENT_DOCUMENTS:"requirement-documents",CODEBASE_KNOWLEDGE:"codebase-knowledge",GUIDELINES:"guidelines"},s={GUIDELINE:"guideline",CONTEXT:"context"},r={IN_PROGRESS:"In-Progress",INGESTION_COMPLETE:"Completed",INGESTION_FAILED:"Failed"},d="GUIDELINE_SESSION_ID";export{s as ADD_CONTEXT_FILE_TYPES,t as CONFIGURABLE_GUIDELINE_STATUSES,i as DEFAULT_GUIDELINE_ARTIFACT_TEMPLATE,a as DEFAULT_GUIDELINE_LABELS,o as FALLBACK_RBAC_CONFIG,r as FILE_INGESTION_STATUS,d as GUIDELINE_SESSION_ID,n as SOURCE_IDS,e as STATUS_ACTION_MODE_NAME};
|
|
2
2
|
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{__spreadArray as t,__assign as e}from"tslib";import{jsxs as n,jsx as i}from"react/jsx-runtime";import{useState as r,useEffect as c}from"react";import{Check as a,Eye as l,X as o}from"lucide-react";import d from"./Cart.styles.js";function s(t){try{var e=new Date(t),n=e.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}),i=e.toLocaleDateString("en-GB").replace(/\//g,"/");return"Added on - ".concat(n," | ").concat(i)}catch(e){return t}}function h(h){var u=h.items,m=h.onRemove,p=h.onProceed,f=r(new Set),g=f[0],y=f[1];c(function(){1!==u.length?y(function(e){var n=new Set(u.map(function(t){return t.instant_learning_id})),i=new Set(t([],e,!0).filter(function(t){return n.has(t)}));return i.size===e.size?e:i}):y(new Set([u[0].instant_learning_id]))},[u]);var v=u.filter(function(t){return g.has(t.instant_learning_id)});return n("section",e({style:d.cartSection},{children:[n("div",e({style:d.cartHeaderRow},{children:[i("p",e({style:d.cartTitle},{children:"Guideline Cart"})),n("span",e({style:d.cartBadge},{children:[u.length," Added"]}))]})),i("p",e({style:d.cartDescription},{children:u.length>1?"Click items to select them for this session":"Selected for this session"})),i("div",e({style:d.cartBody},{children:i("div",e({style:d.cartList},{children:0===u.length?i("div",e({style:d.emptyState},{children:"No guidelines added yet"})):u.map(function(t){var r=g.has(t.instant_learning_id);return n("div",e({style:r?d.cartItemSelected:d.cartItem,onClick:function(){return e=t.instant_learning_id,void y(function(t){var n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});var e}},{children:[n("div",e({style:d.cartItemTop},{children:[n("div",e({style:d.cartItemTopLeft},{children:[i("span",e({style:r?d.cartCheckbox:d.cartCheckboxEmpty},{children:r&&i(a,{size:12,strokeWidth:3})})),i("p",e({style:d.cartItemName},{children:t.instant_learning_title}))]})),n("div",e({style:d.cartItemIcons},{children:[i(l,{size:16,strokeWidth:2}),i("button",e({type:"button",style:d.removeBtn,onClick:function(e){return function(t,e){t.stopPropagation(),y(function(t){if(!t.has(e))return t;var n=new Set(t);return n.delete(e),n}),m(e)}(e,t.instant_learning_id)}},{children:i(o,{size:16,strokeWidth:2})}))]}))]})),i("p",e({style:d.cartItemDescription},{children:t.instant_learning_description})),i("p",e({style:d.cartItemDate},{children:s(t.created_at)}))]}),t.instant_learning_id)})}))})),i("button",e({type:"button",style:v.length>0?d.proceedButton:d.proceedButtonDisabled,disabled:0===v.length,onClick:function(){return v.length>0&&p(v)}},{children:n("span",{children:["Proceed with Selected",v.length>1?" (".concat(v.length,")"):""]})}))]}))}export{h as Cart,h as default};
|
|
2
|
+
//# sourceMappingURL=Cart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Cart.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e={cartSection:{display:"flex",width:"100%",flexDirection:"column",borderRadius:12,border:"1px solid #5B2CF4",background:"#F5F1FF",padding:28,fontFamily:"Inter, sans-serif",boxShadow:"0 1px 4px rgba(16,24,40,0.04)"},cartHeaderRow:{display:"flex",alignItems:"center",gap:12},cartTitle:{fontSize:18,fontWeight:700,color:"#1F2937",margin:0},cartBadge:{display:"inline-flex",height:24,alignItems:"center",borderRadius:9999,background:"#EDE7FF",padding:"0 12px",fontSize:12,fontWeight:600,color:"#5B2CF4",whiteSpace:"nowrap"},cartDescription:{marginTop:4,fontSize:13,color:"#667085"},cartBody:{marginTop:24,minHeight:280,flex:"1 1 0%",overflow:"hidden"},cartList:{maxHeight:420,overflowY:"auto",paddingRight:8,display:"flex",flexDirection:"column",gap:16},emptyState:{display:"flex",alignItems:"center",justifyContent:"center",height:120,fontSize:14,color:"#98A2B3"},cartItem:{display:"flex",flexDirection:"column",borderRadius:10,border:"1px solid #EAECF0",background:"#ffffff",padding:16,cursor:"pointer"},cartItemSelected:{display:"flex",flexDirection:"column",borderRadius:10,border:"2px solid #4438F5",background:"#F5F3FF",padding:16,cursor:"pointer"},cartItemTop:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:8},cartItemTopLeft:{display:"flex",alignItems:"center",gap:8,minWidth:0},cartCheckbox:{display:"inline-flex",height:18,width:18,flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:4,background:"#4438F5",color:"#ffffff"},cartCheckboxEmpty:{display:"inline-flex",height:18,width:18,flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:4,border:"2px solid #D0D5DD",background:"#ffffff"},cartItemName:{fontSize:14,fontWeight:600,color:"#1F2937",margin:0,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},cartItemIcons:{display:"flex",alignItems:"center",gap:10,flexShrink:0,color:"#98A2B3"},cartItemDescription:{marginTop:8,fontSize:13,color:"#667085"},cartItemDate:{marginTop:8,fontSize:12,color:"#98A2B3"},proceedButton:{marginTop:24,display:"inline-flex",height:44,width:"100%",alignItems:"center",justifyContent:"center",gap:8,borderRadius:6,background:"#4438F5",fontSize:15,fontWeight:600,color:"#ffffff",border:"none",boxShadow:"0 1px 2px rgba(16,24,40,0.08)",cursor:"pointer"},proceedButtonDisabled:{marginTop:24,display:"inline-flex",height:44,width:"100%",alignItems:"center",justifyContent:"center",gap:8,borderRadius:6,background:"#C4C9D4",fontSize:15,fontWeight:600,color:"#ffffff",border:"none",cursor:"not-allowed"},removeBtn:{background:"none",border:"none",padding:0,cursor:"pointer",display:"flex",alignItems:"center",color:"#98A2B3"}};export{e as default};
|
|
2
|
+
//# sourceMappingURL=Cart.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Cart.styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{__assign as t}from"tslib";import{jsxs as e,jsx as r}from"react/jsx-runtime";import{BookOpen as i,Eye as n,MoreVertical as o,UserCheck as d,Compass as c,Check as l,Plus as s}from"lucide-react";import a from"./GuidelineCard.styles.js";function u(t){try{var e=new Date(t),r=e.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}),i=e.toLocaleDateString("en-GB").replace(/\//g,"/");return"Added on - ".concat(r," | ").concat(i)}catch(e){return t}}function h(h){var p=h.guideline,y=h.inCart,f=h.onToggleCart,m=h.onExplore;return e("div",t({style:a.card},{children:[e("div",t({style:a.cardTop},{children:[e("div",t({style:a.cardTopLeft},{children:[r(i,{size:18,strokeWidth:2,color:"#6D5BFF"}),r("p",t({style:a.cardTitle},{children:p.instant_learning_title}))]})),e("div",t({style:a.cardTopIcons},{children:[r(n,{size:16,strokeWidth:2}),r(o,{size:16,strokeWidth:2}),r(d,{size:16,strokeWidth:2})]}))]})),r("p",t({style:a.cardDescription},{children:p.instant_learning_description})),r("p",t({style:a.cardDate},{children:u(p.created_at)})),e("div",t({style:a.cardActionsRow},{children:[e("button",t({type:"button",style:a.exploreButton,onClick:function(){return null==m?void 0:m(p)}},{children:[r(c,{size:15,strokeWidth:2.4}),r("span",{children:"Explore"})]})),e("button",y?t({type:"button",style:a.cardAddedButton,onClick:function(){return f(p)}},{children:[r(l,{size:16,strokeWidth:2.4}),r("span",{children:"Selected"})]}):t({type:"button",style:a.cardAddButton,onClick:function(){return f(p)}},{children:[r(s,{size:16,strokeWidth:2.4}),r("span",{children:"Select"})]}))]}))]}))}export{h as GuidelineCard,h as default};
|
|
2
|
+
//# sourceMappingURL=GuidelineCard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GuidelineCard.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e={card:{display:"flex",flexDirection:"column",borderRadius:10,border:"1px solid #EAECF0",background:"#ffffff",padding:20,boxShadow:"0 1px 2px rgba(16,24,40,0.04)"},cardTop:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:8},cardTopLeft:{display:"flex",alignItems:"center",gap:8,minWidth:0},cardTitle:{fontSize:15,fontWeight:600,lineHeight:"24px",color:"#1F2937",margin:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},cardTopIcons:{display:"flex",alignItems:"center",gap:10,flexShrink:0,color:"#98A2B3"},cardDescription:{marginTop:8,fontSize:13,lineHeight:"19px",color:"#667085",overflow:"hidden",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},cardDate:{marginTop:12,fontSize:12,color:"#98A2B3"},cardActions:{marginTop:16},cardAddButton:{display:"inline-flex",height:36,flex:1,alignItems:"center",justifyContent:"center",gap:8,borderRadius:6,border:"1px solid #4438F5",background:"#ffffff",fontSize:13,fontWeight:600,color:"#4438F5",cursor:"pointer"},cardAddedButton:{display:"inline-flex",height:36,flex:1,alignItems:"center",justifyContent:"center",gap:8,borderRadius:6,border:"1px solid #EAE7FF",background:"#EDE9FE",fontSize:13,fontWeight:600,color:"#4438F5",cursor:"pointer"},exploreButton:{display:"inline-flex",height:36,flex:1,alignItems:"center",justifyContent:"center",gap:6,borderRadius:6,border:"1px solid #D0D5DD",background:"#ffffff",fontSize:13,fontWeight:600,color:"#344054",cursor:"pointer"},cardActionsRow:{display:"flex",gap:8,marginTop:16}};export{e as default};
|
|
2
|
+
//# sourceMappingURL=GuidelineCard.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GuidelineCard.styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{__assign as e,__awaiter as n,__generator as t}from"tslib";import{jsx as i,jsxs as r,Fragment as o}from"react/jsx-runtime";import{useState as l,useEffect as d}from"react";import{CircleHelp as a,Plus as s,UserCheck as u,Clock3 as c,ShoppingBag as p,Search as h,Check as f,ChevronDown as m,ChevronUp as g}from"lucide-react";import{fetchGuidelineInstances as b}from"./api.js";import{GuidelineCard as y}from"./GuidelineCard.js";import{Cart as _}from"./Cart/Cart.js";import{LearningManagementWrapper as v}from"./LearningManagementWrapper.js";import k from"./GuidelinesLandingPage.styles.js";import{OutlinedInput as C,InputAdornment as z}from"@mui/material";import{transformSelectedToILData as S}from"./transformSelectedGuidelineData.js";function w(e,n){var t,i,r,o;return n?null!==(o=null===(r=e.mode_mappings.find(function(e){return e.mode_id===n}))||void 0===r?void 0:r.application_integration_id)&&void 0!==o?o:"":null!==(i=null===(t=e.mode_mappings[0])||void 0===t?void 0:t.application_integration_id)&&void 0!==i?i:""}function A(A){var W=A.baseUrl,x=A.baseWebsocketUrl,B=A.token,F=A.userDetails,I=A.modeId,U=A.assistantName,j=A.appsecRbacUrl,G=A.appsecBaseUrl,L=A.onProceedSelected,T=l([]),D=T[0],E=T[1],M=l(6),R=M[0],N=M[1],O=l([]),P=O[0],H=O[1],K=l(!1),q=K[0],J=K[1],Q=l(null),V=Q[0],X=Q[1],Y=l(null),Z=Y[0],$=Y[1],ee=l(""),ne=ee[0],te=ee[1],ie=l(""),re=ie[0],oe=ie[1];d(function(){var e=setTimeout(function(){oe(ne.trim())},750);return function(){return clearTimeout(e)}},[ne]),d(function(){N(6)},[re]),d(function(){J(!0),X(null),b(W,B).then(function(e){E(e.data)}).catch(function(e){return X(e.message)}).finally(function(){return J(!1)})},[W,B]);var le=new Set(P.map(function(e){return e.instant_learning_id}));function de(e){H(function(n){return n.some(function(n){return n.instant_learning_id===e.instant_learning_id})?n.filter(function(n){return n.instant_learning_id!==e.instant_learning_id}):[e]})}var ae=re.length>=2?D.filter(function(e){var n,t,i=re.toLowerCase();return(null===(n=e.instant_learning_title)||void 0===n?void 0:n.toLowerCase().includes(i))||(null===(t=e.instant_learning_description)||void 0===t?void 0:t.toLowerCase().includes(i))}):D,se=ae.slice(0,R),ue=ae.length-R,ce=R>6;return i("div",e({style:k.page},{children:r("main",e({style:k.main},{children:[r("section",e({style:k.headerSection},{children:[r("div",e({style:k.intro},{children:[i("h1",e({style:k.title},{children:"Add Guidelines"})),i("p",e({style:k.description},{children:"Add guidelines that shape how your agent behaves, responds, and interprets."})),r("button",e({type:"button",style:k.debugLink},{children:[i("span",{children:"Know more about debug mode"}),i(a,{size:18,strokeWidth:2})]}))]})),r("button",e({type:"button",style:k.addButton},{children:[i(s,{size:20,strokeWidth:2.4}),i("span",{children:"Add Guideline"})]}))]})),r("section",e({style:k.bodySection},{children:[r("section",e({style:k.librarySection},{children:[r("div",e({style:k.libraryTabs},{children:[r("button",e({type:"button",style:e(e({},k.tab),k.tabActive)},{children:[i(u,{size:18,strokeWidth:2}),i("span",{children:"Saved"})]})),r("button",e({type:"button",style:k.tab},{children:[i(c,{size:18,strokeWidth:2}),i("span",{children:"Recently used"})]})),r("button",e({type:"button",style:k.tab},{children:[i(p,{size:18,strokeWidth:2}),i("span",{children:"Marketplace"})]}))]})),!Z&&i("div",e({style:{position:"sticky",top:0,zIndex:10,backgroundColor:"#FFFFFF",paddingTop:12,backdropFilter:"blur(8px)"}},{children:i(C,{placeholder:"Search Guideline",value:ne,onChange:function(e){return te(e.target.value)},size:"small",startAdornment:i(z,e({position:"start"},{children:i(h,{size:16,color:"#9CA3AF"})})),sx:{width:"280px",borderRadius:"8px",fontSize:"14px","& .MuiOutlinedInput-notchedOutline":{borderColor:"#E5E7EB"},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:"#D1D5DB"},bgcolor:"#fff"}})})),Z?i(v,{userDetails:F,baseUrl:W,baseWebsocketUrl:x,assistantName:U,appsecRbacUrl:j,appsecBaseUrl:G,appIntegrationId:w(Z,I),modeId:I,guidelineTitle:Z.instant_learning_title,onBack:function(){return $(null)},headerActions:le.has(Z.instant_learning_id)?r("button",e({type:"button",style:k.cardAddedButton,onClick:function(){return de(Z)}},{children:[i(f,{size:16,strokeWidth:2.4}),i("span",{children:"Added to Cart"})]})):r("button",e({type:"button",style:k.cardAddButton,onClick:function(){return de(Z)}},{children:[i(s,{size:16,strokeWidth:2.4}),i("span",{children:"Add to Cart"})]}))}):r(o,{children:[q&&i("p",e({style:k.loadingState},{children:"Loading guidelines..."})),V&&r("p",e({style:k.errorState},{children:["Error: ",V]})),!q&&!V&&i(o,{children:0===ae.length?i("p",e({style:k.loadingState},{children:re.length>=2?"No guidelines match your search.":"No guidelines found."})):r(o,{children:[i("div",e({style:k.libraryGrid},{children:se.map(function(e){return i(y,{guideline:e,inCart:le.has(e.instant_learning_id),onToggleCart:de,onExplore:$},e.instant_learning_id)})})),r("div",e({style:{display:"flex",alignItems:"center",gap:16}},{children:[ue>0&&r("button",e({type:"button",style:k.showMore,onClick:function(){return N(function(e){return e+6})}},{children:[r("span",{children:["Show more guidelines (",ue,")"]}),i(m,{size:16,strokeWidth:2.4})]})),ce&&r("button",e({type:"button",style:k.showMore,onClick:function(){return N(6)}},{children:[i("span",{children:"Hide"}),i(g,{size:16,strokeWidth:2.4})]}))]}))]})})]})]})),i(_,{items:P,onRemove:function(e){H(function(n){return n.filter(function(n){return n.instant_learning_id!==e})})},onProceed:function(e){return n(this,void 0,void 0,function(){var n,i;return t(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,S(e,I,F.accessToken)];case 1:return n=t.sent(),console.log("Proceeding with il_data:",n),L(n),[3,3];case 2:return i=t.sent(),console.error("Error building il_data for selected guidelines:",i),[3,3];case 3:return[2]}})})}})]}))]}))}))}export{A as GuidelineLandingPage,A as default};
|
|
2
|
+
//# sourceMappingURL=GuidelinesLandingPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GuidelinesLandingPage.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e={page:{height:"100%",width:"100%",background:"#ffffff",fontFamily:"Inter, sans-serif"},main:{height:"100%",overflow:"auto",padding:40},headerSection:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:24,justifyContent:"space-between",alignItems:"flex-start"},intro:{minWidth:280,flex:"1 1 0%"},title:{fontSize:30,fontWeight:700,lineHeight:"38px",color:"#6D35F2",margin:0},description:{marginTop:8,fontSize:19,lineHeight:"28px",color:"#1F2937"},debugLink:{marginTop:12,display:"inline-flex",alignItems:"center",gap:8,fontSize:14,fontWeight:500,color:"#53657D",background:"none",border:"none",padding:0,cursor:"pointer"},addButton:{display:"inline-flex",height:44,minWidth:210,flexShrink:0,alignItems:"center",justifyContent:"center",gap:12,borderRadius:6,background:"#4438F5",padding:"0 20px",fontSize:15,fontWeight:600,color:"#ffffff",border:"none",boxShadow:"0 1px 2px rgba(16,24,40,0.08)",cursor:"pointer",marginLeft:"auto"},bodySection:{marginTop:48,display:"grid",width:"100%",gridTemplateColumns:"minmax(0,1fr) minmax(300px,360px)",alignItems:"start",gap:24},librarySection:{minWidth:0},libraryTabs:{display:"flex",borderBottom:"1px solid #EAECF0"},tab:{position:"relative",display:"inline-flex",height:40,alignItems:"center",gap:8,padding:"0 16px",fontSize:14,fontWeight:500,background:"none",border:"none",cursor:"pointer",color:"#B5BDC8"},tabActive:{color:"#1F2937",boxShadow:"inset 0 -3px 0 0 #6D5BFF"},libraryGrid:{marginTop:24,display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",gap:20},cardAddButton:{display:"inline-flex",height:36,flex:1,alignItems:"center",justifyContent:"center",gap:8,borderRadius:6,border:"1px solid #4438F5",background:"#ffffff",fontSize:13,fontWeight:600,color:"#4438F5",cursor:"pointer"},cardAddedButton:{display:"inline-flex",height:36,flex:1,alignItems:"center",justifyContent:"center",gap:8,borderRadius:6,border:"1px solid #EAE7FF",background:"#EDE9FE",fontSize:13,fontWeight:600,color:"#4438F5",cursor:"pointer"},showMore:{marginTop:28,display:"inline-flex",alignItems:"center",gap:8,fontSize:14,fontWeight:600,color:"#5B2CF4",background:"none",border:"none",cursor:"pointer"},loadingState:{marginTop:24,fontSize:14,color:"#667085"},errorState:{marginTop:24,fontSize:14,color:"#F04438"}};export{e as default};
|
|
2
|
+
//# sourceMappingURL=GuidelinesLandingPage.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GuidelinesLandingPage.styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{__assign as e}from"tslib";import{jsx as a,jsxs as i}from"react/jsx-runtime";import{useState as t,useEffect as n}from"react";import{ArrowLeft as o}from"lucide-react";import{QueryClient as l,QueryClientProvider as r}from"@tanstack/react-query";import c from"../LearningManagement/LearningManagement.js";import{fetchRBACConfig as d}from"./api.js";var p={config:{CUSTOM_SCOPE_GROUP_NAME:"Preview",INSTANT_LEARNING_TYPE:"iL",MODEL:"claude-3.5-sonnet",CONFIG_MASTER_NAME:"preview-config",SCOPE_NAME:"Custom",ASSISTANT_NAME:"preview",ORGANIZATION_NAME:"techolution",BASE_URL:"https://devllmstudio.creativeworkspace.ai",BASE_WEBSOCKET_URL:"wss://devllmstudio.creativeworkspace.ai/graphql",CHAT_TITLE:"Preview",CHAT_TITLE_EDIT:"Preview Edit",FORM_TITLE:"Learning Details",INITIAL_CHAT_MESSAGE:"Hi",CATEGORY:"Global-Template",SOCKET_TIMEOUT:24e4},llmStudioUrl:"https://devllmstudio.creativeworkspace.ai",audacyBackendUrl:"https://dev-audacy-traffic-manager.techo.camp",ilLabels:{setupLabel:"Learning Setup",ruleTitle:"Learning Title",ruleDescriptionTitle:"Learning Description"}},s={applicationName:"IL Mode - ILOTJ",applicationId:"6a22c19581f05dc3afc8ad57",moduleId:"6a22c19581f05dc3afc8ad8e",applicationModuleId:"6a22c19581f05dc3afc8ad88",applicationResourceId:"6a22c19681f05dc3afc8ad94",appsecRbacUrl:"https://dev-cw-appsec.techo.camp/granularApi",appsecBaseUrl:"https://dev-cw-appsec.techo.camp"},f={configId:"6a1825e9fb722c37637b9490"},u=new l,g={wrapper:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},header:{display:"flex",alignItems:"center",gap:12,padding:"10px 0",borderBottom:"1px solid #EAECF0",flexShrink:0},backButton:{display:"inline-flex",alignItems:"center",gap:6,background:"none",border:"none",cursor:"pointer",fontSize:14,fontWeight:500,color:"#344054",padding:"4px 8px",borderRadius:6},headerTitle:{fontSize:14,fontWeight:600,color:"#1F2937",margin:0,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},headerActions:{display:"flex",alignItems:"center",gap:8,marginLeft:"auto"},lmsContainer:{flex:1,minHeight:0,overflow:"hidden"},loadingState:{padding:24,fontSize:14,color:"#667085"}};function m(l){var m=l.userDetails,h=l.baseUrl,T=l.baseWebsocketUrl,I=l.assistantName,v=l.appsecRbacUrl,_=l.appsecBaseUrl,E=l.appIntegrationId,A=l.modeId,S=l.guidelineTitle,L=l.onBack,b=l.headerActions,C=t(null),w=C[0],U=C[1];return n(function(){if(E){var a=e(e({},p),{config:e(e({},p.config),{ASSISTANT_NAME:I,BASE_URL:h,BASE_WEBSOCKET_URL:T}),llmStudioUrl:h}),i=e(e({},s),{appsecRbacUrl:v,appsecBaseUrl:_}),t=!1;return U(null),d(h,m.accessToken,E).then(function(n){var o,l,r,c;if(!t){var d=n?{applicationName:n.application_name,applicationId:n.application_id,moduleId:null===(o=n.module_data)||void 0===o?void 0:o.Scopes,applicationModuleId:null===(l=n.module_data)||void 0===l?void 0:l.General,applicationResourceId:null===(r=n.resource_data)||void 0===r?void 0:r["Learning Management"],appsecRbacUrl:v,appsecBaseUrl:_}:i;U(e(e({},a),{auditLogConfig:{configId:null!==(c=null==n?void 0:n.change_log_config_id)&&void 0!==c?c:f.configId},rbacConfig:d}))}}).catch(function(){t||(console.warn("RBAC config fetch failed, using fallback."),U(e(e({},a),{auditLogConfig:f,rbacConfig:i})))}),function(){t=!0}}},[E,h,T,I,v,_]),a(r,e({client:u},{children:i("div",e({style:g.wrapper},{children:[i("div",e({style:g.header},{children:[i("button",e({type:"button",style:g.backButton,onClick:L},{children:[a(o,{size:16,strokeWidth:2}),"Back"]})),S&&a("p",e({style:g.headerTitle},{children:S})),b&&a("div",e({style:g.headerActions},{children:b}))]})),a("div",e({style:g.lmsContainer},{children:w?a(c,e({},w,{userDetails:m,app_integration_id:E,modeId:A}),"lms-explore"):a("p",e({style:g.loadingState},{children:"Loading..."}))}))]}))}))}export{m as LearningManagementWrapper,m as default};
|
|
2
|
+
//# sourceMappingURL=LearningManagementWrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LearningManagementWrapper.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{__awaiter as t,__generator as n}from"tslib";import{endpoints as e}from"./endpoints.js";function r(r,o){return t(this,void 0,void 0,function(){var t;return n(this,function(n){switch(n.label){case 0:return[4,fetch(e.listInstances(r),{headers:{accept:"application/json, text/plain, */*",authorization:"Bearer ".concat(o)}})];case 1:if(!(t=n.sent()).ok)throw new Error("Failed to fetch guidelines: ".concat(t.status));return[2,t.json()]}})})}function o(r,o,i){return t(this,void 0,void 0,function(){var t;return n(this,function(n){switch(n.label){case 0:return[4,fetch(e.getRbacConfig(r,i),{headers:{accept:"application/json, text/plain, */*",authorization:"Bearer ".concat(o)}})];case 1:if(!(t=n.sent()).ok)throw new Error("Failed to fetch RBAC config: ".concat(t.status));return[4,t.json()];case 2:return[2,n.sent().data]}})})}export{r as fetchGuidelineInstances,o as fetchRBACConfig};
|
|
2
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|