@e-llm-studio/instant-learning 1.3.0-alpha.19 → 1.3.0-alpha.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +150 -31
- package/dist/cjs/features/IL-OTJ/_components/MessageRendering/ClickableChatComponents.js +1 -1
- package/dist/cjs/features/LearningManagement/AuditLog/AuditLog.js +1 -1
- package/dist/cjs/features/LearningManagement/LearningManagement.js +1 -1
- package/dist/cjs/features/LearningManagement/RuleContent/AddScopeModal.js +1 -1
- package/dist/cjs/features/LearningManagement/RuleContent/ApprovalLearningDialog.js +1 -1
- package/dist/cjs/features/LearningManagement/RuleContent/RuleAccordionHeader.js +1 -1
- package/dist/cjs/features/LearningManagement/RuleContent/RuleContent.js +1 -1
- package/dist/cjs/features/LearningManagement/RuleContent/TierCard.js +1 -1
- package/dist/cjs/features/LearningManagement/RuleContent/VariantCard.js +1 -1
- package/dist/cjs/features/LearningManagement/Sidebar.js +1 -1
- package/dist/cjs/features/LearningManagement/components/InstantLearningModal.js +1 -1
- package/dist/cjs/features/LearningManagement/components/ScopeTree/TreeNode.js +1 -1
- package/dist/cjs/features/LearningManagement/config.js +1 -1
- package/dist/cjs/features/LearningManagement/constants.js +2 -0
- package/dist/cjs/features/LearningManagement/constants.js.map +1 -0
- package/dist/cjs/features/LearningManagement/queries/useLMSConfigQuery.js +1 -1
- package/dist/cjs/features/LearningManagement/store/useLMSConfigStore.js +1 -1
- package/dist/cjs/plugins/ValueTypes/Default/DefaultTeachMeRenderer.js +1 -1
- package/dist/cjs/plugins/ValueTypes/Guidelines/GuidelinesTeachMeRenderer.js +1 -1
- package/dist/features/IL-OTJ/_components/MessageRendering/ClickableChatComponents.js +1 -1
- package/dist/features/LearningManagement/AuditLog/AuditLog.js +1 -1
- package/dist/features/LearningManagement/LearningManagement.js +1 -1
- package/dist/features/LearningManagement/RuleContent/AddScopeModal.js +1 -1
- package/dist/features/LearningManagement/RuleContent/ApprovalLearningDialog.js +1 -1
- package/dist/features/LearningManagement/RuleContent/RuleAccordionHeader.js +1 -1
- package/dist/features/LearningManagement/RuleContent/RuleContent.js +1 -1
- package/dist/features/LearningManagement/RuleContent/TierCard.js +1 -1
- package/dist/features/LearningManagement/RuleContent/VariantCard.js +1 -1
- package/dist/features/LearningManagement/Sidebar.js +1 -1
- package/dist/features/LearningManagement/components/InstantLearningModal.js +1 -1
- package/dist/features/LearningManagement/components/ScopeTree/TreeNode.js +1 -1
- package/dist/features/LearningManagement/config.js +1 -1
- package/dist/features/LearningManagement/constants.js +2 -0
- package/dist/features/LearningManagement/constants.js.map +1 -0
- package/dist/features/LearningManagement/queries/useLMSConfigQuery.js +1 -1
- package/dist/features/LearningManagement/store/useLMSConfigStore.js +1 -1
- package/dist/plugins/ValueTypes/Default/DefaultTeachMeRenderer.js +1 -1
- package/dist/plugins/ValueTypes/Guidelines/GuidelinesTeachMeRenderer.js +1 -1
- package/dist/types/src/features/IL-OTJ/_components/MessageRendering/ClickableChatComponents.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/AuditLog/AuditLog.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/LearningManagement.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/RuleContent/AddScopeModal.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/RuleContent/ApprovalLearningDialog.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/RuleContent/RuleAccordionHeader.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/RuleContent/RuleContent.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/RuleContent/TierCard.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/RuleContent/VariantCard.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/Sidebar.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/components/ScopeTree/TreeNode.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/constants.d.ts +8 -0
- package/dist/types/src/features/LearningManagement/constants.d.ts.map +1 -0
- package/dist/types/src/features/LearningManagement/queries/useLMSConfigQuery.d.ts +1 -1
- package/dist/types/src/features/LearningManagement/queries/useLMSConfigQuery.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/store/useLMSConfigStore.d.ts +16 -0
- package/dist/types/src/features/LearningManagement/store/useLMSConfigStore.d.ts.map +1 -1
- package/dist/types/src/plugins/ValueTypes/Default/DefaultTeachMeRenderer.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),o=require("react/jsx-runtime"),n=require("lucide-react"),i=require("../../styles/ScopeTree.module.css.js"),d=require("./TreeNodeHeader.js"),t=require("./TreeSectionItem.js"),r=require("./TreeAddAction.js"),l=require("../../store/useLMSConfigStore.js"),a=require("../../constants.js"),c=function(s){var u,p,h,v,C=s.node,m=s.depth,T=void 0===m?0:m,f=s.nodePath,_=void 0===f?[]:f,g=s.expandedNodeIds,b=s.activeSelection,y=s.onToggleExpand,A=s.onSectionSelect,S=s.onNodeOptionsClick,D=s.onAddChild,x=s.onRenameChild,E=s.onDeleteChild,N=s.canDeleteScope,j=s.canEditScope,L=s.canCreateScope,P=s.searchQuery,q=s.sectionsConfig,R=void 0===q?[]:q,I=s.nodeTypesConfig,k=void 0===I?[]:I,M=s.forceVisible,w=void 0!==M&&M,O=e.__spreadArray(e.__spreadArray([],_,!0),[C.id],!1),H=g.has(C.id),W=l.dt("".concat(a.MIDDLE_DRAWER_DT_PATH,".scope")),V=!!b&&b.nodePath[b.nodePath.length-1]===C.id,Q=!!b&&(b.nodePath.includes(C.id)&&!V),Y=function(e,o){if(!o)return!0;var n=o.toLowerCase();return!!e.name.toLowerCase().includes(n)||!!e.children&&e.children.some(function(e){return Y(e,o)})};if(!w&&!Y(C,P||""))return null;var K=T>=k.length-1?k[k.length-1]:k[T],U=!!(null==K?void 0:K.addChildType),X=!N||N(C.id),z=!j||j(C.id),B=!L||L(C.id),F=C.children&&C.children.length>0,G=!X||F,J=X?F?"This scope cannot be deleted because other scopes inherit learnings from it.":void 0:"You do not have permission to delete this scope.",Z=B?void 0:"You do not have permission to add a scope here.",$=!P||C.name.toLowerCase().includes(P.toLowerCase());return o.jsxs("div",e.__assign({className:i.default.nodeWrapper,style:{"--tree-depth":T}},{children:[o.jsx(d.TreeNodeHeader,{nodeType:C.type,name:C.name,isExpanded:H,isSelected:V,isAncestor:Q,childrenCount:null===(u=C.children)||void 0===u?void 0:u.length,onToggleExpand:function(e){e.stopPropagation(),y(C.id)},onClick:function(){A(O,"learnings")},searchQuery:P,menuOptions:e.__spreadArray(e.__spreadArray([],U?[{label:K.addChildLabel||"Add Child",icon:n.Plus,onClick:function(){return null==D?void 0:D(C.id,K.addChildType,C.name)},disabled:!B,tooltip:Z}]:[],!0),[{label:"".concat(l.dt("".concat(a.MIDDLE_DRAWER_CONTEXT_MENU_DT_PATH,".rename"),"Rename")),icon:n.Pencil,onClick:function(){return null==x?void 0:x(C.id,C.name)},disabled:!z||"station"===(null===(p=null==C?void 0:C.type)||void 0===p?void 0:p.toLocaleLowerCase()),tooltip:z?void 0:"You do not have permission to rename this scope."},{label:"station"===(null===(h=null==C?void 0:C.type)||void 0===h?void 0:h.toLowerCase())?"Delete Station":" ".concat(l.dt("".concat(a.MIDDLE_DRAWER_CONTEXT_MENU_DT_PATH,".delete"),"Delete ".concat((null==K?void 0:K.label)||"Node"),{scope:W})),icon:n.Trash2,onClick:function(){var e;return null==E?void 0:E(C.id,C.name,(null===(e=C.metrics)||void 0===e?void 0:e.learningsCount)||0)},disabled:G,tooltip:J,className:"text-red-500 hover:text-red-600 hover:bg-red-50"}],!1)}),H&&o.jsxs("div",e.__assign({className:i.default.childrenWrapper},{children:[R.filter(function(e){return!e.isVisible||e.isVisible(C,T)}).map(function(e){var n;return o.jsx(t.TreeSectionItem,{icon:e.icon,label:e.label,badgeCount:e.badgeKey?null===(n=C.metrics)||void 0===n?void 0:n[e.badgeKey]:void 0,isActive:V&&(null==b?void 0:b.sectionId)===e.id,onClick:function(){return A(O,e.id)}},"".concat(C.id,"-").concat(e.id))}),null===(v=C.children)||void 0===v?void 0:v.map(function(e){return o.jsx(c,{node:e,depth:T+1,nodePath:O,expandedNodeIds:g,activeSelection:b,onToggleExpand:y,onSectionSelect:A,onNodeOptionsClick:S,onAddChild:D,onRenameChild:x,onDeleteChild:E,canDeleteScope:N,canEditScope:j,canCreateScope:L,searchQuery:P,forceVisible:$,sectionsConfig:R,nodeTypesConfig:k},e.id)}),U&&o.jsx(r.TreeAddAction,{label:K.addChildLabel||"Add Child",onAdd:function(){return null==D?void 0:D(C.id,K.addChildType,C.name)},disabled:!B,tooltip:Z})]}))]}))};exports.TreeNode=c;
|
|
2
2
|
//# sourceMappingURL=TreeNode.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),require("tslib");var _={VITE_GOOGLE_CLIENT_ID:process.env.VITE_GOOGLE_CLIENT_ID,VITE_GOOGLE_CLIENT_SECRET:process.env.VITE_GOOGLE_CLIENT_SECRET,VITE_REDIRECT_URI:process.env.VITE_REDIRECT_URI||"http://localhost:5173",VITE_BACKEND_URL:process.env.VITE_BACKEND_URL||"http://localhost:3000",VITE_DOMAIN_NAME_URL:process.env.VITE_DOMAIN_NAME_URL||"https://devllmstudio.creativeworkspace.ai",VITE_ASSISTANT_NAME:process.env.VITE_ASSISTANT_NAME||"cwchatorchestrator",VITE_PROJECT_CREATION_ASSISTANT_NAME:process.env.VITE_PROJECT_CREATION_ASSISTANT_NAME||"cwprojectcreation",VITE_WEBSOCKET_URL:process.env.VITE_WEBSOCKET_URL||"wss://dev-proposals-ai.techo.camp/graphql",VITE_AUDACY_BACKEND_URL:process.env.VITE_AUDACY_BACKEND_URL||"",VITE_AUDACY_WEBSOCKET_URL:process.env.VITE_AUDACY_WEBSOCKET_URL||"",VITE_AUDACY_ASSISTANT_NAME:process.env.VITE_AUDACY_ASSISTANT_NAME||"",VITE_AUDACY_RECOMMEND_AGENT:process.env.VITE_AUDACY_RECOMMEND_AGENT||"",VITE_AUDACY_COMPARE_AGENT:process.env.VITE_AUDACY_COMPARE_AGENT||"",VITE_AUDACY_CHAT_ASSISTANT:process.env.VITE_AUDACY_CHAT_ASSISTANT||"",VITE_CORE_WHITELIST_URLS:(null===(e=process.env.VITE_CORE_WHITELIST_URLS)||void 0===e?void 0:e.split(",").map(function(e){return e.trim()}))||[],VITE_LLM_STUDIO_URL:process.env.VITE_LLM_STUDIO_URL||"https://devllmstudio.creativeworkspace.ai",VITE_LLM_STUDIO_WEBSOCKET_URL:process.env.VITE_LLM_STUDIO_WEBSOCKET_URL||"wss://devllmstudio.creativeworkspace.ai/graphql",VITE_AUDACY_RULE_ASSISTANT:process.env.VITE_AUDACY_RULE_ASSISTANT},E={"Separation rule":"I want to add a separation rule","Max priority":"I want to set a max priority","Break code matching":"I want to add a break code matching rule","Inventory window matching":"I want to add an inventory window matching rule","Enter a learning description":"I want to add a learning description","Tester Genie":"Finding an interesting usecase to test..."},T="<p><span>Hi! 👋 I'm your Instant Learning Concierge.</span>\n <span>How would you like to get started? You can select an option below or describe the learning you'd like to create.</span>\n ".concat(["Separation rule","Max priority","Break code matching","Inventory window matching","Enter a learning description"].map(function(e){return'<button class="clickable-button" data-value="'.concat(E[e],'">').concat(e,"</button>")}).join(""),"</p>"),n={CUSTOM_SCOPE_GROUP_NAME:"Audacy-Traffic-Manager",INSTANT_LEARNING_TYPE:"iL",MODEL:"claude-3.5-sonnet",CONFIG_MASTER_NAME:"audacy-config",SCOPE_NAME:"Custom",ASSISTANT_NAME:process.env.VITE_AUDACY_RULE_ASSISTANT||"testaudacyrilprompt",ORGANIZATION_NAME:"techolution",BASE_URL:_.VITE_LLM_STUDIO_URL,BASE_WEBSOCKET_URL:_.VITE_LLM_STUDIO_WEBSOCKET_URL,CHAT_TITLE:"Teach Me OTJ -
|
|
1
|
+
"use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),require("tslib");var _={VITE_GOOGLE_CLIENT_ID:process.env.VITE_GOOGLE_CLIENT_ID,VITE_GOOGLE_CLIENT_SECRET:process.env.VITE_GOOGLE_CLIENT_SECRET,VITE_REDIRECT_URI:process.env.VITE_REDIRECT_URI||"http://localhost:5173",VITE_BACKEND_URL:process.env.VITE_BACKEND_URL||"http://localhost:3000",VITE_DOMAIN_NAME_URL:process.env.VITE_DOMAIN_NAME_URL||"https://devllmstudio.creativeworkspace.ai",VITE_ASSISTANT_NAME:process.env.VITE_ASSISTANT_NAME||"cwchatorchestrator",VITE_PROJECT_CREATION_ASSISTANT_NAME:process.env.VITE_PROJECT_CREATION_ASSISTANT_NAME||"cwprojectcreation",VITE_WEBSOCKET_URL:process.env.VITE_WEBSOCKET_URL||"wss://dev-proposals-ai.techo.camp/graphql",VITE_AUDACY_BACKEND_URL:process.env.VITE_AUDACY_BACKEND_URL||"",VITE_AUDACY_WEBSOCKET_URL:process.env.VITE_AUDACY_WEBSOCKET_URL||"",VITE_AUDACY_ASSISTANT_NAME:process.env.VITE_AUDACY_ASSISTANT_NAME||"",VITE_AUDACY_RECOMMEND_AGENT:process.env.VITE_AUDACY_RECOMMEND_AGENT||"",VITE_AUDACY_COMPARE_AGENT:process.env.VITE_AUDACY_COMPARE_AGENT||"",VITE_AUDACY_CHAT_ASSISTANT:process.env.VITE_AUDACY_CHAT_ASSISTANT||"",VITE_CORE_WHITELIST_URLS:(null===(e=process.env.VITE_CORE_WHITELIST_URLS)||void 0===e?void 0:e.split(",").map(function(e){return e.trim()}))||[],VITE_LLM_STUDIO_URL:process.env.VITE_LLM_STUDIO_URL||"https://devllmstudio.creativeworkspace.ai",VITE_LLM_STUDIO_WEBSOCKET_URL:process.env.VITE_LLM_STUDIO_WEBSOCKET_URL||"wss://devllmstudio.creativeworkspace.ai/graphql",VITE_AUDACY_RULE_ASSISTANT:process.env.VITE_AUDACY_RULE_ASSISTANT},E={"Separation rule":"I want to add a separation rule","Max priority":"I want to set a max priority","Break code matching":"I want to add a break code matching rule","Inventory window matching":"I want to add an inventory window matching rule","Enter a learning description":"I want to add a learning description","Tester Genie":"Finding an interesting usecase to test..."},T="<p><span>Hi! 👋 I'm your Instant Learning Concierge.</span>\n <span>How would you like to get started? You can select an option below or describe the learning you'd like to create.</span>\n ".concat(["Separation rule","Max priority","Break code matching","Inventory window matching","Enter a learning description"].map(function(e){return'<button class="clickable-button" data-value="'.concat(E[e],'">').concat(e,"</button>")}).join(""),"</p>"),n={CUSTOM_SCOPE_GROUP_NAME:"Audacy-Traffic-Manager",INSTANT_LEARNING_TYPE:"iL",MODEL:"claude-3.5-sonnet",CONFIG_MASTER_NAME:"audacy-config",SCOPE_NAME:"Custom",ASSISTANT_NAME:process.env.VITE_AUDACY_RULE_ASSISTANT||"testaudacyrilprompt",ORGANIZATION_NAME:"techolution",BASE_URL:_.VITE_LLM_STUDIO_URL,BASE_WEBSOCKET_URL:_.VITE_LLM_STUDIO_WEBSOCKET_URL,CHAT_TITLE:"Teach Me OTJ - {scope} - Add Learning",CHAT_TITLE_EDIT:"Teach Me OTJ - {scope} - Edit Learning",FORM_TITLE:"Learning Details",INITIAL_CHAT_MESSAGE:T,CATEGORY:"Global-Template",SOCKET_TIMEOUT:24e4};exports.IL_CONFIG_CONSTANTS=n,exports.config=_;
|
|
2
2
|
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.LEARNING_DT_PATH="learnings.tier.learning",exports.MIDDLE_DRAWER_ADD_SCOPE_DT_PATH="middleDrawer.addScopeDialog",exports.MIDDLE_DRAWER_APPROVAL_SETTINGS_DT_PATH="middleDrawer.addScopeDialog.learningApprovalSettings",exports.MIDDLE_DRAWER_CONTEXT_MENU_DT_PATH="middleDrawer.treeMenu.contextMenu",exports.MIDDLE_DRAWER_DT_PATH="middleDrawer",exports.TIER_DT_PATH="learnings.tier",exports.VARIANT_DT_PATH="learnings.tier.learning.variant";
|
|
2
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("@tanstack/react-query"),t=require("../store/useAuthStore.js"),n=require("../store/useEnvStore.js"),u=require("../apis/scopeApis.js"),i=require("../store/useLMSConfigStore.js"),o=require("../store/useLearningTemplateStore.js");exports.useLMSConfigQuery=function(s,a){var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("@tanstack/react-query"),t=require("../store/useAuthStore.js"),n=require("../store/useEnvStore.js"),u=require("../apis/scopeApis.js"),i=require("../store/useLMSConfigStore.js"),o=require("../store/useLearningTemplateStore.js");exports.useLMSConfigQuery=function(s,a,l){var c=this;void 0===l&&(l=!0);var f=t.default(function(e){var r,t;return null!==(t=null===(r=e.user)||void 0===r?void 0:r.accessToken)&&void 0!==t?t:""}),g=n.default(function(e){var r;return null!==(r=e.llmStudioUrl)&&void 0!==r?r:""}),v=i.useLMSConfigStore(function(e){return e.setLMSConfig}),d=i.useTeachMeConfigStore(function(e){return e.setTeachMeConfig}),S=o.useLearningTemplateStore(function(e){return e.setTemplateData});return r.useQuery({queryKey:["lms-config",s],queryFn:function(){return e.__awaiter(c,void 0,void 0,function(){var r,t,n,i;return e.__generator(this,function(e){switch(e.label){case 0:return[4,u.fetchLMSConfig(g,s,f)];case 1:return r=e.sent(),t=r.lmsConfig,n=r.teachMeConfig,i=r.template,t&&v(t),n&&d(n),i&&S(s,i),[2,{lmsConfig:t,teachMeConfig:n,template:i}]}})})},enabled:l&&!!s&&!!f&&!!g&&!a,staleTime:6e5})};
|
|
2
2
|
//# sourceMappingURL=useLMSConfigQuery.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("zustand"),t={pageTitle:"",middleDrawer:{scope:"",addScope:"",addSubScope:"",addScopeDialog:{title:"",subtitle:"",scopeName:"",learningApprovalSettings:{title:"",approvalRequired:{title:"",subtitle:""},publishWithoutApproval:{title:"",subtitle:""}},submitButton:"",cancel:""},treeMenu:{search:"",submenu:{learnings:"",access:"",changeHistory:""},contextMenu:{addScope:"",rename:"",delete:"",addSubScope:""}}},learnings:{header:{title:"",exportButton:"",addNewLearningButton:""},tier:{showTierHeader:!0,tierHeader:"",subtitle:"",tierHeaderNoOfLearnings:"",deleteDialog:{title:"",description:"",cancel:"",submit:""},learning:{inheritance:"",actions:{disable:"",enable:"",approve:"",reject:"",delete:""},approveDialog:{title:"",desc:"",footer:"",cancel:"",approveLearning:""},rejectDialog:{title:"",desc:"",feedbackTitle:"",feedbackPlaceholder:"",deleteCheckboxLabel:"",cancel:"",rejectLearning:""},deleteDialog:{title:"",desc:"",warningText:"",cancelText:"",deleteText:""}}}}},
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("zustand"),t=require("./useLearningTemplateStore.js"),n={pageTitle:"",middleDrawer:{scope:"",addScope:"",addSubScope:"",addScopeDialog:{title:"",subtitle:"",scopeName:"",learningApprovalSettings:{title:"",approvalRequired:{title:"",subtitle:""},publishWithoutApproval:{title:"",subtitle:""}},submitButton:"",cancel:""},treeMenu:{search:"",submenu:{learnings:"",access:"",changeHistory:""},contextMenu:{addScope:"",rename:"",delete:"",addSubScope:""}}},learnings:{header:{title:"",exportButton:"",addNewLearningButton:""},tier:{showTierHeader:!0,tierHeader:"",subtitle:"",tierHeaderNoOfLearnings:"",deleteDialog:{title:"",description:"",cancel:"",submit:""},learning:{inheritance:"",actions:{disable:"",enable:"",approve:"",reject:"",delete:""},approveDialog:{title:"",desc:"",footer:"",cancel:"",approveLearning:""},rejectDialog:{title:"",desc:"",feedbackTitle:"",feedbackPlaceholder:"",deleteCheckboxLabel:"",cancel:"",rejectLearning:""},deleteDialog:{title:"",desc:"",warningText:"",cancelText:"",deleteText:""}}}}},a={showScope:!1,showConfiguration:!1,welcomeMessage:"Hi! 👋 I'm your Instant Learning Concierge.",welcomeMessageSubtitle:"How would you like to get started? You can select an option below or describe the rule you'd like to create.",actions:[{label:"Separation rule",value:"I would want to add a separation rule"},{label:"Max priority rule",value:"I would want to set a max priority rule"},{label:"Break code matching",value:"I would want to add a break code matching rule"},{label:"Inventory code matching",value:"I would want to add a inventory window matching rule"},{label:"Enter a rule description",value:"I want to add a rule description"},{label:"Tester Genie",value:"Loading prompt..."}],chatTitle:"Teach Me OTJ - {scope} - Add Learning",chatTitleEdit:"Teach Me OTJ - {scope} - Edit Learning",formTitle:"Rule setup",setupLabel:"Configure your IL",ruleTitle:"Main Rule Name",scopeLabel:"Define Scope",tierLabel:"Select Tiers",ruleDescriptionTitle:"Learning Explanation",whenToApplyTitle:"Trigger Events (When to Apply)",addWhenToApplyBtnLabel:"Add WTA",whenNotToApplyTitle:"Exclusion Events (When NOT to Apply)",addWhenNotToApplyBtnLabel:"Add WNTA",configTitle:"Advanced Settings",saveBtnLabel:"Save Rule",saveBtnLoadingLabel:"Saving Rule...",chatTextareaPlaceholder:"Tell me more about this learning.."},l=e.create(function(e){return{lmsConfig:n,setLMSConfig:function(t){return e({lmsConfig:t})},clearLMSConfig:function(){return e({lmsConfig:n})}}});var i=e.create(function(e){return{teachMeConfig:null,setTeachMeConfig:function(t){return e({teachMeConfig:t})},clearTeachMeConfig:function(){return e({teachMeConfig:null})}}});exports.defaultLMSConfig=n,exports.defaultTeachMeConfig=a,exports.dt=function(e,n,a){if(t.useLearningTemplateStore.getState().backwardCompatibility)return null!=n?n:"";var i=l.getState().lmsConfig,o=e.split(".").reduce(function(e,t){return null==e?void 0:e[t]},i);return"string"!=typeof o||""===o?null!=n?n:e:o.replace(/\{(\w+)\}/g,function(e,t){var n;return String(null!==(n=null==a?void 0:a[t])&&void 0!==n?n:"{".concat(t,"}"))})},exports.dtt=function(e,t,n){var a=i.getState().teachMeConfig,l=e.split(".").reduce(function(e,t){return null==e?void 0:e[t]},a);return"string"!=typeof l?null!=t?t:e:l.replace(/\{(\w+)\}/g,function(e,t){var a;return String(null!==(a=null==n?void 0:n[t])&&void 0!==a?a:"{".concat(t,"}"))})},exports.dttWelcomeMessageParts=function(){var e,t,n=null!==(e=i.getState().teachMeConfig)&&void 0!==e?e:a;return{greeting:n.welcomeMessage||a.welcomeMessage,subtitle:n.welcomeMessageSubtitle||a.welcomeMessageSubtitle,actions:(null===(t=n.actions)||void 0===t?void 0:t.length)?n.actions:a.actions}},exports.useLMSConfigStore=l,exports.useTeachMeConfigStore=i;
|
|
2
2
|
//# sourceMappingURL=useLMSConfigStore.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),i=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),i=require("../../../features/LearningManagement/components/InstantLearningModal.js"),a=require("../../../features/LearningManagement/store/useLMSConfigStore.js"),n=require("react-markdown"),r=require("react-dom/server");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=l(n);exports.default=function(n){var l=n.pluginPayload||{},d=l.editingRule,s=l.editingTier,c=l.editingVariants,u=l.focusedVariantIndex,p=l.setFocusedVariantIndex,g=l.triggerAddVariant,T=l.triggerFixGaps,h=l.copiedRule,f=l.copiedSourceTier,b=l.copiedTargetTier,L=l.initialDraftMessage,m=l.app_integration_id,x=l.modeId;a.useTeachMeConfigStore(function(e){return e.teachMeConfig});var A=a.dttWelcomeMessageParts(),v=A.greeting,M=A.subtitle,S=A.actions,y=r.renderToStaticMarkup(t.jsxs("p",{children:[t.jsx("span",{children:v}),t.jsx(o.default,{children:M}),t.jsx("span",e.__assign({className:"clickable-button-group"},{children:S.map(function(i){var a=i.label,n=i.value;return t.jsx("button",e.__assign({className:"clickable-button","data-value":n},{children:a}),a)})}))]})),I={showScope:!1,showConfiguration:!1,welcomeMessage:a.dtt("welcomeMessage","Hi! 👋 I'm your Instant Learning Concierge."),formTitle:a.dtt("formTitle","Rule setup"),setupLabel:a.dtt("setupLabel","Configure your IL"),ruleTitle:a.dtt("ruleTitle","Main Rule Name"),scopeLabel:a.dtt("scopeLabel","Define Scope"),tierLabel:a.dtt("tierLabel","Select Tiers"),ruleDescriptionTitle:a.dtt("ruleDescriptionTitle","Learning Explanation"),whenToApplyTitle:a.dtt("whenToApplyTitle","Trigger Events (When to Apply)"),addWhenToApplyBtnLabel:a.dtt("addWhenToApplyBtnLabel","Add WTA"),whenNotToApplyTitle:a.dtt("whenNotToApplyTitle","Exclusion Events (When NOT to Apply)"),addWhenNotToApplyBtnLabel:a.dtt("addWhenNotToApplyBtnLabel","Add WNTA"),configTitle:a.dtt("configTitle","Advanced Settings"),saveBtnConfig:{label:a.dtt("saveBtnLabel","Save Rule"),loadingLabel:a.dtt("saveBtnLoadingLabel","Saving Rule...")},chatTitle:a.dtt("chatTitle","Teach Me OTJ - {scope} - Add Learning"),chatTitleEdit:a.dtt("chatTitleEdit","Teach Me OTJ - {scope} - Edit Learning"),chatTextareaPlaceholder:a.dtt("chatTextareaPlaceholder","Tell me more about this learning..")};return t.jsx(i.default,{isOpen:n.isOpen,onClose:n.onClose,initialScope:n.initialScope,ruleSet:n.ruleSet,editingRule:d,editingTier:s,editingVariants:c,focusedVariantIndex:u,setFocusedVariantIndex:p,triggerAddVariant:g,triggerFixGaps:T,copiedRule:h,copiedSourceTier:f,copiedTargetTier:b,initialDraftMessage:L,initialChatMessage:y,applicationIntegrationId:m,modeId:x,uiStateLabels:I})};
|
|
2
2
|
//# sourceMappingURL=DefaultTeachMeRenderer.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("react/jsx-runtime"),t=require("react"),n=require("lucide-react");require("../../../features/IL-OTJ/_components/atoms/Textarea/Textarea.js"),require("../../../features/IL-OTJ/_components/InputDataReasoningCard.js"),require("../../../features/IL-OTJ/_components/TooltipComponent.js");var a=require("../../../features/IL-OTJ/_components/templates/TemplatesMap/templatesMap.js");require("../../../features/IL-OTJ/store/CitationsContext.js"),require("@mui/material"),require("uuid"),require("@mui/material/Tooltip"),require("react-markdown"),require("rehype-raw"),require("axios"),require("@e-llm-studio/streaming-response"),require("@e-llm-studio/watch-me-work"),require("../../../features/IL-OTJ/_components/ChatComponents/ChatHeader.js"),require("remark-gfm"),require("../../../features/IL-OTJ/_components/MarkdownComponents/MarkdownElements.js"),require("../../../features/IL-OTJ/_components/CitationLink.js"),require("@e-llm-studio/citation"),require("@viswa-test/test-citation"),require("../../../features/LearningManagement/store/useLearningTemplateStore.js"),require("primereact/toast"),require("../../../features/LearningManagement/apis/scopeApis.js"),require("../../../features/LearningManagement/store/usePermissionsStore.js"),require("../../../features/LearningManagement/store/useLMSConfigStore.js"),require("../../../features/LearningManagement/components/ToolTip.js"),require("../../../features/LearningManagement/store/useAuthStore.js"),require("@mui/icons-material/Check"),require("@mui/icons-material/CloseRounded"),require("@tanstack/react-query"),require("../../../features/LearningManagement/store/useEnvStore.js"),require("date-fns"),require("framer-motion"),require("@mui/icons-material/Close");var i=require("../../../features/IL-OTJ/ILOTJ.js");require("../../../features/LearningManagement/store/useConfigStore.js"),require("../../../features/LearningManagement/config.js"),require("react-dom/server");var o=require("../../../features/IL-OTJ/_components/AccordianSection.js");require("appsec-ui"),require("@radix-ui/react-tooltip"),require("../../../features/LearningManagement/components/StationOnboarding/InputField.js"),require("../../../features/LearningManagement/store/useAppSecRolesStore.js"),require("@e-llm-studio/audit-log"),require("@e-llm-studio/audit-log/dist/styles.css"),require("../../../features/LearningManagement/AuditLog/ChangeLogDiff.js"),require("react-router-dom");var s={order_rules:{enabled:!1,global_min_separation_seconds:0},advertiser_rules:{enabled:!1,global_min_separation_seconds:0},inventory_rules:{respect_inventory_code:!1},break_code_rules:{respect_break_code:!1},is_default_enabled:!1},u=[{label:"Global Scope",value:"global"},{label:"Genre Scope",value:"genre"},{label:"Custom Scope",value:"custom"}],l=["Tier 1"];exports.default=function(){var c=t.useState(!0),d=c[0],p=c[1],_=t.useState(""),m=_[0],g=_[1],f=t.useState(""),b=f[0],q=f[1],y=t.useState({station:"",tiers:["Tier 1"]}),h=y[0],v=y[1],T=t.useState([]),L=T[0],k=T[1],C=t.useState([]),S=C[0],j=C[1],w=t.useState(s),A=w[0],x=w[1],I=t.useCallback(function(r,t){v(function(n){var a;return e.__assign(e.__assign({},n),((a={})[r]=t,a))})},[]),M=t.useCallback(function(r,t){x(function(n){var a=e.__assign({},n);switch(r){case"order_rules":case"advertiser_rules":a[r]="boolean"==typeof t?e.__assign(e.__assign({},n[r]),{enabled:t}):{enabled:t.enabled,global_min_separation_seconds:t.global_min_separation_seconds};break;case"inventory_rules":a.inventory_rules={respect_inventory_code:"boolean"==typeof t?t:t.respect_inventory_code};break;case"break_code_rules":a.break_code_rules={respect_break_code:"boolean"==typeof t?t:t.respect_break_code};break;case"is_default_enabled":a.is_default_enabled="boolean"==typeof t?t:!!t}return a})},[]),O=function(r){r(function(r){return e.__spreadArray(e.__spreadArray([],r,!0),[{id:Date.now(),text:"",reasoning:""}],!1)})},G=function(e,r){e(function(e){return e.filter(function(e){return e.id!==r})})},J=function(r,t,n){r(function(r){return r.map(function(r){return String(r.id)===String(t)?e.__assign(e.__assign({},r),{text:n}):r})})},N=[e.__assign({key:"order_rules",label:"Order"},A.order_rules),e.__assign({key:"advertiser_rules",label:"Advertiser"},A.advertiser_rules)],W=[{key:"inventory_rules",label:"Inventory code",enabled:A.inventory_rules.respect_inventory_code},{key:"break_code_rules",label:"Break Code",enabled:A.break_code_rules.respect_break_code},{key:"is_default_enabled",label:"Default Variant",enabled:A.is_default_enabled}],D={"Add Guideline":"I would want to add a separation rule","Search Guideline":"I would want to set a max priority rule","Type your query":"I would want to add a break code matching rule"},R="<p><span>Hi! 👋 I'm your Instant Learning Concierge.</span>\n <span>How would you like to get started? You can select an option below or describe the Guideline you’d like to create.</span>\n ".concat(["Add Guideline","Search Guideline","Type your query"].map(function(e){return'<button class="clickable-button" data-value="'.concat(D[e],'">').concat(e,"</button>")}).join(""),"</p>");return r.jsx(i.default,{open:d,closeFunction:function(){return p(!1)},chatAssistantName:"defaultAssistant",organizationName:"techolution",baseUrl:"https://devllmstudio.creativeworkspace.ai",baseWebsocketUrl:"wss://devllmstudio.creativeworkspace.ai/graphql",ThinkingBulbIconComponent:r.jsx(n.Lightbulb,{}),customSections:r.jsx(r.Fragment,{}),isUseNormalChat:!0,chatTitle:"Create New Guideline",formTitle:"Guideline Details",initialChatMessage:R,template:a.TemplateList.BaseTemplate,templateProps:{state:{title:m,description:b,scopeData:h,whenToApplyConditions:L,whenNotToApplyConditions:S,configData:A,citations:[],citation:{}},handlers:{onTitleChange:function(e){var r,t;return g(null!==(t=null===(r=null==e?void 0:e.target)||void 0===r?void 0:r.value)&&void 0!==t?t:e)},onDescriptionChange:function(e){var r,t;return q(null!==(t=null===(r=null==e?void 0:e.target)||void 0===r?void 0:r.value)&&void 0!==t?t:e)},onAddWhenToApply:function(){return O(k)},onRemoveWhenToApply:function(e){return G(k,e)},onEditWhenToApply:function(e,r){return J(k,e,r)},onAddWhenNotToApply:function(){return O(j)},onRemoveWhenNotToApply:function(e){return G(j,e)},onEditWhenNotToApply:function(e,r){return J(j,e,r)},onScopeChange:I,onConfigChange:M},uiState:{showScope:!1,showConfiguration:!1,titleLabel:"Guideline Name",scopeLabel:"Define Scope",tierLabel:"Select Tier",descriptionLabel:"Guideline Description",whenToApplyLabel:"When to apply this Guideline (When to Apply)",whenNotToApplyLabel:"When not to apply this Guideline (When NOT to Apply)",configLabel:"Advanced Settings",stationOptions:u,tierOptions:l,separationItems:N,toggles:W},customNodes:{afterTitle:r.jsx(o.default,e.__assign({title:{type:"other",label:"Guideline"}},{children:r.jsx("p",e.__assign({style:{padding:"12px",fontSize:"14px",color:"#64748b"}},{children:"HealthCare"}))})),top:r.jsxs("div",e.__assign({style:{marginBottom:"12px",padding:"8px",backgroundColor:"#f0f4ff",borderRadius:"4px"}},{children:[r.jsx("strong",{children:"Guideline Template:"})," This is an ILOTJ TeachMe customized for Guideline Value Type"]}))}}})};
|
|
2
2
|
//# sourceMappingURL=GuidelinesTeachMeRenderer.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__rest as e,__assign as r,__awaiter as n,__generator as o}from"tslib";import{jsx as t,jsxs as i,Fragment as l}from"react/jsx-runtime";import{useState as a}from"react";import{extractTextFromChildren as s}from"../../helpers/utils.js";import{TickIcon as d}from"../_svg/TickIcon.js";import{autoGeneratePrompt as c}from"../ChatComponents/ChatComponent.js";import u from"../_svg/SparkleIcon.js";import{ArrowRight as p}from"lucide-react";var g=function(e){var n=e.content,o=function(e){var r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp("<".concat(r,">([\\s\\S]*?)<\\/").concat(r,">"),"i"),t=n.match(o);return t?t[1].trim():"*No ".concat(e," tag found.*")},l=o("reasoning_new"),a=o("proposed_rule"),s=o("wta_new"),d=o("wnta_new");return i("div",r({style:{padding:"16px 16px",maxWidth:"100%",border:"1px solid #A78BFA",borderRadius:"8px",backgroundColor:"#F6F4FF"}},{children:[t("div",r({style:{color:"#4B5563",fontSize:"1rem",lineHeight:"1.5rem",marginBottom:"1rem",fontFamily:"inherit",maxWidth:"90%"}},{children:l})),i("div",r({style:{border:"1px solid #ddd",borderRadius:"8px",padding:"16px",backgroundColor:"#FFFFFF",boxShadow:"0 4px 6px rgba(0, 0, 0, 0.05)"}},{children:[i("div",r({style:{paddingLeft:"12px",marginBottom:"12px",fontFamily:"inherit"}},{children:[t("div",r({style:{fontSize:"14px",fontWeight:"400",color:"#666F8D",fontFamily:"inherit"}},{children:"Proposed Rule"})),t("div",r({style:{fontSize:"0.95rem",color:"#374151",fontFamily:"inherit"}},{children:a}))]})),i("div",r({style:{marginBottom:"12px",paddingLeft:"12px",fontFamily:"inherit"}},{children:[t("div",r({style:{fontSize:"14px",fontWeight:"400",color:"#666F8D",fontFamily:"inherit"}},{children:"When to apply"})),t("div",r({style:{fontSize:"0.9rem",color:"#374151",fontFamily:"inherit"}},{children:s}))]})),i("div",r({style:{paddingLeft:"12px",fontFamily:"inherit"}},{children:[t("div",r({style:{fontSize:"14px",fontWeight:"400",color:"#666F8D",fontFamily:"inherit"}},{children:"When NOT to apply"})),t("div",r({style:{fontSize:"0.9rem",color:"#374151",fontFamily:"inherit"}},{children:d}))]}))]}))]}))},f=function(e){var n=e.label,o=e.onToggle,l=e.isSelected,a=e.disabled;return i("div",r({style:{display:"inline-flex",alignItems:"center",cursor:a?"not-allowed":"pointer",margin:"8px 24px 8px 0",userSelect:"none",fontFamily:"Plus Jakarta Sans, sans-serif",fontSize:"14px",color:a?"#9ca3af":"#000000de",verticalAlign:"middle",opacity:a&&!l?.6:1},onClick:function(){return!a&&o(n,!l)}},{children:[t("div",r({style:{width:"18px",height:"18px",borderRadius:"4px",border:l?"none":"2px solid ".concat(a?"#e5e7eb":"#cfd8dc"),backgroundColor:l?a?"#90caf9":"#2661eb":"transparent",display:"flex",alignItems:"center",justifyContent:"center",marginRight:"8px",transition:"all 0.2s ease",color:"white",flexShrink:0}},{children:l&&t("svg",r({width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:t("path",{d:"M10 3L4.5 8.5L2 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}))})),t("span",{children:n})]}))},b=function(g){var f,b=g.node,h=g.className,m=g.children,y=g.handleStream,x=g.onAction,v=g.disabled,C=g.isStreamEnd,k=void 0===C||C,w=g.style;g.isLastMessage;var T=g.onTypeResponseClick,F=e(g,["node","className","children","handleStream","onAction","disabled","isStreamEnd","style","isLastMessage","onTypeResponseClick"]),S=s(m),E=a(!1),z=E[0],L=E[1],R=a(!1),W=R[0],A=R[1],G=a(null),M=G[0],I=G[1],P=a(!1),B=P[0],D=P[1],j=a(""),N=j[0],J=j[1],_="typeYourAnswer"===((null===(f=null==b?void 0:b.properties)||void 0===f?void 0:f.id)||F.id)||"type your response"===S.toLowerCase().trim(),H=F["data-selected"],K="true"===H,U="true"===H||"false"===H,Y=F["data-value"],$=a(!1),O=$[0],q=$[1],Q=K||_&&O;if(!1===k&&!v&&!U&&!_)return null;var V={padding:"0.3rem 0.8rem",borderRadius:"4px",fontSize:"0.9rem",fontWeight:"500",fontFamily:"Plus Jakarta Sans, sans-serif",display:"flex",alignItems:"center",gap:"6px",cursor:"pointer",transition:"all 0.2s ease",border:"1px solid"},X={display:"inline-block",width:"12px",height:"12px",border:"2px solid currentColor",borderTopColor:"transparent",borderRadius:"50%",animation:"spin 0.6s linear infinite",flexShrink:0};if("clickable-button"===h){var Z=(null==F?void 0:F.isTesterGenie)&&(z||null!==M),ee=v||U&&!K||Z,re={background:(null==F?void 0:F.isTesterGenie)?"linear-gradient(135deg, #e0eaff, #ede9fe, #dbeafe, #e0eaff)":"#fff",color:(null==F?void 0:F.isTesterGenie)?"#6d28d9":"#272727ff",borderColor:(null==F?void 0:F.isTesterGenie)?"rgba(139, 92, 246, 0.35)":"#272727ff",cursor:"pointer",opacity:1};return U||_?re=Q?{background:"linear-gradient(to right, rgb(236, 253, 245), rgb(209, 250, 229))",color:"#047857",borderColor:"#55a78fff",cursor:_?"pointer":"default",opacity:1}:{background:"#f3f4f6",color:"#64676A",borderColor:"#a8a8a8ff",cursor:"default",opacity:.6}:(v||Z)&&(re={background:"#f3f4f6",color:"#64676A",borderColor:"#C0C0C2",cursor:"not-allowed",opacity:1}),i(l,{children:[t("style",{children:"\n @keyframes spin { to { transform: rotate(360deg); } }\n @keyframes tgShimmer {\n 0%, 100% { background-position: 0% 50%; }\n 50% { background-position: 100% 50%; }\n }\n "}),t("button",r({className:h,onClick:function(e){return n(void 0,void 0,void 0,function(){var r,n,t,i;return o(this,function(o){switch(o.label){case 0:return e.preventDefault(),_?(q(!0),T&&T(),[2]):ee?[2]:(r=Y||S,x?(x(r),[3,8]):[3,1]);case 1:if(!(null==F?void 0:F.isTesterGenie))return[3,7];o.label=2;case 2:return o.trys.push([2,4,5,6]),L(!0),[4,c(F.baseURL)];case 3:return n=o.sent(),I((null===(i=null==n?void 0:n.result)||void 0===i?void 0:i.Answer)||""),[3,6];case 4:return t=o.sent(),console.error("Error in TesterGenie click:",t),[3,6];case 5:return L(!1),[7];case 6:return[3,8];case 7:y(new KeyboardEvent("keydown",{key:"Enter"}),!1,r,L),o.label=8;case 8:return[2]}})})},disabled:ee,style:(null==F?void 0:F.isTesterGenie)?r(r({padding:"0.3rem 0.8rem",margin:"10px 8px 8px 0",background:re.background,backgroundSize:(null==F?void 0:F.isTesterGenie)?"250% 250%":void 0,animation:(null==F?void 0:F.isTesterGenie)&&!ee?"tgShimmer 6s ease infinite":void 0,color:re.color,border:"1.5px solid ".concat(re.borderColor),borderRadius:"6px",cursor:re.cursor,fontSize:"0.9rem",fontWeight:"500",transition:"color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease",fontFamily:"Plus Jakarta Sans, sans-serif",display:"flex",alignItems:"center",gap:"3px",pointerEvents:ee?"none":"auto",opacity:re.opacity,boxShadow:(null==F?void 0:F.isTesterGenie)?"0 1px 4px rgba(124, 58, 237, 0.1)":"none"},w),{marginLeft:"8px"}):r({display:"flex",alignItems:"center",padding:"5px 8px",background:Q?"linear-gradient(to right, #EFF4FF)":"transparent",border:"1px solid ".concat(Q?"#B2CCFF":"transparent"),borderRadius:"6px",cursor:ee?"not-allowed":"pointer",textAlign:"left",fontFamily:"Plus Jakarta Sans, sans-serif",opacity:ee?.6:1},w),onMouseEnter:function(e){ee||(null==F?void 0:F.isTesterGenie)||Q||(e.currentTarget.style.background="linear-gradient(to right, #EFF4FF)",e.currentTarget.style.borderColor="#B2CCFF")},onMouseLeave:function(e){ee||(null==F?void 0:F.isTesterGenie)||Q||(e.currentTarget.style.background="transparent",e.currentTarget.style.borderColor="transparent")}},F,{children:z&&(null==F?void 0:F.isTesterGenie)&&null===M?i("span",r({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[t("span",{style:X}),"Finding an interesting usecase to test..."]})):t(l,{children:(null==F?void 0:F.isTesterGenie)?m:i("div",r({style:{display:"flex",alignItems:"center",width:"100%"}},{children:[t("div",r({style:{width:"28px",height:"28px",borderRadius:"50%",border:Q?"1px solid #D0D5DD":"1px solid #B2CCFF",display:"flex",alignItems:"center",justifyContent:"center",marginRight:"12px",backgroundColor:Q?"#D1E0FF":"#fff",flexShrink:0}},{children:t(p,{color:Q?"#004EEB":"#667085",size:20})})),t("span",r({style:{fontSize:"14px",color:"#344054",fontFamily:"Inter",fontWeight:"500"}},{children:m}))]}))})})),(null==F?void 0:F.isTesterGenie)&&null!==M&&i("div",r({style:{marginTop:"6px",borderRadius:"8px",border:"1px solid #e5e7eb",background:"#f9fafb",padding:"14px 16px",maxWidth:"520px",fontFamily:"Plus Jakarta Sans, sans-serif"},onWheel:function(e){return e.stopPropagation()}},{children:[i("p",r({style:{margin:"0 0 4px 0",fontSize:"1rem",color:"#111827"}},{children:[t("span",r({style:{height:"1.2em",width:"1.2em",marginRight:"4px"}},{children:t(u,{})})),"Your prompt is ready!"]})),t("p",r({style:{margin:"14px 0 14px 0",fontSize:"0.95rem",fontWeight:"600",color:"#111827",whiteSpace:"pre-wrap"}},{children:M})),t("p",r({style:{margin:"0 0 4px 0",fontSize:"1rem",color:"#111827",lineHeight:"1.55"}},{children:"Would you like to proceed with this prompt, or generate a new one?"})),i("div",r({style:{display:"flex",gap:"6px",flexWrap:"wrap"}},{children:[i("button",r({disabled:W||z,style:r(r({},V),{background:"linear-gradient(to right, rgb(237, 233, 254), rgb(221, 214, 254))",color:"#5b21b6",borderColor:"#7c3aed",opacity:W||z?.6:1,cursor:W||z?"not-allowed":"pointer"}),onMouseEnter:function(e){W||z||(e.currentTarget.style.background="linear-gradient(to right, rgb(221, 214, 254), rgb(196, 181, 253))")},onMouseLeave:function(e){W||z||(e.currentTarget.style.background="linear-gradient(to right, rgb(237, 233, 254), rgb(221, 214, 254))")},onClick:function(){y(new KeyboardEvent("keydown",{key:"Enter"}),!1,M,L),I(null),D(!1),J("")}},{children:[t(d,{color:"#5b21b6"})," Proceed"]})),t("button",r({disabled:W||z,style:r(r({},V),{background:W?"#f3f4f6":"#fff",color:W?"#64676A":"#272727",borderColor:W?"#C0C0C2":"#272727",cursor:W||z?"not-allowed":"pointer",opacity:W||z?.7:1}),onMouseEnter:function(e){W||z||(e.currentTarget.style.background="linear-gradient(to right, rgb(237, 233, 254), rgb(221, 214, 254))",e.currentTarget.style.borderColor="#7c3aed",e.currentTarget.style.color="#5b21b6")},onMouseLeave:function(e){W||z||(e.currentTarget.style.background="#fff",e.currentTarget.style.borderColor="#272727",e.currentTarget.style.color="#272727")},onClick:function(){return n(void 0,void 0,void 0,function(){var e,r,n;return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,3,4]),A(!0),[4,c(F.baseUrl,N||void 0)];case 1:return e=o.sent(),I((null===(n=null==e?void 0:e.result)||void 0===n?void 0:n.Answer)||""),[3,4];case 2:return r=o.sent(),console.error("Error regenerating prompt:",r),[3,4];case 3:return A(!1),[7];case 4:return[2]}})})}},{children:i(l,W?{children:[t("span",{style:X})," Regenerating..."]}:{children:[i("svg",r({width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0}},{children:[t("path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),t("path",{d:"M3 3v5h5"})]})),"Regenerate"]})})),t("button",r({disabled:W||z,style:r(r({},V),{background:"#fff",color:B?"#5b21b6":"#64676A",borderColor:B?"#7c3aed":"#C0C0C2",cursor:W||z?"not-allowed":"pointer",opacity:W||z?.6:1}),onMouseEnter:function(e){W||z||(e.currentTarget.style.borderColor="#7c3aed",e.currentTarget.style.color="#5b21b6")},onMouseLeave:function(e){W||z||B||(e.currentTarget.style.borderColor="#C0C0C2",e.currentTarget.style.color="#64676A")},onClick:function(){return D(function(e){return!e})}},{children:B?"✕ Hide Inputs":" Give Inputs"}))]})),B&&i("div",r({style:{marginTop:"12px",paddingTop:"12px",borderTop:"1px solid #e5e7eb"}},{children:[t("p",r({style:{margin:"0 0 6px 0",fontSize:"1rem",color:"#6b7280"}},{children:"Help us generate better prompt (optional)"})),t("textarea",{placeholder:"e.g. Provide usecases for seperation rules",value:N,onChange:function(e){return J(e.target.value)},rows:3,onKeyDown:function(e){e.stopPropagation()},onWheel:function(e){e.stopPropagation()},style:{width:"100%",minWidth:"420px",maxWidth:"100%",padding:"10px 12px",borderRadius:"6px",border:"1px solid #d1d5db",fontSize:"0.9rem",fontFamily:"Plus Jakarta Sans, sans-serif",color:"#111827",background:"#fff",resize:"vertical",outline:"none",boxSizing:"border-box",lineHeight:"1.5",transition:"border-color 0.2s ease"},onFocus:function(e){e.currentTarget.style.borderColor="#7c3aed"},onBlur:function(e){e.currentTarget.style.borderColor="#d1d5db"}}),i("div",r({style:{display:"flex",gap:"8px",marginTop:"8px"}},{children:[t("button",r({disabled:z||!N.trim(),style:r(r({},V),{background:z||!N.trim()?"#f3f4f6":"linear-gradient(to right, rgb(237, 233, 254), rgb(221, 214, 254))",color:z||!N.trim()?"#64676A":"#5b21b6",borderColor:z||!N.trim()?"#C0C0C2":"#7c3aed",cursor:z||!N.trim()?"not-allowed":"pointer",opacity:z||!N.trim()?.7:1}),onMouseEnter:function(e){!z&&N.trim()&&(e.currentTarget.style.background="linear-gradient(to right, rgb(221, 214, 254), rgb(196, 181, 253))")},onMouseLeave:function(e){!z&&N.trim()&&(e.currentTarget.style.background="linear-gradient(to right, rgb(237, 233, 254), rgb(221, 214, 254))")},onClick:function(){return n(void 0,void 0,void 0,function(){var e,r,n;return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,3,4]),L(!0),[4,c(F.baseUrl,N)];case 1:return e=o.sent(),I((null===(n=null==e?void 0:e.result)||void 0===n?void 0:n.Answer)||""),D(!1),[3,4];case 2:return r=o.sent(),console.error("Error generating with direction:",r),[3,4];case 3:return L(!1),[7];case 4:return[2]}})})}},{children:z?i(l,{children:[t("span",{style:X})," Generating..."]}):t(l,{children:"✦ Generate"})})),t("button",r({disabled:z,style:r(r({},V),{background:"#fff",color:"#64676A",borderColor:"#C0C0C2",cursor:z?"not-allowed":"pointer",opacity:z?.5:1}),onMouseEnter:function(e){z||(e.currentTarget.style.borderColor="#272727",e.currentTarget.style.color="#272727")},onMouseLeave:function(e){z||(e.currentTarget.style.borderColor="#C0C0C2",e.currentTarget.style.color="#64676A")},onClick:function(){return J("")}},{children:"Clear"}))]}))]}))]}))]})}return t("button",r({className:h},F,{children:m}))},h=function(n){n.node;var o=n.className,l=n.children,a=n.selectedItems,d=n.onToggle,c=n.isSubmitted,u=n.disabled;e(n,["node","className","children","selectedItems","onToggle","isSubmitted","disabled"]);var p=s(l),g=p.trim();return"clickable-box"===o?c?a.includes(g)?i("div",r({style:{display:"inline-flex",alignItems:"center",margin:"4px 24px 4px 0",color:"#2661eb",fontWeight:600,fontFamily:"Plus Jakarta Sans, sans-serif"}},{children:[t("span",r({style:{marginRight:"6px",fontSize:"16px"}},{children:"✓"}))," ",p]})):null:t(f,{label:p,isSelected:a.includes(g),onToggle:d,disabled:u}):t("span",r({className:o},{children:l}))};export{b as ActionableButton,h as ActionableCheckbox,f as CheckboxSelector,g as RuleDisplay};
|
|
1
|
+
import{__rest as e,__assign as r,__awaiter as n,__generator as o}from"tslib";import{jsx as t,jsxs as i,Fragment as l}from"react/jsx-runtime";import{useState as a}from"react";import{extractTextFromChildren as s}from"../../helpers/utils.js";import{TickIcon as d}from"../_svg/TickIcon.js";import{autoGeneratePrompt as c}from"../ChatComponents/ChatComponent.js";import u from"../_svg/SparkleIcon.js";import{ArrowRight as p}from"lucide-react";var g=function(e){var n=e.content,o=function(e){var r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp("<".concat(r,">([\\s\\S]*?)<\\/").concat(r,">"),"i"),t=n.match(o);return t?t[1].trim():"*No ".concat(e," tag found.*")},l=o("reasoning_new"),a=o("proposed_rule"),s=o("wta_new"),d=o("wnta_new");return i("div",r({style:{padding:"16px 16px",maxWidth:"100%",border:"1px solid #A78BFA",borderRadius:"8px",backgroundColor:"#F6F4FF"}},{children:[t("div",r({style:{color:"#4B5563",fontSize:"1rem",lineHeight:"1.5rem",marginBottom:"1rem",fontFamily:"inherit",maxWidth:"90%"}},{children:l})),i("div",r({style:{border:"1px solid #ddd",borderRadius:"8px",padding:"16px",backgroundColor:"#FFFFFF",boxShadow:"0 4px 6px rgba(0, 0, 0, 0.05)"}},{children:[i("div",r({style:{paddingLeft:"12px",marginBottom:"12px",fontFamily:"inherit"}},{children:[t("div",r({style:{fontSize:"14px",fontWeight:"400",color:"#666F8D",fontFamily:"inherit"}},{children:"Proposed Rule"})),t("div",r({style:{fontSize:"0.95rem",color:"#374151",fontFamily:"inherit"}},{children:a}))]})),i("div",r({style:{marginBottom:"12px",paddingLeft:"12px",fontFamily:"inherit"}},{children:[t("div",r({style:{fontSize:"14px",fontWeight:"400",color:"#666F8D",fontFamily:"inherit"}},{children:"When to apply"})),t("div",r({style:{fontSize:"0.9rem",color:"#374151",fontFamily:"inherit"}},{children:s}))]})),i("div",r({style:{paddingLeft:"12px",fontFamily:"inherit"}},{children:[t("div",r({style:{fontSize:"14px",fontWeight:"400",color:"#666F8D",fontFamily:"inherit"}},{children:"When NOT to apply"})),t("div",r({style:{fontSize:"0.9rem",color:"#374151",fontFamily:"inherit"}},{children:d}))]}))]}))]}))},f=function(e){var n=e.label,o=e.onToggle,l=e.isSelected,a=e.disabled;return i("div",r({style:{display:"inline-flex",alignItems:"center",cursor:a?"not-allowed":"pointer",margin:"8px 24px 8px 0",userSelect:"none",fontFamily:"Plus Jakarta Sans, sans-serif",fontSize:"14px",color:a?"#9ca3af":"#000000de",verticalAlign:"middle",opacity:a&&!l?.6:1},onClick:function(){return!a&&o(n,!l)}},{children:[t("div",r({style:{width:"18px",height:"18px",borderRadius:"4px",border:l?"none":"2px solid ".concat(a?"#e5e7eb":"#cfd8dc"),backgroundColor:l?a?"#90caf9":"#2661eb":"transparent",display:"flex",alignItems:"center",justifyContent:"center",marginRight:"8px",transition:"all 0.2s ease",color:"white",flexShrink:0}},{children:l&&t("svg",r({width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:t("path",{d:"M10 3L4.5 8.5L2 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}))})),t("span",{children:n})]}))},b=function(g){var f,b=g.node,h=g.className,m=g.children,y=g.handleStream,x=g.onAction,v=g.disabled,C=g.isStreamEnd,k=void 0===C||C,w=g.style;g.isLastMessage;var T=g.onTypeResponseClick,F=e(g,["node","className","children","handleStream","onAction","disabled","isStreamEnd","style","isLastMessage","onTypeResponseClick"]),S=s(m),E=a(!1),z=E[0],L=E[1],R=a(!1),W=R[0],A=R[1],G=a(null),M=G[0],I=G[1],P=a(!1),B=P[0],D=P[1],j=a(""),N=j[0],J=j[1],_="typeYourAnswer"===((null===(f=null==b?void 0:b.properties)||void 0===f?void 0:f.id)||F.id)||"type your response"===S.toLowerCase().trim(),H=F["data-selected"],K="true"===H,U="true"===H||"false"===H,Y=F["data-value"],$=a(!1),O=$[0],q=$[1],Q=K||_&&O;if(!1===k&&!v&&!U&&!_)return null;var V={padding:"0.3rem 0.8rem",borderRadius:"4px",fontSize:"0.9rem",fontWeight:"500",fontFamily:"Plus Jakarta Sans, sans-serif",display:"flex",alignItems:"center",gap:"6px",cursor:"pointer",transition:"all 0.2s ease",border:"1px solid"},X={display:"inline-block",width:"12px",height:"12px",border:"2px solid currentColor",borderTopColor:"transparent",borderRadius:"50%",animation:"spin 0.6s linear infinite",flexShrink:0};if("clickable-button"===h){var Z=(null==F?void 0:F.isTesterGenie)&&(z||null!==M),ee=v||U&&!K||Z,re={background:(null==F?void 0:F.isTesterGenie)?"linear-gradient(135deg, #e0eaff, #ede9fe, #dbeafe, #e0eaff)":"#fff",color:(null==F?void 0:F.isTesterGenie)?"#6d28d9":"#272727ff",borderColor:(null==F?void 0:F.isTesterGenie)?"rgba(139, 92, 246, 0.35)":"#272727ff",cursor:"pointer",opacity:1};return U||_?re=Q?{background:"linear-gradient(to right, rgb(236, 253, 245), rgb(209, 250, 229))",color:"#047857",borderColor:"#55a78fff",cursor:_?"pointer":"default",opacity:1}:{background:"#f3f4f6",color:"#64676A",borderColor:"#a8a8a8ff",cursor:"default",opacity:.6}:(v||Z)&&(re={background:"#f3f4f6",color:"#64676A",borderColor:"#C0C0C2",cursor:"not-allowed",opacity:1}),i(l,{children:[t("style",{children:"\n @keyframes spin { to { transform: rotate(360deg); } }\n @keyframes tgShimmer {\n 0%, 100% { background-position: 0% 50%; }\n 50% { background-position: 100% 50%; }\n }\n "}),t("button",r({className:h,onClick:function(e){return n(void 0,void 0,void 0,function(){var r,n,t,i;return o(this,function(o){switch(o.label){case 0:return e.preventDefault(),_?(q(!0),T&&T(),[2]):ee?[2]:(r=Y||S,x?(x(r),[3,8]):[3,1]);case 1:if(!(null==F?void 0:F.isTesterGenie))return[3,7];o.label=2;case 2:return o.trys.push([2,4,5,6]),L(!0),[4,c(F.baseURL)];case 3:return n=o.sent(),I((null===(i=null==n?void 0:n.result)||void 0===i?void 0:i.Answer)||""),[3,6];case 4:return t=o.sent(),console.error("Error in TesterGenie click:",t),[3,6];case 5:return L(!1),[7];case 6:return[3,8];case 7:y(new KeyboardEvent("keydown",{key:"Enter"}),!1,r,L),o.label=8;case 8:return[2]}})})},disabled:ee,style:(null==F?void 0:F.isTesterGenie)?r(r({padding:"0.3rem 0.8rem",margin:"10px 8px 8px 0",background:re.background,backgroundSize:(null==F?void 0:F.isTesterGenie)?"250% 250%":void 0,animation:(null==F?void 0:F.isTesterGenie)&&!ee?"tgShimmer 6s ease infinite":void 0,color:re.color,border:"1.5px solid ".concat(re.borderColor),borderRadius:"6px",cursor:re.cursor,fontSize:"0.9rem",fontWeight:"500",transition:"color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease",fontFamily:"Plus Jakarta Sans, sans-serif",display:"flex",alignItems:"center",gap:"3px",pointerEvents:ee?"none":"auto",opacity:re.opacity,boxShadow:(null==F?void 0:F.isTesterGenie)?"0 1px 4px rgba(124, 58, 237, 0.1)":"none"},w),{marginLeft:"8px",width:"fit-content"}):r({display:"flex",alignItems:"center",padding:"5px 8px",background:Q?"linear-gradient(to right, #EFF4FF)":"transparent",border:"1px solid ".concat(Q?"#B2CCFF":"transparent"),borderRadius:"6px",cursor:ee?"not-allowed":"pointer",textAlign:"left",fontFamily:"Plus Jakarta Sans, sans-serif",opacity:ee?.6:1},w),onMouseEnter:function(e){ee||(null==F?void 0:F.isTesterGenie)||Q||(e.currentTarget.style.background="linear-gradient(to right, #EFF4FF)",e.currentTarget.style.borderColor="#B2CCFF")},onMouseLeave:function(e){ee||(null==F?void 0:F.isTesterGenie)||Q||(e.currentTarget.style.background="transparent",e.currentTarget.style.borderColor="transparent")}},F,{children:z&&(null==F?void 0:F.isTesterGenie)&&null===M?i("span",r({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[t("span",{style:X}),"Finding an interesting usecase to test..."]})):t(l,{children:(null==F?void 0:F.isTesterGenie)?m:i("div",r({style:{display:"flex",alignItems:"center",width:"100%"}},{children:[t("div",r({style:{width:"28px",height:"28px",borderRadius:"50%",border:Q?"1px solid #D0D5DD":"1px solid #B2CCFF",display:"flex",alignItems:"center",justifyContent:"center",marginRight:"12px",backgroundColor:Q?"#D1E0FF":"#fff",flexShrink:0}},{children:t(p,{color:Q?"#004EEB":"#667085",size:20})})),t("span",r({style:{fontSize:"14px",color:"#344054",fontFamily:"Inter",fontWeight:"500"}},{children:m}))]}))})})),(null==F?void 0:F.isTesterGenie)&&null!==M&&i("div",r({style:{marginTop:"6px",borderRadius:"8px",border:"1px solid #e5e7eb",background:"#f9fafb",padding:"14px 16px",maxWidth:"520px",fontFamily:"Plus Jakarta Sans, sans-serif"},onWheel:function(e){return e.stopPropagation()}},{children:[i("p",r({style:{margin:"0 0 4px 0",fontSize:"1rem",color:"#111827"}},{children:[t("span",r({style:{height:"1.2em",width:"1.2em",marginRight:"4px"}},{children:t(u,{})})),"Your prompt is ready!"]})),t("p",r({style:{margin:"14px 0 14px 0",fontSize:"0.95rem",fontWeight:"600",color:"#111827",whiteSpace:"pre-wrap"}},{children:M})),t("p",r({style:{margin:"0 0 4px 0",fontSize:"1rem",color:"#111827",lineHeight:"1.55"}},{children:"Would you like to proceed with this prompt, or generate a new one?"})),i("div",r({style:{display:"flex",gap:"6px",flexWrap:"wrap"}},{children:[i("button",r({disabled:W||z,style:r(r({},V),{background:"linear-gradient(to right, rgb(237, 233, 254), rgb(221, 214, 254))",color:"#5b21b6",borderColor:"#7c3aed",opacity:W||z?.6:1,cursor:W||z?"not-allowed":"pointer"}),onMouseEnter:function(e){W||z||(e.currentTarget.style.background="linear-gradient(to right, rgb(221, 214, 254), rgb(196, 181, 253))")},onMouseLeave:function(e){W||z||(e.currentTarget.style.background="linear-gradient(to right, rgb(237, 233, 254), rgb(221, 214, 254))")},onClick:function(){y(new KeyboardEvent("keydown",{key:"Enter"}),!1,M,L),I(null),D(!1),J("")}},{children:[t(d,{color:"#5b21b6"})," Proceed"]})),t("button",r({disabled:W||z,style:r(r({},V),{background:W?"#f3f4f6":"#fff",color:W?"#64676A":"#272727",borderColor:W?"#C0C0C2":"#272727",cursor:W||z?"not-allowed":"pointer",opacity:W||z?.7:1}),onMouseEnter:function(e){W||z||(e.currentTarget.style.background="linear-gradient(to right, rgb(237, 233, 254), rgb(221, 214, 254))",e.currentTarget.style.borderColor="#7c3aed",e.currentTarget.style.color="#5b21b6")},onMouseLeave:function(e){W||z||(e.currentTarget.style.background="#fff",e.currentTarget.style.borderColor="#272727",e.currentTarget.style.color="#272727")},onClick:function(){return n(void 0,void 0,void 0,function(){var e,r,n;return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,3,4]),A(!0),[4,c(F.baseUrl,N||void 0)];case 1:return e=o.sent(),I((null===(n=null==e?void 0:e.result)||void 0===n?void 0:n.Answer)||""),[3,4];case 2:return r=o.sent(),console.error("Error regenerating prompt:",r),[3,4];case 3:return A(!1),[7];case 4:return[2]}})})}},{children:i(l,W?{children:[t("span",{style:X})," Regenerating..."]}:{children:[i("svg",r({width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0}},{children:[t("path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),t("path",{d:"M3 3v5h5"})]})),"Regenerate"]})})),t("button",r({disabled:W||z,style:r(r({},V),{background:"#fff",color:B?"#5b21b6":"#64676A",borderColor:B?"#7c3aed":"#C0C0C2",cursor:W||z?"not-allowed":"pointer",opacity:W||z?.6:1}),onMouseEnter:function(e){W||z||(e.currentTarget.style.borderColor="#7c3aed",e.currentTarget.style.color="#5b21b6")},onMouseLeave:function(e){W||z||B||(e.currentTarget.style.borderColor="#C0C0C2",e.currentTarget.style.color="#64676A")},onClick:function(){return D(function(e){return!e})}},{children:B?"✕ Hide Inputs":" Give Inputs"}))]})),B&&i("div",r({style:{marginTop:"12px",paddingTop:"12px",borderTop:"1px solid #e5e7eb"}},{children:[t("p",r({style:{margin:"0 0 6px 0",fontSize:"1rem",color:"#6b7280"}},{children:"Help us generate better prompt (optional)"})),t("textarea",{placeholder:"e.g. Provide usecases for seperation rules",value:N,onChange:function(e){return J(e.target.value)},rows:3,onKeyDown:function(e){e.stopPropagation()},onWheel:function(e){e.stopPropagation()},style:{width:"100%",minWidth:"420px",maxWidth:"100%",padding:"10px 12px",borderRadius:"6px",border:"1px solid #d1d5db",fontSize:"0.9rem",fontFamily:"Plus Jakarta Sans, sans-serif",color:"#111827",background:"#fff",resize:"vertical",outline:"none",boxSizing:"border-box",lineHeight:"1.5",transition:"border-color 0.2s ease"},onFocus:function(e){e.currentTarget.style.borderColor="#7c3aed"},onBlur:function(e){e.currentTarget.style.borderColor="#d1d5db"}}),i("div",r({style:{display:"flex",gap:"8px",marginTop:"8px"}},{children:[t("button",r({disabled:z||!N.trim(),style:r(r({},V),{background:z||!N.trim()?"#f3f4f6":"linear-gradient(to right, rgb(237, 233, 254), rgb(221, 214, 254))",color:z||!N.trim()?"#64676A":"#5b21b6",borderColor:z||!N.trim()?"#C0C0C2":"#7c3aed",cursor:z||!N.trim()?"not-allowed":"pointer",opacity:z||!N.trim()?.7:1}),onMouseEnter:function(e){!z&&N.trim()&&(e.currentTarget.style.background="linear-gradient(to right, rgb(221, 214, 254), rgb(196, 181, 253))")},onMouseLeave:function(e){!z&&N.trim()&&(e.currentTarget.style.background="linear-gradient(to right, rgb(237, 233, 254), rgb(221, 214, 254))")},onClick:function(){return n(void 0,void 0,void 0,function(){var e,r,n;return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,3,4]),L(!0),[4,c(F.baseUrl,N)];case 1:return e=o.sent(),I((null===(n=null==e?void 0:e.result)||void 0===n?void 0:n.Answer)||""),D(!1),[3,4];case 2:return r=o.sent(),console.error("Error generating with direction:",r),[3,4];case 3:return L(!1),[7];case 4:return[2]}})})}},{children:z?i(l,{children:[t("span",{style:X})," Generating..."]}):t(l,{children:"✦ Generate"})})),t("button",r({disabled:z,style:r(r({},V),{background:"#fff",color:"#64676A",borderColor:"#C0C0C2",cursor:z?"not-allowed":"pointer",opacity:z?.5:1}),onMouseEnter:function(e){z||(e.currentTarget.style.borderColor="#272727",e.currentTarget.style.color="#272727")},onMouseLeave:function(e){z||(e.currentTarget.style.borderColor="#C0C0C2",e.currentTarget.style.color="#64676A")},onClick:function(){return J("")}},{children:"Clear"}))]}))]}))]}))]})}return t("button",r({className:h},F,{children:m}))},h=function(n){n.node;var o=n.className,l=n.children,a=n.selectedItems,d=n.onToggle,c=n.isSubmitted,u=n.disabled;e(n,["node","className","children","selectedItems","onToggle","isSubmitted","disabled"]);var p=s(l),g=p.trim();return"clickable-box"===o?c?a.includes(g)?i("div",r({style:{display:"inline-flex",alignItems:"center",margin:"4px 24px 4px 0",color:"#2661eb",fontWeight:600,fontFamily:"Plus Jakarta Sans, sans-serif"}},{children:[t("span",r({style:{marginRight:"6px",fontSize:"16px"}},{children:"✓"}))," ",p]})):null:t(f,{label:p,isSelected:a.includes(g),onToggle:d,disabled:u}):t("span",r({className:o},{children:l}))};export{b as ActionableButton,h as ActionableCheckbox,f as CheckboxSelector,g as RuleDisplay};
|
|
2
2
|
//# sourceMappingURL=ClickableChatComponents.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e}from"tslib";import{jsxs as t,jsx as o}from"react/jsx-runtime";import{useMemo as i,useEffect as n}from"react";import{AuditLog as r}from"@e-llm-studio/audit-log";import"@e-llm-studio/audit-log/dist/styles.css";import{User as l,ExternalLink as a}from"lucide-react";import d from"./ChangeLogDiff.js";var
|
|
1
|
+
import{__assign as e}from"tslib";import{jsxs as t,jsx as o}from"react/jsx-runtime";import{useMemo as i,useEffect as n}from"react";import{AuditLog as r}from"@e-llm-studio/audit-log";import"@e-llm-studio/audit-log/dist/styles.css";import{User as l,ExternalLink as a}from"lucide-react";import d from"./ChangeLogDiff.js";import{dt as c}from"../store/useLMSConfigStore.js";var s=function(s){var h=s.configId,p=s.ruleData,g=s.scopeId,m=s.scopeName,u=(null==m?void 0:m.trim())||"Selected",f=i(function(){var e=[];return g&&e.push(g),e},[p,g]);return n(function(){console.log("Flattened External Resource IDs:",f)},[f]),t("div",e({style:{padding:"24px",fontFamily:"Arial, sans-serif"}},{children:[t("div",e({style:{marginBottom:"16px",paddingBottom:"4px"}},{children:[o("h1",e({style:{margin:0,color:"#334155",fontSize:"20px",fontWeight:700,lineHeight:1.25}},{children:c("history.title","".concat(u," - Audit Log"),{scope_name:u})})),o("p",e({style:{margin:"8px 0 0",color:"#667085",fontSize:"16px",fontWeight:500,lineHeight:1}},{children:c("history.subtitle","Track all learning updates and modifications with the ".concat(u," scope."),{scope_name:u})}))]})),o(r,{configId:h,getData:{baseUrl:"https://dev.appmod.ai",endpoint:"/changelog/audit-log/fetch"},distinctValuesApi:{baseUrl:"https://dev.appmod.ai",endpoint:"/changelog/audit-log/distinct-values"},query:{externalResourceId:f.length>0?f:[""],paginationLimit:10},sidebar:{config:{showAnalystFilter:!0,showDateFilter:!0,showChangeTitleFilter:!0,showImpactPercentage:!1},labels:{title:"Filters",multiSelectLabel:"Modified By",multiSelectHint:"Filter by the user who made the change",changeTitleLabel:"Change Action",changeTitleHint:"Filter by Actions"}},table:{tableProps:{scrollable:!0,scrollHeight:"80vh",showGridlines:!0,size:"small",rowClassName:function(){return"custom-compact-row"},pt:{bodyCell:{style:{paddingTop:"4px",paddingBottom:"4px"}}}},hiddenColumns:["actions","changeSummary","changeDateTime","logId"],extraColumns:[{key:"modifiedBy",header:"Modified By",body:function(i){return t("div",e({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[o(l,{size:16,color:"#64748b",style:{flexShrink:0}}),o("span",e({style:{fontWeight:500}},{children:i.modifiedBy}))]}))},style:{width:"15%",minWidth:"140px"}},{key:"changeAction",header:"Action",body:function(t){var i,n,r=(i=t.changeTitle,(n=(i||"").toUpperCase()).includes("CREATE")?{color:"#2e7d32",backgroundColor:"#edf7ed",borderColor:"#c8e6c9",boxShadow:"0 1px 2px rgba(46, 125, 50, 0.08)"}:n.includes("UPDATE")||n.includes("TOGGLE")?{color:"#1565c0",backgroundColor:"#e3f2fd",borderColor:"#bbdefb",boxShadow:"0 1px 2px rgba(21, 101, 192, 0.08)"}:n.includes("DELETE")?{color:"#c62828",backgroundColor:"#fdeeed",borderColor:"#ffcdd2",boxShadow:"0 1px 2px rgba(198, 40, 40, 0.08)"}:{color:"#475569",backgroundColor:"#f8fafc",borderColor:"#cbd5e1",boxShadow:"0 1px 2px rgba(15, 23, 42, 0.06)"}),l=t.changeTitle?t.changeTitle.replace(/_/g," "):"—";return o("span",e({style:{color:r.color,backgroundColor:r.backgroundColor,border:"1px solid ".concat(r.borderColor),boxShadow:r.boxShadow,padding:"6px 12px",borderRadius:"999px",fontSize:"12px",lineHeight:1,fontWeight:600,display:"inline-block",minWidth:"76px",textAlign:"center",textTransform:"capitalize"}},{children:l}))},style:{width:"15%",textAlign:"center"}},{key:"customChangeSummary",header:"Change Summary",body:function(e){var t;return o(d,{change:null!==(t=e.actionText)&&void 0!==t?t:"-"})},style:{width:"30%",minWidth:"200px"}},{key:"redirectLink",header:"Link",body:function(i){var n,r=(null===(n=i.metadata)||void 0===n?void 0:n.redirect_url)||i.redirect_url;return r?o("div",e({style:{display:"flex",justifyContent:"center",alignItems:"center"}},{children:t("a",e({href:r,target:"_blank",rel:"noopener noreferrer",style:{display:"flex",alignItems:"center",gap:"6px",color:"#2563eb",textDecoration:"none",fontWeight:500,fontSize:"13px"}},{children:["View ",o(a,{size:14})]}))})):o("span",e({style:{color:"#94a3b8",display:"flex",justifyContent:"center"}},{children:"—"}))},style:{width:"10%",minWidth:"90px",textAlign:"center"}},{key:"customChangeDateTime",header:"Change Time and Date",body:function(i){if(!i.actionDate)return o("span",e({style:{color:"#94a3b8"}},{children:"—"}));var n=new Date(i.actionDate),r=n.toLocaleDateString("en-US",{month:"short",day:"2-digit",year:"numeric"}),l=n.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"});return t("div",e({style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"4px",fontSize:"13px",color:"#475569"}},{children:[o("span",e({style:{fontWeight:500}},{children:r})),o("span",{children:l})]}))},style:{width:"15%",minWidth:"150px",textAlign:"center"}}]},filters:{config:{showFilterButton:!0,showSort:!0,showDate:!0,showSearch:!0,sortOptions:{latest:!0,oldest:!0,impactHighToLow:!1,impactLowToHigh:!1}}}})]}))};export{s as default};
|
|
2
2
|
//# sourceMappingURL=AuditLog.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e,__spreadArray as n,__awaiter as t,__generator as r}from"tslib";import{jsx as o,jsxs as s,Fragment as i}from"react/jsx-runtime";import{useState as a,useRef as l,useEffect as c}from"react";import{BookOpen as u,Users as d,History as p}from"lucide-react";import{useLearningTemplateStore as m}from"./store/useLearningTemplateStore.js";import{Toast as f}from"primereact/toast";import g from"./styles/LearningTemplateManagement.module.css.js";import v from"./LearningTemplateLayout.js";import h from"./components/EmptyLearningState.js";import S from"./store/useAuthStore.js";import{fetchTiers as y,fetchScopes as b,inheritScope as C,inheritScopeBackwardCompatible as T,createRuleSet as w,renameScope as E,deleteRuleSet as L,requestAccess as I}from"./apis/scopeApis.js";import{QUERY_PARAM_KEYS as D,setQueryParams as A}from"./hooks/useLearningTemplateQueryParams.js";import O from"./components/ConfirmationModal.js";import R from"./components/LearningTemplateManagementSkeleton.js";import{findNodePathById as j}from"./utils/treeUtils.js";import N from"./store/useEnvStore.js";import{useConfigStore as k}from"./store/useConfigStore.js";import{TooltipProvider as M}from"./components/ToolTip.js";import _ from"./components/CreateRuleSetLegacyModal.js";import{usePermissionsStore as P}from"./store/usePermissionsStore.js";import{useAppSecRolesStore as U}from"./store/useAppSecRolesStore.js";import{useGetAppSecRolesQuery as G}from"./queries/useApprovalQueries.js";import{useLMSConfigQuery as B}from"./queries/useLMSConfigQuery.js";import F from"./RuleContent/AddScopeModal.js";import q from"./components/RuleContentSkeleton.js";import x from"./components/ErrorStateDisplay.js";import{useLocation as H}from"react-router-dom";import Q from"./shared/SuccessToastContent.js";import z from"./shared/ErrorToastContent.js";import K from"./RuleContent/RenameScopeModal.js";import{dt as V}from"./store/useLMSConfigStore.js";function W(W){var Y,J,X,Z=this,$=W.userDetails,ee=W.llmStudioUrl,ne=W.audacyBackendUrl,te=W.ilLabels,re=W.config,oe=W.rbacConfig,se=W.auditLogConfig,ie=W.app_integration_id,ae=W.backwardCompatibility,le=void 0!==ae&&ae,ce=m(function(e){return e.selectedRuleSetId}),ue=m(function(e){return e.setSelectedRuleSetId}),de=m(function(e){return e.error}),pe=m(function(e){return e.setError}),me=m(function(e){return e.setStations}),fe=m(function(e){return e.scopeTreeData}),ge=m(function(e){return e.setScopeTreeData}),ve=a({isOpen:!1,type:"GLOBAL"}),he=ve[0],Se=ve[1],ye=a(!1),be=ye[0],Ce=ye[1],Te=a(!1),we=Te[0],Ee=Te[1],Le=a("learnings"),Ie=Le[0],De=Le[1],Ae=a(null),Oe=Ae[0],Re=Ae[1],je=a(null),Ne=je[0],ke=je[1],Me=l(null),_e=l(null),Pe=l(!1),Ue=l(null),Ge=S();Ge.user;var Be=Ge.setUser,Fe=k(),qe=Fe.setConfig,xe=Fe.setIlLabels;console.log("testing",V("middleDrawer.contextMenu.addSubscope",""));var He=function(){try{return H()}catch(e){return{search:""}}}();c(function(){if(!Pe.current){var e=new URLSearchParams(window.location.search),n=e.get(D.RULESET_ID),t=e.get(D.SECTION),r=t&&ln.has(t)?t:"learnings";(null==n?void 0:n.length)&&ue&&De&&(ue(n),De(r),Pe.current=!0)}},[null==He?void 0:He.search,De,ue]);var Qe=P(function(e){return e.fetchPermissions}),ze=P(function(e){return e.hasPermission}),Ke=U(function(e){return e.setRoles}),Ve=N(function(e){return e.appsecRbacUrl})===oe.appsecRbacUrl,We=G(oe.applicationId,Ve).data,Ye=B(null!=ie?ie:""),Je=Ye.isLoading,Xe=Ye.isError,Ze=Ye.refetch;Ye.isSuccess,c(function(){We&&Ke(We.map(function(e){return{_id:e._id,name:e.name}}))},[We,Ke]),c(function(){var e;console.log("userDetails",$),Be($),console.log("llmStudioUrl",ee),console.log("audacyBackendUrl",ne),N.getState().setLlmStudioUrl(ee),N.getState().setAudacyBackendUrl(ne),N.getState().setRbacConfig(oe),N.getState().setAuditLogConfig(se),qe(re),xe(te),m.getState().setAppIntegrationId(null!=ie?ie:null),m.getState().setBackwardCompatibility(le),m.getState().setToken(null!==(e=null==$?void 0:$.accessToken)&&void 0!==e?e:null)},[$,Be,ee,ne,oe,se,re,qe,te,xe,ie,le]),c(function(){(null==$?void 0:$.accessToken)&&ee&&y()},[ie,null==$?void 0:$.accessToken,ee]);var $e=function(n){return void 0===n&&(n=!0),t(Z,void 0,void 0,function(){var t,o,s,i,a,l;return r(this,function(r){switch(r.label){case 0:n&&Ce(!0),pe(null),r.label=1;case 1:return r.trys.push([1,4,5,6]),[4,Qe(oe.applicationId)];case 2:return r.sent(),t=function(n){if(!P.getState().hasPermission("ilotj.scope.view",n.id))return null;var r=n.children?n.children.map(function(e){return t(e)}).filter(function(e){return null!==e}):[];return e(e({},n),{children:r})},[4,b(ie,$.accessToken)];case 3:return(o=r.sent())&&o.data&&o.data.data&&(s=o.data.data,Array.isArray(s)&&(s=s.length>0?s[0]:null),s?(i=t(s))?(Re(null),ge({data:i}),_e.current?(ue(_e.current),De("learnings"),_e.current=null):m.getState().selectedRuleSetId||ue(i.id)):(Re(null!==(l=s.id)&&void 0!==l?l:null),ge(null)):(Re(null),ge(null))),[3,6];case 4:return a=r.sent(),console.error("Failed to fetch rule sets or permissions",a),pe("Failed to load data. Please try again later."),[3,6];case 5:return Ce(!1),[7];case 6:return[2]}})})};c(function(){var e;(null===(e=null==$?void 0:$.accessToken)||void 0===e?void 0:e.length)&&Ve?$e(!0):console.warn("Error: Trying to fetch rules without access token",$)},[null==$?void 0:$.accessToken,pe,me,oe.applicationId,Ve]);var en=function(n,o,s){return t(Z,void 0,void 0,function(){var t,o,s,i,a,l,c,u;return r(this,function(r){switch(r.label){case 0:Ee(!0),r.label=1;case 1:return r.trys.push([1,4,5,6]),[4,L(n,$.accessToken)];case 2:return r.sent(),m.getState().selectedRuleSetId===n&&(t=m.getState().scopeTreeData,(o=j((null==t?void 0:t.data)||null,n))&&o.length>1&&(s=o[o.length-2],ue(s),De("learnings"))),[4,$e(!0)];case 3:return r.sent(),Se(function(n){return e(e({},n),{isOpen:!1})}),null===(a=Ue.current)||void 0===a||a.show({severity:"success",summary:"Deleted Successfully",detail:"The scope was permanently removed."}),[3,6];case 4:return i=r.sent(),console.error("An error occurred during scope deletion.",i),null===(l=Ue.current)||void 0===l||l.show({severity:"error",summary:"Delete Failed",detail:(null===(u=null===(c=null==i?void 0:i.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 Ee(!1),[7];case 6:return[2]}})})},nn=fe,tn=Ne?{data:{id:Ne.stationId,name:Ne.stationName,type:"STATION",metrics:{learningsCount:Ne.learningsCount,stationsCount:0},children:[]}}:nn,rn=!!(null==tn?void 0:tn.data);null===(Y=null==tn?void 0:tn.data)||void 0===Y||Y.type;var on=P(function(e){return e.hasGlobalPermission})("ilotj.scope.global.create",oe.applicationResourceId||"");if(Je)return o("div",e({className:g.learningManagementContainer},{children:o(q,{})}));if(Xe)return o("div",e({className:g.learningManagementContainer},{children:o(x,{errorMessage:"Failed to load configuration. Please try again.",onRetry:function(){return Ze()},title:"Error Loading Configuration"})}));var sn=n([{type:"GLOBAL",label:"Global",addChildLabel:"".concat(V("middleDrawer.addScope","Add Scope")),addChildType:"SCOPE"},e({type:"SCOPE",label:V("middleDrawer.scope","Scope")},!le&&{addChildLabel:V("middleDrawer.treeMenu.contextMenu.addSubscope","Add Subscope"),addChildType:"SUBSCOPE"})],le?[]:[{type:"SUBSCOPE",label:V("middleDrawer.subScope","Subscope")}],!0),an=[{id:"learnings",label:V("middleDrawer.treeMenu.submenu.learnings","Learnings"),icon:u,badgeKey:"learningsCount"},{id:"access",label:V("middleDrawer.treeMenu.submenu.access","Access"),icon:d},{id:"history",label:V("middleDrawer.treeMenu.submenu.changeHistory","Change History"),icon:p}],ln=new Set(an.map(function(e){return e.id})),cn=Ne?an.filter(function(e){return"stations"!==e.id}):an;return o(M,{children:s("div",e({className:g.learningManagementContainer},{children:[o("div",e({className:g.mainWrapper},{children:be?o(R,{}):de?s("div",e({className:g.errorContainer},{children:[o("div",e({className:g.errorTitle},{children:"Error Loading Data"})),o("p",e({className:g.errorDesc},{children:de})),o("button",e({onClick:function(){return $e(!0)},className:g.tryAgainBtn},{children:"Try Again"}))]})):rn?o(v,{onOpenCreateModal:function(){return Se({isOpen:!0,type:"GLOBAL"})},onAddChild:function(e,n,t){return Se({isOpen:!0,type:n,parentId:e,parentName:t})},onRenameChild:function(e,n){return Se({isOpen:!0,type:"RENAME",scopeId:e,initialName:n})},onDeleteChild:function(e,n,o){return t(Z,void 0,void 0,function(){var t,s,i;return r(this,function(r){switch(r.label){case 0:return t=m.getState().scopeTreeData,s=j((null==t?void 0:t.data)||null,e),i=!!s&&3===s.length,0!==o?[3,2]:[4,en(e)];case 1:return r.sent(),[3,3];case 2:Se({isOpen:!0,type:"DELETE",scopeId:e,initialName:n,isSubscope:i}),r.label=3;case 3:return[2]}})})},canDeleteScope:function(e){return ze("ilotj.scope.delete",e)},canEditScope:function(e){return ze("ilotj.scope.edit",e)},canCreateScope:function(e){return ze("ilotj.scope.create",e)},onSectionSelect:function(e,n){var t;console.log("Section Selected:",{scopeId:e,sectionId:n}),A(((t={})[D.SECTION]="learnings"===n?null:n,t[D.RULESET_ID]=e,t)),De(n),ue(e)},activeSectionId:Ie,scopeTreeData:tn,sectionsConfig:cn,onViewStation:function(e){Me.current=ce,ke(e),De("learnings"),ue(e.stationId)},onRefreshRuleSets:function(e,n){void 0===e&&(e=!0),n&&(_e.current=n),$e(e)},nodeTypesConfig:sn,app_integration_id:ie,token:$.accessToken}):o(h,{onCreate:function(){return Se({isOpen:!0,type:"GLOBAL"})},title:"No Global Scope has been added!",desc:"Start by creating a Global scope to define base learnings that apply across all stations.",button:"Create Global Scope",canCreateRule:on,noAccessTitle:"Access Restricted",noAccessDesc:"You do not have access to create a Global scope for this application.",onRequestAccess:function(){return t(Z,void 0,void 0,function(){var e,n,t,s,i,a,l,c,u;return r(this,function(r){switch(r.label){case 0:if(!(e=(null===(s=null===(t=m.getState().scopeTreeData)||void 0===t?void 0:t.data)||void 0===s?void 0:s.id)||Oe))return null===(i=Ue.current)||void 0===i||i.show({severity:"error",sticky:!1,className:g.errorToast,content:o(z,{message:"Unable to identify the global scope for this access request."})}),[2];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,I(e)];case 2:return r.sent(),null===(a=Ue.current)||void 0===a||a.show({severity:"success",sticky:!1,life:3e3,className:g.successToast,content:o(Q,{message:"Access request submitted successfully!"})}),[3,4];case 3:return n=r.sent(),null===(l=Ue.current)||void 0===l||l.show({severity:"error",sticky:!1,className:g.errorToast,content:o(z,{message:(null===(u=null===(c=null==n?void 0:n.response)||void 0===c?void 0:c.data)||void 0===u?void 0:u.detail)||"Failed to request access. Please try again."})}),[3,4];case 4:return[2]}})})}})})),o(f,{ref:Ue,pt:{root:{style:{zIndex:9999}}}}),le&&he.isOpen&&"DELETE"!==he.type&&"RENAME"!==he.type?o(_,{isOpen:!0,onClose:function(){return Se(e(e({},he),{isOpen:!1}))},onSubmit:function(n){return t(Z,void 0,void 0,function(){var t,o,s,i,a,l,c,u,d,p,f,g,v,h,S,y,b,E,L,I;return r(this,function(r){switch(r.label){case 0:Ee(!0),t=m.getState().backwardCompatibility,r.label=1;case 1:return r.trys.push([1,12,13,14]),o=void 0,t&&"object"==typeof n?o=n:(s=n,i="SCOPE"===he.type&&he.parentId,a=i?"genreRuleSet":he.type,o={topic:a,scope_reference_id:null,scopeDescription:"demo",parentScopeId:he.parentId||null,scopeName:s,scopeReferenceMetadata:{},applicationMappingId:ie}),[4,w(o,$.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(_e.current=c,u=t&&(null===(S=o.topic)||void 0===S?void 0:S.toLowerCase().includes("genre")),d=!t&&"GLOBAL"!==he.type&&he.parentId,!u&&!d)return[3,10];if(!(p=t?null===(b=null===(y=m.getState().scopeTreeData)||void 0===y?void 0:y.data)||void 0===b?void 0:b.id:he.parentId))return[3,10];if(!le)return[3,7];r.label=3;case 3:return r.trys.push([3,5,,6]),[4,T({source_scope_id:p,target_scope_id:c})];case 4:return r.sent(),[3,6];case 5:return f=r.sent(),console.error("Failed to inherit rules for the new scope:",f),[3,6];case 6:return[3,10];case 7:return r.trys.push([7,9,,10]),[4,C({source_scope_id:p,target_scope_id:c,application_mapping_id:ie||"",is_copy_parent_variant_id:!1})];case 8:return r.sent(),[3,10];case 9:return g=r.sent(),console.error("Failed to inherit rules for the new scope:",g),[3,10];case 10:return[4,$e(!0)];case 11:return r.sent(),Se(function(n){return e(e({},n),{isOpen:!1})}),[3,14];case 12:throw v=r.sent(),console.error("An error occurred during scope creation.",v),null===(E=Ue.current)||void 0===E||E.show({severity:"error",summary:"Creation Failed",detail:(null===(I=null===(L=null==v?void 0:v.response)||void 0===L?void 0:L.data)||void 0===I?void 0:I.message)||"There was an error creating the scope. Please try again."}),v;case 13:return Ee(!1),[7];case 14:return[2]}})})},hasGlobalRuleSet:rn,canCreateGlobal:on,globalScopeId:null!==(X=null===(J=null==fe?void 0:fe.data)||void 0===J?void 0:J.id)&&void 0!==X?X:null}):s(i,{children:[o(F,{isOpen:he.isOpen&&"DELETE"!==he.type&&"RENAME"!==he.type,onClose:function(){return Se(e(e({},he),{isOpen:!1}))},onCreate:function(e){e&&(_e.current=e),$e(!0)},hasGlobalRuleSet:rn,parentId:he.parentId}),o(K,{isOpen:he.isOpen&&"RENAME"===he.type,onClose:function(){return Se(e(e({},he),{isOpen:!1}))},onSave:function(n){return t(Z,void 0,void 0,function(){var t,s,i,a;return r(this,function(r){switch(r.label){case 0:Ee(!0),r.label=1;case 1:return r.trys.push([1,4,5,6]),he.scopeId?[4,E({scope_id:he.scopeId,scope_name:n})]:[2];case 2:return r.sent(),[4,$e(!0)];case 3:return r.sent(),Se(function(n){return e(e({},n),{isOpen:!1})}),[3,6];case 4:throw t=r.sent(),console.error("An error occurred during scope rename.",t),null===(s=Ue.current)||void 0===s||s.show({severity:"error",sticky:!1,className:g.errorToast,content:o(z,{message:(null===(a=null===(i=null==t?void 0:t.response)||void 0===i?void 0:i.data)||void 0===a?void 0:a.message)||"There was an error renaming the scope. Please try again."})}),t;case 5:return Ee(!1),[7];case 6:return[2]}})})},initialName:he.initialName})]}),o(O,{isOpen:he.isOpen&&"DELETE"===he.type,onCancel:function(){return Se(e(e({},he),{isOpen:!1}))},onConfirm:function(){return en(he.scopeId,he.initialName,he.isSubscope)},title:"Delete Scope",description:s(i,{children:["Deleting ",o("span",e({className:g.highlight},{children:he.initialName||"this scope"}))," will permanently remove all Learnings, Access rules, and Change History inside it. This cannot be undone."]}),confirmText:"Delete",confirmBgColor:"#EF4444",isLoading:we})]}))})}console.log("learningstest",V("middleDrawer.treeMenu.submenu.learnings"));export{W as default};
|
|
1
|
+
import{__assign as e,__spreadArray as n,__awaiter as t,__generator as r}from"tslib";import{jsx as o,jsxs as s,Fragment as i}from"react/jsx-runtime";import{useState as a,useRef as l,useEffect as c}from"react";import{BookOpen as u,Users as d,History as p}from"lucide-react";import{useLearningTemplateStore as m}from"./store/useLearningTemplateStore.js";import{Toast as f}from"primereact/toast";import g from"./styles/LearningTemplateManagement.module.css.js";import v from"./LearningTemplateLayout.js";import h from"./components/EmptyLearningState.js";import S from"./store/useAuthStore.js";import{fetchTiers as y,fetchScopes as b,inheritScope as C,inheritScopeBackwardCompatible as T,createRuleSet as E,renameScope as L,deleteRuleSet as I,requestAccess as A}from"./apis/scopeApis.js";import{QUERY_PARAM_KEYS as O,setQueryParams as w}from"./hooks/useLearningTemplateQueryParams.js";import j from"./components/ConfirmationModal.js";import R from"./components/LearningTemplateManagementSkeleton.js";import{findNodePathById as N}from"./utils/treeUtils.js";import D from"./store/useEnvStore.js";import{useConfigStore as k}from"./store/useConfigStore.js";import{TooltipProvider as _}from"./components/ToolTip.js";import M from"./components/CreateRuleSetLegacyModal.js";import{usePermissionsStore as P}from"./store/usePermissionsStore.js";import{useAppSecRolesStore as U}from"./store/useAppSecRolesStore.js";import{useGetAppSecRolesQuery as G}from"./queries/useApprovalQueries.js";import{useLMSConfigQuery as B}from"./queries/useLMSConfigQuery.js";import F from"./RuleContent/AddScopeModal.js";import q from"./components/RuleContentSkeleton.js";import x from"./components/ErrorStateDisplay.js";import{useLocation as H}from"react-router-dom";import Q from"./shared/SuccessToastContent.js";import z from"./shared/ErrorToastContent.js";import K from"./RuleContent/RenameScopeModal.js";import{dt as V}from"./store/useLMSConfigStore.js";import{MIDDLE_DRAWER_DT_PATH as W,MIDDLE_DRAWER_CONTEXT_MENU_DT_PATH as Y}from"./constants.js";function J(J){var X,Z,$,ee=this,ne=J.userDetails,te=J.llmStudioUrl,re=J.audacyBackendUrl,oe=J.ilLabels,se=J.config,ie=J.rbacConfig,ae=J.auditLogConfig,le=J.app_integration_id,ce=J.backwardCompatibility,ue=void 0!==ce&&ce,de=m(function(e){return e.selectedRuleSetId}),pe=m(function(e){return e.setSelectedRuleSetId}),me=m(function(e){return e.error}),fe=m(function(e){return e.setError}),ge=m(function(e){return e.setStations}),ve=m(function(e){return e.scopeTreeData}),he=m(function(e){return e.setScopeTreeData}),Se=a({isOpen:!1,type:"GLOBAL"}),ye=Se[0],be=Se[1],Ce=a(!1),Te=Ce[0],Ee=Ce[1],Le=a(!1),Ie=Le[0],Ae=Le[1],Oe=a("learnings"),we=Oe[0],je=Oe[1],Re=a(null),Ne=Re[0],De=Re[1],ke=a(null),_e=ke[0],Me=ke[1],Pe=l(null),Ue=l(null),Ge=l(!1),Be=l(null),Fe=S();Fe.user;var qe=Fe.setUser,xe=k(),He=xe.setConfig,Qe=xe.setIlLabels,ze=function(){try{return H()}catch(e){return{search:""}}}();c(function(){if(!Ge.current){var e=new URLSearchParams(window.location.search),n=e.get(O.RULESET_ID),t=e.get(O.SECTION),r=t&&un.has(t)?t:"learnings";(null==n?void 0:n.length)&&pe&&je&&(pe(n),je(r),Ge.current=!0)}},[null==ze?void 0:ze.search,je,pe]);var Ke=P(function(e){return e.fetchPermissions}),Ve=P(function(e){return e.hasPermission}),We=U(function(e){return e.setRoles}),Ye=D(function(e){return e.appsecRbacUrl})===ie.appsecRbacUrl,Je=G(ie.applicationId,Ye).data,Xe=B(null!=le?le:"",ue),Ze=Xe.isLoading,$e=Xe.isError,en=Xe.refetch;Xe.isSuccess,c(function(){Je&&We(Je.map(function(e){return{_id:e._id,name:e.name}}))},[Je,We]),c(function(){var e;console.log("userDetails",ne),qe(ne),console.log("llmStudioUrl",te),console.log("audacyBackendUrl",re),D.getState().setLlmStudioUrl(te),D.getState().setAudacyBackendUrl(re),D.getState().setRbacConfig(ie),D.getState().setAuditLogConfig(ae),He(se),Qe(oe),m.getState().setAppIntegrationId(null!=le?le:null),m.getState().setBackwardCompatibility(ue),m.getState().setToken(null!==(e=null==ne?void 0:ne.accessToken)&&void 0!==e?e:null)},[ne,qe,te,re,ie,ae,se,He,oe,Qe,le,ue]),c(function(){(null==ne?void 0:ne.accessToken)&&te&&y()},[le,null==ne?void 0:ne.accessToken,te]);var nn=function(n){return void 0===n&&(n=!0),t(ee,void 0,void 0,function(){var t,o,s,i,a,l;return r(this,function(r){switch(r.label){case 0:n&&Ee(!0),fe(null),r.label=1;case 1:return r.trys.push([1,4,5,6]),[4,Ke(ie.applicationId)];case 2:return r.sent(),t=function(n){if(!P.getState().hasPermission("ilotj.scope.view",n.id))return null;var r=n.children?n.children.map(function(e){return t(e)}).filter(function(e){return null!==e}):[];return e(e({},n),{children:r})},[4,b(le,ne.accessToken)];case 3:return(o=r.sent())&&o.data&&o.data.data&&(s=o.data.data,Array.isArray(s)&&(s=s.length>0?s[0]:null),s?(i=t(s))?(De(null),he({data:i}),Ue.current?(pe(Ue.current),je("learnings"),Ue.current=null):m.getState().selectedRuleSetId||pe(i.id)):(De(null!==(l=s.id)&&void 0!==l?l:null),he(null)):(De(null),he(null))),[3,6];case 4:return a=r.sent(),console.error("Failed to fetch rule sets or permissions",a),fe("Failed to load data. Please try again later."),[3,6];case 5:return Ee(!1),[7];case 6:return[2]}})})};c(function(){var e;(null===(e=null==ne?void 0:ne.accessToken)||void 0===e?void 0:e.length)&&Ye?nn(!0):console.warn("Error: Trying to fetch rules without access token",ne)},[null==ne?void 0:ne.accessToken,fe,ge,ie.applicationId,Ye]);var tn=function(n,o,s){return t(ee,void 0,void 0,function(){var t,o,s,i,a,l,c,u;return r(this,function(r){switch(r.label){case 0:Ae(!0),r.label=1;case 1:return r.trys.push([1,4,5,6]),[4,I(n,ne.accessToken)];case 2:return r.sent(),m.getState().selectedRuleSetId===n&&(t=m.getState().scopeTreeData,(o=N((null==t?void 0:t.data)||null,n))&&o.length>1&&(s=o[o.length-2],pe(s),je("learnings"))),[4,nn(!0)];case 3:return r.sent(),be(function(n){return e(e({},n),{isOpen:!1})}),null===(a=Be.current)||void 0===a||a.show({severity:"success",summary:"Deleted Successfully",detail:"The scope was permanently removed."}),[3,6];case 4:return i=r.sent(),console.error("An error occurred during scope deletion.",i),null===(l=Be.current)||void 0===l||l.show({severity:"error",summary:"Delete Failed",detail:(null===(u=null===(c=null==i?void 0:i.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 Ae(!1),[7];case 6:return[2]}})})},rn=ve,on=_e?{data:{id:_e.stationId,name:_e.stationName,type:"STATION",metrics:{learningsCount:_e.learningsCount,stationsCount:0},children:[]}}:rn,sn=!!(null==on?void 0:on.data);null===(X=null==on?void 0:on.data)||void 0===X||X.type;var an=P(function(e){return e.hasGlobalPermission})("ilotj.scope.global.create",ie.applicationResourceId||"");if(Ze)return o("div",e({className:g.learningManagementContainer},{children:o(q,{})}));if($e)return o("div",e({className:g.learningManagementContainer},{children:o(x,{errorMessage:"Failed to load configuration. Please try again.",onRetry:function(){return en()},title:"Error Loading Configuration"})}));var ln=n([{type:"GLOBAL",label:"Global",addChildLabel:"".concat(V("".concat(W,".addScope"),"Add Scope")),addChildType:"SCOPE"},e({type:"SCOPE",label:V("".concat(W,".scope"),"Scope")},!ue&&{addChildLabel:V("".concat(Y,".addSubScope"),"Add Subscope"),addChildType:"SUBSCOPE"})],ue?[]:[{type:"SUBSCOPE",label:V("".concat(W,".subScope"),"Subscope")}],!0),cn=[{id:"learnings",label:V("".concat(W,".treeMenu.submenu.learnings"),"Learnings"),icon:u,badgeKey:"learningsCount"},{id:"access",label:V("".concat(W,".treeMenu.submenu.access"),"Access"),icon:d},{id:"history",label:V("".concat(W,".treeMenu.submenu.changeHistory"),"Change History"),icon:p}],un=new Set(cn.map(function(e){return e.id})),dn=_e?cn.filter(function(e){return"stations"!==e.id}):cn;return o(_,{children:s("div",e({className:g.learningManagementContainer},{children:[o("div",e({className:g.mainWrapper},{children:Te?o(R,{}):me?s("div",e({className:g.errorContainer},{children:[o("div",e({className:g.errorTitle},{children:"Error Loading Data"})),o("p",e({className:g.errorDesc},{children:me})),o("button",e({onClick:function(){return nn(!0)},className:g.tryAgainBtn},{children:"Try Again"}))]})):sn?o(v,{onOpenCreateModal:function(){return be({isOpen:!0,type:"GLOBAL"})},onAddChild:function(e,n,t){return be({isOpen:!0,type:n,parentId:e,parentName:t})},onRenameChild:function(e,n){return be({isOpen:!0,type:"RENAME",scopeId:e,initialName:n})},onDeleteChild:function(e,n,o){return t(ee,void 0,void 0,function(){var t,s,i;return r(this,function(r){switch(r.label){case 0:return t=m.getState().scopeTreeData,s=N((null==t?void 0:t.data)||null,e),i=!!s&&3===s.length,0!==o?[3,2]:[4,tn(e)];case 1:return r.sent(),[3,3];case 2:be({isOpen:!0,type:"DELETE",scopeId:e,initialName:n,isSubscope:i}),r.label=3;case 3:return[2]}})})},canDeleteScope:function(e){return Ve("ilotj.scope.delete",e)},canEditScope:function(e){return Ve("ilotj.scope.edit",e)},canCreateScope:function(e){return Ve("ilotj.scope.create",e)},onSectionSelect:function(e,n){var t;console.log("Section Selected:",{scopeId:e,sectionId:n}),w(((t={})[O.SECTION]="learnings"===n?null:n,t[O.RULESET_ID]=e,t)),je(n),pe(e)},activeSectionId:we,scopeTreeData:on,sectionsConfig:dn,onViewStation:function(e){Pe.current=de,Me(e),je("learnings"),pe(e.stationId)},onRefreshRuleSets:function(e,n){void 0===e&&(e=!0),n&&(Ue.current=n),nn(e)},nodeTypesConfig:ln,app_integration_id:le,token:ne.accessToken}):o(h,{onCreate:function(){return be({isOpen:!0,type:"GLOBAL"})},title:"No Global Scope has been added!",desc:"Start by creating a Global scope to define base learnings that apply across all stations.",button:"Create Global Scope",canCreateRule:an,noAccessTitle:"Access Restricted",noAccessDesc:"You do not have access to create a Global scope for this application.",onRequestAccess:function(){return t(ee,void 0,void 0,function(){var e,n,t,s,i,a,l,c,u;return r(this,function(r){switch(r.label){case 0:if(!(e=(null===(s=null===(t=m.getState().scopeTreeData)||void 0===t?void 0:t.data)||void 0===s?void 0:s.id)||Ne))return null===(i=Be.current)||void 0===i||i.show({severity:"error",sticky:!1,className:g.errorToast,content:o(z,{message:"Unable to identify the global scope for this access request."})}),[2];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,A(e)];case 2:return r.sent(),null===(a=Be.current)||void 0===a||a.show({severity:"success",sticky:!1,life:3e3,className:g.successToast,content:o(Q,{message:"Access request submitted successfully!"})}),[3,4];case 3:return n=r.sent(),null===(l=Be.current)||void 0===l||l.show({severity:"error",sticky:!1,className:g.errorToast,content:o(z,{message:(null===(u=null===(c=null==n?void 0:n.response)||void 0===c?void 0:c.data)||void 0===u?void 0:u.detail)||"Failed to request access. Please try again."})}),[3,4];case 4:return[2]}})})}})})),o(f,{ref:Be,pt:{root:{style:{zIndex:9999}}}}),ue&&ye.isOpen&&"DELETE"!==ye.type&&"RENAME"!==ye.type?o(M,{isOpen:!0,onClose:function(){return be(e(e({},ye),{isOpen:!1}))},onSubmit:function(n){return t(ee,void 0,void 0,function(){var t,o,s,i,a,l,c,u,d,p,f,g,v,h,S,y,b,L,I,A;return r(this,function(r){switch(r.label){case 0:Ae(!0),t=m.getState().backwardCompatibility,r.label=1;case 1:return r.trys.push([1,12,13,14]),o=void 0,t&&"object"==typeof n?o=n:(s=n,i="SCOPE"===ye.type&&ye.parentId,a=i?"genreRuleSet":ye.type,o={topic:a,scope_reference_id:null,scopeDescription:"demo",parentScopeId:ye.parentId||null,scopeName:s,scopeReferenceMetadata:{},applicationMappingId:le}),[4,E(o,ne.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(Ue.current=c,u=t&&(null===(S=o.topic)||void 0===S?void 0:S.toLowerCase().includes("genre")),d=!t&&"GLOBAL"!==ye.type&&ye.parentId,!u&&!d)return[3,10];if(!(p=t?null===(b=null===(y=m.getState().scopeTreeData)||void 0===y?void 0:y.data)||void 0===b?void 0:b.id:ye.parentId))return[3,10];if(!ue)return[3,7];r.label=3;case 3:return r.trys.push([3,5,,6]),[4,T({source_scope_id:p,target_scope_id:c})];case 4:return r.sent(),[3,6];case 5:return f=r.sent(),console.error("Failed to inherit rules for the new scope:",f),[3,6];case 6:return[3,10];case 7:return r.trys.push([7,9,,10]),[4,C({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 g=r.sent(),console.error("Failed to inherit rules for the new scope:",g),[3,10];case 10:return[4,nn(!0)];case 11:return r.sent(),be(function(n){return e(e({},n),{isOpen:!1})}),[3,14];case 12:throw v=r.sent(),console.error("An error occurred during scope creation.",v),null===(L=Be.current)||void 0===L||L.show({severity:"error",summary:"Creation Failed",detail:(null===(A=null===(I=null==v?void 0:v.response)||void 0===I?void 0:I.data)||void 0===A?void 0:A.message)||"There was an error creating the scope. Please try again."}),v;case 13:return Ae(!1),[7];case 14:return[2]}})})},hasGlobalRuleSet:sn,canCreateGlobal:an,globalScopeId:null!==($=null===(Z=null==ve?void 0:ve.data)||void 0===Z?void 0:Z.id)&&void 0!==$?$:null}):s(i,{children:[o(F,{isOpen:ye.isOpen&&"DELETE"!==ye.type&&"RENAME"!==ye.type,onClose:function(){return be(e(e({},ye),{isOpen:!1}))},onCreate:function(e){e&&(Ue.current=e),nn(!0)},hasGlobalRuleSet:sn,parentId:ye.parentId}),o(K,{isOpen:ye.isOpen&&"RENAME"===ye.type,onClose:function(){return be(e(e({},ye),{isOpen:!1}))},onSave:function(n){return t(ee,void 0,void 0,function(){var t,s,i,a;return r(this,function(r){switch(r.label){case 0:Ae(!0),r.label=1;case 1:return r.trys.push([1,4,5,6]),ye.scopeId?[4,L({scope_id:ye.scopeId,scope_name:n})]:[2];case 2:return r.sent(),[4,nn(!0)];case 3:return r.sent(),be(function(n){return e(e({},n),{isOpen:!1})}),[3,6];case 4:throw t=r.sent(),console.error("An error occurred during scope rename.",t),null===(s=Be.current)||void 0===s||s.show({severity:"error",sticky:!1,className:g.errorToast,content:o(z,{message:(null===(a=null===(i=null==t?void 0:t.response)||void 0===i?void 0:i.data)||void 0===a?void 0:a.message)||"There was an error renaming the scope. Please try again."})}),t;case 5:return Ae(!1),[7];case 6:return[2]}})})},initialName:ye.initialName})]}),o(j,{isOpen:ye.isOpen&&"DELETE"===ye.type,onCancel:function(){return be(e(e({},ye),{isOpen:!1}))},onConfirm:function(){return tn(ye.scopeId,ye.initialName,ye.isSubscope)},title:"Delete Scope",description:s(i,{children:["Deleting ",o("span",e({className:g.highlight},{children:ye.initialName||"this scope"}))," will permanently remove all Learnings, Access rules, and Change History inside it. This cannot be undone."]}),confirmText:"Delete",confirmBgColor:"#EF4444",isLoading:Ie})]}))})}export{J as default};
|
|
2
2
|
//# sourceMappingURL=LearningManagement.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as
|
|
1
|
+
import{__awaiter as e,__generator as o,__assign as r,__spreadArray as t}from"tslib";import{jsx as n,jsxs as i,Fragment as l}from"react/jsx-runtime";import{useState as a,useRef as c,useEffect as s}from"react";import{useMutation as d}from"@tanstack/react-query";import{X as p,Loader2 as u}from"lucide-react";import{Toast as m}from"primereact/toast";import{v4 as f}from"uuid";import h from"../components/StationOnboarding/StationAutocomplete.js";import g from"./AddScopeApprovalSearchComponent.js";import v from"../components/ScopeSkeletonLoader.js";import{Input as y}from"@mui/material";import b from"../store/useAuthStore.js";import{useAppSecRolesStore as S}from"../store/useAppSecRolesStore.js";import C from"../store/useEnvStore.js";import{createRuleSet as x}from"../apis/scopeApis.js";import{useLearningTemplateStore as w}from"../store/useLearningTemplateStore.js";import{IL_CONFIG_CONSTANTS as _}from"../config.js";import{dt as k}from"../store/useLMSConfigStore.js";import{MIDDLE_DRAWER_ADD_SCOPE_DT_PATH as A,MIDDLE_DRAWER_APPROVAL_SETTINGS_DT_PATH as R}from"../constants.js";var D=function(D){var I=D.isOpen,q=D.onClose,j=D.onCreate,z=D.hasGlobalRuleSet,F=D.parentId,E=a(""),L=E[0],B=E[1],W=a(""),N=W[0],G=W[1],P=a({}),T=P[0],M=P[1],O=c(null),K=b().user,U=S(function(e){return e.roles}),H=C(function(e){return e.rbacConfig}),J=a(null),Q=J[0],V=J[1],X=a("approval_required"),Y=X[0],Z=X[1],$=a([]),ee=$[0],oe=$[1],re=a([]),te=re[0],ne=re[1],ie=a(""),le=ie[0],ae=ie[1],ce=d({mutationFn:function(r){return e(void 0,void 0,void 0,function(){var e;return o(this,function(o){switch(o.label){case 0:return[4,x(r,null!==(e=null==K?void 0:K.accessToken)&&void 0!==e?e:"")];case 1:return[2,o.sent()]}})})},onSuccess:function(r){return e(void 0,void 0,void 0,function(){return o(this,function(e){return console.log("Rule Set Created Successfully",r),[2]})})}});ce.data;var se=ce.isPending,de=ce.mutateAsync;return s(function(){I&&(B(""),G(""),M({}),V(null),Z("approval_required"),oe([]),ne([]),ae(""))},[I]),I?se?n(v,{isLoading:se}):i("div",r({style:{position:"absolute",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0,0,0,0.3)"}},{children:[n(m,{ref:O}),i("div",r({style:{position:"relative",width:600,borderRadius:12,backgroundColor:"white",padding:24,boxShadow:"0 25px 50px -12px rgba(0,0,0,0.25)"}},{children:[i("div",r({style:{marginBottom:24,display:"flex",alignItems:"flex-start",justifyContent:"space-between"}},{children:[i("div",{children:[n("h2",r({style:{margin:0,fontSize:18,fontWeight:500,color:"#19213D"}},{children:k("".concat(A,".title"),"Add Scope")})),n("p",r({style:{margin:"4px 0 0 0",fontSize:14,fontWeight:400,color:"#666F8D"}},{children:k("".concat(A,".subtitle"),"This scope will be created under Global and will inherit its Learnings by default.",{parent:"Global"})}))]}),n("button",r({onClick:q,style:{background:"none",border:"none",padding:0,cursor:"pointer",color:"#9CA3AF"}},{children:n(p,{size:24})}))]})),i("div",r({style:{display:"flex",flexDirection:"column",gap:20}},{children:[i("div",r({style:{position:"relative",display:"flex",flexDirection:"column",gap:6}},{children:[i("label",r({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:[n("span",r({style:{marginRight:4,fontSize:16,fontWeight:600,color:"#8F2C23"}},{children:"*"})),k("".concat(A,".scopeName"),"Scope Name")]})),"Custom"===L?n(h,{value:N,onChange:function(e){if(e.length>50)return G(e.slice(0,50)),void M(function(e){return r(r({},e),{name:"Scope Name must be 50 characters or fewer"})});G(e),M(function(e){return r(r({},e),{name:void 0})})},onStationSelect:function(e){V(e)},style:{border:T.name?"1px solid #8F2C23":void 0}}):n(y,{value:N,onChange:function(e){var o=e.target.value;if(o.length>50)return G(o.slice(0,50)),void M(function(e){return r(r({},e),{name:"Scope Name must be 50 characters or fewer"})});G(o),M(function(e){return r(r({},e),{name:void 0})})},style:{border:"1px solid ".concat(T.name?"#8F2C23":"#F0F2F5")},placeholder:"e.g. Global Learnings"}),T.name&&n("p",r({style:{margin:"4px 0 0 0",fontSize:12,color:"#8F2C23"}},{children:T.name}))]})),i("div",r({style:{display:"flex",flexDirection:"column",gap:12}},{children:[i("label",r({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:[n("span",r({style:{marginRight:4,fontSize:16,fontWeight:600,color:"#8F2C23"}},{children:"*"})),k("".concat(R,".title"),"Learning Approval Settings")]})),i("div",r({role:"radio","aria-checked":"approval_required"===Y,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:4},onClick:function(){return Z("approval_required")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||Z("approval_required")}},{children:[i("div",r({style:{display:"flex",alignItems:"center",gap:8}},{children:[n("div",r({style:{display:"flex",height:16,width:16,flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("approval_required"===Y?"#2563EB":"#CBD5E1")}},{children:"approval_required"===Y&&n("div",{style:{height:8,width:8,borderRadius:"50%",backgroundColor:"#2563EB"}})})),n("span",r({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:k("".concat(R,".approvalRequired.title"),"Approval Required Before Publishing")}))]})),n("p",r({style:{margin:0,marginLeft:24,fontSize:12,color:"#666F8D"}},{children:k("".concat(R,".approvalRequired.subtitle"),"Learnings require approval before publishing.")}))]})),"approval_required"===Y&&n(g,{selectedApprovers:ee,selectedGroupOfApprovers:te,onApproversChange:oe,onGroupsChange:ne}),le&&n("p",r({style:{margin:0,marginLeft:24,fontSize:12,color:"#8F2C23"}},{children:le})),i("div",r({role:"radio","aria-checked":"publish_without"===Y,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:4},onClick:function(){Z("publish_without"),ae("")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||(Z("publish_without"),ae(""))}},{children:[i("div",r({style:{display:"flex",alignItems:"center",gap:8}},{children:[n("div",r({style:{display:"flex",height:16,width:16,flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("publish_without"===Y?"#2563EB":"#CBD5E1")}},{children:"publish_without"===Y&&n("div",{style:{height:8,width:8,borderRadius:"50%",backgroundColor:"#2563EB"}})})),n("span",r({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:k("".concat(R,".publishWithoutApproval.title"),"Publish Without Approval")}))]})),n("p",r({style:{margin:0,marginLeft:24,fontSize:12,color:"#666F8D"}},{children:k("".concat(R,".publishWithoutApproval.subtitle"),"Learnings can be published directly.")}))]}))]})),i("div",r({style:{marginTop:32,display:"flex",justifyContent:"flex-end",gap:12}},{children:[n("button",r({onClick:q,style:{borderRadius:6,border:"1px solid #E2E8F0",padding:"8px 16px",fontSize:14,fontWeight:500,color:"#64748B",backgroundColor:"white",cursor:"pointer",opacity:se?.5:1},disabled:se},{children:k("".concat(A,".cancel"),"Cancel")})),n("button",r({onClick:function(){return e(void 0,void 0,void 0,function(){var e,r,n,i,l,a,c,s,d,p,u,m,h,g;return o(this,function(o){switch(o.label){case 0:if(e={},N.trim()?N.length>50&&(e.name="Scope Name must be 50 characters or fewer"):e.name="Scope Name is required","approval_required"===Y&&0===ee.length&&0===te.length&&ae("Please select at least one approver or approver group."),e.name)return M(e),[2];if("approval_required"===Y&&0===ee.length&&0===te.length)return[2];ae(""),o.label=1;case 1:return o.trys.push([1,3,,4]),r="approval_required"===Y,n=w.getState().backwardCompatibility,i=n?{topic:z?"genreRuleSet":"globalRuleSet",customScopeGroupName:_.CUSTOM_SCOPE_GROUP_NAME,scopeDescription:N,parentScopeId:null,customScopeName:N,customScopeId:f(),createByName:(null==K?void 0:K.firstname)||"System",createdBy:(null==K?void 0:K.email)||"system@audacy.com",approvalRequired:r,appsecData:{application:null==H?void 0:H.applicationId,module:null==H?void 0:H.moduleId,roles:t(t([],r?[{users:ee.map(function(e){return e.email}),groups:te.map(function(e){return e._id}),role:null!==(s=null===(c=U.find(function(e){return"Learning Manager"===e.name}))||void 0===c?void 0:c._id)&&void 0!==s?s:""}]:[],!0),[{users:[null==K?void 0:K.email],groups:[],role:null!==(p=null===(d=U.find(function(e){return"Instant Learning Admin"===e.name}))||void 0===d?void 0:d._id)&&void 0!==p?p:""}],!1)}}:{topic:z?"genreRuleSet":"globalRuleSet",scope_reference_id:null,scopeDescription:N,parentScopeId:null!=F?F:null,scopeName:N,scopeReferenceMetadata:{},scopeType:"Custom",applicationMappingId:w.getState().app_integration_id},console.log("Add Scope payload:",i),[4,de(i)];case 2:return l=o.sent(),j(null===(u=null==l?void 0:l.data)||void 0===u?void 0:u.scopeId),q(),[3,4];case 3:return a=o.sent(),console.error("An error occurred during scope creation.",a),null===(m=O.current)||void 0===m||m.show({severity:"error",summary:"Adding Scope Failed",detail:(null===(g=null===(h=null==a?void 0:a.response)||void 0===h?void 0:h.data)||void 0===g?void 0:g.message)||"There was an error creating the scope. Please try again."}),[3,4];case 4: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:se||"Custom"===L&&!Q?.5:1},disabled:se||"Custom"===L&&!Q},{children:se?i(l,{children:[n(u,{className:"animate-spin",style:{marginRight:8,height:16,width:16,color:"white"}}),"Creating..."]}):k("".concat(A,".submitButton"),"Create Scope")}))]}))]}))]}))]})):null};export{D as default};
|
|
2
2
|
//# sourceMappingURL=AddScopeModal.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e}from"tslib";import{jsxs as o,jsx as n}from"react/jsx-runtime";import{useState as
|
|
1
|
+
import{__assign as e}from"tslib";import{jsxs as o,jsx as n}from"react/jsx-runtime";import{useState as t}from"react";import{Dialog as r,DialogContent as i,DialogContentText as a,DialogActions as c}from"@mui/material";import l from"@mui/icons-material/Check";import d from"@mui/icons-material/CloseRounded";import{X as s,Loader2 as p}from"lucide-react";import{dt as u}from"../store/useLMSConfigStore.js";import{LEARNING_DT_PATH as m}from"../constants.js";var g={header:{padding:"16px 16px 0",display:"flex",justifyContent:"space-between",alignItems:"center"},title:{color:"#334155",fontSize:"1rem"},closeButton:{border:"none",background:"transparent",padding:0,color:"#9CA3AF",cursor:"pointer",outline:"none",transition:"color 150ms ease-in-out"},dialogContent:{padding:"8px 16px"},description:{color:"#475569",fontSize:"0.875rem",lineHeight:1.625},descriptionStrong:{fontWeight:700,color:"#1E293B"},secondaryDescription:{color:"#475569",fontSize:"0.875rem",marginTop:"8px"},rejectSection:{marginTop:"20px"},feedbackLabel:{display:"block",fontSize:"0.875rem",fontWeight:600,color:"#334155",marginBottom:"6px"},textarea:{width:"100%",fontSize:"0.875rem",color:"#1E293B",padding:"10px",border:"1px solid #E2E8F0",borderRadius:"0.5rem",outline:"none",resize:"none",transition:"border-color 150ms ease-in-out, box-shadow 150ms ease-in-out",boxSizing:"border-box",fontFamily:"inherit"},checkboxLabel:{display:"flex",justifyContent:"flex-end",alignItems:"center",gap:"8px",cursor:"pointer",userSelect:"none",marginTop:"16px"},checkbox:{margin:0,height:"1.125rem",width:"1.125rem",borderRadius:"0.25rem",border:"1px solid #CBD5E1",accentColor:"#DC2626",cursor:"pointer"},checkboxTextWrap:{display:"flex",alignItems:"center"},checkboxText:{fontSize:"0.875rem",fontWeight:500,color:"#1E293B",transition:"color 150ms ease-in-out"},actions:{padding:"24px",gap:"8px"},secondaryButton:{padding:"8px 20px",fontSize:"0.875rem",fontWeight:500,color:"#475569",border:"1px solid #E2E8F0",borderRadius:"0.5rem",backgroundColor:"#FFFFFF",transition:"background-color 150ms ease-in-out, border-color 150ms ease-in-out",cursor:"pointer"},primaryButton:{display:"inline-flex",alignItems:"center",gap:"0.375rem",padding:"8px 20px",fontSize:"0.875rem",fontWeight:500,color:"#FFFFFF",border:"none",borderRadius:"0.5rem",transition:"background-color 150ms ease-in-out",boxShadow:"none",cursor:"pointer"},actionIcon:{width:"1rem",height:"1rem",fontSize:"1rem"},variantCard:{backgroundColor:"#f9fafb",border:"1px solid #e5e7eb",borderRadius:"10px",padding:"16px 20px",marginTop:"12px"},variantCardTitle:{fontSize:"0.9375rem",fontWeight:700,color:"#111111",marginBottom:"4px"},variantCardDescription:{fontSize:"0.8125rem",color:"#374151",marginBottom:"12px",lineHeight:1.5},variantCardMono:{fontSize:"0.75rem",color:"#4b5563",fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",lineHeight:1.6}},h=function(h){var b=h.open,f=h.mode,x=h.onClose,y=h.onSubmit,v=h.variantInformation,C=h.ruleTitle,k=h.pendingVariants,F=void 0===k?[]:k,E=h.isPending,S=void 0!==E&&E,D=t(""),j=D[0],w=D[1],T=t(!0),B=T[0],M=T[1],z=t(!1),A=z[0],L=z[1],W=t(!1),I=W[0],R=W[1],P=t(!1),H=P[0],N=P[1],V=t(!1),Y=V[0],q=V[1],G=t(!1),J=G[0],K=G[1],O="undefined"!=typeof document?document.getElementById("rule-template-layout-content"):null,Q="reject"===f,U=function(){y(Q?{feedback:j,deleteLearning:B}:{}),w(""),M(!1)},X=function(){w(""),M(!1),x()};return o(r,e({open:b,onClose:X,container:O,maxWidth:!1,fullWidth:!0,sx:{position:"absolute",inset:0,zIndex:999,"& .MuiBackdrop-root":{position:"absolute"},"& .MuiDialog-container":{alignItems:"center",justifyContent:"center",padding:"24px 16px"},"& .MuiDialog-paper":{width:"100%",maxWidth:"640px",margin:0,borderRadius:"16px"}}},{children:[o("div",e({style:g.header},{children:[n("div",e({style:g.title},{children:"".concat(Q?u("".concat(m,".rejectDialog.title"),"Reject Learning"):u("".concat(m,".approveDialog.title"),"Approve Learning"))})),n("button",e({onClick:x,onMouseEnter:function(){return L(!0)},onMouseLeave:function(){return L(!1)},style:e(e({},g.closeButton),{color:A?"#4B5563":"#9CA3AF"})},{children:n(s,{size:24})}))]})),o(i,e({sx:g.dialogContent},{children:[o(a,e({sx:g.description},{children:[n("span",e({style:g.descriptionStrong},{children:v}))," ","".concat(Q?u("".concat(m,".rejectDialog.desc"),"will not be published or applied within the selected scope. You can provide feedback before rejecting"):u("".concat(m,".approveDialog.desc"),"will be published and become active within the selected scope after approval."))]})),F.length>0&&n("div",{children:F.map(function(t,r){return o("div",e({style:g.variantCard},{children:[o("div",e({style:g.variantCardTitle},{children:[C,F.length>1?" — Variant ".concat(r+1):""]})),t.description&&n("div",e({style:g.variantCardDescription},{children:t.description})),o("div",e({style:g.variantCardMono},{children:[t.whenToApply&&o("div",{children:["WTA — ",t.whenToApply]}),t.whenNotToApply&&o("div",{children:["WNTA — ",t.whenNotToApply]})]}))]}),t.variantId)})}),n(a,e({sx:g.secondaryDescription},{children:Q?"":u("".concat(m,".approveDialog.footer"),"Take a moment to check the configuration before moving forward.")})),Q&&o("div",e({style:g.rejectSection},{children:[o("div",{children:[n("label",e({htmlFor:"feedback",style:g.feedbackLabel},{children:u("".concat(m,".rejectDialog.feedbackTitle"),"Feedback")})),n("textarea",{id:"feedback",rows:4,value:j,onChange:function(e){return w(e.target.value)},onFocus:function(){return R(!0)},onBlur:function(){return R(!1)},placeholder:"".concat(u("".concat(m,".rejectDialog.feedbackPlaceholder"),"Add feedback or reason for rejection")),style:e(e({},g.textarea),{borderColor:I?"#EF4444":"#E2E8F0",boxShadow:I?"0 0 0 2px rgba(239, 68, 68, 0.2)":"none"})})]}),o("label",e({style:g.checkboxLabel,onMouseEnter:function(){return N(!0)},onMouseLeave:function(){return N(!1)}},{children:[n("input",{type:"checkbox",checked:B,disabled:!1,onChange:function(e){return M(e.target.checked)},style:g.checkbox}),n("div",e({style:g.checkboxTextWrap},{children:n("span",e({style:e(e({},g.checkboxText),{color:H?"#0F172A":"#1E293B"})},{children:u("".concat(m,".rejectDialog.deleteCheckboxLabel"),"Also delete this learning")}))}))]}))]}))]})),o(c,e({sx:g.actions},{children:[n("button",e({onClick:X,type:"button",disabled:S,onMouseEnter:function(){return q(!0)},onMouseLeave:function(){return q(!1)},style:e(e({},g.secondaryButton),{backgroundColor:Y&&!S?"#F8FAFC":"#FFFFFF",borderColor:Y&&!S?"#CBD5E1":"#E2E8F0",opacity:S?.5:1,cursor:S?"not-allowed":"pointer"})},{children:u("".concat(m,".approveDialog.cancel"),"Cancel")})),o("button",Q?e({onClick:U,type:"button",disabled:S,onMouseEnter:function(){return K(!0)},onMouseLeave:function(){return K(!1)},style:e(e({},g.primaryButton),{backgroundColor:S?"#EF4444":J?"#DC2626":"#EF4444",opacity:S?.7:1,cursor:S?"not-allowed":"pointer"})},{children:[S?n(p,{size:16,style:{animation:"spin 1s linear infinite"}}):n(d,{sx:g.actionIcon}),S?u("".concat(m,".rejectDialog.loadingText"),"Processing..."):u("".concat(m,".rejectDialog.rejectLearning"),"Reject Learning")]}):e({onClick:U,type:"button",disabled:S,onMouseEnter:function(){return K(!0)},onMouseLeave:function(){return K(!1)},style:e(e({},g.primaryButton),{backgroundColor:S?"#22C55E":J?"#16A34A":"#22C55E",opacity:S?.7:1,cursor:S?"not-allowed":"pointer"})},{children:[S?n(p,{size:16,style:{animation:"spin 1s linear infinite"}}):n(l,{sx:g.actionIcon}),S?u("".concat(m,".approveDialog.loadingText"),"Processing..."):u("".concat(m,".approveDialog.approveLearning"),"Approve Learning")]}))]})),n("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"})]}))};export{h as default};
|
|
2
2
|
//# sourceMappingURL=ApprovalLearningDialog.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e,__awaiter as n,__generator as
|
|
1
|
+
import{__assign as e,__awaiter as n,__generator as o}from"tslib";import{jsxs as i,Fragment as r,jsx as t}from"react/jsx-runtime";import{useRef as a,useState as l,useEffect as c}from"react";import{GripVertical as s,ChevronUp as u,ChevronDown as d}from"lucide-react";import{toggleVariant as p}from"../apis/scopeApis.js";import v from"../styles/RuleAccordion.module.css.js";import m from"../styles/CustomTooltip.module.css.js";import g from"./InheritanceBreadcrumb.js";import f from"../components/ConfirmationModal.js";import h from"../components/CustomTooltip.js";import b from"../store/useAuthStore.js";import{usePermissionsStore as j}from"../store/usePermissionsStore.js";import{useLearningTemplateStore as T}from"../store/useLearningTemplateStore.js";import A from"./ApprovalLearningDialog.js";import D from"./ApprovalActionButton.js";import S from"./PendingApprovalChip.js";import{useApproveOrRejectVariantsMutation as C}from"../queries/useApprovalQueries.js";import I from"../store/useEnvStore.js";import{Toast as w}from"primereact/toast";import{dt as y}from"../store/useLMSConfigStore.js";import{LEARNING_DT_PATH as L}from"../constants.js";var N=function(N){var x,P,O,R,B,_,k,E,M,H,V,z,F,G=N.rule,q=N.idx,Q=N.ruleSetId,U=N.isOpen,Y=N.onToggle,J=N.onDelete;N.onEdit,N.isGlobalScope;var K=N.deleteButtonLabel,W=void 0===K?"Delete":K;N.editButtonLabel;var X=N.enableLearningRuleLabel,Z=void 0===X?"Enable":X,$=N.disableLearningRuleLabel,ee=void 0===$?"Disable":$,ne=N.onToggleSuccess,oe=N.dragControls,ie=b.getState().user,re=j(function(e){return e.hasPermission}),te=re("ilotj.rule.delete",Q),ae=re("ilotj.rule.enable",Q),le=re("ilotj.rule.disable",Q),ce=re("ilotj.rule.selfApprove",Q),se=re("ilotj.rule.approve",Q),ue=re("ilotj.scope.approve",Q),de=re("ilotj.rule.pendingApproval.view",Q),pe=re("ilotj.rule.variant.pendingApproval.edit",Q),ve=ce||se||ue||pe,me=de||ve,ge=C(),fe=I(function(e){return e.rbacConfig}),he=fe?{application:null==fe?void 0:fe.applicationId,scopeLevelModuleId:null!==(x=null==fe?void 0:fe.moduleId)&&void 0!==x?x:"",applicationLevelModuleId:null!==(P=null==fe?void 0:fe.applicationModuleId)&&void 0!==P?P:"",applicationLevelResourceId:null!==(O=null==fe?void 0:fe.applicationResourceId)&&void 0!==O?O:""}:void 0,be=a(null),je=l(!1),Te=je[0],Ae=je[1],De=G.variants&&G.variants.length>0?!G.variants.every(function(e){return!1===e.is_enabled}):!1!==G.is_enabled,Se=l(!1),Ce=Se[0],Ie=Se[1],we=null===(R=G.variants)||void 0===R?void 0:R.map(function(e){return e.inheritance||[]}).reduce(function(e,n){return n.length>e.length?n:e},[]),ye=null===(B=G.variants)||void 0===B?void 0:B.some(function(e){return null==e?void 0:e.isOverridden}),Le=De?le:ae;G.inheritance&&G.inheritance.length>0&&(null===(_=G.inheritance)||void 0===_||_.length);var Ne=null!==(E=null===(k=G.variants)||void 0===k?void 0:k.length)&&void 0!==E?E:0,xe=l({isOpen:!1,mode:"approve"}),Pe=xe[0],Oe=xe[1],Re=null!==(H=null===(M=G.variants)||void 0===M?void 0:M.filter(function(e){return"pending_approval"===e.approvalStatus}).length)&&void 0!==H?H:0,Be=T(function(e){return e.urlVariantId}),_e=T(function(e){return e.urlApprovalAction}),ke=T(function(e){return e.clearUrlApprovalParams});c(function(){var e;if(Be&&_e){var n=null===(e=G.variants)||void 0===e?void 0:e.find(function(e){return e.variantId===Be});n&&"pending_approval"===(null==n?void 0:n.approvalStatus)&&ve&&(Oe({isOpen:!0,mode:_e}),ke())}},[Be,_e,G.variants,ke,ve]);var Ee=function(e,n){e.stopPropagation(),Oe({isOpen:!0,mode:n})},Me=U?"".concat(v.accordionHeader," ").concat(v.accordionHeaderOpen):v.accordionHeader;return i(r,{children:[t(w,{ref:be}),t("div",e({className:Me,onClick:Y},{children:i("div",e({className:v.headerContent},{children:[i("div",e({className:v.headerTopRow},{children:[t("div",e({className:v.titleSection},{children:i("div",e({className:v.titleRow},{children:[t("div",e({className:v.dragHandle,title:"Drag to reorder",style:{touchAction:"none"},onPointerDown:function(e){e.stopPropagation(),null==oe||oe.start(e)}},{children:t(s,{size:18})})),i("span",e({className:v.ruleTitle},{children:[q+1,". ",G.ruleTitle]})),G.dataSource&&t("span",e({className:v.dataSourceTag},{children:null===(V=G.dataSource)||void 0===V?void 0:V.tag})),me&&t(S,{count:Re}),ye&&t(h,e({content:"Inherited from the ".concat((null==we?void 0:we.length)>=2?we[we.length-2]:"parent"," scope and overridden in this scope."),placement:"top",withArrow:!0,contentClassName:m.customTooltip,sideOffset:5},{children:t("span",e({className:v.overriddenTag},{children:"Overridden"}))})),!De&&t("span",e({className:v.learningDisabledPill},{children:"Disabled"}))]}))})),t("div",e({className:v.headerActions},{children:t("div",e({className:v.chevronIcon},{children:t(U?u:d,{size:20})}))}))]})),i("div",e({className:v.footerRow},{children:[t(g,{inheritance:we||[]}),i("div",e({className:v.headerButtonGroup},{children:[Le&&t("button",e({onClick:function(e){return n(void 0,void 0,void 0,function(){return o(this,function(n){return e.stopPropagation(),Ae(!0),[2]})})},disabled:Ce,className:v.toggleLearningButton},{children:De?ee:Z})),ve&&Re>1&&i(r,{children:[t(D,{variant:"approve",text:Re>1?"Approve All":"Approve",onClick:function(e){return Ee(e,"approve")}}),t(D,{variant:"reject",text:Re>1?"Reject All":"Reject",onClick:function(e){return Ee(e,"reject")}})]}),te&&J&&t("button",e({className:v.deleteButton,onClick:function(e){e.stopPropagation(),null==J||J()}},{children:W}))]}))]}))]}))})),t(f,{isOpen:Te,title:De?y("".concat(L,".disableDialog.title"),"Disable Learning?"):y("".concat(L,".enableDialog.title"),"Enable Learning?"),description:De?y("".concat(L,".disableDialog.desc"),"Are you sure you want to disable this learning for ".concat(G.ruleTitle,"?"),{rule_title:G.ruleTitle}):y("".concat(L,".enableDialog.desc"),"Are you sure you want to enable this learning for ".concat(G.ruleTitle,"?"),{rule_title:G.ruleTitle}),warning:De?y("".concat(L,".disableDialog.warningText"),"This learning will no longer influence upcoming schedules. You can enable it again anytime."):y("".concat(L,".enableDialog.warningText"),"This learning will start influencing upcoming schedules again."),confirmText:De?y("".concat(L,".disableDialog.deleteText"),"Disable"):y("".concat(L,".enableDialog.deleteText"),"Enable"),cancelText:y("".concat(L,De?".disableDialog.cancelText":".enableDialog.cancelText"),"Cancel"),loadingText:y("".concat(L,De?".disableDialog.loadingText":".enableDialog.loadingText"),"Processing..."),confirmBgColor:De?"#DC2626":"#16A34A",onConfirm:function(){return n(void 0,void 0,void 0,function(){var e,n,i;return o(this,function(o){switch(o.label){case 0:Ie(!0),o.label=1;case 1:return o.trys.push([1,3,4,5]),0===(e=(null===(i=G.variants)||void 0===i?void 0:i.map(function(e){return e.variantId}))||[]).length&&G.ruleId&&e.push(G.ruleId),null==ie?void 0:ie.email,[4,p(e,!De)];case 2:return o.sent(),null==ne||ne(),[3,5];case 3:return n=o.sent(),console.error("Failed to toggle rule variants",n),[3,5];case 4:return Ie(!1),Ae(!1),[7];case 5:return[2]}})})},onCancel:function(){return Ae(!1)},isLoading:Ce}),t(A,{open:Pe.isOpen,mode:Pe.mode,onClose:function(){return Oe(function(n){return e(e({},n),{isOpen:!1})})},onSubmit:function(n){return function(n){var o,i,r=null!==(i=null===(o=G.variants)||void 0===o?void 0:o.filter(function(e){return"pending_approval"===e.approvalStatus}).map(function(e){return e.variantId}))&&void 0!==i?i:[];r.length&&Q&&ge.mutate({variantIds:r,status:"approve"===Pe.mode?"approved":"rejected",feedback:n.feedback,scopeId:Q,appsecData:he},{onSuccess:function(){var n;Oe(function(n){return e(e({},n),{isOpen:!1})}),null==ne||ne(),null===(n=be.current)||void 0===n||n.show({severity:"success",summary:"".concat(Pe.mode," Successfully"),detail:"approve"===Pe.mode?"Learning approved successfully":"Learning rejected successfully"})},onError:function(e){var n;console.error("An error occurred during rejecting.",e),null===(n=be.current)||void 0===n||n.show({severity:"error",summary:"".concat(Pe.mode," Failed"),detail:"There was an error ".concat("approve"===Pe.mode?"approving":"rejecting"," the learning. Please try again.")})}})}(n)},variantInformation:"".concat(G.ruleTitle,"-").concat(Ne>1?"Variants":"Variant 1"),ruleTitle:G.ruleTitle,pendingVariants:null!==(F=null===(z=G.variants)||void 0===z?void 0:z.filter(function(e){return"pending_approval"===e.approvalStatus}))&&void 0!==F?F:[],isPending:ge.isPending})]})};export{N as default};
|
|
2
2
|
//# sourceMappingURL=RuleAccordionHeader.js.map
|