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,140 @@
1
+ import type { ApiEndpoint, ApiModuleValue, ApiQuery, HttpMethod } from "../Interfaces/ApiInterfaces.ts";
2
+ import type { CrudMode } from "../Interfaces/CrudInterfaces.ts";
3
+ /**
4
+ * The standard actions of a Nexus controller, as the backend names them. `apiController` builds its endpoints from
5
+ * these; use them for an endpoint of your own too: `apiEndpoint.get(module, "Room/" + API_ACTIONS.activeListing)`.
6
+ */
7
+ export declare const API_ACTIONS: {
8
+ readonly details: "Detail";
9
+ /** Every active record: the `normal` list. */
10
+ readonly listing: "NormalListing";
11
+ readonly activeListing: "ActiveListing";
12
+ readonly findListing: "FindListing";
13
+ /** One page of the `normal` list. */
14
+ readonly pagination: "NormalPagination";
15
+ /** Every record of each list a CRUD shows. */
16
+ readonly listings: {
17
+ readonly normal: "NormalListing";
18
+ readonly flag: "FlagListing";
19
+ readonly trash: "TrashListing";
20
+ readonly deleted: "DeleteListing";
21
+ };
22
+ /** One page of each list a CRUD shows. */
23
+ readonly paginations: {
24
+ readonly normal: "NormalPagination";
25
+ readonly flag: "FlagPagination";
26
+ readonly trash: "TrashPagination";
27
+ readonly deleted: "DeletePagination";
28
+ };
29
+ /** The records the user pinned, which a CRUD shows above its list. */
30
+ readonly pinListing: "PinListing";
31
+ readonly create: "Create";
32
+ readonly update: "Update";
33
+ readonly delete: "Delete";
34
+ readonly trash: "Trash";
35
+ readonly trashFromDelete: "TrashFromDelete";
36
+ readonly recover: "Recover";
37
+ readonly flag: "Flag";
38
+ readonly pin: "Pin";
39
+ readonly audit: "AuditListing";
40
+ readonly accessActions: "AccessActions";
41
+ readonly massDescription: "MassDescription";
42
+ readonly massTrash: "MassTrash";
43
+ readonly massFlag: "MassFlag";
44
+ readonly massPin: "MassPin";
45
+ readonly massDelete: "MassDelete";
46
+ readonly massRecover: "MassRecover";
47
+ readonly massTrashFromDelete: "MassTrashFromDelete";
48
+ };
49
+ /** An endpoint's optional parts: `bodyType`, `query`, `action`, `subject`. */
50
+ export type ApiEndpointExtras = Partial<Omit<ApiEndpoint, "module" | "path" | "method">>;
51
+ type EndpointExtras = ApiEndpointExtras;
52
+ /**
53
+ * Builds an endpoint: `apiEndpoint.get(NexusModule.Message, "EmailProvider/ActiveListing")`. The path is under the
54
+ * module's root; `{name}` in it is filled from the call's `params`, then its body.
55
+ */
56
+ export declare const apiEndpoint: {
57
+ get: <TModule extends ApiModuleValue>(module: TModule, path: string, extras?: EndpointExtras) => ApiEndpoint<TModule>;
58
+ post: <TModule extends ApiModuleValue>(module: TModule, path: string, extras?: EndpointExtras) => ApiEndpoint<TModule>;
59
+ put: <TModule extends ApiModuleValue>(module: TModule, path: string, extras?: EndpointExtras) => ApiEndpoint<TModule>;
60
+ patch: <TModule extends ApiModuleValue>(module: TModule, path: string, extras?: EndpointExtras) => ApiEndpoint<TModule>;
61
+ delete: <TModule extends ApiModuleValue>(module: TModule, path: string, extras?: EndpointExtras) => ApiEndpoint<TModule>;
62
+ };
63
+ /**
64
+ * The endpoints of a Nexus controller, named as the backend names them. `subject` is what the controller keeps, for
65
+ * messages ("room" → "Room saved.", "3 rooms deleted."); a call can name the record instead (`subject: "Room 204"`).
66
+ *
67
+ * @example
68
+ * export const ROOMS = apiController(NexusModule.Reservation, "Room", "room");
69
+ * api.get(ROOMS.details, { params: { id: 5 } }); // GET /api/app/reservation/Room/Detail/5
70
+ * api.put(ROOMS.update, values); // PUT /api/app/reservation/Room/Update → "Room saved."
71
+ * api.delete(ROOMS.delete, { params: { id: 5 } }); // DELETE .../Room/Delete/5 → "Room deleted."
72
+ */
73
+ export declare function apiController<TModule extends ApiModuleValue>(module: TModule, controller: string, subject?: string): {
74
+ module: TModule;
75
+ controller: string;
76
+ /** Every active row: GET `Room/NormalListing`. */
77
+ listing: ApiEndpoint<TModule>;
78
+ /** Active rows for dropdowns: GET `Room/ActiveListing`. */
79
+ activeListing: ApiEndpoint<TModule>;
80
+ /** Rows by id, for saved values a list no longer shows: POST `Room/FindListing` with the ids. */
81
+ findListing: ApiEndpoint<TModule>;
82
+ /** One page of active rows: POST `Room/NormalPagination` with `{ searchKeyword, skipCount, maxCount, sorting, sortType }`. */
83
+ pagination: ApiEndpoint<TModule>;
84
+ /** Every row of each list, for a CRUD that pages in the browser: GET `Room/NormalListing`, `Room/TrashListing`, … */
85
+ lists: Record<CrudMode, ApiEndpoint<TModule>>;
86
+ /** One page of each list, for a CRUD that pages on the server: POST `Room/NormalPagination`, `Room/TrashPagination`, … */
87
+ pages: Record<CrudMode, ApiEndpoint<TModule>>;
88
+ /** The records the user pinned, shown above the list: GET `Room/PinListing`. */
89
+ pins: ApiEndpoint<TModule>;
90
+ /** One record: GET `Room/Detail/{id}`. */
91
+ details: ApiEndpoint<TModule>;
92
+ create: ApiEndpoint<TModule>;
93
+ update: ApiEndpoint<TModule>;
94
+ delete: ApiEndpoint<TModule>;
95
+ trash: ApiEndpoint<TModule>;
96
+ trashFromDelete: ApiEndpoint<TModule>;
97
+ recover: ApiEndpoint<TModule>;
98
+ flag: ApiEndpoint<TModule>;
99
+ pin: ApiEndpoint<TModule>;
100
+ /** A record's history: GET `Room/AuditListing/{ownerId}/{skipCount}`. */
101
+ audit: ApiEndpoint<TModule>;
102
+ /** What the user may do here: GET `Room/AccessActions`. */
103
+ accessActions: ApiEndpoint<TModule>;
104
+ /** Actions on many rows at once: POST `Room/MassDelete` and the rest, with the ids. */
105
+ mass: {
106
+ description: ApiEndpoint<TModule>;
107
+ trash: ApiEndpoint<TModule>;
108
+ trashFromDelete: ApiEndpoint<TModule>;
109
+ flag: ApiEndpoint<TModule>;
110
+ pin: ApiEndpoint<TModule>;
111
+ delete: ApiEndpoint<TModule>;
112
+ recover: ApiEndpoint<TModule>;
113
+ };
114
+ /** Any other action of the controller: `ROOMS.action("PUT", "Block/{id}", { action: "update" })`. */
115
+ action: (method: HttpMethod, action: string, extras?: EndpointExtras) => ApiEndpoint<TModule>;
116
+ };
117
+ export type ApiControllerEndpoints = ReturnType<typeof apiController>;
118
+ /** Whether a value is an endpoint (not a URL or a request of another shape). */
119
+ export declare function isApiEndpoint(value: unknown): value is ApiEndpoint;
120
+ /** Thrown when a path names a value the call did not give, so a request never goes to ".../Detail/undefined". */
121
+ export declare class ApiPathError extends Error {
122
+ readonly path: string;
123
+ readonly missing: string;
124
+ constructor(path: string, missing: string);
125
+ }
126
+ /**
127
+ * Fills `{name}` in a path from `params`, then from the body's fields (names without case), and encodes each value.
128
+ * Leading and trailing slashes go.
129
+ */
130
+ export declare function fillApiPath(path: string, params?: Record<string, unknown> | null, body?: unknown): string;
131
+ /** Adds query values to a URL: lists repeat their name, dates go as ISO text, `null` and `undefined` are left out. */
132
+ export declare function appendQuery(url: string, ...queries: (ApiQuery | null | undefined)[]): string;
133
+ /** Joins a root URL and a path with one slash between them. */
134
+ export declare function joinUrl(root: string, path: string): string;
135
+ export interface ApiUrlParts {
136
+ params?: Record<string, unknown> | null;
137
+ query?: ApiQuery;
138
+ body?: unknown;
139
+ }
140
+ export {};
@@ -0,0 +1,183 @@
1
+ /*
2
+ * Endpoints and their URLs. An endpoint is a path under a module's root; which roots exist, and where, is the app's
3
+ * `ApiModules` class (ApiModules.ts). Define endpoints once, with `apiEndpoint` or `apiController` (or the same
4
+ * methods of the app's modules), and call them from anywhere.
5
+ */
6
+ /**
7
+ * The standard actions of a Nexus controller, as the backend names them. `apiController` builds its endpoints from
8
+ * these; use them for an endpoint of your own too: `apiEndpoint.get(module, "Room/" + API_ACTIONS.activeListing)`.
9
+ */
10
+ export const API_ACTIONS = {
11
+ details: "Detail",
12
+ /** Every active record: the `normal` list. */
13
+ listing: "NormalListing",
14
+ activeListing: "ActiveListing",
15
+ findListing: "FindListing",
16
+ /** One page of the `normal` list. */
17
+ pagination: "NormalPagination",
18
+ /** Every record of each list a CRUD shows. */
19
+ listings: { normal: "NormalListing", flag: "FlagListing", trash: "TrashListing", deleted: "DeleteListing" },
20
+ /** One page of each list a CRUD shows. */
21
+ paginations: { normal: "NormalPagination", flag: "FlagPagination", trash: "TrashPagination", deleted: "DeletePagination" },
22
+ /** The records the user pinned, which a CRUD shows above its list. */
23
+ pinListing: "PinListing",
24
+ create: "Create",
25
+ update: "Update",
26
+ delete: "Delete",
27
+ trash: "Trash",
28
+ trashFromDelete: "TrashFromDelete",
29
+ recover: "Recover",
30
+ flag: "Flag",
31
+ pin: "Pin",
32
+ audit: "AuditListing",
33
+ accessActions: "AccessActions",
34
+ massDescription: "MassDescription",
35
+ massTrash: "MassTrash",
36
+ massFlag: "MassFlag",
37
+ massPin: "MassPin",
38
+ massDelete: "MassDelete",
39
+ massRecover: "MassRecover",
40
+ massTrashFromDelete: "MassTrashFromDelete",
41
+ };
42
+ const define = (method) => (module, path, extras) => ({ ...extras, module, path, method });
43
+ /**
44
+ * Builds an endpoint: `apiEndpoint.get(NexusModule.Message, "EmailProvider/ActiveListing")`. The path is under the
45
+ * module's root; `{name}` in it is filled from the call's `params`, then its body.
46
+ */
47
+ export const apiEndpoint = {
48
+ get: define("GET"),
49
+ post: define("POST"),
50
+ put: define("PUT"),
51
+ patch: define("PATCH"),
52
+ delete: define("DELETE"),
53
+ };
54
+ /**
55
+ * The endpoints of a Nexus controller, named as the backend names them. `subject` is what the controller keeps, for
56
+ * messages ("room" → "Room saved.", "3 rooms deleted."); a call can name the record instead (`subject: "Room 204"`).
57
+ *
58
+ * @example
59
+ * export const ROOMS = apiController(NexusModule.Reservation, "Room", "room");
60
+ * api.get(ROOMS.details, { params: { id: 5 } }); // GET /api/app/reservation/Room/Detail/5
61
+ * api.put(ROOMS.update, values); // PUT /api/app/reservation/Room/Update → "Room saved."
62
+ * api.delete(ROOMS.delete, { params: { id: 5 } }); // DELETE .../Room/Delete/5 → "Room deleted."
63
+ */
64
+ export function apiController(module, controller, subject) {
65
+ const at = (action) => `${controller}/${action}`;
66
+ const endpoint = (method, path, extras) => ({ module, path, method, ...(subject && { subject }), ...extras });
67
+ const A = API_ACTIONS;
68
+ const modes = Object.keys(A.listings);
69
+ const byMode = (method, actions) => Object.fromEntries(modes.map(mode => [mode, endpoint(method, at(actions[mode]), { action: "load" })]));
70
+ return {
71
+ module,
72
+ controller,
73
+ /** Every active row: GET `Room/NormalListing`. */
74
+ listing: endpoint("GET", at(A.listing), { action: "load" }),
75
+ /** Active rows for dropdowns: GET `Room/ActiveListing`. */
76
+ activeListing: endpoint("GET", at(A.activeListing), { action: "load" }),
77
+ /** Rows by id, for saved values a list no longer shows: POST `Room/FindListing` with the ids. */
78
+ findListing: endpoint("POST", at(A.findListing), { action: "load" }),
79
+ /** One page of active rows: POST `Room/NormalPagination` with `{ searchKeyword, skipCount, maxCount, sorting, sortType }`. */
80
+ pagination: endpoint("POST", at(A.pagination), { action: "load" }),
81
+ /** Every row of each list, for a CRUD that pages in the browser: GET `Room/NormalListing`, `Room/TrashListing`, … */
82
+ lists: byMode("GET", A.listings),
83
+ /** One page of each list, for a CRUD that pages on the server: POST `Room/NormalPagination`, `Room/TrashPagination`, … */
84
+ pages: byMode("POST", A.paginations),
85
+ /** The records the user pinned, shown above the list: GET `Room/PinListing`. */
86
+ pins: endpoint("GET", at(A.pinListing), { action: "load" }),
87
+ /** One record: GET `Room/Detail/{id}`. */
88
+ details: endpoint("GET", at(`${A.details}/{id}`), { action: "load" }),
89
+ create: endpoint("POST", at(A.create), { action: "create" }),
90
+ update: endpoint("PUT", at(A.update), { action: "save" }),
91
+ delete: endpoint("DELETE", at(`${A.delete}/{id}`), { action: "delete" }),
92
+ trash: endpoint("DELETE", at(`${A.trash}/{id}`), { action: "trash" }),
93
+ trashFromDelete: endpoint("PUT", at(`${A.trashFromDelete}/{id}`), { action: "trash" }),
94
+ recover: endpoint("PUT", at(`${A.recover}/{id}`), { action: "recover" }),
95
+ flag: endpoint("PUT", at(`${A.flag}/{id}`), { action: "flag" }),
96
+ pin: endpoint("PUT", at(`${A.pin}/{id}`), { action: "pin" }),
97
+ /** A record's history: GET `Room/AuditListing/{ownerId}/{skipCount}`. */
98
+ audit: endpoint("GET", at(`${A.audit}/{ownerId}/{skipCount}`), { action: "load" }),
99
+ /** What the user may do here: GET `Room/AccessActions`. */
100
+ accessActions: endpoint("GET", at(A.accessActions), { action: "load" }),
101
+ /** Actions on many rows at once: POST `Room/MassDelete` and the rest, with the ids. */
102
+ mass: {
103
+ description: endpoint("POST", at(A.massDescription), { action: "update" }),
104
+ trash: endpoint("POST", at(A.massTrash), { action: "trash" }),
105
+ trashFromDelete: endpoint("POST", at(A.massTrashFromDelete), { action: "trash" }),
106
+ flag: endpoint("POST", at(A.massFlag), { action: "flag" }),
107
+ pin: endpoint("POST", at(A.massPin), { action: "pin" }),
108
+ delete: endpoint("POST", at(A.massDelete), { action: "delete" }),
109
+ recover: endpoint("POST", at(A.massRecover), { action: "recover" }),
110
+ },
111
+ /** Any other action of the controller: `ROOMS.action("PUT", "Block/{id}", { action: "update" })`. */
112
+ action: (method, action, extras) => endpoint(method, at(action), extras),
113
+ };
114
+ }
115
+ /** Whether a value is an endpoint (not a URL or a request of another shape). */
116
+ export function isApiEndpoint(value) {
117
+ const endpoint = value;
118
+ return typeof endpoint === "object" && endpoint !== null && (typeof endpoint.module === "number" || typeof endpoint.module === "string") && typeof endpoint.path === "string" && typeof endpoint.method === "string";
119
+ }
120
+ function isRecord(value) {
121
+ return typeof value === "object" && value !== null && !Array.isArray(value) && !(value instanceof Blob) && !(typeof FormData !== "undefined" && value instanceof FormData);
122
+ }
123
+ /** Thrown when a path names a value the call did not give, so a request never goes to ".../Detail/undefined". */
124
+ export class ApiPathError extends Error {
125
+ path;
126
+ missing;
127
+ constructor(path, missing) {
128
+ super(`The API path "${path}" needs "${missing}", which the call did not give.`);
129
+ this.name = "ApiPathError";
130
+ this.path = path;
131
+ this.missing = missing;
132
+ }
133
+ }
134
+ /**
135
+ * Fills `{name}` in a path from `params`, then from the body's fields (names without case), and encodes each value.
136
+ * Leading and trailing slashes go.
137
+ */
138
+ export function fillApiPath(path, params, body) {
139
+ const fields = isRecord(body) ? body : undefined;
140
+ const filled = path.replace(/\{(\w+)\}/g, (_whole, name) => {
141
+ let value = params?.[name];
142
+ if ((value === undefined || value === null) && fields) {
143
+ const lower = name.toLowerCase();
144
+ const key = name in fields ? name : Object.keys(fields).find(candidate => candidate.toLowerCase() === lower);
145
+ if (key !== undefined)
146
+ value = fields[key];
147
+ }
148
+ if (value === undefined || value === null || value === "")
149
+ throw new ApiPathError(path, name);
150
+ return encodeURIComponent(String(value));
151
+ });
152
+ return filled.replace(/^\/+|\/+$/g, "");
153
+ }
154
+ function queryText(value) {
155
+ return value instanceof Date ? value.toISOString() : String(value);
156
+ }
157
+ /** Adds query values to a URL: lists repeat their name, dates go as ISO text, `null` and `undefined` are left out. */
158
+ export function appendQuery(url, ...queries) {
159
+ const search = new URLSearchParams();
160
+ for (const query of queries) {
161
+ for (const [key, value] of Object.entries(query ?? {})) {
162
+ if (value === undefined || value === null)
163
+ continue;
164
+ if (Array.isArray(value))
165
+ for (const item of value)
166
+ search.append(key, queryText(item));
167
+ else
168
+ search.append(key, queryText(value));
169
+ }
170
+ }
171
+ const text = search.toString();
172
+ if (!text)
173
+ return url;
174
+ const hash = url.indexOf("#");
175
+ const [base, fragment] = hash === -1 ? [url, ""] : [url.slice(0, hash), url.slice(hash)];
176
+ return `${base}${base.includes("?") ? "&" : "?"}${text}${fragment}`;
177
+ }
178
+ /** Joins a root URL and a path with one slash between them. */
179
+ export function joinUrl(root, path) {
180
+ if (!path)
181
+ return root.replace(/\/+$/, "");
182
+ return `${root.replace(/\/+$/, "")}/${path.replace(/^\/+/, "")}`;
183
+ }
@@ -0,0 +1,21 @@
1
+ import type { ApiResult, HttpMethod } from "../Interfaces/ApiInterfaces.ts";
2
+ import type { BuiltMessage, MessageContext } from "../Interfaces/MessageInterfaces.ts";
3
+ /**
4
+ * Toasts for one call. `true` shows both, `false` none; or each on its own, with `true`, `false`, or a title of its own:
5
+ * `{ success: "Booking confirmed.", error: false, loading: true }`. `loading` shows a spinner toast while the call runs,
6
+ * which then turns into the success or error toast (or closes).
7
+ */
8
+ export type ApiToastOption = boolean | {
9
+ success?: boolean | string;
10
+ error?: boolean | string;
11
+ loading?: boolean | string;
12
+ };
13
+ /** The app's defaults: an error toast for every failed call, a success toast for POST, PUT, PATCH, and DELETE. */
14
+ export interface ApiToastDefaults {
15
+ success?: boolean;
16
+ error?: boolean;
17
+ }
18
+ /** The toast for a call's answer, or `null` for none. */
19
+ export declare function planApiToast(result: ApiResult, method: HttpMethod, context: MessageContext, option?: ApiToastOption, defaults?: ApiToastDefaults): BuiltMessage | null;
20
+ /** The loading toast's text for a call, or `null` for none. */
21
+ export declare function planLoadingToast(context: MessageContext, option?: ApiToastOption): string | null;
@@ -0,0 +1,22 @@
1
+ import { buildMessage, describeResult } from "./MessageBuilder.js";
2
+ /** The toast for a call's answer, or `null` for none. */
3
+ export function planApiToast(result, method, context, option, defaults = {}) {
4
+ if (result.aborted)
5
+ return null;
6
+ const choice = typeof option === "object" ? (result.ok ? option.success : option.error) : option;
7
+ const wanted = choice ?? (result.ok ? (defaults.success ?? true) && method !== "GET" : (defaults.error ?? true));
8
+ if (!wanted)
9
+ return null;
10
+ const built = describeResult(result, context);
11
+ if (!built || typeof choice !== "string")
12
+ return built;
13
+ // A title of the call's own; a failure keeps the reason under it.
14
+ return result.ok ? { tone: "success", title: choice } : { ...built, title: choice };
15
+ }
16
+ /** The loading toast's text for a call, or `null` for none. */
17
+ export function planLoadingToast(context, option) {
18
+ const loading = typeof option === "object" ? option.loading : undefined;
19
+ if (!loading)
20
+ return null;
21
+ return typeof loading === "string" ? loading : buildMessage("loading", context);
22
+ }
@@ -0,0 +1,134 @@
1
+ import { type ApiEndpoint, type ApiModuleValue } from "../Interfaces/ApiInterfaces.ts";
2
+ import type { AppChatDomain, ChatConversation, ChatDomainInfo, ChatDomainValue, ChatDraft, ChatHistory, ChatHistoryRequest, ChatId, ChatMessage, ChatParticipant, ChatParticipantPage, ChatParticipantQuery, ChatScope, ChatSummary, NewChatRequest } from "../Interfaces/ChatInterfaces.ts";
3
+ /** The actions a chat needs from a backend. A backend that does not serve one takes that feature off the panel. */
4
+ export declare const CHAT_ACTIONS: {
5
+ /** The conversations a record holds, for this reader. */
6
+ readonly conversations: "ConversationListing";
7
+ /** Starts one. */
8
+ readonly createConversation: "CreateConversation";
9
+ /** One page of messages. */
10
+ readonly history: "History";
11
+ /** Writes one message. */
12
+ readonly send: "Create";
13
+ /** The counts of many records at once, for the trigger icons in a list. */
14
+ readonly summaries: "Summaries";
15
+ /** The people in a conversation, and the ones who could join, searched. */
16
+ readonly participants: "ParticipantPagination";
17
+ /** How far this user has read. */
18
+ readonly read: "Read";
19
+ /** Removes one message. */
20
+ readonly remove: "Delete";
21
+ /** Adds people to a conversation. */
22
+ readonly addParticipants: "AddParticipants";
23
+ };
24
+ export type ChatAction = keyof typeof CHAT_ACTIONS;
25
+ type Row = Record<string, unknown>;
26
+ /**
27
+ * What a chat needs from a backend. Extend it for an app whose chat API differs from the Nexus one, and register it
28
+ * once beside the app's API modules:
29
+ *
30
+ * @example
31
+ * class HrChatBackend extends NexusChatBackend {
32
+ * override endpoint(action: ChatAction) {
33
+ * return action === "history" ? apiEndpoint.post(HrModule.Staff, "LeaveChat/Page") : super.endpoint(action);
34
+ * }
35
+ * }
36
+ * defineChatBackend(new HrChatBackend());
37
+ */
38
+ export declare abstract class ChatBackend<TDomain extends ChatDomainValue = AppChatDomain> {
39
+ /**
40
+ * Which endpoint serves an action. The module is one of the app's own (`AppModule`), as everywhere else in the API
41
+ * layer: an app on another backend registers a backend of its own and names its own modules here.
42
+ */
43
+ abstract endpoint(action: ChatAction): ApiEndpoint;
44
+ /** Whether the backend serves an action. Default true; `false` takes the feature off the panel. */
45
+ supports(action: ChatAction): boolean;
46
+ /** What asking for a record's conversations sends. */
47
+ abstract conversationsRequest(scope: ChatScope<TDomain>): unknown;
48
+ /** Reads them. */
49
+ abstract readConversations(result: unknown): readonly ChatConversation[];
50
+ /** What starting a conversation sends. */
51
+ abstract createConversationRequest(scope: ChatScope<TDomain>, request: NewChatRequest): unknown;
52
+ /** Reads the conversation that was started, or the one that already existed. */
53
+ abstract readConversation(result: unknown): ChatConversation;
54
+ /** What a history request sends: which conversation, and which page of it. */
55
+ abstract historyRequest(scope: ChatScope<TDomain>, request: ChatHistoryRequest, conversationId?: ChatId): unknown;
56
+ /** Reads a page of history. */
57
+ abstract readHistory(result: unknown): ChatHistory;
58
+ /** What sending a message sends. */
59
+ abstract sendRequest(scope: ChatScope<TDomain>, draft: ChatDraft, conversationId?: ChatId): unknown;
60
+ /** Reads the saved message. The draft is there for a backend that answers with an id alone. */
61
+ abstract readMessage(result: unknown, scope: ChatScope<TDomain>, draft: ChatDraft): ChatMessage;
62
+ /** What asking for many records' counts sends. One call carries one domain and many parent ids. */
63
+ abstract summariesRequest(domain: TDomain, parentIds: readonly ChatId[], userId: ChatId): unknown;
64
+ /** Reads those counts, by parent id as text (`String(parentId)`). Records the answer leaves out have no messages. */
65
+ abstract readSummaries(result: unknown): Map<string, ChatSummary>;
66
+ /** What a participant search sends. Without a conversation it asks who could be put in a new one. */
67
+ abstract participantsRequest(scope: ChatScope<TDomain>, query: ChatParticipantQuery, conversationId?: ChatId): unknown;
68
+ /** Reads a page of participants. */
69
+ abstract readParticipants(result: unknown): ChatParticipantPage;
70
+ /** What the read mark sends. */
71
+ abstract readMarkRequest(scope: ChatScope<TDomain>, upTo: ChatId, conversationId?: ChatId): unknown;
72
+ /** What adding people sends. */
73
+ abstract addParticipantsRequest(scope: ChatScope<TDomain>, userIds: readonly ChatId[], conversationId?: ChatId): unknown;
74
+ /** What removing a message sends, as the call's `params`: the id in the path. */
75
+ removeParams(scope: ChatScope<TDomain>, messageId: ChatId): Record<string, string | number>;
76
+ }
77
+ /**
78
+ * The Nexus Chat module: one controller, `Chat`, whose actions take the domain, the parent id and the reader, and
79
+ * answer as the other Nexus endpoints do (`{ results, totalCount, filterCount }` for pages). See the note at the top
80
+ * of this file: these are the shape the module is expected to take.
81
+ */
82
+ export declare class NexusChatBackend<TDomain extends ChatDomainValue = AppChatDomain> extends ChatBackend<TDomain> {
83
+ /** The module the chat endpoints live in. `NexusModule.Chat` (bit 6). */
84
+ readonly module: ApiModuleValue;
85
+ /** The controller the actions hang off. */
86
+ readonly controller: string;
87
+ endpoint(action: ChatAction): ApiEndpoint;
88
+ conversationsRequest(scope: ChatScope<TDomain>): unknown;
89
+ readConversations(result: unknown): readonly ChatConversation[];
90
+ createConversationRequest(scope: ChatScope<TDomain>, request: NewChatRequest): unknown;
91
+ readConversation(result: unknown): ChatConversation;
92
+ historyRequest(scope: ChatScope<TDomain>, request: ChatHistoryRequest, conversationId?: ChatId): unknown;
93
+ readHistory(result: unknown): ChatHistory;
94
+ sendRequest(scope: ChatScope<TDomain>, draft: ChatDraft, conversationId?: ChatId): unknown;
95
+ readMessage(result: unknown, scope: ChatScope<TDomain>, draft: ChatDraft): ChatMessage;
96
+ summariesRequest(domain: TDomain, parentIds: readonly ChatId[], userId: ChatId): unknown;
97
+ readSummaries(result: unknown): Map<string, ChatSummary>;
98
+ participantsRequest(scope: ChatScope<TDomain>, query: ChatParticipantQuery, conversationId?: ChatId): unknown;
99
+ readParticipants(result: unknown): ChatParticipantPage;
100
+ readMarkRequest(scope: ChatScope<TDomain>, upTo: ChatId, conversationId?: ChatId): unknown;
101
+ addParticipantsRequest(scope: ChatScope<TDomain>, userIds: readonly ChatId[], conversationId?: ChatId): unknown;
102
+ /**
103
+ * One conversation row. The type comes back as the backend's `EChatTypes` number (0 one-to-one, 1 group) or as a
104
+ * name; both are read, because which it will be is not settled.
105
+ */
106
+ protected toConversation(row: Row): ChatConversation;
107
+ /** One message row. The names are the ones a Nexus contract uses; override this alone for a backend that differs. */
108
+ protected toMessage(row: Row): ChatMessage;
109
+ /** One set of counts. */
110
+ protected toSummary(row: Row): ChatSummary;
111
+ /** One participant row. */
112
+ protected toParticipant(row: Row): ChatParticipant;
113
+ }
114
+ /** Makes an app's chat backend the one every chat uses, and returns it. Call it once, beside `defineApiModules`. */
115
+ export declare function defineChatBackend<T extends ChatBackend<any>>(backend: T): T;
116
+ /** The app's chat backend: the one given to `defineChatBackend`, else the Nexus one. */
117
+ export declare function getChatBackend(): ChatBackend<any>;
118
+ /**
119
+ * Names the app's domains, for the panel's heading and its messages. The values are the app's own enum, so this
120
+ * package never holds a number of its own: the owner's list is Leave, Procurement, Applicants, Students, Companies,
121
+ * Tenders and the account kinds, and which number each one is belongs to the backend's `EDomainTypes`.
122
+ *
123
+ * @example
124
+ * defineChatDomains([
125
+ * { domain: EDomainTypes.Leave, key: "leave", label: "Leave request" },
126
+ * { domain: EDomainTypes.Procurement, key: "procurement", label: "Purchase order" },
127
+ * ]);
128
+ */
129
+ export declare function defineChatDomains<TDomain extends ChatDomainValue>(list: readonly ChatDomainInfo<TDomain>[]): readonly ChatDomainInfo<TDomain>[];
130
+ /** The registered domains. Empty until an app calls `defineChatDomains`. */
131
+ export declare function getChatDomains(): readonly ChatDomainInfo<any>[];
132
+ /** A domain's name on screen, or `undefined` when the app has not named it. */
133
+ export declare function chatDomainLabel(domain: ChatDomainValue): string | undefined;
134
+ export {};