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
@@ -1,28 +0,0 @@
1
- import { EModules } from "../interfaces/system-interfaces";
2
-
3
-
4
- /** HTTP methods supported by the backend proxy. */
5
- export const PROXY_ALLOWED_METHODS = new Set(["GET", "POST", "PUT", "DELETE", "PATCH"]);
6
-
7
- /** Request headers that must not be forwarded to the backend. */
8
- export const PROXY_REQUEST_HEADERS_TO_SKIP = new Set(["host", "connection", "content-length", "transfer-encoding", "keep-alive", "upgrade", "cookie"]);
9
-
10
- /** Response headers that must not be forwarded to the browser. */
11
- export const PROXY_RESPONSE_HEADERS_TO_SKIP = new Set(["connection", "transfer-encoding", "keep-alive", "proxy-authenticate", "proxy-authorization", "te", "trailer", "upgrade"]);
12
-
13
- /** Public path prefix the browser uses to reach the proxy. */
14
-
15
- /** Allowed modules for proxy requests. */
16
-
17
- export const ALLOWED_MODULES = [
18
- EModules.Authentication.toString(),
19
- EModules.Configuration.toString(),
20
- EModules.Enterprise.toString(),
21
- EModules.Drive.toString(),
22
- EModules.Message.toString(),
23
- EModules.Accounting.toString(),
24
- EModules.Report.toString(),
25
- EModules.Portfolio.toString(),
26
- EModules.Subscription.toString(),
27
- EModules.Reservation.toString(),
28
- ]
@@ -1,91 +0,0 @@
1
- import { NextRequest, NextResponse } from "next/server";
2
- import { EErrorCodes, EExceptionCategories } from "../interfaces/exception-interfaces";
3
- import { GetResponse, PROXY_PUBLIC_BASE_PATH } from "../interfaces/http-interfaces";
4
- import { EModules } from "../interfaces/system-interfaces";
5
- import { PROXY_REQUEST_HEADERS_TO_SKIP, PROXY_RESPONSE_HEADERS_TO_SKIP } from "./proxy-constants";
6
-
7
- const BACKEND_NOT_CONFIGURED_ERROR = "Backend API is not configured.";
8
-
9
- export function BuildBackendUrl(backendBase: string, pathSegments: string[], searchParams: URLSearchParams): string {
10
- if (pathSegments.some((segment) => segment === ".." || segment === "." || segment.includes("\\"))) throw new Error("Invalid path.");
11
- else if (!backendBase) throw new Error(BACKEND_NOT_CONFIGURED_ERROR);
12
-
13
- const path = pathSegments.map(encodeURIComponent).join("/");
14
- const query = searchParams.toString();
15
-
16
- return query ? `${backendBase}/${path}?${query}` : `${backendBase}/${path}`;
17
- }
18
-
19
- export function BuildForwardHeaders(req: NextRequest): Headers {
20
- const headers = new Headers();
21
-
22
- req.headers.forEach((value, key) => {
23
- if (PROXY_REQUEST_HEADERS_TO_SKIP.has(key.toLowerCase())) {
24
- return;
25
- }
26
-
27
- headers.set(key, value);
28
- });
29
-
30
- return headers;
31
- }
32
-
33
- export async function ReadRequestBody(req: NextRequest, method: string): Promise<BodyInit | undefined> {
34
- if (method === "GET" || method === "HEAD" || method === "OPTIONS") {
35
- return undefined;
36
- }
37
-
38
- return await req.arrayBuffer();
39
- }
40
-
41
- export function ProxyErrorResponse(message: string, status: number, messageCode = "PROXY_ERROR", errorCode: EErrorCodes = EErrorCodes.Unknown): NextResponse {
42
- return NextResponse.json(GetResponse.ERROR(message, messageCode, EExceptionCategories.Application, errorCode, undefined, null, status), { status });
43
- }
44
- function stripBackendBasePath(pathname: string, backendBaseUrl: string): string {
45
- try {
46
- const basePath = new URL(backendBaseUrl).pathname.replace(/\/+$/, "");
47
- if (pathname.startsWith(basePath)) {
48
- return pathname.slice(basePath.length).replace(/^\/+/, "");
49
- }
50
- } catch {
51
- // Fall through to pathname cleanup below.
52
- }
53
-
54
- return pathname.replace(/^\/+/, "");
55
- }
56
- export function SanitizeResponseHeaders(headers: Headers, backendBaseUrl: string, module: EModules): Headers {
57
- const sanitized = new Headers();
58
- let backendHost: string | undefined;
59
-
60
- try {
61
- backendHost = new URL(backendBaseUrl).host;
62
- } catch {
63
- backendHost = undefined;
64
- }
65
-
66
- headers.forEach((value, key) => {
67
- const lowerKey = key.toLowerCase();
68
-
69
- if (PROXY_RESPONSE_HEADERS_TO_SKIP.has(lowerKey)) {
70
- return;
71
- }
72
-
73
- if (lowerKey === "location" && backendHost) {
74
- try {
75
- const location = new URL(value, backendBaseUrl);
76
- if (location.host === backendHost) {
77
- const relativePath = stripBackendBasePath(location.pathname, backendBaseUrl);
78
- const proxyPath = `${PROXY_PUBLIC_BASE_PATH}/${module}/${relativePath}${location.search}`;
79
- sanitized.set(key, proxyPath);
80
- return;
81
- }
82
- } catch {
83
- // Relative locations are forwarded as-is.
84
- }
85
- }
86
-
87
- sanitized.set(key, value);
88
- });
89
-
90
- return sanitized;
91
- }
@@ -1 +0,0 @@
1
- export * from "./proxy-api/proxy-constants";
@@ -1,2 +0,0 @@
1
- export * from "./proxy-api/proxy-backend";
2
- export * from "./proxy-api/proxy-constants";
@@ -1,75 +0,0 @@
1
- "use client";
2
-
3
- /**
4
- * Client-side HTTP utilities for `"use client"` pages and components.
5
- * Adds UI-level response handling (loader/toast hooks). For Route Handlers and
6
- * Server Components use `http-services` (`HttpPost`, `HttpGet`, …) from `nexus-shared` instead.
7
- */
8
- import { DatasourceTypes, EBody, GetApiInformations, GetResponse, IApiInformations, IErrorRespose, IInterface, ISuccessResponse, UN } from "../interface";
9
- import { HttpDelete, HttpGet, HttpPost, HttpPut } from "./http-services";
10
- import { ErrorMessage, SuccessMessage } from "./message-services";
11
-
12
- /** // if same url is called multiple times, it will only send one request and return the same promise
13
- // this is to prevent multiple requests to the same url at the same time
14
- // this is useful for example when user is typing in a search box and multiple requests are sent to the server
15
- // this will prevent multiple requests to the same url and return the same promise
16
- // this will also prevent multiple requests to the same url when user is navigating to different pages and the same url is called in each page
17
- // If country Dropdown is called multiple times, it will only send one request and return the same promise
18
- // this is useful for example when user is typing in a search box and multiple requests are sent to the server
19
- */
20
- const pendingRequests: { [url: string]: Promise<any> | undefined } = {};
21
- export const Get = async (apiUrl: string, successMessage?: boolean | UN, errorMessage?: boolean | UN): Promise<ISuccessResponse | IErrorRespose> => {
22
- if (pendingRequests[apiUrl] !== undefined) return pendingRequests[apiUrl]!;
23
-
24
- pendingRequests[apiUrl] = HttpGet(apiUrl)
25
- .then((response) => handleResponse(response, successMessage ?? false, errorMessage ?? true))
26
- .finally(() => {
27
- delete pendingRequests[apiUrl];
28
- });
29
- return pendingRequests[apiUrl]!;
30
- };
31
-
32
- export const Put = async (apiUrl: string, body?: any | UN, bodyType?: EBody | UN, successMessage?: boolean | UN, errorMessage?: boolean | UN) => {
33
- return await handleResponse(await HttpPut(apiUrl, body, bodyType, null, 0, null), successMessage ?? true, errorMessage ?? true);
34
- };
35
-
36
- export const Post = async (apiUrl: string, body?: any | UN, bodyType?: EBody | UN, successMessage?: boolean | UN, errorMessage?: boolean | UN) => {
37
- const isFindListing = Array.isArray(body) && apiUrl.endsWith("/FindListing");
38
-
39
- if (!isFindListing) {
40
- return await handleResponse(await HttpPost(apiUrl, body, bodyType, null, 0, null), successMessage ?? true, errorMessage ?? true);
41
- } else {
42
- const apiKey = `${apiUrl}__${(body as string[]).sort().join(",")}`;
43
-
44
- if (pendingRequests[apiKey]) return pendingRequests[apiKey];
45
-
46
- pendingRequests[apiKey] = HttpPost(apiUrl, body, bodyType, null, 0, null)
47
- .then((response) => handleResponse(response, successMessage ?? true, errorMessage ?? true))
48
- .finally(() => {
49
- delete pendingRequests[apiKey];
50
- });
51
- return pendingRequests[apiKey];
52
- }
53
- };
54
-
55
- export const Delete = async (apiUrl: string, successMessage?: boolean | UN, errorMessage?: boolean | UN) => {
56
- return await handleResponse(await HttpDelete(apiUrl, null, 0, null), successMessage ?? true, errorMessage ?? true);
57
- };
58
- export const SubmitApi = async (api: DatasourceTypes | UN, parameters: IInterface | IInterface[] | UN, successMessage?: boolean | UN, errorMessage?: boolean | UN): Promise<IErrorRespose | ISuccessResponse> => {
59
- if (!api || Array.isArray(api) || !GetApiInformations.IS_API(api)) return Promise.resolve(GetResponse.SUCCESS(api));
60
- const apiInfo = api as IApiInformations;
61
-
62
- const url = GetApiInformations.BUILD_API(apiInfo, parameters);
63
-
64
- // TODO:
65
- return Post(url, parameters, null, successMessage, errorMessage);
66
- };
67
-
68
- const handleResponse = async (result: ISuccessResponse | IErrorRespose, successMessage?: boolean, errorMessage?: boolean): Promise<ISuccessResponse | IErrorRespose> => {
69
- if (result.isSuccess && !(result as IErrorRespose).exception) {
70
- if (successMessage) SuccessMessage("Request Success!", result.message ?? "Success");
71
- return result;
72
- }
73
- if (errorMessage) ErrorMessage("Request Failed!", result.message ?? "Failed");
74
- return result;
75
- };
@@ -1,158 +0,0 @@
1
- /**
2
- * Server-side HTTP utilities for Route Handlers, Server Components, and Server Actions.
3
- * For browser/client components use `http-client-services` (`Post`, `Get`, …) via `nexus-shared/client`.
4
- */
5
- import { Delay } from "../helpers/utility-helpers";
6
- import { EActions, EBody, EModules, GetMethod, GetResponse, IErrorRespose, ISuccessResponse, UN } from "../interface";
7
- import { EErrorCodes, EExceptionCategories } from "../interfaces/exception-interfaces";
8
- import { APIS, NEXUS_CONFIG, NEXUS_INFO } from "../nexus.environments";
9
-
10
- const MAX_RETRIES = NEXUS_INFO.IS_PRODUCTION ? 2 : 1;
11
- const RETRY_DELAY_MS = NEXUS_INFO.IS_PRODUCTION ? 50 : 1;
12
-
13
- export const BuildApiHeader = (formdata?: any, httpMethod?: EActions | string, bodyType: EBody | UN = EBody.JSON, token?: string | UN, revalidate?: number | UN, browserId?: string | UN): RequestInit & { next?: { revalidate: number } } => {
14
- httpMethod = httpMethod ?? "GET";
15
- bodyType = bodyType ?? EBody.JSON;
16
-
17
- const headers = new Headers();
18
- if (token && token.length > 50) headers.append("authorization", token.startsWith("Bearer ") ? token : `Bearer ${token}`);
19
- if (browserId) headers.append("bid", browserId);
20
- headers.append("Content-Type", bodyType);
21
-
22
- const options: RequestInit & { next?: { revalidate: number } } = {
23
- method: typeof httpMethod === "string" ? httpMethod : GetMethod(httpMethod),
24
- headers,
25
- };
26
-
27
- if (formdata) options.body = bodyType === EBody.JSON ? JSON.stringify(formdata) : formdata;
28
-
29
- if (!revalidate || revalidate <= 0) {
30
- // No caching
31
- options.cache = "no-store";
32
- } else {
33
- // Use Next.js ISR caching
34
- options.next = { revalidate: revalidate ?? 0 };
35
- }
36
-
37
- return options;
38
- };
39
- const shouldRetry = (error: any) => error.name === "AbortError" || error.code === "ECONNREFUSED" || error.message.includes("fetch") || error.message.includes("network");
40
- const safeFetch = async (fetchFunc: () => Promise<Response>): Promise<ISuccessResponse | IErrorRespose> => {
41
- for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
42
- try {
43
- const response = await fetchFunc();
44
- if (!response.ok) return await handleResponse(response);
45
- return await response.json();
46
- } catch (error: any) {
47
- if (attempt < MAX_RETRIES - 1 && shouldRetry(error)) {
48
- await Delay(RETRY_DELAY_MS * (attempt + 1));
49
- continue;
50
- }
51
- return handleNetworkError(error);
52
- }
53
- }
54
- return handleError({ status: 500, message: "Maximum retry attempts exceeded." });
55
- };
56
- const fetchWithTimeout = async (url: string, options?: RequestInit, timeout = NEXUS_CONFIG.DEFAULT_HTTP_REQUEST_TIMEOUT): Promise<Response> => {
57
- const controller = new AbortController();
58
- const id = setTimeout(() => controller.abort(), timeout);
59
- try {
60
- const response = await fetch(url, { ...options, signal: controller.signal });
61
- return response;
62
- } catch (error) {
63
- throw error;
64
- } finally {
65
- clearTimeout(id);
66
- }
67
- };
68
- export const HttpGet = async (apiUrl: string, token?: string | UN, revalidate?: number | UN, browserId?: string | UN) => {
69
- return await safeFetch(() => fetchWithTimeout(apiUrl, BuildApiHeader(undefined, EActions.Get, EBody.JSON, token, revalidate, browserId)));
70
- };
71
- export const HttpPost = async (apiUrl: string, body?: any | UN, bodyType?: EBody | UN, token?: string | UN, revalidate?: number | UN, browserId?: string | UN) => {
72
- return await safeFetch(() => fetchWithTimeout(apiUrl, BuildApiHeader(body, EActions.Post, bodyType, token, revalidate, browserId)));
73
- };
74
-
75
- export const HttpPut = async (apiUrl: string, body?: any | UN, bodyType?: EBody | UN, token?: string | UN, revalidate?: number | UN, browserId?: string | UN) => {
76
- return await safeFetch(() => fetchWithTimeout(apiUrl, BuildApiHeader(body, EActions.Put, bodyType, token, revalidate, browserId)));
77
- };
78
-
79
- export const HttpDelete = async (apiUrl: string, token?: string | UN, revalidate?: number | UN, browserId?: string | UN) => {
80
- return await safeFetch(() => fetchWithTimeout(apiUrl, BuildApiHeader(undefined, EActions.Delete, undefined, token, revalidate, browserId)));
81
- };
82
-
83
- export const HttpFetch = async (apiUrl: string, method: EActions | string, body?: any, bodyType?: EBody, token?: string | UN, revalidate?: number, browserId?: string | UN): Promise<Response | Error> => {
84
- try {
85
- const response = await fetch(apiUrl, BuildApiHeader(body, method, bodyType, token, revalidate, browserId));
86
- return response;
87
- } catch (error: Error | any) {
88
- return error;
89
- }
90
- };
91
-
92
- export const GetRootApi = (nexusModule: EModules) => {
93
- switch (nexusModule) {
94
- case EModules.None:
95
- return "/api";
96
- case EModules.Authentication:
97
- return APIS.AUTHENTICATION;
98
- case EModules.Configuration:
99
- return APIS.CONFIGURATION;
100
- case EModules.Enterprise:
101
- return APIS.ENTERPRISE;
102
- case EModules.Drive:
103
- return APIS.DRIVE;
104
- case EModules.Message:
105
- return APIS.MESSAGE;
106
- case EModules.Accounting:
107
- return APIS.ACCOUNTING;
108
- case EModules.Report:
109
- return APIS.REPORT;
110
- default:
111
- throw new Error("Invalid Nexus Module");
112
- }
113
- };
114
- const handleResponse = async (response: Response): Promise<IErrorRespose> => {
115
- const status = response.status;
116
- try {
117
- const errorData = await response.json();
118
-
119
- return handleError({ ...errorData, code: status, status: status });
120
- } catch (error: any) {
121
- let message = "Unexpected server error.";
122
- switch (status) {
123
- case 401:
124
- case 403:
125
- message = "You do not have permission to access this resource.";
126
- break;
127
- case 404:
128
- case 410:
129
- message = "Resource not found.";
130
- break;
131
- case 405:
132
- message = "Method not allowed.";
133
- break;
134
- }
135
- return handleError(GetResponse.ERROR(message, "GENERIC_ERROR", EExceptionCategories.Application, EErrorCodes.Unknown, undefined, undefined, status));
136
- }
137
- };
138
- export const handleError = (error: any): IErrorRespose => {
139
- return {
140
- isSuccess: false,
141
- code: error?.code,
142
- message: error?.message || "An unknown error occurred.",
143
- messageCode: error?.messageCode || "GENERIC_ERROR",
144
- exceptionCategory: error?.exceptionCategory || EExceptionCategories.Application,
145
- errorCode: error?.errorCode || EErrorCodes.Unknown,
146
- inputName: error?.inputName || undefined,
147
- exception: error?.exception || undefined,
148
- result: error?.result || undefined,
149
- };
150
- };
151
- const handleNetworkError = (error: any): IErrorRespose => {
152
- return handleError({
153
- status: 503,
154
- message: "Unable to connect to the server. Please check your network or backend status.",
155
- key: "NETWORK_ERROR",
156
- exception: error,
157
- });
158
- };
@@ -1,185 +0,0 @@
1
- import { FindChildElement, IsBrowser, RemoveElement } from "../helpers/browser-helpers";
2
- import { EAnimationClasses, ESizes } from "../interfaces/layout-interfaces";
3
- import { EBackgrounds } from "../interfaces/theme-interfaces";
4
- import { UN } from "../interfaces/type-interfaces";
5
- import { FILES } from "../nexus.environments";
6
-
7
- const DEFAULT_LOADER_TYPE = EAnimationClasses.SPIN;
8
- const DEFAULT_LOADER_SIZE = ESizes.Medium;
9
- const DEFAULT_LOADER_DELAY = 0;
10
- const LOADER_IDENTITY = "nexus-loader";
11
- const LOADER_DATA_COUNT_ATTRIBUTE = "data-count";
12
- const LOADER_DATA_TYPE_ATTRIBUTE = "data-type";
13
- const LOADER_DATA_SIZE_ATTRIBUTE = "data-size";
14
- const LOADER_DATA_DISABLED_INPUTS_ATTRIBUTE = "data-disabled-inputs";
15
- const DISPOSED_LOADER_CLASS = "disposed";
16
- const DEFAULT_LOADER_BACKGROUND = EBackgrounds.PopupBackgroundColor;
17
- /**
18
- *
19
- * @param parent - Parent element to show loader on
20
- * @param type - Animation type to use for showing loader
21
- * @param disabledInputs - If true, all inputs will be disabled
22
- * @param size - Size of the loader
23
- * @param delay - Delay in milliseconds
24
- * @returns - Returns the loader element
25
- */
26
-
27
- const _findParentElement = (parent: String | HTMLElement | UN): HTMLElement => {
28
- if (parent) {
29
- if (typeof parent === "string") return document.getElementById(parent) ?? document.body;
30
- else if (parent instanceof HTMLElement) return parent ?? document.body;
31
- }
32
-
33
- return document.body;
34
- };
35
- const _findExistingLoader = (parent: HTMLElement): HTMLElement | null => {
36
- const loaderElement = FindChildElement(parent, `#${LOADER_IDENTITY}`);
37
- return loaderElement as HTMLElement | null;
38
- };
39
- const _updateLoaderProperties = (loaderElement: HTMLElement, type: EAnimationClasses, size: ESizes, isInputLoader: boolean) => {
40
- if (type === EAnimationClasses.SPIN) {
41
- if (size === ESizes.VeryTiny) {
42
- loaderElement.style.setProperty("--SPIN_BOX_SIZE", isInputLoader ? "1.5rem" : "2.5rem");
43
- loaderElement.style.setProperty("--SPIN_BOX_BORDER_SIZE", isInputLoader ? "0.28rem" : "0.34rem");
44
- } else if (size === ESizes.Tiny) {
45
- loaderElement.style.setProperty("--SPIN_BOX_SIZE", isInputLoader ? "2.0rem" : "2.8rem");
46
- loaderElement.style.setProperty("--SPIN_BOX_BORDER_SIZE", isInputLoader ? "0.31rem" : "0.36rem");
47
- } else if (size === ESizes.VerySmall) {
48
- loaderElement.style.setProperty("--SPIN_BOX_SIZE", isInputLoader ? "2.4rem" : "3rem");
49
- loaderElement.style.setProperty("--SPIN_BOX_BORDER_SIZE", isInputLoader ? "0.34rem" : "0.38rem");
50
- } else if (size === ESizes.Small) {
51
- loaderElement.style.setProperty("--SPIN_BOX_SIZE", "3.5rem");
52
- loaderElement.style.setProperty("--SPIN_BOX_BORDER_SIZE", "0.45rem");
53
- } else if (size === ESizes.Medium) {
54
- loaderElement.style.setProperty("--SPIN_BOX_SIZE", "4rem");
55
- loaderElement.style.setProperty("--SPIN_BOX_BORDER_SIZE", "0.5rem");
56
- } else if (size === ESizes.Large) {
57
- loaderElement.style.setProperty("--SPIN_BOX_SIZE", "4.8rem");
58
- loaderElement.style.setProperty("--SPIN_BOX_BORDER_SIZE", "0.55rem");
59
- } else if (size === ESizes.ExtraLarge) {
60
- loaderElement.style.setProperty("--SPIN_BOX_SIZE", "5.5rem");
61
- loaderElement.style.setProperty("--SPIN_BOX_BORDER_SIZE", "0.6rem");
62
- } else if (size === ESizes.VeryExtraLarge) {
63
- loaderElement.style.setProperty("--SPIN_BOX_SIZE", "6.5rem");
64
- loaderElement.style.setProperty("--SPIN_BOX_BORDER_SIZE", "0.7rem");
65
- } else if (size === ESizes.FullSize) {
66
- loaderElement.style.setProperty("--SPIN_BOX_SIZE", "8rem");
67
- loaderElement.style.setProperty("--SPIN_BOX_BORDER_SIZE", "0.8rem");
68
- }
69
- }
70
- };
71
- const _updateLoaderAttributes = (loaderElement: HTMLElement, type: EAnimationClasses, size: ESizes, disabledInputs: boolean, count: number, isInputLoader: boolean) => {
72
- loaderElement.setAttribute(LOADER_DATA_COUNT_ATTRIBUTE, count.toString());
73
- loaderElement.setAttribute(LOADER_DATA_TYPE_ATTRIBUTE, type);
74
- loaderElement.setAttribute(LOADER_DATA_SIZE_ATTRIBUTE, size);
75
- loaderElement.setAttribute(LOADER_DATA_DISABLED_INPUTS_ATTRIBUTE, disabledInputs ? "true" : "false");
76
- };
77
- const _createLoaderElement = (parent: HTMLElement, type: EAnimationClasses, size: ESizes, showLogo: boolean, disabledInputs: boolean, background: EBackgrounds, defaultClass?: string | UN, isInputLoader?: boolean): HTMLElement | null => {
78
- const loaderElement = _findExistingLoader(parent);
79
- if (loaderElement && !loaderElement.classList.contains(DISPOSED_LOADER_CLASS)) {
80
- const count = parseInt(loaderElement.getAttribute(LOADER_DATA_COUNT_ATTRIBUTE) ?? "0") + 1;
81
- _updateLoaderAttributes(loaderElement, type, size, disabledInputs, count, isInputLoader ?? false);
82
- _updateLoaderProperties(loaderElement, type, size, isInputLoader ?? false);
83
- return loaderElement as HTMLElement;
84
- }
85
-
86
- const newLoaderElement = document.createElement("div");
87
- newLoaderElement.id = LOADER_IDENTITY;
88
- newLoaderElement.classList.add("nexus-container", "o0", EAnimationClasses.FADE_IN, background);
89
- if (defaultClass) newLoaderElement.classList.add(...defaultClass.split(" "));
90
- _updateLoaderAttributes(newLoaderElement, type, size, disabledInputs, 1, isInputLoader ?? false);
91
- _updateLoaderProperties(newLoaderElement, type, size, isInputLoader ?? false);
92
-
93
- newLoaderElement.style.maxHeight = "100%!important";
94
- newLoaderElement.style.maxWidth = "100%!important";
95
-
96
- const loader = document.createElement("div");
97
- newLoaderElement.appendChild(loader);
98
- loader.classList.add(size, type);
99
-
100
- const isTextLoader = (type === EAnimationClasses.BOUNCE || type === EAnimationClasses.FADE_IN_OUT || type === EAnimationClasses.PULSE_IN_OUT) && parent === document.body;
101
- if (isTextLoader && !showLogo) {
102
- loader.innerText = "Loading...";
103
- loader.classList.add("tx52");
104
- loader.style.fontSize = "1.5rem";
105
- } else if (showLogo && type !== EAnimationClasses.SLIDE_BAR && type !== EAnimationClasses.BOUNCE_BAR) {
106
- const logoElement = document.createElement("img");
107
- logoElement.src = FILES.LOGO.ICON;
108
- logoElement.alt = "Logo";
109
- logoElement.className = "pa bg52";
110
- logoElement.style.width = "calc(var(--SPIN_BOX_SIZE) - var(--SPIN_BOX_BORDER_SIZE))";
111
- logoElement.style.height = "calc(var(--SPIN_BOX_SIZE) - var(--SPIN_BOX_BORDER_SIZE))";
112
- logoElement.style.zIndex = "-1";
113
-
114
- if (isTextLoader) {
115
- logoElement.style.padding = `var(--SPIN_BOX_BORDER_SIZE)`;
116
- logoElement.classList.add("txy50", "r2");
117
- loader.appendChild(logoElement);
118
- } else {
119
- logoElement.style.padding = `calc(var(--SPIN_BOX_BORDER_SIZE) * 1.3)`;
120
- logoElement.style.borderRadius = `35%`;
121
- newLoaderElement.appendChild(logoElement);
122
- }
123
- }
124
-
125
- parent.appendChild(newLoaderElement);
126
- return newLoaderElement;
127
- };
128
-
129
- export const ShowLoader = async (parent?: String | HTMLElement | UN, type?: EAnimationClasses | UN, disabledInputs?: boolean | UN, size?: ESizes | UN, delay?: number | UN, showLogo?: boolean | UN, background?: EBackgrounds | UN, defaultClass?: string | UN, isInputLoader?: boolean | UN): Promise<HTMLElement | null> => {
130
- if (!IsBrowser()) return Promise.resolve(null);
131
- type = type ?? DEFAULT_LOADER_TYPE;
132
- size = size ?? DEFAULT_LOADER_SIZE;
133
- background = background ?? DEFAULT_LOADER_BACKGROUND;
134
-
135
- return new Promise((resolve) => {
136
- const timeout = setTimeout(() => {
137
- clearTimeout(timeout);
138
- const parentElement = _findParentElement(parent);
139
- const loaderElement = _createLoaderElement(parentElement, type, size, showLogo ?? true, disabledInputs ?? false, background, defaultClass, isInputLoader ?? false);
140
- resolve(loaderElement);
141
- }, delay ?? DEFAULT_LOADER_DELAY);
142
- });
143
- };
144
-
145
- /**
146
- * Hide loader if it is visible
147
- * @param parent - Parent element to hide loader from
148
- * @param type - Animation type to use for hiding loader
149
- * @param force - This will dispose all loader elements
150
- * @param delay - Delay in milliseconds
151
- */
152
- export const HideLoader = (parent?: String | HTMLElement | UN, force?: boolean | UN, delay?: number | UN): Promise<boolean> => {
153
- if (!IsBrowser()) return Promise.resolve(false);
154
- const parentElement = _findParentElement(parent);
155
-
156
- return new Promise((resolve) => {
157
- const timeout = setTimeout(() => {
158
- clearTimeout(timeout);
159
-
160
- const loaderElement = _findExistingLoader(parentElement);
161
- if (!loaderElement) return resolve(false);
162
-
163
- const count = parseInt(loaderElement.getAttribute(LOADER_DATA_COUNT_ATTRIBUTE) ?? "0");
164
-
165
- if (force || count <= 1) {
166
- RemoveElement(loaderElement, 300);
167
- } else loaderElement.setAttribute(LOADER_DATA_COUNT_ATTRIBUTE, (count - 1).toString());
168
- return resolve(true);
169
- }, delay ?? DEFAULT_LOADER_DELAY);
170
- });
171
- };
172
-
173
- export const InputLoader = async (parent: String | HTMLElement, isShow: boolean, defaultClass?: string | UN): Promise<HTMLElement | null> => {
174
- if (isShow !== false) {
175
- const loaderElement = await ShowLoader(parent, EAnimationClasses.SPIN, false, ESizes.VeryTiny, null, false, EBackgrounds.None, defaultClass, true);
176
- if (loaderElement) {
177
- loaderElement.style.width = "100%";
178
- loaderElement.style.height = "100%";
179
- }
180
- return loaderElement;
181
- }
182
-
183
- HideLoader(parent);
184
- return null;
185
- };
@@ -1,119 +0,0 @@
1
- import { CreateUpdatePreference } from "../api-services/preference-service";
2
- import { IsBrowser } from "../helpers/browser-helpers";
3
- import { Debounce } from "../helpers/utility-helpers";
4
- import { EFlexPositions, UN } from "../interface";
5
- import { LOCAL_STORAGE_KEYS } from "../interfaces/storage-interfaces";
6
- import { EPreferenceTargets } from "../interfaces/system-interfaces";
7
- import { IThemeInformation } from "../interfaces/theme-interfaces";
8
- import { O } from "../nexus-client";
9
-
10
- /**
11
- * Create a debounce function to update the preference in the server
12
- * This is used to update the preference in the server
13
- * @param CreateUpdatePreference The function to create the update preference
14
- * @param debounceTime The debounce time in milliseconds
15
- * @returns The debounce function
16
- */
17
- const _createUpdatePreferenceDebounce = Debounce(CreateUpdatePreference, 1000);
18
-
19
- /**
20
- * Sync the value of the local storage to the server
21
- * This is used to sync the value of the local storage to the server
22
- * @param key The key of the local storage
23
- * @param value The value to set
24
- * @param isSyncWithServer Whether to sync with the server
25
- * @param target The target of the local storage
26
- */
27
- const _syncStorageToServer = async (key: string, value: string | UN, isSyncWithServer?: boolean | UN, target?: EPreferenceTargets | UN) => {
28
- if (!IsBrowser() || !isSyncWithServer || !target) return;
29
-
30
- await _createUpdatePreferenceDebounce(target, key, value ?? null);
31
- };
32
-
33
- /**
34
- * Set the value of the local storage
35
- * This is used to set the value of the local storage
36
- * @param key The key of the local storage
37
- * @param value The value to set
38
- * @param isSyncWithServer Whether to sync with the server
39
- * @param target The target of the local storage
40
- */
41
- export const SetLocalStorage = (key: string, value: string | UN, isSyncWithServer?: boolean | UN, target?: EPreferenceTargets | UN) => {
42
- if (!IsBrowser()) return;
43
-
44
- _syncStorageToServer(key, value, isSyncWithServer, target);
45
-
46
- if (value === null || value === undefined) RemoveLocalStorage(key, isSyncWithServer, target);
47
- else localStorage.setItem(key, value);
48
- };
49
- export const SetSessionStorage = (key: string, value: string | UN) => {
50
- if (!IsBrowser()) return;
51
- if (value === null || value === undefined) RemoveSessionStorage(key);
52
- else sessionStorage.setItem(key, value);
53
- };
54
- export const GetSessionStorage = (key: string): string | null => {
55
- if (!IsBrowser()) return null;
56
- const data = sessionStorage.getItem(key);
57
- if (!data) return null;
58
- return data;
59
- };
60
- export const RemoveSessionStorage = (key: string) => {
61
- if (!IsBrowser()) return;
62
- sessionStorage.removeItem(key);
63
- };
64
- /**
65
- * Remove the value of the local storage
66
- * This is used to remove the value of the local storage
67
- * @param key The key of the local storage
68
- * @param isSyncWithServer Whether to sync with the server
69
- * @param target The target of the local storage
70
- */
71
- export const RemoveLocalStorage = (key: string, isSyncWithServer?: boolean | UN, target?: EPreferenceTargets | UN) => {
72
- _syncStorageToServer(key, null, isSyncWithServer, target);
73
- localStorage.removeItem(key);
74
- };
75
-
76
- /**
77
- * Get the value of the local storage
78
- * This is used to get the value of the local storage
79
- * @param key The key of the local storage
80
- * @returns The value of the local storage
81
- */
82
- export function GetLocalStorage(key: string): string | null {
83
- if (!IsBrowser()) return null;
84
- const data = localStorage.getItem(key);
85
- if (!data) return null;
86
- return data;
87
- }
88
-
89
- /**
90
- * Set the current theme in the local storage
91
- * This is used to determine the current theme in the application
92
- * @param themeCode The code of the theme to set
93
- */
94
- export const SetCurrentTheme = (themeCode: string) => SetLocalStorage(LOCAL_STORAGE_KEYS.ACTIVE_THEME, themeCode, true, EPreferenceTargets.User);
95
- export const GetCurrentTheme = (): IThemeInformation => {
96
- const themeInformations = O.systemThemes;
97
- if (!themeInformations || themeInformations.length === 0) throw new Error("No theme information found");
98
- const activeTheme = GetLocalStorage(LOCAL_STORAGE_KEYS.ACTIVE_THEME);
99
- if (!activeTheme) return themeInformations[0];
100
- return themeInformations.find((theme) => theme.systemName === activeTheme) || themeInformations[0];
101
- };
102
- export const GetCurrentThemeName = (): string => GetCurrentTheme().systemName;
103
-
104
- /**
105
- * Get the position of the form buttons from the local storage
106
- * This is used to determine the position of the form buttons in the form
107
- * @returns The position of the form buttons
108
- */
109
- export const GetFormButtonPosition = (): EFlexPositions => {
110
- const position = GetLocalStorage(LOCAL_STORAGE_KEYS.FORM_BUTTON_POSITION);
111
- if (!position) return EFlexPositions.Left;
112
- return position as EFlexPositions;
113
- };
114
- /**
115
- * Set the position of the form buttons in the local storage
116
- * This is used to determine the position of the form buttons in the form
117
- * @param position The position of the form buttons
118
- */
119
- export const SetFormButtonPosition = (position: EFlexPositions) => SetLocalStorage(LOCAL_STORAGE_KEYS.FORM_BUTTON_POSITION, position, true, EPreferenceTargets.User);