@e-llm-studio/instant-learning 1.0.10 → 1.0.12
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/dist/cjs/features/IL-OTJ/_components/MarkdownRenderer.js +2 -0
- package/dist/cjs/features/IL-OTJ/_components/MarkdownRenderer.js.map +1 -0
- package/dist/cjs/features/IL-OTJ/_components/MarkdownRenderer.module.css.js +2 -0
- package/dist/cjs/features/IL-OTJ/_components/MarkdownRenderer.module.css.js.map +1 -0
- package/dist/cjs/features/IL-OTJ/_components/templates/RuleComparison/RuleComparisonNew.js +1 -1
- package/dist/cjs/features/LearningManagement/AuditLog/AuditLog.js +1 -1
- package/dist/cjs/features/LearningManagement/LearningTemplateLayout.js +1 -1
- package/dist/cjs/features/LearningManagement/RBAC/AccessManagementPanel.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/assets/Search-result(add new).svg.js +2 -0
- package/dist/cjs/features/LearningManagement/assets/Search-result(add new).svg.js.map +1 -0
- package/dist/cjs/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.js +2 -0
- package/dist/cjs/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.js.map +1 -0
- package/dist/cjs/features/LearningManagement/components/StationOnboarding/StationOnboardModal.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/hooks/useLearningTemplateQueryParams.js +1 -1
- package/dist/cjs/features/LearningManagement/queries/useLMSConfigQuery.js +2 -0
- package/dist/cjs/features/LearningManagement/queries/useLMSConfigQuery.js.map +1 -0
- package/dist/cjs/features/LearningManagement/store/useLMSConfigStore.js +2 -0
- package/dist/cjs/features/LearningManagement/store/useLMSConfigStore.js.map +1 -0
- package/dist/cjs/features/LearningManagement/store/useLearningTemplateStore.js +1 -1
- package/dist/cjs/features/LearningManagement/store/usePermissionsStore.js +1 -1
- package/dist/features/IL-OTJ/_components/MarkdownRenderer.js +2 -0
- package/dist/features/IL-OTJ/_components/MarkdownRenderer.js.map +1 -0
- package/dist/features/IL-OTJ/_components/MarkdownRenderer.module.css.js +2 -0
- package/dist/features/IL-OTJ/_components/MarkdownRenderer.module.css.js.map +1 -0
- package/dist/features/IL-OTJ/_components/templates/RuleComparison/RuleComparisonNew.js +1 -1
- package/dist/features/LearningManagement/AuditLog/AuditLog.js +1 -1
- package/dist/features/LearningManagement/LearningTemplateLayout.js +1 -1
- package/dist/features/LearningManagement/RBAC/AccessManagementPanel.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/assets/Search-result(add new).svg.js +2 -0
- package/dist/features/LearningManagement/assets/Search-result(add new).svg.js.map +1 -0
- package/dist/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.js +2 -0
- package/dist/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.js.map +1 -0
- package/dist/features/LearningManagement/components/StationOnboarding/StationOnboardModal.js +1 -1
- package/dist/features/LearningManagement/constants.js +2 -0
- package/dist/features/LearningManagement/constants.js.map +1 -0
- package/dist/features/LearningManagement/hooks/useLearningTemplateQueryParams.js +1 -1
- package/dist/features/LearningManagement/queries/useLMSConfigQuery.js +2 -0
- package/dist/features/LearningManagement/queries/useLMSConfigQuery.js.map +1 -0
- package/dist/features/LearningManagement/store/useLMSConfigStore.js +2 -0
- package/dist/features/LearningManagement/store/useLMSConfigStore.js.map +1 -0
- package/dist/features/LearningManagement/store/useLearningTemplateStore.js +1 -1
- package/dist/features/LearningManagement/store/usePermissionsStore.js +1 -1
- package/dist/types/src/features/IL-OTJ/_components/MarkdownRenderer.d.ts +25 -0
- package/dist/types/src/features/IL-OTJ/_components/MarkdownRenderer.d.ts.map +1 -0
- package/dist/types/src/features/LearningManagement/AuditLog/AuditLog.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/LearningTemplateLayout.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/RBAC/AccessManagementPanel.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/components/StationOnboarding/BackwardStationOnboardModal.d.ts +12 -0
- package/dist/types/src/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.d.ts.map +1 -0
- package/dist/types/src/features/LearningManagement/components/StationOnboarding/StationOnboardModal.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/hooks/useLearningTemplateQueryParams.d.ts +2 -0
- package/dist/types/src/features/LearningManagement/hooks/useLearningTemplateQueryParams.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/queries/useLMSConfigQuery.d.ts +2 -0
- package/dist/types/src/features/LearningManagement/queries/useLMSConfigQuery.d.ts.map +1 -0
- package/dist/types/src/features/LearningManagement/store/useLMSConfigStore.d.ts +172 -0
- package/dist/types/src/features/LearningManagement/store/useLMSConfigStore.d.ts.map +1 -0
- package/dist/types/src/features/LearningManagement/store/useLearningTemplateStore.d.ts +2 -0
- package/dist/types/src/features/LearningManagement/store/useLearningTemplateStore.d.ts.map +1 -1
- package/dist/types/src/features/LearningManagement/store/usePermissionsStore.d.ts +2 -1
- package/dist/types/src/features/LearningManagement/store/usePermissionsStore.d.ts.map +1 -1
- package/dist/types/src/plugins/ValueTypes/Default/DefaultTeachMeRendererOld.d.ts +28 -0
- package/dist/types/src/plugins/ValueTypes/Default/DefaultTeachMeRendererOld.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),r=require("react"),n=require("react-markdown"),i=require("rehype-raw"),a=require("remark-gfm"),l=require("unist-util-visit"),s=require("./MarkdownRenderer.module.css.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=u(r),c=u(n),d=u(i),p=u(a);function f(){return function(t){l.visit(t,"text",function(t,r,n){var i;if(n&&"string"==typeof t.value&&t.value.includes("✓")){for(var a=t.value.split("✓"),l=[],u=0;u<a.length;u++){var o=a[u];o&&l.push({type:"text",value:o}),u<a.length-1&&l.push({type:"element",tagName:"span",properties:{"data-green-check":"true",className:[s.default.checkGreen]},children:[{type:"text",value:"✓"}]})}return(i=n.children).splice.apply(i,e.__spreadArray([r,1],l,!1)),r+l.length}})}}function m(){return function(e){l.visit(e,"element",function(e,t,r){if(r&&"p"===e.tagName)return e.children&&1===e.children.length&&"element"===e.children[0].type&&"details"===e.children[0].tagName?(r.children.splice(t,1,e.children[0]),t):void 0})}}var v=function(e){var t;return"text"===(null==e?void 0:e.type)&&/^\s*$/.test(null!==(t=e.value)&&void 0!==t?t:"")};function g(){return function(e){l.visit(e,"element",function(e){var t,r;if("details"===e.tagName&&"data-target"in(e.properties||{})){var n=e.children||[],i=0;"element"===(null===(t=n[0])||void 0===t?void 0:t.type)&&"summary"===(null===(r=n[0])||void 0===r?void 0:r.tagName)&&(i=1);var a=n.slice(i),l=a.filter(function(e){return!v(e)});if((1!==l.length||"element"!==l[0].type||!l[0].properties||!("data-popup"in l[0].properties)&&void 0===l[0].properties["data-popup"])&&!l.some(function(e){return"element"===(null==e?void 0:e.type)&&(null==e?void 0:e.properties)&&("data-popup"in e.properties||void 0!==e.properties["data-popup"])})){var s={type:"element",tagName:"div",properties:{"data-popup":""},children:a};e.children=n.slice(0,i).concat([s])}}})}}function h(){return function(e){l.visit(e,"element",function(e){var t,r;if("details"===e.tagName){var n=e.properties||{};if(!("data-inline"in n)&&!("data-target"in n)){var i=e.children||[],a=0;"element"===(null===(t=i[0])||void 0===t?void 0:t.type)&&"summary"===(null===(r=i[0])||void 0===r?void 0:r.tagName)&&(a=1);var l=i.slice(a),s=l.filter(function(e){return!v(e)});if((1!==s.length||"element"!==s[0].type||!s[0].properties||!("data-popup"in s[0].properties)&&void 0===s[0].properties["data-popup"])&&!s.some(function(e){return"element"===(null==e?void 0:e.type)&&(null==e?void 0:e.properties)&&("data-popup"in e.properties||void 0!==e.properties["data-popup"])})){var u={type:"element",tagName:"div",properties:{"data-popup":""},children:l};e.children=i.slice(0,a).concat([u])}}}})}}var y=function(r,n,i){if(!n||!n.trim())return r;var a=new RegExp("(".concat(n.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&"),")"),"gi");return r.split(a).map(function(r,n){return a.test(r)?t.jsx("mark",e.__assign({className:s.default.customHighlight,id:"customHighlight",style:i},{children:r}),n):r})};exports.default=function(n){var i=n.value,a=n.highlightedText,l=n.scrollTo,u=n.styles,v=void 0===u?{}:u,_=o.default.useRef(null),x=o.default.useRef(null);r.useEffect(function(){if(a){var e=setTimeout(function(){if(x.current){var e=x.current.querySelector("#customHighlight");e&&e.scrollIntoView({behavior:"smooth",block:l||"center"})}},225);return function(){return clearTimeout(e)}}},[a,i]);return t.jsx("div",e.__assign({ref:_,className:s.default.containerWrapper,style:v.containerWrapper},{children:t.jsx("div",e.__assign({className:s.default.mainCard,style:v.mainCard},{children:t.jsx("div",e.__assign({ref:x,className:s.default.scrollArea,style:v.scrollArea},{children:t.jsx(c.default,e.__assign({remarkPlugins:[p.default],rehypePlugins:[d.default,m,f,g,h],components:{details:function(r){r.node;var n=e.__rest(r,["node"]),i=!!n["data-inline"],a=!!n["data-target"],l=s.default.detailsBlock,u=v.detailsBlock;return i&&(l=s.default.detailsInline,u=v.detailsInline),a&&(l=s.default.detailsTarget,u=v.detailsTarget),t.jsxs("details",e.__assign({},n,{className:l,style:e.__assign(e.__assign({},u),n.style),onToggle:function(e){e.stopPropagation(),i&&function(e){var t=e.currentTarget,r=t.getAttribute("data-inline");if(r&&_.current){var n=_.current.querySelector('details[data-target="'.concat(r,'"]'));n&&(n.open=t.open)}}(e)}},{children:[a&&t.jsx("summary",{className:s.default.targetDummySummary,"aria-hidden":"true"}),n.children]}))},summary:function(r){r.node;var n=e.__rest(r,["node"]);return t.jsx("summary",e.__assign({className:s.default.summary,style:v.summary,onClick:function(e){return e.stopPropagation()}},n,{children:n.children}))},ul:function(r){return t.jsx("ul",e.__assign({className:s.default.list,style:v.list},r))},ol:function(r){return t.jsx("ol",e.__assign({className:s.default.list,style:v.list},r))},div:function(r){var n=r.node,i=e.__rest(r,["node"]),a=(null==n?void 0:n.properties)&&"data-popup"in n.properties;return t.jsx("div",e.__assign({},i,{className:a?s.default.popup:i.className,style:a?v.popup:i.style}))},span:function(r){var n,i=r.node,a=e.__rest(r,["node"]);return"true"===(null===(n=null==i?void 0:i.properties)||void 0===n?void 0:n["data-green-check"])?t.jsx("span",e.__assign({},a,{style:v.checkGreen})):t.jsx("span",e.__assign({},a))},p:function(e){var r=e.children,n=Array.isArray(r)?r:[r];return t.jsx("p",{children:n.map(function(e,r){return"string"==typeof e?y(e,a,v.customHighlight):t.jsx(o.default.Fragment,{children:e},r)})})},li:function(r){var n=r.children;try{var i=null==n?[]:Array.isArray(n)?n:[n];return t.jsx("li",e.__assign({style:{marginBottom:"4px"}},{children:null==i?void 0:i.map(function(e,r){return"string"==typeof e?y(e,a,v.customHighlight):t.jsx(o.default.Fragment,{children:e},r)})}))}catch(e){return console.error("Error rendering <li>:",e),t.jsx("li",{children:n})}},code:function(r){var n=r.children,i=e.__rest(r,["children"]);return t.jsx("code",e.__assign({},i,{children:n.map(function(e){return"string"==typeof e?y(e,a,v.customHighlight):e})}))}}},{children:i}))}))}))}))};
|
|
2
|
+
//# sourceMappingURL=MarkdownRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkdownRenderer.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});require("../../../node_modules/style-inject/dist/style-inject.es.js").default(".MarkdownRenderer-module_containerWrapper__XUtML{display:flex;gap:16px;height:42vh!important}.MarkdownRenderer-module_mainCard__BcSV-{background-color:#fff;border:1px solid #e5e7eb;border-radius:12px;box-shadow:0 1px 2px 0 #0000000d;flex:1;height:42vh;padding:20px}.MarkdownRenderer-module_scrollArea__oTyxO{height:100%;overflow-y:auto;padding-right:8px}.MarkdownRenderer-module_checkGreen__fc8ex{color:#16a34a!important;display:inline-block;font-weight:500;margin-right:4px;vertical-align:middle}.MarkdownRenderer-module_list__UqrN9{list-style-type:decimal;margin:4px 0;padding-left:20px}.MarkdownRenderer-module_customHighlight__KSBCr{background-color:#fef08a;border-radius:4px;color:#374151;padding:2px 4px}.MarkdownRenderer-module_detailsInline__Lqlyi{border-radius:8px;display:inline-block;margin:4px 0;position:relative;vertical-align:middle}.MarkdownRenderer-module_detailsInline__Lqlyi>:not(summary){display:none!important}.MarkdownRenderer-module_detailsTarget__MQk1n{display:block;margin:8px 0}.MarkdownRenderer-module_detailsBlock__iHvXn{border-radius:8px;margin:4px 0;position:relative;width:100%}.MarkdownRenderer-module_summary__2-IHg{align-items:center;color:#19213d;cursor:pointer;display:inline-flex;font-weight:500;gap:4px;padding:4px 0;user-select:none}.MarkdownRenderer-module_summary__2-IHg:hover{opacity:.9}.MarkdownRenderer-module_detailsBlock__iHvXn summary::-webkit-details-marker,.MarkdownRenderer-module_detailsInline__Lqlyi summary::-webkit-details-marker,.MarkdownRenderer-module_detailsTarget__MQk1n summary::-webkit-details-marker{display:none}.MarkdownRenderer-module_targetDummySummary__1L590{display:none!important}.MarkdownRenderer-module_popup__QuC1y{background:#6d28d91a;border:1px solid #6d28d9;border-radius:10px;box-shadow:0 8px 24px #0000000f;color:#6d28d9;display:block;font-size:12px;line-height:1.35;margin-top:6px;padding:12px;transition:opacity .2s ease,transform .2s ease}.MarkdownRenderer-module_detailsTarget__MQk1n .MarkdownRenderer-module_popup__QuC1y{opacity:0;transform:translateY(-4px)}.MarkdownRenderer-module_detailsTarget__MQk1n[open] .MarkdownRenderer-module_popup__QuC1y{opacity:1;transform:translateY(0)}.MarkdownRenderer-module_popup__QuC1y .MarkdownRenderer-module_popup__QuC1y{background:#0000!important;border:none!important;box-shadow:none!important;color:inherit!important;padding:0!important}"),exports.default={containerWrapper:"MarkdownRenderer-module_containerWrapper__XUtML",mainCard:"MarkdownRenderer-module_mainCard__BcSV-",scrollArea:"MarkdownRenderer-module_scrollArea__oTyxO",checkGreen:"MarkdownRenderer-module_checkGreen__fc8ex",list:"MarkdownRenderer-module_list__UqrN9",customHighlight:"MarkdownRenderer-module_customHighlight__KSBCr",detailsInline:"MarkdownRenderer-module_detailsInline__Lqlyi",detailsTarget:"MarkdownRenderer-module_detailsTarget__MQk1n",detailsBlock:"MarkdownRenderer-module_detailsBlock__iHvXn",summary:"MarkdownRenderer-module_summary__2-IHg",targetDummySummary:"MarkdownRenderer-module_targetDummySummary__1L590",popup:"MarkdownRenderer-module_popup__QuC1y"};
|
|
2
|
+
//# sourceMappingURL=MarkdownRenderer.module.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkdownRenderer.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),i=require("@mui/material"),r=require("lucide-react"),o=require("../../_svg/SparkleIcon.js"),s=require("@e-llm-studio/citation"),l=require("../../_svg/ButtonCognitiveIcon.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=function(e,n){if(!n)return null;var t=new RegExp("<".concat(e,"[^>]*>([\\s\\S]*?)<\\/").concat(e,">"),"i"),i=n.match(t);return i?i[1].replace(/\\n/g,"\n"):null},d=function(e,n,t){var i=100*e;if(!t)return{bg:"#FFFFFF",border:"#E2E8F0",badgeBg:"#F1F5F9",badgeBorder:"#CBD5E1",badgeText:"#64748B",highlightBg:"transparent",label:"Not Defined"};var r=function(e){return e.split("_").map(function(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}).join(" ")}(n);return i>=70?{bg:"#FEF2F2",border:"#FEE2E2",badgeBg:"#FEF2F2",badgeBorder:"#FECACA",badgeText:"#B91C1C",highlightBg:"#FECACA",label:r}:i>=40?{bg:"#FFFCF6",border:"#FFDD80",badgeBg:"#FEF9C3",badgeBorder:"#FEF08A",badgeText:"#A16207",highlightBg:"#FDDEB3",label:r}:{bg:"#FFFFFF",border:"#E2E8F0",badgeBg:"#F1F5F9",badgeBorder:"#CBD5E1",badgeText:"#64748B",highlightBg:"transparent",label:r}},p=a(t).default.forwardRef(function(t,r){var o=t.label,s=t.content,l=t.highlights,a=void 0===l?[]:l,c=t.styleVariant,d=t.isHighlighted,p=void 0!==d&&d,x=Array.isArray(s)?s.join("\n"):s||"",g="#B91C1C"===c.badgeText?{borderColor:"#EF4444",shadow:"rgba(239, 68, 68, 0.25)"}:"#A16207"===c.badgeText?{borderColor:"#F59E0B",shadow:"rgba(245, 158, 11, 0.25)"}:{borderColor:"#6366F1",shadow:"rgba(99, 102, 241, 0.25)"};return n.jsxs(i.Box,e.__assign({sx:{mb:1.5}},{children:[n.jsx(i.Typography,e.__assign({sx:{fontSize:"12px",color:"#19213D",mb:.5,fontWeight:500,lineHeight:"130%"}},{children:o})),n.jsx(i.Box,e.__assign({ref:r,sx:{p:"4px 12px",borderRadius:"6px",border:p?"1.5px solid ".concat(g.borderColor):"1px solid ".concat(c.border),boxShadow:p?"0px 0px 0px 2px ".concat(g.shadow):"none",bgcolor:c.bg,fontSize:"13px",color:"#0B0E1A",lineHeight:1.4,minHeight:"24px",display:"flex",alignItems:"center",whiteSpace:"pre-line",wordBreak:"break-word"}},{children:n.jsx(i.Box,{children:function(){if(!x)return n.jsx(i.Typography,e.__assign({sx:{color:"#94A3B8",fontSize:"12px",fontStyle:"italic"}},{children:"Not Defined"}));if(!a||0===a.length)return x;var t=a.filter(function(e){return e&&e.length>0}).map(function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")});if(0===t.length)return x;var r=new RegExp("(".concat(t.join("|"),")"),"gi");return x.split(r).map(function(t,r){return a.some(function(e){return e&&e.toLowerCase()===t.toLowerCase()})?n.jsx(i.Box,e.__assign({component:"span",sx:{bgcolor:c.highlightBg,borderRadius:"2px",px:"2px"}},{children:t}),r):t})}()})}))]}))}),x=function(t){var r=t.data,o=t.isSelected,s=t.isCognitiveOpen,a=t.onToggleCognitive,c=t.onClick,d=r.summaryText||r.description||"",p=d.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),x=p?d.replace(p[0],"").trim():d,g=!!p;return n.jsxs(i.Box,e.__assign({id:"variant-card-".concat(r.id),onClick:c,sx:{minWidth:"280px",maxWidth:"280px",p:2,m:.5,bgcolor:o?"#EFF6FF99":"#FFFFFF",borderRadius:"8px",cursor:"pointer",transition:"all 0.2s",display:"flex",flexDirection:"column",gap:1,flexShrink:0,opacity:r.isLoading?.7:1,border:o?"1.4px solid #2563EB":null,boxShadow:o?"none":"0px 2px 4px 0px #19213D14","&:hover":{borderColor:o?"#2563EB":"#CBD5E1",boxShadow:o?"none":"0px 4px 8px 0px #19213D1F"}}},{children:[n.jsx(i.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:1.5}},{children:r.isLoading?n.jsx(i.Skeleton,{variant:"rounded",width:80,height:20}):n.jsxs(i.Box,e.__assign({sx:{bgcolor:"#FEF2F2",color:"#B91C1C",fontSize:"11px",fontWeight:600,px:1,py:.5,borderRadius:"100px",border:"1px solid #FFE1E1"}},{children:[void 0!==r.similarity?r.similarity:0,"% Similarity"]}))})),n.jsxs(i.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:1}},{children:[n.jsxs(i.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"nowrap"}},{children:[n.jsx(i.Typography,e.__assign({title:r.title,sx:{fontWeight:500,fontSize:"14px",color:"#19213D",lineHeight:1.2,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"block"}},{children:r.title})),r.scope&&n.jsx(i.Box,e.__assign({sx:{flexShrink:0,fontSize:"10px",fontWeight:600,color:"#19213D",bgcolor:"#FFF",border:"1px solid #EDEFF2",px:.75,py:.25,borderRadius:"6px",lineHeight:1.4,whiteSpace:"nowrap"}},{children:r.scope}))]})),r.isLoading?n.jsxs(i.Box,{children:[n.jsx(i.Skeleton,{width:"90%"}),n.jsx(i.Skeleton,{width:"60%"})]}):n.jsxs(i.Box,e.__assign({title:x,sx:{display:"flex",flexDirection:"column",gap:.5}},{children:[n.jsx(i.Typography,e.__assign({sx:{fontWeight:400,fontSize:"13px",color:"#666F8D",lineHeight:1.4,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis"}},{children:x})),g&&n.jsxs(i.Box,e.__assign({onClick:function(e){e.stopPropagation(),o||c(),a()},sx:{display:"inline-flex",alignItems:"center",alignSelf:"flex-start",gap:"4px",padding:"2px 6px",borderRadius:"4px",cursor:"pointer",transition:"all 0.2s ease",marginLeft:"-4px","&:hover":{backgroundColor:"#F1F5F9"}}},{children:[n.jsx("div",e.__assign({style:{width:"13px",height:"13px",display:"flex",alignItems:"center"}},{children:n.jsx(l.ButtonCognitiveIcon,{})})),n.jsx("svg",e.__assign({width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#4B5563",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:o&&s?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s ease"}},{children:n.jsx("path",{d:"M6 9l6 6 6-6"})}))]}))]}))]}))]}))};exports.default=function(a){var g,h,u=a.proposedRule,f=a.variants,_=void 0===f?[]:f,y=a.onSelectVariant;a.onAddAsVariant;var b=a.onSkip,m=a.onBack,v=a.targetVariantId,w=a.highlightedField,F=t.useState(v||null),B=F[0],j=F[1],C=t.useState(!1),E=C[0],S=C[1],k=t.useState(null),A=k[0],R=k[1],T=t.useRef(null),L=t.useRef(null);t.useEffect(function(){if(v&&j(v),R(null!=w?w:null),w){var e=setTimeout(function(){return R(null)},6e3);return function(){return clearTimeout(e)}}},[v,w]);var D=function(e){T.current&&T.current.scrollBy({left:"left"===e?-300:300,behavior:"smooth"})},I=t.useMemo(function(){return e.__spreadArray([],_,!0).sort(function(e,n){return(n.similarity||0)-(e.similarity||0)})},[_]),W=t.useMemo(function(){if(B){var e=String(B).trim();return _.find(function(n){return n.id&&String(n.id).trim()===e})||I[0]}return I.length>0?I[0]:null},[B,_,I]);t.useEffect(function(){if(B&&T.current){var e=B.trim();setTimeout(function(){var n=document.getElementById("variant-card-".concat(e)),t=T.current;if(n&&t){var i=n.offsetLeft-t.offsetLeft-t.clientWidth/2+n.clientWidth/2;t.scrollTo({left:i,behavior:"smooth"})}},150)}},[B,I]);var z=W||{title:"",scope:"",description:"",wta:"",wnta:"",variantType:"Default"},H=null==W?void 0:W.analysis,M=(null===(h=null===(g=null==H?void 0:H.rule_difference_comparison)||void 0===g?void 0:g.summary)||void 0===h?void 0:h.overall_summary)||"",O=M.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),q=!!O,V=O?O[1]:"",N=c("reason",V)||"",P=c("gap",V)||"",U=c("relevance_score",V)||"",Y=t.useMemo(function(){return{ul:function(t){t.node;var i=e.__rest(t,["node"]);return n.jsx("ol",e.__assign({},i,{style:{paddingLeft:"1.25rem",listStyleType:"decimal",margin:0}}))},li:function(t){t.node;var i=e.__rest(t,["node"]);return n.jsx("li",e.__assign({},i,{style:{marginBottom:"4px",listStyleType:"decimal"}},{children:i.children}))},ol:function(t){t.node;var i=e.__rest(t,["node"]);return n.jsx("li",e.__assign({},i,{style:{marginBottom:"4px",listStyleType:"decimal"}},{children:i.children}))},a:function(t){var i=t.href,r=t.children,o=e.__rest(t,["href","children"]);if(!i)return n.jsx("a",e.__assign({},o,{children:r}));var s=i||"";try{s=decodeURIComponent(i)}catch(e){console.error("Error decoding href",e)}if(s.includes("variant_id=")){var l="",a="",c=s.match(/variant_id=([^?&]+)/);c&&(l=c[1]);var d=s.match(/field_name=([^&]+)/);return d&&(a=d[1]),n.jsxs("button",e.__assign({type:"button",onClick:function(e){e.preventDefault(),e.stopPropagation(),j(l),R(a),setTimeout(function(){return R(null)},6e3)},style:{background:"none",border:"none",outline:"none",borderRadius:"6px",padding:"1px 4px",color:"#0F172A",cursor:"pointer",fontSize:"13px",fontWeight:500,display:"inline-flex",alignItems:"center",gap:"2px",margin:"0 1px",verticalAlign:"baseline",textDecoration:"none",boxShadow:"none",WebkitAppearance:"none",MozAppearance:"none"},title:"View Comparison"},{children:[r,n.jsx("svg",e.__assign({width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:n.jsx("path",{d:"M10.2082 8.67708H2.0415M2.0415 8.67708L4.08317 6.63542M2.0415 8.67708L4.08317 10.7188M2.0415 3.57292H10.2082M10.2082 3.57292L8.1665 1.53125M10.2082 3.57292L8.1665 5.61458",stroke:"#0F172A",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}))]}))}return n.jsx("a",e.__assign({href:i,target:"_blank",rel:"noopener noreferrer",style:{color:"#7C3AED"}},o,{children:r}))}}},[]);t.useEffect(function(){!B&&!v&&I.length>0&&!I[0].isLoading&&j(I[0].id)},[I,B,v]);var $=t.useRef(null),J=t.useState([]),X=J[0],G=J[1],K=t.useState(!1),Q=K[0],Z=K[1],ee=t.useState(!1),ne=ee[0],te=ee[1];t.useEffect(function(){var e=T.current;if(e){var n=function(){Z(e.scrollLeft>0),te(e.scrollLeft+e.clientWidth<e.scrollWidth-1)};return n(),e.addEventListener("scroll",n),window.addEventListener("resize",n),function(){e.removeEventListener("scroll",n),window.removeEventListener("resize",n)}}},[I]);var ie={title:t.useRef(null),scope:t.useRef(null),description:t.useRef(null),wta:t.useRef(null),wnta:t.useRef(null)},re={title:t.useRef(null),scope:t.useRef(null),description:t.useRef(null),wta:t.useRef(null),wnta:t.useRef(null)};t.useEffect(function(){if(A){var e="when_to_apply"===A?"wta":"when_not_to_apply"===A?"wnta":A,n=ie[e]||re[e];n&&n.current&&setTimeout(function(){n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}},[A]);var oe=function(e){var n,t,i,r,o,s=null===(n=null==H?void 0:H.rule_difference_comparison)||void 0===n?void 0:n.fields,l="when_to_apply"===e?"wta":"when_not_to_apply"===e?"wnta":e,a=!(!u[l]&&!z[l]);if(!s||!s[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var c=s[e];if(c.mappings){var d=c.mappings[0]||{};return{score:c.score,relation:d.relation||"",highlightsA:(null===(t=d.highlights)||void 0===t?void 0:t.ruleA_spans)||[],highlightsB:(null===(i=d.highlights)||void 0===i?void 0:i.ruleB_spans)||[],hasContent:a}}return{score:c.score,relation:c.relation||"",highlightsA:(null===(r=c.highlights)||void 0===r?void 0:r.ruleA_spans)||[],highlightsB:(null===(o=c.highlights)||void 0===o?void 0:o.ruleB_spans)||[],hasContent:a}},se=["title","scope","description","when_to_apply","when_not_to_apply"],le=function(){if($.current){var e=$.current.getBoundingClientRect(),n=[];se.forEach(function(t){var i="when_to_apply"===t?ie.wta:"when_not_to_apply"===t?ie.wnta:ie[t],r="when_to_apply"===t?re.wta:"when_not_to_apply"===t?re.wnta:re[t];if(i.current&&r.current){i.current.style.height="auto",r.current.style.height="auto";var o=i.current.getBoundingClientRect(),s=r.current.getBoundingClientRect(),l=Math.max(o.height,s.height);i.current.style.height="".concat(l,"px"),r.current.style.height="".concat(l,"px");var a=i.current.getBoundingClientRect(),c=r.current.getBoundingClientRect(),p=oe(t),x=d(p.score,p.relation,p.hasContent),g=a.top+a.height/2-e.top;n.push({x1:a.right-e.left,y1:g,x2:c.left-e.left,y2:g,style:x})}}),G(n)}};return t.useEffect(function(){var e=setTimeout(le,250);window.addEventListener("resize",le);var n=null;return $.current&&(n=new ResizeObserver(function(){window.requestAnimationFrame(function(){le()})})).observe($.current),function(){clearTimeout(e),window.removeEventListener("resize",le),n&&n.disconnect()}},[u,z,H,E]),n.jsxs(i.Box,e.__assign({sx:{display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif',overflow:"hidden"}},{children:[n.jsxs(i.Box,e.__assign({sx:{px:2,py:1,display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#FFFFFF",border:"1.5px solid #EEF0F4"}},{children:[n.jsxs(i.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:1}},{children:[n.jsx(i.IconButton,e.__assign({onClick:m,size:"small"},{children:n.jsx(r.ArrowLeft,{})})),n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:450,color:"#0F172A"}},{children:"Learning Comparison"}))]})),n.jsx(i.IconButton,e.__assign({onClick:b,size:"small"},{children:n.jsx(i.Box,e.__assign({sx:{fontSize:24,lineHeight:.5}},{children:"×"}))}))]})),I.length>1&&n.jsxs(i.Box,e.__assign({sx:{px:3,pb:.25}},{children:[n.jsxs(i.Box,e.__assign({sx:{display:"flex",alignItems:"center",justifyContent:"space-between",py:1}},{children:[n.jsx(i.Typography,e.__assign({sx:{fontSize:"13px",color:"#475569"}},{children:"Choose the Learning you want to compare with the rule you are creating."})),n.jsxs(i.Box,e.__assign({sx:{display:"flex",gap:.5,flexShrink:0,ml:1}},{children:[n.jsx(i.IconButton,e.__assign({onClick:function(){return D("left")},size:"small",disabled:!Q},{children:n.jsx(r.ArrowLeft,{size:18})})),n.jsx(i.IconButton,e.__assign({onClick:function(){return D("right")},size:"small",disabled:!ne},{children:n.jsx(r.ArrowRight,{size:18})}))]}))]})),n.jsx(i.Box,e.__assign({ref:T,sx:{display:"flex",gap:1,overflowX:"auto",pb:.05,"&::-webkit-scrollbar":{height:"6px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"transparent",borderRadius:"10px"},"&::-webkit-scrollbar-thumb:hover":{background:"transparent"}}},{children:I.map(function(e){return n.jsx(x,{data:e,isSelected:(null==W?void 0:W.id)===e.id,isCognitiveOpen:E,onToggleCognitive:function(){S(function(e){var n=!e;return n&&L.current&&L.current.scrollTo({top:0,behavior:"smooth"}),n})},onClick:function(){return j((n=e).id),y(n),void S(!1);var n}},e.id)})}))]})),n.jsx(i.Box,e.__assign({ref:L,sx:{flex:1,overflowY:"auto",py:1.5,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",borderTop:M&&q&&E?"none":"1.5px solid #EEF0F4"}},{children:n.jsxs(i.Box,e.__assign({sx:{display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"}},{children:[M&&q&&E&&n.jsx(i.Box,e.__assign({sx:{width:"100%",pb:1,animation:"fadeIn 0.2s ease-out","& > div > button":{display:"none !important"},"& > div > div":{marginTop:"0px"}}},{children:n.jsx(s.CognitiveDecisioningCard,{headerIcon:n.jsx(l.ButtonCognitiveIcon,{}),reasoning:N,gap:P,score:U,mdComponents:Y,isOpen:!0,onToggle:function(){return S(!1)}})})),n.jsxs(i.Box,e.__assign({ref:$,sx:{display:"grid",gridTemplateColumns:"1fr auto 1fr",gap:"60px",maxWidth:"1200px",width:"100%",position:"relative"}},{children:[n.jsx("svg",e.__assign({style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",pointerEvents:"none",zIndex:10}},{children:X.map(function(t,r){var o=(t.x1+t.x2)/2,s=t.y1;return n.jsxs("g",{children:[n.jsx("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.badgeBorder,strokeWidth:"1"}),n.jsx("foreignObject",e.__assign({x:o-125,y:s-16,width:"250",height:"32"},{children:n.jsx(i.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:n.jsx(i.Box,e.__assign({sx:{fontSize:"11px",bgcolor:t.style.badgeBg,color:t.style.badgeText,border:"1px solid ".concat(t.style.badgeBorder),borderRadius:"12px",px:1.5,py:.25,fontWeight:500,textAlign:"center",whiteSpace:"nowrap"}},{children:t.style.label}))}))}))]},r)})})),n.jsxs(i.Box,e.__assign({sx:{border:"1px dashed #B0B0B0",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)",minWidth:0}},{children:[n.jsx(i.Box,e.__assign({sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px dashed #B0B0B0",borderRadius:"8px 8px 0 0",display:"flex",minHeight:"24px",alignItems:"center"}},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#19213D"}},{children:"Learning You’re Creating"}))})),n.jsx(i.Box,e.__assign({sx:{p:"12px",display:"flex",flexDirection:"column"}},{children:se.map(function(e){var t=oe(e),i=d(t.score,t.relation,t.hasContent),r="when_to_apply"===e?ie.wta:"when_not_to_apply"===e?ie.wnta:ie[e],o=u["when_to_apply"===e?"wta":"when_not_to_apply"===e?"wnta":e];return n.jsx(p,{ref:r,label:"when_to_apply"===e?"When to apply":"when_not_to_apply"===e?"When NOT to Apply":e.charAt(0).toUpperCase()+e.slice(1).replace("_"," "),content:o,highlights:t.highlightsA,styleVariant:i,isHighlighted:A===e},"left-".concat(e))})}))]})),n.jsx(i.Box,{sx:{width:"1px"}}),n.jsxs(i.Box,e.__assign({sx:{border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0}},{children:[n.jsx(i.Box,e.__assign({sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"24px",display:"flex",alignItems:"center"}},{children:n.jsxs(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",display:"flex",alignItems:"center",gap:1}},{children:[n.jsx("div",e.__assign({style:{width:"18px",height:"18px",display:"flex",alignItems:"center",justifyContent:"center"}},{children:n.jsx(o.default,{})})),"Existing Learning"]}))})),n.jsx(i.Box,e.__assign({sx:{p:"12px",display:"flex",flexDirection:"column"}},{children:se.map(function(e){var t=oe(e),i=d(t.score,t.relation,t.hasContent),r="when_to_apply"===e?re.wta:"when_not_to_apply"===e?re.wnta:re[e],o=z["when_to_apply"===e?"wta":"when_not_to_apply"===e?"wnta":e];return n.jsx(p,{ref:r,label:"when_to_apply"===e?"When to apply":"when_not_to_apply"===e?"When NOT to Apply":e.charAt(0).toUpperCase()+e.slice(1).replace("_"," "),content:o,highlights:t.highlightsB,styleVariant:i,isHighlighted:A===e},"right-".concat(e))})}))]}))]}))]}))}))]}))};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),i=require("@mui/material"),r=require("lucide-react"),o=require("../../_svg/SparkleIcon.js"),s=require("@e-llm-studio/citation"),l=require("../../_svg/ButtonCognitiveIcon.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=function(e,n){if(!n)return null;var t=new RegExp("<".concat(e,"[^>]*>([\\s\\S]*?)<\\/").concat(e,">"),"i"),i=n.match(t);return i?i[1].replace(/\\n/g,"\n"):null},d=function(e,n,t){var i=100*e;if(!t)return{bg:"#FFFFFF",border:"#E2E8F0",badgeBg:"#F1F5F9",badgeBorder:"#CBD5E1",badgeText:"#64748B",highlightBg:"transparent",label:"Not Defined"};var r=function(e){return e.split("_").map(function(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}).join(" ")}(n);return i>=70?{bg:"#FEF2F2",border:"#FEE2E2",badgeBg:"#FEF2F2",badgeBorder:"#FECACA",badgeText:"#B91C1C",highlightBg:"#FECACA",label:r}:i>=40?{bg:"#FFFCF6",border:"#FFDD80",badgeBg:"#FEF9C3",badgeBorder:"#FEF08A",badgeText:"#A16207",highlightBg:"#FDDEB3",label:r}:{bg:"#FFFFFF",border:"#E2E8F0",badgeBg:"#F1F5F9",badgeBorder:"#CBD5E1",badgeText:"#64748B",highlightBg:"transparent",label:r}},p=a(t).default.forwardRef(function(t,r){var o=t.label,s=t.content,l=t.highlights,a=void 0===l?[]:l,c=t.styleVariant,d=t.isHighlighted,p=void 0!==d&&d,x=Array.isArray(s)?s.join("\n"):s||"",g="#B91C1C"===c.badgeText?{borderColor:"#EF4444",shadow:"rgba(239, 68, 68, 0.25)"}:"#A16207"===c.badgeText?{borderColor:"#F59E0B",shadow:"rgba(245, 158, 11, 0.25)"}:{borderColor:"#6366F1",shadow:"rgba(99, 102, 241, 0.25)"};return n.jsxs(i.Box,e.__assign({sx:{mb:1.5}},{children:[n.jsx(i.Typography,e.__assign({sx:{fontSize:"12px",color:"#19213D",mb:.5,fontWeight:500,lineHeight:"130%"}},{children:o})),n.jsx(i.Box,e.__assign({ref:r,sx:{p:"4px 12px",borderRadius:"6px",border:p?"1.5px solid ".concat(g.borderColor):"1px solid ".concat(c.border),boxShadow:p?"0px 0px 0px 2px ".concat(g.shadow):"none",bgcolor:c.bg,fontSize:"13px",color:"#0B0E1A",lineHeight:1.4,minHeight:"24px",display:"flex",alignItems:"center",whiteSpace:"pre-line",wordBreak:"break-word"}},{children:n.jsx(i.Box,{children:function(){if(!x)return n.jsx(i.Typography,e.__assign({sx:{color:"#94A3B8",fontSize:"12px",fontStyle:"italic"}},{children:"Not Defined"}));if(!a||0===a.length)return x;var t=a.filter(function(e){return e&&e.length>0}).map(function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")});if(0===t.length)return x;var r=new RegExp("(".concat(t.join("|"),")"),"gi");return x.split(r).map(function(t,r){return a.some(function(e){return e&&e.toLowerCase()===t.toLowerCase()})?n.jsx(i.Box,e.__assign({component:"span",sx:{bgcolor:c.highlightBg,borderRadius:"2px",px:"2px"}},{children:t}),r):t})}()})}))]}))}),x=function(t){var r=t.data,o=t.isSelected,s=t.isCognitiveOpen,a=t.onToggleCognitive,c=t.onClick,d=r.summaryText||r.description||"",p=d.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),x=p?d.replace(p[0],"").trim():d,g=!!p;return n.jsxs(i.Box,e.__assign({id:"variant-card-".concat(r.id),onClick:c,sx:{minWidth:"280px",maxWidth:"280px",p:2,m:.5,bgcolor:o?"#EFF6FF99":"#FFFFFF",borderRadius:"8px",cursor:"pointer",transition:"all 0.2s",display:"flex",flexDirection:"column",gap:1,flexShrink:0,opacity:r.isLoading?.7:1,border:o?"1.4px solid #2563EB":null,boxShadow:o?"none":"0px 2px 4px 0px #19213D14","&:hover":{borderColor:o?"#2563EB":"#CBD5E1",boxShadow:o?"none":"0px 4px 8px 0px #19213D1F"}}},{children:[n.jsx(i.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:1.5}},{children:r.isLoading?n.jsx(i.Skeleton,{variant:"rounded",width:80,height:20}):n.jsxs(i.Box,e.__assign({sx:{bgcolor:"#FEF2F2",color:"#B91C1C",fontSize:"11px",fontWeight:600,px:1,py:.5,borderRadius:"100px",border:"1px solid #FFE1E1"}},{children:[void 0!==r.similarity?r.similarity:0,"% Similarity"]}))})),n.jsxs(i.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:1}},{children:[n.jsxs(i.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"nowrap"}},{children:[n.jsx(i.Typography,e.__assign({title:r.title,sx:{fontWeight:500,fontSize:"14px",color:"#19213D",lineHeight:1.2,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",display:"block"}},{children:r.title})),r.scope&&n.jsx(i.Box,e.__assign({sx:{flexShrink:0,fontSize:"10px",fontWeight:600,color:"#19213D",bgcolor:"#FFF",border:"1px solid #EDEFF2",px:.75,py:.25,borderRadius:"6px",lineHeight:1.4,whiteSpace:"nowrap"}},{children:r.scope}))]})),r.isLoading?n.jsxs(i.Box,{children:[n.jsx(i.Skeleton,{width:"90%"}),n.jsx(i.Skeleton,{width:"60%"})]}):n.jsxs(i.Box,e.__assign({title:x,sx:{display:"flex",flexDirection:"column",gap:.5}},{children:[n.jsx(i.Typography,e.__assign({sx:{fontWeight:400,fontSize:"13px",color:"#666F8D",lineHeight:1.4,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis"}},{children:x})),g&&n.jsxs(i.Box,e.__assign({onClick:function(e){e.stopPropagation(),o||c(),a()},sx:{display:"inline-flex",alignItems:"center",alignSelf:"flex-start",gap:"4px",padding:"2px 6px",borderRadius:"4px",cursor:"pointer",transition:"all 0.2s ease",marginLeft:"-4px","&:hover":{backgroundColor:"#F1F5F9"}}},{children:[n.jsx("div",e.__assign({style:{width:"13px",height:"13px",display:"flex",alignItems:"center"}},{children:n.jsx(l.ButtonCognitiveIcon,{})})),n.jsx("svg",e.__assign({width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#4B5563",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:o&&s?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s ease"}},{children:n.jsx("path",{d:"M6 9l6 6 6-6"})}))]}))]}))]}))]}))};exports.default=function(a){var g,h,u=a.proposedRule,f=a.variants,_=void 0===f?[]:f,y=a.onSelectVariant;a.onAddAsVariant;var b=a.onSkip,m=a.onBack,v=a.targetVariantId,w=a.highlightedField,F=t.useState(v||null),B=F[0],j=F[1],C=t.useState(!1),E=C[0],S=C[1],k=t.useState(null),A=k[0],R=k[1],T=t.useRef(null),L=t.useRef(null);t.useEffect(function(){if(v&&j(v),R(null!=w?w:null),w){var e=setTimeout(function(){return R(null)},6e3);return function(){return clearTimeout(e)}}},[v,w]);var D=function(e){T.current&&T.current.scrollBy({left:"left"===e?-300:300,behavior:"smooth"})},I=t.useMemo(function(){return e.__spreadArray([],_,!0).sort(function(e,n){return(n.similarity||0)-(e.similarity||0)})},[_]),W=t.useMemo(function(){if(B){var e=String(B).trim();return _.find(function(n){return n.id&&String(n.id).trim()===e})||I[0]}return I.length>0?I[0]:null},[B,_,I]);t.useEffect(function(){if(B&&T.current){var e=B.trim();setTimeout(function(){var n=document.getElementById("variant-card-".concat(e)),t=T.current;if(n&&t){var i=n.offsetLeft-t.offsetLeft-t.clientWidth/2+n.clientWidth/2;t.scrollTo({left:i,behavior:"smooth"})}},150)}},[B,I]);var z=W||{title:"",scope:"",description:"",wta:"",wnta:"",variantType:"Default"},H=null==W?void 0:W.analysis,M=(null===(h=null===(g=null==H?void 0:H.rule_difference_comparison)||void 0===g?void 0:g.summary)||void 0===h?void 0:h.overall_summary)||"",O=M.match(/<ai_reasoning>([\s\S]*?)<\/ai_reasoning>/i),q=!!O,V=O?O[1]:"",N=c("reason",V)||"",P=c("gap",V)||"",U=c("relevance_score",V)||"",Y=t.useMemo(function(){return{ul:function(t){t.node;var i=e.__rest(t,["node"]);return n.jsx("ol",e.__assign({},i,{style:{paddingLeft:"1.25rem",listStyleType:"decimal",margin:0}}))},li:function(t){t.node;var i=e.__rest(t,["node"]);return n.jsx("li",e.__assign({},i,{style:{marginBottom:"4px",listStyleType:"decimal"}},{children:i.children}))},ol:function(t){t.node;var i=e.__rest(t,["node"]);return n.jsx("li",e.__assign({},i,{style:{marginBottom:"4px",listStyleType:"decimal"}},{children:i.children}))},a:function(t){var i=t.href,r=t.children,o=e.__rest(t,["href","children"]);if(!i)return n.jsx("a",e.__assign({},o,{children:r}));var s=i||"";try{s=decodeURIComponent(i)}catch(e){console.error("Error decoding href",e)}if(s.includes("variant_id=")){var l="",a="",c=s.match(/variant_id=([^?&]+)/);c&&(l=c[1]);var d=s.match(/field_name=([^&]+)/);return d&&(a=d[1]),n.jsxs("button",e.__assign({type:"button",onClick:function(e){e.preventDefault(),e.stopPropagation(),j(l),R(a),setTimeout(function(){return R(null)},6e3)},style:{background:"none",border:"none",outline:"none",borderRadius:"6px",padding:"1px 4px",color:"#0F172A",cursor:"pointer",fontSize:"13px",fontWeight:500,display:"inline-flex",alignItems:"center",gap:"2px",margin:"0 1px",verticalAlign:"baseline",textDecoration:"none",boxShadow:"none",WebkitAppearance:"none",MozAppearance:"none"},title:"View Comparison"},{children:[r,n.jsx("svg",e.__assign({width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:n.jsx("path",{d:"M10.2082 8.67708H2.0415M2.0415 8.67708L4.08317 6.63542M2.0415 8.67708L4.08317 10.7188M2.0415 3.57292H10.2082M10.2082 3.57292L8.1665 1.53125M10.2082 3.57292L8.1665 5.61458",stroke:"#0F172A",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}))]}))}return n.jsx("a",e.__assign({href:i,target:"_blank",rel:"noopener noreferrer",style:{color:"#7C3AED"}},o,{children:r}))}}},[]);t.useEffect(function(){!B&&!v&&I.length>0&&!I[0].isLoading&&j(I[0].id)},[I,B,v]);var $=t.useRef(null),J=t.useState([]),X=J[0],G=J[1],K=t.useState(!1),Q=K[0],Z=K[1],ee=t.useState(!1),ne=ee[0],te=ee[1];t.useEffect(function(){var e=T.current;if(e){var n=function(){Z(e.scrollLeft>0),te(e.scrollLeft+e.clientWidth<e.scrollWidth-1)};return n(),e.addEventListener("scroll",n),window.addEventListener("resize",n),function(){e.removeEventListener("scroll",n),window.removeEventListener("resize",n)}}},[I]);var ie={title:t.useRef(null),scope:t.useRef(null),description:t.useRef(null),wta:t.useRef(null),wnta:t.useRef(null)},re={title:t.useRef(null),scope:t.useRef(null),description:t.useRef(null),wta:t.useRef(null),wnta:t.useRef(null)};t.useEffect(function(){if(A){var e="when_to_apply"===A?"wta":"when_not_to_apply"===A?"wnta":A,n=ie[e]||re[e];n&&n.current&&setTimeout(function(){n.current.scrollIntoView({behavior:"smooth",block:"center"})},150)}},[A]);var oe=function(e){var n,t,i,r,o,s=null===(n=null==H?void 0:H.rule_difference_comparison)||void 0===n?void 0:n.fields,l="when_to_apply"===e?"wta":"when_not_to_apply"===e?"wnta":e,a=!(!u[l]&&!z[l]);if(!s||!s[e])return{score:0,relation:"",highlightsA:[],highlightsB:[],hasContent:!1};var c=s[e];if(c.mappings){var d=c.mappings[0]||{};return{score:c.score,relation:d.relation||"",highlightsA:(null===(t=d.highlights)||void 0===t?void 0:t.ruleA_spans)||[],highlightsB:(null===(i=d.highlights)||void 0===i?void 0:i.ruleB_spans)||[],hasContent:a}}return{score:c.score,relation:c.relation||"",highlightsA:(null===(r=c.highlights)||void 0===r?void 0:r.ruleA_spans)||[],highlightsB:(null===(o=c.highlights)||void 0===o?void 0:o.ruleB_spans)||[],hasContent:a}},se=["title","scope","description","when_to_apply","when_not_to_apply"],le=function(){if($.current){var e=$.current.getBoundingClientRect(),n=[];se.forEach(function(t){var i="when_to_apply"===t?ie.wta:"when_not_to_apply"===t?ie.wnta:ie[t],r="when_to_apply"===t?re.wta:"when_not_to_apply"===t?re.wnta:re[t];if(i.current&&r.current){i.current.style.height="auto",r.current.style.height="auto";var o=i.current.getBoundingClientRect(),s=r.current.getBoundingClientRect(),l=Math.max(o.height,s.height);i.current.style.height="".concat(l,"px"),r.current.style.height="".concat(l,"px");var a=i.current.getBoundingClientRect(),c=r.current.getBoundingClientRect(),p=oe(t),x=d(p.score,p.relation,p.hasContent),g=a.top+a.height/2-e.top;n.push({x1:a.right-e.left,y1:g,x2:c.left-e.left,y2:g,style:x})}}),G(n)}};return t.useEffect(function(){var e=setTimeout(le,250);window.addEventListener("resize",le);var n=null;return $.current&&(n=new ResizeObserver(function(){window.requestAnimationFrame(function(){le()})})).observe($.current),function(){clearTimeout(e),window.removeEventListener("resize",le),n&&n.disconnect()}},[u,z,H,E]),n.jsxs(i.Box,e.__assign({sx:{display:"flex",flexDirection:"column",height:"100%",bgcolor:"#F6F7F9B2",fontFamily:'"Plus Jakarta Sans", sans-serif',overflow:"hidden"}},{children:[n.jsxs(i.Box,e.__assign({sx:{px:2,py:1,display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#FFFFFF",border:"1.5px solid #EEF0F4"}},{children:[n.jsxs(i.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:1}},{children:[n.jsx(i.IconButton,e.__assign({onClick:m,size:"small"},{children:n.jsx(r.ArrowLeft,{})})),n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:450,color:"#0F172A"}},{children:"Learning Comparison"}))]})),n.jsx(i.IconButton,e.__assign({onClick:b,size:"small"},{children:n.jsx(i.Box,e.__assign({sx:{fontSize:24,lineHeight:.5}},{children:"×"}))}))]})),I.length>0&&n.jsxs(i.Box,e.__assign({sx:{px:3,pb:.25}},{children:[n.jsxs(i.Box,e.__assign({sx:{display:"flex",alignItems:"center",justifyContent:"space-between",py:1}},{children:[n.jsx(i.Typography,e.__assign({sx:{fontSize:"13px",color:"#475569"}},{children:"Choose the Learning you want to compare with the rule you are creating."})),n.jsxs(i.Box,e.__assign({sx:{display:"flex",gap:.5,flexShrink:0,ml:1}},{children:[n.jsx(i.IconButton,e.__assign({onClick:function(){return D("left")},size:"small",disabled:!Q},{children:n.jsx(r.ArrowLeft,{size:18})})),n.jsx(i.IconButton,e.__assign({onClick:function(){return D("right")},size:"small",disabled:!ne},{children:n.jsx(r.ArrowRight,{size:18})}))]}))]})),n.jsx(i.Box,e.__assign({ref:T,sx:{display:"flex",gap:1,overflowX:"auto",pb:.05,"&::-webkit-scrollbar":{height:"6px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"transparent",borderRadius:"10px"},"&::-webkit-scrollbar-thumb:hover":{background:"transparent"}}},{children:I.map(function(e){return n.jsx(x,{data:e,isSelected:(null==W?void 0:W.id)===e.id,isCognitiveOpen:E,onToggleCognitive:function(){S(function(e){var n=!e;return n&&L.current&&L.current.scrollTo({top:0,behavior:"smooth"}),n})},onClick:function(){return j((n=e).id),y(n),void S(!1);var n}},e.id)})}))]})),n.jsx(i.Box,e.__assign({ref:L,sx:{flex:1,overflowY:"auto",py:1.5,px:3,display:"flex",justifyContent:"center",alignItems:"flex-start",bgcolor:"#FFFFFF",borderTop:M&&q&&E?"none":"1.5px solid #EEF0F4"}},{children:n.jsxs(i.Box,e.__assign({sx:{display:"flex",flexDirection:"column",width:"100%",maxWidth:"1200px"}},{children:[M&&q&&E&&n.jsx(i.Box,e.__assign({sx:{width:"100%",pb:1,animation:"fadeIn 0.2s ease-out","& > div > button":{display:"none !important"},"& > div > div":{marginTop:"0px"}}},{children:n.jsx(s.CognitiveDecisioningCard,{headerIcon:n.jsx(l.ButtonCognitiveIcon,{}),reasoning:N,gap:P,score:U,mdComponents:Y,isOpen:!0,onToggle:function(){return S(!1)}})})),n.jsxs(i.Box,e.__assign({ref:$,sx:{display:"grid",gridTemplateColumns:"1fr auto 1fr",gap:"60px",maxWidth:"1200px",width:"100%",position:"relative"}},{children:[n.jsx("svg",e.__assign({style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",pointerEvents:"none",zIndex:10}},{children:X.map(function(t,r){var o=(t.x1+t.x2)/2,s=t.y1;return n.jsxs("g",{children:[n.jsx("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.badgeBorder,strokeWidth:"1"}),n.jsx("foreignObject",e.__assign({x:o-125,y:s-16,width:"250",height:"32"},{children:n.jsx(i.Box,e.__assign({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:n.jsx(i.Box,e.__assign({sx:{fontSize:"11px",bgcolor:t.style.badgeBg,color:t.style.badgeText,border:"1px solid ".concat(t.style.badgeBorder),borderRadius:"12px",px:1.5,py:.25,fontWeight:500,textAlign:"center",whiteSpace:"nowrap"}},{children:t.style.label}))}))}))]},r)})})),n.jsxs(i.Box,e.__assign({sx:{border:"1px dashed #B0B0B0",borderRadius:"8px",bgcolor:"#FFFFFF",display:"flex",flexDirection:"column",position:"relative",zIndex:2,filter:"drop-shadow(0px 2px 4px #F2F2F2)",minWidth:0}},{children:[n.jsx(i.Box,e.__assign({sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px dashed #B0B0B0",borderRadius:"8px 8px 0 0",display:"flex",minHeight:"24px",alignItems:"center"}},{children:n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#19213D"}},{children:"Learning You’re Creating"}))})),n.jsx(i.Box,e.__assign({sx:{p:"12px",display:"flex",flexDirection:"column"}},{children:se.map(function(e){var t=oe(e),i=d(t.score,t.relation,t.hasContent),r="when_to_apply"===e?ie.wta:"when_not_to_apply"===e?ie.wnta:ie[e],o=u["when_to_apply"===e?"wta":"when_not_to_apply"===e?"wnta":e];return n.jsx(p,{ref:r,label:"when_to_apply"===e?"When to apply":"when_not_to_apply"===e?"When NOT to Apply":e.charAt(0).toUpperCase()+e.slice(1).replace("_"," "),content:o,highlights:t.highlightsA,styleVariant:i,isHighlighted:A===e},"left-".concat(e))})}))]})),n.jsx(i.Box,{sx:{width:"1px"}}),n.jsxs(i.Box,e.__assign({sx:{border:"1px solid #E3E6EA",borderRadius:"8px",bgcolor:"#FFFFFF",boxShadow:"0px 1px 4px #F7F4FE",position:"relative",zIndex:2,display:"flex",flexDirection:"column",minWidth:0}},{children:[n.jsx(i.Box,e.__assign({sx:{p:"8px",bgcolor:"#F7F8FA",borderBottom:"1px solid #E3E6EA",borderRadius:"8px 8px 0 0",minHeight:"24px",display:"flex",alignItems:"center"}},{children:n.jsxs(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:500,color:"#5928ED",display:"flex",alignItems:"center",gap:1}},{children:[n.jsx("div",e.__assign({style:{width:"18px",height:"18px",display:"flex",alignItems:"center",justifyContent:"center"}},{children:n.jsx(o.default,{})})),"Existing Learning"]}))})),n.jsx(i.Box,e.__assign({sx:{p:"12px",display:"flex",flexDirection:"column"}},{children:se.map(function(e){var t=oe(e),i=d(t.score,t.relation,t.hasContent),r="when_to_apply"===e?re.wta:"when_not_to_apply"===e?re.wnta:re[e],o=z["when_to_apply"===e?"wta":"when_not_to_apply"===e?"wnta":e];return n.jsx(p,{ref:r,label:"when_to_apply"===e?"When to apply":"when_not_to_apply"===e?"When NOT to Apply":e.charAt(0).toUpperCase()+e.slice(1).replace("_"," "),content:o,highlights:t.highlightsB,styleVariant:i,isHighlighted:A===e},"right-".concat(e))})}))]}))]}))]}))}))]}))};
|
|
2
2
|
//# sourceMappingURL=RuleComparisonNew.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("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),i=require("react"),o=require("@e-llm-studio/audit-log");require("@e-llm-studio/audit-log/dist/styles.css");var n=require("lucide-react"),r=require("./ChangeLogDiff.js"),a=require("../store/useLMSConfigStore.js");exports.default=function(l){var s=l.configId,d=l.ruleData,c=l.scopeId,g=l.scopeName,h=(null==g?void 0:g.trim())||"Selected",u=i.useMemo(function(){var e=[];return c&&e.push(c),e},[d,c]);return i.useEffect(function(){console.log("Flattened External Resource IDs:",u)},[u]),t.jsxs("div",e.__assign({style:{padding:"24px",fontFamily:"Arial, sans-serif"}},{children:[t.jsxs("div",e.__assign({style:{marginBottom:"16px",paddingBottom:"4px"}},{children:[t.jsx("h1",e.__assign({style:{margin:0,color:"#334155",fontSize:"20px",fontWeight:700,lineHeight:1.25}},{children:a.dt("history.title","".concat(h," - Audit Log"),{scope_name:h})})),t.jsx("p",e.__assign({style:{margin:"8px 0 0",color:"#667085",fontSize:"16px",fontWeight:500,lineHeight:1}},{children:a.dt("history.subtitle","Track all learning updates and modifications with the ".concat(h," scope."),{scope_name:h})}))]})),t.jsx(o.AuditLog,{configId:s,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:u.length>0?u:[""],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.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[t.jsx(n.User,{size:16,color:"#64748b",style:{flexShrink:0}}),t.jsx("span",e.__assign({style:{fontWeight:500}},{children:i.modifiedBy}))]}))},style:{width:"15%",minWidth:"140px"}},{key:"changeAction",header:"Action",body:function(i){var o,n,r=(o=i.changeTitle,(n=(o||"").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)"}),a=i.changeTitle?i.changeTitle.replace(/_/g," "):"—";return t.jsx("span",e.__assign({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:a}))},style:{width:"15%",textAlign:"center"}},{key:"customChangeSummary",header:"Change Summary",body:function(e){var i;return t.jsx(r.default,{change:null!==(i=e.actionText)&&void 0!==i?i:"-"})},style:{width:"30%",minWidth:"200px"}},{key:"redirectLink",header:"Link",body:function(i){var o,r=(null===(o=i.metadata)||void 0===o?void 0:o.redirect_url)||i.redirect_url;return r?t.jsx("div",e.__assign({style:{display:"flex",justifyContent:"center",alignItems:"center"}},{children:t.jsxs("a",e.__assign({href:r,target:"_blank",rel:"noopener noreferrer",style:{display:"flex",alignItems:"center",gap:"6px",color:"#2563eb",textDecoration:"none",fontWeight:500,fontSize:"13px"}},{children:["View ",t.jsx(n.ExternalLink,{size:14})]}))})):t.jsx("span",e.__assign({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 t.jsx("span",e.__assign({style:{color:"#94a3b8"}},{children:"—"}));var o=new Date(i.actionDate),n=o.toLocaleDateString("en-US",{month:"short",day:"2-digit",year:"numeric"}),r=o.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"});return t.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"4px",fontSize:"13px",color:"#475569"}},{children:[t.jsx("span",e.__assign({style:{fontWeight:500}},{children:n})),t.jsx("span",{children:r})]}))},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}}}})]}))};
|
|
2
2
|
//# sourceMappingURL=AuditLog.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("./RuleContent/RuleContent.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),o=require("./RuleContent/RuleContent.js"),i=require("./StationsContent/StationsContent.js"),r=require("./styles/LearningTemplateLayout.module.css.js"),a=require("./utils/treeUtils.js"),s=require("./SidebarWrapper.js"),l=require("./store/useLearningTemplateStore.js"),u=require("./components/StationOnboarding/StationOnboardModal.js");exports.default=function(d){var c,p=d.onOpenCreateModal,S=d.onRefreshRuleSets,f=d.scopeTreeData,g=d.onAddChild,C=d.onRenameChild,m=d.onDeleteChild,j=d.onSectionSelect,v=d.onViewStation,T=d.activeSectionId,_=void 0===T?"learnings":T,h=d.sectionsConfig,R=d.nodeTypesConfig,q=d.app_integration_id,O=d.token,x=l.useLearningTemplateStore(function(e){return e.isStationModalOpen}),L=l.useLearningTemplateStore(function(e){return e.setStationModalOpen}),M=l.useLearningTemplateStore(function(e){return e.isStationOnboardModalTriggered}),b=l.useLearningTemplateStore(function(e){return e.setIsStationOnboardModalTriggered}),y=l.useLearningTemplateStore(function(e){return e.selectedRuleSetId}),I=y?a.findNodeById((null==f?void 0:f.data)||null,y):null;return t.useEffect(function(){M&&L(!0)},[M,L,b]),n.jsxs("div",e.__assign({className:r.default.container},{children:[n.jsx(s.default,{onOpenCreateModal:p,onRefreshRuleSets:S,scopeTreeData:f,onAddChild:g,onRenameChild:C,onDeleteChild:m,onSectionSelect:j,activeSectionId:_,sectionsConfig:h,nodeTypesConfig:R}),n.jsx("div",e.__assign({className:r.default.content},{children:"stations"===_?n.jsx(i.default,{scopeId:y||"",scopeName:(null==I?void 0:I.name)||"Unknown Scope",stationsCount:null===(c=null==I?void 0:I.metrics)||void 0===c?void 0:c.stationsCount,onViewStation:v}):n.jsx(o.default,{onRefreshRuleSets:S,app_integration_id:q,token:O})})),n.jsx(u.default,{isOpen:x,onClose:function(){L(!1),b(!1)},onBoardStation:function(e){S(!0,e)},app_integration_id:q,token:O})]}))};
|
|
2
2
|
//# sourceMappingURL=LearningTemplateLayout.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),s=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),s=require("react/jsx-runtime"),c=require("react"),a=require("./AccessPanel.js"),t=require("../store/useEnvStore.js"),i=require("../store/usePermissionsStore.js"),l=require("./AccessPanel.module.css.js"),o=require("../store/useLMSConfigStore.js");exports.default=function(n){var r=n.selectedRuleSetId,u=n.useApplicationModuleForScopeAccess,d=void 0!==u&&u,p=c.useState("scope"),v=p[0],b=p[1],f=t.default(function(e){return e.rbacConfig}),m=i.usePermissionsStore(function(e){return e.hasPermission}),j=null==f?void 0:f.applicationResourceId,A=(null==f?void 0:f.applicationModuleId)||(null==f?void 0:f.moduleId),_=d?A:null==f?void 0:f.moduleId,x=Boolean(j&&m("ilotj.scope.access.application.view",j));return s.jsxs("div",e.__assign({className:l.default.accessManagement},{children:[s.jsxs("div",e.__assign({className:l.default.accessTabs,role:"tablist","aria-label":"Access level"},{children:[s.jsx("button",e.__assign({type:"button",role:"tab","aria-selected":"scope"===v,className:"".concat(l.default.accessTab," ").concat("scope"===v?l.default.accessTabActive:""),onClick:function(){return b("scope")}},{children:o.dt("access.scopeLevelAccess","Scope Level Access")})),s.jsx("button",e.__assign({type:"button",role:"tab","aria-selected":"application"===v,className:"".concat(l.default.accessTab," ").concat("application"===v?l.default.accessTabActive:""),onClick:function(){return b("application")},disabled:!x,title:x?"":"You don't have permission to view application access"},{children:o.dt("access.appLevelAccess","Application Level Access")}))]})),s.jsx("div",e.__assign({className:l.default.accessTabPanel,role:"tabpanel"},{children:"application"===v?s.jsx(a.default,{resourceId:j,moduleId:A,accessLevel:"application"}):s.jsx(a.default,{ruleSetId:r,moduleId:_,accessLevel:"scope"})}))]}))};
|
|
2
2
|
//# sourceMappingURL=AccessManagementPanel.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),i=require("react"),r=require("@tanstack/react-query"),t=require("lucide-react"),o=require("primereact/toast"),s=require("uuid"),a=require("../components/StationOnboarding/StationAutocomplete.js"),l=require("./AddScopeApprovalSearchComponent.js"),u=require("../components/ScopeSkeletonLoader.js"),d=require("@mui/material"),c=require("../store/useAuthStore.js"),p=require("../store/useAppSecRolesStore.js"),g=require("../store/useEnvStore.js"),_=require("../apis/scopeApis.js"),f=require("../store/useLearningTemplateStore.js"),h=require("../config.js");exports.default=function(m){var v=m.isOpen,x=m.onClose,y=m.onCreate,S=m.hasGlobalRuleSet,b=m.parentId,j=i.useState(""),C=j[0],q=j[1],w=i.useState(""),A=w[0],k=w[1],R=i.useState({}),I=R[0],D=R[1],F=i.useRef(null),L=c.default().user,z=p.useAppSecRolesStore(function(e){return e.roles}),E=g.default(function(e){return e.rbacConfig}),N=i.useState(null),B=N[0],T=N[1],W=i.useState("approval_required"),O=W[0],G=W[1],P=i.useState([]),M=P[0],K=P[1],U=i.useState([]),X=U[0],H=U[1],J=i.useState(""),Q=J[0],V=J[1],Y=r.useMutation({mutationFn:function(n){return e.__awaiter(void 0,void 0,void 0,function(){var i;return e.__generator(this,function(e){switch(e.label){case 0:return[4,_.createRuleSet(n,null!==(i=null==L?void 0:L.accessToken)&&void 0!==i?i:"")];case 1:return[2,e.sent()]}})})},onSuccess:function(n){return e.__awaiter(void 0,void 0,void 0,function(){return e.__generator(this,function(e){return console.log("Rule Set Created Successfully",n),[2]})})}}),Z=Y.data,$=Y.isPending,ee=Y.mutateAsync;return i.useEffect(function(){v&&(q(""),k(""),D({}),T(null),G("approval_required"),K([]),H([]),V(""))},[v]),v?$?n.jsx(u.default,{isLoading:$}):n.jsxs("div",e.__assign({style:{position:"absolute",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0,0,0,0.3)"}},{children:[n.jsx(o.Toast,{ref:F}),n.jsxs("div",e.__assign({style:{position:"relative",width:600,borderRadius:12,backgroundColor:"white",padding:24,boxShadow:"0 25px 50px -12px rgba(0,0,0,0.25)"}},{children:[n.jsxs("div",e.__assign({style:{marginBottom:24,display:"flex",alignItems:"flex-start",justifyContent:"space-between"}},{children:[n.jsxs("div",{children:[n.jsx("h2",e.__assign({style:{margin:0,fontSize:18,fontWeight:500,color:"#19213D"}},{children:"Add Scope"})),n.jsx("p",e.__assign({style:{margin:"4px 0 0 0",fontSize:14,fontWeight:400,color:"#666F8D"}},{children:"This scope will be created under Global and will inherit its Learnings by default."}))]}),n.jsx("button",e.__assign({onClick:x,style:{background:"none",border:"none",padding:0,cursor:"pointer",color:"#9CA3AF"}},{children:n.jsx(t.X,{size:24})}))]})),n.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:20}},{children:[n.jsxs("div",e.__assign({style:{position:"relative",display:"flex",flexDirection:"column",gap:6}},{children:[n.jsxs("label",e.__assign({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:[n.jsx("span",e.__assign({style:{marginRight:4,fontSize:16,fontWeight:600,color:"#8F2C23"}},{children:"*"})),"Scope Name"]})),"Custom"===C?n.jsx(a.default,{value:A,onChange:function(n){if(n.length>50)return k(n.slice(0,50)),void D(function(n){return e.__assign(e.__assign({},n),{name:"Scope Name must be 50 characters or fewer"})});k(n),D(function(n){return e.__assign(e.__assign({},n),{name:void 0})})},onStationSelect:function(e){T(e)},style:{border:I.name?"1px solid #8F2C23":void 0}}):n.jsx(d.Input,{value:A,onChange:function(n){var i=n.target.value;if(i.length>50)return k(i.slice(0,50)),void D(function(n){return e.__assign(e.__assign({},n),{name:"Scope Name must be 50 characters or fewer"})});k(i),D(function(n){return e.__assign(e.__assign({},n),{name:void 0})})},style:{border:"1px solid ".concat(I.name?"#8F2C23":"#F0F2F5")},placeholder:"e.g. Global Learnings"}),I.name&&n.jsx("p",e.__assign({style:{margin:"4px 0 0 0",fontSize:12,color:"#8F2C23"}},{children:I.name}))]})),n.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:12}},{children:[n.jsxs("label",e.__assign({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:[n.jsx("span",e.__assign({style:{marginRight:4,fontSize:16,fontWeight:600,color:"#8F2C23"}},{children:"*"})),"Learning Approval Settings"]})),n.jsxs("div",e.__assign({role:"radio","aria-checked":"approval_required"===O,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:4},onClick:function(){return G("approval_required")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||G("approval_required")}},{children:[n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:8}},{children:[n.jsx("div",e.__assign({style:{display:"flex",height:16,width:16,flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("approval_required"===O?"#2563EB":"#CBD5E1")}},{children:"approval_required"===O&&n.jsx("div",{style:{height:8,width:8,borderRadius:"50%",backgroundColor:"#2563EB"}})})),n.jsx("span",e.__assign({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:"Approval Required Before Publishing"}))]})),n.jsx("p",e.__assign({style:{margin:0,marginLeft:24,fontSize:12,color:"#666F8D"}},{children:"Learnings require approval before publishing."}))]})),"approval_required"===O&&n.jsx(l.default,{selectedApprovers:M,selectedGroupOfApprovers:X,onApproversChange:K,onGroupsChange:H}),Q&&n.jsx("p",e.__assign({style:{margin:0,marginLeft:24,fontSize:12,color:"#8F2C23"}},{children:Q})),n.jsxs("div",e.__assign({role:"radio","aria-checked":"publish_without"===O,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:4},onClick:function(){G("publish_without"),V("")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||(G("publish_without"),V(""))}},{children:[n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:8}},{children:[n.jsx("div",e.__assign({style:{display:"flex",height:16,width:16,flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("publish_without"===O?"#2563EB":"#CBD5E1")}},{children:"publish_without"===O&&n.jsx("div",{style:{height:8,width:8,borderRadius:"50%",backgroundColor:"#2563EB"}})})),n.jsx("span",e.__assign({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:"Publish Without Approval"}))]})),n.jsx("p",e.__assign({style:{margin:0,marginLeft:24,fontSize:12,color:"#666F8D"}},{children:"Learnings can be published directly."}))]}))]})),n.jsxs("div",e.__assign({style:{marginTop:32,display:"flex",justifyContent:"flex-end",gap:12}},{children:[n.jsx("button",e.__assign({onClick:x,style:{borderRadius:6,border:"1px solid #E2E8F0",padding:"8px 16px",fontSize:14,fontWeight:500,color:"#64748B",backgroundColor:"white",cursor:"pointer",opacity:$?.5:1},disabled:$},{children:"Cancel"})),n.jsx("button",e.__assign({onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var n,i,r,t,o,a,l,u,d,c,p,g;return e.__generator(this,function(_){if(n={},A.trim()?A.length>50&&(n.name="Scope Name must be 50 characters or fewer"):n.name="Scope Name is required","approval_required"===O&&0===M.length&&0===X.length&&V("Please select at least one approver or approver group."),n.name)return D(n),[2];if("approval_required"===O&&0===M.length&&0===X.length)return[2];V("");try{i="approval_required"===O,r=f.useLearningTemplateStore.getState().backwardCompatibility,t=r?{topic:S?"genreRuleSet":"globalRuleSet",customScopeGroupName:h.IL_CONFIG_CONSTANTS.CUSTOM_SCOPE_GROUP_NAME,scopeDescription:A,parentScopeId:null,customScopeName:A,customScopeId:s.v4(),createByName:(null==L?void 0:L.firstname)||"System",createdBy:(null==L?void 0:L.email)||"system@audacy.com",approvalRequired:i,appsecData:{application:null==E?void 0:E.applicationId,module:null==E?void 0:E.moduleId,roles:e.__spreadArray(e.__spreadArray([],i?[{users:M.map(function(e){return e.email}),groups:X.map(function(e){return e._id}),role:null!==(a=null===(o=z.find(function(e){return"Learning Manager"===e.name}))||void 0===o?void 0:o._id)&&void 0!==a?a:""}]:[],!0),[{users:[null==L?void 0:L.email],groups:[],role:null!==(u=null===(l=z.find(function(e){return"Instant Learning Admin"===e.name}))||void 0===l?void 0:l._id)&&void 0!==u?u:""}],!1)}}:{topic:S?"genreRuleSet":"globalRuleSet",scope_reference_id:null,scopeDescription:A,parentScopeId:null!=b?b:null,scopeName:A,scopeReferenceMetadata:{},applicationMappingId:f.useLearningTemplateStore.getState().app_integration_id},console.log("Add Scope payload:",t),ee(t),y(null===(d=null==Z?void 0:Z.data)||void 0===d?void 0:d.scopeId),x()}catch(e){console.error("An error occurred during scope creation.",e),null===(c=F.current)||void 0===c||c.show({severity:"error",summary:"Adding Scope Failed",detail:(null===(g=null===(p=null==e?void 0:e.response)||void 0===p?void 0:p.data)||void 0===g?void 0:g.message)||"There was an error creating the scope. Please try again."})}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:$||"Custom"===C&&!B?.5:1},disabled:$||"Custom"===C&&!B},{children:$?n.jsxs(n.Fragment,{children:[n.jsx(t.Loader2,{className:"animate-spin",style:{marginRight:8,height:16,width:16,color:"white"}}),"Creating..."]}):"Create Scope"}))]}))]}))]}))]})):null};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("react/jsx-runtime"),r=require("react"),n=require("@tanstack/react-query"),i=require("lucide-react"),o=require("primereact/toast"),s=require("uuid"),a=require("../components/StationOnboarding/StationAutocomplete.js"),l=require("./AddScopeApprovalSearchComponent.js"),c=require("../components/ScopeSkeletonLoader.js"),u=require("@mui/material"),d=require("../store/useAuthStore.js"),p=require("../store/useAppSecRolesStore.js"),_=require("../store/useEnvStore.js"),g=require("../apis/scopeApis.js"),h=require("../store/useLearningTemplateStore.js"),f=require("../config.js"),m=require("../store/useLMSConfigStore.js"),v=require("../constants.js");exports.default=function(S){var x=S.isOpen,y=S.onClose,b=S.onCreate,D=S.hasGlobalRuleSet,A=S.parentId,j=r.useState(""),C=j[0],R=j[1],E=r.useState(""),T=E[0],q=E[1],I=r.useState({}),L=I[0],w=I[1],P=r.useRef(null),k=d.default().user,W=p.useAppSecRolesStore(function(e){return e.roles}),N=_.default(function(e){return e.rbacConfig}),F=r.useState(null),O=F[0],M=F[1],z=r.useState("approval_required"),G=z[0],B=z[1],H=r.useState([]),V=H[0],K=H[1],U=r.useState([]),X=U[0],J=U[1],Q=r.useState(""),Y=Q[0],Z=Q[1],$=n.useMutation({mutationFn:function(t){return e.__awaiter(void 0,void 0,void 0,function(){var r;return e.__generator(this,function(e){switch(e.label){case 0:return[4,g.createRuleSet(t,null!==(r=null==k?void 0:k.accessToken)&&void 0!==r?r:"")];case 1:return[2,e.sent()]}})})},onSuccess:function(t){return e.__awaiter(void 0,void 0,void 0,function(){return e.__generator(this,function(e){return console.log("Rule Set Created Successfully",t),[2]})})}});$.data;var ee=$.isPending,te=$.mutateAsync;return r.useEffect(function(){x&&(R(""),q(""),w({}),M(null),B("approval_required"),K([]),J([]),Z(""))},[x]),x?ee?t.jsx(c.default,{isLoading:ee}):t.jsxs("div",e.__assign({style:{position:"absolute",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0,0,0,0.3)"}},{children:[t.jsx(o.Toast,{ref:P}),t.jsxs("div",e.__assign({style:{position:"relative",width:600,borderRadius:12,backgroundColor:"white",padding:24,boxShadow:"0 25px 50px -12px rgba(0,0,0,0.25)"}},{children:[t.jsxs("div",e.__assign({style:{marginBottom:24,display:"flex",alignItems:"flex-start",justifyContent:"space-between"}},{children:[t.jsxs("div",{children:[t.jsx("h2",e.__assign({style:{margin:0,fontSize:18,fontWeight:500,color:"#19213D"}},{children:m.dt("".concat(v.MIDDLE_DRAWER_ADD_SCOPE_DT_PATH,".title"),"Add Scope")})),t.jsx("p",e.__assign({style:{margin:"4px 0 0 0",fontSize:14,fontWeight:400,color:"#666F8D"}},{children:m.dt("".concat(v.MIDDLE_DRAWER_ADD_SCOPE_DT_PATH,".subtitle"),"This scope will be created under Global and will inherit its Learnings by default.",{parent:"Global"})}))]}),t.jsx("button",e.__assign({onClick:y,style:{background:"none",border:"none",padding:0,cursor:"pointer",color:"#9CA3AF"}},{children:t.jsx(i.X,{size:24})}))]})),t.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:20}},{children:[t.jsxs("div",e.__assign({style:{position:"relative",display:"flex",flexDirection:"column",gap:6}},{children:[t.jsxs("label",e.__assign({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:[t.jsx("span",e.__assign({style:{marginRight:4,fontSize:16,fontWeight:600,color:"#8F2C23"}},{children:"*"})),m.dt("".concat(v.MIDDLE_DRAWER_ADD_SCOPE_DT_PATH,".scopeName"),"Scope Name")]})),"Custom"===C?t.jsx(a.default,{value:T,onChange:function(t){if(t.length>50)return q(t.slice(0,50)),void w(function(t){return e.__assign(e.__assign({},t),{name:"Scope Name must be 50 characters or fewer"})});q(t),w(function(t){return e.__assign(e.__assign({},t),{name:void 0})})},onStationSelect:function(e){M(e)},style:{border:L.name?"1px solid #8F2C23":void 0}}):t.jsx(u.Input,{value:T,onChange:function(t){var r=t.target.value;if(r.length>50)return q(r.slice(0,50)),void w(function(t){return e.__assign(e.__assign({},t),{name:"Scope Name must be 50 characters or fewer"})});q(r),w(function(t){return e.__assign(e.__assign({},t),{name:void 0})})},style:{border:"1px solid ".concat(L.name?"#8F2C23":"#F0F2F5")},placeholder:"e.g. Global Learnings"}),L.name&&t.jsx("p",e.__assign({style:{margin:"4px 0 0 0",fontSize:12,color:"#8F2C23"}},{children:L.name}))]})),t.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",gap:12}},{children:[t.jsxs("label",e.__assign({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:[t.jsx("span",e.__assign({style:{marginRight:4,fontSize:16,fontWeight:600,color:"#8F2C23"}},{children:"*"})),m.dt("".concat(v.MIDDLE_DRAWER_APPROVAL_SETTINGS_DT_PATH,".title"),"Learning Approval Settings")]})),t.jsxs("div",e.__assign({role:"radio","aria-checked":"approval_required"===G,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:4},onClick:function(){return B("approval_required")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||B("approval_required")}},{children:[t.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:8}},{children:[t.jsx("div",e.__assign({style:{display:"flex",height:16,width:16,flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("approval_required"===G?"#2563EB":"#CBD5E1")}},{children:"approval_required"===G&&t.jsx("div",{style:{height:8,width:8,borderRadius:"50%",backgroundColor:"#2563EB"}})})),t.jsx("span",e.__assign({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:m.dt("".concat(v.MIDDLE_DRAWER_APPROVAL_SETTINGS_DT_PATH,".approvalRequired.title"),"Approval Required Before Publishing")}))]})),t.jsx("p",e.__assign({style:{margin:0,marginLeft:24,fontSize:12,color:"#666F8D"}},{children:m.dt("".concat(v.MIDDLE_DRAWER_APPROVAL_SETTINGS_DT_PATH,".approvalRequired.subtitle"),"Learnings require approval before publishing.")}))]})),"approval_required"===G&&t.jsx(l.default,{selectedApprovers:V,selectedGroupOfApprovers:X,onApproversChange:K,onGroupsChange:J}),Y&&t.jsx("p",e.__assign({style:{margin:0,marginLeft:24,fontSize:12,color:"#8F2C23"}},{children:Y})),t.jsxs("div",e.__assign({role:"radio","aria-checked":"publish_without"===G,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:4},onClick:function(){B("publish_without"),Z("")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||(B("publish_without"),Z(""))}},{children:[t.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:8}},{children:[t.jsx("div",e.__assign({style:{display:"flex",height:16,width:16,flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("publish_without"===G?"#2563EB":"#CBD5E1")}},{children:"publish_without"===G&&t.jsx("div",{style:{height:8,width:8,borderRadius:"50%",backgroundColor:"#2563EB"}})})),t.jsx("span",e.__assign({style:{fontSize:14,fontWeight:500,color:"#19213D"}},{children:m.dt("".concat(v.MIDDLE_DRAWER_APPROVAL_SETTINGS_DT_PATH,".publishWithoutApproval.title"),"Publish Without Approval")}))]})),t.jsx("p",e.__assign({style:{margin:0,marginLeft:24,fontSize:12,color:"#666F8D"}},{children:m.dt("".concat(v.MIDDLE_DRAWER_APPROVAL_SETTINGS_DT_PATH,".publishWithoutApproval.subtitle"),"Learnings can be published directly.")}))]}))]})),t.jsxs("div",e.__assign({style:{marginTop:32,display:"flex",justifyContent:"flex-end",gap:12}},{children:[t.jsx("button",e.__assign({onClick:y,style:{borderRadius:6,border:"1px solid #E2E8F0",padding:"8px 16px",fontSize:14,fontWeight:500,color:"#64748B",backgroundColor:"white",cursor:"pointer",opacity:ee?.5:1},disabled:ee},{children:m.dt("".concat(v.MIDDLE_DRAWER_ADD_SCOPE_DT_PATH,".cancel"),"Cancel")})),t.jsx("button",e.__assign({onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var t,r,n,i,o,a,l,c,u,d,p,_,m,v,S,x;return e.__generator(this,function(j){switch(j.label){case 0:if(t={},T.trim()?T.length>50&&(t.name="Scope Name must be 50 characters or fewer"):t.name="Scope Name is required","approval_required"===G&&0===V.length&&0===X.length&&Z("Please select at least one approver or approver group."),t.name)return w(t),[2];if("approval_required"===G&&0===V.length&&0===X.length)return[2];Z(""),j.label=1;case 1:return j.trys.push([1,7,,8]),r="approval_required"===G,n=h.useLearningTemplateStore.getState().backwardCompatibility,i=n?{topic:D?"genreRuleSet":"globalRuleSet",customScopeGroupName:f.IL_CONFIG_CONSTANTS.CUSTOM_SCOPE_GROUP_NAME,scopeDescription:T,parentScopeId:null,customScopeName:T,customScopeId:s.v4(),createByName:(null==k?void 0:k.firstname)||"System",createdBy:(null==k?void 0:k.email)||"system@audacy.com",approvalRequired:r,appsecData:{application:null==N?void 0:N.applicationId,module:null==N?void 0:N.moduleId,roles:e.__spreadArray(e.__spreadArray([],r?[{users:V.map(function(e){return e.email}),groups:X.map(function(e){return e._id}),role:null!==(d=null===(u=W.find(function(e){return"Learning Manager"===e.name}))||void 0===u?void 0:u._id)&&void 0!==d?d:""}]:[],!0),[{users:[null==k?void 0:k.email],groups:[],role:null!==(_=null===(p=W.find(function(e){return"Instant Learning Admin"===e.name}))||void 0===p?void 0:p._id)&&void 0!==_?_:""}],!1)}}:{topic:D?"genreRuleSet":"globalRuleSet",scope_reference_id:null,scopeDescription:T,parentScopeId:null!=A?A:null,scopeName:T,scopeReferenceMetadata:{},scopeType:"Custom",applicationMappingId:h.useLearningTemplateStore.getState().app_integration_id},console.log("Add Scope payload:",i),[4,te(i)];case 2:if(o=j.sent(),a=null===(m=null==o?void 0:o.data)||void 0===m?void 0:m.scopeId,n||!a||!A)return[3,6];j.label=3;case 3:return j.trys.push([3,5,,6]),[4,g.inheritScope({source_scope_id:A,target_scope_id:a,application_mapping_id:h.useLearningTemplateStore.getState().app_integration_id||"",is_copy_parent_variant_id:!1})];case 4:return j.sent(),[3,6];case 5:return l=j.sent(),console.error("Failed to inherit rules for the new scope:",l),[3,6];case 6:return b(a),y(),[3,8];case 7:return c=j.sent(),console.error("An error occurred during scope creation.",c),null===(v=P.current)||void 0===v||v.show({severity:"error",summary:"Adding Scope Failed",detail:(null===(x=null===(S=null==c?void 0:c.response)||void 0===S?void 0:S.data)||void 0===x?void 0:x.message)||"There was an error creating the scope. Please try again."}),[3,8];case 8: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:ee||"Custom"===C&&!O?.5:1},disabled:ee||"Custom"===C&&!O},{children:ee?t.jsxs(t.Fragment,{children:[t.jsx(i.Loader2,{className:"animate-spin",style:{marginRight:8,height:16,width:16,color:"white"}}),"Creating..."]}):m.dt("".concat(v.MIDDLE_DRAWER_ADD_SCOPE_DT_PATH,".submitButton"),"Create Scope")}))]}))]}))]}))]})):null};
|
|
2
2
|
//# sourceMappingURL=AddScopeModal.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),o=require("react"),t=require("@mui/material"),i=require("@mui/icons-material/Check"),r=require("@mui/icons-material/CloseRounded"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),o=require("react"),t=require("@mui/material"),i=require("@mui/icons-material/Check"),r=require("@mui/icons-material/CloseRounded"),a=require("lucide-react"),s=require("../store/useLMSConfigStore.js"),c=require("../constants.js");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=l(i),u=l(r),p={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}};exports.default=function(i){var r=i.open,l=i.mode,g=i.onClose,x=i.onSubmit,_=i.variantInformation,b=i.ruleTitle,h=i.pendingVariants,f=void 0===h?[]:h,m=i.isPending,j=void 0!==m&&m,y=o.useState(""),T=y[0],v=y[1],C=o.useState(!0),A=C[0],D=C[1],k=o.useState(!1),E=k[0],F=k[1],L=o.useState(!1),S=L[0],N=L[1],I=o.useState(!1),R=I[0],w=I[1],B=o.useState(!1),M=B[0],z=B[1],P=o.useState(!1),H=P[0],G=P[1],W="undefined"!=typeof document?document.getElementById("rule-template-layout-content"):null,q="reject"===l,V=function(){x(q?{feedback:T,deleteLearning:A}:{}),v(""),D(!1)},O=function(){v(""),D(!1),g()};return n.jsxs(t.Dialog,e.__assign({open:r,onClose:O,container:W,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:[n.jsxs("div",e.__assign({style:p.header},{children:[n.jsx("div",e.__assign({style:p.title},{children:"".concat(q?s.dt("".concat(c.LEARNING_DT_PATH,".rejectDialog.title"),"Reject Learning"):s.dt("".concat(c.LEARNING_DT_PATH,".approveDialog.title"),"Approve Learning"))})),n.jsx("button",e.__assign({onClick:g,onMouseEnter:function(){return F(!0)},onMouseLeave:function(){return F(!1)},style:e.__assign(e.__assign({},p.closeButton),{color:E?"#4B5563":"#9CA3AF"})},{children:n.jsx(a.X,{size:24})}))]})),n.jsxs(t.DialogContent,e.__assign({sx:p.dialogContent},{children:[n.jsxs(t.DialogContentText,e.__assign({sx:p.description},{children:[n.jsx("span",e.__assign({style:p.descriptionStrong},{children:_}))," ","".concat(q?s.dt("".concat(c.LEARNING_DT_PATH,".rejectDialog.desc"),"will not be published or applied within the selected scope. You can provide feedback before rejecting"):s.dt("".concat(c.LEARNING_DT_PATH,".approveDialog.desc"),"will be published and become active within the selected scope after approval."))]})),f.length>0&&n.jsx("div",{children:f.map(function(o,t){return n.jsxs("div",e.__assign({style:p.variantCard},{children:[n.jsxs("div",e.__assign({style:p.variantCardTitle},{children:[b,f.length>1?" — Variant ".concat(t+1):""]})),o.description&&n.jsx("div",e.__assign({style:p.variantCardDescription},{children:o.description})),n.jsxs("div",e.__assign({style:p.variantCardMono},{children:[o.whenToApply&&n.jsxs("div",{children:["WTA — ",o.whenToApply]}),o.whenNotToApply&&n.jsxs("div",{children:["WNTA — ",o.whenNotToApply]})]}))]}),o.variantId)})}),n.jsx(t.DialogContentText,e.__assign({sx:p.secondaryDescription},{children:q?"":s.dt("".concat(c.LEARNING_DT_PATH,".approveDialog.footer"),"Take a moment to check the configuration before moving forward.")})),q&&n.jsxs("div",e.__assign({style:p.rejectSection},{children:[n.jsxs("div",{children:[n.jsx("label",e.__assign({htmlFor:"feedback",style:p.feedbackLabel},{children:s.dt("".concat(c.LEARNING_DT_PATH,".rejectDialog.feedbackTitle"),"Feedback")})),n.jsx("textarea",{id:"feedback",rows:4,value:T,onChange:function(e){return v(e.target.value)},onFocus:function(){return N(!0)},onBlur:function(){return N(!1)},placeholder:"".concat(s.dt("".concat(c.LEARNING_DT_PATH,".rejectDialog.feedbackPlaceholder"),"Add feedback or reason for rejection")),style:e.__assign(e.__assign({},p.textarea),{borderColor:S?"#EF4444":"#E2E8F0",boxShadow:S?"0 0 0 2px rgba(239, 68, 68, 0.2)":"none"})})]}),n.jsxs("label",e.__assign({style:p.checkboxLabel,onMouseEnter:function(){return w(!0)},onMouseLeave:function(){return w(!1)}},{children:[n.jsx("input",{type:"checkbox",checked:A,disabled:!1,onChange:function(e){return D(e.target.checked)},style:p.checkbox}),n.jsx("div",e.__assign({style:p.checkboxTextWrap},{children:n.jsx("span",e.__assign({style:e.__assign(e.__assign({},p.checkboxText),{color:R?"#0F172A":"#1E293B"})},{children:s.dt("".concat(c.LEARNING_DT_PATH,".rejectDialog.deleteCheckboxLabel"),"Also delete this learning")}))}))]}))]}))]})),n.jsxs(t.DialogActions,e.__assign({sx:p.actions},{children:[n.jsx("button",e.__assign({onClick:O,type:"button",disabled:j,onMouseEnter:function(){return z(!0)},onMouseLeave:function(){return z(!1)},style:e.__assign(e.__assign({},p.secondaryButton),{backgroundColor:M&&!j?"#F8FAFC":"#FFFFFF",borderColor:M&&!j?"#CBD5E1":"#E2E8F0",opacity:j?.5:1,cursor:j?"not-allowed":"pointer"})},{children:s.dt("".concat(c.LEARNING_DT_PATH,".approveDialog.cancel"),"Cancel")})),q?n.jsxs("button",e.__assign({onClick:V,type:"button",disabled:j,onMouseEnter:function(){return G(!0)},onMouseLeave:function(){return G(!1)},style:e.__assign(e.__assign({},p.primaryButton),{backgroundColor:j?"#EF4444":H?"#DC2626":"#EF4444",opacity:j?.7:1,cursor:j?"not-allowed":"pointer"})},{children:[j?n.jsx(a.Loader2,{size:16,style:{animation:"spin 1s linear infinite"}}):n.jsx(u.default,{sx:p.actionIcon}),j?s.dt("".concat(c.LEARNING_DT_PATH,".rejectDialog.loadingText"),"Processing..."):s.dt("".concat(c.LEARNING_DT_PATH,".rejectDialog.rejectLearning"),"Reject Learning")]})):n.jsxs("button",e.__assign({onClick:V,type:"button",disabled:j,onMouseEnter:function(){return G(!0)},onMouseLeave:function(){return G(!1)},style:e.__assign(e.__assign({},p.primaryButton),{backgroundColor:j?"#22C55E":H?"#16A34A":"#22C55E",opacity:j?.7:1,cursor:j?"not-allowed":"pointer"})},{children:[j?n.jsx(a.Loader2,{size:16,style:{animation:"spin 1s linear infinite"}}):n.jsx(d.default,{sx:p.actionIcon}),j?s.dt("".concat(c.LEARNING_DT_PATH,".approveDialog.loadingText"),"Processing..."):s.dt("".concat(c.LEARNING_DT_PATH,".approveDialog.approveLearning"),"Approve Learning")]}))]})),n.jsx("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"})]}))};
|
|
2
2
|
//# sourceMappingURL=ApprovalLearningDialog.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),require("react");exports.default="data:image/svg+xml,%3Csvg%20width%3D%22160%22%20height%3D%22153%22%20viewBox%3D%220%200%20160%20153%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M79.2744%20143.735C116.627%20143.735%20146.909%20113.508%20146.909%2076.223C146.909%2038.9359%20116.627%208.71106%2079.2744%208.71106C41.9192%208.71106%2011.6367%2038.9359%2011.6367%2076.223C11.6367%20113.508%2041.9192%20143.735%2079.2744%20143.735Z%22%20fill%3D%22%23F8FAFC%22%2F%3E%3Cpath%20d%3D%22M116.902%2030.8984H43.3269C38.7417%2030.8984%2035.0234%2034.7993%2035.0234%2039.6097H125.205C125.205%2034.7993%20121.489%2030.8984%20116.902%2030.8984Z%22%20fill%3D%22%23D0D9E4%22%2F%3E%3Cpath%20d%3D%22M35.0234%2039.6094H125.205V109.239C125.205%20112.335%20123.994%20115.304%20121.834%20117.494C119.674%20119.684%20116.745%20120.914%20113.692%20120.914H46.5394C43.4834%20120.914%2040.555%20119.684%2038.3973%20117.494C36.2372%20115.304%2035.0234%20112.335%2035.0234%20109.239V39.6094Z%22%20fill%3D%22%23F1F5F9%22%2F%3E%3Cpath%20d%3D%22M125.155%2039.6592V109.239C125.155%20112.322%20123.949%20115.279%20121.798%20117.459C119.647%20119.639%20116.731%20120.864%20113.691%20120.864H46.5391C43.4967%20120.864%2040.5809%20119.639%2038.4326%20117.459C36.2818%20115.279%2035.0732%20112.322%2035.0732%20109.239V39.6592H125.155Z%22%20stroke%3D%22%2364748B%22%20stroke-opacity%3D%220.1%22%20stroke-width%3D%220.1%22%2F%3E%3Cpath%20d%3D%22M70.571%2048.3203H48.9307C48.4799%2048.3203%2048.1133%2049.295%2048.1133%2050.4981C48.1133%2051.7012%2048.4799%2052.6759%2048.9307%2052.6759H70.571C71.0218%2052.6759%2071.386%2051.7012%2071.386%2050.4981C71.386%2049.295%2071.0218%2048.3203%2070.571%2048.3203Z%22%20fill%3D%22url%28%23paint0_linear_1020_82405%29%22%2F%3E%3Cpath%20d%3D%22M70.571%2067.1953H48.9307C48.4799%2067.1953%2048.1133%2068.17%2048.1133%2069.3731C48.1133%2070.5762%2048.4799%2071.5509%2048.9307%2071.5509H70.571C71.0218%2071.5509%2071.386%2070.5762%2071.386%2069.3731C71.386%2068.17%2071.0218%2067.1953%2070.571%2067.1953Z%22%20fill%3D%22url%28%23paint1_linear_1020_82405%29%22%2F%3E%3Cpath%20d%3D%22M70.571%2086.0703H48.9307C48.4799%2086.0703%2048.1133%2087.0468%2048.1133%2088.2493C48.1133%2089.4517%2048.4799%2090.4259%2048.9307%2090.4259H70.571C71.0218%2090.4259%2071.386%2089.4517%2071.386%2088.2493C71.386%2087.0468%2071.0218%2086.0703%2070.571%2086.0703Z%22%20fill%3D%22url%28%23paint2_linear_1020_82405%29%22%2F%3E%3Cpath%20d%3D%22M70.571%20104.945H48.9307C48.4799%20104.945%2048.1133%20105.922%2048.1133%20107.124C48.1133%20108.327%2048.4799%20109.301%2048.9307%20109.301H70.571C71.0218%20109.301%2071.386%20108.327%2071.386%20107.124C71.386%20105.922%2071.0218%20104.945%2070.571%20104.945Z%22%20fill%3D%22url%28%23paint3_linear_1020_82405%29%22%2F%3E%3Cpath%20d%3D%22M116.507%2048.3203H78.6367C77.8481%2048.3203%2077.207%2049.295%2077.207%2050.4981C77.207%2051.7012%2077.8481%2052.6759%2078.6367%2052.6759H116.507C117.296%2052.6759%20117.934%2051.7012%20117.934%2050.4981C117.934%2049.295%20117.296%2048.3203%20116.507%2048.3203Z%22%20fill%3D%22url%28%23paint4_linear_1020_82405%29%22%2F%3E%3Cpath%20d%3D%22M116.507%2086.0703H78.6367C77.8481%2086.0703%2077.207%2087.045%2077.207%2088.2481C77.207%2089.4512%2077.8481%2090.4259%2078.6367%2090.4259H116.507C117.296%2090.4259%20117.934%2089.4512%20117.934%2088.2481C117.934%2087.045%20117.296%2086.0703%20116.507%2086.0703Z%22%20fill%3D%22url%28%23paint5_linear_1020_82405%29%22%2F%3E%3Cpath%20d%3D%22M116.507%2067.1953H78.6367C77.8481%2067.1953%2077.207%2068.17%2077.207%2069.3731C77.207%2070.5762%2077.8481%2071.5509%2078.6367%2071.5509H116.507C117.296%2071.5509%20117.934%2070.5762%20117.934%2069.3731C117.934%2068.17%20117.296%2067.1953%20116.507%2067.1953Z%22%20fill%3D%22url%28%23paint6_linear_1020_82405%29%22%2F%3E%3Cpath%20d%3D%22M116.507%20104.945H78.6367C77.8481%20104.945%2077.207%20105.92%2077.207%20107.123C77.207%20108.326%2077.8481%20109.301%2078.6367%20109.301H116.507C117.296%20109.301%20117.934%20108.326%20117.934%20107.123C117.934%20105.92%20117.296%20104.945%20116.507%20104.945Z%22%20fill%3D%22url%28%23paint7_linear_1020_82405%29%22%2F%3E%3CforeignObject%20x%3D%2270.7116%22%20y%3D%2260.6843%22%20width%3D%2279.8961%22%20height%3D%2279.81%22%3E%3Cdiv%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml%22%20style%3D%22backdrop-filter%3Ablur%288.34px%29%3Bclip-path%3Aurl%28%23bgblur_0_1020_82405_clip_path%29%3Bheight%3A100%25%3Bwidth%3A100%25%22%3E%3C%2Fdiv%3E%3C%2FforeignObject%3E%3Cpath%20data-figma-bg-blur-radius%3D%2216.6751%22%20d%3D%22M110.659%20123.819C123.513%20123.819%20133.932%20113.419%20133.932%20100.589C133.932%2087.7597%20123.513%2077.3594%20110.659%2077.3594C97.8062%2077.3594%2087.3867%2087.7597%2087.3867%20100.589C87.3867%20113.419%2097.8062%20123.819%20110.659%20123.819Z%22%20fill%3D%22white%22%2F%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M110.659%2085.3419C111.63%2085.3458%20112.413%2086.1299%20112.411%2087.0961L112.395%2098.2651L123.584%2098.2817C124.555%2098.2856%20125.338%2099.0696%20125.339%20100.038C125.335%20101.007%20124.55%20101.789%20123.579%20101.79L112.39%20101.773L112.373%20112.942C112.372%20113.908%20111.586%20114.69%20110.615%20114.691C109.645%20114.687%20108.862%20113.903%20108.861%20112.935L108.877%20101.766L97.6878%20101.749C96.7198%20101.748%2095.9366%20100.964%2095.9355%2099.9948C95.9395%2099.0261%2096.725%2098.2443%2097.693%2098.2458L108.883%2098.2623L108.899%2087.0934C108.903%2086.1247%20109.689%2085.3429%20110.659%2085.3419Z%22%20fill%3D%22%23CBD5E1%22%2F%3E%3Cdefs%3E%3CclipPath%20id%3D%22bgblur_0_1020_82405_clip_path%22%20transform%3D%22translate%28-70.7116%20-60.6843%29%22%3E%3Cpath%20d%3D%22M110.659%20123.819C123.513%20123.819%20133.932%20113.419%20133.932%20100.589C133.932%2087.7597%20123.513%2077.3594%20110.659%2077.3594C97.8062%2077.3594%2087.3867%2087.7597%2087.3867%20100.589C87.3867%20113.419%2097.8062%20123.819%20110.659%20123.819Z%22%2F%3E%3C%2FclipPath%3E%3ClinearGradient%20id%3D%22paint0_linear_1020_82405%22%20x1%3D%2247.1291%22%20y1%3D%2252.497%22%20x2%3D%2272.7628%22%20y2%3D%2252.497%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23CBD5E1%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23F8F9FB%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint1_linear_1020_82405%22%20x1%3D%2247.1291%22%20y1%3D%2271.372%22%20x2%3D%2272.7628%22%20y2%3D%2271.372%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23CBD5E1%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23F8F9FB%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint2_linear_1020_82405%22%20x1%3D%2247.1291%22%20y1%3D%2290.247%22%20x2%3D%2272.7628%22%20y2%3D%2290.247%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23CBD5E1%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23F8F9FB%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint3_linear_1020_82405%22%20x1%3D%2247.1291%22%20y1%3D%22109.122%22%20x2%3D%2272.7628%22%20y2%3D%22109.122%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23CBD5E1%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23F8F9FB%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint4_linear_1020_82405%22%20x1%3D%2275.4847%22%20y1%3D%2252.497%22%20x2%3D%22120.344%22%20y2%3D%2252.497%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23CBD5E1%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23F8F9FB%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint5_linear_1020_82405%22%20x1%3D%2275.4847%22%20y1%3D%2290.247%22%20x2%3D%22120.344%22%20y2%3D%2290.247%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23CBD5E1%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23F8F9FB%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint6_linear_1020_82405%22%20x1%3D%2275.4847%22%20y1%3D%2271.372%22%20x2%3D%22120.344%22%20y2%3D%2271.372%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23CBD5E1%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23F8F9FB%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint7_linear_1020_82405%22%20x1%3D%2275.4847%22%20y1%3D%22109.122%22%20x2%3D%22120.344%22%20y2%3D%22109.122%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23CBD5E1%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23F8F9FB%22%2F%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%3C%2Fsvg%3E";
|
|
2
|
+
//# sourceMappingURL=Search-result(add new).svg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Search-result(add new).svg.js","sources":["../../../../../src/features/LearningManagement/assets/Search-result(add new).svg"],"sourcesContent":["export default \"data:image/svg+xml,%3Csvg%20width%3D%22160%22%20height%3D%22153%22%20viewBox%3D%220%200%20160%20153%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M79.2744%20143.735C116.627%20143.735%20146.909%20113.508%20146.909%2076.223C146.909%2038.9359%20116.627%208.71106%2079.2744%208.71106C41.9192%208.71106%2011.6367%2038.9359%2011.6367%2076.223C11.6367%20113.508%2041.9192%20143.735%2079.2744%20143.735Z%22%20fill%3D%22%23F8FAFC%22%2F%3E%3Cpath%20d%3D%22M116.902%2030.8984H43.3269C38.7417%2030.8984%2035.0234%2034.7993%2035.0234%2039.6097H125.205C125.205%2034.7993%20121.489%2030.8984%20116.902%2030.8984Z%22%20fill%3D%22%23D0D9E4%22%2F%3E%3Cpath%20d%3D%22M35.0234%2039.6094H125.205V109.239C125.205%20112.335%20123.994%20115.304%20121.834%20117.494C119.674%20119.684%20116.745%20120.914%20113.692%20120.914H46.5394C43.4834%20120.914%2040.555%20119.684%2038.3973%20117.494C36.2372%20115.304%2035.0234%20112.335%2035.0234%20109.239V39.6094Z%22%20fill%3D%22%23F1F5F9%22%2F%3E%3Cpath%20d%3D%22M125.155%2039.6592V109.239C125.155%20112.322%20123.949%20115.279%20121.798%20117.459C119.647%20119.639%20116.731%20120.864%20113.691%20120.864H46.5391C43.4967%20120.864%2040.5809%20119.639%2038.4326%20117.459C36.2818%20115.279%2035.0732%20112.322%2035.0732%20109.239V39.6592H125.155Z%22%20stroke%3D%22%2364748B%22%20stroke-opacity%3D%220.1%22%20stroke-width%3D%220.1%22%2F%3E%3Cpath%20d%3D%22M70.571%2048.3203H48.9307C48.4799%2048.3203%2048.1133%2049.295%2048.1133%2050.4981C48.1133%2051.7012%2048.4799%2052.6759%2048.9307%2052.6759H70.571C71.0218%2052.6759%2071.386%2051.7012%2071.386%2050.4981C71.386%2049.295%2071.0218%2048.3203%2070.571%2048.3203Z%22%20fill%3D%22url%28%23paint0_linear_1020_82405%29%22%2F%3E%3Cpath%20d%3D%22M70.571%2067.1953H48.9307C48.4799%2067.1953%2048.1133%2068.17%2048.1133%2069.3731C48.1133%2070.5762%2048.4799%2071.5509%2048.9307%2071.5509H70.571C71.0218%2071.5509%2071.386%2070.5762%2071.386%2069.3731C71.386%2068.17%2071.0218%2067.1953%2070.571%2067.1953Z%22%20fill%3D%22url%28%23paint1_linear_1020_82405%29%22%2F%3E%3Cpath%20d%3D%22M70.571%2086.0703H48.9307C48.4799%2086.0703%2048.1133%2087.0468%2048.1133%2088.2493C48.1133%2089.4517%2048.4799%2090.4259%2048.9307%2090.4259H70.571C71.0218%2090.4259%2071.386%2089.4517%2071.386%2088.2493C71.386%2087.0468%2071.0218%2086.0703%2070.571%2086.0703Z%22%20fill%3D%22url%28%23paint2_linear_1020_82405%29%22%2F%3E%3Cpath%20d%3D%22M70.571%20104.945H48.9307C48.4799%20104.945%2048.1133%20105.922%2048.1133%20107.124C48.1133%20108.327%2048.4799%20109.301%2048.9307%20109.301H70.571C71.0218%20109.301%2071.386%20108.327%2071.386%20107.124C71.386%20105.922%2071.0218%20104.945%2070.571%20104.945Z%22%20fill%3D%22url%28%23paint3_linear_1020_82405%29%22%2F%3E%3Cpath%20d%3D%22M116.507%2048.3203H78.6367C77.8481%2048.3203%2077.207%2049.295%2077.207%2050.4981C77.207%2051.7012%2077.8481%2052.6759%2078.6367%2052.6759H116.507C117.296%2052.6759%20117.934%2051.7012%20117.934%2050.4981C117.934%2049.295%20117.296%2048.3203%20116.507%2048.3203Z%22%20fill%3D%22url%28%23paint4_linear_1020_82405%29%22%2F%3E%3Cpath%20d%3D%22M116.507%2086.0703H78.6367C77.8481%2086.0703%2077.207%2087.045%2077.207%2088.2481C77.207%2089.4512%2077.8481%2090.4259%2078.6367%2090.4259H116.507C117.296%2090.4259%20117.934%2089.4512%20117.934%2088.2481C117.934%2087.045%20117.296%2086.0703%20116.507%2086.0703Z%22%20fill%3D%22url%28%23paint5_linear_1020_82405%29%22%2F%3E%3Cpath%20d%3D%22M116.507%2067.1953H78.6367C77.8481%2067.1953%2077.207%2068.17%2077.207%2069.3731C77.207%2070.5762%2077.8481%2071.5509%2078.6367%2071.5509H116.507C117.296%2071.5509%20117.934%2070.5762%20117.934%2069.3731C117.934%2068.17%20117.296%2067.1953%20116.507%2067.1953Z%22%20fill%3D%22url%28%23paint6_linear_1020_82405%29%22%2F%3E%3Cpath%20d%3D%22M116.507%20104.945H78.6367C77.8481%20104.945%2077.207%20105.92%2077.207%20107.123C77.207%20108.326%2077.8481%20109.301%2078.6367%20109.301H116.507C117.296%20109.301%20117.934%20108.326%20117.934%20107.123C117.934%20105.92%20117.296%20104.945%20116.507%20104.945Z%22%20fill%3D%22url%28%23paint7_linear_1020_82405%29%22%2F%3E%3CforeignObject%20x%3D%2270.7116%22%20y%3D%2260.6843%22%20width%3D%2279.8961%22%20height%3D%2279.81%22%3E%3Cdiv%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml%22%20style%3D%22backdrop-filter%3Ablur%288.34px%29%3Bclip-path%3Aurl%28%23bgblur_0_1020_82405_clip_path%29%3Bheight%3A100%25%3Bwidth%3A100%25%22%3E%3C%2Fdiv%3E%3C%2FforeignObject%3E%3Cpath%20data-figma-bg-blur-radius%3D%2216.6751%22%20d%3D%22M110.659%20123.819C123.513%20123.819%20133.932%20113.419%20133.932%20100.589C133.932%2087.7597%20123.513%2077.3594%20110.659%2077.3594C97.8062%2077.3594%2087.3867%2087.7597%2087.3867%20100.589C87.3867%20113.419%2097.8062%20123.819%20110.659%20123.819Z%22%20fill%3D%22white%22%2F%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M110.659%2085.3419C111.63%2085.3458%20112.413%2086.1299%20112.411%2087.0961L112.395%2098.2651L123.584%2098.2817C124.555%2098.2856%20125.338%2099.0696%20125.339%20100.038C125.335%20101.007%20124.55%20101.789%20123.579%20101.79L112.39%20101.773L112.373%20112.942C112.372%20113.908%20111.586%20114.69%20110.615%20114.691C109.645%20114.687%20108.862%20113.903%20108.861%20112.935L108.877%20101.766L97.6878%20101.749C96.7198%20101.748%2095.9366%20100.964%2095.9355%2099.9948C95.9395%2099.0261%2096.725%2098.2443%2097.693%2098.2458L108.883%2098.2623L108.899%2087.0934C108.903%2086.1247%20109.689%2085.3429%20110.659%2085.3419Z%22%20fill%3D%22%23CBD5E1%22%2F%3E%3Cdefs%3E%3CclipPath%20id%3D%22bgblur_0_1020_82405_clip_path%22%20transform%3D%22translate%28-70.7116%20-60.6843%29%22%3E%3Cpath%20d%3D%22M110.659%20123.819C123.513%20123.819%20133.932%20113.419%20133.932%20100.589C133.932%2087.7597%20123.513%2077.3594%20110.659%2077.3594C97.8062%2077.3594%2087.3867%2087.7597%2087.3867%20100.589C87.3867%20113.419%2097.8062%20123.819%20110.659%20123.819Z%22%2F%3E%3C%2FclipPath%3E%3ClinearGradient%20id%3D%22paint0_linear_1020_82405%22%20x1%3D%2247.1291%22%20y1%3D%2252.497%22%20x2%3D%2272.7628%22%20y2%3D%2252.497%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23CBD5E1%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23F8F9FB%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint1_linear_1020_82405%22%20x1%3D%2247.1291%22%20y1%3D%2271.372%22%20x2%3D%2272.7628%22%20y2%3D%2271.372%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23CBD5E1%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23F8F9FB%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint2_linear_1020_82405%22%20x1%3D%2247.1291%22%20y1%3D%2290.247%22%20x2%3D%2272.7628%22%20y2%3D%2290.247%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23CBD5E1%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23F8F9FB%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint3_linear_1020_82405%22%20x1%3D%2247.1291%22%20y1%3D%22109.122%22%20x2%3D%2272.7628%22%20y2%3D%22109.122%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23CBD5E1%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23F8F9FB%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint4_linear_1020_82405%22%20x1%3D%2275.4847%22%20y1%3D%2252.497%22%20x2%3D%22120.344%22%20y2%3D%2252.497%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23CBD5E1%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23F8F9FB%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint5_linear_1020_82405%22%20x1%3D%2275.4847%22%20y1%3D%2290.247%22%20x2%3D%22120.344%22%20y2%3D%2290.247%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23CBD5E1%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23F8F9FB%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint6_linear_1020_82405%22%20x1%3D%2275.4847%22%20y1%3D%2271.372%22%20x2%3D%22120.344%22%20y2%3D%2271.372%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23CBD5E1%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23F8F9FB%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint7_linear_1020_82405%22%20x1%3D%2275.4847%22%20y1%3D%22109.122%22%20x2%3D%22120.344%22%20y2%3D%22109.122%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23CBD5E1%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23F8F9FB%22%2F%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%3C%2Fsvg%3E\""],"names":[],"mappings":"qGA0Ke"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),r=require("@mui/material"),o=require("lucide-react"),i=require("primereact/toast"),s=require("uuid"),a=require("../../assets/Search-result(add new).svg.js"),l=require("../../store/useAuthStore.js"),u=require("../../config.js"),c=require("../../apis/scopeApis.js"),d=require("./InputField.js"),p=require("./StationAutocomplete.js"),f=require("../CardSkeleton.js"),g=require("./OnboardingLoader.js"),x=require("./TemplateCard.js"),_=[{label:"5am to 7pm",value:"05:00 AM - 7:00 PM"},{label:"6am to 7pm",value:"06:00 AM - 7:00 PM"}],m=[{label:"Low Sellout",value:"Low Sellout"},{label:"High Sellout",value:"High Sellout"},{label:"None",value:""}],h=[{label:"None",value:"None"},{label:"Distribute spots evenly across all breaks in the hour",value:"Distribute spots evenly across all breaks in the hour"}];exports.default=function(v){var S,y=v.isOpen,b=v.onClose,j=v.onBoardStation,w=v.app_integration_id,C=v.token,T=v.stationNameParam,O=t.useState(null),F=O[0],N=O[1],B=t.useState([]),A=B[0],E=B[1],M=t.useState(0),D=M[0],q=M[1],I=t.useState(!0),k=I[0],P=I[1],R=t.useState(!1),z=R[0],L=R[1],W=t.useState([]),G=W[0],U=W[1],Y=t.useState(""),H=Y[0],K=Y[1],X=t.useState(""),J=X[0],Q=X[1],V=t.useState(!1),Z=V[0],$=V[1],ee=t.useState(!1),ne=ee[0],te=ee[1],re=t.useState(null),oe=re[0],ie=re[1],se=t.useState(!1),ae=se[0],le=se[1],ue=t.useState(0),ce=ue[0],de=ue[1],pe=t.useState(""),fe=pe[0],ge=pe[1],xe=l.default().user,_e=t.useRef(null),me=t.useRef(null),he=t.useRef(null),ve=t.useRef(null),Se=t.useState({region:"",primeTime:["06:00 AM - 7:00 PM"],genre:"Music",type:"",lowSelloutConfig:""}),ye=Se[0],be=Se[1],je=function(e,n){return e.find(function(e){return e.value===n})||null},we=t.useMemo(function(){return A.map(function(e){return{label:e.scope_name,value:e.scope_name}})},[A]),Ce=t.useMemo(function(){var e,n,t;if(!ye.genre)return null;var r=A.find(function(e){return e.scope_name===ye.genre});return r?{id:r.id,title:r.scope_name||"Unnamed Template",description:(null===(e=r.description)||void 0===e?void 0:e.trim())||"No description available.",inheritedText:(null===(n=r.inheritance)||void 0===n?void 0:n[0])||void 0,rulesCount:r.rules_count||0,tiersCount:r.tier_count||0,isCopy:null!==(t=r.is_copy)&&void 0!==t&&t}:null},[ye.genre,A]);t.useEffect(function(){return function(){he.current&&clearTimeout(he.current)}},[]);var Te=function(n){return e.__awaiter(void 0,void 0,void 0,function(){var t,r,o;return e.__generator(this,function(i){switch(i.label){case 0:if(z)return[2];L(!0),i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,c.retrieveGenreScopes({limit:"20",offset:String(n)})];case 2:return"success"===(null==(t=i.sent())?void 0:t.status)&&Array.isArray(null==t?void 0:t.data)?(r=t.data,E(function(t){if(0===n)return r;var o=new Set(t.map(function(e){return e.id})),i=r.filter(function(e){return!o.has(e.id)});return e.__spreadArray(e.__spreadArray([],t,!0),i,!0)}),r.length<20?P(!1):P(!0),q(n+20)):P(!1),[3,5];case 3:return o=i.sent(),console.error("[StationOnboard] Failed to fetch genre scopes:",o),P(!1),[3,5];case 4:return L(!1),[7];case 5:return[2]}})})};t.useEffect(function(){if(y&&(E([]),q(0),P(!0),Te(0),T)){ge(T);e.__awaiter(void 0,void 0,void 0,function(){var n,t,r;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,c.fetchStationsByKeyword(T,!0)];case 1:return!0===(null==(n=e.sent())?void 0:n.success)&&Array.isArray(null==n?void 0:n.data)&&(t=n.data.find(function(e){var n;return(null===(n=e.station_name)||void 0===n?void 0:n.toLowerCase())===T.toLowerCase()&&!e.ruleset_id}),t&&N(t)),[3,3];case 2:return r=e.sent(),console.error("[StationOnboard] Error auto-selecting station:",r),[3,3];case 3:return[2]}})})}},[y,T]);t.useEffect(function(){be(F?function(n){var t;return e.__assign(e.__assign({},n),{region:null!==(t=F.market)&&void 0!==t?t:""})}:{region:"",primeTime:["06:00 AM - 7:00 PM"],genre:"Music",type:"",lowSelloutConfig:""})},[F]),t.useEffect(function(){var e=setTimeout(function(){Q(H)},500);return function(){return clearTimeout(e)}},[H]),t.useEffect(function(){e.__awaiter(void 0,void 0,void 0,function(){var n,t,r;return e.__generator(this,function(e){switch(e.label){case 0:if(!J.trim())return U([]),[2];$(!0),e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,c.searchScopes({search_string:J})];case 2:return"success"===(null==(n=e.sent())?void 0:n.status)&&Array.isArray(null==n?void 0:n.data)?(t=n.data.map(function(e){var n,t,r;return{id:e.id,title:e.scope_name||"Unnamed Template",description:(null===(n=e.description)||void 0===n?void 0:n.trim())||"No description available.",inheritedText:(null===(t=e.inheritance)||void 0===t?void 0:t[0])||void 0,rulesCount:e.rules_count||0,tiersCount:e.tier_count||0,isCopy:null!==(r=e.is_copy)&&void 0!==r&&r}}),U(t)):U([]),[3,5];case 3:return r=e.sent(),console.error("[StationOnboard] Error searching scopes:",r),U([]),[3,5];case 4:return $(!1),[7];case 5:return[2]}})})},[J]),t.useEffect(function(){!J.trim()&&Ce&&ie(Ce.id)},[J,Ce]);var Oe=function(){setTimeout(function(){ve.current&&ve.current.scrollTo({top:ve.current.scrollHeight,behavior:"smooth"})},100)},Fe=function(){ge(""),N(null),be({region:"",primeTime:["06:00 AM - 7:00 PM"],genre:"Music",type:"",lowSelloutConfig:""}),U([]),K(""),ie(null),b()},Ne=function(n,t){var r;if("primeTime"!==n){var o=null!==(r=null==t?void 0:t.value)&&void 0!==r?r:"";be(function(t){var r;return e.__assign(e.__assign({},t),((r={})[n]=String(o),r))}),"genre"===n&&(te(!0),he.current&&clearTimeout(he.current),he.current=setTimeout(function(){var e=A.find(function(e){return e.scope_name===o});ie(e?e.id:null),te(!1)},800))}else{var i=(null==t?void 0:t.value)?String(t.value):"";be(function(n){return e.__assign(e.__assign({},n),{primeTime:i?[i]:[]})})}},Be=Boolean(F&&ye.region&&ye.primeTime.length>0&&ye.genre);return n.jsxs(r.Dialog,e.__assign({open:y,onClose:Fe,maxWidth:!1,disableEscapeKeyDown:!0,PaperProps:{sx:{width:"90vw",height:"90vh",borderRadius:"12px",display:"flex",flexDirection:"column",overflow:"hidden"}}},{children:[n.jsx(i.Toast,{ref:_e}),n.jsxs(r.Box,e.__assign({sx:{p:"20px 20px 20px 27px",borderBottom:"1px solid #F0F2F5",display:"flex",justifyContent:"space-between",alignItems:"center",bgcolor:"#fff"}},{children:[n.jsxs(r.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:.5}},{children:[n.jsx(r.Typography,e.__assign({sx:{fontSize:"18px",fontWeight:600,color:"#19213D"}},{children:"Onboard a Station"})),n.jsx(r.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:400,color:"#666F8D"}},{children:"Onboard a station to start configuring learnings."}))]})),n.jsx(r.IconButton,e.__assign({onClick:Fe,disabled:ae,sx:{color:"#19213D"}},{children:n.jsx(o.X,{size:24})}))]})),n.jsxs(r.DialogContent,e.__assign({sx:{p:0,bgcolor:"#F8FAFC",display:"flex",flexDirection:"row",overflow:"hidden",position:"relative"}},{children:[n.jsx(g.default,{isLoading:ae,currentStep:ce,onComplete:function(){le(!1);var e=me.current;Fe(),j(e||void 0),me.current=null}}),n.jsxs(r.Box,e.__assign({sx:{display:"flex",flex:1,paddingY:"14px",paddingX:"20px",gap:3,overflowY:"hidden"}},{children:[n.jsxs(r.Box,e.__assign({ref:ve,sx:{flex:1,bgcolor:"#fff",p:3,borderRadius:"16px",border:"1px solid #F0F2F5",height:"100%",overflowY:"auto"}},{children:[n.jsx(r.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:600,mb:.5,color:"#19213D"}},{children:"Basic Details"})),n.jsx(r.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#00000080",mb:"20px"}},{children:"Set up basic station details to unlock AI recommended scopes."})),n.jsxs(r.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[n.jsxs(r.Box,e.__assign({className:"space-y-1.5"},{children:[n.jsxs("label",e.__assign({className:"text-sm font-medium text-[#19213D]"},{children:[n.jsx("span",e.__assign({className:"mr-0.5 text-xs font-semibold text-[#8F2C23]"},{children:"*"})),"Station Name/Call Letters"]})),n.jsx(p.default,{value:fe,onChange:ge,onStationSelect:function(e){return N(e)}})]})),n.jsx(d.default,{required:!0,disabled:!0,label:"Region",placeholder:"Select Region",value:ye.region||void 0,isSearchable:!1}),n.jsx(d.default,{required:!0,label:"Prime Time Window",placeholder:"Select Prime Time",options:_,value:je(_,(null===(S=ye.primeTime)||void 0===S?void 0:S[0])||""),onOptionChange:function(e){return Ne("primeTime",e)},isSearchable:!1}),n.jsx(r.Box,e.__assign({onClick:Oe,sx:{width:"100%"}},{children:n.jsx(d.default,{required:!0,label:"Genre",placeholder:"Select Genre",options:we,value:je(we,ye.genre),onOptionChange:function(e){return Ne("genre",e)},isSearchable:!1,onMenuScrollToBottom:function(){!z&&k&&Te(D)},isLoadingOptions:z,hasMoreOptions:k})})),n.jsx(r.Box,e.__assign({onClick:Oe,sx:{width:"100%"}},{children:n.jsx(d.default,{label:"Station Type",placeholder:"None",options:m,value:je(m,ye.type),onOptionChange:function(n){Ne("type",n),"Low Sellout"!==(null==n?void 0:n.value)&&be(function(n){return e.__assign(e.__assign({},n),{lowSelloutConfig:""})})},isSearchable:!1})})),"Low Sellout"===ye.type&&n.jsx(r.Box,e.__assign({onClick:Oe,sx:{width:"100%"}},{children:n.jsx(d.default,{label:"Low Sell Out Configurations",placeholder:"Select Configuration",options:h,value:je(h,ye.lowSelloutConfig),onOptionChange:function(e){return Ne("lowSelloutConfig",e)},isSearchable:!1})}))]}))]})),n.jsx(r.Box,e.__assign({sx:{flex:1,bgcolor:"#fff",p:3,borderRadius:"12px",border:"1px solid #F0F2F5",display:"flex",flexDirection:"column",height:"100%",overflowY:"auto"}},{children:ye.genre?n.jsxs(n.Fragment,{children:[n.jsx(r.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:500,mb:1.5}},{children:"Matching scope for your station"})),n.jsx(r.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:2,mb:4}},{children:ne?n.jsx(f.default,{}):Ce?n.jsx(x.default,e.__assign({},Ce,{isSelected:oe===Ce.id,onSelect:ie}),Ce.id):null})),n.jsx(r.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:500,mb:1.5}},{children:"Other available stations"})),n.jsxs("div",e.__assign({className:"relative mb-4 w-full"},{children:[n.jsx("input",{type:"text",value:H,onChange:function(e){return K(e.target.value)},placeholder:"Search for station...",className:"w-full rounded-lg border border-[#E2E8F0] px-10 py-[7px] text-[12px] outline-none transition-all placeholder:text-[#BAC0CC] focus:border-blue-500 focus:ring-1 focus:ring-blue-500"}),n.jsx(o.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400",size:16})]})),n.jsxs(r.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:2}},{children:[Z&&n.jsx(f.default,{}),!Z&&0===G.length&&J.trim()&&n.jsxs(r.Typography,e.__assign({sx:{fontSize:"0.875rem",color:"#64748B",textAlign:"center",py:4}},{children:['No scopes found matching "',J,'".']})),!Z&&G.map(function(t){return n.jsx(x.default,e.__assign({},t,{isSelected:oe===t.id,onSelect:ie}),t.id)})]}))]}):n.jsxs(n.Fragment,{children:[n.jsx(r.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:500,mb:1.5}},{children:"Fill in the station details to load AI recommended scopes"})),n.jsx(r.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#64748B",mb:3}},{children:"AI will recommend the most relevant scope for this station."})),n.jsx(r.Box,e.__assign({sx:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",opacity:.5,py:10}},{children:n.jsx("img",{src:a.default,alt:"Empty Result"})}))]})}))]}))]})),n.jsxs(r.Box,e.__assign({sx:{p:"12px 20px",borderTop:"1px solid #F0F2F5",display:"flex",justifyContent:"flex-end",gap:2,bgcolor:"#fff"}},{children:[n.jsx("button",e.__assign({onClick:Fe,disabled:ae,style:{padding:"7px 10px",borderRadius:"6px",color:"#64748B",border:"1px solid #E2E8F0",backgroundColor:"#fff",cursor:"pointer",fontSize:"14px",fontWeight:500}},{children:"Cancel"})),n.jsx("button",e.__assign({onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var n,t,r,o,i,a,l,d,p,f,g,x,_,m,h,v,S,y;return e.__generator(this,function(b){switch(b.label){case 0:if(!F||!oe)return console.error("[StationOnboard] Missing required data for onboarding"),[2];n=Ce?e.__spreadArray([Ce],G,!0):G,t=n.find(function(e){return e.id===oe}),r=null!==(_=null==t?void 0:t.isCopy)&&void 0!==_&&_,le(!0),de(0),o=null,b.label=1;case 1:return b.trys.push([1,3,,4]),i={topic:"customRuleSet",customScopeGroupName:(null===u.IL_CONFIG_CONSTANTS||void 0===u.IL_CONFIG_CONSTANTS?void 0:u.IL_CONFIG_CONSTANTS.CUSTOM_SCOPE_GROUP_NAME)||"Audacy-Traffic-Manager",scopeDescription:F.station_name||"New Station",parentScopeId:null,customScopeName:F.station_name||"New Station",customScopeId:s.v4(),createByName:(null==xe?void 0:xe.firstname)||"System",createdBy:(null==xe?void 0:xe.email)||"system@audacy.com",applicationMappingId:w},console.log("[StationOnboard] Step 1: Creating rule set with payload:",i),[4,c.createRuleSet(i,C)];case 2:if(a=b.sent(),!(o=null===(m=null==a?void 0:a.data)||void 0===m?void 0:m.scopeId))throw new Error("Failed to create scope - no scopeId returned");return de(1),[3,4];case 3:return l=b.sent(),console.error("[StationOnboard] Error creating rule set:",l),null===(h=_e.current)||void 0===h||h.show({severity:"error",life:3e3,summary:"Error",detail:"Failed to create rule set. Please try again."}),le(!1),de(0),[2];case 4:return b.trys.push([4,6,,11]),d={market:F.market,region:F.region,primetime_windows:ye.primeTime,genre:ye.genre,station_type:""===ye.type?null:ye.type,low_sellout_configurations:"Low Sellout"===ye.type?ye.lowSelloutConfig:null,ruleset_id:o,station_guid:F.station_guid,station_name:F.station_name||"New Station"},console.log("[StationOnboard] Step 2: Updating station with payload:",d),[4,c.updateStation(d)];case 5:return b.sent(),de(2),[3,11];case 6:p=b.sent(),console.error("[StationOnboard] Error updating station, rolling back rule set:",p),409===p.status?(null===(v=_e.current)||void 0===v||v.show({severity:"error",life:2500,summary:"Error updating station",detail:"Station already Onboarded."}),N(null),ie(null),ge(""),be(function(n){return e.__assign(e.__assign({},n),{region:""})})):null===(S=_e.current)||void 0===S||S.show({severity:"error",life:2500,summary:"Error updating station",detail:"Please try again."}),b.label=7;case 7:return b.trys.push([7,9,,10]),[4,c.deleteRuleSet(o,C)];case 8:return b.sent(),[3,10];case 9:return f=b.sent(),console.error("[StationOnboard] Failed to rollback rule set deletion:",f),[3,10];case 10:return le(!1),de(0),[2];case 11:return b.trys.push([11,13,,14]),g={source_scope_id:oe,target_scope_id:o,is_copy_parent_variant_id:r},console.log("[StationOnboard] Step 3: Inheriting scope with payload:",g),[4,c.inheritScope(g)];case 12:return b.sent(),de(3),[3,14];case 13:return x=b.sent(),console.error("[StationOnboard] Error inheriting scope (no rollback):",x),null===(y=_e.current)||void 0===y||y.show({severity:"error",life:3e3,summary:"Error",detail:"Failed to apply rule template. Please try again."}),le(!1),de(0),[2];case 14:return me.current=o,[2]}})})},disabled:!Be||ae,style:{padding:"7px 10px",borderRadius:"6px",border:"none",backgroundColor:Be?"#2563EB":"#BFDBFE",color:"#fff",cursor:Be&&!ae?"pointer":"not-allowed",fontSize:"14px",fontWeight:500,display:"flex",alignItems:"center",gap:"7px"}},{children:ae?n.jsxs(n.Fragment,{children:[n.jsx(r.CircularProgress,{size:16,color:"inherit"}),n.jsx("span",{children:"Onboarding..."})]}):n.jsxs(n.Fragment,{children:[n.jsx("span",{children:"Onboard Station"}),n.jsx(o.ArrowRight,{size:16})]})}))]}))]}))};
|
|
2
|
+
//# sourceMappingURL=BackwardStationOnboardModal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BackwardStationOnboardModal.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/cjs/features/LearningManagement/components/StationOnboarding/StationOnboardModal.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),r=require("react"),o=require("@mui/material"),i=require("lucide-react"),t=require("primereact/toast"),s=require("uuid"),a=require("../../apis/scopeApis.js"),l=require("./StationAutocomplete.js"),u=require("../CardSkeleton.js"),c=require("./OnboardingLoader.js"),d=require("./TemplateCard.js"),p=require("../../styles/StationOnboardModal.module.css.js"),x=require("./InputField.js"),g=require("../../store/useAuthStore.js"),f=require("../../store/useConfigStore.js"),h=require("../../store/useLearningTemplateStore.js"),m=require("../../config.js"),_=[{label:"PT - Pacific Time",value:"Pacific Time"},{label:"MT - Mountain Time",value:"Mountain Time"},{label:"CT - Central Time",value:"Central Time"},{label:"ET - Eastern Time",value:"Eastern Time"}],S=[{label:"6am to 7pm",value:"06:00 AM - 7:00 PM"},{label:"5am to 7pm",value:"05:00 AM - 7:00 PM"}],v=[{label:"Low Sellout",value:"Low Sellout"},{label:"High Sellout",value:"High Sellout"},{label:"None",value:""}],b=[{label:"None",value:"None"},{label:"Distribute spots evenly across all breaks in the hour",value:"Distribute spots evenly across all breaks in the hour"}];exports.default=function(y){var j,T=y.isOpen,C=y.onClose,w=y.onBoardStation,B=y.app_integration_id,F=y.token,E=r.useState(null),O=E[0],z=E[1],k=r.useState([]),N=k[0],D=k[1],q=r.useState(0),R=q[0],I=q[1],M=r.useState(!0),A=M[0],L=M[1],P=r.useState(!1),W=P[0],G=P[1],Y=r.useState([]),U=Y[0],H=Y[1],X=r.useState(""),Z=X[0],K=X[1],J=r.useState(""),Q=J[0],V=J[1],$=r.useState(!1),ee=$[0],ne=$[1],re=r.useState(!1),oe=re[0],ie=re[1],te=r.useState(null),se=te[0],ae=te[1],le=r.useState(null);le[0],le[1];var ue=r.useState(!1),ce=ue[0],de=ue[1],pe=r.useState(0),xe=pe[0],ge=pe[1],fe=r.useState(""),he=fe[0],me=fe[1],_e=g.default().user,Se=r.useRef(null),ve=r.useRef(null),be=r.useRef(null),ye=r.useRef(null);f.useConfigStore().configuration;var je=r.useState({region:"",timezone:"",primeTime:[],genre:"",type:"",lowSelloutConfig:""}),Te=je[0],Ce=je[1],we=function(e,n){return e.find(function(e){return e.value===n})||null},Be=r.useMemo(function(){return N.map(function(e){return{label:e.scope_name,value:e.scope_name}})},[N]),Fe=r.useMemo(function(){var e,n,r;if(!Te.genre)return null;var o=N.find(function(e){return e.scope_name===Te.genre});return o?{id:o.id,title:o.scope_name||"Unnamed Template",description:(null===(e=o.description)||void 0===e?void 0:e.trim())||"No description available.",inheritedText:(null===(n=o.inheritance)||void 0===n?void 0:n[0])||void 0,rulesCount:o.rules_count||0,tiersCount:o.tier_count||0,isCopy:null!==(r=o.is_copy)&&void 0!==r&&r}:null},[Te.genre,N]);r.useEffect(function(){return function(){be.current&&clearTimeout(be.current)}},[]);var Ee=function(n){return e.__awaiter(void 0,void 0,void 0,function(){var r,o,i;return e.__generator(this,function(t){switch(t.label){case 0:if(W)return[2];G(!0),t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,a.retrieveGenreScopes({limit:"20",offset:String(n)})];case 2:return"success"===(null==(r=t.sent())?void 0:r.status)&&Array.isArray(null==r?void 0:r.data)?(o=r.data,D(function(r){if(0===n)return o;var i=new Set(r.map(function(e){return e.id})),t=o.filter(function(e){return!i.has(e.id)});return e.__spreadArray(e.__spreadArray([],r,!0),t,!0)}),o.length<20?L(!1):L(!0),I(n+20)):L(!1),[3,5];case 3:return i=t.sent(),console.error("[StationOnboard] Failed to fetch genre scopes:",i),L(!1),[3,5];case 4:return G(!1),[7];case 5:return[2]}})})};r.useEffect(function(){T&&(D([]),I(0),L(!0),Ee(0))},[T]);r.useEffect(function(){Ce(O?function(n){var r;return e.__assign(e.__assign({},n),{region:null!==(r=O.market)&&void 0!==r?r:""})}:{region:"",timezone:"",primeTime:[],genre:"",type:"",lowSelloutConfig:""})},[O]),r.useEffect(function(){var e=setTimeout(function(){V(Z)},500);return function(){return clearTimeout(e)}},[Z]),r.useEffect(function(){e.__awaiter(void 0,void 0,void 0,function(){var n,r,o,i;return e.__generator(this,function(e){switch(e.label){case 0:if(!Q.trim())return H([]),[2];ne(!0),e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,a.searchScopes({search_string:Q.trim()})];case 2:return"success"===(null==(n=e.sent())?void 0:n.status)&&Array.isArray(null==n?void 0:n.data)?(r=n.data.filter(function(e){var n,r=null!==(n=e.inheritance)&&void 0!==n?n:[],o=r.indexOf(e.scope_name);return!(o<=0)&&r[o-1]===Te.genre}),o=r.map(function(e){var n,r,o;return{id:e.id,title:e.scope_name||"Unnamed Template",description:(null===(n=e.description)||void 0===n?void 0:n.trim())||"No description available.",inheritedText:(null===(r=e.inheritance)||void 0===r?void 0:r[0])||void 0,rulesCount:e.rules_count||0,tiersCount:e.tier_count||0,isCopy:null!==(o=e.is_copy)&&void 0!==o&&o}}),H(o)):H([]),[3,5];case 3:return i=e.sent(),console.error("[StationOnboard] Error searching scopes:",i),H([]),[3,5];case 4:return ne(!1),[7];case 5:return[2]}})})},[Q,Te.genre]),r.useEffect(function(){!Q.trim()&&Fe&&ae(Fe.id)},[Q,Fe]);var Oe=function(){setTimeout(function(){ye.current&&ye.current.scrollTo({top:ye.current.scrollHeight,behavior:"smooth"})},100)},ze=function(){me(""),z(null),Ce({region:"",timezone:"",primeTime:[],genre:"",type:"",lowSelloutConfig:""}),H([]),K(""),ae(null),C()},ke=function(n,r){var o;if("primeTime"!==n){var i=null!==(o=null==r?void 0:r.value)&&void 0!==o?o:"";Ce(function(r){var o;return e.__assign(e.__assign({},r),((o={})[n]=String(i),o))}),"genre"===n&&(ie(!0),be.current&&clearTimeout(be.current),be.current=setTimeout(function(){var e=N.find(function(e){return e.scope_name===i});ae(e?e.id:null),ie(!1)},800))}else{var t=(null==r?void 0:r.value)?String(r.value):"";Ce(function(n){return e.__assign(e.__assign({},n),{primeTime:t?[t]:[]})})}},Ne=Boolean(O&&Te.region&&Te.timezone&&Te.primeTime.length>0&&Te.genre);return n.jsxs(o.Dialog,e.__assign({open:T,onClose:ze,maxWidth:!1,disableEscapeKeyDown:!0,PaperProps:{sx:{width:"90vw",height:"90vh",borderRadius:"12px",display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"sans-serif"}}},{children:[n.jsx(t.Toast,{ref:Se}),n.jsxs(o.Box,e.__assign({sx:{p:"20px 20px 20px 27px",borderBottom:"1px solid #F0F2F5",display:"flex",justifyContent:"space-between",alignItems:"center",bgcolor:"#fff"}},{children:[n.jsxs(o.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:.5}},{children:[n.jsx(o.Typography,e.__assign({sx:{fontSize:"18px",fontWeight:600,color:"#19213D"}},{children:"Onboard a Station"})),n.jsx(o.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:400,color:"#666F8D"}},{children:"Onboard a station to start configuring learnings."}))]})),n.jsx(o.IconButton,e.__assign({onClick:ze,disabled:ce,sx:{color:"#19213D"}},{children:n.jsx(i.X,{size:24})}))]})),n.jsxs(o.DialogContent,e.__assign({sx:{p:0,bgcolor:"#F8FAFC",display:"flex",flexDirection:"row",overflow:"hidden",position:"relative"}},{children:[n.jsx(c.default,{isLoading:ce,currentStep:xe,onComplete:function(){de(!1);var e=ve.current;ze(),w(e||void 0),ve.current=null}}),n.jsxs(o.Box,e.__assign({sx:{display:"flex",flex:1,paddingY:"14px",paddingX:"20px",gap:3,overflowY:"hidden"}},{children:[n.jsxs(o.Box,e.__assign({ref:ye,sx:{flex:1,bgcolor:"#fff",p:3,borderRadius:"16px",border:"1px solid #F0F2F5",height:"100%",overflowY:"auto"}},{children:[n.jsx(o.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:600,mb:.5,color:"#19213D"}},{children:"Basic Details"})),n.jsx(o.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#00000080",mb:"20px"}},{children:"Set up basic station details to unlock AI recommended scopes."})),n.jsxs(o.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[n.jsxs(o.Box,e.__assign({className:p.default.formGroup},{children:[n.jsxs("label",e.__assign({className:p.default.label},{children:[n.jsx("span",e.__assign({className:p.default.asterisk},{children:"*"})),"Station Name/Call Letters"]})),n.jsx(l.default,{value:he,onChange:me,onStationSelect:function(e){return z(e)}})]})),n.jsx(x.default,{required:!0,disabled:!0,label:"Region",placeholder:"Select Region",value:Te.region||void 0,isSearchable:!1}),n.jsx(x.default,{required:!0,label:"TimeZone",placeholder:"Select TimeZone",options:_,value:we(_,Te.timezone),onOptionChange:function(e){return ke("timezone",e)},isSearchable:!1}),n.jsx(x.default,{required:!0,label:"Prime Time Window",placeholder:"Select Prime Time",options:S,value:we(S,(null===(j=Te.primeTime)||void 0===j?void 0:j[0])||""),onOptionChange:function(e){return ke("primeTime",e)},isSearchable:!1}),n.jsx(o.Box,e.__assign({onClick:Oe,sx:{width:"100%"}},{children:n.jsx(x.default,{label:"Station Type",placeholder:"None",options:v,value:we(v,Te.type),onOptionChange:function(n){ke("type",n),"Low Sellout"!==(null==n?void 0:n.value)&&Ce(function(n){return e.__assign(e.__assign({},n),{lowSelloutConfig:""})})},isSearchable:!1})})),"Low Sellout"===Te.type&&n.jsx(o.Box,e.__assign({onClick:Oe,sx:{width:"100%"}},{children:n.jsx(x.default,{label:"Low Sell Out Configurations",placeholder:"Select Configuration",options:b,value:we(b,Te.lowSelloutConfig),onOptionChange:function(e){return ke("lowSelloutConfig",e)},isSearchable:!1})}))]}))]})),n.jsxs(o.Box,e.__assign({sx:{flex:1,bgcolor:"#fff",p:3,borderRadius:"12px",border:"1px solid #F0F2F5",display:"flex",flexDirection:"column",height:"100%",overflowY:"auto"}},{children:[n.jsxs(o.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:600,mb:.5,color:"#19213D"}},{children:[n.jsx("span",e.__assign({style:{color:"#E53E3E",marginRight:"2px"}},{children:"*"})),"Select a scope for your station"]})),n.jsx(o.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#64748B",mb:"16px"}},{children:"Your station will inherit the rules from the selected scope."})),n.jsx(o.Box,e.__assign({sx:{mb:2}},{children:n.jsx(x.default,{required:!0,label:"",placeholder:"Select Genre",options:Be,value:we(Be,Te.genre),onOptionChange:function(e){return ke("genre",e)},isSearchable:!1,onMenuScrollToBottom:function(){!W&&A&&Ee(R)},isLoadingOptions:W,hasMoreOptions:A})})),n.jsx(o.Box,e.__assign({sx:{mb:3}},{children:oe?n.jsx(u.default,{}):Fe?n.jsxs(o.Box,e.__assign({sx:{border:"1.5px solid #2563EB",borderRadius:"10px",p:"14px 16px",bgcolor:"#EFF6FF",display:"flex",alignItems:"flex-start",gap:"12px"}},{children:[n.jsx(o.Box,e.__assign({sx:{width:36,height:36,borderRadius:"8px",bgcolor:"#DBEAFE",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0}},{children:n.jsxs("svg",e.__assign({width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"#2563EB",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:[n.jsx("circle",{cx:"12",cy:"12",r:"2"}),n.jsx("path",{d:"M16.24 7.76a6 6 0 0 1 0 8.49m-8.48-.01a6 6 0 0 1 0-8.49m11.31-2.82a10 10 0 0 1 0 14.14m-14.14 0a10 10 0 0 1 0-14.14"})]}))})),n.jsxs(o.Box,e.__assign({sx:{flex:1,minWidth:0}},{children:[n.jsx(o.Typography,e.__assign({sx:{fontSize:"0.875rem",fontWeight:600,color:"#1E3A5F",mb:"2px"}},{children:Fe.title})),n.jsx(o.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#2563EB",mb:"8px"}},{children:Fe.description})),n.jsxs(o.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"}},{children:[Fe.inheritedText&&n.jsxs(o.Box,e.__assign({component:"span",sx:{fontSize:"0.7rem",color:"#475569",bgcolor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"4px",px:"6px",py:"2px",display:"inline-flex",alignItems:"center",gap:"4px"}},{children:[n.jsxs("svg",e.__assign({width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:[n.jsx("polyline",{points:"15 3 21 3 21 9"}),n.jsx("path",{d:"M21 3L9 15"}),n.jsx("path",{d:"M3 21l6-6"})]})),Fe.inheritedText]})),n.jsxs(o.Box,e.__assign({component:"span",sx:{fontSize:"0.7rem",color:"#475569",bgcolor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"4px",px:"6px",py:"2px"}},{children:[Fe.rulesCount," rules"]})),n.jsxs(o.Box,e.__assign({component:"span",sx:{fontSize:"0.7rem",color:"#475569",bgcolor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"4px",px:"6px",py:"2px"}},{children:[Fe.tiersCount," Tiers"]}))]}))]}))]})):Te.genre?null:n.jsxs(o.Box,e.__assign({sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",opacity:.4,py:6,gap:1}},{children:[n.jsx(i.Brush,{size:28}),n.jsx(o.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#94A3B8"}},{children:"Select a genre to load the matching scope"}))]}))})),Te.genre&&n.jsxs(n.Fragment,{children:[n.jsxs(o.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:600,mb:.5,color:"#19213D"}},{children:["Select an Existing Station from the “",Te.genre,"” Scope"," ",n.jsx(o.Typography,e.__assign({component:"span",sx:{fontSize:"1rem",fontWeight:400,color:"#64748B"}},{children:"(Optional)"}))]})),n.jsxs(o.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#64748B",mb:"12px"}},{children:["Please select an existing station under the “",Te.genre,"” category to copy its learnings."]})),n.jsxs("div",e.__assign({className:p.default.searchWrapper,style:{marginBottom:"12px"}},{children:[n.jsx("input",{type:"text",value:Z,onChange:function(e){return K(e.target.value)},placeholder:"Search for station...",className:p.default.searchInput}),n.jsx(i.Search,{className:p.default.searchIcon,size:16})]})),n.jsxs(o.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:2}},{children:[ee&&n.jsx(u.default,{}),!ee&&0===U.length&&Q.trim()&&n.jsxs(o.Typography,e.__assign({sx:{fontSize:"0.875rem",color:"#64748B",textAlign:"center",py:4}},{children:['No scopes found matching "',Q,'".']})),!ee&&U.map(function(r){return n.jsx(d.default,e.__assign({},r,{isSelected:se===r.id,onSelect:function(e){var n;ae(se===e?null!==(n=null==Fe?void 0:Fe.id)&&void 0!==n?n:null:e)}}),r.id)})]}))]})]}))]}))]})),n.jsxs(o.Box,e.__assign({sx:{p:"12px 20px",borderTop:"1px solid #F0F2F5",display:"flex",justifyContent:"flex-end",gap:2,bgcolor:"#fff"}},{children:[n.jsx("button",e.__assign({onClick:ze,disabled:ce,style:{padding:"7px 10px",borderRadius:"6px",color:"#64748B",border:"1px solid #E2E8F0",backgroundColor:"#fff",cursor:"pointer",fontSize:"14px",fontWeight:500}},{children:"Cancel"})),n.jsx("button",e.__assign({onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var n,r,o,i,t,l,u,c,d,p,x,g,f,_;return e.__generator(this,function(S){switch(S.label){case 0:if(!O||!se)return console.error("[StationOnboard] Missing required data for onboarding"),[2];n=Fe?e.__spreadArray([Fe],U,!0):U,r=n.find(function(e){return e.id===se}),null==r?void 0:r.isCopy,de(!0),ge(0),o=null,S.label=1;case 1:return S.trys.push([1,3,,4]),i=h.useLearningTemplateStore.getState().backwardCompatibility,t=i?{topic:"customRuleSet",customScopeGroupName:m.IL_CONFIG_CONSTANTS.CUSTOM_SCOPE_GROUP_NAME,scopeDescription:O.station_name||"New Station",parentScopeId:null,customScopeName:O.station_name||"New Station",customScopeId:s.v4(),createByName:(null==_e?void 0:_e.firstname)||"System",createdBy:(null==_e?void 0:_e.email)||"system@audacy.com",scopeType:"Station",audacyStationMetadata:{genre:Te.genre,low_sellout_configurations:"Low Sellout"===Te.type?Te.lowSelloutConfig:null,market:O.market,primetime_windows:Te.primeTime,region:O.region,station_guid:O.station_guid,station_type:""===Te.type?null:Te.type}}:{topic:"customRuleSet",scope_reference_id:null,scopeDescription:"demo",parentScopeId:null,scopeName:O.station_name||"New Station",scopeReferenceMetadata:{},applicationMappingId:B},console.log("[StationOnboard] Step 1: Creating rule set with payload:",t),[4,a.createRuleSet(t,F)];case 2:if(l=S.sent(),!(o=null===(x=null==l?void 0:l.data)||void 0===x?void 0:x.scopeId))throw new Error("Failed to create scope - no scopeId returned");return console.log("[StationOnboard] Step 1 Complete: Created scope with ID:",o),ge(1),[3,4];case 3:return u=S.sent(),console.error("[StationOnboard] Error creating rule set:",u),null===(g=Se.current)||void 0===g||g.show({severity:"error",life:3e3,summary:"Error",detail:"Failed to create rule set. Please try again."}),de(!1),ge(0),[2];case 4:return S.trys.push([4,6,,7]),c=null!==se&&se!==(null==Fe?void 0:Fe.id),d={source_scope_id:c?se:null!==(f=null==Fe?void 0:Fe.id)&&void 0!==f?f:se,target_scope_id:o,is_copy_parent_variant_id:c},console.log("[StationOnboard] Step 3: Inheriting scope with payload:",d),[4,a.inheritScopeBackwardCompatible(d)];case 5:return S.sent(),console.log("[StationOnboard] Step 3 Complete: Scope inherited"),ge(3),[3,7];case 6:return p=S.sent(),console.error("[StationOnboard] Error inheriting scope (no rollback):",p),null===(_=Se.current)||void 0===_||_.show({severity:"error",life:3e3,summary:"Error",detail:"Failed to apply rule template. Please try again."}),de(!1),ge(0),[2];case 7:return ve.current=o,console.log("[StationOnboard] Onboarding completed successfully!"),[2]}})})},disabled:!Ne||ce,style:{padding:"7px 10px",borderRadius:"6px",border:"none",backgroundColor:Ne?"#2563EB":"#BFDBFE",color:"#fff",cursor:Ne&&!ce?"pointer":"not-allowed",fontSize:"14px",fontWeight:500,display:"flex",alignItems:"center",gap:"7px"}},{children:ce?n.jsxs(n.Fragment,{children:[n.jsx(o.CircularProgress,{size:16,color:"inherit"}),n.jsx("span",{children:"Onboarding..."})]}):n.jsxs(n.Fragment,{children:[n.jsx("span",{children:"Onboard Station"}),n.jsx(i.ArrowRight,{size:16})]})}))]}))]}))};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),r=require("react"),o=require("@mui/material"),t=require("lucide-react"),i=require("primereact/toast"),s=require("uuid"),a=require("../../apis/scopeApis.js"),l=require("./StationAutocomplete.js"),u=require("../CardSkeleton.js"),c=require("./OnboardingLoader.js"),d=require("./TemplateCard.js"),p=require("../../styles/StationOnboardModal.module.css.js"),x=require("./InputField.js"),g=require("../../store/useAuthStore.js"),f=require("../../store/useConfigStore.js"),h=require("../../store/useLearningTemplateStore.js"),_=require("../../config.js"),m=[{label:"6am to 7pm",value:"06:00 AM - 7:00 PM"},{label:"5am to 7pm",value:"05:00 AM - 7:00 PM"}],S=[{label:"Low Sellout",value:"Low Sellout"},{label:"High Sellout",value:"High Sellout"},{label:"None",value:""}],v=[{label:"None",value:"None"},{label:"Distribute spots evenly across all breaks in the hour",value:"Distribute spots evenly across all breaks in the hour"}];exports.default=function(y){var b,j=y.isOpen,w=y.onClose,C=y.onBoardStation,T=y.app_integration_id,B=y.token,F=r.useState(null),E=F[0],O=F[1],k=r.useState([]),M=k[0],A=k[1],N=r.useState(0),D=N[0],z=N[1],R=r.useState(!0),q=R[0],I=R[1],L=r.useState(!1),P=L[0],W=L[1],G=r.useState([]),Y=G[0],U=G[1],H=r.useState(""),K=H[0],X=H[1],J=r.useState(""),Q=J[0],V=J[1],Z=r.useState(!1),$=Z[0],ee=Z[1],ne=r.useState(!1),re=ne[0],oe=ne[1],te=r.useState(null),ie=te[0],se=te[1],ae=r.useState(null);ae[0],ae[1];var le=r.useState(!1),ue=le[0],ce=le[1],de=r.useState(0),pe=de[0],xe=de[1],ge=r.useState(""),fe=ge[0],he=ge[1],_e=g.default().user,me=r.useRef(null),Se=r.useRef(null),ve=r.useRef(null),ye=r.useRef(null);f.useConfigStore().configuration;var be=h.useLearningTemplateStore(function(e){return e.stationNameParam}),je=r.useState({region:"",primeTime:["06:00 AM - 7:00 PM"],genre:"Music",type:"",lowSelloutConfig:""}),we=je[0],Ce=je[1],Te=function(e,n){return e.find(function(e){return e.value===n})||null},Be=r.useMemo(function(){return M.map(function(e){return{label:e.scope_name,value:e.scope_name}})},[M]),Fe=r.useMemo(function(){var e,n,r;if(!we.genre)return null;var o=M.find(function(e){return e.scope_name===we.genre});return o?{id:o.id,title:o.scope_name||"Unnamed Template",description:(null===(e=o.description)||void 0===e?void 0:e.trim())||"No description available.",inheritedText:(null===(n=o.inheritance)||void 0===n?void 0:n[0])||void 0,rulesCount:o.rules_count||0,tiersCount:o.tier_count||0,isCopy:null!==(r=o.is_copy)&&void 0!==r&&r}:null},[we.genre,M]);r.useEffect(function(){return function(){ve.current&&clearTimeout(ve.current)}},[]);var Ee=function(n){return e.__awaiter(void 0,void 0,void 0,function(){var r,o,t;return e.__generator(this,function(i){switch(i.label){case 0:if(P)return[2];W(!0),i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,a.retrieveGenreScopes({limit:"20",offset:String(n)})];case 2:return"success"===(null==(r=i.sent())?void 0:r.status)&&Array.isArray(null==r?void 0:r.data)?(o=r.data,A(function(r){if(0===n)return o;var t=new Set(r.map(function(e){return e.id})),i=o.filter(function(e){return!t.has(e.id)});return e.__spreadArray(e.__spreadArray([],r,!0),i,!0)}),o.length<20?I(!1):I(!0),z(n+20)):I(!1),[3,5];case 3:return t=i.sent(),console.error("[StationOnboard] Failed to fetch genre scopes:",t),I(!1),[3,5];case 4:return W(!1),[7];case 5:return[2]}})})};r.useEffect(function(){if(j&&(A([]),z(0),I(!0),Ee(0),be)){he(be);e.__awaiter(void 0,void 0,void 0,function(){var n,r,o;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,a.fetchStationsByKeyword(be,!0)];case 1:return!0===(null==(n=e.sent())?void 0:n.success)&&Array.isArray(null==n?void 0:n.data)&&(r=n.data.find(function(e){var n;return(null===(n=e.station_name)||void 0===n?void 0:n.toLowerCase())===be.toLowerCase()&&!e.ruleset_id}),r&&O(r)),[3,3];case 2:return o=e.sent(),console.error("[StationOnboard] Error auto-selecting station:",o),[3,3];case 3:return[2]}})})}},[j,be]);r.useEffect(function(){Ce(E?function(n){var r;return e.__assign(e.__assign({},n),{region:null!==(r=E.market)&&void 0!==r?r:""})}:{region:"",primeTime:["06:00 AM - 7:00 PM"],genre:"Music",type:"",lowSelloutConfig:""})},[E]),r.useEffect(function(){var e=setTimeout(function(){V(K)},500);return function(){return clearTimeout(e)}},[K]),r.useEffect(function(){e.__awaiter(void 0,void 0,void 0,function(){var n,r,o,t;return e.__generator(this,function(e){switch(e.label){case 0:if(!Q.trim())return U([]),[2];ee(!0),e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,a.searchScopes({search_string:Q.trim()})];case 2:return"success"===(null==(n=e.sent())?void 0:n.status)&&Array.isArray(null==n?void 0:n.data)?(r=n.data.filter(function(e){var n,r=null!==(n=e.inheritance)&&void 0!==n?n:[],o=r.indexOf(e.scope_name);return!(o<=0)&&r[o-1]===we.genre}),o=r.map(function(e){var n,r,o;return{id:e.id,title:e.scope_name||"Unnamed Template",description:(null===(n=e.description)||void 0===n?void 0:n.trim())||"No description available.",inheritedText:(null===(r=e.inheritance)||void 0===r?void 0:r[0])||void 0,rulesCount:e.rules_count||0,tiersCount:e.tier_count||0,isCopy:null!==(o=e.is_copy)&&void 0!==o&&o}}),U(o)):U([]),[3,5];case 3:return t=e.sent(),console.error("[StationOnboard] Error searching scopes:",t),U([]),[3,5];case 4:return ee(!1),[7];case 5:return[2]}})})},[Q,we.genre]),r.useEffect(function(){!Q.trim()&&Fe&&se(Fe.id)},[Q,Fe]);var Oe=function(){setTimeout(function(){ye.current&&ye.current.scrollTo({top:ye.current.scrollHeight,behavior:"smooth"})},100)},ke=function(){he(""),O(null),Ce({region:"",primeTime:["06:00 AM - 7:00 PM"],genre:"Music",type:"",lowSelloutConfig:""}),U([]),X(""),se(null),w()},Me=function(n,r){var o;if("primeTime"!==n){var t=null!==(o=null==r?void 0:r.value)&&void 0!==o?o:"";Ce(function(r){var o;return e.__assign(e.__assign({},r),((o={})[n]=String(t),o))}),"genre"===n&&(oe(!0),ve.current&&clearTimeout(ve.current),ve.current=setTimeout(function(){var e=M.find(function(e){return e.scope_name===t});se(e?e.id:null),oe(!1)},800))}else{var i=(null==r?void 0:r.value)?String(r.value):"";Ce(function(n){return e.__assign(e.__assign({},n),{primeTime:i?[i]:[]})})}},Ae=Boolean(E&&we.region&&we.primeTime.length>0&&we.genre);return n.jsxs(o.Dialog,e.__assign({open:j,onClose:ke,maxWidth:!1,disableEscapeKeyDown:!0,PaperProps:{sx:{width:"90vw",height:"90vh",borderRadius:"12px",display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"sans-serif"}}},{children:[n.jsx(i.Toast,{ref:me}),n.jsxs(o.Box,e.__assign({sx:{p:"20px 20px 20px 27px",borderBottom:"1px solid #F0F2F5",display:"flex",justifyContent:"space-between",alignItems:"center",bgcolor:"#fff"}},{children:[n.jsxs(o.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:.5}},{children:[n.jsx(o.Typography,e.__assign({sx:{fontSize:"18px",fontWeight:600,color:"#19213D"}},{children:"Onboard a Station"})),n.jsx(o.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:400,color:"#666F8D"}},{children:"Onboard a station to start configuring learnings."}))]})),n.jsx(o.IconButton,e.__assign({onClick:ke,disabled:ue,sx:{color:"#19213D"}},{children:n.jsx(t.X,{size:24})}))]})),n.jsxs(o.DialogContent,e.__assign({sx:{p:0,bgcolor:"#F8FAFC",display:"flex",flexDirection:"row",overflow:"hidden",position:"relative"}},{children:[n.jsx(c.default,{isLoading:ue,currentStep:pe,onComplete:function(){ce(!1);var e=Se.current;ke(),C(e||void 0),Se.current=null}}),n.jsxs(o.Box,e.__assign({sx:{display:"flex",flex:1,paddingY:"14px",paddingX:"20px",gap:3,overflowY:"hidden"}},{children:[n.jsxs(o.Box,e.__assign({ref:ye,sx:{flex:1,bgcolor:"#fff",p:3,borderRadius:"16px",border:"1px solid #F0F2F5",height:"100%",overflowY:"auto"}},{children:[n.jsx(o.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:600,mb:.5,color:"#19213D"}},{children:"Basic Details"})),n.jsx(o.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#00000080",mb:"20px"}},{children:"Set up basic station details to unlock AI recommended scopes."})),n.jsxs(o.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[n.jsxs(o.Box,e.__assign({className:p.default.formGroup},{children:[n.jsxs("label",e.__assign({className:p.default.label},{children:[n.jsx("span",e.__assign({className:p.default.asterisk},{children:"*"})),"Station Name/Call Letters"]})),n.jsx(l.default,{value:fe,onChange:he,onStationSelect:function(e){return O(e)}})]})),n.jsx(x.default,{required:!0,disabled:!0,label:"Region",placeholder:"Select Region",value:we.region||void 0,isSearchable:!1}),n.jsx(x.default,{required:!0,label:"Prime Time Window",placeholder:"Select Prime Time",options:m,value:Te(m,(null===(b=we.primeTime)||void 0===b?void 0:b[0])||""),onOptionChange:function(e){return Me("primeTime",e)},isSearchable:!1}),n.jsx(o.Box,e.__assign({onClick:Oe,sx:{width:"100%"}},{children:n.jsx(x.default,{label:"Station Sellout Type",placeholder:"None",options:S,value:Te(S,we.type),onOptionChange:function(n){Me("type",n),"Low Sellout"!==(null==n?void 0:n.value)&&Ce(function(n){return e.__assign(e.__assign({},n),{lowSelloutConfig:""})})},isSearchable:!1})})),"Low Sellout"===we.type&&n.jsx(o.Box,e.__assign({onClick:Oe,sx:{width:"100%"}},{children:n.jsx(x.default,{label:"Low Sell Out Configurations",placeholder:"Select Configuration",options:v,value:Te(v,we.lowSelloutConfig),onOptionChange:function(e){return Me("lowSelloutConfig",e)},isSearchable:!1})}))]}))]})),n.jsxs(o.Box,e.__assign({sx:{flex:1,bgcolor:"#fff",p:3,borderRadius:"12px",border:"1px solid #F0F2F5",display:"flex",flexDirection:"column",height:"100%",overflowY:"auto"}},{children:[n.jsxs(o.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:600,mb:.5,color:"#19213D"}},{children:[n.jsx("span",e.__assign({style:{color:"#E53E3E",marginRight:"2px"}},{children:"*"})),"Select a scope for your station"]})),n.jsx(o.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#64748B",mb:"16px"}},{children:"Your station will inherit the rules from the selected scope."})),n.jsx(o.Box,e.__assign({sx:{mb:2}},{children:n.jsx(x.default,{required:!0,label:"",placeholder:"Select Genre",options:Be,value:Te(Be,we.genre),onOptionChange:function(e){return Me("genre",e)},isSearchable:!1,onMenuScrollToBottom:function(){!P&&q&&Ee(D)},isLoadingOptions:P,hasMoreOptions:q})})),n.jsx(o.Box,e.__assign({sx:{mb:3}},{children:re?n.jsx(u.default,{}):Fe?n.jsxs(o.Box,e.__assign({sx:{border:"1.5px solid #2563EB",borderRadius:"10px",p:"14px 16px",bgcolor:"#EFF6FF",display:"flex",alignItems:"flex-start",gap:"12px"}},{children:[n.jsx(o.Box,e.__assign({sx:{width:36,height:36,borderRadius:"8px",bgcolor:"#DBEAFE",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0}},{children:n.jsxs("svg",e.__assign({width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"#2563EB",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:[n.jsx("circle",{cx:"12",cy:"12",r:"2"}),n.jsx("path",{d:"M16.24 7.76a6 6 0 0 1 0 8.49m-8.48-.01a6 6 0 0 1 0-8.49m11.31-2.82a10 10 0 0 1 0 14.14m-14.14 0a10 10 0 0 1 0-14.14"})]}))})),n.jsxs(o.Box,e.__assign({sx:{flex:1,minWidth:0}},{children:[n.jsx(o.Typography,e.__assign({sx:{fontSize:"0.875rem",fontWeight:600,color:"#1E3A5F",mb:"2px"}},{children:Fe.title})),n.jsx(o.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#2563EB",mb:"8px"}},{children:Fe.description})),n.jsxs(o.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"}},{children:[Fe.inheritedText&&n.jsxs(o.Box,e.__assign({component:"span",sx:{fontSize:"0.7rem",color:"#475569",bgcolor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"4px",px:"6px",py:"2px",display:"inline-flex",alignItems:"center",gap:"4px"}},{children:[n.jsxs("svg",e.__assign({width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:[n.jsx("polyline",{points:"15 3 21 3 21 9"}),n.jsx("path",{d:"M21 3L9 15"}),n.jsx("path",{d:"M3 21l6-6"})]})),Fe.inheritedText]})),n.jsxs(o.Box,e.__assign({component:"span",sx:{fontSize:"0.7rem",color:"#475569",bgcolor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"4px",px:"6px",py:"2px"}},{children:[Fe.rulesCount," rules"]})),n.jsxs(o.Box,e.__assign({component:"span",sx:{fontSize:"0.7rem",color:"#475569",bgcolor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"4px",px:"6px",py:"2px"}},{children:[Fe.tiersCount," Tiers"]}))]}))]}))]})):we.genre?null:n.jsxs(o.Box,e.__assign({sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",opacity:.4,py:6,gap:1}},{children:[n.jsx(t.Brush,{size:28}),n.jsx(o.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#94A3B8"}},{children:"Select a genre to load the matching scope"}))]}))})),we.genre&&n.jsxs(n.Fragment,{children:[n.jsxs(o.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:600,mb:.5,color:"#19213D"}},{children:["Select an Existing Station from the “",we.genre,"” Scope"," ",n.jsx(o.Typography,e.__assign({component:"span",sx:{fontSize:"1rem",fontWeight:400,color:"#64748B"}},{children:"(Optional)"}))]})),n.jsxs(o.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#64748B",mb:"12px"}},{children:["Please select an existing station under the “",we.genre,"” category to copy its learnings."]})),n.jsxs("div",e.__assign({className:p.default.searchWrapper,style:{marginBottom:"12px"}},{children:[n.jsx("input",{type:"text",value:K,onChange:function(e){return X(e.target.value)},placeholder:"Search for station...",className:p.default.searchInput}),n.jsx(t.Search,{className:p.default.searchIcon,size:16})]})),n.jsxs(o.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:2}},{children:[$&&n.jsx(u.default,{}),!$&&0===Y.length&&Q.trim()&&n.jsxs(o.Typography,e.__assign({sx:{fontSize:"0.875rem",color:"#64748B",textAlign:"center",py:4}},{children:['No scopes found matching "',Q,'".']})),!$&&Y.map(function(r){return n.jsx(d.default,e.__assign({},r,{isSelected:ie===r.id,onSelect:function(e){var n;se(ie===e?null!==(n=null==Fe?void 0:Fe.id)&&void 0!==n?n:null:e)}}),r.id)})]}))]})]}))]}))]})),n.jsxs(o.Box,e.__assign({sx:{p:"12px 20px",borderTop:"1px solid #F0F2F5",display:"flex",justifyContent:"flex-end",gap:2,bgcolor:"#fff"}},{children:[n.jsx("button",e.__assign({onClick:ke,disabled:ue,style:{padding:"7px 10px",borderRadius:"6px",color:"#64748B",border:"1px solid #E2E8F0",backgroundColor:"#fff",cursor:"pointer",fontSize:"14px",fontWeight:500}},{children:"Cancel"})),n.jsx("button",e.__assign({onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var n,r,o,t,i,l,u,c,d,p,x,g,f,m;return e.__generator(this,function(S){switch(S.label){case 0:if(!E||!ie)return console.error("[StationOnboard] Missing required data for onboarding"),[2];n=Fe?e.__spreadArray([Fe],Y,!0):Y,r=n.find(function(e){return e.id===ie}),null==r?void 0:r.isCopy,ce(!0),xe(0),o=null,S.label=1;case 1:return S.trys.push([1,3,,4]),t=h.useLearningTemplateStore.getState().backwardCompatibility,i=t?{topic:"customRuleSet",customScopeGroupName:_.IL_CONFIG_CONSTANTS.CUSTOM_SCOPE_GROUP_NAME,scopeDescription:E.station_name||"New Station",parentScopeId:null,customScopeName:E.station_name||"New Station",customScopeId:s.v4(),createByName:(null==_e?void 0:_e.firstname)||"System",createdBy:(null==_e?void 0:_e.email)||"system@audacy.com",scopeType:"Station",audacyStationMetadata:{genre:we.genre,low_sellout_configurations:"Low Sellout"===we.type?we.lowSelloutConfig:null,market:E.market,primetime_windows:we.primeTime,region:E.region,station_guid:E.station_guid,station_type:""===we.type?null:we.type}}:{topic:"customRuleSet",scope_reference_id:null,scopeDescription:"demo",parentScopeId:null,scopeName:E.station_name||"New Station",scopeReferenceMetadata:{},applicationMappingId:T},console.log("[StationOnboard] Step 1: Creating rule set with payload:",i),[4,a.createRuleSet(i,B)];case 2:if(l=S.sent(),!(o=null===(x=null==l?void 0:l.data)||void 0===x?void 0:x.scopeId))throw new Error("Failed to create scope - no scopeId returned");return console.log("[StationOnboard] Step 1 Complete: Created scope with ID:",o),xe(1),[3,4];case 3:return u=S.sent(),console.error("[StationOnboard] Error creating rule set:",u),null===(g=me.current)||void 0===g||g.show({severity:"error",life:3e3,summary:"Error",detail:"Failed to create rule set. Please try again."}),ce(!1),xe(0),[2];case 4:return S.trys.push([4,6,,7]),c=null!==ie&&ie!==(null==Fe?void 0:Fe.id),d={source_scope_id:c?ie:null!==(f=null==Fe?void 0:Fe.id)&&void 0!==f?f:ie,target_scope_id:o,is_copy_parent_variant_id:c},console.log("[StationOnboard] Step 3: Inheriting scope with payload:",d),[4,a.inheritScopeBackwardCompatible(d)];case 5:return S.sent(),console.log("[StationOnboard] Step 3 Complete: Scope inherited"),xe(3),[3,7];case 6:return p=S.sent(),console.error("[StationOnboard] Error inheriting scope (no rollback):",p),null===(m=me.current)||void 0===m||m.show({severity:"error",life:3e3,summary:"Error",detail:"Failed to apply rule template. Please try again."}),ce(!1),xe(0),[2];case 7:return Se.current=o,console.log("[StationOnboard] Onboarding completed successfully!"),[2]}})})},disabled:!Ae||ue,style:{padding:"7px 10px",borderRadius:"6px",border:"none",backgroundColor:Ae?"#2563EB":"#BFDBFE",color:"#fff",cursor:Ae&&!ue?"pointer":"not-allowed",fontSize:"14px",fontWeight:500,display:"flex",alignItems:"center",gap:"7px"}},{children:ue?n.jsxs(n.Fragment,{children:[n.jsx(o.CircularProgress,{size:16,color:"inherit"}),n.jsx("span",{children:"Onboarding..."})]}):n.jsxs(n.Fragment,{children:[n.jsx("span",{children:"Onboard Station"}),n.jsx(t.ArrowRight,{size:16})]})}))]}))]}))};
|
|
2
2
|
//# sourceMappingURL=StationOnboardModal.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}),require("react");exports.QUERY_PARAM_KEYS={TAB:"tab",RULESET_ID:"rulesetid",OPEN_IL:"openil",ONBOARD_STATION:"onboardstation"},exports.getQueryParam=function(e){return new URLSearchParams(window.location.search).get(e)},exports.setQueryParams=function(e){var t=new URLSearchParams(window.location.search);Object.entries(e).forEach(function(e){var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),require("react");exports.QUERY_PARAM_KEYS={TAB:"tab",RULESET_ID:"rulesetid",OPEN_IL:"openil",ONBOARD_STATION:"onboardstation",STATION_NAME:"stationname"},exports.getQueryParam=function(e){return new URLSearchParams(window.location.search).get(e)},exports.setQueryParams=function(e){var t=new URLSearchParams(window.location.search);Object.entries(e).forEach(function(e){var a=e[0],r=e[1];null==r||""===r?t.delete(a):t.set(a,r)});var a=t.toString(),r="".concat(window.location.pathname).concat(a?"?".concat(a):"");window.history.replaceState({},"",r)};
|
|
2
2
|
//# sourceMappingURL=useLearningTemplateQueryParams.js.map
|
|
@@ -0,0 +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})};
|
|
2
|
+
//# sourceMappingURL=useLMSConfigQuery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLMSConfigQuery.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("zustand"),t=require("./useLearningTemplateStore.js"),n={pageTitle:"",middleDrawer:{scope:"",addScope:"",addSubScope:"",addScopeDialog:{title:"",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
|
+
//# sourceMappingURL=useLMSConfigStore.js.map
|