@e-llm-studio/instant-learning 1.3.0-alpha.177 → 1.3.0-alpha.178

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/dist/cjs/features/IL-OTJ/ILOTJTest.js +1 -1
  2. package/dist/cjs/features/IL-OTJ/_components/AccordianSection.js +1 -1
  3. package/dist/cjs/features/IL-OTJ/_components/ILPopup.js +1 -1
  4. package/dist/cjs/features/IL-OTJ/_components/_svg/EditPencilIcon.js +2 -0
  5. package/dist/cjs/features/IL-OTJ/_components/_svg/EditPencilIcon.js.map +1 -0
  6. package/dist/cjs/features/IL-OTJ/_components/atoms/Textarea/Textarea.js +1 -1
  7. package/dist/cjs/features/IL-OTJ/_components/molecules/Condition/ConditionList.js +1 -1
  8. package/dist/cjs/features/IL-OTJ/_components/molecules/Sections/SectionWrapper.js +1 -1
  9. package/dist/cjs/features/IL-OTJ/_components/organisms/ConditionSection/ConditionSection.js +1 -1
  10. package/dist/cjs/features/IL-OTJ/_components/organisms/TextSection/TextSection.js +1 -1
  11. package/dist/cjs/features/IL-OTJ/_components/templates/TrafficManager/CreateRule.js +1 -1
  12. package/dist/cjs/features/IL-marketplace/components/GuidelineLibraryCard.js +1 -1
  13. package/dist/cjs/features/IL-marketplace/components/GuidelineLibraryCard.module.css.js +1 -1
  14. package/dist/cjs/features/IL-marketplace/components/GuidelineStatusChip.js +1 -1
  15. package/dist/cjs/features/IL-marketplace/components/GuidelineStatusChip.module.css.js +1 -1
  16. package/dist/cjs/features/IL-marketplace/components/ILMarketPlacePublish/PublishToMarketplaceCompnent.js +1 -1
  17. package/dist/cjs/features/LearningManagement/LearningManagement.js +1 -1
  18. package/dist/cjs/features/LearningManagement/RuleContent/AddScopeModal.js +1 -1
  19. package/dist/cjs/features/LearningManagement/components/InstantLearningModalDynamic.js +1 -1
  20. package/dist/cjs/features/LearningManagement/store/useLMSConfigStore.js +1 -1
  21. package/dist/cjs/features/LearningManagement/store/useLearningTemplateStore.js +1 -1
  22. package/dist/cjs/index.js +1 -1
  23. package/dist/cjs/plugins/ValueTypes/Default/DefaultTeachMeRenderer.js +1 -1
  24. package/dist/cjs/schema-driven/BPARenderer.js +1 -1
  25. package/dist/cjs/schema-driven/components/PromptTextEditorField.js +1 -1
  26. package/dist/features/IL-OTJ/ILOTJTest.js +1 -1
  27. package/dist/features/IL-OTJ/_components/AccordianSection.js +1 -1
  28. package/dist/features/IL-OTJ/_components/ILPopup.js +1 -1
  29. package/dist/features/IL-OTJ/_components/_svg/EditPencilIcon.js +2 -0
  30. package/dist/features/IL-OTJ/_components/_svg/EditPencilIcon.js.map +1 -0
  31. package/dist/features/IL-OTJ/_components/atoms/Textarea/Textarea.js +1 -1
  32. package/dist/features/IL-OTJ/_components/molecules/Condition/ConditionList.js +1 -1
  33. package/dist/features/IL-OTJ/_components/molecules/Sections/SectionWrapper.js +1 -1
  34. package/dist/features/IL-OTJ/_components/organisms/ConditionSection/ConditionSection.js +1 -1
  35. package/dist/features/IL-OTJ/_components/organisms/TextSection/TextSection.js +1 -1
  36. package/dist/features/IL-OTJ/_components/templates/TrafficManager/CreateRule.js +1 -1
  37. package/dist/features/IL-marketplace/components/GuidelineLibraryCard.js +1 -1
  38. package/dist/features/IL-marketplace/components/GuidelineLibraryCard.module.css.js +1 -1
  39. package/dist/features/IL-marketplace/components/GuidelineStatusChip.js +1 -1
  40. package/dist/features/IL-marketplace/components/GuidelineStatusChip.module.css.js +1 -1
  41. package/dist/features/IL-marketplace/components/ILMarketPlacePublish/PublishToMarketplaceCompnent.js +1 -1
  42. package/dist/features/LearningManagement/LearningManagement.js +1 -1
  43. package/dist/features/LearningManagement/RuleContent/AddScopeModal.js +1 -1
  44. package/dist/features/LearningManagement/components/InstantLearningModalDynamic.js +1 -1
  45. package/dist/features/LearningManagement/store/useLMSConfigStore.js +1 -1
  46. package/dist/features/LearningManagement/store/useLearningTemplateStore.js +1 -1
  47. package/dist/index.js +1 -1
  48. package/dist/plugins/ValueTypes/Default/DefaultTeachMeRenderer.js +1 -1
  49. package/dist/schema-driven/BPARenderer.js +1 -1
  50. package/dist/schema-driven/components/PromptTextEditorField.js +1 -1
  51. package/dist/types/src/features/IL-OTJ/_components/AccordianSection.d.ts +1 -0
  52. package/dist/types/src/features/IL-OTJ/_components/AccordianSection.d.ts.map +1 -1
  53. package/dist/types/src/features/IL-OTJ/_components/ILPopup.d.ts.map +1 -1
  54. package/dist/types/src/features/IL-OTJ/_components/_svg/EditPencilIcon.d.ts +7 -0
  55. package/dist/types/src/features/IL-OTJ/_components/_svg/EditPencilIcon.d.ts.map +1 -0
  56. package/dist/types/src/features/IL-OTJ/_components/atoms/Textarea/Textarea.d.ts.map +1 -1
  57. package/dist/types/src/features/IL-OTJ/_components/molecules/Condition/ConditionList.d.ts +4 -1
  58. package/dist/types/src/features/IL-OTJ/_components/molecules/Condition/ConditionList.d.ts.map +1 -1
  59. package/dist/types/src/features/IL-OTJ/_components/molecules/Sections/SectionWrapper.d.ts +2 -1
  60. package/dist/types/src/features/IL-OTJ/_components/molecules/Sections/SectionWrapper.d.ts.map +1 -1
  61. package/dist/types/src/features/IL-OTJ/_components/organisms/ConditionSection/ConditionSection.d.ts +1 -1
  62. package/dist/types/src/features/IL-OTJ/_components/organisms/ConditionSection/ConditionSection.d.ts.map +1 -1
  63. package/dist/types/src/features/IL-OTJ/_components/organisms/TextSection/TextSection.d.ts +1 -1
  64. package/dist/types/src/features/IL-OTJ/_components/organisms/TextSection/TextSection.d.ts.map +1 -1
  65. package/dist/types/src/features/IL-OTJ/_components/templates/TrafficManager/CreateRule.d.ts.map +1 -1
  66. package/dist/types/src/features/IL-marketplace/components/GuidelineLibraryCard.d.ts.map +1 -1
  67. package/dist/types/src/features/IL-marketplace/components/GuidelineStatusChip.d.ts.map +1 -1
  68. package/dist/types/src/features/LearningManagement/LearningManagement.d.ts.map +1 -1
  69. package/dist/types/src/features/LearningManagement/components/InstantLearningModalDynamic.d.ts.map +1 -1
  70. package/dist/types/src/features/LearningManagement/store/useLMSConfigStore.d.ts +22 -0
  71. package/dist/types/src/features/LearningManagement/store/useLMSConfigStore.d.ts.map +1 -1
  72. package/dist/types/src/features/LearningManagement/store/useLearningTemplateStore.d.ts +2 -0
  73. package/dist/types/src/features/LearningManagement/store/useLearningTemplateStore.d.ts.map +1 -1
  74. package/dist/types/src/plugins/ValueTypes/Default/DefaultTeachMeRenderer.d.ts.map +1 -1
  75. package/dist/types/src/schema-driven/BPARenderer.d.ts.map +1 -1
  76. package/dist/types/src/schema-driven/components/PromptTextEditorField.d.ts.map +1 -1
  77. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- import{__awaiter as e,__generator as o,__assign as r,__spreadArray as t}from"tslib";import{jsxs as n,jsx as i,Fragment as l}from"react/jsx-runtime";import{useState as a,useRef as c,useEffect as s}from"react";import{useMutation as d}from"@tanstack/react-query";import{X as u,Loader2 as p}from"lucide-react";import{Toast as m}from"primereact/toast";import{v4 as f}from"uuid";import h from"../components/StationOnboarding/StationAutocomplete.js";import g from"./AddScopeApprovalSearchComponent.js";import v from"../components/ScopeSkeletonLoader.js";import{Input as b}from"@mui/material";import y from"../store/useAuthStore.js";import{useAppSecRolesStore as S}from"../store/useAppSecRolesStore.js";import C from"../store/useEnvStore.js";import{createRuleSet as w,inheritScope as x}from"../apis/scopeApis.js";import{useLearningTemplateStore as _}from"../store/useLearningTemplateStore.js";import{IL_CONFIG_CONSTANTS as k}from"../config.js";import{dt as D,interpolate as A}from"../store/useLMSConfigStore.js";import{MIDDLE_DRAWER_ADD_SCOPE_DT_PATH as R,MIDDLE_DRAWER_APPROVAL_SETTINGS_DT_PATH as I}from"../constants.js";var E=function(E){var B=E.isOpen,j=E.onClose,q=E.onCreate,F=E.hasGlobalRuleSet,L=E.parentId,z=E.isILMarketplace,P=void 0!==z&&z,T=E.childType,W=E.parentName,G=a(""),N=G[0],O=G[1],M=a(""),U=M[0],K=M[1],H=a({}),J=H[0],Q=H[1],V=c(null),X=y().user,Y=S(function(e){return e.roles}),Z=C(function(e){return e.rbacConfig}),$=a(!1),ee=$[0],oe=$[1],re=a(null),te=re[0],ne=re[1],ie=a("approval_required"),le=ie[0],ae=ie[1],ce=a([]),se=ce[0],de=ce[1],ue=a([]),pe=ue[0],me=ue[1],fe=a(!1);fe[0];var he=fe[1],ge=D("middleDrawer.subScope","Subscope"),ve="SUBSCOPE"===T?D("".concat(R,".subScopeName"),"".concat(ge," Name")):D("".concat(R,".scopeName"),"Scope Name"),be=d({mutationFn:function(r){return e(void 0,void 0,void 0,function(){var e;return o(this,function(o){switch(o.label){case 0:return[4,w(r,null!==(e=null==X?void 0:X.accessToken)&&void 0!==e?e:"")];case 1:return[2,o.sent()]}})})},onSuccess:function(r){return e(void 0,void 0,void 0,function(){var e,t;return o(this,function(o){return console.log("Rule Set Created Successfully",r),null===(e=V.current)||void 0===e||e.show({severity:"success",summary:"Scope Created",detail:(null===(t=null==r?void 0:r.data)||void 0===t?void 0:t.message)||"Scope created successfully",life:3e3}),[2]})})},onError:function(e){var o,r,t;console.error("Create scope failed",e),null===(o=V.current)||void 0===o||o.show({severity:"error",summary:"Creation Failed",detail:(null===(t=null===(r=null==e?void 0:e.response)||void 0===r?void 0:r.data)||void 0===t?void 0:t.message)||"There was an error creating the scope. Please try again."})}});be.data;var ye=be.isPending,Se=be.mutateAsync;if(s(function(){B&&(O(""),K(""),Q({}),ne(null),ae("approval_required"),de([]),me([]))},[B]),!B)return null;var Ce="SUBSCOPE"===T?D("".concat(R,".subScopeTitle"),D("middleDrawer.addSubScope","Add Subscope")):F?D("".concat(R,".title"),"Add Scope"):D("".concat(R,".globalTitle"),"Create Global Scope"),we="SUBSCOPE"===T?A(D("".concat(R,".subScopeSubtitle"),"This ".concat(ge.toLowerCase()," will be created under {parent} and will inherit its Knowledgebases by default.")),{parent:W||D("middleDrawer.scope","the selected scope")}):F?D("".concat(R,".subtitle"),"This scope will be created under Global scope and will inherit its learnings by default.",{parent:"Global"}):D("".concat(R,".globalSubtitle"),"This will be your Global scope that defines the base learnings shared across all stations."),xe="SUBSCOPE"===T?"Setting up your ".concat(ge,"…"):F?"Setting up your ".concat(D("middleDrawer.scope","Scope"),"…"):"Setting up your Global Scope…";return n("div",r({style:{position:"absolute",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0,0,0,0.3)"}},{children:[i(m,{ref:V}),ye||ee?i(v,{isLoading:ye||ee,title:xe,subtitle:we}):n("div",r({style:{position:"relative",width:600,borderRadius:12,backgroundColor:"white",padding:24,boxShadow:"0 25px 50px -12px rgba(0,0,0,0.25)"}},{children:[n("div",r({style:{marginBottom:24,display:"flex",alignItems:"flex-start",justifyContent:"space-between"}},{children:[n("div",{children:[i("h2",r({style:{margin:0,fontSize:18,fontWeight:500,color:"#19213D"}},{children:Ce})),i("p",r({style:{margin:"4px 0 0 0",fontSize:14,fontWeight:400,color:"#666F8D"}},{children:we}))]}),i("button",r({onClick:j,style:{background:"none",border:"none",padding:0,cursor:"pointer",color:"#9CA3AF"}},{children:i(u,{size:24})}))]})),n("div",r({style:{display:"flex",flexDirection:"column",gap:20}},{children:[n("div",r({style:{position:"relative",display:"flex",flexDirection:"column",gap:6}},{children:[n("label",r({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:[i("span",r({style:{marginRight:4,fontSize:16,fontWeight:600,color:"#8F2C23"}},{children:"*"})),ve]})),"Custom"===N?i(h,{value:U,onChange:function(e){if(e.length>50)return K(e.slice(0,50)),void Q(function(e){return r(r({},e),{name:"".concat(ve," must be 50 characters or fewer")})});K(e),Q(function(e){return r(r({},e),{name:void 0})})},onStationSelect:function(e){ne(e)},style:{border:J.name?"1px solid #8F2C23":void 0}}):i(b,{value:U,onChange:function(e){var o=e.target.value;if(o.length>50)return K(o.slice(0,50)),void Q(function(e){return r(r({},e),{name:"".concat(ve," must be 50 characters or fewer")})});K(o),Q(function(e){return r(r({},e),{name:void 0})})},style:{border:"1px solid ".concat(J.name?"#8F2C23":"#F0F2F5")},placeholder:P?"e.g. MarketPlace":"e.g. Global Learnings"}),J.name&&i("p",r({style:{margin:"4px 0 0 0",fontSize:12,color:"#8F2C23"}},{children:J.name}))]})),!P&&n("div",r({style:{display:"flex",flexDirection:"column",gap:12}},{children:[n("label",r({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:[i("span",r({style:{marginRight:4,fontSize:16,fontWeight:600,color:"#8F2C23"}},{children:"*"})),D("".concat(I,".title"),"Learning Approval Settings")]})),n("div",r({role:"radio","aria-checked":"approval_required"===le,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:4},onClick:function(){return ae("approval_required")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||ae("approval_required")}},{children:[n("div",r({style:{display:"flex",alignItems:"center",gap:8}},{children:[i("div",r({style:{display:"flex",height:16,width:16,flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("approval_required"===le?"#2563EB":"#CBD5E1")}},{children:"approval_required"===le&&i("div",{style:{height:8,width:8,borderRadius:"50%",backgroundColor:"#2563EB"}})})),i("span",r({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:D("".concat(I,".approvalRequired.title"),"Approval Required Before Publishing")}))]})),i("p",r({style:{margin:0,marginLeft:24,fontSize:12,color:"#666F8D"}},{children:D("".concat(I,".approvalRequired.subtitle"),"Learnings require approval before publishing.")}))]})),"approval_required"===le&&i(g,{selectedApprovers:se,selectedGroupOfApprovers:pe,onApproversChange:de,onGroupsChange:me}),n("div",r({role:"radio","aria-checked":"publish_without"===le,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:4},onClick:function(){ae("publish_without")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||ae("publish_without")}},{children:[n("div",r({style:{display:"flex",alignItems:"center",gap:8}},{children:[i("div",r({style:{display:"flex",height:16,width:16,flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("publish_without"===le?"#2563EB":"#CBD5E1")}},{children:"publish_without"===le&&i("div",{style:{height:8,width:8,borderRadius:"50%",backgroundColor:"#2563EB"}})})),i("span",r({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:D("".concat(I,".publishWithoutApproval.title"),"Publish Without Approval")}))]})),i("p",r({style:{margin:0,marginLeft:24,fontSize:12,color:"#666F8D"}},{children:D("".concat(I,".publishWithoutApproval.subtitle"),"Learnings can be published directly.")}))]}))]})),n("div",r({style:{marginTop:32,display:"flex",justifyContent:"flex-end",gap:12}},{children:[i("button",r({onClick:j,style:{borderRadius:6,border:"1px solid #E2E8F0",padding:"8px 16px",fontSize:14,fontWeight:500,color:"#64748B",backgroundColor:"white",cursor:"pointer",opacity:ye?.5:1},disabled:ye},{children:D("".concat(R,".cancel"),"Cancel")})),i("button",r({onClick:function(){return e(void 0,void 0,void 0,function(){var e,r,n,i,l,a,c,s,d,u,p,m,h,g,v,b,y,S,C,w,D;return o(this,function(o){switch(o.label){case 0:if(e={},U.trim()?U.length>50&&(e.name="".concat(ve," must be 50 characters or fewer")):e.name="".concat(ve," is required"),e.name)return Q(e),[2];o.label=1;case 1:return o.trys.push([1,8,9,10]),oe(!0),r="approval_required"===le,n=_.getState().backwardCompatibility,i=se.length>0||pe.length>0,l=n?{topic:F?"genreRuleSet":"globalRuleSet",customScopeGroupName:k.CUSTOM_SCOPE_GROUP_NAME,scopeDescription:U,parentScopeId:null,customScopeName:U,customScopeId:f(),createByName:(null==X?void 0:X.firstname)||"System",createdBy:(null==X?void 0:X.email)||"system@audacy.com",approvalRequired:r,appsecData:{application:null==Z?void 0:Z.applicationId,module:null==Z?void 0:Z.moduleId,roles:t(t([],r&&i?[{users:se.map(function(e){return e.email}),groups:pe.map(function(e){return e._id}),role:null!==(p=null===(u=Y.find(function(e){return"Learning Manager"===e.name}))||void 0===u?void 0:u._id)&&void 0!==p?p:""}]:[],!0),[{users:[null==X?void 0:X.email],groups:[],role:null!==(h=null===(m=Y.find(function(e){return"Instant Learning Admin"===e.name}))||void 0===m?void 0:m._id)&&void 0!==h?h:""}],!1)}}:{topic:F?"genreRuleSet":"globalRuleSet",scope_reference_id:null,scopeDescription:U,parentScopeId:null!=L?L:null,scopeName:U,scopeReferenceMetadata:{},scopeType:"Custom",applicationMappingId:_.getState().app_integration_id,approvalRequired:r,appsecData:{application:null==Z?void 0:Z.applicationId,module:null==Z?void 0:Z.moduleId,roles:t(t([],r&&i?[{users:se.map(function(e){return e.email}),groups:pe.map(function(e){return e._id}),role:null!==(v=null===(g=Y.find(function(e){return"Learning Manager"===e.name}))||void 0===g?void 0:g._id)&&void 0!==v?v:""}]:[],!0),[{users:[null==X?void 0:X.email],groups:[],role:null!==(y=null===(b=Y.find(function(e){return"Instant Learning Admin"===e.name}))||void 0===b?void 0:b._id)&&void 0!==y?y:""}],!1)}},console.log("Add Scope payload:",l),[4,Se(l)];case 2:if(a=o.sent(),c=null===(S=null==a?void 0:a.data)||void 0===S?void 0:S.scopeId,n||!c||!L)return[3,7];he(!0),o.label=3;case 3:return o.trys.push([3,5,6,7]),[4,x({source_scope_id:L,target_scope_id:c,application_mapping_id:_.getState().app_integration_id||"",is_copy_parent_variant_id:!1})];case 4:return o.sent(),[3,7];case 5:return s=o.sent(),console.error("Failed to inherit rules for the new scope:",s),[3,7];case 6:return he(!1),[7];case 7:return q(c),j(),[3,10];case 8:return d=o.sent(),console.error("An error occurred during scope creation.",d),null===(C=V.current)||void 0===C||C.show({severity:"error",summary:"Adding Scope Failed",detail:(null===(D=null===(w=null==d?void 0:d.response)||void 0===w?void 0:w.data)||void 0===D?void 0:D.message)||"There was an error creating the scope. Please try again."}),[3,10];case 9:return oe(!1),[7];case 10:return[2]}})})},style:{display:"flex",alignItems:"center",borderRadius:6,backgroundColor:"#2563EB",padding:"8px 16px",fontSize:14,fontWeight:500,color:"white",border:"none",cursor:"pointer",opacity:ye||"Custom"===N&&!te?.5:1},disabled:ye||"Custom"===N&&!te},{children:ye?n(l,{children:[i(p,{className:"animate-spin",style:{marginRight:8,height:16,width:16,color:"white"}}),"Creating..."]}):P?"SUBSCOPE"===T?"Create Subdomain":"Create Domain":D("".concat(R,".submitButton"),"Create Scope")}))]}))]}))]}))]}))};export{E as default};
1
+ import{__awaiter as e,__generator as o,__assign as r,__spreadArray as t}from"tslib";import{jsxs as n,jsx as i,Fragment as l}from"react/jsx-runtime";import{useState as a,useRef as c,useEffect as s}from"react";import{useMutation as d}from"@tanstack/react-query";import{X as u,Loader2 as p}from"lucide-react";import{Toast as m}from"primereact/toast";import{v4 as f}from"uuid";import h from"../components/StationOnboarding/StationAutocomplete.js";import g from"./AddScopeApprovalSearchComponent.js";import v from"../components/ScopeSkeletonLoader.js";import{Input as b}from"@mui/material";import y from"../store/useAuthStore.js";import{useAppSecRolesStore as S}from"../store/useAppSecRolesStore.js";import C from"../store/useEnvStore.js";import{createRuleSet as w,inheritScope as x}from"../apis/scopeApis.js";import{useLearningTemplateStore as _}from"../store/useLearningTemplateStore.js";import{IL_CONFIG_CONSTANTS as k}from"../config.js";import{dt as D,interpolate as A}from"../store/useLMSConfigStore.js";import{MIDDLE_DRAWER_ADD_SCOPE_DT_PATH as R,MIDDLE_DRAWER_APPROVAL_SETTINGS_DT_PATH as I}from"../constants.js";var E=function(E){var B=E.isOpen,j=E.onClose,q=E.onCreate,F=E.hasGlobalRuleSet,L=E.parentId,z=E.isILMarketplace,P=void 0!==z&&z,T=E.childType,W=E.parentName,G=a(""),N=G[0],O=G[1],M=a(""),U=M[0],K=M[1],H=a({}),J=H[0],Q=H[1],V=c(null),X=y().user,Y=S(function(e){return e.roles}),Z=C(function(e){return e.rbacConfig}),$=a(!1),ee=$[0],oe=$[1],re=a(null),te=re[0],ne=re[1],ie=a("approval_required"),le=ie[0],ae=ie[1],ce=a([]),se=ce[0],de=ce[1],ue=a([]),pe=ue[0],me=ue[1],fe=a(!1);fe[0];var he=fe[1],ge=D("middleDrawer.subScope","Subscope"),ve="SUBSCOPE"===T?D("".concat(R,".subScopeName"),"".concat(ge," Name")):D("".concat(R,".scopeName"),"Scope Name"),be=d({mutationFn:function(r){return e(void 0,void 0,void 0,function(){var e;return o(this,function(o){switch(o.label){case 0:return[4,w(r,null!==(e=null==X?void 0:X.accessToken)&&void 0!==e?e:"")];case 1:return[2,o.sent()]}})})},onSuccess:function(r){return e(void 0,void 0,void 0,function(){var e,t;return o(this,function(o){return console.log("Rule Set Created Successfully",r),null===(e=V.current)||void 0===e||e.show({severity:"success",summary:"Scope Created",detail:(null===(t=null==r?void 0:r.data)||void 0===t?void 0:t.message)||"Scope created successfully",life:3e3}),[2]})})},onError:function(e){var o,r,t;console.error("Create scope failed",e),null===(o=V.current)||void 0===o||o.show({severity:"error",summary:"Creation Failed",detail:(null===(t=null===(r=null==e?void 0:e.response)||void 0===r?void 0:r.data)||void 0===t?void 0:t.message)||"There was an error creating the scope. Please try again."})}});be.data;var ye=be.isPending,Se=be.mutateAsync;if(s(function(){B&&(O(""),K(""),Q({}),ne(null),ae("approval_required"),de([]),me([]))},[B]),!B)return null;var Ce="SUBSCOPE"===T?D("".concat(R,".subScopeTitle"),D("middleDrawer.addSubScope","Add Subscope")):F?D("".concat(R,".title"),"Add Scope"):D("".concat(R,".globalTitle"),"Create Global Scope"),we="SUBSCOPE"===T?A(D("".concat(R,".subScopeSubtitle"),"This ".concat(ge.toLowerCase()," will be created under {parent} and will inherit its Knowledgebases by default.")),{parent:W||D("middleDrawer.scope","the selected scope")}):F?D("".concat(R,".subtitle"),"This scope will be created under Global scope and will inherit its learnings by default.",{parent:"Global"}):D("".concat(R,".globalSubtitle"),"This will be your Global scope that defines the base learnings shared across all stations."),xe="SUBSCOPE"===T?"Setting up your ".concat(ge,"…"):F?"Setting up your ".concat(D("middleDrawer.scope","Scope"),"…"):"Setting up your Global Scope…";return n("div",r({style:{position:"absolute",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0,0,0,0.3)"}},{children:[i(m,{ref:V}),ye||ee?i(v,{isLoading:ye||ee,title:xe,subtitle:we}):n("div",r({style:{position:"relative",width:600,borderRadius:12,backgroundColor:"white",padding:24,boxShadow:"0 25px 50px -12px rgba(0,0,0,0.25)"}},{children:[n("div",r({style:{marginBottom:24,display:"flex",alignItems:"flex-start",justifyContent:"space-between"}},{children:[n("div",{children:[i("h2",r({style:{margin:0,fontSize:18,fontWeight:500,color:"#19213D"}},{children:Ce})),i("p",r({style:{margin:"4px 0 0 0",fontSize:14,fontWeight:400,color:"#666F8D"}},{children:we}))]}),i("button",r({onClick:j,style:{background:"none",border:"none",padding:0,cursor:"pointer",color:"#9CA3AF"}},{children:i(u,{size:24})}))]})),n("div",r({style:{display:"flex",flexDirection:"column",gap:20}},{children:[n("div",r({style:{position:"relative",display:"flex",flexDirection:"column",gap:6}},{children:[n("label",r({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:[i("span",r({style:{marginRight:4,fontSize:16,fontWeight:600,color:"#8F2C23"}},{children:"*"})),ve]})),"Custom"===N?i(h,{value:U,onChange:function(e){if(e.length>50)return K(e.slice(0,50)),void Q(function(e){return r(r({},e),{name:"".concat(ve," must be 50 characters or fewer")})});K(e),Q(function(e){return r(r({},e),{name:void 0})})},onStationSelect:function(e){ne(e)},style:{border:J.name?"1px solid #8F2C23":void 0}}):i(b,{value:U,onChange:function(e){var o=e.target.value;if(o.length>50)return K(o.slice(0,50)),void Q(function(e){return r(r({},e),{name:"".concat(ve," must be 50 characters or fewer")})});K(o),Q(function(e){return r(r({},e),{name:void 0})})},style:{border:"1px solid ".concat(J.name?"#8F2C23":"#F0F2F5")},placeholder:P?"e.g. MarketPlace":"e.g. Global Learnings"}),J.name&&i("p",r({style:{margin:"4px 0 0 0",fontSize:12,color:"#8F2C23"}},{children:J.name}))]})),!P&&n("div",r({style:{display:"flex",flexDirection:"column",gap:12}},{children:[n("label",r({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:[i("span",r({style:{marginRight:4,fontSize:16,fontWeight:600,color:"#8F2C23"}},{children:"*"})),D("".concat(I,".title"),"Learning Approval Settings")]})),n("div",r({role:"radio","aria-checked":"approval_required"===le,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:4},onClick:function(){return ae("approval_required")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||ae("approval_required")}},{children:[n("div",r({style:{display:"flex",alignItems:"center",gap:8}},{children:[i("div",r({style:{display:"flex",height:16,width:16,flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("approval_required"===le?"#2563EB":"#CBD5E1")}},{children:"approval_required"===le&&i("div",{style:{height:8,width:8,borderRadius:"50%",backgroundColor:"#2563EB"}})})),i("span",r({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:D("".concat(I,".approvalRequired.title"),"Approval Required Before Publishing")}))]})),i("p",r({style:{margin:0,marginLeft:24,fontSize:12,color:"#666F8D"}},{children:D("".concat(I,".approvalRequired.subtitle"),"Learnings require approval before publishing.")}))]})),"approval_required"===le&&i(g,{selectedApprovers:se,selectedGroupOfApprovers:pe,onApproversChange:de,onGroupsChange:me}),n("div",r({role:"radio","aria-checked":"publish_without"===le,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:4},onClick:function(){ae("publish_without")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||ae("publish_without")}},{children:[n("div",r({style:{display:"flex",alignItems:"center",gap:8}},{children:[i("div",r({style:{display:"flex",height:16,width:16,flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("publish_without"===le?"#2563EB":"#CBD5E1")}},{children:"publish_without"===le&&i("div",{style:{height:8,width:8,borderRadius:"50%",backgroundColor:"#2563EB"}})})),i("span",r({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:D("".concat(I,".publishWithoutApproval.title"),"Publish Without Approval")}))]})),i("p",r({style:{margin:0,marginLeft:24,fontSize:12,color:"#666F8D"}},{children:D("".concat(I,".publishWithoutApproval.subtitle"),"Learnings can be published directly.")}))]}))]})),n("div",r({style:{marginTop:32,display:"flex",justifyContent:"flex-end",gap:12}},{children:[i("button",r({onClick:j,style:{borderRadius:6,border:"1px solid #E2E8F0",padding:"8px 16px",fontSize:14,fontWeight:500,color:"#64748B",backgroundColor:"white",cursor:"pointer",opacity:ye?.5:1},disabled:ye},{children:D("".concat(R,".cancel"),"Cancel")})),i("button",r({onClick:function(){return e(void 0,void 0,void 0,function(){var e,r,n,i,l,a,c,s,d,u,p,m,h,g,v,b,y,S,C,w,D;return o(this,function(o){switch(o.label){case 0:if(e={},U.trim()?U.length>50&&(e.name="".concat(ve," must be 50 characters or fewer")):e.name="".concat(ve," is required"),e.name)return Q(e),[2];o.label=1;case 1:return o.trys.push([1,8,9,10]),oe(!0),r="approval_required"===le,n=_.getState().backwardCompatibility,i=se.length>0||pe.length>0,l=n?{topic:F?"genreRuleSet":"globalRuleSet",customScopeGroupName:k.CUSTOM_SCOPE_GROUP_NAME,scopeDescription:U,parentScopeId:null,customScopeName:U,customScopeId:f(),createByName:(null==X?void 0:X.firstname)||"System",createdBy:(null==X?void 0:X.email)||"system@audacy.com",approvalRequired:r,appsecData:{application:null==Z?void 0:Z.applicationId,module:null==Z?void 0:Z.moduleId,roles:t(t([],r&&i?[{users:se.map(function(e){return e.email}),groups:pe.map(function(e){return e._id}),role:null!==(p=null===(u=Y.find(function(e){return"Learning Manager"===e.name}))||void 0===u?void 0:u._id)&&void 0!==p?p:""}]:[],!0),[{users:[null==X?void 0:X.email],groups:[],role:null!==(h=null===(m=Y.find(function(e){return"Instant Learning Admin"===e.name}))||void 0===m?void 0:m._id)&&void 0!==h?h:""}],!1)}}:{topic:F?"genreRuleSet":"globalRuleSet",scope_reference_id:null,scopeDescription:U,parentScopeId:null!=L?L:null,scopeName:U,scopeReferenceMetadata:{},scopeType:"Custom",applicationMappingId:_.getState().app_integration_id,approvalRequired:r,appsecData:{application:null==Z?void 0:Z.applicationId,module:null==Z?void 0:Z.moduleId,roles:t(t([],r&&i?[{users:se.map(function(e){return e.email}),groups:pe.map(function(e){return e._id}),role:null!==(v=null===(g=Y.find(function(e){return"Learning Manager"===e.name}))||void 0===g?void 0:g._id)&&void 0!==v?v:""}]:[],!0),[{users:[null==X?void 0:X.email],groups:[],role:null!==(y=null===(b=Y.find(function(e){return"Instant Learning Admin"===e.name}))||void 0===b?void 0:b._id)&&void 0!==y?y:""}],!1)}},console.log("Add Scope payload:",l),[4,Se(l)];case 2:if(a=o.sent(),c=null===(S=null==a?void 0:a.data)||void 0===S?void 0:S.scopeId,n||!c||!L||P)return[3,7];he(!0),o.label=3;case 3:return o.trys.push([3,5,6,7]),[4,x({source_scope_id:L,target_scope_id:c,application_mapping_id:_.getState().app_integration_id||"",is_copy_parent_variant_id:!1})];case 4:return o.sent(),[3,7];case 5:return s=o.sent(),console.error("Failed to inherit rules for the new scope:",s),[3,7];case 6:return he(!1),[7];case 7:return q(c),j(),[3,10];case 8:return d=o.sent(),console.error("An error occurred during scope creation.",d),null===(C=V.current)||void 0===C||C.show({severity:"error",summary:"Adding Scope Failed",detail:(null===(D=null===(w=null==d?void 0:d.response)||void 0===w?void 0:w.data)||void 0===D?void 0:D.message)||"There was an error creating the scope. Please try again."}),[3,10];case 9:return oe(!1),[7];case 10:return[2]}})})},style:{display:"flex",alignItems:"center",borderRadius:6,backgroundColor:"#2563EB",padding:"8px 16px",fontSize:14,fontWeight:500,color:"white",border:"none",cursor:"pointer",opacity:ye||"Custom"===N&&!te?.5:1},disabled:ye||"Custom"===N&&!te},{children:ye?n(l,{children:[i(p,{className:"animate-spin",style:{marginRight:8,height:16,width:16,color:"white"}}),"Creating..."]}):P?"SUBSCOPE"===T?"Create Subdomain":"Create Domain":D("".concat(R,".submitButton"),"Create Scope")}))]}))]}))]}))]}))};export{E as default};
2
2
  //# sourceMappingURL=AddScopeModal.js.map