@e-llm-studio/instant-learning 1.3.0-alpha.4 → 1.3.0-alpha.41

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 (172) hide show
  1. package/README.md +195 -5
  2. package/dist/cjs/features/IL-OTJ/ILOTJTest.js +1 -1
  3. package/dist/cjs/features/IL-OTJ/ValueTypeWrappers/TeachMePlugin.js +1 -1
  4. package/dist/cjs/features/IL-OTJ/ValueTypeWrappers/TeachMeWrapper.js +1 -1
  5. package/dist/cjs/features/IL-OTJ/_components/CitationLink.js +1 -1
  6. package/dist/cjs/features/IL-OTJ/_components/MarkdownRenderer.js +2 -0
  7. package/dist/cjs/features/IL-OTJ/_components/MarkdownRenderer.js.map +1 -0
  8. package/dist/cjs/features/IL-OTJ/_components/MarkdownRenderer.module.css.js +2 -0
  9. package/dist/cjs/features/IL-OTJ/_components/MarkdownRenderer.module.css.js.map +1 -0
  10. package/dist/cjs/features/IL-OTJ/_components/MessageRendering/ClickableChatComponents.js +1 -1
  11. package/dist/cjs/features/IL-OTJ/_components/MessageRendering/RuleValidationCard.js +1 -1
  12. package/dist/cjs/features/IL-OTJ/_components/templates/RuleComparison/AgentComposerRuleComparison.js +1 -1
  13. package/dist/cjs/features/IL-OTJ/_components/templates/RuleComparison/RuleComparison.js +1 -1
  14. package/dist/cjs/features/IL-OTJ/_components/templates/RuleComparison/RuleComparisonNew.js +1 -1
  15. package/dist/cjs/features/IL-OTJ/_components/templates/TrafficManager/CreateRule.js +1 -1
  16. package/dist/cjs/features/LearningManagement/AuditLog/AuditLog.js +1 -1
  17. package/dist/cjs/features/LearningManagement/AuditLog/ChangeLogDiff.js +2 -0
  18. package/dist/cjs/features/LearningManagement/AuditLog/ChangeLogDiff.js.map +1 -0
  19. package/dist/cjs/features/LearningManagement/LearningManagement.js +1 -1
  20. package/dist/cjs/features/LearningManagement/LearningTemplateLayout.js +1 -1
  21. package/dist/cjs/features/LearningManagement/RBAC/AccessManagementPanel.js +1 -1
  22. package/dist/cjs/features/LearningManagement/RuleContent/AddScopeApprovalSearchComponent.js +1 -1
  23. package/dist/cjs/features/LearningManagement/RuleContent/AddScopeModal.js +1 -1
  24. package/dist/cjs/features/LearningManagement/RuleContent/ApprovalLearningDialog.js +1 -1
  25. package/dist/cjs/features/LearningManagement/RuleContent/ContentLogic.js +1 -1
  26. package/dist/cjs/features/LearningManagement/RuleContent/RuleAccordionHeader.js +1 -1
  27. package/dist/cjs/features/LearningManagement/RuleContent/RuleContent.js +1 -1
  28. package/dist/cjs/features/LearningManagement/RuleContent/RuleHeader.js +1 -1
  29. package/dist/cjs/features/LearningManagement/RuleContent/RuleTierList.js +1 -1
  30. package/dist/cjs/features/LearningManagement/RuleContent/TierCard.js +1 -1
  31. package/dist/cjs/features/LearningManagement/RuleContent/VariantCard.js +1 -1
  32. package/dist/cjs/features/LearningManagement/Sidebar.js +1 -1
  33. package/dist/cjs/features/LearningManagement/apis/apiConfig.js +1 -1
  34. package/dist/cjs/features/LearningManagement/apis/scopeApis.js +1 -1
  35. package/dist/cjs/features/LearningManagement/components/ConfirmationModal.js +1 -1
  36. package/dist/cjs/features/LearningManagement/components/CreateRuleSetLegacyModal.js +1 -1
  37. package/dist/cjs/features/LearningManagement/components/InstantLearningModal.js +1 -1
  38. package/dist/cjs/features/LearningManagement/components/ScopeTree/TreeNode.js +1 -1
  39. package/dist/cjs/features/LearningManagement/components/StationOnboarding/StationOnboardModal.js +1 -1
  40. package/dist/cjs/features/LearningManagement/config.js +1 -1
  41. package/dist/cjs/features/LearningManagement/constants.js +2 -0
  42. package/dist/cjs/features/LearningManagement/constants.js.map +1 -0
  43. package/dist/cjs/features/LearningManagement/hooks/useLearningTemplateQueryParams.js +1 -1
  44. package/dist/cjs/features/LearningManagement/queries/useLMSConfigQuery.js +2 -0
  45. package/dist/cjs/features/LearningManagement/queries/useLMSConfigQuery.js.map +1 -0
  46. package/dist/cjs/features/LearningManagement/store/useLMSConfigStore.js +2 -0
  47. package/dist/cjs/features/LearningManagement/store/useLMSConfigStore.js.map +1 -0
  48. package/dist/cjs/features/LearningManagement/store/useLearningTemplateStore.js +1 -1
  49. package/dist/cjs/features/LearningManagement/store/usePermissionsStore.js +1 -1
  50. package/dist/cjs/features/LearningManagement/styles/TierCard.module.css.js +1 -1
  51. package/dist/cjs/index.js +1 -1
  52. package/dist/cjs/plugins/ValueTypes/Default/DefaultTeachMeRenderer.js +1 -1
  53. package/dist/cjs/plugins/ValueTypes/Guidelines/GuidelinesTeachMeRenderer.js +1 -1
  54. package/dist/features/IL-OTJ/ILOTJTest.js +1 -1
  55. package/dist/features/IL-OTJ/ValueTypeWrappers/TeachMePlugin.js +1 -1
  56. package/dist/features/IL-OTJ/ValueTypeWrappers/TeachMeWrapper.js +1 -1
  57. package/dist/features/IL-OTJ/_components/CitationLink.js +1 -1
  58. package/dist/features/IL-OTJ/_components/MarkdownRenderer.js +2 -0
  59. package/dist/features/IL-OTJ/_components/MarkdownRenderer.js.map +1 -0
  60. package/dist/features/IL-OTJ/_components/MarkdownRenderer.module.css.js +2 -0
  61. package/dist/features/IL-OTJ/_components/MarkdownRenderer.module.css.js.map +1 -0
  62. package/dist/features/IL-OTJ/_components/MessageRendering/ClickableChatComponents.js +1 -1
  63. package/dist/features/IL-OTJ/_components/MessageRendering/RuleValidationCard.js +1 -1
  64. package/dist/features/IL-OTJ/_components/templates/RuleComparison/AgentComposerRuleComparison.js +1 -1
  65. package/dist/features/IL-OTJ/_components/templates/RuleComparison/RuleComparison.js +1 -1
  66. package/dist/features/IL-OTJ/_components/templates/RuleComparison/RuleComparisonNew.js +1 -1
  67. package/dist/features/IL-OTJ/_components/templates/TrafficManager/CreateRule.js +1 -1
  68. package/dist/features/LearningManagement/AuditLog/AuditLog.js +1 -1
  69. package/dist/features/LearningManagement/AuditLog/ChangeLogDiff.js +2 -0
  70. package/dist/features/LearningManagement/AuditLog/ChangeLogDiff.js.map +1 -0
  71. package/dist/features/LearningManagement/LearningManagement.js +1 -1
  72. package/dist/features/LearningManagement/LearningTemplateLayout.js +1 -1
  73. package/dist/features/LearningManagement/RBAC/AccessManagementPanel.js +1 -1
  74. package/dist/features/LearningManagement/RuleContent/AddScopeApprovalSearchComponent.js +1 -1
  75. package/dist/features/LearningManagement/RuleContent/AddScopeModal.js +1 -1
  76. package/dist/features/LearningManagement/RuleContent/ApprovalLearningDialog.js +1 -1
  77. package/dist/features/LearningManagement/RuleContent/ContentLogic.js +1 -1
  78. package/dist/features/LearningManagement/RuleContent/RuleAccordionHeader.js +1 -1
  79. package/dist/features/LearningManagement/RuleContent/RuleContent.js +1 -1
  80. package/dist/features/LearningManagement/RuleContent/RuleHeader.js +1 -1
  81. package/dist/features/LearningManagement/RuleContent/RuleTierList.js +1 -1
  82. package/dist/features/LearningManagement/RuleContent/TierCard.js +1 -1
  83. package/dist/features/LearningManagement/RuleContent/VariantCard.js +1 -1
  84. package/dist/features/LearningManagement/Sidebar.js +1 -1
  85. package/dist/features/LearningManagement/apis/apiConfig.js +1 -1
  86. package/dist/features/LearningManagement/apis/scopeApis.js +1 -1
  87. package/dist/features/LearningManagement/components/ConfirmationModal.js +1 -1
  88. package/dist/features/LearningManagement/components/CreateRuleSetLegacyModal.js +1 -1
  89. package/dist/features/LearningManagement/components/InstantLearningModal.js +1 -1
  90. package/dist/features/LearningManagement/components/ScopeTree/TreeNode.js +1 -1
  91. package/dist/features/LearningManagement/components/StationOnboarding/StationOnboardModal.js +1 -1
  92. package/dist/features/LearningManagement/config.js +1 -1
  93. package/dist/features/LearningManagement/constants.js +2 -0
  94. package/dist/features/LearningManagement/constants.js.map +1 -0
  95. package/dist/features/LearningManagement/hooks/useLearningTemplateQueryParams.js +1 -1
  96. package/dist/features/LearningManagement/queries/useLMSConfigQuery.js +2 -0
  97. package/dist/features/LearningManagement/queries/useLMSConfigQuery.js.map +1 -0
  98. package/dist/features/LearningManagement/store/useLMSConfigStore.js +2 -0
  99. package/dist/features/LearningManagement/store/useLMSConfigStore.js.map +1 -0
  100. package/dist/features/LearningManagement/store/useLearningTemplateStore.js +1 -1
  101. package/dist/features/LearningManagement/store/usePermissionsStore.js +1 -1
  102. package/dist/features/LearningManagement/styles/TierCard.module.css.js +1 -1
  103. package/dist/index.js +1 -1
  104. package/dist/plugins/ValueTypes/Default/DefaultTeachMeRenderer.js +1 -1
  105. package/dist/plugins/ValueTypes/Guidelines/GuidelinesTeachMeRenderer.js +1 -1
  106. package/dist/types/src/features/IL-OTJ/ILOTJTest.d.ts +597 -0
  107. package/dist/types/src/features/IL-OTJ/ILOTJTest.d.ts.map +1 -1
  108. package/dist/types/src/features/IL-OTJ/ValueTypeWrappers/TeachMePlugin.d.ts.map +1 -1
  109. package/dist/types/src/features/IL-OTJ/ValueTypeWrappers/TeachMeWrapper.d.ts.map +1 -1
  110. package/dist/types/src/features/IL-OTJ/_components/CitationLink.d.ts.map +1 -1
  111. package/dist/types/src/features/IL-OTJ/_components/MarkdownRenderer.d.ts +25 -0
  112. package/dist/types/src/features/IL-OTJ/_components/MarkdownRenderer.d.ts.map +1 -0
  113. package/dist/types/src/features/IL-OTJ/_components/MessageRendering/ClickableChatComponents.d.ts.map +1 -1
  114. package/dist/types/src/features/IL-OTJ/_components/MessageRendering/RuleValidationCard.d.ts.map +1 -1
  115. package/dist/types/src/features/IL-OTJ/_components/index.d.ts +2 -0
  116. package/dist/types/src/features/IL-OTJ/_components/index.d.ts.map +1 -1
  117. package/dist/types/src/features/IL-OTJ/_components/templates/RuleComparison/RuleComparison.d.ts.map +1 -1
  118. package/dist/types/src/features/IL-OTJ/_components/templates/TrafficManager/CreateRule.d.ts.map +1 -1
  119. package/dist/types/src/features/LearningManagement/AuditLog/AuditLog.d.ts.map +1 -1
  120. package/dist/types/src/features/LearningManagement/AuditLog/ChangeLogDiff.d.ts +15 -0
  121. package/dist/types/src/features/LearningManagement/AuditLog/ChangeLogDiff.d.ts.map +1 -0
  122. package/dist/types/src/features/LearningManagement/LearningManagement.d.ts +2 -1
  123. package/dist/types/src/features/LearningManagement/LearningManagement.d.ts.map +1 -1
  124. package/dist/types/src/features/LearningManagement/LearningManagementTest.d.ts.map +1 -1
  125. package/dist/types/src/features/LearningManagement/LearningTemplateLayout.d.ts +1 -0
  126. package/dist/types/src/features/LearningManagement/LearningTemplateLayout.d.ts.map +1 -1
  127. package/dist/types/src/features/LearningManagement/RBAC/AccessManagementPanel.d.ts +1 -0
  128. package/dist/types/src/features/LearningManagement/RBAC/AccessManagementPanel.d.ts.map +1 -1
  129. package/dist/types/src/features/LearningManagement/RuleContent/AddScopeModal.d.ts +1 -0
  130. package/dist/types/src/features/LearningManagement/RuleContent/AddScopeModal.d.ts.map +1 -1
  131. package/dist/types/src/features/LearningManagement/RuleContent/ApprovalLearningDialog.d.ts.map +1 -1
  132. package/dist/types/src/features/LearningManagement/RuleContent/ContentLogic.d.ts.map +1 -1
  133. package/dist/types/src/features/LearningManagement/RuleContent/RuleAccordionHeader.d.ts.map +1 -1
  134. package/dist/types/src/features/LearningManagement/RuleContent/RuleContent.d.ts +1 -0
  135. package/dist/types/src/features/LearningManagement/RuleContent/RuleContent.d.ts.map +1 -1
  136. package/dist/types/src/features/LearningManagement/RuleContent/RuleHeader.d.ts.map +1 -1
  137. package/dist/types/src/features/LearningManagement/RuleContent/RuleTierList.d.ts.map +1 -1
  138. package/dist/types/src/features/LearningManagement/RuleContent/TierCard.d.ts +1 -0
  139. package/dist/types/src/features/LearningManagement/RuleContent/TierCard.d.ts.map +1 -1
  140. package/dist/types/src/features/LearningManagement/RuleContent/VariantCard.d.ts.map +1 -1
  141. package/dist/types/src/features/LearningManagement/Sidebar.d.ts.map +1 -1
  142. package/dist/types/src/features/LearningManagement/apis/apiConfig.d.ts +4 -0
  143. package/dist/types/src/features/LearningManagement/apis/apiConfig.d.ts.map +1 -1
  144. package/dist/types/src/features/LearningManagement/apis/scopeApis.d.ts +25 -3
  145. package/dist/types/src/features/LearningManagement/apis/scopeApis.d.ts.map +1 -1
  146. package/dist/types/src/features/LearningManagement/components/ConfirmationModal.d.ts +2 -1
  147. package/dist/types/src/features/LearningManagement/components/ConfirmationModal.d.ts.map +1 -1
  148. package/dist/types/src/features/LearningManagement/components/CreateRuleSetLegacyModal.d.ts +1 -0
  149. package/dist/types/src/features/LearningManagement/components/CreateRuleSetLegacyModal.d.ts.map +1 -1
  150. package/dist/types/src/features/LearningManagement/components/InstantLearningModal.d.ts +1 -0
  151. package/dist/types/src/features/LearningManagement/components/InstantLearningModal.d.ts.map +1 -1
  152. package/dist/types/src/features/LearningManagement/components/ScopeTree/TreeNode.d.ts.map +1 -1
  153. package/dist/types/src/features/LearningManagement/components/StationOnboarding/StationOnboardModal.d.ts.map +1 -1
  154. package/dist/types/src/features/LearningManagement/constants.d.ts +9 -0
  155. package/dist/types/src/features/LearningManagement/constants.d.ts.map +1 -0
  156. package/dist/types/src/features/LearningManagement/hooks/useLearningTemplateQueryParams.d.ts +2 -0
  157. package/dist/types/src/features/LearningManagement/hooks/useLearningTemplateQueryParams.d.ts.map +1 -1
  158. package/dist/types/src/features/LearningManagement/queries/useLMSConfigQuery.d.ts +2 -0
  159. package/dist/types/src/features/LearningManagement/queries/useLMSConfigQuery.d.ts.map +1 -0
  160. package/dist/types/src/features/LearningManagement/store/useLMSConfigStore.d.ts +188 -0
  161. package/dist/types/src/features/LearningManagement/store/useLMSConfigStore.d.ts.map +1 -0
  162. package/dist/types/src/features/LearningManagement/store/useLearningTemplateStore.d.ts +2 -0
  163. package/dist/types/src/features/LearningManagement/store/useLearningTemplateStore.d.ts.map +1 -1
  164. package/dist/types/src/features/LearningManagement/store/usePermissionsStore.d.ts +2 -1
  165. package/dist/types/src/features/LearningManagement/store/usePermissionsStore.d.ts.map +1 -1
  166. package/dist/types/src/index.d.ts +1 -0
  167. package/dist/types/src/index.d.ts.map +1 -1
  168. package/dist/types/src/plugins/ValueTypes/Default/DefaultTeachMeRenderer.d.ts +2 -8
  169. package/dist/types/src/plugins/ValueTypes/Default/DefaultTeachMeRenderer.d.ts.map +1 -1
  170. package/dist/types/src/plugins/ValueTypes/Default/DefaultTeachMeRendererOld.d.ts +28 -0
  171. package/dist/types/src/plugins/ValueTypes/Default/DefaultTeachMeRendererOld.d.ts.map +1 -0
  172. package/package.json +9 -2
