@e-llm-studio/instant-learning 1.3.0-alpha.218 → 1.3.0-alpha.219

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.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),r=require("react"),n=require("lucide-react"),i=require("../store/useLearningTemplateStore.js"),o=require("../utils/treeUtils.js"),l=require("./RuleHeader.js"),s=require("../components/EmptyLearningState.js"),a=require("./RuleTierList.js"),u=require("../apis/scopeApis.js"),d=require("../store/usePermissionsStore.js"),c=require("../store/useLMSConfigStore.js");exports.default=function(g){var m,f=g.onAddRule,p=g.onDeleteRule,h=g.onEditRule,S=g.onEditVariant,v=g.onDeleteVariant,x=g.onExportRule,y=g.isExporting,j=g.emptyStateTitle,R=void 0===j?c.dt("emptyStateLearning.title","No learnings have been added !"):j,b=g.emptyStateDesc,_=void 0===b?c.dt("emptyStateLearning.desc","Start by adding learnings that should apply across all stations."):b,L=g.emptyStateButtonText,T=void 0===L?c.dt("emptyStateLearning.createNewLearning","Create New Learning"):L,D=g.onToggleSuccess,C=g.onReorderRules,E=g.onRefreshRuleSets,w=g.setDeleteConfirmationUsedFor,I=g.onCopyToTier,N=i.useLearningTemplateStore(function(e){return e.currentRules}),q=i.useLearningTemplateStore(function(e){return e.toggleRuleTier}),A=i.useLearningTemplateStore(function(e){return e.scopeTreeData}),F=i.useLearningTemplateStore(function(e){return e.selectedRuleSetId}),B=i.useLearningTemplateStore(function(e){return e.createdVariantInfo}),V=i.useLearningTemplateStore(function(e){return e.urlVariantId}),G=d.usePermissionsStore(function(e){return e.isLoading}),H=d.usePermissionsStore(function(e){return e.hasPermission}),k=F?o.findNodeById((null==A?void 0:A.data)||null,F):null,M=null==k?void 0:k.id,P="GLOBAL"===(null==k?void 0:k.type)||"Global"===(null==k?void 0:k.name),z=k?{ruleSetId:k.id,ruleSetName:k.name,ruleSetDesc:"",ruleCount:null===(m=null==k?void 0:k.metrics)||void 0===m?void 0:m.learningsCount}:void 0,O=H("ilotj.rule.create",M)||H("ilotj.rule.variant.create",M),U=H("ilotj.rule.view",M),W=r.useMemo(function(){var e=new Map;return B&&B.forEach(function(t){t.variants.forEach(function(t){return e.set(t.id,t.action)})}),V&&e.set(V,"existing"),e.size>0?e:void 0},[B,V]),Y=r.useMemo(function(){if(B&&N){var e={tier1:"1",tier2:"2",tier_1:"1",tier_2:"2"},t={};return N.forEach(function(e){t[e.id]=e.name}),B.map(function(r){return t[e[r.tierName]]}).filter(Boolean)}},[B,N]),J=r.useCallback(function(t,r){return e.__awaiter(void 0,void 0,void 0,function(){var t,n;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,u.getRuleOverrideHistory(r||"")];case 1:return(t=e.sent())&&t.data?[2,t.data]:[2,null];case 2:throw n=e.sent(),console.error("Failed to fetch override history",n),n;case 3:return[2]}})})},[]);return G?t.jsx("div",e.__assign({style:{display:"flex",height:"100vh",alignItems:"center",justifyContent:"center",backgroundColor:"#f9fafb",fontFamily:"Helvetica, Arial, sans-serif"}},{children:t.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",alignItems:"center",color:"#4b5563"}},{children:[t.jsx(n.Loader2,{style:{marginBottom:"1rem",height:"3rem",width:"3rem",color:"#007aff",animation:"spin 1s linear infinite"}}),t.jsx("p",e.__assign({style:{fontSize:"1rem",fontWeight:500,color:"#4b5563"}},{children:"Loading your permissions…"}))]}))})):U?N&&0!==(null==N?void 0:N.length)?t.jsxs(t.Fragment,{children:[t.jsx(l.default,{onAddRule:f,onExport:x,isExporting:y,ruleSetName:null==z?void 0:z.ruleSetName,ruleSetDescription:null==z?void 0:z.ruleSetDesc,isGlobal:P,ruleSetId:M}),t.jsx(a.default,{tiers:N,ruleSetId:(null==z?void 0:z.ruleSetId)||"",onToggleTier:q,onDeleteRule:p,isGlobalScope:P,onFetchOverrideHistory:J,onEditRule:h,onEditVariant:S,onDeleteVariant:v,highlightedVariants:W,highlightedTierNames:Y,onToggleSuccess:D,onReorderRules:C,onRefreshRuleSets:E,setDeleteConfirmationUsedFor:w,onCopyToTier:I})]}):t.jsxs(t.Fragment,{children:[t.jsx(l.default,{onAddRule:f,onExport:x,isExporting:y,ruleSetName:null==z?void 0:z.ruleSetName,ruleSetDescription:null==z?void 0:z.ruleSetDesc,isGlobal:P}),t.jsx(s.default,{onCreate:f,title:R,desc:_,button:T,canCreateRule:O})]}):t.jsxs(t.Fragment,{children:[t.jsx(l.default,{onAddRule:f,onExport:x,isExporting:y,ruleSetName:null==z?void 0:z.ruleSetName,ruleSetDescription:null==z?void 0:z.ruleSetDesc,isGlobal:P,ruleSetId:M}),t.jsxs("div",e.__assign({style:{display:"flex",height:"80vh",width:"100%",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"2rem",textAlign:"center",backgroundColor:"#f0f2f5",fontFamily:"Helvetica, Arial, sans-serif"}},{children:[t.jsx("div",e.__assign({style:{marginBottom:"1.5rem",height:"4rem",width:"4rem",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",background:"linear-gradient(145deg, #e0e0e0, #ffffff)",boxShadow:"4px 4px 12px rgba(0,0,0,0.05), -4px -4px 12px rgba(255,255,255,0.7)"}},{children:t.jsx(n.Lock,{style:{height:"2rem",width:"2rem",color:"#8e8e93"}})})),t.jsx("h3",e.__assign({style:{fontSize:"1.25rem",fontWeight:600,color:"#1c1c1e"}},{children:"Access Denied"})),t.jsx("p",e.__assign({style:{maxWidth:"22rem",fontSize:"1rem",color:"#636366",lineHeight:1.6,marginBottom:"1rem"}},{children:"You do not have permission to view learnings for this scope."}))]}))]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),r=require("react"),n=require("lucide-react"),i=require("../store/useLearningTemplateStore.js"),o=require("../utils/treeUtils.js"),l=require("./RuleHeader.js"),s=require("../components/EmptyLearningState.js"),a=require("./RuleTierList.js"),u=require("../apis/scopeApis.js"),d=require("../store/usePermissionsStore.js"),c=require("../store/useLMSConfigStore.js");exports.default=function(f){var g,m,p=f.onAddRule,h=f.onDeleteRule,S=f.onEditRule,v=f.onEditVariant,x=f.onDeleteVariant,y=f.onExportRule,j=f.isExporting,b=f.emptyStateTitle,R=void 0===b?c.dt("emptyStateLearning.title","No learnings have been added !"):b,_=f.emptyStateDesc,L=void 0===_?c.dt("emptyStateLearning.desc","Start by adding learnings that should apply across all stations."):_,T=f.emptyStateButtonText,D=void 0===T?c.dt("emptyStateLearning.createNewLearning","Create New Learning"):T,w=f.onToggleSuccess,C=f.onReorderRules,E=f.onRefreshRuleSets,I=f.setDeleteConfirmationUsedFor,N=f.onCopyToTier,q=i.useLearningTemplateStore(function(e){return e.currentRules}),A=i.useLearningTemplateStore(function(e){return e.toggleRuleTier}),F=i.useLearningTemplateStore(function(e){return e.scopeTreeData}),G=i.useLearningTemplateStore(function(e){return e.selectedRuleSetId}),B=i.useLearningTemplateStore(function(e){return e.createdVariantInfo}),V=i.useLearningTemplateStore(function(e){return e.urlVariantId}),H=d.usePermissionsStore(function(e){return e.isLoading}),k=d.usePermissionsStore(function(e){return e.hasPermission}),M=G?o.findNodeById((null==F?void 0:F.data)||null,G):null,P=null==M?void 0:M.id,z="GLOBAL"===(null==M?void 0:M.type)||"Global"===(null==M?void 0:M.name),O=Boolean((null===(g=null==F?void 0:F.data)||void 0===g?void 0:g.id)&&G===F.data.id),U=M?{ruleSetId:M.id,ruleSetName:M.name,ruleSetDesc:"",ruleCount:null===(m=null==M?void 0:M.metrics)||void 0===m?void 0:m.learningsCount}:void 0,W=k("ilotj.rule.create",P)||k("ilotj.rule.variant.create",P),Y=k("ilotj.rule.view",P),J=r.useMemo(function(){var e=new Map;return B&&B.forEach(function(t){t.variants.forEach(function(t){return e.set(t.id,t.action)})}),V&&e.set(V,"existing"),e.size>0?e:void 0},[B,V]),K=r.useMemo(function(){if(B&&q){var e={tier1:"1",tier2:"2",tier_1:"1",tier_2:"2"},t={};return q.forEach(function(e){t[e.id]=e.name}),B.map(function(r){return t[e[r.tierName]]}).filter(Boolean)}},[B,q]),Q=r.useCallback(function(t,r){return e.__awaiter(void 0,void 0,void 0,function(){var t,n;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,u.getRuleOverrideHistory(r||"")];case 1:return(t=e.sent())&&t.data?[2,t.data]:[2,null];case 2:throw n=e.sent(),console.error("Failed to fetch override history",n),n;case 3:return[2]}})})},[]);return H?t.jsx("div",e.__assign({style:{display:"flex",height:"100vh",alignItems:"center",justifyContent:"center",backgroundColor:"#f9fafb",fontFamily:"Helvetica, Arial, sans-serif"}},{children:t.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",alignItems:"center",color:"#4b5563"}},{children:[t.jsx(n.Loader2,{style:{marginBottom:"1rem",height:"3rem",width:"3rem",color:"#007aff",animation:"spin 1s linear infinite"}}),t.jsx("p",e.__assign({style:{fontSize:"1rem",fontWeight:500,color:"#4b5563"}},{children:"Loading your permissions…"}))]}))})):Y?q&&0!==(null==q?void 0:q.length)?t.jsxs(t.Fragment,{children:[t.jsx(l.default,{onAddRule:p,onExport:y,isExporting:j,ruleSetName:null==U?void 0:U.ruleSetName,ruleSetDescription:null==U?void 0:U.ruleSetDesc,isGlobal:z,showGlobalScopeInfo:O,ruleSetId:P}),t.jsx(a.default,{tiers:q,ruleSetId:(null==U?void 0:U.ruleSetId)||"",onToggleTier:A,onDeleteRule:h,isGlobalScope:z,onFetchOverrideHistory:Q,onEditRule:S,onEditVariant:v,onDeleteVariant:x,highlightedVariants:J,highlightedTierNames:K,onToggleSuccess:w,onReorderRules:C,onRefreshRuleSets:E,setDeleteConfirmationUsedFor:I,onCopyToTier:N})]}):t.jsxs(t.Fragment,{children:[t.jsx(l.default,{onAddRule:p,onExport:y,isExporting:j,ruleSetName:null==U?void 0:U.ruleSetName,ruleSetDescription:null==U?void 0:U.ruleSetDesc,isGlobal:z,showGlobalScopeInfo:O}),t.jsx(s.default,{onCreate:p,title:R,desc:L,button:D,canCreateRule:W})]}):t.jsxs(t.Fragment,{children:[t.jsx(l.default,{onAddRule:p,onExport:y,isExporting:j,ruleSetName:null==U?void 0:U.ruleSetName,ruleSetDescription:null==U?void 0:U.ruleSetDesc,isGlobal:z,showGlobalScopeInfo:O,ruleSetId:P}),t.jsxs("div",e.__assign({style:{display:"flex",height:"80vh",width:"100%",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"2rem",textAlign:"center",backgroundColor:"#f0f2f5",fontFamily:"Helvetica, Arial, sans-serif"}},{children:[t.jsx("div",e.__assign({style:{marginBottom:"1.5rem",height:"4rem",width:"4rem",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",background:"linear-gradient(145deg, #e0e0e0, #ffffff)",boxShadow:"4px 4px 12px rgba(0,0,0,0.05), -4px -4px 12px rgba(255,255,255,0.7)"}},{children:t.jsx(n.Lock,{style:{height:"2rem",width:"2rem",color:"#8e8e93"}})})),t.jsx("h3",e.__assign({style:{fontSize:"1.25rem",fontWeight:600,color:"#1c1c1e"}},{children:"Access Denied"})),t.jsx("p",e.__assign({style:{maxWidth:"22rem",fontSize:"1rem",color:"#636366",lineHeight:1.6,marginBottom:"1rem"}},{children:"You do not have permission to view learnings for this scope."}))]}))]})};
2
2
  //# sourceMappingURL=ContentLogic.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),s=require("react/jsx-runtime"),a=require("lucide-react"),i=require("../styles/RuleHeader.module.css.js"),r=require("../store/usePermissionsStore.js"),t=require("../store/useLMSConfigStore.js");exports.default=function(n){var l=n.onAddRule,o=n.onOnboardStation,d=n.onExport,u=n.isExporting,c=void 0!==u&&u,x=n.ruleSetId,g=n.ruleSetName,b=n.ruleSetDescription,j=n.isGlobal,p=void 0!==j&&j,f=n.globalLabel,m=void 0===f?t.dt("learnings.globalLearning.globalLabel","Global Learnings ( Default )"):f;n.addExemptionLabel;var v=n.addNewRuleLabel,_=void 0===v?t.dt("learnings.header.addNewLearningButton","Add New Learning"):v,h=n.onboardStationLabel,L=void 0===h?t.dt("middleDrawer.scopeDisplayLimit.onboardBtn","Onboard a station"):h,N=r.usePermissionsStore(function(e){return e.hasPermission});if(!g&&!p)return null;var S=p?m:g,q=N("ilotj.rule.create",x||void 0),B=N("ilotj.rule.variant.create",x||void 0),P=q||B;return s.jsxs("div",e.__assign({className:i.default.container},{children:[s.jsxs("div",e.__assign({className:i.default.info},{children:[s.jsx("h1",{children:S}),b&&s.jsx("p",e.__assign({className:i.default.description},{children:b}))]})),s.jsxs("div",e.__assign({className:i.default.actions,style:{display:"flex",gap:"8px"}},{children:[d&&s.jsxs("button",e.__assign({onClick:d,disabled:c,className:i.default.exportButton},{children:[s.jsx(a.Download,{size:14}),c?"Exporting...":t.dt("learnings.header.exportButton","Export")]})),P&&l&&s.jsxs("button",e.__assign({onClick:l,className:i.default.addRuleButton},{children:[s.jsx(a.Plus,{size:14}),_]})),o&&s.jsxs("button",e.__assign({onClick:o,className:i.default.addRuleButton},{children:[s.jsx(a.Plus,{size:14}),L]}))]}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),s=require("react/jsx-runtime"),a=require("lucide-react"),i=require("../styles/RuleHeader.module.css.js"),l=require("../store/usePermissionsStore.js"),n=require("../store/useLMSConfigStore.js");exports.default=function(r){var t=r.onAddRule,o=r.onOnboardStation,d=r.onExport,u=r.isExporting,c=void 0!==u&&u,g=r.ruleSetId,p=r.ruleSetName,x=r.ruleSetDescription,b=r.isGlobal,f=void 0!==b&&b,j=r.showGlobalScopeInfo,_=void 0!==j&&j,h=r.globalLabel,m=void 0===h?n.dt("learnings.globalLearning.globalLabel","Global Learnings ( Default )"):h;r.addExemptionLabel;var v=r.addNewRuleLabel,N=void 0===v?n.dt("learnings.header.addNewLearningButton","Add New Learning"):v,L=r.onboardStationLabel,S=void 0===L?n.dt("middleDrawer.scopeDisplayLimit.onboardBtn","Onboard a station"):L,w=l.usePermissionsStore(function(e){return e.hasPermission});if(!p&&!f)return null;var q=f?m:p,B=_?n.dt("globalScopeInfo","The scope under which all sub scopes and learnings fall under"):"",P=w("ilotj.rule.create",g||void 0),y=w("ilotj.rule.variant.create",g||void 0),D=P||y;return s.jsxs("div",e.__assign({className:i.default.container},{children:[s.jsxs("div",e.__assign({className:i.default.info},{children:[s.jsx("h1",{children:q}),x&&s.jsx("p",e.__assign({className:i.default.description},{children:x})),B&&s.jsx("p",e.__assign({className:i.default.description},{children:B}))]})),s.jsxs("div",e.__assign({className:i.default.actions,style:{display:"flex",gap:"8px"}},{children:[d&&s.jsxs("button",e.__assign({onClick:d,disabled:c,className:i.default.exportButton},{children:[s.jsx(a.Download,{size:14}),c?"Exporting...":n.dt("learnings.header.exportButton","Export")]})),D&&t&&s.jsxs("button",e.__assign({onClick:t,className:i.default.addRuleButton},{children:[s.jsx(a.Plus,{size:14}),N]})),o&&s.jsxs("button",e.__assign({onClick:o,className:i.default.addRuleButton},{children:[s.jsx(a.Plus,{size:14}),S]}))]}))]}))};
2
2
  //# sourceMappingURL=RuleHeader.js.map