@e-llm-studio/instant-learning 1.3.0-alpha.24 → 1.3.0-alpha.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/dist/cjs/features/LearningManagement/LearningTemplateLayout.js +1 -1
  2. package/dist/cjs/features/LearningManagement/assets/Search-result(add new).svg.js +2 -0
  3. package/dist/cjs/features/LearningManagement/assets/Search-result(add new).svg.js.map +1 -0
  4. package/dist/cjs/features/LearningManagement/components/CreateLearningSetModal.js +1 -1
  5. package/dist/cjs/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.js +2 -0
  6. package/dist/cjs/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.js.map +1 -0
  7. package/dist/cjs/features/LearningManagement/components/StationOnboarding/StationOnboardModal.js +1 -1
  8. package/dist/cjs/features/LearningManagement/hooks/useLearningTemplateQueryParams.js +1 -1
  9. package/dist/cjs/features/LearningManagement/store/useLearningTemplateStore.js +1 -1
  10. package/dist/features/LearningManagement/LearningTemplateLayout.js +1 -1
  11. package/dist/features/LearningManagement/assets/Search-result(add new).svg.js +2 -0
  12. package/dist/features/LearningManagement/assets/Search-result(add new).svg.js.map +1 -0
  13. package/dist/features/LearningManagement/components/CreateLearningSetModal.js +1 -1
  14. package/dist/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.js +2 -0
  15. package/dist/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.js.map +1 -0
  16. package/dist/features/LearningManagement/components/StationOnboarding/StationOnboardModal.js +1 -1
  17. package/dist/features/LearningManagement/hooks/useLearningTemplateQueryParams.js +1 -1
  18. package/dist/features/LearningManagement/store/useLearningTemplateStore.js +1 -1
  19. package/dist/types/src/features/LearningManagement/LearningTemplateLayout.d.ts.map +1 -1
  20. package/dist/types/src/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.d.ts +12 -0
  21. package/dist/types/src/features/LearningManagement/components/StationOnboarding/BackwardStationOnboardModal.d.ts.map +1 -0
  22. package/dist/types/src/features/LearningManagement/components/StationOnboarding/StationOnboardModal.d.ts.map +1 -1
  23. package/dist/types/src/features/LearningManagement/hooks/useLearningTemplateQueryParams.d.ts +2 -0
  24. package/dist/types/src/features/LearningManagement/hooks/useLearningTemplateQueryParams.d.ts.map +1 -1
  25. package/dist/types/src/features/LearningManagement/store/useLearningTemplateStore.d.ts +2 -0
  26. package/dist/types/src/features/LearningManagement/store/useLearningTemplateStore.d.ts.map +1 -1
  27. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("./RuleContent/RuleContent.js"),o=require("./StationsContent/StationsContent.js"),i=require("./RBAC/AccessManagementPanel.js");require("appsec-ui"),require("./store/useAuthStore.js"),require("./store/usePermissionsStore.js");var a=require("./store/useEnvStore.js"),r=require("./styles/LearningTemplateLayout.module.css.js"),s=require("./utils/treeUtils.js"),l=require("./SidebarWrapper.js"),u=require("./store/useLearningTemplateStore.js"),d=require("./components/StationOnboarding/StationOnboardModal.js"),c=require("./AuditLog/AuditLog.js");exports.default=function(p){var S,f,g=p.onOpenCreateModal,v=p.onRefreshRuleSets,C=p.scopeTreeData,j=p.onAddChild,m=p.onRenameChild,q=p.onDeleteChild,h=p.canDeleteScope,R=p.canEditScope,x=p.canCreateScope,_=p.onSectionSelect,L=p.onViewStation,T=p.activeSectionId,A=void 0===T?"learnings":T,I=p.sectionsConfig,D=p.nodeTypesConfig,y=p.app_integration_id,M=p.token,O=u.useLearningTemplateStore(function(e){return e.isStationModalOpen}),w=u.useLearningTemplateStore(function(e){return e.setStationModalOpen}),b=u.useLearningTemplateStore(function(e){return e.selectedRuleSetId}),k=u.useLearningTemplateStore(function(e){return e.rawAuditRuleData}),N=a.default(function(e){return e.auditLogConfig});u.useLearningTemplateStore(function(e){return e.ruleData});var B=b?s.findNodeById((null==C?void 0:C.data)||null,b):null;return Boolean((null===(S=null==C?void 0:C.data)||void 0===S?void 0:S.id)&&b===C.data.id),n.jsxs("div",e.__assign({className:r.default.container},{children:[n.jsx(l.default,{onOpenCreateModal:g,onRefreshRuleSets:v,scopeTreeData:C,onAddChild:j,onRenameChild:m,onDeleteChild:q,canDeleteScope:h,canEditScope:R,canCreateScope:x,onSectionSelect:_,activeSectionId:A,sectionsConfig:I,nodeTypesConfig:D}),n.jsx("div",e.__assign({id:"rule-template-layout-content",className:"".concat(r.default.content," relative flex-1 overflow-hidden")},{children:"stations"===A?n.jsx(o.default,{scopeId:b||"",scopeName:(null==B?void 0:B.name)||"Unknown Scope",stationsCount:null===(f=null==B?void 0:B.metrics)||void 0===f?void 0:f.stationsCount,onViewStation:L}):"access"===A?n.jsx(i.default,{selectedRuleSetId:b,useApplicationModuleForScopeAccess:!1}):"history"===A?(null==N?void 0:N.configId)?n.jsx(c.default,{configId:N.configId,scopeId:b||void 0,scopeName:(null==B?void 0:B.name)||"Unknown Scope",ruleData:k}):null:n.jsx(t.default,{onRefreshRuleSets:v,app_integration_id:y,token:M})})),n.jsx(d.default,{isOpen:O,onClose:function(){w(!1)},onBoardStation:function(e){v(!0,e)},app_integration_id:y,token:M})]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),t=require("react"),o=require("./RuleContent/RuleContent.js"),i=require("./StationsContent/StationsContent.js"),a=require("./RBAC/AccessManagementPanel.js");require("appsec-ui"),require("./store/useAuthStore.js"),require("./store/usePermissionsStore.js");var r=require("./store/useEnvStore.js"),s=require("./styles/LearningTemplateLayout.module.css.js"),u=require("./utils/treeUtils.js"),l=require("./SidebarWrapper.js"),d=require("./store/useLearningTemplateStore.js"),c=require("./components/StationOnboarding/StationOnboardModal.js"),p=require("./AuditLog/AuditLog.js");exports.default=function(S){var f,g,m=S.onOpenCreateModal,v=S.onRefreshRuleSets,C=S.scopeTreeData,j=S.onAddChild,q=S.onRenameChild,T=S.onDeleteChild,h=S.canDeleteScope,R=S.canEditScope,L=S.canCreateScope,x=S.onSectionSelect,_=S.onViewStation,I=S.activeSectionId,A=void 0===I?"learnings":I,M=S.sectionsConfig,O=S.nodeTypesConfig,D=S.app_integration_id,y=S.token,b=d.useLearningTemplateStore(function(e){return e.isStationModalOpen}),w=d.useLearningTemplateStore(function(e){return e.setStationModalOpen}),k=d.useLearningTemplateStore(function(e){return e.isStationOnboardModalTriggered}),N=d.useLearningTemplateStore(function(e){return e.setIsStationOnboardModalTriggered}),B=d.useLearningTemplateStore(function(e){return e.selectedRuleSetId}),E=d.useLearningTemplateStore(function(e){return e.rawAuditRuleData}),P=r.default(function(e){return e.auditLogConfig});d.useLearningTemplateStore(function(e){return e.ruleData});var U=B?u.findNodeById((null==C?void 0:C.data)||null,B):null;return Boolean((null===(f=null==C?void 0:C.data)||void 0===f?void 0:f.id)&&B===C.data.id),t.useEffect(function(){k&&w(!0)},[k,w,N]),n.jsxs("div",e.__assign({className:s.default.container},{children:[n.jsx(l.default,{onOpenCreateModal:m,onRefreshRuleSets:v,scopeTreeData:C,onAddChild:j,onRenameChild:q,onDeleteChild:T,canDeleteScope:h,canEditScope:R,canCreateScope:L,onSectionSelect:x,activeSectionId:A,sectionsConfig:M,nodeTypesConfig:O}),n.jsx("div",e.__assign({id:"rule-template-layout-content",className:"".concat(s.default.content," relative flex-1 overflow-hidden")},{children:"stations"===A?n.jsx(i.default,{scopeId:B||"",scopeName:(null==U?void 0:U.name)||"Unknown Scope",stationsCount:null===(g=null==U?void 0:U.metrics)||void 0===g?void 0:g.stationsCount,onViewStation:_}):"access"===A?n.jsx(a.default,{selectedRuleSetId:B,useApplicationModuleForScopeAccess:!1}):"history"===A?(null==P?void 0:P.configId)?n.jsx(p.default,{configId:P.configId,scopeId:B||void 0,scopeName:(null==U?void 0:U.name)||"Unknown Scope",ruleData:E}):null:n.jsx(o.default,{onRefreshRuleSets:v,app_integration_id:D,token:y})})),n.jsx(c.default,{isOpen:b,onClose:function(){w(!1),N(!1)},onBoardStation:function(e){v(!0,e)},app_integration_id:D,token:y})]}))};
2
2
  //# sourceMappingURL=LearningTemplateLayout.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"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),s=require("react/jsx-runtime"),a=require("react"),l=require("lucide-react"),i=require("../styles/CreateLearningSetModal.module.css.js");exports.default=function(n){var r=n.isOpen,t=n.onClose,d=n.onSubmit,c=n.title,u=n.description,o=n.inputLabel,_=n.submitLabel,f=n.placeholder,m=void 0===f?"":f,v=n.initialValue,g=void 0===v?"":v,h=n.isLoading,x=void 0!==h&&h,j=a.useState(""),p=j[0],b=j[1],N=a.useState(null),C=N[0],q=N[1];if(a.useEffect(function(){r&&(b(g),q(null))},[r,g]),!r)return null;return s.jsx("div",e.__assign({className:i.default.overlay},{children:s.jsxs("div",e.__assign({className:i.default.modal},{children:[s.jsxs("div",e.__assign({className:i.default.header},{children:[s.jsxs("div",e.__assign({className:i.default.headerContent},{children:[s.jsx("h2",e.__assign({className:i.default.title},{children:c})),u&&s.jsx("p",e.__assign({className:i.default.description},{children:u}))]})),s.jsx("button",e.__assign({onClick:t,className:i.default.closeBtn,disabled:x},{children:s.jsx(l.X,{size:24})}))]})),s.jsx("div",e.__assign({className:i.default.form},{children:s.jsxs("div",e.__assign({className:i.default.formGroup},{children:[s.jsxs("label",e.__assign({className:i.default.label},{children:[s.jsx("span",e.__assign({className:i.default.asterisk},{children:"*"})),o]})),s.jsx("input",{type:"text",value:p,onChange:function(e){var s=e.target.value;if(s.length>50)return b(s.slice(0,50)),void q("Maximum 50 characters allowed");b(s),C&&q(null)},className:"".concat(i.default.inputField," ").concat(C?i.default.inputError:""),placeholder:m,disabled:x}),C&&s.jsx("p",e.__assign({className:i.default.errorMessage},{children:C}))]}))})),s.jsxs("div",e.__assign({className:i.default.footer},{children:[s.jsx("button",e.__assign({onClick:t,className:i.default.cancelBtn,disabled:x},{children:"Cancel"})),s.jsx("button",e.__assign({onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var s,a,l;return e.__generator(this,function(e){switch(e.label){case 0:if(!(p.trim()?(q(null),1):(q("".concat(o.replace("*","").trim()," is required")),0)))return[2];e.label=1;case 1:return e.trys.push([1,3,,4]),[4,d(p)];case 2:return e.sent(),t(),[3,4];case 3:return s=e.sent(),console.error("Error in submission",s),409===(null==s?void 0:s.status)?(q(null===(l=null===(a=null==s?void 0:s.response)||void 0===a?void 0:a.data)||void 0===l?void 0:l.message),[2]):(q((null==s?void 0:s.message)||"An error occurred. Please try again."),[3,4]);case 4:return[2]}})})},className:i.default.confirmBtn,disabled:x},{children:x?s.jsxs(s.Fragment,{children:[s.jsx(l.Loader2,{className:i.default.spinner}),"Save"===_?"Saving...":"Creating..."]}):_}))]}))]}))}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),s=require("react/jsx-runtime"),a=require("react"),l=require("lucide-react"),i=require("../styles/CreateLearningSetModal.module.css.js");exports.default=function(n){var t=n.isOpen,r=n.onClose,c=n.onSubmit,d=n.title,u=n.description,o=n.inputLabel,_=n.submitLabel,f=n.placeholder,m=void 0===f?"":f,g=n.initialValue,h=void 0===g?"":g,v=n.isLoading,x=void 0!==v&&v,j=a.useState(""),p=j[0],b=j[1],N=a.useState(null),C=N[0],q=N[1];if(a.useEffect(function(){t&&(b(h),q(null))},[t,h]),!t)return null;return s.jsx("div",e.__assign({className:i.default.overlay},{children:s.jsxs("div",e.__assign({className:i.default.modal},{children:[s.jsxs("div",e.__assign({className:i.default.header},{children:[s.jsxs("div",e.__assign({className:i.default.headerContent},{children:[s.jsx("h2",e.__assign({className:i.default.title},{children:d})),u&&s.jsx("p",e.__assign({className:i.default.description},{children:u}))]})),s.jsx("button",e.__assign({onClick:r,className:i.default.closeBtn,disabled:x},{children:s.jsx(l.X,{size:24})}))]})),s.jsx("div",e.__assign({className:i.default.form},{children:s.jsxs("div",e.__assign({className:i.default.formGroup},{children:[s.jsxs("label",e.__assign({className:i.default.label},{children:[s.jsx("span",e.__assign({className:i.default.asterisk},{children:"*"})),o]})),s.jsx("input",{type:"text",value:p,onChange:function(e){b(e.target.value),C&&q(null)},className:"".concat(i.default.inputField," ").concat(C?i.default.inputError:""),placeholder:m,disabled:x}),C&&s.jsx("p",e.__assign({className:i.default.errorMessage},{children:C}))]}))})),s.jsxs("div",e.__assign({className:i.default.footer},{children:[s.jsx("button",e.__assign({onClick:r,className:i.default.cancelBtn,disabled:x},{children:"Cancel"})),s.jsx("button",e.__assign({onClick:function(){return e.__awaiter(void 0,void 0,void 0,function(){var s;return e.__generator(this,function(e){switch(e.label){case 0:if(!(p.trim()?(q(null),1):(q("".concat(o.replace("*","").trim()," is required")),0)))return[2];e.label=1;case 1:return e.trys.push([1,3,,4]),[4,c(p)];case 2:return e.sent(),r(),[3,4];case 3:return s=e.sent(),q((null==s?void 0:s.message)||"An error occurred. Please try again."),[3,4];case 4:return[2]}})})},className:i.default.confirmBtn,disabled:x},{children:x?s.jsxs(s.Fragment,{children:[s.jsx(l.Loader2,{className:i.default.spinner}),"Save"===_?"Saving...":"Creating..."]}):_}))]}))]}))}))};
2
2
  //# sourceMappingURL=CreateLearningSetModal.js.map
@@ -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":""}
@@ -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"),l=require("../../apis/scopeApis.js"),a=require("./StationAutocomplete.js"),u=require("../CardSkeleton.js"),c=require("./OnboardingLoader.js"),p=require("./TemplateCard.js"),d=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:"PT - Pacific Time",value:"Pacific Time"},{label:"MT - Mountain Time",value:"Mountain Time"},{label:"CT - Central Time",value:"Central Time"},{label:"ET - Eastern Time",value:"Eastern Time"}],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:""}],C=[{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(w){var T,B=w.isOpen,F=w.onClose,E=w.onBoardStation,k=w.app_integration_id,q=w.token,D=r.useState(null),z=D[0],O=D[1],A=r.useState([]),R=A[0],I=A[1],L=r.useState(0),N=L[0],M=L[1],W=r.useState(!0),P=W[0],G=W[1],U=r.useState(!1),H=U[0],K=U[1],Y=r.useState([]),X=Y[0],Z=Y[1],V=r.useState(""),J=V[0],Q=V[1],$=r.useState(""),ee=$[0],ne=$[1],re=r.useState(!1),ie=re[0],oe=re[1],te=r.useState(!1),se=te[0],le=te[1],ae=r.useState(null),ue=ae[0],ce=ae[1],pe=r.useState(null);pe[0],pe[1];var de=r.useState(!1),xe=de[0],ge=de[1],fe=r.useState(0),he=fe[0],_e=fe[1],me=r.useState(""),ve=me[0],ye=me[1],Se=g.default().user,be=r.useRef(null),je=r.useRef(null),Ce=r.useRef(null),we=r.useRef(null);f.useConfigStore().configuration;var Te=r.useRef(null),Be=m.useAppSecRolesStore(function(e){return e.roles}),Fe=v.default(function(e){return e.rbacConfig}),Ee=r.useState("approval_required"),ke=Ee[0],qe=Ee[1],De=r.useState([]),ze=De[0],Oe=De[1],Ae=r.useState([]),Re=Ae[0],Ie=Ae[1],Le=r.useState(""),Ne=Le[0],Me=Le[1],We=r.useState({region:"",timezone:"",primeTime:[],genre:"",type:"",lowSelloutConfig:""}),Pe=We[0],Ge=We[1],Ue=function(e,n){return e.find(function(e){return e.value===n})||null},He=r.useMemo(function(){return R.map(function(e){return{label:e.scope_name,value:e.scope_name}})},[R]),Ke=r.useMemo(function(){var e,n,r;if(!Pe.genre)return null;var i=R.find(function(e){return e.scope_name===Pe.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},[Pe.genre,R]);r.useEffect(function(){return function(){Ce.current&&clearTimeout(Ce.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(H)return[2];K(!0),t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,l.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?G(!1):G(!0),M(n+20)):G(!1),[3,5];case 3:return o=t.sent(),console.error("[StationOnboard] Failed to fetch genre scopes:",o),G(!1),[3,5];case 4:return K(!1),[7];case 5:return[2]}})})};r.useEffect(function(){B&&(I([]),M(0),G(!0),Ye(0))},[B]);r.useEffect(function(){Ge(z?function(n){var r;return e.__assign(e.__assign({},n),{region:null!==(r=z.market)&&void 0!==r?r:""})}:{region:"",timezone:"",primeTime:[],genre:"",type:"",lowSelloutConfig:""})},[z]),r.useEffect(function(){var e=setTimeout(function(){ne(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(!ee.trim())return Z([]),[2];oe(!0),e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,l.searchScopes({search_string:ee.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]===Pe.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}}),Z(i)):Z([]),[3,5];case 3:return o=e.sent(),console.error("[StationOnboard] Error searching scopes:",o),Z([]),[3,5];case 4:return oe(!1),[7];case 5:return[2]}})})},[ee,Pe.genre]),r.useEffect(function(){!ee.trim()&&Ke&&ce(Ke.id)},[ee,Ke]);var Xe=function(){setTimeout(function(){we.current&&we.current.scrollTo({top:we.current.scrollHeight,behavior:"smooth"})},100)},Ze=function(){ye(""),O(null),Ge({region:"",timezone:"",primeTime:[],genre:"",type:"",lowSelloutConfig:""}),Z([]),Q(""),ce(null),qe("approval_required"),Oe([]),Ie([]),Me(""),F()},Ve=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&&(le(!0),Ce.current&&clearTimeout(Ce.current),Ce.current=setTimeout(function(){var e=R.find(function(e){return e.scope_name===o});ce(e?e.id:null),le(!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]:[]})})}},Je=Boolean(z&&Pe.region&&Pe.timezone&&Pe.primeTime.length>0&&Pe.genre);return n.jsxs(i.Dialog,e.__assign({open:B,onClose:Ze,maxWidth:!1,disableEscapeKeyDown:!0,PaperProps:{sx:{width:"90vw",height:"90vh",borderRadius:"12px",display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"sans-serif"}}},{children:[n.jsx(t.Toast,{ref:be}),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:Ze,disabled:xe,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:xe,currentStep:he,onComplete:function(){ge(!1);var e=je.current;Ze(),E(e||void 0),je.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:we,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:d.default.formGroup},{children:[n.jsxs("label",e.__assign({className:d.default.label},{children:[n.jsx("span",e.__assign({className:d.default.asterisk},{children:"*"})),"Station Name/Call Letters"]})),n.jsx(a.default,{value:ve,onChange:ye,onStationSelect:function(e){return O(e)}})]})),n.jsx(x.default,{required:!0,disabled:!0,label:"Region",placeholder:"Select Region",value:Pe.region||void 0,isSearchable:!1}),n.jsx(x.default,{required:!0,label:"TimeZone",placeholder:"Select TimeZone",options:S,value:Ue(S,Pe.timezone),onOptionChange:function(e){return Ve("timezone",e)},isSearchable:!1}),n.jsx(x.default,{required:!0,label:"Prime Time Window",placeholder:"Select Prime Time",options:b,value:Ue(b,(null===(T=Pe.primeTime)||void 0===T?void 0:T[0])||""),onOptionChange:function(e){return Ve("primeTime",e)},isSearchable:!1}),n.jsx(i.Box,e.__assign({onClick:Xe,sx:{width:"100%"}},{children:n.jsx(x.default,{label:"Station Type",placeholder:"None",options:j,value:Ue(j,Pe.type),onOptionChange:function(n){Ve("type",n),"Low Sellout"!==(null==n?void 0:n.value)&&Ge(function(n){return e.__assign(e.__assign({},n),{lowSelloutConfig:""})})},isSearchable:!1})})),"Low Sellout"===Pe.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:C,value:Ue(C,Pe.lowSelloutConfig),onOptionChange:function(e){return Ve("lowSelloutConfig",e)},isSearchable:!1})})),h.useLearningTemplateStore.getState().backwardCompatibility&&n.jsxs("div",e.__assign({ref:Te,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"===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(y.default,{selectedApprovers:ze,selectedGroupOfApprovers:Re,onApproversChange:function(e){Oe(e),Me("")},onGroupsChange:function(e){Ie(e),Me("")}}),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"),Me("")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||(qe("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"===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(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:He,value:Ue(He,Pe.genre),onOptionChange:function(e){return Ve("genre",e)},isSearchable:!1,onMenuScrollToBottom:function(){!H&&P&&Ye(N)},isLoadingOptions:H,hasMoreOptions:P})})),n.jsx(i.Box,e.__assign({sx:{mb:3}},{children:se?n.jsx(u.default,{}):Ke?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:Ke.title})),n.jsx(i.Typography,e.__assign({sx:{fontSize:"0.75rem",color:"#2563EB",mb:"8px"}},{children:Ke.description})),n.jsxs(i.Box,e.__assign({sx:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"}},{children:[Ke.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"})]})),Ke.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:[Ke.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:[Ke.tiersCount," Tiers"]}))]}))]}))]})):Pe.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"}))}))})),Pe.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 “",Pe.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 “",Pe.genre,"” category to copy its learnings."]})),n.jsxs("div",e.__assign({className:d.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:d.default.searchInput}),n.jsx(o.Search,{className:d.default.searchIcon,size:16})]})),n.jsxs(i.Box,e.__assign({sx:{display:"flex",flexDirection:"column",gap:2}},{children:[ie&&n.jsx(u.default,{}),!ie&&0===X.length&&ee.trim()&&n.jsxs(i.Typography,e.__assign({sx:{fontSize:"0.875rem",color:"#64748B",textAlign:"center",py:4}},{children:['No scopes found matching "',ee,'".']})),!ie&&X.map(function(r){return n.jsx(p.default,e.__assign({},r,{isSelected:ue===r.id,onSelect:function(e){var n;ce(ue===e?null!==(n=null==Ke?void 0:Ke.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:Ze,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,i,o,t,a,u,c,p,d,x,g,f,m,v,y,S,b,j;return e.__generator(this,function(C){switch(C.label){case 0:if(!z||!ue)return console.error("[StationOnboard] Missing required data for onboarding"),[2];if(h.useLearningTemplateStore.getState().backwardCompatibility&&"approval_required"===ke&&0===ze.length&&0===Re.length)return Me("Please select at least one approver or approver group."),setTimeout(function(){var e;null===(e=Te.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"center"})},50),[2];Me(""),n=Ke?e.__spreadArray([Ke],X,!0):X,r=n.find(function(e){return e.id===ue}),null==r?void 0:r.isCopy,ge(!0),_e(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:z.station_name||"New Station",parentScopeId:null!==(x=null==Ke?void 0:Ke.id)&&void 0!==x?x:null,customScopeName:z.station_name||"New Station",customScopeId:s.v4(),createByName:(null==Se?void 0:Se.firstname)||"System",createdBy:(null==Se?void 0:Se.email)||"system@audacy.com",scopeType:"Station",approvalRequired:"approval_required"===ke,audacyStationMetadata:{genre:Pe.genre,low_sellout_configurations:"Low Sellout"===Pe.type?Pe.lowSelloutConfig:null,market:z.market,primetime_windows:Pe.primeTime,region:z.region,station_guid:z.station_guid,station_type:""===Pe.type?null:Pe.type},appsecData:{application:null==Fe?void 0:Fe.applicationId,module:null==Fe?void 0:Fe.moduleId,roles:e.__spreadArray(e.__spreadArray([],"approval_required"===ke?[{users:ze.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==Se?void 0:Se.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:z.station_name||"New Station",scopeReferenceMetadata:{},applicationMappingId:k},console.log("[StationOnboard] Step 1: Creating rule set with payload:",t),[4,l.createRuleSet(t,q)];case 2:if(a=C.sent(),!(i=null===(y=null==a?void 0:a.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),_e(1),[3,4];case 3:return u=C.sent(),console.error("[StationOnboard] Error creating rule set:",u),null===(S=be.current)||void 0===S||S.show({severity:"error",life:3e3,summary:"Error",detail:"Failed to create rule set. Please try again."}),ge(!1),_e(0),[2];case 4:return C.trys.push([4,6,,7]),c=null!==ue&&ue!==(null==Ke?void 0:Ke.id),p={source_scope_id:c?ue:null!==(b=null==Ke?void 0:Ke.id)&&void 0!==b?b:ue,target_scope_id:i,is_copy_parent_variant_id:c},console.log("[StationOnboard] Step 3: Inheriting scope with payload:",p),[4,l.inheritScopeBackwardCompatible(p)];case 5:return C.sent(),console.log("[StationOnboard] Step 3 Complete: Scope inherited"),_e(3),[3,7];case 6:return d=C.sent(),console.error("[StationOnboard] Error inheriting scope (no rollback):",d),null===(j=be.current)||void 0===j||j.show({severity:"error",life:3e3,summary:"Error",detail:"Failed to apply rule template. Please try again."}),ge(!1),_e(0),[2];case 7:return je.current=i,console.log("[StationOnboard] Onboarding completed successfully!"),[2]}})})},disabled:!Je||xe,style:{padding:"7px 10px",borderRadius:"6px",border:"none",backgroundColor:Je?"#2563EB":"#BFDBFE",color:"#fff",cursor:Je&&!xe?"pointer":"not-allowed",fontSize:"14px",fontWeight:500,display:"flex",alignItems:"center",gap:"7px"}},{children:xe?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"),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})]})}))]}))]}))};
2
2
  //# sourceMappingURL=StationOnboardModal.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),require("react");exports.QUERY_PARAM_KEYS={TAB:"tab",RULESET_ID:"rulesetid",SECTION:"section",OPEN_IL:"openil",ONBOARD_STATION:"onboardstation",VARIANT_ID:"variantid",APPROVAL_ACTION:"approval"},exports.getQueryParam=function(e){return new URLSearchParams(window.location.search).get(e)},exports.setQueryParams=function(e){var t=new URLSearchParams(window.location.search);Object.entries(e).forEach(function(e){var a=e[0],r=e[1];null==r||""===r?t.delete(a):t.set(a,r)});var a=t.toString(),r="".concat(window.location.pathname).concat(a?"?".concat(a):"");window.history.replaceState({},"",r)};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),require("react");exports.QUERY_PARAM_KEYS={TAB:"tab",RULESET_ID:"rulesetid",SECTION:"section",OPEN_IL:"openil",ONBOARD_STATION:"onboardstation",STATION_NAME:"stationname",VARIANT_ID:"variantid",APPROVAL_ACTION:"approval"},exports.getQueryParam=function(e){return new URLSearchParams(window.location.search).get(e)},exports.setQueryParams=function(e){var t=new URLSearchParams(window.location.search);Object.entries(e).forEach(function(e){var a=e[0],r=e[1];null==r||""===r?t.delete(a):t.set(a,r)});var a=t.toString(),r="".concat(window.location.pathname).concat(a?"?".concat(a):"");window.history.replaceState({},"",r)};
2
2
  //# sourceMappingURL=useLearningTemplateQueryParams.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("zustand"),r=require("../hooks/useLearningTemplateQueryParams.js"),n={globalRuleSet:[],genreRuleSet:[],customRuleSet:[]},a=t.create(function(t){return{sidebarTab:"rule-sets",selectedRuleSetId:null,ruleSets:n,isStationModalOpen:!1,isILModalTriggered:"true"===r.getQueryParam(r.QUERY_PARAM_KEYS.OPEN_IL),isStationOnboardModalTriggered:"true"===r.getQueryParam(r.QUERY_PARAM_KEYS.ONBOARD_STATION),scopeTreeData:null,urlVariantId:r.getQueryParam(r.QUERY_PARAM_KEYS.VARIANT_ID),urlApprovalAction:(a=r.getQueryParam(r.QUERY_PARAM_KEYS.APPROVAL_ACTION),"approve"===a||"reject"===a?a:null),stations:[],selectedStationId:null,currentRules:[],createdVariantInfo:null,templateMap:{},setTemplateData:function(r,n){return t(function(t){var a;return{templateMap:e.__assign(e.__assign({},t.templateMap),(a={},a[r]=n,a))}})},setRuleSets:function(e){return t({ruleSets:e})},setScopeTreeData:function(e){return t({scopeTreeData:e})},setStationModalOpen:function(e){return t({isStationModalOpen:e})},setIsILModalTriggered:function(e){var n;r.setQueryParams(((n={})[r.QUERY_PARAM_KEYS.OPEN_IL]=e?"true":null,n)),t({isILModalTriggered:e})},setIsStationOnboardModalTriggered:function(e){var n;r.setQueryParams(((n={})[r.QUERY_PARAM_KEYS.ONBOARD_STATION]=e?"true":null,n)),t({isStationOnboardModalTriggered:e})},setInitialRules:function(e){return t({currentRules:e})},setCreatedVariantInfo:function(e){return t({createdVariantInfo:e})},resetCreatedVariantInfo:function(){return t({createdVariantInfo:null})},clearUrlApprovalParams:function(){var e;r.setQueryParams(((e={})[r.QUERY_PARAM_KEYS.VARIANT_ID]=null,e[r.QUERY_PARAM_KEYS.APPROVAL_ACTION]=null,e)),t({urlVariantId:null,urlApprovalAction:null})},rawAuditRuleData:null,setRawAuditRuleData:function(e){return t({rawAuditRuleData:e})},setSelectedRuleSetId:function(e){var n;r.setQueryParams(((n={})[r.QUERY_PARAM_KEYS.RULESET_ID]=e,n)),t({selectedRuleSetId:e})},toggleRuleTier:function(r){return t(function(t){return{currentRules:t.currentRules.map(function(t){return t.id===r?e.__assign(e.__assign({},t),{isOpen:!t.isOpen}):t})}})},deleteRule:function(r,n){return t(function(t){return{currentRules:t.currentRules.map(function(t){return t.id===r?e.__assign(e.__assign({},t),{rules:t.rules.filter(function(e){return e.id!==n}),ruleCount:t.ruleCount-1}):t})}})},setStations:function(e){return t({stations:e})},addStation:function(r){return t(function(t){return{stations:e.__spreadArray(e.__spreadArray([],t.stations,!0),[r],!1)}})},deleteStation:function(e){return t(function(t){return{stations:t.stations.filter(function(t){return t.stationId!==e}),selectedStationId:t.selectedStationId===e?null:t.selectedStationId}})},error:null,setError:function(e){return t({error:e})},tiers:[],setTiers:function(e){return t({tiers:e})},backwardCompatibility:!1,setBackwardCompatibility:function(e){return t({backwardCompatibility:e})},app_integration_id:null,setAppIntegrationId:function(e){return t({app_integration_id:e})},token:"",setToken:function(e){return t({token:e})}};var a});exports.INITIAL_RULE_SETS=n,exports.useLearningTemplateStore=a;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("zustand"),r=require("../hooks/useLearningTemplateQueryParams.js"),n={globalRuleSet:[],genreRuleSet:[],customRuleSet:[]},a=t.create(function(t){return{sidebarTab:"rule-sets",selectedRuleSetId:null,ruleSets:n,isStationModalOpen:!1,isILModalTriggered:"true"===r.getQueryParam(r.QUERY_PARAM_KEYS.OPEN_IL),isStationOnboardModalTriggered:"true"===r.getQueryParam(r.QUERY_PARAM_KEYS.ONBOARD_STATION),scopeTreeData:null,urlVariantId:r.getQueryParam(r.QUERY_PARAM_KEYS.VARIANT_ID),urlApprovalAction:(a=r.getQueryParam(r.QUERY_PARAM_KEYS.APPROVAL_ACTION),"approve"===a||"reject"===a?a:null),stationNameParam:r.getQueryParam(r.QUERY_PARAM_KEYS.STATION_NAME),stations:[],selectedStationId:null,currentRules:[],createdVariantInfo:null,templateMap:{},setTemplateData:function(r,n){return t(function(t){var a;return{templateMap:e.__assign(e.__assign({},t.templateMap),(a={},a[r]=n,a))}})},setRuleSets:function(e){return t({ruleSets:e})},setScopeTreeData:function(e){return t({scopeTreeData:e})},setStationModalOpen:function(e){return t({isStationModalOpen:e})},setIsILModalTriggered:function(e){var n;r.setQueryParams(((n={})[r.QUERY_PARAM_KEYS.OPEN_IL]=e?"true":null,n)),t({isILModalTriggered:e})},setIsStationOnboardModalTriggered:function(n){var a,u;r.setQueryParams(e.__assign(((a={})[r.QUERY_PARAM_KEYS.ONBOARD_STATION]=n?"true":null,a),n?{}:((u={})[r.QUERY_PARAM_KEYS.STATION_NAME]=null,u))),t(e.__assign({isStationOnboardModalTriggered:n},n?{}:{stationNameParam:null}))},setStationNameParam:function(e){var n;r.setQueryParams(((n={})[r.QUERY_PARAM_KEYS.STATION_NAME]=e,n)),t({stationNameParam:e})},setInitialRules:function(e){return t({currentRules:e})},setCreatedVariantInfo:function(e){return t({createdVariantInfo:e})},resetCreatedVariantInfo:function(){return t({createdVariantInfo:null})},clearUrlApprovalParams:function(){var e;r.setQueryParams(((e={})[r.QUERY_PARAM_KEYS.VARIANT_ID]=null,e[r.QUERY_PARAM_KEYS.APPROVAL_ACTION]=null,e)),t({urlVariantId:null,urlApprovalAction:null})},rawAuditRuleData:null,setRawAuditRuleData:function(e){return t({rawAuditRuleData:e})},setSelectedRuleSetId:function(e){var n;r.setQueryParams(((n={})[r.QUERY_PARAM_KEYS.RULESET_ID]=e,n)),t({selectedRuleSetId:e})},toggleRuleTier:function(r){return t(function(t){return{currentRules:t.currentRules.map(function(t){return t.id===r?e.__assign(e.__assign({},t),{isOpen:!t.isOpen}):t})}})},deleteRule:function(r,n){return t(function(t){return{currentRules:t.currentRules.map(function(t){return t.id===r?e.__assign(e.__assign({},t),{rules:t.rules.filter(function(e){return e.id!==n}),ruleCount:t.ruleCount-1}):t})}})},setStations:function(e){return t({stations:e})},addStation:function(r){return t(function(t){return{stations:e.__spreadArray(e.__spreadArray([],t.stations,!0),[r],!1)}})},deleteStation:function(e){return t(function(t){return{stations:t.stations.filter(function(t){return t.stationId!==e}),selectedStationId:t.selectedStationId===e?null:t.selectedStationId}})},error:null,setError:function(e){return t({error:e})},tiers:[],setTiers:function(e){return t({tiers:e})},backwardCompatibility:!1,setBackwardCompatibility:function(e){return t({backwardCompatibility:e})},app_integration_id:null,setAppIntegrationId:function(e){return t({app_integration_id:e})},token:"",setToken:function(e){return t({token:e})}};var a});exports.INITIAL_RULE_SETS=n,exports.useLearningTemplateStore=a;
2
2
  //# sourceMappingURL=useLearningTemplateStore.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e}from"tslib";import{jsxs as o,jsx as n}from"react/jsx-runtime";import t from"./RuleContent/RuleContent.js";import i from"./StationsContent/StationsContent.js";import a from"./RBAC/AccessManagementPanel.js";import"appsec-ui";import"./store/useAuthStore.js";import"./store/usePermissionsStore.js";import r from"./store/useEnvStore.js";import s from"./styles/LearningTemplateLayout.module.css.js";import{findNodeById as l}from"./utils/treeUtils.js";import d from"./SidebarWrapper.js";import{useLearningTemplateStore as c}from"./store/useLearningTemplateStore.js";import u from"./components/StationOnboarding/StationOnboardModal.js";import p from"./AuditLog/AuditLog.js";var m=function(m){var f,S,C=m.onOpenCreateModal,v=m.onRefreshRuleSets,g=m.scopeTreeData,h=m.onAddChild,R=m.onRenameChild,j=m.onDeleteChild,A=m.canDeleteScope,D=m.canEditScope,I=m.canCreateScope,M=m.onSectionSelect,O=m.onViewStation,w=m.activeSectionId,y=void 0===w?"learnings":w,L=m.sectionsConfig,T=m.nodeTypesConfig,_=m.app_integration_id,k=m.token,b=c(function(e){return e.isStationModalOpen}),N=c(function(e){return e.setStationModalOpen}),x=c(function(e){return e.selectedRuleSetId}),B=c(function(e){return e.rawAuditRuleData}),E=r(function(e){return e.auditLogConfig});c(function(e){return e.ruleData});var U=x?l((null==g?void 0:g.data)||null,x):null;return Boolean((null===(f=null==g?void 0:g.data)||void 0===f?void 0:f.id)&&x===g.data.id),o("div",e({className:s.container},{children:[n(d,{onOpenCreateModal:C,onRefreshRuleSets:v,scopeTreeData:g,onAddChild:h,onRenameChild:R,onDeleteChild:j,canDeleteScope:A,canEditScope:D,canCreateScope:I,onSectionSelect:M,activeSectionId:y,sectionsConfig:L,nodeTypesConfig:T}),n("div",e({id:"rule-template-layout-content",className:"".concat(s.content," relative flex-1 overflow-hidden")},{children:"stations"===y?n(i,{scopeId:x||"",scopeName:(null==U?void 0:U.name)||"Unknown Scope",stationsCount:null===(S=null==U?void 0:U.metrics)||void 0===S?void 0:S.stationsCount,onViewStation:O}):"access"===y?n(a,{selectedRuleSetId:x,useApplicationModuleForScopeAccess:!1}):"history"===y?(null==E?void 0:E.configId)?n(p,{configId:E.configId,scopeId:x||void 0,scopeName:(null==U?void 0:U.name)||"Unknown Scope",ruleData:B}):null:n(t,{onRefreshRuleSets:v,app_integration_id:_,token:k})})),n(u,{isOpen:b,onClose:function(){N(!1)},onBoardStation:function(e){v(!0,e)},app_integration_id:_,token:k})]}))};export{m as default};
1
+ import{__assign as e}from"tslib";import{jsxs as o,jsx as n}from"react/jsx-runtime";import{useEffect as t}from"react";import i from"./RuleContent/RuleContent.js";import r from"./StationsContent/StationsContent.js";import a from"./RBAC/AccessManagementPanel.js";import"appsec-ui";import"./store/useAuthStore.js";import"./store/usePermissionsStore.js";import s from"./store/useEnvStore.js";import l from"./styles/LearningTemplateLayout.module.css.js";import{findNodeById as d}from"./utils/treeUtils.js";import c from"./SidebarWrapper.js";import{useLearningTemplateStore as u}from"./store/useLearningTemplateStore.js";import p from"./components/StationOnboarding/StationOnboardModal.js";import m from"./AuditLog/AuditLog.js";var f=function(f){var S,g,C=f.onOpenCreateModal,v=f.onRefreshRuleSets,h=f.scopeTreeData,R=f.onAddChild,j=f.onRenameChild,A=f.onDeleteChild,I=f.canDeleteScope,D=f.canEditScope,M=f.canCreateScope,O=f.onSectionSelect,T=f.onViewStation,b=f.activeSectionId,w=void 0===b?"learnings":b,y=f.sectionsConfig,L=f.nodeTypesConfig,_=f.app_integration_id,k=f.token,N=u(function(e){return e.isStationModalOpen}),x=u(function(e){return e.setStationModalOpen}),B=u(function(e){return e.isStationOnboardModalTriggered}),E=u(function(e){return e.setIsStationOnboardModalTriggered}),U=u(function(e){return e.selectedRuleSetId}),P=u(function(e){return e.rawAuditRuleData}),V=s(function(e){return e.auditLogConfig});u(function(e){return e.ruleData});var F=U?d((null==h?void 0:h.data)||null,U):null;return Boolean((null===(S=null==h?void 0:h.data)||void 0===S?void 0:S.id)&&U===h.data.id),t(function(){B&&x(!0)},[B,x,E]),o("div",e({className:l.container},{children:[n(c,{onOpenCreateModal:C,onRefreshRuleSets:v,scopeTreeData:h,onAddChild:R,onRenameChild:j,onDeleteChild:A,canDeleteScope:I,canEditScope:D,canCreateScope:M,onSectionSelect:O,activeSectionId:w,sectionsConfig:y,nodeTypesConfig:L}),n("div",e({id:"rule-template-layout-content",className:"".concat(l.content," relative flex-1 overflow-hidden")},{children:"stations"===w?n(r,{scopeId:U||"",scopeName:(null==F?void 0:F.name)||"Unknown Scope",stationsCount:null===(g=null==F?void 0:F.metrics)||void 0===g?void 0:g.stationsCount,onViewStation:T}):"access"===w?n(a,{selectedRuleSetId:U,useApplicationModuleForScopeAccess:!1}):"history"===w?(null==V?void 0:V.configId)?n(m,{configId:V.configId,scopeId:U||void 0,scopeName:(null==F?void 0:F.name)||"Unknown Scope",ruleData:P}):null:n(i,{onRefreshRuleSets:v,app_integration_id:_,token:k})})),n(p,{isOpen:N,onClose:function(){x(!1),E(!1)},onBoardStation:function(e){v(!0,e)},app_integration_id:_,token:k})]}))};export{f as default};
2
2
  //# sourceMappingURL=LearningTemplateLayout.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"}
@@ -1,2 +1,2 @@
1
- import{__assign as e,__awaiter as l,__generator as r}from"tslib";import{jsx as i,jsxs as a,Fragment as n}from"react/jsx-runtime";import{useState as s,useEffect as t}from"react";import{X as c,Loader2 as o}from"lucide-react";import d from"../styles/CreateLearningSetModal.module.css.js";var u=function(u){var m=u.isOpen,v=u.onClose,h=u.onSubmit,p=u.title,f=u.description,b=u.inputLabel,N=u.submitLabel,g=u.placeholder,C=void 0===g?"":g,y=u.initialValue,k=void 0===y?"":y,x=u.isLoading,L=void 0!==x&&x,S=s(""),B=S[0],M=S[1],j=s(null),w=j[0],E=j[1];if(t(function(){m&&(M(k),E(null))},[m,k]),!m)return null;return i("div",e({className:d.overlay},{children:a("div",e({className:d.modal},{children:[a("div",e({className:d.header},{children:[a("div",e({className:d.headerContent},{children:[i("h2",e({className:d.title},{children:p})),f&&i("p",e({className:d.description},{children:f}))]})),i("button",e({onClick:v,className:d.closeBtn,disabled:L},{children:i(c,{size:24})}))]})),i("div",e({className:d.form},{children:a("div",e({className:d.formGroup},{children:[a("label",e({className:d.label},{children:[i("span",e({className:d.asterisk},{children:"*"})),b]})),i("input",{type:"text",value:B,onChange:function(e){var l=e.target.value;if(l.length>50)return M(l.slice(0,50)),void E("Maximum 50 characters allowed");M(l),w&&E(null)},className:"".concat(d.inputField," ").concat(w?d.inputError:""),placeholder:C,disabled:L}),w&&i("p",e({className:d.errorMessage},{children:w}))]}))})),a("div",e({className:d.footer},{children:[i("button",e({onClick:v,className:d.cancelBtn,disabled:L},{children:"Cancel"})),i("button",e({onClick:function(){return l(void 0,void 0,void 0,function(){var e,l,i;return r(this,function(r){switch(r.label){case 0:if(!(B.trim()?(E(null),1):(E("".concat(b.replace("*","").trim()," is required")),0)))return[2];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,h(B)];case 2:return r.sent(),v(),[3,4];case 3:return e=r.sent(),console.error("Error in submission",e),409===(null==e?void 0:e.status)?(E(null===(i=null===(l=null==e?void 0:e.response)||void 0===l?void 0:l.data)||void 0===i?void 0:i.message),[2]):(E((null==e?void 0:e.message)||"An error occurred. Please try again."),[3,4]);case 4:return[2]}})})},className:d.confirmBtn,disabled:L},{children:L?a(n,{children:[i(o,{className:d.spinner}),"Save"===N?"Saving...":"Creating..."]}):N}))]}))]}))}))};export{u as default};
1
+ import{__assign as e,__awaiter as a,__generator as r}from"tslib";import{jsx as l,jsxs as i,Fragment as n}from"react/jsx-runtime";import{useState as s,useEffect as t}from"react";import{X as c,Loader2 as o}from"lucide-react";import d from"../styles/CreateLearningSetModal.module.css.js";var u=function(u){var m=u.isOpen,h=u.onClose,p=u.onSubmit,v=u.title,f=u.description,N=u.inputLabel,b=u.submitLabel,g=u.placeholder,C=void 0===g?"":g,y=u.initialValue,k=void 0===y?"":y,L=u.isLoading,S=void 0!==L&&L,x=s(""),B=x[0],j=x[1],M=s(null),q=M[0],w=M[1];if(t(function(){m&&(j(k),w(null))},[m,k]),!m)return null;return l("div",e({className:d.overlay},{children:i("div",e({className:d.modal},{children:[i("div",e({className:d.header},{children:[i("div",e({className:d.headerContent},{children:[l("h2",e({className:d.title},{children:v})),f&&l("p",e({className:d.description},{children:f}))]})),l("button",e({onClick:h,className:d.closeBtn,disabled:S},{children:l(c,{size:24})}))]})),l("div",e({className:d.form},{children:i("div",e({className:d.formGroup},{children:[i("label",e({className:d.label},{children:[l("span",e({className:d.asterisk},{children:"*"})),N]})),l("input",{type:"text",value:B,onChange:function(e){j(e.target.value),q&&w(null)},className:"".concat(d.inputField," ").concat(q?d.inputError:""),placeholder:C,disabled:S}),q&&l("p",e({className:d.errorMessage},{children:q}))]}))})),i("div",e({className:d.footer},{children:[l("button",e({onClick:h,className:d.cancelBtn,disabled:S},{children:"Cancel"})),l("button",e({onClick:function(){return a(void 0,void 0,void 0,function(){var e;return r(this,function(a){switch(a.label){case 0:if(!(B.trim()?(w(null),1):(w("".concat(N.replace("*","").trim()," is required")),0)))return[2];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,p(B)];case 2:return a.sent(),h(),[3,4];case 3:return e=a.sent(),w((null==e?void 0:e.message)||"An error occurred. Please try again."),[3,4];case 4:return[2]}})})},className:d.confirmBtn,disabled:S},{children:S?i(n,{children:[l(o,{className:d.spinner}),"Save"===b?"Saving...":"Creating..."]}):b}))]}))]}))}))};export{u as default};
2
2
  //# sourceMappingURL=CreateLearningSetModal.js.map
@@ -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":""}
@@ -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 p}from"react";import{Dialog as u,Box as d,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 S}from"primereact/toast";import{v4 as y}from"uuid";import{retrieveGenreScopes as C,searchScopes as w,inheritScopeBackwardCompatible as _,createRuleSet as F}from"../../apis/scopeApis.js";import T from"./StationAutocomplete.js";import k from"../CardSkeleton.js";import E from"./OnboardingLoader.js";import z from"./TemplateCard.js";import D from"../../styles/StationOnboardModal.module.css.js";import B from"./InputField.js";import O from"../../store/useAuthStore.js";import{useConfigStore as I}from"../../store/useConfigStore.js";import{useLearningTemplateStore as A}from"../../store/useLearningTemplateStore.js";import{IL_CONFIG_CONSTANTS as R}from"../../config.js";import{useAppSecRolesStore as j}from"../../store/useAppSecRolesStore.js";import L from"../../store/useEnvStore.js";import N from"../../RuleContent/AddScopeApprovalSearchComponent.js";var M=[{label:"PT - Pacific Time",value:"Pacific Time"},{label:"MT - Mountain Time",value:"Mountain Time"},{label:"CT - Central Time",value:"Central Time"},{label:"ET - Eastern Time",value:"Eastern Time"}],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,Z=G.app_integration_id,V=G.token,X=a(null),J=X[0],Q=X[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],pe=se[1],ue=a([]),de=ue[0],fe=ue[1],me=a(""),he=me[0],ge=me[1],xe=a(""),ve=xe[0],be=xe[1],Se=a(!1),ye=Se[0],Ce=Se[1],we=a(!1),_e=we[0],Fe=we[1],Te=a(null),ke=Te[0],Ee=Te[1],ze=a(null);ze[0],ze[1];var De=a(!1),Be=De[0],Oe=De[1],Ie=a(0),Ae=Ie[0],Re=Ie[1],je=a(""),Le=je[0],Ne=je[1],Me=O().user,We=s(null),qe=s(null),Pe=s(null),Ge=s(null);I().configuration;var Ue=s(null),He=j(function(e){return e.roles}),Ke=L(function(e){return e.rbacConfig}),Ye=a("approval_required"),Ze=Ye[0],Ve=Ye[1],Xe=a([]),Je=Xe[0],Qe=Xe[1],$e=a([]),eo=$e[0],oo=$e[1],ro=a(""),no=ro[0],io=ro[1],to=a({region:"",timezone:"",primeTime:[],genre:"",type:"",lowSelloutConfig:""}),lo=to[0],ao=to[1],so=function(e,o){return e.find(function(e){return e.value===o})||null},co=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(!lo.genre)return null;var n=ee.find(function(e){return e.scope_name===lo.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},[lo.genre,ee]);p(function(){return function(){Pe.current&&clearTimeout(Pe.current)}},[]);var uo=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];pe(!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 pe(!1),[7];case 5:return[2]}})})};p(function(){H&&(oe([]),ie(0),ae(!0),uo(0))},[H]);p(function(){ao(J?function(o){var r;return e(e({},o),{region:null!==(r=J.market)&&void 0!==r?r:""})}:{region:"",timezone:"",primeTime:[],genre:"",type:"",lowSelloutConfig:""})},[J]),p(function(){var e=setTimeout(function(){be(he)},500);return function(){return clearTimeout(e)}},[he]),p(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,w({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]===lo.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,lo.genre]),p(function(){!ve.trim()&&po&&Ee(po.id)},[ve,po]);var fo=function(){setTimeout(function(){Ge.current&&Ge.current.scrollTo({top:Ge.current.scrollHeight,behavior:"smooth"})},100)},mo=function(){Ne(""),Q(null),ao({region:"",timezone:"",primeTime:[],genre:"",type:"",lowSelloutConfig:""}),fe([]),ge(""),Ee(null),Ve("approval_required"),Qe([]),oo([]),io(""),K()},ho=function(o,r){var n;if("primeTime"!==o){var i=null!==(n=null==r?void 0:r.value)&&void 0!==n?n:"";ao(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});Ee(e?e.id:null),Fe(!1)},800))}else{var t=(null==r?void 0:r.value)?String(r.value):"";ao(function(o){return e(e({},o),{primeTime:t?[t]:[]})})}},go=Boolean(J&&lo.region&&lo.timezone&&lo.primeTime.length>0&&lo.genre);return i(u,e({open:H,onClose:mo,maxWidth:!1,disableEscapeKeyDown:!0,PaperProps:{sx:{width:"90vw",height:"90vh",borderRadius:"12px",display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"sans-serif"}}},{children:[t(S,{ref:We}),i(d,e({sx:{p:"20px 20px 20px 27px",borderBottom:"1px solid #F0F2F5",display:"flex",justifyContent:"space-between",alignItems:"center",bgcolor:"#fff"}},{children:[i(d,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:mo,disabled:Be,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(E,{isLoading:Be,currentStep:Ae,onComplete:function(){Oe(!1);var e=qe.current;mo(),Y(e||void 0),qe.current=null}}),t(d,e({sx:{display:"flex",flex:1,flexDirection:"column",paddingY:"14px",paddingX:"20px",gap:2,overflowY:"auto"}},{children:i(d,e({sx:{display:"flex",gap:3}},{children:[i(d,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(d,e({sx:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[i(d,e({className:D.formGroup},{children:[i("label",e({className:D.label},{children:[t("span",e({className:D.asterisk},{children:"*"})),"Station Name/Call Letters"]})),t(T,{value:Le,onChange:Ne,onStationSelect:function(e){return Q(e)}})]})),t(B,{required:!0,disabled:!0,label:"Region",placeholder:"Select Region",value:lo.region||void 0,isSearchable:!1}),t(B,{required:!0,label:"TimeZone",placeholder:"Select TimeZone",options:M,value:so(M,lo.timezone),onOptionChange:function(e){return ho("timezone",e)},isSearchable:!1}),t(B,{required:!0,label:"Prime Time Window",placeholder:"Select Prime Time",options:W,value:so(W,(null===(U=lo.primeTime)||void 0===U?void 0:U[0])||""),onOptionChange:function(e){return ho("primeTime",e)},isSearchable:!1}),t(d,e({onClick:fo,sx:{width:"100%"}},{children:t(B,{label:"Station Type",placeholder:"None",options:q,value:so(q,lo.type),onOptionChange:function(o){ho("type",o),"Low Sellout"!==(null==o?void 0:o.value)&&ao(function(o){return e(e({},o),{lowSelloutConfig:""})})},isSearchable:!1})})),"Low Sellout"===lo.type&&t(d,e({onClick:fo,sx:{width:"100%"}},{children:t(B,{label:"Low Sell Out Configurations",placeholder:"Select Configuration",options:P,value:so(P,lo.lowSelloutConfig),onOptionChange:function(e){return ho("lowSelloutConfig",e)},isSearchable:!1})})),A.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"===Ze,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:"4px",marginBottom:"8px"},onClick:function(){return Ve("approval_required")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||Ve("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"===Ze?"#2563EB":"#CBD5E1")}},{children:"approval_required"===Ze&&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"===Ze&&t(N,{selectedApprovers:Je,selectedGroupOfApprovers:eo,onApproversChange:function(e){Qe(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"===Ze,tabIndex:0,style:{cursor:"pointer",display:"flex",flexDirection:"column",gap:"4px"},onClick:function(){Ve("publish_without"),io("")},onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key||(Ve("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"===Ze?"#2563EB":"#CBD5E1")}},{children:"publish_without"===Ze&&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(d,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(d,e({sx:{mb:2}},{children:t(B,{required:!0,label:"",placeholder:"Select Genre",options:co,value:so(co,lo.genre),onOptionChange:function(e){return ho("genre",e)},isSearchable:!1,onMenuScrollToBottom:function(){!ce&&le&&uo(ne)},isLoadingOptions:ce,hasMoreOptions:le})})),t(d,e({sx:{mb:3}},{children:_e?t(k,{}):po?i(d,e({sx:{border:"1.5px solid #2563EB",borderRadius:"10px",p:"14px 16px",bgcolor:"#EFF6FF",display:"flex",alignItems:"flex-start",gap:"12px"}},{children:[t(d,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(d,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(d,e({sx:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"}},{children:[po.inheritedText&&i(d,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(d,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(d,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"]}))]}))]}))]})):lo.genre?null:t(d,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"}))}))})),lo.genre&&i(l,{children:[i(f,e({sx:{fontSize:"1rem",fontWeight:600,mb:.5,color:"#19213D"}},{children:["Select an Existing Station from the “",lo.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 “",lo.genre,"” category to copy its learnings."]})),i("div",e({className:D.searchWrapper,style:{marginBottom:"12px"}},{children:[t("input",{type:"text",value:he,onChange:function(e){return ge(e.target.value)},placeholder:"Search for station...",className:D.searchInput}),t(v,{className:D.searchIcon,size:16})]})),i(d,e({sx:{display:"flex",flexDirection:"column",gap:2}},{children:[ye&&t(k,{}),!ye&&0===de.length&&ve.trim()&&i(f,e({sx:{fontSize:"0.875rem",color:"#64748B",textAlign:"center",py:4}},{children:['No scopes found matching "',ve,'".']})),!ye&&de.map(function(o){return t(z,e({},o,{isSelected:ke===o.id,onSelect:function(e){var o;Ee(ke===e?null!==(o=null==po?void 0:po.id)&&void 0!==o?o:null:e)}}),o.id)})]}))]})]}))]}))}))]})),i(d,e({sx:{p:"12px 20px",borderTop:"1px solid #F0F2F5",display:"flex",justifyContent:"flex-end",gap:2,bgcolor:"#fff"}},{children:[t("button",e({onClick:mo,disabled:Be,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,p,u,d,f,m,h,g,x,v,b,S;return r(this,function(r){switch(r.label){case 0:if(!J||!ke)return console.error("[StationOnboard] Missing required data for onboarding"),[2];if(A.getState().backwardCompatibility&&"approval_required"===Ze&&0===Je.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],de,!0):de,o=e.find(function(e){return e.id===ke}),null==o?void 0:o.isCopy,Oe(!0),Re(0),i=null,r.label=1;case 1:return r.trys.push([1,3,,4]),t=A.getState().backwardCompatibility,l=t?{topic:"customRuleSet",customScopeGroupName:R.CUSTOM_SCOPE_GROUP_NAME,scopeDescription:J.station_name||"New Station",parentScopeId:null!==(d=null==po?void 0:po.id)&&void 0!==d?d:null,customScopeName:J.station_name||"New Station",customScopeId:y(),createByName:(null==Me?void 0:Me.firstname)||"System",createdBy:(null==Me?void 0:Me.email)||"system@audacy.com",scopeType:"Station",approvalRequired:"approval_required"===Ze,audacyStationMetadata:{genre:lo.genre,low_sellout_configurations:"Low Sellout"===lo.type?lo.lowSelloutConfig:null,market:J.market,primetime_windows:lo.primeTime,region:J.region,station_guid:J.station_guid,station_type:""===lo.type?null:lo.type},appsecData:{application:null==Ke?void 0:Ke.applicationId,module:null==Ke?void 0:Ke.moduleId,roles:n(n([],"approval_required"===Ze?[{users:Je.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==Me?void 0:Me.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:J.station_name||"New Station",scopeReferenceMetadata:{},applicationMappingId:Z},console.log("[StationOnboard] Step 1: Creating rule set with payload:",l),[4,F(l,V)];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),Re(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."}),Oe(!1),Re(0),[2];case 4:return r.trys.push([4,6,,7]),c=null!==ke&&ke!==(null==po?void 0:po.id),p={source_scope_id:c?ke:null!==(b=null==po?void 0:po.id)&&void 0!==b?b:ke,target_scope_id:i,is_copy_parent_variant_id:c},console.log("[StationOnboard] Step 3: Inheriting scope with payload:",p),[4,_(p)];case 5:return r.sent(),console.log("[StationOnboard] Step 3 Complete: Scope inherited"),Re(3),[3,7];case 6:return u=r.sent(),console.error("[StationOnboard] Error inheriting scope (no rollback):",u),null===(S=We.current)||void 0===S||S.show({severity:"error",life:3e3,summary:"Error",detail:"Failed to apply rule template. Please try again."}),Oe(!1),Re(0),[2];case 7:return qe.current=i,console.log("[StationOnboard] Onboarding completed successfully!"),[2]}})})},disabled:!go||Be,style:{padding:"7px 10px",borderRadius:"6px",border:"none",backgroundColor:go?"#2563EB":"#BFDBFE",color:"#fff",cursor:go&&!Be?"pointer":"not-allowed",fontSize:"14px",fontWeight:500,display:"flex",alignItems:"center",gap:"7px"}},{children:i(l,Be?{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 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};
2
2
  //# sourceMappingURL=StationOnboardModal.js.map
@@ -1,2 +1,2 @@
1
- import"react";var a={TAB:"tab",RULESET_ID:"rulesetid",SECTION:"section",OPEN_IL:"openil",ONBOARD_STATION:"onboardstation",VARIANT_ID:"variantid",APPROVAL_ACTION:"approval"},t=function(a){return new URLSearchParams(window.location.search).get(a)},n=function(a){var t=new URLSearchParams(window.location.search);Object.entries(a).forEach(function(a){var n=a[0],o=a[1];null==o||""===o?t.delete(n):t.set(n,o)});var n=t.toString(),o="".concat(window.location.pathname).concat(n?"?".concat(n):"");window.history.replaceState({},"",o)};export{a as QUERY_PARAM_KEYS,t as getQueryParam,n as setQueryParams};
1
+ import"react";var a={TAB:"tab",RULESET_ID:"rulesetid",SECTION:"section",OPEN_IL:"openil",ONBOARD_STATION:"onboardstation",STATION_NAME:"stationname",VARIANT_ID:"variantid",APPROVAL_ACTION:"approval"},t=function(a){return new URLSearchParams(window.location.search).get(a)},n=function(a){var t=new URLSearchParams(window.location.search);Object.entries(a).forEach(function(a){var n=a[0],o=a[1];null==o||""===o?t.delete(n):t.set(n,o)});var n=t.toString(),o="".concat(window.location.pathname).concat(n?"?".concat(n):"");window.history.replaceState({},"",o)};export{a as QUERY_PARAM_KEYS,t as getQueryParam,n as setQueryParams};
2
2
  //# sourceMappingURL=useLearningTemplateQueryParams.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as t,__spreadArray as e}from"tslib";import{create as n}from"zustand";import{getQueryParam as r,setQueryParams as u,QUERY_PARAM_KEYS as a}from"../hooks/useLearningTemplateQueryParams.js";var i={globalRuleSet:[],genreRuleSet:[],customRuleSet:[]},o=n(function(n){return{sidebarTab:"rule-sets",selectedRuleSetId:null,ruleSets:i,isStationModalOpen:!1,isILModalTriggered:"true"===r(a.OPEN_IL),isStationOnboardModalTriggered:"true"===r(a.ONBOARD_STATION),scopeTreeData:null,urlVariantId:r(a.VARIANT_ID),urlApprovalAction:(o=r(a.APPROVAL_ACTION),"approve"===o||"reject"===o?o:null),stations:[],selectedStationId:null,currentRules:[],createdVariantInfo:null,templateMap:{},setTemplateData:function(e,r){return n(function(n){var u;return{templateMap:t(t({},n.templateMap),(u={},u[e]=r,u))}})},setRuleSets:function(t){return n({ruleSets:t})},setScopeTreeData:function(t){return n({scopeTreeData:t})},setStationModalOpen:function(t){return n({isStationModalOpen:t})},setIsILModalTriggered:function(t){var e;u(((e={})[a.OPEN_IL]=t?"true":null,e)),n({isILModalTriggered:t})},setIsStationOnboardModalTriggered:function(t){var e;u(((e={})[a.ONBOARD_STATION]=t?"true":null,e)),n({isStationOnboardModalTriggered:t})},setInitialRules:function(t){return n({currentRules:t})},setCreatedVariantInfo:function(t){return n({createdVariantInfo:t})},resetCreatedVariantInfo:function(){return n({createdVariantInfo:null})},clearUrlApprovalParams:function(){var t;u(((t={})[a.VARIANT_ID]=null,t[a.APPROVAL_ACTION]=null,t)),n({urlVariantId:null,urlApprovalAction:null})},rawAuditRuleData:null,setRawAuditRuleData:function(t){return n({rawAuditRuleData:t})},setSelectedRuleSetId:function(t){var e;u(((e={})[a.RULESET_ID]=t,e)),n({selectedRuleSetId:t})},toggleRuleTier:function(e){return n(function(n){return{currentRules:n.currentRules.map(function(n){return n.id===e?t(t({},n),{isOpen:!n.isOpen}):n})}})},deleteRule:function(e,r){return n(function(n){return{currentRules:n.currentRules.map(function(n){return n.id===e?t(t({},n),{rules:n.rules.filter(function(t){return t.id!==r}),ruleCount:n.ruleCount-1}):n})}})},setStations:function(t){return n({stations:t})},addStation:function(t){return n(function(n){return{stations:e(e([],n.stations,!0),[t],!1)}})},deleteStation:function(t){return n(function(e){return{stations:e.stations.filter(function(e){return e.stationId!==t}),selectedStationId:e.selectedStationId===t?null:e.selectedStationId}})},error:null,setError:function(t){return n({error:t})},tiers:[],setTiers:function(t){return n({tiers:t})},backwardCompatibility:!1,setBackwardCompatibility:function(t){return n({backwardCompatibility:t})},app_integration_id:null,setAppIntegrationId:function(t){return n({app_integration_id:t})},token:"",setToken:function(t){return n({token:t})}};var o});export{i as INITIAL_RULE_SETS,o as useLearningTemplateStore};
1
+ import{__assign as t,__spreadArray as e}from"tslib";import{create as n}from"zustand";import{getQueryParam as r,setQueryParams as a,QUERY_PARAM_KEYS as u}from"../hooks/useLearningTemplateQueryParams.js";var i={globalRuleSet:[],genreRuleSet:[],customRuleSet:[]},o=n(function(n){return{sidebarTab:"rule-sets",selectedRuleSetId:null,ruleSets:i,isStationModalOpen:!1,isILModalTriggered:"true"===r(u.OPEN_IL),isStationOnboardModalTriggered:"true"===r(u.ONBOARD_STATION),scopeTreeData:null,urlVariantId:r(u.VARIANT_ID),urlApprovalAction:(o=r(u.APPROVAL_ACTION),"approve"===o||"reject"===o?o:null),stationNameParam:r(u.STATION_NAME),stations:[],selectedStationId:null,currentRules:[],createdVariantInfo:null,templateMap:{},setTemplateData:function(e,r){return n(function(n){var a;return{templateMap:t(t({},n.templateMap),(a={},a[e]=r,a))}})},setRuleSets:function(t){return n({ruleSets:t})},setScopeTreeData:function(t){return n({scopeTreeData:t})},setStationModalOpen:function(t){return n({isStationModalOpen:t})},setIsILModalTriggered:function(t){var e;a(((e={})[u.OPEN_IL]=t?"true":null,e)),n({isILModalTriggered:t})},setIsStationOnboardModalTriggered:function(e){var r,i;a(t(((r={})[u.ONBOARD_STATION]=e?"true":null,r),e?{}:((i={})[u.STATION_NAME]=null,i))),n(t({isStationOnboardModalTriggered:e},e?{}:{stationNameParam:null}))},setStationNameParam:function(t){var e;a(((e={})[u.STATION_NAME]=t,e)),n({stationNameParam:t})},setInitialRules:function(t){return n({currentRules:t})},setCreatedVariantInfo:function(t){return n({createdVariantInfo:t})},resetCreatedVariantInfo:function(){return n({createdVariantInfo:null})},clearUrlApprovalParams:function(){var t;a(((t={})[u.VARIANT_ID]=null,t[u.APPROVAL_ACTION]=null,t)),n({urlVariantId:null,urlApprovalAction:null})},rawAuditRuleData:null,setRawAuditRuleData:function(t){return n({rawAuditRuleData:t})},setSelectedRuleSetId:function(t){var e;a(((e={})[u.RULESET_ID]=t,e)),n({selectedRuleSetId:t})},toggleRuleTier:function(e){return n(function(n){return{currentRules:n.currentRules.map(function(n){return n.id===e?t(t({},n),{isOpen:!n.isOpen}):n})}})},deleteRule:function(e,r){return n(function(n){return{currentRules:n.currentRules.map(function(n){return n.id===e?t(t({},n),{rules:n.rules.filter(function(t){return t.id!==r}),ruleCount:n.ruleCount-1}):n})}})},setStations:function(t){return n({stations:t})},addStation:function(t){return n(function(n){return{stations:e(e([],n.stations,!0),[t],!1)}})},deleteStation:function(t){return n(function(e){return{stations:e.stations.filter(function(e){return e.stationId!==t}),selectedStationId:e.selectedStationId===t?null:e.selectedStationId}})},error:null,setError:function(t){return n({error:t})},tiers:[],setTiers:function(t){return n({tiers:t})},backwardCompatibility:!1,setBackwardCompatibility:function(t){return n({backwardCompatibility:t})},app_integration_id:null,setAppIntegrationId:function(t){return n({app_integration_id:t})},token:"",setToken:function(t){return n({token:t})}};var o});export{i as INITIAL_RULE_SETS,o as useLearningTemplateStore};
2
2
  //# sourceMappingURL=useLearningTemplateStore.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LearningTemplateLayout.d.ts","sourceRoot":"","sources":["../../../../../src/features/LearningManagement/LearningTemplateLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAK7F,UAAU,2BAA2B;IACnC,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,iGAAiG;IACjG,iBAAiB,EAAE,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACpE,aAAa,CAAC,EAAE,kBAAkB,CAAC;IACnC,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,UAAU,EAAE,UAAU,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9F,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/D,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;IACrF,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC;IAC9C,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC;IAC5C,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC;IAC9C,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/D,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;IAC/C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACrC,eAAe,CAAC,EAAE,cAAc,EAAE,CAAC;IACnC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;GAKG;AACH,QAAA,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC,2BAA2B,CA6FjE,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
1
+ {"version":3,"file":"LearningTemplateLayout.d.ts","sourceRoot":"","sources":["../../../../../src/features/LearningManagement/LearningTemplateLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAQzC,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAK7F,UAAU,2BAA2B;IACnC,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,iGAAiG;IACjG,iBAAiB,EAAE,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACpE,aAAa,CAAC,EAAE,kBAAkB,CAAC;IACnC,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,UAAU,EAAE,UAAU,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9F,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/D,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;IACrF,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC;IAC9C,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC;IAC5C,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC;IAC9C,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/D,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;IAC/C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACrC,eAAe,CAAC,EAAE,cAAc,EAAE,CAAC;IACnC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;GAKG;AACH,QAAA,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC,2BAA2B,CAuGjE,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
@@ -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"}
@@ -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;AAqEpE,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,CA2+B3D,CAAC;AAEF,eAAe,mBAAmB,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;AAsEpE,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,CAmgC3D,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
@@ -12,6 +12,8 @@ export declare const QUERY_PARAM_KEYS: {
12
12
  readonly OPEN_IL: "openil";
13
13
  /** Whether to open the Station Onboarding modal automatically */
14
14
  readonly ONBOARD_STATION: "onboardstation";
15
+ /** Prefilled station name for onboarding */
16
+ readonly STATION_NAME: "stationname";
15
17
  /** Variant ID to auto-open its parent rule accordion */
16
18
  readonly VARIANT_ID: "variantid";
17
19
  /** Approval action to auto-trigger on the variant: 'approve' | 'reject' */
@@ -1 +1 @@
1
- {"version":3,"file":"useLearningTemplateQueryParams.d.ts","sourceRoot":"","sources":["../../../../../../src/features/LearningManagement/hooks/useLearningTemplateQueryParams.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,gBAAgB;IAC3B,mDAAmD;;IAEnD,sCAAsC;;IAEtC,uDAAuD;;IAEvD,+DAA+D;;IAE/D,iEAAiE;;IAEjE,wDAAwD;;IAExD,2EAA2E;;CAEnE,CAAC;AAEX;;GAEG;AACH,KAAK,UAAU,GAAG,WAAW,GAAG,UAAU,CAAC;AAE3C;;;;GAIG;AACH,eAAO,MAAM,aAAa,QAAS,MAAM,KAAG,MAAM,GAAG,IAGpD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc,YAAa,OAAO,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,KAAG,IAcvE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B;yBAKC,UAAU,GAAG,IAAI;+BAYX,MAAM,GAAG,IAAI;mBAQvB,UAAU,KAAG,IAAI;wBAQZ,MAAM,GAAG,IAAI,KAAG,IAAI;CAU5D,CAAC"}
1
+ {"version":3,"file":"useLearningTemplateQueryParams.d.ts","sourceRoot":"","sources":["../../../../../../src/features/LearningManagement/hooks/useLearningTemplateQueryParams.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,gBAAgB;IAC3B,mDAAmD;;IAEnD,sCAAsC;;IAEtC,uDAAuD;;IAEvD,+DAA+D;;IAE/D,iEAAiE;;IAEjE,4CAA4C;;IAE5C,wDAAwD;;IAExD,2EAA2E;;CAEnE,CAAC;AAEX;;GAEG;AACH,KAAK,UAAU,GAAG,WAAW,GAAG,UAAU,CAAC;AAE3C;;;;GAIG;AACH,eAAO,MAAM,aAAa,QAAS,MAAM,KAAG,MAAM,GAAG,IAGpD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc,YAAa,OAAO,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,KAAG,IAcvE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B;yBAKC,UAAU,GAAG,IAAI;+BAYX,MAAM,GAAG,IAAI;mBAQvB,UAAU,KAAG,IAAI;wBAQZ,MAAM,GAAG,IAAI,KAAG,IAAI;CAU5D,CAAC"}
@@ -19,6 +19,7 @@ interface RuleTemplateState {
19
19
  scopeTreeData: ScopesTreeResponse | null;
20
20
  rawAuditRuleData: any | null;
21
21
  setRawAuditRuleData: (data: any) => void;
22
+ stationNameParam: string | null;
22
23
  stations: StationItem[];
23
24
  selectedStationId: string | null;
24
25
  currentRules: RuleTier[];
@@ -34,6 +35,7 @@ interface RuleTemplateState {
34
35
  setTemplateData: (appIntegrationId: string, templateName: string) => void;
35
36
  setRuleSets: (rules: AllRuleSetsResponse) => void;
36
37
  setScopeTreeData: (data: ScopesTreeResponse | null) => void;
38
+ setStationNameParam: (stationName: string | null) => void;
37
39
  setStationModalOpen: (open: boolean) => void;
38
40
  setIsILModalTriggered: (trigger: boolean) => void;
39
41
  setIsStationOnboardModalTriggered: (trigger: boolean) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"useLearningTemplateStore.d.ts","sourceRoot":"","sources":["../../../../../../src/features/LearningManagement/store/useLearningTemplateStore.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,WAAW,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAIhG,sEAAsE;AACtE,MAAM,WAAW,kBAAkB;IACjC,6CAA6C;IAC7C,QAAQ,EAAE,MAAM,CAAC;IACjB,uCAAuC;IACvC,QAAQ,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,KAAK,GAAG,UAAU,CAAA;KAAE,EAAE,CAAC;CACxD;AACD,UAAU,iBAAiB;IAEzB,UAAU,EAAE,WAAW,GAAG,UAAU,CAAC;IACrC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,8BAA8B,EAAE,OAAO,CAAC;IACxC,aAAa,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACzC,gBAAgB,EAAE,GAAG,GAAG,IAAI,CAAC;IAC7B,mBAAmB,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;IAEzC,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IAGjC,YAAY,EAAE,QAAQ,EAAE,CAAC;IAGzB,gEAAgE;IAChE,kBAAkB,EAAE,kBAAkB,EAAE,GAAG,IAAI,CAAC;IAEhD,0EAA0E;IAC1E,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,+FAA+F;IAC/F,iBAAiB,EAAE,SAAS,GAAG,QAAQ,GAAG,IAAI,CAAC;IAC/C,wEAAwE;IACxE,sBAAsB,EAAE,MAAM,IAAI,CAAC;IAEnC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEpC,eAAe,EAAE,CACf,gBAAgB,EAAE,MAAM,EACxB,YAAY,EAAE,MAAM,KACjB,IAAI,CAAC;IAGV,WAAW,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAClD,gBAAgB,EAAE,CAAC,IAAI,EAAE,kBAAkB,GAAG,IAAI,KAAK,IAAI,CAAC;IAC5D,mBAAmB,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7C,qBAAqB,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAClD,iCAAiC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC9D,oBAAoB,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAClD,cAAc,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACrD,eAAe,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,IAAI,CAAC;IAE7C,iDAAiD;IACjD,qBAAqB,EAAE,CAAC,IAAI,EAAE,kBAAkB,EAAE,GAAG,IAAI,KAAK,IAAI,CAAC;IACnE,mCAAmC;IACnC,uBAAuB,EAAE,MAAM,IAAI,CAAC;IAGpC,WAAW,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,KAAK,IAAI,CAAC;IAC/C,UAAU,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;IAC3C,aAAa,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAEpC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACzC,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,QAAQ,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;IACpC,qBAAqB,EAAE,OAAO,CAAC;IAC/B,wBAAwB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACnD,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,mBAAmB,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACjD,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED,eAAO,MAAM,iBAAiB,EAAE,mBAI/B,CAAC;AAEF,eAAO,MAAM,wBAAwB,gFAqGlC,CAAC"}
1
+ {"version":3,"file":"useLearningTemplateStore.d.ts","sourceRoot":"","sources":["../../../../../../src/features/LearningManagement/store/useLearningTemplateStore.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,WAAW,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAIhG,sEAAsE;AACtE,MAAM,WAAW,kBAAkB;IACjC,6CAA6C;IAC7C,QAAQ,EAAE,MAAM,CAAC;IACjB,uCAAuC;IACvC,QAAQ,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,KAAK,GAAG,UAAU,CAAA;KAAE,EAAE,CAAC;CACxD;AACD,UAAU,iBAAiB;IAEzB,UAAU,EAAE,WAAW,GAAG,UAAU,CAAC;IACrC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,8BAA8B,EAAE,OAAO,CAAC;IACxC,aAAa,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACzC,gBAAgB,EAAE,GAAG,GAAG,IAAI,CAAC;IAC7B,mBAAmB,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;IACzC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAEhC,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IAGjC,YAAY,EAAE,QAAQ,EAAE,CAAC;IAGzB,gEAAgE;IAChE,kBAAkB,EAAE,kBAAkB,EAAE,GAAG,IAAI,CAAC;IAEhD,0EAA0E;IAC1E,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,+FAA+F;IAC/F,iBAAiB,EAAE,SAAS,GAAG,QAAQ,GAAG,IAAI,CAAC;IAC/C,wEAAwE;IACxE,sBAAsB,EAAE,MAAM,IAAI,CAAC;IAEnC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEpC,eAAe,EAAE,CACf,gBAAgB,EAAE,MAAM,EACxB,YAAY,EAAE,MAAM,KACjB,IAAI,CAAC;IAGV,WAAW,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAClD,gBAAgB,EAAE,CAAC,IAAI,EAAE,kBAAkB,GAAG,IAAI,KAAK,IAAI,CAAC;IAC5D,mBAAmB,EAAE,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC1D,mBAAmB,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7C,qBAAqB,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAClD,iCAAiC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC9D,oBAAoB,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAClD,cAAc,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACrD,eAAe,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,IAAI,CAAC;IAE7C,iDAAiD;IACjD,qBAAqB,EAAE,CAAC,IAAI,EAAE,kBAAkB,EAAE,GAAG,IAAI,KAAK,IAAI,CAAC;IACnE,mCAAmC;IACnC,uBAAuB,EAAE,MAAM,IAAI,CAAC;IAGpC,WAAW,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,KAAK,IAAI,CAAC;IAC/C,UAAU,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;IAC3C,aAAa,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAEpC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACzC,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,QAAQ,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;IACpC,qBAAqB,EAAE,OAAO,CAAC;IAC/B,wBAAwB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACnD,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,mBAAmB,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACjD,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED,eAAO,MAAM,iBAAiB,EAAE,mBAI/B,CAAC;AAEF,eAAO,MAAM,wBAAwB,gFAgHlC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-llm-studio/instant-learning",
3
- "version": "1.3.0-alpha.24",
3
+ "version": "1.3.0-alpha.26",
4
4
  "author": "Devesh Patel",
5
5
  "description": "",
6
6
  "license": "MIT",