@@ -1,2 +1,2 @@
1
- import{__spreadArray as e,__assign as o}from"tslib";import{jsxs as i,jsx as n}from"react/jsx-runtime";import{Plus as d,Pencil as t,Trash2 as l}from"lucide-react";import r from"../../styles/ScopeTree.module.css.js";import{TreeNodeHeader as a}from"./TreeNodeHeader.js";import{TreeSectionItem as c}from"./TreeSectionItem.js";import{TreeAddAction as s}from"./TreeAddAction.js";var u=function(p){var h,v,m,C=p.node,f=p.depth,b=void 0===f?0:f,g=p.nodePath,y=void 0===g?[]:g,S=p.expandedNodeIds,T=p.activeSelection,x=p.onToggleExpand,A=p.onSectionSelect,N=p.onNodeOptionsClick,L=p.onAddChild,k=p.onRenameChild,E=p.onDeleteChild,P=p.canDeleteScope,j=p.canEditScope,w=p.canCreateScope,D=p.searchQuery,I=p.sectionsConfig,V=void 0===I?[]:I,O=p.nodeTypesConfig,Q=void 0===O?[]:O,R=p.forceVisible,Y=void 0!==R&&R,K=e(e([],y,!0),[C.id],!1),W=S.has(C.id),H=!!T&&T.nodePath[T.nodePath.length-1]===C.id,q=!!T&&(T.nodePath.includes(C.id)&&!H),z=function(e,o){if(!o)return!0;var i=o.toLowerCase();return!!e.name.toLowerCase().includes(i)||!!e.children&&e.children.some(function(e){return z(e,o)})};if(!Y&&!z(C,D||""))return null;var B=b>=Q.length-1?Q[Q.length-1]:Q[b],F=!!(null==B?void 0:B.addChildType),G=!P||P(C.id),J=!j||j(C.id),M=!w||w(C.id),U=C.children&&C.children.length>0,X=!G||U,Z=G?U?"This scope cannot be deleted because other scopes inherit learnings from it.":void 0:"You do not have permission to delete this scope.",$=M?void 0:"You do not have permission to add a scope here.",_=!D||C.name.toLowerCase().includes(D.toLowerCase());return i("div",o({className:r.nodeWrapper,style:{"--tree-depth":b}},{children:[n(a,{nodeType:C.type,name:C.name,isExpanded:W,isSelected:H,isAncestor:q,childrenCount:null===(h=C.children)||void 0===h?void 0:h.length,onToggleExpand:function(e){e.stopPropagation(),x(C.id)},onClick:function(){A(K,"learnings")},searchQuery:D,menuOptions:e(e([],F?[{label:B.addChildLabel||"Add Child",icon:d,onClick:function(){return null==L?void 0:L(C.id,B.addChildType,C.name)},disabled:!M,tooltip:$}]:[],!0),[{label:"Rename",icon:t,onClick:function(){return null==k?void 0:k(C.id,C.name)},disabled:!J||"station"===(null===(v=null==C?void 0:C.type)||void 0===v?void 0:v.toLocaleLowerCase()),tooltip:J?void 0:"You do not have permission to rename this scope."},{label:"Delete ".concat((null==B?void 0:B.label)||"Node"),icon:l,onClick:function(){var e;return null==E?void 0:E(C.id,C.name,(null===(e=C.metrics)||void 0===e?void 0:e.learningsCount)||0)},disabled:X,tooltip:Z,className:"text-red-500 hover:text-red-600 hover:bg-red-50"}],!1)}),W&&i("div",o({className:r.childrenWrapper},{children:[V.filter(function(e){return!e.isVisible||e.isVisible(C,b)}).map(function(e){var o;return n(c,{icon:e.icon,label:e.label,badgeCount:e.badgeKey?null===(o=C.metrics)||void 0===o?void 0:o[e.badgeKey]:void 0,isActive:H&&(null==T?void 0:T.sectionId)===e.id,onClick:function(){return A(K,e.id)}},"".concat(C.id,"-").concat(e.id))}),null===(m=C.children)||void 0===m?void 0:m.map(function(e){return n(u,{node:e,depth:b+1,nodePath:K,expandedNodeIds:S,activeSelection:T,onToggleExpand:x,onSectionSelect:A,onNodeOptionsClick:N,onAddChild:L,onRenameChild:k,onDeleteChild:E,canDeleteScope:P,canEditScope:j,canCreateScope:w,searchQuery:D,forceVisible:_,sectionsConfig:V,nodeTypesConfig:Q},e.id)}),F&&n(s,{label:B.addChildLabel||"Add Child",onAdd:function(){return null==L?void 0:L(C.id,B.addChildType,C.name)},disabled:!M,tooltip:$})]}))]}))};export{u as TreeNode};
1
+ import{__spreadArray as e,__assign as o}from"tslib";import{jsxs as n,jsx as i}from"react/jsx-runtime";import{Plus as d,Pencil as t,Trash2 as l}from"lucide-react";import r from"../../styles/ScopeTree.module.css.js";import{TreeNodeHeader as a}from"./TreeNodeHeader.js";import{TreeSectionItem as c}from"./TreeSectionItem.js";import{TreeAddAction as s}from"./TreeAddAction.js";import{dt as p}from"../../store/useLMSConfigStore.js";import{MIDDLE_DRAWER_DT_PATH as u,MIDDLE_DRAWER_CONTEXT_MENU_DT_PATH as h}from"../../constants.js";var m=function(v){var C,f,b,g,S=v.node,y=v.depth,T=void 0===y?0:y,x=v.nodePath,L=void 0===x?[]:x,A=v.expandedNodeIds,N=v.activeSelection,j=v.onToggleExpand,k=v.onSectionSelect,w=v.onNodeOptionsClick,D=v.onAddChild,E=v.onRenameChild,P=v.onDeleteChild,I=v.canDeleteScope,V=v.canEditScope,O=v.canCreateScope,Q=v.searchQuery,R=v.sectionsConfig,Y=void 0===R?[]:R,K=v.nodeTypesConfig,W=void 0===K?[]:K,H=v.forceVisible,M=void 0!==H&&H,q=e(e([],L,!0),[S.id],!1),z=A.has(S.id),B=p("".concat(u,".scope")),F=!!N&&N.nodePath[N.nodePath.length-1]===S.id,G=!!N&&(N.nodePath.includes(S.id)&&!F),J=function(e,o){if(!o)return!0;var n=o.toLowerCase();return!!e.name.toLowerCase().includes(n)||!!e.children&&e.children.some(function(e){return J(e,o)})};if(!M&&!J(S,Q||""))return null;var U=T>=W.length-1?W[W.length-1]:W[T],X=!!(null==U?void 0:U.addChildType),Z=!I||I(S.id),$=!V||V(S.id),_=!O||O(S.id),ee=S.children&&S.children.length>0,oe=!Z||ee,ne=Z?ee?"This scope cannot be deleted because other scopes inherit learnings from it.":void 0:"You do not have permission to delete this scope.",ie=_?void 0:"You do not have permission to add a scope here.",de=!Q||S.name.toLowerCase().includes(Q.toLowerCase());return n("div",o({className:r.nodeWrapper,style:{"--tree-depth":T}},{children:[i(a,{nodeType:S.type,name:S.name,isExpanded:z,isSelected:F,isAncestor:G,childrenCount:null===(C=S.children)||void 0===C?void 0:C.length,onToggleExpand:function(e){e.stopPropagation(),j(S.id)},onClick:function(){k(q,"learnings")},searchQuery:Q,menuOptions:e(e([],X?[{label:U.addChildLabel||"Add Child",icon:d,onClick:function(){return null==D?void 0:D(S.id,U.addChildType,S.name)},disabled:!_,tooltip:ie}]:[],!0),[{label:"".concat(p("".concat(h,".rename"),"Rename")),icon:t,onClick:function(){return null==E?void 0:E(S.id,S.name)},disabled:!$||"station"===(null===(f=null==S?void 0:S.type)||void 0===f?void 0:f.toLocaleLowerCase()),tooltip:$?void 0:"You do not have permission to rename this scope."},{label:"station"===(null===(b=null==S?void 0:S.type)||void 0===b?void 0:b.toLowerCase())?"Delete Station":" ".concat(p("".concat(h,".delete"),"Delete ".concat((null==U?void 0:U.label)||"Node"),{scope:B})),icon:l,onClick:function(){var e;return null==P?void 0:P(S.id,S.name,(null===(e=S.metrics)||void 0===e?void 0:e.learningsCount)||0)},disabled:oe,tooltip:ne,className:"text-red-500 hover:text-red-600 hover:bg-red-50"}],!1)}),z&&n("div",o({className:r.childrenWrapper},{children:[Y.filter(function(e){return!e.isVisible||e.isVisible(S,T)}).map(function(e){var o;return i(c,{icon:e.icon,label:e.label,badgeCount:e.badgeKey?null===(o=S.metrics)||void 0===o?void 0:o[e.badgeKey]:void 0,isActive:F&&(null==N?void 0:N.sectionId)===e.id,onClick:function(){return k(q,e.id)}},"".concat(S.id,"-").concat(e.id))}),null===(g=S.children)||void 0===g?void 0:g.map(function(e){return i(m,{node:e,depth:T+1,nodePath:q,expandedNodeIds:A,activeSelection:N,onToggleExpand:j,onSectionSelect:k,onNodeOptionsClick:w,onAddChild:D,onRenameChild:E,onDeleteChild:P,canDeleteScope:I,canEditScope:V,canCreateScope:O,searchQuery:Q,forceVisible:de,sectionsConfig:Y,nodeTypesConfig:W},e.id)}),X&&i(s,{label:U.addChildLabel||"Add Child",onAdd:function(){return null==D?void 0:D(S.id,U.addChildType,S.name)},disabled:!_,tooltip:ie})]}))]}))};export{m as TreeNode};
2
2
  //# sourceMappingURL=TreeNode.js.map
