@e-llm-studio/instant-learning 1.3.0-alpha.163 → 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.
Files changed (50) hide show
  1. package/README.md +5 -3
  2. package/dist/ContinueWithTemplateModal.js +1 -1
  3. package/dist/ILMarketplaceWrapper.js +1 -1
  4. package/dist/cjs/ContinueWithTemplateModal.js +1 -1
  5. package/dist/cjs/ILMarketplaceWrapper.js +1 -1
  6. package/dist/cjs/features/IL-marketplace/components/GuidelineLibrary.js +1 -1
  7. package/dist/cjs/features/IL-marketplace/components/GuidelineLibraryCard.js +1 -1
  8. package/dist/cjs/features/IL-marketplace/constants.js +1 -1
  9. package/dist/cjs/features/LearningManagement/LearningManagement.js +1 -1
  10. package/dist/cjs/features/LearningManagement/RuleContent/AddScopeModal.js +1 -1
  11. package/dist/cjs/features/LearningManagement/components/ScopeSkeletonLoader.js +1 -1
  12. package/dist/cjs/features/LearningManagement/store/useLMSConfigStore.js +1 -1
  13. package/dist/cjs/index.js +1 -1
  14. package/dist/cjs/schema-driven/utils/PayloadUtils.js +1 -1
  15. package/dist/features/IL-marketplace/components/GuidelineLibrary.js +1 -1
  16. package/dist/features/IL-marketplace/components/GuidelineLibraryCard.js +1 -1
  17. package/dist/features/IL-marketplace/constants.js +1 -1
  18. package/dist/features/LearningManagement/LearningManagement.js +1 -1
  19. package/dist/features/LearningManagement/RuleContent/AddScopeModal.js +1 -1
  20. package/dist/features/LearningManagement/components/ScopeSkeletonLoader.js +1 -1
  21. package/dist/features/LearningManagement/store/useLMSConfigStore.js +1 -1
  22. package/dist/index.js +1 -1
  23. package/dist/schema-driven/utils/PayloadUtils.js +1 -1
  24. package/dist/types/src/ContinueWithTemplateModal.d.ts +8 -1
  25. package/dist/types/src/ContinueWithTemplateModal.d.ts.map +1 -1
  26. package/dist/types/src/ILMarketplaceWrapper.d.ts +7 -1
  27. package/dist/types/src/ILMarketplaceWrapper.d.ts.map +1 -1
  28. package/dist/types/src/features/IL-OTJ/ValueTypeWrappers/TeachMePlugin.d.ts +6 -1
  29. package/dist/types/src/features/IL-OTJ/ValueTypeWrappers/TeachMePlugin.d.ts.map +1 -1
  30. package/dist/types/src/features/IL-marketplace/components/GuidelineLibrary.d.ts +4 -2
  31. package/dist/types/src/features/IL-marketplace/components/GuidelineLibrary.d.ts.map +1 -1
  32. package/dist/types/src/features/IL-marketplace/components/GuidelineLibraryCard.d.ts +4 -2
  33. package/dist/types/src/features/IL-marketplace/components/GuidelineLibraryCard.d.ts.map +1 -1
  34. package/dist/types/src/features/IL-marketplace/constants.d.ts +4 -0
  35. package/dist/types/src/features/IL-marketplace/constants.d.ts.map +1 -1
  36. package/dist/types/src/features/IL-marketplace/types.d.ts +13 -0
  37. package/dist/types/src/features/IL-marketplace/types.d.ts.map +1 -1
  38. package/dist/types/src/features/LearningManagement/LearningManagement.d.ts.map +1 -1
  39. package/dist/types/src/features/LearningManagement/RuleContent/AddScopeModal.d.ts +0 -3
  40. package/dist/types/src/features/LearningManagement/RuleContent/AddScopeModal.d.ts.map +1 -1
  41. package/dist/types/src/features/LearningManagement/components/ScopeSkeletonLoader.d.ts +4 -0
  42. package/dist/types/src/features/LearningManagement/components/ScopeSkeletonLoader.d.ts.map +1 -1
  43. package/dist/types/src/features/LearningManagement/store/useExternalWorkflowStore.d.ts +5 -0
  44. package/dist/types/src/features/LearningManagement/store/useExternalWorkflowStore.d.ts.map +1 -1
  45. package/dist/types/src/features/LearningManagement/store/useLMSConfigStore.d.ts +3 -0
  46. package/dist/types/src/features/LearningManagement/store/useLMSConfigStore.d.ts.map +1 -1
  47. package/dist/types/src/index.d.ts +2 -1
  48. package/dist/types/src/index.d.ts.map +1 -1
  49. package/dist/types/src/schema-driven/utils/PayloadUtils.d.ts.map +1 -1
  50. package/package.json +1 -1
