@wildo-ai/saas-frontend-lib 1.1.15 → 1.1.17

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 (241) hide show
  1. package/dist/esm/components/compliance/EmbeddedSigningFrame.d.ts.map +1 -1
  2. package/dist/esm/components/compliance/EmbeddedSigningFrame.js +17 -6
  3. package/dist/esm/components/compliance/EmbeddedSigningFrame.js.map +1 -1
  4. package/dist/esm/components/data-display/approval-seal.d.ts +7 -5
  5. package/dist/esm/components/data-display/approval-seal.d.ts.map +1 -1
  6. package/dist/esm/components/data-display/approval-seal.js +10 -4
  7. package/dist/esm/components/data-display/approval-seal.js.map +1 -1
  8. package/dist/esm/components/data-display/signature-requests.d.ts +81 -0
  9. package/dist/esm/components/data-display/signature-requests.d.ts.map +1 -0
  10. package/dist/esm/components/data-display/signature-requests.js +123 -0
  11. package/dist/esm/components/data-display/signature-requests.js.map +1 -0
  12. package/dist/esm/components/flows-actors/approval.d.ts.map +1 -1
  13. package/dist/esm/components/flows-actors/approval.js +8 -15
  14. package/dist/esm/components/flows-actors/approval.js.map +1 -1
  15. package/dist/esm/components/flows-actors/approval.labels.d.ts.map +1 -1
  16. package/dist/esm/components/flows-actors/approval.labels.js +3 -0
  17. package/dist/esm/components/flows-actors/approval.labels.js.map +1 -1
  18. package/dist/esm/components/flows-actors/task-detail.d.ts +12 -1
  19. package/dist/esm/components/flows-actors/task-detail.d.ts.map +1 -1
  20. package/dist/esm/components/flows-actors/task-detail.js +2 -2
  21. package/dist/esm/components/flows-actors/task-detail.js.map +1 -1
  22. package/dist/esm/components/form/automated/ResourceAutomatedForm.d.ts.map +1 -1
  23. package/dist/esm/components/form/automated/ResourceAutomatedForm.js +44 -29
  24. package/dist/esm/components/form/automated/ResourceAutomatedForm.js.map +1 -1
  25. package/dist/esm/components/navigation/NavigationItemBadge.d.ts +16 -0
  26. package/dist/esm/components/navigation/NavigationItemBadge.d.ts.map +1 -1
  27. package/dist/esm/components/navigation/NavigationItemBadge.js +14 -2
  28. package/dist/esm/components/navigation/NavigationItemBadge.js.map +1 -1
  29. package/dist/esm/components/navigation/app-level/ApplicationLevel_NavigationBack.d.ts +3 -3
  30. package/dist/esm/components/navigation/app-level/ApplicationLevel_NavigationBack.js +3 -3
  31. package/dist/esm/components/navigation/app-level/ApplicationLevel_NavigationBack.js.map +1 -1
  32. package/dist/esm/components/navigation/app-level/SidebarResourceBrowser.d.ts +5 -13
  33. package/dist/esm/components/navigation/app-level/SidebarResourceBrowser.d.ts.map +1 -1
  34. package/dist/esm/components/navigation/app-level/SidebarResourceBrowser.js +30 -255
  35. package/dist/esm/components/navigation/app-level/SidebarResourceBrowser.js.map +1 -1
  36. package/dist/esm/components/navigation/app-level/useCommandMenuBehavior.d.ts +22 -1
  37. package/dist/esm/components/navigation/app-level/useCommandMenuBehavior.d.ts.map +1 -1
  38. package/dist/esm/components/navigation/app-level/useCommandMenuBehavior.js +57 -26
  39. package/dist/esm/components/navigation/app-level/useCommandMenuBehavior.js.map +1 -1
  40. package/dist/esm/components/navigation/app-level/useMenuBarBehavior.d.ts +1 -1
  41. package/dist/esm/components/navigation/app-level/useMenuBarBehavior.d.ts.map +1 -1
  42. package/dist/esm/components/navigation/app-level/useMenuBarBehavior.js +35 -1
  43. package/dist/esm/components/navigation/app-level/useMenuBarBehavior.js.map +1 -1
  44. package/dist/esm/components/navigation/app-level/useMenuUserOrgBehavior.d.ts +1 -1
  45. package/dist/esm/components/navigation/app-level/useMenuUserOrgBehavior.d.ts.map +1 -1
  46. package/dist/esm/components/navigation/app-level/useMenuUserOrgBehavior.js +26 -4
  47. package/dist/esm/components/navigation/app-level/useMenuUserOrgBehavior.js.map +1 -1
  48. package/dist/esm/components/navigation/app-level/useNavigationBackBehavior.d.ts +31 -0
  49. package/dist/esm/components/navigation/app-level/useNavigationBackBehavior.d.ts.map +1 -0
  50. package/dist/esm/components/navigation/app-level/useNavigationBackBehavior.js +42 -0
  51. package/dist/esm/components/navigation/app-level/useNavigationBackBehavior.js.map +1 -0
  52. package/dist/esm/components/navigation/app-level/useSidebarResourceBrowser.d.ts +76 -0
  53. package/dist/esm/components/navigation/app-level/useSidebarResourceBrowser.d.ts.map +1 -0
  54. package/dist/esm/components/navigation/app-level/useSidebarResourceBrowser.js +268 -0
  55. package/dist/esm/components/navigation/app-level/useSidebarResourceBrowser.js.map +1 -0
  56. package/dist/esm/components/navigation/command.d.ts +5 -0
  57. package/dist/esm/components/navigation/command.d.ts.map +1 -1
  58. package/dist/esm/components/navigation/command.js.map +1 -1
  59. package/dist/esm/components/resources/ResourceLayout_DangerZone.d.ts.map +1 -1
  60. package/dist/esm/components/resources/ResourceLayout_DangerZone.js +5 -2
  61. package/dist/esm/components/resources/ResourceLayout_DangerZone.js.map +1 -1
  62. package/dist/esm/components/resources/ResourceLayout_InsertedViews.d.ts.map +1 -1
  63. package/dist/esm/components/resources/ResourceLayout_InsertedViews.js +5 -1
  64. package/dist/esm/components/resources/ResourceLayout_InsertedViews.js.map +1 -1
  65. package/dist/esm/components/resources/ResourceLayout_List.d.ts.map +1 -1
  66. package/dist/esm/components/resources/ResourceLayout_List.js +4 -1
  67. package/dist/esm/components/resources/ResourceLayout_List.js.map +1 -1
  68. package/dist/esm/components/resources/ResourceLayout_RecordSharing.d.ts.map +1 -1
  69. package/dist/esm/components/resources/ResourceLayout_RecordSharing.js +4 -1
  70. package/dist/esm/components/resources/ResourceLayout_RecordSharing.js.map +1 -1
  71. package/dist/esm/components/resources/collection/board/ResourceCollectionBody_Board.d.ts.map +1 -1
  72. package/dist/esm/components/resources/collection/board/ResourceCollectionBody_Board.js +4 -1
  73. package/dist/esm/components/resources/collection/board/ResourceCollectionBody_Board.js.map +1 -1
  74. package/dist/esm/components/resources/collection/calendar/ResourceCollectionBody_Calendar.d.ts.map +1 -1
  75. package/dist/esm/components/resources/collection/calendar/ResourceCollectionBody_Calendar.js +4 -1
  76. package/dist/esm/components/resources/collection/calendar/ResourceCollectionBody_Calendar.js.map +1 -1
  77. package/dist/esm/components/resources/collection/timeline/ResourceCollectionBody_Timeline.d.ts.map +1 -1
  78. package/dist/esm/components/resources/collection/timeline/ResourceCollectionBody_Timeline.js +4 -1
  79. package/dist/esm/components/resources/collection/timeline/ResourceCollectionBody_Timeline.js.map +1 -1
  80. package/dist/esm/components/resources/skeleton/Group.d.ts.map +1 -1
  81. package/dist/esm/components/resources/skeleton/Group.js +4 -1
  82. package/dist/esm/components/resources/skeleton/Group.js.map +1 -1
  83. package/dist/esm/components/sections/ContentSectionContainer.d.ts.map +1 -1
  84. package/dist/esm/components/sections/ContentSectionContainer.js +11 -7
  85. package/dist/esm/components/sections/ContentSectionContainer.js.map +1 -1
  86. package/dist/esm/components/sections/content-section.d.ts +1 -3
  87. package/dist/esm/components/sections/content-section.d.ts.map +1 -1
  88. package/dist/esm/components/sections/content-section.js.map +1 -1
  89. package/dist/esm/components/settings/AppPage_AgentActivitySettings.d.ts +79 -0
  90. package/dist/esm/components/settings/AppPage_AgentActivitySettings.d.ts.map +1 -0
  91. package/dist/esm/components/settings/AppPage_AgentActivitySettings.js +272 -0
  92. package/dist/esm/components/settings/AppPage_AgentActivitySettings.js.map +1 -0
  93. package/dist/esm/components/settings/AppPage_AgentActivitySettings.labels.d.ts +3 -0
  94. package/dist/esm/components/settings/AppPage_AgentActivitySettings.labels.d.ts.map +1 -0
  95. package/dist/esm/components/settings/AppPage_AgentActivitySettings.labels.js +66 -0
  96. package/dist/esm/components/settings/AppPage_AgentActivitySettings.labels.js.map +1 -0
  97. package/dist/esm/components/settings/AppPage_ConnectedAccountsSettings.d.ts +12 -0
  98. package/dist/esm/components/settings/AppPage_ConnectedAccountsSettings.d.ts.map +1 -1
  99. package/dist/esm/components/settings/AppPage_ConnectedAccountsSettings.js +28 -6
  100. package/dist/esm/components/settings/AppPage_ConnectedAccountsSettings.js.map +1 -1
  101. package/dist/esm/components/settings/SettingsHub.d.ts.map +1 -1
  102. package/dist/esm/components/settings/SettingsHub.js +6 -0
  103. package/dist/esm/components/settings/SettingsHub.js.map +1 -1
  104. package/dist/esm/components/typography/document-heading-level.d.ts +28 -0
  105. package/dist/esm/components/typography/document-heading-level.d.ts.map +1 -0
  106. package/dist/esm/components/typography/document-heading-level.js +63 -0
  107. package/dist/esm/components/typography/document-heading-level.js.map +1 -0
  108. package/dist/esm/components/views/chart-view/ChartView.d.ts.map +1 -1
  109. package/dist/esm/components/views/chart-view/ChartView.js +20 -16
  110. package/dist/esm/components/views/chart-view/ChartView.js.map +1 -1
  111. package/dist/esm/components/views/chart-view/ChartView.labels.d.ts.map +1 -1
  112. package/dist/esm/components/views/chart-view/ChartView.labels.js +7 -0
  113. package/dist/esm/components/views/chart-view/ChartView.labels.js.map +1 -1
  114. package/dist/esm/components/views/chart-view/option-builder/builder-utils.d.ts +12 -3
  115. package/dist/esm/components/views/chart-view/option-builder/builder-utils.d.ts.map +1 -1
  116. package/dist/esm/components/views/chart-view/option-builder/builder-utils.js +18 -11
  117. package/dist/esm/components/views/chart-view/option-builder/builder-utils.js.map +1 -1
  118. package/dist/esm/components/views/chart-view/option-builder/builders/bar-family.builder.d.ts.map +1 -1
  119. package/dist/esm/components/views/chart-view/option-builder/builders/bar-family.builder.js +2 -1
  120. package/dist/esm/components/views/chart-view/option-builder/builders/bar-family.builder.js.map +1 -1
  121. package/dist/esm/components/views/chart-view/option-builder/builders/funnel.builder.d.ts.map +1 -1
  122. package/dist/esm/components/views/chart-view/option-builder/builders/funnel.builder.js +7 -3
  123. package/dist/esm/components/views/chart-view/option-builder/builders/funnel.builder.js.map +1 -1
  124. package/dist/esm/components/views/chart-view/option-builder/builders/gauge.builder.d.ts.map +1 -1
  125. package/dist/esm/components/views/chart-view/option-builder/builders/gauge.builder.js +6 -2
  126. package/dist/esm/components/views/chart-view/option-builder/builders/gauge.builder.js.map +1 -1
  127. package/dist/esm/components/views/chart-view/option-builder/builders/heatmap.builder.d.ts.map +1 -1
  128. package/dist/esm/components/views/chart-view/option-builder/builders/heatmap.builder.js +7 -1
  129. package/dist/esm/components/views/chart-view/option-builder/builders/heatmap.builder.js.map +1 -1
  130. package/dist/esm/components/views/chart-view/option-builder/builders/hierarchical-family.builder.d.ts.map +1 -1
  131. package/dist/esm/components/views/chart-view/option-builder/builders/hierarchical-family.builder.js +13 -9
  132. package/dist/esm/components/views/chart-view/option-builder/builders/hierarchical-family.builder.js.map +1 -1
  133. package/dist/esm/components/views/chart-view/option-builder/builders/line-family.builder.d.ts.map +1 -1
  134. package/dist/esm/components/views/chart-view/option-builder/builders/line-family.builder.js +2 -1
  135. package/dist/esm/components/views/chart-view/option-builder/builders/line-family.builder.js.map +1 -1
  136. package/dist/esm/components/views/chart-view/option-builder/builders/parallel.builder.d.ts.map +1 -1
  137. package/dist/esm/components/views/chart-view/option-builder/builders/parallel.builder.js +2 -1
  138. package/dist/esm/components/views/chart-view/option-builder/builders/parallel.builder.js.map +1 -1
  139. package/dist/esm/components/views/chart-view/option-builder/builders/pie-family.builder.d.ts.map +1 -1
  140. package/dist/esm/components/views/chart-view/option-builder/builders/pie-family.builder.js +4 -3
  141. package/dist/esm/components/views/chart-view/option-builder/builders/pie-family.builder.js.map +1 -1
  142. package/dist/esm/components/views/chart-view/option-builder/builders/radar.builder.d.ts.map +1 -1
  143. package/dist/esm/components/views/chart-view/option-builder/builders/radar.builder.js +2 -1
  144. package/dist/esm/components/views/chart-view/option-builder/builders/radar.builder.js.map +1 -1
  145. package/dist/esm/components/views/chart-view/option-builder/builders/sankey.builder.d.ts.map +1 -1
  146. package/dist/esm/components/views/chart-view/option-builder/builders/sankey.builder.js +5 -1
  147. package/dist/esm/components/views/chart-view/option-builder/builders/sankey.builder.js.map +1 -1
  148. package/dist/esm/components/views/chart-view/option-builder/builders/statistical-family.builder.d.ts.map +1 -1
  149. package/dist/esm/components/views/chart-view/option-builder/builders/statistical-family.builder.js +4 -3
  150. package/dist/esm/components/views/chart-view/option-builder/builders/statistical-family.builder.js.map +1 -1
  151. package/dist/esm/components/views/composite-view/CompositeView.d.ts +6 -0
  152. package/dist/esm/components/views/composite-view/CompositeView.d.ts.map +1 -1
  153. package/dist/esm/components/views/composite-view/CompositeView.js +12 -2
  154. package/dist/esm/components/views/composite-view/CompositeView.js.map +1 -1
  155. package/dist/esm/components/views/flows-actors-view/ConversationLinkPage.d.ts +57 -0
  156. package/dist/esm/components/views/flows-actors-view/ConversationLinkPage.d.ts.map +1 -0
  157. package/dist/esm/components/views/flows-actors-view/ConversationLinkPage.js +136 -0
  158. package/dist/esm/components/views/flows-actors-view/ConversationLinkPage.js.map +1 -0
  159. package/dist/esm/components/views/flows-actors-view/FlowsActorsView.d.ts +20 -0
  160. package/dist/esm/components/views/flows-actors-view/FlowsActorsView.d.ts.map +1 -1
  161. package/dist/esm/components/views/flows-actors-view/FlowsActorsView.js +139 -22
  162. package/dist/esm/components/views/flows-actors-view/FlowsActorsView.js.map +1 -1
  163. package/dist/esm/components/views/flows-actors-view/FlowsActorsView.labels.d.ts.map +1 -1
  164. package/dist/esm/components/views/flows-actors-view/FlowsActorsView.labels.js +5 -0
  165. package/dist/esm/components/views/flows-actors-view/FlowsActorsView.labels.js.map +1 -1
  166. package/dist/esm/components/views/flows-actors-view/held-conversation-selection.d.ts +4 -0
  167. package/dist/esm/components/views/flows-actors-view/held-conversation-selection.d.ts.map +1 -1
  168. package/dist/esm/components/views/flows-actors-view/held-conversation-selection.js +19 -0
  169. package/dist/esm/components/views/flows-actors-view/held-conversation-selection.js.map +1 -1
  170. package/dist/esm/components/views/flows-actors-view/linked-conversation.context.d.ts +26 -0
  171. package/dist/esm/components/views/flows-actors-view/linked-conversation.context.d.ts.map +1 -0
  172. package/dist/esm/components/views/flows-actors-view/linked-conversation.context.js +3 -0
  173. package/dist/esm/components/views/flows-actors-view/linked-conversation.context.js.map +1 -0
  174. package/dist/esm/core/app-shell/app-shell.schemas.d.ts +87 -16
  175. package/dist/esm/core/app-shell/app-shell.schemas.d.ts.map +1 -1
  176. package/dist/esm/core/app-shell/app-shell.schemas.js +16 -0
  177. package/dist/esm/core/app-shell/app-shell.schemas.js.map +1 -1
  178. package/dist/esm/core/components-registry/assert-registry-completeness.frontend.helper.d.ts.map +1 -1
  179. package/dist/esm/core/components-registry/assert-registry-completeness.frontend.helper.js +1 -0
  180. package/dist/esm/core/components-registry/assert-registry-completeness.frontend.helper.js.map +1 -1
  181. package/dist/esm/core/config/composite-view.schemas.d.ts +19 -0
  182. package/dist/esm/core/config/composite-view.schemas.d.ts.map +1 -1
  183. package/dist/esm/core/config/composite-view.schemas.js.map +1 -1
  184. package/dist/esm/core/config/engine-settings-destinations.d.ts.map +1 -1
  185. package/dist/esm/core/config/engine-settings-destinations.js +23 -0
  186. package/dist/esm/core/config/engine-settings-destinations.js.map +1 -1
  187. package/dist/esm/core/config/settings-hub-presentation.frontend.utils.d.ts.map +1 -1
  188. package/dist/esm/core/config/settings-hub-presentation.frontend.utils.js +3 -0
  189. package/dist/esm/core/config/settings-hub-presentation.frontend.utils.js.map +1 -1
  190. package/dist/esm/core/config/settings-hub.frontend.schemas.d.ts +12 -0
  191. package/dist/esm/core/config/settings-hub.frontend.schemas.d.ts.map +1 -1
  192. package/dist/esm/core/config/settings-hub.frontend.schemas.js +12 -0
  193. package/dist/esm/core/config/settings-hub.frontend.schemas.js.map +1 -1
  194. package/dist/esm/core/events/events.frontend.schemas.d.ts +16 -0
  195. package/dist/esm/core/events/events.frontend.schemas.d.ts.map +1 -1
  196. package/dist/esm/core/flows-actors/FlowsActorsContext.d.ts +10 -1
  197. package/dist/esm/core/flows-actors/FlowsActorsContext.d.ts.map +1 -1
  198. package/dist/esm/core/flows-actors/FlowsActorsContext.js +12 -3
  199. package/dist/esm/core/flows-actors/FlowsActorsContext.js.map +1 -1
  200. package/dist/esm/core/flows-actors/conversation-history.model.d.ts +19 -1
  201. package/dist/esm/core/flows-actors/conversation-history.model.d.ts.map +1 -1
  202. package/dist/esm/core/flows-actors/conversation-history.model.js +45 -4
  203. package/dist/esm/core/flows-actors/conversation-history.model.js.map +1 -1
  204. package/dist/esm/core/navigation/NavigationContentAreas.d.ts +0 -5
  205. package/dist/esm/core/navigation/NavigationContentAreas.d.ts.map +1 -1
  206. package/dist/esm/core/navigation/NavigationContentAreas.js +27 -1
  207. package/dist/esm/core/navigation/NavigationContentAreas.js.map +1 -1
  208. package/dist/esm/core/navigation/navigation.schemas.d.ts +20 -0
  209. package/dist/esm/core/navigation/navigation.schemas.d.ts.map +1 -1
  210. package/dist/esm/core/navigation/navigation.schemas.js +4 -0
  211. package/dist/esm/core/navigation/navigation.schemas.js.map +1 -1
  212. package/dist/esm/core/navigation/useNavigationRouterSync.d.ts.map +1 -1
  213. package/dist/esm/core/navigation/useNavigationRouterSync.js +5 -1
  214. package/dist/esm/core/navigation/useNavigationRouterSync.js.map +1 -1
  215. package/dist/esm/core/requests/wildo-http-client-manual-calls.frontend.service.d.ts +59 -5
  216. package/dist/esm/core/requests/wildo-http-client-manual-calls.frontend.service.d.ts.map +1 -1
  217. package/dist/esm/core/requests/wildo-http-client-manual-calls.frontend.service.js +58 -1
  218. package/dist/esm/core/requests/wildo-http-client-manual-calls.frontend.service.js.map +1 -1
  219. package/dist/esm/core/resources/hooks/useOperationEnabled.d.ts.map +1 -1
  220. package/dist/esm/core/resources/hooks/useOperationEnabled.js +41 -3
  221. package/dist/esm/core/resources/hooks/useOperationEnabled.js.map +1 -1
  222. package/dist/esm/core/resources/resources-repository.frontend.service.d.ts.map +1 -1
  223. package/dist/esm/core/resources/resources-repository.frontend.service.js +2 -0
  224. package/dist/esm/core/resources/resources-repository.frontend.service.js.map +1 -1
  225. package/dist/esm/core/runtime/AppRouter.d.ts.map +1 -1
  226. package/dist/esm/core/runtime/AppRouter.js +2 -1
  227. package/dist/esm/core/runtime/AppRouter.js.map +1 -1
  228. package/dist/esm/core/runtime/routes.frontend.definitions.d.ts +6 -0
  229. package/dist/esm/core/runtime/routes.frontend.definitions.d.ts.map +1 -1
  230. package/dist/esm/core/runtime/routes.frontend.definitions.js +7 -1
  231. package/dist/esm/core/runtime/routes.frontend.definitions.js.map +1 -1
  232. package/dist/esm/core/search/command-score.d.ts +33 -0
  233. package/dist/esm/core/search/command-score.d.ts.map +1 -0
  234. package/dist/esm/core/search/command-score.js +109 -0
  235. package/dist/esm/core/search/command-score.js.map +1 -0
  236. package/dist/esm/index.d.ts +5 -0
  237. package/dist/esm/index.d.ts.map +1 -1
  238. package/dist/esm/index.js +5 -0
  239. package/dist/esm/index.js.map +1 -1
  240. package/dist/tsconfig.build.tsbuildinfo +1 -1
  241. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"statistical-family.builder.js","sourceRoot":"","sources":["../../../../../../../src/components/views/chart-view/option-builder/builders/statistical-family.builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGlD,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,8EAA8E,CAAC;AAEjK,MAAM,OAAO,wBAAwB;IACnC,cAAc,GAAG,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAErC,KAAK,CAAC,GAAsB,EAAE,UAAmC;QAC/D,MAAM,IAAI,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;QAC3B,IAAI,CAAC,IAAI;YAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;QACjC,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,eAAe,IAAI,EAAE,CAA4B,CAAC;QAE9E,MAAM,YAAY,GAAG,sBAAsB,CAAC,GAAG,CAAC,CAAC;QACjD,MAAM,UAAU,GAAG,sBAAsB,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QAE3E,MAAM,QAAQ,GAAG,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,QAAQ,CAAC;QAEnD,gFAAgF;QAChF,uEAAuE;QACvE,MAAM,aAAa,G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AAC,KAAK,CAAC,CAAC;QAC/B,IAAI,KAAK,KAAK,KAAK;YAAE,OAAO,MAAM,CAAC,KAAK,CAAE,CAAC;QAC3C,MAAM,QAAQ,GAAG,KAAK,GAAG,KAAK,CAAC;QAC/B,OAAO,MAAM,CAAC,KAAK,CAAE,GAAG,QAAQ,GAAG,CAAC,MAAM,CAAC,KAAK,CAAE,GAAG,MAAM,CAAC,KAAK,CAAE,CAAC,CAAC;IACvE,CAAC;CACF","sourcesContent":["/** Statistical family builder: BOXPLOT\n *\n * Boxplot expects pre-computed statistical data or raw value arrays.\n * For the aggregation engine, we expect measures like:\n * - min, q1, median, q3, max (five-number summary)\n * or ARRAY_AGG for raw values that are then computed client-side.\n *\n * This builder supports both modes:\n * 1. Pre-computed: 5 measures per series (min, q1, median, q3, max)\n * 2. Raw arrays: single ARRAY_AGG measure → compute boxplot stats client-side\n */\n\nimport { ChartType } from '@wildo-ai/saas-models';\nimport type { ChartSeriesDefinition, ChartTypeConfig_Boxplot } from '@wildo-ai/saas-models';\nimport type { ChartTypeBuilder, ChartBuildContext, ChartBuildResult } from '~wildo-frontend-lib/components/views/chart-view/option-builder/chart-type-builder.interface';\nimport { getPrimaryDimensionRef, extractDimensionValues, resolveSeriesName } from '~wildo-frontend-lib/components/views/chart-view/option-builder/builder-utils';\n\nexport class StatisticalFamilyBuilder implements ChartTypeBuilder {\n supportedTypes = [ChartType.BOXPLOT];\n\n build(ctx: ChartBuildContext, seriesDefs: ChartSeriesDefinition[]): ChartBuildResult {\n const sDef = seriesDefs[0];\n if (!sDef) return { series: [] };\n const cfg = (ctx.definition.chartTypeConfig ?? {}) as ChartTypeConfig_Boxplot;\n\n const dimensionRef = getPrimaryDimensionRef(ctx);\n const categories = extractDimensionValues(ctx.response.data, dimensionRef);\n\n const measures = ctx.definition.dataQuery.measures;\n\n // Determine mode: if 5+ measures exist, assume pre-computed five-number summary\n // Otherwise, check if the first measure is likely an array (ARRAY_AGG)\n const isPreComputed = measures.length >= 5;\n\n let boxData: number[][];\n\n if (isPreComputed) {\n // Pre-computed mode: try to match measures by ref suffix or label convention.\n // Expected order: [min, q1, median, q3, max]\n // 1. If refs contain \"_min\", \"_q1\", \"_median\", \"_q3\", \"_max\" suffixes, use those\n // 2. Otherwise fall back to positional ordering: measures[0]=min, [1]=q1, [2]=median, [3]=q3, [4]=max\n const findByHint = (hints: string[]): typeof measures[number] | undefined =>\n measures.find(m => hints.some(h =>\n m.ref.toLowerCase().endsWith(`_${h}`) || m.label?.toLowerCase() === h,\n ));\n\n const orderedMeasures = (() => {\n const minM = findByHint(['min']);\n const q1M = findByHint(['q1', 'lower_quartile']);\n const medM = findByHint(['median', 'med', 'p50']);\n const q3M = findByHint(['q3', 'upper_quartile']);\n const maxM = findByHint(['max']);\n\n if (minM && q1M && medM && q3M && maxM) {\n return [minM, q1M, medM, q3M, maxM];\n }\n // Fallback: positional order (first 5 measures)\n return measures.slice(0, 5);\n })();\n\n boxData = ctx.response.data.map(row => {\n return orderedMeasures.map(m => Number(row[m.ref]) || 0);\n });\n } else {\n // Array mode: each row has an array value\n boxData = ctx.response.data.map(row => {\n const values = row[sDef.measureRef];\n if (Array.isArray(values)) {\n return this.computeBoxplotStats(values.map(Number).filter(v => !isNaN(v)));\n }\n // Single value — degenerate boxplot\n const v = Number(values) || 0;\n return [v, v, v, v, v];\n });\n }\n\n const sName = resolveSeriesName(sDef, ctx.t);\n const item: Record<string, unknown> = {\n type: 'boxplot',\n name: sName,\n data: boxData,\n };\n\n return {\n series: [item],\n xAxis: {\n type: 'category',\n data: categories,\n boundaryGap: cfg.boundaryGap ?? true,\n axisLabel: { hideOverlap: ctx.chartStylePreset.axis.hideOverlap ?? true },\n },\n yAxis: {\n type: 'value',\n name: sName,\n },\n };\n }\n\n /**\n * Compute five-number summary from an array of numbers.\n * Returns [min, q1, median, q3, max].\n */\n private computeBoxplotStats(values: number[]): number[] {\n if (values.length === 0) return [0, 0, 0, 0, 0];\n\n const sorted = [...values].sort((a, b) => a - b);\n const n = sorted.length;\n\n const min = sorted[0]!;\n const max = sorted[n - 1]!;\n const median = this.percentile(sorted, 50);\n const q1 = this.percentile(sorted, 25);\n const q3 = this.percentile(sorted, 75);\n\n return [min, q1, median, q3, max];\n }\n\n private percentile(sorted: number[], p: number): number {\n const index = (p / 100) * (sorted.length - 1);\n const lower = Math.floor(index);\n const upper = Math.ceil(index);\n if (lower === upper) return sorted[lower]!;\n const fraction = index - lower;\n return sorted[lower]! + fraction * (sorted[upper]! - sorted[lower]!);\n }\n}\n"]}
