@e-llm-studio/instant-learning 1.3.0-alpha.52 → 1.3.0-alpha.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),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})};
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"),o=require("../apis/scopeApis.js"),i=require("../store/useLMSConfigStore.js"),u=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}),C=u.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,o.fetchLMSConfig(g,s,f)];case 1:return r=e.sent(),t=r.lmsConfig,n=r.teachMeConfig,i=r.template,console.log("Fetched LMS Config:",{lmsConfig:t,teachMeConfig:n,template:i}),t&&v(t),n&&d(n),i&&C(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("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(c){c.baseURL;var d=t.useState(!0),p=d[0],_=d[1],m=t.useState(""),g=m[0],f=m[1],b=t.useState(""),q=b[0],y=b[1],h=t.useState({station:"",tiers:["Tier 1"]}),v=h[0],T=h[1],L=t.useState([]),k=L[0],C=L[1],S=t.useState([]),j=S[0],w=S[1],A=t.useState(s),x=A[0],I=A[1],M=t.useCallback(function(r,t){T(function(n){var a;return e.__assign(e.__assign({},n),((a={})[r]=t,a))})},[]),O=t.useCallback(function(r,t){I(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})},[]),G=function(r){r(function(r){return e.__spreadArray(e.__spreadArray([],r,!0),[{id:Date.now(),text:"",reasoning:""}],!1)})},J=function(e,r){e(function(e){return e.filter(function(e){return e.id!==r})})},N=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})})},W=[e.__assign({key:"order_rules",label:"Order"},x.order_rules),e.__assign({key:"advertiser_rules",label:"Advertiser"},x.advertiser_rules)],D=[{key:"inventory_rules",label:"Inventory code",enabled:x.inventory_rules.respect_inventory_code},{key:"break_code_rules",label:"Break Code",enabled:x.break_code_rules.respect_break_code},{key:"is_default_enabled",label:"Default Variant",enabled:x.is_default_enabled}],R={"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"},B="<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(R[e],'">').concat(e,"</button>")}).join(""),"</p>");return r.jsx(i.default,{open:p,closeFunction:function(){return _(!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:B,template:a.TemplateList.BaseTemplate,templateProps:{state:{title:g,description:q,scopeData:v,whenToApplyConditions:k,whenNotToApplyConditions:j,configData:x,citations:[],citation:{}},handlers:{onTitleChange:function(e){var r,t;return f(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 y(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 G(C)},onRemoveWhenToApply:function(e){return J(C,e)},onEditWhenToApply:function(e,r){return N(C,e,r)},onAddWhenNotToApply:function(){return G(w)},onRemoveWhenNotToApply:function(e){return J(w,e)},onEditWhenNotToApply:function(e,r){return N(w,e,r)},onScopeChange:M,onConfigChange:O},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:W,toggles:D},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"]}))}}})};
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("../../../features/IL-OTJ/ValueTypeWrappers/TeachMePlugin.js"),require("../../../features/LearningManagement/store/useConfigStore.js"),require("appsec-ui"),require("@radix-ui/react-tooltip"),require("../../../features/LearningManagement/components/StationOnboarding/InputField.js"),require("../../../features/LearningManagement/config.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 i=require("../../../features/IL-OTJ/_components/AccordianSection.js"),o=require("../../../features/IL-OTJ/ILOTJ.js"),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(c){c.baseURL;var d=t.useState(!0),p=d[0],_=d[1],m=t.useState(""),g=m[0],f=m[1],b=t.useState(""),y=b[0],h=b[1],q=t.useState({station:"",tiers:["Tier 1"]}),T=q[0],v=q[1],L=t.useState([]),k=L[0],j=L[1],C=t.useState([]),S=C[0],w=C[1],A=t.useState(s),x=A[0],I=A[1],M=t.useCallback(function(r,t){v(function(n){var a;return e.__assign(e.__assign({},n),((a={})[r]=t,a))})},[]),O=t.useCallback(function(r,t){I(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})},[]),G=function(r){r(function(r){return e.__spreadArray(e.__spreadArray([],r,!0),[{id:Date.now(),text:"",reasoning:""}],!1)})},J=function(e,r){e(function(e){return e.filter(function(e){return e.id!==r})})},N=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})})},W=[e.__assign({key:"order_rules",label:"Order"},x.order_rules),e.__assign({key:"advertiser_rules",label:"Advertiser"},x.advertiser_rules)],D=[{key:"inventory_rules",label:"Inventory code",enabled:x.inventory_rules.respect_inventory_code},{key:"break_code_rules",label:"Break Code",enabled:x.break_code_rules.respect_break_code},{key:"is_default_enabled",label:"Default Variant",enabled:x.is_default_enabled}],R={"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"},B="<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(R[e],'">').concat(e,"</button>")}).join(""),"</p>");return r.jsx(o.default,{open:p,closeFunction:function(){return _(!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:B,template:a.TemplateList.BaseTemplate,templateProps:{state:{title:g,description:y,scopeData:T,whenToApplyConditions:k,whenNotToApplyConditions:S,configData:x,citations:[],citation:{}},handlers:{onTitleChange:function(e){var r,t;return f(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 h(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 G(j)},onRemoveWhenToApply:function(e){return J(j,e)},onEditWhenToApply:function(e,r){return N(j,e,r)},onAddWhenNotToApply:function(){return G(w)},onRemoveWhenNotToApply:function(e){return J(w,e)},onEditWhenNotToApply:function(e,r){return N(w,e,r)},onScopeChange:M,onConfigChange:O},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:W,toggles:D},customNodes:{afterTitle:r.jsx(i.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{__assign as e}from"tslib";import{jsx as i}from"react/jsx-runtime";import{useEffect as n}from"react";import r from"./TeachMeWrapper.js";import t from"../../../plugins/ValueTypes/Default/DefaultTeachMeRenderer.js";import o from"../../../plugins/ValueTypes/RadioTrafficLearning/RadioTrafficLearningRenderer.js";import a from"../../../plugins/ValueTypes/Guidelines/GuidelinesTeachMeRenderer.js";import{useTeachMeConfigStore as l}from"../../LearningManagement/store/useLMSConfigStore.js";import{useLearningTemplateStore as s}from"../../LearningManagement/store/useLearningTemplateStore.js";var u={Default:t,"Radio Traffic Learning":o,Guidelines:a},p=function(t){var o,a=t.app_integration_id,p=t.isOpen,f=t.onClose,m=t.pluginPayload,d=t.token,g=t.mode,c=t.baseURL,T=l(function(e){return e.setTeachMeConfig});return l(function(e){return e.clearTeachMeConfig}),n(function(){(null==m?void 0:m.teachMe)&&T(m.teachMe),(null==m?void 0:m.tiers)&&s.getState().setTiers(null==m?void 0:m.tiers)},[m]),i(r,{app_integration_id:a,isOpen:p,onClose:f,token:d,templateRegistry:u,baseURL:c,initialScope:null!==(o=null==m?void 0:m.initialScope)&&void 0!==o?o:"",ruleSet:null==m?void 0:m.ruleSet,pluginPayload:e(e({},m),{mode:g})})};export{u as TemplateRegistry,p as default};
1
+ import{__assign as e}from"tslib";import{jsx as r}from"react/jsx-runtime";import{useEffect as n}from"react";import t from"./TeachMeWrapper.js";import i from"../../../plugins/ValueTypes/Default/DefaultTeachMeRenderer.js";import a from"../../../plugins/ValueTypes/RadioTrafficLearning/RadioTrafficLearningRenderer.js";import o from"../../../plugins/ValueTypes/Guidelines/GuidelinesTeachMeRenderer.js";import{useTeachMeConfigStore as s}from"../../LearningManagement/store/useLMSConfigStore.js";import{useLearningTemplateStore as u}from"../../LearningManagement/store/useLearningTemplateStore.js";import{useLMSConfigQuery as l}from"../../LearningManagement/queries/useLMSConfigQuery.js";import m from"../../LearningManagement/store/useAuthStore.js";import p from"../../LearningManagement/store/useEnvStore.js";import{QueryClient as f,QueryClientProvider as g}from"@tanstack/react-query";import{fetchTiers as c}from"../../LearningManagement/apis/scopeApis.js";var d={Default:i,"Radio Traffic Learning":a,Guidelines:o},L=new f,S=function(n){return r(g,e({client:L},{children:r(M,e({},n))}))},M=function(i){var a,o=i.app_integration_id,f=i.isOpen,g=i.onClose,L=i.pluginPayload,S=i.token,M=i.mode,T=i.baseURL,j=s(function(e){return e.setTeachMeConfig});s(function(e){return e.clearTeachMeConfig}),n(function(){m.getState().setUser({accessToken:S}),p.getState().setLlmStudioUrl(T),u.getState().setAppIntegrationId(null!=o?o:""),S&&T&&c()},[o,S,T]);var h=l(null!=o?o:"",!1,!0);return h.isLoading,h.isError,h.refetch,h.isSuccess,n(function(){(null==L?void 0:L.teachMe)&&j(L.teachMe),(null==L?void 0:L.tiers)&&u.getState().setTiers(L.tiers)},[L]),r(t,{app_integration_id:o,isOpen:f,onClose:g,token:S,templateRegistry:d,baseURL:T,initialScope:null!==(a=null==L?void 0:L.initialScope)&&void 0!==a?a:"",ruleSet:null==L?void 0:L.ruleSet,pluginPayload:e(e({},L),{mode:M})})};export{d as TemplateRegistry,S as default};
2
2
  //# sourceMappingURL=TeachMePlugin.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e,__awaiter as r,__generator as o,__spreadArray as i}from"tslib";import{jsx as t,jsxs as n}from"react/jsx-runtime";import{useState as l,useEffect as a}from"react";import{v4 as p}from"uuid";import{IL_CONFIG_CONSTANTS as d}from"../config.js";import s from"../store/useAuthStore.js";import c from"../RuleContent/AddScopeApprovalSearchComponent.js";import{useAppSecRolesStore as u}from"../store/useAppSecRolesStore.js";import f from"../store/useEnvStore.js";import h from"./ScopeSkeletonLoader.js";var x=function(x){var m=x.isOpen,g=x.onClose,v=x.onSubmit,b=x.hasGlobalRuleSet,y=void 0!==b&&b;x.canCreateGlobal;var S=x.globalScopeId,C=void 0===S?null:S,k=l("");k[0];var E=k[1],w=l(""),B=w[0],_=w[1],D=l(""),R=D[0],z=D[1],q=l(!1),I=q[0],A=q[1],j=l({}),F=j[0],G=j[1],L=l("approval_required"),W=L[0],N=L[1],T=l([]),O=T[0],P=T[1],H=l([]),M=H[0],K=H[1],U=l(""),Y=U[0],J=U[1],Q=s().user,V=u(function(e){return e.roles}),X=f(function(e){return e.rbacConfig});if(a(function(){m&&(E(""),_(""),z(""),G({}),N("approval_required"),P([]),K([]),J(""))},[m]),!m)return null;var Z={overlay:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0, 0, 0, 0.3)"},modal:{position:"relative",width:"600px",borderRadius:"12px",backgroundColor:"#ffffff",padding:"24px",boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25)",maxHeight:"90vh",overflowY:"auto"},header:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"24px"},title:{margin:0,fontSize:"18px",fontWeight:500,color:"#19213D"},subtitle:{marginTop:"4px",fontSize:"14px",fontWeight:400,color:"#666F8D"},closeButton:{background:"none",border:"none",fontSize:"20px",cursor:"pointer",color:"#9CA3AF"},formGroup:{display:"flex",flexDirection:"column",marginBottom:"20px",gap:"6px"},label:{fontSize:"14px",fontWeight:500,color:"#19213D"},asterisk:{color:"#8F2C23",marginRight:"4px",fontSize:"16px",fontWeight:600},input:{width:"100%",padding:"8px 12px",borderRadius:"6px",border:"1px solid #E2E8F0",outline:"none",fontSize:"14px"},inputError:{border:"1px solid #8F2C23"},errorText:{margin:0,marginTop:"4px",fontSize:"12px",color:"#8F2C23"},textarea:{width:"100%",padding:"8px 12px",borderRadius:"6px",border:"1px solid #E2E8F0",outline:"none",fontSize:"14px",minHeight:"100px",maxHeight:"200px",overflowY:"auto",resize:"vertical"},footer:{display:"flex",justifyContent:"flex-end",gap:"12px",marginTop:"32px"},cancelBtn:{padding:"8px 16px",borderRadius:"6px",border:"1px solid #E2E8F0",backgroundColor:"transparent",color:"#64748B",fontSize:"14px",fontWeight:500,cursor:"pointer"},submitBtn:{padding:"8px 16px",borderRadius:"6px",border:"none",backgroundColor:"#2563EB",color:"#ffffff",fontSize:"14px",fontWeight:500,cursor:"pointer"},disabledBtn:{opacity:.5,cursor:"not-allowed"}};return I?t(h,{isLoading:I}):t("div",e({style:Z.overlay},{children:n("div",e({style:Z.modal},{children:[n("div",e({style:Z.header},{children:[n("div",{children:[t("h2",e({style:Z.title},{children:"Create Scope"})),t("p",e({style:Z.subtitle},{children:"Create a scope to group and manage rules."}))]}),t("button",e({onClick:g,style:Z.closeButton},{children:"✕"}))]})),n("div",{children:[n("div",e({style:Z.formGroup},{children:[n("label",e({style:Z.label},{children:[t("span",e({style:Z.asterisk},{children:"*"})),"Scope Name"]})),t("input",{type:"text",value:B,onChange:function(r){var o=r.target.value;if(o.length>50)return _(o.slice(0,50)),void G(function(r){return e(e({},r),{name:"Scope Name must be 50 characters or fewer"})});_(o),F.name&&G(function(r){return e(e({},r),{name:void 0})})},placeholder:"e.g. Global Learnings",style:e(e({},Z.input),F.name?Z.inputError:{})}),F.name&&t("p",e({style:Z.errorText},{children:F.name}))]})),n("div",e({style:Z.formGroup},{children:[n("label",e({style:Z.label},{children:[t("span",e({style:Z.asterisk},{children:"*"})),"Description"]})),t("input",{type:"text",value:R,onChange:function(r){var o=r.target.value;if(o.length>200)return z(o.slice(0,200)),void G(function(r){return e(e({},r),{description:"Description must be 200 characters or fewer"})});z(o),F.description&&G(function(r){return e(e({},r),{description:void 0})})},placeholder:"Enter short description for scope",style:e(e({},Z.input),F.description?Z.inputError:{})}),F.description&&t("p",e({style:Z.errorText},{children:F.description}))]})),n("div",e({style:e(e({},Z.formGroup),{gap:"12px"})},{children:[t("label",e({style:Z.label},{children:"Approval Settings"})),n("div",e({role:"radio","aria-checked":"approval_required"===W,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:"4px"},onClick:function(){return N("approval_required")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||N("approval_required")}},{children:[n("div",e({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[t("div",e({style:{display:"flex",height:"16px",width:"16px",flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("approval_required"===W?"#2563EB":"#CBD5E1")}},{children:"approval_required"===W&&t("div",{style:{height:"8px",width:"8px",borderRadius:"50%",backgroundColor:"#2563EB"}})})),t("span",e({style:{fontSize:"14px",fontWeight:500,color:"#19213D"}},{children:"Approval Required Before Publishing"}))]})),t("p",e({style:{margin:0,marginLeft:"24px",fontSize:"12px",color:"#666F8D"}},{children:"Learnings require approval before publishing."}))]})),"approval_required"===W&&t(c,{selectedApprovers:O,selectedGroupOfApprovers:M,onApproversChange:P,onGroupsChange:K}),Y&&t("p",e({style:{margin:0,marginLeft:"24px",fontSize:"12px",color:"#8F2C23"}},{children:Y})),n("div",e({role:"radio","aria-checked":"publish_without"===W,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:"4px"},onClick:function(){N("publish_without"),J("")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||(N("publish_without"),J(""))}},{children:[n("div",e({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[t("div",e({style:{display:"flex",height:"16px",width:"16px",flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("publish_without"===W?"#2563EB":"#CBD5E1")}},{children:"publish_without"===W&&t("div",{style:{height:"8px",width:"8px",borderRadius:"50%",backgroundColor:"#2563EB"}})})),t("span",e({style:{fontSize:"14px",fontWeight:500,color:"#19213D"}},{children:"Publish Without Approval"}))]})),t("p",e({style:{margin:0,marginLeft:"24px",fontSize:"12px",color:"#666F8D"}},{children:"Learnings can be published directly."}))]}))]}))]}),n("div",e({style:Z.footer},{children:[t("button",e({onClick:g,disabled:I,style:e(e({},Z.cancelBtn),I?Z.disabledBtn:{})},{children:"Cancel"})),t("button",e({onClick:function(){return r(void 0,void 0,void 0,function(){var e,r,t,n,l,a,s,c;return o(this,function(o){switch(o.label){case 0:if(u={},f=!0,B.trim()||(u.name="Scope Name is required",f=!1),R.trim()||(u.description="Description is required",f=!1),G(u),!f)return[2];if("approval_required"===W&&0===O.length&&0===M.length)return J("Please select at least one approver or approver group."),[2];J(""),A(!0),e=y?"genreRuleSet":"globalRuleSet",r="approval_required"===W,console.log("topicData",e),t={topic:e,customScopeGroupName:d.CUSTOM_SCOPE_GROUP_NAME,scopeDescription:R,parentScopeId:y?C:null,customScopeName:B,customScopeId:p(),createByName:null==Q?void 0:Q.firstname,createdBy:null==Q?void 0:Q.email,approvalRequired:r,appsecData:{application:null==X?void 0:X.applicationId,module:null==X?void 0:X.moduleId,roles:i(i([],r?[{users:O.map(function(e){return e.email}),groups:M.map(function(e){return e._id}),role:null!==(a=null===(l=V.find(function(e){return"Learning Manager"===e.name}))||void 0===l?void 0:l._id)&&void 0!==a?a:""}]:[],!0),[{users:[null==Q?void 0:Q.email],groups:[],role:null!==(c=null===(s=V.find(function(e){return"Instant Learning Admin"===e.name}))||void 0===s?void 0:s._id)&&void 0!==c?c:""}],!1)}},o.label=1;case 1:return o.trys.push([1,3,4,5]),[4,v(t)];case 2:return o.sent(),g(),[3,5];case 3:return n=o.sent(),console.error("Error in submission",n),[3,5];case 4:return A(!1),[7];case 5:return[2]}var u,f})})},disabled:I,style:e(e({},Z.submitBtn),I?Z.disabledBtn:{})},{children:I?"Creating...":"Create Scope"}))]}))]}))}))};export{x as default};
1
+ import{__assign as e,__awaiter as r,__generator as o,__spreadArray as i}from"tslib";import{jsx as t,jsxs as n}from"react/jsx-runtime";import{useState as l,useEffect as a}from"react";import{v4 as p}from"uuid";import{IL_CONFIG_CONSTANTS as d}from"../config.js";import s from"../store/useAuthStore.js";import c from"../RuleContent/AddScopeApprovalSearchComponent.js";import{useAppSecRolesStore as u}from"../store/useAppSecRolesStore.js";import f from"../store/useEnvStore.js";import h from"./ScopeSkeletonLoader.js";var x=function(x){var m=x.isOpen,g=x.onClose,v=x.onSubmit,b=x.hasGlobalRuleSet,y=void 0!==b&&b;x.canCreateGlobal;var S=x.globalScopeId,C=void 0===S?null:S,k=l("");k[0];var E=k[1],w=l(""),B=w[0],D=w[1],_=l(""),R=_[0],z=_[1],I=l(!1),q=I[0],A=I[1],j=l({}),F=j[0],G=j[1],L=l("approval_required"),W=L[0],N=L[1],T=l([]),O=T[0],P=T[1],H=l([]),M=H[0],K=H[1],U=l(""),Y=U[0],J=U[1],Q=s().user,V=u(function(e){return e.roles}),X=f(function(e){return e.rbacConfig});if(a(function(){m&&(E(""),D(""),z(""),G({}),N("approval_required"),P([]),K([]),J(""))},[m]),!m)return null;var Z={overlay:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0, 0, 0, 0.3)"},modal:{position:"relative",width:"600px",borderRadius:"12px",backgroundColor:"#ffffff",padding:"24px",boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25)",maxHeight:"90vh",overflowY:"auto"},header:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"24px"},title:{margin:0,fontSize:"18px",fontWeight:500,color:"#19213D"},subtitle:{marginTop:"4px",fontSize:"14px",fontWeight:400,color:"#666F8D"},closeButton:{background:"none",border:"none",fontSize:"20px",cursor:"pointer",color:"#9CA3AF"},formGroup:{display:"flex",flexDirection:"column",marginBottom:"20px",gap:"6px"},label:{fontSize:"14px",fontWeight:500,color:"#19213D"},asterisk:{color:"#8F2C23",marginRight:"4px",fontSize:"16px",fontWeight:600},input:{width:"100%",padding:"8px 12px",borderRadius:"6px",border:"1px solid #E2E8F0",outline:"none",fontSize:"14px"},inputError:{border:"1px solid #8F2C23"},errorText:{margin:0,marginTop:"4px",fontSize:"12px",color:"#8F2C23"},textarea:{width:"100%",padding:"8px 12px",borderRadius:"6px",border:"1px solid #E2E8F0",outline:"none",fontSize:"14px",minHeight:"100px",maxHeight:"200px",overflowY:"auto",resize:"vertical"},footer:{display:"flex",justifyContent:"flex-end",gap:"12px",marginTop:"32px"},cancelBtn:{padding:"8px 16px",borderRadius:"6px",border:"1px solid #E2E8F0",backgroundColor:"transparent",color:"#64748B",fontSize:"14px",fontWeight:500,cursor:"pointer"},submitBtn:{padding:"8px 16px",borderRadius:"6px",border:"none",backgroundColor:"#2563EB",color:"#ffffff",fontSize:"14px",fontWeight:500,cursor:"pointer"},disabledBtn:{opacity:.5,cursor:"not-allowed"}};return q?t(h,{isLoading:q}):t("div",e({style:Z.overlay},{children:n("div",e({style:Z.modal},{children:[n("div",e({style:Z.header},{children:[n("div",{children:[t("h2",e({style:Z.title},{children:"Create Scope"})),t("p",e({style:Z.subtitle},{children:"Create a scope to group and manage rules."}))]}),t("button",e({onClick:g,style:Z.closeButton},{children:"✕"}))]})),n("div",{children:[n("div",e({style:Z.formGroup},{children:[n("label",e({style:Z.label},{children:[t("span",e({style:Z.asterisk},{children:"*"})),"Scope Name"]})),t("input",{type:"text",value:B,onChange:function(r){var o=r.target.value;if(o.length>50)return D(o.slice(0,50)),void G(function(r){return e(e({},r),{name:"Scope Name must be 50 characters or fewer"})});D(o),F.name&&G(function(r){return e(e({},r),{name:void 0})})},placeholder:"e.g. Global Learnings",style:e(e({},Z.input),F.name?Z.inputError:{})}),F.name&&t("p",e({style:Z.errorText},{children:F.name}))]})),n("div",e({style:Z.formGroup},{children:[n("label",e({style:Z.label},{children:[t("span",e({style:Z.asterisk},{children:"*"})),"Description"]})),t("input",{type:"text",value:R,onChange:function(r){var o=r.target.value;if(o.length>200)return z(o.slice(0,200)),void G(function(r){return e(e({},r),{description:"Description must be 200 characters or fewer"})});z(o),F.description&&G(function(r){return e(e({},r),{description:void 0})})},placeholder:"Enter short description for scope",style:e(e({},Z.input),F.description?Z.inputError:{})}),F.description&&t("p",e({style:Z.errorText},{children:F.description}))]})),n("div",e({style:e(e({},Z.formGroup),{gap:"12px"})},{children:[t("label",e({style:Z.label},{children:"Approval Settings"})),n("div",e({role:"radio","aria-checked":"approval_required"===W,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:"4px"},onClick:function(){return N("approval_required")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||N("approval_required")}},{children:[n("div",e({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[t("div",e({style:{display:"flex",height:"16px",width:"16px",flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("approval_required"===W?"#2563EB":"#CBD5E1")}},{children:"approval_required"===W&&t("div",{style:{height:"8px",width:"8px",borderRadius:"50%",backgroundColor:"#2563EB"}})})),t("span",e({style:{fontSize:"14px",fontWeight:500,color:"#19213D"}},{children:"Approval Required Before Publishing"}))]})),t("p",e({style:{margin:0,marginLeft:"24px",fontSize:"12px",color:"#666F8D"}},{children:"Learnings require approval before publishing."}))]})),"approval_required"===W&&t(c,{selectedApprovers:O,selectedGroupOfApprovers:M,onApproversChange:P,onGroupsChange:K}),Y&&t("p",e({style:{margin:0,marginLeft:"24px",fontSize:"12px",color:"#8F2C23"}},{children:Y})),n("div",e({role:"radio","aria-checked":"publish_without"===W,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:"4px"},onClick:function(){N("publish_without"),J("")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||(N("publish_without"),J(""))}},{children:[n("div",e({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[t("div",e({style:{display:"flex",height:"16px",width:"16px",flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("publish_without"===W?"#2563EB":"#CBD5E1")}},{children:"publish_without"===W&&t("div",{style:{height:"8px",width:"8px",borderRadius:"50%",backgroundColor:"#2563EB"}})})),t("span",e({style:{fontSize:"14px",fontWeight:500,color:"#19213D"}},{children:"Publish Without Approval"}))]})),t("p",e({style:{margin:0,marginLeft:"24px",fontSize:"12px",color:"#666F8D"}},{children:"Learnings can be published directly."}))]}))]}))]}),n("div",e({style:Z.footer},{children:[t("button",e({onClick:g,disabled:q,style:e(e({},Z.cancelBtn),q?Z.disabledBtn:{})},{children:"Cancel"})),t("button",e({onClick:function(){return r(void 0,void 0,void 0,function(){var e,r,t,n,l,a,s,c,u;return o(this,function(o){switch(o.label){case 0:if(f={},h=!0,B.trim()||(f.name="Scope Name is required",h=!1),R.trim()||(f.description="Description is required",h=!1),G(f),!h)return[2];J(""),A(!0),e=y?"genreRuleSet":"globalRuleSet",r="approval_required"===W,t=O.length>0||M.length>0,console.log("topicData",e),n={topic:e,customScopeGroupName:d.CUSTOM_SCOPE_GROUP_NAME,scopeDescription:R,parentScopeId:y?C:null,customScopeName:B,customScopeId:p(),createByName:null==Q?void 0:Q.firstname,createdBy:null==Q?void 0:Q.email,approvalRequired:r,appsecData:{application:null==X?void 0:X.applicationId,module:null==X?void 0:X.moduleId,roles:i(i([],r&&t?[{users:O.map(function(e){return e.email}),groups:M.map(function(e){return e._id}),role:null!==(s=null===(a=V.find(function(e){return"Learning Manager"===e.name}))||void 0===a?void 0:a._id)&&void 0!==s?s:""}]:[],!0),[{users:[null==Q?void 0:Q.email],groups:[],role:null!==(u=null===(c=V.find(function(e){return"Instant Learning Admin"===e.name}))||void 0===c?void 0:c._id)&&void 0!==u?u:""}],!1)}},o.label=1;case 1:return o.trys.push([1,3,4,5]),[4,v(n)];case 2:return o.sent(),g(),[3,5];case 3:return l=o.sent(),console.error("Error in submission",l),[3,5];case 4:return A(!1),[7];case 5:return[2]}var f,h})})},disabled:q,style:e(e({},Z.submitBtn),q?Z.disabledBtn:{})},{children:q?"Creating...":"Create Scope"}))]}))]}))}))};export{x as default};
2
2
  //# sourceMappingURL=CreateRuleSetLegacyModal.js.map