@northern.tech/store 0.3.3 → 0.4.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 (602) hide show
  1. package/dist/actions.cjs +80 -833
  2. package/dist/actions.cjs.map +1 -1
  3. package/dist/actions.d.cts +229 -85
  4. package/dist/actions.d.ts +229 -85
  5. package/dist/actions.js +14 -14
  6. package/dist/api/general-api.cjs +274 -148
  7. package/dist/api/general-api.cjs.map +1 -1
  8. package/dist/api/general-api.d.cts +1 -1
  9. package/dist/api/general-api.d.ts +1 -1
  10. package/dist/api/general-api.js +7 -7
  11. package/dist/api/users-api.cjs +274 -148
  12. package/dist/api/users-api.cjs.map +1 -1
  13. package/dist/api/users-api.d.cts +7 -5
  14. package/dist/api/users-api.d.ts +7 -5
  15. package/dist/api/users-api.js +8 -8
  16. package/dist/appSlice/constants.cjs +23 -43
  17. package/dist/appSlice/constants.cjs.map +1 -1
  18. package/dist/appSlice/constants.d.cts +109 -119
  19. package/dist/appSlice/constants.d.ts +109 -119
  20. package/dist/appSlice/constants.js +1 -11
  21. package/dist/appSlice/index.cjs +25 -242
  22. package/dist/appSlice/index.cjs.map +1 -1
  23. package/dist/appSlice/index.d.cts +119 -1531
  24. package/dist/appSlice/index.d.ts +119 -1531
  25. package/dist/appSlice/index.js +6 -6
  26. package/dist/appSlice/mocks.cjs +186 -0
  27. package/dist/appSlice/mocks.cjs.map +1 -0
  28. package/dist/appSlice/mocks.d.cts +39 -0
  29. package/dist/appSlice/mocks.d.ts +39 -0
  30. package/dist/appSlice/mocks.js +27 -0
  31. package/dist/appSlice/mocks.js.map +1 -0
  32. package/dist/appSlice/selectors.cjs +31 -5
  33. package/dist/appSlice/selectors.cjs.map +1 -1
  34. package/dist/appSlice/selectors.d.cts +709 -23
  35. package/dist/appSlice/selectors.d.ts +709 -23
  36. package/dist/appSlice/selectors.js +21 -1
  37. package/dist/appSlice/thunks.cjs +1563 -1790
  38. package/dist/appSlice/thunks.cjs.map +1 -1
  39. package/dist/appSlice/thunks.d.cts +34 -14
  40. package/dist/appSlice/thunks.d.ts +34 -14
  41. package/dist/appSlice/thunks.js +30 -29
  42. package/dist/auth.cjs +276 -153
  43. package/dist/auth.cjs.map +1 -1
  44. package/dist/auth.d.cts +13 -10
  45. package/dist/auth.d.ts +13 -10
  46. package/dist/auth.js +6 -8
  47. package/dist/{chunk-CK6YE6AN.js → chunk-2DYA3X77.js} +3 -1
  48. package/dist/{chunk-CK6YE6AN.js.map → chunk-2DYA3X77.js.map} +1 -1
  49. package/dist/{chunk-2CYOM4BK.js → chunk-4TUJPE6G.js} +19 -4
  50. package/dist/chunk-4TUJPE6G.js.map +1 -0
  51. package/dist/{chunk-7PVGDMNM.js → chunk-6KGTHJKC.js} +23 -27
  52. package/dist/chunk-6KGTHJKC.js.map +1 -0
  53. package/dist/chunk-7C4SQBEE.js +715 -0
  54. package/dist/chunk-7C4SQBEE.js.map +1 -0
  55. package/dist/{chunk-QRGTG4YB.js → chunk-ABJLRDCO.js} +10 -11
  56. package/dist/chunk-ABJLRDCO.js.map +1 -0
  57. package/dist/{chunk-LEMVXAYP.js → chunk-CW5T6OGF.js} +56 -22
  58. package/dist/chunk-CW5T6OGF.js.map +1 -0
  59. package/dist/{chunk-MRCFLG45.js → chunk-FAJ3I2UQ.js} +2 -1
  60. package/dist/chunk-FAJ3I2UQ.js.map +1 -0
  61. package/dist/{chunk-DCK2DBOA.js → chunk-IQG5I7AM.js} +29 -39
  62. package/dist/chunk-IQG5I7AM.js.map +1 -0
  63. package/dist/chunk-JUGE7L3K.js +110 -0
  64. package/dist/chunk-JUGE7L3K.js.map +1 -0
  65. package/dist/{chunk-7JKWI5FK.js → chunk-JXQUFKID.js} +2 -2
  66. package/dist/chunk-JXQUFKID.js.map +1 -0
  67. package/dist/chunk-KC7SKI3U.js +389 -0
  68. package/dist/chunk-KC7SKI3U.js.map +1 -0
  69. package/dist/{chunk-YDS36ALB.js → chunk-KJNNEDRV.js} +11 -7
  70. package/dist/chunk-KJNNEDRV.js.map +1 -0
  71. package/dist/chunk-MBKAZVE3.js +44 -0
  72. package/dist/chunk-MBKAZVE3.js.map +1 -0
  73. package/dist/{chunk-TI2RL5P2.js → chunk-MZNANSS2.js} +12 -7
  74. package/dist/chunk-MZNANSS2.js.map +1 -0
  75. package/dist/{chunk-LTKOV26W.js → chunk-N2KLYPS5.js} +138 -95
  76. package/dist/chunk-N2KLYPS5.js.map +1 -0
  77. package/dist/{chunk-UWMYZNUB.js → chunk-OHF3YUXX.js} +25 -40
  78. package/dist/chunk-OHF3YUXX.js.map +1 -0
  79. package/dist/{chunk-CYV6632F.js → chunk-OOICURFL.js} +2 -2
  80. package/dist/chunk-OOICURFL.js.map +1 -0
  81. package/dist/{chunk-VMNMD6KF.js → chunk-PGFVHKP5.js} +5 -7
  82. package/dist/chunk-PGFVHKP5.js.map +1 -0
  83. package/dist/{chunk-JAROCU6M.js → chunk-QHK7GGV4.js} +3 -3
  84. package/dist/chunk-QHK7GGV4.js.map +1 -0
  85. package/dist/{chunk-YT73QWCN.js → chunk-RS37Y2PQ.js} +3 -3
  86. package/dist/chunk-RS37Y2PQ.js.map +1 -0
  87. package/dist/{chunk-TUACATJA.js → chunk-UGSLGUS6.js} +8 -6
  88. package/dist/chunk-UGSLGUS6.js.map +1 -0
  89. package/dist/{chunk-DAPAXWA5.js → chunk-URNS6A5T.js} +14 -14
  90. package/dist/{chunk-FGKMJS3B.js → chunk-VANBSJS5.js} +2 -4
  91. package/dist/chunk-VANBSJS5.js.map +1 -0
  92. package/dist/{chunk-HPBE6KYY.js → chunk-VUFRP6P3.js} +5 -6
  93. package/dist/chunk-VUFRP6P3.js.map +1 -0
  94. package/dist/{chunk-X7IEZBM4.js → chunk-X4GUACQO.js} +8 -5
  95. package/dist/chunk-X4GUACQO.js.map +1 -0
  96. package/dist/{chunk-4XJMRVFI.js → chunk-XWYJACQC.js} +45 -22
  97. package/dist/chunk-XWYJACQC.js.map +1 -0
  98. package/dist/{chunk-AMGWP7A4.js → chunk-ZJW3QIPM.js} +8 -9
  99. package/dist/chunk-ZJW3QIPM.js.map +1 -0
  100. package/dist/chunk-ZKAH3APE.js +1 -0
  101. package/dist/chunk-ZKAH3APE.js.map +1 -0
  102. package/dist/{chunk-2JHFUQ6B.js → chunk-ZN5TB2NJ.js} +963 -883
  103. package/dist/chunk-ZN5TB2NJ.js.map +1 -0
  104. package/dist/{chunk-WXL7PVI5.js → chunk-ZRSYBSSY.js} +18 -12
  105. package/dist/chunk-ZRSYBSSY.js.map +1 -0
  106. package/dist/commonConstants.cjs +279 -173
  107. package/dist/commonConstants.cjs.map +1 -1
  108. package/dist/commonConstants.d.cts +46 -212
  109. package/dist/commonConstants.d.ts +46 -212
  110. package/dist/commonConstants.js +11 -19
  111. package/dist/commonSelectors.cjs +513 -778
  112. package/dist/commonSelectors.cjs.map +1 -1
  113. package/dist/commonSelectors.d.cts +4307 -279
  114. package/dist/commonSelectors.d.ts +4307 -279
  115. package/dist/commonSelectors.js +13 -13
  116. package/dist/constants.cjs +355 -655
  117. package/dist/constants.cjs.map +1 -1
  118. package/dist/constants.d.cts +11 -9
  119. package/dist/constants.d.ts +11 -9
  120. package/dist/constants.js +37 -29
  121. package/dist/deploymentsSlice/constants.cjs +5 -360
  122. package/dist/deploymentsSlice/constants.cjs.map +1 -1
  123. package/dist/deploymentsSlice/constants.d.cts +59 -39
  124. package/dist/deploymentsSlice/constants.d.ts +59 -39
  125. package/dist/deploymentsSlice/constants.js +5 -11
  126. package/dist/deploymentsSlice/index.cjs +17 -365
  127. package/dist/deploymentsSlice/index.cjs.map +1 -1
  128. package/dist/deploymentsSlice/index.d.cts +142 -2359
  129. package/dist/deploymentsSlice/index.d.ts +142 -2359
  130. package/dist/deploymentsSlice/index.js +6 -6
  131. package/dist/deploymentsSlice/mocks.cjs +429 -0
  132. package/dist/deploymentsSlice/mocks.cjs.map +1 -0
  133. package/dist/deploymentsSlice/mocks.d.cts +189 -0
  134. package/dist/deploymentsSlice/mocks.d.ts +189 -0
  135. package/dist/deploymentsSlice/mocks.js +146 -0
  136. package/dist/deploymentsSlice/mocks.js.map +1 -0
  137. package/dist/deploymentsSlice/selectors.cjs +5 -353
  138. package/dist/deploymentsSlice/selectors.cjs.map +1 -1
  139. package/dist/deploymentsSlice/selectors.d.cts +167 -11
  140. package/dist/deploymentsSlice/selectors.d.ts +167 -11
  141. package/dist/deploymentsSlice/selectors.js +6 -6
  142. package/dist/deploymentsSlice/thunks.cjs +1551 -1778
  143. package/dist/deploymentsSlice/thunks.cjs.map +1 -1
  144. package/dist/deploymentsSlice/thunks.d.cts +134 -76
  145. package/dist/deploymentsSlice/thunks.d.ts +134 -76
  146. package/dist/deploymentsSlice/thunks.js +30 -29
  147. package/dist/devicesSlice/constants.cjs +5 -375
  148. package/dist/devicesSlice/constants.cjs.map +1 -1
  149. package/dist/devicesSlice/constants.d.cts +8 -16
  150. package/dist/devicesSlice/constants.d.ts +8 -16
  151. package/dist/devicesSlice/constants.js +7 -25
  152. package/dist/devicesSlice/index.cjs +17 -381
  153. package/dist/devicesSlice/index.cjs.map +1 -1
  154. package/dist/devicesSlice/index.d.cts +196 -2208
  155. package/dist/devicesSlice/index.d.ts +196 -2208
  156. package/dist/devicesSlice/index.js +6 -6
  157. package/dist/devicesSlice/mocks.cjs +336 -0
  158. package/dist/devicesSlice/mocks.cjs.map +1 -0
  159. package/dist/devicesSlice/mocks.d.cts +154 -0
  160. package/dist/devicesSlice/mocks.d.ts +154 -0
  161. package/dist/devicesSlice/mocks.js +136 -0
  162. package/dist/devicesSlice/mocks.js.map +1 -0
  163. package/dist/devicesSlice/selectors.cjs +280 -293
  164. package/dist/devicesSlice/selectors.cjs.map +1 -1
  165. package/dist/devicesSlice/selectors.d.cts +1791 -82
  166. package/dist/devicesSlice/selectors.d.ts +1791 -82
  167. package/dist/devicesSlice/selectors.js +8 -6
  168. package/dist/devicesSlice/thunks.cjs +1699 -1936
  169. package/dist/devicesSlice/thunks.cjs.map +1 -1
  170. package/dist/devicesSlice/thunks.d.cts +374 -291
  171. package/dist/devicesSlice/thunks.d.ts +374 -291
  172. package/dist/devicesSlice/thunks.js +36 -45
  173. package/dist/liststatehook.cjs +935 -0
  174. package/dist/liststatehook.cjs.map +1 -0
  175. package/dist/liststatehook.d.cts +234 -0
  176. package/dist/liststatehook.d.ts +234 -0
  177. package/dist/liststatehook.js +88 -0
  178. package/dist/liststatehook.js.map +1 -0
  179. package/dist/locationutils.cjs +906 -0
  180. package/dist/locationutils.cjs.map +1 -0
  181. package/dist/locationutils.d.cts +114 -0
  182. package/dist/locationutils.d.ts +114 -0
  183. package/dist/locationutils.js +46 -0
  184. package/dist/locationutils.js.map +1 -0
  185. package/dist/monitorSlice/constants.cjs +0 -146
  186. package/dist/monitorSlice/constants.cjs.map +1 -1
  187. package/dist/monitorSlice/constants.d.cts +4 -5
  188. package/dist/monitorSlice/constants.d.ts +4 -5
  189. package/dist/monitorSlice/constants.js +1 -12
  190. package/dist/monitorSlice/index.cjs +5 -353
  191. package/dist/monitorSlice/index.cjs.map +1 -1
  192. package/dist/monitorSlice/index.d.cts +63 -260
  193. package/dist/monitorSlice/index.d.ts +63 -260
  194. package/dist/monitorSlice/index.js +6 -6
  195. package/dist/monitorSlice/mocks.cjs +130 -0
  196. package/dist/monitorSlice/mocks.cjs.map +1 -0
  197. package/dist/monitorSlice/mocks.d.cts +57 -0
  198. package/dist/monitorSlice/mocks.d.ts +57 -0
  199. package/dist/monitorSlice/mocks.js +65 -0
  200. package/dist/monitorSlice/mocks.js.map +1 -0
  201. package/dist/monitorSlice/thunks.cjs +633 -880
  202. package/dist/monitorSlice/thunks.cjs.map +1 -1
  203. package/dist/monitorSlice/thunks.d.cts +90 -21
  204. package/dist/monitorSlice/thunks.d.ts +90 -21
  205. package/dist/monitorSlice/thunks.js +26 -26
  206. package/dist/onboardingSlice/constants.cjs +1 -0
  207. package/dist/onboardingSlice/constants.cjs.map +1 -1
  208. package/dist/onboardingSlice/constants.d.cts +23 -20
  209. package/dist/onboardingSlice/constants.d.ts +23 -20
  210. package/dist/onboardingSlice/constants.js +1 -1
  211. package/dist/onboardingSlice/index.cjs +1 -3
  212. package/dist/onboardingSlice/index.cjs.map +1 -1
  213. package/dist/onboardingSlice/index.d.cts +50 -225
  214. package/dist/onboardingSlice/index.d.ts +50 -225
  215. package/dist/onboardingSlice/index.js +1 -1
  216. package/dist/onboardingSlice/mocks.cjs +83 -0
  217. package/dist/onboardingSlice/mocks.cjs.map +1 -0
  218. package/dist/onboardingSlice/mocks.d.cts +19 -0
  219. package/dist/onboardingSlice/mocks.d.ts +19 -0
  220. package/dist/onboardingSlice/mocks.js +17 -0
  221. package/dist/onboardingSlice/mocks.js.map +1 -0
  222. package/dist/onboardingSlice/thunks.cjs +1787 -2020
  223. package/dist/onboardingSlice/thunks.cjs.map +1 -1
  224. package/dist/onboardingSlice/thunks.d.cts +63 -36
  225. package/dist/onboardingSlice/thunks.d.ts +63 -36
  226. package/dist/onboardingSlice/thunks.js +30 -31
  227. package/dist/organizationSlice/constants.cjs +8 -748
  228. package/dist/organizationSlice/constants.cjs.map +1 -1
  229. package/dist/organizationSlice/constants.d.cts +36 -116
  230. package/dist/organizationSlice/constants.d.ts +36 -116
  231. package/dist/organizationSlice/constants.js +7 -17
  232. package/dist/organizationSlice/index.cjs +14 -368
  233. package/dist/organizationSlice/index.cjs.map +1 -1
  234. package/dist/organizationSlice/index.d.cts +45 -73
  235. package/dist/organizationSlice/index.d.ts +45 -73
  236. package/dist/organizationSlice/index.js +6 -6
  237. package/dist/organizationSlice/mocks.cjs +234 -0
  238. package/dist/organizationSlice/mocks.cjs.map +1 -0
  239. package/dist/organizationSlice/mocks.d.cts +107 -0
  240. package/dist/organizationSlice/mocks.d.ts +107 -0
  241. package/dist/organizationSlice/mocks.js +101 -0
  242. package/dist/organizationSlice/mocks.js.map +1 -0
  243. package/dist/organizationSlice/selectors.cjs +301 -146
  244. package/dist/organizationSlice/selectors.cjs.map +1 -1
  245. package/dist/organizationSlice/selectors.d.cts +888 -51
  246. package/dist/organizationSlice/selectors.d.ts +888 -51
  247. package/dist/organizationSlice/selectors.js +14 -6
  248. package/dist/organizationSlice/thunks.cjs +2616 -2759
  249. package/dist/organizationSlice/thunks.cjs.map +1 -1
  250. package/dist/organizationSlice/thunks.d.cts +322 -131
  251. package/dist/organizationSlice/thunks.d.ts +322 -131
  252. package/dist/organizationSlice/thunks.js +44 -29
  253. package/dist/organizationSlice/types.cjs.map +1 -1
  254. package/dist/organizationSlice/types.d.cts +62 -79
  255. package/dist/organizationSlice/types.d.ts +62 -79
  256. package/dist/releasesSlice/constants.cjs +3 -0
  257. package/dist/releasesSlice/constants.cjs.map +1 -1
  258. package/dist/releasesSlice/constants.d.cts +2 -1
  259. package/dist/releasesSlice/constants.d.ts +2 -1
  260. package/dist/releasesSlice/constants.js +3 -1
  261. package/dist/releasesSlice/index.cjs +5 -222
  262. package/dist/releasesSlice/index.cjs.map +1 -1
  263. package/dist/releasesSlice/index.d.cts +52 -473
  264. package/dist/releasesSlice/index.d.ts +52 -473
  265. package/dist/releasesSlice/index.js +6 -6
  266. package/dist/releasesSlice/mocks.cjs +177 -0
  267. package/dist/releasesSlice/mocks.cjs.map +1 -0
  268. package/dist/releasesSlice/mocks.d.cts +49 -0
  269. package/dist/releasesSlice/mocks.d.ts +49 -0
  270. package/dist/releasesSlice/mocks.js +61 -0
  271. package/dist/releasesSlice/mocks.js.map +1 -0
  272. package/dist/releasesSlice/selectors.cjs +293 -165
  273. package/dist/releasesSlice/selectors.cjs.map +1 -1
  274. package/dist/releasesSlice/selectors.d.cts +886 -24
  275. package/dist/releasesSlice/selectors.d.ts +886 -24
  276. package/dist/releasesSlice/selectors.js +9 -7
  277. package/dist/releasesSlice/thunks.cjs +827 -1017
  278. package/dist/releasesSlice/thunks.cjs.map +1 -1
  279. package/dist/releasesSlice/thunks.d.cts +150 -130
  280. package/dist/releasesSlice/thunks.d.ts +150 -130
  281. package/dist/releasesSlice/thunks.js +33 -26
  282. package/dist/selectors.cjs +565 -780
  283. package/dist/selectors.cjs.map +1 -1
  284. package/dist/selectors.d.cts +37 -8
  285. package/dist/selectors.d.ts +37 -8
  286. package/dist/selectors.js +54 -18
  287. package/dist/sockethook.cjs +519 -0
  288. package/dist/sockethook.cjs.map +1 -0
  289. package/dist/sockethook.d.cts +10 -0
  290. package/dist/sockethook.d.ts +10 -0
  291. package/dist/sockethook.js +139 -0
  292. package/dist/sockethook.js.map +1 -0
  293. package/dist/store.cjs +121 -840
  294. package/dist/store.cjs.map +1 -1
  295. package/dist/store.d.cts +697 -1961
  296. package/dist/store.d.ts +697 -1961
  297. package/dist/store.js +18 -16
  298. package/dist/storehooks.cjs +1854 -1968
  299. package/dist/storehooks.cjs.map +1 -1
  300. package/dist/storehooks.js +46 -63
  301. package/dist/storehooks.js.map +1 -1
  302. package/dist/thunks.cjs +2138 -2231
  303. package/dist/thunks.cjs.map +1 -1
  304. package/dist/thunks.d.cts +25 -7
  305. package/dist/thunks.d.ts +25 -7
  306. package/dist/thunks.js +54 -45
  307. package/dist/{deploymentdevicehook.cjs → useDeploymentDevice.cjs} +1797 -2026
  308. package/dist/useDeploymentDevice.cjs.map +1 -0
  309. package/dist/useDeploymentDevice.js +63 -0
  310. package/dist/useDeploymentDevice.js.map +1 -0
  311. package/dist/usersSlice/constants.cjs +5 -747
  312. package/dist/usersSlice/constants.cjs.map +1 -1
  313. package/dist/usersSlice/constants.d.cts +16 -774
  314. package/dist/usersSlice/constants.d.ts +16 -774
  315. package/dist/usersSlice/constants.js +7 -30
  316. package/dist/usersSlice/index.cjs +10 -721
  317. package/dist/usersSlice/index.cjs.map +1 -1
  318. package/dist/usersSlice/index.d.cts +136 -7900
  319. package/dist/usersSlice/index.d.ts +136 -7900
  320. package/dist/usersSlice/index.js +6 -6
  321. package/dist/usersSlice/mocks.cjs +200 -0
  322. package/dist/usersSlice/mocks.cjs.map +1 -0
  323. package/dist/usersSlice/mocks.d.cts +83 -0
  324. package/dist/usersSlice/mocks.d.ts +83 -0
  325. package/dist/usersSlice/mocks.js +47 -0
  326. package/dist/usersSlice/mocks.js.map +1 -0
  327. package/dist/usersSlice/selectors.cjs +319 -566
  328. package/dist/usersSlice/selectors.cjs.map +1 -1
  329. package/dist/usersSlice/selectors.d.cts +1651 -59
  330. package/dist/usersSlice/selectors.d.ts +1651 -59
  331. package/dist/usersSlice/selectors.js +13 -9
  332. package/dist/usersSlice/thunks.cjs +1666 -1893
  333. package/dist/usersSlice/thunks.cjs.map +1 -1
  334. package/dist/usersSlice/thunks.d.cts +362 -312
  335. package/dist/usersSlice/thunks.d.ts +362 -312
  336. package/dist/usersSlice/thunks.js +30 -29
  337. package/dist/utils.cjs +428 -292
  338. package/dist/utils.cjs.map +1 -1
  339. package/dist/utils.d.cts +44 -22
  340. package/dist/utils.d.ts +44 -22
  341. package/dist/utils.js +12 -6
  342. package/package.json +18 -8
  343. package/dist/api/types/AWSCredentials.ts +0 -16
  344. package/dist/api/types/Actor.ts +0 -35
  345. package/dist/api/types/Addon.ts +0 -17
  346. package/dist/api/types/AddonTenantadm.ts +0 -17
  347. package/dist/api/types/Address.ts +0 -6
  348. package/dist/api/types/AddressUpdate.ts +0 -12
  349. package/dist/api/types/Alert.ts +0 -34
  350. package/dist/api/types/AlertDetails.ts +0 -23
  351. package/dist/api/types/AlertSubject.ts +0 -23
  352. package/dist/api/types/ApiBurst.ts +0 -21
  353. package/dist/api/types/ApiBurstTenantadm.ts +0 -21
  354. package/dist/api/types/ApiLimits.ts +0 -16
  355. package/dist/api/types/ApiLimitsTenantadm.ts +0 -16
  356. package/dist/api/types/ApiQuota.ts +0 -17
  357. package/dist/api/types/ApiQuotaTenantadm.ts +0 -17
  358. package/dist/api/types/Artifact.ts +0 -48
  359. package/dist/api/types/ArtifactDeployments.ts +0 -48
  360. package/dist/api/types/ArtifactInfo.ts +0 -11
  361. package/dist/api/types/ArtifactInfoDeployments.ts +0 -11
  362. package/dist/api/types/ArtifactLink.ts +0 -11
  363. package/dist/api/types/ArtifactTypeInfo.ts +0 -13
  364. package/dist/api/types/ArtifactTypeInfoDeployments.ts +0 -13
  365. package/dist/api/types/ArtifactUpdate.ts +0 -10
  366. package/dist/api/types/ArtifactUploadLink.ts +0 -15
  367. package/dist/api/types/Attribute.ts +0 -36
  368. package/dist/api/types/AttributeInventory.ts +0 -32
  369. package/dist/api/types/AuditLog.ts +0 -26
  370. package/dist/api/types/AuthSet.ts +0 -37
  371. package/dist/api/types/AuthSetDeviceauth.ts +0 -37
  372. package/dist/api/types/AuthSetIot_manager.ts +0 -33
  373. package/dist/api/types/AutoAuthRequest.ts +0 -23
  374. package/dist/api/types/AzureSharedAccessSecret.ts +0 -11
  375. package/dist/api/types/BillingInfo.ts +0 -13
  376. package/dist/api/types/BillingProfile.ts +0 -37
  377. package/dist/api/types/BillingProfileUpdate.ts +0 -37
  378. package/dist/api/types/BinaryDeltaConfiguration.ts +0 -15
  379. package/dist/api/types/BinaryDeltaConfigurationDeployments.ts +0 -15
  380. package/dist/api/types/BinaryDeltaLimits.ts +0 -21
  381. package/dist/api/types/BinaryDeltaLimitsDeployments.ts +0 -15
  382. package/dist/api/types/BoundingBox.ts +0 -9
  383. package/dist/api/types/CancelRequest.ts +0 -10
  384. package/dist/api/types/CardData.ts +0 -49
  385. package/dist/api/types/CardSetupData.ts +0 -17
  386. package/dist/api/types/CheckoutData.ts +0 -13
  387. package/dist/api/types/Configuration.ts +0 -11
  388. package/dist/api/types/Count.ts +0 -13
  389. package/dist/api/types/Credentials.ts +0 -23
  390. package/dist/api/types/DBusSubsystem.ts +0 -27
  391. package/dist/api/types/DeltaConfiguration.ts +0 -14
  392. package/dist/api/types/DeltaConfigurationDeployments.ts +0 -14
  393. package/dist/api/types/Deployment.ts +0 -45
  394. package/dist/api/types/DeploymentAggregation.ts +0 -16
  395. package/dist/api/types/DeploymentAggregationItem.ts +0 -16
  396. package/dist/api/types/DeploymentAggregationTerm.ts +0 -22
  397. package/dist/api/types/DeploymentAggregationTerms.ts +0 -16
  398. package/dist/api/types/DeploymentAttributeProjection.ts +0 -10
  399. package/dist/api/types/DeploymentAuditlogs.ts +0 -11
  400. package/dist/api/types/DeploymentDeployments.ts +0 -98
  401. package/dist/api/types/DeploymentFilterTerm.ts +0 -35
  402. package/dist/api/types/DeploymentIdentifier.ts +0 -10
  403. package/dist/api/types/DeploymentPhase.ts +0 -23
  404. package/dist/api/types/DeploymentPhaseDeployments.ts +0 -23
  405. package/dist/api/types/DeploymentReporting.ts +0 -46
  406. package/dist/api/types/DeploymentSearchTerms.ts +0 -37
  407. package/dist/api/types/DeploymentSortTerm.ts +0 -23
  408. package/dist/api/types/DeploymentStatistics.ts +0 -15
  409. package/dist/api/types/DeploymentStatisticsDeployments.ts +0 -15
  410. package/dist/api/types/DeploymentStatusStatistics.ts +0 -54
  411. package/dist/api/types/DeploymentStatusStatisticsDeployments.ts +0 -54
  412. package/dist/api/types/Device.ts +0 -20
  413. package/dist/api/types/DeviceAggregation.ts +0 -16
  414. package/dist/api/types/DeviceAggregationItem.ts +0 -16
  415. package/dist/api/types/DeviceAggregationTerm.ts +0 -26
  416. package/dist/api/types/DeviceAggregationTerms.ts +0 -20
  417. package/dist/api/types/DeviceAttribute.ts +0 -22
  418. package/dist/api/types/DeviceAttributeProjection.ts +0 -14
  419. package/dist/api/types/DeviceAuditlogs.ts +0 -17
  420. package/dist/api/types/DeviceAuthEvent.ts +0 -23
  421. package/dist/api/types/DeviceConfiguration.ts +0 -16
  422. package/dist/api/types/DeviceDeployment.ts +0 -11
  423. package/dist/api/types/DeviceDeployments.ts +0 -29
  424. package/dist/api/types/DeviceDeviceauth.ts +0 -42
  425. package/dist/api/types/DeviceFilterAttribute.ts +0 -21
  426. package/dist/api/types/DeviceFilterTerm.ts +0 -39
  427. package/dist/api/types/DeviceInventory.ts +0 -19
  428. package/dist/api/types/DeviceInventoryInventory.ts +0 -19
  429. package/dist/api/types/DeviceReporting.ts +0 -22
  430. package/dist/api/types/DeviceSearchTerms.ts +0 -37
  431. package/dist/api/types/DeviceSortTerm.ts +0 -27
  432. package/dist/api/types/DeviceState.ts +0 -32
  433. package/dist/api/types/DeviceStateDeviceconnect.ts +0 -33
  434. package/dist/api/types/DeviceStateIot_manager.ts +0 -14
  435. package/dist/api/types/DeviceStatus.ts +0 -19
  436. package/dist/api/types/DeviceWithImage.ts +0 -80
  437. package/dist/api/types/DirectUploadMetadata.ts +0 -18
  438. package/dist/api/types/EmailVerificationCompletion.ts +0 -13
  439. package/dist/api/types/EmailVerificationRequest.ts +0 -13
  440. package/dist/api/types/Error.ts +0 -17
  441. package/dist/api/types/ErrorAuditlogs.ts +0 -13
  442. package/dist/api/types/ErrorDeployments.ts +0 -17
  443. package/dist/api/types/ErrorDeviceauth.ts +0 -13
  444. package/dist/api/types/ErrorDeviceconfig.ts +0 -17
  445. package/dist/api/types/ErrorDeviceconnect.ts +0 -17
  446. package/dist/api/types/ErrorDevicemonitor.ts +0 -17
  447. package/dist/api/types/ErrorExt.ts +0 -18
  448. package/dist/api/types/ErrorInventory.ts +0 -17
  449. package/dist/api/types/ErrorIot_manager.ts +0 -17
  450. package/dist/api/types/ErrorNotFound.ts +0 -17
  451. package/dist/api/types/ErrorReporting.ts +0 -18
  452. package/dist/api/types/ErrorTenantadm.ts +0 -13
  453. package/dist/api/types/ErrorUseradm.ts +0 -17
  454. package/dist/api/types/Event.ts +0 -48
  455. package/dist/api/types/ExternalIdentity.ts +0 -17
  456. package/dist/api/types/Features.ts +0 -17
  457. package/dist/api/types/FileUpload.ts +0 -23
  458. package/dist/api/types/Filter.ts +0 -19
  459. package/dist/api/types/FilterAttribute.ts +0 -21
  460. package/dist/api/types/FilterDefinition.ts +0 -18
  461. package/dist/api/types/FilterDeployments.ts +0 -19
  462. package/dist/api/types/FilterInventory.ts +0 -19
  463. package/dist/api/types/FilterPredicate.ts +0 -48
  464. package/dist/api/types/FilterPredicateDeployments.ts +0 -48
  465. package/dist/api/types/FilterPredicateInventory.ts +0 -78
  466. package/dist/api/types/GeoBoundingBox.ts +0 -8
  467. package/dist/api/types/GeoBoundingBoxFilter.ts +0 -5
  468. package/dist/api/types/GeoDistance.ts +0 -15
  469. package/dist/api/types/GeoDistanceFilter.ts +0 -8
  470. package/dist/api/types/GeoPoint.ts +0 -14
  471. package/dist/api/types/Group.ts +0 -10
  472. package/dist/api/types/HTTP.ts +0 -19
  473. package/dist/api/types/IdentityData.ts +0 -25
  474. package/dist/api/types/InputParameter.ts +0 -8
  475. package/dist/api/types/Integration.ts +0 -30
  476. package/dist/api/types/JobStatus.ts +0 -13
  477. package/dist/api/types/Limit.ts +0 -21
  478. package/dist/api/types/LimitDeployments.ts +0 -21
  479. package/dist/api/types/LimitDeviceauth.ts +0 -10
  480. package/dist/api/types/LimitUseradm.ts +0 -11
  481. package/dist/api/types/Limits.ts +0 -11
  482. package/dist/api/types/LineDescriptor.ts +0 -11
  483. package/dist/api/types/LogSubsystem.ts +0 -23
  484. package/dist/api/types/LoginOptions.ts +0 -18
  485. package/dist/api/types/ManagementAPIConfiguration.ts +0 -5
  486. package/dist/api/types/MenderTypes.ts +0 -213
  487. package/dist/api/types/MonitorConfiguration.ts +0 -22
  488. package/dist/api/types/NewConfigurationDeployment.ts +0 -15
  489. package/dist/api/types/NewConfigurationDeploymentResponse.ts +0 -10
  490. package/dist/api/types/NewDeployment.ts +0 -42
  491. package/dist/api/types/NewDeploymentForGroup.ts +0 -33
  492. package/dist/api/types/NewDeploymentPhase.ts +0 -37
  493. package/dist/api/types/NewDeploymentPhaseDeployments.ts +0 -20
  494. package/dist/api/types/NewDeploymentV2.ts +0 -34
  495. package/dist/api/types/NewTenant.ts +0 -49
  496. package/dist/api/types/Object.ts +0 -38
  497. package/dist/api/types/OwnUserUpdate.ts +0 -21
  498. package/dist/api/types/PasswordResetCompletion.ts +0 -17
  499. package/dist/api/types/PasswordResetRequest.ts +0 -13
  500. package/dist/api/types/Permission.ts +0 -21
  501. package/dist/api/types/PermissionObject.ts +0 -14
  502. package/dist/api/types/PermissionSet.ts +0 -22
  503. package/dist/api/types/PermissionSetWithScope.ts +0 -15
  504. package/dist/api/types/PersonalAccessToken.ts +0 -29
  505. package/dist/api/types/PersonalAccessTokenRequest.ts +0 -18
  506. package/dist/api/types/Plan.ts +0 -19
  507. package/dist/api/types/PlanBindingDetails.ts +0 -13
  508. package/dist/api/types/PlanChangeRequest.ts +0 -14
  509. package/dist/api/types/PlanLimits.ts +0 -12
  510. package/dist/api/types/PreAuthSet.ts +0 -16
  511. package/dist/api/types/Release.ts +0 -32
  512. package/dist/api/types/ReleaseDeployments.ts +0 -32
  513. package/dist/api/types/ReleaseUpdate.ts +0 -13
  514. package/dist/api/types/Releases.ts +0 -9
  515. package/dist/api/types/ReleasesDeleteError.ts +0 -21
  516. package/dist/api/types/ReleasesDeployments.ts +0 -9
  517. package/dist/api/types/Role.ts +0 -19
  518. package/dist/api/types/RolePermission.ts +0 -25
  519. package/dist/api/types/RolePermissionObject.ts +0 -17
  520. package/dist/api/types/RoleUseradm.ts +0 -19
  521. package/dist/api/types/SAMLMetadata.ts +0 -21
  522. package/dist/api/types/Scope.ts +0 -19
  523. package/dist/api/types/SelectAttribute.ts +0 -17
  524. package/dist/api/types/ServiceSubsystem.ts +0 -19
  525. package/dist/api/types/Settings.ts +0 -23
  526. package/dist/api/types/SortCriteria.ts +0 -30
  527. package/dist/api/types/SsoObject.ts +0 -21
  528. package/dist/api/types/Status.ts +0 -18
  529. package/dist/api/types/StatusDeviceauth.ts +0 -18
  530. package/dist/api/types/StatusTenantadm.ts +0 -17
  531. package/dist/api/types/StorageLimit.ts +0 -17
  532. package/dist/api/types/SubscriptionData.ts +0 -8
  533. package/dist/api/types/SupportRequest.ts +0 -17
  534. package/dist/api/types/Tag.ts +0 -27
  535. package/dist/api/types/Tags.ts +0 -10
  536. package/dist/api/types/TaskResult.ts +0 -13
  537. package/dist/api/types/TaskResultCLI.ts +0 -10
  538. package/dist/api/types/TaskResultHTTPRequest.ts +0 -8
  539. package/dist/api/types/TaskResultHTTPResponse.ts +0 -10
  540. package/dist/api/types/Tenant.ts +0 -26
  541. package/dist/api/types/TenantApiLimits.ts +0 -12
  542. package/dist/api/types/TenantApiLimitsTenantadm.ts +0 -12
  543. package/dist/api/types/TenantIdName.ts +0 -14
  544. package/dist/api/types/TenantIdsData.ts +0 -10
  545. package/dist/api/types/TenantInfo.ts +0 -14
  546. package/dist/api/types/TenantShortInfo.ts +0 -21
  547. package/dist/api/types/TenantTenantadm.ts +0 -54
  548. package/dist/api/types/TenantsIdName.ts +0 -6
  549. package/dist/api/types/Update.ts +0 -17
  550. package/dist/api/types/UpdateChildTenant.ts +0 -17
  551. package/dist/api/types/UpdateDeployments.ts +0 -18
  552. package/dist/api/types/UpdateFile.ts +0 -13
  553. package/dist/api/types/UpdateFileDeployments.ts +0 -13
  554. package/dist/api/types/UpdateTypes.ts +0 -8
  555. package/dist/api/types/UpgradeCompleteRequest.ts +0 -25
  556. package/dist/api/types/User.ts +0 -13
  557. package/dist/api/types/UserAuditlogs.ts +0 -13
  558. package/dist/api/types/UserNew.ts +0 -26
  559. package/dist/api/types/UserUpdate.ts +0 -25
  560. package/dist/api/types/UserUseradm.ts +0 -45
  561. package/dist/api/types/UserWithTenantInfo.ts +0 -12
  562. package/dist/api/types/XDeltaArgs.ts +0 -9
  563. package/dist/api/types/XDeltaArgsDeployments.ts +0 -9
  564. package/dist/api/types/XDeltaArgsLimits.ts +0 -10
  565. package/dist/api/types/XDeltaArgsLimitsDeployments.ts +0 -10
  566. package/dist/chunk-2CYOM4BK.js.map +0 -1
  567. package/dist/chunk-2JHFUQ6B.js.map +0 -1
  568. package/dist/chunk-4B3IMP4I.js +0 -245
  569. package/dist/chunk-4B3IMP4I.js.map +0 -1
  570. package/dist/chunk-4XJMRVFI.js.map +0 -1
  571. package/dist/chunk-7JKWI5FK.js.map +0 -1
  572. package/dist/chunk-7PVGDMNM.js.map +0 -1
  573. package/dist/chunk-AMGWP7A4.js.map +0 -1
  574. package/dist/chunk-C5NEDBJI.js +0 -727
  575. package/dist/chunk-C5NEDBJI.js.map +0 -1
  576. package/dist/chunk-CYV6632F.js.map +0 -1
  577. package/dist/chunk-DCK2DBOA.js.map +0 -1
  578. package/dist/chunk-FGKMJS3B.js.map +0 -1
  579. package/dist/chunk-HPBE6KYY.js.map +0 -1
  580. package/dist/chunk-JAROCU6M.js.map +0 -1
  581. package/dist/chunk-LEMVXAYP.js.map +0 -1
  582. package/dist/chunk-LGNOTPUG.js +0 -106
  583. package/dist/chunk-LGNOTPUG.js.map +0 -1
  584. package/dist/chunk-LIJIIRON.js +0 -28
  585. package/dist/chunk-LIJIIRON.js.map +0 -1
  586. package/dist/chunk-LTKOV26W.js.map +0 -1
  587. package/dist/chunk-MRCFLG45.js.map +0 -1
  588. package/dist/chunk-QRGTG4YB.js.map +0 -1
  589. package/dist/chunk-TI2RL5P2.js.map +0 -1
  590. package/dist/chunk-TUACATJA.js.map +0 -1
  591. package/dist/chunk-UWMYZNUB.js.map +0 -1
  592. package/dist/chunk-VMNMD6KF.js.map +0 -1
  593. package/dist/chunk-WXL7PVI5.js.map +0 -1
  594. package/dist/chunk-X7IEZBM4.js.map +0 -1
  595. package/dist/chunk-YDS36ALB.js.map +0 -1
  596. package/dist/chunk-YT73QWCN.js.map +0 -1
  597. package/dist/deploymentdevicehook.cjs.map +0 -1
  598. package/dist/deploymentdevicehook.js +0 -62
  599. package/dist/deploymentdevicehook.js.map +0 -1
  600. /package/dist/{chunk-DAPAXWA5.js.map → chunk-URNS6A5T.js.map} +0 -0
  601. /package/dist/{deploymentdevicehook.d.cts → useDeploymentDevice.d.cts} +0 -0
  602. /package/dist/{deploymentdevicehook.d.ts → useDeploymentDevice.d.ts} +0 -0
@@ -45,6 +45,15 @@ __export(thunks_exports, {
45
45
  updateDeploymentControlMap: () => updateDeploymentControlMap
46
46
  });
47
47
  module.exports = __toCommonJS(thunks_exports);
48
+ var import_helpers10 = require("@northern.tech/utils/helpers");
49
+ var import_tracking = __toESM(require("@northern.tech/utils/tracking"), 1);
50
+ var import_isUUID = __toESM(require("validator/lib/isUUID"), 1);
51
+
52
+ // src/deploymentsSlice/index.ts
53
+ var import_toolkit = require("@reduxjs/toolkit");
54
+
55
+ // src/constants.ts
56
+ var import_constants5 = require("@northern.tech/utils/constants");
48
57
 
49
58
  // src/appSlice/constants.ts
50
59
  var import_icons_material = require("@mui/icons-material");
@@ -52,16 +61,6 @@ var startingDeviceCount = {
52
61
  os: "for first 50 devices",
53
62
  professional: "for first 250 devices"
54
63
  };
55
- var apiRoot = "/api/management";
56
- var apiUrl = {
57
- v1: `${apiRoot}/v1`,
58
- v2: `${apiRoot}/v2`
59
- };
60
- var headerNames = {
61
- link: "link",
62
- location: "location",
63
- total: "x-total-count"
64
- };
65
64
  var chartTypes = {
66
65
  bar: { key: "bar", Icon: import_icons_material.BarChart },
67
66
  pie: { key: "pie", Icon: import_icons_material.PieChartOutline }
@@ -73,28 +72,30 @@ var PLANS = {
73
72
  os: {
74
73
  id: "os",
75
74
  name: "Basic",
75
+ minimalDeviceCount: 50,
76
76
  offer: true,
77
- price: "$32 / month",
77
+ price: "$34 / month",
78
78
  deviceCount: startingDeviceCount.os,
79
- offerprice: "$23 / month for first 50 devices",
80
- price2: "for first 6 months;\n$29/month thereafter",
79
+ description: "The core features of Mender. To continue using Enterprise Trial features\u2014like Delta updates, scheduled deployments, phased rollouts, device filtering, dynamic groups, RBAC, audit logs, and more\u2014please upgrade to a higher plan.",
81
80
  features: ["Access to core features of Mender", "Basic support"]
82
81
  },
83
82
  professional: {
84
83
  id: "professional",
85
84
  name: "Professional",
85
+ minimalDeviceCount: 250,
86
86
  offer: true,
87
- price: "$269 / month",
87
+ price: "$291 / month",
88
88
  deviceCount: startingDeviceCount.professional,
89
- offerprice: "$200 / month for first 50 devices",
90
- price2: "for first 6 months;\n$249/month thereafter",
89
+ description: "Everything in Basic, plus enhanced update management and automation features.",
91
90
  features: ["Advanced OTA features", "Higher priority support"]
92
91
  },
93
92
  enterprise: {
94
93
  id: "enterprise",
95
94
  name: "Enterprise",
95
+ minimalDeviceCount: 1e3,
96
96
  price: "Custom pricing",
97
97
  deviceCount: "Unlimited devices",
98
+ description: "Every advanced feature of Mender, tailored for complex and large-scale deployments. Not available as a monthly subscription \u2014 ask us for a quote.",
98
99
  features: ["All Mender features", "Advanced security features", "SLA-backed support"]
99
100
  }
100
101
  };
@@ -114,21 +115,6 @@ var ADDONS = {
114
115
  },
115
116
  eligible: ["os", "professional", "enterprise"]
116
117
  },
117
- troubleshoot: {
118
- id: "troubleshoot",
119
- title: "Troubleshoot",
120
- description: "Expand your plan with device troubleshooting features",
121
- needs: ["hasDeviceConnect"],
122
- os: {
123
- price: "$27/month",
124
- deviceCount: startingDeviceCount.os
125
- },
126
- professional: {
127
- price: "$72/month",
128
- deviceCount: startingDeviceCount.professional
129
- },
130
- eligible: ["os", "professional", "enterprise"]
131
- },
132
118
  monitor: {
133
119
  id: "monitor",
134
120
  title: "Monitor",
@@ -143,6 +129,21 @@ var ADDONS = {
143
129
  deviceCount: startingDeviceCount.professional
144
130
  },
145
131
  eligible: ["professional", "enterprise"]
132
+ },
133
+ troubleshoot: {
134
+ id: "troubleshoot",
135
+ title: "Troubleshoot",
136
+ description: "Expand your plan with device troubleshooting features",
137
+ needs: ["hasDeviceConnect"],
138
+ os: {
139
+ price: "$27/month",
140
+ deviceCount: startingDeviceCount.os
141
+ },
142
+ professional: {
143
+ price: "$72/month",
144
+ deviceCount: startingDeviceCount.professional
145
+ },
146
+ eligible: ["os", "professional", "enterprise"]
146
147
  }
147
148
  };
148
149
  var BENEFITS = {
@@ -180,144 +181,18 @@ var BENEFITS = {
180
181
  default: { id: "default", benefit: "gain access to this feature", requiredPlan: PLANS.enterprise.id }
181
182
  };
182
183
  var DARK_MODE = "dark";
183
- var APPLICATION_JSON_CONTENT_TYPE = "application/json";
184
- var APPLICATION_JWT_CONTENT_TYPE = "application/jwt";
185
184
 
186
185
  // src/commonConstants.tsx
187
186
  var import_js = require("@mdi/js");
187
+ var import_MenderTypes = require("@northern.tech/types/MenderTypes");
188
188
  var import_jsx_runtime = require("react/jsx-runtime");
189
- var DEVICE_LIST_DEFAULTS = {
190
- page: 1,
191
- perPage: 20
192
- };
193
189
  var timeUnits = {
194
190
  days: "days",
195
191
  minutes: "minutes",
196
192
  hours: "hours"
197
193
  };
198
- var ALL_DEVICES = "All devices";
199
194
  var UNGROUPED_GROUP = { id: "*|=ungrouped=|*", name: "Unassigned" };
200
195
  var DEVICE_LIST_MAXIMUM_LENGTH = 50;
201
- var DEVICE_FILTERING_OPTIONS = {
202
- $eq: { key: "$eq", title: "equals", shortform: "=" },
203
- $ne: { key: "$ne", title: "not equal", shortform: "!=" },
204
- $gt: {
205
- key: "$gt",
206
- title: ">",
207
- shortform: ">",
208
- help: 'The "greater than" operator can work both on numbers and strings. In the latter case, the operator applies the lexicographical order to the value strings.'
209
- },
210
- $gte: {
211
- title: ">=",
212
- shortform: ">=",
213
- help: 'The "greater than or equal" operator can work both on numbers and strings. In the latter case, the operator applies the lexicographical order to the value strings.'
214
- },
215
- $lt: {
216
- key: "$lt",
217
- title: "<",
218
- shortform: "<",
219
- help: 'The "lesser than" operator can work both on numbers and strings. In the latter case, the operator applies the lexicographical order to the value strings.'
220
- },
221
- $lte: {
222
- title: "<=",
223
- shortform: "<=",
224
- help: 'The "lesser than or equal" operator can work both on numbers and strings. In the latter case, the operator applies the lexicographical order to the value strings.'
225
- },
226
- $ltne: {
227
- key: "$ltne",
228
- title: "$ltne",
229
- shortform: "ltne",
230
- help: 'The "lesser than or does not exist" operator can work both on numbers and strings. In the latter case, the operator applies the lexicographical order to the value strings.'
231
- },
232
- $in: {
233
- key: "$in",
234
- title: "in",
235
- shortform: "in",
236
- help: 'The "in" operator accepts a list of comma-separated values. It matches if the selected field is equal to one of the specified values.'
237
- },
238
- $nin: {
239
- key: "$nin",
240
- title: "not in",
241
- shortform: "not in",
242
- help: `The "not in" operator accepts a list of comma-separated values. It matches if the selected field's value is not equal to any of the specified options.`
243
- },
244
- $exists: {
245
- key: "$exists",
246
- title: "exists",
247
- shortform: "exists",
248
- value: true,
249
- help: `The "exists" operator matches if the selected field's value has a value. No value needs to be provided for this operator.`
250
- },
251
- $nexists: {
252
- key: "$nexists",
253
- title: `doesn't exist`,
254
- shortform: `doesn't exist`,
255
- value: true,
256
- help: `The "doesn't exist" operator matches if the selected field's value has no value. No value needs to be provided for this operator.`
257
- },
258
- $regex: {
259
- key: "$regex",
260
- title: `matches regular expression`,
261
- shortform: `matches`,
262
- help: `The "regular expression" operator matches the selected field's value with a Perl compatible regular expression (PCRE), automatically anchored by ^. If the regular expression is not valid, the filter will produce no results. If you need to specify options and flags, you can provide the full regex in the format of /regex/flags, for example.`
263
- }
264
- };
265
- var DEVICE_ISSUE_OPTIONS = {
266
- issues: {
267
- isCategory: true,
268
- key: "issues",
269
- title: "Devices with issues",
270
- filterRule: {}
271
- },
272
- offline: {
273
- issueCategory: "issues",
274
- key: "offline",
275
- needsFullFiltering: true,
276
- needsMonitor: false,
277
- needsReporting: false,
278
- filterRule: {
279
- scope: "system",
280
- key: "check_in_time",
281
- operator: DEVICE_FILTERING_OPTIONS.$ltne.key,
282
- value: ({ offlineThreshold }) => offlineThreshold
283
- },
284
- title: "Offline devices"
285
- },
286
- failedLastUpdate: {
287
- issueCategory: "issues",
288
- key: "failedLastUpdate",
289
- needsFullFiltering: false,
290
- needsMonitor: false,
291
- needsReporting: true,
292
- filterRule: { scope: "monitor", key: "failed_last_update", operator: DEVICE_FILTERING_OPTIONS.$eq.key, value: true },
293
- title: "Deployment failed"
294
- },
295
- monitoring: {
296
- issueCategory: "issues",
297
- key: "monitoring",
298
- needsFullFiltering: false,
299
- needsMonitor: true,
300
- needsReporting: false,
301
- filterRule: { scope: "monitor", key: "alerts", operator: DEVICE_FILTERING_OPTIONS.$eq.key, value: true },
302
- title: "Monitoring alert"
303
- },
304
- authRequests: {
305
- key: "authRequests",
306
- needsFullFiltering: false,
307
- needsMonitor: false,
308
- needsReporting: true,
309
- filterRule: { scope: "monitor", key: "auth_requests", operator: DEVICE_FILTERING_OPTIONS.$gt.key, value: 1 },
310
- title: "Devices with new authentication requests"
311
- },
312
- gatewayDevices: {
313
- key: "gatewayDevices",
314
- needsFullFiltering: false,
315
- needsMonitor: false,
316
- needsReporting: true,
317
- filterRule: { scope: "inventory", key: "mender_is_gateway", operator: DEVICE_FILTERING_OPTIONS.$eq.key, value: "true" },
318
- title: "Gateway devices"
319
- }
320
- };
321
196
  var oneSecond = 1e3;
322
197
  var TIMEOUTS = {
323
198
  debounceDefault: 700,
@@ -330,23 +205,12 @@ var TIMEOUTS = {
330
205
  refreshDefault: 10 * oneSecond,
331
206
  refreshLong: 60 * oneSecond
332
207
  };
333
- var SORTING_OPTIONS = {
334
- asc: "asc",
335
- desc: "desc"
336
- };
337
208
  var DEVICE_ONLINE_CUTOFF = { interval: 1, intervalName: timeUnits.days };
338
- var ATTRIBUTE_SCOPES = {
339
- inventory: "inventory",
340
- identity: "identity",
341
- monitor: "monitor",
342
- system: "system",
343
- tags: "tags"
344
- };
345
- var defaultIdAttribute = Object.freeze({ attribute: "id", scope: ATTRIBUTE_SCOPES.identity });
209
+ var defaultIdAttribute = Object.freeze({ attribute: "id", scope: import_constants5.ATTRIBUTE_SCOPES.identity });
346
210
  var credentialTypes = {
347
- aws: "aws",
348
- http: "http",
349
- sas: "sas",
211
+ aws: import_MenderTypes.Credentials.type.AWS,
212
+ http: import_MenderTypes.Credentials.type.HTTP,
213
+ sas: import_MenderTypes.Credentials.type.SAS,
350
214
  x509: "x509"
351
215
  };
352
216
  var EXTERNAL_PROVIDER = {
@@ -386,32 +250,278 @@ var EXTERNAL_PROVIDER = {
386
250
  webhook: {
387
251
  credentialsType: credentialTypes.http,
388
252
  deviceTwin: false,
253
+ twinTitle: "",
389
254
  // disable the webhook provider here, since it is treated different than other integrations, with a custom configuration & management view, etc.
390
255
  enabled: false,
391
256
  provider: "webhook"
392
257
  }
393
258
  };
394
- var MAX_PAGE_SIZE = 500;
395
- var ALL_RELEASES = "All releases";
396
- var emptyUiPermissions = Object.freeze({
397
- auditlog: [],
398
- deployments: [],
399
- groups: Object.freeze({}),
400
- releases: Object.freeze({}),
401
- tenantManagement: [],
402
- userManagement: []
403
- });
404
- var emptyRole = Object.freeze({
405
- name: void 0,
259
+ var emptyWebhook = {
406
260
  description: "",
407
- permissions: [],
408
- uiPermissions: Object.freeze({ ...emptyUiPermissions })
409
- });
261
+ provider: import_MenderTypes.Integration.provider.WEBHOOK,
262
+ credentials: {
263
+ type: EXTERNAL_PROVIDER.webhook.credentialsType,
264
+ [EXTERNAL_PROVIDER.webhook.credentialsType]: {
265
+ secret: "",
266
+ url: ""
267
+ }
268
+ }
269
+ };
270
+ var MAX_PAGE_SIZE = 500;
271
+ var regionNames = new Intl.DisplayNames(["en"], { type: "region" });
272
+ var countries = [
273
+ "AD",
274
+ "AE",
275
+ "AF",
276
+ "AG",
277
+ "AI",
278
+ "AL",
279
+ "AM",
280
+ "AO",
281
+ "AQ",
282
+ "AR",
283
+ "AS",
284
+ "AT",
285
+ "AU",
286
+ "AW",
287
+ "AX",
288
+ "AZ",
289
+ "BA",
290
+ "BB",
291
+ "BD",
292
+ "BE",
293
+ "BF",
294
+ "BG",
295
+ "BH",
296
+ "BI",
297
+ "BJ",
298
+ "BL",
299
+ "BM",
300
+ "BN",
301
+ "BO",
302
+ "BR",
303
+ "BS",
304
+ "BT",
305
+ "BV",
306
+ "BW",
307
+ "BY",
308
+ "BZ",
309
+ "CA",
310
+ "CC",
311
+ "CD",
312
+ "CF",
313
+ "CG",
314
+ "CH",
315
+ "CI",
316
+ "CK",
317
+ "CL",
318
+ "CM",
319
+ "CN",
320
+ "CO",
321
+ "CR",
322
+ "CU",
323
+ "CV",
324
+ "CW",
325
+ "CX",
326
+ "CY",
327
+ "CZ",
328
+ "DE",
329
+ "DJ",
330
+ "DK",
331
+ "DM",
332
+ "DO",
333
+ "DZ",
334
+ "EC",
335
+ "EE",
336
+ "EG",
337
+ "EH",
338
+ "ER",
339
+ "ES",
340
+ "ET",
341
+ "FI",
342
+ "FJ",
343
+ "FK",
344
+ "FM",
345
+ "FO",
346
+ "FR",
347
+ "GA",
348
+ "GB",
349
+ "GD",
350
+ "GE",
351
+ "GF",
352
+ "GG",
353
+ "GH",
354
+ "GI",
355
+ "GL",
356
+ "GM",
357
+ "GN",
358
+ "GP",
359
+ "GQ",
360
+ "GR",
361
+ "GS",
362
+ "GT",
363
+ "GU",
364
+ "GW",
365
+ "GY",
366
+ "HK",
367
+ "HM",
368
+ "HN",
369
+ "HR",
370
+ "HT",
371
+ "HU",
372
+ "ID",
373
+ "IE",
374
+ "IL",
375
+ "IM",
376
+ "IN",
377
+ "IO",
378
+ "IQ",
379
+ "IR",
380
+ "IS",
381
+ "IT",
382
+ "JE",
383
+ "JM",
384
+ "JO",
385
+ "JP",
386
+ "KE",
387
+ "KG",
388
+ "KH",
389
+ "KI",
390
+ "KM",
391
+ "KN",
392
+ "KP",
393
+ "KR",
394
+ "KW",
395
+ "KY",
396
+ "KZ",
397
+ "LA",
398
+ "LB",
399
+ "LC",
400
+ "LI",
401
+ "LK",
402
+ "LR",
403
+ "LS",
404
+ "LT",
405
+ "LU",
406
+ "LV",
407
+ "LY",
408
+ "MA",
409
+ "MC",
410
+ "MD",
411
+ "ME",
412
+ "MF",
413
+ "MG",
414
+ "MH",
415
+ "MK",
416
+ "ML",
417
+ "MM",
418
+ "MN",
419
+ "MO",
420
+ "MP",
421
+ "MQ",
422
+ "MR",
423
+ "MS",
424
+ "MT",
425
+ "MU",
426
+ "MV",
427
+ "MW",
428
+ "MX",
429
+ "MY",
430
+ "MZ",
431
+ "NA",
432
+ "NC",
433
+ "NE",
434
+ "NF",
435
+ "NG",
436
+ "NI",
437
+ "NL",
438
+ "NO",
439
+ "NP",
440
+ "NR",
441
+ "NU",
442
+ "NZ",
443
+ "OM",
444
+ "PA",
445
+ "PE",
446
+ "PF",
447
+ "PG",
448
+ "PH",
449
+ "PK",
450
+ "PL",
451
+ "PM",
452
+ "PN",
453
+ "PR",
454
+ "PS",
455
+ "PT",
456
+ "PW",
457
+ "PY",
458
+ "QA",
459
+ "RE",
460
+ "RO",
461
+ "RS",
462
+ "RU",
463
+ "RW",
464
+ "SA",
465
+ "SB",
466
+ "SC",
467
+ "SD",
468
+ "SE",
469
+ "SG",
470
+ "SH",
471
+ "SI",
472
+ "SJ",
473
+ "SK",
474
+ "SL",
475
+ "SM",
476
+ "SN",
477
+ "SO",
478
+ "SR",
479
+ "SS",
480
+ "ST",
481
+ "SV",
482
+ "SX",
483
+ "SY",
484
+ "SZ",
485
+ "TC",
486
+ "TD",
487
+ "TF",
488
+ "TG",
489
+ "TH",
490
+ "TJ",
491
+ "TK",
492
+ "TL",
493
+ "TM",
494
+ "TN",
495
+ "TO",
496
+ "TR",
497
+ "TT",
498
+ "TV",
499
+ "TW",
500
+ "TZ",
501
+ "UA",
502
+ "UG",
503
+ "US",
504
+ "UY",
505
+ "UZ",
506
+ "VA",
507
+ "VC",
508
+ "VE",
509
+ "VG",
510
+ "VI",
511
+ "VN",
512
+ "VU",
513
+ "WF",
514
+ "WS",
515
+ "XK",
516
+ "YE",
517
+ "YT",
518
+ "ZA",
519
+ "ZM",
520
+ "ZW"
521
+ ].map((code) => ({ code, label: regionNames.of(code) })).sort((a, b) => a.label.localeCompare(b.label));
410
522
 
411
523
  // src/deploymentsSlice/constants.ts
412
524
  var alreadyInstalled = "already-installed";
413
- var deploymentsApiUrl = `${apiUrl.v1}/deployments`;
414
- var deploymentsApiUrlV2 = `${apiUrl.v2}/deployments`;
415
525
  var deploymentSubstates = {
416
526
  aborted: "aborted",
417
527
  alreadyInstalled,
@@ -484,9 +594,9 @@ var DEPLOYMENT_STATES = {
484
594
  var listDefaultsByState = {
485
595
  [DEPLOYMENT_STATES.inprogress]: { page: 1, perPage: 10 },
486
596
  [DEPLOYMENT_STATES.pending]: { page: 1, perPage: 10 },
487
- [DEPLOYMENT_STATES.scheduled]: { ...DEVICE_LIST_DEFAULTS },
488
- [DEPLOYMENT_STATES.finished]: { ...DEVICE_LIST_DEFAULTS },
489
- sort: { direction: SORTING_OPTIONS.desc }
597
+ [DEPLOYMENT_STATES.scheduled]: { ...import_constants5.DEVICE_LIST_DEFAULTS },
598
+ [DEPLOYMENT_STATES.finished]: { ...import_constants5.DEVICE_LIST_DEFAULTS },
599
+ sort: { direction: import_constants5.SORTING_OPTIONS.desc }
490
600
  };
491
601
  var DEFAULT_PENDING_INPROGRESS_COUNT = 10;
492
602
  var DEPLOYMENT_ROUTES = {
@@ -547,30 +657,10 @@ var pauseMap = {
547
657
  followUp: installationSubstatesMap.reboot.pauseConfigurationIndicator
548
658
  }
549
659
  };
550
- var limitDefault = { min: 5, max: 100, default: 10 };
551
660
 
552
661
  // src/devicesSlice/constants.ts
553
- var emptyFilter = { key: null, value: "", operator: DEVICE_FILTERING_OPTIONS.$eq.key, scope: "inventory" };
554
- var deviceAuthV2 = `${apiUrl.v2}/devauth`;
555
- var deviceConnect = `${apiUrl.v1}/deviceconnect`;
556
- var inventoryApiUrl = `${apiUrl.v1}/inventory`;
557
- var inventoryApiUrlV2 = `${apiUrl.v2}/inventory`;
558
- var deviceConfig = `${apiUrl.v1}/deviceconfig/configurations/device`;
559
- var reportingApiUrl = `${apiUrl.v1}/reporting`;
560
- var iotManagerBaseURL = `${apiUrl.v1}/iot-manager`;
561
- var ALL_DEVICE_STATES = "any";
562
- var DEVICE_STATES = {
563
- accepted: "accepted",
564
- pending: "pending",
565
- preauth: "preauthorized",
566
- rejected: "rejected"
567
- };
662
+ var emptyFilter = { key: null, value: "", operator: import_constants5.DEVICE_FILTERING_OPTIONS.$eq.key, scope: "inventory" };
568
663
  var geoAttributes = ["geo-lat", "geo-lon"].map((attribute) => ({ attribute, scope: "inventory" }));
569
- var REPORT_CHART_SIZE_LIMIT = 6;
570
-
571
- // src/monitorSlice/constants.ts
572
- var alertChannels = { email: "email" };
573
- var monitorApiUrlv1 = `${apiUrl.v1}/devicemonitor`;
574
664
 
575
665
  // src/onboardingSlice/constants.ts
576
666
  var onboardingSteps = {
@@ -588,6 +678,7 @@ var onboardingSteps = {
588
678
  SCHEDULING_GROUP_SELECTION: "scheduling-group-selection",
589
679
  SCHEDULING_RELEASE_TO_DEVICES: "scheduling-release-to-devices",
590
680
  DEPLOYMENTS_INPROGRESS: "deployments-inprogress",
681
+ DEPLOYMENTS_COMPLETED: "deployments-completed",
591
682
  DEPLOYMENTS_PAST: "deployments-past",
592
683
  DEPLOYMENTS_PAST_COMPLETED: "deployments-past-completed",
593
684
  DEPLOYMENTS_PAST_COMPLETED_FAILURE: "deployments-past-completed-failure",
@@ -614,14 +705,10 @@ var orderedOnboardingSteps = [
614
705
  ];
615
706
 
616
707
  // src/organizationSlice/constants.ts
617
- var auditLogsApiUrl = `${apiUrl.v1}/auditlogs`;
618
- var tenantadmApiUrlv1 = `${apiUrl.v1}/tenantadm`;
619
- var tenantadmApiUrlv2 = `${apiUrl.v2}/tenantadm`;
620
- var ssoIdpApiUrlv1 = `${apiUrl.v1}/useradm/sso/idp/metadata`;
621
708
  var XML_METADATA_FORMAT = "xml";
622
709
  var JSON_METADATA_FORMAT = "json";
623
- var getSamlStartUrl = (id) => `${window.location.origin}${useradmApiUrlv1}/auth/sso/${id}/login`;
624
- var getOidcStartUrl = (id) => `${window.location.origin}${useradmApiUrlv1}/oidc/${id}/start`;
710
+ var getSamlStartUrl = (id) => `${window.location.origin}${import_constants5.useradmApiUrl}/auth/sso/${id}/login`;
711
+ var getOidcStartUrl = (id) => `${window.location.origin}${import_constants5.useradmApiUrl}/oidc/${id}/start`;
625
712
  var SSO_TYPES = {
626
713
  saml: {
627
714
  id: "saml",
@@ -632,8 +719,8 @@ var SSO_TYPES = {
632
719
  contentType: "application/samlmetadata+xml",
633
720
  getStartUrl: getSamlStartUrl,
634
721
  configDetails: [
635
- { key: "entityID", label: "Entity ID", getValue: (id) => `${window.location.origin}${useradmApiUrlv1}/sso/sp/metadata/${id}` },
636
- { key: "acs", label: "ACS URL", getValue: (id) => `${window.location.origin}${useradmApiUrlv1}/auth/sso/${id}/acs` },
722
+ { key: "entityID", label: "Entity ID", getValue: (id) => `${window.location.origin}${import_constants5.useradmApiUrl}/sso/sp/metadata/${id}` },
723
+ { key: "acs", label: "ACS URL", getValue: (id) => `${window.location.origin}${import_constants5.useradmApiUrl}/auth/sso/${id}/acs` },
637
724
  { key: "startURL", label: "Start URL", getValue: getSamlStartUrl }
638
725
  ]
639
726
  },
@@ -658,17 +745,6 @@ var auditlogTypes = {
658
745
  };
659
746
  var AUDIT_LOGS_TYPES = [auditlogTypes.artifact, auditlogTypes.deployment, auditlogTypes.device, auditlogTypes.user_access_token, auditlogTypes.user];
660
747
  var SP_AUDIT_LOGS_TYPES = [auditlogTypes.user, auditlogTypes.tenant];
661
- var emptyWebhook = {
662
- description: "",
663
- enabled: true,
664
- credentials: {
665
- type: EXTERNAL_PROVIDER.webhook.credentialsType,
666
- [EXTERNAL_PROVIDER.webhook.credentialsType]: {
667
- secret: "",
668
- url: ""
669
- }
670
- }
671
- };
672
748
  var TENANT_LIST_DEFAULT = {
673
749
  page: 1,
674
750
  perPage: 20
@@ -676,541 +752,22 @@ var TENANT_LIST_DEFAULT = {
676
752
 
677
753
  // src/releasesSlice/constants.ts
678
754
  var rootfsImageVersion = "rootfs-image.version";
679
- var softwareTitleMap = { [rootfsImageVersion]: { title: "Root filesystem", priority: 0, key: rootfsImageVersion } };
680
-
681
- // src/usersSlice/constants.ts
682
- var useradmApiUrlv1 = `${apiUrl.v1}/useradm`;
683
- var useradmApiUrlv2 = `${apiUrl.v2}/useradm`;
684
- var staticRolesByName = {
685
- admin: "RBAC_ROLE_PERMIT_ALL",
686
- readOnly: "RBAC_ROLE_OBSERVER",
687
- ci: "RBAC_ROLE_CI",
688
- deploymentsManager: "RBAC_ROLE_DEPLOYMENTS_MANAGER",
689
- terminalAccess: "RBAC_ROLE_REMOTE_TERMINAL"
690
- };
691
- var PermissionTypes = {
692
- Any: "any",
693
- Get: "GET",
694
- Post: "POST",
695
- Put: "PUT",
696
- Delete: "DELETE",
697
- Patch: "PATCH",
698
- DeviceGroup: "DEVICE_GROUP",
699
- DeviceId: "DEVICE_ID"
700
- };
701
- var permissionSetIds = {
702
- Basic: "Basic",
703
- ConfigureDevices: "ConfigureDevices",
704
- ConnectToDevices: "ConnectToDevices",
705
- DeployToDevices: "DeployToDevices",
706
- ManageDevices: "ManageDevices",
707
- ManageReleases: "ManageReleases",
708
- ManageTenants: "ManageTenants",
709
- ManageUsers: "ManageUsers",
710
- ReadAuditLogs: "ReadAuditLogs",
711
- ReadDevices: "ReadDevices",
712
- ReadReleases: "ReadReleases",
713
- ReadTenants: "ReadTenants",
714
- ReadUsers: "ReadUsers",
715
- SuperUser: "SuperUser",
716
- UploadArtifacts: "UploadArtifacts"
717
- };
718
- var uiPermissionsById = {
719
- configure: {
720
- explanations: { groups: `'Configure' allows the user to use mender-configure features and apply configurations.` },
721
- permissionLevel: 2,
722
- permissionSets: { groups: permissionSetIds.ConfigureDevices },
723
- title: "Configure",
724
- value: "configure",
725
- verbs: [PermissionTypes.Get, PermissionTypes.Put, PermissionTypes.Post]
726
- },
727
- connect: {
728
- explanations: { groups: `'Connect' allows the user to use mender-connect features and Troubleshoot add-ons.` },
729
- permissionLevel: 2,
730
- permissionSets: { groups: permissionSetIds.ConnectToDevices },
731
- title: "Connect",
732
- value: "connect",
733
- verbs: [PermissionTypes.Get, PermissionTypes.Put]
734
- },
735
- deploy: {
736
- explanations: { groups: `'Deploy' allows the user to deploy software or configuration updates to devices.` },
737
- permissionLevel: 2,
738
- permissionSets: { deployments: permissionSetIds.DeployToDevices, groups: permissionSetIds.DeployToDevices },
739
- title: "Deploy",
740
- value: "deploy",
741
- verbs: [PermissionTypes.Post]
742
- },
743
- manage: {
744
- explanations: {
745
- groups: `'Manage' allows the user to edit device name, notes, and manage authentication status. For 'All devices' it also allows the user to edit and create device groups.`,
746
- releases: `'Manage' allows the user to upload new artifacts, edit release descriptions and remove artifacts.`
747
- },
748
- permissionLevel: 2,
749
- permissionSets: {
750
- groups: permissionSetIds.ManageDevices,
751
- releases: permissionSetIds.ManageReleases,
752
- tenantManagement: permissionSetIds.ManageTenants,
753
- userManagement: permissionSetIds.ManageUsers
754
- },
755
- title: "Manage",
756
- value: "manage",
757
- verbs: [PermissionTypes.Post, PermissionTypes.Put, PermissionTypes.Patch]
758
- },
759
- read: {
760
- explanations: { groups: `'Read' allows the user to view devices.` },
761
- permissionLevel: 1,
762
- permissionSets: {
763
- auditlog: permissionSetIds.ReadAuditLogs,
764
- groups: permissionSetIds.ReadDevices,
765
- releases: permissionSetIds.ReadReleases,
766
- tenantManagement: permissionSetIds.ReadTenants,
767
- userManagement: permissionSetIds.ReadUsers
768
- },
769
- title: "Read",
770
- value: "read",
771
- verbs: [PermissionTypes.Get, PermissionTypes.Post]
772
- },
773
- upload: {
774
- explanations: { groups: `'Upload' allows the user to upload new Artifacts.` },
775
- unscopedOnly: { releases: true },
776
- permissionLevel: 1,
777
- permissionSets: { releases: permissionSetIds.UploadArtifacts },
778
- title: "Upload",
779
- value: "upload",
780
- verbs: [PermissionTypes.Post, PermissionTypes.Put, PermissionTypes.Patch]
781
- }
782
- };
783
- var scopedPermissionAreas = {
784
- groups: { key: "groups", excessiveAccessSelector: ALL_DEVICES, scopeType: "DeviceGroups" },
785
- releases: { key: "releases", excessiveAccessSelector: ALL_RELEASES, scopeType: "Releases" }
786
- };
787
- var uiPermissionsByArea = {
788
- auditlog: {
789
- endpoints: [{ path: /\/(auditlog)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.read] }],
790
- explanation: "Granting access to the audit log will allow tracing changes to devices, releases and user accounts, as well as providing information about deployments.",
791
- key: "auditlog",
792
- uiPermissions: [uiPermissionsById.read],
793
- title: "System Audit Log"
794
- },
795
- deployments: {
796
- endpoints: [
797
- { path: /\/(deployments\/deployments)/i, types: [PermissionTypes.Post, PermissionTypes.Put], uiPermissions: [uiPermissionsById.deploy] },
798
- { path: /\/(deployments\/deployments)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.read] },
799
- { path: /\/(deployments\/config)/i, types: [PermissionTypes.Get, PermissionTypes.Put], uiPermissions: [uiPermissionsById.manage] }
800
- ],
801
- explanation: "Providing deploy permissions will allow deployments to be created using the releases and devices a user has access to.",
802
- key: "deployments",
803
- uiPermissions: [uiPermissionsById.read, uiPermissionsById.deploy],
804
- title: "Deployments"
805
- },
806
- groups: {
807
- endpoints: [
808
- {
809
- path: /\/(devauth|inventory|deviceconfig|devicemonitor|deviceconnect\/devices)/i,
810
- types: [PermissionTypes.Get],
811
- uiPermissions: [uiPermissionsById.read]
812
- },
813
- { path: /\/(devauth|inventory)/i, types: [PermissionTypes.Put, PermissionTypes.Post], uiPermissions: [uiPermissionsById.manage] },
814
- { path: /\/(deviceconfig)/i, types: [PermissionTypes.Get, PermissionTypes.Put, PermissionTypes.Post], uiPermissions: [uiPermissionsById.configure] },
815
- { path: /\/(deviceconnect\/devices)/i, types: [PermissionTypes.Get, PermissionTypes.Post], uiPermissions: [uiPermissionsById.connect] }
816
- ],
817
- explanation: "Device group management permissions control the degree to which devices in a group can be accessed and moved to other groups.",
818
- key: "groups",
819
- scope: scopedPermissionAreas.groups.scopeType,
820
- uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage, uiPermissionsById.deploy, uiPermissionsById.configure, uiPermissionsById.connect],
821
- title: "Group Management"
822
- },
823
- releases: {
824
- endpoints: [
825
- { path: /\/(deployments\/artifacts|deployments\/deployments\/releases)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.read] },
826
- {
827
- path: /\/(deployments\/artifacts|deployments\/deployments\/releases)/i,
828
- types: [PermissionTypes.Post, PermissionTypes.Put],
829
- uiPermissions: [uiPermissionsById.read, uiPermissionsById.upload]
830
- },
831
- {
832
- path: /\/(deployments\/artifacts|deployments\/deployments\/releases)/i,
833
- types: [PermissionTypes.Delete],
834
- uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage]
835
- }
836
- ],
837
- explanation: "Release permissions can be granted to allow artifact & release modifications, as well as the creation of new releases.",
838
- key: "releases",
839
- scope: "ReleaseTags",
840
- uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage, uiPermissionsById.upload],
841
- title: "Release Management"
842
- },
843
- tenantManagement: {
844
- endpoints: [
845
- { path: /\/(tenantadm\/tenants)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.read] },
846
- { path: /\/(tenantadm\/tenants)/i, types: [PermissionTypes.Post, PermissionTypes.Put], uiPermissions: [uiPermissionsById.manage] },
847
- { path: /\/(users\/exists)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.manage] }
848
- ],
849
- explanation: "Tenant management permissions allow listing, creating and modifying child tenants",
850
- key: "tenantManagement",
851
- uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage],
852
- title: "Tenant Management"
853
- },
854
- userManagement: {
855
- endpoints: [
856
- { path: /\/(useradm)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.read] },
857
- { path: /\/(useradm)/i, types: [PermissionTypes.Post], uiPermissions: [uiPermissionsById.manage] }
858
- ],
859
- explanation: "User management permissions should be granted carefully, as these allow privilege increases for any users managed by a user with user management permissions",
860
- key: "userManagement",
861
- uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage],
862
- title: "User Management"
863
- }
864
- };
865
- var permissionMapper = (permission) => permission.value;
866
- var itemUiPermissionsReducer = (accu, { item, uiPermissions }) => item ? { ...accu, [item]: uiPermissions } : accu;
867
- var rolesById = Object.freeze({
868
- [staticRolesByName.admin]: {
869
- name: "Admin",
870
- value: staticRolesByName.admin,
871
- description: "Full access",
872
- permissions: [],
873
- // permissions refers to the values returned from the backend
874
- uiPermissions: {
875
- ...emptyUiPermissions,
876
- auditlog: uiPermissionsByArea.auditlog.uiPermissions.map(permissionMapper),
877
- deployments: uiPermissionsByArea.deployments.uiPermissions.map(permissionMapper),
878
- groups: { [ALL_DEVICES]: uiPermissionsByArea.groups.uiPermissions.map(permissionMapper) },
879
- releases: { [ALL_RELEASES]: uiPermissionsByArea.releases.uiPermissions.map(permissionMapper) },
880
- userManagement: uiPermissionsByArea.userManagement.uiPermissions.map(permissionMapper)
881
- }
882
- },
883
- [staticRolesByName.readOnly]: {
884
- name: "Read Access",
885
- value: staticRolesByName.readOnly,
886
- description: "",
887
- permissions: [],
888
- uiPermissions: {
889
- ...emptyUiPermissions,
890
- deployments: [uiPermissionsById.read.value],
891
- groups: { [ALL_DEVICES]: [uiPermissionsById.read.value] },
892
- releases: { [ALL_RELEASES]: [uiPermissionsById.read.value] },
893
- userManagement: [uiPermissionsById.read.value]
894
- }
895
- },
896
- [staticRolesByName.ci]: {
897
- name: "Releases Manager",
898
- value: staticRolesByName.ci,
899
- description: "",
900
- permissions: [],
901
- uiPermissions: {
902
- ...emptyUiPermissions,
903
- releases: { [ALL_RELEASES]: uiPermissionsByArea.releases.uiPermissions.map(permissionMapper) }
904
- }
905
- },
906
- [staticRolesByName.deploymentsManager]: {
907
- name: "Deployments Manager",
908
- value: staticRolesByName.deploymentsManager,
909
- description: "",
910
- permissions: [],
911
- uiPermissions: {
912
- ...emptyUiPermissions,
913
- deployments: uiPermissionsByArea.deployments.uiPermissions.map(permissionMapper),
914
- groups: { [ALL_DEVICES]: [uiPermissionsById.deploy.value, uiPermissionsById.read.value] },
915
- releases: { [ALL_RELEASES]: [uiPermissionsById.read.value] }
916
- }
917
- },
918
- [staticRolesByName.terminalAccess]: {
919
- name: "Troubleshooting",
920
- value: staticRolesByName.terminalAccess,
921
- description: "Access to the troubleshooting features: Remote Terminal, File Transfer, Port Forwarding",
922
- permissions: [],
923
- uiPermissions: {
924
- ...emptyUiPermissions,
925
- groups: { [ALL_DEVICES]: [uiPermissionsById.connect.value] }
926
- }
927
- }
928
- });
929
- var serviceProviderRolesById = {
930
- admin: {
931
- name: "Admin",
932
- value: staticRolesByName.admin,
933
- description: "Full access",
934
- permissions: [],
935
- uiPermissions: {
936
- ...emptyUiPermissions,
937
- auditlog: uiPermissionsByArea.auditlog.uiPermissions.map(permissionMapper),
938
- userManagement: uiPermissionsByArea.userManagement.uiPermissions.map(permissionMapper),
939
- tenantManagement: uiPermissionsByArea.tenantManagement.uiPermissions.map(permissionMapper)
940
- }
941
- },
942
- readOnly: {
943
- name: "Read access",
944
- value: staticRolesByName.readOnly,
945
- description: "This role can see all linked organizations but cannot make any changes",
946
- permissions: [],
947
- uiPermissions: {
948
- ...emptyUiPermissions,
949
- auditlog: [uiPermissionsById.read.value],
950
- userManagement: [uiPermissionsById.read.value],
951
- tenantManagement: [uiPermissionsById.read.value]
952
- }
953
- }
954
- };
955
- var defaultPermissionSets = {
956
- [permissionSetIds.Basic]: {
957
- name: permissionSetIds.Basic,
958
- result: {
959
- // this is needed to prevent the detailed permissions of the basic permission set from being interpreted as allowing read & management access to user endpoints
960
- userManagement: [uiPermissionsById.read.value]
961
- }
962
- },
963
- [permissionSetIds.SuperUser]: {
964
- name: permissionSetIds.SuperUser,
965
- result: {
966
- ...rolesById[staticRolesByName.admin].uiPermissions
967
- }
968
- },
969
- [permissionSetIds.ManageUsers]: {
970
- name: permissionSetIds.ManageUsers,
971
- result: {
972
- userManagement: [uiPermissionsById.manage.value]
973
- }
974
- },
975
- [permissionSetIds.ReadAuditLogs]: {
976
- name: permissionSetIds.ReadAuditLogs,
977
- result: {
978
- auditlog: [uiPermissionsById.read.value]
979
- }
980
- },
981
- [permissionSetIds.ReadReleases]: {
982
- name: permissionSetIds.ReadReleases,
983
- result: {
984
- releases: { [ALL_RELEASES]: [uiPermissionsById.read.value] }
985
- }
986
- },
987
- [permissionSetIds.ReadTenants]: {
988
- name: permissionSetIds.ReadTenants,
989
- result: {
990
- tenantManagement: [uiPermissionsById.read.value]
991
- }
992
- },
993
- [permissionSetIds.ManageTenants]: {
994
- name: permissionSetIds.ManageTenants,
995
- result: {
996
- tenantManagement: [uiPermissionsById.manage.value]
997
- }
998
- },
999
- [permissionSetIds.ReadUsers]: {
1000
- name: permissionSetIds.ReadUsers,
1001
- result: {
1002
- userManagement: [uiPermissionsById.read.value]
1003
- }
1004
- },
1005
- [permissionSetIds.UploadArtifacts]: {
1006
- name: permissionSetIds.UploadArtifacts,
1007
- result: {
1008
- releases: { [ALL_RELEASES]: [uiPermissionsById.upload.value] }
1009
- }
1010
- },
1011
- [permissionSetIds.ManageReleases]: {
1012
- name: permissionSetIds.ManageReleases,
1013
- result: {
1014
- releases: { [ALL_RELEASES]: [uiPermissionsById.manage.value] }
1015
- }
1016
- },
1017
- [permissionSetIds.ConfigureDevices]: {
1018
- name: permissionSetIds.ConfigureDevices,
1019
- result: {
1020
- deployments: [uiPermissionsById.read.value, uiPermissionsById.deploy.value],
1021
- groups: { [ALL_DEVICES]: [uiPermissionsById.read.value, uiPermissionsById.configure.value] }
1022
- }
1023
- },
1024
- [permissionSetIds.ConnectToDevices]: {
1025
- name: permissionSetIds.ConnectToDevices,
1026
- result: {
1027
- groups: { [ALL_DEVICES]: [uiPermissionsById.read.value, uiPermissionsById.connect.value] }
1028
- }
1029
- },
1030
- [permissionSetIds.DeployToDevices]: {
1031
- name: permissionSetIds.DeployToDevices,
1032
- result: {
1033
- deployments: [uiPermissionsById.deploy.value, uiPermissionsById.manage.value, uiPermissionsById.read.value],
1034
- groups: { [ALL_DEVICES]: [uiPermissionsById.read.value, uiPermissionsById.deploy.value] }
1035
- }
1036
- },
1037
- [permissionSetIds.ManageDevices]: {
1038
- name: permissionSetIds.ManageDevices,
1039
- result: {
1040
- groups: { [ALL_DEVICES]: [uiPermissionsById.read.value, uiPermissionsById.manage.value] }
1041
- }
1042
- },
1043
- [permissionSetIds.ReadDevices]: {
1044
- name: permissionSetIds.ReadDevices,
1045
- result: {
1046
- groups: { [ALL_DEVICES]: [uiPermissionsById.read.value] }
1047
- }
1048
- }
1049
- };
1050
- var USER_LOGOUT = "USER_LOGOUT";
1051
- var OWN_USER_ID = "me";
1052
- var rolesByName = {
1053
- ...staticRolesByName,
1054
- deploymentCreation: { action: "CREATE_DEPLOYMENT", object: { type: "DEVICE_GROUP", value: void 0 } },
1055
- groupAccess: { action: "VIEW_DEVICE", object: { type: "DEVICE_GROUP", value: void 0 } },
1056
- userManagement: { action: "http", object: { type: "any", value: `${useradmApiUrlv1}/.*` } }
1057
- };
1058
- var twoFAStates = {
1059
- enabled: "enabled",
1060
- disabled: "disabled",
1061
- unverified: "unverified"
1062
- };
1063
- var settingsKeys = { initialized: "settings-initialized" };
1064
- var READ_STATES = {
1065
- read: "read",
1066
- seen: "seen",
1067
- unread: "unread"
1068
- };
1069
-
1070
- // src/appSlice/index.ts
1071
- var import_toolkit = require("@reduxjs/toolkit");
1072
- var sliceName = "app";
1073
- var getYesterday = () => {
1074
- const today = /* @__PURE__ */ new Date();
1075
- today.setDate(today.getDate() - 1);
1076
- return today.toISOString();
1077
- };
1078
- var initialState = {
1079
- cancelSource: void 0,
1080
- demoArtifactLink: "https://dgsbl4vditpls.cloudfront.net/mender-demo-artifact.mender",
1081
- hostAddress: null,
1082
- snackbar: {
1083
- open: false,
1084
- message: "",
1085
- maxWidth: 900,
1086
- autoHideDuration: void 0,
1087
- action: void 0,
1088
- children: void 0,
1089
- onClick: void 0,
1090
- onClose: void 0
1091
- },
1092
- // return boolean rather than organization details
1093
- features: {
1094
- hasAuditlogs: false,
1095
- hasDeltaProgress: false,
1096
- hasMultitenancy: false,
1097
- hasDeviceConfig: false,
1098
- hasDeviceConnect: false,
1099
- hasFeedbackEnabled: false,
1100
- hasMonitor: false,
1101
- hasReporting: false,
1102
- isDemoMode: false,
1103
- isHosted: false,
1104
- isEnterprise: false
1105
- },
1106
- feedbackProbability: 0.3,
1107
- firstLoginAfterSignup: false,
1108
- hostedAnnouncement: "",
1109
- docsVersion: "",
1110
- recaptchaSiteKey: "",
1111
- searchState: {
1112
- deviceIds: [],
1113
- searchTerm: "",
1114
- searchTotal: 0,
1115
- sort: {
1116
- direction: SORTING_OPTIONS.desc
1117
- // key: null,
1118
- // scope: null
1119
- }
1120
- },
1121
- stripeAPIKey: "",
1122
- trackerCode: "",
1123
- uploadsById: {
1124
- // id: { uploading: false, uploadProgress: 0, cancelSource: undefined }
1125
- },
1126
- newThreshold: getYesterday(),
1127
- offlineThreshold: getYesterday(),
1128
- versionInformation: {
1129
- Integration: "",
1130
- "Mender-Client": "",
1131
- "Mender-Artifact": "",
1132
- "Meta-Mender": "",
1133
- Deployments: "",
1134
- Deviceauth: "",
1135
- Inventory: "",
1136
- GUI: "latest"
1137
- },
1138
- yesterday: void 0
1139
- };
1140
- var appSlice = (0, import_toolkit.createSlice)({
1141
- name: sliceName,
1142
- initialState,
1143
- reducers: {
1144
- setFeatures: (state, action) => {
1145
- state.features = {
1146
- ...state.features,
1147
- ...action.payload
1148
- };
1149
- },
1150
- setSnackbar: (state, { payload }) => {
1151
- let { message, autoHideDuration, action, children, onClick, onClose } = payload;
1152
- if (typeof payload === "string" || payload instanceof String) {
1153
- message = payload;
1154
- }
1155
- state.snackbar = {
1156
- open: message ? true : false,
1157
- message,
1158
- maxWidth: 900,
1159
- autoHideDuration,
1160
- action,
1161
- children,
1162
- onClick,
1163
- onClose
1164
- };
1165
- },
1166
- setFirstLoginAfterSignup: (state, action) => {
1167
- state.firstLoginAfterSignup = action.payload;
1168
- },
1169
- setAnnouncement: (state, action) => {
1170
- state.hostedAnnouncement = action.payload;
1171
- },
1172
- setSearchState: (state, action) => {
1173
- state.searchState = {
1174
- ...state.searchState,
1175
- ...action.payload
1176
- };
1177
- },
1178
- setOfflineThreshold: (state, action) => {
1179
- state.offlineThreshold = action.payload;
1180
- },
1181
- initUpload: (state, action) => {
1182
- const { id, upload } = action.payload;
1183
- state.uploadsById[id] = upload;
1184
- },
1185
- uploadProgress: (state, action) => {
1186
- const { id, progress: progress2 } = action.payload;
1187
- state.uploadsById[id] = {
1188
- ...state.uploadsById[id],
1189
- progress: progress2
1190
- };
1191
- },
1192
- cleanUpUpload: (state, action) => {
1193
- const { [action.payload]: current, ...remainder } = state.uploadsById;
1194
- state.uploadsById = remainder;
1195
- },
1196
- setVersionInformation: (state, action) => {
1197
- state.versionInformation = {
1198
- ...state.versionInformation,
1199
- ...action.payload
1200
- };
1201
- },
1202
- setEnvironmentData: (state, action) => {
1203
- return { ...state, ...action.payload };
1204
- }
1205
- }
1206
- });
1207
- var actions = appSlice.actions;
1208
- var appSlice_default = appSlice.reducer;
755
+ var softwareTitleMap = { [rootfsImageVersion]: { title: "Root filesystem", priority: 0, key: rootfsImageVersion } };
756
+
757
+ // src/usersSlice/constants.ts
758
+ var itemUiPermissionsReducer = (accu, { item, uiPermissions }) => item ? { ...accu, [item]: uiPermissions } : accu;
759
+ var USER_LOGOUT = "USER_LOGOUT";
760
+ var OWN_USER_ID = "me";
761
+ var settingsKeys = { initialized: "settings-initialized" };
762
+ var READ_STATES = {
763
+ read: "read",
764
+ seen: "seen",
765
+ unread: "unread"
766
+ };
1209
767
 
1210
768
  // src/deploymentsSlice/index.ts
1211
- var import_toolkit2 = require("@reduxjs/toolkit");
1212
- var sliceName2 = "deployments";
1213
- var initialState2 = {
769
+ var sliceName = "deployments";
770
+ var initialState = {
1214
771
  byId: {
1215
772
  // [id]: { statistics: { status: {}, total_size }, devices: { [deploymentId]: { id, log } }, totalDeviceCount }
1216
773
  },
@@ -1232,20 +789,20 @@ var initialState2 = {
1232
789
  sourceWindow: -1
1233
790
  },
1234
791
  binaryDeltaLimits: {
1235
- timeout: { ...limitDefault, default: 60, max: 3600, min: 60 },
1236
- sourceWindow: limitDefault,
1237
- inputWindow: limitDefault,
1238
- duplicatesWindow: limitDefault,
1239
- instructionBuffer: limitDefault
792
+ timeout: { ...import_constants5.limitDefault, default: 60, max: 3600, min: 60 },
793
+ sourceWindow: import_constants5.limitDefault,
794
+ inputWindow: import_constants5.limitDefault,
795
+ duplicatesWindow: import_constants5.limitDefault,
796
+ instructionBuffer: import_constants5.limitDefault
1240
797
  }
1241
798
  },
1242
799
  deploymentDeviceLimit: 5e3,
1243
800
  selectedDeviceIds: [],
1244
801
  selectionState: {
1245
- finished: { ...DEVICE_LIST_DEFAULTS, endDate: void 0, search: "", selection: [], startDate: void 0, total: 0, type: "" },
1246
- inprogress: { ...DEVICE_LIST_DEFAULTS, perPage: DEFAULT_PENDING_INPROGRESS_COUNT, selection: [] },
1247
- pending: { ...DEVICE_LIST_DEFAULTS, perPage: DEFAULT_PENDING_INPROGRESS_COUNT, selection: [] },
1248
- scheduled: { ...DEVICE_LIST_DEFAULTS, selection: [] },
802
+ finished: { ...import_constants5.DEVICE_LIST_DEFAULTS, endDate: void 0, search: "", selection: [], startDate: void 0, total: 0, type: "" },
803
+ inprogress: { ...import_constants5.DEVICE_LIST_DEFAULTS, perPage: DEFAULT_PENDING_INPROGRESS_COUNT, selection: [] },
804
+ pending: { ...import_constants5.DEVICE_LIST_DEFAULTS, perPage: DEFAULT_PENDING_INPROGRESS_COUNT, selection: [] },
805
+ scheduled: { ...import_constants5.DEVICE_LIST_DEFAULTS, selection: [] },
1249
806
  general: {
1250
807
  state: DEPLOYMENT_ROUTES.active.key,
1251
808
  showCreationDialog: false,
@@ -1256,9 +813,9 @@ var initialState2 = {
1256
813
  selectedId: void 0
1257
814
  }
1258
815
  };
1259
- var deploymentsSlice = (0, import_toolkit2.createSlice)({
1260
- name: sliceName2,
1261
- initialState: initialState2,
816
+ var deploymentsSlice = (0, import_toolkit.createSlice)({
817
+ name: sliceName,
818
+ initialState,
1262
819
  reducers: {
1263
820
  createdDeployment: (state, action) => {
1264
821
  state.byId[action.payload.id] = {
@@ -1267,7 +824,8 @@ var deploymentsSlice = (0, import_toolkit2.createSlice)({
1267
824
  };
1268
825
  state.byStatus[DEPLOYMENT_STATES.pending].total = state.byStatus[DEPLOYMENT_STATES.pending].total + 1;
1269
826
  state.byStatus[DEPLOYMENT_STATES.pending].deploymentIds = [...state.byStatus.pending.deploymentIds, action.payload.id];
1270
- state.selectionState[DEPLOYMENT_STATES.pending].selection = [action.payload.id, ...state.selectionState[DEPLOYMENT_STATES.pending].selection], state.selectionState[DEPLOYMENT_STATES.pending].total = state.selectionState[DEPLOYMENT_STATES.pending].total + 1;
827
+ state.selectionState[DEPLOYMENT_STATES.pending].selection = [action.payload.id, ...state.selectionState[DEPLOYMENT_STATES.pending].selection];
828
+ state.selectionState[DEPLOYMENT_STATES.pending].total = (state.selectionState[DEPLOYMENT_STATES.pending].total || 0) + 1;
1271
829
  },
1272
830
  removedDeployment: (state, action) => {
1273
831
  const { [action.payload]: removedDeployment, ...remainder } = state.byId;
@@ -1329,9 +887,145 @@ var deploymentsSlice = (0, import_toolkit2.createSlice)({
1329
887
  }
1330
888
  }
1331
889
  });
1332
- var actions2 = deploymentsSlice.actions;
890
+ var actions = deploymentsSlice.actions;
1333
891
  var deploymentsSlice_default = deploymentsSlice.reducer;
1334
892
 
893
+ // src/appSlice/index.ts
894
+ var import_toolkit2 = require("@reduxjs/toolkit");
895
+ var sliceName2 = "app";
896
+ var getYesterday = () => {
897
+ const today = /* @__PURE__ */ new Date();
898
+ today.setDate(today.getDate() - 1);
899
+ return today.toISOString();
900
+ };
901
+ var initialState2 = {
902
+ cancelSource: void 0,
903
+ commit: "",
904
+ demoArtifactLink: "https://dgsbl4vditpls.cloudfront.net/mender-demo-artifact.mender",
905
+ hostAddress: null,
906
+ snackbar: {
907
+ action: void 0,
908
+ autoHideDuration: void 0,
909
+ message: "",
910
+ open: false,
911
+ preventClickToCopy: false
912
+ },
913
+ // return boolean rather than organization details
914
+ features: {
915
+ hasAuditlogs: false,
916
+ hasDeltaProgress: false,
917
+ hasMultitenancy: false,
918
+ hasDeviceConfig: false,
919
+ hasDeviceConnect: false,
920
+ hasFeedbackEnabled: false,
921
+ hasMonitor: false,
922
+ hasReporting: false,
923
+ isDemoMode: false,
924
+ isHosted: true,
925
+ isEnterprise: false
926
+ },
927
+ feedbackProbability: 0.3,
928
+ firstLoginAfterSignup: false,
929
+ hostedAnnouncement: "",
930
+ docsVersion: "",
931
+ recaptchaSiteKey: "",
932
+ searchState: {
933
+ deviceIds: [],
934
+ searchTerm: "",
935
+ searchTotal: 0,
936
+ isSearching: false,
937
+ sort: {
938
+ direction: import_constants5.SORTING_OPTIONS.desc
939
+ // key: null,
940
+ // scope: null
941
+ }
942
+ },
943
+ sentry: {
944
+ location: "",
945
+ replaysSessionSampleRate: 0.1,
946
+ tracesSampleRate: 1
947
+ },
948
+ stripeAPIKey: "",
949
+ trackerCode: "",
950
+ uploadsById: {
951
+ // id: { progress: 0, cancelSource: undefined }
952
+ },
953
+ newThreshold: getYesterday(),
954
+ offlineThreshold: getYesterday(),
955
+ versionInformation: {
956
+ Integration: "",
957
+ "Mender-Client": "",
958
+ "Mender-Artifact": "",
959
+ "Meta-Mender": ""
960
+ },
961
+ yesterday: void 0
962
+ };
963
+ var appSlice = (0, import_toolkit2.createSlice)({
964
+ name: sliceName2,
965
+ initialState: initialState2,
966
+ reducers: {
967
+ setFeatures: (state, action) => {
968
+ state.features = {
969
+ ...state.features,
970
+ ...action.payload
971
+ };
972
+ },
973
+ setSnackbar: (state, { payload }) => {
974
+ if (typeof payload === "string") {
975
+ state.snackbar.message = payload;
976
+ return;
977
+ }
978
+ const { message, autoHideDuration, action, preventClickToCopy = false } = payload;
979
+ state.snackbar = {
980
+ message,
981
+ autoHideDuration,
982
+ action,
983
+ preventClickToCopy,
984
+ open: !!message
985
+ };
986
+ },
987
+ setFirstLoginAfterSignup: (state, action) => {
988
+ state.firstLoginAfterSignup = action.payload;
989
+ },
990
+ setAnnouncement: (state, action) => {
991
+ state.hostedAnnouncement = action.payload;
992
+ },
993
+ setSearchState: (state, action) => {
994
+ state.searchState = {
995
+ ...state.searchState,
996
+ ...action.payload
997
+ };
998
+ },
999
+ setOfflineThreshold: (state, action) => {
1000
+ state.offlineThreshold = action.payload;
1001
+ },
1002
+ initUpload: (state, action) => {
1003
+ const { id, upload } = action.payload;
1004
+ state.uploadsById[id] = upload;
1005
+ },
1006
+ uploadProgress: (state, action) => {
1007
+ const { id, progress: progress2 } = action.payload;
1008
+ state.uploadsById[id] = {
1009
+ ...state.uploadsById[id],
1010
+ progress: progress2
1011
+ };
1012
+ },
1013
+ cleanUpUpload: (state, action) => {
1014
+ const { [action.payload]: current, ...remainder } = state.uploadsById;
1015
+ state.uploadsById = remainder;
1016
+ },
1017
+ setVersionInformation: (state, action) => {
1018
+ state.versionInformation = {
1019
+ ...state.versionInformation,
1020
+ ...action.payload
1021
+ };
1022
+ },
1023
+ setEnvironmentData: (state, action) => ({ ...state, ...action.payload })
1024
+ }
1025
+ });
1026
+ var actions2 = appSlice.actions;
1027
+ var appSlice_default = appSlice.reducer;
1028
+
1335
1029
  // src/devicesSlice/index.ts
1336
1030
  var import_helpers = require("@northern.tech/utils/helpers");
1337
1031
  var import_toolkit3 = require("@reduxjs/toolkit");
@@ -1344,26 +1038,30 @@ var initialState3 = {
1344
1038
  // }
1345
1039
  },
1346
1040
  byStatus: {
1347
- [DEVICE_STATES.accepted]: { deviceIds: [], total: 0 },
1041
+ [import_constants5.DEVICE_STATES.accepted]: { deviceIds: [], total: 0 },
1348
1042
  active: { deviceIds: [], total: 0 },
1349
1043
  inactive: { deviceIds: [], total: 0 },
1350
- [DEVICE_STATES.pending]: { deviceIds: [], total: 0 },
1351
- [DEVICE_STATES.preauth]: { deviceIds: [], total: 0 },
1352
- [DEVICE_STATES.rejected]: { deviceIds: [], total: 0 }
1044
+ [import_constants5.DEVICE_STATES.pending]: { deviceIds: [], total: 0 },
1045
+ [import_constants5.DEVICE_STATES.preauth]: { deviceIds: [], total: 0 },
1046
+ [import_constants5.DEVICE_STATES.rejected]: { deviceIds: [], total: 0 }
1353
1047
  },
1354
1048
  deviceList: {
1355
1049
  deviceIds: [],
1356
- ...DEVICE_LIST_DEFAULTS,
1050
+ ...import_constants5.DEVICE_LIST_DEFAULTS,
1357
1051
  selectedAttributes: [],
1358
1052
  selectedIssues: [],
1359
1053
  selection: [],
1360
1054
  sort: {
1361
- direction: SORTING_OPTIONS.desc
1055
+ direction: import_constants5.SORTING_OPTIONS.desc
1362
1056
  // key: null,
1363
1057
  // scope: null
1364
1058
  },
1365
- state: DEVICE_STATES.accepted,
1366
- total: 0
1059
+ state: import_constants5.DEVICE_STATES.accepted,
1060
+ total: 0,
1061
+ refreshTrigger: false,
1062
+ isLoading: false,
1063
+ detailsTab: "",
1064
+ open: false
1367
1065
  },
1368
1066
  filters: [
1369
1067
  // { key: 'device_type', value: 'raspberry', operator: '$eq', scope: 'inventory' }
@@ -1435,7 +1133,7 @@ var devicesSlice = (0, import_toolkit3.createSlice)({
1435
1133
  };
1436
1134
  },
1437
1135
  selectGroup: (state, { payload: group }) => {
1438
- state.deviceList.deviceIds = state.groups.byId[group] && state.groups.byId[group].deviceIds.length > 0 ? state.groups.byId[group].deviceIds : [];
1136
+ state.deviceList.deviceIds = group && state.groups.byId[group] && state.groups.byId[group].deviceIds && state.groups.byId[group].deviceIds.length > 0 ? state.groups.byId[group].deviceIds : [];
1439
1137
  state.groups.selectedGroup = group;
1440
1138
  },
1441
1139
  removeGroup: (state, action) => {
@@ -1487,9 +1185,6 @@ var devicesSlice = (0, import_toolkit3.createSlice)({
1487
1185
  const { count, status } = action.payload;
1488
1186
  state.byStatus[status].total = count;
1489
1187
  },
1490
- setTotalDevices: (state, action) => {
1491
- state.total = action.payload;
1492
- },
1493
1188
  setDeviceLimit: (state, action) => {
1494
1189
  state.limit = action.payload;
1495
1190
  },
@@ -1502,8 +1197,8 @@ var devicesSlice = (0, import_toolkit3.createSlice)({
1502
1197
  maybeUpdateDevicesByStatus: (state, action) => {
1503
1198
  const { deviceId, authId } = action.payload;
1504
1199
  const device = state.byId[deviceId];
1505
- const hasMultipleAuthSets = authId ? device.auth_sets.filter((authset) => authset.id !== authId).length > 0 : false;
1506
- if (!hasMultipleAuthSets && Object.values(DEVICE_STATES).includes(device.status)) {
1200
+ const hasMultipleAuthSets = authId && device.auth_sets ? device.auth_sets.filter((authset) => authset.id !== authId).length > 0 : false;
1201
+ if (!hasMultipleAuthSets && Object.values(import_constants5.DEVICE_STATES).includes(device.status)) {
1507
1202
  const deviceIds = state.byStatus[device.status].deviceIds.filter((id) => id !== deviceId);
1508
1203
  state.byStatus[device.status] = { deviceIds, total: Math.max(0, state.byStatus[device.status].total - 1) };
1509
1204
  }
@@ -1518,16 +1213,16 @@ var import_toolkit4 = require("@reduxjs/toolkit");
1518
1213
  var sliceName4 = "monitor";
1519
1214
  var initialState4 = {
1520
1215
  alerts: {
1521
- alertList: { ...DEVICE_LIST_DEFAULTS, total: 0 },
1216
+ alertList: { ...import_constants5.DEVICE_LIST_DEFAULTS, total: 0 },
1522
1217
  byDeviceId: {}
1523
1218
  },
1524
1219
  issueCounts: {
1525
- byType: Object.values(DEVICE_ISSUE_OPTIONS).reduce((accu, { key }) => ({ ...accu, [key]: { filtered: 0, total: 0 } }), {})
1220
+ byType: Object.keys(import_constants5.DEVICE_ISSUE_OPTIONS).reduce((accu, key) => ({ ...accu, [key]: { filtered: 0, total: 0 } }), {})
1526
1221
  },
1527
1222
  settings: {
1528
1223
  global: {
1529
1224
  channels: {
1530
- ...Object.keys(alertChannels).reduce((accu, item) => ({ ...accu, [item]: { enabled: true } }), {})
1225
+ ...Object.keys(import_constants5.alertChannels).reduce((accu, item) => ({ ...accu, [item]: { enabled: true } }), {})
1531
1226
  }
1532
1227
  }
1533
1228
  }
@@ -1576,9 +1271,7 @@ var onboardingSlice = (0, import_toolkit5.createSlice)({
1576
1271
  name: sliceName5,
1577
1272
  initialState: initialState5,
1578
1273
  reducers: {
1579
- setOnboardingState: (state, action) => {
1580
- return { ...state, ...action.payload };
1581
- },
1274
+ setOnboardingState: (state, action) => ({ ...state, ...action.payload }),
1582
1275
  setDemoArtifactPort: (state, action) => {
1583
1276
  state.demoArtifactPort = action.payload;
1584
1277
  },
@@ -1621,7 +1314,7 @@ var initialState6 = {
1621
1314
  tenants: [],
1622
1315
  selectedTenant: null,
1623
1316
  sort: {
1624
- direction: SORTING_OPTIONS.desc,
1317
+ direction: import_constants5.SORTING_OPTIONS.desc,
1625
1318
  key: "name"
1626
1319
  }
1627
1320
  },
@@ -1631,15 +1324,16 @@ var initialState6 = {
1631
1324
  auditlog: {
1632
1325
  events: [],
1633
1326
  selectionState: {
1634
- ...DEVICE_LIST_DEFAULTS,
1327
+ ...import_constants5.DEVICE_LIST_DEFAULTS,
1635
1328
  detail: void 0,
1636
1329
  endDate: void 0,
1637
1330
  selectedIssue: void 0,
1638
- sort: { direction: SORTING_OPTIONS.desc },
1331
+ sort: { direction: import_constants5.SORTING_OPTIONS.desc },
1639
1332
  startDate: void 0,
1640
1333
  total: 0,
1641
1334
  type: void 0,
1642
- user: void 0
1335
+ user: void 0,
1336
+ isLoading: false
1643
1337
  }
1644
1338
  },
1645
1339
  externalDeviceIntegrations: [
@@ -1677,6 +1371,12 @@ var organizationSlice = (0, import_toolkit6.createSlice)({
1677
1371
  setOrganization: (state, action) => {
1678
1372
  state.organization = { ...state.organization, ...action.payload };
1679
1373
  },
1374
+ setSubscription: (state, action) => {
1375
+ state.organization.subscription = { ...state.organization.subscription, ...action.payload };
1376
+ },
1377
+ setBillingProfile: (state, action) => {
1378
+ state.organization.billing_profile = action.payload;
1379
+ },
1680
1380
  setTenantListState: (state, action) => {
1681
1381
  state.tenantList = action.payload;
1682
1382
  },
@@ -1739,12 +1439,12 @@ var initialState7 = {
1739
1439
  */
1740
1440
  },
1741
1441
  releasesList: {
1742
- ...DEVICE_LIST_DEFAULTS,
1442
+ ...import_constants5.DEVICE_LIST_DEFAULTS,
1743
1443
  searchedIds: [],
1744
1444
  releaseIds: [],
1745
1445
  selection: [],
1746
1446
  sort: {
1747
- direction: SORTING_OPTIONS.desc,
1447
+ direction: import_constants5.SORTING_OPTIONS.desc,
1748
1448
  key: "modified"
1749
1449
  },
1750
1450
  isLoading: void 0,
@@ -1813,11 +1513,12 @@ var initialState8 = {
1813
1513
  retries: 0
1814
1514
  },
1815
1515
  permissionSetsById: {
1816
- ...defaultPermissionSets
1516
+ ...import_constants5.defaultPermissionSets
1817
1517
  },
1818
1518
  rolesById: {
1819
- ...rolesById
1519
+ ...import_constants5.rolesById
1820
1520
  },
1521
+ rolesInitialized: false,
1821
1522
  settingsInitialized: false,
1822
1523
  showConnectDeviceDialog: false,
1823
1524
  showFeedbackDialog: false,
@@ -1853,9 +1554,6 @@ var usersSlice = (0, import_toolkit8.createSlice)({
1853
1554
  state.byId[action.payload.id] = action.payload;
1854
1555
  state.currentUser = action.payload.id;
1855
1556
  },
1856
- createdUser: (state, action) => {
1857
- state.byId[0] = action.payload;
1858
- },
1859
1557
  removedUser: (state, action) => {
1860
1558
  const { [action.payload]: removedUser, ...byId } = state.byId;
1861
1559
  state.byId = byId;
@@ -1872,6 +1570,10 @@ var usersSlice = (0, import_toolkit8.createSlice)({
1872
1570
  },
1873
1571
  receivedRoles: (state, action) => {
1874
1572
  state.rolesById = action.payload;
1573
+ state.rolesInitialized = true;
1574
+ },
1575
+ finishedRoleInitialization: (state, action) => {
1576
+ state.rolesInitialized = action.payload;
1875
1577
  },
1876
1578
  createdRole: (state, action) => {
1877
1579
  state.rolesById[action.payload.name] = {
@@ -1902,7 +1604,7 @@ var usersSlice = (0, import_toolkit8.createSlice)({
1902
1604
  },
1903
1605
  setTooltipState: (state, action) => {
1904
1606
  const { id, readState = READ_STATES.read } = action.payload;
1905
- state.tooltips.byId[id].readState = readState;
1607
+ state.tooltips.byId[id] = { ...state.tooltips.byId[id], readState };
1906
1608
  },
1907
1609
  setTooltipsState: (state, action) => {
1908
1610
  state.tooltips.byId = {
@@ -1926,8 +1628,8 @@ var usersSlice_default = usersSlice.reducer;
1926
1628
 
1927
1629
  // src/actions.ts
1928
1630
  var actions_default = {
1929
- ...actions,
1930
1631
  ...actions2,
1632
+ ...actions,
1931
1633
  ...actions3,
1932
1634
  ...actions4,
1933
1635
  ...actions5,
@@ -1942,7 +1644,7 @@ var import_axios = __toESM(require("axios"), 1);
1942
1644
  // src/auth.ts
1943
1645
  var import_universal_cookie = __toESM(require("universal-cookie"), 1);
1944
1646
  var cookies = new import_universal_cookie.default();
1945
- var emptySession = Object.freeze({ token: "", exiresAt: void 0 });
1647
+ var emptySession = Object.freeze({ token: "", expiresAt: void 0 });
1946
1648
  var tokenCache = "";
1947
1649
  var getSessionInfo = () => {
1948
1650
  let sessionInfo = { ...emptySession };
@@ -1955,15 +1657,15 @@ var getSessionInfo = () => {
1955
1657
  return { ...emptySession };
1956
1658
  }
1957
1659
  if (!sessionInfo.token) {
1958
- let jwtTokenFromCookie = cookies.get("JWT", { doNotParse: true }) ?? "";
1660
+ const jwtTokenFromCookie = cookies.get("JWT", { doNotParse: true }) ?? "";
1959
1661
  if (jwtTokenFromCookie) {
1960
- setSessionInfo({ token: jwtTokenFromCookie, undefined: void 0 });
1662
+ setSessionInfo({ token: jwtTokenFromCookie });
1961
1663
  sessionInfo.token = jwtTokenFromCookie;
1962
1664
  cookies.remove("JWT");
1963
1665
  cookies.remove("JWT", { path: "/" });
1964
1666
  }
1965
1667
  }
1966
- sessionInfo.token = sessionInfo.token || void 0;
1668
+ sessionInfo.token = sessionInfo.token || "";
1967
1669
  tokenCache = sessionInfo.token;
1968
1670
  return sessionInfo;
1969
1671
  };
@@ -1979,7 +1681,6 @@ var cleanUp = () => {
1979
1681
  window.localStorage.removeItem("JWT");
1980
1682
  window.localStorage.removeItem("oauth");
1981
1683
  };
1982
- var maxSessionAge = 900;
1983
1684
 
1984
1685
  // src/api/general-api.ts
1985
1686
  var unauthorizedRedirect = (error) => {
@@ -2021,20 +1722,17 @@ var general_api_default = Api;
2021
1722
  // src/appSlice/selectors.ts
2022
1723
  var import_helpers2 = require("@northern.tech/utils/helpers");
2023
1724
  var import_toolkit9 = require("@reduxjs/toolkit");
2024
- var getAppDocsVersion = (state) => state.app.docsVersion;
2025
1725
  var getFeatures = (state) => state.app.features;
2026
1726
  var getFullVersionInformation = (state) => state.app.versionInformation;
2027
- var getDocsVersion = (0, import_toolkit9.createSelector)([getAppDocsVersion, getFeatures], (appDocsVersion, { isHosted }) => {
2028
- const docsVersion = appDocsVersion ? `${appDocsVersion}/` : "development/";
2029
- return isHosted ? "" : docsVersion;
2030
- });
2031
1727
  var getSearchState = (state) => state.app.searchState;
1728
+ var getUploads = (state) => state.app.uploadsById;
1729
+ var getIsUploading = (0, import_toolkit9.createSelector)([getUploads], (uploadsById) => !!Object.keys(uploadsById).length);
2032
1730
  var getSearchedDevices = (0, import_toolkit9.createSelector)([getSearchState], ({ deviceIds }) => deviceIds);
2033
1731
  var getVersionInformation = (0, import_toolkit9.createSelector)(
2034
1732
  [getFullVersionInformation, getFeatures],
2035
- ({ Integration, ...remainder }, { isHosted }) => isHosted && Integration !== "next" ? remainder : { ...remainder, Integration }
1733
+ ({ Integration: Integration2, ...remainder }, { isHosted }) => isHosted && Integration2 !== "next" ? remainder : { ...remainder, Integration: Integration2 }
2036
1734
  );
2037
- var getIsPreview = (0, import_toolkit9.createSelector)([getFullVersionInformation], ({ Integration }) => (0, import_helpers2.versionCompare)(Integration, "next") > -1);
1735
+ var getIsPreview = (0, import_toolkit9.createSelector)([getFullVersionInformation], ({ Integration: Integration2 }) => (0, import_helpers2.versionCompare)(Integration2, "next") > -1);
2038
1736
 
2039
1737
  // src/commonSelectors.ts
2040
1738
  var import_helpers5 = require("@northern.tech/utils/helpers");
@@ -2086,6 +1784,7 @@ var import_toolkit11 = require("@reduxjs/toolkit");
2086
1784
  var getAcceptedDevices = (state) => state.devices.byStatus.accepted;
2087
1785
  var getDevicesByStatus = (state) => state.devices.byStatus;
2088
1786
  var getDevicesById = (state) => state.devices.byId;
1787
+ var getDeviceReports = (state) => state.devices.reports;
2089
1788
  var getGroupsById = (state) => state.devices.groups.byId;
2090
1789
  var getSelectedGroup = (state) => state.devices.groups.selectedGroup;
2091
1790
  var getDeviceListState = (state) => state.devices.deviceList;
@@ -2117,7 +1816,7 @@ var getDeviceIdentityAttributes = (0, import_toolkit11.createSelector)(
2117
1816
  );
2118
1817
  var getDeviceCountsByStatus = (0, import_toolkit11.createSelector)(
2119
1818
  [getDevicesByStatus],
2120
- (byStatus) => Object.values(DEVICE_STATES).reduce((accu, state) => {
1819
+ (byStatus) => Object.values(import_constants5.DEVICE_STATES).reduce((accu, state) => {
2121
1820
  accu[state] = byStatus[state].total || 0;
2122
1821
  return accu;
2123
1822
  }, {})
@@ -2129,7 +1828,7 @@ var getSelectedGroupInfo = (0, import_toolkit11.createSelector)(
2129
1828
  let groupCount = acceptedDeviceTotal;
2130
1829
  let groupFilters = [];
2131
1830
  if (selectedGroup && groupsById[selectedGroup]) {
2132
- groupCount = groupsById[selectedGroup].total;
1831
+ groupCount = groupsById[selectedGroup].total || 0;
2133
1832
  groupFilters = groupsById[selectedGroup].filters || [];
2134
1833
  }
2135
1834
  return { groupCount, selectedGroup, groupFilters };
@@ -2140,13 +1839,18 @@ var getLimitMaxed = (0, import_toolkit11.createSelector)(
2140
1839
  ({ total: acceptedDevices = 0 }, deviceLimit) => Boolean(deviceLimit && deviceLimit <= acceptedDevices)
2141
1840
  );
2142
1841
  var getGroupsByIdWithoutUngrouped = (0, import_toolkit11.createSelector)([getGroupsById], ({ [UNGROUPED_GROUP.id]: ungrouped, ...groups }) => groups);
1842
+ var getGroupData = (0, import_toolkit11.createSelector)([getGroupsByIdWithoutUngrouped], (groups) => {
1843
+ const createdGroup = Object.keys(groups).length ? Object.keys(groups)[0] : void 0;
1844
+ const hasDynamicGroups = Object.values(groups).some((group) => !!group.id);
1845
+ return { createdGroup, hasDynamicGroups, groups };
1846
+ });
2143
1847
  var getGroups = (0, import_toolkit11.createSelector)([getGroupsById], (groupsById) => {
2144
1848
  const groupNames = Object.keys(groupsById).sort();
2145
1849
  const groupedGroups = Object.entries(groupsById).sort((a, b) => a[0].localeCompare(b[0])).reduce(
2146
1850
  (accu, [groupname, group]) => {
2147
1851
  const name = groupname === UNGROUPED_GROUP.id ? UNGROUPED_GROUP.name : groupname;
2148
1852
  const groupItem = { ...group, groupId: name, name: groupname };
2149
- if (group.filters?.length > 0) {
1853
+ if ((group.filters ?? []).length > 0) {
2150
1854
  if (groupname !== UNGROUPED_GROUP.id) {
2151
1855
  accu.dynamic.push(groupItem);
2152
1856
  } else {
@@ -2189,12 +1893,14 @@ var getOnboarding = (state) => state.onboarding;
2189
1893
 
2190
1894
  // src/organizationSlice/selectors.ts
2191
1895
  var import_toolkit12 = require("@reduxjs/toolkit");
1896
+ var import_dayjs = __toESM(require("dayjs"), 1);
1897
+ var import_relativeTime = __toESM(require("dayjs/plugin/relativeTime"), 1);
2192
1898
  var getOrganization = (state) => state.organization.organization;
2193
1899
  var getExternalIntegrations = (state) => state.organization.externalDeviceIntegrations;
2194
1900
  var getAuditLog = (state) => state.organization.auditlog.events;
2195
1901
  var getAuditLogSelectionState = (state) => state.organization.auditlog.selectionState;
2196
1902
  var getWebhookEvents = (state) => state.organization.webhooks.events;
2197
- var getWebhookEventTotal = (state) => state.organization.webhooks.eventTotal;
1903
+ var getWebhookEventTotal = (state) => state.organization.webhooks.eventsTotal;
2198
1904
  var getDeviceTwinIntegrations = (0, import_toolkit12.createSelector)(
2199
1905
  [getExternalIntegrations],
2200
1906
  (integrations) => integrations.filter((integration) => integration.id && EXTERNAL_PROVIDER[integration.provider]?.deviceTwin)
@@ -2215,22 +1921,31 @@ var getAuditLogEntry = (0, import_toolkit12.createSelector)([getAuditLog, getAud
2215
1921
  const [eventAction, eventTime] = atob(selectedId).split("|");
2216
1922
  return events.find((item) => item.action === eventAction && item.time === eventTime);
2217
1923
  });
1924
+ import_dayjs.default.extend(import_relativeTime.default);
1925
+ var newPricingIntroduction = (0, import_dayjs.default)("2025-06-03T00:00");
1926
+ var getHasCurrentPricing = (0, import_toolkit12.createSelector)(
1927
+ [getOrganization],
1928
+ ({ id }) => !!id && (0, import_dayjs.default)(parseInt(id.substring(0, 8), 16) * 1e3) >= newPricingIntroduction
1929
+ );
1930
+
1931
+ // src/releasesSlice/selectors.ts
1932
+ var import_toolkit13 = require("@reduxjs/toolkit");
2218
1933
 
2219
1934
  // src/utils.ts
2220
1935
  var import_helpers4 = require("@northern.tech/utils/helpers");
2221
1936
  var filterProcessors = {
2222
- [DEVICE_FILTERING_OPTIONS.$gt.key]: (val) => Number(val) || val,
2223
- [DEVICE_FILTERING_OPTIONS.$gte.key]: (val) => Number(val) || val,
2224
- [DEVICE_FILTERING_OPTIONS.$lt.key]: (val) => Number(val) || val,
2225
- [DEVICE_FILTERING_OPTIONS.$lte.key]: (val) => Number(val) || val,
2226
- [DEVICE_FILTERING_OPTIONS.$ltne.key]: (val) => Number(val) || val,
2227
- [DEVICE_FILTERING_OPTIONS.$in.key]: (val) => ("" + val).split(",").map((i) => i.trim()),
2228
- [DEVICE_FILTERING_OPTIONS.$nin.key]: (val) => ("" + val).split(",").map((i) => i.trim()),
2229
- [DEVICE_FILTERING_OPTIONS.$exists.key]: import_helpers4.yes,
2230
- [DEVICE_FILTERING_OPTIONS.$nexists.key]: () => false
1937
+ [import_constants5.DEVICE_FILTERING_OPTIONS.$gt.key]: (val) => Number(val) || val,
1938
+ [import_constants5.DEVICE_FILTERING_OPTIONS.$gte.key]: (val) => Number(val) || val,
1939
+ [import_constants5.DEVICE_FILTERING_OPTIONS.$lt.key]: (val) => Number(val) || val,
1940
+ [import_constants5.DEVICE_FILTERING_OPTIONS.$lte.key]: (val) => Number(val) || val,
1941
+ [import_constants5.DEVICE_FILTERING_OPTIONS.$ltne.key]: (val) => Number(val) || val,
1942
+ [import_constants5.DEVICE_FILTERING_OPTIONS.$in.key]: (val) => ("" + val).split(",").map((i) => i.trim()),
1943
+ [import_constants5.DEVICE_FILTERING_OPTIONS.$nin.key]: (val) => ("" + val).split(",").map((i) => i.trim()),
1944
+ [import_constants5.DEVICE_FILTERING_OPTIONS.$exists.key]: import_helpers4.yes,
1945
+ [import_constants5.DEVICE_FILTERING_OPTIONS.$nexists.key]: () => false
2231
1946
  };
2232
1947
  var filterAliases = {
2233
- $nexists: { alias: DEVICE_FILTERING_OPTIONS.$exists.key, value: false }
1948
+ $nexists: { alias: import_constants5.DEVICE_FILTERING_OPTIONS.$exists.key, value: false }
2234
1949
  };
2235
1950
  var mapFiltersToTerms = (filters) => filters.map((filter) => ({
2236
1951
  scope: filter.scope,
@@ -2246,40 +1961,45 @@ var mapTermsToFilters = (terms) => terms.map((term) => {
2246
1961
  return { scope: term.scope, key: term.attribute, operator, value: term.value };
2247
1962
  });
2248
1963
  var convertIssueOptionsToFilters = (issuesSelection, filtersState = {}) => issuesSelection.map((item) => {
2249
- if (typeof DEVICE_ISSUE_OPTIONS[item].filterRule.value === "function") {
2250
- return { ...DEVICE_ISSUE_OPTIONS[item].filterRule, value: DEVICE_ISSUE_OPTIONS[item].filterRule.value(filtersState) };
1964
+ if (typeof import_constants5.DEVICE_ISSUE_OPTIONS[item].filterRule.value === "function") {
1965
+ return { ...import_constants5.DEVICE_ISSUE_OPTIONS[item].filterRule, value: import_constants5.DEVICE_ISSUE_OPTIONS[item].filterRule.value(filtersState) };
2251
1966
  }
2252
- return DEVICE_ISSUE_OPTIONS[item].filterRule;
1967
+ return import_constants5.DEVICE_ISSUE_OPTIONS[item].filterRule;
2253
1968
  });
2254
- var convertDeviceListStateToFilters = ({ filters = [], group, groups = { byId: {} }, offlineThreshold, selectedIssues = [], status }) => {
1969
+ var convertDeviceListStateToFilters = ({
1970
+ filters = [],
1971
+ group,
1972
+ groups = { byId: {} },
1973
+ offlineThreshold,
1974
+ selectedIssues = [],
1975
+ status
1976
+ }) => {
2255
1977
  let applicableFilters = [...filters];
2256
1978
  if (typeof group === "string" && !(groups.byId[group]?.filters || applicableFilters).length) {
2257
- applicableFilters.push({ key: "group", value: group, operator: DEVICE_FILTERING_OPTIONS.$eq.key, scope: "system" });
1979
+ applicableFilters.push({ key: "group", value: group, operator: import_constants5.DEVICE_FILTERING_OPTIONS.$eq.key, scope: "system" });
2258
1980
  }
2259
1981
  const nonMonitorFilters = applicableFilters.filter(
2260
- (filter) => !Object.values(DEVICE_ISSUE_OPTIONS).some(
1982
+ (filter) => !Object.values(import_constants5.DEVICE_ISSUE_OPTIONS).some(
2261
1983
  ({ filterRule }) => filter.scope !== "inventory" && filterRule.scope === filter.scope && filterRule.key === filter.key
2262
1984
  )
2263
1985
  );
2264
1986
  const deviceIssueFilters = convertIssueOptionsToFilters(selectedIssues, { offlineThreshold });
2265
1987
  applicableFilters = [...nonMonitorFilters, ...deviceIssueFilters];
2266
- const effectiveFilters = status ? [...applicableFilters, { key: "status", value: status, operator: DEVICE_FILTERING_OPTIONS.$eq.key, scope: "identity" }] : applicableFilters;
1988
+ const effectiveFilters = status ? [...applicableFilters, { key: "status", value: status, operator: import_constants5.DEVICE_FILTERING_OPTIONS.$eq.key, scope: "identity" }] : applicableFilters;
2267
1989
  return { applicableFilters: nonMonitorFilters, filterTerms: mapFiltersToTerms(effectiveFilters) };
2268
1990
  };
2269
- var filterCompare = (filter, item) => Object.keys(emptyFilter).every((key) => item[key].toString() === filter[key].toString());
1991
+ var filterCompare = (filter, item) => Object.keys(emptyFilter).every((key) => item[key]?.toString() === filter[key]?.toString());
2270
1992
  var filtersFilter = (item, index, array) => {
2271
1993
  const firstIndex = array.findIndex((filter) => filterCompare(filter, item));
2272
1994
  return firstIndex === index;
2273
1995
  };
2274
- var listItemMapper = (byId, ids, { defaultObject = {}, cutOffSize = DEVICE_LIST_MAXIMUM_LENGTH }) => {
2275
- return ids.slice(0, cutOffSize).reduce((accu, id) => {
2276
- if (id && byId[id]) {
2277
- accu.push({ ...defaultObject, ...byId[id] });
2278
- }
2279
- return accu;
2280
- }, []);
2281
- };
2282
- var mergePermissions = (existingPermissions = { ...emptyUiPermissions }, addedPermissions) => Object.entries(existingPermissions).reduce(
1996
+ var listItemMapper = (byId, ids, { cutOffSize = DEVICE_LIST_MAXIMUM_LENGTH, defaultObject = {} }) => ids.slice(0, cutOffSize).reduce((accu, id) => {
1997
+ if (id && byId[id]) {
1998
+ accu.push({ ...defaultObject, ...byId[id] });
1999
+ }
2000
+ return accu;
2001
+ }, []);
2002
+ var mergePermissions = (existingPermissions = { ...import_constants5.emptyUiPermissions }, addedPermissions) => Object.entries(existingPermissions).reduce(
2283
2003
  (accu, [key, value]) => {
2284
2004
  let values;
2285
2005
  if (!accu[key]) {
@@ -2303,23 +2023,24 @@ var mapUserRolesToUiPermissions = (userRoles, roles) => userRoles.reduce(
2303
2023
  }
2304
2024
  return mergePermissions(accu, roles[roleId].uiPermissions);
2305
2025
  },
2306
- { ...emptyUiPermissions }
2026
+ { ...import_constants5.emptyUiPermissions }
2307
2027
  );
2308
2028
  var progress = ({ loaded, total }) => {
2309
2029
  let uploadProgress3 = loaded / total * 100;
2310
2030
  return uploadProgress3 = uploadProgress3 < 50 ? Math.ceil(uploadProgress3) : Math.round(uploadProgress3);
2311
2031
  };
2032
+ var extractErrorMessage = (err, fallback = "") => err.response?.data?.error?.message || err.response?.data?.error || err.error || err.message || fallback;
2312
2033
  var getComparisonCompatibleVersion = (version) => isNaN(version.charAt(0)) && version !== "next" ? "master" : version;
2313
2034
  var mapDeviceAttributes = (attributes = []) => attributes.reduce(
2314
2035
  (accu, attribute) => {
2315
- if (!(attribute.value && attribute.name) && attribute.scope === ATTRIBUTE_SCOPES.inventory) {
2036
+ if (!(attribute.value && attribute.name) && attribute.scope === import_constants5.ATTRIBUTE_SCOPES.inventory) {
2316
2037
  return accu;
2317
2038
  }
2318
- accu[attribute.scope || ATTRIBUTE_SCOPES.inventory] = {
2319
- ...accu[attribute.scope || ATTRIBUTE_SCOPES.inventory],
2039
+ accu[attribute.scope || import_constants5.ATTRIBUTE_SCOPES.inventory] = {
2040
+ ...accu[attribute.scope || import_constants5.ATTRIBUTE_SCOPES.inventory],
2320
2041
  [attribute.name]: attribute.value
2321
2042
  };
2322
- if (attribute.name === "device_type" && attribute.scope === ATTRIBUTE_SCOPES.inventory) {
2043
+ if (attribute.name === "device_type" && attribute.scope === import_constants5.ATTRIBUTE_SCOPES.inventory) {
2323
2044
  accu.inventory.device_type = [].concat(attribute.value);
2324
2045
  }
2325
2046
  return accu;
@@ -2329,39 +2050,44 @@ var mapDeviceAttributes = (attributes = []) => attributes.reduce(
2329
2050
  var isDarkMode = (mode) => mode === DARK_MODE;
2330
2051
 
2331
2052
  // src/releasesSlice/selectors.ts
2332
- var import_toolkit13 = require("@reduxjs/toolkit");
2333
2053
  var getSelectedReleaseId = (state) => state.releases.selectedRelease;
2334
2054
  var getReleasesById = (state) => state.releases.byId;
2335
2055
  var getReleaseTags = (state) => state.releases.tags;
2336
2056
  var getReleaseListState = (state) => state.releases.releasesList;
2337
2057
  var getListedReleases = (state) => state.releases.releasesList.releaseIds;
2338
- var getReleaseMappingDefaults = () => ({});
2058
+ var releaseDefaults = {};
2059
+ var getReleaseMappingDefaults = () => releaseDefaults;
2339
2060
  var getReleasesList = (0, import_toolkit13.createSelector)([getReleasesById, getListedReleases, getReleaseMappingDefaults], listItemMapper);
2340
2061
  var getReleaseTagsById = (0, import_toolkit13.createSelector)([getReleaseTags], (releaseTags) => releaseTags.reduce((accu, key) => ({ ...accu, [key]: key }), {}));
2341
2062
  var getHasReleases = (0, import_toolkit13.createSelector)(
2342
2063
  [getReleaseListState, getReleasesById],
2343
2064
  ({ searchTotal, total }, byId) => !!(Object.keys(byId).length || total || searchTotal)
2344
2065
  );
2345
- var getSelectedRelease = (0, import_toolkit13.createSelector)([getReleasesById, getSelectedReleaseId], (byId, id) => byId[id] ?? {});
2066
+ var getSelectedRelease = (0, import_toolkit13.createSelector)([getReleasesById, getSelectedReleaseId], (byId, id) => byId[id || ""] ?? {});
2067
+ var getSelectedReleases = (0, import_toolkit13.createSelector)([getReleaseListState, getReleasesList], ({ selection }, releases) => selection.map((index) => releases[index]));
2346
2068
 
2347
2069
  // src/usersSlice/selectors.ts
2348
2070
  var import_toolkit14 = require("@reduxjs/toolkit");
2071
+ var emptyObject = {};
2349
2072
  var getRolesById = (state) => state.users.rolesById;
2350
2073
  var getTooltipsById = (state) => state.users.tooltips.byId;
2351
2074
  var getGlobalSettings = (state) => state.users.globalSettings;
2352
2075
  var getCurrentUserId = (state) => state.users.currentUser;
2353
2076
  var getUsersById = (state) => state.users.byId;
2354
2077
  var getUsersList = (0, import_toolkit14.createSelector)([getUsersById], (usersById) => Object.values(usersById));
2355
- var getCurrentUser = (0, import_toolkit14.createSelector)([getUsersById, getCurrentUserId], (usersById, userId) => usersById[userId] ?? {});
2078
+ var getCurrentUser = (0, import_toolkit14.createSelector)(
2079
+ [getUsersById, getCurrentUserId],
2080
+ (usersById, userId) => userId ? usersById[userId] ?? emptyObject : emptyObject
2081
+ );
2356
2082
  var getUserSettings = (state) => state.users.userSettings;
2357
2083
  var getSelectedDeviceAttribute = (0, import_toolkit14.createSelector)(
2358
2084
  [getUserSettings],
2359
2085
  ({ columnSelection }) => columnSelection.map((attribute) => ({ attribute: attribute.key, scope: attribute.scope }))
2360
2086
  );
2361
2087
  var getIsDarkMode = (0, import_toolkit14.createSelector)([getUserSettings], ({ mode }) => isDarkMode(mode));
2362
- var getShowHelptips = (0, import_toolkit14.createSelector)(
2088
+ var getReadAllHelptips = (0, import_toolkit14.createSelector)(
2363
2089
  [getTooltipsById],
2364
- (tooltips) => Object.values(tooltips).reduce((accu, { readState }) => accu || readState === READ_STATES.unread, false)
2090
+ (tooltips) => Object.values(tooltips).every(({ readState }) => readState === READ_STATES.read)
2365
2091
  );
2366
2092
  var getTooltipsState = (0, import_toolkit14.createSelector)(
2367
2093
  [getTooltipsById, getUserSettings],
@@ -2375,7 +2101,7 @@ var getTooltipsState = (0, import_toolkit14.createSelector)(
2375
2101
  );
2376
2102
  var getHas2FA = (0, import_toolkit14.createSelector)(
2377
2103
  [getCurrentUser],
2378
- (currentUser) => currentUser.hasOwnProperty("tfa_status") && currentUser.tfa_status === twoFAStates.enabled
2104
+ (currentUser) => currentUser.hasOwnProperty("tfa_status") && currentUser.tfa_status === import_constants5.twoFAStates.enabled
2379
2105
  );
2380
2106
  var getIdAttribute = (0, import_toolkit14.createSelector)([getGlobalSettings], ({ id_attribute = { ...defaultIdAttribute } }) => id_attribute);
2381
2107
  var getOfflineThresholdSettings = (0, import_toolkit14.createSelector)([getGlobalSettings], ({ offlineThreshold }) => ({
@@ -2391,37 +2117,34 @@ var getIsEnterprise = (0, import_toolkit15.createSelector)(
2391
2117
  );
2392
2118
  var getAttrsEndpoint = (0, import_toolkit15.createSelector)(
2393
2119
  [getFeatures],
2394
- ({ hasReporting }) => hasReporting ? `${reportingApiUrl}/devices/search/attributes` : `${inventoryApiUrlV2}/filters/attributes`
2120
+ ({ hasReporting }) => hasReporting ? `${import_constants5.reportingApiUrl}/devices/search/attributes` : `${import_constants5.inventoryApiUrlV2}/filters/attributes`
2395
2121
  );
2396
2122
  var getSearchEndpoint = (0, import_toolkit15.createSelector)(
2397
2123
  [getFeatures],
2398
- ({ hasReporting }) => hasReporting ? `${reportingApiUrl}/devices/search` : `${inventoryApiUrlV2}/filters/search`
2399
- );
2400
- var getUserRoles = (0, import_toolkit15.createSelector)(
2401
- [getCurrentUser, getRolesById, getIsEnterprise, getFeatures, getOrganization],
2402
- (currentUser, rolesById2, isEnterprise, { isHosted, hasMultitenancy }, { plan = PLANS.os.id }) => {
2403
- const isAdmin = currentUser.roles?.length ? currentUser.roles.some((role) => role === rolesByName.admin) : !(hasMultitenancy || isEnterprise || isHosted && plan !== PLANS.os.id);
2404
- const uiPermissions = isAdmin ? mapUserRolesToUiPermissions([rolesByName.admin], rolesById2) : mapUserRolesToUiPermissions(currentUser.roles || [], rolesById2);
2405
- return { isAdmin, uiPermissions };
2406
- }
2124
+ ({ hasReporting }) => hasReporting ? `${import_constants5.reportingApiUrl}/devices/search` : `${import_constants5.inventoryApiUrlV2}/filters/search`
2407
2125
  );
2126
+ var getUserRoles = (0, import_toolkit15.createSelector)([getCurrentUser, getRolesById, getIsEnterprise], (currentUser, rolesById2, isEnterprise) => {
2127
+ const isAdmin = currentUser.roles?.length ? currentUser.roles.some((role) => role === import_constants5.rolesByName.admin) : !isEnterprise;
2128
+ const uiPermissions = isAdmin ? mapUserRolesToUiPermissions([import_constants5.rolesByName.admin], rolesById2) : mapUserRolesToUiPermissions(currentUser.roles || [], rolesById2);
2129
+ return { isAdmin, uiPermissions };
2130
+ });
2408
2131
  var hasPermission = (thing, permission) => Object.values(thing).some((permissions) => permissions.includes(permission));
2409
2132
  var getUserCapabilities = (0, import_toolkit15.createSelector)([getUserRoles, getIsServiceProvider], ({ uiPermissions }, isServiceProvider) => {
2410
- const canManageReleases = hasPermission(uiPermissions.releases, uiPermissionsById.manage.value);
2411
- const canReadReleases = canManageReleases || hasPermission(uiPermissions.releases, uiPermissionsById.read.value);
2412
- const canUploadReleases = canManageReleases || hasPermission(uiPermissions.releases, uiPermissionsById.upload.value);
2413
- const canAuditlog = uiPermissions.auditlog.includes(uiPermissionsById.read.value);
2414
- const canReadUsers = uiPermissions.userManagement.includes(uiPermissionsById.read.value);
2415
- const canManageUsers = uiPermissions.userManagement.includes(uiPermissionsById.manage.value);
2416
- const canReadDevices = hasPermission(uiPermissions.groups, uiPermissionsById.read.value);
2133
+ const canManageReleases = hasPermission(uiPermissions.releases, import_constants5.uiPermissionsById.manage.value);
2134
+ const canReadReleases = canManageReleases || hasPermission(uiPermissions.releases, import_constants5.uiPermissionsById.read.value);
2135
+ const canUploadReleases = canManageReleases || hasPermission(uiPermissions.releases, import_constants5.uiPermissionsById.upload.value);
2136
+ const canAuditlog = uiPermissions.auditlog.includes(import_constants5.uiPermissionsById.read.value);
2137
+ const canReadUsers = uiPermissions.userManagement.includes(import_constants5.uiPermissionsById.read.value);
2138
+ const canManageUsers = uiPermissions.userManagement.includes(import_constants5.uiPermissionsById.manage.value);
2139
+ const canReadDevices = hasPermission(uiPermissions.groups, import_constants5.uiPermissionsById.read.value);
2417
2140
  const canWriteDevices = Object.values(uiPermissions.groups).some(
2418
- (groupPermissions) => groupPermissions.includes(uiPermissionsById.read.value) && groupPermissions.length > 1
2141
+ (groupPermissions) => groupPermissions.includes(import_constants5.uiPermissionsById.read.value) && groupPermissions.length > 1
2419
2142
  );
2420
- const canTroubleshoot = hasPermission(uiPermissions.groups, uiPermissionsById.connect.value);
2421
- const canManageDevices = hasPermission(uiPermissions.groups, uiPermissionsById.manage.value);
2422
- const canConfigure = hasPermission(uiPermissions.groups, uiPermissionsById.configure.value);
2423
- const canDeploy = uiPermissions.deployments.includes(uiPermissionsById.deploy.value) || hasPermission(uiPermissions.groups, uiPermissionsById.deploy.value);
2424
- const canReadDeployments = uiPermissions.deployments.includes(uiPermissionsById.read.value);
2143
+ const canTroubleshoot = hasPermission(uiPermissions.groups, import_constants5.uiPermissionsById.connect.value);
2144
+ const canManageDevices = hasPermission(uiPermissions.groups, import_constants5.uiPermissionsById.manage.value);
2145
+ const canConfigure = hasPermission(uiPermissions.groups, import_constants5.uiPermissionsById.configure.value);
2146
+ const canDeploy = uiPermissions.deployments.includes(import_constants5.uiPermissionsById.deploy.value) || hasPermission(uiPermissions.groups, import_constants5.uiPermissionsById.deploy.value);
2147
+ const canReadDeployments = uiPermissions.deployments.includes(import_constants5.uiPermissionsById.read.value);
2425
2148
  return {
2426
2149
  canAuditlog,
2427
2150
  canConfigure,
@@ -2472,11 +2195,11 @@ var getTenantCapabilities = (0, import_toolkit15.createSelector)(
2472
2195
  var getFilterAttributes = (0, import_toolkit15.createSelector)(
2473
2196
  [getGlobalSettings, getFilteringAttributes],
2474
2197
  ({ previousFilters }, { identityAttributes, inventoryAttributes, systemAttributes, tagAttributes }) => {
2475
- const deviceNameAttribute = { key: "name", value: "Name", scope: ATTRIBUTE_SCOPES.tags, category: ATTRIBUTE_SCOPES.tags, priority: 1 };
2476
- const deviceIdAttribute = { key: "id", value: "Device ID", scope: ATTRIBUTE_SCOPES.identity, category: ATTRIBUTE_SCOPES.identity, priority: 1 };
2477
- const checkInAttribute = { key: "check_in_time", value: "Latest activity", scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };
2198
+ const deviceNameAttribute = { key: "name", value: "Name", scope: import_constants5.ATTRIBUTE_SCOPES.tags, category: import_constants5.ATTRIBUTE_SCOPES.tags, priority: 1 };
2199
+ const deviceIdAttribute = { key: "id", value: "Device ID", scope: import_constants5.ATTRIBUTE_SCOPES.identity, category: import_constants5.ATTRIBUTE_SCOPES.identity, priority: 1 };
2200
+ const checkInAttribute = { key: "check_in_time", value: "Latest activity", scope: import_constants5.ATTRIBUTE_SCOPES.system, category: import_constants5.ATTRIBUTE_SCOPES.system, priority: 4 };
2478
2201
  const updateAttribute = { ...checkInAttribute, key: "updated_ts", value: "Last inventory update" };
2479
- const firstRequestAttribute = { key: "created_ts", value: "First request", scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };
2202
+ const firstRequestAttribute = { key: "created_ts", value: "First request", scope: import_constants5.ATTRIBUTE_SCOPES.system, category: import_constants5.ATTRIBUTE_SCOPES.system, priority: 4 };
2480
2203
  const attributes = [
2481
2204
  ...previousFilters.map((item) => ({
2482
2205
  ...item,
@@ -2486,13 +2209,13 @@ var getFilterAttributes = (0, import_toolkit15.createSelector)(
2486
2209
  })),
2487
2210
  deviceNameAttribute,
2488
2211
  deviceIdAttribute,
2489
- ...identityAttributes.map((item) => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.identity, category: ATTRIBUTE_SCOPES.identity, priority: 1 })),
2490
- ...inventoryAttributes.map((item) => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.inventory, category: ATTRIBUTE_SCOPES.inventory, priority: 2 })),
2491
- ...tagAttributes.map((item) => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.tags, category: ATTRIBUTE_SCOPES.tags, priority: 3 })),
2212
+ ...identityAttributes.map((item) => ({ key: item, value: item, scope: import_constants5.ATTRIBUTE_SCOPES.identity, category: import_constants5.ATTRIBUTE_SCOPES.identity, priority: 1 })),
2213
+ ...inventoryAttributes.map((item) => ({ key: item, value: item, scope: import_constants5.ATTRIBUTE_SCOPES.inventory, category: import_constants5.ATTRIBUTE_SCOPES.inventory, priority: 2 })),
2214
+ ...tagAttributes.map((item) => ({ key: item, value: item, scope: import_constants5.ATTRIBUTE_SCOPES.tags, category: import_constants5.ATTRIBUTE_SCOPES.tags, priority: 3 })),
2492
2215
  checkInAttribute,
2493
2216
  updateAttribute,
2494
2217
  firstRequestAttribute,
2495
- ...systemAttributes.map((item) => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 }))
2218
+ ...systemAttributes.map((item) => ({ key: item, value: item, scope: import_constants5.ATTRIBUTE_SCOPES.system, category: import_constants5.ATTRIBUTE_SCOPES.system, priority: 4 }))
2496
2219
  ];
2497
2220
  return (0, import_helpers5.attributeDuplicateFilter)(attributes, "key");
2498
2221
  }
@@ -2534,7 +2257,7 @@ var getSelectedDeploymentData = (0, import_toolkit15.createSelector)(
2534
2257
  );
2535
2258
  var getAvailableIssueOptionsByType = (0, import_toolkit15.createSelector)(
2536
2259
  [getFeatures, getTenantCapabilities, getIssueCountsByType],
2537
- ({ hasReporting }, { hasFullFiltering, hasMonitor }, issueCounts) => Object.values(DEVICE_ISSUE_OPTIONS).reduce((accu, { isCategory, key, needsFullFiltering, needsMonitor, needsReporting, title }) => {
2260
+ ({ hasReporting }, { hasFullFiltering, hasMonitor }, issueCounts) => Object.values(import_constants5.DEVICE_ISSUE_OPTIONS).reduce((accu, { isCategory, key, needsFullFiltering, needsMonitor, needsReporting, title }) => {
2538
2261
  if (isCategory || needsReporting && !hasReporting || needsFullFiltering && !hasFullFiltering || needsMonitor && !hasMonitor) {
2539
2262
  return accu;
2540
2263
  }
@@ -2542,14 +2265,11 @@ var getAvailableIssueOptionsByType = (0, import_toolkit15.createSelector)(
2542
2265
  return accu;
2543
2266
  }, {})
2544
2267
  );
2545
- var getGroupNames = (0, import_toolkit15.createSelector)([getGroupsById, getUserRoles, (_, options = {}) => options], (groupsById, { uiPermissions }, { staticOnly }) => {
2268
+ var getGroupNames = (0, import_toolkit15.createSelector)([getGroupsById, getUserRoles], (groupsById, { uiPermissions }) => {
2546
2269
  const { [UNGROUPED_GROUP.id]: ungrouped, ...groups } = groupsById;
2547
- if (staticOnly) {
2548
- return Object.keys(uiPermissions.groups).sort();
2549
- }
2550
2270
  return Object.keys(
2551
2271
  Object.entries(groups).reduce((accu, [groupName, group]) => {
2552
- if (group.filterId || uiPermissions.groups[ALL_DEVICES]) {
2272
+ if (group.filterId || uiPermissions.groups[import_constants5.ALL_DEVICES]) {
2553
2273
  accu[groupName] = group;
2554
2274
  }
2555
2275
  return accu;
@@ -2558,9 +2278,7 @@ var getGroupNames = (0, import_toolkit15.createSelector)([getGroupsById, getUser
2558
2278
  });
2559
2279
  var getDeviceReportsForUser = (0, import_toolkit15.createSelector)(
2560
2280
  [getUserSettings, getCurrentUser, getGlobalSettings, getDevicesById],
2561
- ({ reports }, { id: currentUserId }, globalSettings, devicesById) => {
2562
- return reports || globalSettings[`${currentUserId}-reports`] || (Object.keys(devicesById).length ? defaultReports : []);
2563
- }
2281
+ ({ reports }, { id: currentUserId }, globalSettings, devicesById) => reports || globalSettings[`${currentUserId}-reports`] || (Object.keys(devicesById).length ? defaultReports : [])
2564
2282
  );
2565
2283
  var listTypeDeviceIdMap = {
2566
2284
  deviceList: getListedDevices,
@@ -2584,14 +2302,14 @@ var getAuditlogDevice = (0, import_toolkit15.createSelector)([getAuditLogEntry,
2584
2302
  var getRelevantRoles = (0, import_toolkit15.createSelector)([getOrganization, getRolesList], ({ service_provider }, roles) => {
2585
2303
  if (service_provider) {
2586
2304
  return roles.reduce((accu, role) => {
2587
- if (rolesById[role.value]) {
2305
+ if (import_constants5.rolesById[role.value]) {
2588
2306
  return accu;
2589
2307
  }
2590
2308
  accu.push(role);
2591
2309
  return accu;
2592
- }, Object.values(serviceProviderRolesById));
2310
+ }, Object.values(import_constants5.serviceProviderRolesById));
2593
2311
  }
2594
- return Object.keys(rolesById).reverse().reduce((accu, key) => {
2312
+ return Object.keys(import_constants5.rolesById).reverse().reduce((accu, key) => {
2595
2313
  const index = accu.findIndex(({ value }) => value === key);
2596
2314
  accu = [accu[index], ...accu.filter((item, itemIndex) => index !== itemIndex)];
2597
2315
  return accu;
@@ -2602,6 +2320,7 @@ var getRelevantRoles = (0, import_toolkit15.createSelector)([getOrganization, ge
2602
2320
  var import_react_redux = require("react-redux");
2603
2321
  var import_helpers6 = require("@northern.tech/utils/helpers");
2604
2322
  var import_toolkit16 = require("@reduxjs/toolkit");
2323
+ var import_react = require("@sentry/react");
2605
2324
  var { setSnackbar, uploadProgress } = actions_default;
2606
2325
  var keys = ["sessionDeploymentChecker", settingsKeys.initialized];
2607
2326
  var resetEnvironment = () => keys.forEach((key) => window.sessionStorage.removeItem(key));
@@ -2638,20 +2357,50 @@ var rejectionLoggerMiddleware = () => (next) => (action) => {
2638
2357
  }
2639
2358
  return next(action);
2640
2359
  };
2360
+ var tracingActionIgnoreList = [actions8.successfullyLoggedIn.type, "users/loginUser/pending", "users/loginUser/fulfilled", "users/loginUser/rejected"];
2361
+ var sentryReduxEnhancer = (0, import_react.createReduxEnhancer)({
2362
+ actionTransformer: (action) => {
2363
+ if (tracingActionIgnoreList.includes(action.type)) {
2364
+ return null;
2365
+ }
2366
+ return action;
2367
+ },
2368
+ // Transform the state to remove sensitive information
2369
+ stateTransformer: (state) => {
2370
+ const transformedState = {
2371
+ ...state,
2372
+ users: { ...state.users, currentSession: null },
2373
+ organization: {
2374
+ ...state.organization,
2375
+ organization: {
2376
+ ...state.organization.organization,
2377
+ tenant_token: null
2378
+ }
2379
+ }
2380
+ };
2381
+ return transformedState;
2382
+ }
2383
+ });
2641
2384
  var getConfiguredStore = (options = {}) => {
2642
2385
  const { preloadedState = {}, ...config } = options;
2643
2386
  return (0, import_toolkit16.configureStore)({
2644
2387
  ...config,
2645
2388
  preloadedState,
2389
+ enhancers: (getDefaultEnhancers) => {
2390
+ if (window.mender_environment?.sentry?.isReduxEnabled) {
2391
+ return getDefaultEnhancers().concat(sentryReduxEnhancer);
2392
+ }
2393
+ return getDefaultEnhancers();
2394
+ },
2646
2395
  reducer: sessionReducer,
2647
2396
  middleware: (getDefaultMiddleware) => getDefaultMiddleware({
2648
2397
  immutableCheck: {
2649
2398
  ignoredPaths: ["app.uploadsById"]
2650
2399
  },
2651
2400
  serializableCheck: {
2652
- ignoredActions: [actions6.receiveExternalDeviceIntegrations.name, setSnackbar.name, uploadProgress.name],
2653
- ignoredActionPaths: ["uploads", "snackbar", /payload\..*$/],
2654
- ignoredPaths: ["app.uploadsById", "app.snackbar", "organization.externalDeviceIntegrations"]
2401
+ ignoredActions: [actions6.receiveExternalDeviceIntegrations.name, uploadProgress.name],
2402
+ ignoredActionPaths: ["uploads", /payload\..*$/, "meta.arg.file", "meta.arg.integration.configHint"],
2403
+ ignoredPaths: ["app.uploadsById", "organization.externalDeviceIntegrations"]
2655
2404
  }
2656
2405
  }).concat(rejectionLoggerMiddleware)
2657
2406
  });
@@ -2659,21 +2408,21 @@ var getConfiguredStore = (options = {}) => {
2659
2408
  var store = getConfiguredStore({
2660
2409
  preloadedState: {}
2661
2410
  });
2411
+ var createAppAsyncThunk = import_toolkit16.createAsyncThunk.withTypes();
2662
2412
 
2663
2413
  // src/appSlice/thunks.ts
2664
2414
  var import_helpers7 = require("@northern.tech/utils/helpers");
2665
- var import_toolkit17 = require("@reduxjs/toolkit");
2666
2415
  var import_universal_cookie2 = __toESM(require("universal-cookie"), 1);
2667
2416
  var cookies2 = new import_universal_cookie2.default();
2668
- var setFirstLoginAfterSignup = (0, import_toolkit17.createAsyncThunk)(`${sliceName}/setFirstLoginAfterSignup`, (firstLoginAfterSignup, { dispatch }) => {
2417
+ var setFirstLoginAfterSignup = createAppAsyncThunk(`${sliceName2}/setFirstLoginAfterSignup`, (firstLoginAfterSignup, { dispatch }) => {
2669
2418
  cookies2.set("firstLoginAfterSignup", !!firstLoginAfterSignup, { maxAge: 60, path: "/", domain: ".mender.io", sameSite: false });
2670
- dispatch(actions.setFirstLoginAfterSignup(!!firstLoginAfterSignup));
2419
+ dispatch(actions2.setFirstLoginAfterSignup(!!firstLoginAfterSignup));
2671
2420
  });
2672
2421
  var dateFunctionMap = {
2673
2422
  getDays: "getDate",
2674
2423
  setDays: "setDate"
2675
2424
  };
2676
- var setOfflineThreshold = (0, import_toolkit17.createAsyncThunk)(`${sliceName}/setOfflineThreshold`, (_, { dispatch, getState }) => {
2425
+ var setOfflineThreshold = createAppAsyncThunk(`${sliceName2}/setOfflineThreshold`, (_, { dispatch, getState }) => {
2677
2426
  const { interval, intervalUnit } = getOfflineThresholdSettings(getState());
2678
2427
  const today = /* @__PURE__ */ new Date();
2679
2428
  const intervalName = `${intervalUnit.charAt(0).toUpperCase()}${intervalUnit.substring(1)}`;
@@ -2684,9 +2433,9 @@ var setOfflineThreshold = (0, import_toolkit17.createAsyncThunk)(`${sliceName}/s
2684
2433
  try {
2685
2434
  value = today.toISOString();
2686
2435
  } catch {
2687
- return Promise.resolve(dispatch(actions.setSnackbar("There was an error saving the offline threshold, please check your settings.")));
2436
+ return Promise.resolve(dispatch(actions2.setSnackbar("There was an error saving the offline threshold, please check your settings.")));
2688
2437
  }
2689
- return Promise.resolve(dispatch(actions.setOfflineThreshold(value)));
2438
+ return Promise.resolve(dispatch(actions2.setOfflineThreshold(value)));
2690
2439
  });
2691
2440
  var versionRegex = new RegExp(/\d+\.\d+/);
2692
2441
  var getLatestRelease = (thing) => {
@@ -2698,12 +2447,11 @@ var repoKeyMap = {
2698
2447
  mender: "Mender-Client",
2699
2448
  "mender-artifact": "Mender-Artifact"
2700
2449
  };
2701
- var deductSaasState = (latestRelease, guiTags, saasReleases) => {
2450
+ var deductSaasState = (latestRelease, guiTags) => {
2702
2451
  const latestGuiTag = guiTags.length ? guiTags[0].name : "";
2703
- const latestSaasRelease = latestGuiTag.startsWith("saas-v") ? { date: latestGuiTag.split("-v")[1].replaceAll(".", "-"), tag: latestGuiTag } : saasReleases[0];
2704
- return latestSaasRelease.date > latestRelease.release_date ? latestSaasRelease.tag : latestRelease.release;
2452
+ return latestGuiTag ? latestGuiTag : latestRelease.release;
2705
2453
  };
2706
- var getLatestReleaseInfo = (0, import_toolkit17.createAsyncThunk)(`${sliceName}/getLatestReleaseInfo`, (_, { dispatch, getState }) => {
2454
+ var getLatestReleaseInfo = createAppAsyncThunk(`${sliceName2}/getLatestReleaseInfo`, (_, { dispatch, getState }) => {
2707
2455
  if (!getFeatures(getState()).isHosted) {
2708
2456
  return Promise.resolve();
2709
2457
  }
@@ -2714,7 +2462,7 @@ var getLatestReleaseInfo = (0, import_toolkit17.createAsyncThunk)(`${sliceName}/
2714
2462
  if (!guiTags.length) {
2715
2463
  return Promise.resolve();
2716
2464
  }
2717
- const { releases, saas } = data;
2465
+ const { releases } = data;
2718
2466
  const latestRelease = getLatestRelease(getLatestRelease(releases));
2719
2467
  const { latestRepos, latestVersions } = latestRelease.repos.reduce(
2720
2468
  (accu, item) => {
@@ -2726,13 +2474,12 @@ var getLatestReleaseInfo = (0, import_toolkit17.createAsyncThunk)(`${sliceName}/
2726
2474
  },
2727
2475
  { latestVersions: { ...getState().app.versionInformation }, latestRepos: {} }
2728
2476
  );
2729
- const info = deductSaasState(latestRelease, guiTags, saas);
2477
+ const info = deductSaasState(latestRelease, guiTags);
2730
2478
  return Promise.resolve(
2731
2479
  dispatch(
2732
- actions.setVersionInformation({
2480
+ actions2.setVersionInformation({
2733
2481
  ...latestVersions,
2734
- backend: info,
2735
- GUI: info,
2482
+ Server: info,
2736
2483
  latestRelease: {
2737
2484
  releaseDate: latestRelease.release_date,
2738
2485
  repos: latestRepos
@@ -2742,9 +2489,9 @@ var getLatestReleaseInfo = (0, import_toolkit17.createAsyncThunk)(`${sliceName}/
2742
2489
  );
2743
2490
  });
2744
2491
  });
2745
- var setSearchState = (0, import_toolkit17.createAsyncThunk)(`${sliceName}/setSearchState`, (searchState, { dispatch, getState }) => {
2492
+ var setSearchState = createAppAsyncThunk(`${sliceName2}/setSearchState`, (searchState, { dispatch, getState }) => {
2746
2493
  const currentState = getSearchState(getState());
2747
- let nextState = {
2494
+ const nextState = {
2748
2495
  ...currentState,
2749
2496
  ...searchState,
2750
2497
  sort: {
@@ -2752,7 +2499,7 @@ var setSearchState = (0, import_toolkit17.createAsyncThunk)(`${sliceName}/setSea
2752
2499
  ...searchState.sort
2753
2500
  }
2754
2501
  };
2755
- let tasks = [];
2502
+ const tasks = [];
2756
2503
  const { isSearching: currentSearching, deviceIds: currentDevices, searchTotal: currentTotal, ...currentRequestState } = currentState;
2757
2504
  const { isSearching: nextSearching, deviceIds: nextDevices, searchTotal: nextTotal, ...nextRequestState } = nextState;
2758
2505
  if (nextRequestState.searchTerm && !(0, import_helpers7.deepCompare)(currentRequestState, nextRequestState)) {
@@ -2760,24 +2507,23 @@ var setSearchState = (0, import_toolkit17.createAsyncThunk)(`${sliceName}/setSea
2760
2507
  tasks.push(
2761
2508
  dispatch(searchDevices(nextState)).unwrap().then((results) => {
2762
2509
  const searchResult = results[results.length - 1];
2763
- return dispatch(actions.setSearchState({ ...searchResult, isSearching: false }));
2764
- }).catch(() => dispatch(actions.setSearchState({ isSearching: false, searchTotal: 0 })))
2510
+ return dispatch(actions2.setSearchState({ ...searchResult, isSearching: false }));
2511
+ }).catch(() => dispatch(actions2.setSearchState({ isSearching: false, searchTotal: 0 })))
2765
2512
  );
2766
2513
  }
2767
- tasks.push(dispatch(actions.setSearchState(nextState)));
2514
+ tasks.push(dispatch(actions2.setSearchState(nextState)));
2768
2515
  return Promise.all(tasks);
2769
2516
  });
2770
2517
 
2771
2518
  // src/devicesSlice/thunks.tsx
2772
2519
  var import_react_router_dom = require("react-router-dom");
2773
2520
  var import_helpers8 = require("@northern.tech/utils/helpers");
2774
- var import_toolkit18 = require("@reduxjs/toolkit");
2775
2521
  var import_axios2 = require("axios");
2776
2522
  var import_pluralize = __toESM(require("pluralize"), 1);
2777
2523
  var import_uuid = require("uuid");
2778
2524
  var import_jsx_runtime2 = require("react/jsx-runtime");
2779
2525
  var { cleanUpUpload, initUpload, setSnackbar: setSnackbar2, uploadProgress: uploadProgress2 } = actions_default;
2780
- var { page: defaultPage, perPage: defaultPerPage } = DEVICE_LIST_DEFAULTS;
2526
+ var { page: defaultPage, perPage: defaultPerPage } = import_constants5.DEVICE_LIST_DEFAULTS;
2781
2527
  var defaultAttributes = [
2782
2528
  { scope: "identity", attribute: "status" },
2783
2529
  { scope: "inventory", attribute: "artifact_name" },
@@ -2792,9 +2538,9 @@ var defaultAttributes = [
2792
2538
  { scope: "system", attribute: "group" },
2793
2539
  { scope: "tags", attribute: "name" }
2794
2540
  ];
2795
- var getGroups2 = (0, import_toolkit18.createAsyncThunk)(
2541
+ var getGroups2 = createAppAsyncThunk(
2796
2542
  `${sliceName3}/getGroups`,
2797
- (_, { dispatch, getState }) => general_api_default.get(`${inventoryApiUrl}/groups`).then((res) => {
2543
+ (_, { dispatch, getState }) => general_api_default.get(`${import_constants5.inventoryApiUrl}/groups`).then((res) => {
2798
2544
  const state = getGroupsById(getState());
2799
2545
  const dynamicGroups = Object.entries(state).reduce((accu, [id, group]) => {
2800
2546
  if (group.id || group.filters?.length && id !== UNGROUPED_GROUP.id) {
@@ -2806,10 +2552,10 @@ var getGroups2 = (0, import_toolkit18.createAsyncThunk)(
2806
2552
  accu[group] = { deviceIds: [], filters: [], total: 0, ...state[group] };
2807
2553
  return accu;
2808
2554
  }, dynamicGroups);
2809
- const filters = [{ key: "group", value: res.data, operator: DEVICE_FILTERING_OPTIONS.$nin.key, scope: "system" }];
2555
+ const filters = [{ key: "group", value: res.data, operator: import_constants5.DEVICE_FILTERING_OPTIONS.$nin.key, scope: "system" }];
2810
2556
  return Promise.all([
2811
2557
  dispatch(actions3.receivedGroups(groups)),
2812
- dispatch(getDevicesByStatus2({ filterSelection: filters, group: 0, page: 1, perPage: 1, status: void 0 }))
2558
+ dispatch(getDevicesByStatus2({ filterSelection: filters, group: "", page: 1, perPage: 1, status: void 0 }))
2813
2559
  ]).then((promises) => {
2814
2560
  const devicesRetrieval = promises[promises.length - 1] || [];
2815
2561
  const { payload } = devicesRetrieval || {};
@@ -2821,46 +2567,49 @@ var getGroups2 = (0, import_toolkit18.createAsyncThunk)(
2821
2567
  dispatch(
2822
2568
  actions3.addGroup({
2823
2569
  groupName: UNGROUPED_GROUP.id,
2824
- group: { filters: [{ key: "group", value: res.data, operator: DEVICE_FILTERING_OPTIONS.$nin.key, scope: "system" }] }
2570
+ group: { filters: [{ key: "group", value: res.data, operator: import_constants5.DEVICE_FILTERING_OPTIONS.$nin.key, scope: "system" }] }
2825
2571
  })
2826
2572
  )
2827
2573
  );
2828
2574
  });
2829
2575
  })
2830
2576
  );
2831
- var addDevicesToGroup = (0, import_toolkit18.createAsyncThunk)(
2577
+ var addDevicesToGroup = createAppAsyncThunk(
2832
2578
  `${sliceName3}/addDevicesToGroup`,
2833
- ({ group, deviceIds, isCreation }, { dispatch }) => general_api_default.patch(`${inventoryApiUrl}/groups/${group}/devices`, deviceIds).then(() => dispatch(actions3.addToGroup({ group, deviceIds }))).finally(() => isCreation ? Promise.resolve(dispatch(getGroups2())) : {})
2579
+ ({ group, deviceIds, isCreation }, { dispatch }) => general_api_default.patch(`${import_constants5.inventoryApiUrl}/groups/${group}/devices`, deviceIds).then(() => dispatch(actions3.addToGroup({ group, deviceIds }))).finally(() => isCreation ? Promise.resolve(dispatch(getGroups2())) : {})
2834
2580
  );
2835
- var removeDevicesFromGroup = (0, import_toolkit18.createAsyncThunk)(
2581
+ var removeDevicesFromGroup = createAppAsyncThunk(
2836
2582
  `${sliceName3}/removeDevicesFromGroup`,
2837
- ({ group, deviceIds }, { dispatch }) => general_api_default.delete(`${inventoryApiUrl}/groups/${group}/devices`, deviceIds).then(
2583
+ ({ group, deviceIds }, { dispatch }) => general_api_default.delete(`${import_constants5.inventoryApiUrl}/groups/${group}/devices`, deviceIds).then(
2838
2584
  () => Promise.all([
2839
2585
  dispatch(actions3.removeFromGroup({ group, deviceIds })),
2840
- dispatch(setSnackbar2(`The ${(0, import_pluralize.default)("devices", deviceIds.length)} ${(0, import_pluralize.default)("were", deviceIds.length)} removed from the group`, TIMEOUTS.fiveSeconds))
2586
+ dispatch(
2587
+ setSnackbar2({
2588
+ message: `The ${(0, import_pluralize.default)("devices", deviceIds.length)} ${(0, import_pluralize.default)("were", deviceIds.length)} removed from the group`,
2589
+ autoHideDuration: TIMEOUTS.fiveSeconds
2590
+ })
2591
+ )
2841
2592
  ])
2842
2593
  )
2843
2594
  );
2844
2595
  var getGroupNotification = (newGroup, selectedGroup) => {
2845
2596
  const successMessage = "The group was updated successfully";
2846
2597
  if (newGroup === selectedGroup) {
2847
- return [successMessage, TIMEOUTS.fiveSeconds];
2598
+ return { message: successMessage, autoHideDuration: TIMEOUTS.fiveSeconds };
2848
2599
  }
2849
- return [
2850
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
2600
+ return {
2601
+ action: "",
2602
+ autoHideDuration: TIMEOUTS.fiveSeconds,
2603
+ message: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
2851
2604
  successMessage,
2852
2605
  " - ",
2853
2606
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_router_dom.Link, { to: `/devices?inventory=group:eq:${newGroup}`, children: "click here" }),
2854
2607
  " to see it."
2855
2608
  ] }),
2856
- 5e3,
2857
- void 0,
2858
- void 0,
2859
- () => {
2860
- }
2861
- ];
2609
+ preventClickToCopy: true
2610
+ };
2862
2611
  };
2863
- var addStaticGroup = (0, import_toolkit18.createAsyncThunk)(
2612
+ var addStaticGroup = createAppAsyncThunk(
2864
2613
  `${sliceName3}/addStaticGroup`,
2865
2614
  ({ group, devices }, { dispatch, getState }) => Promise.resolve(dispatch(addDevicesToGroup({ group, deviceIds: devices.map(({ id }) => id), isCreation: true }))).then(
2866
2615
  () => Promise.resolve(
@@ -2874,24 +2623,24 @@ var addStaticGroup = (0, import_toolkit18.createAsyncThunk)(
2874
2623
  () => Promise.all([
2875
2624
  dispatch(setDeviceListState({ setOnly: true })),
2876
2625
  dispatch(getGroups2()),
2877
- dispatch(setSnackbar2(...getGroupNotification(group, getState().devices.groups.selectedGroup)))
2626
+ dispatch(setSnackbar2(getGroupNotification(group, getState().devices.groups.selectedGroup)))
2878
2627
  ])
2879
2628
  )
2880
2629
  ).catch((err) => commonErrorHandler(err, `Group could not be updated:`, dispatch))
2881
2630
  );
2882
- var removeStaticGroup = (0, import_toolkit18.createAsyncThunk)(
2631
+ var removeStaticGroup = createAppAsyncThunk(
2883
2632
  `${sliceName3}/removeStaticGroup`,
2884
- (groupName, { dispatch }) => general_api_default.delete(`${inventoryApiUrl}/groups/${groupName}`).then(
2633
+ (groupName, { dispatch }) => general_api_default.delete(`${import_constants5.inventoryApiUrl}/groups/${groupName}`).then(
2885
2634
  () => Promise.all([
2886
2635
  dispatch(actions3.removeGroup(groupName)),
2887
2636
  dispatch(getGroups2()),
2888
- dispatch(setSnackbar2("Group was removed successfully", TIMEOUTS.fiveSeconds))
2637
+ dispatch(setSnackbar2({ message: "Group was removed successfully", autoHideDuration: TIMEOUTS.fiveSeconds }))
2889
2638
  ])
2890
2639
  )
2891
2640
  );
2892
- var getDynamicGroups = (0, import_toolkit18.createAsyncThunk)(
2641
+ var getDynamicGroups = createAppAsyncThunk(
2893
2642
  `${sliceName3}/getDynamicGroups`,
2894
- (_, { dispatch, getState }) => general_api_default.get(`${inventoryApiUrlV2}/filters?per_page=${MAX_PAGE_SIZE}`).then(({ data: filters }) => {
2643
+ (_, { dispatch, getState }) => general_api_default.get(`${import_constants5.inventoryApiUrlV2}/filters?per_page=${MAX_PAGE_SIZE}`).then(({ data: filters }) => {
2895
2644
  const state = getGroupsById(getState());
2896
2645
  const staticGroups = Object.entries(state).reduce((accu, [id, group]) => {
2897
2646
  if (!(group.id || group.filters?.length)) {
@@ -2912,15 +2661,15 @@ var getDynamicGroups = (0, import_toolkit18.createAsyncThunk)(
2912
2661
  return Promise.resolve(dispatch(actions3.receivedGroups(groups)));
2913
2662
  }).catch(() => console.log("Dynamic group retrieval failed - likely accessing a non-enterprise backend"))
2914
2663
  );
2915
- var addDynamicGroup = (0, import_toolkit18.createAsyncThunk)(
2664
+ var addDynamicGroup = createAppAsyncThunk(
2916
2665
  `${sliceName3}/addDynamicGroup`,
2917
- ({ groupName, filterPredicates }, { dispatch, getState }) => general_api_default.post(`${inventoryApiUrlV2}/filters`, { name: groupName, terms: mapFiltersToTerms(filterPredicates) }).then(
2666
+ ({ groupName, filterPredicates }, { dispatch, getState }) => general_api_default.post(`${import_constants5.inventoryApiUrlV2}/filters`, { name: groupName, terms: mapFiltersToTerms(filterPredicates) }).then(
2918
2667
  (res) => Promise.resolve(
2919
2668
  dispatch(
2920
2669
  actions3.addGroup({
2921
2670
  groupName,
2922
2671
  group: {
2923
- id: res.headers[headerNames.location].substring(res.headers[headerNames.location].lastIndexOf("/") + 1),
2672
+ id: res.headers[import_constants5.headerNames.location].substring(res.headers[import_constants5.headerNames.location].lastIndexOf("/") + 1),
2924
2673
  filters: filterPredicates
2925
2674
  }
2926
2675
  })
@@ -2929,45 +2678,56 @@ var addDynamicGroup = (0, import_toolkit18.createAsyncThunk)(
2929
2678
  const { cleanedFilters } = getGroupFilters(groupName, getState().devices.groups);
2930
2679
  return Promise.all([
2931
2680
  dispatch(actions3.setDeviceFilters(cleanedFilters)),
2932
- dispatch(setSnackbar2(...getGroupNotification(groupName, getState().devices.groups.selectedGroup))),
2681
+ dispatch(setSnackbar2(getGroupNotification(groupName, getState().devices.groups.selectedGroup))),
2933
2682
  dispatch(getDynamicGroups())
2934
2683
  ]);
2935
2684
  })
2936
2685
  ).catch((err) => commonErrorHandler(err, `Group could not be updated:`, dispatch))
2937
2686
  );
2938
- var updateDynamicGroup = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/updateDynamicGroup`, ({ groupName, filterPredicates }, { dispatch, getState }) => {
2939
- const filterId = getState().devices.groups.byId[groupName].id;
2940
- return general_api_default.delete(`${inventoryApiUrlV2}/filters/${filterId}`).then(() => Promise.resolve(dispatch(addDynamicGroup({ groupName, filterPredicates }))));
2941
- });
2942
- var removeDynamicGroup = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/removeDynamicGroup`, (groupName, { dispatch, getState }) => {
2687
+ var updateDynamicGroup = createAppAsyncThunk(
2688
+ `${sliceName3}/updateDynamicGroup`,
2689
+ ({ groupName, filterPredicates }, { dispatch, getState }) => {
2690
+ const filterId = getState().devices.groups.byId[groupName].id;
2691
+ return general_api_default.delete(`${import_constants5.inventoryApiUrlV2}/filters/${filterId}`).then(
2692
+ () => Promise.resolve(dispatch(addDynamicGroup({ groupName, filterPredicates })))
2693
+ );
2694
+ }
2695
+ );
2696
+ var removeDynamicGroup = createAppAsyncThunk(`${sliceName3}/removeDynamicGroup`, (groupName, { dispatch, getState }) => {
2943
2697
  const filterId = getState().devices.groups.byId[groupName].id;
2944
- return general_api_default.delete(`${inventoryApiUrlV2}/filters/${filterId}`).then(
2945
- () => Promise.all([dispatch(actions3.removeGroup(groupName)), dispatch(setSnackbar2("Group was removed successfully", TIMEOUTS.fiveSeconds))])
2698
+ return general_api_default.delete(`${import_constants5.inventoryApiUrlV2}/filters/${filterId}`).then(
2699
+ () => Promise.all([
2700
+ dispatch(actions3.removeGroup(groupName)),
2701
+ dispatch(setSnackbar2({ message: "Group was removed successfully", autoHideDuration: TIMEOUTS.fiveSeconds }))
2702
+ ])
2946
2703
  );
2947
2704
  });
2948
2705
  var getGroupFilters = (group, groupsState, filters = []) => {
2949
2706
  const groupName = group === UNGROUPED_GROUP.id || group === UNGROUPED_GROUP.name ? UNGROUPED_GROUP.id : group;
2950
2707
  const selectedGroup = groupsState.byId[groupName];
2951
2708
  const groupFilterLength = selectedGroup?.filters?.length || 0;
2952
- const cleanedFilters = groupFilterLength ? [...filters, ...selectedGroup.filters].filter(filtersFilter) : filters;
2709
+ const cleanedFilters = groupFilterLength ? [...filters, ...selectedGroup.filters || []].filter(filtersFilter) : filters;
2953
2710
  return { cleanedFilters, groupName, selectedGroup, groupFilterLength };
2954
2711
  };
2955
- var selectGroup = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/selectGroup`, ({ group, filters = [] }, { dispatch, getState }) => {
2956
- const { cleanedFilters, groupName, selectedGroup, groupFilterLength } = getGroupFilters(group, getState().devices.groups, filters);
2957
- if (getSelectedGroup(getState()) === groupName && (filters.length === 0 && !groupFilterLength || filters.length === cleanedFilters.length)) {
2958
- return Promise.resolve();
2959
- }
2960
- let tasks = [];
2961
- if (groupFilterLength) {
2962
- tasks.push(dispatch(actions3.setDeviceFilters(cleanedFilters)));
2963
- } else {
2964
- tasks.push(dispatch(actions3.setDeviceFilters(filters)));
2965
- tasks.push(dispatch(getGroupDevices({ group: groupName, perPage: 1, shouldIncludeAllStates: true })));
2712
+ var selectGroup = createAppAsyncThunk(
2713
+ `${sliceName3}/selectGroup`,
2714
+ ({ group, filters = [] }, { dispatch, getState }) => {
2715
+ const { cleanedFilters, groupName, selectedGroup, groupFilterLength } = getGroupFilters(group, getState().devices.groups, filters);
2716
+ if (getSelectedGroup(getState()) === groupName && (filters.length === 0 && !groupFilterLength || filters.length === cleanedFilters.length)) {
2717
+ return Promise.resolve();
2718
+ }
2719
+ const tasks = [];
2720
+ if (groupFilterLength) {
2721
+ tasks.push(dispatch(actions3.setDeviceFilters(cleanedFilters)));
2722
+ } else {
2723
+ tasks.push(dispatch(actions3.setDeviceFilters(filters)));
2724
+ tasks.push(dispatch(getGroupDevices({ group: groupName, perPage: 1, shouldIncludeAllStates: true })));
2725
+ }
2726
+ const selectedGroupName = selectedGroup || !Object.keys(getGroupsById(getState())).length ? groupName : void 0;
2727
+ tasks.push(dispatch(actions3.selectGroup(selectedGroupName)));
2728
+ return Promise.all(tasks);
2966
2729
  }
2967
- const selectedGroupName = selectedGroup || !Object.keys(getGroupsById(getState())).length ? groupName : void 0;
2968
- tasks.push(dispatch(actions3.selectGroup(selectedGroupName)));
2969
- return Promise.all(tasks);
2970
- });
2730
+ );
2971
2731
  var getEarliestTs = (dateA = "", dateB = "") => !dateA || !dateB ? dateA || dateB : dateA < dateB ? dateA : dateB;
2972
2732
  var reduceReceivedDevices = (devices, ids, state, status) => devices.reduce(
2973
2733
  (accu, device) => {
@@ -2998,11 +2758,16 @@ var reduceReceivedDevices = (devices, ids, state, status) => devices.reduce(
2998
2758
  },
2999
2759
  { ids, devicesById: {} }
3000
2760
  );
3001
- var getGroupDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getGroupDevices`, (options, { dispatch, getState }) => {
2761
+ var getGroupDevices = createAppAsyncThunk(`${sliceName3}/getGroupDevices`, (options, { dispatch, getState }) => {
3002
2762
  const { group, shouldIncludeAllStates, ...remainder } = options;
3003
2763
  const { cleanedFilters: filterSelection } = getGroupFilters(group, getState().devices.groups);
3004
- return Promise.resolve(
3005
- dispatch(getDevicesByStatus2({ ...remainder, filterSelection, group, status: shouldIncludeAllStates ? void 0 : DEVICE_STATES.accepted }))
2764
+ return dispatch(
2765
+ getDevicesByStatus2({
2766
+ ...remainder,
2767
+ filterSelection,
2768
+ group,
2769
+ status: shouldIncludeAllStates ? void 0 : import_constants5.DEVICE_STATES.accepted
2770
+ })
3006
2771
  ).unwrap().then((results) => {
3007
2772
  if (!group) {
3008
2773
  return Promise.resolve();
@@ -3016,7 +2781,7 @@ var getGroupDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getG
3016
2781
  dispatch(
3017
2782
  actions3.addGroup({
3018
2783
  group: {
3019
- deviceIds: deviceAccu.ids.length === total || deviceAccu.ids.length > stateGroup?.deviceIds ? deviceAccu.ids : stateGroup.deviceIds,
2784
+ deviceIds: deviceAccu.ids.length === total || stateGroup && stateGroup.deviceIds && deviceAccu.ids.length > stateGroup.deviceIds ? deviceAccu.ids : stateGroup.deviceIds,
3020
2785
  total
3021
2786
  },
3022
2787
  groupName: group
@@ -3025,63 +2790,71 @@ var getGroupDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getG
3025
2790
  );
3026
2791
  });
3027
2792
  });
3028
- var getAllGroupDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getAllGroupDevices`, (group, { dispatch, getState }) => {
3029
- if (!group || !!group && (!getGroupsById(getState())[group] || getGroupsById(getState())[group].filters.length)) {
3030
- return Promise.resolve();
3031
- }
3032
- const { attributes, filterTerms } = prepareSearchArguments({
3033
- filters: [],
3034
- group,
3035
- state: getState(),
3036
- status: DEVICE_STATES.accepted
3037
- });
3038
- const getAllDevices = (perPage = MAX_PAGE_SIZE, page = defaultPage, devices = []) => general_api_default.post(getSearchEndpoint(getState()), {
3039
- page,
3040
- per_page: perPage,
3041
- filters: filterTerms,
3042
- attributes
3043
- }).then((res) => {
3044
- const state = getState();
3045
- const deviceAccu = reduceReceivedDevices(res.data, devices, state);
3046
- dispatch(actions3.receivedDevices(deviceAccu.devicesById));
3047
- const total = Number(res.headers[headerNames.total]);
3048
- if (total > perPage * page) {
3049
- return getAllDevices(perPage, page + 1, deviceAccu.ids);
2793
+ var getAllGroupDevices = createAppAsyncThunk(
2794
+ `${sliceName3}/getAllGroupDevices`,
2795
+ ({ group, attribute }, { dispatch, getState }) => {
2796
+ if (!group || !!group && (!getGroupsById(getState())[group] || getGroupsById(getState())[group].filters.length)) {
2797
+ return Promise.resolve();
3050
2798
  }
3051
- return Promise.resolve(dispatch(actions3.addGroup({ group: { deviceIds: deviceAccu.ids, total: deviceAccu.ids.length }, groupName: group })));
3052
- });
3053
- return getAllDevices();
3054
- });
3055
- var getAllDynamicGroupDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getAllDynamicGroupDevices`, (group, { dispatch, getState }) => {
3056
- if (!!group && (!getGroupsById(getState())[group] || !getGroupsById(getState())[group].filters.length)) {
3057
- return Promise.resolve();
2799
+ const { attributes, filterTerms } = prepareSearchArguments({
2800
+ filters: [],
2801
+ group,
2802
+ state: getState(),
2803
+ status: import_constants5.DEVICE_STATES.accepted
2804
+ });
2805
+ const getAllDevices = (perPage = MAX_PAGE_SIZE, page = defaultPage, devices = []) => general_api_default.post(getSearchEndpoint(getState()), {
2806
+ page,
2807
+ per_page: perPage,
2808
+ filters: filterTerms,
2809
+ attributes: [...attributes, { scope: "inventory", attribute }]
2810
+ }).then((res) => {
2811
+ const state = getState();
2812
+ const deviceAccu = reduceReceivedDevices(res.data, devices, state);
2813
+ dispatch(actions3.receivedDevices(deviceAccu.devicesById));
2814
+ const total = Number(res.headers[import_constants5.headerNames.total]);
2815
+ if (total > perPage * page) {
2816
+ return getAllDevices(perPage, page + 1, deviceAccu.ids);
2817
+ }
2818
+ return Promise.resolve(dispatch(actions3.addGroup({ group: { deviceIds: deviceAccu.ids, total: deviceAccu.ids.length }, groupName: group })));
2819
+ });
2820
+ return getAllDevices();
3058
2821
  }
3059
- const { attributes, filterTerms: filters } = prepareSearchArguments({
3060
- filters: getState().devices.groups.byId[group].filters,
3061
- state: getState(),
3062
- status: DEVICE_STATES.accepted
3063
- });
3064
- const getAllDevices = (perPage = MAX_PAGE_SIZE, page = defaultPage, devices = []) => general_api_default.post(getSearchEndpoint(getState()), { page, per_page: perPage, filters, attributes }).then((res) => {
3065
- const state = getState();
3066
- const deviceAccu = reduceReceivedDevices(res.data, devices, state);
3067
- dispatch(actions3.receivedDevices(deviceAccu.devicesById));
3068
- const total = Number(res.headers[headerNames.total]);
3069
- if (total > deviceAccu.ids.length) {
3070
- return getAllDevices(perPage, page + 1, deviceAccu.ids);
2822
+ );
2823
+ var getAllDynamicGroupDevices = createAppAsyncThunk(
2824
+ `${sliceName3}/getAllDynamicGroupDevices`,
2825
+ ({ group, attribute }, { dispatch, getState }) => {
2826
+ if (!!group && (!getGroupsById(getState())[group] || !getGroupsById(getState())[group].filters.length)) {
2827
+ return Promise.resolve();
3071
2828
  }
3072
- return Promise.resolve(dispatch(actions3.addGroup({ group: { deviceIds: deviceAccu.ids, total }, groupName: group })));
3073
- });
3074
- return getAllDevices();
3075
- });
3076
- var getDeviceById2 = (0, import_toolkit18.createAsyncThunk)(
2829
+ const { attributes, filterTerms: filters } = prepareSearchArguments({
2830
+ filters: getState().devices.groups.byId[group].filters,
2831
+ state: getState(),
2832
+ status: import_constants5.DEVICE_STATES.accepted
2833
+ });
2834
+ const getAllDevices = (perPage = MAX_PAGE_SIZE, page = defaultPage, devices = []) => general_api_default.post(getSearchEndpoint(getState()), { page, per_page: perPage, filters, attributes: [...attributes, { scope: "inventory", attribute }] }).then(
2835
+ (res) => {
2836
+ const state = getState();
2837
+ const deviceAccu = reduceReceivedDevices(res.data, devices, state);
2838
+ dispatch(actions3.receivedDevices(deviceAccu.devicesById));
2839
+ const total = Number(res.headers[import_constants5.headerNames.total]);
2840
+ if (total > deviceAccu.ids.length) {
2841
+ return getAllDevices(perPage, page + 1, deviceAccu.ids);
2842
+ }
2843
+ return Promise.resolve(dispatch(actions3.addGroup({ group: { deviceIds: deviceAccu.ids, total }, groupName: group })));
2844
+ }
2845
+ );
2846
+ return getAllDevices();
2847
+ }
2848
+ );
2849
+ var getDeviceById2 = createAppAsyncThunk(
3077
2850
  `${sliceName3}/getDeviceById`,
3078
- (id, { dispatch, getState }) => general_api_default.get(`${inventoryApiUrl}/devices/${id}`).then((res) => {
2851
+ (id, { dispatch, getState }) => general_api_default.get(`${import_constants5.inventoryApiUrl}/devices/${id}`).then((res) => {
3079
2852
  const device = reduceReceivedDevices([res.data], [], getState()).devicesById[id];
3080
2853
  device.etag = res.headers.etag;
3081
2854
  dispatch(actions3.receivedDevice(device));
3082
2855
  return Promise.resolve(device);
3083
2856
  }).catch((err) => {
3084
- const errMsg = (0, import_helpers8.extractErrorMessage)(err);
2857
+ const errMsg = extractErrorMessage(err);
3085
2858
  if (errMsg.includes("Not Found")) {
3086
2859
  console.log(`${id} does not have any inventory information`);
3087
2860
  const device = reduceReceivedDevices(
@@ -3091,7 +2864,8 @@ var getDeviceById2 = (0, import_toolkit18.createAsyncThunk)(
3091
2864
  attributes: [
3092
2865
  { name: "status", value: "decomissioned", scope: "identity" },
3093
2866
  { name: "decomissioned", value: "true", scope: "inventory" }
3094
- ]
2867
+ ],
2868
+ log: false
3095
2869
  }
3096
2870
  ],
3097
2871
  [],
@@ -3101,17 +2875,20 @@ var getDeviceById2 = (0, import_toolkit18.createAsyncThunk)(
3101
2875
  }
3102
2876
  })
3103
2877
  );
3104
- var getDeviceInfo = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getDeviceInfo`, (deviceId, { dispatch, getState }) => {
2878
+ var getDeviceInfo = createAppAsyncThunk(`${sliceName3}/getDeviceInfo`, (deviceId, { dispatch, getState }) => {
3105
2879
  const device = getDeviceById(getState(), deviceId);
3106
2880
  const { hasDeviceConfig, hasDeviceConnect, hasMonitor } = getTenantCapabilities(getState());
3107
2881
  const { canConfigure } = getUserCapabilities(getState());
3108
2882
  const integrations = getDeviceTwinIntegrations(getState());
3109
- let tasks = [dispatch(getDeviceAuth(deviceId)), ...integrations.map((integration) => dispatch(getDeviceTwin({ deviceId, integration })))];
3110
- if (hasDeviceConfig && canConfigure && [DEVICE_STATES.accepted, DEVICE_STATES.preauth].includes(device.status)) {
2883
+ const tasks = [
2884
+ dispatch(getDeviceAuth(deviceId)),
2885
+ dispatch(getDeviceById2(deviceId)),
2886
+ ...integrations.map((integration) => dispatch(getDeviceTwin({ deviceId, integration })))
2887
+ ];
2888
+ if (hasDeviceConfig && canConfigure && (device.status === import_constants5.DEVICE_STATES.accepted || device.status === import_constants5.DEVICE_STATES.preauth)) {
3111
2889
  tasks.push(dispatch(getDeviceConfig(deviceId)));
3112
2890
  }
3113
- if (device.status === DEVICE_STATES.accepted) {
3114
- tasks.push(dispatch(getDeviceById2(deviceId)));
2891
+ if (device.status === import_constants5.DEVICE_STATES.accepted) {
3115
2892
  if (hasDeviceConnect) {
3116
2893
  tasks.push(dispatch(getDeviceConnect(deviceId)));
3117
2894
  }
@@ -3122,156 +2899,136 @@ var getDeviceInfo = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getDev
3122
2899
  }
3123
2900
  return Promise.all(tasks);
3124
2901
  });
3125
- var deriveInactiveDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/deriveInactiveDevices`, (deviceIds, { dispatch, getState }) => {
3126
- const yesterday = /* @__PURE__ */ new Date();
3127
- yesterday.setDate(yesterday.getDate() - 1);
3128
- const yesterdaysIsoString = yesterday.toISOString();
3129
- const devices = deviceIds.reduce(
3130
- (accu, id) => {
3131
- const device = getDeviceById(getState(), id);
3132
- if (device && device.updated_ts > yesterdaysIsoString) {
3133
- accu.active.push(id);
3134
- } else {
3135
- accu.inactive.push(id);
3136
- }
3137
- return accu;
3138
- },
3139
- { active: [], inactive: [] }
3140
- );
3141
- return dispatch(actions3.setInactiveDevices({ activeDeviceTotal: devices.active.length, inactiveDeviceTotal: devices.inactive.length }));
3142
- });
3143
- var getDeviceCount = (0, import_toolkit18.createAsyncThunk)(
2902
+ var getDeviceCount = createAppAsyncThunk(
3144
2903
  `${sliceName3}/getDeviceCount`,
3145
2904
  (status, { dispatch, getState }) => general_api_default.post(getSearchEndpoint(getState()), {
3146
2905
  page: 1,
3147
2906
  per_page: 1,
3148
- filters: mapFiltersToTerms([{ key: "status", value: status, operator: DEVICE_FILTERING_OPTIONS.$eq.key, scope: "identity" }]),
2907
+ filters: mapFiltersToTerms([{ key: "status", value: status, operator: import_constants5.DEVICE_FILTERING_OPTIONS.$eq.key, scope: "identity" }]),
3149
2908
  attributes: defaultAttributes
3150
2909
  }).then((response) => {
3151
- const count = Number(response.headers[headerNames.total]);
3152
- if (status) {
3153
- return dispatch(actions3.setDevicesCountByStatus({ count, status }));
3154
- }
3155
- return dispatch(actions3.setTotalDevices(count));
2910
+ const count = Number(response.headers[import_constants5.headerNames.total]);
2911
+ return dispatch(actions3.setDevicesCountByStatus({ count, status }));
3156
2912
  })
3157
2913
  );
3158
- var getAllDeviceCounts = (0, import_toolkit18.createAsyncThunk)(
2914
+ var getAllDeviceCounts = createAppAsyncThunk(
3159
2915
  `${sliceName3}/getAllDeviceCounts`,
3160
- (_, { dispatch }) => Promise.all([DEVICE_STATES.accepted, DEVICE_STATES.pending].map((status) => dispatch(getDeviceCount(status))))
2916
+ (_, { dispatch }) => Promise.all([import_constants5.DEVICE_STATES.accepted, import_constants5.DEVICE_STATES.pending].map((status) => dispatch(getDeviceCount(status))))
3161
2917
  );
3162
- var getDeviceLimit2 = (0, import_toolkit18.createAsyncThunk)(
2918
+ var getDeviceLimit2 = createAppAsyncThunk(
3163
2919
  `${sliceName3}/getDeviceLimit`,
3164
- (_, { dispatch }) => general_api_default.get(`${deviceAuthV2}/limits/max_devices`).then((res) => dispatch(actions3.setDeviceLimit(res.data.limit)))
2920
+ (_, { dispatch }) => general_api_default.get(`${import_constants5.deviceAuthV2}/limits/max_devices`).then((res) => dispatch(actions3.setDeviceLimit(res.data.limit)))
3165
2921
  );
3166
- var setDeviceListState = (0, import_toolkit18.createAsyncThunk)(
2922
+ var setDeviceListState = createAppAsyncThunk(
3167
2923
  `${sliceName3}/setDeviceListState`,
3168
2924
  ({ shouldSelectDevices = true, forceRefresh, fetchAuth = true, ...selectionState }, { dispatch, getState }) => {
3169
2925
  const currentState = getDeviceListState(getState());
3170
2926
  const refreshTrigger = forceRefresh ? !currentState.refreshTrigger : selectionState.refreshTrigger;
3171
- let nextState = {
2927
+ const nextState = {
3172
2928
  ...currentState,
3173
2929
  setOnly: false,
3174
2930
  refreshTrigger,
3175
2931
  ...selectionState,
3176
2932
  sort: { ...currentState.sort, ...selectionState.sort }
3177
2933
  };
3178
- let tasks = [];
2934
+ const tasks = [];
3179
2935
  const { isLoading: currentLoading, deviceIds: currentDevices, selection: currentSelection, ...currentRequestState } = currentState;
3180
2936
  const { isLoading: nextLoading, deviceIds: nextDevices, selection: nextSelection, ...nextRequestState } = nextState;
3181
2937
  if (!nextState.setOnly && !(0, import_helpers8.deepCompare)(currentRequestState, nextRequestState)) {
3182
- const { direction: sortDown = SORTING_OPTIONS.desc, key: sortCol, scope: sortScope } = nextState.sort ?? {};
2938
+ const { direction: sortDown = import_constants5.SORTING_OPTIONS.desc, key: sortCol, scope: sortScope = "" } = nextState.sort ?? {};
3183
2939
  const sortBy = sortCol ? [{ attribute: sortCol, order: sortDown, scope: sortScope }] : void 0;
3184
- const applicableSelectedState = nextState.state === ALL_DEVICE_STATES ? void 0 : nextState.state;
2940
+ const applicableSelectedState = nextState.state === import_constants5.ALL_DEVICE_STATES ? void 0 : nextState.state;
3185
2941
  nextState.isLoading = true;
3186
2942
  tasks.push(
3187
2943
  dispatch(getDevicesByStatus2({ ...nextState, status: applicableSelectedState, sortOptions: sortBy, fetchAuth })).unwrap().then((results) => {
3188
2944
  const { deviceAccu, total } = results[results.length - 1];
3189
- const devicesState = shouldSelectDevices ? { deviceIds: deviceAccu.ids, total, isLoading: false } : { isLoading: false };
3190
- return Promise.resolve(dispatch(actions3.setDeviceListState(devicesState)));
3191
- }).catch(() => Promise.resolve({ isLoading: false }))
3192
- );
3193
- }
3194
- tasks.push(dispatch(actions3.setDeviceListState(nextState)));
3195
- return Promise.all(tasks);
3196
- }
3197
- );
3198
- var getDevicesByStatus2 = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getDevicesByStatus`, (options, { dispatch, getState }) => {
3199
- const {
3200
- status,
3201
- fetchAuth = true,
3202
- filterSelection,
3203
- group,
3204
- selectedIssues = [],
3205
- page = defaultPage,
3206
- perPage = defaultPerPage,
3207
- sortOptions = [],
3208
- selectedAttributes = getSelectedDeviceAttribute(getState())
3209
- } = options;
3210
- const state = getState();
3211
- const { applicableFilters, filterTerms } = convertDeviceListStateToFilters({
3212
- filters: filterSelection ?? getDeviceFilters(state),
3213
- group: group ?? getSelectedGroup(state),
3214
- groups: state.devices.groups,
3215
- offlineThreshold: state.app.offlineThreshold,
3216
- selectedIssues,
3217
- status
3218
- });
3219
- const attributes = [...defaultAttributes, getIdAttribute(getState()), ...selectedAttributes];
3220
- return general_api_default.post(getSearchEndpoint(getState()), {
3221
- page,
3222
- per_page: perPage,
3223
- filters: filterTerms,
3224
- sort: sortOptions,
3225
- attributes
3226
- }).then((response) => {
3227
- const state2 = getState();
3228
- const deviceAccu = reduceReceivedDevices(response.data, [], state2, status);
3229
- let total = !applicableFilters.length ? Number(response.headers[headerNames.total]) : null;
3230
- if (status && state2.devices.byStatus[status].total === deviceAccu.ids.length) {
3231
- total = deviceAccu.ids.length;
3232
- }
3233
- let tasks = [dispatch(actions3.receivedDevices(deviceAccu.devicesById))];
3234
- if (status) {
3235
- tasks.push(dispatch(actions3.setDevicesByStatus({ deviceIds: deviceAccu.ids, status, total })));
3236
- }
3237
- const receivedDevices = Object.values(deviceAccu.devicesById);
3238
- if (receivedDevices.length && fetchAuth) {
3239
- tasks.push(dispatch(getDevicesWithAuth(receivedDevices)));
2945
+ const devicesState = shouldSelectDevices ? { deviceIds: deviceAccu.ids, total, isLoading: false } : { isLoading: false };
2946
+ return Promise.resolve(dispatch(actions3.setDeviceListState(devicesState)));
2947
+ }).catch(() => Promise.resolve({ isLoading: false }))
2948
+ );
3240
2949
  }
3241
- tasks.push(Promise.resolve({ deviceAccu, total: Number(response.headers[headerNames.total]) }));
2950
+ tasks.push(dispatch(actions3.setDeviceListState(nextState)));
3242
2951
  return Promise.all(tasks);
3243
- }).catch((err) => commonErrorHandler(err, `${status} devices couldn't be loaded.`, dispatch, commonErrorFallback));
3244
- });
3245
- var getAllDevicesByStatus = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getAllDevicesByStatus`, (status, { dispatch, getState }) => {
3246
- const attributes = [...defaultAttributes, getIdAttribute(getState())];
3247
- const getAllDevices = (perPage = MAX_PAGE_SIZE, page = 1, devices = []) => general_api_default.post(getSearchEndpoint(getState()), {
3248
- page,
3249
- per_page: perPage,
3250
- filters: mapFiltersToTerms([{ key: "status", value: status, operator: DEVICE_FILTERING_OPTIONS.$eq.key, scope: "identity" }]),
3251
- attributes
3252
- }).then((res) => {
2952
+ }
2953
+ );
2954
+ var getDevicesByStatus2 = createAppAsyncThunk(
2955
+ `${sliceName3}/getDevicesByStatus`,
2956
+ (options, { dispatch, getState }) => {
2957
+ const {
2958
+ status,
2959
+ fetchAuth = true,
2960
+ filterSelection,
2961
+ group,
2962
+ selectedIssues = [],
2963
+ page = defaultPage,
2964
+ perPage = defaultPerPage,
2965
+ sortOptions = [],
2966
+ selectedAttributes = getSelectedDeviceAttribute(getState())
2967
+ } = options;
3253
2968
  const state = getState();
3254
- const deviceAccu = reduceReceivedDevices(res.data, devices, state, status);
3255
- dispatch(actions3.receivedDevices(deviceAccu.devicesById));
3256
- const total = Number(res.headers[headerNames.total]);
3257
- if (total > state.deployments.deploymentDeviceLimit) {
2969
+ const { applicableFilters, filterTerms } = convertDeviceListStateToFilters({
2970
+ filters: filterSelection ?? getDeviceFilters(state),
2971
+ group: group ?? getSelectedGroup(state),
2972
+ groups: state.devices.groups,
2973
+ offlineThreshold: state.app.offlineThreshold,
2974
+ selectedIssues,
2975
+ status
2976
+ });
2977
+ const attributes = [...defaultAttributes, getIdAttribute(getState()), ...selectedAttributes];
2978
+ return general_api_default.post(getSearchEndpoint(getState()), {
2979
+ page,
2980
+ per_page: perPage,
2981
+ filters: filterTerms,
2982
+ sort: sortOptions,
2983
+ attributes
2984
+ }).then((response) => {
2985
+ const state2 = getState();
2986
+ const deviceAccu = reduceReceivedDevices(response.data, [], state2, status);
2987
+ let total = !applicableFilters.length ? Number(response.headers[import_constants5.headerNames.total]) : 0;
2988
+ if (status && state2.devices.byStatus[status].total === deviceAccu.ids.length) {
2989
+ total = deviceAccu.ids.length;
2990
+ }
2991
+ const tasks = [dispatch(actions3.receivedDevices(deviceAccu.devicesById))];
2992
+ if (status) {
2993
+ tasks.push(dispatch(actions3.setDevicesByStatus({ deviceIds: deviceAccu.ids, status, total })));
2994
+ }
2995
+ const receivedDevices = Object.values(deviceAccu.devicesById);
2996
+ if (receivedDevices.length && fetchAuth) {
2997
+ tasks.push(dispatch(getDevicesWithAuth(receivedDevices)));
2998
+ }
2999
+ tasks.push(Promise.resolve({ deviceAccu, total: Number(response.headers[import_constants5.headerNames.total]) }));
3000
+ return Promise.all(tasks);
3001
+ }).catch((err) => commonErrorHandler(err, `${status} devices couldn't be loaded.`, dispatch, commonErrorFallback));
3002
+ }
3003
+ );
3004
+ var getAllDevicesByStatus = createAppAsyncThunk(
3005
+ `${sliceName3}/getAllDevicesByStatus`,
3006
+ ({ status, attribute }, { dispatch, getState }) => {
3007
+ const attributes = [...defaultAttributes, getIdAttribute(getState())];
3008
+ const getAllDevices = (perPage = MAX_PAGE_SIZE, page = 1, devices = []) => general_api_default.post(getSearchEndpoint(getState()), {
3009
+ page,
3010
+ per_page: perPage,
3011
+ filters: mapFiltersToTerms([{ key: "status", value: status, operator: import_constants5.DEVICE_FILTERING_OPTIONS.$eq.key, scope: "identity" }]),
3012
+ attributes: [...attributes, { scope: "inventory", attribute }]
3013
+ }).then((res) => {
3014
+ const state = getState();
3015
+ const deviceAccu = reduceReceivedDevices(res.data, devices, state, status);
3016
+ dispatch(actions3.receivedDevices(deviceAccu.devicesById));
3017
+ const total = Number(res.headers[import_constants5.headerNames.total]);
3018
+ if (total > state.deployments.deploymentDeviceLimit) {
3019
+ return Promise.resolve();
3020
+ }
3021
+ if (total > perPage * page) {
3022
+ return getAllDevices(perPage, page + 1, deviceAccu.ids);
3023
+ }
3258
3024
  return Promise.resolve();
3259
- }
3260
- if (total > perPage * page) {
3261
- return getAllDevices(perPage, page + 1, deviceAccu.ids);
3262
- }
3263
- let tasks = [dispatch(actions3.setDevicesByStatus({ deviceIds: deviceAccu.ids, forceUpdate: true, status, total: deviceAccu.ids.length }))];
3264
- if (status === DEVICE_STATES.accepted && deviceAccu.ids.length === total) {
3265
- tasks.push(dispatch(deriveInactiveDevices(deviceAccu.ids)));
3266
- tasks.push(dispatch(deriveReportsData()));
3267
- }
3268
- return Promise.all(tasks);
3269
- });
3270
- return getAllDevices();
3271
- });
3272
- var searchDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/searchDevices`, (passedOptions = {}, { dispatch, getState }) => {
3025
+ });
3026
+ return getAllDevices();
3027
+ }
3028
+ );
3029
+ var searchDevices = createAppAsyncThunk(`${sliceName3}/searchDevices`, (passedOptions = {}, { dispatch, getState }) => {
3273
3030
  const state = getState();
3274
- let options = { ...state.app.searchState, ...passedOptions };
3031
+ const options = { ...state.app.searchState, ...passedOptions };
3275
3032
  const { page = defaultPage, searchTerm, sortOptions = [] } = options;
3276
3033
  const { columnSelection = [] } = getUserSettings(state);
3277
3034
  const selectedAttributes = columnSelection.map((column) => ({ attribute: column.key, scope: column.scope }));
@@ -3287,7 +3044,7 @@ var searchDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/search
3287
3044
  const deviceAccu = reduceReceivedDevices(response.data, [], getState());
3288
3045
  return Promise.all([
3289
3046
  dispatch(actions3.receivedDevices(deviceAccu.devicesById)),
3290
- Promise.resolve({ deviceIds: deviceAccu.ids, searchTotal: Number(response.headers[headerNames.total]) })
3047
+ Promise.resolve({ deviceIds: deviceAccu.ids, searchTotal: Number(response.headers[import_constants5.headerNames.total]) })
3291
3048
  ]);
3292
3049
  }).catch((err) => commonErrorHandler(err, `devices couldn't be searched.`, dispatch, commonErrorFallback));
3293
3050
  });
@@ -3302,64 +3059,25 @@ var attributeReducer = (attributes = []) => attributes.slice(0, ATTRIBUTE_LIST_C
3302
3059
  },
3303
3060
  { identity: [], inventory: [], system: [], tags: [] }
3304
3061
  );
3305
- var getDeviceAttributes = (0, import_toolkit18.createAsyncThunk)(
3062
+ var getDeviceAttributes = createAppAsyncThunk(
3306
3063
  `${sliceName3}/getDeviceAttributes`,
3307
3064
  (_, { dispatch, getState }) => general_api_default.get(getAttrsEndpoint(getState())).then(({ data }) => {
3308
3065
  const { identity: identityAttributes, inventory: inventoryAttributes, system: systemAttributes, tags: tagAttributes } = attributeReducer(data || []);
3309
3066
  return dispatch(actions3.setFilterAttributes({ identityAttributes, inventoryAttributes, systemAttributes, tagAttributes }));
3310
3067
  })
3311
3068
  );
3312
- var getReportingLimits = (0, import_toolkit18.createAsyncThunk)(
3313
- `${sliceName3}/getReportingLimits`,
3314
- (_, { dispatch }) => general_api_default.get(`${reportingApiUrl}/devices/attributes`).catch((err) => commonErrorHandler(err, `filterable attributes limit & usage could not be retrieved.`, dispatch, commonErrorFallback)).then(({ data }) => {
3315
- const { attributes, count, limit } = data;
3316
- const groupedAttributes = attributeReducer(attributes);
3317
- return Promise.resolve(dispatch(actions3.setFilterablesConfig({ count, limit, attributes: groupedAttributes })));
3318
- })
3319
- );
3320
- var ensureVersionString = (software, fallback) => software.length && software !== "artifact_name" ? software.endsWith(".version") ? software : `${software}.version` : fallback;
3321
- var getSingleReportData = (reportConfig, groups) => {
3322
- const { attribute, group, software = "" } = reportConfig;
3323
- const filters = [{ key: "status", scope: "identity", operator: DEVICE_FILTERING_OPTIONS.$eq.key, value: "accepted" }];
3324
- if (group) {
3325
- const staticGroupFilter = { key: "group", scope: "system", operator: DEVICE_FILTERING_OPTIONS.$eq.key, value: group };
3326
- const { cleanedFilters: groupFilters } = getGroupFilters(group, groups);
3327
- filters.push(...groupFilters.length ? groupFilters : [staticGroupFilter]);
3328
- }
3329
- const aggregationAttribute = ensureVersionString(software, attribute);
3330
- return general_api_default.post(`${reportingApiUrl}/devices/aggregate`, {
3331
- aggregations: [{ attribute: aggregationAttribute, name: "*", scope: "inventory", size: REPORT_CHART_SIZE_LIMIT }],
3332
- filters: mapFiltersToTerms(filters)
3333
- }).then(({ data }) => ({ data, reportConfig }));
3334
- };
3335
- var getReportsData = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getReportsData`, (_, { dispatch, getState }) => {
3336
- const state = getState();
3337
- const currentUserId = getCurrentUser(state).id;
3338
- const reports = getUserSettings(state).reports || getGlobalSettings(state)[`${currentUserId}-reports`] || (Object.keys(getDevicesById(state)).length ? defaultReports : []);
3339
- return Promise.all(reports.map((report) => getSingleReportData(report, getState().devices.groups))).then((results) => {
3340
- const devicesState = getState().devices;
3341
- const totalDeviceCount = devicesState.byStatus.accepted.total;
3342
- const newReports = results.map(({ data, reportConfig }) => {
3343
- let { items, other_count } = data[0];
3344
- const { attribute, group, software = "" } = reportConfig;
3345
- const dataCount = items.reduce((accu, item) => accu + item.count, 0);
3346
- const otherCount = !group && (software === rootfsImageVersion || attribute === "artifact_name") ? totalDeviceCount - dataCount : other_count;
3347
- return { items, otherCount, total: otherCount + dataCount };
3348
- });
3349
- return Promise.resolve(dispatch(actions3.setDeviceReports(newReports)));
3350
- });
3351
- });
3352
3069
  var initializeDistributionData = (report, groups, devices, totalDeviceCount) => {
3353
3070
  const { attribute, group = "", software = "" } = report;
3354
3071
  const effectiveAttribute = software ? software : attribute;
3355
3072
  const { deviceIds, total = 0 } = groups[group] || {};
3356
- const relevantDevices = groups[group] ? deviceIds.map((id) => devices[id]) : Object.values(devices);
3073
+ const relevantDevices = deviceIds ? deviceIds.map((id) => devices[id]) : Object.values(devices);
3357
3074
  const distributionByAttribute = relevantDevices.reduce((accu, item) => {
3358
- if (!item.attributes || item.status !== DEVICE_STATES.accepted) return accu;
3359
- if (!accu[item.attributes[effectiveAttribute]]) {
3360
- accu[item.attributes[effectiveAttribute]] = 0;
3075
+ if (!item.attributes || item.status !== import_constants5.DEVICE_STATES.accepted) return accu;
3076
+ const attributeValue = item.attributes[effectiveAttribute];
3077
+ if (!accu[attributeValue]) {
3078
+ accu[attributeValue] = 0;
3361
3079
  }
3362
- accu[item.attributes[effectiveAttribute]] = accu[item.attributes[effectiveAttribute]] + 1;
3080
+ accu[attributeValue] = accu[attributeValue] + 1;
3363
3081
  return accu;
3364
3082
  }, {});
3365
3083
  const distributionByAttributeSorted = Object.entries(distributionByAttribute).sort((pairA, pairB) => pairB[1] - pairA[1]);
@@ -3368,90 +3086,111 @@ var initializeDistributionData = (report, groups, devices, totalDeviceCount) =>
3368
3086
  const otherCount = (groups[group] ? total : totalDeviceCount) - dataCount;
3369
3087
  return { items, otherCount, total: otherCount + dataCount };
3370
3088
  };
3371
- var deriveReportsData = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/deriveReportsData`, (_, { dispatch, getState }) => {
3372
- const state = getState();
3373
- const {
3374
- groups: { byId: groupsById },
3375
- byId,
3376
- byStatus: {
3377
- accepted: { total }
3378
- }
3379
- } = state.devices;
3380
- const reports = getUserSettings(state).reports || state.users.globalSettings[`${state.users.currentUser}-reports`] || (Object.keys(byId).length ? defaultReports : []);
3381
- const newReports = reports.map((report) => initializeDistributionData(report, groupsById, byId, total));
3089
+ var updateReportData = createAppAsyncThunk(`${sliceName3}/updateReportData`, (reportIndex, { dispatch, getState }) => {
3090
+ const reports = getDeviceReportsForUser(getState());
3091
+ const report = reports[reportIndex];
3092
+ const { group = "" } = report;
3093
+ const devicesById = getDevicesById(getState());
3094
+ const groups = getGroupsById(getState());
3095
+ const acceptedDevices = getAcceptedDevices(getState());
3096
+ const totalDeviceCount = groups[group] ? groups[group].total : acceptedDevices.total;
3097
+ const reportsData = getDeviceReports(getState());
3098
+ const newReports = [...reportsData];
3099
+ newReports[reportIndex] = initializeDistributionData(report, groups, devicesById, totalDeviceCount);
3382
3100
  return Promise.resolve(dispatch(actions3.setDeviceReports(newReports)));
3383
3101
  });
3384
- var getReportsDataWithoutBackendSupport = (0, import_toolkit18.createAsyncThunk)(
3385
- `${sliceName3}/getReportsDataWithoutBackendSupport`,
3386
- (_, { dispatch, getState }) => Promise.all([dispatch(getAllDevicesByStatus(DEVICE_STATES.accepted)), dispatch(getGroups2()), dispatch(getDynamicGroups())]).then(() => {
3387
- const { dynamic: dynamicGroups, static: staticGroups } = getGroups(getState());
3388
- return Promise.all([
3389
- ...staticGroups.map(({ groupId }) => dispatch(getAllGroupDevices(groupId))),
3390
- ...dynamicGroups.map(({ groupId }) => dispatch(getAllDynamicGroupDevices(groupId)))
3391
- ]).then(() => dispatch(deriveReportsData()));
3392
- })
3102
+ var getReportDataWithoutBackendSupport = createAppAsyncThunk(
3103
+ `${sliceName3}/getReportDataWithoutBackendSupport`,
3104
+ (reportIndex, { dispatch, getState }) => {
3105
+ const reports = getDeviceReportsForUser(getState());
3106
+ const report = reports[reportIndex];
3107
+ if (!report) {
3108
+ return;
3109
+ }
3110
+ const { attribute, group = "", software = "" } = report;
3111
+ const effectiveAttribute = software ? software : attribute;
3112
+ const devicesById = getDevicesById(getState());
3113
+ const acceptedDevices = getAcceptedDevices(getState());
3114
+ const groups = getGroupsById(getState());
3115
+ const { deviceIds = [], filters = [], total = 0 } = groups[group] || {};
3116
+ let groupDevicesRequest = Promise.resolve({
3117
+ payload: { groupName: "", group: { deviceIds: Object.keys(devicesById), total: Object.keys(devicesById).length } }
3118
+ });
3119
+ if (group && (!(deviceIds.length && total) || deviceIds.length !== total || !deviceIds.every((id) => !!devicesById[id]))) {
3120
+ groupDevicesRequest = filters.length ? dispatch(getAllDynamicGroupDevices({ group, attribute: effectiveAttribute })).unwrap() : dispatch(getAllGroupDevices({ group, attribute: effectiveAttribute })).unwrap();
3121
+ } else if (!group && (acceptedDevices.deviceIds.length !== acceptedDevices.total || !acceptedDevices.deviceIds.every((id) => !!devicesById[id]))) {
3122
+ groupDevicesRequest = dispatch(getAllDevicesByStatus({ status: import_constants5.DEVICE_STATES.accepted, attribute: effectiveAttribute })).unwrap();
3123
+ }
3124
+ return groupDevicesRequest.then(() => dispatch(updateReportData(reportIndex)));
3125
+ }
3393
3126
  );
3394
- var getDeviceConnect = (0, import_toolkit18.createAsyncThunk)(
3127
+ var getDeviceConnect = createAppAsyncThunk(
3395
3128
  `${sliceName3}/getDeviceConnect`,
3396
- (id, { dispatch }) => general_api_default.get(`${deviceConnect}/devices/${id}`).then(
3129
+ (id, { dispatch }) => general_api_default.get(`${import_constants5.deviceConnect}/devices/${id}`).then(
3397
3130
  ({ data }) => Promise.all([dispatch(actions3.receivedDevice({ connect_status: data.status, connect_updated_ts: data.updated_ts, id })), Promise.resolve(data)])
3398
3131
  )
3399
3132
  );
3400
3133
  var updateTypeMap = { deploymentUpdate: "check-update", inventoryUpdate: "send-inventory" };
3401
- var triggerDeviceUpdate = (0, import_toolkit18.createAsyncThunk)(
3134
+ var triggerDeviceUpdate = createAppAsyncThunk(
3402
3135
  `${sliceName3}/triggerDeviceUpdate`,
3403
- ({ id, type }, { dispatch }) => general_api_default.post(`${deviceConnect}/devices/${id}/${updateTypeMap[type] ?? updateTypeMap.deploymentUpdate}`).then(
3136
+ ({ id, type }, { dispatch }) => general_api_default.post(`${import_constants5.deviceConnect}/devices/${id}/${updateTypeMap[type] ?? updateTypeMap.deploymentUpdate}`).then(
3404
3137
  () => new Promise((resolve) => setTimeout(() => resolve(dispatch(getDeviceById2(id))), TIMEOUTS.threeSeconds))
3405
3138
  )
3406
3139
  );
3407
- var getSessionDetails = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getSessionDetails`, ({ sessionId, deviceId, userId, startDate, endDate }) => {
3408
- const { start: startUnix, end: endUnix } = (0, import_helpers8.dateRangeToUnix)(startDate, endDate);
3409
- const createdAfter = startDate ? `&created_after=${startUnix}` : "";
3410
- const createdBefore = endDate ? `&created_before=${endUnix}` : "";
3411
- const objectSearch = `&object_id=${deviceId}`;
3412
- return general_api_default.get(`${auditLogsApiUrl}/logs?per_page=500${createdAfter}${createdBefore}&actor_id=${userId}${objectSearch}`).then(
3413
- ({ data: auditLogEntries }) => {
3414
- const { start, end } = auditLogEntries.reduce(
3415
- (accu, item) => {
3416
- if (item.meta?.session_id?.includes(sessionId)) {
3417
- accu.start = new Date(item.action.startsWith("open") ? item.time : accu.start);
3418
- accu.end = new Date(item.action.startsWith("close") ? item.time : accu.end);
3419
- }
3420
- return accu;
3421
- },
3422
- { start: startDate || endDate, end: endDate || startDate }
3423
- );
3424
- return Promise.resolve({ start, end });
3425
- }
3426
- );
3427
- });
3428
- var getDeviceFileDownloadLink = (0, import_toolkit18.createAsyncThunk)(
3140
+ var getSessionDetails = createAppAsyncThunk(
3141
+ `${sliceName3}/getSessionDetails`,
3142
+ ({ sessionId, deviceId, userId, startDate, endDate }) => {
3143
+ const { start: startUnix, end: endUnix } = (0, import_helpers8.dateRangeToUnix)(startDate, endDate);
3144
+ const createdAfter = startDate ? `&created_after=${startUnix}` : "";
3145
+ const createdBefore = endDate ? `&created_before=${endUnix}` : "";
3146
+ const objectSearch = `&object_id=${deviceId}`;
3147
+ return general_api_default.get(`${import_constants5.auditLogsApiUrl}/logs?per_page=500${createdAfter}${createdBefore}&actor_id=${userId}${objectSearch}`).then(
3148
+ ({ data: auditLogEntries }) => {
3149
+ const { start, end } = auditLogEntries.reduce(
3150
+ (accu, item) => {
3151
+ if (item.meta?.session_id?.includes(sessionId)) {
3152
+ accu.start = new Date(item.action.startsWith("open") ? item.time : accu.start);
3153
+ accu.end = new Date(item.action.startsWith("close") ? item.time : accu.end);
3154
+ }
3155
+ return accu;
3156
+ },
3157
+ { start: startDate || endDate, end: endDate || startDate }
3158
+ );
3159
+ return Promise.resolve({ start, end });
3160
+ }
3161
+ );
3162
+ }
3163
+ );
3164
+ var getDeviceFileDownloadLink = createAppAsyncThunk(
3429
3165
  `${sliceName3}/getDeviceFileDownloadLink`,
3430
- ({ deviceId, path }) => Promise.resolve(`${window.location.origin}${deviceConnect}/devices/${deviceId}/download?path=${encodeURIComponent(path)}`)
3166
+ ({ deviceId, path }) => Promise.resolve(`${window.location.origin}${import_constants5.deviceConnect}/devices/${deviceId}/download?path=${encodeURIComponent(path)}`)
3431
3167
  );
3432
- var deviceFileUpload = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/deviceFileUpload`, ({ deviceId, path, file }, { dispatch }) => {
3433
- let formData = new FormData();
3434
- formData.append("path", path);
3435
- formData.append("file", file);
3436
- const uploadId = (0, import_uuid.v4)();
3437
- const cancelSource = new AbortController();
3438
- return Promise.all([
3439
- dispatch(setSnackbar2("Uploading file")),
3440
- dispatch(initUpload({ id: uploadId, upload: { inprogress: true, uploadProgress: 0, cancelSource } })),
3441
- general_api_default.uploadPut(
3442
- `${deviceConnect}/devices/${deviceId}/upload`,
3443
- formData,
3444
- (e) => dispatch(uploadProgress2({ id: uploadId, progress: progress(e) })),
3445
- cancelSource.signal
3446
- )
3447
- ]).then(() => Promise.resolve(dispatch(setSnackbar2("Upload successful", TIMEOUTS.fiveSeconds)))).catch((err) => {
3448
- if ((0, import_axios2.isCancel)(err)) {
3449
- return dispatch(setSnackbar2("The upload has been cancelled", TIMEOUTS.fiveSeconds));
3450
- }
3451
- return commonErrorHandler(err, `Error uploading file to device.`, dispatch);
3452
- }).finally(() => dispatch(cleanUpUpload(uploadId)));
3453
- });
3454
- var getDeviceAuth = (0, import_toolkit18.createAsyncThunk)(
3168
+ var deviceFileUpload = createAppAsyncThunk(
3169
+ `${sliceName3}/deviceFileUpload`,
3170
+ ({ deviceId, path, file }, { dispatch }) => {
3171
+ const formData = new FormData();
3172
+ formData.append("path", path);
3173
+ formData.append("file", file);
3174
+ const uploadId = (0, import_uuid.v4)();
3175
+ const cancelSource = new AbortController();
3176
+ return Promise.all([
3177
+ dispatch(setSnackbar2("Uploading file")),
3178
+ dispatch(initUpload({ id: uploadId, upload: { progress: 0, cancelSource } })),
3179
+ general_api_default.uploadPut(
3180
+ `${import_constants5.deviceConnect}/devices/${deviceId}/upload`,
3181
+ formData,
3182
+ (e) => dispatch(uploadProgress2({ id: uploadId, progress: progress(e) })),
3183
+ cancelSource.signal
3184
+ )
3185
+ ]).then(() => Promise.resolve(dispatch(setSnackbar2({ message: "Upload successful", autoHideDuration: TIMEOUTS.fiveSeconds })))).catch((err) => {
3186
+ if ((0, import_axios2.isCancel)(err)) {
3187
+ return dispatch(setSnackbar2({ message: "The upload has been cancelled", autoHideDuration: TIMEOUTS.fiveSeconds }));
3188
+ }
3189
+ return commonErrorHandler(err, `Error uploading file to device.`, dispatch);
3190
+ }).finally(() => dispatch(cleanUpUpload(uploadId)));
3191
+ }
3192
+ );
3193
+ var getDeviceAuth = createAppAsyncThunk(
3455
3194
  `${sliceName3}/getDeviceAuth`,
3456
3195
  (id, { dispatch }) => dispatch(getDevicesWithAuth([{ id }])).unwrap().then((results) => {
3457
3196
  if (results[results.length - 1]) {
@@ -3460,81 +3199,86 @@ var getDeviceAuth = (0, import_toolkit18.createAsyncThunk)(
3460
3199
  return Promise.resolve();
3461
3200
  })
3462
3201
  );
3463
- var getDevicesWithAuth = (0, import_toolkit18.createAsyncThunk)(
3202
+ var getDevicesWithAuth = createAppAsyncThunk(
3464
3203
  `${sliceName3}/getDevicesWithAuth`,
3465
- (devices, { dispatch, getState }) => devices.length ? general_api_default.get(`${deviceAuthV2}/devices?id=${devices.map((device) => device.id).join("&id=")}`).then(({ data: receivedDevices }) => {
3204
+ (devices, { dispatch, getState }) => devices.length ? general_api_default.get(`${import_constants5.deviceAuthV2}/devices?id=${devices.map((device) => device.id).join("&id=")}`).then(({ data: receivedDevices }) => {
3466
3205
  const { devicesById } = reduceReceivedDevices(receivedDevices, [], getState());
3467
3206
  return Promise.all([dispatch(actions3.receivedDevices(devicesById)), Promise.resolve(receivedDevices)]);
3468
3207
  }).catch((err) => commonErrorHandler(err, `Error: ${err}`, dispatch)) : Promise.resolve([[], []])
3469
3208
  );
3470
- var updateDeviceAuth = (0, import_toolkit18.createAsyncThunk)(
3209
+ var updateDeviceAuth = createAppAsyncThunk(
3471
3210
  `${sliceName3}/updateDeviceAuth`,
3472
- ({ deviceId, authId, status }, { dispatch, getState }) => general_api_default.put(`${deviceAuthV2}/devices/${deviceId}/auth/${authId}/status`, { status }).then(() => Promise.all([dispatch(getDeviceAuth(deviceId)), dispatch(setSnackbar2("Device authorization status was updated successfully"))])).catch((err) => commonErrorHandler(err, "There was a problem updating the device authorization status:", dispatch)).then(() => Promise.resolve(dispatch(actions3.maybeUpdateDevicesByStatus({ deviceId, authId })))).finally(() => dispatch(setDeviceListState({ refreshTrigger: !getDeviceListState(getState()).refreshTrigger })))
3211
+ ({ deviceId, authId, status }, { dispatch, getState }) => general_api_default.put(`${import_constants5.deviceAuthV2}/devices/${deviceId}/auth/${authId}/status`, { status }).then(() => Promise.all([dispatch(getDeviceAuth(deviceId)), dispatch(setSnackbar2("Device authorization status was updated successfully"))])).catch((err) => commonErrorHandler(err, "There was a problem updating the device authorization status:", dispatch)).then(() => Promise.resolve(dispatch(actions3.maybeUpdateDevicesByStatus({ deviceId, authId })))).finally(() => dispatch(setDeviceListState({ refreshTrigger: !getDeviceListState(getState()).refreshTrigger })))
3473
3212
  );
3474
- var updateDevicesAuth = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/updateDevicesAuth`, ({ deviceIds, status }, { dispatch, getState }) => {
3475
- let devices = getDevicesById(getState());
3476
- const deviceIdsWithoutAuth = deviceIds.reduce((accu, id) => devices[id].auth_sets ? accu : [...accu, { id }], []);
3477
- return dispatch(getDevicesWithAuth(deviceIdsWithoutAuth)).then(() => {
3478
- devices = getDevicesById(getState());
3479
- const deviceAuthUpdates = deviceIds.map((id) => {
3480
- const device = devices[id];
3481
- if (device.auth_sets.length !== 1) {
3482
- return Promise.reject();
3483
- }
3484
- return dispatch(updateDeviceAuth({ authId: device.auth_sets[0].id, deviceId: device.id, status })).unwrap().catch((err) => commonErrorHandler(err, "The action was stopped as there was a problem updating a device authorization status: ", dispatch, "", false));
3485
- });
3486
- return Promise.allSettled(deviceAuthUpdates).then((results) => {
3487
- const { skipped, count } = results.reduce(
3488
- (accu, item) => {
3489
- if (item.status === "rejected") {
3490
- accu.skipped = accu.skipped + 1;
3491
- } else {
3492
- accu.count = accu.count + 1;
3493
- }
3494
- return accu;
3495
- },
3496
- { skipped: 0, count: 0 }
3497
- );
3498
- const message = (0, import_helpers8.getSnackbarMessage)(skipped, count);
3499
- return dispatch(setSnackbar2(message));
3213
+ var updateDevicesAuth = createAppAsyncThunk(
3214
+ `${sliceName3}/updateDevicesAuth`,
3215
+ ({ deviceIds, status }, { dispatch, getState }) => {
3216
+ let devices = getDevicesById(getState());
3217
+ const deviceIdsWithoutAuth = deviceIds.reduce((accu, id) => devices[id].auth_sets ? accu : [...accu, { id }], []);
3218
+ return dispatch(getDevicesWithAuth(deviceIdsWithoutAuth)).then(() => {
3219
+ devices = getDevicesById(getState());
3220
+ const deviceAuthUpdates = deviceIds.map((id) => {
3221
+ const device = devices[id];
3222
+ if (device.auth_sets && device.auth_sets.length !== 1) {
3223
+ return Promise.reject();
3224
+ }
3225
+ return dispatch(updateDeviceAuth({ authId: device.auth_sets[0].id, deviceId: device.id, status })).unwrap().catch((err) => commonErrorHandler(err, "The action was stopped as there was a problem updating a device authorization status: ", dispatch, "", false));
3226
+ });
3227
+ return Promise.allSettled(deviceAuthUpdates).then((results) => {
3228
+ const { skipped, count } = results.reduce(
3229
+ (accu, item) => {
3230
+ if (item.status === "rejected") {
3231
+ accu.skipped = accu.skipped + 1;
3232
+ } else {
3233
+ accu.count = accu.count + 1;
3234
+ }
3235
+ return accu;
3236
+ },
3237
+ { skipped: 0, count: 0 }
3238
+ );
3239
+ const message = (0, import_helpers8.getSnackbarMessage)(skipped, count);
3240
+ return dispatch(setSnackbar2(message));
3241
+ });
3500
3242
  });
3501
- });
3502
- });
3503
- var deleteAuthset = (0, import_toolkit18.createAsyncThunk)(
3243
+ }
3244
+ );
3245
+ var deleteAuthset = createAppAsyncThunk(
3504
3246
  `${sliceName3}/deleteAuthset`,
3505
- ({ deviceId, authId }, { dispatch, getState }) => general_api_default.delete(`${deviceAuthV2}/devices/${deviceId}/auth/${authId}`).then(() => Promise.all([dispatch(setSnackbar2("Device authorization status was updated successfully"))])).catch((err) => commonErrorHandler(err, "There was a problem updating the device authorization status:", dispatch)).then(() => Promise.resolve(dispatch(actions3.maybeUpdateDevicesByStatus({ deviceId, authId })))).finally(() => dispatch(setDeviceListState({ refreshTrigger: !getState().devices.deviceList.refreshTrigger })))
3247
+ ({ deviceId, authId }, { dispatch, getState }) => general_api_default.delete(`${import_constants5.deviceAuthV2}/devices/${deviceId}/auth/${authId}`).then(() => Promise.all([dispatch(setSnackbar2("Device authorization status was updated successfully"))])).catch((err) => commonErrorHandler(err, "There was a problem updating the device authorization status:", dispatch)).then(() => Promise.resolve(dispatch(actions3.maybeUpdateDevicesByStatus({ deviceId, authId })))).finally(() => dispatch(setDeviceListState({ refreshTrigger: !getState().devices.deviceList.refreshTrigger })))
3506
3248
  );
3507
- var preauthDevice = (0, import_toolkit18.createAsyncThunk)(
3249
+ var preauthDevice = createAppAsyncThunk(
3508
3250
  `${sliceName3}/preauthDevice`,
3509
- (authset, { dispatch, rejectWithValue }) => general_api_default.post(`${deviceAuthV2}/devices`, authset).then(() => Promise.resolve(dispatch(setSnackbar2("Device was successfully added to the preauthorization list", TIMEOUTS.fiveSeconds)))).catch((err) => {
3251
+ (authset, { dispatch, rejectWithValue }) => general_api_default.post(`${import_constants5.deviceAuthV2}/devices`, authset).then(
3252
+ () => Promise.resolve(dispatch(setSnackbar2({ message: "Device was successfully added to the preauthorization list", autoHideDuration: TIMEOUTS.fiveSeconds })))
3253
+ ).catch((err) => {
3510
3254
  if (err.response.status === 409) {
3511
3255
  return rejectWithValue("A device with a matching identity data set already exists");
3512
3256
  }
3513
3257
  return commonErrorHandler(err, "The device could not be added:", dispatch);
3514
3258
  })
3515
3259
  );
3516
- var decommissionDevice = (0, import_toolkit18.createAsyncThunk)(
3260
+ var decommissionDevice = createAppAsyncThunk(
3517
3261
  `${sliceName3}/decommissionDevice`,
3518
- ({ deviceId, authId }, { dispatch, getState }) => general_api_default.delete(`${deviceAuthV2}/devices/${deviceId}`).then(() => Promise.resolve(dispatch(setSnackbar2("Device was decommissioned successfully")))).catch((err) => commonErrorHandler(err, "There was a problem decommissioning the device:", dispatch)).then(() => Promise.resolve(dispatch(actions3.maybeUpdateDevicesByStatus({ deviceId, authId })))).finally(() => dispatch(setDeviceListState({ refreshTrigger: !getState().devices.deviceList.refreshTrigger })))
3262
+ ({ deviceId, authId }, { dispatch, getState }) => general_api_default.delete(`${import_constants5.deviceAuthV2}/devices/${deviceId}`).then(() => Promise.resolve(dispatch(setSnackbar2("Device was decommissioned successfully")))).catch((err) => commonErrorHandler(err, "There was a problem decommissioning the device:", dispatch)).then(() => Promise.resolve(dispatch(actions3.maybeUpdateDevicesByStatus({ deviceId, authId })))).finally(() => dispatch(setDeviceListState({ refreshTrigger: !getState().devices.deviceList.refreshTrigger })))
3519
3263
  );
3520
- var getDeviceConfig = (0, import_toolkit18.createAsyncThunk)(
3264
+ var getDeviceConfig = createAppAsyncThunk(
3521
3265
  `${sliceName3}/getDeviceConfig`,
3522
- (deviceId, { dispatch }) => general_api_default.get(`${deviceConfig}/${deviceId}`).then(({ data }) => Promise.all([dispatch(actions3.receivedDevice({ id: deviceId, config: data })), Promise.resolve(data)])).catch((err) => {
3266
+ (deviceId, { dispatch }) => general_api_default.get(`${import_constants5.deviceConfig}/${deviceId}`).then(({ data }) => Promise.all([dispatch(actions3.receivedDevice({ id: deviceId, config: data })), Promise.resolve(data)])).catch((err) => {
3523
3267
  if (err.response?.data?.error.status_code !== 404) {
3524
3268
  return commonErrorHandler(err, `There was an error retrieving the configuration for device ${deviceId}.`, dispatch, commonErrorFallback);
3525
3269
  }
3526
3270
  })
3527
3271
  );
3528
- var setDeviceConfig = (0, import_toolkit18.createAsyncThunk)(
3272
+ var setDeviceConfig = createAppAsyncThunk(
3529
3273
  `${sliceName3}/setDeviceConfig`,
3530
- ({ deviceId, config }, { dispatch }) => general_api_default.put(`${deviceConfig}/${deviceId}`, config).catch((err) => commonErrorHandler(err, `There was an error setting the configuration for device ${deviceId}.`, dispatch, commonErrorFallback)).then(() => Promise.resolve(dispatch(getDeviceConfig(deviceId))))
3274
+ ({ deviceId, config }, { dispatch }) => general_api_default.put(`${import_constants5.deviceConfig}/${deviceId}`, config).catch((err) => commonErrorHandler(err, `There was an error setting the configuration for device ${deviceId}.`, dispatch, commonErrorFallback)).then(() => Promise.resolve(dispatch(getDeviceConfig(deviceId))))
3531
3275
  );
3532
- var applyDeviceConfig = (0, import_toolkit18.createAsyncThunk)(
3276
+ var applyDeviceConfig = createAppAsyncThunk(
3533
3277
  `${sliceName3}/applyDeviceConfig`,
3534
- ({ deviceId, configDeploymentConfiguration, isDefault, config }, { dispatch, getState }) => general_api_default.post(`${deviceConfig}/${deviceId}/deploy`, configDeploymentConfiguration).catch((err) => commonErrorHandler(err, `There was an error deploying the configuration to device ${deviceId}.`, dispatch, commonErrorFallback)).then(({ data }) => {
3278
+ ({ deviceId, configDeploymentConfiguration, isDefault, config }, { dispatch, getState }) => general_api_default.post(`${import_constants5.deviceConfig}/${deviceId}/deploy`, configDeploymentConfiguration).catch((err) => commonErrorHandler(err, `There was an error deploying the configuration to device ${deviceId}.`, dispatch, commonErrorFallback)).then(({ data }) => {
3535
3279
  const device = getDeviceById(getState(), deviceId);
3536
3280
  const { canManageUsers } = getUserCapabilities(getState());
3537
- let tasks = [
3281
+ const tasks = [
3538
3282
  dispatch(actions3.receivedDevice({ ...device, config: { ...device.config, deployment_id: data.deployment_id } })),
3539
3283
  new Promise((resolve) => setTimeout(() => resolve(dispatch(getSingleDeployment(data.deployment_id))), TIMEOUTS.oneSecond))
3540
3284
  ];
@@ -3545,23 +3289,26 @@ var applyDeviceConfig = (0, import_toolkit18.createAsyncThunk)(
3545
3289
  return Promise.all(tasks);
3546
3290
  })
3547
3291
  );
3548
- var setDeviceTags = (0, import_toolkit18.createAsyncThunk)(
3292
+ var setDeviceTags = createAppAsyncThunk(
3549
3293
  `${sliceName3}/setDeviceTags`,
3550
3294
  ({ deviceId, tags }, { dispatch }) => (
3551
3295
  // to prevent tag set failures, retrieve the device & use the freshest etag we can get
3552
- Promise.resolve(dispatch(getDeviceById2(deviceId))).then((device) => {
3296
+ dispatch(getDeviceById2(deviceId)).unwrap().then((device) => {
3553
3297
  const headers = device.etag ? { "If-Match": device.etag } : {};
3554
- return general_api_default.put(
3555
- `${inventoryApiUrl}/devices/${deviceId}/tags`,
3556
- Object.entries(tags).map(([name, value]) => ({ name, value })),
3557
- { headers }
3558
- ).catch((err) => commonErrorHandler(err, `There was an error setting tags for device ${deviceId}.`, dispatch, "Please check your connection.")).then(() => Promise.all([dispatch(actions3.receivedDevice({ ...device, id: deviceId, tags })), dispatch(setSnackbar2("Device name changed"))]));
3298
+ const tagList = Object.entries(tags).map(([name, value]) => ({ name, value }));
3299
+ const isNameChange = tagList.some(({ name }) => name === "name");
3300
+ return general_api_default.put(`${import_constants5.inventoryApiUrl}/devices/${deviceId}/tags`, tagList, { headers }).catch((err) => commonErrorHandler(err, `There was an error setting tags for device ${deviceId}.`, dispatch, "Please check your connection.")).then(
3301
+ () => Promise.all([
3302
+ dispatch(actions3.receivedDevice({ ...device, id: deviceId, tags })),
3303
+ dispatch(setSnackbar2(`Device ${tagList.length === 1 && isNameChange ? "name" : "tags"} changed`))
3304
+ ])
3305
+ );
3559
3306
  })
3560
3307
  )
3561
3308
  );
3562
- var getDeviceTwin = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getDeviceTwin`, ({ deviceId, integration }, { dispatch, getState }) => {
3309
+ var getDeviceTwin = createAppAsyncThunk(`${sliceName3}/getDeviceTwin`, ({ deviceId, integration }, { dispatch, getState }) => {
3563
3310
  let providerResult = {};
3564
- return general_api_default.get(`${iotManagerBaseURL}/devices/${deviceId}/state`).then(({ data }) => {
3311
+ return general_api_default.get(`${import_constants5.iotManagerBaseURL}/devices/${deviceId}/state`).then(({ data }) => {
3565
3312
  providerResult = { ...data, twinError: "" };
3566
3313
  }).catch((err) => {
3567
3314
  providerResult = {
@@ -3572,9 +3319,9 @@ var getDeviceTwin = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getDev
3572
3319
  Promise.resolve(dispatch(actions3.receivedDevice({ ...device, twinsByIntegration: { ...device.twinsByIntegration, ...providerResult } })));
3573
3320
  });
3574
3321
  });
3575
- var setDeviceTwin = (0, import_toolkit18.createAsyncThunk)(
3322
+ var setDeviceTwin = createAppAsyncThunk(
3576
3323
  `${sliceName3}/setDeviceTwin`,
3577
- ({ deviceId, integration, settings }, { dispatch, getState }) => general_api_default.put(`${iotManagerBaseURL}/devices/${deviceId}/state/${integration.id}`, { desired: settings }).catch(
3324
+ ({ deviceId, integration, settings }, { dispatch, getState }) => general_api_default.put(`${import_constants5.iotManagerBaseURL}/devices/${deviceId}/state/${integration.id}`, { desired: settings }).catch(
3578
3325
  (err) => commonErrorHandler(
3579
3326
  err,
3580
3327
  `There was an error updating the ${EXTERNAL_PROVIDER[integration.provider].twinTitle.toLowerCase()} for device ${deviceId}.`,
@@ -3585,7 +3332,9 @@ var setDeviceTwin = (0, import_toolkit18.createAsyncThunk)(
3585
3332
  const { twinsByIntegration = {} } = device;
3586
3333
  const { [integration.id]: currentState = {} } = twinsByIntegration;
3587
3334
  return Promise.resolve(
3588
- dispatch(actions3.receivedDevice({ ...device, twinsByIntegration: { ...twinsByIntegration, [integration.id]: { ...currentState, desired: settings } } }))
3335
+ dispatch(
3336
+ actions3.receivedDevice({ ...device, twinsByIntegration: { ...twinsByIntegration, [integration.id]: { ...currentState, desired: settings } } })
3337
+ )
3589
3338
  );
3590
3339
  })
3591
3340
  );
@@ -3596,7 +3345,7 @@ var prepareSearchArguments = ({ filters, group, state, status }) => {
3596
3345
  const attributes = [...defaultAttributes, getIdAttribute(state), ...selectedAttributes];
3597
3346
  return { attributes, filterTerms };
3598
3347
  };
3599
- var getSystemDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getSystemDevices`, (options, { dispatch, getState }) => {
3348
+ var getSystemDevices = createAppAsyncThunk(`${sliceName3}/getSystemDevices`, (options, { dispatch, getState }) => {
3600
3349
  const { id, page = defaultPage, perPage = defaultPerPage, sortOptions = [] } = options;
3601
3350
  const state = getState();
3602
3351
  const { hasFullFiltering } = getTenantCapabilities(state);
@@ -3606,7 +3355,7 @@ var getSystemDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/get
3606
3355
  const { attributes: deviceAttributes = {} } = getDeviceById(state, id);
3607
3356
  const { mender_gateway_system_id = "" } = deviceAttributes;
3608
3357
  const filters = [
3609
- { ...emptyFilter, key: "mender_is_gateway", operator: DEVICE_FILTERING_OPTIONS.$ne.key, value: "true", scope: "inventory" },
3358
+ { ...emptyFilter, key: "mender_is_gateway", operator: import_constants5.DEVICE_FILTERING_OPTIONS.$ne.key, value: "true", scope: "inventory" },
3610
3359
  { ...emptyFilter, key: "mender_gateway_system_id", value: mender_gateway_system_id, scope: "inventory" }
3611
3360
  ];
3612
3361
  const { attributes, filterTerms } = prepareSearchArguments({ filters, state });
@@ -3622,17 +3371,17 @@ var getSystemDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/get
3622
3371
  const device = {
3623
3372
  ...getDeviceById(state2, id),
3624
3373
  systemDeviceIds: ids,
3625
- systemDeviceTotal: Number(headers[headerNames.total])
3374
+ systemDeviceTotal: Number(headers[import_constants5.headerNames.total])
3626
3375
  };
3627
3376
  return Promise.resolve(dispatch(actions3.receivedDevices({ ...devicesById, [id]: device })));
3628
3377
  });
3629
3378
  });
3630
- var getGatewayDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getGatewayDevices`, (deviceId, { dispatch, getState }) => {
3379
+ var getGatewayDevices = createAppAsyncThunk(`${sliceName3}/getGatewayDevices`, (deviceId, { dispatch, getState }) => {
3631
3380
  const state = getState();
3632
3381
  const { attributes = {} } = getDeviceById(state, deviceId);
3633
3382
  const { mender_gateway_system_id = "" } = attributes;
3634
3383
  const filters = [
3635
- { ...emptyFilter, key: "id", operator: DEVICE_FILTERING_OPTIONS.$ne.key, value: deviceId, scope: "identity" },
3384
+ { ...emptyFilter, key: "id", operator: import_constants5.DEVICE_FILTERING_OPTIONS.$ne.key, value: deviceId, scope: "identity" },
3636
3385
  { ...emptyFilter, key: "mender_is_gateway", value: "true", scope: "inventory" },
3637
3386
  { ...emptyFilter, key: "mender_gateway_system_id", value: mender_gateway_system_id, scope: "inventory" }
3638
3387
  ];
@@ -3644,102 +3393,87 @@ var getGatewayDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/ge
3644
3393
  attributes: attributeSelection
3645
3394
  }).then(({ data }) => {
3646
3395
  const { ids } = reduceReceivedDevices(data, [], getState());
3647
- let tasks = ids.map((deviceId2) => dispatch(getDeviceInfo(deviceId2)));
3396
+ const tasks = ids.map((deviceId2) => dispatch(getDeviceInfo(deviceId2)));
3648
3397
  tasks.push(dispatch(actions3.receivedDevice({ id: deviceId, gatewayIds: ids })));
3649
3398
  return Promise.all(tasks);
3650
3399
  });
3651
3400
  });
3652
- var getDevicesInBounds = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getDevicesInBounds`, ({ bounds, group }, { dispatch, getState }) => {
3653
- const state = getState();
3654
- const { filterTerms } = convertDeviceListStateToFilters({
3655
- group: group === ALL_DEVICES ? void 0 : group,
3656
- groups: state.devices.groups,
3657
- status: DEVICE_STATES.accepted
3658
- });
3659
- return general_api_default.post(getSearchEndpoint(getState()), {
3660
- page: 1,
3661
- per_page: MAX_PAGE_SIZE,
3662
- filters: filterTerms,
3663
- attributes: geoAttributes,
3664
- geo_bounding_box_filter: {
3665
- geo_bounding_box: {
3666
- location: {
3667
- top_left: { lat: bounds._northEast.lat, lon: bounds._southWest.lng },
3668
- bottom_right: { lat: bounds._southWest.lat, lon: bounds._northEast.lng }
3669
- }
3670
- }
3671
- }
3672
- }).then(({ data }) => {
3673
- const { devicesById } = reduceReceivedDevices(data, [], getState());
3674
- return Promise.resolve(dispatch(actions3.receivedDevices(devicesById)));
3675
- });
3676
- });
3677
3401
 
3678
3402
  // src/monitorSlice/thunks.ts
3679
- var import_toolkit19 = require("@reduxjs/toolkit");
3680
- var { page: defaultPage2, perPage: defaultPerPage2 } = DEVICE_LIST_DEFAULTS;
3403
+ var { page: defaultPage2, perPage: defaultPerPage2 } = import_constants5.DEVICE_LIST_DEFAULTS;
3681
3404
  var cutoffLength = 75;
3682
3405
  var ellipsis = "...";
3683
3406
  var longTextTrimmer = (text) => text.length >= cutoffLength + ellipsis.length ? `${text.substring(0, cutoffLength + ellipsis.length)}${ellipsis}` : text;
3684
- var sanitizeDeviceAlerts = (alerts) => alerts.map((alert) => ({ ...alert, fullName: alert.name, name: longTextTrimmer(alert.name) }));
3685
- var getDeviceAlerts = (0, import_toolkit19.createAsyncThunk)(`${sliceName4}/getDeviceAlerts`, ({ id, config = {} }, { dispatch }) => {
3407
+ var sanitizeDeviceAlerts = (alerts) => alerts.map((alert) => ({ ...alert, fullName: alert.name, name: longTextTrimmer(alert.name || "") }));
3408
+ var getDeviceAlerts = createAppAsyncThunk(`${sliceName4}/getDeviceAlerts`, ({ id, config = {} }, { dispatch }) => {
3686
3409
  const { page = defaultPage2, perPage = defaultPerPage2, issuedBefore, issuedAfter, sortAscending = false } = config;
3687
3410
  const issued_after = issuedAfter ? `&issued_after=${issuedAfter}` : "";
3688
3411
  const issued_before = issuedBefore ? `&issued_before=${issuedBefore}` : "";
3689
- return general_api_default.get(`${monitorApiUrlv1}/devices/${id}/alerts?page=${page}&per_page=${perPage}${issued_after}${issued_before}&sort_ascending=${sortAscending}`).catch((err) => commonErrorHandler(err, `Retrieving device alerts for device ${id} failed:`, dispatch)).then(
3412
+ return general_api_default.get(
3413
+ `${import_constants5.monitorApiUrlv1}/devices/${id}/alerts?page=${page}&per_page=${perPage}${issued_after}${issued_before}&sort_ascending=${sortAscending}`
3414
+ ).catch((err) => commonErrorHandler(err, `Retrieving device alerts for device ${id} failed:`, dispatch)).then(
3690
3415
  (res) => Promise.all([
3691
3416
  dispatch(actions4.receiveDeviceAlerts({ deviceId: id, alerts: sanitizeDeviceAlerts(res.data) })),
3692
- dispatch(actions4.setAlertListState({ total: Number(res.headers[headerNames.total]) }))
3417
+ dispatch(actions4.setAlertListState({ total: Number(res.headers[import_constants5.headerNames.total]) }))
3693
3418
  ])
3694
3419
  );
3695
3420
  });
3696
- var getLatestDeviceAlerts = (0, import_toolkit19.createAsyncThunk)(`${sliceName4}/getLatestDeviceAlerts`, ({ id, config = {} }, { dispatch }) => {
3697
- const { page = defaultPage2, perPage = 10 } = config;
3698
- return general_api_default.get(`${monitorApiUrlv1}/devices/${id}/alerts/latest?page=${page}&per_page=${perPage}`).catch((err) => commonErrorHandler(err, `Retrieving device alerts for device ${id} failed:`, dispatch)).then((res) => Promise.resolve(dispatch(actions4.receiveLatestDeviceAlerts({ deviceId: id, alerts: sanitizeDeviceAlerts(res.data) }))));
3699
- });
3700
- var getIssueCountsByType2 = (0, import_toolkit19.createAsyncThunk)(`${sliceName4}/getIssueCountsByType`, ({ type, options = {} }, { dispatch, getState }) => {
3701
- const state = getState();
3702
- const { filters = getDeviceFilters(state), group, status, ...remainder } = options;
3703
- const { applicableFilters: nonMonitorFilters, filterTerms } = convertDeviceListStateToFilters({
3704
- ...remainder,
3705
- filters,
3706
- group,
3707
- offlineThreshold: state.app.offlineThreshold,
3708
- selectedIssues: [type],
3709
- status
3710
- });
3711
- return general_api_default.post(getSearchEndpoint(getState()), {
3712
- page: 1,
3713
- per_page: 1,
3714
- filters: filterTerms,
3715
- attributes: [{ scope: "identity", attribute: "status" }]
3716
- }).catch((err) => commonErrorHandler(err, `Retrieving issue counts failed:`, dispatch, commonErrorFallback)).then((res) => {
3717
- const total = nonMonitorFilters.length ? state.monitor.issueCounts.byType[type].total : Number(res.headers[headerNames.total]);
3718
- const filtered = nonMonitorFilters.length ? Number(res.headers[headerNames.total]) : total;
3719
- if (total === state.monitor.issueCounts.byType[type].total && filtered === state.monitor.issueCounts.byType[type].filtered) {
3720
- return Promise.resolve();
3721
- }
3722
- return Promise.resolve(dispatch(actions4.receiveDeviceIssueCounts({ counts: { filtered, total }, issueType: type })));
3723
- });
3724
- });
3725
- var getDeviceMonitorConfig = (0, import_toolkit19.createAsyncThunk)(
3421
+ var getLatestDeviceAlerts = createAppAsyncThunk(
3422
+ `${sliceName4}/getLatestDeviceAlerts`,
3423
+ ({ id, config = {} }, { dispatch }) => {
3424
+ const { page = defaultPage2, perPage = 10 } = config;
3425
+ return general_api_default.get(`${import_constants5.monitorApiUrlv1}/devices/${id}/alerts/latest?page=${page}&per_page=${perPage}`).catch((err) => commonErrorHandler(err, `Retrieving device alerts for device ${id} failed:`, dispatch)).then((res) => Promise.resolve(dispatch(actions4.receiveLatestDeviceAlerts({ deviceId: id, alerts: sanitizeDeviceAlerts(res.data) }))));
3426
+ }
3427
+ );
3428
+ var getIssueCountsByType2 = createAppAsyncThunk(
3429
+ `${sliceName4}/getIssueCountsByType`,
3430
+ ({ type, options = {} }, { dispatch, getState }) => {
3431
+ const state = getState();
3432
+ const { filters = getDeviceFilters(state), group, status, ...remainder } = options;
3433
+ const { applicableFilters: nonMonitorFilters, filterTerms } = convertDeviceListStateToFilters({
3434
+ ...remainder,
3435
+ filters,
3436
+ group,
3437
+ offlineThreshold: state.app.offlineThreshold,
3438
+ selectedIssues: [type],
3439
+ status
3440
+ });
3441
+ return general_api_default.post(getSearchEndpoint(getState()), {
3442
+ page: 1,
3443
+ per_page: 1,
3444
+ filters: filterTerms,
3445
+ attributes: [{ scope: "identity", attribute: "status" }]
3446
+ }).catch((err) => commonErrorHandler(err, `Retrieving issue counts failed:`, dispatch, commonErrorFallback)).then((res) => {
3447
+ const total = nonMonitorFilters.length ? state.monitor.issueCounts.byType[type].total : Number(res.headers[import_constants5.headerNames.total]);
3448
+ const filtered = nonMonitorFilters.length ? Number(res.headers[import_constants5.headerNames.total]) : total;
3449
+ if (total === state.monitor.issueCounts.byType[type].total && filtered === state.monitor.issueCounts.byType[type].filtered) {
3450
+ return Promise.resolve();
3451
+ }
3452
+ return Promise.resolve(dispatch(actions4.receiveDeviceIssueCounts({ counts: { filtered, total }, issueType: type })));
3453
+ });
3454
+ }
3455
+ );
3456
+ var getDeviceMonitorConfig = createAppAsyncThunk(
3726
3457
  `${sliceName4}/getDeviceMonitorConfig`,
3727
- (id, { dispatch }) => general_api_default.get(`${monitorApiUrlv1}/devices/${id}/config`).catch((err) => commonErrorHandler(err, `Retrieving device monitor config for device ${id} failed:`, dispatch)).then(({ data }) => Promise.all([dispatch(actions_default.receivedDevice({ id, monitors: data }), Promise.resolve(data))]))
3458
+ (id, { dispatch }) => general_api_default.get(`${import_constants5.monitorApiUrlv1}/devices/${id}/config`).catch((err) => commonErrorHandler(err, `Retrieving device monitor config for device ${id} failed:`, dispatch)).then(({ data }) => Promise.all([dispatch(actions_default.receivedDevice({ id, monitors: data }), Promise.resolve(data))]))
3728
3459
  );
3729
- var changeNotificationSetting = (0, import_toolkit19.createAsyncThunk)(
3460
+ var changeNotificationSetting = createAppAsyncThunk(
3730
3461
  `${sliceName4}/changeNotificationSetting`,
3731
- ({ enabled, channel = alertChannels.email }, { dispatch }) => {
3732
- return general_api_default.put(`${monitorApiUrlv1}/settings/global/channel/alerts/${channel}/status`, { enabled }).catch((err) => commonErrorHandler(err, `${enabled ? "En" : "Dis"}abling ${channel} alerts failed:`, dispatch)).then(
3733
- () => Promise.all([
3734
- dispatch(actions4.changeAlertChannel({ channel, enabled })),
3735
- dispatch(actions_default.setSnackbar(`Successfully ${enabled ? "en" : "dis"}abled ${channel} alerts`, TIMEOUTS.fiveSeconds))
3736
- ])
3737
- );
3738
- }
3462
+ ({ enabled, channel = import_constants5.alertChannels.email }, { dispatch }) => general_api_default.put(`${import_constants5.monitorApiUrlv1}/settings/global/channel/alerts/${channel}/status`, { enabled }).catch((err) => commonErrorHandler(err, `${enabled ? "En" : "Dis"}abling ${channel} alerts failed:`, dispatch)).then(
3463
+ () => Promise.all([
3464
+ dispatch(actions4.changeAlertChannel({ channel, enabled })),
3465
+ dispatch(
3466
+ actions_default.setSnackbar({ message: `Successfully ${enabled ? "en" : "dis"}abled ${channel} alerts`, autoHideDuration: TIMEOUTS.fiveSeconds })
3467
+ )
3468
+ ])
3469
+ )
3739
3470
  );
3740
3471
 
3741
3472
  // src/usersSlice/thunks.ts
3742
- var import_helptips = require("@northern.tech/common-ui/helptips");
3473
+ var import_helpers9 = require("@northern.tech/utils/helpers");
3474
+ var import_retrytimer = require("@northern.tech/utils/retrytimer");
3475
+ var import_md5 = __toESM(require("md5"), 1);
3476
+ var import_universal_cookie3 = __toESM(require("universal-cookie"), 1);
3743
3477
 
3744
3478
  // src/api/users-api.ts
3745
3479
  var import_axios3 = __toESM(require("axios"), 1);
@@ -3756,14 +3490,9 @@ var Api2 = {
3756
3490
  var users_api_default = Api2;
3757
3491
 
3758
3492
  // src/usersSlice/thunks.ts
3759
- var import_helpers9 = require("@northern.tech/utils/helpers");
3760
- var import_retrytimer = require("@northern.tech/utils/retrytimer");
3761
- var import_toolkit20 = require("@reduxjs/toolkit");
3762
- var import_md5 = __toESM(require("md5"), 1);
3763
- var import_universal_cookie3 = __toESM(require("universal-cookie"), 1);
3764
3493
  var cookies3 = new import_universal_cookie3.default();
3765
3494
  var { setAnnouncement, setSnackbar: setSnackbar3 } = actions_default;
3766
- var handleLoginError = (err, { token2fa: has2FA, password }, rejectWithValue) => (dispatch) => {
3495
+ var handleLoginError = (err, { token2fa: has2FA, password }, rejectWithValue) => () => {
3767
3496
  const errorText = (0, import_helpers9.extractErrorMessage)(err);
3768
3497
  const is2FABackend = errorText.includes("2fa");
3769
3498
  if (is2FABackend && !has2FA) {
@@ -3774,27 +3503,26 @@ var handleLoginError = (err, { token2fa: has2FA, password }, rejectWithValue) =>
3774
3503
  }
3775
3504
  const twoFAError = is2FABackend ? " and verification code" : "";
3776
3505
  const errorMessage = `There was a problem logging in. Please check your email${twoFAError ? "," : " and"} password${twoFAError}. If you still have problems, contact an administrator.`;
3777
- return Promise.reject(dispatch(setSnackbar3({ message: (0, import_helpers9.preformatWithRequestID)(err.response, errorMessage), action: "Copy to clipboard" })));
3506
+ return rejectWithValue({ error: errorMessage });
3778
3507
  };
3779
- var loginUser = (0, import_toolkit20.createAsyncThunk)(
3508
+ var loginUser = createAppAsyncThunk(
3780
3509
  `${sliceName8}/loginUser`,
3781
- ({ stayLoggedIn, ...userData }, { dispatch, rejectWithValue }) => users_api_default.postLogin(`${useradmApiUrlv1}/auth/login`, { ...userData, no_expiry: stayLoggedIn }).catch((err) => {
3510
+ ({ stayLoggedIn, ...userData }, { dispatch, rejectWithValue }) => users_api_default.postLogin(`${import_constants5.useradmApiUrl}/auth/login`, { ...userData, no_expiry: stayLoggedIn }).catch((err) => {
3782
3511
  cleanUp();
3783
3512
  return Promise.reject(dispatch(handleLoginError(err, userData, rejectWithValue)));
3784
- }).then(({ text: response, contentType }) => {
3785
- if (contentType.includes(APPLICATION_JSON_CONTENT_TYPE)) {
3786
- const { id, kind } = response;
3513
+ }).then(({ text: token, contentType }) => {
3514
+ if (contentType.includes(import_constants5.APPLICATION_JSON_CONTENT_TYPE)) {
3515
+ const { id, kind } = token;
3787
3516
  const type = kind.split("/")[1];
3788
3517
  const ssoLoginUrl = SSO_TYPES[type].getStartUrl(id);
3789
3518
  window.location.replace(ssoLoginUrl);
3790
3519
  return;
3791
3520
  }
3792
- const token = response;
3793
- if (contentType !== APPLICATION_JWT_CONTENT_TYPE || !token) {
3521
+ if (contentType !== import_constants5.APPLICATION_JWT_CONTENT_TYPE || !token) {
3794
3522
  return;
3795
3523
  }
3796
- let now = /* @__PURE__ */ new Date();
3797
- now.setSeconds(now.getSeconds() + maxSessionAge);
3524
+ const now = /* @__PURE__ */ new Date();
3525
+ now.setSeconds(now.getSeconds() + import_constants5.maxSessionAge);
3798
3526
  const expiresAt = stayLoggedIn ? void 0 : now.toISOString();
3799
3527
  setSessionInfo({ token, expiresAt });
3800
3528
  cookies3.remove("JWT", { path: "/" });
@@ -3810,35 +3538,35 @@ var loginUser = (0, import_toolkit20.createAsyncThunk)(
3810
3538
  });
3811
3539
  })
3812
3540
  );
3813
- var logoutUser = (0, import_toolkit20.createAsyncThunk)(`${sliceName8}/logoutUser`, (_, { dispatch, getState }) => {
3541
+ var logoutUser = createAppAsyncThunk(`${sliceName8}/logoutUser`, (_, { dispatch, getState }) => {
3814
3542
  if (Object.keys(getState().app.uploadsById).length) {
3815
3543
  return Promise.reject();
3816
3544
  }
3817
- return general_api_default.post(`${useradmApiUrlv1}/auth/logout`).finally(() => {
3545
+ return general_api_default.post(`${import_constants5.useradmApiUrl}/auth/logout`).finally(() => {
3818
3546
  cleanUp();
3819
3547
  (0, import_retrytimer.clearAllRetryTimers)(setSnackbar3);
3820
3548
  return Promise.resolve(dispatch({ type: USER_LOGOUT }));
3821
3549
  });
3822
3550
  });
3823
- var switchUserOrganization = (0, import_toolkit20.createAsyncThunk)(`${sliceName8}/switchUserOrganization`, (tenantId, { getState }) => {
3551
+ var switchUserOrganization = createAppAsyncThunk(`${sliceName8}/switchUserOrganization`, (tenantId, { getState }) => {
3824
3552
  if (Object.keys(getState().app.uploadsById).length) {
3825
3553
  return Promise.reject();
3826
3554
  }
3827
- return general_api_default.get(`${useradmApiUrlv1}/users/tenants/${tenantId}/token`).then(({ data: token }) => {
3555
+ return general_api_default.get(`${import_constants5.useradmApiUrl}/users/tenants/${tenantId}/token`).then(({ data: token }) => {
3828
3556
  window.sessionStorage.setItem("tenantChanged", "true");
3829
3557
  setSessionInfo({ ...getSessionInfo(), token });
3830
3558
  window.location.reload();
3831
3559
  });
3832
3560
  });
3833
- var passwordResetStart = (0, import_toolkit20.createAsyncThunk)(
3561
+ var passwordResetStart = createAppAsyncThunk(
3834
3562
  `${sliceName8}/passwordResetStart`,
3835
- (email, { dispatch }) => general_api_default.post(`${useradmApiUrlv1}/auth/password-reset/start`, { email }).catch(
3563
+ (email, { dispatch }) => general_api_default.post(`${import_constants5.useradmApiUrl}/auth/password-reset/start`, { email }).catch(
3836
3564
  (err) => commonErrorHandler(err, `The password reset request cannot be processed:`, dispatch, void 0, true)
3837
3565
  )
3838
3566
  );
3839
- var passwordResetComplete = (0, import_toolkit20.createAsyncThunk)(
3567
+ var passwordResetComplete = createAppAsyncThunk(
3840
3568
  `${sliceName8}/passwordResetComplete`,
3841
- ({ secretHash, newPassword }, { dispatch }) => general_api_default.post(`${useradmApiUrlv1}/auth/password-reset/complete`, { secret_hash: secretHash, password: newPassword }).catch((err = {}) => {
3569
+ ({ secretHash, newPassword }, { dispatch }) => general_api_default.post(`${import_constants5.useradmApiUrl}/auth/password-reset/complete`, { secret_hash: secretHash, password: newPassword }).catch((err = {}) => {
3842
3570
  const { error, response = {} } = err;
3843
3571
  let errorMsg = "";
3844
3572
  if (response.status == 400) {
@@ -3850,23 +3578,23 @@ var passwordResetComplete = (0, import_toolkit20.createAsyncThunk)(
3850
3578
  return Promise.reject(err);
3851
3579
  })
3852
3580
  );
3853
- var verifyEmailStart = (0, import_toolkit20.createAsyncThunk)(
3581
+ var verifyEmailStart = createAppAsyncThunk(
3854
3582
  `${sliceName8}/verifyEmailStart`,
3855
- (_, { dispatch, getState }) => general_api_default.post(`${useradmApiUrlv1}/auth/verify-email/start`, { email: getCurrentUser(getState()).email }).catch((err) => commonErrorHandler(err, "An error occured starting the email verification process:", dispatch)).finally(() => Promise.resolve(dispatch(getUser(OWN_USER_ID))))
3583
+ (_, { dispatch, getState }) => general_api_default.post(`${import_constants5.useradmApiUrl}/auth/verify-email/start`, { email: getCurrentUser(getState()).email }).catch((err) => commonErrorHandler(err, "An error occured starting the email verification process:", dispatch)).finally(() => Promise.resolve(dispatch(getUser(OWN_USER_ID))))
3856
3584
  );
3857
- var verifyEmailComplete = (0, import_toolkit20.createAsyncThunk)(
3585
+ var verifyEmailComplete = createAppAsyncThunk(
3858
3586
  `${sliceName8}/verifyEmailComplete`,
3859
- (secret_hash, { dispatch }) => general_api_default.post(`${useradmApiUrlv1}/auth/verify-email/complete`, { secret_hash }).catch((err) => commonErrorHandler(err, "An error occured completing the email verification process:", dispatch)).finally(() => Promise.resolve(dispatch(getUser(OWN_USER_ID))))
3587
+ (secret_hash, { dispatch }) => general_api_default.post(`${import_constants5.useradmApiUrl}/auth/verify-email/complete`, { secret_hash }).catch((err) => commonErrorHandler(err, "An error occured completing the email verification process:", dispatch)).finally(() => Promise.resolve(dispatch(getUser(OWN_USER_ID))))
3860
3588
  );
3861
- var verify2FA = (0, import_toolkit20.createAsyncThunk)(
3589
+ var verify2FA = createAppAsyncThunk(
3862
3590
  `${sliceName8}/verify2FA`,
3863
- (tfaData, { dispatch }) => users_api_default.putVerifyTFA(`${useradmApiUrlv1}/2faverify`, tfaData).then(() => Promise.resolve(dispatch(getUser(OWN_USER_ID)))).catch(
3591
+ (tfaData, { dispatch }) => users_api_default.putVerifyTFA(`${import_constants5.useradmApiUrl}/2faverify`, tfaData).then(() => Promise.resolve(dispatch(getUser(OWN_USER_ID)))).catch(
3864
3592
  (err) => commonErrorHandler(err, "An error occured validating the verification code: failed to verify token, please try again.", dispatch, void 0, true)
3865
3593
  )
3866
3594
  );
3867
- var getUserList = (0, import_toolkit20.createAsyncThunk)(
3595
+ var getUserList = createAppAsyncThunk(
3868
3596
  `${sliceName8}/getUserList`,
3869
- (_, { dispatch, getState }) => general_api_default.get(`${useradmApiUrlv1}/users`).then((res) => {
3597
+ (_, { dispatch, getState }) => general_api_default.get(`${import_constants5.useradmApiUrl}/users`).then((res) => {
3870
3598
  const currentUsersById = getUsersById(getState());
3871
3599
  const users = res.data.reduce(
3872
3600
  (accu, item) => {
@@ -3881,9 +3609,9 @@ var getUserList = (0, import_toolkit20.createAsyncThunk)(
3881
3609
  return dispatch(actions8.receivedUserList(users));
3882
3610
  }).catch((err) => commonErrorHandler(err, `Users couldn't be loaded.`, dispatch, commonErrorFallback))
3883
3611
  );
3884
- var getUser = (0, import_toolkit20.createAsyncThunk)(
3612
+ var getUser = createAppAsyncThunk(
3885
3613
  `${sliceName8}/getUser`,
3886
- (id, { dispatch, rejectWithValue }) => general_api_default.get(`${useradmApiUrlv1}/users/${id}`).then(
3614
+ (id, { dispatch, rejectWithValue }) => general_api_default.get(`${import_constants5.useradmApiUrl}/users/${id}`).then(
3887
3615
  ({ data: user }) => Promise.all([
3888
3616
  dispatch(actions8.receivedUser(user)),
3889
3617
  dispatch(setHideAnnouncement({ shouldHide: false, userId: user.id })),
@@ -3892,22 +3620,25 @@ var getUser = (0, import_toolkit20.createAsyncThunk)(
3892
3620
  ])
3893
3621
  ).catch((e) => rejectWithValue(e))
3894
3622
  );
3895
- var initializeSelf = (0, import_toolkit20.createAsyncThunk)(`${sliceName8}/initializeSelf`, (_, { dispatch }) => dispatch(getUser(OWN_USER_ID)));
3896
- var updateUserColumnSettings = (0, import_toolkit20.createAsyncThunk)(`${sliceName8}/updateUserColumnSettings`, ({ columns, currentUserId }, { dispatch, getState }) => {
3897
- const userId = currentUserId ?? getCurrentUser(getState()).id;
3898
- const storageKey = `${userId}-column-widths`;
3899
- let customColumns = [];
3900
- if (!columns) {
3901
- try {
3902
- customColumns = JSON.parse(window.localStorage.getItem(storageKey)) || customColumns;
3903
- } catch {
3623
+ var initializeSelf = createAppAsyncThunk(`${sliceName8}/initializeSelf`, (_, { dispatch }) => dispatch(getUser(OWN_USER_ID)));
3624
+ var updateUserColumnSettings = createAppAsyncThunk(
3625
+ `${sliceName8}/updateUserColumnSettings`,
3626
+ ({ columns, currentUserId }, { dispatch, getState }) => {
3627
+ const userId = currentUserId ?? getCurrentUser(getState()).id;
3628
+ const storageKey = `${userId}-column-widths`;
3629
+ let customColumns = [];
3630
+ if (!columns) {
3631
+ try {
3632
+ customColumns = JSON.parse(window.localStorage.getItem(storageKey) || "") || customColumns;
3633
+ } catch {
3634
+ }
3635
+ } else {
3636
+ customColumns = columns;
3904
3637
  }
3905
- } else {
3906
- customColumns = columns;
3638
+ window.localStorage.setItem(storageKey, JSON.stringify(customColumns));
3639
+ return Promise.resolve(dispatch(actions8.setCustomColumns(customColumns)));
3907
3640
  }
3908
- window.localStorage.setItem(storageKey, JSON.stringify(customColumns));
3909
- return Promise.resolve(dispatch(actions8.setCustomColumns(customColumns)));
3910
- });
3641
+ );
3911
3642
  var userActions = {
3912
3643
  add: {
3913
3644
  successMessage: "The user was added successfully.",
@@ -3927,44 +3658,44 @@ var userActions = {
3927
3658
  }
3928
3659
  };
3929
3660
  var userActionErrorHandler = (err, type, dispatch) => commonErrorHandler(err, `There was an error ${userActions[type].errorMessage} the user.`, dispatch);
3930
- var createUser = (0, import_toolkit20.createAsyncThunk)(
3661
+ var createUser = createAppAsyncThunk(
3931
3662
  `${sliceName8}/createUser`,
3932
- ({ shouldResetPassword, ...userData }, { dispatch }) => general_api_default.post(`${useradmApiUrlv1}/users`, { ...userData, send_reset_password: shouldResetPassword }).then(() => Promise.all([dispatch(actions8.createdUser(userData)), dispatch(getUserList()), dispatch(setSnackbar3(userActions.create.successMessage))])).catch((err) => userActionErrorHandler(err, "create", dispatch))
3663
+ ({ shouldResetPassword, ...userData }, { dispatch }) => general_api_default.post(`${import_constants5.useradmApiUrl}/users`, { ...userData, send_reset_password: shouldResetPassword }).then(() => Promise.all([dispatch(getUserList()), dispatch(setSnackbar3(userActions.create.successMessage))])).catch((err) => userActionErrorHandler(err, "create", dispatch))
3933
3664
  );
3934
- var removeUser = (0, import_toolkit20.createAsyncThunk)(
3665
+ var removeUser = createAppAsyncThunk(
3935
3666
  `${sliceName8}/removeUser`,
3936
- (userId, { dispatch }) => general_api_default.delete(`${useradmApiUrlv1}/users/${userId}`).then(() => Promise.all([dispatch(actions8.removedUser(userId)), dispatch(getUserList()), dispatch(setSnackbar3(userActions.remove.successMessage))])).catch((err) => userActionErrorHandler(err, "remove", dispatch))
3667
+ (userId, { dispatch }) => general_api_default.delete(`${import_constants5.useradmApiUrl}/users/${userId}`).then(() => Promise.all([dispatch(actions8.removedUser(userId)), dispatch(getUserList()), dispatch(setSnackbar3(userActions.remove.successMessage))])).catch((err) => userActionErrorHandler(err, "remove", dispatch))
3937
3668
  );
3938
- var editUser = (0, import_toolkit20.createAsyncThunk)(
3669
+ var editUser = createAppAsyncThunk(
3939
3670
  `${sliceName8}/editUser`,
3940
- ({ id, ...userData }, { dispatch, getState }) => general_api_default.put(`${useradmApiUrlv1}/users/${id}`, userData).then(
3671
+ ({ id, ...userData }, { dispatch, getState }) => general_api_default.put(`${import_constants5.useradmApiUrl}/users/${id}`, userData).then(
3941
3672
  () => Promise.all([
3942
3673
  dispatch(actions8.updatedUser({ ...userData, id: id === OWN_USER_ID ? getCurrentUser(getState()).id : id })),
3943
3674
  dispatch(setSnackbar3(userActions.edit.successMessage))
3944
3675
  ])
3945
- )
3676
+ ).catch((err) => userActionErrorHandler(err, "edit", dispatch))
3946
3677
  );
3947
- var addUserToCurrentTenant = (0, import_toolkit20.createAsyncThunk)(`${sliceName8}/addUserToTenant`, (userId, { dispatch, getState }) => {
3678
+ var addUserToCurrentTenant = createAppAsyncThunk(`${sliceName8}/addUserToTenant`, (userId, { dispatch, getState }) => {
3948
3679
  const { id } = getOrganization(getState());
3949
- return general_api_default.post(`${useradmApiUrlv1}/users/${userId}/assign`, { tenant_ids: [id] }).catch((err) => commonErrorHandler(err, `There was an error adding the user to your organization:`, dispatch)).then(() => Promise.all([dispatch(setSnackbar3(userActions.add.successMessage)), dispatch(getUserList())]));
3680
+ return general_api_default.post(`${import_constants5.useradmApiUrl}/users/${userId}/assign`, { tenant_ids: [id] }).catch((err) => commonErrorHandler(err, `There was an error adding the user to your organization:`, dispatch)).then(() => Promise.all([dispatch(setSnackbar3(userActions.add.successMessage)), dispatch(getUserList())]));
3950
3681
  });
3951
- var enableUser2fa = (0, import_toolkit20.createAsyncThunk)(
3682
+ var enableUser2fa = createAppAsyncThunk(
3952
3683
  `${sliceName8}/enableUser2fa`,
3953
- (userId = OWN_USER_ID, { dispatch }) => general_api_default.post(`${useradmApiUrlv1}/users/${userId}/2fa/enable`).catch((err) => commonErrorHandler(err, `There was an error enabling Two Factor authentication for the user.`, dispatch)).then(() => Promise.resolve(dispatch(getUser(userId))))
3684
+ (userId = OWN_USER_ID, { dispatch }) => general_api_default.post(`${import_constants5.useradmApiUrl}/users/${userId}/2fa/enable`).catch((err) => commonErrorHandler(err, `There was an error enabling Two Factor authentication for the user.`, dispatch)).then(() => Promise.resolve(dispatch(getUser(userId))))
3954
3685
  );
3955
- var disableUser2fa = (0, import_toolkit20.createAsyncThunk)(
3686
+ var disableUser2fa = createAppAsyncThunk(
3956
3687
  `${sliceName8}/disableUser2fa`,
3957
- (userId = OWN_USER_ID, { dispatch }) => general_api_default.post(`${useradmApiUrlv1}/users/${userId}/2fa/disable`).catch((err) => commonErrorHandler(err, `There was an error disabling Two Factor authentication for the user.`, dispatch)).then(() => Promise.all([dispatch(getUser(userId)), dispatch(actions8.receivedQrCode(null))]))
3688
+ (userId = OWN_USER_ID, { dispatch }) => general_api_default.post(`${import_constants5.useradmApiUrl}/users/${userId}/2fa/disable`).catch((err) => commonErrorHandler(err, `There was an error disabling Two Factor authentication for the user.`, dispatch)).then(() => Promise.all([dispatch(getUser(userId)), dispatch(actions8.receivedQrCode(null))]))
3958
3689
  );
3959
- var mapHttpPermission = (permission) => Object.entries(uiPermissionsByArea).reduce(
3690
+ var mapHttpPermission = (permission) => Object.entries(import_constants5.uiPermissionsByArea).reduce(
3960
3691
  (accu, [area, definition]) => {
3961
3692
  const endpointMatches = definition.endpoints.filter(
3962
- (endpoint) => endpoint.path.test(permission.value) && (endpoint.types.includes(permission.type) || permission.type === PermissionTypes.Any)
3693
+ (endpoint) => endpoint.path.test(permission.value) && (endpoint.types.includes(permission.type) || permission.type === import_constants5.PermissionTypes.Any)
3963
3694
  );
3964
- if (permission.value === PermissionTypes.Any || permission.value.includes(apiRoot) && endpointMatches.length) {
3695
+ if (permission.value === import_constants5.PermissionTypes.Any || permission.value.includes(import_constants5.apiRoot) && endpointMatches.length) {
3965
3696
  const endpointUiPermission = endpointMatches.reduce((endpointAccu, endpoint) => [...endpointAccu, ...endpoint.uiPermissions], []);
3966
3697
  const collector = (endpointUiPermission || definition.uiPermissions).reduce((permissionsAccu, uiPermission) => {
3967
- if (permission.type === PermissionTypes.Any || !endpointMatches.length && uiPermission.verbs.some((verb) => verb === permission.type)) {
3698
+ if (permission.type === import_constants5.PermissionTypes.Any || !endpointMatches.length && uiPermission.verbs.some((verb) => verb === permission.type)) {
3968
3699
  permissionsAccu.push(uiPermission.value);
3969
3700
  }
3970
3701
  return permissionsAccu;
@@ -3972,39 +3703,39 @@ var mapHttpPermission = (permission) => Object.entries(uiPermissionsByArea).redu
3972
3703
  if (Array.isArray(accu[area])) {
3973
3704
  accu[area] = [...accu[area], ...collector].filter(import_helpers9.duplicateFilter);
3974
3705
  } else {
3975
- accu[area] = mergePermissions(accu[area], { [scopedPermissionAreas[area].excessiveAccessSelector]: collector });
3706
+ accu[area] = mergePermissions(accu[area], { [import_constants5.scopedPermissionAreas[area].excessiveAccessSelector]: collector });
3976
3707
  }
3977
3708
  }
3978
3709
  return accu;
3979
3710
  },
3980
- { ...emptyUiPermissions }
3711
+ { ...import_constants5.emptyUiPermissions }
3981
3712
  );
3982
3713
  var permissionActionTypes = {
3983
3714
  any: mapHttpPermission,
3984
- CREATE_DEPLOYMENT: (permission) => permission.type === PermissionTypes.DeviceGroup ? {
3985
- deployments: [uiPermissionsById.deploy.value],
3986
- groups: { [permission.value]: [uiPermissionsById.deploy.value] }
3715
+ CREATE_DEPLOYMENT: (permission) => permission.type === import_constants5.PermissionTypes.DeviceGroup ? {
3716
+ deployments: [import_constants5.uiPermissionsById.deploy.value],
3717
+ groups: { [permission.value]: [import_constants5.uiPermissionsById.deploy.value] }
3987
3718
  } : {},
3988
3719
  http: mapHttpPermission,
3989
- REMOTE_TERMINAL: (permission) => permission.type === PermissionTypes.DeviceGroup ? {
3990
- groups: { [permission.value]: [uiPermissionsById.connect.value] }
3720
+ REMOTE_TERMINAL: (permission) => permission.type === import_constants5.PermissionTypes.DeviceGroup ? {
3721
+ groups: { [permission.value]: [import_constants5.uiPermissionsById.connect.value] }
3991
3722
  } : {},
3992
- VIEW_DEVICE: (permission) => permission.type === PermissionTypes.DeviceGroup ? {
3993
- groups: { [permission.value]: [uiPermissionsById.read.value] }
3723
+ VIEW_DEVICE: (permission) => permission.type === import_constants5.PermissionTypes.DeviceGroup ? {
3724
+ groups: { [permission.value]: [import_constants5.uiPermissionsById.read.value] }
3994
3725
  } : {}
3995
3726
  };
3996
3727
  var combinePermissions = (existingPermissions, additionalPermissions = {}) => Object.entries(additionalPermissions).reduce((accu, [name, permissions]) => {
3997
- let maybeExistingPermissions = accu[name] || [];
3728
+ const maybeExistingPermissions = accu[name] || [];
3998
3729
  accu[name] = [...permissions, ...maybeExistingPermissions].filter(import_helpers9.duplicateFilter);
3999
3730
  return accu;
4000
3731
  }, existingPermissions);
4001
3732
  var tryParseCustomPermission = (permission) => {
4002
3733
  const uiPermissions = permissionActionTypes[permission.action](permission.object);
4003
- const result = mergePermissions({ ...emptyUiPermissions }, uiPermissions);
3734
+ const result = mergePermissions({ ...import_constants5.emptyUiPermissions }, uiPermissions);
4004
3735
  return { isCustom: true, permission, result };
4005
3736
  };
4006
3737
  var customPermissionHandler = (accu, permission) => {
4007
- let processor = tryParseCustomPermission(permission);
3738
+ const processor = tryParseCustomPermission(permission);
4008
3739
  return {
4009
3740
  ...accu,
4010
3741
  isCustom: accu.isCustom || processor.isCustom,
@@ -4012,7 +3743,7 @@ var customPermissionHandler = (accu, permission) => {
4012
3743
  };
4013
3744
  };
4014
3745
  var mapPermissionSet = (permissionSetName, names, scope, existingGroupsPermissions = {}) => {
4015
- const permission = Object.values(uiPermissionsById).find((permission2) => permission2.permissionSets[scope] === permissionSetName).value;
3746
+ const permission = Object.values(import_constants5.uiPermissionsById).find((permission2) => permission2.permissionSets[scope] === permissionSetName)?.value;
4016
3747
  const scopedPermissions = names.reduce((accu, name) => combinePermissions(accu, { [name]: [permission] }), existingGroupsPermissions);
4017
3748
  return Object.entries(scopedPermissions).reduce((accu, [key, permissions]) => ({ ...accu, [key]: deriveImpliedAreaPermissions(scope, permissions) }), {});
4018
3749
  };
@@ -4025,16 +3756,21 @@ var isEmptyPermissionSet = (permissionSet) => !Object.values(permissionSet).redu
4025
3756
  var parseRolePermissions = ({ permission_sets_with_scope = [], permissions = [] }, permissionSets) => {
4026
3757
  const preliminaryResult = permission_sets_with_scope.reduce(
4027
3758
  (accu, permissionSet) => {
4028
- let processor = permissionSets[permissionSet.name];
3759
+ const processor = permissionSets[permissionSet.name];
4029
3760
  if (!processor) {
4030
3761
  return accu;
4031
3762
  }
4032
- const scope = Object.keys(scopedPermissionAreas).find((scope2) => uiPermissionsByArea[scope2].scope === permissionSet.scope?.type);
3763
+ const scope = Object.keys(import_constants5.scopedPermissionAreas).find((scope2) => import_constants5.uiPermissionsByArea[scope2].scope === permissionSet.scope?.type);
4033
3764
  if (scope) {
4034
- const result = mapPermissionSet(permissionSet.name, permissionSet.scope.value, scope, accu.uiPermissions[scope]);
3765
+ const result = mapPermissionSet(
3766
+ permissionSet.name,
3767
+ permissionSet.scope.value,
3768
+ scope,
3769
+ accu.uiPermissions[scope]
3770
+ );
4035
3771
  return { ...accu, uiPermissions: { ...accu.uiPermissions, [scope]: result } };
4036
3772
  } else if (isEmptyPermissionSet(processor.result)) {
4037
- return processor.permissions.reduce(customPermissionHandler, accu);
3773
+ return processor.permissions?.reduce(customPermissionHandler, accu);
4038
3774
  }
4039
3775
  return {
4040
3776
  ...accu,
@@ -4042,7 +3778,7 @@ var parseRolePermissions = ({ permission_sets_with_scope = [], permissions = []
4042
3778
  uiPermissions: mergePermissions(accu.uiPermissions, processor.result)
4043
3779
  };
4044
3780
  },
4045
- { isCustom: false, uiPermissions: { ...emptyUiPermissions, groups: {}, releases: {} } }
3781
+ { isCustom: false, uiPermissions: { ...import_constants5.emptyUiPermissions, groups: {}, releases: {} } }
4046
3782
  );
4047
3783
  return permissions.reduce(customPermissionHandler, preliminaryResult);
4048
3784
  };
@@ -4061,12 +3797,12 @@ var normalizeRbacRoles = (roles, rolesById2, permissionSets) => roles.reduce(
4061
3797
  normalizedPermissions = result.uiPermissions;
4062
3798
  isCustom = result.isCustom;
4063
3799
  }
4064
- const roleState = accu[role.name] ?? { ...emptyRole };
3800
+ const roleState = accu[role.name] ?? { ...import_constants5.emptyRole };
4065
3801
  accu[role.name] = {
4066
3802
  ...roleState,
4067
3803
  ...role,
4068
3804
  description: roleState.description ? roleState.description : role.description,
4069
- editable: !rolesById[role.name] && !isCustom && (typeof roleState.editable !== "undefined" ? roleState.editable : true),
3805
+ editable: !import_constants5.rolesById[role.name] && !isCustom && (typeof roleState.editable !== "undefined" ? roleState.editable : true),
4070
3806
  isCustom,
4071
3807
  name: roleState.name ? roleState.name : role.name,
4072
3808
  uiPermissions: normalizedPermissions
@@ -4075,16 +3811,16 @@ var normalizeRbacRoles = (roles, rolesById2, permissionSets) => roles.reduce(
4075
3811
  },
4076
3812
  { ...rolesById2 }
4077
3813
  );
4078
- var getPermissionSets = (0, import_toolkit20.createAsyncThunk)(
3814
+ var getPermissionSets = createAppAsyncThunk(
4079
3815
  `${sliceName8}/getPermissionSets`,
4080
- (_, { dispatch, getState }) => general_api_default.get(`${useradmApiUrlv2}/permission_sets?per_page=500`).then(({ data }) => {
3816
+ (_, { dispatch, getState }) => general_api_default.get(`${import_constants5.useradmApiUrlv2}/permission_sets?per_page=500`).then(({ data }) => {
4081
3817
  const permissionSets = data.reduce(
4082
3818
  (accu, permissionSet) => {
4083
3819
  const permissionSetState = accu[permissionSet.name] ?? {};
4084
3820
  let permissionSetObject = { ...permissionSetState, ...permissionSet };
4085
- permissionSetObject.result = Object.values(uiPermissionsById).reduce(
3821
+ permissionSetObject.result = Object.values(import_constants5.uiPermissionsById).reduce(
4086
3822
  (accu2, item) => Object.entries(item.permissionSets).reduce((collector, [area, permissionSet2]) => {
4087
- if (scopedPermissionAreas[area]) {
3823
+ if (import_constants5.scopedPermissionAreas[area]) {
4088
3824
  return collector;
4089
3825
  }
4090
3826
  if (permissionSet2 === permissionSetObject.name) {
@@ -4092,16 +3828,19 @@ var getPermissionSets = (0, import_toolkit20.createAsyncThunk)(
4092
3828
  }
4093
3829
  return collector;
4094
3830
  }, accu2),
4095
- { ...emptyUiPermissions, ...permissionSetObject.result ?? {} }
3831
+ { ...import_constants5.emptyUiPermissions, ...permissionSetObject.result ?? {} }
4096
3832
  );
4097
- const scopes = Object.values(scopedPermissionAreas).reduce((accu2, { key, scopeType }) => {
3833
+ const scopes = Object.values(import_constants5.scopedPermissionAreas).reduce((accu2, { key, scopeType }) => {
4098
3834
  if (permissionSetObject.supported_scope_types?.includes(key) || permissionSetObject.supported_scope_types?.includes(scopeType)) {
4099
3835
  accu2.push(key);
4100
3836
  }
4101
3837
  return accu2;
4102
3838
  }, []);
4103
3839
  permissionSetObject = scopes.reduce((accu2, scope) => {
4104
- accu2.result[scope] = mapPermissionSet(permissionSetObject.name, [scopedPermissionAreas[scope].excessiveAccessSelector], scope);
3840
+ accu2.result = {
3841
+ ...accu2.result,
3842
+ [scope]: mapPermissionSet(permissionSetObject.name, [import_constants5.scopedPermissionAreas[scope].excessiveAccessSelector], scope)
3843
+ };
4105
3844
  return accu2;
4106
3845
  }, permissionSetObject);
4107
3846
  accu[permissionSet.name] = permissionSetObject;
@@ -4112,23 +3851,23 @@ var getPermissionSets = (0, import_toolkit20.createAsyncThunk)(
4112
3851
  return Promise.all([dispatch(actions8.receivedPermissionSets(permissionSets)), permissionSets]);
4113
3852
  }).catch(() => console.log("Permission set retrieval failed - likely accessing a non-RBAC backend"))
4114
3853
  );
4115
- var getRoles = (0, import_toolkit20.createAsyncThunk)(
3854
+ var getRoles = createAppAsyncThunk(
4116
3855
  `${sliceName8}/getRoles`,
4117
- (_, { dispatch, getState }) => Promise.all([general_api_default.get(`${useradmApiUrlv2}/roles?per_page=500`), dispatch(getPermissionSets())]).then((results) => {
3856
+ (_, { dispatch, getState }) => Promise.all([general_api_default.get(`${import_constants5.useradmApiUrlv2}/roles?per_page=500`), dispatch(getPermissionSets())]).then((results) => {
4118
3857
  if (!results) {
4119
3858
  return Promise.resolve();
4120
3859
  }
4121
3860
  const [{ data: roles }, { payload: permissionSetTasks }] = results;
4122
3861
  const rolesById2 = normalizeRbacRoles(roles, getRolesById(getState()), permissionSetTasks[permissionSetTasks.length - 1]);
4123
3862
  return Promise.resolve(dispatch(actions8.receivedRoles(rolesById2)));
4124
- }).catch(() => console.log("Role retrieval failed - likely accessing a non-RBAC backend"))
3863
+ }).catch(() => console.log("Role retrieval failed - likely accessing a non-RBAC backend")).finally(() => Promise.resolve(dispatch(actions8.finishedRoleInitialization(true))))
4125
3864
  );
4126
3865
  var deriveImpliedAreaPermissions = (area, areaPermissions, skipPermissions = []) => {
4127
3866
  const highestAreaPermissionLevelSelected = areaPermissions.reduce(
4128
- (highest, current) => uiPermissionsById[current].permissionLevel > highest ? uiPermissionsById[current].permissionLevel : highest,
3867
+ (highest, current) => import_constants5.uiPermissionsById[current].permissionLevel > highest ? import_constants5.uiPermissionsById[current].permissionLevel : highest,
4129
3868
  1
4130
3869
  );
4131
- return uiPermissionsByArea[area].uiPermissions.reduce((permissions, current) => {
3870
+ return import_constants5.uiPermissionsByArea[area].uiPermissions.reduce((permissions, current) => {
4132
3871
  if ((current.permissionLevel < highestAreaPermissionLevelSelected || areaPermissions.includes(current.value)) && !skipPermissions.includes(current.value)) {
4133
3872
  permissions.push(current.value);
4134
3873
  }
@@ -4137,14 +3876,14 @@ var deriveImpliedAreaPermissions = (area, areaPermissions, skipPermissions = [])
4137
3876
  };
4138
3877
  var transformAreaRoleDataToScopedPermissionsSets = (area, areaPermissions, excessiveAccessSelector) => {
4139
3878
  const permissionSetObject = areaPermissions.reduce((accu, { item, uiPermissions }) => {
4140
- const skipPermissions = scopedPermissionAreas.releases.key === area && item !== ALL_RELEASES ? [uiPermissionsById.upload.value] : [];
3879
+ const skipPermissions = import_constants5.scopedPermissionAreas.releases.key === area && item !== import_constants5.ALL_RELEASES ? [import_constants5.uiPermissionsById.upload.value] : [];
4141
3880
  const impliedPermissions = deriveImpliedAreaPermissions(area, uiPermissions, skipPermissions);
4142
3881
  accu = impliedPermissions.reduce((itemPermissionAccu, impliedPermission) => {
4143
- const permissionSetState = itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]] ?? {
4144
- type: uiPermissionsByArea[area].scope,
3882
+ const permissionSetState = itemPermissionAccu[import_constants5.uiPermissionsById[impliedPermission].permissionSets[area]] ?? {
3883
+ type: import_constants5.uiPermissionsByArea[area].scope,
4145
3884
  value: []
4146
3885
  };
4147
- itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]] = {
3886
+ itemPermissionAccu[import_constants5.uiPermissionsById[impliedPermission].permissionSets[area]] = {
4148
3887
  ...permissionSetState,
4149
3888
  value: [...permissionSetState.value, item]
4150
3889
  };
@@ -4161,10 +3900,10 @@ var transformAreaRoleDataToScopedPermissionsSets = (area, areaPermissions, exces
4161
3900
  };
4162
3901
  var transformRoleDataToRole = (roleData, roleState = {}) => {
4163
3902
  const role = { ...roleState, ...roleData };
4164
- const { description = "", name, uiPermissions = emptyUiPermissions } = role;
4165
- const { maybeUiPermissions, remainderKeys } = Object.entries(emptyUiPermissions).reduce(
3903
+ const { description = "", name, uiPermissions = import_constants5.emptyUiPermissions } = role;
3904
+ const { maybeUiPermissions, remainderKeys } = Object.entries(import_constants5.emptyUiPermissions).reduce(
4166
3905
  (accu, [key, emptyPermissions]) => {
4167
- if (!scopedPermissionAreas[key]) {
3906
+ if (!import_constants5.scopedPermissionAreas[key]) {
4168
3907
  accu.remainderKeys.push(key);
4169
3908
  } else if (uiPermissions[key]) {
4170
3909
  accu.maybeUiPermissions[key] = uiPermissions[key].reduce(itemUiPermissionsReducer, emptyPermissions);
@@ -4181,27 +3920,33 @@ var transformRoleDataToRole = (roleData, roleState = {}) => {
4181
3920
  }
4182
3921
  const impliedPermissions = deriveImpliedAreaPermissions(area, areaPermissions);
4183
3922
  accu.roleUiPermissions[area] = impliedPermissions;
4184
- const mappedPermissions = impliedPermissions.map((uiPermission) => ({ name: uiPermissionsById[uiPermission].permissionSets[area] }));
3923
+ const mappedPermissions = impliedPermissions.map((uiPermission) => ({ name: import_constants5.uiPermissionsById[uiPermission].permissionSets[area] }));
4185
3924
  accu.permissionSetsWithScope.push(...mappedPermissions);
4186
3925
  return accu;
4187
3926
  },
4188
- { permissionSetsWithScope: [{ name: defaultPermissionSets.Basic.name }], roleUiPermissions: {} }
3927
+ { permissionSetsWithScope: [{ name: import_constants5.defaultPermissionSets.Basic.name }], roleUiPermissions: {} }
4189
3928
  );
4190
- const scopedPermissionSets = Object.values(scopedPermissionAreas).reduce((accu, { key, excessiveAccessSelector }) => {
3929
+ const scopedPermissionSets = Object.values(import_constants5.scopedPermissionAreas).reduce((accu, { key, excessiveAccessSelector }) => {
4191
3930
  if (!uiPermissions[key]) {
4192
3931
  return accu;
4193
3932
  }
4194
- accu.push(...transformAreaRoleDataToScopedPermissionsSets(key, uiPermissions[key], excessiveAccessSelector));
3933
+ accu.push(
3934
+ ...transformAreaRoleDataToScopedPermissionsSets(
3935
+ key,
3936
+ uiPermissions[key],
3937
+ excessiveAccessSelector
3938
+ )
3939
+ );
4195
3940
  return accu;
4196
3941
  }, []);
4197
3942
  return {
4198
3943
  permissionSetsWithScope: [...permissionSetsWithScope, ...scopedPermissionSets],
4199
3944
  role: {
4200
- ...emptyRole,
3945
+ ...import_constants5.emptyRole,
4201
3946
  name,
4202
- description: description ? description : roleState.description,
3947
+ description: description ? description : roleState.description || "",
4203
3948
  uiPermissions: {
4204
- ...emptyUiPermissions,
3949
+ ...import_constants5.emptyUiPermissions,
4205
3950
  ...roleUiPermissions,
4206
3951
  ...maybeUiPermissions
4207
3952
  }
@@ -4222,50 +3967,57 @@ var roleActions = {
4222
3967
  errorMessage: "removing"
4223
3968
  }
4224
3969
  };
4225
- var roleActionErrorHandler = (err, type, dispatch) => commonErrorHandler(err, `There was an error ${roleActions[type].errorMessage} the role.`, dispatch);
4226
- var createRole = (0, import_toolkit20.createAsyncThunk)(`${sliceName8}/createRole`, (roleData, { dispatch }) => {
3970
+ var roleActionErrorHandler = (err, type, dispatch, meta) => {
3971
+ let errorContext = `There was an error ${roleActions[type].errorMessage} the role.`;
3972
+ if (meta) {
3973
+ const { permissionSetsCreated, name } = meta;
3974
+ errorContext += ` Tried to ${type} role ${name} with ${permissionSetsCreated} permission sets.`;
3975
+ }
3976
+ return commonErrorHandler(err, errorContext, dispatch);
3977
+ };
3978
+ var createRole = createAppAsyncThunk(`${sliceName8}/createRole`, (roleData, { dispatch }) => {
4227
3979
  const { permissionSetsWithScope, role } = transformRoleDataToRole(roleData);
4228
- return general_api_default.post(`${useradmApiUrlv2}/roles`, {
3980
+ return general_api_default.post(`${import_constants5.useradmApiUrlv2}/roles`, {
4229
3981
  name: role.name,
4230
3982
  description: role.description,
4231
3983
  permission_sets_with_scope: permissionSetsWithScope
4232
- }).then(() => Promise.all([dispatch(actions8.createdRole(role)), dispatch(getRoles()), dispatch(setSnackbar3(roleActions.create.successMessage))])).catch((err) => roleActionErrorHandler(err, "create", dispatch));
3984
+ }).then(() => Promise.all([dispatch(actions8.createdRole(role)), dispatch(getRoles()), dispatch(setSnackbar3(roleActions.create.successMessage))])).catch((err) => roleActionErrorHandler(err, "create", dispatch, { permissionSetsCreated: permissionSetsWithScope.length, name: role.name }));
4233
3985
  });
4234
- var editRole = (0, import_toolkit20.createAsyncThunk)(`${sliceName8}/editRole`, (roleData, { dispatch, getState }) => {
3986
+ var editRole = createAppAsyncThunk(`${sliceName8}/editRole`, (roleData, { dispatch, getState }) => {
4235
3987
  const { permissionSetsWithScope, role } = transformRoleDataToRole(roleData, getRolesById(getState())[roleData.name]);
4236
- return general_api_default.put(`${useradmApiUrlv2}/roles/${role.name}`, {
3988
+ return general_api_default.put(`${import_constants5.useradmApiUrlv2}/roles/${role.name}`, {
4237
3989
  description: role.description,
4238
3990
  name: role.name,
4239
3991
  permission_sets_with_scope: permissionSetsWithScope
4240
- }).then(() => Promise.all([dispatch(actions8.createdRole(role)), dispatch(getRoles()), dispatch(setSnackbar3(roleActions.edit.successMessage))])).catch((err) => roleActionErrorHandler(err, "edit", dispatch));
3992
+ }).then(() => Promise.all([dispatch(actions8.createdRole(role)), dispatch(getRoles()), dispatch(setSnackbar3(roleActions.edit.successMessage))])).catch((err) => roleActionErrorHandler(err, "edit", dispatch, { permissionSetsCreated: permissionSetsWithScope.length, name: role.name }));
4241
3993
  });
4242
- var removeRole = (0, import_toolkit20.createAsyncThunk)(
3994
+ var removeRole = createAppAsyncThunk(
4243
3995
  `${sliceName8}/removeRole`,
4244
- (roleId, { dispatch }) => general_api_default.delete(`${useradmApiUrlv2}/roles/${roleId}`).then(() => Promise.all([dispatch(actions8.removedRole(roleId)), dispatch(getRoles()), dispatch(setSnackbar3(roleActions.remove.successMessage))])).catch((err) => roleActionErrorHandler(err, "remove", dispatch))
3996
+ (roleId, { dispatch }) => general_api_default.delete(`${import_constants5.useradmApiUrlv2}/roles/${roleId}`).then(() => Promise.all([dispatch(actions8.removedRole(roleId)), dispatch(getRoles()), dispatch(setSnackbar3(roleActions.remove.successMessage))])).catch((err) => roleActionErrorHandler(err, "remove", dispatch))
4245
3997
  );
4246
- var getGlobalSettings2 = (0, import_toolkit20.createAsyncThunk)(
3998
+ var getGlobalSettings2 = createAppAsyncThunk(
4247
3999
  `${sliceName8}/getGlobalSettings`,
4248
- (_, { dispatch }) => general_api_default.get(`${useradmApiUrlv1}/settings`).then(({ data: settings, headers: { etag } }) => {
4249
- window.sessionStorage.setItem(settingsKeys.initialized, true);
4000
+ (_, { dispatch }) => general_api_default.get(`${import_constants5.useradmApiUrl}/settings`).then(({ data: settings, headers: { etag } }) => {
4001
+ window.sessionStorage.setItem(settingsKeys.initialized, "true");
4250
4002
  return Promise.all([dispatch(actions8.setGlobalSettings(settings)), dispatch(setOfflineThreshold()), etag]);
4251
4003
  })
4252
4004
  );
4253
- var saveGlobalSettings = (0, import_toolkit20.createAsyncThunk)(
4005
+ var saveGlobalSettings = createAppAsyncThunk(
4254
4006
  `${sliceName8}/saveGlobalSettings`,
4255
4007
  ({ beOptimistic = false, notify = false, ...settings }, { dispatch, getState }) => {
4256
4008
  if (!window.sessionStorage.getItem(settingsKeys.initialized) && !beOptimistic) {
4257
4009
  return;
4258
4010
  }
4259
4011
  return dispatch(getGlobalSettings2()).unwrap().then((result) => {
4260
- let updatedSettings = { ...getState().users.globalSettings, ...settings };
4012
+ const updatedSettings = { ...getState().users.globalSettings, ...settings };
4261
4013
  if (getCurrentUser(getState()).verified) {
4262
- updatedSettings["2fa"] = twoFAStates.enabled;
4014
+ updatedSettings["2fa"] = import_constants5.twoFAStates.enabled;
4263
4015
  } else {
4264
4016
  delete updatedSettings["2fa"];
4265
4017
  }
4266
- let tasks = [dispatch(actions8.setGlobalSettings(updatedSettings))];
4018
+ const tasks = [dispatch(actions8.setGlobalSettings(updatedSettings))];
4267
4019
  const headers = result[result.length - 1] ? { "If-Match": result[result.length - 1] } : {};
4268
- return general_api_default.post(`${useradmApiUrlv1}/settings`, updatedSettings, { headers }).then(() => {
4020
+ return general_api_default.post(`${import_constants5.useradmApiUrl}/settings`, updatedSettings, { headers }).then(() => {
4269
4021
  if (notify) {
4270
4022
  tasks.push(dispatch(setSnackbar3("Settings saved successfully")));
4271
4023
  }
@@ -4280,54 +4032,59 @@ var saveGlobalSettings = (0, import_toolkit20.createAsyncThunk)(
4280
4032
  });
4281
4033
  }
4282
4034
  );
4283
- var getUserSettings2 = (0, import_toolkit20.createAsyncThunk)(
4035
+ var getUserSettings2 = createAppAsyncThunk(
4284
4036
  `${sliceName8}/getUserSettings`,
4285
- (_, { dispatch }) => general_api_default.get(`${useradmApiUrlv1}/settings/me`).then(({ data: settings, headers: { etag } }) => {
4286
- window.sessionStorage.setItem(settingsKeys.initialized, true);
4037
+ (_, { dispatch }) => general_api_default.get(`${import_constants5.useradmApiUrl}/settings/me`).then(({ data: settings, headers: { etag } }) => {
4038
+ window.sessionStorage.setItem(settingsKeys.initialized, "true");
4287
4039
  return Promise.all([dispatch(actions8.setUserSettings(settings)), etag]);
4288
4040
  })
4289
4041
  );
4290
- var saveUserSettings = (0, import_toolkit20.createAsyncThunk)(`${sliceName8}/saveUserSettings`, (settings = { onboarding: {} }, { dispatch, getState }) => {
4291
- if (!getCurrentUser(getState()).id) {
4292
- return Promise.resolve();
4042
+ var saveUserSettings = createAppAsyncThunk(
4043
+ `${sliceName8}/saveUserSettings`,
4044
+ (settings = { onboarding: {} }, { dispatch, getState }) => {
4045
+ if (!getCurrentUser(getState()).id) {
4046
+ return Promise.resolve();
4047
+ }
4048
+ return dispatch(getUserSettings2()).unwrap().then((result) => {
4049
+ const userSettings = getUserSettings(getState());
4050
+ const onboardingState = getOnboardingState(getState());
4051
+ const tooltipState = getTooltipsState(getState());
4052
+ const updatedSettings = {
4053
+ ...userSettings,
4054
+ ...settings,
4055
+ onboarding: {
4056
+ ...onboardingState,
4057
+ ...settings.onboarding
4058
+ },
4059
+ tooltips: tooltipState
4060
+ };
4061
+ const headers = result[result.length - 1] ? { "If-Match": result[result.length - 1] } : {};
4062
+ return Promise.all([
4063
+ Promise.resolve(dispatch(actions8.setUserSettings(updatedSettings))),
4064
+ general_api_default.post(`${import_constants5.useradmApiUrl}/settings/me`, updatedSettings, { headers })
4065
+ ]).catch(() => dispatch(actions8.setUserSettings(userSettings)));
4066
+ });
4293
4067
  }
4294
- return dispatch(getUserSettings2()).unwrap().then((result) => {
4295
- const userSettings = getUserSettings(getState());
4296
- const onboardingState = getOnboardingState(getState());
4297
- const tooltipState = getTooltipsState(getState());
4298
- const updatedSettings = {
4299
- ...userSettings,
4300
- ...settings,
4301
- onboarding: {
4302
- ...onboardingState,
4303
- ...settings.onboarding
4304
- },
4305
- tooltips: tooltipState
4306
- };
4307
- const headers = result[result.length - 1] ? { "If-Match": result[result.length - 1] } : {};
4308
- return Promise.all([
4309
- Promise.resolve(dispatch(actions8.setUserSettings(updatedSettings))),
4310
- general_api_default.post(`${useradmApiUrlv1}/settings/me`, updatedSettings, { headers })
4311
- ]).catch(() => dispatch(actions8.setUserSettings(userSettings)));
4312
- });
4313
- });
4314
- var get2FAQRCode = (0, import_toolkit20.createAsyncThunk)(
4068
+ );
4069
+ var get2FAQRCode = createAppAsyncThunk(
4315
4070
  `${sliceName8}/get2FAQRCode`,
4316
- (_, { dispatch }) => general_api_default.get(`${useradmApiUrlv1}/2faqr`).then((res) => dispatch(actions8.receivedQrCode(res.data.qr)))
4071
+ (_, { dispatch }) => general_api_default.get(`${import_constants5.useradmApiUrl}/2faqr`).then((res) => dispatch(actions8.receivedQrCode(res.data.qr)))
4317
4072
  );
4318
- var setHideAnnouncement = (0, import_toolkit20.createAsyncThunk)(`${sliceName8}/setHideAnnouncement`, ({ shouldHide, userId }, { dispatch, getState }) => {
4319
- const currentUserId = userId || getCurrentUser(getState()).id;
4320
- const hash = getState().app.hostedAnnouncement ? (0, import_md5.default)(getState().app.hostedAnnouncement) : "";
4321
- const announceCookie = cookies3.get(`${currentUserId}${hash}`);
4322
- if (shouldHide || hash.length && typeof announceCookie !== "undefined") {
4323
- cookies3.set(`${currentUserId}${hash}`, true, { maxAge: 604800 });
4324
- return Promise.resolve(dispatch(setAnnouncement()));
4073
+ var setHideAnnouncement = createAppAsyncThunk(
4074
+ `${sliceName8}/setHideAnnouncement`,
4075
+ ({ shouldHide, userId }, { dispatch, getState }) => {
4076
+ const currentUserId = userId || getCurrentUser(getState()).id;
4077
+ const hash = getState().app.hostedAnnouncement ? (0, import_md5.default)(getState().app.hostedAnnouncement) : "";
4078
+ const announceCookie = cookies3.get(`${currentUserId}${hash}`);
4079
+ if (shouldHide || hash.length && typeof announceCookie !== "undefined") {
4080
+ cookies3.set(`${currentUserId}${hash}`, true, { maxAge: 604800 });
4081
+ dispatch(setAnnouncement(""));
4082
+ }
4325
4083
  }
4326
- return Promise.resolve();
4327
- });
4328
- var getTokens = (0, import_toolkit20.createAsyncThunk)(
4084
+ );
4085
+ var getTokens = createAppAsyncThunk(
4329
4086
  `${sliceName8}/getTokens`,
4330
- (_, { dispatch, getState }) => general_api_default.get(`${useradmApiUrlv1}/settings/tokens`).then(({ data: tokens }) => {
4087
+ (_, { dispatch, getState }) => general_api_default.get(`${import_constants5.useradmApiUrl}/settings/tokens`).then(({ data: tokens }) => {
4331
4088
  const user = getCurrentUser(getState());
4332
4089
  const updatedUser = {
4333
4090
  ...user,
@@ -4337,28 +4094,33 @@ var getTokens = (0, import_toolkit20.createAsyncThunk)(
4337
4094
  })
4338
4095
  );
4339
4096
  var ONE_YEAR = 31536e3;
4340
- var generateToken = (0, import_toolkit20.createAsyncThunk)(
4097
+ var generateToken = createAppAsyncThunk(
4341
4098
  `${sliceName8}/generateToken`,
4342
- ({ expiresIn = ONE_YEAR, name }, { dispatch }) => general_api_default.post(`${useradmApiUrlv1}/settings/tokens`, { name, expires_in: expiresIn }).then(({ data: token }) => Promise.all([dispatch(getTokens()), token])).catch((err) => commonErrorHandler(err, "There was an error creating the token:", dispatch))
4099
+ ({ expiresIn = ONE_YEAR, name }, { dispatch }) => general_api_default.post(`${import_constants5.useradmApiUrl}/settings/tokens`, { name, expires_in: expiresIn }).then(({ data: token }) => Promise.all([dispatch(getTokens()), token])).catch((err) => commonErrorHandler(err, "There was an error creating the token:", dispatch))
4343
4100
  );
4344
- var revokeToken = (0, import_toolkit20.createAsyncThunk)(
4101
+ var revokeToken = createAppAsyncThunk(
4345
4102
  `${sliceName8}/revokeToken`,
4346
- (token, { dispatch }) => general_api_default.delete(`${useradmApiUrlv1}/settings/tokens/${token.id}`).then(() => Promise.resolve(dispatch(getTokens())))
4103
+ (token, { dispatch }) => general_api_default.delete(`${import_constants5.useradmApiUrl}/settings/tokens/${token.id}`).then(() => Promise.resolve(dispatch(getTokens())))
4347
4104
  );
4348
- var setTooltipReadState = (0, import_toolkit20.createAsyncThunk)(`${sliceName8}/setTooltipReadState`, ({ persist, ...remainder }, { dispatch }) => {
4349
- let tasks = [dispatch(actions8.setTooltipState(remainder))];
4350
- if (persist) {
4351
- tasks.push(dispatch(saveUserSettings()));
4105
+ var setTooltipReadState = createAppAsyncThunk(
4106
+ `${sliceName8}/setTooltipReadState`,
4107
+ async ({ persist, ...remainder }, { dispatch }) => {
4108
+ dispatch(actions8.setTooltipState(remainder));
4109
+ if (persist) {
4110
+ await dispatch(saveUserSettings());
4111
+ }
4352
4112
  }
4353
- return Promise.all(tasks);
4354
- });
4355
- var setAllTooltipsReadState = (0, import_toolkit20.createAsyncThunk)(`${sliceName8}/toggleHelptips`, (readState = READ_STATES.read, { dispatch }) => {
4356
- const updatedTips = Object.keys(import_helptips.HELPTOOLTIPS).reduce((accu, id) => ({ ...accu, [id]: { readState } }), {});
4357
- return Promise.resolve(dispatch(actions8.setTooltipsState(updatedTips))).then(() => dispatch(saveUserSettings()));
4358
- });
4359
- var submitFeedback = (0, import_toolkit20.createAsyncThunk)(
4113
+ );
4114
+ var setAllTooltipsReadState = createAppAsyncThunk(
4115
+ `${sliceName8}/toggleHelptips`,
4116
+ ({ readState = READ_STATES.read, tooltipIds }, { dispatch }) => {
4117
+ const updatedTips = tooltipIds.reduce((accu, id) => ({ ...accu, [id]: { readState } }), {});
4118
+ return Promise.resolve(dispatch(actions8.setTooltipsState(updatedTips))).then(() => dispatch(saveUserSettings()));
4119
+ }
4120
+ );
4121
+ var submitFeedback = createAppAsyncThunk(
4360
4122
  `${sliceName8}/submitFeedback`,
4361
- ({ satisfaction, feedback, ...meta }, { dispatch }) => general_api_default.post(`${tenantadmApiUrlv2}/contact/support`, {
4123
+ ({ satisfaction, feedback, ...meta }, { dispatch }) => general_api_default.post(`${import_constants5.tenantadmApiUrlv2}/contact/support`, {
4362
4124
  subject: "feedback submission",
4363
4125
  body: JSON.stringify({ feedback, satisfaction, meta })
4364
4126
  }).then(() => {
@@ -4369,21 +4131,17 @@ var submitFeedback = (0, import_toolkit20.createAsyncThunk)(
4369
4131
  );
4370
4132
 
4371
4133
  // src/deploymentsSlice/thunks.ts
4372
- var import_helpers10 = require("@northern.tech/utils/helpers");
4373
- var import_tracking = __toESM(require("@northern.tech/utils/tracking"), 1);
4374
- var import_toolkit21 = require("@reduxjs/toolkit");
4375
- var import_validator = require("validator");
4376
4134
  var { receivedDevice, setSnackbar: setSnackbar4 } = actions_default;
4377
- var { page: defaultPage3, perPage: defaultPerPage3 } = DEVICE_LIST_DEFAULTS;
4378
- var deriveDeploymentGroup = ({ filter = {}, group, groups = [], name }) => group || groups.length === 1 && !(0, import_validator.isUUID)(name) ? groups[0] : filter.name;
4379
- var transformDeployments = (deployments, deploymentsById) => deployments.sort(import_helpers10.startTimeSort).reduce(
4135
+ var { page: defaultPage3, perPage: defaultPerPage3 } = import_constants5.DEVICE_LIST_DEFAULTS;
4136
+ var deriveDeploymentGroup = ({ filter, group, groups = [], name }) => group || groups.length === 1 && !(0, import_isUUID.default)(name) ? groups[0] : filter?.name;
4137
+ var transformDeployments = (deployments, deploymentsById) => deployments.sort((0, import_helpers10.customSort)(true, "created")).reduce(
4380
4138
  (accu, item) => {
4381
- const filter = item.filter ?? {};
4139
+ const filter = item.filter;
4382
4140
  let deployment = {
4383
4141
  ...deploymentPrototype,
4384
4142
  ...deploymentsById[item.id],
4385
4143
  ...item,
4386
- filter: item.filter ? { ...filter, name: filter.name ?? filter.id, filters: mapTermsToFilters(filter.terms) } : void 0,
4144
+ filter: filter ? { ...filter, name: filter.name ?? filter.id, filters: mapTermsToFilters(filter.terms) } : void 0,
4387
4145
  name: decodeURIComponent(item.name)
4388
4146
  };
4389
4147
  deployment = { ...deployment, group: deriveDeploymentGroup(deployment) };
@@ -4393,40 +4151,43 @@ var transformDeployments = (deployments, deploymentsById) => deployments.sort(im
4393
4151
  },
4394
4152
  { deployments: {}, deploymentIds: [] }
4395
4153
  );
4396
- var getDeploymentsByStatus2 = (0, import_toolkit21.createAsyncThunk)(`${sliceName2}/getDeploymentsByStatus`, (options = {}, { dispatch, getState }) => {
4397
- const { status, page = defaultPage3, per_page = defaultPerPage3, startDate, endDate, group, type, shouldSelect = true, sort = SORTING_OPTIONS.desc } = options;
4398
- const created_after = startDate ? `&created_after=${startDate}` : "";
4399
- const created_before = endDate ? `&created_before=${endDate}` : "";
4400
- const search = group ? `&search=${group}` : "";
4401
- const typeFilter = type ? `&type=${type}` : "";
4402
- return general_api_default.get(
4403
- `${deploymentsApiUrl}/deployments?status=${status}&per_page=${per_page}&page=${page}${created_after}${created_before}${search}${typeFilter}&sort=${sort}`
4404
- ).then((res) => {
4405
- const { deployments, deploymentIds } = transformDeployments(res.data, getState().deployments.byId);
4406
- const total = Number(res.headers[headerNames.total]);
4407
- let tasks = [
4408
- dispatch(actions2.receivedDeployments(deployments)),
4409
- dispatch(
4410
- actions2.receivedDeploymentsForStatus({
4411
- deploymentIds,
4412
- status,
4413
- total: !(startDate || endDate || group || type) ? total : getState().deployments.byStatus[status].total
4414
- })
4415
- )
4416
- ];
4417
- tasks = deploymentIds.reduce((accu, deploymentId) => {
4418
- if (deployments[deploymentId].type === DEPLOYMENT_TYPES.configuration) {
4419
- accu.push(dispatch(getSingleDeployment(deploymentId)));
4154
+ var getDeploymentsByStatus2 = createAppAsyncThunk(
4155
+ `${sliceName}/getDeploymentsByStatus`,
4156
+ (options, { dispatch, getState }) => {
4157
+ const { status, page = defaultPage3, perPage = defaultPerPage3, startDate, endDate, group, type, shouldSelect = true, sort = import_constants5.SORTING_OPTIONS.desc } = options;
4158
+ const created_after = startDate ? `&created_after=${startDate}` : "";
4159
+ const created_before = endDate ? `&created_before=${endDate}` : "";
4160
+ const search = group ? `&search=${group}` : "";
4161
+ const typeFilter = type ? `&type=${type}` : "";
4162
+ return general_api_default.get(
4163
+ `${import_constants5.deploymentsApiUrl}/deployments?status=${status}&per_page=${perPage}&page=${page}${created_after}${created_before}${search}${typeFilter}&sort=${sort}`
4164
+ ).then((res) => {
4165
+ const { deployments, deploymentIds } = transformDeployments(res.data, getState().deployments.byId);
4166
+ const total = Number(res.headers[import_constants5.headerNames.total]);
4167
+ let tasks = [
4168
+ dispatch(actions.receivedDeployments(deployments)),
4169
+ dispatch(
4170
+ actions.receivedDeploymentsForStatus({
4171
+ deploymentIds,
4172
+ status,
4173
+ total: !(startDate || endDate || group || type) ? total : getState().deployments.byStatus[status].total
4174
+ })
4175
+ )
4176
+ ];
4177
+ tasks = deploymentIds.reduce((accu, deploymentId) => {
4178
+ if (deployments[deploymentId].type === DEPLOYMENT_TYPES.configuration) {
4179
+ accu.push(dispatch(getSingleDeployment(deploymentId)));
4180
+ }
4181
+ return accu;
4182
+ }, tasks);
4183
+ if (shouldSelect) {
4184
+ tasks.push(dispatch(actions.selectDeploymentsForStatus({ deploymentIds, status, total })));
4420
4185
  }
4421
- return accu;
4422
- }, tasks);
4423
- if (shouldSelect) {
4424
- tasks.push(dispatch(actions2.selectDeploymentsForStatus({ deploymentIds, status, total })));
4425
- }
4426
- tasks.push({ deploymentIds, total });
4427
- return Promise.all(tasks);
4428
- });
4429
- });
4186
+ tasks.push({ deploymentIds, total });
4187
+ return Promise.all(tasks);
4188
+ });
4189
+ }
4190
+ );
4430
4191
  var isWithinFirstMonth = (expirationDate) => {
4431
4192
  if (!expirationDate) {
4432
4193
  return false;
@@ -4448,86 +4209,98 @@ var trackDeploymentCreation = (totalDeploymentCount, hasDeployments, trial_expir
4448
4209
  }
4449
4210
  };
4450
4211
  var MAX_PREVIOUS_PHASES_COUNT = 5;
4451
- var createDeployment = (0, import_toolkit21.createAsyncThunk)(`${sliceName2}/createDeployment`, ({ newDeployment, hasNewRetryDefault = false }, { dispatch, getState }) => {
4452
- let request;
4453
- if (newDeployment.filter_id) {
4454
- request = general_api_default.post(`${deploymentsApiUrlV2}/deployments`, newDeployment);
4455
- } else if (newDeployment.group) {
4456
- request = general_api_default.post(`${deploymentsApiUrl}/deployments/group/${newDeployment.group}`, newDeployment);
4457
- } else {
4458
- request = general_api_default.post(`${deploymentsApiUrl}/deployments`, newDeployment);
4459
- }
4460
- const totalDeploymentCount = Object.values(getDeploymentsByStatus(getState())).reduce((accu, item) => accu + item.total, 0);
4461
- const { hasDeployments } = getGlobalSettings(getState());
4462
- const { trial_expiration } = getOrganization(getState());
4463
- return request.catch((err) => commonErrorHandler(err, "Error creating deployment.", dispatch)).then((data) => {
4464
- const lastslashindex = data.headers.location.lastIndexOf("/");
4465
- const deploymentId = data.headers.location.substring(lastslashindex + 1);
4466
- const deployment = {
4467
- ...newDeployment,
4468
- id: deploymentId,
4469
- devices: newDeployment.devices ? newDeployment.devices.map((id) => ({ id, status: "pending" })) : [],
4470
- statistics: { status: {} }
4471
- };
4472
- let tasks = [
4473
- dispatch(actions2.createdDeployment(deployment)),
4474
- dispatch(getSingleDeployment(deploymentId)),
4475
- dispatch(setSnackbar4("Deployment created successfully", TIMEOUTS.fiveSeconds))
4476
- ];
4477
- trackDeploymentCreation(totalDeploymentCount, hasDeployments, trial_expiration);
4478
- const { canManageUsers } = getUserCapabilities(getState());
4479
- if (canManageUsers) {
4480
- const { phases, retries } = newDeployment;
4481
- const { previousPhases = [], retries: previousRetries = 0 } = getGlobalSettings(getState());
4482
- let newSettings = { retries: hasNewRetryDefault ? retries : previousRetries, hasDeployments: true };
4483
- if (phases) {
4484
- const standardPhases = (0, import_helpers10.standardizePhases)(phases);
4485
- let prevPhases = previousPhases.map(import_helpers10.standardizePhases);
4486
- if (!prevPhases.find((previousPhaseList) => previousPhaseList.every((oldPhase) => standardPhases.find((phase) => (0, import_helpers10.deepCompare)(phase, oldPhase))))) {
4487
- prevPhases.push(standardPhases);
4488
- }
4489
- newSettings.previousPhases = prevPhases.slice(-1 * MAX_PREVIOUS_PHASES_COUNT);
4490
- }
4491
- tasks.push(dispatch(saveGlobalSettings(newSettings)));
4212
+ var createDeployment = createAppAsyncThunk(
4213
+ `${sliceName}/createDeployment`,
4214
+ ({
4215
+ newDeployment,
4216
+ hasNewRetryDefault = false
4217
+ }, { dispatch, getState }) => {
4218
+ let request;
4219
+ if ("filter_id" in newDeployment && newDeployment.filter_id) {
4220
+ request = general_api_default.post(`${import_constants5.deploymentsApiUrlV2}/deployments`, newDeployment);
4221
+ } else if ("group" in newDeployment && newDeployment.group) {
4222
+ request = general_api_default.post(`${import_constants5.deploymentsApiUrl}/deployments/group/${newDeployment.group}`, newDeployment);
4223
+ } else {
4224
+ request = general_api_default.post(`${import_constants5.deploymentsApiUrl}/deployments`, newDeployment);
4492
4225
  }
4493
- return Promise.all(tasks);
4494
- });
4495
- });
4496
- var getDeploymentDevices = (0, import_toolkit21.createAsyncThunk)(`${sliceName2}/getDeploymentDevices`, (options, { dispatch, getState }) => {
4497
- const { id, page = defaultPage3, perPage = defaultPerPage3 } = options;
4498
- return general_api_default.get(`${deploymentsApiUrl}/deployments/${id}/devices/list?&page=${page}&per_page=${perPage}`).then((response) => {
4499
- const { devices: deploymentDevices = {} } = getState().deployments.byId[id] || {};
4500
- const devices = response.data.reduce((accu, item) => {
4501
- accu[item.id] = item;
4502
- const log = (deploymentDevices[item.id] || {}).log;
4503
- if (log) {
4504
- accu[item.id].log = log;
4505
- }
4506
- return accu;
4507
- }, {});
4508
- const selectedDeviceIds = Object.keys(devices);
4509
- let tasks = [
4510
- dispatch(
4511
- actions2.receivedDeploymentDevices({
4512
- id,
4513
- devices,
4514
- selectedDeviceIds,
4515
- totalDeviceCount: Number(response.headers[headerNames.total])
4516
- })
4517
- )
4518
- ];
4519
- const devicesById = getDevicesById(getState());
4520
- const lackingData = selectedDeviceIds.reduce((accu, deviceId) => {
4521
- const device = devicesById[deviceId];
4522
- if (!device || !device.identity_data || !device.attributes || Object.keys(device.attributes).length === 0) {
4523
- accu.push(deviceId);
4226
+ const totalDeploymentCount = Object.values(getDeploymentsByStatus(getState())).reduce(
4227
+ (accu, item) => accu + item.total,
4228
+ 0
4229
+ );
4230
+ const { hasDeployments } = getGlobalSettings(getState());
4231
+ const { trial_expiration } = getOrganization(getState());
4232
+ return request.catch((err) => commonErrorHandler(err, "Error creating deployment.", dispatch)).then((data) => {
4233
+ const lastslashindex = data.headers.location.lastIndexOf("/");
4234
+ const deploymentId = data.headers.location.substring(lastslashindex + 1);
4235
+ const deployment = {
4236
+ ...newDeployment,
4237
+ id: deploymentId,
4238
+ devices: "devices" in newDeployment && newDeployment.devices ? newDeployment.devices.map((id) => ({ id, status: "pending" })) : [],
4239
+ statistics: { status: {} }
4240
+ };
4241
+ const tasks = [
4242
+ dispatch(actions.createdDeployment(deployment)),
4243
+ dispatch(getSingleDeployment(deploymentId)),
4244
+ dispatch(setSnackbar4({ message: "Deployment created successfully", autoHideDuration: TIMEOUTS.fiveSeconds }))
4245
+ ];
4246
+ trackDeploymentCreation(totalDeploymentCount, hasDeployments, trial_expiration);
4247
+ const { canManageUsers } = getUserCapabilities(getState());
4248
+ if (canManageUsers) {
4249
+ const { phases, retries } = newDeployment;
4250
+ const { previousPhases = [], retries: previousRetries = 0 } = getGlobalSettings(getState());
4251
+ const newSettings = { retries: hasNewRetryDefault ? retries : previousRetries, hasDeployments: true };
4252
+ if (phases) {
4253
+ const standardPhases = (0, import_helpers10.standardizePhases)(phases);
4254
+ const prevPhases = previousPhases.map(import_helpers10.standardizePhases);
4255
+ if (!prevPhases.find((previousPhaseList) => previousPhaseList.every((oldPhase) => standardPhases.find((phase) => (0, import_helpers10.deepCompare)(phase, oldPhase))))) {
4256
+ prevPhases.push(standardPhases);
4257
+ }
4258
+ newSettings.previousPhases = prevPhases.slice(-1 * MAX_PREVIOUS_PHASES_COUNT);
4259
+ }
4260
+ tasks.push(dispatch(saveGlobalSettings(newSettings)));
4524
4261
  }
4525
- return accu;
4526
- }, []);
4527
- tasks = lackingData.reduce((accu, deviceId) => [...accu, dispatch(getDeviceById2(deviceId)), dispatch(getDeviceAuth(deviceId))], tasks);
4528
- return Promise.all(tasks);
4529
- });
4530
- });
4262
+ return Promise.all(tasks);
4263
+ });
4264
+ }
4265
+ );
4266
+ var getDeploymentDevices = createAppAsyncThunk(
4267
+ `${sliceName}/getDeploymentDevices`,
4268
+ (options, { dispatch, getState }) => {
4269
+ const { id, page = defaultPage3, perPage = defaultPerPage3 } = options;
4270
+ return general_api_default.get(`${import_constants5.deploymentsApiUrl}/deployments/${id}/devices/list?&page=${page}&per_page=${perPage}`).then((response) => {
4271
+ const { devices: deploymentDevices = {} } = getState().deployments.byId[id] || {};
4272
+ const devices = response.data.reduce((accu, item) => {
4273
+ accu[item.id] = item;
4274
+ const log = (deploymentDevices[item.id] || {}).log;
4275
+ if (log) {
4276
+ accu[item.id].log = log;
4277
+ }
4278
+ return accu;
4279
+ }, {});
4280
+ const selectedDeviceIds = Object.keys(devices);
4281
+ let tasks = [
4282
+ dispatch(
4283
+ actions.receivedDeploymentDevices({
4284
+ id,
4285
+ devices,
4286
+ selectedDeviceIds,
4287
+ totalDeviceCount: Number(response.headers[import_constants5.headerNames.total])
4288
+ })
4289
+ )
4290
+ ];
4291
+ const devicesById = getDevicesById(getState());
4292
+ const lackingData = selectedDeviceIds.reduce((accu, deviceId) => {
4293
+ const device = devicesById[deviceId];
4294
+ if (!device || !device.identity_data || !device.attributes || Object.keys(device.attributes).length === 0) {
4295
+ accu.push(deviceId);
4296
+ }
4297
+ return accu;
4298
+ }, []);
4299
+ tasks = lackingData.reduce((accu, deviceId) => [...accu, dispatch(getDeviceById2(deviceId)), dispatch(getDeviceAuth(deviceId))], tasks);
4300
+ return Promise.all(tasks);
4301
+ });
4302
+ }
4303
+ );
4531
4304
  var parseDeviceDeployment = ({
4532
4305
  deployment: { id, artifact_name: release, status: deploymentStatus },
4533
4306
  device: { created, deleted, id: deviceId, finished, status, log }
@@ -4547,44 +4320,44 @@ var parseDeviceDeployment = ({
4547
4320
  return accu;
4548
4321
  }, "")
4549
4322
  });
4550
- var getDeviceDeployments = (0, import_toolkit21.createAsyncThunk)(`${sliceName2}/getDeviceDeployments`, (options, { dispatch }) => {
4323
+ var getDeviceDeployments = createAppAsyncThunk(`${sliceName}/getDeviceDeployments`, (options, { dispatch }) => {
4551
4324
  const { deviceId, filterSelection = [], page = defaultPage3, perPage = defaultPerPage3 } = options;
4552
4325
  const filters = filterSelection.map((item) => `&status=${item}`).join("");
4553
- return general_api_default.get(`${deploymentsApiUrl}/deployments/devices/${deviceId}?page=${page}&per_page=${perPage}${filters}`).then(
4326
+ return general_api_default.get(`${import_constants5.deploymentsApiUrl}/deployments/devices/${deviceId}?page=${page}&per_page=${perPage}${filters}`).then(
4554
4327
  ({ data, headers }) => Promise.resolve(
4555
4328
  dispatch(
4556
4329
  receivedDevice({
4557
4330
  id: deviceId,
4558
4331
  deviceDeployments: data.map(parseDeviceDeployment),
4559
- deploymentsCount: Number(headers[headerNames.total])
4332
+ deploymentsCount: Number(headers[import_constants5.headerNames.total])
4560
4333
  })
4561
4334
  )
4562
4335
  )
4563
4336
  ).catch((err) => commonErrorHandler(err, "There was an error retrieving the device deployment history:", dispatch));
4564
4337
  });
4565
- var resetDeviceDeployments = (0, import_toolkit21.createAsyncThunk)(
4566
- `${sliceName2}/resetDeviceDeployments`,
4567
- (deviceId, { dispatch }) => general_api_default.delete(`${deploymentsApiUrl}/deployments/devices/${deviceId}/history`).then(() => Promise.resolve(dispatch(getDeviceDeployments({ deviceId })))).catch((err) => commonErrorHandler(err, "There was an error resetting the device deployment history:", dispatch))
4338
+ var resetDeviceDeployments = createAppAsyncThunk(
4339
+ `${sliceName}/resetDeviceDeployments`,
4340
+ (deviceId, { dispatch }) => general_api_default.delete(`${import_constants5.deploymentsApiUrl}/deployments/devices/${deviceId}/history`).then(() => Promise.resolve(dispatch(getDeviceDeployments({ deviceId })))).catch((err) => commonErrorHandler(err, "There was an error resetting the device deployment history:", dispatch))
4568
4341
  );
4569
- var getSingleDeployment = (0, import_toolkit21.createAsyncThunk)(
4570
- `${sliceName2}/getSingleDeployment`,
4571
- (id, { dispatch, getState }) => general_api_default.get(`${deploymentsApiUrl}/deployments/${id}`).then(({ data }) => {
4342
+ var getSingleDeployment = createAppAsyncThunk(
4343
+ `${sliceName}/getSingleDeployment`,
4344
+ (id, { dispatch, getState }) => general_api_default.get(`${import_constants5.deploymentsApiUrl}/deployments/${id}`).then(({ data }) => {
4572
4345
  const { deployments } = transformDeployments([data], getState().deployments.byId);
4573
- return Promise.resolve(dispatch(actions2.receivedDeployment(deployments[id])));
4346
+ return Promise.resolve(dispatch(actions.receivedDeployment(deployments[id])));
4574
4347
  })
4575
4348
  );
4576
- var getDeviceLog = (0, import_toolkit21.createAsyncThunk)(
4577
- `${sliceName2}/getDeviceLog`,
4578
- ({ deploymentId, deviceId }, { dispatch }) => general_api_default.get(`${deploymentsApiUrl}/deployments/${deploymentId}/devices/${deviceId}/log`).catch((e) => {
4349
+ var getDeviceLog = createAppAsyncThunk(
4350
+ `${sliceName}/getDeviceLog`,
4351
+ ({ deploymentId, deviceId }, { dispatch }) => general_api_default.get(`${import_constants5.deploymentsApiUrl}/deployments/${deploymentId}/devices/${deviceId}/log`).catch((e) => {
4579
4352
  console.log("no log here", e);
4580
4353
  return Promise.reject();
4581
4354
  }).then(
4582
- ({ data: log }) => Promise.all([Promise.resolve(dispatch(actions2.receivedDeploymentDeviceLog({ id: deploymentId, deviceId, log }))), Promise.resolve(log)])
4355
+ ({ data: log }) => Promise.all([Promise.resolve(dispatch(actions.receivedDeploymentDeviceLog({ id: deploymentId, deviceId, log }))), Promise.resolve(log)])
4583
4356
  )
4584
4357
  );
4585
- var abortDeployment = (0, import_toolkit21.createAsyncThunk)(
4586
- `${sliceName2}/abortDeployment`,
4587
- (deploymentId, { dispatch, getState }) => general_api_default.put(`${deploymentsApiUrl}/deployments/${deploymentId}/status`, { status: "aborted" }).then(() => {
4358
+ var abortDeployment = createAppAsyncThunk(
4359
+ `${sliceName}/abortDeployment`,
4360
+ (deploymentId, { dispatch, getState }) => general_api_default.put(`${import_constants5.deploymentsApiUrl}/deployments/${deploymentId}/status`, { status: "aborted" }).then(() => {
4588
4361
  const deploymentsByStatus = getDeploymentsByStatus(getState());
4589
4362
  let status = DEPLOYMENT_STATES.pending;
4590
4363
  let index = deploymentsByStatus.pending.deploymentIds.findIndex((id) => id === deploymentId);
@@ -4600,21 +4373,21 @@ var abortDeployment = (0, import_toolkit21.createAsyncThunk)(
4600
4373
  }, {});
4601
4374
  const total = Math.max(deploymentsByStatus[status].total - 1, 0);
4602
4375
  return Promise.all([
4603
- dispatch(actions2.receivedDeployments(deployments)),
4604
- dispatch(actions2.receivedDeploymentsForStatus({ deploymentIds, status, total })),
4605
- dispatch(actions2.removedDeployment(deploymentId)),
4376
+ dispatch(actions.receivedDeployments(deployments)),
4377
+ dispatch(actions.receivedDeploymentsForStatus({ deploymentIds, status, total })),
4378
+ dispatch(actions.removedDeployment(deploymentId)),
4606
4379
  dispatch(setSnackbar4("The deployment was successfully aborted"))
4607
4380
  ]);
4608
4381
  }).catch((err) => commonErrorHandler(err, "There was an error while aborting the deployment:", dispatch))
4609
4382
  );
4610
- var updateDeploymentControlMap = (0, import_toolkit21.createAsyncThunk)(
4611
- `${sliceName2}/updateDeploymentControlMap`,
4612
- ({ deploymentId, updateControlMap }, { dispatch }) => general_api_default.patch(`${deploymentsApiUrl}/deployments/${deploymentId}`, { update_control_map: updateControlMap }).catch((err) => commonErrorHandler(err, "There was an error while updating the deployment status:", dispatch)).then(() => Promise.resolve(dispatch(getSingleDeployment(deploymentId))))
4383
+ var updateDeploymentControlMap = createAppAsyncThunk(
4384
+ `${sliceName}/updateDeploymentControlMap`,
4385
+ ({ deploymentId, updateControlMap }, { dispatch }) => general_api_default.patch(`${import_constants5.deploymentsApiUrl}/deployments/${deploymentId}`, { update_control_map: updateControlMap }).catch((err) => commonErrorHandler(err, "There was an error while updating the deployment status:", dispatch)).then(() => Promise.resolve(dispatch(getSingleDeployment(deploymentId))))
4613
4386
  );
4614
- var setDeploymentsState = (0, import_toolkit21.createAsyncThunk)(`${sliceName2}/setDeploymentsState`, (selection, { dispatch, getState }) => {
4387
+ var setDeploymentsState = createAppAsyncThunk(`${sliceName}/setDeploymentsState`, (selection, { dispatch, getState }) => {
4615
4388
  const { page, perPage, ...selectionState } = selection;
4616
4389
  const currentState = getState().deployments.selectionState;
4617
- let nextState = {
4390
+ const nextState = {
4618
4391
  ...currentState,
4619
4392
  ...selectionState,
4620
4393
  ...Object.keys(DEPLOYMENT_STATES).reduce((accu, item) => {
@@ -4629,7 +4402,7 @@ var setDeploymentsState = (0, import_toolkit21.createAsyncThunk)(`${sliceName2}/
4629
4402
  ...selectionState.general
4630
4403
  }
4631
4404
  };
4632
- let tasks = [dispatch(actions2.setDeploymentsState(nextState))];
4405
+ const tasks = [dispatch(actions.setDeploymentsState(nextState))];
4633
4406
  if (nextState.selectedId && currentState.selectedId !== nextState.selectedId) {
4634
4407
  tasks.push(dispatch(getSingleDeployment(nextState.selectedId)));
4635
4408
  }
@@ -4650,34 +4423,32 @@ var mapExternalDeltaConfig = (config = {}) => deltaAttributeMappings.reduce((acc
4650
4423
  }
4651
4424
  return accu;
4652
4425
  }, {});
4653
- var getDeploymentsConfig = (0, import_toolkit21.createAsyncThunk)(
4654
- `${sliceName2}/getDeploymentsConfig`,
4655
- (_, { dispatch, getState }) => general_api_default.get(`${deploymentsApiUrl}/config`).then(({ data }) => {
4426
+ var getDeploymentsConfig = createAppAsyncThunk(
4427
+ `${sliceName}/getDeploymentsConfig`,
4428
+ (_, { dispatch, getState }) => general_api_default.get(`${import_constants5.deploymentsApiUrl}/config`).then(({ data }) => {
4656
4429
  const oldConfig = getState().deployments.config;
4657
4430
  const { delta = {} } = data;
4658
4431
  const { binary_delta = {}, binary_delta_limits = {} } = delta;
4659
- const { xdelta_args = {}, timeout: timeoutConfig = oldConfig.binaryDelta.timeout } = binary_delta;
4660
- const { xdelta_args_limits = {}, timeout: timeoutLimit = oldConfig.binaryDeltaLimits.timeout } = binary_delta_limits;
4432
+ const { xdelta_args = {} } = binary_delta;
4433
+ const { xdelta_args_limits = {} } = binary_delta_limits;
4661
4434
  const config = {
4662
4435
  ...oldConfig,
4663
4436
  hasDelta: Boolean(delta.enabled),
4664
4437
  binaryDelta: {
4665
4438
  ...oldConfig.binaryDelta,
4666
- timeout: timeoutConfig,
4667
4439
  ...mapExternalDeltaConfig(xdelta_args)
4668
4440
  },
4669
4441
  binaryDeltaLimits: {
4670
4442
  ...oldConfig.binaryDeltaLimits,
4671
- timeout: timeoutLimit,
4672
4443
  ...mapExternalDeltaConfig(xdelta_args_limits)
4673
4444
  }
4674
4445
  };
4675
- return Promise.resolve(dispatch(actions2.setDeploymentsConfig(config)));
4446
+ return Promise.resolve(dispatch(actions.setDeploymentsConfig(config)));
4676
4447
  })
4677
4448
  );
4678
4449
  var deepClean = (source) => Object.entries(source).reduce((accu, [key, value]) => {
4679
4450
  if (value !== void 0) {
4680
- let cleanedValue = typeof value === "object" ? deepClean(value) : value;
4451
+ const cleanedValue = typeof value === "object" ? deepClean(value) : value;
4681
4452
  if (cleanedValue === void 0 || typeof cleanedValue === "object" && (0, import_helpers10.isEmpty)(cleanedValue)) {
4682
4453
  return accu;
4683
4454
  }
@@ -4685,32 +4456,34 @@ var deepClean = (source) => Object.entries(source).reduce((accu, [key, value]) =
4685
4456
  }
4686
4457
  return accu;
4687
4458
  }, void 0);
4688
- var saveDeltaDeploymentsConfig = (0, import_toolkit21.createAsyncThunk)(`${sliceName2}/saveDeltaDeploymentsConfig`, (config, { dispatch, getState }) => {
4689
- const configChange = {
4690
- timeout: config.timeout,
4691
- xdelta_args: deltaAttributeMappings.reduce((accu, { here, there }) => {
4692
- if (config[here] !== void 0) {
4693
- accu[there] = config[here];
4694
- }
4695
- return accu;
4696
- }, {})
4697
- };
4698
- const result = deepClean(configChange);
4699
- if (!result) {
4700
- return Promise.resolve();
4701
- }
4702
- return general_api_default.put(`${deploymentsApiUrl}/config/binary_delta`, result).catch((err) => commonErrorHandler(err, "There was a problem storing your delta artifact generation configuration.", dispatch)).then(() => {
4703
- const oldConfig = getState().deployments.config;
4704
- const newConfig = {
4705
- ...oldConfig,
4706
- binaryDelta: {
4707
- ...oldConfig.binaryDelta,
4708
- ...config
4709
- }
4459
+ var saveDeltaDeploymentsConfig = createAppAsyncThunk(
4460
+ `${sliceName}/saveDeltaDeploymentsConfig`,
4461
+ (config, { dispatch, getState }) => {
4462
+ const configChange = {
4463
+ xdelta_args: deltaAttributeMappings.reduce((accu, { here, there }) => {
4464
+ if (config[here] !== void 0) {
4465
+ accu[there] = config[here];
4466
+ }
4467
+ return accu;
4468
+ }, {})
4710
4469
  };
4711
- return Promise.all([dispatch(actions2.setDeploymentsConfig(newConfig)), dispatch(setSnackbar4("Settings saved successfully"))]);
4712
- });
4713
- });
4470
+ const result = deepClean(configChange);
4471
+ if (!result) {
4472
+ return Promise.resolve();
4473
+ }
4474
+ return general_api_default.put(`${import_constants5.deploymentsApiUrl}/config/binary_delta`, result).catch((err) => commonErrorHandler(err, "There was a problem storing your delta artifact generation configuration.", dispatch)).then(() => {
4475
+ const oldConfig = getState().deployments.config;
4476
+ const newConfig = {
4477
+ ...oldConfig,
4478
+ binaryDelta: {
4479
+ ...oldConfig.binaryDelta,
4480
+ ...config
4481
+ }
4482
+ };
4483
+ return Promise.all([dispatch(actions.setDeploymentsConfig(newConfig)), dispatch(setSnackbar4("Settings saved successfully"))]);
4484
+ });
4485
+ }
4486
+ );
4714
4487
  // Annotate the CommonJS export names for ESM import in node:
4715
4488
  0 && (module.exports = {
4716
4489
  abortDeployment,