1
+ {"version":3,"file":"statistical-family.builder.js","sourceRoot":"","sources":["../../../../../../../src/components/views/chart-view/option-builder/builders/statistical-family.builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAGtD,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,8EAA8E,CAAC;AAEjK,MAAM,OAAO,wBAAwB;IACnC,cAAc,GAAG,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAErC,KAAK,CAAC,GAAsB,EAAE,UAAmC;QAC/D,MAAM,IAAI,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;QAC3B,IAAI,CAAC,IAAI;YAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;QACjC,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,eAAe,IAAI,EAAE,CAA4B,CAAC;QAE9E,MAAM,YAAY,GAAG,sBAAsB,CAAC,GAAG,CAAC,CAAC;QACjD,MAAM,UAAU,GAAG,sBAAsB,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QAE3E,MAAM,QAAQ,GAAG,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,QAAQ,CAAC;QAEnD,gFAAgF;QAChF,uEAA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,KAAK,CAAC,CAAC;QAChC,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/B,IAAI,KAAK,KAAK,KAAK;YAAE,OAAO,MAAM,CAAC,KAAK,CAAE,CAAC;QAC3C,MAAM,QAAQ,GAAG,KAAK,GAAG,KAAK,CAAC;QAC/B,OAAO,MAAM,CAAC,KAAK,CAAE,GAAG,QAAQ,GAAG,CAAC,MAAM,CAAC,KAAK,CAAE,GAAG,MAAM,CAAC,KAAK,CAAE,CAAC,CAAC;IACvE,CAAC;CACF","sourcesContent":["/** Statistical family builder: BOXPLOT\n *\n * Boxplot expects pre-computed statistical data or raw value arrays.\n * For the aggregation engine, we expect measures like:\n * - min, q1, median, q3, max (five-number summary)\n * or ARRAY_AGG for raw values that are then computed client-side.\n *\n * This builder supports both modes:\n * 1. Pre-computed: 5 measures per series (min, q1, median, q3, max)\n * 2. Raw arrays: single ARRAY_AGG measure → compute boxplot stats client-side\n */\n\nimport { ChartType } from '@wildo-ai/saas-models';\nimport { measureValueOrNull } from '../builder-utils';\nimport type { ChartSeriesDefinition, ChartTypeConfig_Boxplot } from '@wildo-ai/saas-models';\nimport type { ChartTypeBuilder, ChartBuildContext, ChartBuildResult } from '~wildo-frontend-lib/components/views/chart-view/option-builder/chart-type-builder.interface';\nimport { getPrimaryDimensionRef, extractDimensionValues, resolveSeriesName } from '~wildo-frontend-lib/components/views/chart-view/option-builder/builder-utils';\n\nexport class StatisticalFamilyBuilder implements ChartTypeBuilder {\n supportedTypes = [ChartType.BOXPLOT];\n\n build(ctx: ChartBuildContext, seriesDefs: ChartSeriesDefinition[]): ChartBuildResult {\n const sDef = seriesDefs[0];\n if (!sDef) return { series: [] };\n const cfg = (ctx.definition.chartTypeConfig ?? {}) as ChartTypeConfig_Boxplot;\n\n const dimensionRef = getPrimaryDimensionRef(ctx);\n const categories = extractDimensionValues(ctx.response.data, dimensionRef);\n\n const measures = ctx.definition.dataQuery.measures;\n\n // Determine mode: if 5+ measures exist, assume pre-computed five-number summary\n // Otherwise, check if the first measure is likely an array (ARRAY_AGG)\n const isPreComputed = measures.length >= 5;\n\n let boxData: number[][];\n\n if (isPreComputed) {\n // Pre-computed mode: try to match measures by ref suffix or label convention.\n // Expected order: [min, q1, median, q3, max]\n // 1. If refs contain \"_min\", \"_q1\", \"_median\", \"_q3\", \"_max\" suffixes, use those\n // 2. Otherwise fall back to positional ordering: measures[0]=min, [1]=q1, [2]=median, [3]=q3, [4]=max\n const findByHint = (hints: string[]): typeof measures[number] | undefined =>\n measures.find(m => hints.some(h =>\n m.ref.toLowerCase().endsWith(`_${h}`) || m.label?.toLowerCase() === h,\n ));\n\n const orderedMeasures = (() => {\n const minM = findByHint(['min']);\n const q1M = findByHint(['q1', 'lower_quartile']);\n const medM = findByHint(['median', 'med', 'p50']);\n const q3M = findByHint(['q3', 'upper_quartile']);\n const maxM = findByHint(['max']);\n\n if (minM && q1M && medM && q3M && maxM) {\n return [minM, q1M, medM, q3M, maxM];\n }\n // Fallback: positional order (first 5 measures)\n return measures.slice(0, 5);\n })();\n\n boxData = ctx.response.data.map(row => {\n return orderedMeasures.map(m => measureValueOrNull(row[m.ref]));\n });\n } else {\n // Array mode: each row has an array value\n boxData = ctx.response.data.map(row => {\n const values = row[sDef.measureRef];\n if (Array.isArray(values)) {\n return this.computeBoxplotStats(values.map(Number).filter(v => !isNaN(v)));\n }\n // Single value — degenerate boxplot\n const v = measureValueOrNull(values);\n return v === null ? [] : [v, v, v, v, v];\n });\n }\n\n const sName = resolveSeriesName(sDef, ctx.t);\n const item: Record<string, unknown> = {\n type: 'boxplot',\n name: sName,\n data: boxData,\n };\n\n return {\n series: [item],\n xAxis: {\n type: 'category',\n data: categories,\n boundaryGap: cfg.boundaryGap ?? true,\n axisLabel: { hideOverlap: ctx.chartStylePreset.axis.hideOverlap ?? true },\n },\n yAxis: {\n type: 'value',\n name: sName,\n },\n };\n }\n\n /**\n * Compute five-number summary from an array of numbers.\n * Returns [min, q1, median, q3, max].\n */\n private computeBoxplotStats(values: number[]): number[] {\n if (values.length === 0) return [0, 0, 0, 0, 0];\n\n const sorted = [...values].sort((a, b) => a - b);\n const n = sorted.length;\n\n const min = sorted[0]!;\n const max = sorted[n - 1]!;\n const median = this.percentile(sorted, 50);\n const q1 = this.percentile(sorted, 25);\n const q3 = this.percentile(sorted, 75);\n\n return [min, q1, median, q3, max];\n }\n\n private percentile(sorted: number[], p: number): number {\n const index = (p / 100) * (sorted.length - 1);\n const lower = Math.floor(index);\n const upper = Math.ceil(index);\n if (lower === upper) return sorted[lower]!;\n const fraction = index - lower;\n return sorted[lower]! + fraction * (sorted[upper]! - sorted[lower]!);\n }\n}\n"]}
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { type CompositeViewDefinition } from '../../../core/config/composite-view.schemas';
3
3
  import { NavigationZone, type NavigationInitiatorContext } from '../../../core/navigation/navigation.schemas';
4
+ import { type LinkedConversationRequest } from '../../../components/views/flows-actors-view/linked-conversation.context';
4
5
  export interface CompositeViewProps {
5
6
  /** View reference — resolved from UIContext internally. Mutually exclusive with `document`. */
6
7
  viewRef?: string;
@@ -14,6 +15,11 @@ export interface CompositeViewProps {
14
15
  navigationZone?: NavigationZone;
15
16
  /** Framework-owned transient navigation initiator. */
16
17
  navigationInitiator?: NavigationInitiatorContext;
18
+ /**
19
+ * A conversation a link asked this view to open (#4043): handed to the conversation the view declares it hosts
20
+ * (`conversationSystemRef`). A view that declares none settles it at once, so its address does not keep it.
21
+ */
22
+ linkedConversation?: LinkedConversationRequest;
17
23
  }
18
24
  /**
19
25
  * CompositeView - top-level host for authored composite surfaces.
@@ -1 +1 @@
1
- {"version":3,"file":"CompositeView.d.ts","sourceRoot":"","sources":["../../../../../src/components/views/composite-view/CompositeView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAElD,OAAO,EAEL,KAAK,uBAAuB,EAE7B,MAAM,wDAAwD,CAAC;AAGhE,OAAO,EAAE,cAAc,EAAE,KAAK,0BAA0B,EAAE,MAAM,wDAAwD,CAAC;AAazH,MAAM,WAAW,kBAAkB;IACjC,+FAA+F;IAC/F,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,uBAAuB,CAAC;IACnC,0EAA0E;IAC1E,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,mFAAmF;IACnF,0BAA0B,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpD,8CAA8C;IAC9C,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,sDAAsD;IACtD,mBAAmB,CAAC,EAAE,0BAA0B,CAAC;CAClD;AAED;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA6KtD,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"CompositeView.d.ts","sourceRoot":"","sources":["../../../../../src/components/views/composite-view/CompositeView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAElD,OAAO,EAEL,KAAK,uBAAuB,EAE7B,MAAM,wDAAwD,CAAC;AAGhE,OAAO,EAAE,cAAc,EAAE,KAAK,0BAA0B,EAAE,MAAM,wDAAwD,CAAC;AAYzH,OAAO,EAGL,KAAK,yBAAyB,EAC/B,MAAM,oFAAoF,CAAC;AAE5F,MAAM,WAAW,kBAAkB;IACjC,+FAA+F;IAC/F,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,uBAAuB,CAAC;IACnC,0EAA0E;IAC1E,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,mFAAmF;IACnF,0BAA0B,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpD,8CAA8C;IAC9C,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,sDAAsD;IACtD,mBAAmB,CAAC,EAAE,0BAA0B,CAAC;IACjD;;;OAGG;IACH,kBAAkB,CAAC,EAAE,yBAAyB,CAAC;CAChD;AAED;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA8LtD,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -12,10 +12,11 @@ import { FrontendResourceUtils } from '../../../core/resources/frontend-resource
12
12
  import { ScopeUtilsService } from '../../../core/scope/scope.utils.frontend.service.js';
13
13
  import { useAppScopeSafe } from '../../../core/scope/useAppScope.js';
14
14
  import { CompositeViewProvider, useOptionalCompositeViewContext } from './CompositeViewContext.js';
15
+ import { HostedLinkedConversationContext, } from '../../../components/views/flows-actors-view/linked-conversation.context.js';
15
16
  /**
16
17
  * CompositeView - top-level host for authored composite surfaces.
17
18
  */
18
- export const CompositeView = ({ viewRef, document: documentProp, hostResourceType, contextResourceIdentifiers, navigationZone, navigationInitiator, }) => {
19
+ export const CompositeView = ({ viewRef, document: documentProp, hostResourceType, contextResourceIdentifiers, navigationZone, navigationInitiator, linkedConversation, }) => {
19
20
  const parentCompositeContext = useOptionalCompositeViewContext();
20
21
  const { registry } = useResourceRegistry();
21
22
  const appScope = useAppScopeSafe();
@@ -129,11 +130,20 @@ export const CompositeView = ({ viewRef, document: documentProp, hostResourceTyp
129
130
  ?? parentCompositeContext?.navigationZone
130
131
  ?? NavigationZone.PRIMARY;
131
132
  const resolvedNavigationInitiator = navigationInitiator ?? parentCompositeContext?.navigationInitiator;
133
+ // The linked conversation, for the conversation this view hosts on its record (#4043).
134
+ const outerHostedLinkedConversation = React.useContext(HostedLinkedConversationContext);
135
+ const hostedSystemRef = document?.conversationSystemRef;
136
+ const hostedLinkedConversation = useMemo(() => (linkedConversation && hostedSystemRef ? { ...linkedConversation, systemRef: hostedSystemRef } : null), [linkedConversation, hostedSystemRef]);
137
+ // A link nothing here can take is settled at once: the address does not keep a conversation no view will open.
138
+ const unhostedLink = linkedConversation && document && !hostedSystemRef ? linkedConversation : undefined;
139
+ useEffect(() => {
140
+ unhostedLink?.onSettled();
141
+ }, [unhostedLink]);
132
142
  if (!document) {
133
143
  return _jsx(ViewNotFound, { viewKind: "composite", viewRef: viewRef });
134
144
  }
135
145
  const CompositeComponent = document.viewComponent;
136
- return (_jsx(CompositeViewProvider, { viewDefinition: document, breakpoint: currentBreakpoint, navigationZone: resolvedNavigationZone, navigationInitiator: resolvedNavigationInitiator, hostResourceType: resolvedHostResourceType, contextResourceIdentifiers: mergedContextResourceIdentifiers, children: _jsx(CompositeComponent, { viewRef: document.ref, viewDefinition: document }) }));
146
+ return (_jsx(CompositeViewProvider, { viewDefinition: document, breakpoint: currentBreakpoint, navigationZone: resolvedNavigationZone, navigationInitiator: resolvedNavigationInitiator, hostResourceType: resolvedHostResourceType, contextResourceIdentifiers: mergedContextResourceIdentifiers, children: _jsx(HostedLinkedConversationContext.Provider, { value: hostedLinkedConversation ?? outerHostedLinkedConversation, children: _jsx(CompositeComponent, { viewRef: document.ref, viewDefinition: document }) }) }));
137
147
  };
138
148
  export default CompositeView;
139
149
  //# sourceMappingURL=CompositeView.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CompositeView.js","sourceRoot":"","sources":["../../../../../src/components/views/composite-view/CompositeView.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,EAAE,iCAAiC,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAGL,8BAA8B,GAC/B,MAAM,wDAAwD,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,mDAAmD,CAAC;AACjF,OAAO,EAAE,cAAc,EAAmC,MAAM,wDAAwD,CAAC;AACzH,OAAO,EACL,4BAA4B,EAC5B,wBAAwB,EACxB,4BAA4B,GAC7B,MAAM,gEAAgE,CAAC;AACxE,OAAO,EA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IACL,CAAC,EAAE;QACD,QAAQ;QACR,QAAQ,EAAE,sBAAsB;QAChC,QAAQ,EAAE,oBAAoB;QAC9B,QAAQ,EAAE,qBAAqB;QAC/B,QAAQ,EAAE,aAAa;QACvB,QAAQ;QACR,wBAAwB;QACxB,kCAAkC;KACnC,CAAC,CAAC;IACH;;;;;;;;;;OAUG;IACH,MAAM,mCAAmC,GAAG,qBAAqB,CAAC,kCAAkC,CAClG,wCAAwC,CACzC,CAAC;IACF,MAAM,gCAAgC,GAAG,OAAO,CAC9C,GAAG,EAAE,CAAC,wCAAwC;IAC9C,iJAAiJ;IACjJ,CAAC,mCAAmC,CAAC,CACtC,CAAC;IACF,MAAM,sBAAsB,GAAG,cAAc;WACxC,sBAAsB,EAAE,cAAc;WACtC,cAAc,CAAC,OAAO,CAAC;IAC5B,MAAM,2BAA2B,GAAG,mBAAmB,IAAI,sBAAsB,EAAE,mBAAmB,CAAC;IAEvG,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,KAAC,YAAY,IAAC,QAAQ,EAAC,WAAW,EAAC,OAAO,EAAE,OAAO,GAAI,CAAC;IACjE,CAAC;IAED,MAAM,kBAAkB,GAAqD,QAAQ,CAAC,aAAa,CAAC;IAEpG,OAAO,CACL,KAAC,qBAAqB,IACpB,cAAc,EAAE,QAAQ,EACxB,UAAU,EAAE,iBAAiB,EAC7B,cAAc,EAAE,sBAAsB,EACtC,mBAAmB,EAAE,2BAA2B,EAChD,gBAAgB,EAAE,wBAAwB,EAC1C,0BAA0B,EAAE,gCAAgC,YAE5D,KAAC,kBAAkB,IAAC,OAAO,EAAE,QAAQ,CAAC,GAAG,EAAE,cAAc,EAAE,QAAQ,GAAI,GACjD,CACzB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import React, { useEffect, useMemo } from 'react';\nimport { ResourceParentResourceRequirement } from '@wildo-ai/saas-models';\nimport {\n type CompositeViewComponentProps,\n type CompositeViewDefinition,\n resolveCompositeViewDefinition,\n} from '~wildo-frontend-lib/core/config/composite-view.schemas';\nimport { useUI } from \"~wildo-frontend-lib/core/ui/useUI\";\nimport { ViewNotFound } from '~wildo-frontend-lib/components/views/ViewNotFound';\nimport { NavigationZone, type NavigationInitiatorContext } from '~wildo-frontend-lib/core/navigation/navigation.schemas';\nimport {\n FrontendInsertedViewHostKind,\n FrontendInsertedViewKind,\n parseFrontendInsertedViewRef,\n} from '~wildo-frontend-lib/core/config/inserted-view.frontend.schemas';\nimport { FrontendView_ScopeMode } from '~wildo-frontend-lib/core/config/views-frontend.schemas';\nimport { useResourceRegistry } from '~wildo-frontend-lib/core/resources/useResourceRegistry';\nimport { FrontendResourceUtils } from '~wildo-frontend-lib/core/resources/frontend-resource.utils';\nimport { ScopeUtilsService } from '~wildo-frontend-lib/core/scope/scope.utils.frontend.service';\nimport { useAppScopeSafe } from '~wildo-frontend-lib/core/scope/useAppScope';\nimport { CompositeViewProvider, useOptionalCompositeViewContext } from './CompositeViewContext';\n\nexport interface CompositeViewProps {\n /** View reference — resolved from UIContext internally. Mutually exclusive with `document`. */\n viewRef?: string;\n /** Pre-resolved document to load. When provided, viewRef is ignored. */\n document?: CompositeViewDefinition;\n /** Explicit resource host type for resource-scoped composite runtimes. */\n hostResourceType?: string;\n /** Explicit scoped resource identifiers for resource-scoped composite runtimes. */\n contextResourceIdentifiers?: Record<string, string>;\n /** Framework-owned transient runtime zone. */\n navigationZone?: NavigationZone;\n /** Framework-owned transient navigation initiator. */\n navigationInitiator?: NavigationInitiatorContext;\n}\n\n/**\n * CompositeView - top-level host for authored composite surfaces.\n */\nexport const CompositeView: React.FC<CompositeViewProps> = ({\n viewRef,\n document: documentProp,\n hostResourceType,\n contextResourceIdentifiers,\n navigationZone,\n navigationInitiator,\n}) => {\n const parentCompositeContext = useOptionalCompositeViewContext();\n const { registry } = useResourceRegistry();\n const appScope = useAppScopeSafe();\n\n // Get current viewport breakpoint and composite views from UI context\n const { UIConfig, compositeViews } = useUI();\n const currentBreakpoint = UIConfig?.currentBreakpoint;\n\n const insertedIdentity = React.useMemo(() => parseFrontendInsertedViewRef(viewRef), [viewRef]);\n\n const resolvedHostResourceType = hostResourceType\n ?? (\n insertedIdentity?.hostKind === FrontendInsertedViewHostKind.RESOURCE\n && insertedIdentity.viewKind === FrontendInsertedViewKind.COMPOSITE_VIEW\n ? insertedIdentity.hostRef\n : undefined\n )\n ?? parentCompositeContext?.hostResourceType;\n\n const resolvedContextResourceIdentifiers = contextResourceIdentifiers\n ?? parentCompositeContext?.contextResourceIdentifiers;\n\n // Resolve document: use provided prop, or resolve from inserted resource host, or resolve from app UIContext.\n // Memoized so the resolved definition keeps a stable identity across renders — it\n // is a field of the CompositeViewProvider value and a dep of several memos below;\n // a fresh object each render would defeat that provider's identity stability and\n // re-render every embedded surface.\n const document = useMemo(\n () => documentProp ?? resolveCompositeViewDefinition({ viewRef, compositeViews, registry }),\n [documentProp, viewRef, compositeViews, registry],\n );\n useEffect(() => {\n if (\n process.env.NODE_ENV === 'production'\n || document\n || !viewRef\n || !resolvedContextResourceIdentifiers\n || Object.keys(resolvedContextResourceIdentifiers).length === 0\n ) {\n return;\n }\n\n console.warn('[CompositeView] Cannot validate explicit view context bindings because the view definition could not be resolved', {\n surfaceName: 'CompositeView',\n surfaceRef: viewRef,\n explicitContextResourceIdentifiers: resolvedContextResourceIdentifiers,\n });\n }, [document, resolvedContextResourceIdentifiers, viewRef]);\n const computedMergedContextResourceIdentifiers = useMemo(() => {\n const primaryScopeInitiatorIds = ScopeUtilsService.buildInitiatorIds({\n userId: appScope?.currentUserId,\n organizationId: appScope?.currentOrganizationId,\n applicationId: appScope?.currentApplicationId,\n anonymousUserId: appScope?.currentAnonymousUserId,\n });\n const primaryScopeContext =\n document?.primaryScope\n ? ScopeUtilsService.primaryScopeToContextIdentifiers(\n primaryScopeInitiatorIds,\n document.primaryScope,\n )\n : {};\n const liveAppScopeContext = appScope?.buildContextResourceIdentifiers() ?? {};\n const customScopeContext = ScopeUtilsService.filterCustomScopeContextResourceIdentifiers(liveAppScopeContext);\n\n if (!document) {\n return ScopeUtilsService.mergeContextResourceIdentifiers(\n primaryScopeContext,\n customScopeContext,\n resolvedContextResourceIdentifiers,\n );\n }\n\n const hostResourceRequirement = (\n document.scope === FrontendView_ScopeMode.RESOURCE\n && resolvedHostResourceType\n )\n ? [{\n resourceType: resolvedHostResourceType,\n requirement: ResourceParentResourceRequirement.OPTIONAL,\n isPrimaryScope: false,\n }]\n : [];\n\n const mergedAdditionalResourceRequirements = [\n ...(document.additionalResourceRequirements ?? []),\n ...hostResourceRequirement,\n ];\n // Drop inherited ancestor keys the composite never scopes by — e.g. a todo\n // opened via `/todo-lists/{list}/todos/{todo}` hands its workspace\n // `todoLists`, but the workspace's contract is {primaryScope, host todo}.\n // The host resource IS in the contract (added via hostResourceRequirement),\n // so the embedded host READ keeps the id it needs; only the dead ancestor is\n // dropped. This keeps the context forwarded to every embedded surface honest\n // and silences the dev \"context bindings outside its declared contract\" warning.\n const allowedBindingKeys = ScopeUtilsService.getAllowedViewBindingKeys({\n primaryScope: document.primaryScope,\n parentResourcesRequirements: document.parentResourcesRequirements,\n additionalResourceRequirements: mergedAdditionalResourceRequirements,\n });\n return ScopeUtilsService.resolveViewContextResourceIdentifiers({\n surfaceName: 'CompositeView',\n surfaceRef: document.ref,\n primaryScope: document.primaryScope,\n parentResourcesRequirements: document.parentResourcesRequirements,\n additionalResourceRequirements: mergedAdditionalResourceRequirements,\n primaryScopeContext,\n customScopeContext,\n explicitContextResourceIdentifiers: ScopeUtilsService.scopeContextToBindingContract(\n resolvedContextResourceIdentifiers,\n allowedBindingKeys,\n ),\n });\n }, [\n appScope,\n appScope?.currentAnonymousUserId,\n appScope?.currentApplicationId,\n appScope?.currentOrganizationId,\n appScope?.currentUserId,\n document,\n resolvedHostResourceType,\n resolvedContextResourceIdentifiers,\n ]);\n /**\n * IDENTITY-STABLE scoped identifiers. The memo above depends on the live\n * `appScope` object, whose identity churns on every AppScope provider render —\n * so it recomputes to a fresh `Record` constantly even when the actual scoped\n * ids are unchanged. That fresh object is the root of the composite re-render\n * loop: it flows into `CompositeViewProvider` and every embedded surface,\n * rebuilding resource-operation contexts (and cloning configs) each render.\n * Keying a passthrough memo on the value-derived identifiers key collapses the\n * identity back to a single reference per distinct value — recomputing only\n * when the scoped ids genuinely change, so no context goes stale.\n */\n const mergedContextResourceIdentifiersKey = FrontendResourceUtils.buildContextResourceIdentifiersKey(\n computedMergedContextResourceIdentifiers,\n );\n const mergedContextResourceIdentifiers = useMemo(\n () => computedMergedContextResourceIdentifiers,\n // eslint-disable-next-line react-hooks/exhaustive-deps -- intentionally keyed by value (key), not by the recomputed-every-render object identity\n [mergedContextResourceIdentifiersKey],\n );\n const resolvedNavigationZone = navigationZone\n ?? parentCompositeContext?.navigationZone\n ?? NavigationZone.PRIMARY;\n const resolvedNavigationInitiator = navigationInitiator ?? parentCompositeContext?.navigationInitiator;\n\n if (!document) {\n return <ViewNotFound viewKind=\"composite\" viewRef={viewRef} />;\n }\n\n const CompositeComponent: React.ComponentType<CompositeViewComponentProps> = document.viewComponent;\n\n return (\n <CompositeViewProvider\n viewDefinition={document}\n breakpoint={currentBreakpoint}\n navigationZone={resolvedNavigationZone}\n navigationInitiator={resolvedNavigationInitiator}\n hostResourceType={resolvedHostResourceType}\n contextResourceIdentifiers={mergedContextResourceIdentifiers}\n >\n <CompositeComponent viewRef={document.ref} viewDefinition={document} />\n </CompositeViewProvider>\n );\n};\n\nexport default CompositeView;\n\n"]}
1
+ {"version":3,"file":"CompositeView.js","sourceRoot":"","sources":["../../../../../src/components/views/composite-view/CompositeView.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,EAAE,iCAAiC,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAGL,8BAA8B,GAC/B,MAAM,wDAAwD,CAAC;AAChE,OAAO,EAAE,KAAK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tC,CAAC;IACF,+GAA+G;IAC/G,MAAM,YAAY,GAAG,kBAAkB,IAAI,QAAQ,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,SAAS,CAAC;IACzG,SAAS,CAAC,GAAG,EAAE;QACb,YAAY,EAAE,SAAS,EAAE,CAAC;IAC5B,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAEnB,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,KAAC,YAAY,IAAC,QAAQ,EAAC,WAAW,EAAC,OAAO,EAAE,OAAO,GAAI,CAAC;IACjE,CAAC;IAED,MAAM,kBAAkB,GAAqD,QAAQ,CAAC,aAAa,CAAC;IAEpG,OAAO,CACL,KAAC,qBAAqB,IACpB,cAAc,EAAE,QAAQ,EACxB,UAAU,EAAE,iBAAiB,EAC7B,cAAc,EAAE,sBAAsB,EACtC,mBAAmB,EAAE,2BAA2B,EAChD,gBAAgB,EAAE,wBAAwB,EAC1C,0BAA0B,EAAE,gCAAgC,YAG5D,KAAC,+BAA+B,CAAC,QAAQ,IAAC,KAAK,EAAE,wBAAwB,IAAI,6BAA6B,YACxG,KAAC,kBAAkB,IAAC,OAAO,EAAE,QAAQ,CAAC,GAAG,EAAE,cAAc,EAAE,QAAQ,GAAI,GAC9B,GACrB,CACzB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import React, { useEffect, useMemo } from 'react';\nimport { ResourceParentResourceRequirement } from '@wildo-ai/saas-models';\nimport {\n type CompositeViewComponentProps,\n type CompositeViewDefinition,\n resolveCompositeViewDefinition,\n} from '~wildo-frontend-lib/core/config/composite-view.schemas';\nimport { useUI } from \"~wildo-frontend-lib/core/ui/useUI\";\nimport { ViewNotFound } from '~wildo-frontend-lib/components/views/ViewNotFound';\nimport { NavigationZone, type NavigationInitiatorContext } from '~wildo-frontend-lib/core/navigation/navigation.schemas';\nimport {\n FrontendInsertedViewHostKind,\n FrontendInsertedViewKind,\n parseFrontendInsertedViewRef,\n} from '~wildo-frontend-lib/core/config/inserted-view.frontend.schemas';\nimport { FrontendView_ScopeMode } from '~wildo-frontend-lib/core/config/views-frontend.schemas';\nimport { useResourceRegistry } from '~wildo-frontend-lib/core/resources/useResourceRegistry';\nimport { FrontendResourceUtils } from '~wildo-frontend-lib/core/resources/frontend-resource.utils';\nimport { ScopeUtilsService } from '~wildo-frontend-lib/core/scope/scope.utils.frontend.service';\nimport { useAppScopeSafe } from '~wildo-frontend-lib/core/scope/useAppScope';\nimport { CompositeViewProvider, useOptionalCompositeViewContext } from './CompositeViewContext';\nimport {\n HostedLinkedConversationContext,\n type HostedLinkedConversation,\n type LinkedConversationRequest,\n} from '~wildo-frontend-lib/components/views/flows-actors-view/linked-conversation.context';\n\nexport interface CompositeViewProps {\n /** View reference — resolved from UIContext internally. Mutually exclusive with `document`. */\n viewRef?: string;\n /** Pre-resolved document to load. When provided, viewRef is ignored. */\n document?: CompositeViewDefinition;\n /** Explicit resource host type for resource-scoped composite runtimes. */\n hostResourceType?: string;\n /** Explicit scoped resource identifiers for resource-scoped composite runtimes. */\n contextResourceIdentifiers?: Record<string, string>;\n /** Framework-owned transient runtime zone. */\n navigationZone?: NavigationZone;\n /** Framework-owned transient navigation initiator. */\n navigationInitiator?: NavigationInitiatorContext;\n /**\n * A conversation a link asked this view to open (#4043): handed to the conversation the view declares it hosts\n * (`conversationSystemRef`). A view that declares none settles it at once, so its address does not keep it.\n */\n linkedConversation?: LinkedConversationRequest;\n}\n\n/**\n * CompositeView - top-level host for authored composite surfaces.\n */\nexport const CompositeView: React.FC<CompositeViewProps> = ({\n viewRef,\n document: documentProp,\n hostResourceType,\n contextResourceIdentifiers,\n navigationZone,\n navigationInitiator,\n linkedConversation,\n}) => {\n const parentCompositeContext = useOptionalCompositeViewContext();\n const { registry } = useResourceRegistry();\n const appScope = useAppScopeSafe();\n\n // Get current viewport breakpoint and composite views from UI context\n const { UIConfig, compositeViews } = useUI();\n const currentBreakpoint = UIConfig?.currentBreakpoint;\n\n const insertedIdentity = React.useMemo(() => parseFrontendInsertedViewRef(viewRef), [viewRef]);\n\n const resolvedHostResourceType = hostResourceType\n ?? (\n insertedIdentity?.hostKind === FrontendInsertedViewHostKind.RESOURCE\n && insertedIdentity.viewKind === FrontendInsertedViewKind.COMPOSITE_VIEW\n ? insertedIdentity.hostRef\n : undefined\n )\n ?? parentCompositeContext?.hostResourceType;\n\n const resolvedContextResourceIdentifiers = contextResourceIdentifiers\n ?? parentCompositeContext?.contextResourceIdentifiers;\n\n // Resolve document: use provided prop, or resolve from inserted resource host, or resolve from app UIContext.\n // Memoized so the resolved definition keeps a stable identity across renders — it\n // is a field of the CompositeViewProvider value and a dep of several memos below;\n // a fresh object each render would defeat that provider's identity stability and\n // re-render every embedded surface.\n const document = useMemo(\n () => documentProp ?? resolveCompositeViewDefinition({ viewRef, compositeViews, registry }),\n [documentProp, viewRef, compositeViews, registry],\n );\n useEffect(() => {\n if (\n process.env.NODE_ENV === 'production'\n || document\n || !viewRef\n || !resolvedContextResourceIdentifiers\n || Object.keys(resolvedContextResourceIdentifiers).length === 0\n ) {\n return;\n }\n\n console.warn('[CompositeView] Cannot validate explicit view context bindings because the view definition could not be resolved', {\n surfaceName: 'CompositeView',\n surfaceRef: viewRef,\n explicitContextResourceIdentifiers: resolvedContextResourceIdentifiers,\n });\n }, [document, resolvedContextResourceIdentifiers, viewRef]);\n const computedMergedContextResourceIdentifiers = useMemo(() => {\n const primaryScopeInitiatorIds = ScopeUtilsService.buildInitiatorIds({\n userId: appScope?.currentUserId,\n organizationId: appScope?.currentOrganizationId,\n applicationId: appScope?.currentApplicationId,\n anonymousUserId: appScope?.currentAnonymousUserId,\n });\n const primaryScopeContext =\n document?.primaryScope\n ? ScopeUtilsService.primaryScopeToContextIdentifiers(\n primaryScopeInitiatorIds,\n document.primaryScope,\n )\n : {};\n const liveAppScopeContext = appScope?.buildContextResourceIdentifiers() ?? {};\n const customScopeContext = ScopeUtilsService.filterCustomScopeContextResourceIdentifiers(liveAppScopeContext);\n\n if (!document) {\n return ScopeUtilsService.mergeContextResourceIdentifiers(\n primaryScopeContext,\n customScopeContext,\n resolvedContextResourceIdentifiers,\n );\n }\n\n const hostResourceRequirement = (\n document.scope === FrontendView_ScopeMode.RESOURCE\n && resolvedHostResourceType\n )\n ? [{\n resourceType: resolvedHostResourceType,\n requirement: ResourceParentResourceRequirement.OPTIONAL,\n isPrimaryScope: false,\n }]\n : [];\n\n const mergedAdditionalResourceRequirements = [\n ...(document.additionalResourceRequirements ?? []),\n ...hostResourceRequirement,\n ];\n // Drop inherited ancestor keys the composite never scopes by — e.g. a todo\n // opened via `/todo-lists/{list}/todos/{todo}` hands its workspace\n // `todoLists`, but the workspace's contract is {primaryScope, host todo}.\n // The host resource IS in the contract (added via hostResourceRequirement),\n // so the embedded host READ keeps the id it needs; only the dead ancestor is\n // dropped. This keeps the context forwarded to every embedded surface honest\n // and silences the dev \"context bindings outside its declared contract\" warning.\n const allowedBindingKeys = ScopeUtilsService.getAllowedViewBindingKeys({\n primaryScope: document.primaryScope,\n parentResourcesRequirements: document.parentResourcesRequirements,\n additionalResourceRequirements: mergedAdditionalResourceRequirements,\n });\n return ScopeUtilsService.resolveViewContextResourceIdentifiers({\n surfaceName: 'CompositeView',\n surfaceRef: document.ref,\n primaryScope: document.primaryScope,\n parentResourcesRequirements: document.parentResourcesRequirements,\n additionalResourceRequirements: mergedAdditionalResourceRequirements,\n primaryScopeContext,\n customScopeContext,\n explicitContextResourceIdentifiers: ScopeUtilsService.scopeContextToBindingContract(\n resolvedContextResourceIdentifiers,\n allowedBindingKeys,\n ),\n });\n }, [\n appScope,\n appScope?.currentAnonymousUserId,\n appScope?.currentApplicationId,\n appScope?.currentOrganizationId,\n appScope?.currentUserId,\n document,\n resolvedHostResourceType,\n resolvedContextResourceIdentifiers,\n ]);\n /**\n * IDENTITY-STABLE scoped identifiers. The memo above depends on the live\n * `appScope` object, whose identity churns on every AppScope provider render —\n * so it recomputes to a fresh `Record` constantly even when the actual scoped\n * ids are unchanged. That fresh object is the root of the composite re-render\n * loop: it flows into `CompositeViewProvider` and every embedded surface,\n * rebuilding resource-operation contexts (and cloning configs) each render.\n * Keying a passthrough memo on the value-derived identifiers key collapses the\n * identity back to a single reference per distinct value — recomputing only\n * when the scoped ids genuinely change, so no context goes stale.\n */\n const mergedContextResourceIdentifiersKey = FrontendResourceUtils.buildContextResourceIdentifiersKey(\n computedMergedContextResourceIdentifiers,\n );\n const mergedContextResourceIdentifiers = useMemo(\n () => computedMergedContextResourceIdentifiers,\n // eslint-disable-next-line react-hooks/exhaustive-deps -- intentionally keyed by value (key), not by the recomputed-every-render object identity\n [mergedContextResourceIdentifiersKey],\n );\n const resolvedNavigationZone = navigationZone\n ?? parentCompositeContext?.navigationZone\n ?? NavigationZone.PRIMARY;\n const resolvedNavigationInitiator = navigationInitiator ?? parentCompositeContext?.navigationInitiator;\n\n // The linked conversation, for the conversation this view hosts on its record (#4043).\n const outerHostedLinkedConversation = React.useContext(HostedLinkedConversationContext);\n const hostedSystemRef = document?.conversationSystemRef;\n const hostedLinkedConversation = useMemo<HostedLinkedConversation | null>(\n () => (linkedConversation && hostedSystemRef ? { ...linkedConversation, systemRef: hostedSystemRef } : null),\n [linkedConversation, hostedSystemRef],\n );\n // A link nothing here can take is settled at once: the address does not keep a conversation no view will open.\n const unhostedLink = linkedConversation && document && !hostedSystemRef ? linkedConversation : undefined;\n useEffect(() => {\n unhostedLink?.onSettled();\n }, [unhostedLink]);\n\n if (!document) {\n return <ViewNotFound viewKind=\"composite\" viewRef={viewRef} />;\n }\n\n const CompositeComponent: React.ComponentType<CompositeViewComponentProps> = document.viewComponent;\n\n return (\n <CompositeViewProvider\n viewDefinition={document}\n breakpoint={currentBreakpoint}\n navigationZone={resolvedNavigationZone}\n navigationInitiator={resolvedNavigationInitiator}\n hostResourceType={resolvedHostResourceType}\n contextResourceIdentifiers={mergedContextResourceIdentifiers}\n >\n {/* A view holding no link passes the outer one on: a view nested in a hosting view must not hide its link. */}\n <HostedLinkedConversationContext.Provider value={hostedLinkedConversation ?? outerHostedLinkedConversation}>\n <CompositeComponent viewRef={document.ref} viewDefinition={document} />\n </HostedLinkedConversationContext.Provider>\n </CompositeViewProvider>\n );\n};\n\nexport default CompositeView;\n\n"]}
@@ -0,0 +1,57 @@
1
+ import React from 'react';
2
+ import type { FlowsActorsViewDefinition } from '../../../core/config/flows-actors-view.schemas';
3
+ import type { FrontendResourcesRegistry } from '../../../core/resources/resources.frontend.schemas';
4
+ /**
5
+ * Where a link to one conversation leads (#4013, #4043), or `undefined` when the link is incomplete or nothing in this
6
+ * application shows that conversation's system.
7
+ *
8
+ * The backend that sends a notice knows the conversation's system and the context it was opened in, not this
9
+ * frontend's views, so the link names those and this maps them to a page:
10
+ *
11
+ * 1. **On a record.** When the context names a record of a resource whose composite view declares it hosts this
12
+ * system's conversations (`conversationSystemRef`) and has an address of its own, that view on that record: the
13
+ * conversation is listed there and nowhere else. Resources are tried in the registry's order, and the first that
14
+ * matches is taken. The page is addressed by the record and its organization alone, which is all a stored context
15
+ * holds: a record the engine can only open under a parent it names in its route is not reached this way.
16
+ * 2. **Otherwise**, the first flows-actors view configured for the system: its conversations are the ones opened in the
17
+ * organization alone. When several views show the same system, they list the same person's conversations of it.
18
+ *
19
+ * Either page names the conversation in `?conversation=`. The organization is not part of the path: the page switches to
20
+ * it before following the link (see {@link ConversationLinkPage}).
21
+ */
22
+ export declare function conversationLinkTargetOf(params: {
23
+ views: readonly Pick<FlowsActorsViewDefinition, 'ref' | 'systemRef'>[] | undefined;
24
+ resourceConfigurations?: FrontendResourcesRegistry['resourceConfigurations'];
25
+ search: URLSearchParams;
26
+ }): string | undefined;
27
+ /**
28
+ * The conversation a link names on a flows-actors view's page (`?conversation=`, set by {@link ConversationLinkPage}),
29
+ * and the way to drop it from the address once the view has taken it, so a reload or a later visit does not reopen it
30
+ * over the conversation the person moved to. Replaces the history entry: the link is not a step the person took.
31
+ */
32
+ export declare function useLinkedConversationParam(): {
33
+ linkedConversationId: string | undefined;
34
+ dropLinkedConversation: () => void;
35
+ };
36
+ /**
37
+ * The engine page a notice or an email about a conversation opens (`CONVERSATION_LINK_PAGE_PATH`, #4013). It shows
38
+ * nothing of its own: it sends the person on to the page that lists the conversation (see
39
+ * {@link conversationLinkTargetOf}), which opens it if their history holds it.
40
+ *
41
+ * **In the conversation's organization (#4043).** A conversation is listed only in the organization it was opened in,
42
+ * which its context names. When that is not the organization the person is in, the page switches to it first, through
43
+ * `followRouteOrganization`: the link names an organization the way a route does, and the follow admits exactly the
44
+ * organizations a route may take this session into (an active membership, one it loaded, one its access profile
45
+ * confers; never in a one-off session). It does not reset the navigation the way the switcher does, so the person
46
+ * lands on the conversation rather than the home page; like the route follow, it announces the move
47
+ * (`NAVIGATION_ORGANIZATION_FOLLOWED`), so no pane or overlay of the previous organization stays on screen under the
48
+ * new one (#2276). A refusal is held for that organization only, and asked again when what the session holds changes
49
+ * (memberships, access profile) or the link names another one. When the session cannot be in that organization, or the context
50
+ * names several, the page says the conversation cannot be opened here, in the words the view uses for one it cannot
51
+ * open. It decides nothing about access: switching is refused or admitted by the same rules as any route.
52
+ *
53
+ * An application with no page for that system says so, as a view that does not exist does.
54
+ */
55
+ export declare const ConversationLinkPage: React.FC;
56
+ export default ConversationLinkPage;
57
+ //# sourceMappingURL=ConversationLinkPage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConversationLinkPage.d.ts","sourceRoot":"","sources":["../../../../../src/components/views/flows-actors-view/ConversationLinkPage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2DAA2D,CAAC;AAM3G,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,+DAA+D,CAAC;AAgB/G;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE;IAC/C,KAAK,EAAE,SAAS,IAAI,CAAC,yBAAyB,EAAE,KAAK,GAAG,WAAW,CAAC,EAAE,GAAG,SAAS,CAAC;IACnF,sBAAsB,CAAC,EAAE,yBAAyB,CAAC,wBAAwB,CAAC,CAAC;IAC7E,MAAM,EAAE,eAAe,CAAC;CACzB,GAAG,MAAM,GAAG,SAAS,CA0BrB;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,IAAI;IAAE,oBAAoB,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,sBAAsB,EAAE,MAAM,IAAI,CAAA;CAAE,CAW7H;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAkCxC,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
@@ -0,0 +1,136 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import { Navigate, useSearchParams } from 'react-router';
4
+ import { CONVERSATION_LINK_CONTEXT_PARAM, CONVERSATION_LINK_CONVERSATION_PARAM, CONVERSATION_LINK_SYSTEM_PARAM, CoreResourceType, FLOWS_ACTORS_VIEW_CONVERSATION_PARAM, organizationsNamedByFlowsActorsContext, parseFlowsActorsContextRef, } from '@wildo-ai/saas-models';
5
+ import { buildCompositeRouteUrlPath, buildResourceInsertedCompositeIdentity, isStandaloneRoutableInsertedCompositeView, } from '../../../core/config/composite-view.schemas.js';
6
+ import { useResourceRegistry } from '../../../core/resources/useResourceRegistry.js';
7
+ import { useUI } from '../../../core/ui/useUI.js';
8
+ import { useI18n } from '../../../core/i18n/useI18n.js';
9
+ import { useAppScopeSafe } from '../../../core/scope/useAppScope.js';
10
+ import { useUserOrgs } from '../../../core/security/useUserOrgs.js';
11
+ import { useEventBus } from '../../../core/events/useEventBus.js';
12
+ import { FrontendEvents } from '../../../core/events/events.frontend.schemas.js';
13
+ import { FrontendComponentType } from '@wildo-ai/presets-components-models';
14
+ import { ViewNotFound } from '../../../components/views/ViewNotFound.js';
15
+ /** `path` with one more query parameter, whether or not it already has some. */
16
+ function withQueryParam(path, key, value) {
17
+ return `${path}${path.includes('?') ? '&' : '?'}${key}=${encodeURIComponent(value)}`;
18
+ }
19
+ /**
20
+ * Where a link to one conversation leads (#4013, #4043), or `undefined` when the link is incomplete or nothing in this
21
+ * application shows that conversation's system.
22
+ *
23
+ * The backend that sends a notice knows the conversation's system and the context it was opened in, not this
24
+ * frontend's views, so the link names those and this maps them to a page:
25
+ *
26
+ * 1. **On a record.** When the context names a record of a resource whose composite view declares it hosts this
27
+ * system's conversations (`conversationSystemRef`) and has an address of its own, that view on that record: the
28
+ * conversation is listed there and nowhere else. Resources are tried in the registry's order, and the first that
29
+ * matches is taken. The page is addressed by the record and its organization alone, which is all a stored context
30
+ * holds: a record the engine can only open under a parent it names in its route is not reached this way.
31
+ * 2. **Otherwise**, the first flows-actors view configured for the system: its conversations are the ones opened in the
32
+ * organization alone. When several views show the same system, they list the same person's conversations of it.
33
+ *
34
+ * Either page names the conversation in `?conversation=`. The organization is not part of the path: the page switches to
35
+ * it before following the link (see {@link ConversationLinkPage}).
36
+ */
37
+ export function conversationLinkTargetOf(params) {
38
+ const { views, resourceConfigurations, search } = params;
39
+ const systemRef = search.get(CONVERSATION_LINK_SYSTEM_PARAM);
40
+ const conversationId = search.get(CONVERSATION_LINK_CONVERSATION_PARAM);
41
+ if (!systemRef || !conversationId)
42
+ return undefined;
43
+ const context = parseFlowsActorsContextRef(search.get(CONVERSATION_LINK_CONTEXT_PARAM) ?? undefined);
44
+ const organizations = organizationsNamedByFlowsActorsContext(context);
45
+ for (const [resourceType, configuration] of Object.entries(resourceConfigurations ?? {})) {
46
+ const recordId = context[resourceType];
47
+ if (!recordId)
48
+ continue;
49
+ const hosting = configuration?.frontendConfiguration?.compositeViews?.find((view) => (view.conversationSystemRef === systemRef && isStandaloneRoutableInsertedCompositeView(view)));
50
+ if (!hosting)
51
+ continue;
52
+ const viewRef = buildResourceInsertedCompositeIdentity(resourceType, hosting).insertedViewRef;
53
+ const page = buildCompositeRouteUrlPath(viewRef, {
54
+ [resourceType]: recordId,
55
+ ...(organizations.length === 1 ? { [CoreResourceType.ORGANIZATIONS]: organizations[0] } : {}),
56
+ });
57
+ return withQueryParam(page, FLOWS_ACTORS_VIEW_CONVERSATION_PARAM, conversationId);
58
+ }
59
+ const view = views?.find((candidate) => candidate.systemRef === systemRef);
60
+ if (!view)
61
+ return undefined;
62
+ return withQueryParam(`/flows-actors/${encodeURIComponent(view.ref)}`, FLOWS_ACTORS_VIEW_CONVERSATION_PARAM, conversationId);
63
+ }
64
+ /**
65
+ * The conversation a link names on a flows-actors view's page (`?conversation=`, set by {@link ConversationLinkPage}),
66
+ * and the way to drop it from the address once the view has taken it, so a reload or a later visit does not reopen it
67
+ * over the conversation the person moved to. Replaces the history entry: the link is not a step the person took.
68
+ */
69
+ export function useLinkedConversationParam() {
70
+ const [search, setSearch] = useSearchParams();
71
+ const linkedConversationId = search.get(FLOWS_ACTORS_VIEW_CONVERSATION_PARAM) ?? undefined;
72
+ const dropLinkedConversation = React.useCallback(() => {
73
+ setSearch((current) => {
74
+ const next = new URLSearchParams(current);
75
+ next.delete(FLOWS_ACTORS_VIEW_CONVERSATION_PARAM);
76
+ return next;
77
+ }, { replace: true });
78
+ }, [setSearch]);
79
+ return { linkedConversationId, dropLinkedConversation };
80
+ }
81
+ /**
82
+ * The engine page a notice or an email about a conversation opens (`CONVERSATION_LINK_PAGE_PATH`, #4013). It shows
83
+ * nothing of its own: it sends the person on to the page that lists the conversation (see
84
+ * {@link conversationLinkTargetOf}), which opens it if their history holds it.
85
+ *
86
+ * **In the conversation's organization (#4043).** A conversation is listed only in the organization it was opened in,
87
+ * which its context names. When that is not the organization the person is in, the page switches to it first, through
88
+ * `followRouteOrganization`: the link names an organization the way a route does, and the follow admits exactly the
89
+ * organizations a route may take this session into (an active membership, one it loaded, one its access profile
90
+ * confers; never in a one-off session). It does not reset the navigation the way the switcher does, so the person
91
+ * lands on the conversation rather than the home page; like the route follow, it announces the move
92
+ * (`NAVIGATION_ORGANIZATION_FOLLOWED`), so no pane or overlay of the previous organization stays on screen under the
93
+ * new one (#2276). A refusal is held for that organization only, and asked again when what the session holds changes
94
+ * (memberships, access profile) or the link names another one. When the session cannot be in that organization, or the context
95
+ * names several, the page says the conversation cannot be opened here, in the words the view uses for one it cannot
96
+ * open. It decides nothing about access: switching is refused or admitted by the same rules as any route.
97
+ *
98
+ * An application with no page for that system says so, as a view that does not exist does.
99
+ */
100
+ export const ConversationLinkPage = () => {
101
+ const [search] = useSearchParams();
102
+ const { flowsActorsViews } = useUI();
103
+ const { registry } = useResourceRegistry();
104
+ const appScope = useAppScopeSafe();
105
+ const { followRouteOrganization } = useUserOrgs();
106
+ const { emit } = useEventBus();
107
+ const { tComponent } = useI18n({ component: FrontendComponentType.HIGH_LEVEL_VIEWS_FLOWS_ACTORS });
108
+ const organizations = organizationsNamedByFlowsActorsContext(parseFlowsActorsContextRef(search.get(CONVERSATION_LINK_CONTEXT_PARAM) ?? undefined));
109
+ const organizationId = organizations.length === 1 ? organizations[0] : undefined;
110
+ const mustSwitch = organizationId !== undefined && appScope?.currentOrganizationId !== organizationId;
111
+ const [refusedOrganizationId, setRefusedOrganizationId] = React.useState(null);
112
+ const refused = organizationId !== undefined && refusedOrganizationId === organizationId;
113
+ React.useEffect(() => {
114
+ if (!mustSwitch || !organizationId)
115
+ return;
116
+ if (!followRouteOrganization(organizationId)) {
117
+ setRefusedOrganizationId(organizationId);
118
+ return;
119
+ }
120
+ setRefusedOrganizationId(null);
121
+ // In the same effect as the move, as the route follow does: what the previous organization left goes with it (#2276).
122
+ emit(FrontendEvents.NAVIGATION_ORGANIZATION_FOLLOWED, { organizationId });
123
+ }, [mustSwitch, organizationId, followRouteOrganization, emit]);
124
+ if (organizations.length > 1 || refused) {
125
+ return _jsx("p", { role: "status", className: "p-container text-sm text-muted-foreground", children: tComponent(FrontendComponentType.HIGH_LEVEL_VIEWS_FLOWS_ACTORS, 'linkedConversationUnavailable') });
126
+ }
127
+ // Switching: the conversation is followed once the person is in its organization.
128
+ if (mustSwitch)
129
+ return null;
130
+ const target = conversationLinkTargetOf({ views: flowsActorsViews, resourceConfigurations: registry?.resourceConfigurations, search });
131
+ if (!target)
132
+ return _jsx(ViewNotFound, { viewKind: "flows-actors" });
133
+ return _jsx(Navigate, { replace: true, to: target });
134
+ };
135
+ export default ConversationLinkPage;
136
+ //# sourceMappingURL=ConversationLinkPage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConversationLinkPage.js","sourceRoot":"","sources":["../../../../../src/components/views/flows-actors-view/ConversationLinkPage.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EACL,+BAA+B,EAC/B,oCAAoC,EACpC,8BAA8B,EAC9B,gBAAgB,EAChB,oCAAoC,EACpC,sCAAsC,EACtC,0BAA0B,GAC3B,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,0BAA0B,EAC1B,sCAAsC,EACtC,yCAAyC,GAC1C,MAAM,wDAAwD,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wDAAwD,CAAC;AAC7F,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,4CAA4C,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,6CAA6C,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,yDAAyD,CAAC;AACzF,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,mDAAmD,CAAC;AAEjF,gFAAgF;AAChF,SAAS,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AC7C,wBAAwB,CAAC,cAAc,CAAC,CAAC;YACzC,OAAO;QACT,CAAC;QACD,wBAAwB,CAAC,IAAI,CAAC,CAAC;QAC/B,sHAAsH;QACtH,IAAI,CAAC,cAAc,CAAC,gCAAgC,EAAE,EAAE,cAAc,EAAE,CAAC,CAAC;IAC5E,CAAC,EAAE,CAAC,UAAU,EAAE,cAAc,EAAE,uBAAuB,EAAE,IAAI,CAAC,CAAC,CAAC;IAEhE,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,EAAE,CAAC;QACxC,OAAO,YAAG,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAC,2CAA2C,YAAE,UAAU,CAAC,qBAAqB,CAAC,6BAA6B,EAAE,+BAA+B,CAAC,GAAK,CAAC;IACvL,CAAC;IACD,kFAAkF;IAClF,IAAI,UAAU;QAAE,OAAO,IAAI,CAAC;IAE5B,MAAM,MAAM,GAAG,wBAAwB,CAAC,EAAE,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,QAAQ,EAAE,sBAAsB,EAAE,MAAM,EAAE,CAAC,CAAC;IACvI,IAAI,CAAC,MAAM;QAAE,OAAO,KAAC,YAAY,IAAC,QAAQ,EAAC,cAAc,GAAG,CAAC;IAC7D,OAAO,KAAC,QAAQ,IAAC,OAAO,QAAC,EAAE,EAAE,MAAM,GAAI,CAAC;AAC1C,CAAC,CAAC;AAEF,eAAe,oBAAoB,CAAC","sourcesContent":["import React from 'react';\nimport { Navigate, useSearchParams } from 'react-router';\nimport {\n CONVERSATION_LINK_CONTEXT_PARAM,\n CONVERSATION_LINK_CONVERSATION_PARAM,\n CONVERSATION_LINK_SYSTEM_PARAM,\n CoreResourceType,\n FLOWS_ACTORS_VIEW_CONVERSATION_PARAM,\n organizationsNamedByFlowsActorsContext,\n parseFlowsActorsContextRef,\n} from '@wildo-ai/saas-models';\n\nimport type { FlowsActorsViewDefinition } from '~wildo-frontend-lib/core/config/flows-actors-view.schemas';\nimport {\n buildCompositeRouteUrlPath,\n buildResourceInsertedCompositeIdentity,\n isStandaloneRoutableInsertedCompositeView,\n} from '~wildo-frontend-lib/core/config/composite-view.schemas';\nimport type { FrontendResourcesRegistry } from '~wildo-frontend-lib/core/resources/resources.frontend.schemas';\nimport { useResourceRegistry } from '~wildo-frontend-lib/core/resources/useResourceRegistry';\nimport { useUI } from '~wildo-frontend-lib/core/ui/useUI';\nimport { useI18n } from '~wildo-frontend-lib/core/i18n/useI18n';\nimport { useAppScopeSafe } from '~wildo-frontend-lib/core/scope/useAppScope';\nimport { useUserOrgs } from '~wildo-frontend-lib/core/security/useUserOrgs';\nimport { useEventBus } from '~wildo-frontend-lib/core/events/useEventBus';\nimport { FrontendEvents } from '~wildo-frontend-lib/core/events/events.frontend.schemas';\nimport { FrontendComponentType } from '@wildo-ai/presets-components-models';\nimport { ViewNotFound } from '~wildo-frontend-lib/components/views/ViewNotFound';\n\n/** `path` with one more query parameter, whether or not it already has some. */\nfunction withQueryParam(path: string, key: string, value: string): string {\n return `${path}${path.includes('?') ? '&' : '?'}${key}=${encodeURIComponent(value)}`;\n}\n\n/**\n * Where a link to one conversation leads (#4013, #4043), or `undefined` when the link is incomplete or nothing in this\n * application shows that conversation's system.\n *\n * The backend that sends a notice knows the conversation's system and the context it was opened in, not this\n * frontend's views, so the link names those and this maps them to a page:\n *\n * 1. **On a record.** When the context names a record of a resource whose composite view declares it hosts this\n * system's conversations (`conversationSystemRef`) and has an address of its own, that view on that record: the\n * conversation is listed there and nowhere else. Resources are tried in the registry's order, and the first that\n * matches is taken. The page is addressed by the record and its organization alone, which is all a stored context\n * holds: a record the engine can only open under a parent it names in its route is not reached this way.\n * 2. **Otherwise**, the first flows-actors view configured for the system: its conversations are the ones opened in the\n * organization alone. When several views show the same system, they list the same person's conversations of it.\n *\n * Either page names the conversation in `?conversation=`. The organization is not part of the path: the page switches to\n * it before following the link (see {@link ConversationLinkPage}).\n */\nexport function conversationLinkTargetOf(params: {\n views: readonly Pick<FlowsActorsViewDefinition, 'ref' | 'systemRef'>[] | undefined;\n resourceConfigurations?: FrontendResourcesRegistry['resourceConfigurations'];\n search: URLSearchParams;\n}): string | undefined {\n const { views, resourceConfigurations, search } = params;\n const systemRef = search.get(CONVERSATION_LINK_SYSTEM_PARAM);\n const conversationId = search.get(CONVERSATION_LINK_CONVERSATION_PARAM);\n if (!systemRef || !conversationId) return undefined;\n const context = parseFlowsActorsContextRef(search.get(CONVERSATION_LINK_CONTEXT_PARAM) ?? undefined);\n\n const organizations = organizationsNamedByFlowsActorsContext(context);\n for (const [resourceType, configuration] of Object.entries(resourceConfigurations ?? {})) {\n const recordId = context[resourceType];\n if (!recordId) continue;\n const hosting = configuration?.frontendConfiguration?.compositeViews?.find((view) => (\n view.conversationSystemRef === systemRef && isStandaloneRoutableInsertedCompositeView(view)\n ));\n if (!hosting) continue;\n const viewRef = buildResourceInsertedCompositeIdentity(resourceType, hosting).insertedViewRef;\n const page = buildCompositeRouteUrlPath(viewRef, {\n [resourceType]: recordId,\n ...(organizations.length === 1 ? { [CoreResourceType.ORGANIZATIONS]: organizations[0]! } : {}),\n });\n return withQueryParam(page, FLOWS_ACTORS_VIEW_CONVERSATION_PARAM, conversationId);\n }\n\n const view = views?.find((candidate) => candidate.systemRef === systemRef);\n if (!view) return undefined;\n return withQueryParam(`/flows-actors/${encodeURIComponent(view.ref)}`, FLOWS_ACTORS_VIEW_CONVERSATION_PARAM, conversationId);\n}\n\n/**\n * The conversation a link names on a flows-actors view's page (`?conversation=`, set by {@link ConversationLinkPage}),\n * and the way to drop it from the address once the view has taken it, so a reload or a later visit does not reopen it\n * over the conversation the person moved to. Replaces the history entry: the link is not a step the person took.\n */\nexport function useLinkedConversationParam(): { linkedConversationId: string | undefined; dropLinkedConversation: () => void } {\n const [search, setSearch] = useSearchParams();\n const linkedConversationId = search.get(FLOWS_ACTORS_VIEW_CONVERSATION_PARAM) ?? undefined;\n const dropLinkedConversation = React.useCallback(() => {\n setSearch((current) => {\n const next = new URLSearchParams(current);\n next.delete(FLOWS_ACTORS_VIEW_CONVERSATION_PARAM);\n return next;\n }, { replace: true });\n }, [setSearch]);\n return { linkedConversationId, dropLinkedConversation };\n}\n\n/**\n * The engine page a notice or an email about a conversation opens (`CONVERSATION_LINK_PAGE_PATH`, #4013). It shows\n * nothing of its own: it sends the person on to the page that lists the conversation (see\n * {@link conversationLinkTargetOf}), which opens it if their history holds it.\n *\n * **In the conversation's organization (#4043).** A conversation is listed only in the organization it was opened in,\n * which its context names. When that is not the organization the person is in, the page switches to it first, through\n * `followRouteOrganization`: the link names an organization the way a route does, and the follow admits exactly the\n * organizations a route may take this session into (an active membership, one it loaded, one its access profile\n * confers; never in a one-off session). It does not reset the navigation the way the switcher does, so the person\n * lands on the conversation rather than the home page; like the route follow, it announces the move\n * (`NAVIGATION_ORGANIZATION_FOLLOWED`), so no pane or overlay of the previous organization stays on screen under the\n * new one (#2276). A refusal is held for that organization only, and asked again when what the session holds changes\n * (memberships, access profile) or the link names another one. When the session cannot be in that organization, or the context\n * names several, the page says the conversation cannot be opened here, in the words the view uses for one it cannot\n * open. It decides nothing about access: switching is refused or admitted by the same rules as any route.\n *\n * An application with no page for that system says so, as a view that does not exist does.\n */\nexport const ConversationLinkPage: React.FC = () => {\n const [search] = useSearchParams();\n const { flowsActorsViews } = useUI();\n const { registry } = useResourceRegistry();\n const appScope = useAppScopeSafe();\n const { followRouteOrganization } = useUserOrgs();\n const { emit } = useEventBus();\n const { tComponent } = useI18n({ component: FrontendComponentType.HIGH_LEVEL_VIEWS_FLOWS_ACTORS });\n\n const organizations = organizationsNamedByFlowsActorsContext(parseFlowsActorsContextRef(search.get(CONVERSATION_LINK_CONTEXT_PARAM) ?? undefined));\n const organizationId = organizations.length === 1 ? organizations[0] : undefined;\n const mustSwitch = organizationId !== undefined && appScope?.currentOrganizationId !== organizationId;\n const [refusedOrganizationId, setRefusedOrganizationId] = React.useState<string | null>(null);\n const refused = organizationId !== undefined && refusedOrganizationId === organizationId;\n React.useEffect(() => {\n if (!mustSwitch || !organizationId) return;\n if (!followRouteOrganization(organizationId)) {\n setRefusedOrganizationId(organizationId);\n return;\n }\n setRefusedOrganizationId(null);\n // In the same effect as the move, as the route follow does: what the previous organization left goes with it (#2276).\n emit(FrontendEvents.NAVIGATION_ORGANIZATION_FOLLOWED, { organizationId });\n }, [mustSwitch, organizationId, followRouteOrganization, emit]);\n\n if (organizations.length > 1 || refused) {\n return <p role=\"status\" className=\"p-container text-sm text-muted-foreground\">{tComponent(FrontendComponentType.HIGH_LEVEL_VIEWS_FLOWS_ACTORS, 'linkedConversationUnavailable')}</p>;\n }\n // Switching: the conversation is followed once the person is in its organization.\n if (mustSwitch) return null;\n\n const target = conversationLinkTargetOf({ views: flowsActorsViews, resourceConfigurations: registry?.resourceConfigurations, search });\n if (!target) return <ViewNotFound viewKind=\"flows-actors\" />;\n return <Navigate replace to={target} />;\n};\n\nexport default ConversationLinkPage;\n"]}
@@ -16,6 +16,26 @@ export interface FlowsActorsViewProps {
16
16
  * `contextResourceIdentifiers`, which is what keeps each case's discussions apart.
17
17
  */
18
18
  caseRef?: WorkUnitRef;
19
+ /**
20
+ * A conversation to open, named by a link (#4013): the conversation-link page (`CONVERSATION_LINK_PAGE_PATH`) sends a
21
+ * person here with it, from a notice or an email about the conversation. It replaces the conversation held for this
22
+ * view and is held in its place once the person's history holds it: listed by the newest page, or read by id when it
23
+ * is older (#4040). It decides nothing about access: an id the history does not hold is not opened, the view says so,
24
+ * and a new conversation is offered instead. Until the history has answered, nothing can be sent into it, since the
25
+ * id came from outside the page. A view rendered by a record view that hosts its system's conversations may instead
26
+ * receive the link from that host (`HostedLinkedConversationContext`, #4043); a link given here wins.
27
+ */
28
+ linkedConversationId?: string;
29
+ /**
30
+ * Called once the view has SETTLED {@link linkedConversationId}: opened it, found it unavailable, or the person moved
31
+ * elsewhere first. The host then drops it from its address, so a reload does not reopen it.
32
+ */
33
+ onLinkedConversationSettled?: () => void;
34
+ /**
35
+ * What distinguishes this link from another naming the same conversation: the navigation entry that carries it. A
36
+ * link once settled under this key is never applied again, even by a remounted view (`held-conversation-selection`).
37
+ */
38
+ linkKey?: string;
19
39
  }
20
40
  /**
21
41
  * FlowsActorsView — chat-first engine host for a standalone flows-actors surface.
@@ -1 +1 @@
1
- {"version":3,"file":"FlowsActorsView.d.ts","sourceRoot":"","sources":["../../../../../src/components/views/flows-actors-view/FlowsActorsView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAEjF,OAAO,EAML,KAAK,WAAW,EACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2DAA2D,CAAC;AAuC3G,MAAM,WAAW,oBAAoB;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,yBAAyB,CAAC;IAC3C,0BAA0B,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpD;;;;;;;;;OASG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;CACvB;AAiTD;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAiF1D,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"FlowsActorsView.d.ts","sourceRoot":"","sources":["../../../../../src/components/views/flows-actors-view/FlowsActorsView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwE,MAAM,OAAO,CAAC;AAE7F,OAAO,EAML,KAAK,WAAW,EACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2DAA2D,CAAC;AAmD3G,MAAM,WAAW,oBAAoB;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,yBAAyB,CAAC;IAC3C,0BAA0B,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpD;;;;;;;;;OASG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB;;;;;;;;OAQG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;OAGG;IACH,2BAA2B,CAAC,EAAE,MAAM,IAAI,CAAC;IACzC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AA8ZD;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAwG1D,CAAC;AAEF,eAAe,eAAe,CAAC"}