@@ -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;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,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!==(f=null===(d=He.find(function(e){return"Learning Manager"===e.name}))||void 0===d?void 0:d._id)&&void 0!==f?f:""}]:[],!0),[{users:[null==Me?void 0:Me.email],groups:[],role:null!==(h=null===(m=He.find(function(e){return"Instant Learning Admin"===e.name}))||void 0===m?void 0:m._id)&&void 0!==h?h:""}],!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===(g=null==a?void 0:a.data)||void 0===g?void 0:g.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===(x=We.current)||void 0===x||x.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!==(v=null==po?void 0:po.id)&&void 0!==v?v: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===(b=We.current)||void 0===b||b.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"tslib";var _,e={VITE_GOOGLE_CLIENT_ID:process.env.VITE_GOOGLE_CLIENT_ID,VITE_GOOGLE_CLIENT_SECRET:process.env.VITE_GOOGLE_CLIENT_SECRET,VITE_REDIRECT_URI:process.env.VITE_REDIRECT_URI||"http://localhost:5173",VITE_BACKEND_URL:process.env.VITE_BACKEND_URL||"http://localhost:3000",VITE_DOMAIN_NAME_URL:process.env.VITE_DOMAIN_NAME_URL||"https://devllmstudio.creativeworkspace.ai",VITE_ASSISTANT_NAME:process.env.VITE_ASSISTANT_NAME||"cwchatorchestrator",VITE_PROJECT_CREATION_ASSISTANT_NAME:process.env.VITE_PROJECT_CREATION_ASSISTANT_NAME||"cwprojectcreation",VITE_WEBSOCKET_URL:process.env.VITE_WEBSOCKET_URL||"wss://dev-proposals-ai.techo.camp/graphql",VITE_AUDACY_BACKEND_URL:process.env.VITE_AUDACY_BACKEND_URL||"",VITE_AUDACY_WEBSOCKET_URL:process.env.VITE_AUDACY_WEBSOCKET_URL||"",VITE_AUDACY_ASSISTANT_NAME:process.env.VITE_AUDACY_ASSISTANT_NAME||"",VITE_AUDACY_RECOMMEND_AGENT:process.env.VITE_AUDACY_RECOMMEND_AGENT||"",VITE_AUDACY_COMPARE_AGENT:process.env.VITE_AUDACY_COMPARE_AGENT||"",VITE_AUDACY_CHAT_ASSISTANT:process.env.VITE_AUDACY_CHAT_ASSISTANT||"",VITE_CORE_WHITELIST_URLS:(null===(_=process.env.VITE_CORE_WHITELIST_URLS)||void 0===_?void 0:_.split(",").map(function(_){return _.trim()}))||[],VITE_LLM_STUDIO_URL:process.env.VITE_LLM_STUDIO_URL||"https://devllmstudio.creativeworkspace.ai",VITE_LLM_STUDIO_WEBSOCKET_URL:process.env.VITE_LLM_STUDIO_WEBSOCKET_URL||"wss://devllmstudio.creativeworkspace.ai/graphql",VITE_AUDACY_RULE_ASSISTANT:process.env.VITE_AUDACY_RULE_ASSISTANT},E={"Separation rule":"I want to add a separation rule","Max priority":"I want to set a max priority","Break code matching":"I want to add a break code matching rule","Inventory window matching":"I want to add an inventory window matching rule","Enter a learning description":"I want to add a learning description","Tester Genie":"Finding an interesting usecase to test..."},T="<p><span>Hi! 👋 I'm your Instant Learning Concierge.</span>\n <span>How would you like to get started? You can select an option below or describe the learning you'd like to create.</span>\n ".concat(["Separation rule","Max priority","Break code matching","Inventory window matching","Enter a learning description"].map(function(_){return'<button class="clickable-button" data-value="'.concat(E[_],'">').concat(_,"</button>")}).join(""),"</p>"),n={CUSTOM_SCOPE_GROUP_NAME:"Audacy-Traffic-Manager",INSTANT_LEARNING_TYPE:"iL",MODEL:"claude-3.5-sonnet",CONFIG_MASTER_NAME:"audacy-config",SCOPE_NAME:"Custom",ASSISTANT_NAME:process.env.VITE_AUDACY_RULE_ASSISTANT||"testaudacyrilprompt",ORGANIZATION_NAME:"techolution",BASE_URL:e.VITE_LLM_STUDIO_URL,BASE_WEBSOCKET_URL:e.VITE_LLM_STUDIO_WEBSOCKET_URL,CHAT_TITLE:"Teach Me OTJ - <scope> - Add Learning",CHAT_TITLE_EDIT:"Teach Me OTJ - <scope> - Edit Learning",FORM_TITLE:"Learning Details",INITIAL_CHAT_MESSAGE:T,CATEGORY:"Global-Template",SOCKET_TIMEOUT:24e4};export{n as IL_CONFIG_CONSTANTS,e as config};
1
+ import"tslib";var _,e={VITE_GOOGLE_CLIENT_ID:process.env.VITE_GOOGLE_CLIENT_ID,VITE_GOOGLE_CLIENT_SECRET:process.env.VITE_GOOGLE_CLIENT_SECRET,VITE_REDIRECT_URI:process.env.VITE_REDIRECT_URI||"http://localhost:5173",VITE_BACKEND_URL:process.env.VITE_BACKEND_URL||"http://localhost:3000",VITE_DOMAIN_NAME_URL:process.env.VITE_DOMAIN_NAME_URL||"https://devllmstudio.creativeworkspace.ai",VITE_ASSISTANT_NAME:process.env.VITE_ASSISTANT_NAME||"cwchatorchestrator",VITE_PROJECT_CREATION_ASSISTANT_NAME:process.env.VITE_PROJECT_CREATION_ASSISTANT_NAME||"cwprojectcreation",VITE_WEBSOCKET_URL:process.env.VITE_WEBSOCKET_URL||"wss://dev-proposals-ai.techo.camp/graphql",VITE_AUDACY_BACKEND_URL:process.env.VITE_AUDACY_BACKEND_URL||"",VITE_AUDACY_WEBSOCKET_URL:process.env.VITE_AUDACY_WEBSOCKET_URL||"",VITE_AUDACY_ASSISTANT_NAME:process.env.VITE_AUDACY_ASSISTANT_NAME||"",VITE_AUDACY_RECOMMEND_AGENT:process.env.VITE_AUDACY_RECOMMEND_AGENT||"",VITE_AUDACY_COMPARE_AGENT:process.env.VITE_AUDACY_COMPARE_AGENT||"",VITE_AUDACY_CHAT_ASSISTANT:process.env.VITE_AUDACY_CHAT_ASSISTANT||"",VITE_CORE_WHITELIST_URLS:(null===(_=process.env.VITE_CORE_WHITELIST_URLS)||void 0===_?void 0:_.split(",").map(function(_){return _.trim()}))||[],VITE_LLM_STUDIO_URL:process.env.VITE_LLM_STUDIO_URL||"https://devllmstudio.creativeworkspace.ai",VITE_LLM_STUDIO_WEBSOCKET_URL:process.env.VITE_LLM_STUDIO_WEBSOCKET_URL||"wss://devllmstudio.creativeworkspace.ai/graphql",VITE_AUDACY_RULE_ASSISTANT:process.env.VITE_AUDACY_RULE_ASSISTANT},E={"Separation rule":"I want to add a separation rule","Max priority":"I want to set a max priority","Break code matching":"I want to add a break code matching rule","Inventory window matching":"I want to add an inventory window matching rule","Enter a learning description":"I want to add a learning description","Tester Genie":"Finding an interesting usecase to test..."},T="<p><span>Hi! 👋 I'm your Instant Learning Concierge.</span>\n <span>How would you like to get started? You can select an option below or describe the learning you'd like to create.</span>\n ".concat(["Separation rule","Max priority","Break code matching","Inventory window matching","Enter a learning description"].map(function(_){return'<button class="clickable-button" data-value="'.concat(E[_],'">').concat(_,"</button>")}).join(""),"</p>"),n={CUSTOM_SCOPE_GROUP_NAME:"Audacy-Traffic-Manager",INSTANT_LEARNING_TYPE:"iL",MODEL:"claude-3.5-sonnet",CONFIG_MASTER_NAME:"audacy-config",SCOPE_NAME:"Custom",ASSISTANT_NAME:process.env.VITE_AUDACY_RULE_ASSISTANT||"testaudacyrilprompt",ORGANIZATION_NAME:"techolution",BASE_URL:e.VITE_LLM_STUDIO_URL,BASE_WEBSOCKET_URL:e.VITE_LLM_STUDIO_WEBSOCKET_URL,CHAT_TITLE:"Teach Me OTJ - {scope} - Add Learning",CHAT_TITLE_EDIT:"Teach Me OTJ - {scope} - Edit Learning",FORM_TITLE:"Learning Details",INITIAL_CHAT_MESSAGE:T,CATEGORY:"Global-Template",SOCKET_TIMEOUT:24e4};export{n as IL_CONFIG_CONSTANTS,e as config};
2
2
  //# sourceMappingURL=config.js.map
