nexus-shared 1.1.21 → 3.0.0

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 (376) hide show
  1. package/CHANGELOG.md +262 -0
  2. package/LICENSE +21 -0
  3. package/README.md +1000 -0
  4. package/dist/Client.Index.d.ts +55 -0
  5. package/dist/Client.Index.js +60 -0
  6. package/dist/Components/Chats/Chat.d.ts +28 -0
  7. package/dist/Components/Chats/Chat.js +19 -0
  8. package/dist/Components/Chats/ChatButton.d.ts +26 -0
  9. package/dist/Components/Chats/ChatButton.js +41 -0
  10. package/dist/Components/Chats/ChatComposer.d.ts +41 -0
  11. package/dist/Components/Chats/ChatComposer.js +177 -0
  12. package/dist/Components/Chats/ChatConversations.d.ts +35 -0
  13. package/dist/Components/Chats/ChatConversations.js +38 -0
  14. package/dist/Components/Chats/ChatPanel.d.ts +66 -0
  15. package/dist/Components/Chats/ChatPanel.js +94 -0
  16. package/dist/Components/Chats/ChatParts.d.ts +87 -0
  17. package/dist/Components/Chats/ChatParts.js +100 -0
  18. package/dist/Components/Chats/ChatThread.d.ts +22 -0
  19. package/dist/Components/Chats/ChatThread.js +96 -0
  20. package/dist/Components/Documents/Button.d.ts +29 -0
  21. package/dist/Components/Documents/Button.js +11 -0
  22. package/dist/Components/Documents/Menu.d.ts +102 -0
  23. package/dist/Components/Documents/Menu.js +242 -0
  24. package/dist/Components/Documents/SplitButton.d.ts +64 -0
  25. package/dist/Components/Documents/SplitButton.js +129 -0
  26. package/dist/Components/Documents/TabButtons.d.ts +80 -0
  27. package/dist/Components/Documents/TabButtons.js +38 -0
  28. package/dist/Components/Forms/ApiForm.d.ts +23 -0
  29. package/dist/Components/Forms/ApiForm.js +100 -0
  30. package/dist/Components/Forms/Crud.d.ts +17 -0
  31. package/dist/Components/Forms/Crud.js +708 -0
  32. package/dist/Components/Forms/CrudParts.d.ts +15 -0
  33. package/dist/Components/Forms/CrudParts.js +36 -0
  34. package/dist/Components/Forms/ExcelImport.d.ts +42 -0
  35. package/dist/Components/Forms/ExcelImport.js +190 -0
  36. package/dist/Components/Forms/Form.d.ts +52 -0
  37. package/dist/Components/Forms/Form.js +323 -0
  38. package/dist/Components/Forms/SubmitForm.d.ts +65 -0
  39. package/dist/Components/Forms/SubmitForm.js +198 -0
  40. package/dist/Components/Inputs/Calendar.d.ts +69 -0
  41. package/dist/Components/Inputs/Calendar.js +258 -0
  42. package/dist/Components/Inputs/CheckBox.d.ts +53 -0
  43. package/dist/Components/Inputs/CheckBox.js +87 -0
  44. package/dist/Components/Inputs/CheckBoxGroup.d.ts +20 -0
  45. package/dist/Components/Inputs/CheckBoxGroup.js +80 -0
  46. package/dist/Components/Inputs/ChoiceField.d.ts +122 -0
  47. package/dist/Components/Inputs/ChoiceField.js +169 -0
  48. package/dist/Components/Inputs/DatePicker.d.ts +54 -0
  49. package/dist/Components/Inputs/DatePicker.js +246 -0
  50. package/dist/Components/Inputs/DateRangePicker.d.ts +62 -0
  51. package/dist/Components/Inputs/DateRangePicker.js +283 -0
  52. package/dist/Components/Inputs/DateTimePicker.d.ts +75 -0
  53. package/dist/Components/Inputs/DateTimePicker.js +400 -0
  54. package/dist/Components/Inputs/Dropdown.d.ts +117 -0
  55. package/dist/Components/Inputs/Dropdown.js +839 -0
  56. package/dist/Components/Inputs/DropdownParts.d.ts +84 -0
  57. package/dist/Components/Inputs/DropdownParts.js +102 -0
  58. package/dist/Components/Inputs/EditorShell.d.ts +45 -0
  59. package/dist/Components/Inputs/EditorShell.js +214 -0
  60. package/dist/Components/Inputs/Field.d.ts +53 -0
  61. package/dist/Components/Inputs/Field.js +16 -0
  62. package/dist/Components/Inputs/GroupForm.d.ts +20 -0
  63. package/dist/Components/Inputs/GroupForm.js +172 -0
  64. package/dist/Components/Inputs/InputField.d.ts +59 -0
  65. package/dist/Components/Inputs/InputField.js +169 -0
  66. package/dist/Components/Inputs/InputRenderer.d.ts +37 -0
  67. package/dist/Components/Inputs/InputRenderer.js +99 -0
  68. package/dist/Components/Inputs/MarkdownEditor.d.ts +67 -0
  69. package/dist/Components/Inputs/MarkdownEditor.js +289 -0
  70. package/dist/Components/Inputs/NumberBox.d.ts +53 -0
  71. package/dist/Components/Inputs/NumberBox.js +228 -0
  72. package/dist/Components/Inputs/RadioGroup.d.ts +20 -0
  73. package/dist/Components/Inputs/RadioGroup.js +43 -0
  74. package/dist/Components/Inputs/ReadOnlyNotice.d.ts +36 -0
  75. package/dist/Components/Inputs/ReadOnlyNotice.js +117 -0
  76. package/dist/Components/Inputs/RichTextEditor.d.ts +103 -0
  77. package/dist/Components/Inputs/RichTextEditor.js +1170 -0
  78. package/dist/Components/Inputs/RichTextParts.d.ts +63 -0
  79. package/dist/Components/Inputs/RichTextParts.js +157 -0
  80. package/dist/Components/Inputs/RowsInput.d.ts +115 -0
  81. package/dist/Components/Inputs/RowsInput.js +308 -0
  82. package/dist/Components/Inputs/Slider.d.ts +87 -0
  83. package/dist/Components/Inputs/Slider.js +216 -0
  84. package/dist/Components/Inputs/TabularForm.d.ts +27 -0
  85. package/dist/Components/Inputs/TabularForm.js +348 -0
  86. package/dist/Components/Inputs/TextArea.d.ts +43 -0
  87. package/dist/Components/Inputs/TextArea.js +31 -0
  88. package/dist/Components/Inputs/TextBox.d.ts +52 -0
  89. package/dist/Components/Inputs/TextBox.js +58 -0
  90. package/dist/Components/Inputs/TextField.d.ts +31 -0
  91. package/dist/Components/Inputs/TextField.js +35 -0
  92. package/dist/Components/Inputs/TimePanel.d.ts +34 -0
  93. package/dist/Components/Inputs/TimePanel.js +288 -0
  94. package/dist/Components/Inputs/TimePicker.d.ts +54 -0
  95. package/dist/Components/Inputs/TimePicker.js +240 -0
  96. package/dist/Components/Inputs/TreeView.d.ts +160 -0
  97. package/dist/Components/Inputs/TreeView.js +947 -0
  98. package/dist/Components/Layouts/MessageBox.d.ts +71 -0
  99. package/dist/Components/Layouts/MessageBox.js +104 -0
  100. package/dist/Components/Layouts/Popup.d.ts +92 -0
  101. package/dist/Components/Layouts/Popup.js +376 -0
  102. package/dist/Components/Layouts/PopupContext.d.ts +2 -0
  103. package/dist/Components/Layouts/PopupContext.js +4 -0
  104. package/dist/Components/Layouts/PopupDock.d.ts +22 -0
  105. package/dist/Components/Layouts/PopupDock.js +121 -0
  106. package/dist/Components/Layouts/PopupHost.d.ts +56 -0
  107. package/dist/Components/Layouts/PopupHost.js +163 -0
  108. package/dist/Components/Layouts/PopupRules.d.ts +30 -0
  109. package/dist/Components/Layouts/PopupRules.js +63 -0
  110. package/dist/Components/Layouts/ThemePicker.d.ts +13 -0
  111. package/dist/Components/Layouts/ThemePicker.js +22 -0
  112. package/dist/Components/Layouts/ThemeScript.d.ts +14 -0
  113. package/dist/Components/Layouts/ThemeScript.js +13 -0
  114. package/dist/Components/Layouts/ThemeSwitcher.d.ts +13 -0
  115. package/dist/Components/Layouts/ThemeSwitcher.js +49 -0
  116. package/dist/Components/Layouts/Toaster.d.ts +76 -0
  117. package/dist/Components/Layouts/Toaster.js +172 -0
  118. package/dist/Components/Viewers/DataTable.d.ts +25 -0
  119. package/dist/Components/Viewers/DataTable.js +596 -0
  120. package/dist/Components/Viewers/DataTableColumns.d.ts +28 -0
  121. package/dist/Components/Viewers/DataTableColumns.js +243 -0
  122. package/dist/Components/Viewers/DataTableParts.d.ts +138 -0
  123. package/dist/Components/Viewers/DataTableParts.js +157 -0
  124. package/dist/Components/Viewers/MarkdownView.d.ts +26 -0
  125. package/dist/Components/Viewers/MarkdownView.js +79 -0
  126. package/dist/Components/Viewers/RichTextView.d.ts +18 -0
  127. package/dist/Components/Viewers/RichTextView.js +17 -0
  128. package/dist/Helpers/AnimationHelpers.d.ts +6 -0
  129. package/dist/Helpers/AnimationHelpers.js +35 -0
  130. package/dist/Helpers/ApiClient.d.ts +96 -0
  131. package/dist/Helpers/ApiClient.js +200 -0
  132. package/dist/Helpers/ApiFormHelpers.d.ts +49 -0
  133. package/dist/Helpers/ApiFormHelpers.js +120 -0
  134. package/dist/Helpers/ApiModules.d.ts +131 -0
  135. package/dist/Helpers/ApiModules.js +195 -0
  136. package/dist/Helpers/ApiResponses.d.ts +51 -0
  137. package/dist/Helpers/ApiResponses.js +250 -0
  138. package/dist/Helpers/ApiRoutes.d.ts +140 -0
  139. package/dist/Helpers/ApiRoutes.js +183 -0
  140. package/dist/Helpers/ApiToasts.d.ts +21 -0
  141. package/dist/Helpers/ApiToasts.js +22 -0
  142. package/dist/Helpers/ChatBackend.d.ts +134 -0
  143. package/dist/Helpers/ChatBackend.js +332 -0
  144. package/dist/Helpers/ChatHelpers.d.ts +189 -0
  145. package/dist/Helpers/ChatHelpers.js +486 -0
  146. package/dist/Helpers/ChatHooks.d.ts +81 -0
  147. package/dist/Helpers/ChatHooks.js +175 -0
  148. package/dist/Helpers/ChatStore.d.ts +132 -0
  149. package/dist/Helpers/ChatStore.js +394 -0
  150. package/dist/Helpers/ChatSummaries.d.ts +39 -0
  151. package/dist/Helpers/ChatSummaries.js +118 -0
  152. package/dist/Helpers/ClassHelpers.d.ts +3 -0
  153. package/dist/Helpers/ClassHelpers.js +4 -0
  154. package/dist/Helpers/CrudBackend.d.ts +98 -0
  155. package/dist/Helpers/CrudBackend.js +214 -0
  156. package/dist/Helpers/CrudHelpers.d.ts +111 -0
  157. package/dist/Helpers/CrudHelpers.js +267 -0
  158. package/dist/Helpers/DateHelpers.d.ts +88 -0
  159. package/dist/Helpers/DateHelpers.js +363 -0
  160. package/dist/Helpers/DatePreferences.d.ts +14 -0
  161. package/dist/Helpers/DatePreferences.js +94 -0
  162. package/dist/Helpers/DateTimeHelpers.d.ts +87 -0
  163. package/dist/Helpers/DateTimeHelpers.js +286 -0
  164. package/dist/Helpers/DragHelpers.d.ts +129 -0
  165. package/dist/Helpers/DragHelpers.js +281 -0
  166. package/dist/Helpers/DropdownHelpers.d.ts +56 -0
  167. package/dist/Helpers/DropdownHelpers.js +180 -0
  168. package/dist/Helpers/ExcelBackend.d.ts +106 -0
  169. package/dist/Helpers/ExcelBackend.js +290 -0
  170. package/dist/Helpers/ExcelHelpers.d.ts +98 -0
  171. package/dist/Helpers/ExcelHelpers.js +302 -0
  172. package/dist/Helpers/FormDrafts.d.ts +18 -0
  173. package/dist/Helpers/FormDrafts.js +76 -0
  174. package/dist/Helpers/FormStore.d.ts +233 -0
  175. package/dist/Helpers/FormStore.js +752 -0
  176. package/dist/Helpers/InputParamsHelpers.d.ts +79 -0
  177. package/dist/Helpers/InputParamsHelpers.js +388 -0
  178. package/dist/Helpers/MarkdownEditing.d.ts +27 -0
  179. package/dist/Helpers/MarkdownEditing.js +250 -0
  180. package/dist/Helpers/MarkdownHelpers.d.ts +82 -0
  181. package/dist/Helpers/MarkdownHelpers.js +775 -0
  182. package/dist/Helpers/MessageBuilder.d.ts +74 -0
  183. package/dist/Helpers/MessageBuilder.js +252 -0
  184. package/dist/Helpers/NepaliCalendar.d.ts +25 -0
  185. package/dist/Helpers/NepaliCalendar.js +107 -0
  186. package/dist/Helpers/NumberHelpers.d.ts +71 -0
  187. package/dist/Helpers/NumberHelpers.js +202 -0
  188. package/dist/Helpers/Permissions.d.ts +62 -0
  189. package/dist/Helpers/Permissions.js +133 -0
  190. package/dist/Helpers/PopoverHelpers.d.ts +68 -0
  191. package/dist/Helpers/PopoverHelpers.js +195 -0
  192. package/dist/Helpers/RichTextHelpers.d.ts +77 -0
  193. package/dist/Helpers/RichTextHelpers.js +1072 -0
  194. package/dist/Helpers/RowsStore.d.ts +166 -0
  195. package/dist/Helpers/RowsStore.js +606 -0
  196. package/dist/Helpers/TableColumns.d.ts +47 -0
  197. package/dist/Helpers/TableColumns.js +282 -0
  198. package/dist/Helpers/TableExport.d.ts +30 -0
  199. package/dist/Helpers/TableExport.js +97 -0
  200. package/dist/Helpers/TableHelpers.d.ts +110 -0
  201. package/dist/Helpers/TableHelpers.js +301 -0
  202. package/dist/Helpers/TableStore.d.ts +142 -0
  203. package/dist/Helpers/TableStore.js +530 -0
  204. package/dist/Helpers/ThemeHelpers.d.ts +15 -0
  205. package/dist/Helpers/ThemeHelpers.js +16 -0
  206. package/dist/Helpers/TimeHelpers.d.ts +73 -0
  207. package/dist/Helpers/TimeHelpers.js +253 -0
  208. package/dist/Helpers/TreeStore.d.ts +188 -0
  209. package/dist/Helpers/TreeStore.js +577 -0
  210. package/dist/Helpers/ValidationHelpers.d.ts +124 -0
  211. package/dist/Helpers/ValidationHelpers.js +301 -0
  212. package/dist/Interfaces/ApiInterfaces.d.ts +174 -0
  213. package/dist/Interfaces/ApiInterfaces.js +30 -0
  214. package/dist/Interfaces/ChatInterfaces.d.ts +240 -0
  215. package/{src/sso-client.tsx → dist/Interfaces/ChatInterfaces.js} +1 -1
  216. package/dist/Interfaces/CrudInterfaces.d.ts +232 -0
  217. package/dist/Interfaces/CrudInterfaces.js +1 -0
  218. package/dist/Interfaces/DateInterfaces.d.ts +154 -0
  219. package/dist/Interfaces/DateInterfaces.js +29 -0
  220. package/dist/Interfaces/ExcelInterfaces.d.ts +215 -0
  221. package/dist/Interfaces/ExcelInterfaces.js +45 -0
  222. package/dist/Interfaces/FormInterfaces.d.ts +402 -0
  223. package/dist/Interfaces/FormInterfaces.js +1 -0
  224. package/dist/Interfaces/InputInterfaces.d.ts +141 -0
  225. package/dist/Interfaces/InputInterfaces.js +1 -0
  226. package/dist/Interfaces/MessageInterfaces.d.ts +111 -0
  227. package/dist/Interfaces/MessageInterfaces.js +5 -0
  228. package/dist/Interfaces/TableInterfaces.d.ts +351 -0
  229. package/dist/Interfaces/TableInterfaces.js +1 -0
  230. package/dist/Interfaces/ThemeInterfaces.d.ts +17 -0
  231. package/dist/Interfaces/ThemeInterfaces.js +17 -0
  232. package/dist/Interfaces/TypeInterfaces.d.ts +4 -0
  233. package/dist/Interfaces/TypeInterfaces.js +1 -0
  234. package/dist/Server.Index.d.ts +2 -0
  235. package/dist/Server.Index.js +5 -0
  236. package/dist/Services/ApiProxy.d.ts +32 -0
  237. package/dist/Services/ApiProxy.js +111 -0
  238. package/dist/Services/BrowserApi.d.ts +95 -0
  239. package/dist/Services/BrowserApi.js +129 -0
  240. package/dist/Services/ChatApi.d.ts +37 -0
  241. package/dist/Services/ChatApi.js +98 -0
  242. package/dist/Services/ExcelApi.d.ts +46 -0
  243. package/dist/Services/ExcelApi.js +196 -0
  244. package/dist/Services/ServerApi.d.ts +54 -0
  245. package/dist/Services/ServerApi.js +78 -0
  246. package/dist/Services/ThemeService.d.ts +17 -0
  247. package/dist/Services/ThemeService.js +83 -0
  248. package/dist/Shared.Index.d.ts +51 -0
  249. package/dist/Shared.Index.js +55 -0
  250. package/package.json +85 -33
  251. package/src/Styles/Nexus.Base.css +70 -0
  252. package/src/Styles/Nexus.Button.css +153 -0
  253. package/src/Styles/Nexus.Calendar.css +275 -0
  254. package/src/Styles/Nexus.Chat.css +1489 -0
  255. package/src/Styles/Nexus.Choice.css +345 -0
  256. package/src/Styles/Nexus.Crud.css +161 -0
  257. package/src/Styles/Nexus.DateTime.css +81 -0
  258. package/src/Styles/Nexus.Dropdown.css +774 -0
  259. package/src/Styles/Nexus.Editor.css +297 -0
  260. package/src/Styles/Nexus.Excel.css +370 -0
  261. package/src/Styles/Nexus.Form.css +321 -0
  262. package/src/Styles/Nexus.Index.css +36 -0
  263. package/src/Styles/Nexus.Input.css +637 -0
  264. package/src/Styles/Nexus.Markdown.css +265 -0
  265. package/src/Styles/Nexus.Menu.css +259 -0
  266. package/src/Styles/Nexus.Popup.css +731 -0
  267. package/src/Styles/Nexus.RichText.css +463 -0
  268. package/src/Styles/Nexus.Rows.css +596 -0
  269. package/src/Styles/Nexus.Slider.css +278 -0
  270. package/src/Styles/Nexus.Tab.Buttons.css +419 -0
  271. package/src/Styles/Nexus.Table.css +1296 -0
  272. package/src/Styles/Nexus.Theme.Picker.css +232 -0
  273. package/src/Styles/Nexus.Themes.css +194 -0
  274. package/src/Styles/Nexus.Time.css +147 -0
  275. package/src/Styles/Nexus.Toast.css +265 -0
  276. package/src/Styles/Nexus.Tokens.css +72 -0
  277. package/src/Styles/Nexus.Tree.css +435 -0
  278. package/src/api-services/authentication-service.tsx +0 -23
  279. package/src/api-services/preference-service.tsx +0 -5
  280. package/src/api-services/system-service.tsx +0 -29
  281. package/src/client.ts +0 -31
  282. package/src/components/documents/button.tsx +0 -133
  283. package/src/components/documents/icon-box.tsx +0 -93
  284. package/src/components/documents/page-title.tsx +0 -7
  285. package/src/components/documents/tab-button.tsx +0 -172
  286. package/src/components/documents/tag.tsx +0 -30
  287. package/src/components/index.js +0 -0
  288. package/src/components/inputs/checkbox-input.tsx +0 -66
  289. package/src/components/inputs/input-box.tsx +0 -48
  290. package/src/components/inputs/input-element.tsx +0 -65
  291. package/src/components/inputs/input-form.tsx +0 -164
  292. package/src/components/inputs/input.tsx +0 -181
  293. package/src/components/inputs/number-input.tsx +0 -108
  294. package/src/components/inputs/radiobox-input.tsx +0 -53
  295. package/src/components/inputs/textarea-input.tsx +0 -47
  296. package/src/components/inputs/textbox-input.tsx +0 -45
  297. package/src/components/layouts/global-dialogbox.tsx +0 -431
  298. package/src/components/layouts/global-layout.tsx +0 -64
  299. package/src/components/layouts/layout-helpers.tsx +0 -20
  300. package/src/components/layouts/panels/user-panel.tsx +0 -112
  301. package/src/components/layouts/utility-menu.tsx +0 -49
  302. package/src/components/panels/theme-panel.tsx +0 -46
  303. package/src/helpers/bitwise-helpers.tsx +0 -11
  304. package/src/helpers/browser-helpers.tsx +0 -156
  305. package/src/helpers/datasource-helpers.tsx +0 -99
  306. package/src/helpers/element-helpers.tsx +0 -123
  307. package/src/helpers/input-helpers.tsx +0 -74
  308. package/src/helpers/string-helpers.tsx +0 -28
  309. package/src/helpers/utility-helpers.tsx +0 -45
  310. package/src/helpers/validation-helpers.tsx +0 -302
  311. package/src/index.ts +0 -26
  312. package/src/interface.ts +0 -19
  313. package/src/interfaces/auth-token-interfaces.tsx +0 -6
  314. package/src/interfaces/browser-interfaces.tsx +0 -36
  315. package/src/interfaces/button-interfaces.tsx +0 -63
  316. package/src/interfaces/datasource-interfaces.tsx +0 -22
  317. package/src/interfaces/datatable-interfaces.tsx +0 -25
  318. package/src/interfaces/dialogbox-interfaces.tsx +0 -5
  319. package/src/interfaces/exception-interfaces.tsx +0 -99
  320. package/src/interfaces/http-interfaces.tsx +0 -129
  321. package/src/interfaces/icon-interfaces.tsx +0 -129
  322. package/src/interfaces/input-interfaces.tsx +0 -410
  323. package/src/interfaces/layout-interfaces.tsx +0 -191
  324. package/src/interfaces/menu-interfaces.tsx +0 -53
  325. package/src/interfaces/message-interfaces.tsx +0 -32
  326. package/src/interfaces/permission-interfaces.tsx +0 -9
  327. package/src/interfaces/storage-interfaces.tsx +0 -5
  328. package/src/interfaces/system-interfaces.tsx +0 -22
  329. package/src/interfaces/theme-interfaces.tsx +0 -123
  330. package/src/interfaces/type-interfaces.tsx +0 -28
  331. package/src/interfaces/user-interfaces.tsx +0 -47
  332. package/src/nexus-client.tsx +0 -21
  333. package/src/nexus.environments.tsx +0 -66
  334. package/src/proxy-api/proxy-backend.tsx +0 -60
  335. package/src/proxy-api/proxy-constants.tsx +0 -28
  336. package/src/proxy-api/proxy-helpers.tsx +0 -91
  337. package/src/proxy-api-client.tsx +0 -1
  338. package/src/proxy-api-server.tsx +0 -2
  339. package/src/services/http-client-services.tsx +0 -75
  340. package/src/services/http-services.tsx +0 -158
  341. package/src/services/loader-service.tsx +0 -185
  342. package/src/services/localstorage-service.tsx +0 -119
  343. package/src/services/message-services.tsx +0 -383
  344. package/src/services/theme-service.tsx +0 -163
  345. package/src/services/user-services.tsx +0 -10
  346. package/src/sso-config/auth-token-validation.ts +0 -16
  347. package/src/sso-config/callback-route.tsx +0 -35
  348. package/src/sso-config/cookie-encryption.ts +0 -51
  349. package/src/sso-config/cookie-helpers.tsx +0 -102
  350. package/src/sso-config/forgot-password-route.tsx +0 -36
  351. package/src/sso-config/oauth-callback-state.ts +0 -61
  352. package/src/sso-config/pkce-helpers.ts +0 -9
  353. package/src/sso-config/provider-complete-route.tsx +0 -18
  354. package/src/sso-config/redirect-context-actions.tsx +0 -45
  355. package/src/sso-config/redirect-context-helpers.tsx +0 -159
  356. package/src/sso-config/redirect-context-persist.tsx +0 -18
  357. package/src/sso-config/redirect-context-route.tsx +0 -45
  358. package/src/sso-config/refresh-route.tsx +0 -23
  359. package/src/sso-config/sign-in-route.tsx +0 -74
  360. package/src/sso-config/sign-out-route.tsx +0 -57
  361. package/src/sso-config/sign-up-route.tsx +0 -57
  362. package/src/sso-config/sso-backend-flow.ts +0 -38
  363. package/src/sso-config/sso-complete-route.tsx +0 -50
  364. package/src/sso-config/sso-config.ts +0 -59
  365. package/src/sso-config/sso-interfaces.tsx +0 -99
  366. package/src/sso-config/sso-response-helpers.tsx +0 -20
  367. package/src/sso-server.tsx +0 -21
  368. package/src/styles/nexus.animation.css +0 -269
  369. package/src/styles/nexus.core.css +0 -119
  370. package/src/styles/nexus.dialog.css +0 -144
  371. package/src/styles/nexus.grid-view.css +0 -42
  372. package/src/styles/nexus.icon.css +0 -51
  373. package/src/styles/nexus.input.css +0 -207
  374. package/src/styles/nexus.loader.css +0 -11
  375. package/src/styles/nexus.logic.css +0 -47
  376. package/src/styles/nexus.utility.css +0 -347