@@ -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){return n.isLoading?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:"Setting up your scope…"})),e.jsx("p",i.__assign({style:{fontSize:"0.875rem",color:"#64748B",margin:"0",lineHeight:"1.5"}},{children:"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};
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
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"),x=require("./features/IL-OTJ/_components/organisms/ConditionSection/ConditionSection.js"),L=require("./features/IL-OTJ/_components/templates/TrafficManager/TrafficManagerTemplate.js"),g=require("./features/IL-OTJ/_components/templates/Testing/Testing.js"),G=require("./features/IL-OTJ/_components/templates/TemplatesMap/templatesMap.js"),I=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"),j=require("./ILMarketplaceWrapper.js"),q=require("./features/IL-OTJ/ValueTypeWrappers/TeachMePlugin.js");require("./features/LearningManagement/LearningManagementTest.js");var S=require("./api/transport.js"),k=require("./ContinueWithTemplateModal.js"),D=require("./features/IL-marketplace/components/GuidelineCart.js"),_=require("./features/IL-marketplace/components/GuidelineCartHeader.js"),A=require("./features/IL-marketplace/components/GuidelineCartItem.js"),W=require("./features/IL-marketplace/components/GuidelineEmptyState.js"),O=require("./features/IL-marketplace/components/GuidelineHeader.js"),M=require("./features/IL-marketplace/components/GuidelineIconButton.js"),E=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"),v=require("./features/IL-marketplace/components/GuidelineConfirmDialog.js"),R=require("./features/IL-marketplace/hooks/useGuidelineSelection.js"),w=require("./features/IL-marketplace/constants.js"),V=require("./features/IL-marketplace/utils.js"),H=require("./features/IL-marketplace/workspace/workspace.runtime.js"),U=require("./features/IL-marketplace/workspace/useGuidelineWorkspace.js"),N=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=x.ConditionSection,exports.TrafficManagerTemplate=L.TrafficManagerTemplate,exports.Testing=g.Testing,Object.defineProperty(exports,"TemplateList",{enumerable:!0,get:function(){return G.TemplateList}}),exports.TemplateMap=G.TemplateMap,exports.extractAndParseResponse=I.extractAndParseResponse,exports.extractAndParseWithProperty=I.extractAndParseWithProperty,exports.extractTextFromChildren=I.extractTextFromChildren,exports.extractVariantIds=I.extractVariantIds,exports.parseValidationData=I.parseValidationData,exports.useHeaderObserver=I.useHeaderObserver,exports.CitationProvider=T.CitationProvider,exports.useCitations=T.useCitations,exports.dummyDat=f.dummyDat,exports.getVariantInfo=f.getVariantInfo,exports.LearningManagement=C.default,exports.ILMarketplaceWrapper=j.default,exports.IL_MARKETPLACE_TAB_ID=j.IL_MARKETPLACE_TAB_ID,exports.MY_KNOWLEDGE_BASES_TAB_ID=j.MY_KNOWLEDGE_BASES_TAB_ID,exports.SAVED_TAB_ID=j.SAVED_TAB_ID,exports.TeachMePlugin=q.default,exports.TemplateRegistry=q.TemplateRegistry,exports.setApiDebug=S.setApiDebug,exports.ContinueWithTemplateModal=k.default,exports.GuidelineCart=D.GuidelineCart,exports.GuidelineCartHeader=_.GuidelineCartHeader,exports.GuidelineCartItem=A.GuidelineCartItem,exports.GuidelineEmptyState=W.GuidelineEmptyState,exports.GuidelineHeader=O.GuidelineHeader,exports.GuidelineIconButton=M.GuidelineIconButton,exports.GuidelineLandingPage=E.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=v.GuidelineConfirmDialog,exports.useGuidelineSelection=R.useGuidelineSelection,exports.DEFAULT_GUIDELINE_ARTIFACT_TEMPLATE=w.DEFAULT_GUIDELINE_ARTIFACT_TEMPLATE,exports.DEFAULT_GUIDELINE_LABELS=w.DEFAULT_GUIDELINE_LABELS,exports.createGuidelineId=V.createGuidelineId,exports.cx=V.cx,exports.defaultFormatAddedOnLabel=V.defaultFormatAddedOnLabel,exports.getAppIntegrationId=V.getAppIntegrationId,exports.getGuidelineDate=V.getGuidelineDate,exports.getGuidelineDescription=V.getGuidelineDescription,exports.getGuidelineDisplayDescription=V.getGuidelineDisplayDescription,exports.getGuidelineId=V.getGuidelineId,exports.getGuidelineTitle=V.getGuidelineTitle,exports.isInstantLearningGuideline=V.isInstantLearningGuideline,exports.mergeGuidelineLabels=V.mergeGuidelineLabels,exports.getGuidelineWorkspaceActions=H.getGuidelineWorkspaceActions,exports.getGuidelineWorkspaceSnapshot=H.getGuidelineWorkspaceSnapshot,exports.useGuidelineWorkspace=U.useGuidelineWorkspace,exports.useGuidelineWorkspaceActions=U.useGuidelineWorkspaceActions,exports.useOptionalGuidelineWorkspace=U.useOptionalGuidelineWorkspace,exports.useOptionalGuidelineWorkspaceActions=U.useOptionalGuidelineWorkspaceActions,exports.clearGuidelineCartClearPending=N.clearGuidelineCartClearPending,exports.clearInstantLearningGuidelineCartPresent=N.clearInstantLearningGuidelineCartPresent,exports.getGuidelineSessionId=N.getGuidelineSessionId,exports.markGuidelineCartClearPending=N.markGuidelineCartClearPending,exports.rotateGuidelineSessionId=N.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;
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 d=e.useDynamicFormStore.getState(),c=d.setGlobalField,y=d.setVariantField,f=d.setGlobalReasoning,v=d.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&&!u.read_only&&(!0===u.ai_generated||(null==p?void 0:p.hydrateAll))){var d=t(u.data_key,o),m=d.cleanKey,F=d.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?(c(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),d=p.cleanKey;(function(e){return null!=e&&(Array.isArray(e)?e.length>0:"string"!=typeof e||""!==e.trim())})(p.isGlobal?a(d):l(r,o,d))||(s=!1)}n.properties&&!i(n)&&u(n.properties,r,o)}})};u(p);var d=Object.values(p).find(i);return(null==d?void 0:d.properties)&&o.forEach(function(e,r){e.forEach(function(e,t){u(d.properties,r,t)})}),s},exports.generatePayloadFromSchema=function(o,n,a){var l=e.useDynamicFormStore.getState(),p=l.getGlobalField,s=l.getVariantField,u={},d={},c=[],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:(d[l]=b,f.is_required&&!c.includes(l)&&c.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:d,required:c}}};
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 r}from"react";import{ChevronRight as t,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,r){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,"%")}})]}),r)})}))}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,re=b.handleViewButtonCallback,te=b.handlePreviewButtonCallback,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(r,{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?t: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:re,handlePreviewButtonCallback:te})]}))]}))}export{m as GuidelineLibrary};
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."},t={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}},a={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"},i={IMAGES:"images",MEETING_RECORDINGS:"meeting-recordings",DOCUMENTS:"documents",STORMEE_CONVERSATIONS:"stormee-conversations",REQUIREMENT_DOCUMENTS:"requirement-documents",CODEBASE_KNOWLEDGE:"codebase-knowledge",GUIDELINES:"guidelines"},o={GUIDELINE:"guideline",CONTEXT:"context"},n={IN_PROGRESS:"In-Progress",INGESTION_COMPLETE:"Completed",INGESTION_FAILED:"Failed"},s="GUIDELINE_SESSION_ID";export{o as ADD_CONTEXT_FILE_TYPES,t as DEFAULT_GUIDELINE_ARTIFACT_TEMPLATE,e as DEFAULT_GUIDELINE_LABELS,a as FALLBACK_RBAC_CONFIG,n as FILE_INGESTION_STATUS,s as GUIDELINE_SESSION_ID,i as SOURCE_IDS};
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
@@ -1,2 +1,2 @@
1
- import{__assign as e,__spreadArray as n,__awaiter as t,__generator as r}from"tslib";import{jsx as o,jsxs as i,Fragment as s}from"react/jsx-runtime";import{useState as a,useRef as l,useCallback as c,useEffect as u}from"react";import{applyAxiosConfig as d}from"../../api/transport.js";import{BookOpen as p,Users as m,History as f}from"lucide-react";import{useLearningTemplateStore as v}from"./store/useLearningTemplateStore.js";import{Toast as g}from"primereact/toast";import h from"./styles/LearningTemplateManagement.module.css.js";import S from"./LearningTemplateLayout.js";import y from"./components/EmptyLearningState.js";import C from"./store/useAuthStore.js";import{fetchTiers as b,getILInstance as T,fetchScopes as I,inheritScope as L,inheritScopeBackwardCompatible as A,createRuleSet as R,renameScope as E,deleteRuleSet as O,requestAccess as w}from"./apis/scopeApis.js";import{useRuleTemplateQueryParams as j,setQueryParams as N,QUERY_PARAM_KEYS as _}from"./hooks/useLearningTemplateQueryParams.js";import D from"./components/ConfirmationModal.js";import M from"./components/LearningTemplateManagementSkeleton.js";import{findNodePathById as k,findNodeById as P}from"./utils/treeUtils.js";import U from"./store/useEnvStore.js";import{useConfigStore as B}from"./store/useConfigStore.js";import{TooltipProvider as q}from"./components/ToolTip.js";import G from"./components/CreateRuleSetLegacyModal.js";import{usePermissionsStore as F}from"./store/usePermissionsStore.js";import{useAppSecRolesStore as x}from"./store/useAppSecRolesStore.js";import{useGetAppSecRolesQuery as H}from"./queries/useApprovalQueries.js";import{useLMSConfigQuery as Q}from"./queries/useLMSConfigQuery.js";import z from"./RuleContent/AddScopeModal.js";import K from"./components/RuleContentSkeleton.js";import V from"./components/ErrorStateDisplay.js";import{useLocation as W,useSearchParams as Y}from"react-router-dom";import J from"./shared/SuccessToastContent.js";import X from"./shared/ErrorToastContent.js";import Z from"./RuleContent/RenameScopeModal.js";import{dt as $,useLMSConfigStore as ee}from"./store/useLMSConfigStore.js";import{MIDDLE_DRAWER_DT_PATH as ne,MIDDLE_DRAWER_CONTEXT_MENU_DT_PATH as te,EMPTY_STATE_DT_PATH as re}from"./constants.js";function oe(oe){var ie,se,ae,le,ce,ue,de,pe,me,fe,ve,ge=this,he=oe.userDetails,Se=oe.llmStudioUrl,ye=oe.audacyBackendUrl,Ce=oe.ilLabels,be=oe.config,Te=oe.rbacConfig,Ie=oe.auditLogConfig,Le=oe.app_integration_id,Ae=oe.backwardCompatibility,Re=void 0!==Ae&&Ae,Ee=oe.cognitiveCompareCompatibility,Oe=void 0!==Ee&&Ee,we=oe.modeId,je=oe.modeDetails,Ne=oe.pluginPayload,_e=oe.axiosConfig,De=oe.isILMarketplace,Me=oe.guidelineContentProps,ke=oe.treeOverrides;d(_e);var Pe=[{id:"learnings",label:$("".concat(ne,".treeMenu.submenu.learnings"),"Learnings"),icon:p,badgeKey:"learningsCount"},{id:"access",label:$("".concat(ne,".treeMenu.submenu.access"),"Access"),icon:m},{id:"history",label:$("".concat(ne,".treeMenu.submenu.changeHistory"),"Change History"),icon:f}],Ue=(null==ke?void 0:ke.sectionsConfig)?ke.sectionsConfig.filter(function(e){return Pe.some(function(n){return n.id===e.id})}):Pe,Be=new Set(Ue.map(function(e){return e.id})),qe=null!==(se=null===(ie=Ue[0])||void 0===ie?void 0:ie.id)&&void 0!==se?se:"learnings",Ge=j().clearLearningParams,Fe=v(function(e){return e.selectedRuleSetId}),xe=v(function(e){return e.setSelectedRuleSetId}),He=v(function(e){return e.setIlInstanceId}),Qe=v(function(e){return e.error}),ze=v(function(e){return e.setError}),Ke=v(function(e){return e.setStations}),Ve=v(function(e){return e.scopeTreeData}),We=v(function(e){return e.setScopeTreeData}),Ye=a({isOpen:!1,type:"GLOBAL"}),Je=Ye[0],Xe=Ye[1],Ze=a(!1),$e=Ze[0],en=Ze[1],nn=a(!1),tn=nn[0],rn=nn[1],on=a(qe),sn=on[0],an=on[1],ln=a(null),cn=ln[0],un=ln[1],dn=a(!1),pn=dn[0],mn=dn[1],fn=a(null),vn=fn[0];fn[1];var gn=a(!1),hn=gn[0],Sn=gn[1],yn=a(!1),Cn=yn[0],bn=yn[1];l(null);var Tn=l(null),In=l(!1),Ln=l(null),An=C();An.user;var Rn=An.setUser,En=B(),On=En.setConfig,wn=En.setIlLabels,jn=function(){try{return W()}catch(e){return{search:""}}}(),Nn=function(){try{return Y()[1]}catch(e){return null}}(),_n=c(function(e){if(Nn){var n=new URLSearchParams(window.location.search);Object.entries(e).forEach(function(e){var t=e[0],r=e[1];null==r||""===r?n.delete(t):n.set(t,r)}),Nn(n,{replace:!0})}else N(e)},[Nn]);u(function(){if(!In.current){var e=new URLSearchParams(window.location.search),n=e.get(_.RULESET_ID),t=e.get(_.SECTION),r=t&&(null==Be?void 0:Be.has(t))?t:qe;(null==n?void 0:n.length)&&xe&&an&&(xe(n),an(r),In.current=!0)}},[null==jn?void 0:jn.search,an,xe]),u(function(){return function(){Ge()}},[Ge]),u(function(){var e;Fe&&_n(((e={})[_.RULESET_ID]=Fe,e))},[Fe,_n]),u(function(){var n;(null==Ne?void 0:Ne.learningManagement)&&ee.getState().setLMSConfig(e(e({},Ne.learningManagement),{agents:null!==(n=Ne.agents)&&void 0!==n?n:{}}))},[Ne]);var Dn=F(function(e){return e.fetchPermissions}),Mn=F(function(e){return e.hasPermission}),kn=x(function(e){return e.setRoles}),Pn=U(function(e){return e.appsecRbacUrl})===Te.appsecRbacUrl,Un=H(Te.applicationId,Pn).data,Bn=Q(null!=Le?Le:"",Re),qn=Bn.isLoading,Gn=Bn.isError,Fn=Bn.refetch;Bn.isSuccess;var xn=a(0),Hn=xn[0],Qn=xn[1];u(function(){if(!Re&&Le&&Se){t(ge,void 0,void 0,function(){var e,n,t,o,i,s,a;return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,T(Le)];case 1:return e=r.sent(),(null===(o=null==e?void 0:e.data)||void 0===o?void 0:o.ILInstanceId)&&He(e.data.ILInstanceId),"number"==typeof(n=null===(a=null===(s=null===(i=null==e?void 0:e.data)||void 0===i?void 0:i.learningManagement)||void 0===s?void 0:s.scopeAndHierarchy)||void 0===a?void 0:a.maxHierarchyLevels)&&n>0&&Qn(n-1),[3,3];case 2:return t=r.sent(),console.error("Failed to fetch IL instance for hierarchy levels:",t),[3,3];case 3:return[2]}})})}},[Le,Se]),u(function(){Un&&kn(Un.map(function(e){return{_id:e._id,name:e.name}}))},[Un,kn]),u(function(){var e;console.log("userDetails",he),Rn(he),console.log("llmStudioUrl",Se),console.log("audacyBackendUrl",ye),U.getState().setLlmStudioUrl(Se),U.getState().setAudacyBackendUrl(ye),U.getState().setRbacConfig(Te),U.getState().setAuditLogConfig(Ie),U.getState().setBaseModeName((null==je?void 0:je.modeNameFromURL)||null),On(be),wn(Ce),v.getState().setAppIntegrationId(null!=Le?Le:null),v.getState().setBackwardCompatibility(Re),v.getState().setCognitiveCompareCompatibility(null!=Oe&&Oe),v.getState().setToken(null!==(e=null==he?void 0:he.accessToken)&&void 0!==e?e:null)},[he,Rn,Se,ye,Te,Ie,be,On,Ce,wn,Le,Re,Oe,je]),u(function(){(null==he?void 0:he.accessToken)&&Se&&(De||b())},[Le,null==he?void 0:he.accessToken,Se,De]);var zn=function(n){return void 0===n&&(n=!0),t(ge,void 0,void 0,function(){var t,o,i,s,a,l,c,u,d,p,m,f;return r(this,function(r){switch(r.label){case 0:n&&en(!0),ze(null),r.label=1;case 1:return r.trys.push([1,7,8,9]),[4,Dn(Te.applicationId)];case 2:r.sent(),t=function(n){var r=F.getState().hasPermission("ilotj.scope.view",n.id),o=n.children?n.children.map(function(e){return t(e)}).filter(function(e){return null!==e}):[];return r||0!==o.length?e(e({},n),{hasAccess:r,children:o}):null},o=void 0,r.label=3;case 3:return r.trys.push([3,5,,6]),[4,I(Le,he.accessToken)];case 4:return o=r.sent(),[3,6];case 5:if(i=r.sent(),403===(null===(m=null==i?void 0:i.response)||void 0===m?void 0:m.status))return We(null),un(Te.applicationResourceId||null),mn(!0),[2];throw i;case 6:return o&&o.data&&o.data.data&&(s=o.data.data,Array.isArray(s)&&(s=s.length>0?s[0]:null),s?(a=t(s))?(un(null),mn(!1),We({data:a}),Tn.current?(xe(Tn.current),an(qe),Tn.current=null):(l=v.getState().selectedRuleSetId,c=l?P(a,l):null,l&&c||(u=function(e){if(e.hasAccess)return e;for(var n=0,t=e.children||[];n<t.length;n++){var r=t[n],o=u(r);if(o)return o}return null},d=u(a),xe(d?d.id:a.id)))):(un(null!==(f=s.id)&&void 0!==f?f:null),mn(!1),We(null)):(un(null),mn(!1),We(null))),[3,9];case 7:return p=r.sent(),console.error("Failed to fetch rule sets or permissions",p),ze("Failed to load data. Please try again later."),[3,9];case 8:return en(!1),[7];case 9:return[2]}})})};u(function(){var e;(null===(e=null==he?void 0:he.accessToken)||void 0===e?void 0:e.length)&&Pn?zn(!0):console.warn("Error: Trying to fetch rules without access token",he)},[null==he?void 0:he.accessToken,ze,Ke,Te.applicationId,Pn]);var Kn=function(n,o,i){return t(ge,void 0,void 0,function(){var t,o,i,s,a,l,c,u;return r(this,function(r){switch(r.label){case 0:rn(!0),r.label=1;case 1:return r.trys.push([1,4,5,6]),[4,O(n,he.accessToken)];case 2:return r.sent(),v.getState().selectedRuleSetId===n&&(t=v.getState().scopeTreeData,(o=k((null==t?void 0:t.data)||null,n))&&o.length>1&&(i=o[o.length-2],xe(i),an(qe))),[4,zn(!0)];case 3:return r.sent(),Xe(function(n){return e(e({},n),{isOpen:!1})}),null===(a=Ln.current)||void 0===a||a.show({severity:"success",summary:"Deleted Successfully",detail:"The scope was permanently removed."}),[3,6];case 4:return s=r.sent(),console.error("An error occurred during scope deletion.",s),null===(l=Ln.current)||void 0===l||l.show({severity:"error",summary:"Delete Failed",detail:(null===(u=null===(c=null==s?void 0:s.response)||void 0===c?void 0:c.data)||void 0===u?void 0:u.message)||"There was an error deleting the scope. Please try again."}),[3,6];case 5:return rn(!1),[7];case 6:return[2]}})})},Vn=Ve,Wn=vn?{data:{id:vn.stationId,name:vn.stationName,type:"STATION",metrics:{learningsCount:vn.learningsCount,stationsCount:0},children:[]}}:Vn,Yn=!!(null==Wn?void 0:Wn.data);null===(ae=null==Wn?void 0:Wn.data)||void 0===ae||ae.type;var Jn=F(function(e){return e.hasGlobalPermission})("ilotj.scope.global.create",Te.applicationResourceId||""),Xn=function(e){return t(ge,void 0,void 0,function(){var n,t,i,s,a,l,c,u,d,p;return r(this,function(r){switch(r.label){case 0:if(!(n="string"==typeof e?e:(null===(l=null===(a=v.getState().scopeTreeData)||void 0===a?void 0:a.data)||void 0===l?void 0:l.id)||cn)&&!pn)return null===(c=Ln.current)||void 0===c||c.show({severity:"error",sticky:!1,className:h.errorToast,content:o(X,{message:"Unable to identify the global scope for this access request."})}),[2];Sn(!0),r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,w(n,pn)];case 2:return r.sent(),bn(!0),null===(u=Ln.current)||void 0===u||u.show({severity:"success",sticky:!1,life:3e3,className:h.successToast,content:o(J,{message:"Access request submitted successfully!"})}),[3,5];case 3:return t=r.sent(),i=null===(d=null==t?void 0:t.response)||void 0===d?void 0:d.data,s="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===(p=Ln.current)||void 0===p||p.show({severity:"error",sticky:!1,className:h.errorToast,content:o(X,{message:s})}),[3,5];case 4:return Sn(!1),[7];case 5:return[2]}})})};if(qn)return o("div",e({className:h.learningManagementContainer},{children:o(K,{})}));if(Gn)return o("div",e({className:h.learningManagementContainer},{children:o(V,{errorMessage:"Failed to load configuration. Please try again.",onRetry:function(){return Fn()},title:"Error Loading Configuration"})}));var Zn=n(n([{type:"GLOBAL",label:"Global",addChildLabel:"".concat($("".concat(ne,".addScope"),"Add Scope")),addChildType:"SCOPE"}],Array.from({length:Hn},function(){return e({type:"SCOPE",label:$("".concat(ne,".scope"),"Scope")},!Re&&{addChildLabel:$("".concat(te,".addSubScope"),"Add Subscope"),addChildType:"SUBSCOPE"})}),!0),Re?[]:[{type:"SUBSCOPE",label:$("".concat(ne,".subScope"),"Subscope")}],!0),$n=vn?Ue.filter(function(e){return"stations"!==e.id}):Ue,et=function(e,n){void 0===e&&(e=!0),n&&(Tn.current=n),zn(e)},nt=function(){return et(!0)},tt=null!==(le=null==ke?void 0:ke.nodeTypesConfig)&&void 0!==le?le:Zn,rt=(null==ke?void 0:ke.onOpenCreateModal)?function(){return ke.onOpenCreateModal(nt)}:function(){return Xe({isOpen:!0,type:"GLOBAL"})},ot=(null==ke?void 0:ke.onAddChild)?function(e,n,t){return ke.onAddChild(e,n,t,nt)}:function(e,n,t){return Xe({isOpen:!0,type:n,parentId:e,parentName:t})},it=(null==ke?void 0:ke.onRenameChild)?function(e,n){return ke.onRenameChild(e,n,nt)}:function(e,n){return Xe({isOpen:!0,type:"RENAME",scopeId:e,initialName:n})},st=(null==ke?void 0:ke.onDeleteChild)?function(e,n,t){return ke.onDeleteChild(e,n,t,nt)}:function(e,n,o){return t(ge,void 0,void 0,function(){var t,i,s;return r(this,function(r){switch(r.label){case 0:return t=v.getState().scopeTreeData,i=k((null==t?void 0:t.data)||null,e),s=!!i&&3===i.length,0!==o?[3,2]:[4,Kn(e)];case 1:return r.sent(),[3,3];case 2:Xe({isOpen:!0,type:"DELETE",scopeId:e,initialName:n,isSubscope:s}),r.label=3;case 3:return[2]}})})},at=null!==(ce=null==ke?void 0:ke.onSectionSelect)&&void 0!==ce?ce:function(e,n){var t;console.log("Section Selected:",{scopeId:e,sectionId:n}),_n(((t={})[_.SECTION]=n===qe?null:n,t)),an(n),xe(e),bn(!1)},lt=null!==(ue=null==ke?void 0:ke.onRefreshRuleSets)&&void 0!==ue?ue:et,ct=null!==(de=null==ke?void 0:ke.canCreateScope)&&void 0!==de?de:function(e){return Mn("ilotj.scope.create",e)},ut=null!==(pe=null==ke?void 0:ke.canEditScope)&&void 0!==pe?pe:function(e){return Mn("ilotj.scope.edit",e)},dt=null!==(me=null==ke?void 0:ke.canDeleteScope)&&void 0!==me?me:function(e){return Mn("ilotj.scope.delete",e)};return o(q,{children:i("div",e({className:h.learningManagementContainer},{children:[o("div",e({className:h.mainWrapper},{children:$e?o(M,{}):Qe?i("div",e({className:h.errorContainer},{children:[o("div",e({className:h.errorTitle},{children:"Error Loading Data"})),o("p",e({className:h.errorDesc},{children:Qe})),o("button",e({onClick:function(){return zn(!0)},className:h.tryAgainBtn},{children:"Try Again"}))]})):Yn?o(S,{onOpenCreateModal:rt,onAddChild:ot,onRenameChild:it,onDeleteChild:st,canDeleteScope:dt,canEditScope:ut,canCreateScope:ct,onSectionSelect:at,activeSectionId:sn,scopeTreeData:Wn,sectionsConfig:$n,onViewStation:function(e){at(e.stationId,qe)},onRefreshRuleSets:lt,nodeTypesConfig:tt,app_integration_id:Le,token:he.accessToken,modeId:we,onRequestAccess:Xn,isRequestingAccess:hn,isAccessRequested:Cn,isILMarketplace:De,guidelineContentProps:Me}):o(y,{onCreate:function(){return Xe({isOpen:!0,type:"GLOBAL"})},title:$("".concat(re,".title"),"No Global Scope has been added!"),desc:$("".concat(re,".desc"),"Start by creating a Global scope to define base learnings that apply across all stations."),button:$("".concat(re,".createGlobalScope"),"Create Global Scope"),canCreateRule:Jn,noAccessTitle:$("".concat(re,".noAccessTitle"),"Access Restricted"),noAccessDesc:$("".concat(re,".noAccessDesc"),"You do not have access for this application."),requestAccessButton:$("".concat(re,".requestAccessButton"),"Request Access"),requestSentButton:$("".concat(re,".requestSentButton"),"Request Sent"),onRequestAccess:Xn,isRequestingAccess:hn,isAccessRequested:Cn})})),o(g,{ref:Ln,pt:{root:{style:{zIndex:9999}}}}),Re&&Je.isOpen&&"DELETE"!==Je.type&&"RENAME"!==Je.type?o(G,{isOpen:!0,onClose:function(){return Xe(e(e({},Je),{isOpen:!1}))},onSubmit:function(n){return t(ge,void 0,void 0,function(){var t,o,i,s,a,l,c,u,d,p,m,f,g,h,S,y,C,b,T,I;return r(this,function(r){switch(r.label){case 0:rn(!0),t=v.getState().backwardCompatibility,r.label=1;case 1:return r.trys.push([1,12,13,14]),o=void 0,t&&"object"==typeof n?o=n:(i=n,s="SCOPE"===Je.type&&Je.parentId,a=s?"genreRuleSet":Je.type,o={topic:a,scope_reference_id:null,scopeDescription:"demo",parentScopeId:Je.parentId||null,scopeName:i,scopeReferenceMetadata:{},applicationMappingId:Le}),[4,R(o,he.accessToken)];case 2:if(l=r.sent(),!(c=null===(h=null==l?void 0:l.data)||void 0===h?void 0:h.scopeId))return[3,10];if(Tn.current=c,u=t&&(null===(S=o.topic)||void 0===S?void 0:S.toLowerCase().includes("genre")),d=!t&&"GLOBAL"!==Je.type&&Je.parentId,!u&&!d)return[3,10];if(!(p=t?null===(C=null===(y=v.getState().scopeTreeData)||void 0===y?void 0:y.data)||void 0===C?void 0:C.id:Je.parentId))return[3,10];if(!Re)return[3,7];r.label=3;case 3:return r.trys.push([3,5,,6]),[4,A({source_scope_id:p,target_scope_id:c})];case 4:return r.sent(),[3,6];case 5:return m=r.sent(),console.error("Failed to inherit rules for the new scope:",m),[3,6];case 6:return[3,10];case 7:return r.trys.push([7,9,,10]),[4,L({source_scope_id:p,target_scope_id:c,application_mapping_id:Le||"",is_copy_parent_variant_id:!1})];case 8:return r.sent(),[3,10];case 9:return f=r.sent(),console.error("Failed to inherit rules for the new scope:",f),[3,10];case 10:return[4,zn(!0)];case 11:return r.sent(),Xe(function(n){return e(e({},n),{isOpen:!1})}),[3,14];case 12:throw g=r.sent(),console.error("An error occurred during scope creation.",g),null===(b=Ln.current)||void 0===b||b.show({severity:"error",summary:"Creation Failed",detail:(null===(I=null===(T=null==g?void 0:g.response)||void 0===T?void 0:T.data)||void 0===I?void 0:I.message)||"There was an error creating the scope. Please try again."}),g;case 13:return rn(!1),[7];case 14:return[2]}})})},hasGlobalRuleSet:Yn,canCreateGlobal:Jn,globalScopeId:null!==(ve=null===(fe=null==Ve?void 0:Ve.data)||void 0===fe?void 0:fe.id)&&void 0!==ve?ve:null}):i(s,{children:[o(z,{isOpen:Je.isOpen&&"DELETE"!==Je.type&&"RENAME"!==Je.type,onClose:function(){return Xe(e(e({},Je),{isOpen:!1}))},onCreate:function(e){e&&(Tn.current=e),zn(!0)},hasGlobalRuleSet:Yn,parentId:Je.parentId,isILMarketplace:De}),o(Z,{isOpen:Je.isOpen&&"RENAME"===Je.type,onClose:function(){return Xe(e(e({},Je),{isOpen:!1}))},onSave:function(n){return t(ge,void 0,void 0,function(){var t,i,s,a,l,c;return r(this,function(r){switch(r.label){case 0:rn(!0),r.label=1;case 1:return r.trys.push([1,4,5,6]),Je.scopeId?(t=v.getState().backwardCompatibility,i=t?{scope_id:Je.scopeId,scope_name:n}:{scope_id:Je.scopeId,scope_type:"Custom",scope_name:n,application_mapping_id:Le},[4,E(i,he.accessToken)]):[2];case 2:return r.sent(),[4,zn(!0)];case 3:return r.sent(),Xe(function(n){return e(e({},n),{isOpen:!1})}),[3,6];case 4:throw s=r.sent(),console.error("An error occurred during scope rename.",s),null===(a=Ln.current)||void 0===a||a.show({severity:"error",sticky:!1,className:h.errorToast,content:o(X,{message:(null===(c=null===(l=null==s?void 0:s.response)||void 0===l?void 0:l.data)||void 0===c?void 0:c.message)||"There was an error renaming the scope. Please try again."})}),s;case 5:return rn(!1),[7];case 6:return[2]}})})},initialName:Je.initialName})]}),o(D,{isOpen:Je.isOpen&&"DELETE"===Je.type,onCancel:function(){return Xe(e(e({},Je),{isOpen:!1}))},onConfirm:function(){return Kn(Je.scopeId,Je.initialName,Je.isSubscope)},title:"Delete Scope",description:i(s,{children:["Deleting ",o("span",e({className:h.highlight},{children:Je.initialName||"this scope"}))," will permanently remove all Learnings, Access rules, and Change History inside it. This cannot be undone."]}),confirmText:"Delete",confirmBgColor:"#EF4444",isLoading:tn})]}))})}export{oe as default};
1
+ import{__assign as e,__spreadArray as n,__awaiter as t,__generator as r}from"tslib";import{jsx as o,jsxs as i,Fragment as s}from"react/jsx-runtime";import{useState as a,useRef as l,useCallback as c,useEffect as u}from"react";import{applyAxiosConfig as d}from"../../api/transport.js";import{BookOpen as p,Users as m,History as f}from"lucide-react";import{useLearningTemplateStore as v}from"./store/useLearningTemplateStore.js";import{Toast as g}from"primereact/toast";import h from"./styles/LearningTemplateManagement.module.css.js";import S from"./LearningTemplateLayout.js";import y from"./components/EmptyLearningState.js";import C from"./store/useAuthStore.js";import{fetchTiers as b,getILInstance as T,fetchScopes as I,inheritScope as L,inheritScopeBackwardCompatible as A,createRuleSet as E,renameScope as R,deleteRuleSet as O,requestAccess as w}from"./apis/scopeApis.js";import{useRuleTemplateQueryParams as N,setQueryParams as j,QUERY_PARAM_KEYS as _}from"./hooks/useLearningTemplateQueryParams.js";import D from"./components/ConfirmationModal.js";import M from"./components/LearningTemplateManagementSkeleton.js";import{findNodePathById as k,findNodeById as P}from"./utils/treeUtils.js";import U from"./store/useEnvStore.js";import{useConfigStore as B}from"./store/useConfigStore.js";import{TooltipProvider as q}from"./components/ToolTip.js";import G from"./components/CreateRuleSetLegacyModal.js";import{usePermissionsStore as F}from"./store/usePermissionsStore.js";import{useAppSecRolesStore as x}from"./store/useAppSecRolesStore.js";import{useGetAppSecRolesQuery as H}from"./queries/useApprovalQueries.js";import{useLMSConfigQuery as Q}from"./queries/useLMSConfigQuery.js";import z from"./RuleContent/AddScopeModal.js";import K from"./components/RuleContentSkeleton.js";import V from"./components/ErrorStateDisplay.js";import{useLocation as W,useSearchParams as Y}from"react-router-dom";import J from"./shared/SuccessToastContent.js";import X from"./shared/ErrorToastContent.js";import Z from"./RuleContent/RenameScopeModal.js";import{dt as $,useLMSConfigStore as ee}from"./store/useLMSConfigStore.js";import{MIDDLE_DRAWER_DT_PATH as ne,MIDDLE_DRAWER_CONTEXT_MENU_DT_PATH as te,EMPTY_STATE_DT_PATH as re}from"./constants.js";function oe(oe){var ie,se,ae,le,ce,ue,de,pe,me,fe,ve,ge=this,he=oe.userDetails,Se=oe.llmStudioUrl,ye=oe.audacyBackendUrl,Ce=oe.ilLabels,be=oe.config,Te=oe.rbacConfig,Ie=oe.auditLogConfig,Le=oe.app_integration_id,Ae=oe.backwardCompatibility,Ee=void 0!==Ae&&Ae,Re=oe.cognitiveCompareCompatibility,Oe=void 0!==Re&&Re,we=oe.modeId,Ne=oe.modeDetails,je=oe.pluginPayload,_e=oe.axiosConfig,De=oe.isILMarketplace,Me=oe.guidelineContentProps,ke=oe.treeOverrides;d(_e);var Pe=[{id:"learnings",label:$("".concat(ne,".treeMenu.submenu.learnings"),"Learnings"),icon:p,badgeKey:"learningsCount"},{id:"access",label:$("".concat(ne,".treeMenu.submenu.access"),"Access"),icon:m},{id:"history",label:$("".concat(ne,".treeMenu.submenu.changeHistory"),"Change History"),icon:f}],Ue=(null==ke?void 0:ke.sectionsConfig)?ke.sectionsConfig.filter(function(e){return Pe.some(function(n){return n.id===e.id})}):Pe,Be=new Set(Ue.map(function(e){return e.id})),qe=null!==(se=null===(ie=Ue[0])||void 0===ie?void 0:ie.id)&&void 0!==se?se:"learnings",Ge=N().clearLearningParams,Fe=v(function(e){return e.selectedRuleSetId}),xe=v(function(e){return e.setSelectedRuleSetId}),He=v(function(e){return e.setIlInstanceId}),Qe=v(function(e){return e.error}),ze=v(function(e){return e.setError}),Ke=v(function(e){return e.setStations}),Ve=v(function(e){return e.scopeTreeData}),We=v(function(e){return e.setScopeTreeData}),Ye=a({isOpen:!1,type:"GLOBAL"}),Je=Ye[0],Xe=Ye[1],Ze=a(!1),$e=Ze[0],en=Ze[1],nn=a(!1),tn=nn[0],rn=nn[1],on=a(qe),sn=on[0],an=on[1],ln=a(null),cn=ln[0],un=ln[1],dn=a(!1),pn=dn[0],mn=dn[1],fn=a(null),vn=fn[0];fn[1];var gn=a(!1),hn=gn[0],Sn=gn[1],yn=a(!1),Cn=yn[0],bn=yn[1];l(null);var Tn=l(null),In=l(!1),Ln=l(null),An=C();An.user;var En=An.setUser,Rn=B(),On=Rn.setConfig,wn=Rn.setIlLabels,Nn=function(){try{return W()}catch(e){return{search:""}}}(),jn=function(){try{return Y()[1]}catch(e){return null}}(),_n=c(function(e){if(jn){var n=new URLSearchParams(window.location.search);Object.entries(e).forEach(function(e){var t=e[0],r=e[1];null==r||""===r?n.delete(t):n.set(t,r)}),jn(n,{replace:!0})}else j(e)},[jn]);u(function(){if(!In.current){var e=new URLSearchParams(window.location.search),n=e.get(_.RULESET_ID),t=e.get(_.SECTION),r=t&&(null==Be?void 0:Be.has(t))?t:qe;(null==n?void 0:n.length)&&xe&&an&&(xe(n),an(r),In.current=!0)}},[null==Nn?void 0:Nn.search,an,xe]),u(function(){return function(){Ge()}},[Ge]),u(function(){var e;Fe&&_n(((e={})[_.RULESET_ID]=Fe,e))},[Fe,_n]),u(function(){var n;(null==je?void 0:je.learningManagement)&&ee.getState().setLMSConfig(e(e({},je.learningManagement),{agents:null!==(n=je.agents)&&void 0!==n?n:{}}))},[je]);var Dn=F(function(e){return e.fetchPermissions}),Mn=F(function(e){return e.hasPermission}),kn=x(function(e){return e.setRoles}),Pn=U(function(e){return e.appsecRbacUrl})===Te.appsecRbacUrl,Un=H(Te.applicationId,Pn).data,Bn=Q(null!=Le?Le:"",Ee),qn=Bn.isLoading,Gn=Bn.isError,Fn=Bn.refetch;Bn.isSuccess;var xn=a(0),Hn=xn[0],Qn=xn[1];u(function(){if(!Ee&&Le&&Se){t(ge,void 0,void 0,function(){var e,n,t,o,i,s,a;return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,T(Le)];case 1:return e=r.sent(),(null===(o=null==e?void 0:e.data)||void 0===o?void 0:o.ILInstanceId)&&He(e.data.ILInstanceId),"number"==typeof(n=null===(a=null===(s=null===(i=null==e?void 0:e.data)||void 0===i?void 0:i.learningManagement)||void 0===s?void 0:s.scopeAndHierarchy)||void 0===a?void 0:a.maxHierarchyLevels)&&n>0&&Qn(n-1),[3,3];case 2:return t=r.sent(),console.error("Failed to fetch IL instance for hierarchy levels:",t),[3,3];case 3:return[2]}})})}},[Le,Se]),u(function(){Un&&kn(Un.map(function(e){return{_id:e._id,name:e.name}}))},[Un,kn]),u(function(){var e;console.log("userDetails",he),En(he),console.log("llmStudioUrl",Se),console.log("audacyBackendUrl",ye),U.getState().setLlmStudioUrl(Se),U.getState().setAudacyBackendUrl(ye),U.getState().setRbacConfig(Te),U.getState().setAuditLogConfig(Ie),U.getState().setBaseModeName((null==Ne?void 0:Ne.modeNameFromURL)||null),On(be),wn(Ce),v.getState().setAppIntegrationId(null!=Le?Le:null),v.getState().setBackwardCompatibility(Ee),v.getState().setCognitiveCompareCompatibility(null!=Oe&&Oe),v.getState().setToken(null!==(e=null==he?void 0:he.accessToken)&&void 0!==e?e:null)},[he,En,Se,ye,Te,Ie,be,On,Ce,wn,Le,Ee,Oe,Ne]),u(function(){(null==he?void 0:he.accessToken)&&Se&&(De||b())},[Le,null==he?void 0:he.accessToken,Se,De]);var zn=function(n){return void 0===n&&(n=!0),t(ge,void 0,void 0,function(){var t,o,i,s,a,l,c,u,d,p,m,f;return r(this,function(r){switch(r.label){case 0:n&&en(!0),ze(null),r.label=1;case 1:return r.trys.push([1,7,8,9]),[4,Dn(Te.applicationId)];case 2:r.sent(),t=function(n){var r=F.getState().hasPermission("ilotj.scope.view",n.id),o=n.children?n.children.map(function(e){return t(e)}).filter(function(e){return null!==e}):[];return r||0!==o.length?e(e({},n),{hasAccess:r,children:o}):null},o=void 0,r.label=3;case 3:return r.trys.push([3,5,,6]),[4,I(Le,he.accessToken)];case 4:return o=r.sent(),[3,6];case 5:if(i=r.sent(),403===(null===(m=null==i?void 0:i.response)||void 0===m?void 0:m.status))return We(null),un(Te.applicationResourceId||null),mn(!0),[2];throw i;case 6:return o&&o.data&&o.data.data&&(s=o.data.data,Array.isArray(s)&&(s=s.length>0?s[0]:null),s?(a=t(s))?(un(null),mn(!1),We({data:a}),Tn.current?(xe(Tn.current),an(qe),Tn.current=null):(l=v.getState().selectedRuleSetId,c=l?P(a,l):null,l&&c||(u=function(e){if(e.hasAccess)return e;for(var n=0,t=e.children||[];n<t.length;n++){var r=t[n],o=u(r);if(o)return o}return null},d=u(a),xe(d?d.id:a.id)))):(un(null!==(f=s.id)&&void 0!==f?f:null),mn(!1),We(null)):(un(null),mn(!1),We(null))),[3,9];case 7:return p=r.sent(),console.error("Failed to fetch rule sets or permissions",p),ze("Failed to load data. Please try again later."),[3,9];case 8:return en(!1),[7];case 9:return[2]}})})};u(function(){var e;(null===(e=null==he?void 0:he.accessToken)||void 0===e?void 0:e.length)&&Pn?zn(!0):console.warn("Error: Trying to fetch rules without access token",he)},[null==he?void 0:he.accessToken,ze,Ke,Te.applicationId,Pn]);var Kn=function(n,o,i){return t(ge,void 0,void 0,function(){var t,o,i,s,a,l,c,u;return r(this,function(r){switch(r.label){case 0:rn(!0),r.label=1;case 1:return r.trys.push([1,4,5,6]),[4,O(n,he.accessToken)];case 2:return r.sent(),v.getState().selectedRuleSetId===n&&(t=v.getState().scopeTreeData,(o=k((null==t?void 0:t.data)||null,n))&&o.length>1&&(i=o[o.length-2],xe(i),an(qe))),[4,zn(!0)];case 3:return r.sent(),Xe(function(n){return e(e({},n),{isOpen:!1})}),null===(a=Ln.current)||void 0===a||a.show({severity:"success",summary:"Deleted Successfully",detail:"The scope was permanently removed."}),[3,6];case 4:return s=r.sent(),console.error("An error occurred during scope deletion.",s),null===(l=Ln.current)||void 0===l||l.show({severity:"error",summary:"Delete Failed",detail:(null===(u=null===(c=null==s?void 0:s.response)||void 0===c?void 0:c.data)||void 0===u?void 0:u.message)||"There was an error deleting the scope. Please try again."}),[3,6];case 5:return rn(!1),[7];case 6:return[2]}})})},Vn=Ve,Wn=vn?{data:{id:vn.stationId,name:vn.stationName,type:"STATION",metrics:{learningsCount:vn.learningsCount,stationsCount:0},children:[]}}:Vn,Yn=!!(null==Wn?void 0:Wn.data);null===(ae=null==Wn?void 0:Wn.data)||void 0===ae||ae.type;var Jn=F(function(e){return e.hasGlobalPermission})("ilotj.scope.global.create",Te.applicationResourceId||""),Xn=function(e){return t(ge,void 0,void 0,function(){var n,t,i,s,a,l,c,u,d,p;return r(this,function(r){switch(r.label){case 0:if(!(n="string"==typeof e?e:(null===(l=null===(a=v.getState().scopeTreeData)||void 0===a?void 0:a.data)||void 0===l?void 0:l.id)||cn)&&!pn)return null===(c=Ln.current)||void 0===c||c.show({severity:"error",sticky:!1,className:h.errorToast,content:o(X,{message:"Unable to identify the global scope for this access request."})}),[2];Sn(!0),r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,w(n,pn)];case 2:return r.sent(),bn(!0),null===(u=Ln.current)||void 0===u||u.show({severity:"success",sticky:!1,life:3e3,className:h.successToast,content:o(J,{message:"Access request submitted successfully!"})}),[3,5];case 3:return t=r.sent(),i=null===(d=null==t?void 0:t.response)||void 0===d?void 0:d.data,s="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===(p=Ln.current)||void 0===p||p.show({severity:"error",sticky:!1,className:h.errorToast,content:o(X,{message:s})}),[3,5];case 4:return Sn(!1),[7];case 5:return[2]}})})};if(qn)return o("div",e({className:h.learningManagementContainer},{children:o(K,{})}));if(Gn)return o("div",e({className:h.learningManagementContainer},{children:o(V,{errorMessage:"Failed to load configuration. Please try again.",onRetry:function(){return Fn()},title:"Error Loading Configuration"})}));var Zn=n(n([{type:"GLOBAL",label:"Global",addChildLabel:"".concat($("".concat(ne,".addScope"),"Add Scope")),addChildType:"SCOPE"}],Array.from({length:Hn},function(){return e({type:"SCOPE",label:$("".concat(ne,".scope"),"Scope")},!Ee&&{addChildLabel:$("".concat(te,".addSubScope"),"Add Subscope"),addChildType:"SUBSCOPE"})}),!0),Ee?[]:[{type:"SUBSCOPE",label:$("".concat(ne,".subScope"),"Subscope")}],!0),$n=vn?Ue.filter(function(e){return"stations"!==e.id}):Ue,et=function(e,n){void 0===e&&(e=!0),n&&(Tn.current=n),zn(e)},nt=function(){return et(!0)},tt=null!==(le=null==ke?void 0:ke.nodeTypesConfig)&&void 0!==le?le:Zn,rt=(null==ke?void 0:ke.onOpenCreateModal)?function(){return ke.onOpenCreateModal(nt)}:function(){return Xe({isOpen:!0,type:"GLOBAL"})},ot=(null==ke?void 0:ke.onAddChild)?function(e,n,t){return ke.onAddChild(e,n,t,nt)}:function(e,n,t){return Xe({isOpen:!0,type:n,parentId:e,parentName:t})},it=(null==ke?void 0:ke.onRenameChild)?function(e,n){return ke.onRenameChild(e,n,nt)}:function(e,n){return Xe({isOpen:!0,type:"RENAME",scopeId:e,initialName:n})},st=(null==ke?void 0:ke.onDeleteChild)?function(e,n,t){return ke.onDeleteChild(e,n,t,nt)}:function(e,n,o){return t(ge,void 0,void 0,function(){var t,i,s;return r(this,function(r){switch(r.label){case 0:return t=v.getState().scopeTreeData,i=k((null==t?void 0:t.data)||null,e),s=!!i&&3===i.length,0!==o?[3,2]:[4,Kn(e)];case 1:return r.sent(),[3,3];case 2:Xe({isOpen:!0,type:"DELETE",scopeId:e,initialName:n,isSubscope:s}),r.label=3;case 3:return[2]}})})},at=null!==(ce=null==ke?void 0:ke.onSectionSelect)&&void 0!==ce?ce:function(e,n){var t;console.log("Section Selected:",{scopeId:e,sectionId:n}),_n(((t={})[_.SECTION]=n===qe?null:n,t)),an(n),xe(e),bn(!1)},lt=null!==(ue=null==ke?void 0:ke.onRefreshRuleSets)&&void 0!==ue?ue:et,ct=null!==(de=null==ke?void 0:ke.canCreateScope)&&void 0!==de?de:function(e){return Mn("ilotj.scope.create",e)},ut=null!==(pe=null==ke?void 0:ke.canEditScope)&&void 0!==pe?pe:function(e){return Mn("ilotj.scope.edit",e)},dt=null!==(me=null==ke?void 0:ke.canDeleteScope)&&void 0!==me?me:function(e){return Mn("ilotj.scope.delete",e)};return o(q,{children:i("div",e({className:h.learningManagementContainer},{children:[o("div",e({className:h.mainWrapper},{children:$e?o(M,{}):Qe?i("div",e({className:h.errorContainer},{children:[o("div",e({className:h.errorTitle},{children:"Error Loading Data"})),o("p",e({className:h.errorDesc},{children:Qe})),o("button",e({onClick:function(){return zn(!0)},className:h.tryAgainBtn},{children:"Try Again"}))]})):Yn?o(S,{onOpenCreateModal:rt,onAddChild:ot,onRenameChild:it,onDeleteChild:st,canDeleteScope:dt,canEditScope:ut,canCreateScope:ct,onSectionSelect:at,activeSectionId:sn,scopeTreeData:Wn,sectionsConfig:$n,onViewStation:function(e){at(e.stationId,qe)},onRefreshRuleSets:lt,nodeTypesConfig:tt,app_integration_id:Le,token:he.accessToken,modeId:we,onRequestAccess:Xn,isRequestingAccess:hn,isAccessRequested:Cn,isILMarketplace:De,guidelineContentProps:Me}):o(y,{onCreate:function(){return Xe({isOpen:!0,type:"GLOBAL"})},title:$("".concat(re,".title"),"No Global Scope has been added!"),desc:$("".concat(re,".desc"),"Start by creating a Global scope to define base learnings that apply across all stations."),button:$("".concat(re,".createGlobalScope"),"Create Global Scope"),canCreateRule:Jn,noAccessTitle:$("".concat(re,".noAccessTitle"),"Access Restricted"),noAccessDesc:$("".concat(re,".noAccessDesc"),"You do not have access for this application."),requestAccessButton:$("".concat(re,".requestAccessButton"),"Request Access"),requestSentButton:$("".concat(re,".requestSentButton"),"Request Sent"),onRequestAccess:Xn,isRequestingAccess:hn,isAccessRequested:Cn})})),o(g,{ref:Ln,pt:{root:{style:{zIndex:9999}}}}),Ee&&Je.isOpen&&"DELETE"!==Je.type&&"RENAME"!==Je.type?o(G,{isOpen:!0,onClose:function(){return Xe(e(e({},Je),{isOpen:!1}))},onSubmit:function(n){return t(ge,void 0,void 0,function(){var t,o,i,s,a,l,c,u,d,p,m,f,g,h,S,y,C,b,T,I;return r(this,function(r){switch(r.label){case 0:rn(!0),t=v.getState().backwardCompatibility,r.label=1;case 1:return r.trys.push([1,12,13,14]),o=void 0,t&&"object"==typeof n?o=n:(i=n,s="SCOPE"===Je.type&&Je.parentId,a=s?"genreRuleSet":Je.type,o={topic:a,scope_reference_id:null,scopeDescription:"demo",parentScopeId:Je.parentId||null,scopeName:i,scopeReferenceMetadata:{},applicationMappingId:Le}),[4,E(o,he.accessToken)];case 2:if(l=r.sent(),!(c=null===(h=null==l?void 0:l.data)||void 0===h?void 0:h.scopeId))return[3,10];if(Tn.current=c,u=t&&(null===(S=o.topic)||void 0===S?void 0:S.toLowerCase().includes("genre")),d=!t&&"GLOBAL"!==Je.type&&Je.parentId,!u&&!d)return[3,10];if(!(p=t?null===(C=null===(y=v.getState().scopeTreeData)||void 0===y?void 0:y.data)||void 0===C?void 0:C.id:Je.parentId))return[3,10];if(!Ee)return[3,7];r.label=3;case 3:return r.trys.push([3,5,,6]),[4,A({source_scope_id:p,target_scope_id:c})];case 4:return r.sent(),[3,6];case 5:return m=r.sent(),console.error("Failed to inherit rules for the new scope:",m),[3,6];case 6:return[3,10];case 7:return r.trys.push([7,9,,10]),[4,L({source_scope_id:p,target_scope_id:c,application_mapping_id:Le||"",is_copy_parent_variant_id:!1})];case 8:return r.sent(),[3,10];case 9:return f=r.sent(),console.error("Failed to inherit rules for the new scope:",f),[3,10];case 10:return[4,zn(!0)];case 11:return r.sent(),Xe(function(n){return e(e({},n),{isOpen:!1})}),[3,14];case 12:throw g=r.sent(),console.error("An error occurred during scope creation.",g),null===(b=Ln.current)||void 0===b||b.show({severity:"error",summary:"Creation Failed",detail:(null===(I=null===(T=null==g?void 0:g.response)||void 0===T?void 0:T.data)||void 0===I?void 0:I.message)||"There was an error creating the scope. Please try again."}),g;case 13:return rn(!1),[7];case 14:return[2]}})})},hasGlobalRuleSet:Yn,canCreateGlobal:Jn,globalScopeId:null!==(ve=null===(fe=null==Ve?void 0:Ve.data)||void 0===fe?void 0:fe.id)&&void 0!==ve?ve:null}):i(s,{children:[o(z,{isOpen:Je.isOpen&&"DELETE"!==Je.type&&"RENAME"!==Je.type,onClose:function(){return Xe(e(e({},Je),{isOpen:!1}))},onCreate:function(e){e&&(Tn.current=e),zn(!0)},hasGlobalRuleSet:Yn,parentId:Je.parentId,parentName:Je.parentName,childType:"SUBSCOPE"===Je.type?"SUBSCOPE":"SCOPE",isILMarketplace:De}),o(Z,{isOpen:Je.isOpen&&"RENAME"===Je.type,onClose:function(){return Xe(e(e({},Je),{isOpen:!1}))},onSave:function(n){return t(ge,void 0,void 0,function(){var t,i,s,a,l,c;return r(this,function(r){switch(r.label){case 0:rn(!0),r.label=1;case 1:return r.trys.push([1,4,5,6]),Je.scopeId?(t=v.getState().backwardCompatibility,i=t?{scope_id:Je.scopeId,scope_name:n}:{scope_id:Je.scopeId,scope_type:"Custom",scope_name:n,application_mapping_id:Le},[4,R(i,he.accessToken)]):[2];case 2:return r.sent(),[4,zn(!0)];case 3:return r.sent(),Xe(function(n){return e(e({},n),{isOpen:!1})}),[3,6];case 4:throw s=r.sent(),console.error("An error occurred during scope rename.",s),null===(a=Ln.current)||void 0===a||a.show({severity:"error",sticky:!1,className:h.errorToast,content:o(X,{message:(null===(c=null===(l=null==s?void 0:s.response)||void 0===l?void 0:l.data)||void 0===c?void 0:c.message)||"There was an error renaming the scope. Please try again."})}),s;case 5:return rn(!1),[7];case 6:return[2]}})})},initialName:Je.initialName})]}),o(D,{isOpen:Je.isOpen&&"DELETE"===Je.type,onCancel:function(){return Xe(e(e({},Je),{isOpen:!1}))},onConfirm:function(){return Kn(Je.scopeId,Je.initialName,Je.isSubscope)},title:"Delete Scope",description:i(s,{children:["Deleting ",o("span",e({className:h.highlight},{children:Je.initialName||"this scope"}))," will permanently remove all Learnings, Access rules, and Change History inside it. This cannot be undone."]}),confirmText:"Delete",confirmBgColor:"#EF4444",isLoading:tn})]}))})}export{oe as default};
2
2
  //# sourceMappingURL=LearningManagement.js.map
@@ -1,2 +1,2 @@
1
- import{__awaiter as e,__generator as o,__assign as n,__spreadArray as r}from"tslib";import{jsxs as t,jsx as i,Fragment as a}from"react/jsx-runtime";import{useState as l,useRef as s,useEffect as c}from"react";import{useMutation as d}from"@tanstack/react-query";import{X as u,Loader2 as p}from"lucide-react";import{Toast as m}from"primereact/toast";import{v4 as f}from"uuid";import h from"../components/StationOnboarding/StationAutocomplete.js";import g from"./AddScopeApprovalSearchComponent.js";import v from"../components/ScopeSkeletonLoader.js";import{Input as b}from"@mui/material";import y from"../store/useAuthStore.js";import{useAppSecRolesStore as S}from"../store/useAppSecRolesStore.js";import C from"../store/useEnvStore.js";import{createRuleSet as x,inheritScope as _}from"../apis/scopeApis.js";import{useLearningTemplateStore as w}from"../store/useLearningTemplateStore.js";import{IL_CONFIG_CONSTANTS as k}from"../config.js";import{dt as A}from"../store/useLMSConfigStore.js";import{MIDDLE_DRAWER_ADD_SCOPE_DT_PATH as D,MIDDLE_DRAWER_APPROVAL_SETTINGS_DT_PATH as I}from"../constants.js";var R=function(R){var E=R.isOpen,B=R.onClose,j=R.onCreate,q=R.hasGlobalRuleSet,F=R.parentId,z=R.isILMarketplace,L=void 0!==z&&z,P=R.onCreateMarketplaceDomain,T=R.childType,W=R.parentName,N=l(""),O=N[0],G=N[1],M=l(""),U=M[0],K=M[1],H=l({}),J=H[0],Q=H[1],V=s(null),X=y().user,Y=S(function(e){return e.roles}),Z=C(function(e){return e.rbacConfig}),$=l(!1),ee=$[0],oe=$[1],ne=l(null),re=ne[0],te=ne[1],ie=l("approval_required"),ae=ie[0],le=ie[1],se=l([]),ce=se[0],de=se[1],ue=l([]),pe=ue[0],me=ue[1],fe=l(!1);fe[0];var he=fe[1],ge=L?"SUBSCOPE"===T?"Subdomain Name":"Domain Name":A("".concat(D,".scopeName"),"Scope Name"),ve=d({mutationFn:function(n){return e(void 0,void 0,void 0,function(){var e;return o(this,function(o){switch(o.label){case 0:return[4,x(n,null!==(e=null==X?void 0:X.accessToken)&&void 0!==e?e:"")];case 1:return[2,o.sent()]}})})},onSuccess:function(n){return e(void 0,void 0,void 0,function(){var e,r;return o(this,function(o){return console.log("Rule Set Created Successfully",n),null===(e=V.current)||void 0===e||e.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 o,n,r;console.error("Create scope failed",e),null===(o=V.current)||void 0===o||o.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."})}});ve.data;var be=ve.isPending,ye=ve.mutateAsync;return c(function(){E&&(G(""),K(""),Q({}),te(null),le("approval_required"),de([]),me([]))},[E]),E?t("div",n({style:{position:"absolute",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0,0,0,0.3)"}},{children:[i(m,{ref:V}),be||ee?i(v,{isLoading:be||ee}):t("div",n({style:{position:"relative",width:600,borderRadius:12,backgroundColor:"white",padding:24,boxShadow:"0 25px 50px -12px rgba(0,0,0,0.25)"}},{children:[t("div",n({style:{marginBottom:24,display:"flex",alignItems:"flex-start",justifyContent:"space-between"}},{children:[t("div",{children:[i("h2",n({style:{margin:0,fontSize:18,fontWeight:500,color:"#19213D"}},{children:L?"SUBSCOPE"===T?"Add Subdomain":"Add Domain":q?A("".concat(D,".title"),"Add Scope"):A("".concat(D,".globalTitle"),"Create Global Scope")})),i("p",n({style:{margin:"4px 0 0 0",fontSize:14,fontWeight:400,color:"#666F8D"}},{children:L?W?"This ".concat("SUBSCOPE"===T?"subdomain":"domain"," will be created under '").concat(W,"'."):"This ".concat("SUBSCOPE"===T?"subdomain":"domain"," will be created under the selected parent domain."):q?A("".concat(D,".subtitle"),"This scope will be created under Global scope and will inherit its learnings by default.",{parent:"Global"}):A("".concat(D,".globalSubtitle"),"This will be your Global scope that defines the base learnings shared across all stations.")}))]}),i("button",n({onClick:B,style:{background:"none",border:"none",padding:0,cursor:"pointer",color:"#9CA3AF"}},{children:i(u,{size:24})}))]})),t("div",n({style:{display:"flex",flexDirection:"column",gap:20}},{children:[t("div",n({style:{position:"relative",display:"flex",flexDirection:"column",gap:6}},{children:[t("label",n({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:[i("span",n({style:{marginRight:4,fontSize:16,fontWeight:600,color:"#8F2C23"}},{children:"*"})),ge]})),"Custom"===O?i(h,{value:U,onChange:function(e){if(e.length>50)return K(e.slice(0,50)),void Q(function(e){return n(n({},e),{name:"".concat(ge," must be 50 characters or fewer")})});K(e),Q(function(e){return n(n({},e),{name:void 0})})},onStationSelect:function(e){te(e)},style:{border:J.name?"1px solid #8F2C23":void 0}}):i(b,{value:U,onChange:function(e){var o=e.target.value;if(o.length>50)return K(o.slice(0,50)),void Q(function(e){return n(n({},e),{name:"".concat(ge," must be 50 characters or fewer")})});K(o),Q(function(e){return n(n({},e),{name:void 0})})},style:{border:"1px solid ".concat(J.name?"#8F2C23":"#F0F2F5")},placeholder:L?"e.g. MarketPlace":"e.g. Global Learnings"}),J.name&&i("p",n({style:{margin:"4px 0 0 0",fontSize:12,color:"#8F2C23"}},{children:J.name}))]})),!L&&t("div",n({style:{display:"flex",flexDirection:"column",gap:12}},{children:[t("label",n({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:[i("span",n({style:{marginRight:4,fontSize:16,fontWeight:600,color:"#8F2C23"}},{children:"*"})),A("".concat(I,".title"),"Learning Approval Settings")]})),t("div",n({role:"radio","aria-checked":"approval_required"===ae,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:4},onClick:function(){return le("approval_required")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||le("approval_required")}},{children:[t("div",n({style:{display:"flex",alignItems:"center",gap:8}},{children:[i("div",n({style:{display:"flex",height:16,width:16,flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("approval_required"===ae?"#2563EB":"#CBD5E1")}},{children:"approval_required"===ae&&i("div",{style:{height:8,width:8,borderRadius:"50%",backgroundColor:"#2563EB"}})})),i("span",n({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:A("".concat(I,".approvalRequired.title"),"Approval Required Before Publishing")}))]})),i("p",n({style:{margin:0,marginLeft:24,fontSize:12,color:"#666F8D"}},{children:A("".concat(I,".approvalRequired.subtitle"),"Learnings require approval before publishing.")}))]})),"approval_required"===ae&&i(g,{selectedApprovers:ce,selectedGroupOfApprovers:pe,onApproversChange:de,onGroupsChange:me}),t("div",n({role:"radio","aria-checked":"publish_without"===ae,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:4},onClick:function(){le("publish_without")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||le("publish_without")}},{children:[t("div",n({style:{display:"flex",alignItems:"center",gap:8}},{children:[i("div",n({style:{display:"flex",height:16,width:16,flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("publish_without"===ae?"#2563EB":"#CBD5E1")}},{children:"publish_without"===ae&&i("div",{style:{height:8,width:8,borderRadius:"50%",backgroundColor:"#2563EB"}})})),i("span",n({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:A("".concat(I,".publishWithoutApproval.title"),"Publish Without Approval")}))]})),i("p",n({style:{margin:0,marginLeft:24,fontSize:12,color:"#666F8D"}},{children:A("".concat(I,".publishWithoutApproval.subtitle"),"Learnings can be published directly.")}))]}))]})),t("div",n({style:{marginTop:32,display:"flex",justifyContent:"flex-end",gap:12}},{children:[i("button",n({onClick:B,style:{borderRadius:6,border:"1px solid #E2E8F0",padding:"8px 16px",fontSize:14,fontWeight:500,color:"#64748B",backgroundColor:"white",cursor:"pointer",opacity:be?.5:1},disabled:be},{children:A("".concat(D,".cancel"),"Cancel")})),i("button",n({onClick:function(){return e(void 0,void 0,void 0,function(){var e,n,t,i,a,l,s,c,d,u,p,m,h,g,v,b,y,S,C,x,A,D;return o(this,function(o){switch(o.label){case 0:if(e={},U.trim()?U.length>50&&(e.name="".concat(ge," must be 50 characters or fewer")):e.name="".concat(ge," is required"),e.name)return Q(e),[2];o.label=1;case 1:return o.trys.push([1,10,11,12]),oe(!0),L?[4,null==P?void 0:P(U)]:[3,3];case 2:return n=o.sent(),j(null==n?void 0:n.scopeId),B(),[2];case 3:return t="approval_required"===ae,i=w.getState().backwardCompatibility,a=ce.length>0||pe.length>0,l=i?{topic:q?"genreRuleSet":"globalRuleSet",customScopeGroupName:k.CUSTOM_SCOPE_GROUP_NAME,scopeDescription:U,parentScopeId:null,customScopeName:U,customScopeId:f(),createByName:(null==X?void 0:X.firstname)||"System",createdBy:(null==X?void 0:X.email)||"system@audacy.com",approvalRequired:t,appsecData:{application:null==Z?void 0:Z.applicationId,module:null==Z?void 0:Z.moduleId,roles:r(r([],t&&a?[{users:ce.map(function(e){return e.email}),groups:pe.map(function(e){return e._id}),role:null!==(m=null===(p=Y.find(function(e){return"Learning Manager"===e.name}))||void 0===p?void 0:p._id)&&void 0!==m?m:""}]:[],!0),[{users:[null==X?void 0:X.email],groups:[],role:null!==(g=null===(h=Y.find(function(e){return"Instant Learning Admin"===e.name}))||void 0===h?void 0:h._id)&&void 0!==g?g:""}],!1)}}:{topic:q?"genreRuleSet":"globalRuleSet",scope_reference_id:null,scopeDescription:U,parentScopeId:null!=F?F:null,scopeName:U,scopeReferenceMetadata:{},scopeType:"Custom",applicationMappingId:w.getState().app_integration_id,approvalRequired:t,appsecData:{application:null==Z?void 0:Z.applicationId,module:null==Z?void 0:Z.moduleId,roles:r(r([],t&&a?[{users:ce.map(function(e){return e.email}),groups:pe.map(function(e){return e._id}),role:null!==(b=null===(v=Y.find(function(e){return"Learning Manager"===e.name}))||void 0===v?void 0:v._id)&&void 0!==b?b:""}]:[],!0),[{users:[null==X?void 0:X.email],groups:[],role:null!==(S=null===(y=Y.find(function(e){return"Instant Learning Admin"===e.name}))||void 0===y?void 0:y._id)&&void 0!==S?S:""}],!1)}},console.log("Add Scope payload:",l),[4,ye(l)];case 4:if(s=o.sent(),c=null===(C=null==s?void 0:s.data)||void 0===C?void 0:C.scopeId,i||!c||!F)return[3,9];he(!0),o.label=5;case 5:return o.trys.push([5,7,8,9]),[4,_({source_scope_id:F,target_scope_id:c,application_mapping_id:w.getState().app_integration_id||"",is_copy_parent_variant_id:!1})];case 6:return o.sent(),[3,9];case 7:return d=o.sent(),console.error("Failed to inherit rules for the new scope:",d),[3,9];case 8:return he(!1),[7];case 9:return j(c),B(),[3,12];case 10:return u=o.sent(),console.error("An error occurred during scope creation.",u),null===(x=V.current)||void 0===x||x.show({severity:"error",summary:"Adding Scope Failed",detail:(null===(D=null===(A=null==u?void 0:u.response)||void 0===A?void 0:A.data)||void 0===D?void 0:D.message)||"There was an error creating the scope. Please try again."}),[3,12];case 11:return oe(!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:be||"Custom"===O&&!re?.5:1},disabled:be||"Custom"===O&&!re},{children:be?t(a,{children:[i(p,{className:"animate-spin",style:{marginRight:8,height:16,width:16,color:"white"}}),"Creating..."]}):L?"SUBSCOPE"===T?"Create Subdomain":"Create Domain":A("".concat(D,".submitButton"),"Create Scope")}))]}))]}))]}))]})):null};export{R as default};
1
+ import{__awaiter as e,__generator as o,__assign as r,__spreadArray as t}from"tslib";import{jsxs as n,jsx as i,Fragment as l}from"react/jsx-runtime";import{useState as a,useRef as c,useEffect as s}from"react";import{useMutation as d}from"@tanstack/react-query";import{X as u,Loader2 as p}from"lucide-react";import{Toast as m}from"primereact/toast";import{v4 as f}from"uuid";import h from"../components/StationOnboarding/StationAutocomplete.js";import g from"./AddScopeApprovalSearchComponent.js";import v from"../components/ScopeSkeletonLoader.js";import{Input as b}from"@mui/material";import y from"../store/useAuthStore.js";import{useAppSecRolesStore as S}from"../store/useAppSecRolesStore.js";import C from"../store/useEnvStore.js";import{createRuleSet as w,inheritScope as x}from"../apis/scopeApis.js";import{useLearningTemplateStore as _}from"../store/useLearningTemplateStore.js";import{IL_CONFIG_CONSTANTS as k}from"../config.js";import{dt as D,interpolate as A}from"../store/useLMSConfigStore.js";import{MIDDLE_DRAWER_ADD_SCOPE_DT_PATH as R,MIDDLE_DRAWER_APPROVAL_SETTINGS_DT_PATH as I}from"../constants.js";var E=function(E){var B=E.isOpen,j=E.onClose,q=E.onCreate,F=E.hasGlobalRuleSet,L=E.parentId,z=E.isILMarketplace,P=void 0!==z&&z,T=E.childType,W=E.parentName,G=a(""),N=G[0],O=G[1],M=a(""),U=M[0],K=M[1],H=a({}),J=H[0],Q=H[1],V=c(null),X=y().user,Y=S(function(e){return e.roles}),Z=C(function(e){return e.rbacConfig}),$=a(!1),ee=$[0],oe=$[1],re=a(null),te=re[0],ne=re[1],ie=a("approval_required"),le=ie[0],ae=ie[1],ce=a([]),se=ce[0],de=ce[1],ue=a([]),pe=ue[0],me=ue[1],fe=a(!1);fe[0];var he=fe[1],ge=D("middleDrawer.subScope","Subscope"),ve="SUBSCOPE"===T?D("".concat(R,".subScopeName"),"".concat(ge," Name")):D("".concat(R,".scopeName"),"Scope Name"),be=d({mutationFn:function(r){return e(void 0,void 0,void 0,function(){var e;return o(this,function(o){switch(o.label){case 0:return[4,w(r,null!==(e=null==X?void 0:X.accessToken)&&void 0!==e?e:"")];case 1:return[2,o.sent()]}})})},onSuccess:function(r){return e(void 0,void 0,void 0,function(){var e,t;return o(this,function(o){return console.log("Rule Set Created Successfully",r),null===(e=V.current)||void 0===e||e.show({severity:"success",summary:"Scope Created",detail:(null===(t=null==r?void 0:r.data)||void 0===t?void 0:t.message)||"Scope created successfully",life:3e3}),[2]})})},onError:function(e){var o,r,t;console.error("Create scope failed",e),null===(o=V.current)||void 0===o||o.show({severity:"error",summary:"Creation Failed",detail:(null===(t=null===(r=null==e?void 0:e.response)||void 0===r?void 0:r.data)||void 0===t?void 0:t.message)||"There was an error creating the scope. Please try again."})}});be.data;var ye=be.isPending,Se=be.mutateAsync;if(s(function(){B&&(O(""),K(""),Q({}),ne(null),ae("approval_required"),de([]),me([]))},[B]),!B)return null;var Ce="SUBSCOPE"===T?D("".concat(R,".subScopeTitle"),D("middleDrawer.addSubScope","Add Subscope")):F?D("".concat(R,".title"),"Add Scope"):D("".concat(R,".globalTitle"),"Create Global Scope"),we="SUBSCOPE"===T?A(D("".concat(R,".subScopeSubtitle"),"This ".concat(ge.toLowerCase()," will be created under {parent} and will inherit its Knowledgebases by default.")),{parent:W||D("middleDrawer.scope","the selected scope")}):F?D("".concat(R,".subtitle"),"This scope will be created under Global scope and will inherit its learnings by default.",{parent:"Global"}):D("".concat(R,".globalSubtitle"),"This will be your Global scope that defines the base learnings shared across all stations."),xe="SUBSCOPE"===T?"Setting up your ".concat(ge,"…"):F?"Setting up your ".concat(D("middleDrawer.scope","Scope"),"…"):"Setting up your Global Scope…";return n("div",r({style:{position:"absolute",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0,0,0,0.3)"}},{children:[i(m,{ref:V}),ye||ee?i(v,{isLoading:ye||ee,title:xe,subtitle:we}):n("div",r({style:{position:"relative",width:600,borderRadius:12,backgroundColor:"white",padding:24,boxShadow:"0 25px 50px -12px rgba(0,0,0,0.25)"}},{children:[n("div",r({style:{marginBottom:24,display:"flex",alignItems:"flex-start",justifyContent:"space-between"}},{children:[n("div",{children:[i("h2",r({style:{margin:0,fontSize:18,fontWeight:500,color:"#19213D"}},{children:Ce})),i("p",r({style:{margin:"4px 0 0 0",fontSize:14,fontWeight:400,color:"#666F8D"}},{children:we}))]}),i("button",r({onClick:j,style:{background:"none",border:"none",padding:0,cursor:"pointer",color:"#9CA3AF"}},{children:i(u,{size:24})}))]})),n("div",r({style:{display:"flex",flexDirection:"column",gap:20}},{children:[n("div",r({style:{position:"relative",display:"flex",flexDirection:"column",gap:6}},{children:[n("label",r({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:[i("span",r({style:{marginRight:4,fontSize:16,fontWeight:600,color:"#8F2C23"}},{children:"*"})),ve]})),"Custom"===N?i(h,{value:U,onChange:function(e){if(e.length>50)return K(e.slice(0,50)),void Q(function(e){return r(r({},e),{name:"".concat(ve," must be 50 characters or fewer")})});K(e),Q(function(e){return r(r({},e),{name:void 0})})},onStationSelect:function(e){ne(e)},style:{border:J.name?"1px solid #8F2C23":void 0}}):i(b,{value:U,onChange:function(e){var o=e.target.value;if(o.length>50)return K(o.slice(0,50)),void Q(function(e){return r(r({},e),{name:"".concat(ve," must be 50 characters or fewer")})});K(o),Q(function(e){return r(r({},e),{name:void 0})})},style:{border:"1px solid ".concat(J.name?"#8F2C23":"#F0F2F5")},placeholder:P?"e.g. MarketPlace":"e.g. Global Learnings"}),J.name&&i("p",r({style:{margin:"4px 0 0 0",fontSize:12,color:"#8F2C23"}},{children:J.name}))]})),!P&&n("div",r({style:{display:"flex",flexDirection:"column",gap:12}},{children:[n("label",r({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:[i("span",r({style:{marginRight:4,fontSize:16,fontWeight:600,color:"#8F2C23"}},{children:"*"})),D("".concat(I,".title"),"Learning Approval Settings")]})),n("div",r({role:"radio","aria-checked":"approval_required"===le,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:4},onClick:function(){return ae("approval_required")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||ae("approval_required")}},{children:[n("div",r({style:{display:"flex",alignItems:"center",gap:8}},{children:[i("div",r({style:{display:"flex",height:16,width:16,flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("approval_required"===le?"#2563EB":"#CBD5E1")}},{children:"approval_required"===le&&i("div",{style:{height:8,width:8,borderRadius:"50%",backgroundColor:"#2563EB"}})})),i("span",r({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:D("".concat(I,".approvalRequired.title"),"Approval Required Before Publishing")}))]})),i("p",r({style:{margin:0,marginLeft:24,fontSize:12,color:"#666F8D"}},{children:D("".concat(I,".approvalRequired.subtitle"),"Learnings require approval before publishing.")}))]})),"approval_required"===le&&i(g,{selectedApprovers:se,selectedGroupOfApprovers:pe,onApproversChange:de,onGroupsChange:me}),n("div",r({role:"radio","aria-checked":"publish_without"===le,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:4},onClick:function(){ae("publish_without")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||ae("publish_without")}},{children:[n("div",r({style:{display:"flex",alignItems:"center",gap:8}},{children:[i("div",r({style:{display:"flex",height:16,width:16,flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("publish_without"===le?"#2563EB":"#CBD5E1")}},{children:"publish_without"===le&&i("div",{style:{height:8,width:8,borderRadius:"50%",backgroundColor:"#2563EB"}})})),i("span",r({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:D("".concat(I,".publishWithoutApproval.title"),"Publish Without Approval")}))]})),i("p",r({style:{margin:0,marginLeft:24,fontSize:12,color:"#666F8D"}},{children:D("".concat(I,".publishWithoutApproval.subtitle"),"Learnings can be published directly.")}))]}))]})),n("div",r({style:{marginTop:32,display:"flex",justifyContent:"flex-end",gap:12}},{children:[i("button",r({onClick:j,style:{borderRadius:6,border:"1px solid #E2E8F0",padding:"8px 16px",fontSize:14,fontWeight:500,color:"#64748B",backgroundColor:"white",cursor:"pointer",opacity:ye?.5:1},disabled:ye},{children:D("".concat(R,".cancel"),"Cancel")})),i("button",r({onClick:function(){return e(void 0,void 0,void 0,function(){var e,r,n,i,l,a,c,s,d,u,p,m,h,g,v,b,y,S,C,w,D;return o(this,function(o){switch(o.label){case 0:if(e={},U.trim()?U.length>50&&(e.name="".concat(ve," must be 50 characters or fewer")):e.name="".concat(ve," is required"),e.name)return Q(e),[2];o.label=1;case 1:return o.trys.push([1,8,9,10]),oe(!0),r="approval_required"===le,n=_.getState().backwardCompatibility,i=se.length>0||pe.length>0,l=n?{topic:F?"genreRuleSet":"globalRuleSet",customScopeGroupName:k.CUSTOM_SCOPE_GROUP_NAME,scopeDescription:U,parentScopeId:null,customScopeName:U,customScopeId:f(),createByName:(null==X?void 0:X.firstname)||"System",createdBy:(null==X?void 0:X.email)||"system@audacy.com",approvalRequired:r,appsecData:{application:null==Z?void 0:Z.applicationId,module:null==Z?void 0:Z.moduleId,roles:t(t([],r&&i?[{users:se.map(function(e){return e.email}),groups:pe.map(function(e){return e._id}),role:null!==(p=null===(u=Y.find(function(e){return"Learning Manager"===e.name}))||void 0===u?void 0:u._id)&&void 0!==p?p:""}]:[],!0),[{users:[null==X?void 0:X.email],groups:[],role:null!==(h=null===(m=Y.find(function(e){return"Instant Learning Admin"===e.name}))||void 0===m?void 0:m._id)&&void 0!==h?h:""}],!1)}}:{topic:F?"genreRuleSet":"globalRuleSet",scope_reference_id:null,scopeDescription:U,parentScopeId:null!=L?L:null,scopeName:U,scopeReferenceMetadata:{},scopeType:"Custom",applicationMappingId:_.getState().app_integration_id,approvalRequired:r,appsecData:{application:null==Z?void 0:Z.applicationId,module:null==Z?void 0:Z.moduleId,roles:t(t([],r&&i?[{users:se.map(function(e){return e.email}),groups:pe.map(function(e){return e._id}),role:null!==(v=null===(g=Y.find(function(e){return"Learning Manager"===e.name}))||void 0===g?void 0:g._id)&&void 0!==v?v:""}]:[],!0),[{users:[null==X?void 0:X.email],groups:[],role:null!==(y=null===(b=Y.find(function(e){return"Instant Learning Admin"===e.name}))||void 0===b?void 0:b._id)&&void 0!==y?y:""}],!1)}},console.log("Add Scope payload:",l),[4,Se(l)];case 2:if(a=o.sent(),c=null===(S=null==a?void 0:a.data)||void 0===S?void 0:S.scopeId,n||!c||!L)return[3,7];he(!0),o.label=3;case 3:return o.trys.push([3,5,6,7]),[4,x({source_scope_id:L,target_scope_id:c,application_mapping_id:_.getState().app_integration_id||"",is_copy_parent_variant_id:!1})];case 4:return o.sent(),[3,7];case 5:return s=o.sent(),console.error("Failed to inherit rules for the new scope:",s),[3,7];case 6:return he(!1),[7];case 7:return q(c),j(),[3,10];case 8:return d=o.sent(),console.error("An error occurred during scope creation.",d),null===(C=V.current)||void 0===C||C.show({severity:"error",summary:"Adding Scope Failed",detail:(null===(D=null===(w=null==d?void 0:d.response)||void 0===w?void 0:w.data)||void 0===D?void 0:D.message)||"There was an error creating the scope. Please try again."}),[3,10];case 9:return oe(!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:ye||"Custom"===N&&!te?.5:1},disabled:ye||"Custom"===N&&!te},{children:ye?n(l,{children:[i(p,{className:"animate-spin",style:{marginRight:8,height:16,width:16,color:"white"}}),"Creating..."]}):P?"SUBSCOPE"===T?"Create Subdomain":"Create Domain":D("".concat(R,".submitButton"),"Create Scope")}))]}))]}))]}))]}))};export{E as default};
2
2
  //# sourceMappingURL=AddScopeModal.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as i}from"tslib";import{jsxs as t,Fragment as e,jsx as n}from"react/jsx-runtime";import{Sparkles as r}from"lucide-react";var o=function(t){var e=t.width,r=void 0===e?"100%":e,o=t.height,d=void 0===o?"10px":o,h=t.style;return n("div",{style:i({width:r,height:d,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"},h)})},d=function(){return t("div",i({style:{display:"flex",flexDirection:"column",gap:"12px",padding:"24px",backgroundColor:"#fff",borderRadius:"12px",border:"1px solid #E2E8F0",width:"100%"}},{children:[n(o,{width:"100%",height:"12px"}),n(o,{width:"85%",height:"10px"}),n("div",{style:{height:"8px"}}),n(o,{width:"60%",height:"12px"}),n(o,{width:"90%",height:"10px"}),n(o,{width:"75%",height:"10px"}),n("div",{style:{height:"8px"}}),n(o,{width:"40%",height:"12px"}),n(o,{width:"100%",height:"10px"}),n(o,{width:"80%",height:"10px"}),n("div",{style:{height:"8px"}}),n(o,{width:"55%",height:"12px"}),n(o,{width:"95%",height:"10px"}),n(o,{width:"70%",height:"10px"}),n(o,{width:"45%",height:"12px"}),n(o,{width:"88%",height:"10px"})]}))},h=function(o){return o.isLoading?t(e,{children:[n("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"}),n("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:99}}),t("div",i({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:[t("div",i({style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center"}},{children:[n("div",i({style:{marginBottom:"16px"}},{children:n(r,{size:32,color:"#7C3AED"})})),n("h2",i({style:{fontSize:"1.5rem",fontWeight:600,color:"#0F172A",margin:"0 0 8px 0"}},{children:"Setting up your scope…"})),n("p",i({style:{fontSize:"0.875rem",color:"#64748B",margin:"0",lineHeight:"1.5"}},{children:"Inheriting Learnings from Global. This will only take a moment."}))]})),n("div",i({style:{flex:1.5,display:"flex",alignItems:"center",justifyContent:"center",minWidth:"350px"}},{children:n(d,{})}))]})),n("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};export{h as default};
1
+ import{__assign as i}from"tslib";import{jsxs as t,Fragment as e,jsx as n}from"react/jsx-runtime";import{Sparkles as r}from"lucide-react";var o=function(t){var e=t.width,r=void 0===e?"100%":e,o=t.height,d=void 0===o?"10px":o,h=t.style;return n("div",{style:i({width:r,height:d,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"},h)})},d=function(){return t("div",i({style:{display:"flex",flexDirection:"column",gap:"12px",padding:"24px",backgroundColor:"#fff",borderRadius:"12px",border:"1px solid #E2E8F0",width:"100%"}},{children:[n(o,{width:"100%",height:"12px"}),n(o,{width:"85%",height:"10px"}),n("div",{style:{height:"8px"}}),n(o,{width:"60%",height:"12px"}),n(o,{width:"90%",height:"10px"}),n(o,{width:"75%",height:"10px"}),n("div",{style:{height:"8px"}}),n(o,{width:"40%",height:"12px"}),n(o,{width:"100%",height:"10px"}),n(o,{width:"80%",height:"10px"}),n("div",{style:{height:"8px"}}),n(o,{width:"55%",height:"12px"}),n(o,{width:"95%",height:"10px"}),n(o,{width:"70%",height:"10px"}),n(o,{width:"45%",height:"12px"}),n(o,{width:"88%",height:"10px"})]}))},h=function(o){var h=o.isLoading,l=o.title,a=o.subtitle;return h?t(e,{children:[n("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"}),n("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:99}}),t("div",i({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:[t("div",i({style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center"}},{children:[n("div",i({style:{marginBottom:"16px"}},{children:n(r,{size:32,color:"#7C3AED"})})),n("h2",i({style:{fontSize:"1.5rem",fontWeight:600,color:"#0F172A",margin:"0 0 8px 0"}},{children:null!=l?l:"Setting up your scope…"})),n("p",i({style:{fontSize:"0.875rem",color:"#64748B",margin:"0",lineHeight:"1.5"}},{children:null!=a?a:"Inheriting Learnings from Global. This will only take a moment."}))]})),n("div",i({style:{flex:1.5,display:"flex",alignItems:"center",justifyContent:"center",minWidth:"350px"}},{children:n(d,{})}))]})),n("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};export{h as default};
2
2
  //# sourceMappingURL=ScopeSkeletonLoader.js.map
@@ -1,2 +1,2 @@
1
- import{create as e}from"zustand";import{useLearningTemplateStore as t}from"./useLearningTemplateStore.js";var 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.."},l=e(function(e){return{lmsConfig:n,setLMSConfig:function(t){return e({lmsConfig:t})},clearLMSConfig:function(){return e({lmsConfig:n})}}});function o(e,n,a){if(t.getState().backwardCompatibility)return null!=n?n:"";var o=l.getState().lmsConfig,i=e.split(".").reduce(function(e,t){return null==e?void 0:e[t]},o);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,"}"))})}function i(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,"}"))})}var r=e(function(e){return{teachMeConfig:null,setTeachMeConfig:function(t){return e({teachMeConfig:t})},clearTeachMeConfig:function(){return e({teachMeConfig:null})}}});function c(){var e,t,n=null!==(e=r.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}}function u(e,t,n){var a=r.getState().teachMeConfig,l=e.split(".").reduce(function(e,t){return null==e?void 0:e[t]},a);return"string"!=typeof l?null!=t?t:e:l.replace(/\{(\w+)\}/g,function(e,t){var a;return String(null!==(a=null==n?void 0:n[t])&&void 0!==a?a:"{".concat(t,"}"))})}export{n as defaultLMSConfig,a as defaultTeachMeConfig,o as dt,u as dtt,c as dttWelcomeMessageParts,i as interpolate,l as useLMSConfigStore,r as useTeachMeConfigStore};
1
+ import{create as e}from"zustand";import{useLearningTemplateStore as t}from"./useLearningTemplateStore.js";var 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.."},l=e(function(e){return{lmsConfig:n,setLMSConfig:function(t){return e({lmsConfig:t})},clearLMSConfig:function(){return e({lmsConfig:n})}}});function o(e,n,a){if(t.getState().backwardCompatibility)return null!=n?n:"";var o=l.getState().lmsConfig,i=e.split(".").reduce(function(e,t){return null==e?void 0:e[t]},o);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,"}"))})}function i(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,"}"))})}var r=e(function(e){return{teachMeConfig:null,setTeachMeConfig:function(t){return e({teachMeConfig:t})},clearTeachMeConfig:function(){return e({teachMeConfig:null})}}});function c(){var e,t,n=null!==(e=r.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}}function u(e,t,n){var a=r.getState().teachMeConfig,l=e.split(".").reduce(function(e,t){return null==e?void 0:e[t]},a);return"string"!=typeof l?null!=t?t:e:l.replace(/\{(\w+)\}/g,function(e,t){var a;return String(null!==(a=null==n?void 0:n[t])&&void 0!==a?a:"{".concat(t,"}"))})}export{n as defaultLMSConfig,a as defaultTeachMeConfig,o as dt,u as dtt,c as dttWelcomeMessageParts,i as interpolate,l as useLMSConfigStore,r as useTeachMeConfigStore};
2
2
  //# sourceMappingURL=useLMSConfigStore.js.map
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export{default as InstantLearning}from"./features/InstantLearning/InstantLearning.js";export{default as WtaWnta}from"./features/WtaWnta/WtaWnta.js";export{default as BookLearning}from"./features/DocumentLearning/DocumentLearning.js";export{default as ILOTJ}from"./features/IL-OTJ/ILOTJ.js";export{Button}from"./features/IL-OTJ/_components/atoms/Button/Button.js";export{Dropdown}from"./features/IL-OTJ/_components/atoms/Dropdown/Dropdown.js";export{Toggle}from"./features/IL-OTJ/_components/atoms/Toggle/Toggle.js";export{Textarea}from"./features/IL-OTJ/_components/atoms/Textarea/Textarea.js";export{ConditionList}from"./features/IL-OTJ/_components/molecules/Condition/ConditionList.js";export{SectionWrapper}from"./features/IL-OTJ/_components/molecules/Sections/SectionWrapper.js";export{SeparationRow}from"./features/IL-OTJ/_components/molecules/SeperationRow/SeparationRow.js";export{ConfigSection}from"./features/IL-OTJ/_components/organisms/ConfigSection/ConfigSection.js";export{TextSection}from"./features/IL-OTJ/_components/organisms/TextSection/TextSection.js";export{ScopeSection}from"./features/IL-OTJ/_components/organisms/ScopeSection/ScopeSection.js";export{ConditionSection}from"./features/IL-OTJ/_components/organisms/ConditionSection/ConditionSection.js";export{TrafficManagerTemplate}from"./features/IL-OTJ/_components/templates/TrafficManager/TrafficManagerTemplate.js";export{Testing}from"./features/IL-OTJ/_components/templates/Testing/Testing.js";export{TemplateList,TemplateMap}from"./features/IL-OTJ/_components/templates/TemplatesMap/templatesMap.js";export{extractAndParseResponse,extractAndParseWithProperty,extractTextFromChildren,extractVariantIds,parseValidationData,useHeaderObserver}from"./features/IL-OTJ/helpers/utils.js";export{CitationProvider,useCitations}from"./features/IL-OTJ/store/CitationsContext.js";export{dummyDat,getVariantInfo}from"./features/IL-OTJ/ILOTJTest.js";export{default as LearningManagement}from"./features/LearningManagement/LearningManagement.js";export{default as ILMarketplaceWrapper,IL_MARKETPLACE_TAB_ID,MY_KNOWLEDGE_BASES_TAB_ID,SAVED_TAB_ID}from"./ILMarketplaceWrapper.js";export{default as TeachMePlugin,TemplateRegistry}from"./features/IL-OTJ/ValueTypeWrappers/TeachMePlugin.js";import"./features/LearningManagement/LearningManagementTest.js";export{setApiDebug}from"./api/transport.js";export{default as ContinueWithTemplateModal}from"./ContinueWithTemplateModal.js";export{GuidelineCart}from"./features/IL-marketplace/components/GuidelineCart.js";export{GuidelineCartHeader}from"./features/IL-marketplace/components/GuidelineCartHeader.js";export{GuidelineCartItem}from"./features/IL-marketplace/components/GuidelineCartItem.js";export{GuidelineEmptyState}from"./features/IL-marketplace/components/GuidelineEmptyState.js";export{GuidelineHeader}from"./features/IL-marketplace/components/GuidelineHeader.js";export{GuidelineIconButton}from"./features/IL-marketplace/components/GuidelineIconButton.js";export{GuidelineLandingPage}from"./features/IL-marketplace/components/GuidelineLandingPage.js";export{GuidelineFilterPanel}from"./features/IL-marketplace/components/GuidelineFilterPanel.js";export{GuidelineLibrary}from"./features/IL-marketplace/components/GuidelineLibrary.js";export{GuidelineLibraryCard}from"./features/IL-marketplace/components/GuidelineLibraryCard.js";export{LearningManagementWrapper}from"./features/IL-marketplace/components/LearningManagementWrapper.js";export{GuidelineProceedButton}from"./features/IL-marketplace/components/GuidelineProceedButton.js";export{GuidelineSelectButton}from"./features/IL-marketplace/components/GuidelineSelectButton.js";export{GuidelineCardMenu,createGuidelineCardMenuItems}from"./features/IL-marketplace/components/GuidelineCardMenu.js";export{GuidelineConfirmDialog}from"./features/IL-marketplace/components/GuidelineConfirmDialog.js";export{useGuidelineSelection}from"./features/IL-marketplace/hooks/useGuidelineSelection.js";export{DEFAULT_GUIDELINE_ARTIFACT_TEMPLATE,DEFAULT_GUIDELINE_LABELS}from"./features/IL-marketplace/constants.js";export{createGuidelineId,cx,defaultFormatAddedOnLabel,getAppIntegrationId,getGuidelineDate,getGuidelineDescription,getGuidelineDisplayDescription,getGuidelineId,getGuidelineTitle,isInstantLearningGuideline,mergeGuidelineLabels}from"./features/IL-marketplace/utils.js";export{getGuidelineWorkspaceActions,getGuidelineWorkspaceSnapshot}from"./features/IL-marketplace/workspace/workspace.runtime.js";export{useGuidelineWorkspace,useGuidelineWorkspaceActions,useOptionalGuidelineWorkspace,useOptionalGuidelineWorkspaceActions}from"./features/IL-marketplace/workspace/useGuidelineWorkspace.js";export{clearGuidelineCartClearPending,clearInstantLearningGuidelineCartPresent,getGuidelineSessionId,markGuidelineCartClearPending,rotateGuidelineSessionId}from"./features/IL-marketplace/services/guideline.session.js";export{removeInstantLearningGuidelinesFromCart}from"./features/IL-marketplace/services/instant-learning.api.js";export{closeGuidelineOverlayWithSync}from"./features/IL-marketplace/utils/guidelineOverlay.js";export{dataCartFileToGuidelineFileItem,getDataCartFilesFromResponse,isGuidelineDataCartFile,mergeGuidelineFiles}from"./features/IL-marketplace/utils/guidelineFiles.js";export{syncGuidelineCartWithMemstore}from"./features/IL-marketplace/services/guideline.cart.api.js";export{guidelineQueryClient}from"./features/IL-marketplace/queryClient.js";
1
+ export{default as InstantLearning}from"./features/InstantLearning/InstantLearning.js";export{default as WtaWnta}from"./features/WtaWnta/WtaWnta.js";export{default as BookLearning}from"./features/DocumentLearning/DocumentLearning.js";export{default as ILOTJ}from"./features/IL-OTJ/ILOTJ.js";export{Button}from"./features/IL-OTJ/_components/atoms/Button/Button.js";export{Dropdown}from"./features/IL-OTJ/_components/atoms/Dropdown/Dropdown.js";export{Toggle}from"./features/IL-OTJ/_components/atoms/Toggle/Toggle.js";export{Textarea}from"./features/IL-OTJ/_components/atoms/Textarea/Textarea.js";export{ConditionList}from"./features/IL-OTJ/_components/molecules/Condition/ConditionList.js";export{SectionWrapper}from"./features/IL-OTJ/_components/molecules/Sections/SectionWrapper.js";export{SeparationRow}from"./features/IL-OTJ/_components/molecules/SeperationRow/SeparationRow.js";export{ConfigSection}from"./features/IL-OTJ/_components/organisms/ConfigSection/ConfigSection.js";export{TextSection}from"./features/IL-OTJ/_components/organisms/TextSection/TextSection.js";export{ScopeSection}from"./features/IL-OTJ/_components/organisms/ScopeSection/ScopeSection.js";export{ConditionSection}from"./features/IL-OTJ/_components/organisms/ConditionSection/ConditionSection.js";export{TrafficManagerTemplate}from"./features/IL-OTJ/_components/templates/TrafficManager/TrafficManagerTemplate.js";export{Testing}from"./features/IL-OTJ/_components/templates/Testing/Testing.js";export{TemplateList,TemplateMap}from"./features/IL-OTJ/_components/templates/TemplatesMap/templatesMap.js";export{extractAndParseResponse,extractAndParseWithProperty,extractTextFromChildren,extractVariantIds,parseValidationData,useHeaderObserver}from"./features/IL-OTJ/helpers/utils.js";export{CitationProvider,useCitations}from"./features/IL-OTJ/store/CitationsContext.js";export{dummyDat,getVariantInfo}from"./features/IL-OTJ/ILOTJTest.js";export{default as LearningManagement}from"./features/LearningManagement/LearningManagement.js";export{default as ILMarketplaceWrapper,IL_MARKETPLACE_TAB_ID,MY_KNOWLEDGE_BASES_TAB_ID,SAVED_TAB_ID}from"./ILMarketplaceWrapper.js";export{default as TeachMePlugin,TemplateRegistry}from"./features/IL-OTJ/ValueTypeWrappers/TeachMePlugin.js";import"./features/LearningManagement/LearningManagementTest.js";export{setApiDebug}from"./api/transport.js";export{default as ContinueWithTemplateModal}from"./ContinueWithTemplateModal.js";export{GuidelineCart}from"./features/IL-marketplace/components/GuidelineCart.js";export{GuidelineCartHeader}from"./features/IL-marketplace/components/GuidelineCartHeader.js";export{GuidelineCartItem}from"./features/IL-marketplace/components/GuidelineCartItem.js";export{GuidelineEmptyState}from"./features/IL-marketplace/components/GuidelineEmptyState.js";export{GuidelineHeader}from"./features/IL-marketplace/components/GuidelineHeader.js";export{GuidelineIconButton}from"./features/IL-marketplace/components/GuidelineIconButton.js";export{GuidelineLandingPage}from"./features/IL-marketplace/components/GuidelineLandingPage.js";export{GuidelineFilterPanel}from"./features/IL-marketplace/components/GuidelineFilterPanel.js";export{GuidelineLibrary}from"./features/IL-marketplace/components/GuidelineLibrary.js";export{GuidelineLibraryCard}from"./features/IL-marketplace/components/GuidelineLibraryCard.js";export{LearningManagementWrapper}from"./features/IL-marketplace/components/LearningManagementWrapper.js";export{GuidelineProceedButton}from"./features/IL-marketplace/components/GuidelineProceedButton.js";export{GuidelineSelectButton}from"./features/IL-marketplace/components/GuidelineSelectButton.js";export{GuidelineCardMenu,createGuidelineCardMenuItems}from"./features/IL-marketplace/components/GuidelineCardMenu.js";export{GuidelineConfirmDialog}from"./features/IL-marketplace/components/GuidelineConfirmDialog.js";export{useGuidelineSelection}from"./features/IL-marketplace/hooks/useGuidelineSelection.js";export{CONFIGURABLE_GUIDELINE_STATUSES,DEFAULT_GUIDELINE_ARTIFACT_TEMPLATE,DEFAULT_GUIDELINE_LABELS,STATUS_ACTION_MODE_NAME}from"./features/IL-marketplace/constants.js";export{createGuidelineId,cx,defaultFormatAddedOnLabel,getAppIntegrationId,getGuidelineDate,getGuidelineDescription,getGuidelineDisplayDescription,getGuidelineId,getGuidelineTitle,isInstantLearningGuideline,mergeGuidelineLabels}from"./features/IL-marketplace/utils.js";export{getGuidelineWorkspaceActions,getGuidelineWorkspaceSnapshot}from"./features/IL-marketplace/workspace/workspace.runtime.js";export{useGuidelineWorkspace,useGuidelineWorkspaceActions,useOptionalGuidelineWorkspace,useOptionalGuidelineWorkspaceActions}from"./features/IL-marketplace/workspace/useGuidelineWorkspace.js";export{clearGuidelineCartClearPending,clearInstantLearningGuidelineCartPresent,getGuidelineSessionId,markGuidelineCartClearPending,rotateGuidelineSessionId}from"./features/IL-marketplace/services/guideline.session.js";export{removeInstantLearningGuidelinesFromCart}from"./features/IL-marketplace/services/instant-learning.api.js";export{closeGuidelineOverlayWithSync}from"./features/IL-marketplace/utils/guidelineOverlay.js";export{dataCartFileToGuidelineFileItem,getDataCartFilesFromResponse,isGuidelineDataCartFile,mergeGuidelineFiles}from"./features/IL-marketplace/utils/guidelineFiles.js";export{syncGuidelineCartWithMemstore}from"./features/IL-marketplace/services/guideline.cart.api.js";export{guidelineQueryClient}from"./features/IL-marketplace/queryClient.js";
2
2
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- import{useDynamicFormStore as e}from"../store/useDynamicFormStore.js";import{stripAiReasoning as r}from"./aiReasoning.js";var 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)},n=function(n,o,a){var l=e.getState(),p=l.getGlobalField,s=l.getVariantField,u={},d={},c=[],f=function(e,n){void 0===n&&(n=!1),e&&Object.entries(e).forEach(function(e){var l=e[0],v=e[1];if(v.ui_only){if(i(v))return;v.properties&&f(v.properties,n)}else{if(v.data_key){var y=t(v.data_key,n),_=y.cleanKey,b=y.isGlobal?p(_):s(o,a,_);void 0===b&&(b="array"===v.type?[]:"boolean"!==v.type&&("object"===v.type?{}:"")),"string"==typeof b&&b.includes("<ai_reasoning>")&&(b=r(b).clean),v.core_field?u[l]=b:(d[l]=b,v.is_required&&!c.includes(l)&&c.push(l))}v.properties&&!i(v)&&f(v.properties,n)}})},v=(null==n?void 0:n.properties)||{};f(v,!1);var y=Object.values(v).find(i);return y&&y.properties&&f(y.properties,!0),{rootPayload:u,learningMetadata:{properties:d,required:c}}},o=function(r,n){var o=e.getState(),a=o.getGlobalField,l=o.getVariantField,p=(null==r?void 0:r.properties)||{},s=!0,u=function(e,r,n){e&&Object.entries(e).forEach(function(e){var o=e[1];if(!o.ui_only||!i(o)){if(o.data_key&&o.is_required){var p=t(o.data_key,void 0!==r),d=p.cleanKey;(function(e){return null!=e&&(Array.isArray(e)?e.length>0:"string"!=typeof e||""!==e.trim())})(p.isGlobal?a(d):l(r,n,d))||(s=!1)}o.properties&&!i(o)&&u(o.properties,r,n)}})};u(p);var d=Object.values(p).find(i);return(null==d?void 0:d.properties)&&n.forEach(function(e,r){e.forEach(function(e,t){u(d.properties,r,t)})}),s},a=function(n,o,a,l,p){var s,u;if(o&&"object"==typeof o){var d=e.getState(),c=d.setGlobalField,f=d.setVariantField,v=d.setGlobalReasoning,y=d.setVariantReasoning,_=!!a&&void 0!==l,b=Symbol("not-found"),g=null!==(u=null===(s=o.learning_metadata)||void 0===s?void 0:s.properties)&&void 0!==u?u:o.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,n){void 0===n&&(n=!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,n)}else{if(u.data_key&&!u.read_only&&(!0===u.ai_generated||(null==p?void 0:p.hydrateAll))){var d=t(u.data_key,n),m=d.cleanKey,O=d.isGlobal,w=function(e,r){var t;if(r){if(Object.prototype.hasOwnProperty.call(o,e))return o[e];var i=null===(t=h[e])||void 0===t?void 0:t.find(function(e){return Object.prototype.hasOwnProperty.call(o,e)});return i?o[i]:b}if(g&&"object"==typeof g&&e in g){var n=g[e];return n&&"object"==typeof n&&!Array.isArray(n)&&"value"in n?n.value:n}return b}(s,!!u.core_field);if(w!==b&&("array"!==u.type&&Array.isArray(w)&&(w=w.join("\n")),void 0!==w)){var A=null;if(!("ConditionSection"===u.bpa_ui_component)&&"string"==typeof w&&w.includes("<ai_reasoning>")){var G=r(w);w=G.clean,A=G.raw}O?(c(m,w),A&&v(m,A)):_&&(f(a,l,m,w),A&&y(a,l,m,A))}}u.properties&&!i(u)&&j(u.properties,n)}})},m=(null==n?void 0:n.properties)||{};(null==p?void 0:p.variantOnly)||j(m,!1);var O=Object.values(m).find(i);O&&O.properties&&j(O.properties,!0)}};export{a as applyResponseToStore,o as areRequiredFieldsFilled,n as generatePayloadFromSchema};
1
+ import{useDynamicFormStore as e}from"../store/useDynamicFormStore.js";import{stripAiReasoning as r}from"./aiReasoning.js";var 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)},n=function(n,o,a){var l=e.getState(),p=l.getGlobalField,s=l.getVariantField,u={},c={},d=[],f=function(e,n){void 0===n&&(n=!1),e&&Object.entries(e).forEach(function(e){var l=e[0],v=e[1];if(v.ui_only){if(i(v))return;v.properties&&f(v.properties,n)}else{if(v.data_key){var y=t(v.data_key,n),_=y.cleanKey,b=y.isGlobal?p(_):s(o,a,_);void 0===b&&(b="array"===v.type?[]:"boolean"!==v.type&&("object"===v.type?{}:"")),"string"==typeof b&&b.includes("<ai_reasoning>")&&(b=r(b).clean),v.core_field?u[l]=b:(c[l]=b,v.is_required&&!d.includes(l)&&d.push(l))}v.properties&&!i(v)&&f(v.properties,n)}})},v=(null==n?void 0:n.properties)||{};f(v,!1);var y=Object.values(v).find(i);return y&&y.properties&&f(y.properties,!0),{rootPayload:u,learningMetadata:{properties:c,required:d}}},o=function(r,n){var o=e.getState(),a=o.getGlobalField,l=o.getVariantField,p=(null==r?void 0:r.properties)||{},s=!0,u=function(e,r,n){e&&Object.entries(e).forEach(function(e){var o=e[1];if(!o.ui_only||!i(o)){if(o.data_key&&o.is_required){var p=t(o.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,n,c))||(s=!1)}o.properties&&!i(o)&&u(o.properties,r,n)}})};u(p);var c=Object.values(p).find(i);return(null==c?void 0:c.properties)&&n.forEach(function(e,r){e.forEach(function(e,t){u(c.properties,r,t)})}),s},a=function(n,o,a,l,p){var s,u;if(o&&"object"==typeof o){var c=e.getState(),d=c.setGlobalField,f=c.setVariantField,v=c.setGlobalReasoning,y=c.setVariantReasoning,_=!!a&&void 0!==l,b=Symbol("not-found"),g=null!==(u=null===(s=o.learning_metadata)||void 0===s?void 0:s.properties)&&void 0!==u?u:o.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,n){void 0===n&&(n=!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,n)}else{if(u.data_key&&(!0===u.ai_generated||(null==p?void 0:p.hydrateAll))){var c=t(u.data_key,n),m=c.cleanKey,O=c.isGlobal,w=function(e,r){var t;if(r){if(Object.prototype.hasOwnProperty.call(o,e))return o[e];var i=null===(t=h[e])||void 0===t?void 0:t.find(function(e){return Object.prototype.hasOwnProperty.call(o,e)});return i?o[i]:b}if(g&&"object"==typeof g&&e in g){var n=g[e];return n&&"object"==typeof n&&!Array.isArray(n)&&"value"in n?n.value:n}return b}(s,!!u.core_field);if(w!==b&&("array"!==u.type&&Array.isArray(w)&&(w=w.join("\n")),void 0!==w)){var A=null;if(!("ConditionSection"===u.bpa_ui_component)&&"string"==typeof w&&w.includes("<ai_reasoning>")){var G=r(w);w=G.clean,A=G.raw}O?(d(m,w),A&&v(m,A)):_&&(f(a,l,m,w),A&&y(a,l,m,A))}}u.properties&&!i(u)&&j(u.properties,n)}})},m=(null==n?void 0:n.properties)||{};(null==p?void 0:p.variantOnly)||j(m,!1);var O=Object.values(m).find(i);O&&O.properties&&j(O.properties,!0)}};export{a as applyResponseToStore,o as areRequiredFieldsFilled,n as generatePayloadFromSchema};
2
2
  //# sourceMappingURL=PayloadUtils.js.map
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ import { ExternalWorkflowStepBadges } from './features/LearningManagement/store/useExternalWorkflowStore';
2
3
  export interface TemplateContinueOption {
3
4
  id: string;
4
5
  icon: React.ReactNode;
@@ -11,7 +12,13 @@ export interface TemplateContinueOption {
11
12
  export interface ContinueWithTemplateModalProps {
12
13
  heading?: string;
13
14
  options?: TemplateContinueOption[];
15
+ /**
16
+ * Step chips for the default cards. Normally supplied by the host through
17
+ * `externalWorkflowMetaData.stepBadges` on <TeachMePlugin />; this prop is
18
+ * only for rendering the modal standalone.
19
+ */
20
+ stepBadges?: ExternalWorkflowStepBadges;
14
21
  }
15
- declare const ContinueWithTemplateModal: ({ heading, options, }: ContinueWithTemplateModalProps) => import("react").JSX.Element;
22
+ declare const ContinueWithTemplateModal: ({ heading, options, stepBadges, }: ContinueWithTemplateModalProps) => import("react").JSX.Element;
16
23
  export default ContinueWithTemplateModal;
17
24
  //# sourceMappingURL=ContinueWithTemplateModal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ContinueWithTemplateModal.d.ts","sourceRoot":"","sources":["../../../src/ContinueWithTemplateModal.tsx"],"names":[],"mappings":";AAOA,MAAM,WAAW,sBAAsB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,8BAA8B;IAC3C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,sBAAsB,EAAE,CAAC;CACtC;AAED,QAAA,MAAM,yBAAyB,0BAG5B,8BAA8B,gCAqJhC,CAAC;AAEF,eAAe,yBAAyB,CAAC"}
1
+ {"version":3,"file":"ContinueWithTemplateModal.d.ts","sourceRoot":"","sources":["../../../src/ContinueWithTemplateModal.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,0BAA0B,EAA4B,MAAM,8DAA8D,CAAC;AAGpI,MAAM,WAAW,sBAAsB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,8BAA8B;IAC3C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,sBAAsB,EAAE,CAAC;IACnC;;;;OAIG;IACH,UAAU,CAAC,EAAE,0BAA0B,CAAC;CAC3C;AAED,QAAA,MAAM,yBAAyB,sCAI5B,8BAA8B,gCAwJhC,CAAC;AAEF,eAAe,yBAAyB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { LscGuidelineSection } from "./features/IL-marketplace/types/add-context.types";
3
- import { LscGuidelineLabels } from "./features/IL-marketplace/types";
3
+ import { GuidelineStatusActions, LscGuidelineLabels } from "./features/IL-marketplace/types";
4
4
  import { FileItem } from "./features/IL-marketplace/types/file-item";
5
5
  import { ScopeTreeNode } from "@e-llm-studio/creative-workspace-ui-component/dist/types/types";
6
6
  import type { MiddleDrawerOverrides } from "./features/LearningManagement/types";
@@ -37,6 +37,12 @@ export type ILMarketplaceWrapperProps = {
37
37
  isILMarketplace?: boolean;
38
38
  handleViewButtonCallback?: (guideline: FileItem) => void;
39
39
  handlePreviewButtonCallback?: (guideline: FileItem) => void;
40
+ /**
41
+ * Status-driven primary button (Configure for drafts, Test Template otherwise).
42
+ * Applied only when `statusActions.modeName` is `STATUS_ACTION_MODE_NAME`; any other
43
+ * mode keeps the existing `handleViewButtonCallback` behaviour.
44
+ */
45
+ statusActions?: GuidelineStatusActions<FileItem>;
40
46
  onAddKnowledgeBase?: () => void;
41
47
  marketplaceLabels?: ILMarketplaceLabelsConfig;
42
48
  fetchGuidelinesForTab?: (tabId: string) => Promise<FileItem[]>;