@@ -0,0 +1,2 @@
1
+ var e="learnings.tier",r="learnings.tier.learning",a="learnings.tier.learning.variant",n="middleDrawer",i="middleDrawer.treeMenu.contextMenu",l="middleDrawer.addScopeDialog",t="middleDrawer.addScopeDialog.learningApprovalSettings",d="emptyStateLearning";export{d as EMPTY_STATE_DT_PATH,r as LEARNING_DT_PATH,l as MIDDLE_DRAWER_ADD_SCOPE_DT_PATH,t as MIDDLE_DRAWER_APPROVAL_SETTINGS_DT_PATH,i as MIDDLE_DRAWER_CONTEXT_MENU_DT_PATH,n as MIDDLE_DRAWER_DT_PATH,e as TIER_DT_PATH,a as VARIANT_DT_PATH};
2
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -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
@@ -0,0 +1,2 @@
1
+ import{__awaiter as e,__generator as t}from"tslib";import{useQuery as r}from"@tanstack/react-query";import o from"../store/useAuthStore.js";import n from"../store/useEnvStore.js";import{fetchLMSConfig as i}from"../apis/scopeApis.js";import{useLMSConfigStore as s,useTeachMeConfigStore as u}from"../store/useLMSConfigStore.js";import{useLearningTemplateStore as a}from"../store/useLearningTemplateStore.js";function f(f,m,c){var l=this;void 0===c&&(c=!0);var p=o(function(e){var t,r;return null!==(r=null===(t=e.user)||void 0===t?void 0:t.accessToken)&&void 0!==r?r:""}),v=n(function(e){var t;return null!==(t=e.llmStudioUrl)&&void 0!==t?t:""}),d=s(function(e){return e.setLMSConfig}),g=u(function(e){return e.setTeachMeConfig}),h=a(function(e){return e.setTemplateData});return r({queryKey:["lms-config",f],queryFn:function(){return e(l,void 0,void 0,function(){var e,r,o,n;return t(this,function(t){switch(t.label){case 0:return[4,i(v,f,p)];case 1:return e=t.sent(),r=e.lmsConfig,o=e.teachMeConfig,n=e.template,r&&d(r),o&&g(o),n&&h(f,n),[2,{lmsConfig:r,teachMeConfig:o,template:n}]}})})},enabled:c&&!!f&&!!p&&!!v&&!m,staleTime:6e5})}export{f as useLMSConfigQuery};
2
+ //# sourceMappingURL=useLMSConfigQuery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLMSConfigQuery.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import{create as e}from"zustand";import{useLearningTemplateStore as t}from"./useLearningTemplateStore.js";var n={pageTitle:"",middleDrawer:{scope:"",addScope:"",addSubScope:"",addScopeDialog:{title:"",globalTitle:"",subtitle:"",globalSubtitle:"",scopeName:"",learningApprovalSettings:{title:"",approvalRequired:{title:"",subtitle:""},publishWithoutApproval:{title:"",subtitle:""}},submitButton:"",cancel:""},treeMenu:{search:"",submenu:{learnings:"",access:"",changeHistory:""},contextMenu:{addScope:"",rename:"",delete:"",addSubScope:""}}},learnings:{header:{title:"",exportButton:"",addNewLearningButton:""},tier:{showTierHeader:!0,tierHeader:"",subtitle:"",tierHeaderNoOfLearnings:"",deleteDialog:{title:"",description:"",cancel:"",submit:""},learning:{inheritance:"",actions:{disable:"",enable:"",approve:"",reject:"",delete:""},approveDialog:{title:"",desc:"",footer:"",cancel:"",approveLearning:""},rejectDialog:{title:"",desc:"",feedbackTitle:"",feedbackPlaceholder:"",deleteCheckboxLabel:"",cancel:"",rejectLearning:""},deleteDialog:{title:"",desc:"",warningText:"",cancelText:"",deleteText:""}}}},emptyStateLearning:{title:"",desc:"",createNewLearning:"",createGlobalScope:"",noAccessTitle:"",noAccessDesc:"",requestAccessButton:""},agents:{LearningTerm:""}},a={showScope:!1,showConfiguration:!1,welcomeMessage:"Hi! 👋 I'm your Instant Learning Concierge.",welcomeMessageSubtitle:"How would you like to get started? You can select an option below or describe the rule you'd like to create.",actions:[{label:"Separation rule",value:"I would want to add a separation rule"},{label:"Max priority rule",value:"I would want to set a max priority rule"},{label:"Break code matching",value:"I would want to add a break code matching rule"},{label:"Inventory code matching",value:"I would want to add a inventory window matching rule"},{label:"Enter a rule description",value:"I want to add a rule description"},{label:"Tester Genie",value:"Loading prompt..."}],chatTitle:"Teach Me OTJ - {scope} - Add Learning",chatTitleEdit:"Teach Me OTJ - {scope} - Edit Learning",formTitle:"Rule setup",setupLabel:"Configure your IL",ruleTitle:"Main Rule Name",scopeLabel:"Define Scope",tierLabel:"Select Tiers",ruleDescriptionTitle:"Learning Explanation",whenToApplyTitle:"Trigger Events (When to Apply)",addWhenToApplyBtnLabel:"Add WTA",whenNotToApplyTitle:"Exclusion Events (When NOT to Apply)",addWhenNotToApplyBtnLabel:"Add WNTA",configTitle:"Advanced Settings",saveBtnLabel:"Save Rule",saveBtnLoadingLabel:"Saving Rule...",chatTextareaPlaceholder:"Tell me more about this learning.."},l=e(function(e){return{lmsConfig:n,setLMSConfig:function(t){return e({lmsConfig:t})},clearLMSConfig:function(){return e({lmsConfig:n})}}});function i(e,n,a){if(t.getState().backwardCompatibility)return null!=n?n:"";var i=l.getState().lmsConfig,o=e.split(".").reduce(function(e,t){return null==e?void 0:e[t]},i);return"string"!=typeof o||""===o?null!=n?n:e:o.replace(/\{(\w+)\}/g,function(e,t){var n;return String(null!==(n=null==a?void 0:a[t])&&void 0!==n?n:"{".concat(t,"}"))})}var o=e(function(e){return{teachMeConfig:null,setTeachMeConfig:function(t){return e({teachMeConfig:t})},clearTeachMeConfig:function(){return e({teachMeConfig:null})}}});function r(){var e,t,n=null!==(e=o.getState().teachMeConfig)&&void 0!==e?e:a;return{greeting:n.welcomeMessage||a.welcomeMessage,subtitle:n.welcomeMessageSubtitle||a.welcomeMessageSubtitle,actions:(null===(t=n.actions)||void 0===t?void 0:t.length)?n.actions:a.actions}}function c(e,t,n){var a=o.getState().teachMeConfig,l=e.split(".").reduce(function(e,t){return null==e?void 0:e[t]},a);return"string"!=typeof l?null!=t?t:e:l.replace(/\{(\w+)\}/g,function(e,t){var a;return String(null!==(a=null==n?void 0:n[t])&&void 0!==a?a:"{".concat(t,"}"))})}export{n as defaultLMSConfig,a as defaultTeachMeConfig,i as dt,c as dtt,r as dttWelcomeMessageParts,l as useLMSConfigStore,o as useTeachMeConfigStore};
2
+ //# sourceMappingURL=useLMSConfigStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLMSConfigStore.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -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,2 +1,2 @@
1
- import{__awaiter as r,__generator as e}from"tslib";import{create as i}from"zustand";import{appsecApi as t}from"../apis/scopeApis.js";import{useLearningTemplateStore as n}from"./useLearningTemplateStore.js";import o from"./useEnvStore.js";var s=function(r,e){return!!e&&function(r){return r?"string"==typeof r?[r]:[r._id,r.id,r.resourceId,r.resource_id].filter(function(r){return"string"==typeof r&&r.length>0}):[]}(r).includes(e)},a=i(function(i,a){return{accessData:[],isLoading:!1,error:null,fetchPermissions:function(n,o){return r(void 0,void 0,void 0,function(){var r,s,a;return e(this,function(e){switch(e.label){case 0:if(!n)return[2];i({isLoading:!0,error:null}),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,t.get("/users/me",{params:{appId:n,resourceId:o}})];case 2:return r=e.sent(),i({accessData:(null===(a=r.data)||void 0===a?void 0:a.data)||[],isLoading:!1}),[3,4];case 3:return s=e.sent(),console.error("Failed to fetch permissions:",s),i({error:s.message||"Failed to fetch permissions",isLoading:!1}),[3,4];case 4:return[2]}})})},hasPermission:function(r,e){var i;if(!n.getState().backwardCompatibility)return!0;var t=a().accessData,u=null===(i=o.getState().rbacConfig)||void 0===i?void 0:i.applicationResourceId,c=function(r,e){return t.some(function(i){var t,n,o;return s(i.resourceId,e)&&null!==(o=null===(n=null===(t=i.role)||void 0===t?void 0:t.permissions)||void 0===n?void 0:n.some(function(e){return e.name===r}))&&void 0!==o&&o})};return!(!u||!c(r,u))||c(r,e)},hasGlobalPermission:function(r,e){return!n.getState().backwardCompatibility||!!e&&(a().hasApplicationAccess(e)||a().hasPermission(r,e))},hasApplicationAccess:function(r){return!n.getState().backwardCompatibility||!!r&&a().accessData.some(function(e){var i,t,n;return s(e.resourceId,r)&&null!==(n=null===(t=null===(i=e.role)||void 0===i?void 0:i.permissions)||void 0===t?void 0:t.some(function(r){return"ilotj.scope.access.application.user.add"===r.name}))&&void 0!==n&&n})},reset:function(){return i({accessData:[],isLoading:!1,error:null})}}});export{a as usePermissionsStore};
1
+ import{__awaiter as r,__generator as e}from"tslib";import{create as s}from"zustand";import{appsecApi as n}from"../apis/scopeApis.js";import i from"./useEnvStore.js";var t=function(r,e){return!!e&&function(r){return r?"string"==typeof r?[r]:[r._id,r.id,r.resourceId,r.resource_id].filter(function(r){return"string"==typeof r&&r.length>0}):[]}(r).includes(e)},o=function(r,e){for(var s,n,i=new Set,o=0,a=r;o<a.length;o++){var c=a[o];if(t(c.resourceId,e))for(var u=0,l=null!==(n=null===(s=c.role)||void 0===s?void 0:s.permissions)&&void 0!==n?n:[];u<l.length;u++){var d=l[u];i.add(d.name)}}return i},a=s(function(s,t){return{accessData:[],isLoading:!1,error:null,fetchPermissions:function(i,t){return r(void 0,void 0,void 0,function(){var r,o,a;return e(this,function(e){switch(e.label){case 0:if(!i)return[2];s({isLoading:!0,error:null}),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,n.get("/users/me",{params:{appId:i,resourceId:t}})];case 2:return r=e.sent(),s({accessData:(null===(a=r.data)||void 0===a?void 0:a.data)||[],isLoading:!1}),[3,4];case 3:return o=e.sent(),console.error("Failed to fetch permissions:",o),s({error:o.message||"Failed to fetch permissions",isLoading:!1}),[3,4];case 4:return[2]}})})},hasPermission:function(r,e){var s,n=t().accessData,a=null===(s=i.getState().rbacConfig)||void 0===s?void 0:s.applicationResourceId;if(a&&o(n,a).has(r))return!0;if(e&&o(n,e).has(r))return!0;return!1},hasGlobalPermission:function(r,e){return!!e&&(t().hasApplicationAccess(e)||t().hasPermission(r,e))},hasApplicationAccess:function(r){if(!r)return!1;var e=t().accessData;return o(e,r).has("ilotj.scope.access.application.user.add")},reset:function(){return s({accessData:[],isLoading:!1,error:null})}}});export{a as usePermissionsStore};
2
2
  //# sourceMappingURL=usePermissionsStore.js.map