@@ -0,0 +1,332 @@
1
+ import { NexusModule } from "../Interfaces/ApiInterfaces.js";
2
+ import { apiEndpoint } from "./ApiRoutes.js";
3
+ import { chatPreviewText } from "./ChatHelpers.js";
4
+ /*
5
+ * How a chat talks to a backend: which endpoint serves each action, what each request sends, and how each answer is
6
+ * read. `ChatBackend` is what an app implements for its own backend; `NexusChatBackend` is the Nexus one, and runs
7
+ * when nothing is registered. Nothing here calls anything — `apiChatSource` does that — so this file is pure and can
8
+ * be checked without a server.
9
+ *
10
+ * **The Nexus endpoints below are the shape the Chat module is expected to take, not an API that answers today.** The
11
+ * backend module (`NexusModule.Chat`, bit 6) exists as a number and a proxy key; its controller does not. Until it
12
+ * does, an app either registers its own backend with `defineChatBackend` or hands the components a `ChatSource` of
13
+ * its own (`localChatSource` keeps a conversation in memory). When the controller lands, whatever differs is one
14
+ * override here, not a change in every component.
15
+ */
16
+ /** The actions a chat needs from a backend. A backend that does not serve one takes that feature off the panel. */
17
+ export const CHAT_ACTIONS = {
18
+ /** The conversations a record holds, for this reader. */
19
+ conversations: "ConversationListing",
20
+ /** Starts one. */
21
+ createConversation: "CreateConversation",
22
+ /** One page of messages. */
23
+ history: "History",
24
+ /** Writes one message. */
25
+ send: "Create",
26
+ /** The counts of many records at once, for the trigger icons in a list. */
27
+ summaries: "Summaries",
28
+ /** The people in a conversation, and the ones who could join, searched. */
29
+ participants: "ParticipantPagination",
30
+ /** How far this user has read. */
31
+ read: "Read",
32
+ /** Removes one message. */
33
+ remove: "Delete",
34
+ /** Adds people to a conversation. */
35
+ addParticipants: "AddParticipants",
36
+ };
37
+ const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
38
+ const text = (value) => (typeof value === "string" && value.trim() !== "" ? value : null);
39
+ const count = (value) => {
40
+ const number = Number(value);
41
+ return Number.isFinite(number) ? number : 0;
42
+ };
43
+ const id = (value) => (typeof value === "string" || typeof value === "number" ? value : null);
44
+ /** Rows of an answer: an array, or the `results` of a page. */
45
+ function rowsOf(result) {
46
+ const list = Array.isArray(result) ? result : isRecord(result) && Array.isArray(result.results) ? result.results : [];
47
+ return list.filter(isRecord);
48
+ }
49
+ /**
50
+ * What a chat needs from a backend. Extend it for an app whose chat API differs from the Nexus one, and register it
51
+ * once beside the app's API modules:
52
+ *
53
+ * @example
54
+ * class HrChatBackend extends NexusChatBackend {
55
+ * override endpoint(action: ChatAction) {
56
+ * return action === "history" ? apiEndpoint.post(HrModule.Staff, "LeaveChat/Page") : super.endpoint(action);
57
+ * }
58
+ * }
59
+ * defineChatBackend(new HrChatBackend());
60
+ */
61
+ export class ChatBackend {
62
+ /** Whether the backend serves an action. Default true; `false` takes the feature off the panel. */
63
+ supports(action) {
64
+ void action;
65
+ return true;
66
+ }
67
+ /** What removing a message sends, as the call's `params`: the id in the path. */
68
+ removeParams(scope, messageId) {
69
+ return { id: typeof messageId === "number" ? messageId : String(messageId), parentId: typeof scope.parentId === "number" ? scope.parentId : String(scope.parentId) };
70
+ }
71
+ }
72
+ /**
73
+ * The Nexus Chat module: one controller, `Chat`, whose actions take the domain, the parent id and the reader, and
74
+ * answer as the other Nexus endpoints do (`{ results, totalCount, filterCount }` for pages). See the note at the top
75
+ * of this file: these are the shape the module is expected to take.
76
+ */
77
+ export class NexusChatBackend extends ChatBackend {
78
+ /** The module the chat endpoints live in. `NexusModule.Chat` (bit 6). */
79
+ module = NexusModule.Chat;
80
+ /** The controller the actions hang off. */
81
+ controller = "Chat";
82
+ endpoint(action) {
83
+ const path = `${this.controller}/${CHAT_ACTIONS[action]}`;
84
+ // This class builds the Nexus module's endpoints, so its module is a value of the Nexus enum rather than of the
85
+ // app's. An app whose modules are its own registers its own backend; the API layer looks a module up by value or
86
+ // by key either way, so the one cast here is the whole of the assumption.
87
+ const module = this.module;
88
+ // `subject` words the failure toasts; the panel shows its own messages, so the calls send `toast: false` for the rest.
89
+ switch (action) {
90
+ case "history":
91
+ case "summaries":
92
+ case "participants":
93
+ case "conversations":
94
+ return apiEndpoint.post(module, path, { action: "load", subject: "chat" });
95
+ case "createConversation":
96
+ return apiEndpoint.post(module, path, { action: "create", subject: "conversation" });
97
+ case "read":
98
+ return apiEndpoint.put(module, path, { action: "update", subject: "chat" });
99
+ case "remove":
100
+ return apiEndpoint.delete(module, `${path}/{id}`, { action: "delete", subject: "message" });
101
+ case "addParticipants":
102
+ return apiEndpoint.post(module, path, { action: "create", subject: "participants" });
103
+ default:
104
+ return apiEndpoint.post(module, path, { action: "create", subject: "message" });
105
+ }
106
+ }
107
+ conversationsRequest(scope) {
108
+ return { domainType: scope.domain, parentId: scope.parentId, userId: scope.userId };
109
+ }
110
+ readConversations(result) {
111
+ return rowsOf(result).map(row => this.toConversation(row));
112
+ }
113
+ createConversationRequest(scope, request) {
114
+ return {
115
+ domainType: scope.domain,
116
+ parentId: scope.parentId,
117
+ // The backend's `EChatTypes`: a one-to-one is 0 and a group is 1 until it says otherwise.
118
+ chatType: request.type === "one-to-one" ? 0 : 1,
119
+ title: request.title?.trim() || null,
120
+ userIds: request.userIds,
121
+ };
122
+ }
123
+ readConversation(result) {
124
+ const row = isRecord(result) ? result : {};
125
+ // A backend that answers with the whole list (the new one among the old) hands back the newest.
126
+ const rows = rowsOf(result);
127
+ return this.toConversation(rows.length === 1 ? rows[0] : rows.length > 1 ? (rows.find(one => one.isNew === true) ?? rows[0]) : row);
128
+ }
129
+ historyRequest(scope, request, conversationId) {
130
+ return {
131
+ domainType: scope.domain,
132
+ parentId: scope.parentId,
133
+ userId: scope.userId,
134
+ chatId: conversationId ?? null,
135
+ beforeId: request.before ?? null,
136
+ afterId: request.after ?? null,
137
+ maxCount: request.take,
138
+ };
139
+ }
140
+ readHistory(result) {
141
+ const page = isRecord(result) ? result : {};
142
+ const messages = rowsOf(result).map(row => this.toMessage(row));
143
+ const summary = isRecord(page.summary) ? this.toSummary(page.summary) : undefined;
144
+ const participants = Array.isArray(page.participants) ? page.participants.filter(isRecord).map(row => this.toParticipant(row)) : undefined;
145
+ return {
146
+ messages,
147
+ ...(typeof page.hasMore === "boolean" && { hasMore: page.hasMore }),
148
+ ...(summary && { summary }),
149
+ ...(participants && { participants }),
150
+ ...(typeof page.canSend === "boolean" && { canSend: page.canSend }),
151
+ };
152
+ }
153
+ sendRequest(scope, draft, conversationId) {
154
+ return {
155
+ domainType: scope.domain,
156
+ parentId: scope.parentId,
157
+ chatId: conversationId ?? null,
158
+ body: draft.body,
159
+ replyToId: draft.replyToId ?? null,
160
+ mentions: draft.mentions ?? [],
161
+ clientId: draft.clientId,
162
+ };
163
+ }
164
+ readMessage(result, scope, draft) {
165
+ // The answer is the saved message. A backend that answers with an id alone still gives the chat what it needs:
166
+ // the body it was sent, and this user as its author.
167
+ const row = isRecord(result) ? result : {};
168
+ const saved = this.toMessage(row);
169
+ return {
170
+ ...saved,
171
+ id: saved.id === "" ? (id(row) ?? draft.clientId) : saved.id,
172
+ authorId: saved.authorId === "" ? scope.userId : saved.authorId,
173
+ body: saved.body || draft.body,
174
+ clientId: draft.clientId,
175
+ status: "sent",
176
+ };
177
+ }
178
+ summariesRequest(domain, parentIds, userId) {
179
+ return { domainType: domain, parentIds, userId };
180
+ }
181
+ readSummaries(result) {
182
+ const summaries = new Map();
183
+ for (const row of rowsOf(result)) {
184
+ const parentId = id(row.parentId);
185
+ if (parentId === null)
186
+ continue;
187
+ summaries.set(String(parentId), this.toSummary(row));
188
+ }
189
+ return summaries;
190
+ }
191
+ participantsRequest(scope, query, conversationId) {
192
+ return {
193
+ domainType: scope.domain,
194
+ parentId: scope.parentId,
195
+ chatId: conversationId ?? null,
196
+ searchKeyword: query.search || undefined,
197
+ skipCount: query.skip,
198
+ maxCount: query.pageSize,
199
+ };
200
+ }
201
+ readParticipants(result) {
202
+ const page = result;
203
+ const items = rowsOf(result).map(row => this.toParticipant(row));
204
+ if (Array.isArray(page))
205
+ return { items, hasMore: false, total: items.length };
206
+ const total = isRecord(page) ? count(page.filterCount ?? page.totalCount) : items.length;
207
+ return { items, total, hasMore: items.length > 0 && total > 0 && items.length < total };
208
+ }
209
+ readMarkRequest(scope, upTo, conversationId) {
210
+ return { domainType: scope.domain, parentId: scope.parentId, chatId: conversationId ?? null, messageId: upTo };
211
+ }
212
+ addParticipantsRequest(scope, userIds, conversationId) {
213
+ return { domainType: scope.domain, parentId: scope.parentId, chatId: conversationId ?? null, userIds };
214
+ }
215
+ /**
216
+ * One conversation row. The type comes back as the backend's `EChatTypes` number (0 one-to-one, 1 group) or as a
217
+ * name; both are read, because which it will be is not settled.
218
+ */
219
+ toConversation(row) {
220
+ const written = String(row.chatType ?? row.type ?? "").toLowerCase().replace(/[\s_-]/g, "");
221
+ const group = written === "1" || written === "group";
222
+ const participants = Array.isArray(row.participants) ? row.participants.filter(isRecord).map(person => this.toParticipant(person)) : undefined;
223
+ return {
224
+ id: id(row.id ?? row.chatId) ?? "",
225
+ type: group ? "group" : "one-to-one",
226
+ title: text(row.title ?? row.name),
227
+ ...(participants && { participants }),
228
+ summary: this.toSummary(row),
229
+ createdAt: text(row.creationTime ?? row.createdAt),
230
+ createdBy: id(row.creatorUserId ?? row.createdBy),
231
+ ...(typeof row.canSend === "boolean" && { canSend: row.canSend }),
232
+ ...(row.isClosed === true && { closed: true }),
233
+ };
234
+ }
235
+ /** One message row. The names are the ones a Nexus contract uses; override this alone for a backend that differs. */
236
+ toMessage(row) {
237
+ return {
238
+ id: id(row.id) ?? "",
239
+ authorId: id(row.userId ?? row.authorId ?? row.creatorUserId) ?? "",
240
+ authorName: text(row.userName ?? row.authorName ?? row.creatorUserName),
241
+ authorAvatar: text(row.userImage ?? row.authorAvatar ?? row.photo),
242
+ body: typeof row.body === "string" ? row.body : typeof row.message === "string" ? row.message : "",
243
+ createdAt: text(row.creationTime ?? row.createdAt) ?? "",
244
+ editedAt: text(row.lastModificationTime ?? row.editedAt),
245
+ status: "sent",
246
+ replyToId: id(row.replyToId),
247
+ ...(Array.isArray(row.attachments) && {
248
+ attachments: row.attachments.filter(isRecord).map(file => ({
249
+ id: id(file.id) ?? undefined,
250
+ name: text(file.name ?? file.fileName) ?? "File",
251
+ size: file.size === undefined ? undefined : count(file.size),
252
+ url: text(file.url ?? file.path),
253
+ contentType: text(file.contentType),
254
+ })),
255
+ }),
256
+ ...(row.isSystem === true && { isSystem: true }),
257
+ ...(Array.isArray(row.deliveredTo) && { deliveredTo: row.deliveredTo.map(id).filter((value) => value !== null) }),
258
+ ...(Array.isArray(row.readBy) && { readBy: row.readBy.map(id).filter((value) => value !== null) }),
259
+ };
260
+ }
261
+ /** One set of counts. */
262
+ toSummary(row) {
263
+ const lastText = text(row.lastMessageText ?? row.lastMessage ?? row.lastBody);
264
+ return {
265
+ messageCount: count(row.messageCount ?? row.totalCount),
266
+ unreadCount: count(row.unreadCount),
267
+ lastMessageAt: text(row.lastMessageAt ?? row.lastMessageTime),
268
+ lastMessageText: lastText === null ? null : chatPreviewText(lastText),
269
+ lastMessageBy: text(row.lastMessageBy ?? row.lastMessageUserName),
270
+ ...(row.participantCount !== undefined && { participantCount: count(row.participantCount) }),
271
+ };
272
+ }
273
+ /** One participant row. */
274
+ toParticipant(row) {
275
+ return {
276
+ id: id(row.id ?? row.userId) ?? "",
277
+ name: text(row.name ?? row.userName ?? row.fullName) ?? "Unknown",
278
+ avatar: text(row.avatar ?? row.userImage ?? row.photo),
279
+ role: text(row.role ?? row.designation),
280
+ ...(row.readOnly === true && { readOnly: true }),
281
+ lastReadAt: text(row.lastReadAt),
282
+ ...((row.isActive === false || row.inactive === true) && { inactive: true }),
283
+ };
284
+ }
285
+ }
286
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
287
+ let registered;
288
+ /** Makes an app's chat backend the one every chat uses, and returns it. Call it once, beside `defineApiModules`. */
289
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
290
+ export function defineChatBackend(backend) {
291
+ registered = backend;
292
+ return backend;
293
+ }
294
+ /** The app's chat backend: the one given to `defineChatBackend`, else the Nexus one. */
295
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
296
+ export function getChatBackend() {
297
+ return (registered ??= new NexusChatBackend());
298
+ }
299
+ // Domain names
300
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
301
+ let domains = [];
302
+ /**
303
+ * Names the app's domains, for the panel's heading and its messages. The values are the app's own enum, so this
304
+ * package never holds a number of its own: the owner's list is Leave, Procurement, Applicants, Students, Companies,
305
+ * Tenders and the account kinds, and which number each one is belongs to the backend's `EDomainTypes`.
306
+ *
307
+ * @example
308
+ * defineChatDomains([
309
+ * { domain: EDomainTypes.Leave, key: "leave", label: "Leave request" },
310
+ * { domain: EDomainTypes.Procurement, key: "procurement", label: "Purchase order" },
311
+ * ]);
312
+ */
313
+ export function defineChatDomains(list) {
314
+ const seen = new Set();
315
+ for (const info of list) {
316
+ const key = String(info.domain);
317
+ if (seen.has(key))
318
+ throw new Error(`Two chat domains have the value ${key}.`);
319
+ seen.add(key);
320
+ }
321
+ domains = list;
322
+ return list;
323
+ }
324
+ /** The registered domains. Empty until an app calls `defineChatDomains`. */
325
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
326
+ export function getChatDomains() {
327
+ return domains;
328
+ }
329
+ /** A domain's name on screen, or `undefined` when the app has not named it. */
330
+ export function chatDomainLabel(domain) {
331
+ return domains.find(info => String(info.domain) === String(domain))?.label;
332
+ }
@@ -0,0 +1,189 @@
1
+ import type { AnyChatScope, ChatConversation, ChatConversationType, ChatHighlight, ChatId, ChatMessage, ChatParticipant, ChatPlaceSource, ChatScopeKey, ChatSource, ChatSummary } from "../Interfaces/ChatInterfaces.ts";
2
+ import { type DateTimeFormatOptions } from "./DateTimeHelpers.ts";
3
+ /** A conversation with no messages yet. */
4
+ export declare const EMPTY_CHAT_SUMMARY: ChatSummary;
5
+ /** Messages by the same author this close together are drawn as one run, with one avatar and one time. */
6
+ export declare const CHAT_RUN_MINUTES = 5;
7
+ /** A conversation's key: its domain and its parent id, `"1:482"`. Two scopes of the same record share it, whoever reads. */
8
+ export declare function chatScopeKey(scope: Pick<AnyChatScope, "domain" | "parentId">): ChatScopeKey;
9
+ /** Whether two scopes name the same conversation for the same reader. */
10
+ export declare function sameChatScope(a: AnyChatScope | null | undefined, b: AnyChatScope | null | undefined): boolean;
11
+ /**
12
+ * Which of the three looks the trigger takes: `quiet` with no messages, `active` once the conversation has some, and
13
+ * `unread` once some are this user's to read. The icon never changes size between them.
14
+ */
15
+ export declare function chatHighlight(summary: ChatSummary | null | undefined): ChatHighlight;
16
+ /** Counts over 99 show as "99+", so a badge never grows wider than its icon. */
17
+ export declare function chatBadgeText(count: number, max?: number): string;
18
+ /** Compares ids the way the chat does: id 7 from an API and "7" from a URL are the same person or message. */
19
+ export declare const sameChatId: (a: ChatId | null | undefined, b: ChatId | null | undefined) => boolean;
20
+ /** A message's key for React, and for the maps that hold the conversation. */
21
+ export declare const chatMessageKey: (message: ChatMessage) => string;
22
+ /** Messages oldest first, as the thread reads. */
23
+ export declare function sortChatMessages(messages: readonly ChatMessage[]): ChatMessage[];
24
+ /**
25
+ * Joins a page of messages with the ones already held: oldest first, one entry per message, and a message that came
26
+ * back from the server replacing the one this browser sent (matched by `clientId`, then by id). The newer copy wins,
27
+ * so an edited body and a `sent` status both land.
28
+ */
29
+ export declare function mergeChatMessages(held: readonly ChatMessage[], incoming: readonly ChatMessage[]): ChatMessage[];
30
+ /** Messages this user has not read: the ones written by somebody else after `lastReadAt`. */
31
+ export declare function countChatUnread(messages: readonly ChatMessage[], userId: ChatId, lastReadAt?: string | null): number;
32
+ /**
33
+ * Where the "New messages" line goes: the id of the first of the last `unreadCount` messages not written by this user.
34
+ * `null` when there is nothing unread. Worked out once, when a conversation opens, so the line does not move while it
35
+ * is being read.
36
+ */
37
+ export declare function firstUnreadChatId(messages: readonly ChatMessage[], userId: ChatId, unreadCount: number): ChatId | null;
38
+ /** The counts of a conversation held in full, for a source that keeps its own messages. */
39
+ export declare function summarizeChatMessages(messages: readonly ChatMessage[], userId: ChatId, lastReadAt?: string | null): ChatSummary;
40
+ /**
41
+ * How far a message of your own has got. The chat draws one mark for it, in one place, and this is the only thing that
42
+ * decides which: on its way, not sent, sent, it reached someone, someone read it, everyone read it.
43
+ */
44
+ export type ChatDelivery = "sending" | "failed" | "sent" | "delivered" | "read" | "read-all";
45
+ /** What each state is called, for the mark's tooltip and for a screen reader. */
46
+ export declare const CHAT_DELIVERY_LABELS: Record<ChatDelivery, string>;
47
+ /**
48
+ * How far a message has got. Only the sender's own messages carry a mark, so the reader is left out of both lists: a
49
+ * message is not "read" because the person who wrote it has seen it. Somebody who has left the conversation is left
50
+ * out of "everyone", or a message could never be read by all of it.
51
+ */
52
+ export declare function chatDeliveryState(message: ChatMessage, userId: ChatId, participants?: readonly ChatParticipant[]): ChatDelivery;
53
+ /** A file's size beside its name: "812 B", "248 KB", "3.4 MB". */
54
+ export declare function chatFileSize(bytes: number | null | undefined): string;
55
+ /** A message's first line as plain words, cut for a tooltip or a list: a message is Markdown, a preview is not. */
56
+ export declare function chatPreviewText(body: string, max?: number): string;
57
+ /** How a chat writes dates and times: the user's date settings, and the zone moments are shown in. */
58
+ export type ChatTimeOptions = DateTimeFormatOptions;
59
+ /** What the day divider says: "Today", "Yesterday", or the date in the user's calendar and format. */
60
+ export declare function chatDayLabel(isoDate: string, options?: ChatTimeOptions, today?: string): string;
61
+ /** A message's time of day, in the user's time format and script: "02:30 PM", "१४:३०". */
62
+ export declare function chatTimeLabel(utc: string, options?: ChatTimeOptions): string;
63
+ /** The ISO date a moment falls on in the reader's zone, which is the day its message is grouped under. */
64
+ export declare function chatLocalDate(utc: string, timeZone?: string): string;
65
+ /**
66
+ * How long ago, in few words, for the trigger's tooltip: "just now", "14 min ago", "3 h ago", "yesterday", then the
67
+ * date itself. Never a live-updating clock: the tooltip is read once.
68
+ */
69
+ export declare function chatTimeAgo(utc: string | null | undefined, options?: ChatTimeOptions, now?: number): string;
70
+ /** Messages by one author, close together, drawn with one avatar and one time. */
71
+ export interface ChatRun {
72
+ /** The author of every message in the run. */
73
+ authorId: ChatId;
74
+ authorName: string;
75
+ authorAvatar?: string | null;
76
+ /** Written by this user: the run sits on the right. */
77
+ mine: boolean;
78
+ /** Written by the system: a centered note, with no avatar and no side. */
79
+ system: boolean;
80
+ /** The "New messages" line goes before this run. */
81
+ startsUnread: boolean;
82
+ messages: readonly ChatMessage[];
83
+ }
84
+ /** One day of a conversation. */
85
+ export interface ChatDay {
86
+ /** The ISO date in the reader's zone. */
87
+ date: string;
88
+ /** What the divider says: "Today", "Yesterday", or the date. */
89
+ label: string;
90
+ runs: readonly ChatRun[];
91
+ }
92
+ export interface ChatGroupOptions extends ChatTimeOptions {
93
+ /** Whose messages sit on the right. */
94
+ userId: ChatId;
95
+ /** The message the "New messages" line goes before. */
96
+ unreadFrom?: ChatId | null;
97
+ /** Minutes within which messages by one author join a run. Default 5. */
98
+ runMinutes?: number;
99
+ /** The day "Today" means. Default: the browser's today. */
100
+ today?: string;
101
+ }
102
+ /** What a message with no author name is called. */
103
+ export declare const CHAT_UNKNOWN_AUTHOR = "Unknown";
104
+ /**
105
+ * Lays a conversation out the way it is drawn: a day at a time, and inside a day, runs of messages by one author sent
106
+ * within `runMinutes` of each other. A system note is always its own run, and the first unread message always starts
107
+ * one, so the "New messages" line never has to split a bubble group.
108
+ */
109
+ export declare function groupChatMessages(messages: readonly ChatMessage[], options: ChatGroupOptions): ChatDay[];
110
+ /** What a conversation is called: a group by its name or its people, a one-to-one by the other person. */
111
+ export declare function chatConversationName(conversation: ChatConversation, userId: ChatId, fallback?: string): string;
112
+ /** The counts of a whole place: every conversation in it added up, which is what one trigger icon stands for. */
113
+ export declare function chatPlaceSummary(conversations: readonly ChatConversation[]): ChatSummary;
114
+ /** Which conversation to open: the one with unread messages, else the one with the newest message, else the first. */
115
+ export declare function pickChatConversation(conversations: readonly ChatConversation[]): ChatConversation | undefined;
116
+ /** A conversation of two is a one-to-one; more, or a name, make a group. */
117
+ export declare function chatTypeFor(userIds: readonly ChatId[], title?: string | null): ChatConversationType;
118
+ /** What is being typed after an `@`: where it starts, and the letters so far. */
119
+ export interface ChatMention {
120
+ /** Where the `@` is. */
121
+ at: number;
122
+ /** The caret, which is where the name being typed ends. */
123
+ end: number;
124
+ /** What has been typed after the `@`, which may be empty. */
125
+ query: string;
126
+ }
127
+ /**
128
+ * The `@…` the caret sits in, or `null`. An `@` only counts at the start of a word, so an email address does not open
129
+ * the list, and a space ends it — a name of two words is picked from the list rather than typed through.
130
+ */
131
+ export declare function findChatMention(value: string, caret: number): ChatMention | null;
132
+ /** The people an `@…` offers: those in the conversation whose name or role starts with, or contains, what was typed. */
133
+ export declare function matchChatMentions(participants: readonly ChatParticipant[], query: string, max?: number): ChatParticipant[];
134
+ /**
135
+ * Puts a name into the text being written, in place of the `@…` that was typed. A message is Markdown, so with
136
+ * `href` the name becomes a link; without one it is plain `@Name`, and the id travels in the draft's `mentions`.
137
+ */
138
+ export declare function applyChatMention(value: string, mention: ChatMention, person: ChatParticipant, href?: string | null): {
139
+ value: string;
140
+ caret: number;
141
+ };
142
+ /** The people named with @ in a body, by matching what is written against who is in the conversation. */
143
+ export declare function readChatMentions(body: string, participants: readonly ChatParticipant[]): ChatId[];
144
+ export interface LocalChatSourceOptions {
145
+ /** Who is reading: their messages are their own, and the unread count is theirs. */
146
+ userId: ChatId;
147
+ /** The messages it starts with, in any order. */
148
+ messages?: readonly ChatMessage[];
149
+ /** Everyone in the conversation, searched by `participants`. */
150
+ participants?: readonly ChatParticipant[];
151
+ /** How far this user had read, as a UTC moment. Without it, every message by somebody else is unread. */
152
+ lastReadAt?: string | null;
153
+ /** Milliseconds each call waits, so a demo shows its loading states. Default 0. */
154
+ delay?: number;
155
+ /** Fails every `send`, to show the failed state and Retry. */
156
+ failSend?: boolean;
157
+ /** The author a sent message is written by. Default the reader, named "You". */
158
+ author?: Pick<ChatParticipant, "name" | "avatar">;
159
+ }
160
+ /**
161
+ * A `ChatSource` that keeps everything in memory: the whole chat without a backend, for a demo page, a test, or a
162
+ * page that already has its messages. It answers pages, sends, searches its participants, and keeps the read mark.
163
+ *
164
+ * @example
165
+ * const source = localChatSource({ userId: 7, messages: DEMO_MESSAGES });
166
+ * <ChatPanel scope={scope} source={source} title="Leave request #482" />
167
+ */
168
+ export declare function localChatSource(options: LocalChatSourceOptions): ChatSource & {
169
+ messages: () => readonly ChatMessage[];
170
+ };
171
+ export interface LocalChatPlaceOptions {
172
+ userId: ChatId;
173
+ /** The conversations it starts with. */
174
+ conversations?: readonly ChatConversation[];
175
+ /** Everyone who could be put in a conversation here. */
176
+ participants?: readonly ChatParticipant[];
177
+ /** Milliseconds each call waits, so a demo shows its loading states. Default 0. */
178
+ delay?: number;
179
+ /** Starting a conversation is refused, to show what the panel does then. */
180
+ failCreate?: boolean;
181
+ }
182
+ /**
183
+ * A `ChatPlaceSource` that keeps its conversations in memory: a record with several conversations, and starting
184
+ * another, without a backend. A one-to-one with somebody who already has one comes back rather than being made twice,
185
+ * which is the rule the real backend is expected to follow.
186
+ */
187
+ export declare function localChatPlace(options: LocalChatPlaceOptions): ChatPlaceSource & {
188
+ list: () => readonly ChatConversation[];
189
+ };