@e-llm-studio/instant-learning 1.3.0-alpha.47 → 1.3.0-alpha.48
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/LearningManagement/AuditLog/AuditLog.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/DayToggleSelector.js +2 -0
- package/dist/cjs/features/LearningManagement/components/StationOnboarding/DayToggleSelector.js.map +1 -0
- package/dist/cjs/features/LearningManagement/components/StationOnboarding/StationOnboardModal.js +1 -1
- package/dist/features/LearningManagement/AuditLog/AuditLog.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/DayToggleSelector.js +2 -0
- package/dist/features/LearningManagement/components/StationOnboarding/DayToggleSelector.js.map +1 -0
- package/dist/features/LearningManagement/components/StationOnboarding/StationOnboardModal.js +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/DayToggleSelector.d.ts +13 -0
- package/dist/types/src/features/LearningManagement/components/StationOnboarding/DayToggleSelector.d.ts.map +1 -0
- package/dist/types/src/features/LearningManagement/components/StationOnboarding/StationOnboardModal.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),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"),a=require("./ChangeLogDiff.js"),s=require("../store/useLMSConfigStore.js"),r=require("../RBAC/AccessPanel.module.css.js"),l=require("../store/usePermissionsStore.js"),c=require("../store/useEnvStore.js"),d=require("../store/useConfigStore.js");exports.default=function(u){var g=u.configId,p=u.ruleData,h=u.scopeId,x=u.scopeName,f=(null==x?void 0:x.trim())||"Selected",m=i.useState("scope"),b=m[0],y=m[1]
|
|
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"),a=require("./ChangeLogDiff.js"),s=require("../store/useLMSConfigStore.js"),r=require("../RBAC/AccessPanel.module.css.js"),l=require("../store/usePermissionsStore.js"),c=require("../store/useEnvStore.js"),d=require("../store/useConfigStore.js");exports.default=function(u){var g=u.configId,p=u.ruleData,h=u.scopeId,x=u.scopeName,f=(null==x?void 0:x.trim())||"Selected",m=i.useState("scope"),b=m[0],y=m[1];d.useConfigStore.getState().configuration;var v=l.usePermissionsStore(function(e){return e.hasPermission}),_=c.default(function(e){var t;return(null===(t=e.rbacConfig)||void 0===t?void 0:t.applicationResourceId)||""}),w=Boolean(h&&v("ilotj.scope.changeLog.view",h)),j=Boolean(_&&v("ilotj.application.changeLog.view",_)),S=i.useMemo(function(){var e=[];return h&&e.push(h),e},[p,h]);i.useEffect(function(){console.log("Flattened External Resource IDs:",S)},[S]);var C={configId:g,getData:{baseUrl:window.location.origin.includes("local")?"https://dev.appmod.ai":window.location.origin,endpoint:"/changelog/audit-log/fetch"},distinctValuesApi:{baseUrl:window.location.origin.includes("local")?"https://dev.appmod.ai":window.location.origin,endpoint:"/changelog/audit-log/distinct-values"},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,a=(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)"}),s=i.changeTitle?i.changeTitle.replace(/_/g," "):"—";return t.jsx("span",e.__assign({style:{color:a.color,backgroundColor:a.backgroundColor,border:"1px solid ".concat(a.borderColor),boxShadow:a.boxShadow,padding:"6px 12px",borderRadius:"999px",fontSize:"12px",lineHeight:1,fontWeight:600,display:"inline-block",minWidth:"76px",textAlign:"center",textTransform:"capitalize"}},{children:s}))},style:{width:"15%",textAlign:"center"}},{key:"customChangeSummary",header:"Change Summary",body:function(e){var i;return t.jsx(a.default,{change:null!==(i=e.actionText)&&void 0!==i?i:"-"})},style:{width:"30%",minWidth:"200px"}},{key:"redirectLink",header:"Link",body:function(i){var o,a=(null===(o=i.metadata)||void 0===o?void 0:o.redirect_url)||i.redirect_url;return a?t.jsx("div",e.__assign({style:{display:"flex",justifyContent:"center",alignItems:"center"}},{children:t.jsxs("a",e.__assign({href:a,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"}),a=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:a})]}))},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}}}};return 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:s.dt("history.title","".concat(f," - Audit Log"),{scope_name:f})})),t.jsx("p",e.__assign({style:{margin:"8px 0 0",color:"#667085",fontSize:"16px",fontWeight:500,lineHeight:1}},{children:s.dt("history.subtitle","Track all learning updates and modifications with the ".concat(f," scope."),{scope_name:f})}))]})),t.jsxs("div",e.__assign({className:r.default.accessTabs,role:"tablist","aria-label":"Audit log level"},{children:[t.jsx("button",e.__assign({type:"button",role:"tab","aria-selected":"scope"===b,className:"".concat(r.default.accessTab," ").concat("scope"===b?r.default.accessTabActive:""),onClick:function(){return y("scope")},disabled:!w,title:w?"":"You do not have permission to view scope level change log"},{children:s.dt("history.scopeLevel","Scope Level")})),t.jsx("button",e.__assign({type:"button",role:"tab","aria-selected":"application"===b,className:"".concat(r.default.accessTab," ").concat("application"===b?r.default.accessTabActive:""),onClick:function(){return y("application")},disabled:!j,title:j?"":"You do not have permission to view application level change log"},{children:s.dt("history.applicationLevel","Application Level")}))]})),"scope"===b?t.jsx(o.AuditLog,e.__assign({},C,{query:{externalResourceId:S.length>0?S:[""],paginationLimit:10}}),"scope-audit-log"):t.jsx(o.AuditLog,e.__assign({},C,{query:{externalResourceId:[],paginationLimit:10}}),"application-audit-log")]}))};
|
|
2
2
|
//# sourceMappingURL=AuditLog.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/DayToggleSelector.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),r={display:"flex",gap:"8px",flexWrap:"nowrap",padding:"10px 12px",backgroundColor:"#FAFAFA",border:"1px solid #E2E8F0",borderRadius:"8px",marginTop:"4px",minHeight:"54px",alignItems:"center",width:"70%",boxSizing:"border-box"},n={display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:"6px",fontSize:"0.815rem",fontWeight:500,cursor:"pointer",userSelect:"none",transition:"all 0.15s ease-in-out",height:"34px",flex:"1 0 calc((100% - (6 * 8px)) / 7)",minWidth:"0",position:"relative",boxSizing:"border-box"};exports.default=function(s){var o=s.label,t=s.subText,l=s.required,a=s.options,d=s.selectedValues,x=s.onChange;return i.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",width:"100%",marginBottom:"4px"}},{children:[i.jsxs("label",e.__assign({style:{fontSize:"0.875rem",fontWeight:500,color:"#19213D",marginBottom:"2px",display:"block"}},{children:[l&&i.jsx("span",e.__assign({style:{color:"#E53E3E",marginRight:"4px"}},{children:"*"})),o]})),t&&i.jsx("p",e.__assign({style:{margin:"0 0 6px 0",fontSize:"0.75rem",color:"#666F8D",lineHeight:"1.2"}},{children:t})),i.jsx("div",e.__assign({style:r},{children:a.map(function(r){var s=d.includes(String(r.value));return i.jsx("div",e.__assign({onClick:function(){return i=String(r.value),void(d.includes(i)?x(d.filter(function(e){return e!==i})):x(e.__spreadArray(e.__spreadArray([],d,!0),[i],!1)));var i},style:e.__assign(e.__assign({},n),{border:s?"1.5px solid #2563EB":"1px solid #E2E8F0",backgroundColor:s?"#EFF6FF":"#FFFFFF",color:s?"#2563EB":"#64748B",boxShadow:s?"0 1px 2px rgba(37, 99, 235, 0.05)":"0 1px 2px rgba(0, 0, 0, 0.02)"})},{children:i.jsx("span",{children:r.label})}),r.value)})}))]}))};
|
|
2
|
+
//# sourceMappingURL=DayToggleSelector.js.map
|
package/dist/cjs/features/LearningManagement/components/StationOnboarding/DayToggleSelector.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DayToggleSelector.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"),i=require("@mui/material"),o=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"),_=require("../../config.js"),m=require("../../store/useAppSecRolesStore.js"),v=require("../../store/useEnvStore.js"),y=require("../../RuleContent/AddScopeApprovalSearchComponent.js"),S=[{label:"6am to 7pm",value:"06:00 AM - 7:00 PM"},{label:"5am to 7pm",value:"05:00 AM - 7:00 PM"}],b=[{label:"Low Sellout",value:"Low Sellout"},{label:"High Sellout",value:"High Sellout"},{label:"None",value:""}],j=[{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(C){var w,B=C.isOpen,T=C.onClose,F=C.onBoardStation,E=C.app_integration_id,k=C.token,q=r.useState(null),A=q[0],D=q[1],O=r.useState([]),R=O[0],I=O[1],z=r.useState(0),L=z[0],M=z[1],N=r.useState(!0),P=N[0],W=N[1],G=r.useState(!1),K=G[0],U=G[1],H=r.useState([]),Y=H[0],X=H[1],V=r.useState(""),J=V[0],Q=V[1],Z=r.useState(""),$=Z[0],ee=Z[1],ne=r.useState(!1),re=ne[0],ie=ne[1],oe=r.useState(!1),te=oe[0],se=oe[1],ae=r.useState(null),le=ae[0],ue=ae[1],ce=r.useState(null);ce[0],ce[1];var de=r.useState(!1),pe=de[0],xe=de[1],ge=r.useState(0),fe=ge[0],he=ge[1],_e=r.useState(""),me=_e[0],ve=_e[1],ye=g.default().user,Se=r.useRef(null),be=r.useRef(null),je=r.useRef(null),Ce=r.useRef(null);f.useConfigStore().configuration;var we=r.useRef(null),Be=m.useAppSecRolesStore(function(e){return e.roles}),Te=v.default(function(e){return e.rbacConfig}),Fe=r.useState("approval_required"),Ee=Fe[0],ke=Fe[1],qe=r.useState([]),Ae=qe[0],De=qe[1],Oe=r.useState([]),Re=Oe[0],Ie=Oe[1],ze=r.useState(""),Le=ze[0],Me=ze[1],Ne=h.useLearningTemplateStore(function(e){return e.stationNameParam}),Pe=r.useState({region:"",primeTime:["06:00 AM - 7:00 PM"],genre:"Music",type:"",lowSelloutConfig:""}),We=Pe[0],Ge=Pe[1],Ke=function(e,n){return e.find(function(e){return e.value===n})||null},Ue=r.useMemo(function(){return R.map(function(e){return{label:e.scope_name,value:e.scope_name}})},[R]),He=r.useMemo(function(){var e,n,r;if(!We.genre)return null;var i=R.find(function(e){return e.scope_name===We.genre});return i?{id:i.id,title:i.scope_name||"Unnamed Template",description:(null===(e=i.description)||void 0===e?void 0:e.trim())||"No description available.",inheritedText:(null===(n=i.inheritance)||void 0===n?void 0:n[0])||void 0,rulesCount:i.rules_count||0,tiersCount:i.tier_count||0,isCopy:null!==(r=i.is_copy)&&void 0!==r&&r}:null},[We.genre,R]);r.useEffect(function(){return function(){je.current&&clearTimeout(je.current)}},[]);var Ye=function(n){return e.__awaiter(void 0,void 0,void 0,function(){var r,i,o;return e.__generator(this,function(t){switch(t.label){case 0:if(K)return[2];U(!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)?(i=r.data,I(function(r){if(0===n)return i;var o=new Set(r.map(function(e){return e.id})),t=i.filter(function(e){return!o.has(e.id)});return e.__spreadArray(e.__spreadArray([],r,!0),t,!0)}),i.length<20?W(!1):W(!0),M(n+20)):W(!1),[3,5];case 3:return o=t.sent(),console.error("[StationOnboard] Failed to fetch genre scopes:",o),W(!1),[3,5];case 4:return U(!1),[7];case 5:return[2]}})})};r.useEffect(function(){if(B&&(I([]),M(0),W(!0),Ye(0),Ne)){ve(Ne);e.__awaiter(void 0,void 0,void 0,function(){var n,r,i;return e.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,a.fetchStationsByKeyword(Ne,!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())===Ne.toLowerCase()&&!e.ruleset_id}),r&&D(r)),[3,3];case 2:return i=e.sent(),console.error("[StationOnboard] Error auto-selecting station:",i),[3,3];case 3:return[2]}})})}},[B,Ne]);r.useEffect(function(){Ge(A?function(n){var r;return e.__assign(e.__assign({},n),{region:null!==(r=A.market)&&void 0!==r?r:""})}:{region:"",primeTime:["06:00 AM - 7:00 PM"],genre:"Music",type:"",lowSelloutConfig:""})},[A]),r.useEffect(function(){var e=setTimeout(function(){ee(J)},500);return function(){return clearTimeout(e)}},[J]),r.useEffect(function(){e.__awaiter(void 0,void 0,void 0,function(){var n,r,i,o;return e.__generator(this,function(e){switch(e.label){case 0:if(!$.trim())return X([]),[2];ie(!0),e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,a.searchScopes({search_string:$.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:[],i=r.indexOf(e.scope_name);return!(i<=0)&&r[i-1]===We.genre}),i=r.map(function(e){var n,r,i;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!==(i=e.is_copy)&&void 0!==i&&i}}),X(i)):X([]),[3,5];case 3:return o=e.sent(),console.error("[StationOnboard] Error searching scopes:",o),X([]),[3,5];case 4:return ie(!1),[7];case 5:return[2]}})})},[$,We.genre]),r.useEffect(function(){!$.trim()&&He&&ue(He.id)},[$,He]);var Xe=function(){setTimeout(function(){Ce.current&&Ce.current.scrollTo({top:Ce.current.scrollHeight,behavior:"smooth"})},100)},Ve=function(){ve(""),D(null),Ge({region:"",primeTime:["06:00 AM - 7:00 PM"],genre:"Music",type:"",lowSelloutConfig:""}),X([]),Q(""),ue(null),ke("approval_required"),De([]),Ie([]),Me(""),T()},Je=function(n,r){var i;if("primeTime"!==n){var o=null!==(i=null==r?void 0:r.value)&&void 0!==i?i:"";Ge(function(r){var i;return e.__assign(e.__assign({},r),((i={})[n]=String(o),i))}),"genre"===n&&(se(!0),je.current&&clearTimeout(je.current),je.current=setTimeout(function(){var e=R.find(function(e){return e.scope_name===o});ue(e?e.id:null),se(!1)},800))}else{var t=(null==r?void 0:r.value)?String(r.value):"";Ge(function(n){return e.__assign(e.__assign({},n),{primeTime:t?[t]:[]})})}},Qe=Boolean(A&&We.region&&We.primeTime.length>0&&We.genre);return n.jsxs(i.Dialog,e.__assign({open:B,onClose:Ve,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(i.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(i.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:.5}},{children:[n.jsx(i.Typography,e.__assign({sx:{fontSize:"18px",fontWeight:600,color:"#19213D"}},{children:"Onboard a Station"})),n.jsx(i.Typography,e.__assign({sx:{fontSize:"16px",fontWeight:400,color:"#666F8D"}},{children:"Onboard a station to start configuring learnings."}))]})),n.jsx(i.IconButton,e.__assign({onClick:Ve,disabled:pe,sx:{color:"#19213D"}},{children:n.jsx(o.X,{size:24})}))]})),n.jsxs(i.DialogContent,e.__assign({sx:{p:0,bgcolor:"#F8FAFC",display:"flex",flexDirection:"row",overflow:"hidden",position:"relative"}},{children:[n.jsx(c.default,{isLoading:pe,currentStep:fe,onComplete:function(){xe(!1);var e=be.current;Ve(),F(e||void 0),be.current=null}}),n.jsx(i.Box,e.__assign({sx:{display:"flex",flex:1,flexDirection:"column",paddingY:"14px",paddingX:"20px",gap:2,overflowY:"auto"}},{children:n.jsxs(i.Box,e.__assign({sx:{display:"flex",gap:3}},{children:[n.jsxs(i.Box,e.__assign({ref:Ce,sx:{flex:1,bgcolor:"#fff",p:3,borderRadius:"16px",border:"1px solid #F0F2F5"}},{children:[n.jsx(i.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:600,mb:.5,color:"#19213D"}},{children:"Basic Details"})),n.jsx(i.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#00000080",mb:"20px"}},{children:"Set up basic station details to unlock AI recommended scopes."})),n.jsxs(i.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[n.jsxs(i.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:me,onChange:ve,onStationSelect:function(e){return D(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:S,value:Ke(S,(null===(w=We.primeTime)||void 0===w?void 0:w[0])||""),onOptionChange:function(e){return Je("primeTime",e)},isSearchable:!1}),n.jsx(i.Box,e.__assign({onClick:Xe,sx:{width:"100%"}},{children:n.jsx(x.default,{label:"Station Sellout Type",placeholder:"None",options:b,value:Ke(b,We.type),onOptionChange:function(n){Je("type",n),"Low Sellout"!==(null==n?void 0:n.value)&&Ge(function(n){return e.__assign(e.__assign({},n),{lowSelloutConfig:""})})},isSearchable:!1})})),"Low Sellout"===We.type&&n.jsx(i.Box,e.__assign({onClick:Xe,sx:{width:"100%"}},{children:n.jsx(x.default,{label:"Low Sell Out Configurations",placeholder:"Select Configuration",options:j,value:Ke(j,We.lowSelloutConfig),onOptionChange:function(e){return Je("lowSelloutConfig",e)},isSearchable:!1})})),h.useLearningTemplateStore.getState().backwardCompatibility&&n.jsxs("div",e.__assign({ref:we,style:{display:"flex",flexDirection:"column",marginTop:"12px"}},{children:[n.jsx(i.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:600,mb:.5,color:"#19213D"}},{children:"Approval Settings"})),n.jsx(i.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#00000080",mb:"20px"}},{children:"Configure who can approve learnings before they get published."})),n.jsxs("div",e.__assign({style:{marginBottom:"12px",fontSize:"12px",color:"#8F2C23",gap:"16px"}},{children:[n.jsxs("div",e.__assign({style:{marginBottom:"12px",fontSize:"12px",color:"#8F2C23",gap:"12px"}},{children:[n.jsxs("div",e.__assign({role:"radio","aria-checked":"approval_required"===Ee,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:"4px",marginBottom:"8px"},onClick:function(){return ke("approval_required")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||ke("approval_required")}},{children:[n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[n.jsx("div",e.__assign({style:{display:"flex",height:"16px",width:"16px",flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("approval_required"===Ee?"#2563EB":"#CBD5E1")}},{children:"approval_required"===Ee&&n.jsx("div",{style:{height:"8px",width:"8px",borderRadius:"50%",backgroundColor:"#2563EB"}})})),n.jsx("span",e.__assign({style:{fontSize:"14px",fontWeight:500,color:"#19213D"}},{children:"Approval Required Before Publishing"}))]})),n.jsx("p",e.__assign({style:{margin:0,marginLeft:"24px",fontSize:"12px",color:"#666F8D"}},{children:"Learnings require approval before publishing."}))]})),n.jsxs("div",e.__assign({style:{gap:"16px"}},{children:["approval_required"===Ee&&n.jsx(y.default,{selectedApprovers:Ae,selectedGroupOfApprovers:Re,onApproversChange:function(e){De(e),Me("")},onGroupsChange:function(e){Ie(e),Me("")}}),Le&&n.jsx("p",e.__assign({style:{margin:0,marginLeft:"24px",fontSize:"12px",color:"#8F2C23"}},{children:Le}))]}))]})),n.jsxs("div",e.__assign({role:"radio","aria-checked":"publish_without"===Ee,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:"4px"},onClick:function(){ke("publish_without"),Me("")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||(ke("publish_without"),Me(""))}},{children:[n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[n.jsx("div",e.__assign({style:{display:"flex",height:"16px",width:"16px",flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("publish_without"===Ee?"#2563EB":"#CBD5E1")}},{children:"publish_without"===Ee&&n.jsx("div",{style:{height:"8px",width:"8px",borderRadius:"50%",backgroundColor:"#2563EB"}})})),n.jsx("span",e.__assign({style:{fontSize:"14px",fontWeight:500,color:"#19213D"}},{children:"Publish Without Approval"}))]})),n.jsx("p",e.__assign({style:{margin:0,marginLeft:"24px",fontSize:"12px",color:"#666F8D"}},{children:"Learnings can be published directly."}))]}))]}))]}))]}))]})),n.jsxs(i.Box,e.__assign({sx:{flex:1,bgcolor:"#fff",p:3,borderRadius:"12px",border:"1px solid #F0F2F5",display:"flex",flexDirection:"column"}},{children:[n.jsxs(i.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(i.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#64748B",mb:"16px"}},{children:"Your station will inherit the rules from the selected scope."})),n.jsx(i.Box,e.__assign({sx:{mb:2}},{children:n.jsx(x.default,{required:!0,label:"",placeholder:"Select Genre",options:Ue,value:Ke(Ue,We.genre),onOptionChange:function(e){return Je("genre",e)},isSearchable:!1,onMenuScrollToBottom:function(){!K&&P&&Ye(L)},isLoadingOptions:K,hasMoreOptions:P})})),n.jsx(i.Box,e.__assign({sx:{mb:3}},{children:te?n.jsx(u.default,{}):He?n.jsxs(i.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(i.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(i.Box,e.__assign({sx:{flex:1,minWidth:0}},{children:[n.jsx(i.Typography,e.__assign({sx:{fontSize:"0.875rem",fontWeight:600,color:"#1E3A5F",mb:"2px"}},{children:He.title})),n.jsx(i.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#2563EB",mb:"8px"}},{children:He.description})),n.jsxs(i.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"}},{children:[He.inheritedText&&n.jsxs(i.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"})]})),He.inheritedText]})),n.jsxs(i.Box,e.__assign({component:"span",sx:{fontSize:"0.7rem",color:"#475569",bgcolor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"4px",px:"6px",py:"2px"}},{children:[He.rulesCount," rules"]})),n.jsxs(i.Box,e.__assign({component:"span",sx:{fontSize:"0.7rem",color:"#475569",bgcolor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"4px",px:"6px",py:"2px"}},{children:[He.tiersCount," Tiers"]}))]}))]}))]})):We.genre?null:n.jsx(i.Box,e.__assign({sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",opacity:.4,py:6,gap:1}},{children:n.jsx(i.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(i.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:600,mb:.5,color:"#19213D"}},{children:["Select an Existing Station from the “",We.genre,"” Scope"," ",n.jsx(i.Typography,e.__assign({component:"span",sx:{fontSize:"1rem",fontWeight:400,color:"#64748B"}},{children:"(Optional)"}))]})),n.jsxs(i.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:J,onChange:function(e){return Q(e.target.value)},placeholder:"Search for station...",className:p.default.searchInput}),n.jsx(o.Search,{className:p.default.searchIcon,size:16})]})),n.jsxs(i.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:2}},{children:[re&&n.jsx(u.default,{}),!re&&0===Y.length&&$.trim()&&n.jsxs(i.Typography,e.__assign({sx:{fontSize:"0.875rem",color:"#64748B",textAlign:"center",py:4}},{children:['No scopes found matching "',$,'".']})),!re&&Y.map(function(r){return n.jsx(d.default,e.__assign({},r,{isSelected:le===r.id,onSelect:function(e){var n;ue(le===e?null!==(n=null==He?void 0:He.id)&&void 0!==n?n:null:e)}}),r.id)})]}))]})]}))]}))}))]})),n.jsxs(i.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:Ve,disabled:pe,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,i,o,t,l,u,c,d,p,x,g,f,m,v,y,S,b,j;return e.__generator(this,function(C){switch(C.label){case 0:if(!A||!le)return console.error("[StationOnboard] Missing required data for onboarding"),[2];if(h.useLearningTemplateStore.getState().backwardCompatibility&&"approval_required"===Ee&&0===Ae.length&&0===Re.length)return Me("Please select at least one approver or approver group."),setTimeout(function(){var e;null===(e=we.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"center"})},50),[2];Me(""),n=He?e.__spreadArray([He],Y,!0):Y,r=n.find(function(e){return e.id===le}),null==r?void 0:r.isCopy,xe(!0),he(0),i=null,C.label=1;case 1:return C.trys.push([1,3,,4]),o=h.useLearningTemplateStore.getState().backwardCompatibility,t=o?{topic:"customRuleSet",customScopeGroupName:_.IL_CONFIG_CONSTANTS.CUSTOM_SCOPE_GROUP_NAME,scopeDescription:A.station_name||"New Station",parentScopeId:null!==(x=null==He?void 0:He.id)&&void 0!==x?x:null,customScopeName:A.station_name||"New Station",customScopeId:s.v4(),createByName:(null==ye?void 0:ye.firstname)||"System",createdBy:(null==ye?void 0:ye.email)||"system@audacy.com",scopeType:"Station",approvalRequired:"approval_required"===Ee,audacyStationMetadata:{genre:We.genre,low_sellout_configurations:"Low Sellout"===We.type?We.lowSelloutConfig:null,market:A.market,primetime_windows:We.primeTime,region:A.region,station_guid:A.station_guid,station_type:""===We.type?null:We.type},appsecData:{application:null==Te?void 0:Te.applicationId,module:null==Te?void 0:Te.moduleId,roles:e.__spreadArray(e.__spreadArray([],"approval_required"===Ee?[{users:Ae.map(function(e){return e.email}),groups:Re.map(function(e){return e._id}),role:null!==(f=null===(g=Be.find(function(e){return"Learning Manager"===e.name}))||void 0===g?void 0:g._id)&&void 0!==f?f:""}]:[],!0),[{users:[null==ye?void 0:ye.email],groups:[],role:null!==(v=null===(m=Be.find(function(e){return"Instant Learning Admin"===e.name}))||void 0===m?void 0:m._id)&&void 0!==v?v:""}],!1)}}:{topic:"customRuleSet",scope_reference_id:null,scopeDescription:"demo",parentScopeId:null,scopeName:A.station_name||"New Station",scopeReferenceMetadata:{},applicationMappingId:E},console.log("[StationOnboard] Step 1: Creating rule set with payload:",t),[4,a.createRuleSet(t,k)];case 2:if(l=C.sent(),!(i=null===(y=null==l?void 0:l.data)||void 0===y?void 0:y.scopeId))throw new Error("Failed to create scope - no scopeId returned");return console.log("[StationOnboard] Step 1 Complete: Created scope with ID:",i),he(1),[3,4];case 3:return u=C.sent(),console.error("[StationOnboard] Error creating rule set:",u),null===(S=Se.current)||void 0===S||S.show({severity:"error",life:3e3,summary:"Error",detail:"Failed to create rule set. Please try again."}),xe(!1),he(0),[2];case 4:return C.trys.push([4,6,,7]),c=null!==le&&le!==(null==He?void 0:He.id),d={source_scope_id:c?le:null!==(b=null==He?void 0:He.id)&&void 0!==b?b:le,target_scope_id:i,is_copy_parent_variant_id:c},console.log("[StationOnboard] Step 3: Inheriting scope with payload:",d),[4,a.inheritScopeBackwardCompatible(d)];case 5:return C.sent(),console.log("[StationOnboard] Step 3 Complete: Scope inherited"),he(3),[3,7];case 6:return p=C.sent(),console.error("[StationOnboard] Error inheriting scope (no rollback):",p),null===(j=Se.current)||void 0===j||j.show({severity:"error",life:3e3,summary:"Error",detail:"Failed to apply rule template. Please try again."}),xe(!1),he(0),[2];case 7:return be.current=i,console.log("[StationOnboard] Onboarding completed successfully!"),[2]}})})},disabled:!Qe||pe,style:{padding:"7px 10px",borderRadius:"6px",border:"none",backgroundColor:Qe?"#2563EB":"#BFDBFE",color:"#fff",cursor:Qe&&!pe?"pointer":"not-allowed",fontSize:"14px",fontWeight:500,display:"flex",alignItems:"center",gap:"7px"}},{children:pe?n.jsxs(n.Fragment,{children:[n.jsx(i.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})]})}))]}))]}))};
|
|
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"),d=require("./OnboardingLoader.js"),c=require("./TemplateCard.js"),p=require("../../styles/StationOnboardModal.module.css.js"),g=require("./InputField.js"),x=require("../../store/useAuthStore.js"),f=require("../../store/useConfigStore.js"),h=require("../../store/useLearningTemplateStore.js"),_=require("../../config.js"),m=require("../../store/useAppSecRolesStore.js"),y=require("../../store/useEnvStore.js"),v=require("../../RuleContent/AddScopeApprovalSearchComponent.js"),S=require("./DayToggleSelector.js"),b=[{label:"6am to 7pm",value:"06:00 AM - 7:00 PM"},{label:"5am to 7pm",value:"05:00 AM - 7:00 PM"}],j=[{label:"Low Sellout",value:"Low Sellout"},{label:"High Sellout",value:"High Sellout"},{label:"None",value:""}],w=[{label:"None",value:"None"},{label:"Distribute spots evenly across all breaks in the hour",value:"Distribute spots evenly across all breaks in the hour"}],C=[{label:"Mon",value:"monday"},{label:"Tue",value:"tuesday"},{label:"Wed",value:"wednesday"},{label:"Thu",value:"thursday"},{label:"Fri",value:"friday"},{label:"Sat",value:"saturday"},{label:"Sun",value:"sunday"}];exports.default=function(T){var B,F=T.isOpen,E=T.onClose,D=T.onBoardStation,k=T.app_integration_id,q=T.token,A=r.useState(null),O=A[0],R=A[1],z=r.useState([]),I=z[0],L=z[1],M=r.useState(0),N=M[0],W=M[1],P=r.useState(!0),G=P[0],K=P[1],U=r.useState(!1),H=U[0],V=U[1],Y=r.useState([]),X=Y[0],J=Y[1],Q=r.useState(""),Z=Q[0],$=Q[1],ee=r.useState(""),ne=ee[0],re=ee[1],oe=r.useState(!1),ie=oe[0],te=oe[1],se=r.useState(!1),ae=se[0],le=se[1],ue=r.useState(null),de=ue[0],ce=ue[1],pe=r.useState(null);pe[0],pe[1];var ge=r.useState(!1),xe=ge[0],fe=ge[1],he=r.useState(0),_e=he[0],me=he[1],ye=r.useState(""),ve=ye[0],Se=ye[1],be=x.default().user,je=r.useRef(null),we=r.useRef(null),Ce=r.useRef(null),Te=r.useRef(null);f.useConfigStore().configuration;var Be=r.useRef(null),Fe=m.useAppSecRolesStore(function(e){return e.roles}),Ee=y.default(function(e){return e.rbacConfig}),De=r.useState("approval_required"),ke=De[0],qe=De[1],Ae=r.useState([]),Oe=Ae[0],Re=Ae[1],ze=r.useState([]),Ie=ze[0],Le=ze[1],Me=r.useState(""),Ne=Me[0],We=Me[1],Pe=h.useLearningTemplateStore(function(e){return e.stationNameParam}),Ge=r.useState({region:"",primeTime:["06:00 AM - 7:00 PM"],genre:"Music",type:"",lowSelloutConfig:"",source_days:["wednesday","thursday","friday","saturday"],target_days:["monday","tuesday","wednesday"]}),Ke=Ge[0],Ue=Ge[1],He=function(e,n){return e.find(function(e){return e.value===n})||null},Ve=r.useMemo(function(){return I.map(function(e){return{label:e.scope_name,value:e.scope_name}})},[I]),Ye=r.useMemo(function(){var e,n,r;if(!Ke.genre)return null;var o=I.find(function(e){return e.scope_name===Ke.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},[Ke.genre,I]);r.useEffect(function(){return function(){Ce.current&&clearTimeout(Ce.current)}},[]);var Xe=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(H)return[2];V(!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,L(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?K(!1):K(!0),W(n+20)):K(!1),[3,5];case 3:return i=t.sent(),console.error("[StationOnboard] Failed to fetch genre scopes:",i),K(!1),[3,5];case 4:return V(!1),[7];case 5:return[2]}})})};r.useEffect(function(){if(F&&(L([]),W(0),K(!0),Xe(0),Pe)){Se(Pe);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(Pe,!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())===Pe.toLowerCase()&&!e.ruleset_id}),r&&R(r)),[3,3];case 2:return o=e.sent(),console.error("[StationOnboard] Error auto-selecting station:",o),[3,3];case 3:return[2]}})})}},[F,Pe]);r.useEffect(function(){Ue(O?function(n){var r;return e.__assign(e.__assign({},n),{region:null!==(r=O.market)&&void 0!==r?r:""})}:{region:"",primeTime:["06:00 AM - 7:00 PM"],genre:"Music",type:"",lowSelloutConfig:"",source_days:["wednesday","thursday","friday","saturday"],target_days:["monday","tuesday","wednesday"]})},[O]),r.useEffect(function(){var e=setTimeout(function(){re(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(!ne.trim())return J([]),[2];te(!0),e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,a.searchScopes({search_string:ne.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]===Ke.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}}),J(o)):J([]),[3,5];case 3:return i=e.sent(),console.error("[StationOnboard] Error searching scopes:",i),J([]),[3,5];case 4:return te(!1),[7];case 5:return[2]}})})},[ne,Ke.genre]),r.useEffect(function(){!ne.trim()&&Ye&&ce(Ye.id)},[ne,Ye]);var Je=function(){setTimeout(function(){Te.current&&Te.current.scrollTo({top:Te.current.scrollHeight,behavior:"smooth"})},100)},Qe=function(){Se(""),R(null),Ue({region:"",primeTime:["06:00 AM - 7:00 PM"],genre:"Music",type:"",lowSelloutConfig:"",source_days:["wednesday","thursday","friday","saturday"],target_days:["monday","tuesday","wednesday"]}),J([]),$(""),ce(null),qe("approval_required"),Re([]),Le([]),We(""),E()},Ze=function(n,r){var o;if("primeTime"!==n)if("source_days"!==n&&"target_days"!==n){var i=null!==(o=null==r?void 0:r.value)&&void 0!==o?o:"";Ue(function(r){var o;return e.__assign(e.__assign({},r),((o={})[n]=String(i),o))}),"genre"===n&&(le(!0),Ce.current&&clearTimeout(Ce.current),Ce.current=setTimeout(function(){var e=I.find(function(e){return e.scope_name===i});ce(e?e.id:null),le(!1)},800))}else Ue(function(o){var i;return e.__assign(e.__assign({},o),((i={})[n]=r,i))});else{var t=(null==r?void 0:r.value)?String(r.value):"";Ue(function(n){return e.__assign(e.__assign({},n),{primeTime:t?[t]:[]})})}},$e=Boolean(O&&Ke.region&&Ke.primeTime.length>0&&Ke.genre);return n.jsxs(o.Dialog,e.__assign({open:F,onClose:Qe,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:je}),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:Qe,disabled:xe,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(d.default,{isLoading:xe,currentStep:_e,onComplete:function(){fe(!1);var e=we.current;Qe(),D(e||void 0),we.current=null}}),n.jsx(o.Box,e.__assign({sx:{display:"flex",flex:1,flexDirection:"column",paddingY:"14px",paddingX:"20px",gap:2,overflowY:"auto"}},{children:n.jsxs(o.Box,e.__assign({sx:{display:"flex",gap:3}},{children:[n.jsxs(o.Box,e.__assign({ref:Te,sx:{flex:1,bgcolor:"#fff",p:3,borderRadius:"16px",border:"1px solid #F0F2F5"}},{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:ve,onChange:Se,onStationSelect:function(e){return R(e)}})]})),n.jsx(g.default,{required:!0,disabled:!0,label:"Region",placeholder:"Select Region",value:Ke.region||void 0,isSearchable:!1}),n.jsx(g.default,{required:!0,label:"Prime Time Window",placeholder:"Select Prime Time",options:b,value:He(b,(null===(B=Ke.primeTime)||void 0===B?void 0:B[0])||""),onOptionChange:function(e){return Ze("primeTime",e)},isSearchable:!1}),n.jsx(o.Box,e.__assign({onClick:Je,sx:{width:"100%"}},{children:n.jsx(g.default,{label:"Station Sellout Type",placeholder:"None",options:j,value:He(j,Ke.type),onOptionChange:function(n){Ze("type",n),"Low Sellout"!==(null==n?void 0:n.value)&&Ue(function(n){return e.__assign(e.__assign({},n),{lowSelloutConfig:""})})},isSearchable:!1})})),"Low Sellout"===Ke.type&&n.jsx(o.Box,e.__assign({onClick:Je,sx:{width:"100%"}},{children:n.jsx(g.default,{label:"Low Sell Out Configurations",placeholder:"Select Configuration",options:w,value:He(w,Ke.lowSelloutConfig),onOptionChange:function(e){return Ze("lowSelloutConfig",e)},isSearchable:!1})})),n.jsxs(o.Box,e.__assign({onClick:Je,sx:{width:"100%",display:"flex",flexDirection:"column",gap:"20px"}},{children:[n.jsx(o.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:600,color:"#19213D"}},{children:"Front-Loading Configuration"})),n.jsx(S.default,{label:"Source Days",subText:"Days from which spots can be front loaded.",options:C,selectedValues:Ke.source_days,onChange:function(e){return Ze("source_days",e)}}),n.jsx(S.default,{label:"Target Days",subText:"Days where front loaded spots can be placed.",options:C,selectedValues:Ke.target_days,onChange:function(e){return Ze("target_days",e)}})]})),h.useLearningTemplateStore.getState().backwardCompatibility&&n.jsxs("div",e.__assign({ref:Be,style:{display:"flex",flexDirection:"column",marginTop:"12px"}},{children:[n.jsx(o.Typography,e.__assign({sx:{fontSize:"1rem",fontWeight:600,mb:.5,color:"#19213D"}},{children:"Approval Settings"})),n.jsx(o.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#00000080",mb:"20px"}},{children:"Configure who can approve learnings before they get published."})),n.jsxs("div",e.__assign({style:{marginBottom:"12px",fontSize:"12px",color:"#8F2C23",gap:"16px"}},{children:[n.jsxs("div",e.__assign({style:{marginBottom:"12px",fontSize:"12px",color:"#8F2C23",gap:"12px"}},{children:[n.jsxs("div",e.__assign({role:"radio","aria-checked":"approval_required"===ke,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:"4px",marginBottom:"8px"},onClick:function(){return qe("approval_required")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||qe("approval_required")}},{children:[n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[n.jsx("div",e.__assign({style:{display:"flex",height:"16px",width:"16px",flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("approval_required"===ke?"#2563EB":"#CBD5E1")}},{children:"approval_required"===ke&&n.jsx("div",{style:{height:"8px",width:"8px",borderRadius:"50%",backgroundColor:"#2563EB"}})})),n.jsx("span",e.__assign({style:{fontSize:"14px",fontWeight:500,color:"#19213D"}},{children:"Approval Required Before Publishing"}))]})),n.jsx("p",e.__assign({style:{margin:0,marginLeft:"24px",fontSize:"12px",color:"#666F8D"}},{children:"Learnings require approval before publishing."}))]})),n.jsxs("div",e.__assign({style:{gap:"16px"}},{children:["approval_required"===ke&&n.jsx(v.default,{selectedApprovers:Oe,selectedGroupOfApprovers:Ie,onApproversChange:function(e){Re(e),We("")},onGroupsChange:function(e){Le(e),We("")}}),Ne&&n.jsx("p",e.__assign({style:{margin:0,marginLeft:"24px",fontSize:"12px",color:"#8F2C23"}},{children:Ne}))]}))]})),n.jsxs("div",e.__assign({role:"radio","aria-checked":"publish_without"===ke,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:"4px"},onClick:function(){qe("publish_without"),We("")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||(qe("publish_without"),We(""))}},{children:[n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[n.jsx("div",e.__assign({style:{display:"flex",height:"16px",width:"16px",flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("publish_without"===ke?"#2563EB":"#CBD5E1")}},{children:"publish_without"===ke&&n.jsx("div",{style:{height:"8px",width:"8px",borderRadius:"50%",backgroundColor:"#2563EB"}})})),n.jsx("span",e.__assign({style:{fontSize:"14px",fontWeight:500,color:"#19213D"}},{children:"Publish Without Approval"}))]})),n.jsx("p",e.__assign({style:{margin:0,marginLeft:"24px",fontSize:"12px",color:"#666F8D"}},{children:"Learnings can be published directly."}))]}))]}))]}))]}))]})),n.jsxs(o.Box,e.__assign({sx:{flex:1,bgcolor:"#fff",p:3,borderRadius:"12px",border:"1px solid #F0F2F5",display:"flex",flexDirection:"column"}},{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(g.default,{required:!0,label:"",placeholder:"Select Genre",options:Ve,value:He(Ve,Ke.genre),onOptionChange:function(e){return Ze("genre",e)},isSearchable:!1,onMenuScrollToBottom:function(){!H&&G&&Xe(N)},isLoadingOptions:H,hasMoreOptions:G})})),n.jsx(o.Box,e.__assign({sx:{mb:3}},{children:ae?n.jsx(u.default,{}):Ye?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:Ye.title})),n.jsx(o.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#2563EB",mb:"8px"}},{children:Ye.description})),n.jsxs(o.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"}},{children:[Ye.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"})]})),Ye.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:[Ye.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:[Ye.tiersCount," Tiers"]}))]}))]}))]})):Ke.genre?null:n.jsx(o.Box,e.__assign({sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",opacity:.4,py:6,gap:1}},{children:n.jsx(o.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#94A3B8"}},{children:"Select a genre to load the matching scope"}))}))})),Ke.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 “",Ke.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 “",Ke.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 $(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:[ie&&n.jsx(u.default,{}),!ie&&0===X.length&&ne.trim()&&n.jsxs(o.Typography,e.__assign({sx:{fontSize:"0.875rem",color:"#64748B",textAlign:"center",py:4}},{children:['No scopes found matching "',ne,'".']})),!ie&&X.map(function(r){return n.jsx(c.default,e.__assign({},r,{isSelected:de===r.id,onSelect:function(e){var n;ce(de===e?null!==(n=null==Ye?void 0:Ye.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:Qe,disabled:xe,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,d,c,p,g,x,f,m,y,v,S,b,j;return e.__generator(this,function(w){switch(w.label){case 0:if(!O||!de)return console.error("[StationOnboard] Missing required data for onboarding"),[2];if(h.useLearningTemplateStore.getState().backwardCompatibility&&"approval_required"===ke&&0===Oe.length&&0===Ie.length)return We("Please select at least one approver or approver group."),setTimeout(function(){var e;null===(e=Be.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"center"})},50),[2];We(""),n=Ye?e.__spreadArray([Ye],X,!0):X,r=n.find(function(e){return e.id===de}),null==r?void 0:r.isCopy,fe(!0),me(0),o=null,w.label=1;case 1:return w.trys.push([1,3,,4]),i=h.useLearningTemplateStore.getState().backwardCompatibility,t=i?{topic:"customRuleSet",customScopeGroupName:_.IL_CONFIG_CONSTANTS.CUSTOM_SCOPE_GROUP_NAME,scopeDescription:O.station_name||"New Station",parentScopeId:null!==(g=null==Ye?void 0:Ye.id)&&void 0!==g?g:null,customScopeName:O.station_name||"New Station",customScopeId:s.v4(),createByName:(null==be?void 0:be.firstname)||"System",createdBy:(null==be?void 0:be.email)||"system@audacy.com",scopeType:"Station",approvalRequired:"approval_required"===ke,audacyStationMetadata:{genre:Ke.genre,low_sellout_configurations:"Low Sellout"===Ke.type?Ke.lowSelloutConfig:null,market:O.market,primetime_windows:Ke.primeTime,region:O.region,station_guid:O.station_guid,station_type:""===Ke.type?null:Ke.type,source_days:Ke.source_days,target_days:Ke.target_days},appsecData:{application:null==Ee?void 0:Ee.applicationId,module:null==Ee?void 0:Ee.moduleId,roles:e.__spreadArray(e.__spreadArray([],"approval_required"===ke?[{users:Oe.map(function(e){return e.email}),groups:Ie.map(function(e){return e._id}),role:null!==(f=null===(x=Fe.find(function(e){return"Learning Manager"===e.name}))||void 0===x?void 0:x._id)&&void 0!==f?f:""}]:[],!0),[{users:[null==be?void 0:be.email],groups:[],role:null!==(y=null===(m=Fe.find(function(e){return"Instant Learning Admin"===e.name}))||void 0===m?void 0:m._id)&&void 0!==y?y:""}],!1)}}:{topic:"customRuleSet",scope_reference_id:null,scopeDescription:"demo",parentScopeId:null,scopeName:O.station_name||"New Station",scopeReferenceMetadata:{},applicationMappingId:k},console.log("[StationOnboard] Step 1: Creating rule set with payload:",t),[4,a.createRuleSet(t,q)];case 2:if(l=w.sent(),!(o=null===(v=null==l?void 0:l.data)||void 0===v?void 0:v.scopeId))throw new Error("Failed to create scope - no scopeId returned");return console.log("[StationOnboard] Step 1 Complete: Created scope with ID:",o),me(1),[3,4];case 3:return u=w.sent(),console.error("[StationOnboard] Error creating rule set:",u),null===(S=je.current)||void 0===S||S.show({severity:"error",life:3e3,summary:"Error",detail:"Failed to create rule set. Please try again."}),fe(!1),me(0),[2];case 4:return w.trys.push([4,6,,7]),d=null!==de&&de!==(null==Ye?void 0:Ye.id),c={source_scope_id:d?de:null!==(b=null==Ye?void 0:Ye.id)&&void 0!==b?b:de,target_scope_id:o,is_copy_parent_variant_id:d},console.log("[StationOnboard] Step 3: Inheriting scope with payload:",c),[4,a.inheritScopeBackwardCompatible(c)];case 5:return w.sent(),console.log("[StationOnboard] Step 3 Complete: Scope inherited"),me(3),[3,7];case 6:return p=w.sent(),console.error("[StationOnboard] Error inheriting scope (no rollback):",p),null===(j=je.current)||void 0===j||j.show({severity:"error",life:3e3,summary:"Error",detail:"Failed to apply rule template. Please try again."}),fe(!1),me(0),[2];case 7:return we.current=o,console.log("[StationOnboard] Onboarding completed successfully!"),[2]}})})},disabled:!$e||xe,style:{padding:"7px 10px",borderRadius:"6px",border:"none",backgroundColor:$e?"#2563EB":"#BFDBFE",color:"#fff",cursor:$e&&!xe?"pointer":"not-allowed",fontSize:"14px",fontWeight:500,display:"flex",alignItems:"center",gap:"7px"}},{children:xe?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})]})}))]}))]}))};
|
|
2
2
|
//# sourceMappingURL=StationOnboardModal.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e}from"tslib";import{jsxs as
|
|
1
|
+
import{__assign as e}from"tslib";import{jsxs as o,jsx as t}from"react/jsx-runtime";import{useState as i,useMemo as n,useEffect as a}from"react";import{AuditLog as r}from"@e-llm-studio/audit-log";import"@e-llm-studio/audit-log/dist/styles.css";import{User as l,ExternalLink as c}from"lucide-react";import s from"./ChangeLogDiff.js";import{dt as d}from"../store/useLMSConfigStore.js";import p from"../RBAC/AccessPanel.module.css.js";import{usePermissionsStore as g}from"../store/usePermissionsStore.js";import h from"../store/useEnvStore.js";import{useConfigStore as u}from"../store/useConfigStore.js";var m=function(m){var f=m.configId,b=m.ruleData,y=m.scopeId,x=m.scopeName,v=(null==x?void 0:x.trim())||"Selected",w=i("scope"),C=w[0],S=w[1];u.getState().configuration;var T=g(function(e){return e.hasPermission}),L=h(function(e){var o;return(null===(o=e.rbacConfig)||void 0===o?void 0:o.applicationResourceId)||""}),A=Boolean(y&&T("ilotj.scope.changeLog.view",y)),k=Boolean(L&&T("ilotj.application.changeLog.view",L)),D=n(function(){var e=[];return y&&e.push(y),e},[b,y]);a(function(){console.log("Flattened External Resource IDs:",D)},[D]);var I={configId:f,getData:{baseUrl:window.location.origin.includes("local")?"https://dev.appmod.ai":window.location.origin,endpoint:"/changelog/audit-log/fetch"},distinctValuesApi:{baseUrl:window.location.origin.includes("local")?"https://dev.appmod.ai":window.location.origin,endpoint:"/changelog/audit-log/distinct-values"},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 o("div",e({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[t(l,{size:16,color:"#64748b",style:{flexShrink:0}}),t("span",e({style:{fontWeight:500}},{children:i.modifiedBy}))]}))},style:{width:"15%",minWidth:"140px"}},{key:"changeAction",header:"Action",body:function(o){var i,n,a=(i=o.changeTitle,(n=(i||"").toUpperCase()).includes("CREATE")?{color:"#2e7d32",backgroundColor:"#edf7ed",borderColor:"#c8e6c9",boxShadow:"0 1px 2px rgba(46, 125, 50, 0.08)"}:n.includes("UPDATE")||n.includes("TOGGLE")?{color:"#1565c0",backgroundColor:"#e3f2fd",borderColor:"#bbdefb",boxShadow:"0 1px 2px rgba(21, 101, 192, 0.08)"}:n.includes("DELETE")?{color:"#c62828",backgroundColor:"#fdeeed",borderColor:"#ffcdd2",boxShadow:"0 1px 2px rgba(198, 40, 40, 0.08)"}:{color:"#475569",backgroundColor:"#f8fafc",borderColor:"#cbd5e1",boxShadow:"0 1px 2px rgba(15, 23, 42, 0.06)"}),r=o.changeTitle?o.changeTitle.replace(/_/g," "):"—";return t("span",e({style:{color:a.color,backgroundColor:a.backgroundColor,border:"1px solid ".concat(a.borderColor),boxShadow:a.boxShadow,padding:"6px 12px",borderRadius:"999px",fontSize:"12px",lineHeight:1,fontWeight:600,display:"inline-block",minWidth:"76px",textAlign:"center",textTransform:"capitalize"}},{children:r}))},style:{width:"15%",textAlign:"center"}},{key:"customChangeSummary",header:"Change Summary",body:function(e){var o;return t(s,{change:null!==(o=e.actionText)&&void 0!==o?o:"-"})},style:{width:"30%",minWidth:"200px"}},{key:"redirectLink",header:"Link",body:function(i){var n,a=(null===(n=i.metadata)||void 0===n?void 0:n.redirect_url)||i.redirect_url;return a?t("div",e({style:{display:"flex",justifyContent:"center",alignItems:"center"}},{children:o("a",e({href:a,target:"_blank",rel:"noopener noreferrer",style:{display:"flex",alignItems:"center",gap:"6px",color:"#2563eb",textDecoration:"none",fontWeight:500,fontSize:"13px"}},{children:["View ",t(c,{size:14})]}))})):t("span",e({style:{color:"#94a3b8",display:"flex",justifyContent:"center"}},{children:"—"}))},style:{width:"10%",minWidth:"90px",textAlign:"center"}},{key:"customChangeDateTime",header:"Change Time and Date",body:function(i){if(!i.actionDate)return t("span",e({style:{color:"#94a3b8"}},{children:"—"}));var n=new Date(i.actionDate),a=n.toLocaleDateString("en-US",{month:"short",day:"2-digit",year:"numeric"}),r=n.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"});return o("div",e({style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"4px",fontSize:"13px",color:"#475569"}},{children:[t("span",e({style:{fontWeight:500}},{children:a})),t("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}}}};return o("div",e({style:{padding:"24px",fontFamily:"Arial, sans-serif"}},{children:[o("div",e({style:{marginBottom:"16px",paddingBottom:"4px"}},{children:[t("h1",e({style:{margin:0,color:"#334155",fontSize:"20px",fontWeight:700,lineHeight:1.25}},{children:d("history.title","".concat(v," - Audit Log"),{scope_name:v})})),t("p",e({style:{margin:"8px 0 0",color:"#667085",fontSize:"16px",fontWeight:500,lineHeight:1}},{children:d("history.subtitle","Track all learning updates and modifications with the ".concat(v," scope."),{scope_name:v})}))]})),o("div",e({className:p.accessTabs,role:"tablist","aria-label":"Audit log level"},{children:[t("button",e({type:"button",role:"tab","aria-selected":"scope"===C,className:"".concat(p.accessTab," ").concat("scope"===C?p.accessTabActive:""),onClick:function(){return S("scope")},disabled:!A,title:A?"":"You do not have permission to view scope level change log"},{children:d("history.scopeLevel","Scope Level")})),t("button",e({type:"button",role:"tab","aria-selected":"application"===C,className:"".concat(p.accessTab," ").concat("application"===C?p.accessTabActive:""),onClick:function(){return S("application")},disabled:!k,title:k?"":"You do not have permission to view application level change log"},{children:d("history.applicationLevel","Application Level")}))]})),"scope"===C?t(r,e({},I,{query:{externalResourceId:D.length>0?D:[""],paginationLimit:10}}),"scope-audit-log"):t(r,e({},I,{query:{externalResourceId:[],paginationLimit:10}}),"application-audit-log")]}))};export{m as default};
|
|
2
2
|
//# sourceMappingURL=AuditLog.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"react";var t="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";export{t as default};
|
|
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":["EmptyResultIconSVG"],"mappings":"cA0KA,IAAAA,EAAe"}
|
package/dist/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{__assign as e,__awaiter as r,__generator as n,__spreadArray as t}from"tslib";import{jsxs as o,jsx as i,Fragment as l}from"react/jsx-runtime";import{useState as a,useRef as s,useMemo as u,useEffect as c}from"react";import{Dialog as d,Box as p,Typography as f,IconButton as m,DialogContent as h,CircularProgress as g}from"@mui/material";import{X as v,Search as b,ArrowRight as x}from"lucide-react";import{Toast as S}from"primereact/toast";import{v4 as y}from"uuid";import w from"../../assets/Search-result(add new).svg.js";import C from"../../store/useAuthStore.js";import{IL_CONFIG_CONSTANTS as _}from"../../config.js";import{retrieveGenreScopes as O,fetchStationsByKeyword as F,searchScopes as T,inheritScope as A,deleteRuleSet as N,updateStation as M,createRuleSet as E}from"../../apis/scopeApis.js";import k from"./InputField.js";import D from"./StationAutocomplete.js";import z from"../CardSkeleton.js";import P from"./OnboardingLoader.js";import B from"./TemplateCard.js";var j=[{label:"5am to 7pm",value:"05:00 AM - 7:00 PM"},{label:"6am to 7pm",value:"06:00 AM - 7:00 PM"}],I=[{label:"Low Sellout",value:"Low Sellout"},{label:"High Sellout",value:"High Sellout"},{label:"None",value:""}],L=[{label:"None",value:"None"},{label:"Distribute spots evenly across all breaks in the hour",value:"Distribute spots evenly across all breaks in the hour"}],R=function(R){var W,U=R.isOpen,q=R.onClose,G=R.onBoardStation,Y=R.app_integration_id,H=R.token,K=R.stationNameParam,X=a(null),J=X[0],Q=X[1],V=a([]),Z=V[0],$=V[1],ee=a(0),re=ee[0],ne=ee[1],te=a(!0),oe=te[0],ie=te[1],le=a(!1),ae=le[0],se=le[1],ue=a([]),ce=ue[0],de=ue[1],pe=a(""),fe=pe[0],me=pe[1],he=a(""),ge=he[0],ve=he[1],be=a(!1),xe=be[0],Se=be[1],ye=a(!1),we=ye[0],Ce=ye[1],_e=a(null),Oe=_e[0],Fe=_e[1],Te=a(!1),Ae=Te[0],Ne=Te[1],Me=a(0),Ee=Me[0],ke=Me[1],De=a(""),ze=De[0],Pe=De[1],Be=C().user,je=s(null),Ie=s(null),Le=s(null),Re=s(null),We=a({region:"",primeTime:["06:00 AM - 7:00 PM"],genre:"Music",type:"",lowSelloutConfig:""}),Ue=We[0],qe=We[1],Ge=function(e,r){return e.find(function(e){return e.value===r})||null},Ye=u(function(){return Z.map(function(e){return{label:e.scope_name,value:e.scope_name}})},[Z]),He=u(function(){var e,r,n;if(!Ue.genre)return null;var t=Z.find(function(e){return e.scope_name===Ue.genre});return t?{id:t.id,title:t.scope_name||"Unnamed Template",description:(null===(e=t.description)||void 0===e?void 0:e.trim())||"No description available.",inheritedText:(null===(r=t.inheritance)||void 0===r?void 0:r[0])||void 0,rulesCount:t.rules_count||0,tiersCount:t.tier_count||0,isCopy:null!==(n=t.is_copy)&&void 0!==n&&n}:null},[Ue.genre,Z]);c(function(){return function(){Le.current&&clearTimeout(Le.current)}},[]);var Ke=function(e){return r(void 0,void 0,void 0,function(){var r,o,i;return n(this,function(n){switch(n.label){case 0:if(ae)return[2];se(!0),n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,O({limit:"20",offset:String(e)})];case 2:return"success"===(null==(r=n.sent())?void 0:r.status)&&Array.isArray(null==r?void 0:r.data)?(o=r.data,$(function(r){if(0===e)return o;var n=new Set(r.map(function(e){return e.id})),i=o.filter(function(e){return!n.has(e.id)});return t(t([],r,!0),i,!0)}),o.length<20?ie(!1):ie(!0),ne(e+20)):ie(!1),[3,5];case 3:return i=n.sent(),console.error("[StationOnboard] Failed to fetch genre scopes:",i),ie(!1),[3,5];case 4:return se(!1),[7];case 5:return[2]}})})};c(function(){if(U&&($([]),ne(0),ie(!0),Ke(0),K)){Pe(K);r(void 0,void 0,void 0,function(){var e,r,t;return n(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,F(K,!0)];case 1:return!0===(null==(e=n.sent())?void 0:e.success)&&Array.isArray(null==e?void 0:e.data)&&(r=e.data.find(function(e){var r;return(null===(r=e.station_name)||void 0===r?void 0:r.toLowerCase())===K.toLowerCase()&&!e.ruleset_id}),r&&Q(r)),[3,3];case 2:return t=n.sent(),console.error("[StationOnboard] Error auto-selecting station:",t),[3,3];case 3:return[2]}})})}},[U,K]);c(function(){qe(J?function(r){var n;return e(e({},r),{region:null!==(n=J.market)&&void 0!==n?n:""})}:{region:"",primeTime:["06:00 AM - 7:00 PM"],genre:"Music",type:"",lowSelloutConfig:""})},[J]),c(function(){var e=setTimeout(function(){ve(fe)},500);return function(){return clearTimeout(e)}},[fe]),c(function(){r(void 0,void 0,void 0,function(){var e,r,t;return n(this,function(n){switch(n.label){case 0:if(!ge.trim())return de([]),[2];Se(!0),n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,T({search_string:ge})];case 2:return"success"===(null==(e=n.sent())?void 0:e.status)&&Array.isArray(null==e?void 0:e.data)?(r=e.data.map(function(e){var r,n,t;return{id:e.id,title:e.scope_name||"Unnamed Template",description:(null===(r=e.description)||void 0===r?void 0:r.trim())||"No description available.",inheritedText:(null===(n=e.inheritance)||void 0===n?void 0:n[0])||void 0,rulesCount:e.rules_count||0,tiersCount:e.tier_count||0,isCopy:null!==(t=e.is_copy)&&void 0!==t&&t}}),de(r)):de([]),[3,5];case 3:return t=n.sent(),console.error("[StationOnboard] Error searching scopes:",t),de([]),[3,5];case 4:return Se(!1),[7];case 5:return[2]}})})},[ge]),c(function(){!ge.trim()&&He&&Fe(He.id)},[ge,He]);var Xe=function(){setTimeout(function(){Re.current&&Re.current.scrollTo({top:Re.current.scrollHeight,behavior:"smooth"})},100)},Je=function(){Pe(""),Q(null),qe({region:"",primeTime:["06:00 AM - 7:00 PM"],genre:"Music",type:"",lowSelloutConfig:""}),de([]),me(""),Fe(null),q()},Qe=function(r,n){var t;if("primeTime"!==r){var o=null!==(t=null==n?void 0:n.value)&&void 0!==t?t:"";qe(function(n){var t;return e(e({},n),((t={})[r]=String(o),t))}),"genre"===r&&(Ce(!0),Le.current&&clearTimeout(Le.current),Le.current=setTimeout(function(){var e=Z.find(function(e){return e.scope_name===o});Fe(e?e.id:null),Ce(!1)},800))}else{var i=(null==n?void 0:n.value)?String(n.value):"";qe(function(r){return e(e({},r),{primeTime:i?[i]:[]})})}},Ve=Boolean(J&&Ue.region&&Ue.primeTime.length>0&&Ue.genre);return o(d,e({open:U,onClose:Je,maxWidth:!1,disableEscapeKeyDown:!0,PaperProps:{sx:{width:"90vw",height:"90vh",borderRadius:"12px",display:"flex",flexDirection:"column",overflow:"hidden"}}},{children:[i(S,{ref:je}),o(p,e({sx:{p:"20px 20px 20px 27px",borderBottom:"1px solid #F0F2F5",display:"flex",justifyContent:"space-between",alignItems:"center",bgcolor:"#fff"}},{children:[o(p,e({sx:{display:"flex",flexDirection:"column",gap:.5}},{children:[i(f,e({sx:{fontSize:"18px",fontWeight:600,color:"#19213D"}},{children:"Onboard a Station"})),i(f,e({sx:{fontSize:"16px",fontWeight:400,color:"#666F8D"}},{children:"Onboard a station to start configuring learnings."}))]})),i(m,e({onClick:Je,disabled:Ae,sx:{color:"#19213D"}},{children:i(v,{size:24})}))]})),o(h,e({sx:{p:0,bgcolor:"#F8FAFC",display:"flex",flexDirection:"row",overflow:"hidden",position:"relative"}},{children:[i(P,{isLoading:Ae,currentStep:Ee,onComplete:function(){Ne(!1);var e=Ie.current;Je(),G(e||void 0),Ie.current=null}}),o(p,e({sx:{display:"flex",flex:1,paddingY:"14px",paddingX:"20px",gap:3,overflowY:"hidden"}},{children:[o(p,e({ref:Re,sx:{flex:1,bgcolor:"#fff",p:3,borderRadius:"16px",border:"1px solid #F0F2F5",height:"100%",overflowY:"auto"}},{children:[i(f,e({sx:{fontSize:"1rem",fontWeight:600,mb:.5,color:"#19213D"}},{children:"Basic Details"})),i(f,e({sx:{fontSize:"0.75rem",color:"#00000080",mb:"20px"}},{children:"Set up basic station details to unlock AI recommended scopes."})),o(p,e({sx:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[o(p,e({className:"space-y-1.5"},{children:[o("label",e({className:"text-sm font-medium text-[#19213D]"},{children:[i("span",e({className:"mr-0.5 text-xs font-semibold text-[#8F2C23]"},{children:"*"})),"Station Name/Call Letters"]})),i(D,{value:ze,onChange:Pe,onStationSelect:function(e){return Q(e)}})]})),i(k,{required:!0,disabled:!0,label:"Region",placeholder:"Select Region",value:Ue.region||void 0,isSearchable:!1}),i(k,{required:!0,label:"Prime Time Window",placeholder:"Select Prime Time",options:j,value:Ge(j,(null===(W=Ue.primeTime)||void 0===W?void 0:W[0])||""),onOptionChange:function(e){return Qe("primeTime",e)},isSearchable:!1}),i(p,e({onClick:Xe,sx:{width:"100%"}},{children:i(k,{required:!0,label:"Genre",placeholder:"Select Genre",options:Ye,value:Ge(Ye,Ue.genre),onOptionChange:function(e){return Qe("genre",e)},isSearchable:!1,onMenuScrollToBottom:function(){!ae&&oe&&Ke(re)},isLoadingOptions:ae,hasMoreOptions:oe})})),i(p,e({onClick:Xe,sx:{width:"100%"}},{children:i(k,{label:"Station Type",placeholder:"None",options:I,value:Ge(I,Ue.type),onOptionChange:function(r){Qe("type",r),"Low Sellout"!==(null==r?void 0:r.value)&&qe(function(r){return e(e({},r),{lowSelloutConfig:""})})},isSearchable:!1})})),"Low Sellout"===Ue.type&&i(p,e({onClick:Xe,sx:{width:"100%"}},{children:i(k,{label:"Low Sell Out Configurations",placeholder:"Select Configuration",options:L,value:Ge(L,Ue.lowSelloutConfig),onOptionChange:function(e){return Qe("lowSelloutConfig",e)},isSearchable:!1})}))]}))]})),i(p,e({sx:{flex:1,bgcolor:"#fff",p:3,borderRadius:"12px",border:"1px solid #F0F2F5",display:"flex",flexDirection:"column",height:"100%",overflowY:"auto"}},{children:Ue.genre?o(l,{children:[i(f,e({sx:{fontSize:"1rem",fontWeight:500,mb:1.5}},{children:"Matching scope for your station"})),i(p,e({sx:{display:"flex",flexDirection:"column",gap:2,mb:4}},{children:we?i(z,{}):He?i(B,e({},He,{isSelected:Oe===He.id,onSelect:Fe}),He.id):null})),i(f,e({sx:{fontSize:"1rem",fontWeight:500,mb:1.5}},{children:"Other available stations"})),o("div",e({className:"relative mb-4 w-full"},{children:[i("input",{type:"text",value:fe,onChange:function(e){return me(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"}),i(b,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400",size:16})]})),o(p,e({sx:{display:"flex",flexDirection:"column",gap:2}},{children:[xe&&i(z,{}),!xe&&0===ce.length&&ge.trim()&&o(f,e({sx:{fontSize:"0.875rem",color:"#64748B",textAlign:"center",py:4}},{children:['No scopes found matching "',ge,'".']})),!xe&&ce.map(function(r){return i(B,e({},r,{isSelected:Oe===r.id,onSelect:Fe}),r.id)})]}))]}):o(l,{children:[i(f,e({sx:{fontSize:"1rem",fontWeight:500,mb:1.5}},{children:"Fill in the station details to load AI recommended scopes"})),i(f,e({sx:{fontSize:"0.75rem",color:"#64748B",mb:3}},{children:"AI will recommend the most relevant scope for this station."})),i(p,e({sx:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",opacity:.5,py:10}},{children:i("img",{src:w,alt:"Empty Result"})}))]})}))]}))]})),o(p,e({sx:{p:"12px 20px",borderTop:"1px solid #F0F2F5",display:"flex",justifyContent:"flex-end",gap:2,bgcolor:"#fff"}},{children:[i("button",e({onClick:Je,disabled:Ae,style:{padding:"7px 10px",borderRadius:"6px",color:"#64748B",border:"1px solid #E2E8F0",backgroundColor:"#fff",cursor:"pointer",fontSize:"14px",fontWeight:500}},{children:"Cancel"})),i("button",e({onClick:function(){return r(void 0,void 0,void 0,function(){var r,o,i,l,a,s,u,c,d,p,f,m,h,g,v,b,x,S;return n(this,function(n){switch(n.label){case 0:if(!J||!Oe)return console.error("[StationOnboard] Missing required data for onboarding"),[2];r=He?t([He],ce,!0):ce,o=r.find(function(e){return e.id===Oe}),i=null!==(h=null==o?void 0:o.isCopy)&&void 0!==h&&h,Ne(!0),ke(0),l=null,n.label=1;case 1:return n.trys.push([1,3,,4]),a={topic:"customRuleSet",customScopeGroupName:(null==_?void 0:_.CUSTOM_SCOPE_GROUP_NAME)||"Audacy-Traffic-Manager",scopeDescription:J.station_name||"New Station",parentScopeId:null,customScopeName:J.station_name||"New Station",customScopeId:y(),createByName:(null==Be?void 0:Be.firstname)||"System",createdBy:(null==Be?void 0:Be.email)||"system@audacy.com",applicationMappingId:Y},console.log("[StationOnboard] Step 1: Creating rule set with payload:",a),[4,E(a,H)];case 2:if(s=n.sent(),!(l=null===(g=null==s?void 0:s.data)||void 0===g?void 0:g.scopeId))throw new Error("Failed to create scope - no scopeId returned");return ke(1),[3,4];case 3:return u=n.sent(),console.error("[StationOnboard] Error creating rule set:",u),null===(v=je.current)||void 0===v||v.show({severity:"error",life:3e3,summary:"Error",detail:"Failed to create rule set. Please try again."}),Ne(!1),ke(0),[2];case 4:return n.trys.push([4,6,,11]),c={market:J.market,region:J.region,primetime_windows:Ue.primeTime,genre:Ue.genre,station_type:""===Ue.type?null:Ue.type,low_sellout_configurations:"Low Sellout"===Ue.type?Ue.lowSelloutConfig:null,ruleset_id:l,station_guid:J.station_guid,station_name:J.station_name||"New Station"},console.log("[StationOnboard] Step 2: Updating station with payload:",c),[4,M(c)];case 5:return n.sent(),ke(2),[3,11];case 6:d=n.sent(),console.error("[StationOnboard] Error updating station, rolling back rule set:",d),409===d.status?(null===(b=je.current)||void 0===b||b.show({severity:"error",life:2500,summary:"Error updating station",detail:"Station already Onboarded."}),Q(null),Fe(null),Pe(""),qe(function(r){return e(e({},r),{region:""})})):null===(x=je.current)||void 0===x||x.show({severity:"error",life:2500,summary:"Error updating station",detail:"Please try again."}),n.label=7;case 7:return n.trys.push([7,9,,10]),[4,N(l,H)];case 8:return n.sent(),[3,10];case 9:return p=n.sent(),console.error("[StationOnboard] Failed to rollback rule set deletion:",p),[3,10];case 10:return Ne(!1),ke(0),[2];case 11:return n.trys.push([11,13,,14]),f={source_scope_id:Oe,target_scope_id:l,is_copy_parent_variant_id:i},console.log("[StationOnboard] Step 3: Inheriting scope with payload:",f),[4,A(f)];case 12:return n.sent(),ke(3),[3,14];case 13:return m=n.sent(),console.error("[StationOnboard] Error inheriting scope (no rollback):",m),null===(S=je.current)||void 0===S||S.show({severity:"error",life:3e3,summary:"Error",detail:"Failed to apply rule template. Please try again."}),Ne(!1),ke(0),[2];case 14:return Ie.current=l,[2]}})})},disabled:!Ve||Ae,style:{padding:"7px 10px",borderRadius:"6px",border:"none",backgroundColor:Ve?"#2563EB":"#BFDBFE",color:"#fff",cursor:Ve&&!Ae?"pointer":"not-allowed",fontSize:"14px",fontWeight:500,display:"flex",alignItems:"center",gap:"7px"}},{children:o(l,Ae?{children:[i(g,{size:16,color:"inherit"}),i("span",{children:"Onboarding..."})]}:{children:[i("span",{children:"Onboard Station"}),i(x,{size:16})]})}))]}))]}))};export{R as default};
|
|
2
|
+
//# sourceMappingURL=BackwardStationOnboardModal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BackwardStationOnboardModal.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{__assign as e,__spreadArray as i}from"tslib";import{jsxs as r,jsx as n}from"react/jsx-runtime";var o={display:"flex",gap:"8px",flexWrap:"nowrap",padding:"10px 12px",backgroundColor:"#FAFAFA",border:"1px solid #E2E8F0",borderRadius:"8px",marginTop:"4px",minHeight:"54px",alignItems:"center",width:"70%",boxSizing:"border-box"},t={display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:"6px",fontSize:"0.815rem",fontWeight:500,cursor:"pointer",userSelect:"none",transition:"all 0.15s ease-in-out",height:"34px",flex:"1 0 calc((100% - (6 * 8px)) / 7)",minWidth:"0",position:"relative",boxSizing:"border-box"},l=function(l){var a=l.label,d=l.subText,p=l.required,s=l.options,x=l.selectedValues,c=l.onChange;return r("div",e({style:{display:"flex",flexDirection:"column",width:"100%",marginBottom:"4px"}},{children:[r("label",e({style:{fontSize:"0.875rem",fontWeight:500,color:"#19213D",marginBottom:"2px",display:"block"}},{children:[p&&n("span",e({style:{color:"#E53E3E",marginRight:"4px"}},{children:"*"})),a]})),d&&n("p",e({style:{margin:"0 0 6px 0",fontSize:"0.75rem",color:"#666F8D",lineHeight:"1.2"}},{children:d})),n("div",e({style:o},{children:s.map(function(r){var o=x.includes(String(r.value));return n("div",e({onClick:function(){return e=String(r.value),void(x.includes(e)?c(x.filter(function(i){return i!==e})):c(i(i([],x,!0),[e],!1)));var e},style:e(e({},t),{border:o?"1.5px solid #2563EB":"1px solid #E2E8F0",backgroundColor:o?"#EFF6FF":"#FFFFFF",color:o?"#2563EB":"#64748B",boxShadow:o?"0 1px 2px rgba(37, 99, 235, 0.05)":"0 1px 2px rgba(0, 0, 0, 0.02)"})},{children:n("span",{children:r.label})}),r.value)})}))]}))};export{l as default};
|
|
2
|
+
//# sourceMappingURL=DayToggleSelector.js.map
|
package/dist/features/LearningManagement/components/StationOnboarding/DayToggleSelector.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DayToggleSelector.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/features/LearningManagement/components/StationOnboarding/StationOnboardModal.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e,__awaiter as o,__generator as r,__spreadArray as n}from"tslib";import{jsxs as i,jsx as t,Fragment as l}from"react/jsx-runtime";import{useState as a,useRef as s,useMemo as c,useEffect as u}from"react";import{Dialog as d,Box as p,Typography as f,IconButton as m,DialogContent as h,CircularProgress as g}from"@mui/material";import{X as x,Search as v,ArrowRight as b}from"lucide-react";import{Toast as y}from"primereact/toast";import{v4 as S}from"uuid";import{retrieveGenreScopes as C,fetchStationsByKeyword as w,searchScopes as _,inheritScopeBackwardCompatible as F,createRuleSet as k}from"../../apis/scopeApis.js";import E from"./StationAutocomplete.js";import D from"../CardSkeleton.js";import T from"./OnboardingLoader.js";import B from"./TemplateCard.js";import O from"../../styles/StationOnboardModal.module.css.js";import z from"./InputField.js";import A from"../../store/useAuthStore.js";import{useConfigStore as I}from"../../store/useConfigStore.js";import{useLearningTemplateStore as M}from"../../store/useLearningTemplateStore.js";import{IL_CONFIG_CONSTANTS as L}from"../../config.js";import{useAppSecRolesStore as R}from"../../store/useAppSecRolesStore.js";import j from"../../store/useEnvStore.js";import N from"../../RuleContent/AddScopeApprovalSearchComponent.js";var W=[{label:"6am to 7pm",value:"06:00 AM - 7:00 PM"},{label:"5am to 7pm",value:"05:00 AM - 7:00 PM"}],q=[{label:"Low Sellout",value:"Low Sellout"},{label:"High Sellout",value:"High Sellout"},{label:"None",value:""}],P=[{label:"None",value:"None"},{label:"Distribute spots evenly across all breaks in the hour",value:"Distribute spots evenly across all breaks in the hour"}],G=function(G){var U,H=G.isOpen,K=G.onClose,Y=G.onBoardStation,V=G.app_integration_id,X=G.token,J=a(null),Q=J[0],Z=J[1],$=a([]),ee=$[0],oe=$[1],re=a(0),ne=re[0],ie=re[1],te=a(!0),le=te[0],ae=te[1],se=a(!1),ce=se[0],ue=se[1],de=a([]),pe=de[0],fe=de[1],me=a(""),he=me[0],ge=me[1],xe=a(""),ve=xe[0],be=xe[1],ye=a(!1),Se=ye[0],Ce=ye[1],we=a(!1),_e=we[0],Fe=we[1],ke=a(null),Ee=ke[0],De=ke[1],Te=a(null);Te[0],Te[1];var Be=a(!1),Oe=Be[0],ze=Be[1],Ae=a(0),Ie=Ae[0],Me=Ae[1],Le=a(""),Re=Le[0],je=Le[1],Ne=A().user,We=s(null),qe=s(null),Pe=s(null),Ge=s(null);I().configuration;var Ue=s(null),He=R(function(e){return e.roles}),Ke=j(function(e){return e.rbacConfig}),Ye=a("approval_required"),Ve=Ye[0],Xe=Ye[1],Je=a([]),Qe=Je[0],Ze=Je[1],$e=a([]),eo=$e[0],oo=$e[1],ro=a(""),no=ro[0],io=ro[1],to=M(function(e){return e.stationNameParam}),lo=a({region:"",primeTime:["06:00 AM - 7:00 PM"],genre:"Music",type:"",lowSelloutConfig:""}),ao=lo[0],so=lo[1],co=function(e,o){return e.find(function(e){return e.value===o})||null},uo=c(function(){return ee.map(function(e){return{label:e.scope_name,value:e.scope_name}})},[ee]),po=c(function(){var e,o,r;if(!ao.genre)return null;var n=ee.find(function(e){return e.scope_name===ao.genre});return n?{id:n.id,title:n.scope_name||"Unnamed Template",description:(null===(e=n.description)||void 0===e?void 0:e.trim())||"No description available.",inheritedText:(null===(o=n.inheritance)||void 0===o?void 0:o[0])||void 0,rulesCount:n.rules_count||0,tiersCount:n.tier_count||0,isCopy:null!==(r=n.is_copy)&&void 0!==r&&r}:null},[ao.genre,ee]);u(function(){return function(){Pe.current&&clearTimeout(Pe.current)}},[]);var fo=function(e){return o(void 0,void 0,void 0,function(){var o,i,t;return r(this,function(r){switch(r.label){case 0:if(ce)return[2];ue(!0),r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,C({limit:"20",offset:String(e)})];case 2:return"success"===(null==(o=r.sent())?void 0:o.status)&&Array.isArray(null==o?void 0:o.data)?(i=o.data,oe(function(o){if(0===e)return i;var r=new Set(o.map(function(e){return e.id})),t=i.filter(function(e){return!r.has(e.id)});return n(n([],o,!0),t,!0)}),i.length<20?ae(!1):ae(!0),ie(e+20)):ae(!1),[3,5];case 3:return t=r.sent(),console.error("[StationOnboard] Failed to fetch genre scopes:",t),ae(!1),[3,5];case 4:return ue(!1),[7];case 5:return[2]}})})};u(function(){if(H&&(oe([]),ie(0),ae(!0),fo(0),to)){je(to);o(void 0,void 0,void 0,function(){var e,o,n;return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,w(to,!0)];case 1:return!0===(null==(e=r.sent())?void 0:e.success)&&Array.isArray(null==e?void 0:e.data)&&(o=e.data.find(function(e){var o;return(null===(o=e.station_name)||void 0===o?void 0:o.toLowerCase())===to.toLowerCase()&&!e.ruleset_id}),o&&Z(o)),[3,3];case 2:return n=r.sent(),console.error("[StationOnboard] Error auto-selecting station:",n),[3,3];case 3:return[2]}})})}},[H,to]);u(function(){so(Q?function(o){var r;return e(e({},o),{region:null!==(r=Q.market)&&void 0!==r?r:""})}:{region:"",primeTime:["06:00 AM - 7:00 PM"],genre:"Music",type:"",lowSelloutConfig:""})},[Q]),u(function(){var e=setTimeout(function(){be(he)},500);return function(){return clearTimeout(e)}},[he]),u(function(){o(void 0,void 0,void 0,function(){var e,o,n,i;return r(this,function(r){switch(r.label){case 0:if(!ve.trim())return fe([]),[2];Ce(!0),r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,_({search_string:ve.trim()})];case 2:return"success"===(null==(e=r.sent())?void 0:e.status)&&Array.isArray(null==e?void 0:e.data)?(o=e.data.filter(function(e){var o,r=null!==(o=e.inheritance)&&void 0!==o?o:[],n=r.indexOf(e.scope_name);return!(n<=0)&&r[n-1]===ao.genre}),n=o.map(function(e){var o,r,n;return{id:e.id,title:e.scope_name||"Unnamed Template",description:(null===(o=e.description)||void 0===o?void 0:o.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!==(n=e.is_copy)&&void 0!==n&&n}}),fe(n)):fe([]),[3,5];case 3:return i=r.sent(),console.error("[StationOnboard] Error searching scopes:",i),fe([]),[3,5];case 4:return Ce(!1),[7];case 5:return[2]}})})},[ve,ao.genre]),u(function(){!ve.trim()&&po&&De(po.id)},[ve,po]);var mo=function(){setTimeout(function(){Ge.current&&Ge.current.scrollTo({top:Ge.current.scrollHeight,behavior:"smooth"})},100)},ho=function(){je(""),Z(null),so({region:"",primeTime:["06:00 AM - 7:00 PM"],genre:"Music",type:"",lowSelloutConfig:""}),fe([]),ge(""),De(null),Xe("approval_required"),Ze([]),oo([]),io(""),K()},go=function(o,r){var n;if("primeTime"!==o){var i=null!==(n=null==r?void 0:r.value)&&void 0!==n?n:"";so(function(r){var n;return e(e({},r),((n={})[o]=String(i),n))}),"genre"===o&&(Fe(!0),Pe.current&&clearTimeout(Pe.current),Pe.current=setTimeout(function(){var e=ee.find(function(e){return e.scope_name===i});De(e?e.id:null),Fe(!1)},800))}else{var t=(null==r?void 0:r.value)?String(r.value):"";so(function(o){return e(e({},o),{primeTime:t?[t]:[]})})}},xo=Boolean(Q&&ao.region&&ao.primeTime.length>0&&ao.genre);return i(d,e({open:H,onClose:ho,maxWidth:!1,disableEscapeKeyDown:!0,PaperProps:{sx:{width:"90vw",height:"90vh",borderRadius:"12px",display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"sans-serif"}}},{children:[t(y,{ref:We}),i(p,e({sx:{p:"20px 20px 20px 27px",borderBottom:"1px solid #F0F2F5",display:"flex",justifyContent:"space-between",alignItems:"center",bgcolor:"#fff"}},{children:[i(p,e({sx:{display:"flex",flexDirection:"column",gap:.5}},{children:[t(f,e({sx:{fontSize:"18px",fontWeight:600,color:"#19213D"}},{children:"Onboard a Station"})),t(f,e({sx:{fontSize:"16px",fontWeight:400,color:"#666F8D"}},{children:"Onboard a station to start configuring learnings."}))]})),t(m,e({onClick:ho,disabled:Oe,sx:{color:"#19213D"}},{children:t(x,{size:24})}))]})),i(h,e({sx:{p:0,bgcolor:"#F8FAFC",display:"flex",flexDirection:"row",overflow:"hidden",position:"relative"}},{children:[t(T,{isLoading:Oe,currentStep:Ie,onComplete:function(){ze(!1);var e=qe.current;ho(),Y(e||void 0),qe.current=null}}),t(p,e({sx:{display:"flex",flex:1,flexDirection:"column",paddingY:"14px",paddingX:"20px",gap:2,overflowY:"auto"}},{children:i(p,e({sx:{display:"flex",gap:3}},{children:[i(p,e({ref:Ge,sx:{flex:1,bgcolor:"#fff",p:3,borderRadius:"16px",border:"1px solid #F0F2F5"}},{children:[t(f,e({sx:{fontSize:"1rem",fontWeight:600,mb:.5,color:"#19213D"}},{children:"Basic Details"})),t(f,e({sx:{fontSize:"0.75rem",color:"#00000080",mb:"20px"}},{children:"Set up basic station details to unlock AI recommended scopes."})),i(p,e({sx:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[i(p,e({className:O.formGroup},{children:[i("label",e({className:O.label},{children:[t("span",e({className:O.asterisk},{children:"*"})),"Station Name/Call Letters"]})),t(E,{value:Re,onChange:je,onStationSelect:function(e){return Z(e)}})]})),t(z,{required:!0,disabled:!0,label:"Region",placeholder:"Select Region",value:ao.region||void 0,isSearchable:!1}),t(z,{required:!0,label:"Prime Time Window",placeholder:"Select Prime Time",options:W,value:co(W,(null===(U=ao.primeTime)||void 0===U?void 0:U[0])||""),onOptionChange:function(e){return go("primeTime",e)},isSearchable:!1}),t(p,e({onClick:mo,sx:{width:"100%"}},{children:t(z,{label:"Station Sellout Type",placeholder:"None",options:q,value:co(q,ao.type),onOptionChange:function(o){go("type",o),"Low Sellout"!==(null==o?void 0:o.value)&&so(function(o){return e(e({},o),{lowSelloutConfig:""})})},isSearchable:!1})})),"Low Sellout"===ao.type&&t(p,e({onClick:mo,sx:{width:"100%"}},{children:t(z,{label:"Low Sell Out Configurations",placeholder:"Select Configuration",options:P,value:co(P,ao.lowSelloutConfig),onOptionChange:function(e){return go("lowSelloutConfig",e)},isSearchable:!1})})),M.getState().backwardCompatibility&&i("div",e({ref:Ue,style:{display:"flex",flexDirection:"column",marginTop:"12px"}},{children:[t(f,e({sx:{fontSize:"1rem",fontWeight:600,mb:.5,color:"#19213D"}},{children:"Approval Settings"})),t(f,e({sx:{fontSize:"0.75rem",color:"#00000080",mb:"20px"}},{children:"Configure who can approve learnings before they get published."})),i("div",e({style:{marginBottom:"12px",fontSize:"12px",color:"#8F2C23",gap:"16px"}},{children:[i("div",e({style:{marginBottom:"12px",fontSize:"12px",color:"#8F2C23",gap:"12px"}},{children:[i("div",e({role:"radio","aria-checked":"approval_required"===Ve,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:"4px",marginBottom:"8px"},onClick:function(){return Xe("approval_required")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||Xe("approval_required")}},{children:[i("div",e({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[t("div",e({style:{display:"flex",height:"16px",width:"16px",flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("approval_required"===Ve?"#2563EB":"#CBD5E1")}},{children:"approval_required"===Ve&&t("div",{style:{height:"8px",width:"8px",borderRadius:"50%",backgroundColor:"#2563EB"}})})),t("span",e({style:{fontSize:"14px",fontWeight:500,color:"#19213D"}},{children:"Approval Required Before Publishing"}))]})),t("p",e({style:{margin:0,marginLeft:"24px",fontSize:"12px",color:"#666F8D"}},{children:"Learnings require approval before publishing."}))]})),i("div",e({style:{gap:"16px"}},{children:["approval_required"===Ve&&t(N,{selectedApprovers:Qe,selectedGroupOfApprovers:eo,onApproversChange:function(e){Ze(e),io("")},onGroupsChange:function(e){oo(e),io("")}}),no&&t("p",e({style:{margin:0,marginLeft:"24px",fontSize:"12px",color:"#8F2C23"}},{children:no}))]}))]})),i("div",e({role:"radio","aria-checked":"publish_without"===Ve,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:"4px"},onClick:function(){Xe("publish_without"),io("")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||(Xe("publish_without"),io(""))}},{children:[i("div",e({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[t("div",e({style:{display:"flex",height:"16px",width:"16px",flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("publish_without"===Ve?"#2563EB":"#CBD5E1")}},{children:"publish_without"===Ve&&t("div",{style:{height:"8px",width:"8px",borderRadius:"50%",backgroundColor:"#2563EB"}})})),t("span",e({style:{fontSize:"14px",fontWeight:500,color:"#19213D"}},{children:"Publish Without Approval"}))]})),t("p",e({style:{margin:0,marginLeft:"24px",fontSize:"12px",color:"#666F8D"}},{children:"Learnings can be published directly."}))]}))]}))]}))]}))]})),i(p,e({sx:{flex:1,bgcolor:"#fff",p:3,borderRadius:"12px",border:"1px solid #F0F2F5",display:"flex",flexDirection:"column"}},{children:[i(f,e({sx:{fontSize:"1rem",fontWeight:600,mb:.5,color:"#19213D"}},{children:[t("span",e({style:{color:"#E53E3E",marginRight:"2px"}},{children:"*"})),"Select a scope for your station"]})),t(f,e({sx:{fontSize:"0.75rem",color:"#64748B",mb:"16px"}},{children:"Your station will inherit the rules from the selected scope."})),t(p,e({sx:{mb:2}},{children:t(z,{required:!0,label:"",placeholder:"Select Genre",options:uo,value:co(uo,ao.genre),onOptionChange:function(e){return go("genre",e)},isSearchable:!1,onMenuScrollToBottom:function(){!ce&&le&&fo(ne)},isLoadingOptions:ce,hasMoreOptions:le})})),t(p,e({sx:{mb:3}},{children:_e?t(D,{}):po?i(p,e({sx:{border:"1.5px solid #2563EB",borderRadius:"10px",p:"14px 16px",bgcolor:"#EFF6FF",display:"flex",alignItems:"flex-start",gap:"12px"}},{children:[t(p,e({sx:{width:36,height:36,borderRadius:"8px",bgcolor:"#DBEAFE",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0}},{children:i("svg",e({width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"#2563EB",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:[t("circle",{cx:"12",cy:"12",r:"2"}),t("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"})]}))})),i(p,e({sx:{flex:1,minWidth:0}},{children:[t(f,e({sx:{fontSize:"0.875rem",fontWeight:600,color:"#1E3A5F",mb:"2px"}},{children:po.title})),t(f,e({sx:{fontSize:"0.75rem",color:"#2563EB",mb:"8px"}},{children:po.description})),i(p,e({sx:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"}},{children:[po.inheritedText&&i(p,e({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:[i("svg",e({width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:[t("polyline",{points:"15 3 21 3 21 9"}),t("path",{d:"M21 3L9 15"}),t("path",{d:"M3 21l6-6"})]})),po.inheritedText]})),i(p,e({component:"span",sx:{fontSize:"0.7rem",color:"#475569",bgcolor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"4px",px:"6px",py:"2px"}},{children:[po.rulesCount," rules"]})),i(p,e({component:"span",sx:{fontSize:"0.7rem",color:"#475569",bgcolor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"4px",px:"6px",py:"2px"}},{children:[po.tiersCount," Tiers"]}))]}))]}))]})):ao.genre?null:t(p,e({sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",opacity:.4,py:6,gap:1}},{children:t(f,e({sx:{fontSize:"0.75rem",color:"#94A3B8"}},{children:"Select a genre to load the matching scope"}))}))})),ao.genre&&i(l,{children:[i(f,e({sx:{fontSize:"1rem",fontWeight:600,mb:.5,color:"#19213D"}},{children:["Select an Existing Station from the “",ao.genre,"” Scope"," ",t(f,e({component:"span",sx:{fontSize:"1rem",fontWeight:400,color:"#64748B"}},{children:"(Optional)"}))]})),i(f,e({sx:{fontSize:"0.75rem",color:"#64748B",mb:"12px"}},{children:["Please select an existing station under the “",ao.genre,"” category to copy its learnings."]})),i("div",e({className:O.searchWrapper,style:{marginBottom:"12px"}},{children:[t("input",{type:"text",value:he,onChange:function(e){return ge(e.target.value)},placeholder:"Search for station...",className:O.searchInput}),t(v,{className:O.searchIcon,size:16})]})),i(p,e({sx:{display:"flex",flexDirection:"column",gap:2}},{children:[Se&&t(D,{}),!Se&&0===pe.length&&ve.trim()&&i(f,e({sx:{fontSize:"0.875rem",color:"#64748B",textAlign:"center",py:4}},{children:['No scopes found matching "',ve,'".']})),!Se&&pe.map(function(o){return t(B,e({},o,{isSelected:Ee===o.id,onSelect:function(e){var o;De(Ee===e?null!==(o=null==po?void 0:po.id)&&void 0!==o?o:null:e)}}),o.id)})]}))]})]}))]}))}))]})),i(p,e({sx:{p:"12px 20px",borderTop:"1px solid #F0F2F5",display:"flex",justifyContent:"flex-end",gap:2,bgcolor:"#fff"}},{children:[t("button",e({onClick:ho,disabled:Oe,style:{padding:"7px 10px",borderRadius:"6px",color:"#64748B",border:"1px solid #E2E8F0",backgroundColor:"#fff",cursor:"pointer",fontSize:"14px",fontWeight:500}},{children:"Cancel"})),t("button",e({onClick:function(){return o(void 0,void 0,void 0,function(){var e,o,i,t,l,a,s,c,u,d,p,f,m,h,g,x,v,b,y;return r(this,function(r){switch(r.label){case 0:if(!Q||!Ee)return console.error("[StationOnboard] Missing required data for onboarding"),[2];if(M.getState().backwardCompatibility&&"approval_required"===Ve&&0===Qe.length&&0===eo.length)return io("Please select at least one approver or approver group."),setTimeout(function(){var e;null===(e=Ue.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"center"})},50),[2];io(""),e=po?n([po],pe,!0):pe,o=e.find(function(e){return e.id===Ee}),null==o?void 0:o.isCopy,ze(!0),Me(0),i=null,r.label=1;case 1:return r.trys.push([1,3,,4]),t=M.getState().backwardCompatibility,l=t?{topic:"customRuleSet",customScopeGroupName:L.CUSTOM_SCOPE_GROUP_NAME,scopeDescription:Q.station_name||"New Station",parentScopeId:null!==(p=null==po?void 0:po.id)&&void 0!==p?p:null,customScopeName:Q.station_name||"New Station",customScopeId:S(),createByName:(null==Ne?void 0:Ne.firstname)||"System",createdBy:(null==Ne?void 0:Ne.email)||"system@audacy.com",scopeType:"Station",approvalRequired:"approval_required"===Ve,audacyStationMetadata:{genre:ao.genre,low_sellout_configurations:"Low Sellout"===ao.type?ao.lowSelloutConfig:null,market:Q.market,primetime_windows:ao.primeTime,region:Q.region,station_guid:Q.station_guid,station_type:""===ao.type?null:ao.type},appsecData:{application:null==Ke?void 0:Ke.applicationId,module:null==Ke?void 0:Ke.moduleId,roles:n(n([],"approval_required"===Ve?[{users:Qe.map(function(e){return e.email}),groups:eo.map(function(e){return e._id}),role:null!==(m=null===(f=He.find(function(e){return"Learning Manager"===e.name}))||void 0===f?void 0:f._id)&&void 0!==m?m:""}]:[],!0),[{users:[null==Ne?void 0:Ne.email],groups:[],role:null!==(g=null===(h=He.find(function(e){return"Instant Learning Admin"===e.name}))||void 0===h?void 0:h._id)&&void 0!==g?g:""}],!1)}}:{topic:"customRuleSet",scope_reference_id:null,scopeDescription:"demo",parentScopeId:null,scopeName:Q.station_name||"New Station",scopeReferenceMetadata:{},applicationMappingId:V},console.log("[StationOnboard] Step 1: Creating rule set with payload:",l),[4,k(l,X)];case 2:if(a=r.sent(),!(i=null===(x=null==a?void 0:a.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:",i),Me(1),[3,4];case 3:return s=r.sent(),console.error("[StationOnboard] Error creating rule set:",s),null===(v=We.current)||void 0===v||v.show({severity:"error",life:3e3,summary:"Error",detail:"Failed to create rule set. Please try again."}),ze(!1),Me(0),[2];case 4:return r.trys.push([4,6,,7]),c=null!==Ee&&Ee!==(null==po?void 0:po.id),u={source_scope_id:c?Ee:null!==(b=null==po?void 0:po.id)&&void 0!==b?b:Ee,target_scope_id:i,is_copy_parent_variant_id:c},console.log("[StationOnboard] Step 3: Inheriting scope with payload:",u),[4,F(u)];case 5:return r.sent(),console.log("[StationOnboard] Step 3 Complete: Scope inherited"),Me(3),[3,7];case 6:return d=r.sent(),console.error("[StationOnboard] Error inheriting scope (no rollback):",d),null===(y=We.current)||void 0===y||y.show({severity:"error",life:3e3,summary:"Error",detail:"Failed to apply rule template. Please try again."}),ze(!1),Me(0),[2];case 7:return qe.current=i,console.log("[StationOnboard] Onboarding completed successfully!"),[2]}})})},disabled:!xo||Oe,style:{padding:"7px 10px",borderRadius:"6px",border:"none",backgroundColor:xo?"#2563EB":"#BFDBFE",color:"#fff",cursor:xo&&!Oe?"pointer":"not-allowed",fontSize:"14px",fontWeight:500,display:"flex",alignItems:"center",gap:"7px"}},{children:i(l,Oe?{children:[t(g,{size:16,color:"inherit"}),t("span",{children:"Onboarding..."})]}:{children:[t("span",{children:"Onboard Station"}),t(b,{size:16})]})}))]}))]}))};export{G as default};
|
|
1
|
+
import{__assign as e,__awaiter as r,__generator as o,__spreadArray as n}from"tslib";import{jsxs as t,jsx as i,Fragment as l}from"react/jsx-runtime";import{useState as a,useRef as s,useMemo as c,useEffect as d}from"react";import{Dialog as u,Box as p,Typography as f,IconButton as m,DialogContent as h,CircularProgress as g}from"@mui/material";import{X as x,Search as v,ArrowRight as y}from"lucide-react";import{Toast as b}from"primereact/toast";import{v4 as S}from"uuid";import{retrieveGenreScopes as w,fetchStationsByKeyword as C,searchScopes as _,inheritScopeBackwardCompatible as F,createRuleSet as k}from"../../apis/scopeApis.js";import D from"./StationAutocomplete.js";import E from"../CardSkeleton.js";import T from"./OnboardingLoader.js";import B from"./TemplateCard.js";import z from"../../styles/StationOnboardModal.module.css.js";import O from"./InputField.js";import A from"../../store/useAuthStore.js";import{useConfigStore as I}from"../../store/useConfigStore.js";import{useLearningTemplateStore as M}from"../../store/useLearningTemplateStore.js";import{IL_CONFIG_CONSTANTS as L}from"../../config.js";import{useAppSecRolesStore as R}from"../../store/useAppSecRolesStore.js";import j from"../../store/useEnvStore.js";import N from"../../RuleContent/AddScopeApprovalSearchComponent.js";import W from"./DayToggleSelector.js";var q=[{label:"6am to 7pm",value:"06:00 AM - 7:00 PM"},{label:"5am to 7pm",value:"05:00 AM - 7:00 PM"}],P=[{label:"Low Sellout",value:"Low Sellout"},{label:"High Sellout",value:"High Sellout"},{label:"None",value:""}],G=[{label:"None",value:"None"},{label:"Distribute spots evenly across all breaks in the hour",value:"Distribute spots evenly across all breaks in the hour"}],U=[{label:"Mon",value:"monday"},{label:"Tue",value:"tuesday"},{label:"Wed",value:"wednesday"},{label:"Thu",value:"thursday"},{label:"Fri",value:"friday"},{label:"Sat",value:"saturday"},{label:"Sun",value:"sunday"}],H=function(H){var K,V=H.isOpen,Y=H.onClose,X=H.onBoardStation,J=H.app_integration_id,Q=H.token,Z=a(null),$=Z[0],ee=Z[1],re=a([]),oe=re[0],ne=re[1],te=a(0),ie=te[0],le=te[1],ae=a(!0),se=ae[0],ce=ae[1],de=a(!1),ue=de[0],pe=de[1],fe=a([]),me=fe[0],he=fe[1],ge=a(""),xe=ge[0],ve=ge[1],ye=a(""),be=ye[0],Se=ye[1],we=a(!1),Ce=we[0],_e=we[1],Fe=a(!1),ke=Fe[0],De=Fe[1],Ee=a(null),Te=Ee[0],Be=Ee[1],ze=a(null);ze[0],ze[1];var Oe=a(!1),Ae=Oe[0],Ie=Oe[1],Me=a(0),Le=Me[0],Re=Me[1],je=a(""),Ne=je[0],We=je[1],qe=A().user,Pe=s(null),Ge=s(null),Ue=s(null),He=s(null);I().configuration;var Ke=s(null),Ve=R(function(e){return e.roles}),Ye=j(function(e){return e.rbacConfig}),Xe=a("approval_required"),Je=Xe[0],Qe=Xe[1],Ze=a([]),$e=Ze[0],er=Ze[1],rr=a([]),or=rr[0],nr=rr[1],tr=a(""),ir=tr[0],lr=tr[1],ar=M(function(e){return e.stationNameParam}),sr=a({region:"",primeTime:["06:00 AM - 7:00 PM"],genre:"Music",type:"",lowSelloutConfig:"",source_days:["wednesday","thursday","friday","saturday"],target_days:["monday","tuesday","wednesday"]}),cr=sr[0],dr=sr[1],ur=function(e,r){return e.find(function(e){return e.value===r})||null},pr=c(function(){return oe.map(function(e){return{label:e.scope_name,value:e.scope_name}})},[oe]),fr=c(function(){var e,r,o;if(!cr.genre)return null;var n=oe.find(function(e){return e.scope_name===cr.genre});return n?{id:n.id,title:n.scope_name||"Unnamed Template",description:(null===(e=n.description)||void 0===e?void 0:e.trim())||"No description available.",inheritedText:(null===(r=n.inheritance)||void 0===r?void 0:r[0])||void 0,rulesCount:n.rules_count||0,tiersCount:n.tier_count||0,isCopy:null!==(o=n.is_copy)&&void 0!==o&&o}:null},[cr.genre,oe]);d(function(){return function(){Ue.current&&clearTimeout(Ue.current)}},[]);var mr=function(e){return r(void 0,void 0,void 0,function(){var r,t,i;return o(this,function(o){switch(o.label){case 0:if(ue)return[2];pe(!0),o.label=1;case 1:return o.trys.push([1,3,4,5]),[4,w({limit:"20",offset:String(e)})];case 2:return"success"===(null==(r=o.sent())?void 0:r.status)&&Array.isArray(null==r?void 0:r.data)?(t=r.data,ne(function(r){if(0===e)return t;var o=new Set(r.map(function(e){return e.id})),i=t.filter(function(e){return!o.has(e.id)});return n(n([],r,!0),i,!0)}),t.length<20?ce(!1):ce(!0),le(e+20)):ce(!1),[3,5];case 3:return i=o.sent(),console.error("[StationOnboard] Failed to fetch genre scopes:",i),ce(!1),[3,5];case 4:return pe(!1),[7];case 5:return[2]}})})};d(function(){if(V&&(ne([]),le(0),ce(!0),mr(0),ar)){We(ar);r(void 0,void 0,void 0,function(){var e,r,n;return o(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,C(ar,!0)];case 1:return!0===(null==(e=o.sent())?void 0:e.success)&&Array.isArray(null==e?void 0:e.data)&&(r=e.data.find(function(e){var r;return(null===(r=e.station_name)||void 0===r?void 0:r.toLowerCase())===ar.toLowerCase()&&!e.ruleset_id}),r&&ee(r)),[3,3];case 2:return n=o.sent(),console.error("[StationOnboard] Error auto-selecting station:",n),[3,3];case 3:return[2]}})})}},[V,ar]);d(function(){dr($?function(r){var o;return e(e({},r),{region:null!==(o=$.market)&&void 0!==o?o:""})}:{region:"",primeTime:["06:00 AM - 7:00 PM"],genre:"Music",type:"",lowSelloutConfig:"",source_days:["wednesday","thursday","friday","saturday"],target_days:["monday","tuesday","wednesday"]})},[$]),d(function(){var e=setTimeout(function(){Se(xe)},500);return function(){return clearTimeout(e)}},[xe]),d(function(){r(void 0,void 0,void 0,function(){var e,r,n,t;return o(this,function(o){switch(o.label){case 0:if(!be.trim())return he([]),[2];_e(!0),o.label=1;case 1:return o.trys.push([1,3,4,5]),[4,_({search_string:be.trim()})];case 2:return"success"===(null==(e=o.sent())?void 0:e.status)&&Array.isArray(null==e?void 0:e.data)?(r=e.data.filter(function(e){var r,o=null!==(r=e.inheritance)&&void 0!==r?r:[],n=o.indexOf(e.scope_name);return!(n<=0)&&o[n-1]===cr.genre}),n=r.map(function(e){var r,o,n;return{id:e.id,title:e.scope_name||"Unnamed Template",description:(null===(r=e.description)||void 0===r?void 0:r.trim())||"No description available.",inheritedText:(null===(o=e.inheritance)||void 0===o?void 0:o[0])||void 0,rulesCount:e.rules_count||0,tiersCount:e.tier_count||0,isCopy:null!==(n=e.is_copy)&&void 0!==n&&n}}),he(n)):he([]),[3,5];case 3:return t=o.sent(),console.error("[StationOnboard] Error searching scopes:",t),he([]),[3,5];case 4:return _e(!1),[7];case 5:return[2]}})})},[be,cr.genre]),d(function(){!be.trim()&&fr&&Be(fr.id)},[be,fr]);var hr=function(){setTimeout(function(){He.current&&He.current.scrollTo({top:He.current.scrollHeight,behavior:"smooth"})},100)},gr=function(){We(""),ee(null),dr({region:"",primeTime:["06:00 AM - 7:00 PM"],genre:"Music",type:"",lowSelloutConfig:"",source_days:["wednesday","thursday","friday","saturday"],target_days:["monday","tuesday","wednesday"]}),he([]),ve(""),Be(null),Qe("approval_required"),er([]),nr([]),lr(""),Y()},xr=function(r,o){var n;if("primeTime"!==r)if("source_days"!==r&&"target_days"!==r){var t=null!==(n=null==o?void 0:o.value)&&void 0!==n?n:"";dr(function(o){var n;return e(e({},o),((n={})[r]=String(t),n))}),"genre"===r&&(De(!0),Ue.current&&clearTimeout(Ue.current),Ue.current=setTimeout(function(){var e=oe.find(function(e){return e.scope_name===t});Be(e?e.id:null),De(!1)},800))}else dr(function(n){var t;return e(e({},n),((t={})[r]=o,t))});else{var i=(null==o?void 0:o.value)?String(o.value):"";dr(function(r){return e(e({},r),{primeTime:i?[i]:[]})})}},vr=Boolean($&&cr.region&&cr.primeTime.length>0&&cr.genre);return t(u,e({open:V,onClose:gr,maxWidth:!1,disableEscapeKeyDown:!0,PaperProps:{sx:{width:"90vw",height:"90vh",borderRadius:"12px",display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"sans-serif"}}},{children:[i(b,{ref:Pe}),t(p,e({sx:{p:"20px 20px 20px 27px",borderBottom:"1px solid #F0F2F5",display:"flex",justifyContent:"space-between",alignItems:"center",bgcolor:"#fff"}},{children:[t(p,e({sx:{display:"flex",flexDirection:"column",gap:.5}},{children:[i(f,e({sx:{fontSize:"18px",fontWeight:600,color:"#19213D"}},{children:"Onboard a Station"})),i(f,e({sx:{fontSize:"16px",fontWeight:400,color:"#666F8D"}},{children:"Onboard a station to start configuring learnings."}))]})),i(m,e({onClick:gr,disabled:Ae,sx:{color:"#19213D"}},{children:i(x,{size:24})}))]})),t(h,e({sx:{p:0,bgcolor:"#F8FAFC",display:"flex",flexDirection:"row",overflow:"hidden",position:"relative"}},{children:[i(T,{isLoading:Ae,currentStep:Le,onComplete:function(){Ie(!1);var e=Ge.current;gr(),X(e||void 0),Ge.current=null}}),i(p,e({sx:{display:"flex",flex:1,flexDirection:"column",paddingY:"14px",paddingX:"20px",gap:2,overflowY:"auto"}},{children:t(p,e({sx:{display:"flex",gap:3}},{children:[t(p,e({ref:He,sx:{flex:1,bgcolor:"#fff",p:3,borderRadius:"16px",border:"1px solid #F0F2F5"}},{children:[i(f,e({sx:{fontSize:"1rem",fontWeight:600,mb:.5,color:"#19213D"}},{children:"Basic Details"})),i(f,e({sx:{fontSize:"0.75rem",color:"#00000080",mb:"20px"}},{children:"Set up basic station details to unlock AI recommended scopes."})),t(p,e({sx:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[t(p,e({className:z.formGroup},{children:[t("label",e({className:z.label},{children:[i("span",e({className:z.asterisk},{children:"*"})),"Station Name/Call Letters"]})),i(D,{value:Ne,onChange:We,onStationSelect:function(e){return ee(e)}})]})),i(O,{required:!0,disabled:!0,label:"Region",placeholder:"Select Region",value:cr.region||void 0,isSearchable:!1}),i(O,{required:!0,label:"Prime Time Window",placeholder:"Select Prime Time",options:q,value:ur(q,(null===(K=cr.primeTime)||void 0===K?void 0:K[0])||""),onOptionChange:function(e){return xr("primeTime",e)},isSearchable:!1}),i(p,e({onClick:hr,sx:{width:"100%"}},{children:i(O,{label:"Station Sellout Type",placeholder:"None",options:P,value:ur(P,cr.type),onOptionChange:function(r){xr("type",r),"Low Sellout"!==(null==r?void 0:r.value)&&dr(function(r){return e(e({},r),{lowSelloutConfig:""})})},isSearchable:!1})})),"Low Sellout"===cr.type&&i(p,e({onClick:hr,sx:{width:"100%"}},{children:i(O,{label:"Low Sell Out Configurations",placeholder:"Select Configuration",options:G,value:ur(G,cr.lowSelloutConfig),onOptionChange:function(e){return xr("lowSelloutConfig",e)},isSearchable:!1})})),t(p,e({onClick:hr,sx:{width:"100%",display:"flex",flexDirection:"column",gap:"20px"}},{children:[i(f,e({sx:{fontSize:"1rem",fontWeight:600,color:"#19213D"}},{children:"Front-Loading Configuration"})),i(W,{label:"Source Days",subText:"Days from which spots can be front loaded.",options:U,selectedValues:cr.source_days,onChange:function(e){return xr("source_days",e)}}),i(W,{label:"Target Days",subText:"Days where front loaded spots can be placed.",options:U,selectedValues:cr.target_days,onChange:function(e){return xr("target_days",e)}})]})),M.getState().backwardCompatibility&&t("div",e({ref:Ke,style:{display:"flex",flexDirection:"column",marginTop:"12px"}},{children:[i(f,e({sx:{fontSize:"1rem",fontWeight:600,mb:.5,color:"#19213D"}},{children:"Approval Settings"})),i(f,e({sx:{fontSize:"0.75rem",color:"#00000080",mb:"20px"}},{children:"Configure who can approve learnings before they get published."})),t("div",e({style:{marginBottom:"12px",fontSize:"12px",color:"#8F2C23",gap:"16px"}},{children:[t("div",e({style:{marginBottom:"12px",fontSize:"12px",color:"#8F2C23",gap:"12px"}},{children:[t("div",e({role:"radio","aria-checked":"approval_required"===Je,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:"4px",marginBottom:"8px"},onClick:function(){return Qe("approval_required")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||Qe("approval_required")}},{children:[t("div",e({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[i("div",e({style:{display:"flex",height:"16px",width:"16px",flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("approval_required"===Je?"#2563EB":"#CBD5E1")}},{children:"approval_required"===Je&&i("div",{style:{height:"8px",width:"8px",borderRadius:"50%",backgroundColor:"#2563EB"}})})),i("span",e({style:{fontSize:"14px",fontWeight:500,color:"#19213D"}},{children:"Approval Required Before Publishing"}))]})),i("p",e({style:{margin:0,marginLeft:"24px",fontSize:"12px",color:"#666F8D"}},{children:"Learnings require approval before publishing."}))]})),t("div",e({style:{gap:"16px"}},{children:["approval_required"===Je&&i(N,{selectedApprovers:$e,selectedGroupOfApprovers:or,onApproversChange:function(e){er(e),lr("")},onGroupsChange:function(e){nr(e),lr("")}}),ir&&i("p",e({style:{margin:0,marginLeft:"24px",fontSize:"12px",color:"#8F2C23"}},{children:ir}))]}))]})),t("div",e({role:"radio","aria-checked":"publish_without"===Je,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:"4px"},onClick:function(){Qe("publish_without"),lr("")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||(Qe("publish_without"),lr(""))}},{children:[t("div",e({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[i("div",e({style:{display:"flex",height:"16px",width:"16px",flexShrink:0,alignItems:"center",justifyContent:"center",borderRadius:"50%",border:"2px solid ".concat("publish_without"===Je?"#2563EB":"#CBD5E1")}},{children:"publish_without"===Je&&i("div",{style:{height:"8px",width:"8px",borderRadius:"50%",backgroundColor:"#2563EB"}})})),i("span",e({style:{fontSize:"14px",fontWeight:500,color:"#19213D"}},{children:"Publish Without Approval"}))]})),i("p",e({style:{margin:0,marginLeft:"24px",fontSize:"12px",color:"#666F8D"}},{children:"Learnings can be published directly."}))]}))]}))]}))]}))]})),t(p,e({sx:{flex:1,bgcolor:"#fff",p:3,borderRadius:"12px",border:"1px solid #F0F2F5",display:"flex",flexDirection:"column"}},{children:[t(f,e({sx:{fontSize:"1rem",fontWeight:600,mb:.5,color:"#19213D"}},{children:[i("span",e({style:{color:"#E53E3E",marginRight:"2px"}},{children:"*"})),"Select a scope for your station"]})),i(f,e({sx:{fontSize:"0.75rem",color:"#64748B",mb:"16px"}},{children:"Your station will inherit the rules from the selected scope."})),i(p,e({sx:{mb:2}},{children:i(O,{required:!0,label:"",placeholder:"Select Genre",options:pr,value:ur(pr,cr.genre),onOptionChange:function(e){return xr("genre",e)},isSearchable:!1,onMenuScrollToBottom:function(){!ue&&se&&mr(ie)},isLoadingOptions:ue,hasMoreOptions:se})})),i(p,e({sx:{mb:3}},{children:ke?i(E,{}):fr?t(p,e({sx:{border:"1.5px solid #2563EB",borderRadius:"10px",p:"14px 16px",bgcolor:"#EFF6FF",display:"flex",alignItems:"flex-start",gap:"12px"}},{children:[i(p,e({sx:{width:36,height:36,borderRadius:"8px",bgcolor:"#DBEAFE",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0}},{children:t("svg",e({width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"#2563EB",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:[i("circle",{cx:"12",cy:"12",r:"2"}),i("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"})]}))})),t(p,e({sx:{flex:1,minWidth:0}},{children:[i(f,e({sx:{fontSize:"0.875rem",fontWeight:600,color:"#1E3A5F",mb:"2px"}},{children:fr.title})),i(f,e({sx:{fontSize:"0.75rem",color:"#2563EB",mb:"8px"}},{children:fr.description})),t(p,e({sx:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"}},{children:[fr.inheritedText&&t(p,e({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:[t("svg",e({width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:[i("polyline",{points:"15 3 21 3 21 9"}),i("path",{d:"M21 3L9 15"}),i("path",{d:"M3 21l6-6"})]})),fr.inheritedText]})),t(p,e({component:"span",sx:{fontSize:"0.7rem",color:"#475569",bgcolor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"4px",px:"6px",py:"2px"}},{children:[fr.rulesCount," rules"]})),t(p,e({component:"span",sx:{fontSize:"0.7rem",color:"#475569",bgcolor:"#F1F5F9",border:"1px solid #E2E8F0",borderRadius:"4px",px:"6px",py:"2px"}},{children:[fr.tiersCount," Tiers"]}))]}))]}))]})):cr.genre?null:i(p,e({sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",opacity:.4,py:6,gap:1}},{children:i(f,e({sx:{fontSize:"0.75rem",color:"#94A3B8"}},{children:"Select a genre to load the matching scope"}))}))})),cr.genre&&t(l,{children:[t(f,e({sx:{fontSize:"1rem",fontWeight:600,mb:.5,color:"#19213D"}},{children:["Select an Existing Station from the “",cr.genre,"” Scope"," ",i(f,e({component:"span",sx:{fontSize:"1rem",fontWeight:400,color:"#64748B"}},{children:"(Optional)"}))]})),t(f,e({sx:{fontSize:"0.75rem",color:"#64748B",mb:"12px"}},{children:["Please select an existing station under the “",cr.genre,"” category to copy its learnings."]})),t("div",e({className:z.searchWrapper,style:{marginBottom:"12px"}},{children:[i("input",{type:"text",value:xe,onChange:function(e){return ve(e.target.value)},placeholder:"Search for station...",className:z.searchInput}),i(v,{className:z.searchIcon,size:16})]})),t(p,e({sx:{display:"flex",flexDirection:"column",gap:2}},{children:[Ce&&i(E,{}),!Ce&&0===me.length&&be.trim()&&t(f,e({sx:{fontSize:"0.875rem",color:"#64748B",textAlign:"center",py:4}},{children:['No scopes found matching "',be,'".']})),!Ce&&me.map(function(r){return i(B,e({},r,{isSelected:Te===r.id,onSelect:function(e){var r;Be(Te===e?null!==(r=null==fr?void 0:fr.id)&&void 0!==r?r:null:e)}}),r.id)})]}))]})]}))]}))}))]})),t(p,e({sx:{p:"12px 20px",borderTop:"1px solid #F0F2F5",display:"flex",justifyContent:"flex-end",gap:2,bgcolor:"#fff"}},{children:[i("button",e({onClick:gr,disabled:Ae,style:{padding:"7px 10px",borderRadius:"6px",color:"#64748B",border:"1px solid #E2E8F0",backgroundColor:"#fff",cursor:"pointer",fontSize:"14px",fontWeight:500}},{children:"Cancel"})),i("button",e({onClick:function(){return r(void 0,void 0,void 0,function(){var e,r,t,i,l,a,s,c,d,u,p,f,m,h,g,x,v,y,b;return o(this,function(o){switch(o.label){case 0:if(!$||!Te)return console.error("[StationOnboard] Missing required data for onboarding"),[2];if(M.getState().backwardCompatibility&&"approval_required"===Je&&0===$e.length&&0===or.length)return lr("Please select at least one approver or approver group."),setTimeout(function(){var e;null===(e=Ke.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"center"})},50),[2];lr(""),e=fr?n([fr],me,!0):me,r=e.find(function(e){return e.id===Te}),null==r?void 0:r.isCopy,Ie(!0),Re(0),t=null,o.label=1;case 1:return o.trys.push([1,3,,4]),i=M.getState().backwardCompatibility,l=i?{topic:"customRuleSet",customScopeGroupName:L.CUSTOM_SCOPE_GROUP_NAME,scopeDescription:$.station_name||"New Station",parentScopeId:null!==(p=null==fr?void 0:fr.id)&&void 0!==p?p:null,customScopeName:$.station_name||"New Station",customScopeId:S(),createByName:(null==qe?void 0:qe.firstname)||"System",createdBy:(null==qe?void 0:qe.email)||"system@audacy.com",scopeType:"Station",approvalRequired:"approval_required"===Je,audacyStationMetadata:{genre:cr.genre,low_sellout_configurations:"Low Sellout"===cr.type?cr.lowSelloutConfig:null,market:$.market,primetime_windows:cr.primeTime,region:$.region,station_guid:$.station_guid,station_type:""===cr.type?null:cr.type,source_days:cr.source_days,target_days:cr.target_days},appsecData:{application:null==Ye?void 0:Ye.applicationId,module:null==Ye?void 0:Ye.moduleId,roles:n(n([],"approval_required"===Je?[{users:$e.map(function(e){return e.email}),groups:or.map(function(e){return e._id}),role:null!==(m=null===(f=Ve.find(function(e){return"Learning Manager"===e.name}))||void 0===f?void 0:f._id)&&void 0!==m?m:""}]:[],!0),[{users:[null==qe?void 0:qe.email],groups:[],role:null!==(g=null===(h=Ve.find(function(e){return"Instant Learning Admin"===e.name}))||void 0===h?void 0:h._id)&&void 0!==g?g:""}],!1)}}:{topic:"customRuleSet",scope_reference_id:null,scopeDescription:"demo",parentScopeId:null,scopeName:$.station_name||"New Station",scopeReferenceMetadata:{},applicationMappingId:J},console.log("[StationOnboard] Step 1: Creating rule set with payload:",l),[4,k(l,Q)];case 2:if(a=o.sent(),!(t=null===(x=null==a?void 0:a.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:",t),Re(1),[3,4];case 3:return s=o.sent(),console.error("[StationOnboard] Error creating rule set:",s),null===(v=Pe.current)||void 0===v||v.show({severity:"error",life:3e3,summary:"Error",detail:"Failed to create rule set. Please try again."}),Ie(!1),Re(0),[2];case 4:return o.trys.push([4,6,,7]),c=null!==Te&&Te!==(null==fr?void 0:fr.id),d={source_scope_id:c?Te:null!==(y=null==fr?void 0:fr.id)&&void 0!==y?y:Te,target_scope_id:t,is_copy_parent_variant_id:c},console.log("[StationOnboard] Step 3: Inheriting scope with payload:",d),[4,F(d)];case 5:return o.sent(),console.log("[StationOnboard] Step 3 Complete: Scope inherited"),Re(3),[3,7];case 6:return u=o.sent(),console.error("[StationOnboard] Error inheriting scope (no rollback):",u),null===(b=Pe.current)||void 0===b||b.show({severity:"error",life:3e3,summary:"Error",detail:"Failed to apply rule template. Please try again."}),Ie(!1),Re(0),[2];case 7:return Ge.current=t,console.log("[StationOnboard] Onboarding completed successfully!"),[2]}})})},disabled:!vr||Ae,style:{padding:"7px 10px",borderRadius:"6px",border:"none",backgroundColor:vr?"#2563EB":"#BFDBFE",color:"#fff",cursor:vr&&!Ae?"pointer":"not-allowed",fontSize:"14px",fontWeight:500,display:"flex",alignItems:"center",gap:"7px"}},{children:t(l,Ae?{children:[i(g,{size:16,color:"inherit"}),i("span",{children:"Onboarding..."})]}:{children:[i("span",{children:"Onboard Station"}),i(y,{size:16})]})}))]}))]}))};export{H as default};
|
|
2
2
|
//# sourceMappingURL=StationOnboardModal.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface StationOnboardModalProps {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
onBoardStation: (scopeId?: string) => void;
|
|
6
|
+
app_integration_id?: string;
|
|
7
|
+
token: string;
|
|
8
|
+
stationNameParam?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const BackwardStationOnboardModal: React.FC<StationOnboardModalProps>;
|
|
11
|
+
export default BackwardStationOnboardModal;
|
|
12
|
+
//# sourceMappingURL=BackwardStationOnboardModal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BackwardStationOnboardModal.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AA+DpE,UAAU,wBAAwB;IAChC,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,cAAc,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,QAAA,MAAM,2BAA2B,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAitBnE,CAAC;AAEF,eAAe,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SelectOption } from "./InputField";
|
|
3
|
+
interface DayToggleSelectorProps {
|
|
4
|
+
label: string;
|
|
5
|
+
subText?: string;
|
|
6
|
+
required?: boolean;
|
|
7
|
+
options: SelectOption[];
|
|
8
|
+
selectedValues: string[];
|
|
9
|
+
onChange: (updatedValues: string[]) => void;
|
|
10
|
+
}
|
|
11
|
+
declare const DayToggleSelector: React.FC<DayToggleSelectorProps>;
|
|
12
|
+
export default DayToggleSelector;
|
|
13
|
+
//# sourceMappingURL=DayToggleSelector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DayToggleSelector.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/LearningManagement/components/StationOnboarding/DayToggleSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAkC5C,UAAU,sBAAsB;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,QAAQ,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CAC7C;AAED,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CA4EvD,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StationOnboardModal.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/LearningManagement/components/StationOnboarding/StationOnboardModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"StationOnboardModal.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/LearningManagement/components/StationOnboarding/StationOnboardModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AAiFpE,UAAU,wBAAwB;IAChC,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,qEAAqE;IACrE,cAAc,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,kBAAkB,EAAE,MAAM,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,QAAA,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAuiC3D,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|