@@ -1,2 +1,2 @@
1
- import e from"../../../node_modules/style-inject/dist/style-inject.es.js";var r={tierCard:"TierCard-module_tierCard__KSpm5",tierCardOpen:"TierCard-module_tierCardOpen__o1Vxl",tierButtonGroup:"TierCard-module_tierButtonGroup__uo5yd",deleteButton:"TierCard-module_deleteButton__6gY-e",tierHeader:"TierCard-module_tierHeader__TdCQv",tierInfo:"TierCard-module_tierInfo__i9nVc",tierDescription:"TierCard-module_tierDescription__uhf1S",chevronIcon:"TierCard-module_chevronIcon__feRit",chevronIconClosed:"TierCard-module_chevronIconClosed__EIWyT",tierContent:"TierCard-module_tierContent__77VBi",emptyRules:"TierCard-module_emptyRules__jDjkj",rulesList:"TierCard-module_rulesList__vevJk"};e(".TierCard-module_tierCard__KSpm5{background-color:#fff;border:1px solid #bfdbfe;border-radius:.5rem;box-shadow:0 1px 2px 0 #0000000d;overflow:hidden;transition:all .2s ease}.TierCard-module_tierCardOpen__o1Vxl{border-color:#2563eb;border-width:1.5px}.TierCard-module_tierButtonGroup__uo5yd{align-items:center;display:flex;gap:1rem;margin-left:auto}.TierCard-module_deleteButton__6gY-e{background:none;border:none;color:#ef4444;cursor:pointer;font-size:.75rem;font-weight:500;transition:color .2s ease}.TierCard-module_tierHeader__TdCQv{align-items:flex-start;cursor:pointer;display:flex;justify-content:space-between;padding:1.25rem;transition:background-color .2s ease;user-select:none}.TierCard-module_tierHeader__TdCQv:hover{background-color:#f9fafb}.TierCard-module_tierInfo__i9nVc h3{color:#19213d;font-size:.875rem;font-weight:600;margin-bottom:.25rem}.TierCard-module_tierInfo__i9nVc h3 span{color:#19213d;font-weight:400}.TierCard-module_tierDescription__uhf1S{color:#666f8d;font-size:.875rem;font-weight:400;max-width:36rem}.TierCard-module_chevronIcon__feRit{color:#000;transition:transform .2s ease}.TierCard-module_chevronIconClosed__EIWyT{transform:rotate(180deg)}.TierCard-module_tierContent__77VBi{padding-bottom:1.25rem;padding-left:1.25rem;padding-right:1.25rem}.TierCard-module_emptyRules__jDjkj{color:#6b7280;font-size:.875rem;margin-top:1.25rem;text-align:center}.TierCard-module_rulesList__vevJk{display:flex;flex-direction:column;gap:.75rem;list-style:none;margin:0;padding:0}");export{r as default};
1
+ import e from"../../../node_modules/style-inject/dist/style-inject.es.js";var r={tierCard:"TierCard-module_tierCard__KSpm5",tierCardOpen:"TierCard-module_tierCardOpen__o1Vxl",singleTier:"TierCard-module_singleTier__cyQwV",tierButtonGroup:"TierCard-module_tierButtonGroup__uo5yd",deleteButton:"TierCard-module_deleteButton__6gY-e",tierHeader:"TierCard-module_tierHeader__TdCQv",tierInfo:"TierCard-module_tierInfo__i9nVc",tierDescription:"TierCard-module_tierDescription__uhf1S",chevronIcon:"TierCard-module_chevronIcon__feRit",chevronIconClosed:"TierCard-module_chevronIconClosed__EIWyT",tierContent:"TierCard-module_tierContent__77VBi",emptyRules:"TierCard-module_emptyRules__jDjkj",rulesList:"TierCard-module_rulesList__vevJk"};e(".TierCard-module_tierCard__KSpm5{background-color:#fff;border:1px solid #bfdbfe;border-radius:.5rem;box-shadow:0 1px 2px 0 #0000000d;overflow:hidden;transition:all .2s ease}.TierCard-module_tierCardOpen__o1Vxl{border-color:#2563eb;border-width:1.5px}.TierCard-module_singleTier__cyQwV{border:none;box-shadow:none}.TierCard-module_tierButtonGroup__uo5yd{align-items:center;display:flex;gap:1rem;margin-left:auto}.TierCard-module_deleteButton__6gY-e{background:none;border:none;color:#ef4444;cursor:pointer;font-size:.75rem;font-weight:500;transition:color .2s ease}.TierCard-module_tierHeader__TdCQv{align-items:flex-start;cursor:pointer;display:flex;justify-content:space-between;padding:1.25rem;transition:background-color .2s ease;user-select:none}.TierCard-module_tierHeader__TdCQv:hover{background-color:#f9fafb}.TierCard-module_tierInfo__i9nVc h3{color:#19213d;font-size:.875rem;font-weight:600;margin-bottom:.25rem}.TierCard-module_tierInfo__i9nVc h3 span{color:#19213d;font-weight:400}.TierCard-module_tierDescription__uhf1S{color:#666f8d;font-size:.875rem;font-weight:400;max-width:36rem}.TierCard-module_chevronIcon__feRit{color:#000;transition:transform .2s ease}.TierCard-module_chevronIconClosed__EIWyT{transform:rotate(180deg)}.TierCard-module_tierContent__77VBi{padding-bottom:1.25rem;padding-left:1.25rem;padding-right:1.25rem}.TierCard-module_emptyRules__jDjkj{color:#6b7280;font-size:.875rem;margin-top:1.25rem;text-align:center}.TierCard-module_rulesList__vevJk{display:flex;flex-direction:column;gap:.75rem;list-style:none;margin:0;padding:0}");export{r as default};
2
2
  //# sourceMappingURL=TierCard.module.css.js.map
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export{default as InstantLearning}from"./features/InstantLearning/InstantLearning.js";export{default as WtaWnta}from"./features/WtaWnta/WtaWnta.js";export{default as BookLearning}from"./features/DocumentLearning/DocumentLearning.js";export{default as ILOTJ}from"./features/IL-OTJ/ILOTJ.js";export{Button}from"./features/IL-OTJ/_components/atoms/Button/Button.js";export{Dropdown}from"./features/IL-OTJ/_components/atoms/Dropdown/Dropdown.js";export{Toggle}from"./features/IL-OTJ/_components/atoms/Toggle/Toggle.js";export{Textarea}from"./features/IL-OTJ/_components/atoms/Textarea/Textarea.js";export{ConditionList}from"./features/IL-OTJ/_components/molecules/Condition/ConditionList.js";export{SectionWrapper}from"./features/IL-OTJ/_components/molecules/Sections/SectionWrapper.js";export{SeparationRow}from"./features/IL-OTJ/_components/molecules/SeperationRow/SeparationRow.js";export{ConfigSection}from"./features/IL-OTJ/_components/organisms/ConfigSection/ConfigSection.js";export{TextSection}from"./features/IL-OTJ/_components/organisms/TextSection/TextSection.js";export{ScopeSection}from"./features/IL-OTJ/_components/organisms/ScopeSection/ScopeSection.js";export{ConditionSection}from"./features/IL-OTJ/_components/organisms/ConditionSection/ConditionSection.js";export{TrafficManagerTemplate}from"./features/IL-OTJ/_components/templates/TrafficManager/TrafficManagerTemplate.js";export{Testing}from"./features/IL-OTJ/_components/templates/Testing/Testing.js";export{TemplateList,TemplateMap}from"./features/IL-OTJ/_components/templates/TemplatesMap/templatesMap.js";export{extractAndParseResponse,extractAndParseWithProperty,extractTextFromChildren,extractVariantIds,parseValidationData,useHeaderObserver}from"./features/IL-OTJ/helpers/utils.js";export{CitationProvider,useCitations}from"./features/IL-OTJ/store/CitationsContext.js";export{getVariantInfo}from"./features/IL-OTJ/ILOTJTest.js";export{default as LearningManagement}from"./features/LearningManagement/LearningManagement.js";
1
+ export{default as InstantLearning}from"./features/InstantLearning/InstantLearning.js";export{default as WtaWnta}from"./features/WtaWnta/WtaWnta.js";export{default as BookLearning}from"./features/DocumentLearning/DocumentLearning.js";export{default as ILOTJ}from"./features/IL-OTJ/ILOTJ.js";export{Button}from"./features/IL-OTJ/_components/atoms/Button/Button.js";export{Dropdown}from"./features/IL-OTJ/_components/atoms/Dropdown/Dropdown.js";export{Toggle}from"./features/IL-OTJ/_components/atoms/Toggle/Toggle.js";export{Textarea}from"./features/IL-OTJ/_components/atoms/Textarea/Textarea.js";export{ConditionList}from"./features/IL-OTJ/_components/molecules/Condition/ConditionList.js";export{SectionWrapper}from"./features/IL-OTJ/_components/molecules/Sections/SectionWrapper.js";export{SeparationRow}from"./features/IL-OTJ/_components/molecules/SeperationRow/SeparationRow.js";export{ConfigSection}from"./features/IL-OTJ/_components/organisms/ConfigSection/ConfigSection.js";export{TextSection}from"./features/IL-OTJ/_components/organisms/TextSection/TextSection.js";export{ScopeSection}from"./features/IL-OTJ/_components/organisms/ScopeSection/ScopeSection.js";export{ConditionSection}from"./features/IL-OTJ/_components/organisms/ConditionSection/ConditionSection.js";export{TrafficManagerTemplate}from"./features/IL-OTJ/_components/templates/TrafficManager/TrafficManagerTemplate.js";export{Testing}from"./features/IL-OTJ/_components/templates/Testing/Testing.js";export{TemplateList,TemplateMap}from"./features/IL-OTJ/_components/templates/TemplatesMap/templatesMap.js";export{extractAndParseResponse,extractAndParseWithProperty,extractTextFromChildren,extractVariantIds,parseValidationData,useHeaderObserver}from"./features/IL-OTJ/helpers/utils.js";export{CitationProvider,useCitations}from"./features/IL-OTJ/store/CitationsContext.js";export{dummyDat,getVariantInfo}from"./features/IL-OTJ/ILOTJTest.js";export{default as LearningManagement}from"./features/LearningManagement/LearningManagement.js";export{default as TeachMePlugin,TemplateRegistry}from"./features/IL-OTJ/ValueTypeWrappers/TeachMePlugin.js";import"tslib";import"react/jsx-runtime";
2
2
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e,__spreadArray as t}from"tslib";import{jsx as o,Fragment as n,jsxs as r}from"react/jsx-runtime";import{useState as a,useCallback as i}from"react";import{Lightbulb as s}from"lucide-react";import"../../../features/IL-OTJ/_components/atoms/Textarea/Textarea.js";import"../../../features/IL-OTJ/_components/InputDataReasoningCard.js";import"../../../features/IL-OTJ/_components/TooltipComponent.js";import{TemplateList as l}from"../../../features/IL-OTJ/_components/templates/TemplatesMap/templatesMap.js";import"../../../features/IL-OTJ/store/CitationsContext.js";import"@mui/material";import"uuid";import"@mui/material/Tooltip";import"react-markdown";import"rehype-raw";import"axios";import"@e-llm-studio/streaming-response";import"@e-llm-studio/watch-me-work";import"../../../features/IL-OTJ/_components/ChatComponents/ChatHeader.js";import"remark-gfm";import"../../../features/IL-OTJ/_components/MarkdownComponents/MarkdownElements.js";import"../../../features/IL-OTJ/_components/CitationLink.js";import"@e-llm-studio/citation";import"@viswa-test/test-citation";import"../../../features/LearningManagement/LearningManagement.js";import p from"../../../features/IL-OTJ/_components/AccordianSection.js";import c from"../../../features/IL-OTJ/ILOTJ.js";var u={order_rules:{enabled:!1,global_min_separation_seconds:0},advertiser_rules:{enabled:!1,global_min_separation_seconds:0},inventory_rules:{respect_inventory_code:!1},break_code_rules:{respect_break_code:!1},is_default_enabled:!1},d=[{label:"Global Scope",value:"global"},{label:"Genre Scope",value:"genre"},{label:"Custom Scope",value:"custom"}],m=["Tier 1"],f=function(){var f=a(!0),_=f[0],b=f[1],g=a(""),v=g[0],h=g[1],y=a(""),T=y[0],k=y[1],C=a({station:"",tiers:["Tier 1"]}),L=C[0],w=C[1],A=a([]),I=A[0],x=A[1],O=a([]),S=O[0],j=O[1],N=a(u),J=N[0],D=N[1],W=i(function(t,o){w(function(n){var r;return e(e({},n),((r={})[t]=o,r))})},[]),E=i(function(t,o){D(function(n){var r=e({},n);switch(t){case"order_rules":case"advertiser_rules":r[t]="boolean"==typeof o?e(e({},n[t]),{enabled:o}):{enabled:o.enabled,global_min_separation_seconds:o.global_min_separation_seconds};break;case"inventory_rules":r.inventory_rules={respect_inventory_code:"boolean"==typeof o?o:o.respect_inventory_code};break;case"break_code_rules":r.break_code_rules={respect_break_code:"boolean"==typeof o?o:o.respect_break_code};break;case"is_default_enabled":r.is_default_enabled="boolean"==typeof o?o:!!o}return r})},[]),M=function(e){e(function(e){return t(t([],e,!0),[{id:Date.now(),text:"",reasoning:""}],!1)})},B=function(e,t){e(function(e){return e.filter(function(e){return e.id!==t})})},R=function(t,o,n){t(function(t){return t.map(function(t){return String(t.id)===String(o)?e(e({},t),{text:n}):t})})},U=[e({key:"order_rules",label:"Order"},J.order_rules),e({key:"advertiser_rules",label:"Advertiser"},J.advertiser_rules)],H=[{key:"inventory_rules",label:"Inventory code",enabled:J.inventory_rules.respect_inventory_code},{key:"break_code_rules",label:"Break Code",enabled:J.break_code_rules.respect_break_code},{key:"is_default_enabled",label:"Default Variant",enabled:J.is_default_enabled}];return o(c,{open:_,closeFunction:function(){return b(!1)},chatAssistantName:"defaultAssistant",organizationName:"techolution",baseUrl:"https://devllmstudio.creativeworkspace.ai",baseWebsocketUrl:"wss://devllmstudio.creativeworkspace.ai/graphql",ThinkingBulbIconComponent:o(s,{}),customSections:o(n,{}),isUseNormalChat:!0,chatTitle:"Create New Learning",formTitle:"Learning Details",initialChatMessage:"Hey! How can I assist you?",template:l.BaseTemplate,templateProps:{state:{title:v,description:T,scopeData:L,whenToApplyConditions:I,whenNotToApplyConditions:S,configData:J,citations:[],citation:{}},handlers:{onTitleChange:function(e){var t,o;return h(null!==(o=null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.value)&&void 0!==o?o:e)},onDescriptionChange:function(e){var t,o;return k(null!==(o=null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.value)&&void 0!==o?o:e)},onAddWhenToApply:function(){return M(x)},onRemoveWhenToApply:function(e){return B(x,e)},onEditWhenToApply:function(e,t){return R(x,e,t)},onAddWhenNotToApply:function(){return M(j)},onRemoveWhenNotToApply:function(e){return B(j,e)},onEditWhenNotToApply:function(e,t){return R(j,e,t)},onScopeChange:W,onConfigChange:E},uiState:{showScope:!1,showConfiguration:!0,titleLabel:"Main Rule Name",scopeLabel:"Define Scope",tierLabel:"Select Tier",descriptionLabel:"Learning Explanation",whenToApplyLabel:"Trigger Events (When to Apply)",whenNotToApplyLabel:"Exclusion Events (When NOT to Apply)",configLabel:"Advanced Settings",stationOptions:d,tierOptions:m,separationItems:U,toggles:H},customNodes:{afterDescription:o(p,e({title:{type:"other",label:"Extra Context Panel"}},{children:o("p",e({style:{padding:"12px",fontSize:"14px",color:"#64748b"}},{children:"Because you decoupled the template, I can inject anything I want here without touching BaseTemplate logic!"}))})),afterTitle:r("div",e({style:{marginBottom:"12px",padding:"8px",backgroundColor:"#f0f4ff",borderRadius:"4px"}},{children:[o("strong",{children:"Tip:"})," Use a clear and descriptive title for your rule to make it easily identifiable later."]}))}}})};export{f as default};
1
+ import{__assign as e}from"tslib";import{jsxs as i,jsx as t}from"react/jsx-runtime";import a from"../../../features/LearningManagement/components/InstantLearningModal.js";import{useTeachMeConfigStore as n,dttWelcomeMessageParts as r,dtt as o,dt as l}from"../../../features/LearningManagement/store/useLMSConfigStore.js";import s from"react-markdown";import{renderToStaticMarkup as d}from"react-dom/server";var p=function(p){var c=p.pluginPayload||{},g=c.editingRule,u=c.editingTier,T=c.editingVariants,m=c.focusedVariantIndex,h=c.setFocusedVariantIndex,L=c.triggerAddVariant,f=c.triggerFixGaps,b=c.copiedRule,A=c.copiedSourceTier,v=c.copiedTargetTier,S=c.initialDraftMessage,y=c.app_integration_id,M=c.modeId;n(function(e){return e.teachMeConfig});var x=r(),I=x.greeting,w=x.subtitle,C=x.actions,N=d(i("p",{children:[t("span",{children:I}),t(s,{children:w}),t("span",e({className:"clickable-button-group"},{children:C.map(function(i){var a=i.label,n=i.value;return t("button",e({className:"clickable-button","data-value":n},{children:a}),a)})}))]})),R={showScope:!1,showConfiguration:!1,welcomeMessage:o("welcomeMessage","Hi! 👋 I'm your Instant Learning Concierge."),formTitle:o("formTitle","Rule setup"),setupLabel:o("setupLabel","Configure your IL"),ruleTitle:o("ruleTitle","Main Rule Name"),scopeLabel:o("scopeLabel","Define Scope"),tierLabel:o("tierLabel","Select Tiers"),ruleDescriptionTitle:o("ruleDescriptionTitle","Learning Explanation"),whenToApplyTitle:o("whenToApplyTitle","Trigger Events (When to Apply)"),addWhenToApplyBtnLabel:o("addWhenToApplyBtnLabel","Add WTA"),whenNotToApplyTitle:o("whenNotToApplyTitle","Exclusion Events (When NOT to Apply)"),addWhenNotToApplyBtnLabel:o("addWhenNotToApplyBtnLabel","Add WNTA"),configTitle:o("configTitle","Advanced Settings"),saveBtnConfig:{label:o("saveBtnLabel","Save Rule"),loadingLabel:o("saveBtnLoadingLabel","Saving Rule...")},chatTitle:o("chatTitle","Teach Me OTJ - {scope} - Add Learning"),chatTitleEdit:o("chatTitleEdit","Teach Me OTJ - {scope} - Edit Learning"),chatTextareaPlaceholder:o("chatTextareaPlaceholder","Tell me more about this learning.."),LearningTerm:l("agents.LearningTerm","Learnings")};return t(a,{isOpen:p.isOpen,onClose:p.onClose,initialScope:p.initialScope,ruleSet:p.ruleSet,editingRule:g,editingTier:u,editingVariants:T,focusedVariantIndex:m,setFocusedVariantIndex:h,triggerAddVariant:L,triggerFixGaps:f,copiedRule:b,copiedSourceTier:A,copiedTargetTier:v,initialDraftMessage:S,initialChatMessage:N,applicationIntegrationId:y,modeId:M,uiStateLabels:R})};export{p as default};
2
2
  //# sourceMappingURL=DefaultTeachMeRenderer.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e,__spreadArray as t}from"tslib";import{jsx as o,Fragment as n,jsxs as r}from"react/jsx-runtime";import{useState as a,useCallback as i}from"react";import{Lightbulb as l}from"lucide-react";import"../../../features/IL-OTJ/_components/atoms/Textarea/Textarea.js";import"../../../features/IL-OTJ/_components/InputDataReasoningCard.js";import"../../../features/IL-OTJ/_components/TooltipComponent.js";import{TemplateList as s}from"../../../features/IL-OTJ/_components/templates/TemplatesMap/templatesMap.js";import"../../../features/IL-OTJ/store/CitationsContext.js";import"@mui/material";import"uuid";import"@mui/material/Tooltip";import"react-markdown";import"rehype-raw";import"axios";import"@e-llm-studio/streaming-response";import"@e-llm-studio/watch-me-work";import"../../../features/IL-OTJ/_components/ChatComponents/ChatHeader.js";import"remark-gfm";import"../../../features/IL-OTJ/_components/MarkdownComponents/MarkdownElements.js";import"../../../features/IL-OTJ/_components/CitationLink.js";import"@e-llm-studio/citation";import"@viswa-test/test-citation";import"../../../features/LearningManagement/LearningManagement.js";import u from"../../../features/IL-OTJ/_components/AccordianSection.js";import p from"../../../features/IL-OTJ/ILOTJ.js";var c={order_rules:{enabled:!1,global_min_separation_seconds:0},advertiser_rules:{enabled:!1,global_min_separation_seconds:0},inventory_rules:{respect_inventory_code:!1},break_code_rules:{respect_break_code:!1},is_default_enabled:!1},d=[{label:"Global Scope",value:"global"},{label:"Genre Scope",value:"genre"},{label:"Custom Scope",value:"custom"}],m=["Tier 1"],_=function(){var _=a(!0),f=_[0],b=_[1],h=a(""),y=h[0],v=h[1],T=a(""),g=T[0],k=T[1],w=a({station:"",tiers:["Tier 1"]}),C=w[0],L=w[1],A=a([]),I=A[0],G=A[1],O=a([]),S=O[0],x=O[1],j=a(c),J=j[0],N=j[1],W=i(function(t,o){L(function(n){var r;return e(e({},n),((r={})[t]=o,r))})},[]),D=i(function(t,o){N(function(n){var r=e({},n);switch(t){case"order_rules":case"advertiser_rules":r[t]="boolean"==typeof o?e(e({},n[t]),{enabled:o}):{enabled:o.enabled,global_min_separation_seconds:o.global_min_separation_seconds};break;case"inventory_rules":r.inventory_rules={respect_inventory_code:"boolean"==typeof o?o:o.respect_inventory_code};break;case"break_code_rules":r.break_code_rules={respect_break_code:"boolean"==typeof o?o:o.respect_break_code};break;case"is_default_enabled":r.is_default_enabled="boolean"==typeof o?o:!!o}return r})},[]),M=function(e){e(function(e){return t(t([],e,!0),[{id:Date.now(),text:"",reasoning:""}],!1)})},B=function(e,t){e(function(e){return e.filter(function(e){return e.id!==t})})},H=function(t,o,n){t(function(t){return t.map(function(t){return String(t.id)===String(o)?e(e({},t),{text:n}):t})})},R=[e({key:"order_rules",label:"Order"},J.order_rules),e({key:"advertiser_rules",label:"Advertiser"},J.advertiser_rules)],q=[{key:"inventory_rules",label:"Inventory code",enabled:J.inventory_rules.respect_inventory_code},{key:"break_code_rules",label:"Break Code",enabled:J.break_code_rules.respect_break_code},{key:"is_default_enabled",label:"Default Variant",enabled:J.is_default_enabled}],z={"Add Guideline":"I would want to add a separation rule","Search Guideline":"I would want to set a max priority rule","Type your query":"I would want to add a break code matching rule"},E="<p><span>Hi! 👋 I'm your Instant Learning Concierge.</span>\n <span>How would you like to get started? You can select an option below or describe the Guideline you’d like to create.</span>\n ".concat(["Add Guideline","Search Guideline","Type your query"].map(function(e){return'<button class="clickable-button" data-value="'.concat(z[e],'">').concat(e,"</button>")}).join(""),"</p>");return o(p,{open:f,closeFunction:function(){return b(!1)},chatAssistantName:"defaultAssistant",organizationName:"techolution",baseUrl:"https://devllmstudio.creativeworkspace.ai",baseWebsocketUrl:"wss://devllmstudio.creativeworkspace.ai/graphql",ThinkingBulbIconComponent:o(l,{}),customSections:o(n,{}),isUseNormalChat:!0,chatTitle:"Create New Guideline",formTitle:"Guideline Details",initialChatMessage:E,template:s.BaseTemplate,templateProps:{state:{title:y,description:g,scopeData:C,whenToApplyConditions:I,whenNotToApplyConditions:S,configData:J,citations:[],citation:{}},handlers:{onTitleChange:function(e){var t,o;return v(null!==(o=null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.value)&&void 0!==o?o:e)},onDescriptionChange:function(e){var t,o;return k(null!==(o=null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.value)&&void 0!==o?o:e)},onAddWhenToApply:function(){return M(G)},onRemoveWhenToApply:function(e){return B(G,e)},onEditWhenToApply:function(e,t){return H(G,e,t)},onAddWhenNotToApply:function(){return M(x)},onRemoveWhenNotToApply:function(e){return B(x,e)},onEditWhenNotToApply:function(e,t){return H(x,e,t)},onScopeChange:W,onConfigChange:D},uiState:{showScope:!1,showConfiguration:!1,titleLabel:"Guideline Name",scopeLabel:"Define Scope",tierLabel:"Select Tier",descriptionLabel:"Guideline Description",whenToApplyLabel:"When to apply this Guideline (When to Apply)",whenNotToApplyLabel:"When not to apply this Guideline (When NOT to Apply)",configLabel:"Advanced Settings",stationOptions:d,tierOptions:m,separationItems:R,toggles:q},customNodes:{afterTitle:o(u,e({title:{type:"other",label:"Guideline"}},{children:o("p",e({style:{padding:"12px",fontSize:"14px",color:"#64748b"}},{children:"HealthCare"}))})),top:r("div",e({style:{marginBottom:"12px",padding:"8px",backgroundColor:"#f0f4ff",borderRadius:"4px"}},{children:[o("strong",{children:"Guideline Template:"})," This is an ILOTJ TeachMe customized for Guideline Value Type"]}))}}})};export{_ as default};
1
+ import{__assign as e,__spreadArray as t}from"tslib";import{jsx as o,Fragment as n,jsxs as r}from"react/jsx-runtime";import{useState as a,useCallback as i}from"react";import{Lightbulb as s}from"lucide-react";import"../../../features/IL-OTJ/_components/atoms/Textarea/Textarea.js";import"../../../features/IL-OTJ/_components/InputDataReasoningCard.js";import"../../../features/IL-OTJ/_components/TooltipComponent.js";import{TemplateList as l}from"../../../features/IL-OTJ/_components/templates/TemplatesMap/templatesMap.js";import"../../../features/IL-OTJ/store/CitationsContext.js";import"@mui/material";import"uuid";import"@mui/material/Tooltip";import"react-markdown";import"rehype-raw";import"axios";import"@e-llm-studio/streaming-response";import"@e-llm-studio/watch-me-work";import"../../../features/IL-OTJ/_components/ChatComponents/ChatHeader.js";import"remark-gfm";import"../../../features/IL-OTJ/_components/MarkdownComponents/MarkdownElements.js";import"../../../features/IL-OTJ/_components/CitationLink.js";import"@e-llm-studio/citation";import"@viswa-test/test-citation";import"../../../features/LearningManagement/store/useLearningTemplateStore.js";import"primereact/toast";import"../../../features/LearningManagement/apis/scopeApis.js";import"../../../features/LearningManagement/store/usePermissionsStore.js";import"../../../features/LearningManagement/store/useLMSConfigStore.js";import"../../../features/LearningManagement/components/ToolTip.js";import"../../../features/LearningManagement/store/useAuthStore.js";import"@mui/icons-material/Check";import"@mui/icons-material/CloseRounded";import"@tanstack/react-query";import"../../../features/LearningManagement/store/useEnvStore.js";import"date-fns";import"framer-motion";import"@mui/icons-material/Close";import p from"../../../features/IL-OTJ/ILOTJ.js";import"../../../features/LearningManagement/store/useConfigStore.js";import"../../../features/LearningManagement/config.js";import"react-dom/server";import u from"../../../features/IL-OTJ/_components/AccordianSection.js";import"appsec-ui";import"@radix-ui/react-tooltip";import"../../../features/LearningManagement/components/StationOnboarding/InputField.js";import"../../../features/LearningManagement/store/useAppSecRolesStore.js";import"@e-llm-studio/audit-log";import"@e-llm-studio/audit-log/dist/styles.css";import"../../../features/LearningManagement/AuditLog/ChangeLogDiff.js";import"react-router-dom";var c={order_rules:{enabled:!1,global_min_separation_seconds:0},advertiser_rules:{enabled:!1,global_min_separation_seconds:0},inventory_rules:{respect_inventory_code:!1},break_code_rules:{respect_break_code:!1},is_default_enabled:!1},d=[{label:"Global Scope",value:"global"},{label:"Genre Scope",value:"genre"},{label:"Custom Scope",value:"custom"}],m=["Tier 1"],f=function(){var f=a(!0),g=f[0],_=f[1],b=a(""),h=b[0],y=b[1],v=a(""),T=v[0],L=v[1],k=a({station:"",tiers:["Tier 1"]}),C=k[0],w=k[1],S=a([]),A=S[0],j=S[1],I=a([]),M=I[0],O=I[1],G=a(c),x=G[0],J=G[1],N=i(function(t,o){w(function(n){var r;return e(e({},n),((r={})[t]=o,r))})},[]),W=i(function(t,o){J(function(n){var r=e({},n);switch(t){case"order_rules":case"advertiser_rules":r[t]="boolean"==typeof o?e(e({},n[t]),{enabled:o}):{enabled:o.enabled,global_min_separation_seconds:o.global_min_separation_seconds};break;case"inventory_rules":r.inventory_rules={respect_inventory_code:"boolean"==typeof o?o:o.respect_inventory_code};break;case"break_code_rules":r.break_code_rules={respect_break_code:"boolean"==typeof o?o:o.respect_break_code};break;case"is_default_enabled":r.is_default_enabled="boolean"==typeof o?o:!!o}return r})},[]),D=function(e){e(function(e){return t(t([],e,!0),[{id:Date.now(),text:"",reasoning:""}],!1)})},R=function(e,t){e(function(e){return e.filter(function(e){return e.id!==t})})},q=function(t,o,n){t(function(t){return t.map(function(t){return String(t.id)===String(o)?e(e({},t),{text:n}):t})})},B=[e({key:"order_rules",label:"Order"},x.order_rules),e({key:"advertiser_rules",label:"Advertiser"},x.advertiser_rules)],E=[{key:"inventory_rules",label:"Inventory code",enabled:x.inventory_rules.respect_inventory_code},{key:"break_code_rules",label:"Break Code",enabled:x.break_code_rules.respect_break_code},{key:"is_default_enabled",label:"Default Variant",enabled:x.is_default_enabled}],H={"Add Guideline":"I would want to add a separation rule","Search Guideline":"I would want to set a max priority rule","Type your query":"I would want to add a break code matching rule"},z="<p><span>Hi! 👋 I'm your Instant Learning Concierge.</span>\n <span>How would you like to get started? You can select an option below or describe the Guideline you’d like to create.</span>\n ".concat(["Add Guideline","Search Guideline","Type your query"].map(function(e){return'<button class="clickable-button" data-value="'.concat(H[e],'">').concat(e,"</button>")}).join(""),"</p>");return o(p,{open:g,closeFunction:function(){return _(!1)},chatAssistantName:"defaultAssistant",organizationName:"techolution",baseUrl:"https://devllmstudio.creativeworkspace.ai",baseWebsocketUrl:"wss://devllmstudio.creativeworkspace.ai/graphql",ThinkingBulbIconComponent:o(s,{}),customSections:o(n,{}),isUseNormalChat:!0,chatTitle:"Create New Guideline",formTitle:"Guideline Details",initialChatMessage:z,template:l.BaseTemplate,templateProps:{state:{title:h,description:T,scopeData:C,whenToApplyConditions:A,whenNotToApplyConditions:M,configData:x,citations:[],citation:{}},handlers:{onTitleChange:function(e){var t,o;return y(null!==(o=null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.value)&&void 0!==o?o:e)},onDescriptionChange:function(e){var t,o;return L(null!==(o=null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.value)&&void 0!==o?o:e)},onAddWhenToApply:function(){return D(j)},onRemoveWhenToApply:function(e){return R(j,e)},onEditWhenToApply:function(e,t){return q(j,e,t)},onAddWhenNotToApply:function(){return D(O)},onRemoveWhenNotToApply:function(e){return R(O,e)},onEditWhenNotToApply:function(e,t){return q(O,e,t)},onScopeChange:N,onConfigChange:W},uiState:{showScope:!1,showConfiguration:!1,titleLabel:"Guideline Name",scopeLabel:"Define Scope",tierLabel:"Select Tier",descriptionLabel:"Guideline Description",whenToApplyLabel:"When to apply this Guideline (When to Apply)",whenNotToApplyLabel:"When not to apply this Guideline (When NOT to Apply)",configLabel:"Advanced Settings",stationOptions:d,tierOptions:m,separationItems:B,toggles:E},customNodes:{afterTitle:o(u,e({title:{type:"other",label:"Guideline"}},{children:o("p",e({style:{padding:"12px",fontSize:"14px",color:"#64748b"}},{children:"HealthCare"}))})),top:r("div",e({style:{marginBottom:"12px",padding:"8px",backgroundColor:"#f0f4ff",borderRadius:"4px"}},{children:[o("strong",{children:"Guideline Template:"})," This is an ILOTJ TeachMe customized for Guideline Value Type"]}))}}})};export{f as default};
2
2
  //# sourceMappingURL=GuidelinesTeachMeRenderer.js.map