@northern.tech/store 0.3.4 → 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 (603) hide show
  1. package/dist/actions.cjs +78 -827
  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 +102 -112
  19. package/dist/appSlice/constants.d.ts +102 -112
  20. package/dist/appSlice/constants.js +1 -11
  21. package/dist/appSlice/index.cjs +24 -239
  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 +1552 -1769
  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 +31 -31
  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-JO33IORF.js → chunk-4TUJPE6G.js} +19 -4
  50. package/dist/chunk-4TUJPE6G.js.map +1 -0
  51. package/dist/{chunk-AFICTIVU.js → chunk-6KGTHJKC.js} +22 -24
  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-X3GZILYD.js → chunk-ABJLRDCO.js} +10 -11
  56. package/dist/chunk-ABJLRDCO.js.map +1 -0
  57. package/dist/{chunk-PAIB5V27.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-FVCYB5OP.js → chunk-IQG5I7AM.js} +32 -40
  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-ZWOAFHAR.js → chunk-JXQUFKID.js} +2 -2
  66. package/dist/chunk-JXQUFKID.js.map +1 -0
  67. package/dist/{chunk-K4MMUDYT.js → chunk-KC7SKI3U.js} +9 -11
  68. package/dist/chunk-KC7SKI3U.js.map +1 -0
  69. package/dist/{chunk-L3SY3J5M.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-FRSA2YB5.js → chunk-MZNANSS2.js} +12 -7
  74. package/dist/chunk-MZNANSS2.js.map +1 -0
  75. package/dist/{chunk-EYCORLYU.js → chunk-N2KLYPS5.js} +128 -87
  76. package/dist/chunk-N2KLYPS5.js.map +1 -0
  77. package/dist/{chunk-Y575RZHR.js → chunk-OHF3YUXX.js} +25 -40
  78. package/dist/chunk-OHF3YUXX.js.map +1 -0
  79. package/dist/{chunk-NOQR3TE7.js → chunk-OOICURFL.js} +2 -2
  80. package/dist/chunk-OOICURFL.js.map +1 -0
  81. package/dist/{chunk-AVX7VVOK.js → chunk-PGFVHKP5.js} +5 -7
  82. package/dist/chunk-PGFVHKP5.js.map +1 -0
  83. package/dist/{chunk-NCSKCF2S.js → chunk-QHK7GGV4.js} +3 -3
  84. package/dist/chunk-QHK7GGV4.js.map +1 -0
  85. package/dist/{chunk-AUBJUUP3.js → chunk-RS37Y2PQ.js} +3 -3
  86. package/dist/chunk-RS37Y2PQ.js.map +1 -0
  87. package/dist/{chunk-7YZCUAXZ.js → chunk-UGSLGUS6.js} +8 -6
  88. package/dist/chunk-UGSLGUS6.js.map +1 -0
  89. package/dist/{chunk-ZZMFXRQK.js → chunk-URNS6A5T.js} +14 -14
  90. package/dist/{chunk-RX32WLVJ.js → chunk-VANBSJS5.js} +1 -1
  91. package/dist/chunk-VANBSJS5.js.map +1 -0
  92. package/dist/{chunk-DGQKXSRI.js → chunk-VUFRP6P3.js} +5 -6
  93. package/dist/chunk-VUFRP6P3.js.map +1 -0
  94. package/dist/{chunk-DCEKU6UV.js → chunk-X4GUACQO.js} +8 -5
  95. package/dist/chunk-X4GUACQO.js.map +1 -0
  96. package/dist/{chunk-GWJIY56H.js → chunk-XWYJACQC.js} +40 -15
  97. package/dist/chunk-XWYJACQC.js.map +1 -0
  98. package/dist/{chunk-GAI4VYRZ.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-EQLHIPPR.js → chunk-ZN5TB2NJ.js} +919 -842
  103. package/dist/chunk-ZN5TB2NJ.js.map +1 -0
  104. package/dist/{chunk-FQDSV3NK.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 +507 -768
  112. package/dist/commonSelectors.cjs.map +1 -1
  113. package/dist/commonSelectors.d.cts +4307 -280
  114. package/dist/commonSelectors.d.ts +4307 -280
  115. package/dist/commonSelectors.js +14 -14
  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 +1518 -1735
  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 +31 -31
  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 -1926
  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 +37 -47
  173. package/dist/liststatehook.cjs +289 -325
  174. package/dist/liststatehook.cjs.map +1 -1
  175. package/dist/liststatehook.d.cts +4 -16
  176. package/dist/liststatehook.d.ts +4 -16
  177. package/dist/liststatehook.js +9 -9
  178. package/dist/liststatehook.js.map +1 -1
  179. package/dist/locationutils.cjs +286 -322
  180. package/dist/locationutils.cjs.map +1 -1
  181. package/dist/locationutils.d.cts +8 -7
  182. package/dist/locationutils.d.ts +8 -7
  183. package/dist/locationutils.js +6 -6
  184. package/dist/monitorSlice/constants.cjs +0 -146
  185. package/dist/monitorSlice/constants.cjs.map +1 -1
  186. package/dist/monitorSlice/constants.d.cts +4 -5
  187. package/dist/monitorSlice/constants.d.ts +4 -5
  188. package/dist/monitorSlice/constants.js +1 -12
  189. package/dist/monitorSlice/index.cjs +5 -353
  190. package/dist/monitorSlice/index.cjs.map +1 -1
  191. package/dist/monitorSlice/index.d.cts +63 -260
  192. package/dist/monitorSlice/index.d.ts +63 -260
  193. package/dist/monitorSlice/index.js +6 -6
  194. package/dist/monitorSlice/mocks.cjs +130 -0
  195. package/dist/monitorSlice/mocks.cjs.map +1 -0
  196. package/dist/monitorSlice/mocks.d.cts +57 -0
  197. package/dist/monitorSlice/mocks.d.ts +57 -0
  198. package/dist/monitorSlice/mocks.js +65 -0
  199. package/dist/monitorSlice/mocks.js.map +1 -0
  200. package/dist/monitorSlice/thunks.cjs +623 -860
  201. package/dist/monitorSlice/thunks.cjs.map +1 -1
  202. package/dist/monitorSlice/thunks.d.cts +90 -21
  203. package/dist/monitorSlice/thunks.d.ts +90 -21
  204. package/dist/monitorSlice/thunks.js +27 -27
  205. package/dist/onboardingSlice/constants.cjs +1 -0
  206. package/dist/onboardingSlice/constants.cjs.map +1 -1
  207. package/dist/onboardingSlice/constants.d.cts +23 -20
  208. package/dist/onboardingSlice/constants.d.ts +23 -20
  209. package/dist/onboardingSlice/constants.js +1 -1
  210. package/dist/onboardingSlice/index.cjs.map +1 -1
  211. package/dist/onboardingSlice/index.d.cts +50 -225
  212. package/dist/onboardingSlice/index.d.ts +50 -225
  213. package/dist/onboardingSlice/index.js +1 -1
  214. package/dist/onboardingSlice/mocks.cjs +83 -0
  215. package/dist/onboardingSlice/mocks.cjs.map +1 -0
  216. package/dist/onboardingSlice/mocks.d.cts +19 -0
  217. package/dist/onboardingSlice/mocks.d.ts +19 -0
  218. package/dist/onboardingSlice/mocks.js +17 -0
  219. package/dist/onboardingSlice/mocks.js.map +1 -0
  220. package/dist/onboardingSlice/thunks.cjs +1771 -1991
  221. package/dist/onboardingSlice/thunks.cjs.map +1 -1
  222. package/dist/onboardingSlice/thunks.d.cts +62 -34
  223. package/dist/onboardingSlice/thunks.d.ts +62 -34
  224. package/dist/onboardingSlice/thunks.js +31 -31
  225. package/dist/organizationSlice/constants.cjs +8 -748
  226. package/dist/organizationSlice/constants.cjs.map +1 -1
  227. package/dist/organizationSlice/constants.d.cts +36 -116
  228. package/dist/organizationSlice/constants.d.ts +36 -116
  229. package/dist/organizationSlice/constants.js +7 -17
  230. package/dist/organizationSlice/index.cjs +14 -368
  231. package/dist/organizationSlice/index.cjs.map +1 -1
  232. package/dist/organizationSlice/index.d.cts +45 -74
  233. package/dist/organizationSlice/index.d.ts +45 -74
  234. package/dist/organizationSlice/index.js +6 -6
  235. package/dist/organizationSlice/mocks.cjs +234 -0
  236. package/dist/organizationSlice/mocks.cjs.map +1 -0
  237. package/dist/organizationSlice/mocks.d.cts +107 -0
  238. package/dist/organizationSlice/mocks.d.ts +107 -0
  239. package/dist/organizationSlice/mocks.js +101 -0
  240. package/dist/organizationSlice/mocks.js.map +1 -0
  241. package/dist/organizationSlice/selectors.cjs +301 -146
  242. package/dist/organizationSlice/selectors.cjs.map +1 -1
  243. package/dist/organizationSlice/selectors.d.cts +888 -52
  244. package/dist/organizationSlice/selectors.d.ts +888 -52
  245. package/dist/organizationSlice/selectors.js +14 -6
  246. package/dist/organizationSlice/thunks.cjs +2593 -2730
  247. package/dist/organizationSlice/thunks.cjs.map +1 -1
  248. package/dist/organizationSlice/thunks.d.cts +318 -127
  249. package/dist/organizationSlice/thunks.d.ts +318 -127
  250. package/dist/organizationSlice/thunks.js +45 -31
  251. package/dist/organizationSlice/types.cjs.map +1 -1
  252. package/dist/organizationSlice/types.d.cts +95 -3
  253. package/dist/organizationSlice/types.d.ts +95 -3
  254. package/dist/releasesSlice/constants.cjs +3 -0
  255. package/dist/releasesSlice/constants.cjs.map +1 -1
  256. package/dist/releasesSlice/constants.d.cts +2 -1
  257. package/dist/releasesSlice/constants.d.ts +2 -1
  258. package/dist/releasesSlice/constants.js +3 -1
  259. package/dist/releasesSlice/index.cjs +5 -222
  260. package/dist/releasesSlice/index.cjs.map +1 -1
  261. package/dist/releasesSlice/index.d.cts +52 -473
  262. package/dist/releasesSlice/index.d.ts +52 -473
  263. package/dist/releasesSlice/index.js +6 -6
  264. package/dist/releasesSlice/mocks.cjs +177 -0
  265. package/dist/releasesSlice/mocks.cjs.map +1 -0
  266. package/dist/releasesSlice/mocks.d.cts +49 -0
  267. package/dist/releasesSlice/mocks.d.ts +49 -0
  268. package/dist/releasesSlice/mocks.js +61 -0
  269. package/dist/releasesSlice/mocks.js.map +1 -0
  270. package/dist/releasesSlice/selectors.cjs +288 -158
  271. package/dist/releasesSlice/selectors.cjs.map +1 -1
  272. package/dist/releasesSlice/selectors.d.cts +886 -24
  273. package/dist/releasesSlice/selectors.d.ts +886 -24
  274. package/dist/releasesSlice/selectors.js +9 -7
  275. package/dist/releasesSlice/thunks.cjs +787 -982
  276. package/dist/releasesSlice/thunks.cjs.map +1 -1
  277. package/dist/releasesSlice/thunks.d.cts +150 -130
  278. package/dist/releasesSlice/thunks.d.ts +150 -130
  279. package/dist/releasesSlice/thunks.js +34 -28
  280. package/dist/selectors.cjs +559 -770
  281. package/dist/selectors.cjs.map +1 -1
  282. package/dist/selectors.d.cts +37 -9
  283. package/dist/selectors.d.ts +37 -9
  284. package/dist/selectors.js +77 -41
  285. package/dist/sockethook.cjs +271 -281
  286. package/dist/sockethook.cjs.map +1 -1
  287. package/dist/sockethook.js +7 -9
  288. package/dist/sockethook.js.map +1 -1
  289. package/dist/store.cjs +119 -834
  290. package/dist/store.cjs.map +1 -1
  291. package/dist/store.d.cts +698 -1963
  292. package/dist/store.d.ts +698 -1963
  293. package/dist/store.js +18 -16
  294. package/dist/storehooks.cjs +1797 -1907
  295. package/dist/storehooks.cjs.map +1 -1
  296. package/dist/storehooks.js +43 -49
  297. package/dist/storehooks.js.map +1 -1
  298. package/dist/thunks.cjs +2132 -2229
  299. package/dist/thunks.cjs.map +1 -1
  300. package/dist/thunks.d.cts +24 -6
  301. package/dist/thunks.d.ts +24 -6
  302. package/dist/thunks.js +55 -45
  303. package/dist/{deploymentdevicehook.cjs → useDeploymentDevice.cjs} +1757 -1976
  304. package/dist/useDeploymentDevice.cjs.map +1 -0
  305. package/dist/useDeploymentDevice.js +63 -0
  306. package/dist/useDeploymentDevice.js.map +1 -0
  307. package/dist/usersSlice/constants.cjs +5 -747
  308. package/dist/usersSlice/constants.cjs.map +1 -1
  309. package/dist/usersSlice/constants.d.cts +11 -769
  310. package/dist/usersSlice/constants.d.ts +11 -769
  311. package/dist/usersSlice/constants.js +7 -30
  312. package/dist/usersSlice/index.cjs +10 -721
  313. package/dist/usersSlice/index.cjs.map +1 -1
  314. package/dist/usersSlice/index.d.cts +136 -7900
  315. package/dist/usersSlice/index.d.ts +136 -7900
  316. package/dist/usersSlice/index.js +6 -6
  317. package/dist/usersSlice/mocks.cjs +200 -0
  318. package/dist/usersSlice/mocks.cjs.map +1 -0
  319. package/dist/usersSlice/mocks.d.cts +83 -0
  320. package/dist/usersSlice/mocks.d.ts +83 -0
  321. package/dist/usersSlice/mocks.js +47 -0
  322. package/dist/usersSlice/mocks.js.map +1 -0
  323. package/dist/usersSlice/selectors.cjs +319 -566
  324. package/dist/usersSlice/selectors.cjs.map +1 -1
  325. package/dist/usersSlice/selectors.d.cts +1651 -59
  326. package/dist/usersSlice/selectors.d.ts +1651 -59
  327. package/dist/usersSlice/selectors.js +13 -9
  328. package/dist/usersSlice/thunks.cjs +1655 -1872
  329. package/dist/usersSlice/thunks.cjs.map +1 -1
  330. package/dist/usersSlice/thunks.d.cts +362 -312
  331. package/dist/usersSlice/thunks.d.ts +362 -312
  332. package/dist/usersSlice/thunks.js +31 -31
  333. package/dist/utils.cjs +423 -285
  334. package/dist/utils.cjs.map +1 -1
  335. package/dist/utils.d.cts +44 -22
  336. package/dist/utils.d.ts +44 -22
  337. package/dist/utils.js +12 -6
  338. package/package.json +20 -11
  339. package/dist/BillingProfile-ChP2_Sqw.d.cts +0 -45
  340. package/dist/BillingProfile-ChP2_Sqw.d.ts +0 -45
  341. package/dist/api/types/AWSCredentials.ts +0 -16
  342. package/dist/api/types/Actor.ts +0 -35
  343. package/dist/api/types/Addon.ts +0 -17
  344. package/dist/api/types/AddonTenantadm.ts +0 -17
  345. package/dist/api/types/Address.ts +0 -6
  346. package/dist/api/types/AddressUpdate.ts +0 -12
  347. package/dist/api/types/Alert.ts +0 -34
  348. package/dist/api/types/AlertDetails.ts +0 -23
  349. package/dist/api/types/AlertSubject.ts +0 -23
  350. package/dist/api/types/ApiBurst.ts +0 -21
  351. package/dist/api/types/ApiBurstTenantadm.ts +0 -21
  352. package/dist/api/types/ApiLimits.ts +0 -16
  353. package/dist/api/types/ApiLimitsTenantadm.ts +0 -16
  354. package/dist/api/types/ApiQuota.ts +0 -17
  355. package/dist/api/types/ApiQuotaTenantadm.ts +0 -17
  356. package/dist/api/types/Artifact.ts +0 -48
  357. package/dist/api/types/ArtifactDeployments.ts +0 -48
  358. package/dist/api/types/ArtifactInfo.ts +0 -11
  359. package/dist/api/types/ArtifactInfoDeployments.ts +0 -11
  360. package/dist/api/types/ArtifactLink.ts +0 -11
  361. package/dist/api/types/ArtifactTypeInfo.ts +0 -13
  362. package/dist/api/types/ArtifactTypeInfoDeployments.ts +0 -13
  363. package/dist/api/types/ArtifactUpdate.ts +0 -10
  364. package/dist/api/types/ArtifactUploadLink.ts +0 -15
  365. package/dist/api/types/Attribute.ts +0 -36
  366. package/dist/api/types/AttributeInventory.ts +0 -32
  367. package/dist/api/types/AuditLog.ts +0 -26
  368. package/dist/api/types/AuthSet.ts +0 -37
  369. package/dist/api/types/AuthSetDeviceauth.ts +0 -37
  370. package/dist/api/types/AuthSetIot_manager.ts +0 -33
  371. package/dist/api/types/AutoAuthRequest.ts +0 -23
  372. package/dist/api/types/AzureSharedAccessSecret.ts +0 -11
  373. package/dist/api/types/BillingInfo.ts +0 -13
  374. package/dist/api/types/BillingProfile.ts +0 -37
  375. package/dist/api/types/BillingProfileUpdate.ts +0 -37
  376. package/dist/api/types/BinaryDeltaConfiguration.ts +0 -15
  377. package/dist/api/types/BinaryDeltaConfigurationDeployments.ts +0 -15
  378. package/dist/api/types/BinaryDeltaLimits.ts +0 -21
  379. package/dist/api/types/BinaryDeltaLimitsDeployments.ts +0 -15
  380. package/dist/api/types/BoundingBox.ts +0 -9
  381. package/dist/api/types/CancelRequest.ts +0 -10
  382. package/dist/api/types/CardData.ts +0 -49
  383. package/dist/api/types/CardSetupData.ts +0 -17
  384. package/dist/api/types/CheckoutData.ts +0 -13
  385. package/dist/api/types/Configuration.ts +0 -11
  386. package/dist/api/types/Count.ts +0 -13
  387. package/dist/api/types/Credentials.ts +0 -23
  388. package/dist/api/types/DBusSubsystem.ts +0 -27
  389. package/dist/api/types/DeltaConfiguration.ts +0 -14
  390. package/dist/api/types/DeltaConfigurationDeployments.ts +0 -14
  391. package/dist/api/types/Deployment.ts +0 -45
  392. package/dist/api/types/DeploymentAggregation.ts +0 -16
  393. package/dist/api/types/DeploymentAggregationItem.ts +0 -16
  394. package/dist/api/types/DeploymentAggregationTerm.ts +0 -22
  395. package/dist/api/types/DeploymentAggregationTerms.ts +0 -16
  396. package/dist/api/types/DeploymentAttributeProjection.ts +0 -10
  397. package/dist/api/types/DeploymentAuditlogs.ts +0 -11
  398. package/dist/api/types/DeploymentDeployments.ts +0 -98
  399. package/dist/api/types/DeploymentFilterTerm.ts +0 -35
  400. package/dist/api/types/DeploymentIdentifier.ts +0 -10
  401. package/dist/api/types/DeploymentPhase.ts +0 -23
  402. package/dist/api/types/DeploymentPhaseDeployments.ts +0 -23
  403. package/dist/api/types/DeploymentReporting.ts +0 -46
  404. package/dist/api/types/DeploymentSearchTerms.ts +0 -37
  405. package/dist/api/types/DeploymentSortTerm.ts +0 -23
  406. package/dist/api/types/DeploymentStatistics.ts +0 -15
  407. package/dist/api/types/DeploymentStatisticsDeployments.ts +0 -15
  408. package/dist/api/types/DeploymentStatusStatistics.ts +0 -54
  409. package/dist/api/types/DeploymentStatusStatisticsDeployments.ts +0 -54
  410. package/dist/api/types/Device.ts +0 -20
  411. package/dist/api/types/DeviceAggregation.ts +0 -16
  412. package/dist/api/types/DeviceAggregationItem.ts +0 -16
  413. package/dist/api/types/DeviceAggregationTerm.ts +0 -26
  414. package/dist/api/types/DeviceAggregationTerms.ts +0 -20
  415. package/dist/api/types/DeviceAttribute.ts +0 -22
  416. package/dist/api/types/DeviceAttributeProjection.ts +0 -14
  417. package/dist/api/types/DeviceAuditlogs.ts +0 -17
  418. package/dist/api/types/DeviceAuthEvent.ts +0 -23
  419. package/dist/api/types/DeviceConfiguration.ts +0 -16
  420. package/dist/api/types/DeviceDeployment.ts +0 -11
  421. package/dist/api/types/DeviceDeployments.ts +0 -29
  422. package/dist/api/types/DeviceDeviceauth.ts +0 -42
  423. package/dist/api/types/DeviceFilterAttribute.ts +0 -21
  424. package/dist/api/types/DeviceFilterTerm.ts +0 -39
  425. package/dist/api/types/DeviceInventory.ts +0 -19
  426. package/dist/api/types/DeviceInventoryInventory.ts +0 -19
  427. package/dist/api/types/DeviceReporting.ts +0 -22
  428. package/dist/api/types/DeviceSearchTerms.ts +0 -37
  429. package/dist/api/types/DeviceSortTerm.ts +0 -27
  430. package/dist/api/types/DeviceState.ts +0 -32
  431. package/dist/api/types/DeviceStateDeviceconnect.ts +0 -33
  432. package/dist/api/types/DeviceStateIot_manager.ts +0 -14
  433. package/dist/api/types/DeviceStatus.ts +0 -19
  434. package/dist/api/types/DeviceWithImage.ts +0 -80
  435. package/dist/api/types/DirectUploadMetadata.ts +0 -18
  436. package/dist/api/types/EmailVerificationCompletion.ts +0 -13
  437. package/dist/api/types/EmailVerificationRequest.ts +0 -13
  438. package/dist/api/types/Error.ts +0 -17
  439. package/dist/api/types/ErrorAuditlogs.ts +0 -13
  440. package/dist/api/types/ErrorDeployments.ts +0 -17
  441. package/dist/api/types/ErrorDeviceauth.ts +0 -13
  442. package/dist/api/types/ErrorDeviceconfig.ts +0 -17
  443. package/dist/api/types/ErrorDeviceconnect.ts +0 -17
  444. package/dist/api/types/ErrorDevicemonitor.ts +0 -17
  445. package/dist/api/types/ErrorExt.ts +0 -18
  446. package/dist/api/types/ErrorInventory.ts +0 -17
  447. package/dist/api/types/ErrorIot_manager.ts +0 -17
  448. package/dist/api/types/ErrorNotFound.ts +0 -17
  449. package/dist/api/types/ErrorReporting.ts +0 -18
  450. package/dist/api/types/ErrorTenantadm.ts +0 -13
  451. package/dist/api/types/ErrorUseradm.ts +0 -17
  452. package/dist/api/types/Event.ts +0 -48
  453. package/dist/api/types/ExternalIdentity.ts +0 -17
  454. package/dist/api/types/Features.ts +0 -17
  455. package/dist/api/types/FileUpload.ts +0 -23
  456. package/dist/api/types/Filter.ts +0 -19
  457. package/dist/api/types/FilterAttribute.ts +0 -21
  458. package/dist/api/types/FilterDefinition.ts +0 -18
  459. package/dist/api/types/FilterDeployments.ts +0 -19
  460. package/dist/api/types/FilterInventory.ts +0 -19
  461. package/dist/api/types/FilterPredicate.ts +0 -48
  462. package/dist/api/types/FilterPredicateDeployments.ts +0 -48
  463. package/dist/api/types/FilterPredicateInventory.ts +0 -78
  464. package/dist/api/types/GeoBoundingBox.ts +0 -8
  465. package/dist/api/types/GeoBoundingBoxFilter.ts +0 -5
  466. package/dist/api/types/GeoDistance.ts +0 -15
  467. package/dist/api/types/GeoDistanceFilter.ts +0 -8
  468. package/dist/api/types/GeoPoint.ts +0 -14
  469. package/dist/api/types/Group.ts +0 -10
  470. package/dist/api/types/HTTP.ts +0 -19
  471. package/dist/api/types/IdentityData.ts +0 -25
  472. package/dist/api/types/InputParameter.ts +0 -8
  473. package/dist/api/types/Integration.ts +0 -30
  474. package/dist/api/types/JobStatus.ts +0 -13
  475. package/dist/api/types/Limit.ts +0 -21
  476. package/dist/api/types/LimitDeployments.ts +0 -21
  477. package/dist/api/types/LimitDeviceauth.ts +0 -10
  478. package/dist/api/types/LimitUseradm.ts +0 -11
  479. package/dist/api/types/Limits.ts +0 -11
  480. package/dist/api/types/LineDescriptor.ts +0 -11
  481. package/dist/api/types/LogSubsystem.ts +0 -23
  482. package/dist/api/types/LoginOptions.ts +0 -18
  483. package/dist/api/types/ManagementAPIConfiguration.ts +0 -5
  484. package/dist/api/types/MenderTypes.ts +0 -213
  485. package/dist/api/types/MonitorConfiguration.ts +0 -22
  486. package/dist/api/types/NewConfigurationDeployment.ts +0 -15
  487. package/dist/api/types/NewConfigurationDeploymentResponse.ts +0 -10
  488. package/dist/api/types/NewDeployment.ts +0 -42
  489. package/dist/api/types/NewDeploymentForGroup.ts +0 -33
  490. package/dist/api/types/NewDeploymentPhase.ts +0 -37
  491. package/dist/api/types/NewDeploymentPhaseDeployments.ts +0 -20
  492. package/dist/api/types/NewDeploymentV2.ts +0 -34
  493. package/dist/api/types/NewTenant.ts +0 -49
  494. package/dist/api/types/Object.ts +0 -38
  495. package/dist/api/types/OwnUserUpdate.ts +0 -21
  496. package/dist/api/types/PasswordResetCompletion.ts +0 -17
  497. package/dist/api/types/PasswordResetRequest.ts +0 -13
  498. package/dist/api/types/Permission.ts +0 -21
  499. package/dist/api/types/PermissionObject.ts +0 -14
  500. package/dist/api/types/PermissionSet.ts +0 -22
  501. package/dist/api/types/PermissionSetWithScope.ts +0 -15
  502. package/dist/api/types/PersonalAccessToken.ts +0 -29
  503. package/dist/api/types/PersonalAccessTokenRequest.ts +0 -18
  504. package/dist/api/types/Plan.ts +0 -19
  505. package/dist/api/types/PlanBindingDetails.ts +0 -13
  506. package/dist/api/types/PlanChangeRequest.ts +0 -14
  507. package/dist/api/types/PlanLimits.ts +0 -12
  508. package/dist/api/types/PreAuthSet.ts +0 -16
  509. package/dist/api/types/Release.ts +0 -32
  510. package/dist/api/types/ReleaseDeployments.ts +0 -32
  511. package/dist/api/types/ReleaseUpdate.ts +0 -13
  512. package/dist/api/types/Releases.ts +0 -9
  513. package/dist/api/types/ReleasesDeleteError.ts +0 -21
  514. package/dist/api/types/ReleasesDeployments.ts +0 -9
  515. package/dist/api/types/Role.ts +0 -19
  516. package/dist/api/types/RolePermission.ts +0 -25
  517. package/dist/api/types/RolePermissionObject.ts +0 -17
  518. package/dist/api/types/RoleUseradm.ts +0 -19
  519. package/dist/api/types/SAMLMetadata.ts +0 -21
  520. package/dist/api/types/Scope.ts +0 -19
  521. package/dist/api/types/SelectAttribute.ts +0 -17
  522. package/dist/api/types/ServiceSubsystem.ts +0 -19
  523. package/dist/api/types/Settings.ts +0 -23
  524. package/dist/api/types/SortCriteria.ts +0 -30
  525. package/dist/api/types/SsoObject.ts +0 -21
  526. package/dist/api/types/Status.ts +0 -18
  527. package/dist/api/types/StatusDeviceauth.ts +0 -18
  528. package/dist/api/types/StatusTenantadm.ts +0 -17
  529. package/dist/api/types/StorageLimit.ts +0 -17
  530. package/dist/api/types/SubscriptionData.ts +0 -8
  531. package/dist/api/types/SupportRequest.ts +0 -17
  532. package/dist/api/types/Tag.ts +0 -27
  533. package/dist/api/types/Tags.ts +0 -10
  534. package/dist/api/types/TaskResult.ts +0 -13
  535. package/dist/api/types/TaskResultCLI.ts +0 -10
  536. package/dist/api/types/TaskResultHTTPRequest.ts +0 -8
  537. package/dist/api/types/TaskResultHTTPResponse.ts +0 -10
  538. package/dist/api/types/Tenant.ts +0 -26
  539. package/dist/api/types/TenantApiLimits.ts +0 -12
  540. package/dist/api/types/TenantApiLimitsTenantadm.ts +0 -12
  541. package/dist/api/types/TenantIdName.ts +0 -14
  542. package/dist/api/types/TenantIdsData.ts +0 -10
  543. package/dist/api/types/TenantInfo.ts +0 -14
  544. package/dist/api/types/TenantShortInfo.ts +0 -21
  545. package/dist/api/types/TenantTenantadm.ts +0 -54
  546. package/dist/api/types/TenantsIdName.ts +0 -6
  547. package/dist/api/types/Update.ts +0 -17
  548. package/dist/api/types/UpdateChildTenant.ts +0 -17
  549. package/dist/api/types/UpdateDeployments.ts +0 -18
  550. package/dist/api/types/UpdateFile.ts +0 -13
  551. package/dist/api/types/UpdateFileDeployments.ts +0 -13
  552. package/dist/api/types/UpdateTypes.ts +0 -8
  553. package/dist/api/types/UpgradeCompleteRequest.ts +0 -25
  554. package/dist/api/types/User.ts +0 -13
  555. package/dist/api/types/UserAuditlogs.ts +0 -13
  556. package/dist/api/types/UserNew.ts +0 -26
  557. package/dist/api/types/UserUpdate.ts +0 -25
  558. package/dist/api/types/UserUseradm.ts +0 -45
  559. package/dist/api/types/UserWithTenantInfo.ts +0 -12
  560. package/dist/api/types/XDeltaArgs.ts +0 -9
  561. package/dist/api/types/XDeltaArgsDeployments.ts +0 -9
  562. package/dist/api/types/XDeltaArgsLimits.ts +0 -10
  563. package/dist/api/types/XDeltaArgsLimitsDeployments.ts +0 -10
  564. package/dist/chunk-4RWZR3BN.js +0 -104
  565. package/dist/chunk-4RWZR3BN.js.map +0 -1
  566. package/dist/chunk-7YZCUAXZ.js.map +0 -1
  567. package/dist/chunk-AFICTIVU.js.map +0 -1
  568. package/dist/chunk-AUBJUUP3.js.map +0 -1
  569. package/dist/chunk-AVX7VVOK.js.map +0 -1
  570. package/dist/chunk-BSN2TOQC.js +0 -245
  571. package/dist/chunk-BSN2TOQC.js.map +0 -1
  572. package/dist/chunk-DCEKU6UV.js.map +0 -1
  573. package/dist/chunk-DGQKXSRI.js.map +0 -1
  574. package/dist/chunk-EQLHIPPR.js.map +0 -1
  575. package/dist/chunk-EYCORLYU.js.map +0 -1
  576. package/dist/chunk-FQDSV3NK.js.map +0 -1
  577. package/dist/chunk-FRSA2YB5.js.map +0 -1
  578. package/dist/chunk-FVCYB5OP.js.map +0 -1
  579. package/dist/chunk-GAI4VYRZ.js.map +0 -1
  580. package/dist/chunk-GWJIY56H.js.map +0 -1
  581. package/dist/chunk-JO33IORF.js.map +0 -1
  582. package/dist/chunk-K4MMUDYT.js.map +0 -1
  583. package/dist/chunk-L3SY3J5M.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-MRCFLG45.js.map +0 -1
  587. package/dist/chunk-NCSKCF2S.js.map +0 -1
  588. package/dist/chunk-NOQR3TE7.js.map +0 -1
  589. package/dist/chunk-OEP2D6QL.js +0 -727
  590. package/dist/chunk-OEP2D6QL.js.map +0 -1
  591. package/dist/chunk-PAIB5V27.js.map +0 -1
  592. package/dist/chunk-RX32WLVJ.js.map +0 -1
  593. package/dist/chunk-X3GZILYD.js.map +0 -1
  594. package/dist/chunk-Y575RZHR.js.map +0 -1
  595. package/dist/chunk-ZWOAFHAR.js.map +0 -1
  596. package/dist/deploymentdevicehook.cjs.map +0 -1
  597. package/dist/deploymentdevicehook.js +0 -63
  598. package/dist/deploymentdevicehook.js.map +0 -1
  599. package/dist/types-DBj17FZO.d.cts +0 -135
  600. package/dist/types-DnfZa6xd.d.ts +0 -135
  601. /package/dist/{chunk-ZZMFXRQK.js.map → chunk-URNS6A5T.js.map} +0 -0
  602. /package/dist/{deploymentdevicehook.d.cts → useDeploymentDevice.d.cts} +0 -0
  603. /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
@@ -679,415 +755,160 @@ var rootfsImageVersion = "rootfs-image.version";
679
755
  var softwareTitleMap = { [rootfsImageVersion]: { title: "Root filesystem", priority: 0, key: rootfsImageVersion } };
680
756
 
681
757
  // 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"
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"
717
766
  };
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]
767
+
768
+ // src/deploymentsSlice/index.ts
769
+ var sliceName = "deployments";
770
+ var initialState = {
771
+ byId: {
772
+ // [id]: { statistics: { status: {}, total_size }, devices: { [deploymentId]: { id, log } }, totalDeviceCount }
734
773
  },
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]
774
+ byStatus: {
775
+ finished: { deploymentIds: [], total: 0 },
776
+ inprogress: { deploymentIds: [], total: 0 },
777
+ pending: { deploymentIds: [], total: 0 },
778
+ scheduled: { deploymentIds: [], total: 0 }
742
779
  },
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
780
+ config: {
781
+ binaryDelta: {
782
+ timeout: -1,
783
+ duplicatesWindow: -1,
784
+ compressionLevel: -1,
785
+ disableChecksum: false,
786
+ disableDecompression: false,
787
+ inputWindow: -1,
788
+ instructionBuffer: -1,
789
+ sourceWindow: -1
754
790
  },
755
- title: "Manage",
756
- value: "manage",
757
- verbs: [PermissionTypes.Post, PermissionTypes.Put, PermissionTypes.Patch]
791
+ binaryDeltaLimits: {
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
797
+ }
758
798
  },
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
799
+ deploymentDeviceLimit: 5e3,
800
+ selectedDeviceIds: [],
801
+ selectionState: {
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: [] },
806
+ general: {
807
+ state: DEPLOYMENT_ROUTES.active.key,
808
+ showCreationDialog: false,
809
+ showReportDialog: false,
810
+ reportType: null
811
+ // DeploymentConstants.DEPLOYMENT_TYPES.configuration|DeploymentConstants.DEPLOYMENT_TYPES.software
768
812
  },
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"
813
+ selectedId: void 0
863
814
  }
864
815
  };
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] }
816
+ var deploymentsSlice = (0, import_toolkit.createSlice)({
817
+ name: sliceName,
818
+ initialState,
819
+ reducers: {
820
+ createdDeployment: (state, action) => {
821
+ state.byId[action.payload.id] = {
822
+ ...deploymentPrototype,
823
+ ...action.payload
824
+ };
825
+ state.byStatus[DEPLOYMENT_STATES.pending].total = state.byStatus[DEPLOYMENT_STATES.pending].total + 1;
826
+ state.byStatus[DEPLOYMENT_STATES.pending].deploymentIds = [...state.byStatus.pending.deploymentIds, action.payload.id];
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;
829
+ },
830
+ removedDeployment: (state, action) => {
831
+ const { [action.payload]: removedDeployment, ...remainder } = state.byId;
832
+ state.byId = remainder;
833
+ },
834
+ receivedDeployment: (state, action) => {
835
+ state.byId[action.payload.id] = {
836
+ ...state.byId[action.payload.id] || {},
837
+ ...action.payload
838
+ };
839
+ },
840
+ receivedDeploymentDeviceLog: (state, action) => {
841
+ const { id, deviceId, log } = action.payload;
842
+ const deployment = {
843
+ ...deploymentPrototype,
844
+ ...state.byId[id]
845
+ };
846
+ state.byId[id] = {
847
+ ...deployment,
848
+ devices: {
849
+ ...deployment.devices,
850
+ [deviceId]: {
851
+ ...deployment.devices[deviceId],
852
+ log
853
+ }
854
+ }
855
+ };
856
+ },
857
+ receivedDeploymentDevices: (state, action) => {
858
+ const { id, devices, selectedDeviceIds, totalDeviceCount } = action.payload;
859
+ state.byId[id] = {
860
+ ...state.byId[id],
861
+ devices,
862
+ totalDeviceCount
863
+ };
864
+ state.selectedDeviceIds = selectedDeviceIds;
865
+ },
866
+ receivedDeployments: (state, action) => {
867
+ state.byId = {
868
+ ...state.byId,
869
+ ...action.payload
870
+ };
871
+ },
872
+ receivedDeploymentsForStatus: (state, action) => {
873
+ const { status, deploymentIds, total } = action.payload;
874
+ state.byStatus[status].deploymentIds = deploymentIds;
875
+ state.byStatus[status].total = total;
876
+ },
877
+ selectDeploymentsForStatus: (state, action) => {
878
+ const { status, deploymentIds, total } = action.payload;
879
+ state.selectionState[status].selection = deploymentIds;
880
+ state.selectionState[status].total = total;
881
+ },
882
+ setDeploymentsState: (state, action) => {
883
+ state.selectionState = action.payload;
884
+ },
885
+ setDeploymentsConfig: (state, action) => {
886
+ state.config = action.payload;
926
887
  }
927
888
  }
928
889
  });
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
- };
890
+ var actions = deploymentsSlice.actions;
891
+ var deploymentsSlice_default = deploymentsSlice.reducer;
1069
892
 
1070
893
  // src/appSlice/index.ts
1071
- var import_toolkit = require("@reduxjs/toolkit");
1072
- var sliceName = "app";
894
+ var import_toolkit2 = require("@reduxjs/toolkit");
895
+ var sliceName2 = "app";
1073
896
  var getYesterday = () => {
1074
897
  const today = /* @__PURE__ */ new Date();
1075
898
  today.setDate(today.getDate() - 1);
1076
899
  return today.toISOString();
1077
900
  };
1078
- var initialState = {
901
+ var initialState2 = {
1079
902
  cancelSource: void 0,
903
+ commit: "",
1080
904
  demoArtifactLink: "https://dgsbl4vditpls.cloudfront.net/mender-demo-artifact.mender",
1081
905
  hostAddress: null,
1082
906
  snackbar: {
1083
- open: false,
1084
- message: "",
1085
- maxWidth: 900,
1086
- autoHideDuration: void 0,
1087
907
  action: void 0,
1088
- children: void 0,
1089
- onClick: void 0,
1090
- onClose: void 0
908
+ autoHideDuration: void 0,
909
+ message: "",
910
+ open: false,
911
+ preventClickToCopy: false
1091
912
  },
1092
913
  // return boolean rather than organization details
1093
914
  features: {
@@ -1100,7 +921,7 @@ var initialState = {
1100
921
  hasMonitor: false,
1101
922
  hasReporting: false,
1102
923
  isDemoMode: false,
1103
- isHosted: false,
924
+ isHosted: true,
1104
925
  isEnterprise: false
1105
926
  },
1106
927
  feedbackProbability: 0.3,
@@ -1112,16 +933,22 @@ var initialState = {
1112
933
  deviceIds: [],
1113
934
  searchTerm: "",
1114
935
  searchTotal: 0,
936
+ isSearching: false,
1115
937
  sort: {
1116
- direction: SORTING_OPTIONS.desc
938
+ direction: import_constants5.SORTING_OPTIONS.desc
1117
939
  // key: null,
1118
940
  // scope: null
1119
941
  }
1120
942
  },
943
+ sentry: {
944
+ location: "",
945
+ replaysSessionSampleRate: 0.1,
946
+ tracesSampleRate: 1
947
+ },
1121
948
  stripeAPIKey: "",
1122
949
  trackerCode: "",
1123
950
  uploadsById: {
1124
- // id: { uploading: false, uploadProgress: 0, cancelSource: undefined }
951
+ // id: { progress: 0, cancelSource: undefined }
1125
952
  },
1126
953
  newThreshold: getYesterday(),
1127
954
  offlineThreshold: getYesterday(),
@@ -1129,17 +956,13 @@ var initialState = {
1129
956
  Integration: "",
1130
957
  "Mender-Client": "",
1131
958
  "Mender-Artifact": "",
1132
- "Meta-Mender": "",
1133
- Deployments: "",
1134
- Deviceauth: "",
1135
- Inventory: "",
1136
- GUI: "latest"
959
+ "Meta-Mender": ""
1137
960
  },
1138
961
  yesterday: void 0
1139
962
  };
1140
- var appSlice = (0, import_toolkit.createSlice)({
1141
- name: sliceName,
1142
- initialState,
963
+ var appSlice = (0, import_toolkit2.createSlice)({
964
+ name: sliceName2,
965
+ initialState: initialState2,
1143
966
  reducers: {
1144
967
  setFeatures: (state, action) => {
1145
968
  state.features = {
@@ -1148,19 +971,17 @@ var appSlice = (0, import_toolkit.createSlice)({
1148
971
  };
1149
972
  },
1150
973
  setSnackbar: (state, { payload }) => {
1151
- let { message, autoHideDuration, action, children, onClick, onClose } = payload;
1152
- if (typeof payload === "string" || payload instanceof String) {
1153
- message = payload;
974
+ if (typeof payload === "string") {
975
+ state.snackbar.message = payload;
976
+ return;
1154
977
  }
978
+ const { message, autoHideDuration, action, preventClickToCopy = false } = payload;
1155
979
  state.snackbar = {
1156
- open: message ? true : false,
1157
980
  message,
1158
- maxWidth: 900,
1159
981
  autoHideDuration,
1160
982
  action,
1161
- children,
1162
- onClick,
1163
- onClose
983
+ preventClickToCopy,
984
+ open: !!message
1164
985
  };
1165
986
  },
1166
987
  setFirstLoginAfterSignup: (state, action) => {
@@ -1202,134 +1023,9 @@ var appSlice = (0, import_toolkit.createSlice)({
1202
1023
  setEnvironmentData: (state, action) => ({ ...state, ...action.payload })
1203
1024
  }
1204
1025
  });
1205
- var actions = appSlice.actions;
1026
+ var actions2 = appSlice.actions;
1206
1027
  var appSlice_default = appSlice.reducer;
1207
1028
 
1208
- // src/deploymentsSlice/index.ts
1209
- var import_toolkit2 = require("@reduxjs/toolkit");
1210
- var sliceName2 = "deployments";
1211
- var initialState2 = {
1212
- byId: {
1213
- // [id]: { statistics: { status: {}, total_size }, devices: { [deploymentId]: { id, log } }, totalDeviceCount }
1214
- },
1215
- byStatus: {
1216
- finished: { deploymentIds: [], total: 0 },
1217
- inprogress: { deploymentIds: [], total: 0 },
1218
- pending: { deploymentIds: [], total: 0 },
1219
- scheduled: { deploymentIds: [], total: 0 }
1220
- },
1221
- config: {
1222
- binaryDelta: {
1223
- timeout: -1,
1224
- duplicatesWindow: -1,
1225
- compressionLevel: -1,
1226
- disableChecksum: false,
1227
- disableDecompression: false,
1228
- inputWindow: -1,
1229
- instructionBuffer: -1,
1230
- sourceWindow: -1
1231
- },
1232
- binaryDeltaLimits: {
1233
- timeout: { ...limitDefault, default: 60, max: 3600, min: 60 },
1234
- sourceWindow: limitDefault,
1235
- inputWindow: limitDefault,
1236
- duplicatesWindow: limitDefault,
1237
- instructionBuffer: limitDefault
1238
- }
1239
- },
1240
- deploymentDeviceLimit: 5e3,
1241
- selectedDeviceIds: [],
1242
- selectionState: {
1243
- finished: { ...DEVICE_LIST_DEFAULTS, endDate: void 0, search: "", selection: [], startDate: void 0, total: 0, type: "" },
1244
- inprogress: { ...DEVICE_LIST_DEFAULTS, perPage: DEFAULT_PENDING_INPROGRESS_COUNT, selection: [] },
1245
- pending: { ...DEVICE_LIST_DEFAULTS, perPage: DEFAULT_PENDING_INPROGRESS_COUNT, selection: [] },
1246
- scheduled: { ...DEVICE_LIST_DEFAULTS, selection: [] },
1247
- general: {
1248
- state: DEPLOYMENT_ROUTES.active.key,
1249
- showCreationDialog: false,
1250
- showReportDialog: false,
1251
- reportType: null
1252
- // DeploymentConstants.DEPLOYMENT_TYPES.configuration|DeploymentConstants.DEPLOYMENT_TYPES.software
1253
- },
1254
- selectedId: void 0
1255
- }
1256
- };
1257
- var deploymentsSlice = (0, import_toolkit2.createSlice)({
1258
- name: sliceName2,
1259
- initialState: initialState2,
1260
- reducers: {
1261
- createdDeployment: (state, action) => {
1262
- state.byId[action.payload.id] = {
1263
- ...deploymentPrototype,
1264
- ...action.payload
1265
- };
1266
- state.byStatus[DEPLOYMENT_STATES.pending].total = state.byStatus[DEPLOYMENT_STATES.pending].total + 1;
1267
- state.byStatus[DEPLOYMENT_STATES.pending].deploymentIds = [...state.byStatus.pending.deploymentIds, action.payload.id];
1268
- 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;
1269
- },
1270
- removedDeployment: (state, action) => {
1271
- const { [action.payload]: removedDeployment, ...remainder } = state.byId;
1272
- state.byId = remainder;
1273
- },
1274
- receivedDeployment: (state, action) => {
1275
- state.byId[action.payload.id] = {
1276
- ...state.byId[action.payload.id] || {},
1277
- ...action.payload
1278
- };
1279
- },
1280
- receivedDeploymentDeviceLog: (state, action) => {
1281
- const { id, deviceId, log } = action.payload;
1282
- const deployment = {
1283
- ...deploymentPrototype,
1284
- ...state.byId[id]
1285
- };
1286
- state.byId[id] = {
1287
- ...deployment,
1288
- devices: {
1289
- ...deployment.devices,
1290
- [deviceId]: {
1291
- ...deployment.devices[deviceId],
1292
- log
1293
- }
1294
- }
1295
- };
1296
- },
1297
- receivedDeploymentDevices: (state, action) => {
1298
- const { id, devices, selectedDeviceIds, totalDeviceCount } = action.payload;
1299
- state.byId[id] = {
1300
- ...state.byId[id],
1301
- devices,
1302
- totalDeviceCount
1303
- };
1304
- state.selectedDeviceIds = selectedDeviceIds;
1305
- },
1306
- receivedDeployments: (state, action) => {
1307
- state.byId = {
1308
- ...state.byId,
1309
- ...action.payload
1310
- };
1311
- },
1312
- receivedDeploymentsForStatus: (state, action) => {
1313
- const { status, deploymentIds, total } = action.payload;
1314
- state.byStatus[status].deploymentIds = deploymentIds;
1315
- state.byStatus[status].total = total;
1316
- },
1317
- selectDeploymentsForStatus: (state, action) => {
1318
- const { status, deploymentIds, total } = action.payload;
1319
- state.selectionState[status].selection = deploymentIds;
1320
- state.selectionState[status].total = total;
1321
- },
1322
- setDeploymentsState: (state, action) => {
1323
- state.selectionState = action.payload;
1324
- },
1325
- setDeploymentsConfig: (state, action) => {
1326
- state.config = action.payload;
1327
- }
1328
- }
1329
- });
1330
- var actions2 = deploymentsSlice.actions;
1331
- var deploymentsSlice_default = deploymentsSlice.reducer;
1332
-
1333
1029
  // src/devicesSlice/index.ts
1334
1030
  var import_helpers = require("@northern.tech/utils/helpers");
1335
1031
  var import_toolkit3 = require("@reduxjs/toolkit");
@@ -1342,26 +1038,30 @@ var initialState3 = {
1342
1038
  // }
1343
1039
  },
1344
1040
  byStatus: {
1345
- [DEVICE_STATES.accepted]: { deviceIds: [], total: 0 },
1041
+ [import_constants5.DEVICE_STATES.accepted]: { deviceIds: [], total: 0 },
1346
1042
  active: { deviceIds: [], total: 0 },
1347
1043
  inactive: { deviceIds: [], total: 0 },
1348
- [DEVICE_STATES.pending]: { deviceIds: [], total: 0 },
1349
- [DEVICE_STATES.preauth]: { deviceIds: [], total: 0 },
1350
- [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 }
1351
1047
  },
1352
1048
  deviceList: {
1353
1049
  deviceIds: [],
1354
- ...DEVICE_LIST_DEFAULTS,
1050
+ ...import_constants5.DEVICE_LIST_DEFAULTS,
1355
1051
  selectedAttributes: [],
1356
1052
  selectedIssues: [],
1357
1053
  selection: [],
1358
1054
  sort: {
1359
- direction: SORTING_OPTIONS.desc
1055
+ direction: import_constants5.SORTING_OPTIONS.desc
1360
1056
  // key: null,
1361
1057
  // scope: null
1362
1058
  },
1363
- state: DEVICE_STATES.accepted,
1364
- total: 0
1059
+ state: import_constants5.DEVICE_STATES.accepted,
1060
+ total: 0,
1061
+ refreshTrigger: false,
1062
+ isLoading: false,
1063
+ detailsTab: "",
1064
+ open: false
1365
1065
  },
1366
1066
  filters: [
1367
1067
  // { key: 'device_type', value: 'raspberry', operator: '$eq', scope: 'inventory' }
@@ -1433,7 +1133,7 @@ var devicesSlice = (0, import_toolkit3.createSlice)({
1433
1133
  };
1434
1134
  },
1435
1135
  selectGroup: (state, { payload: group }) => {
1436
- 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 : [];
1437
1137
  state.groups.selectedGroup = group;
1438
1138
  },
1439
1139
  removeGroup: (state, action) => {
@@ -1485,9 +1185,6 @@ var devicesSlice = (0, import_toolkit3.createSlice)({
1485
1185
  const { count, status } = action.payload;
1486
1186
  state.byStatus[status].total = count;
1487
1187
  },
1488
- setTotalDevices: (state, action) => {
1489
- state.total = action.payload;
1490
- },
1491
1188
  setDeviceLimit: (state, action) => {
1492
1189
  state.limit = action.payload;
1493
1190
  },
@@ -1500,8 +1197,8 @@ var devicesSlice = (0, import_toolkit3.createSlice)({
1500
1197
  maybeUpdateDevicesByStatus: (state, action) => {
1501
1198
  const { deviceId, authId } = action.payload;
1502
1199
  const device = state.byId[deviceId];
1503
- const hasMultipleAuthSets = authId ? device.auth_sets.filter((authset) => authset.id !== authId).length > 0 : false;
1504
- 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)) {
1505
1202
  const deviceIds = state.byStatus[device.status].deviceIds.filter((id) => id !== deviceId);
1506
1203
  state.byStatus[device.status] = { deviceIds, total: Math.max(0, state.byStatus[device.status].total - 1) };
1507
1204
  }
@@ -1516,16 +1213,16 @@ var import_toolkit4 = require("@reduxjs/toolkit");
1516
1213
  var sliceName4 = "monitor";
1517
1214
  var initialState4 = {
1518
1215
  alerts: {
1519
- alertList: { ...DEVICE_LIST_DEFAULTS, total: 0 },
1216
+ alertList: { ...import_constants5.DEVICE_LIST_DEFAULTS, total: 0 },
1520
1217
  byDeviceId: {}
1521
1218
  },
1522
1219
  issueCounts: {
1523
- 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 } }), {})
1524
1221
  },
1525
1222
  settings: {
1526
1223
  global: {
1527
1224
  channels: {
1528
- ...Object.keys(alertChannels).reduce((accu, item) => ({ ...accu, [item]: { enabled: true } }), {})
1225
+ ...Object.keys(import_constants5.alertChannels).reduce((accu, item) => ({ ...accu, [item]: { enabled: true } }), {})
1529
1226
  }
1530
1227
  }
1531
1228
  }
@@ -1617,7 +1314,7 @@ var initialState6 = {
1617
1314
  tenants: [],
1618
1315
  selectedTenant: null,
1619
1316
  sort: {
1620
- direction: SORTING_OPTIONS.desc,
1317
+ direction: import_constants5.SORTING_OPTIONS.desc,
1621
1318
  key: "name"
1622
1319
  }
1623
1320
  },
@@ -1627,15 +1324,16 @@ var initialState6 = {
1627
1324
  auditlog: {
1628
1325
  events: [],
1629
1326
  selectionState: {
1630
- ...DEVICE_LIST_DEFAULTS,
1327
+ ...import_constants5.DEVICE_LIST_DEFAULTS,
1631
1328
  detail: void 0,
1632
1329
  endDate: void 0,
1633
1330
  selectedIssue: void 0,
1634
- sort: { direction: SORTING_OPTIONS.desc },
1331
+ sort: { direction: import_constants5.SORTING_OPTIONS.desc },
1635
1332
  startDate: void 0,
1636
1333
  total: 0,
1637
1334
  type: void 0,
1638
- user: void 0
1335
+ user: void 0,
1336
+ isLoading: false
1639
1337
  }
1640
1338
  },
1641
1339
  externalDeviceIntegrations: [
@@ -1673,6 +1371,12 @@ var organizationSlice = (0, import_toolkit6.createSlice)({
1673
1371
  setOrganization: (state, action) => {
1674
1372
  state.organization = { ...state.organization, ...action.payload };
1675
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
+ },
1676
1380
  setTenantListState: (state, action) => {
1677
1381
  state.tenantList = action.payload;
1678
1382
  },
@@ -1735,12 +1439,12 @@ var initialState7 = {
1735
1439
  */
1736
1440
  },
1737
1441
  releasesList: {
1738
- ...DEVICE_LIST_DEFAULTS,
1442
+ ...import_constants5.DEVICE_LIST_DEFAULTS,
1739
1443
  searchedIds: [],
1740
1444
  releaseIds: [],
1741
1445
  selection: [],
1742
1446
  sort: {
1743
- direction: SORTING_OPTIONS.desc,
1447
+ direction: import_constants5.SORTING_OPTIONS.desc,
1744
1448
  key: "modified"
1745
1449
  },
1746
1450
  isLoading: void 0,
@@ -1809,11 +1513,12 @@ var initialState8 = {
1809
1513
  retries: 0
1810
1514
  },
1811
1515
  permissionSetsById: {
1812
- ...defaultPermissionSets
1516
+ ...import_constants5.defaultPermissionSets
1813
1517
  },
1814
1518
  rolesById: {
1815
- ...rolesById
1519
+ ...import_constants5.rolesById
1816
1520
  },
1521
+ rolesInitialized: false,
1817
1522
  settingsInitialized: false,
1818
1523
  showConnectDeviceDialog: false,
1819
1524
  showFeedbackDialog: false,
@@ -1849,9 +1554,6 @@ var usersSlice = (0, import_toolkit8.createSlice)({
1849
1554
  state.byId[action.payload.id] = action.payload;
1850
1555
  state.currentUser = action.payload.id;
1851
1556
  },
1852
- createdUser: (state, action) => {
1853
- state.byId[0] = action.payload;
1854
- },
1855
1557
  removedUser: (state, action) => {
1856
1558
  const { [action.payload]: removedUser, ...byId } = state.byId;
1857
1559
  state.byId = byId;
@@ -1868,6 +1570,10 @@ var usersSlice = (0, import_toolkit8.createSlice)({
1868
1570
  },
1869
1571
  receivedRoles: (state, action) => {
1870
1572
  state.rolesById = action.payload;
1573
+ state.rolesInitialized = true;
1574
+ },
1575
+ finishedRoleInitialization: (state, action) => {
1576
+ state.rolesInitialized = action.payload;
1871
1577
  },
1872
1578
  createdRole: (state, action) => {
1873
1579
  state.rolesById[action.payload.name] = {
@@ -1898,7 +1604,7 @@ var usersSlice = (0, import_toolkit8.createSlice)({
1898
1604
  },
1899
1605
  setTooltipState: (state, action) => {
1900
1606
  const { id, readState = READ_STATES.read } = action.payload;
1901
- state.tooltips.byId[id].readState = readState;
1607
+ state.tooltips.byId[id] = { ...state.tooltips.byId[id], readState };
1902
1608
  },
1903
1609
  setTooltipsState: (state, action) => {
1904
1610
  state.tooltips.byId = {
@@ -1922,8 +1628,8 @@ var usersSlice_default = usersSlice.reducer;
1922
1628
 
1923
1629
  // src/actions.ts
1924
1630
  var actions_default = {
1925
- ...actions,
1926
1631
  ...actions2,
1632
+ ...actions,
1927
1633
  ...actions3,
1928
1634
  ...actions4,
1929
1635
  ...actions5,
@@ -1938,7 +1644,7 @@ var import_axios = __toESM(require("axios"), 1);
1938
1644
  // src/auth.ts
1939
1645
  var import_universal_cookie = __toESM(require("universal-cookie"), 1);
1940
1646
  var cookies = new import_universal_cookie.default();
1941
- var emptySession = Object.freeze({ token: "", exiresAt: void 0 });
1647
+ var emptySession = Object.freeze({ token: "", expiresAt: void 0 });
1942
1648
  var tokenCache = "";
1943
1649
  var getSessionInfo = () => {
1944
1650
  let sessionInfo = { ...emptySession };
@@ -1951,15 +1657,15 @@ var getSessionInfo = () => {
1951
1657
  return { ...emptySession };
1952
1658
  }
1953
1659
  if (!sessionInfo.token) {
1954
- let jwtTokenFromCookie = cookies.get("JWT", { doNotParse: true }) ?? "";
1660
+ const jwtTokenFromCookie = cookies.get("JWT", { doNotParse: true }) ?? "";
1955
1661
  if (jwtTokenFromCookie) {
1956
- setSessionInfo({ token: jwtTokenFromCookie, undefined: void 0 });
1662
+ setSessionInfo({ token: jwtTokenFromCookie });
1957
1663
  sessionInfo.token = jwtTokenFromCookie;
1958
1664
  cookies.remove("JWT");
1959
1665
  cookies.remove("JWT", { path: "/" });
1960
1666
  }
1961
1667
  }
1962
- sessionInfo.token = sessionInfo.token || void 0;
1668
+ sessionInfo.token = sessionInfo.token || "";
1963
1669
  tokenCache = sessionInfo.token;
1964
1670
  return sessionInfo;
1965
1671
  };
@@ -1975,7 +1681,6 @@ var cleanUp = () => {
1975
1681
  window.localStorage.removeItem("JWT");
1976
1682
  window.localStorage.removeItem("oauth");
1977
1683
  };
1978
- var maxSessionAge = 900;
1979
1684
 
1980
1685
  // src/api/general-api.ts
1981
1686
  var unauthorizedRedirect = (error) => {
@@ -2017,20 +1722,17 @@ var general_api_default = Api;
2017
1722
  // src/appSlice/selectors.ts
2018
1723
  var import_helpers2 = require("@northern.tech/utils/helpers");
2019
1724
  var import_toolkit9 = require("@reduxjs/toolkit");
2020
- var getAppDocsVersion = (state) => state.app.docsVersion;
2021
1725
  var getFeatures = (state) => state.app.features;
2022
1726
  var getFullVersionInformation = (state) => state.app.versionInformation;
2023
- var getDocsVersion = (0, import_toolkit9.createSelector)([getAppDocsVersion, getFeatures], (appDocsVersion, { isHosted }) => {
2024
- const docsVersion = appDocsVersion ? `${appDocsVersion}/` : "development/";
2025
- return isHosted ? "" : docsVersion;
2026
- });
2027
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);
2028
1730
  var getSearchedDevices = (0, import_toolkit9.createSelector)([getSearchState], ({ deviceIds }) => deviceIds);
2029
1731
  var getVersionInformation = (0, import_toolkit9.createSelector)(
2030
1732
  [getFullVersionInformation, getFeatures],
2031
- ({ Integration, ...remainder }, { isHosted }) => isHosted && Integration !== "next" ? remainder : { ...remainder, Integration }
1733
+ ({ Integration: Integration2, ...remainder }, { isHosted }) => isHosted && Integration2 !== "next" ? remainder : { ...remainder, Integration: Integration2 }
2032
1734
  );
2033
- 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);
2034
1736
 
2035
1737
  // src/commonSelectors.ts
2036
1738
  var import_helpers5 = require("@northern.tech/utils/helpers");
@@ -2082,6 +1784,7 @@ var import_toolkit11 = require("@reduxjs/toolkit");
2082
1784
  var getAcceptedDevices = (state) => state.devices.byStatus.accepted;
2083
1785
  var getDevicesByStatus = (state) => state.devices.byStatus;
2084
1786
  var getDevicesById = (state) => state.devices.byId;
1787
+ var getDeviceReports = (state) => state.devices.reports;
2085
1788
  var getGroupsById = (state) => state.devices.groups.byId;
2086
1789
  var getSelectedGroup = (state) => state.devices.groups.selectedGroup;
2087
1790
  var getDeviceListState = (state) => state.devices.deviceList;
@@ -2113,7 +1816,7 @@ var getDeviceIdentityAttributes = (0, import_toolkit11.createSelector)(
2113
1816
  );
2114
1817
  var getDeviceCountsByStatus = (0, import_toolkit11.createSelector)(
2115
1818
  [getDevicesByStatus],
2116
- (byStatus) => Object.values(DEVICE_STATES).reduce((accu, state) => {
1819
+ (byStatus) => Object.values(import_constants5.DEVICE_STATES).reduce((accu, state) => {
2117
1820
  accu[state] = byStatus[state].total || 0;
2118
1821
  return accu;
2119
1822
  }, {})
@@ -2125,7 +1828,7 @@ var getSelectedGroupInfo = (0, import_toolkit11.createSelector)(
2125
1828
  let groupCount = acceptedDeviceTotal;
2126
1829
  let groupFilters = [];
2127
1830
  if (selectedGroup && groupsById[selectedGroup]) {
2128
- groupCount = groupsById[selectedGroup].total;
1831
+ groupCount = groupsById[selectedGroup].total || 0;
2129
1832
  groupFilters = groupsById[selectedGroup].filters || [];
2130
1833
  }
2131
1834
  return { groupCount, selectedGroup, groupFilters };
@@ -2136,13 +1839,18 @@ var getLimitMaxed = (0, import_toolkit11.createSelector)(
2136
1839
  ({ total: acceptedDevices = 0 }, deviceLimit) => Boolean(deviceLimit && deviceLimit <= acceptedDevices)
2137
1840
  );
2138
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
+ });
2139
1847
  var getGroups = (0, import_toolkit11.createSelector)([getGroupsById], (groupsById) => {
2140
1848
  const groupNames = Object.keys(groupsById).sort();
2141
1849
  const groupedGroups = Object.entries(groupsById).sort((a, b) => a[0].localeCompare(b[0])).reduce(
2142
1850
  (accu, [groupname, group]) => {
2143
1851
  const name = groupname === UNGROUPED_GROUP.id ? UNGROUPED_GROUP.name : groupname;
2144
1852
  const groupItem = { ...group, groupId: name, name: groupname };
2145
- if (group.filters?.length > 0) {
1853
+ if ((group.filters ?? []).length > 0) {
2146
1854
  if (groupname !== UNGROUPED_GROUP.id) {
2147
1855
  accu.dynamic.push(groupItem);
2148
1856
  } else {
@@ -2185,12 +1893,14 @@ var getOnboarding = (state) => state.onboarding;
2185
1893
 
2186
1894
  // src/organizationSlice/selectors.ts
2187
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);
2188
1898
  var getOrganization = (state) => state.organization.organization;
2189
1899
  var getExternalIntegrations = (state) => state.organization.externalDeviceIntegrations;
2190
1900
  var getAuditLog = (state) => state.organization.auditlog.events;
2191
1901
  var getAuditLogSelectionState = (state) => state.organization.auditlog.selectionState;
2192
1902
  var getWebhookEvents = (state) => state.organization.webhooks.events;
2193
- var getWebhookEventTotal = (state) => state.organization.webhooks.eventTotal;
1903
+ var getWebhookEventTotal = (state) => state.organization.webhooks.eventsTotal;
2194
1904
  var getDeviceTwinIntegrations = (0, import_toolkit12.createSelector)(
2195
1905
  [getExternalIntegrations],
2196
1906
  (integrations) => integrations.filter((integration) => integration.id && EXTERNAL_PROVIDER[integration.provider]?.deviceTwin)
@@ -2211,22 +1921,31 @@ var getAuditLogEntry = (0, import_toolkit12.createSelector)([getAuditLog, getAud
2211
1921
  const [eventAction, eventTime] = atob(selectedId).split("|");
2212
1922
  return events.find((item) => item.action === eventAction && item.time === eventTime);
2213
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");
2214
1933
 
2215
1934
  // src/utils.ts
2216
1935
  var import_helpers4 = require("@northern.tech/utils/helpers");
2217
1936
  var filterProcessors = {
2218
- [DEVICE_FILTERING_OPTIONS.$gt.key]: (val) => Number(val) || val,
2219
- [DEVICE_FILTERING_OPTIONS.$gte.key]: (val) => Number(val) || val,
2220
- [DEVICE_FILTERING_OPTIONS.$lt.key]: (val) => Number(val) || val,
2221
- [DEVICE_FILTERING_OPTIONS.$lte.key]: (val) => Number(val) || val,
2222
- [DEVICE_FILTERING_OPTIONS.$ltne.key]: (val) => Number(val) || val,
2223
- [DEVICE_FILTERING_OPTIONS.$in.key]: (val) => ("" + val).split(",").map((i) => i.trim()),
2224
- [DEVICE_FILTERING_OPTIONS.$nin.key]: (val) => ("" + val).split(",").map((i) => i.trim()),
2225
- [DEVICE_FILTERING_OPTIONS.$exists.key]: import_helpers4.yes,
2226
- [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
2227
1946
  };
2228
1947
  var filterAliases = {
2229
- $nexists: { alias: DEVICE_FILTERING_OPTIONS.$exists.key, value: false }
1948
+ $nexists: { alias: import_constants5.DEVICE_FILTERING_OPTIONS.$exists.key, value: false }
2230
1949
  };
2231
1950
  var mapFiltersToTerms = (filters) => filters.map((filter) => ({
2232
1951
  scope: filter.scope,
@@ -2242,38 +1961,45 @@ var mapTermsToFilters = (terms) => terms.map((term) => {
2242
1961
  return { scope: term.scope, key: term.attribute, operator, value: term.value };
2243
1962
  });
2244
1963
  var convertIssueOptionsToFilters = (issuesSelection, filtersState = {}) => issuesSelection.map((item) => {
2245
- if (typeof DEVICE_ISSUE_OPTIONS[item].filterRule.value === "function") {
2246
- 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) };
2247
1966
  }
2248
- return DEVICE_ISSUE_OPTIONS[item].filterRule;
1967
+ return import_constants5.DEVICE_ISSUE_OPTIONS[item].filterRule;
2249
1968
  });
2250
- 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
+ }) => {
2251
1977
  let applicableFilters = [...filters];
2252
1978
  if (typeof group === "string" && !(groups.byId[group]?.filters || applicableFilters).length) {
2253
- 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" });
2254
1980
  }
2255
1981
  const nonMonitorFilters = applicableFilters.filter(
2256
- (filter) => !Object.values(DEVICE_ISSUE_OPTIONS).some(
1982
+ (filter) => !Object.values(import_constants5.DEVICE_ISSUE_OPTIONS).some(
2257
1983
  ({ filterRule }) => filter.scope !== "inventory" && filterRule.scope === filter.scope && filterRule.key === filter.key
2258
1984
  )
2259
1985
  );
2260
1986
  const deviceIssueFilters = convertIssueOptionsToFilters(selectedIssues, { offlineThreshold });
2261
1987
  applicableFilters = [...nonMonitorFilters, ...deviceIssueFilters];
2262
- 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;
2263
1989
  return { applicableFilters: nonMonitorFilters, filterTerms: mapFiltersToTerms(effectiveFilters) };
2264
1990
  };
2265
- 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());
2266
1992
  var filtersFilter = (item, index, array) => {
2267
1993
  const firstIndex = array.findIndex((filter) => filterCompare(filter, item));
2268
1994
  return firstIndex === index;
2269
1995
  };
2270
- var listItemMapper = (byId, ids, { defaultObject = {}, cutOffSize = DEVICE_LIST_MAXIMUM_LENGTH }) => ids.slice(0, cutOffSize).reduce((accu, id) => {
1996
+ var listItemMapper = (byId, ids, { cutOffSize = DEVICE_LIST_MAXIMUM_LENGTH, defaultObject = {} }) => ids.slice(0, cutOffSize).reduce((accu, id) => {
2271
1997
  if (id && byId[id]) {
2272
1998
  accu.push({ ...defaultObject, ...byId[id] });
2273
1999
  }
2274
2000
  return accu;
2275
2001
  }, []);
2276
- var mergePermissions = (existingPermissions = { ...emptyUiPermissions }, addedPermissions) => Object.entries(existingPermissions).reduce(
2002
+ var mergePermissions = (existingPermissions = { ...import_constants5.emptyUiPermissions }, addedPermissions) => Object.entries(existingPermissions).reduce(
2277
2003
  (accu, [key, value]) => {
2278
2004
  let values;
2279
2005
  if (!accu[key]) {
@@ -2297,23 +2023,24 @@ var mapUserRolesToUiPermissions = (userRoles, roles) => userRoles.reduce(
2297
2023
  }
2298
2024
  return mergePermissions(accu, roles[roleId].uiPermissions);
2299
2025
  },
2300
- { ...emptyUiPermissions }
2026
+ { ...import_constants5.emptyUiPermissions }
2301
2027
  );
2302
2028
  var progress = ({ loaded, total }) => {
2303
2029
  let uploadProgress3 = loaded / total * 100;
2304
2030
  return uploadProgress3 = uploadProgress3 < 50 ? Math.ceil(uploadProgress3) : Math.round(uploadProgress3);
2305
2031
  };
2032
+ var extractErrorMessage = (err, fallback = "") => err.response?.data?.error?.message || err.response?.data?.error || err.error || err.message || fallback;
2306
2033
  var getComparisonCompatibleVersion = (version) => isNaN(version.charAt(0)) && version !== "next" ? "master" : version;
2307
2034
  var mapDeviceAttributes = (attributes = []) => attributes.reduce(
2308
2035
  (accu, attribute) => {
2309
- if (!(attribute.value && attribute.name) && attribute.scope === ATTRIBUTE_SCOPES.inventory) {
2036
+ if (!(attribute.value && attribute.name) && attribute.scope === import_constants5.ATTRIBUTE_SCOPES.inventory) {
2310
2037
  return accu;
2311
2038
  }
2312
- accu[attribute.scope || ATTRIBUTE_SCOPES.inventory] = {
2313
- ...accu[attribute.scope || ATTRIBUTE_SCOPES.inventory],
2039
+ accu[attribute.scope || import_constants5.ATTRIBUTE_SCOPES.inventory] = {
2040
+ ...accu[attribute.scope || import_constants5.ATTRIBUTE_SCOPES.inventory],
2314
2041
  [attribute.name]: attribute.value
2315
2042
  };
2316
- if (attribute.name === "device_type" && attribute.scope === ATTRIBUTE_SCOPES.inventory) {
2043
+ if (attribute.name === "device_type" && attribute.scope === import_constants5.ATTRIBUTE_SCOPES.inventory) {
2317
2044
  accu.inventory.device_type = [].concat(attribute.value);
2318
2045
  }
2319
2046
  return accu;
@@ -2323,39 +2050,44 @@ var mapDeviceAttributes = (attributes = []) => attributes.reduce(
2323
2050
  var isDarkMode = (mode) => mode === DARK_MODE;
2324
2051
 
2325
2052
  // src/releasesSlice/selectors.ts
2326
- var import_toolkit13 = require("@reduxjs/toolkit");
2327
2053
  var getSelectedReleaseId = (state) => state.releases.selectedRelease;
2328
2054
  var getReleasesById = (state) => state.releases.byId;
2329
2055
  var getReleaseTags = (state) => state.releases.tags;
2330
2056
  var getReleaseListState = (state) => state.releases.releasesList;
2331
2057
  var getListedReleases = (state) => state.releases.releasesList.releaseIds;
2332
- var getReleaseMappingDefaults = () => ({});
2058
+ var releaseDefaults = {};
2059
+ var getReleaseMappingDefaults = () => releaseDefaults;
2333
2060
  var getReleasesList = (0, import_toolkit13.createSelector)([getReleasesById, getListedReleases, getReleaseMappingDefaults], listItemMapper);
2334
2061
  var getReleaseTagsById = (0, import_toolkit13.createSelector)([getReleaseTags], (releaseTags) => releaseTags.reduce((accu, key) => ({ ...accu, [key]: key }), {}));
2335
2062
  var getHasReleases = (0, import_toolkit13.createSelector)(
2336
2063
  [getReleaseListState, getReleasesById],
2337
2064
  ({ searchTotal, total }, byId) => !!(Object.keys(byId).length || total || searchTotal)
2338
2065
  );
2339
- 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]));
2340
2068
 
2341
2069
  // src/usersSlice/selectors.ts
2342
2070
  var import_toolkit14 = require("@reduxjs/toolkit");
2071
+ var emptyObject = {};
2343
2072
  var getRolesById = (state) => state.users.rolesById;
2344
2073
  var getTooltipsById = (state) => state.users.tooltips.byId;
2345
2074
  var getGlobalSettings = (state) => state.users.globalSettings;
2346
2075
  var getCurrentUserId = (state) => state.users.currentUser;
2347
2076
  var getUsersById = (state) => state.users.byId;
2348
2077
  var getUsersList = (0, import_toolkit14.createSelector)([getUsersById], (usersById) => Object.values(usersById));
2349
- 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
+ );
2350
2082
  var getUserSettings = (state) => state.users.userSettings;
2351
2083
  var getSelectedDeviceAttribute = (0, import_toolkit14.createSelector)(
2352
2084
  [getUserSettings],
2353
2085
  ({ columnSelection }) => columnSelection.map((attribute) => ({ attribute: attribute.key, scope: attribute.scope }))
2354
2086
  );
2355
2087
  var getIsDarkMode = (0, import_toolkit14.createSelector)([getUserSettings], ({ mode }) => isDarkMode(mode));
2356
- var getShowHelptips = (0, import_toolkit14.createSelector)(
2088
+ var getReadAllHelptips = (0, import_toolkit14.createSelector)(
2357
2089
  [getTooltipsById],
2358
- (tooltips) => Object.values(tooltips).reduce((accu, { readState }) => accu || readState === READ_STATES.unread, false)
2090
+ (tooltips) => Object.values(tooltips).every(({ readState }) => readState === READ_STATES.read)
2359
2091
  );
2360
2092
  var getTooltipsState = (0, import_toolkit14.createSelector)(
2361
2093
  [getTooltipsById, getUserSettings],
@@ -2369,7 +2101,7 @@ var getTooltipsState = (0, import_toolkit14.createSelector)(
2369
2101
  );
2370
2102
  var getHas2FA = (0, import_toolkit14.createSelector)(
2371
2103
  [getCurrentUser],
2372
- (currentUser) => currentUser.hasOwnProperty("tfa_status") && currentUser.tfa_status === twoFAStates.enabled
2104
+ (currentUser) => currentUser.hasOwnProperty("tfa_status") && currentUser.tfa_status === import_constants5.twoFAStates.enabled
2373
2105
  );
2374
2106
  var getIdAttribute = (0, import_toolkit14.createSelector)([getGlobalSettings], ({ id_attribute = { ...defaultIdAttribute } }) => id_attribute);
2375
2107
  var getOfflineThresholdSettings = (0, import_toolkit14.createSelector)([getGlobalSettings], ({ offlineThreshold }) => ({
@@ -2385,37 +2117,34 @@ var getIsEnterprise = (0, import_toolkit15.createSelector)(
2385
2117
  );
2386
2118
  var getAttrsEndpoint = (0, import_toolkit15.createSelector)(
2387
2119
  [getFeatures],
2388
- ({ hasReporting }) => hasReporting ? `${reportingApiUrl}/devices/search/attributes` : `${inventoryApiUrlV2}/filters/attributes`
2120
+ ({ hasReporting }) => hasReporting ? `${import_constants5.reportingApiUrl}/devices/search/attributes` : `${import_constants5.inventoryApiUrlV2}/filters/attributes`
2389
2121
  );
2390
2122
  var getSearchEndpoint = (0, import_toolkit15.createSelector)(
2391
2123
  [getFeatures],
2392
- ({ hasReporting }) => hasReporting ? `${reportingApiUrl}/devices/search` : `${inventoryApiUrlV2}/filters/search`
2393
- );
2394
- var getUserRoles = (0, import_toolkit15.createSelector)(
2395
- [getCurrentUser, getRolesById, getIsEnterprise, getFeatures, getOrganization],
2396
- (currentUser, rolesById2, isEnterprise, { isHosted, hasMultitenancy }, { plan = PLANS.os.id }) => {
2397
- const isAdmin = currentUser.roles?.length ? currentUser.roles.some((role) => role === rolesByName.admin) : !(hasMultitenancy || isEnterprise || isHosted && plan !== PLANS.os.id);
2398
- const uiPermissions = isAdmin ? mapUserRolesToUiPermissions([rolesByName.admin], rolesById2) : mapUserRolesToUiPermissions(currentUser.roles || [], rolesById2);
2399
- return { isAdmin, uiPermissions };
2400
- }
2124
+ ({ hasReporting }) => hasReporting ? `${import_constants5.reportingApiUrl}/devices/search` : `${import_constants5.inventoryApiUrlV2}/filters/search`
2401
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
+ });
2402
2131
  var hasPermission = (thing, permission) => Object.values(thing).some((permissions) => permissions.includes(permission));
2403
2132
  var getUserCapabilities = (0, import_toolkit15.createSelector)([getUserRoles, getIsServiceProvider], ({ uiPermissions }, isServiceProvider) => {
2404
- const canManageReleases = hasPermission(uiPermissions.releases, uiPermissionsById.manage.value);
2405
- const canReadReleases = canManageReleases || hasPermission(uiPermissions.releases, uiPermissionsById.read.value);
2406
- const canUploadReleases = canManageReleases || hasPermission(uiPermissions.releases, uiPermissionsById.upload.value);
2407
- const canAuditlog = uiPermissions.auditlog.includes(uiPermissionsById.read.value);
2408
- const canReadUsers = uiPermissions.userManagement.includes(uiPermissionsById.read.value);
2409
- const canManageUsers = uiPermissions.userManagement.includes(uiPermissionsById.manage.value);
2410
- 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);
2411
2140
  const canWriteDevices = Object.values(uiPermissions.groups).some(
2412
- (groupPermissions) => groupPermissions.includes(uiPermissionsById.read.value) && groupPermissions.length > 1
2141
+ (groupPermissions) => groupPermissions.includes(import_constants5.uiPermissionsById.read.value) && groupPermissions.length > 1
2413
2142
  );
2414
- const canTroubleshoot = hasPermission(uiPermissions.groups, uiPermissionsById.connect.value);
2415
- const canManageDevices = hasPermission(uiPermissions.groups, uiPermissionsById.manage.value);
2416
- const canConfigure = hasPermission(uiPermissions.groups, uiPermissionsById.configure.value);
2417
- const canDeploy = uiPermissions.deployments.includes(uiPermissionsById.deploy.value) || hasPermission(uiPermissions.groups, uiPermissionsById.deploy.value);
2418
- 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);
2419
2148
  return {
2420
2149
  canAuditlog,
2421
2150
  canConfigure,
@@ -2466,11 +2195,11 @@ var getTenantCapabilities = (0, import_toolkit15.createSelector)(
2466
2195
  var getFilterAttributes = (0, import_toolkit15.createSelector)(
2467
2196
  [getGlobalSettings, getFilteringAttributes],
2468
2197
  ({ previousFilters }, { identityAttributes, inventoryAttributes, systemAttributes, tagAttributes }) => {
2469
- const deviceNameAttribute = { key: "name", value: "Name", scope: ATTRIBUTE_SCOPES.tags, category: ATTRIBUTE_SCOPES.tags, priority: 1 };
2470
- const deviceIdAttribute = { key: "id", value: "Device ID", scope: ATTRIBUTE_SCOPES.identity, category: ATTRIBUTE_SCOPES.identity, priority: 1 };
2471
- 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 };
2472
2201
  const updateAttribute = { ...checkInAttribute, key: "updated_ts", value: "Last inventory update" };
2473
- 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 };
2474
2203
  const attributes = [
2475
2204
  ...previousFilters.map((item) => ({
2476
2205
  ...item,
@@ -2480,13 +2209,13 @@ var getFilterAttributes = (0, import_toolkit15.createSelector)(
2480
2209
  })),
2481
2210
  deviceNameAttribute,
2482
2211
  deviceIdAttribute,
2483
- ...identityAttributes.map((item) => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.identity, category: ATTRIBUTE_SCOPES.identity, priority: 1 })),
2484
- ...inventoryAttributes.map((item) => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.inventory, category: ATTRIBUTE_SCOPES.inventory, priority: 2 })),
2485
- ...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 })),
2486
2215
  checkInAttribute,
2487
2216
  updateAttribute,
2488
2217
  firstRequestAttribute,
2489
- ...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 }))
2490
2219
  ];
2491
2220
  return (0, import_helpers5.attributeDuplicateFilter)(attributes, "key");
2492
2221
  }
@@ -2528,7 +2257,7 @@ var getSelectedDeploymentData = (0, import_toolkit15.createSelector)(
2528
2257
  );
2529
2258
  var getAvailableIssueOptionsByType = (0, import_toolkit15.createSelector)(
2530
2259
  [getFeatures, getTenantCapabilities, getIssueCountsByType],
2531
- ({ 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 }) => {
2532
2261
  if (isCategory || needsReporting && !hasReporting || needsFullFiltering && !hasFullFiltering || needsMonitor && !hasMonitor) {
2533
2262
  return accu;
2534
2263
  }
@@ -2536,14 +2265,11 @@ var getAvailableIssueOptionsByType = (0, import_toolkit15.createSelector)(
2536
2265
  return accu;
2537
2266
  }, {})
2538
2267
  );
2539
- var getGroupNames = (0, import_toolkit15.createSelector)([getGroupsById, getUserRoles, (_, options = {}) => options], (groupsById, { uiPermissions }, { staticOnly }) => {
2268
+ var getGroupNames = (0, import_toolkit15.createSelector)([getGroupsById, getUserRoles], (groupsById, { uiPermissions }) => {
2540
2269
  const { [UNGROUPED_GROUP.id]: ungrouped, ...groups } = groupsById;
2541
- if (staticOnly) {
2542
- return Object.keys(uiPermissions.groups).sort();
2543
- }
2544
2270
  return Object.keys(
2545
2271
  Object.entries(groups).reduce((accu, [groupName, group]) => {
2546
- if (group.filterId || uiPermissions.groups[ALL_DEVICES]) {
2272
+ if (group.filterId || uiPermissions.groups[import_constants5.ALL_DEVICES]) {
2547
2273
  accu[groupName] = group;
2548
2274
  }
2549
2275
  return accu;
@@ -2576,14 +2302,14 @@ var getAuditlogDevice = (0, import_toolkit15.createSelector)([getAuditLogEntry,
2576
2302
  var getRelevantRoles = (0, import_toolkit15.createSelector)([getOrganization, getRolesList], ({ service_provider }, roles) => {
2577
2303
  if (service_provider) {
2578
2304
  return roles.reduce((accu, role) => {
2579
- if (rolesById[role.value]) {
2305
+ if (import_constants5.rolesById[role.value]) {
2580
2306
  return accu;
2581
2307
  }
2582
2308
  accu.push(role);
2583
2309
  return accu;
2584
- }, Object.values(serviceProviderRolesById));
2310
+ }, Object.values(import_constants5.serviceProviderRolesById));
2585
2311
  }
2586
- return Object.keys(rolesById).reverse().reduce((accu, key) => {
2312
+ return Object.keys(import_constants5.rolesById).reverse().reduce((accu, key) => {
2587
2313
  const index = accu.findIndex(({ value }) => value === key);
2588
2314
  accu = [accu[index], ...accu.filter((item, itemIndex) => index !== itemIndex)];
2589
2315
  return accu;
@@ -2594,6 +2320,7 @@ var getRelevantRoles = (0, import_toolkit15.createSelector)([getOrganization, ge
2594
2320
  var import_react_redux = require("react-redux");
2595
2321
  var import_helpers6 = require("@northern.tech/utils/helpers");
2596
2322
  var import_toolkit16 = require("@reduxjs/toolkit");
2323
+ var import_react = require("@sentry/react");
2597
2324
  var { setSnackbar, uploadProgress } = actions_default;
2598
2325
  var keys = ["sessionDeploymentChecker", settingsKeys.initialized];
2599
2326
  var resetEnvironment = () => keys.forEach((key) => window.sessionStorage.removeItem(key));
@@ -2630,20 +2357,50 @@ var rejectionLoggerMiddleware = () => (next) => (action) => {
2630
2357
  }
2631
2358
  return next(action);
2632
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
+ });
2633
2384
  var getConfiguredStore = (options = {}) => {
2634
2385
  const { preloadedState = {}, ...config } = options;
2635
2386
  return (0, import_toolkit16.configureStore)({
2636
2387
  ...config,
2637
2388
  preloadedState,
2389
+ enhancers: (getDefaultEnhancers) => {
2390
+ if (window.mender_environment?.sentry?.isReduxEnabled) {
2391
+ return getDefaultEnhancers().concat(sentryReduxEnhancer);
2392
+ }
2393
+ return getDefaultEnhancers();
2394
+ },
2638
2395
  reducer: sessionReducer,
2639
2396
  middleware: (getDefaultMiddleware) => getDefaultMiddleware({
2640
2397
  immutableCheck: {
2641
2398
  ignoredPaths: ["app.uploadsById"]
2642
2399
  },
2643
2400
  serializableCheck: {
2644
- ignoredActions: [actions6.receiveExternalDeviceIntegrations.name, setSnackbar.name, uploadProgress.name],
2645
- ignoredActionPaths: ["uploads", "snackbar", /payload\..*$/],
2646
- 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"]
2647
2404
  }
2648
2405
  }).concat(rejectionLoggerMiddleware)
2649
2406
  });
@@ -2651,21 +2408,21 @@ var getConfiguredStore = (options = {}) => {
2651
2408
  var store = getConfiguredStore({
2652
2409
  preloadedState: {}
2653
2410
  });
2411
+ var createAppAsyncThunk = import_toolkit16.createAsyncThunk.withTypes();
2654
2412
 
2655
2413
  // src/appSlice/thunks.ts
2656
2414
  var import_helpers7 = require("@northern.tech/utils/helpers");
2657
- var import_toolkit17 = require("@reduxjs/toolkit");
2658
2415
  var import_universal_cookie2 = __toESM(require("universal-cookie"), 1);
2659
2416
  var cookies2 = new import_universal_cookie2.default();
2660
- var setFirstLoginAfterSignup = (0, import_toolkit17.createAsyncThunk)(`${sliceName}/setFirstLoginAfterSignup`, (firstLoginAfterSignup, { dispatch }) => {
2417
+ var setFirstLoginAfterSignup = createAppAsyncThunk(`${sliceName2}/setFirstLoginAfterSignup`, (firstLoginAfterSignup, { dispatch }) => {
2661
2418
  cookies2.set("firstLoginAfterSignup", !!firstLoginAfterSignup, { maxAge: 60, path: "/", domain: ".mender.io", sameSite: false });
2662
- dispatch(actions.setFirstLoginAfterSignup(!!firstLoginAfterSignup));
2419
+ dispatch(actions2.setFirstLoginAfterSignup(!!firstLoginAfterSignup));
2663
2420
  });
2664
2421
  var dateFunctionMap = {
2665
2422
  getDays: "getDate",
2666
2423
  setDays: "setDate"
2667
2424
  };
2668
- var setOfflineThreshold = (0, import_toolkit17.createAsyncThunk)(`${sliceName}/setOfflineThreshold`, (_, { dispatch, getState }) => {
2425
+ var setOfflineThreshold = createAppAsyncThunk(`${sliceName2}/setOfflineThreshold`, (_, { dispatch, getState }) => {
2669
2426
  const { interval, intervalUnit } = getOfflineThresholdSettings(getState());
2670
2427
  const today = /* @__PURE__ */ new Date();
2671
2428
  const intervalName = `${intervalUnit.charAt(0).toUpperCase()}${intervalUnit.substring(1)}`;
@@ -2676,9 +2433,9 @@ var setOfflineThreshold = (0, import_toolkit17.createAsyncThunk)(`${sliceName}/s
2676
2433
  try {
2677
2434
  value = today.toISOString();
2678
2435
  } catch {
2679
- 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.")));
2680
2437
  }
2681
- return Promise.resolve(dispatch(actions.setOfflineThreshold(value)));
2438
+ return Promise.resolve(dispatch(actions2.setOfflineThreshold(value)));
2682
2439
  });
2683
2440
  var versionRegex = new RegExp(/\d+\.\d+/);
2684
2441
  var getLatestRelease = (thing) => {
@@ -2690,12 +2447,11 @@ var repoKeyMap = {
2690
2447
  mender: "Mender-Client",
2691
2448
  "mender-artifact": "Mender-Artifact"
2692
2449
  };
2693
- var deductSaasState = (latestRelease, guiTags, saasReleases) => {
2450
+ var deductSaasState = (latestRelease, guiTags) => {
2694
2451
  const latestGuiTag = guiTags.length ? guiTags[0].name : "";
2695
- const latestSaasRelease = latestGuiTag.startsWith("saas-v") ? { date: latestGuiTag.split("-v")[1].replaceAll(".", "-"), tag: latestGuiTag } : saasReleases[0];
2696
- return latestSaasRelease.date > latestRelease.release_date ? latestSaasRelease.tag : latestRelease.release;
2452
+ return latestGuiTag ? latestGuiTag : latestRelease.release;
2697
2453
  };
2698
- var getLatestReleaseInfo = (0, import_toolkit17.createAsyncThunk)(`${sliceName}/getLatestReleaseInfo`, (_, { dispatch, getState }) => {
2454
+ var getLatestReleaseInfo = createAppAsyncThunk(`${sliceName2}/getLatestReleaseInfo`, (_, { dispatch, getState }) => {
2699
2455
  if (!getFeatures(getState()).isHosted) {
2700
2456
  return Promise.resolve();
2701
2457
  }
@@ -2706,7 +2462,7 @@ var getLatestReleaseInfo = (0, import_toolkit17.createAsyncThunk)(`${sliceName}/
2706
2462
  if (!guiTags.length) {
2707
2463
  return Promise.resolve();
2708
2464
  }
2709
- const { releases, saas } = data;
2465
+ const { releases } = data;
2710
2466
  const latestRelease = getLatestRelease(getLatestRelease(releases));
2711
2467
  const { latestRepos, latestVersions } = latestRelease.repos.reduce(
2712
2468
  (accu, item) => {
@@ -2718,13 +2474,12 @@ var getLatestReleaseInfo = (0, import_toolkit17.createAsyncThunk)(`${sliceName}/
2718
2474
  },
2719
2475
  { latestVersions: { ...getState().app.versionInformation }, latestRepos: {} }
2720
2476
  );
2721
- const info = deductSaasState(latestRelease, guiTags, saas);
2477
+ const info = deductSaasState(latestRelease, guiTags);
2722
2478
  return Promise.resolve(
2723
2479
  dispatch(
2724
- actions.setVersionInformation({
2480
+ actions2.setVersionInformation({
2725
2481
  ...latestVersions,
2726
- backend: info,
2727
- GUI: info,
2482
+ Server: info,
2728
2483
  latestRelease: {
2729
2484
  releaseDate: latestRelease.release_date,
2730
2485
  repos: latestRepos
@@ -2734,9 +2489,9 @@ var getLatestReleaseInfo = (0, import_toolkit17.createAsyncThunk)(`${sliceName}/
2734
2489
  );
2735
2490
  });
2736
2491
  });
2737
- var setSearchState = (0, import_toolkit17.createAsyncThunk)(`${sliceName}/setSearchState`, (searchState, { dispatch, getState }) => {
2492
+ var setSearchState = createAppAsyncThunk(`${sliceName2}/setSearchState`, (searchState, { dispatch, getState }) => {
2738
2493
  const currentState = getSearchState(getState());
2739
- let nextState = {
2494
+ const nextState = {
2740
2495
  ...currentState,
2741
2496
  ...searchState,
2742
2497
  sort: {
@@ -2744,7 +2499,7 @@ var setSearchState = (0, import_toolkit17.createAsyncThunk)(`${sliceName}/setSea
2744
2499
  ...searchState.sort
2745
2500
  }
2746
2501
  };
2747
- let tasks = [];
2502
+ const tasks = [];
2748
2503
  const { isSearching: currentSearching, deviceIds: currentDevices, searchTotal: currentTotal, ...currentRequestState } = currentState;
2749
2504
  const { isSearching: nextSearching, deviceIds: nextDevices, searchTotal: nextTotal, ...nextRequestState } = nextState;
2750
2505
  if (nextRequestState.searchTerm && !(0, import_helpers7.deepCompare)(currentRequestState, nextRequestState)) {
@@ -2752,24 +2507,23 @@ var setSearchState = (0, import_toolkit17.createAsyncThunk)(`${sliceName}/setSea
2752
2507
  tasks.push(
2753
2508
  dispatch(searchDevices(nextState)).unwrap().then((results) => {
2754
2509
  const searchResult = results[results.length - 1];
2755
- return dispatch(actions.setSearchState({ ...searchResult, isSearching: false }));
2756
- }).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 })))
2757
2512
  );
2758
2513
  }
2759
- tasks.push(dispatch(actions.setSearchState(nextState)));
2514
+ tasks.push(dispatch(actions2.setSearchState(nextState)));
2760
2515
  return Promise.all(tasks);
2761
2516
  });
2762
2517
 
2763
2518
  // src/devicesSlice/thunks.tsx
2764
2519
  var import_react_router_dom = require("react-router-dom");
2765
2520
  var import_helpers8 = require("@northern.tech/utils/helpers");
2766
- var import_toolkit18 = require("@reduxjs/toolkit");
2767
2521
  var import_axios2 = require("axios");
2768
2522
  var import_pluralize = __toESM(require("pluralize"), 1);
2769
2523
  var import_uuid = require("uuid");
2770
2524
  var import_jsx_runtime2 = require("react/jsx-runtime");
2771
2525
  var { cleanUpUpload, initUpload, setSnackbar: setSnackbar2, uploadProgress: uploadProgress2 } = actions_default;
2772
- var { page: defaultPage, perPage: defaultPerPage } = DEVICE_LIST_DEFAULTS;
2526
+ var { page: defaultPage, perPage: defaultPerPage } = import_constants5.DEVICE_LIST_DEFAULTS;
2773
2527
  var defaultAttributes = [
2774
2528
  { scope: "identity", attribute: "status" },
2775
2529
  { scope: "inventory", attribute: "artifact_name" },
@@ -2784,9 +2538,9 @@ var defaultAttributes = [
2784
2538
  { scope: "system", attribute: "group" },
2785
2539
  { scope: "tags", attribute: "name" }
2786
2540
  ];
2787
- var getGroups2 = (0, import_toolkit18.createAsyncThunk)(
2541
+ var getGroups2 = createAppAsyncThunk(
2788
2542
  `${sliceName3}/getGroups`,
2789
- (_, { dispatch, getState }) => general_api_default.get(`${inventoryApiUrl}/groups`).then((res) => {
2543
+ (_, { dispatch, getState }) => general_api_default.get(`${import_constants5.inventoryApiUrl}/groups`).then((res) => {
2790
2544
  const state = getGroupsById(getState());
2791
2545
  const dynamicGroups = Object.entries(state).reduce((accu, [id, group]) => {
2792
2546
  if (group.id || group.filters?.length && id !== UNGROUPED_GROUP.id) {
@@ -2798,10 +2552,10 @@ var getGroups2 = (0, import_toolkit18.createAsyncThunk)(
2798
2552
  accu[group] = { deviceIds: [], filters: [], total: 0, ...state[group] };
2799
2553
  return accu;
2800
2554
  }, dynamicGroups);
2801
- 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" }];
2802
2556
  return Promise.all([
2803
2557
  dispatch(actions3.receivedGroups(groups)),
2804
- 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 }))
2805
2559
  ]).then((promises) => {
2806
2560
  const devicesRetrieval = promises[promises.length - 1] || [];
2807
2561
  const { payload } = devicesRetrieval || {};
@@ -2813,46 +2567,49 @@ var getGroups2 = (0, import_toolkit18.createAsyncThunk)(
2813
2567
  dispatch(
2814
2568
  actions3.addGroup({
2815
2569
  groupName: UNGROUPED_GROUP.id,
2816
- 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" }] }
2817
2571
  })
2818
2572
  )
2819
2573
  );
2820
2574
  });
2821
2575
  })
2822
2576
  );
2823
- var addDevicesToGroup = (0, import_toolkit18.createAsyncThunk)(
2577
+ var addDevicesToGroup = createAppAsyncThunk(
2824
2578
  `${sliceName3}/addDevicesToGroup`,
2825
- ({ 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())) : {})
2826
2580
  );
2827
- var removeDevicesFromGroup = (0, import_toolkit18.createAsyncThunk)(
2581
+ var removeDevicesFromGroup = createAppAsyncThunk(
2828
2582
  `${sliceName3}/removeDevicesFromGroup`,
2829
- ({ 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(
2830
2584
  () => Promise.all([
2831
2585
  dispatch(actions3.removeFromGroup({ group, deviceIds })),
2832
- 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
+ )
2833
2592
  ])
2834
2593
  )
2835
2594
  );
2836
2595
  var getGroupNotification = (newGroup, selectedGroup) => {
2837
2596
  const successMessage = "The group was updated successfully";
2838
2597
  if (newGroup === selectedGroup) {
2839
- return [successMessage, TIMEOUTS.fiveSeconds];
2598
+ return { message: successMessage, autoHideDuration: TIMEOUTS.fiveSeconds };
2840
2599
  }
2841
- return [
2842
- /* @__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: [
2843
2604
  successMessage,
2844
2605
  " - ",
2845
2606
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_router_dom.Link, { to: `/devices?inventory=group:eq:${newGroup}`, children: "click here" }),
2846
2607
  " to see it."
2847
2608
  ] }),
2848
- 5e3,
2849
- void 0,
2850
- void 0,
2851
- () => {
2852
- }
2853
- ];
2609
+ preventClickToCopy: true
2610
+ };
2854
2611
  };
2855
- var addStaticGroup = (0, import_toolkit18.createAsyncThunk)(
2612
+ var addStaticGroup = createAppAsyncThunk(
2856
2613
  `${sliceName3}/addStaticGroup`,
2857
2614
  ({ group, devices }, { dispatch, getState }) => Promise.resolve(dispatch(addDevicesToGroup({ group, deviceIds: devices.map(({ id }) => id), isCreation: true }))).then(
2858
2615
  () => Promise.resolve(
@@ -2866,24 +2623,24 @@ var addStaticGroup = (0, import_toolkit18.createAsyncThunk)(
2866
2623
  () => Promise.all([
2867
2624
  dispatch(setDeviceListState({ setOnly: true })),
2868
2625
  dispatch(getGroups2()),
2869
- dispatch(setSnackbar2(...getGroupNotification(group, getState().devices.groups.selectedGroup)))
2626
+ dispatch(setSnackbar2(getGroupNotification(group, getState().devices.groups.selectedGroup)))
2870
2627
  ])
2871
2628
  )
2872
2629
  ).catch((err) => commonErrorHandler(err, `Group could not be updated:`, dispatch))
2873
2630
  );
2874
- var removeStaticGroup = (0, import_toolkit18.createAsyncThunk)(
2631
+ var removeStaticGroup = createAppAsyncThunk(
2875
2632
  `${sliceName3}/removeStaticGroup`,
2876
- (groupName, { dispatch }) => general_api_default.delete(`${inventoryApiUrl}/groups/${groupName}`).then(
2633
+ (groupName, { dispatch }) => general_api_default.delete(`${import_constants5.inventoryApiUrl}/groups/${groupName}`).then(
2877
2634
  () => Promise.all([
2878
2635
  dispatch(actions3.removeGroup(groupName)),
2879
2636
  dispatch(getGroups2()),
2880
- dispatch(setSnackbar2("Group was removed successfully", TIMEOUTS.fiveSeconds))
2637
+ dispatch(setSnackbar2({ message: "Group was removed successfully", autoHideDuration: TIMEOUTS.fiveSeconds }))
2881
2638
  ])
2882
2639
  )
2883
2640
  );
2884
- var getDynamicGroups = (0, import_toolkit18.createAsyncThunk)(
2641
+ var getDynamicGroups = createAppAsyncThunk(
2885
2642
  `${sliceName3}/getDynamicGroups`,
2886
- (_, { 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 }) => {
2887
2644
  const state = getGroupsById(getState());
2888
2645
  const staticGroups = Object.entries(state).reduce((accu, [id, group]) => {
2889
2646
  if (!(group.id || group.filters?.length)) {
@@ -2904,15 +2661,15 @@ var getDynamicGroups = (0, import_toolkit18.createAsyncThunk)(
2904
2661
  return Promise.resolve(dispatch(actions3.receivedGroups(groups)));
2905
2662
  }).catch(() => console.log("Dynamic group retrieval failed - likely accessing a non-enterprise backend"))
2906
2663
  );
2907
- var addDynamicGroup = (0, import_toolkit18.createAsyncThunk)(
2664
+ var addDynamicGroup = createAppAsyncThunk(
2908
2665
  `${sliceName3}/addDynamicGroup`,
2909
- ({ 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(
2910
2667
  (res) => Promise.resolve(
2911
2668
  dispatch(
2912
2669
  actions3.addGroup({
2913
2670
  groupName,
2914
2671
  group: {
2915
- 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),
2916
2673
  filters: filterPredicates
2917
2674
  }
2918
2675
  })
@@ -2921,45 +2678,56 @@ var addDynamicGroup = (0, import_toolkit18.createAsyncThunk)(
2921
2678
  const { cleanedFilters } = getGroupFilters(groupName, getState().devices.groups);
2922
2679
  return Promise.all([
2923
2680
  dispatch(actions3.setDeviceFilters(cleanedFilters)),
2924
- dispatch(setSnackbar2(...getGroupNotification(groupName, getState().devices.groups.selectedGroup))),
2681
+ dispatch(setSnackbar2(getGroupNotification(groupName, getState().devices.groups.selectedGroup))),
2925
2682
  dispatch(getDynamicGroups())
2926
2683
  ]);
2927
2684
  })
2928
2685
  ).catch((err) => commonErrorHandler(err, `Group could not be updated:`, dispatch))
2929
2686
  );
2930
- var updateDynamicGroup = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/updateDynamicGroup`, ({ groupName, filterPredicates }, { dispatch, getState }) => {
2931
- const filterId = getState().devices.groups.byId[groupName].id;
2932
- return general_api_default.delete(`${inventoryApiUrlV2}/filters/${filterId}`).then(() => Promise.resolve(dispatch(addDynamicGroup({ groupName, filterPredicates }))));
2933
- });
2934
- 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 }) => {
2935
2697
  const filterId = getState().devices.groups.byId[groupName].id;
2936
- return general_api_default.delete(`${inventoryApiUrlV2}/filters/${filterId}`).then(
2937
- () => 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
+ ])
2938
2703
  );
2939
2704
  });
2940
2705
  var getGroupFilters = (group, groupsState, filters = []) => {
2941
2706
  const groupName = group === UNGROUPED_GROUP.id || group === UNGROUPED_GROUP.name ? UNGROUPED_GROUP.id : group;
2942
2707
  const selectedGroup = groupsState.byId[groupName];
2943
2708
  const groupFilterLength = selectedGroup?.filters?.length || 0;
2944
- const cleanedFilters = groupFilterLength ? [...filters, ...selectedGroup.filters].filter(filtersFilter) : filters;
2709
+ const cleanedFilters = groupFilterLength ? [...filters, ...selectedGroup.filters || []].filter(filtersFilter) : filters;
2945
2710
  return { cleanedFilters, groupName, selectedGroup, groupFilterLength };
2946
2711
  };
2947
- var selectGroup = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/selectGroup`, ({ group, filters = [] }, { dispatch, getState }) => {
2948
- const { cleanedFilters, groupName, selectedGroup, groupFilterLength } = getGroupFilters(group, getState().devices.groups, filters);
2949
- if (getSelectedGroup(getState()) === groupName && (filters.length === 0 && !groupFilterLength || filters.length === cleanedFilters.length)) {
2950
- return Promise.resolve();
2951
- }
2952
- let tasks = [];
2953
- if (groupFilterLength) {
2954
- tasks.push(dispatch(actions3.setDeviceFilters(cleanedFilters)));
2955
- } else {
2956
- tasks.push(dispatch(actions3.setDeviceFilters(filters)));
2957
- 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);
2958
2729
  }
2959
- const selectedGroupName = selectedGroup || !Object.keys(getGroupsById(getState())).length ? groupName : void 0;
2960
- tasks.push(dispatch(actions3.selectGroup(selectedGroupName)));
2961
- return Promise.all(tasks);
2962
- });
2730
+ );
2963
2731
  var getEarliestTs = (dateA = "", dateB = "") => !dateA || !dateB ? dateA || dateB : dateA < dateB ? dateA : dateB;
2964
2732
  var reduceReceivedDevices = (devices, ids, state, status) => devices.reduce(
2965
2733
  (accu, device) => {
@@ -2990,11 +2758,16 @@ var reduceReceivedDevices = (devices, ids, state, status) => devices.reduce(
2990
2758
  },
2991
2759
  { ids, devicesById: {} }
2992
2760
  );
2993
- var getGroupDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getGroupDevices`, (options, { dispatch, getState }) => {
2761
+ var getGroupDevices = createAppAsyncThunk(`${sliceName3}/getGroupDevices`, (options, { dispatch, getState }) => {
2994
2762
  const { group, shouldIncludeAllStates, ...remainder } = options;
2995
2763
  const { cleanedFilters: filterSelection } = getGroupFilters(group, getState().devices.groups);
2996
- return Promise.resolve(
2997
- 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
+ })
2998
2771
  ).unwrap().then((results) => {
2999
2772
  if (!group) {
3000
2773
  return Promise.resolve();
@@ -3008,7 +2781,7 @@ var getGroupDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getG
3008
2781
  dispatch(
3009
2782
  actions3.addGroup({
3010
2783
  group: {
3011
- 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,
3012
2785
  total
3013
2786
  },
3014
2787
  groupName: group
@@ -3017,63 +2790,71 @@ var getGroupDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getG
3017
2790
  );
3018
2791
  });
3019
2792
  });
3020
- var getAllGroupDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getAllGroupDevices`, (group, { dispatch, getState }) => {
3021
- if (!group || !!group && (!getGroupsById(getState())[group] || getGroupsById(getState())[group].filters.length)) {
3022
- return Promise.resolve();
3023
- }
3024
- const { attributes, filterTerms } = prepareSearchArguments({
3025
- filters: [],
3026
- group,
3027
- state: getState(),
3028
- status: DEVICE_STATES.accepted
3029
- });
3030
- const getAllDevices = (perPage = MAX_PAGE_SIZE, page = defaultPage, devices = []) => general_api_default.post(getSearchEndpoint(getState()), {
3031
- page,
3032
- per_page: perPage,
3033
- filters: filterTerms,
3034
- attributes
3035
- }).then((res) => {
3036
- const state = getState();
3037
- const deviceAccu = reduceReceivedDevices(res.data, devices, state);
3038
- dispatch(actions3.receivedDevices(deviceAccu.devicesById));
3039
- const total = Number(res.headers[headerNames.total]);
3040
- if (total > perPage * page) {
3041
- 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();
3042
2798
  }
3043
- return Promise.resolve(dispatch(actions3.addGroup({ group: { deviceIds: deviceAccu.ids, total: deviceAccu.ids.length }, groupName: group })));
3044
- });
3045
- return getAllDevices();
3046
- });
3047
- var getAllDynamicGroupDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getAllDynamicGroupDevices`, (group, { dispatch, getState }) => {
3048
- if (!!group && (!getGroupsById(getState())[group] || !getGroupsById(getState())[group].filters.length)) {
3049
- 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();
3050
2821
  }
3051
- const { attributes, filterTerms: filters } = prepareSearchArguments({
3052
- filters: getState().devices.groups.byId[group].filters,
3053
- state: getState(),
3054
- status: DEVICE_STATES.accepted
3055
- });
3056
- const getAllDevices = (perPage = MAX_PAGE_SIZE, page = defaultPage, devices = []) => general_api_default.post(getSearchEndpoint(getState()), { page, per_page: perPage, filters, attributes }).then((res) => {
3057
- const state = getState();
3058
- const deviceAccu = reduceReceivedDevices(res.data, devices, state);
3059
- dispatch(actions3.receivedDevices(deviceAccu.devicesById));
3060
- const total = Number(res.headers[headerNames.total]);
3061
- if (total > deviceAccu.ids.length) {
3062
- 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();
3063
2828
  }
3064
- return Promise.resolve(dispatch(actions3.addGroup({ group: { deviceIds: deviceAccu.ids, total }, groupName: group })));
3065
- });
3066
- return getAllDevices();
3067
- });
3068
- 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(
3069
2850
  `${sliceName3}/getDeviceById`,
3070
- (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) => {
3071
2852
  const device = reduceReceivedDevices([res.data], [], getState()).devicesById[id];
3072
2853
  device.etag = res.headers.etag;
3073
2854
  dispatch(actions3.receivedDevice(device));
3074
2855
  return Promise.resolve(device);
3075
2856
  }).catch((err) => {
3076
- const errMsg = (0, import_helpers8.extractErrorMessage)(err);
2857
+ const errMsg = extractErrorMessage(err);
3077
2858
  if (errMsg.includes("Not Found")) {
3078
2859
  console.log(`${id} does not have any inventory information`);
3079
2860
  const device = reduceReceivedDevices(
@@ -3083,7 +2864,8 @@ var getDeviceById2 = (0, import_toolkit18.createAsyncThunk)(
3083
2864
  attributes: [
3084
2865
  { name: "status", value: "decomissioned", scope: "identity" },
3085
2866
  { name: "decomissioned", value: "true", scope: "inventory" }
3086
- ]
2867
+ ],
2868
+ log: false
3087
2869
  }
3088
2870
  ],
3089
2871
  [],
@@ -3093,17 +2875,20 @@ var getDeviceById2 = (0, import_toolkit18.createAsyncThunk)(
3093
2875
  }
3094
2876
  })
3095
2877
  );
3096
- var getDeviceInfo = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getDeviceInfo`, (deviceId, { dispatch, getState }) => {
2878
+ var getDeviceInfo = createAppAsyncThunk(`${sliceName3}/getDeviceInfo`, (deviceId, { dispatch, getState }) => {
3097
2879
  const device = getDeviceById(getState(), deviceId);
3098
2880
  const { hasDeviceConfig, hasDeviceConnect, hasMonitor } = getTenantCapabilities(getState());
3099
2881
  const { canConfigure } = getUserCapabilities(getState());
3100
2882
  const integrations = getDeviceTwinIntegrations(getState());
3101
- let tasks = [dispatch(getDeviceAuth(deviceId)), ...integrations.map((integration) => dispatch(getDeviceTwin({ deviceId, integration })))];
3102
- 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)) {
3103
2889
  tasks.push(dispatch(getDeviceConfig(deviceId)));
3104
2890
  }
3105
- if (device.status === DEVICE_STATES.accepted) {
3106
- tasks.push(dispatch(getDeviceById2(deviceId)));
2891
+ if (device.status === import_constants5.DEVICE_STATES.accepted) {
3107
2892
  if (hasDeviceConnect) {
3108
2893
  tasks.push(dispatch(getDeviceConnect(deviceId)));
3109
2894
  }
@@ -3114,66 +2899,45 @@ var getDeviceInfo = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getDev
3114
2899
  }
3115
2900
  return Promise.all(tasks);
3116
2901
  });
3117
- var deriveInactiveDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/deriveInactiveDevices`, (deviceIds, { dispatch, getState }) => {
3118
- const yesterday = /* @__PURE__ */ new Date();
3119
- yesterday.setDate(yesterday.getDate() - 1);
3120
- const yesterdaysIsoString = yesterday.toISOString();
3121
- const devices = deviceIds.reduce(
3122
- (accu, id) => {
3123
- const device = getDeviceById(getState(), id);
3124
- if (device && device.updated_ts > yesterdaysIsoString) {
3125
- accu.active.push(id);
3126
- } else {
3127
- accu.inactive.push(id);
3128
- }
3129
- return accu;
3130
- },
3131
- { active: [], inactive: [] }
3132
- );
3133
- return dispatch(actions3.setInactiveDevices({ activeDeviceTotal: devices.active.length, inactiveDeviceTotal: devices.inactive.length }));
3134
- });
3135
- var getDeviceCount = (0, import_toolkit18.createAsyncThunk)(
2902
+ var getDeviceCount = createAppAsyncThunk(
3136
2903
  `${sliceName3}/getDeviceCount`,
3137
2904
  (status, { dispatch, getState }) => general_api_default.post(getSearchEndpoint(getState()), {
3138
2905
  page: 1,
3139
2906
  per_page: 1,
3140
- 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" }]),
3141
2908
  attributes: defaultAttributes
3142
2909
  }).then((response) => {
3143
- const count = Number(response.headers[headerNames.total]);
3144
- if (status) {
3145
- return dispatch(actions3.setDevicesCountByStatus({ count, status }));
3146
- }
3147
- return dispatch(actions3.setTotalDevices(count));
2910
+ const count = Number(response.headers[import_constants5.headerNames.total]);
2911
+ return dispatch(actions3.setDevicesCountByStatus({ count, status }));
3148
2912
  })
3149
2913
  );
3150
- var getAllDeviceCounts = (0, import_toolkit18.createAsyncThunk)(
2914
+ var getAllDeviceCounts = createAppAsyncThunk(
3151
2915
  `${sliceName3}/getAllDeviceCounts`,
3152
- (_, { 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))))
3153
2917
  );
3154
- var getDeviceLimit2 = (0, import_toolkit18.createAsyncThunk)(
2918
+ var getDeviceLimit2 = createAppAsyncThunk(
3155
2919
  `${sliceName3}/getDeviceLimit`,
3156
- (_, { 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)))
3157
2921
  );
3158
- var setDeviceListState = (0, import_toolkit18.createAsyncThunk)(
2922
+ var setDeviceListState = createAppAsyncThunk(
3159
2923
  `${sliceName3}/setDeviceListState`,
3160
2924
  ({ shouldSelectDevices = true, forceRefresh, fetchAuth = true, ...selectionState }, { dispatch, getState }) => {
3161
2925
  const currentState = getDeviceListState(getState());
3162
2926
  const refreshTrigger = forceRefresh ? !currentState.refreshTrigger : selectionState.refreshTrigger;
3163
- let nextState = {
2927
+ const nextState = {
3164
2928
  ...currentState,
3165
2929
  setOnly: false,
3166
2930
  refreshTrigger,
3167
2931
  ...selectionState,
3168
2932
  sort: { ...currentState.sort, ...selectionState.sort }
3169
2933
  };
3170
- let tasks = [];
2934
+ const tasks = [];
3171
2935
  const { isLoading: currentLoading, deviceIds: currentDevices, selection: currentSelection, ...currentRequestState } = currentState;
3172
2936
  const { isLoading: nextLoading, deviceIds: nextDevices, selection: nextSelection, ...nextRequestState } = nextState;
3173
2937
  if (!nextState.setOnly && !(0, import_helpers8.deepCompare)(currentRequestState, nextRequestState)) {
3174
- 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 ?? {};
3175
2939
  const sortBy = sortCol ? [{ attribute: sortCol, order: sortDown, scope: sortScope }] : void 0;
3176
- 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;
3177
2941
  nextState.isLoading = true;
3178
2942
  tasks.push(
3179
2943
  dispatch(getDevicesByStatus2({ ...nextState, status: applicableSelectedState, sortOptions: sortBy, fetchAuth })).unwrap().then((results) => {
@@ -3187,83 +2951,84 @@ var setDeviceListState = (0, import_toolkit18.createAsyncThunk)(
3187
2951
  return Promise.all(tasks);
3188
2952
  }
3189
2953
  );
3190
- var getDevicesByStatus2 = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getDevicesByStatus`, (options, { dispatch, getState }) => {
3191
- const {
3192
- status,
3193
- fetchAuth = true,
3194
- filterSelection,
3195
- group,
3196
- selectedIssues = [],
3197
- page = defaultPage,
3198
- perPage = defaultPerPage,
3199
- sortOptions = [],
3200
- selectedAttributes = getSelectedDeviceAttribute(getState())
3201
- } = options;
3202
- const state = getState();
3203
- const { applicableFilters, filterTerms } = convertDeviceListStateToFilters({
3204
- filters: filterSelection ?? getDeviceFilters(state),
3205
- group: group ?? getSelectedGroup(state),
3206
- groups: state.devices.groups,
3207
- offlineThreshold: state.app.offlineThreshold,
3208
- selectedIssues,
3209
- status
3210
- });
3211
- const attributes = [...defaultAttributes, getIdAttribute(getState()), ...selectedAttributes];
3212
- return general_api_default.post(getSearchEndpoint(getState()), {
3213
- page,
3214
- per_page: perPage,
3215
- filters: filterTerms,
3216
- sort: sortOptions,
3217
- attributes
3218
- }).then((response) => {
3219
- const state2 = getState();
3220
- const deviceAccu = reduceReceivedDevices(response.data, [], state2, status);
3221
- let total = !applicableFilters.length ? Number(response.headers[headerNames.total]) : null;
3222
- if (status && state2.devices.byStatus[status].total === deviceAccu.ids.length) {
3223
- total = deviceAccu.ids.length;
3224
- }
3225
- let tasks = [dispatch(actions3.receivedDevices(deviceAccu.devicesById))];
3226
- if (status) {
3227
- tasks.push(dispatch(actions3.setDevicesByStatus({ deviceIds: deviceAccu.ids, status, total })));
3228
- }
3229
- const receivedDevices = Object.values(deviceAccu.devicesById);
3230
- if (receivedDevices.length && fetchAuth) {
3231
- tasks.push(dispatch(getDevicesWithAuth(receivedDevices)));
3232
- }
3233
- tasks.push(Promise.resolve({ deviceAccu, total: Number(response.headers[headerNames.total]) }));
3234
- return Promise.all(tasks);
3235
- }).catch((err) => commonErrorHandler(err, `${status} devices couldn't be loaded.`, dispatch, commonErrorFallback));
3236
- });
3237
- var getAllDevicesByStatus = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getAllDevicesByStatus`, (status, { dispatch, getState }) => {
3238
- const attributes = [...defaultAttributes, getIdAttribute(getState())];
3239
- const getAllDevices = (perPage = MAX_PAGE_SIZE, page = 1, devices = []) => general_api_default.post(getSearchEndpoint(getState()), {
3240
- page,
3241
- per_page: perPage,
3242
- filters: mapFiltersToTerms([{ key: "status", value: status, operator: DEVICE_FILTERING_OPTIONS.$eq.key, scope: "identity" }]),
3243
- attributes
3244
- }).then((res) => {
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;
3245
2968
  const state = getState();
3246
- const deviceAccu = reduceReceivedDevices(res.data, devices, state, status);
3247
- dispatch(actions3.receivedDevices(deviceAccu.devicesById));
3248
- const total = Number(res.headers[headerNames.total]);
3249
- 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
+ }
3250
3024
  return Promise.resolve();
3251
- }
3252
- if (total > perPage * page) {
3253
- return getAllDevices(perPage, page + 1, deviceAccu.ids);
3254
- }
3255
- let tasks = [dispatch(actions3.setDevicesByStatus({ deviceIds: deviceAccu.ids, forceUpdate: true, status, total: deviceAccu.ids.length }))];
3256
- if (status === DEVICE_STATES.accepted && deviceAccu.ids.length === total) {
3257
- tasks.push(dispatch(deriveInactiveDevices(deviceAccu.ids)));
3258
- tasks.push(dispatch(deriveReportsData()));
3259
- }
3260
- return Promise.all(tasks);
3261
- });
3262
- return getAllDevices();
3263
- });
3264
- 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 }) => {
3265
3030
  const state = getState();
3266
- let options = { ...state.app.searchState, ...passedOptions };
3031
+ const options = { ...state.app.searchState, ...passedOptions };
3267
3032
  const { page = defaultPage, searchTerm, sortOptions = [] } = options;
3268
3033
  const { columnSelection = [] } = getUserSettings(state);
3269
3034
  const selectedAttributes = columnSelection.map((column) => ({ attribute: column.key, scope: column.scope }));
@@ -3279,7 +3044,7 @@ var searchDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/search
3279
3044
  const deviceAccu = reduceReceivedDevices(response.data, [], getState());
3280
3045
  return Promise.all([
3281
3046
  dispatch(actions3.receivedDevices(deviceAccu.devicesById)),
3282
- 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]) })
3283
3048
  ]);
3284
3049
  }).catch((err) => commonErrorHandler(err, `devices couldn't be searched.`, dispatch, commonErrorFallback));
3285
3050
  });
@@ -3294,64 +3059,25 @@ var attributeReducer = (attributes = []) => attributes.slice(0, ATTRIBUTE_LIST_C
3294
3059
  },
3295
3060
  { identity: [], inventory: [], system: [], tags: [] }
3296
3061
  );
3297
- var getDeviceAttributes = (0, import_toolkit18.createAsyncThunk)(
3062
+ var getDeviceAttributes = createAppAsyncThunk(
3298
3063
  `${sliceName3}/getDeviceAttributes`,
3299
3064
  (_, { dispatch, getState }) => general_api_default.get(getAttrsEndpoint(getState())).then(({ data }) => {
3300
3065
  const { identity: identityAttributes, inventory: inventoryAttributes, system: systemAttributes, tags: tagAttributes } = attributeReducer(data || []);
3301
3066
  return dispatch(actions3.setFilterAttributes({ identityAttributes, inventoryAttributes, systemAttributes, tagAttributes }));
3302
3067
  })
3303
3068
  );
3304
- var getReportingLimits = (0, import_toolkit18.createAsyncThunk)(
3305
- `${sliceName3}/getReportingLimits`,
3306
- (_, { dispatch }) => general_api_default.get(`${reportingApiUrl}/devices/attributes`).catch((err) => commonErrorHandler(err, `filterable attributes limit & usage could not be retrieved.`, dispatch, commonErrorFallback)).then(({ data }) => {
3307
- const { attributes, count, limit } = data;
3308
- const groupedAttributes = attributeReducer(attributes);
3309
- return Promise.resolve(dispatch(actions3.setFilterablesConfig({ count, limit, attributes: groupedAttributes })));
3310
- })
3311
- );
3312
- var ensureVersionString = (software, fallback) => software.length && software !== "artifact_name" ? software.endsWith(".version") ? software : `${software}.version` : fallback;
3313
- var getSingleReportData = (reportConfig, groups) => {
3314
- const { attribute, group, software = "" } = reportConfig;
3315
- const filters = [{ key: "status", scope: "identity", operator: DEVICE_FILTERING_OPTIONS.$eq.key, value: "accepted" }];
3316
- if (group) {
3317
- const staticGroupFilter = { key: "group", scope: "system", operator: DEVICE_FILTERING_OPTIONS.$eq.key, value: group };
3318
- const { cleanedFilters: groupFilters } = getGroupFilters(group, groups);
3319
- filters.push(...groupFilters.length ? groupFilters : [staticGroupFilter]);
3320
- }
3321
- const aggregationAttribute = ensureVersionString(software, attribute);
3322
- return general_api_default.post(`${reportingApiUrl}/devices/aggregate`, {
3323
- aggregations: [{ attribute: aggregationAttribute, name: "*", scope: "inventory", size: REPORT_CHART_SIZE_LIMIT }],
3324
- filters: mapFiltersToTerms(filters)
3325
- }).then(({ data }) => ({ data, reportConfig }));
3326
- };
3327
- var getReportsData = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getReportsData`, (_, { dispatch, getState }) => {
3328
- const state = getState();
3329
- const currentUserId = getCurrentUser(state).id;
3330
- const reports = getUserSettings(state).reports || getGlobalSettings(state)[`${currentUserId}-reports`] || (Object.keys(getDevicesById(state)).length ? defaultReports : []);
3331
- return Promise.all(reports.map((report) => getSingleReportData(report, getState().devices.groups))).then((results) => {
3332
- const devicesState = getState().devices;
3333
- const totalDeviceCount = devicesState.byStatus.accepted.total;
3334
- const newReports = results.map(({ data, reportConfig }) => {
3335
- let { items, other_count } = data[0];
3336
- const { attribute, group, software = "" } = reportConfig;
3337
- const dataCount = items.reduce((accu, item) => accu + item.count, 0);
3338
- const otherCount = !group && (software === rootfsImageVersion || attribute === "artifact_name") ? totalDeviceCount - dataCount : other_count;
3339
- return { items, otherCount, total: otherCount + dataCount };
3340
- });
3341
- return Promise.resolve(dispatch(actions3.setDeviceReports(newReports)));
3342
- });
3343
- });
3344
3069
  var initializeDistributionData = (report, groups, devices, totalDeviceCount) => {
3345
3070
  const { attribute, group = "", software = "" } = report;
3346
3071
  const effectiveAttribute = software ? software : attribute;
3347
3072
  const { deviceIds, total = 0 } = groups[group] || {};
3348
- const relevantDevices = groups[group] ? deviceIds.map((id) => devices[id]) : Object.values(devices);
3073
+ const relevantDevices = deviceIds ? deviceIds.map((id) => devices[id]) : Object.values(devices);
3349
3074
  const distributionByAttribute = relevantDevices.reduce((accu, item) => {
3350
- if (!item.attributes || item.status !== DEVICE_STATES.accepted) return accu;
3351
- if (!accu[item.attributes[effectiveAttribute]]) {
3352
- 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;
3353
3079
  }
3354
- accu[item.attributes[effectiveAttribute]] = accu[item.attributes[effectiveAttribute]] + 1;
3080
+ accu[attributeValue] = accu[attributeValue] + 1;
3355
3081
  return accu;
3356
3082
  }, {});
3357
3083
  const distributionByAttributeSorted = Object.entries(distributionByAttribute).sort((pairA, pairB) => pairB[1] - pairA[1]);
@@ -3360,90 +3086,111 @@ var initializeDistributionData = (report, groups, devices, totalDeviceCount) =>
3360
3086
  const otherCount = (groups[group] ? total : totalDeviceCount) - dataCount;
3361
3087
  return { items, otherCount, total: otherCount + dataCount };
3362
3088
  };
3363
- var deriveReportsData = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/deriveReportsData`, (_, { dispatch, getState }) => {
3364
- const state = getState();
3365
- const {
3366
- groups: { byId: groupsById },
3367
- byId,
3368
- byStatus: {
3369
- accepted: { total }
3370
- }
3371
- } = state.devices;
3372
- const reports = getUserSettings(state).reports || state.users.globalSettings[`${state.users.currentUser}-reports`] || (Object.keys(byId).length ? defaultReports : []);
3373
- 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);
3374
3100
  return Promise.resolve(dispatch(actions3.setDeviceReports(newReports)));
3375
3101
  });
3376
- var getReportsDataWithoutBackendSupport = (0, import_toolkit18.createAsyncThunk)(
3377
- `${sliceName3}/getReportsDataWithoutBackendSupport`,
3378
- (_, { dispatch, getState }) => Promise.all([dispatch(getAllDevicesByStatus(DEVICE_STATES.accepted)), dispatch(getGroups2()), dispatch(getDynamicGroups())]).then(() => {
3379
- const { dynamic: dynamicGroups, static: staticGroups } = getGroups(getState());
3380
- return Promise.all([
3381
- ...staticGroups.map(({ groupId }) => dispatch(getAllGroupDevices(groupId))),
3382
- ...dynamicGroups.map(({ groupId }) => dispatch(getAllDynamicGroupDevices(groupId)))
3383
- ]).then(() => dispatch(deriveReportsData()));
3384
- })
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
+ }
3385
3126
  );
3386
- var getDeviceConnect = (0, import_toolkit18.createAsyncThunk)(
3127
+ var getDeviceConnect = createAppAsyncThunk(
3387
3128
  `${sliceName3}/getDeviceConnect`,
3388
- (id, { dispatch }) => general_api_default.get(`${deviceConnect}/devices/${id}`).then(
3129
+ (id, { dispatch }) => general_api_default.get(`${import_constants5.deviceConnect}/devices/${id}`).then(
3389
3130
  ({ data }) => Promise.all([dispatch(actions3.receivedDevice({ connect_status: data.status, connect_updated_ts: data.updated_ts, id })), Promise.resolve(data)])
3390
3131
  )
3391
3132
  );
3392
3133
  var updateTypeMap = { deploymentUpdate: "check-update", inventoryUpdate: "send-inventory" };
3393
- var triggerDeviceUpdate = (0, import_toolkit18.createAsyncThunk)(
3134
+ var triggerDeviceUpdate = createAppAsyncThunk(
3394
3135
  `${sliceName3}/triggerDeviceUpdate`,
3395
- ({ 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(
3396
3137
  () => new Promise((resolve) => setTimeout(() => resolve(dispatch(getDeviceById2(id))), TIMEOUTS.threeSeconds))
3397
3138
  )
3398
3139
  );
3399
- var getSessionDetails = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getSessionDetails`, ({ sessionId, deviceId, userId, startDate, endDate }) => {
3400
- const { start: startUnix, end: endUnix } = (0, import_helpers8.dateRangeToUnix)(startDate, endDate);
3401
- const createdAfter = startDate ? `&created_after=${startUnix}` : "";
3402
- const createdBefore = endDate ? `&created_before=${endUnix}` : "";
3403
- const objectSearch = `&object_id=${deviceId}`;
3404
- return general_api_default.get(`${auditLogsApiUrl}/logs?per_page=500${createdAfter}${createdBefore}&actor_id=${userId}${objectSearch}`).then(
3405
- ({ data: auditLogEntries }) => {
3406
- const { start, end } = auditLogEntries.reduce(
3407
- (accu, item) => {
3408
- if (item.meta?.session_id?.includes(sessionId)) {
3409
- accu.start = new Date(item.action.startsWith("open") ? item.time : accu.start);
3410
- accu.end = new Date(item.action.startsWith("close") ? item.time : accu.end);
3411
- }
3412
- return accu;
3413
- },
3414
- { start: startDate || endDate, end: endDate || startDate }
3415
- );
3416
- return Promise.resolve({ start, end });
3417
- }
3418
- );
3419
- });
3420
- 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(
3421
3165
  `${sliceName3}/getDeviceFileDownloadLink`,
3422
- ({ 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)}`)
3423
3167
  );
3424
- var deviceFileUpload = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/deviceFileUpload`, ({ deviceId, path, file }, { dispatch }) => {
3425
- let formData = new FormData();
3426
- formData.append("path", path);
3427
- formData.append("file", file);
3428
- const uploadId = (0, import_uuid.v4)();
3429
- const cancelSource = new AbortController();
3430
- return Promise.all([
3431
- dispatch(setSnackbar2("Uploading file")),
3432
- dispatch(initUpload({ id: uploadId, upload: { inprogress: true, uploadProgress: 0, cancelSource } })),
3433
- general_api_default.uploadPut(
3434
- `${deviceConnect}/devices/${deviceId}/upload`,
3435
- formData,
3436
- (e) => dispatch(uploadProgress2({ id: uploadId, progress: progress(e) })),
3437
- cancelSource.signal
3438
- )
3439
- ]).then(() => Promise.resolve(dispatch(setSnackbar2("Upload successful", TIMEOUTS.fiveSeconds)))).catch((err) => {
3440
- if ((0, import_axios2.isCancel)(err)) {
3441
- return dispatch(setSnackbar2("The upload has been cancelled", TIMEOUTS.fiveSeconds));
3442
- }
3443
- return commonErrorHandler(err, `Error uploading file to device.`, dispatch);
3444
- }).finally(() => dispatch(cleanUpUpload(uploadId)));
3445
- });
3446
- 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(
3447
3194
  `${sliceName3}/getDeviceAuth`,
3448
3195
  (id, { dispatch }) => dispatch(getDevicesWithAuth([{ id }])).unwrap().then((results) => {
3449
3196
  if (results[results.length - 1]) {
@@ -3452,81 +3199,86 @@ var getDeviceAuth = (0, import_toolkit18.createAsyncThunk)(
3452
3199
  return Promise.resolve();
3453
3200
  })
3454
3201
  );
3455
- var getDevicesWithAuth = (0, import_toolkit18.createAsyncThunk)(
3202
+ var getDevicesWithAuth = createAppAsyncThunk(
3456
3203
  `${sliceName3}/getDevicesWithAuth`,
3457
- (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 }) => {
3458
3205
  const { devicesById } = reduceReceivedDevices(receivedDevices, [], getState());
3459
3206
  return Promise.all([dispatch(actions3.receivedDevices(devicesById)), Promise.resolve(receivedDevices)]);
3460
3207
  }).catch((err) => commonErrorHandler(err, `Error: ${err}`, dispatch)) : Promise.resolve([[], []])
3461
3208
  );
3462
- var updateDeviceAuth = (0, import_toolkit18.createAsyncThunk)(
3209
+ var updateDeviceAuth = createAppAsyncThunk(
3463
3210
  `${sliceName3}/updateDeviceAuth`,
3464
- ({ 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 })))
3465
3212
  );
3466
- var updateDevicesAuth = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/updateDevicesAuth`, ({ deviceIds, status }, { dispatch, getState }) => {
3467
- let devices = getDevicesById(getState());
3468
- const deviceIdsWithoutAuth = deviceIds.reduce((accu, id) => devices[id].auth_sets ? accu : [...accu, { id }], []);
3469
- return dispatch(getDevicesWithAuth(deviceIdsWithoutAuth)).then(() => {
3470
- devices = getDevicesById(getState());
3471
- const deviceAuthUpdates = deviceIds.map((id) => {
3472
- const device = devices[id];
3473
- if (device.auth_sets.length !== 1) {
3474
- return Promise.reject();
3475
- }
3476
- 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));
3477
- });
3478
- return Promise.allSettled(deviceAuthUpdates).then((results) => {
3479
- const { skipped, count } = results.reduce(
3480
- (accu, item) => {
3481
- if (item.status === "rejected") {
3482
- accu.skipped = accu.skipped + 1;
3483
- } else {
3484
- accu.count = accu.count + 1;
3485
- }
3486
- return accu;
3487
- },
3488
- { skipped: 0, count: 0 }
3489
- );
3490
- const message = (0, import_helpers8.getSnackbarMessage)(skipped, count);
3491
- 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
+ });
3492
3242
  });
3493
- });
3494
- });
3495
- var deleteAuthset = (0, import_toolkit18.createAsyncThunk)(
3243
+ }
3244
+ );
3245
+ var deleteAuthset = createAppAsyncThunk(
3496
3246
  `${sliceName3}/deleteAuthset`,
3497
- ({ 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 })))
3498
3248
  );
3499
- var preauthDevice = (0, import_toolkit18.createAsyncThunk)(
3249
+ var preauthDevice = createAppAsyncThunk(
3500
3250
  `${sliceName3}/preauthDevice`,
3501
- (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) => {
3502
3254
  if (err.response.status === 409) {
3503
3255
  return rejectWithValue("A device with a matching identity data set already exists");
3504
3256
  }
3505
3257
  return commonErrorHandler(err, "The device could not be added:", dispatch);
3506
3258
  })
3507
3259
  );
3508
- var decommissionDevice = (0, import_toolkit18.createAsyncThunk)(
3260
+ var decommissionDevice = createAppAsyncThunk(
3509
3261
  `${sliceName3}/decommissionDevice`,
3510
- ({ 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 })))
3511
3263
  );
3512
- var getDeviceConfig = (0, import_toolkit18.createAsyncThunk)(
3264
+ var getDeviceConfig = createAppAsyncThunk(
3513
3265
  `${sliceName3}/getDeviceConfig`,
3514
- (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) => {
3515
3267
  if (err.response?.data?.error.status_code !== 404) {
3516
3268
  return commonErrorHandler(err, `There was an error retrieving the configuration for device ${deviceId}.`, dispatch, commonErrorFallback);
3517
3269
  }
3518
3270
  })
3519
3271
  );
3520
- var setDeviceConfig = (0, import_toolkit18.createAsyncThunk)(
3272
+ var setDeviceConfig = createAppAsyncThunk(
3521
3273
  `${sliceName3}/setDeviceConfig`,
3522
- ({ 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))))
3523
3275
  );
3524
- var applyDeviceConfig = (0, import_toolkit18.createAsyncThunk)(
3276
+ var applyDeviceConfig = createAppAsyncThunk(
3525
3277
  `${sliceName3}/applyDeviceConfig`,
3526
- ({ 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 }) => {
3527
3279
  const device = getDeviceById(getState(), deviceId);
3528
3280
  const { canManageUsers } = getUserCapabilities(getState());
3529
- let tasks = [
3281
+ const tasks = [
3530
3282
  dispatch(actions3.receivedDevice({ ...device, config: { ...device.config, deployment_id: data.deployment_id } })),
3531
3283
  new Promise((resolve) => setTimeout(() => resolve(dispatch(getSingleDeployment(data.deployment_id))), TIMEOUTS.oneSecond))
3532
3284
  ];
@@ -3537,23 +3289,26 @@ var applyDeviceConfig = (0, import_toolkit18.createAsyncThunk)(
3537
3289
  return Promise.all(tasks);
3538
3290
  })
3539
3291
  );
3540
- var setDeviceTags = (0, import_toolkit18.createAsyncThunk)(
3292
+ var setDeviceTags = createAppAsyncThunk(
3541
3293
  `${sliceName3}/setDeviceTags`,
3542
3294
  ({ deviceId, tags }, { dispatch }) => (
3543
3295
  // to prevent tag set failures, retrieve the device & use the freshest etag we can get
3544
- Promise.resolve(dispatch(getDeviceById2(deviceId))).then((device) => {
3296
+ dispatch(getDeviceById2(deviceId)).unwrap().then((device) => {
3545
3297
  const headers = device.etag ? { "If-Match": device.etag } : {};
3546
- return general_api_default.put(
3547
- `${inventoryApiUrl}/devices/${deviceId}/tags`,
3548
- Object.entries(tags).map(([name, value]) => ({ name, value })),
3549
- { headers }
3550
- ).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
+ );
3551
3306
  })
3552
3307
  )
3553
3308
  );
3554
- var getDeviceTwin = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getDeviceTwin`, ({ deviceId, integration }, { dispatch, getState }) => {
3309
+ var getDeviceTwin = createAppAsyncThunk(`${sliceName3}/getDeviceTwin`, ({ deviceId, integration }, { dispatch, getState }) => {
3555
3310
  let providerResult = {};
3556
- 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 }) => {
3557
3312
  providerResult = { ...data, twinError: "" };
3558
3313
  }).catch((err) => {
3559
3314
  providerResult = {
@@ -3564,9 +3319,9 @@ var getDeviceTwin = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getDev
3564
3319
  Promise.resolve(dispatch(actions3.receivedDevice({ ...device, twinsByIntegration: { ...device.twinsByIntegration, ...providerResult } })));
3565
3320
  });
3566
3321
  });
3567
- var setDeviceTwin = (0, import_toolkit18.createAsyncThunk)(
3322
+ var setDeviceTwin = createAppAsyncThunk(
3568
3323
  `${sliceName3}/setDeviceTwin`,
3569
- ({ 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(
3570
3325
  (err) => commonErrorHandler(
3571
3326
  err,
3572
3327
  `There was an error updating the ${EXTERNAL_PROVIDER[integration.provider].twinTitle.toLowerCase()} for device ${deviceId}.`,
@@ -3577,7 +3332,9 @@ var setDeviceTwin = (0, import_toolkit18.createAsyncThunk)(
3577
3332
  const { twinsByIntegration = {} } = device;
3578
3333
  const { [integration.id]: currentState = {} } = twinsByIntegration;
3579
3334
  return Promise.resolve(
3580
- 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
+ )
3581
3338
  );
3582
3339
  })
3583
3340
  );
@@ -3588,7 +3345,7 @@ var prepareSearchArguments = ({ filters, group, state, status }) => {
3588
3345
  const attributes = [...defaultAttributes, getIdAttribute(state), ...selectedAttributes];
3589
3346
  return { attributes, filterTerms };
3590
3347
  };
3591
- var getSystemDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getSystemDevices`, (options, { dispatch, getState }) => {
3348
+ var getSystemDevices = createAppAsyncThunk(`${sliceName3}/getSystemDevices`, (options, { dispatch, getState }) => {
3592
3349
  const { id, page = defaultPage, perPage = defaultPerPage, sortOptions = [] } = options;
3593
3350
  const state = getState();
3594
3351
  const { hasFullFiltering } = getTenantCapabilities(state);
@@ -3598,7 +3355,7 @@ var getSystemDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/get
3598
3355
  const { attributes: deviceAttributes = {} } = getDeviceById(state, id);
3599
3356
  const { mender_gateway_system_id = "" } = deviceAttributes;
3600
3357
  const filters = [
3601
- { ...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" },
3602
3359
  { ...emptyFilter, key: "mender_gateway_system_id", value: mender_gateway_system_id, scope: "inventory" }
3603
3360
  ];
3604
3361
  const { attributes, filterTerms } = prepareSearchArguments({ filters, state });
@@ -3614,17 +3371,17 @@ var getSystemDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/get
3614
3371
  const device = {
3615
3372
  ...getDeviceById(state2, id),
3616
3373
  systemDeviceIds: ids,
3617
- systemDeviceTotal: Number(headers[headerNames.total])
3374
+ systemDeviceTotal: Number(headers[import_constants5.headerNames.total])
3618
3375
  };
3619
3376
  return Promise.resolve(dispatch(actions3.receivedDevices({ ...devicesById, [id]: device })));
3620
3377
  });
3621
3378
  });
3622
- var getGatewayDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getGatewayDevices`, (deviceId, { dispatch, getState }) => {
3379
+ var getGatewayDevices = createAppAsyncThunk(`${sliceName3}/getGatewayDevices`, (deviceId, { dispatch, getState }) => {
3623
3380
  const state = getState();
3624
3381
  const { attributes = {} } = getDeviceById(state, deviceId);
3625
3382
  const { mender_gateway_system_id = "" } = attributes;
3626
3383
  const filters = [
3627
- { ...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" },
3628
3385
  { ...emptyFilter, key: "mender_is_gateway", value: "true", scope: "inventory" },
3629
3386
  { ...emptyFilter, key: "mender_gateway_system_id", value: mender_gateway_system_id, scope: "inventory" }
3630
3387
  ];
@@ -3636,100 +3393,87 @@ var getGatewayDevices = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/ge
3636
3393
  attributes: attributeSelection
3637
3394
  }).then(({ data }) => {
3638
3395
  const { ids } = reduceReceivedDevices(data, [], getState());
3639
- let tasks = ids.map((deviceId2) => dispatch(getDeviceInfo(deviceId2)));
3396
+ const tasks = ids.map((deviceId2) => dispatch(getDeviceInfo(deviceId2)));
3640
3397
  tasks.push(dispatch(actions3.receivedDevice({ id: deviceId, gatewayIds: ids })));
3641
3398
  return Promise.all(tasks);
3642
3399
  });
3643
3400
  });
3644
- var getDevicesInBounds = (0, import_toolkit18.createAsyncThunk)(`${sliceName3}/getDevicesInBounds`, ({ bounds, group }, { dispatch, getState }) => {
3645
- const state = getState();
3646
- const { filterTerms } = convertDeviceListStateToFilters({
3647
- group: group === ALL_DEVICES ? void 0 : group,
3648
- groups: state.devices.groups,
3649
- status: DEVICE_STATES.accepted
3650
- });
3651
- return general_api_default.post(getSearchEndpoint(getState()), {
3652
- page: 1,
3653
- per_page: MAX_PAGE_SIZE,
3654
- filters: filterTerms,
3655
- attributes: geoAttributes,
3656
- geo_bounding_box_filter: {
3657
- geo_bounding_box: {
3658
- location: {
3659
- top_left: { lat: bounds._northEast.lat, lon: bounds._southWest.lng },
3660
- bottom_right: { lat: bounds._southWest.lat, lon: bounds._northEast.lng }
3661
- }
3662
- }
3663
- }
3664
- }).then(({ data }) => {
3665
- const { devicesById } = reduceReceivedDevices(data, [], getState());
3666
- return Promise.resolve(dispatch(actions3.receivedDevices(devicesById)));
3667
- });
3668
- });
3669
3401
 
3670
3402
  // src/monitorSlice/thunks.ts
3671
- var import_toolkit19 = require("@reduxjs/toolkit");
3672
- var { page: defaultPage2, perPage: defaultPerPage2 } = DEVICE_LIST_DEFAULTS;
3403
+ var { page: defaultPage2, perPage: defaultPerPage2 } = import_constants5.DEVICE_LIST_DEFAULTS;
3673
3404
  var cutoffLength = 75;
3674
3405
  var ellipsis = "...";
3675
3406
  var longTextTrimmer = (text) => text.length >= cutoffLength + ellipsis.length ? `${text.substring(0, cutoffLength + ellipsis.length)}${ellipsis}` : text;
3676
- var sanitizeDeviceAlerts = (alerts) => alerts.map((alert) => ({ ...alert, fullName: alert.name, name: longTextTrimmer(alert.name) }));
3677
- 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 }) => {
3678
3409
  const { page = defaultPage2, perPage = defaultPerPage2, issuedBefore, issuedAfter, sortAscending = false } = config;
3679
3410
  const issued_after = issuedAfter ? `&issued_after=${issuedAfter}` : "";
3680
3411
  const issued_before = issuedBefore ? `&issued_before=${issuedBefore}` : "";
3681
- 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(
3682
3415
  (res) => Promise.all([
3683
3416
  dispatch(actions4.receiveDeviceAlerts({ deviceId: id, alerts: sanitizeDeviceAlerts(res.data) })),
3684
- dispatch(actions4.setAlertListState({ total: Number(res.headers[headerNames.total]) }))
3417
+ dispatch(actions4.setAlertListState({ total: Number(res.headers[import_constants5.headerNames.total]) }))
3685
3418
  ])
3686
3419
  );
3687
3420
  });
3688
- var getLatestDeviceAlerts = (0, import_toolkit19.createAsyncThunk)(`${sliceName4}/getLatestDeviceAlerts`, ({ id, config = {} }, { dispatch }) => {
3689
- const { page = defaultPage2, perPage = 10 } = config;
3690
- 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) }))));
3691
- });
3692
- var getIssueCountsByType2 = (0, import_toolkit19.createAsyncThunk)(`${sliceName4}/getIssueCountsByType`, ({ type, options = {} }, { dispatch, getState }) => {
3693
- const state = getState();
3694
- const { filters = getDeviceFilters(state), group, status, ...remainder } = options;
3695
- const { applicableFilters: nonMonitorFilters, filterTerms } = convertDeviceListStateToFilters({
3696
- ...remainder,
3697
- filters,
3698
- group,
3699
- offlineThreshold: state.app.offlineThreshold,
3700
- selectedIssues: [type],
3701
- status
3702
- });
3703
- return general_api_default.post(getSearchEndpoint(getState()), {
3704
- page: 1,
3705
- per_page: 1,
3706
- filters: filterTerms,
3707
- attributes: [{ scope: "identity", attribute: "status" }]
3708
- }).catch((err) => commonErrorHandler(err, `Retrieving issue counts failed:`, dispatch, commonErrorFallback)).then((res) => {
3709
- const total = nonMonitorFilters.length ? state.monitor.issueCounts.byType[type].total : Number(res.headers[headerNames.total]);
3710
- const filtered = nonMonitorFilters.length ? Number(res.headers[headerNames.total]) : total;
3711
- if (total === state.monitor.issueCounts.byType[type].total && filtered === state.monitor.issueCounts.byType[type].filtered) {
3712
- return Promise.resolve();
3713
- }
3714
- return Promise.resolve(dispatch(actions4.receiveDeviceIssueCounts({ counts: { filtered, total }, issueType: type })));
3715
- });
3716
- });
3717
- 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(
3718
3457
  `${sliceName4}/getDeviceMonitorConfig`,
3719
- (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))]))
3720
3459
  );
3721
- var changeNotificationSetting = (0, import_toolkit19.createAsyncThunk)(
3460
+ var changeNotificationSetting = createAppAsyncThunk(
3722
3461
  `${sliceName4}/changeNotificationSetting`,
3723
- ({ enabled, channel = alertChannels.email }, { dispatch }) => 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(
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(
3724
3463
  () => Promise.all([
3725
3464
  dispatch(actions4.changeAlertChannel({ channel, enabled })),
3726
- dispatch(actions_default.setSnackbar(`Successfully ${enabled ? "en" : "dis"}abled ${channel} alerts`, TIMEOUTS.fiveSeconds))
3465
+ dispatch(
3466
+ actions_default.setSnackbar({ message: `Successfully ${enabled ? "en" : "dis"}abled ${channel} alerts`, autoHideDuration: TIMEOUTS.fiveSeconds })
3467
+ )
3727
3468
  ])
3728
3469
  )
3729
3470
  );
3730
3471
 
3731
3472
  // src/usersSlice/thunks.ts
3732
- 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);
3733
3477
 
3734
3478
  // src/api/users-api.ts
3735
3479
  var import_axios3 = __toESM(require("axios"), 1);
@@ -3746,14 +3490,9 @@ var Api2 = {
3746
3490
  var users_api_default = Api2;
3747
3491
 
3748
3492
  // src/usersSlice/thunks.ts
3749
- var import_helpers9 = require("@northern.tech/utils/helpers");
3750
- var import_retrytimer = require("@northern.tech/utils/retrytimer");
3751
- var import_toolkit20 = require("@reduxjs/toolkit");
3752
- var import_md5 = __toESM(require("md5"), 1);
3753
- var import_universal_cookie3 = __toESM(require("universal-cookie"), 1);
3754
3493
  var cookies3 = new import_universal_cookie3.default();
3755
3494
  var { setAnnouncement, setSnackbar: setSnackbar3 } = actions_default;
3756
- var handleLoginError = (err, { token2fa: has2FA, password }, rejectWithValue) => (dispatch) => {
3495
+ var handleLoginError = (err, { token2fa: has2FA, password }, rejectWithValue) => () => {
3757
3496
  const errorText = (0, import_helpers9.extractErrorMessage)(err);
3758
3497
  const is2FABackend = errorText.includes("2fa");
3759
3498
  if (is2FABackend && !has2FA) {
@@ -3764,27 +3503,26 @@ var handleLoginError = (err, { token2fa: has2FA, password }, rejectWithValue) =>
3764
3503
  }
3765
3504
  const twoFAError = is2FABackend ? " and verification code" : "";
3766
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.`;
3767
- return Promise.reject(dispatch(setSnackbar3({ message: (0, import_helpers9.preformatWithRequestID)(err.response, errorMessage), action: "Copy to clipboard" })));
3506
+ return rejectWithValue({ error: errorMessage });
3768
3507
  };
3769
- var loginUser = (0, import_toolkit20.createAsyncThunk)(
3508
+ var loginUser = createAppAsyncThunk(
3770
3509
  `${sliceName8}/loginUser`,
3771
- ({ 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) => {
3772
3511
  cleanUp();
3773
3512
  return Promise.reject(dispatch(handleLoginError(err, userData, rejectWithValue)));
3774
- }).then(({ text: response, contentType }) => {
3775
- if (contentType.includes(APPLICATION_JSON_CONTENT_TYPE)) {
3776
- const { id, kind } = response;
3513
+ }).then(({ text: token, contentType }) => {
3514
+ if (contentType.includes(import_constants5.APPLICATION_JSON_CONTENT_TYPE)) {
3515
+ const { id, kind } = token;
3777
3516
  const type = kind.split("/")[1];
3778
3517
  const ssoLoginUrl = SSO_TYPES[type].getStartUrl(id);
3779
3518
  window.location.replace(ssoLoginUrl);
3780
3519
  return;
3781
3520
  }
3782
- const token = response;
3783
- if (contentType !== APPLICATION_JWT_CONTENT_TYPE || !token) {
3521
+ if (contentType !== import_constants5.APPLICATION_JWT_CONTENT_TYPE || !token) {
3784
3522
  return;
3785
3523
  }
3786
- let now = /* @__PURE__ */ new Date();
3787
- now.setSeconds(now.getSeconds() + maxSessionAge);
3524
+ const now = /* @__PURE__ */ new Date();
3525
+ now.setSeconds(now.getSeconds() + import_constants5.maxSessionAge);
3788
3526
  const expiresAt = stayLoggedIn ? void 0 : now.toISOString();
3789
3527
  setSessionInfo({ token, expiresAt });
3790
3528
  cookies3.remove("JWT", { path: "/" });
@@ -3800,35 +3538,35 @@ var loginUser = (0, import_toolkit20.createAsyncThunk)(
3800
3538
  });
3801
3539
  })
3802
3540
  );
3803
- var logoutUser = (0, import_toolkit20.createAsyncThunk)(`${sliceName8}/logoutUser`, (_, { dispatch, getState }) => {
3541
+ var logoutUser = createAppAsyncThunk(`${sliceName8}/logoutUser`, (_, { dispatch, getState }) => {
3804
3542
  if (Object.keys(getState().app.uploadsById).length) {
3805
3543
  return Promise.reject();
3806
3544
  }
3807
- return general_api_default.post(`${useradmApiUrlv1}/auth/logout`).finally(() => {
3545
+ return general_api_default.post(`${import_constants5.useradmApiUrl}/auth/logout`).finally(() => {
3808
3546
  cleanUp();
3809
3547
  (0, import_retrytimer.clearAllRetryTimers)(setSnackbar3);
3810
3548
  return Promise.resolve(dispatch({ type: USER_LOGOUT }));
3811
3549
  });
3812
3550
  });
3813
- var switchUserOrganization = (0, import_toolkit20.createAsyncThunk)(`${sliceName8}/switchUserOrganization`, (tenantId, { getState }) => {
3551
+ var switchUserOrganization = createAppAsyncThunk(`${sliceName8}/switchUserOrganization`, (tenantId, { getState }) => {
3814
3552
  if (Object.keys(getState().app.uploadsById).length) {
3815
3553
  return Promise.reject();
3816
3554
  }
3817
- 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 }) => {
3818
3556
  window.sessionStorage.setItem("tenantChanged", "true");
3819
3557
  setSessionInfo({ ...getSessionInfo(), token });
3820
3558
  window.location.reload();
3821
3559
  });
3822
3560
  });
3823
- var passwordResetStart = (0, import_toolkit20.createAsyncThunk)(
3561
+ var passwordResetStart = createAppAsyncThunk(
3824
3562
  `${sliceName8}/passwordResetStart`,
3825
- (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(
3826
3564
  (err) => commonErrorHandler(err, `The password reset request cannot be processed:`, dispatch, void 0, true)
3827
3565
  )
3828
3566
  );
3829
- var passwordResetComplete = (0, import_toolkit20.createAsyncThunk)(
3567
+ var passwordResetComplete = createAppAsyncThunk(
3830
3568
  `${sliceName8}/passwordResetComplete`,
3831
- ({ 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 = {}) => {
3832
3570
  const { error, response = {} } = err;
3833
3571
  let errorMsg = "";
3834
3572
  if (response.status == 400) {
@@ -3840,23 +3578,23 @@ var passwordResetComplete = (0, import_toolkit20.createAsyncThunk)(
3840
3578
  return Promise.reject(err);
3841
3579
  })
3842
3580
  );
3843
- var verifyEmailStart = (0, import_toolkit20.createAsyncThunk)(
3581
+ var verifyEmailStart = createAppAsyncThunk(
3844
3582
  `${sliceName8}/verifyEmailStart`,
3845
- (_, { 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))))
3846
3584
  );
3847
- var verifyEmailComplete = (0, import_toolkit20.createAsyncThunk)(
3585
+ var verifyEmailComplete = createAppAsyncThunk(
3848
3586
  `${sliceName8}/verifyEmailComplete`,
3849
- (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))))
3850
3588
  );
3851
- var verify2FA = (0, import_toolkit20.createAsyncThunk)(
3589
+ var verify2FA = createAppAsyncThunk(
3852
3590
  `${sliceName8}/verify2FA`,
3853
- (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(
3854
3592
  (err) => commonErrorHandler(err, "An error occured validating the verification code: failed to verify token, please try again.", dispatch, void 0, true)
3855
3593
  )
3856
3594
  );
3857
- var getUserList = (0, import_toolkit20.createAsyncThunk)(
3595
+ var getUserList = createAppAsyncThunk(
3858
3596
  `${sliceName8}/getUserList`,
3859
- (_, { dispatch, getState }) => general_api_default.get(`${useradmApiUrlv1}/users`).then((res) => {
3597
+ (_, { dispatch, getState }) => general_api_default.get(`${import_constants5.useradmApiUrl}/users`).then((res) => {
3860
3598
  const currentUsersById = getUsersById(getState());
3861
3599
  const users = res.data.reduce(
3862
3600
  (accu, item) => {
@@ -3871,9 +3609,9 @@ var getUserList = (0, import_toolkit20.createAsyncThunk)(
3871
3609
  return dispatch(actions8.receivedUserList(users));
3872
3610
  }).catch((err) => commonErrorHandler(err, `Users couldn't be loaded.`, dispatch, commonErrorFallback))
3873
3611
  );
3874
- var getUser = (0, import_toolkit20.createAsyncThunk)(
3612
+ var getUser = createAppAsyncThunk(
3875
3613
  `${sliceName8}/getUser`,
3876
- (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(
3877
3615
  ({ data: user }) => Promise.all([
3878
3616
  dispatch(actions8.receivedUser(user)),
3879
3617
  dispatch(setHideAnnouncement({ shouldHide: false, userId: user.id })),
@@ -3882,22 +3620,25 @@ var getUser = (0, import_toolkit20.createAsyncThunk)(
3882
3620
  ])
3883
3621
  ).catch((e) => rejectWithValue(e))
3884
3622
  );
3885
- var initializeSelf = (0, import_toolkit20.createAsyncThunk)(`${sliceName8}/initializeSelf`, (_, { dispatch }) => dispatch(getUser(OWN_USER_ID)));
3886
- var updateUserColumnSettings = (0, import_toolkit20.createAsyncThunk)(`${sliceName8}/updateUserColumnSettings`, ({ columns, currentUserId }, { dispatch, getState }) => {
3887
- const userId = currentUserId ?? getCurrentUser(getState()).id;
3888
- const storageKey = `${userId}-column-widths`;
3889
- let customColumns = [];
3890
- if (!columns) {
3891
- try {
3892
- customColumns = JSON.parse(window.localStorage.getItem(storageKey)) || customColumns;
3893
- } 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;
3894
3637
  }
3895
- } else {
3896
- customColumns = columns;
3638
+ window.localStorage.setItem(storageKey, JSON.stringify(customColumns));
3639
+ return Promise.resolve(dispatch(actions8.setCustomColumns(customColumns)));
3897
3640
  }
3898
- window.localStorage.setItem(storageKey, JSON.stringify(customColumns));
3899
- return Promise.resolve(dispatch(actions8.setCustomColumns(customColumns)));
3900
- });
3641
+ );
3901
3642
  var userActions = {
3902
3643
  add: {
3903
3644
  successMessage: "The user was added successfully.",
@@ -3917,44 +3658,44 @@ var userActions = {
3917
3658
  }
3918
3659
  };
3919
3660
  var userActionErrorHandler = (err, type, dispatch) => commonErrorHandler(err, `There was an error ${userActions[type].errorMessage} the user.`, dispatch);
3920
- var createUser = (0, import_toolkit20.createAsyncThunk)(
3661
+ var createUser = createAppAsyncThunk(
3921
3662
  `${sliceName8}/createUser`,
3922
- ({ 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))
3923
3664
  );
3924
- var removeUser = (0, import_toolkit20.createAsyncThunk)(
3665
+ var removeUser = createAppAsyncThunk(
3925
3666
  `${sliceName8}/removeUser`,
3926
- (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))
3927
3668
  );
3928
- var editUser = (0, import_toolkit20.createAsyncThunk)(
3669
+ var editUser = createAppAsyncThunk(
3929
3670
  `${sliceName8}/editUser`,
3930
- ({ 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(
3931
3672
  () => Promise.all([
3932
3673
  dispatch(actions8.updatedUser({ ...userData, id: id === OWN_USER_ID ? getCurrentUser(getState()).id : id })),
3933
3674
  dispatch(setSnackbar3(userActions.edit.successMessage))
3934
3675
  ])
3935
- )
3676
+ ).catch((err) => userActionErrorHandler(err, "edit", dispatch))
3936
3677
  );
3937
- var addUserToCurrentTenant = (0, import_toolkit20.createAsyncThunk)(`${sliceName8}/addUserToTenant`, (userId, { dispatch, getState }) => {
3678
+ var addUserToCurrentTenant = createAppAsyncThunk(`${sliceName8}/addUserToTenant`, (userId, { dispatch, getState }) => {
3938
3679
  const { id } = getOrganization(getState());
3939
- 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())]));
3940
3681
  });
3941
- var enableUser2fa = (0, import_toolkit20.createAsyncThunk)(
3682
+ var enableUser2fa = createAppAsyncThunk(
3942
3683
  `${sliceName8}/enableUser2fa`,
3943
- (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))))
3944
3685
  );
3945
- var disableUser2fa = (0, import_toolkit20.createAsyncThunk)(
3686
+ var disableUser2fa = createAppAsyncThunk(
3946
3687
  `${sliceName8}/disableUser2fa`,
3947
- (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))]))
3948
3689
  );
3949
- var mapHttpPermission = (permission) => Object.entries(uiPermissionsByArea).reduce(
3690
+ var mapHttpPermission = (permission) => Object.entries(import_constants5.uiPermissionsByArea).reduce(
3950
3691
  (accu, [area, definition]) => {
3951
3692
  const endpointMatches = definition.endpoints.filter(
3952
- (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)
3953
3694
  );
3954
- 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) {
3955
3696
  const endpointUiPermission = endpointMatches.reduce((endpointAccu, endpoint) => [...endpointAccu, ...endpoint.uiPermissions], []);
3956
3697
  const collector = (endpointUiPermission || definition.uiPermissions).reduce((permissionsAccu, uiPermission) => {
3957
- 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)) {
3958
3699
  permissionsAccu.push(uiPermission.value);
3959
3700
  }
3960
3701
  return permissionsAccu;
@@ -3962,39 +3703,39 @@ var mapHttpPermission = (permission) => Object.entries(uiPermissionsByArea).redu
3962
3703
  if (Array.isArray(accu[area])) {
3963
3704
  accu[area] = [...accu[area], ...collector].filter(import_helpers9.duplicateFilter);
3964
3705
  } else {
3965
- accu[area] = mergePermissions(accu[area], { [scopedPermissionAreas[area].excessiveAccessSelector]: collector });
3706
+ accu[area] = mergePermissions(accu[area], { [import_constants5.scopedPermissionAreas[area].excessiveAccessSelector]: collector });
3966
3707
  }
3967
3708
  }
3968
3709
  return accu;
3969
3710
  },
3970
- { ...emptyUiPermissions }
3711
+ { ...import_constants5.emptyUiPermissions }
3971
3712
  );
3972
3713
  var permissionActionTypes = {
3973
3714
  any: mapHttpPermission,
3974
- CREATE_DEPLOYMENT: (permission) => permission.type === PermissionTypes.DeviceGroup ? {
3975
- deployments: [uiPermissionsById.deploy.value],
3976
- 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] }
3977
3718
  } : {},
3978
3719
  http: mapHttpPermission,
3979
- REMOTE_TERMINAL: (permission) => permission.type === PermissionTypes.DeviceGroup ? {
3980
- 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] }
3981
3722
  } : {},
3982
- VIEW_DEVICE: (permission) => permission.type === PermissionTypes.DeviceGroup ? {
3983
- 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] }
3984
3725
  } : {}
3985
3726
  };
3986
3727
  var combinePermissions = (existingPermissions, additionalPermissions = {}) => Object.entries(additionalPermissions).reduce((accu, [name, permissions]) => {
3987
- let maybeExistingPermissions = accu[name] || [];
3728
+ const maybeExistingPermissions = accu[name] || [];
3988
3729
  accu[name] = [...permissions, ...maybeExistingPermissions].filter(import_helpers9.duplicateFilter);
3989
3730
  return accu;
3990
3731
  }, existingPermissions);
3991
3732
  var tryParseCustomPermission = (permission) => {
3992
3733
  const uiPermissions = permissionActionTypes[permission.action](permission.object);
3993
- const result = mergePermissions({ ...emptyUiPermissions }, uiPermissions);
3734
+ const result = mergePermissions({ ...import_constants5.emptyUiPermissions }, uiPermissions);
3994
3735
  return { isCustom: true, permission, result };
3995
3736
  };
3996
3737
  var customPermissionHandler = (accu, permission) => {
3997
- let processor = tryParseCustomPermission(permission);
3738
+ const processor = tryParseCustomPermission(permission);
3998
3739
  return {
3999
3740
  ...accu,
4000
3741
  isCustom: accu.isCustom || processor.isCustom,
@@ -4002,7 +3743,7 @@ var customPermissionHandler = (accu, permission) => {
4002
3743
  };
4003
3744
  };
4004
3745
  var mapPermissionSet = (permissionSetName, names, scope, existingGroupsPermissions = {}) => {
4005
- 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;
4006
3747
  const scopedPermissions = names.reduce((accu, name) => combinePermissions(accu, { [name]: [permission] }), existingGroupsPermissions);
4007
3748
  return Object.entries(scopedPermissions).reduce((accu, [key, permissions]) => ({ ...accu, [key]: deriveImpliedAreaPermissions(scope, permissions) }), {});
4008
3749
  };
@@ -4015,16 +3756,21 @@ var isEmptyPermissionSet = (permissionSet) => !Object.values(permissionSet).redu
4015
3756
  var parseRolePermissions = ({ permission_sets_with_scope = [], permissions = [] }, permissionSets) => {
4016
3757
  const preliminaryResult = permission_sets_with_scope.reduce(
4017
3758
  (accu, permissionSet) => {
4018
- let processor = permissionSets[permissionSet.name];
3759
+ const processor = permissionSets[permissionSet.name];
4019
3760
  if (!processor) {
4020
3761
  return accu;
4021
3762
  }
4022
- 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);
4023
3764
  if (scope) {
4024
- 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
+ );
4025
3771
  return { ...accu, uiPermissions: { ...accu.uiPermissions, [scope]: result } };
4026
3772
  } else if (isEmptyPermissionSet(processor.result)) {
4027
- return processor.permissions.reduce(customPermissionHandler, accu);
3773
+ return processor.permissions?.reduce(customPermissionHandler, accu);
4028
3774
  }
4029
3775
  return {
4030
3776
  ...accu,
@@ -4032,7 +3778,7 @@ var parseRolePermissions = ({ permission_sets_with_scope = [], permissions = []
4032
3778
  uiPermissions: mergePermissions(accu.uiPermissions, processor.result)
4033
3779
  };
4034
3780
  },
4035
- { isCustom: false, uiPermissions: { ...emptyUiPermissions, groups: {}, releases: {} } }
3781
+ { isCustom: false, uiPermissions: { ...import_constants5.emptyUiPermissions, groups: {}, releases: {} } }
4036
3782
  );
4037
3783
  return permissions.reduce(customPermissionHandler, preliminaryResult);
4038
3784
  };
@@ -4051,12 +3797,12 @@ var normalizeRbacRoles = (roles, rolesById2, permissionSets) => roles.reduce(
4051
3797
  normalizedPermissions = result.uiPermissions;
4052
3798
  isCustom = result.isCustom;
4053
3799
  }
4054
- const roleState = accu[role.name] ?? { ...emptyRole };
3800
+ const roleState = accu[role.name] ?? { ...import_constants5.emptyRole };
4055
3801
  accu[role.name] = {
4056
3802
  ...roleState,
4057
3803
  ...role,
4058
3804
  description: roleState.description ? roleState.description : role.description,
4059
- 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),
4060
3806
  isCustom,
4061
3807
  name: roleState.name ? roleState.name : role.name,
4062
3808
  uiPermissions: normalizedPermissions
@@ -4065,16 +3811,16 @@ var normalizeRbacRoles = (roles, rolesById2, permissionSets) => roles.reduce(
4065
3811
  },
4066
3812
  { ...rolesById2 }
4067
3813
  );
4068
- var getPermissionSets = (0, import_toolkit20.createAsyncThunk)(
3814
+ var getPermissionSets = createAppAsyncThunk(
4069
3815
  `${sliceName8}/getPermissionSets`,
4070
- (_, { 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 }) => {
4071
3817
  const permissionSets = data.reduce(
4072
3818
  (accu, permissionSet) => {
4073
3819
  const permissionSetState = accu[permissionSet.name] ?? {};
4074
3820
  let permissionSetObject = { ...permissionSetState, ...permissionSet };
4075
- permissionSetObject.result = Object.values(uiPermissionsById).reduce(
3821
+ permissionSetObject.result = Object.values(import_constants5.uiPermissionsById).reduce(
4076
3822
  (accu2, item) => Object.entries(item.permissionSets).reduce((collector, [area, permissionSet2]) => {
4077
- if (scopedPermissionAreas[area]) {
3823
+ if (import_constants5.scopedPermissionAreas[area]) {
4078
3824
  return collector;
4079
3825
  }
4080
3826
  if (permissionSet2 === permissionSetObject.name) {
@@ -4082,16 +3828,19 @@ var getPermissionSets = (0, import_toolkit20.createAsyncThunk)(
4082
3828
  }
4083
3829
  return collector;
4084
3830
  }, accu2),
4085
- { ...emptyUiPermissions, ...permissionSetObject.result ?? {} }
3831
+ { ...import_constants5.emptyUiPermissions, ...permissionSetObject.result ?? {} }
4086
3832
  );
4087
- const scopes = Object.values(scopedPermissionAreas).reduce((accu2, { key, scopeType }) => {
3833
+ const scopes = Object.values(import_constants5.scopedPermissionAreas).reduce((accu2, { key, scopeType }) => {
4088
3834
  if (permissionSetObject.supported_scope_types?.includes(key) || permissionSetObject.supported_scope_types?.includes(scopeType)) {
4089
3835
  accu2.push(key);
4090
3836
  }
4091
3837
  return accu2;
4092
3838
  }, []);
4093
3839
  permissionSetObject = scopes.reduce((accu2, scope) => {
4094
- 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
+ };
4095
3844
  return accu2;
4096
3845
  }, permissionSetObject);
4097
3846
  accu[permissionSet.name] = permissionSetObject;
@@ -4102,23 +3851,23 @@ var getPermissionSets = (0, import_toolkit20.createAsyncThunk)(
4102
3851
  return Promise.all([dispatch(actions8.receivedPermissionSets(permissionSets)), permissionSets]);
4103
3852
  }).catch(() => console.log("Permission set retrieval failed - likely accessing a non-RBAC backend"))
4104
3853
  );
4105
- var getRoles = (0, import_toolkit20.createAsyncThunk)(
3854
+ var getRoles = createAppAsyncThunk(
4106
3855
  `${sliceName8}/getRoles`,
4107
- (_, { 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) => {
4108
3857
  if (!results) {
4109
3858
  return Promise.resolve();
4110
3859
  }
4111
3860
  const [{ data: roles }, { payload: permissionSetTasks }] = results;
4112
3861
  const rolesById2 = normalizeRbacRoles(roles, getRolesById(getState()), permissionSetTasks[permissionSetTasks.length - 1]);
4113
3862
  return Promise.resolve(dispatch(actions8.receivedRoles(rolesById2)));
4114
- }).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))))
4115
3864
  );
4116
3865
  var deriveImpliedAreaPermissions = (area, areaPermissions, skipPermissions = []) => {
4117
3866
  const highestAreaPermissionLevelSelected = areaPermissions.reduce(
4118
- (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,
4119
3868
  1
4120
3869
  );
4121
- return uiPermissionsByArea[area].uiPermissions.reduce((permissions, current) => {
3870
+ return import_constants5.uiPermissionsByArea[area].uiPermissions.reduce((permissions, current) => {
4122
3871
  if ((current.permissionLevel < highestAreaPermissionLevelSelected || areaPermissions.includes(current.value)) && !skipPermissions.includes(current.value)) {
4123
3872
  permissions.push(current.value);
4124
3873
  }
@@ -4127,14 +3876,14 @@ var deriveImpliedAreaPermissions = (area, areaPermissions, skipPermissions = [])
4127
3876
  };
4128
3877
  var transformAreaRoleDataToScopedPermissionsSets = (area, areaPermissions, excessiveAccessSelector) => {
4129
3878
  const permissionSetObject = areaPermissions.reduce((accu, { item, uiPermissions }) => {
4130
- 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] : [];
4131
3880
  const impliedPermissions = deriveImpliedAreaPermissions(area, uiPermissions, skipPermissions);
4132
3881
  accu = impliedPermissions.reduce((itemPermissionAccu, impliedPermission) => {
4133
- const permissionSetState = itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]] ?? {
4134
- type: uiPermissionsByArea[area].scope,
3882
+ const permissionSetState = itemPermissionAccu[import_constants5.uiPermissionsById[impliedPermission].permissionSets[area]] ?? {
3883
+ type: import_constants5.uiPermissionsByArea[area].scope,
4135
3884
  value: []
4136
3885
  };
4137
- itemPermissionAccu[uiPermissionsById[impliedPermission].permissionSets[area]] = {
3886
+ itemPermissionAccu[import_constants5.uiPermissionsById[impliedPermission].permissionSets[area]] = {
4138
3887
  ...permissionSetState,
4139
3888
  value: [...permissionSetState.value, item]
4140
3889
  };
@@ -4151,10 +3900,10 @@ var transformAreaRoleDataToScopedPermissionsSets = (area, areaPermissions, exces
4151
3900
  };
4152
3901
  var transformRoleDataToRole = (roleData, roleState = {}) => {
4153
3902
  const role = { ...roleState, ...roleData };
4154
- const { description = "", name, uiPermissions = emptyUiPermissions } = role;
4155
- 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(
4156
3905
  (accu, [key, emptyPermissions]) => {
4157
- if (!scopedPermissionAreas[key]) {
3906
+ if (!import_constants5.scopedPermissionAreas[key]) {
4158
3907
  accu.remainderKeys.push(key);
4159
3908
  } else if (uiPermissions[key]) {
4160
3909
  accu.maybeUiPermissions[key] = uiPermissions[key].reduce(itemUiPermissionsReducer, emptyPermissions);
@@ -4171,27 +3920,33 @@ var transformRoleDataToRole = (roleData, roleState = {}) => {
4171
3920
  }
4172
3921
  const impliedPermissions = deriveImpliedAreaPermissions(area, areaPermissions);
4173
3922
  accu.roleUiPermissions[area] = impliedPermissions;
4174
- const mappedPermissions = impliedPermissions.map((uiPermission) => ({ name: uiPermissionsById[uiPermission].permissionSets[area] }));
3923
+ const mappedPermissions = impliedPermissions.map((uiPermission) => ({ name: import_constants5.uiPermissionsById[uiPermission].permissionSets[area] }));
4175
3924
  accu.permissionSetsWithScope.push(...mappedPermissions);
4176
3925
  return accu;
4177
3926
  },
4178
- { permissionSetsWithScope: [{ name: defaultPermissionSets.Basic.name }], roleUiPermissions: {} }
3927
+ { permissionSetsWithScope: [{ name: import_constants5.defaultPermissionSets.Basic.name }], roleUiPermissions: {} }
4179
3928
  );
4180
- const scopedPermissionSets = Object.values(scopedPermissionAreas).reduce((accu, { key, excessiveAccessSelector }) => {
3929
+ const scopedPermissionSets = Object.values(import_constants5.scopedPermissionAreas).reduce((accu, { key, excessiveAccessSelector }) => {
4181
3930
  if (!uiPermissions[key]) {
4182
3931
  return accu;
4183
3932
  }
4184
- accu.push(...transformAreaRoleDataToScopedPermissionsSets(key, uiPermissions[key], excessiveAccessSelector));
3933
+ accu.push(
3934
+ ...transformAreaRoleDataToScopedPermissionsSets(
3935
+ key,
3936
+ uiPermissions[key],
3937
+ excessiveAccessSelector
3938
+ )
3939
+ );
4185
3940
  return accu;
4186
3941
  }, []);
4187
3942
  return {
4188
3943
  permissionSetsWithScope: [...permissionSetsWithScope, ...scopedPermissionSets],
4189
3944
  role: {
4190
- ...emptyRole,
3945
+ ...import_constants5.emptyRole,
4191
3946
  name,
4192
- description: description ? description : roleState.description,
3947
+ description: description ? description : roleState.description || "",
4193
3948
  uiPermissions: {
4194
- ...emptyUiPermissions,
3949
+ ...import_constants5.emptyUiPermissions,
4195
3950
  ...roleUiPermissions,
4196
3951
  ...maybeUiPermissions
4197
3952
  }
@@ -4212,50 +3967,57 @@ var roleActions = {
4212
3967
  errorMessage: "removing"
4213
3968
  }
4214
3969
  };
4215
- var roleActionErrorHandler = (err, type, dispatch) => commonErrorHandler(err, `There was an error ${roleActions[type].errorMessage} the role.`, dispatch);
4216
- 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 }) => {
4217
3979
  const { permissionSetsWithScope, role } = transformRoleDataToRole(roleData);
4218
- return general_api_default.post(`${useradmApiUrlv2}/roles`, {
3980
+ return general_api_default.post(`${import_constants5.useradmApiUrlv2}/roles`, {
4219
3981
  name: role.name,
4220
3982
  description: role.description,
4221
3983
  permission_sets_with_scope: permissionSetsWithScope
4222
- }).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 }));
4223
3985
  });
4224
- var editRole = (0, import_toolkit20.createAsyncThunk)(`${sliceName8}/editRole`, (roleData, { dispatch, getState }) => {
3986
+ var editRole = createAppAsyncThunk(`${sliceName8}/editRole`, (roleData, { dispatch, getState }) => {
4225
3987
  const { permissionSetsWithScope, role } = transformRoleDataToRole(roleData, getRolesById(getState())[roleData.name]);
4226
- return general_api_default.put(`${useradmApiUrlv2}/roles/${role.name}`, {
3988
+ return general_api_default.put(`${import_constants5.useradmApiUrlv2}/roles/${role.name}`, {
4227
3989
  description: role.description,
4228
3990
  name: role.name,
4229
3991
  permission_sets_with_scope: permissionSetsWithScope
4230
- }).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 }));
4231
3993
  });
4232
- var removeRole = (0, import_toolkit20.createAsyncThunk)(
3994
+ var removeRole = createAppAsyncThunk(
4233
3995
  `${sliceName8}/removeRole`,
4234
- (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))
4235
3997
  );
4236
- var getGlobalSettings2 = (0, import_toolkit20.createAsyncThunk)(
3998
+ var getGlobalSettings2 = createAppAsyncThunk(
4237
3999
  `${sliceName8}/getGlobalSettings`,
4238
- (_, { dispatch }) => general_api_default.get(`${useradmApiUrlv1}/settings`).then(({ data: settings, headers: { etag } }) => {
4239
- 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");
4240
4002
  return Promise.all([dispatch(actions8.setGlobalSettings(settings)), dispatch(setOfflineThreshold()), etag]);
4241
4003
  })
4242
4004
  );
4243
- var saveGlobalSettings = (0, import_toolkit20.createAsyncThunk)(
4005
+ var saveGlobalSettings = createAppAsyncThunk(
4244
4006
  `${sliceName8}/saveGlobalSettings`,
4245
4007
  ({ beOptimistic = false, notify = false, ...settings }, { dispatch, getState }) => {
4246
4008
  if (!window.sessionStorage.getItem(settingsKeys.initialized) && !beOptimistic) {
4247
4009
  return;
4248
4010
  }
4249
4011
  return dispatch(getGlobalSettings2()).unwrap().then((result) => {
4250
- let updatedSettings = { ...getState().users.globalSettings, ...settings };
4012
+ const updatedSettings = { ...getState().users.globalSettings, ...settings };
4251
4013
  if (getCurrentUser(getState()).verified) {
4252
- updatedSettings["2fa"] = twoFAStates.enabled;
4014
+ updatedSettings["2fa"] = import_constants5.twoFAStates.enabled;
4253
4015
  } else {
4254
4016
  delete updatedSettings["2fa"];
4255
4017
  }
4256
- let tasks = [dispatch(actions8.setGlobalSettings(updatedSettings))];
4018
+ const tasks = [dispatch(actions8.setGlobalSettings(updatedSettings))];
4257
4019
  const headers = result[result.length - 1] ? { "If-Match": result[result.length - 1] } : {};
4258
- return general_api_default.post(`${useradmApiUrlv1}/settings`, updatedSettings, { headers }).then(() => {
4020
+ return general_api_default.post(`${import_constants5.useradmApiUrl}/settings`, updatedSettings, { headers }).then(() => {
4259
4021
  if (notify) {
4260
4022
  tasks.push(dispatch(setSnackbar3("Settings saved successfully")));
4261
4023
  }
@@ -4270,54 +4032,59 @@ var saveGlobalSettings = (0, import_toolkit20.createAsyncThunk)(
4270
4032
  });
4271
4033
  }
4272
4034
  );
4273
- var getUserSettings2 = (0, import_toolkit20.createAsyncThunk)(
4035
+ var getUserSettings2 = createAppAsyncThunk(
4274
4036
  `${sliceName8}/getUserSettings`,
4275
- (_, { dispatch }) => general_api_default.get(`${useradmApiUrlv1}/settings/me`).then(({ data: settings, headers: { etag } }) => {
4276
- 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");
4277
4039
  return Promise.all([dispatch(actions8.setUserSettings(settings)), etag]);
4278
4040
  })
4279
4041
  );
4280
- var saveUserSettings = (0, import_toolkit20.createAsyncThunk)(`${sliceName8}/saveUserSettings`, (settings = { onboarding: {} }, { dispatch, getState }) => {
4281
- if (!getCurrentUser(getState()).id) {
4282
- 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
+ });
4283
4067
  }
4284
- return dispatch(getUserSettings2()).unwrap().then((result) => {
4285
- const userSettings = getUserSettings(getState());
4286
- const onboardingState = getOnboardingState(getState());
4287
- const tooltipState = getTooltipsState(getState());
4288
- const updatedSettings = {
4289
- ...userSettings,
4290
- ...settings,
4291
- onboarding: {
4292
- ...onboardingState,
4293
- ...settings.onboarding
4294
- },
4295
- tooltips: tooltipState
4296
- };
4297
- const headers = result[result.length - 1] ? { "If-Match": result[result.length - 1] } : {};
4298
- return Promise.all([
4299
- Promise.resolve(dispatch(actions8.setUserSettings(updatedSettings))),
4300
- general_api_default.post(`${useradmApiUrlv1}/settings/me`, updatedSettings, { headers })
4301
- ]).catch(() => dispatch(actions8.setUserSettings(userSettings)));
4302
- });
4303
- });
4304
- var get2FAQRCode = (0, import_toolkit20.createAsyncThunk)(
4068
+ );
4069
+ var get2FAQRCode = createAppAsyncThunk(
4305
4070
  `${sliceName8}/get2FAQRCode`,
4306
- (_, { 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)))
4307
4072
  );
4308
- var setHideAnnouncement = (0, import_toolkit20.createAsyncThunk)(`${sliceName8}/setHideAnnouncement`, ({ shouldHide, userId }, { dispatch, getState }) => {
4309
- const currentUserId = userId || getCurrentUser(getState()).id;
4310
- const hash = getState().app.hostedAnnouncement ? (0, import_md5.default)(getState().app.hostedAnnouncement) : "";
4311
- const announceCookie = cookies3.get(`${currentUserId}${hash}`);
4312
- if (shouldHide || hash.length && typeof announceCookie !== "undefined") {
4313
- cookies3.set(`${currentUserId}${hash}`, true, { maxAge: 604800 });
4314
- 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
+ }
4315
4083
  }
4316
- return Promise.resolve();
4317
- });
4318
- var getTokens = (0, import_toolkit20.createAsyncThunk)(
4084
+ );
4085
+ var getTokens = createAppAsyncThunk(
4319
4086
  `${sliceName8}/getTokens`,
4320
- (_, { 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 }) => {
4321
4088
  const user = getCurrentUser(getState());
4322
4089
  const updatedUser = {
4323
4090
  ...user,
@@ -4327,28 +4094,33 @@ var getTokens = (0, import_toolkit20.createAsyncThunk)(
4327
4094
  })
4328
4095
  );
4329
4096
  var ONE_YEAR = 31536e3;
4330
- var generateToken = (0, import_toolkit20.createAsyncThunk)(
4097
+ var generateToken = createAppAsyncThunk(
4331
4098
  `${sliceName8}/generateToken`,
4332
- ({ 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))
4333
4100
  );
4334
- var revokeToken = (0, import_toolkit20.createAsyncThunk)(
4101
+ var revokeToken = createAppAsyncThunk(
4335
4102
  `${sliceName8}/revokeToken`,
4336
- (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())))
4337
4104
  );
4338
- var setTooltipReadState = (0, import_toolkit20.createAsyncThunk)(`${sliceName8}/setTooltipReadState`, ({ persist, ...remainder }, { dispatch }) => {
4339
- let tasks = [dispatch(actions8.setTooltipState(remainder))];
4340
- if (persist) {
4341
- 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
+ }
4342
4112
  }
4343
- return Promise.all(tasks);
4344
- });
4345
- var setAllTooltipsReadState = (0, import_toolkit20.createAsyncThunk)(`${sliceName8}/toggleHelptips`, (readState = READ_STATES.read, { dispatch }) => {
4346
- const updatedTips = Object.keys(import_helptips.HELPTOOLTIPS).reduce((accu, id) => ({ ...accu, [id]: { readState } }), {});
4347
- return Promise.resolve(dispatch(actions8.setTooltipsState(updatedTips))).then(() => dispatch(saveUserSettings()));
4348
- });
4349
- 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(
4350
4122
  `${sliceName8}/submitFeedback`,
4351
- ({ 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`, {
4352
4124
  subject: "feedback submission",
4353
4125
  body: JSON.stringify({ feedback, satisfaction, meta })
4354
4126
  }).then(() => {
@@ -4359,21 +4131,17 @@ var submitFeedback = (0, import_toolkit20.createAsyncThunk)(
4359
4131
  );
4360
4132
 
4361
4133
  // src/deploymentsSlice/thunks.ts
4362
- var import_helpers10 = require("@northern.tech/utils/helpers");
4363
- var import_tracking = __toESM(require("@northern.tech/utils/tracking"), 1);
4364
- var import_toolkit21 = require("@reduxjs/toolkit");
4365
- var import_validator = require("validator");
4366
4134
  var { receivedDevice, setSnackbar: setSnackbar4 } = actions_default;
4367
- var { page: defaultPage3, perPage: defaultPerPage3 } = DEVICE_LIST_DEFAULTS;
4368
- var deriveDeploymentGroup = ({ filter = {}, group, groups = [], name }) => group || groups.length === 1 && !(0, import_validator.isUUID)(name) ? groups[0] : filter.name;
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;
4369
4137
  var transformDeployments = (deployments, deploymentsById) => deployments.sort((0, import_helpers10.customSort)(true, "created")).reduce(
4370
4138
  (accu, item) => {
4371
- const filter = item.filter ?? {};
4139
+ const filter = item.filter;
4372
4140
  let deployment = {
4373
4141
  ...deploymentPrototype,
4374
4142
  ...deploymentsById[item.id],
4375
4143
  ...item,
4376
- 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,
4377
4145
  name: decodeURIComponent(item.name)
4378
4146
  };
4379
4147
  deployment = { ...deployment, group: deriveDeploymentGroup(deployment) };
@@ -4383,40 +4151,43 @@ var transformDeployments = (deployments, deploymentsById) => deployments.sort((0
4383
4151
  },
4384
4152
  { deployments: {}, deploymentIds: [] }
4385
4153
  );
4386
- var getDeploymentsByStatus2 = (0, import_toolkit21.createAsyncThunk)(`${sliceName2}/getDeploymentsByStatus`, (options = {}, { dispatch, getState }) => {
4387
- const { status, page = defaultPage3, per_page = defaultPerPage3, startDate, endDate, group, type, shouldSelect = true, sort = SORTING_OPTIONS.desc } = options;
4388
- const created_after = startDate ? `&created_after=${startDate}` : "";
4389
- const created_before = endDate ? `&created_before=${endDate}` : "";
4390
- const search = group ? `&search=${group}` : "";
4391
- const typeFilter = type ? `&type=${type}` : "";
4392
- return general_api_default.get(
4393
- `${deploymentsApiUrl}/deployments?status=${status}&per_page=${per_page}&page=${page}${created_after}${created_before}${search}${typeFilter}&sort=${sort}`
4394
- ).then((res) => {
4395
- const { deployments, deploymentIds } = transformDeployments(res.data, getState().deployments.byId);
4396
- const total = Number(res.headers[headerNames.total]);
4397
- let tasks = [
4398
- dispatch(actions2.receivedDeployments(deployments)),
4399
- dispatch(
4400
- actions2.receivedDeploymentsForStatus({
4401
- deploymentIds,
4402
- status,
4403
- total: !(startDate || endDate || group || type) ? total : getState().deployments.byStatus[status].total
4404
- })
4405
- )
4406
- ];
4407
- tasks = deploymentIds.reduce((accu, deploymentId) => {
4408
- if (deployments[deploymentId].type === DEPLOYMENT_TYPES.configuration) {
4409
- 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 })));
4410
4185
  }
4411
- return accu;
4412
- }, tasks);
4413
- if (shouldSelect) {
4414
- tasks.push(dispatch(actions2.selectDeploymentsForStatus({ deploymentIds, status, total })));
4415
- }
4416
- tasks.push({ deploymentIds, total });
4417
- return Promise.all(tasks);
4418
- });
4419
- });
4186
+ tasks.push({ deploymentIds, total });
4187
+ return Promise.all(tasks);
4188
+ });
4189
+ }
4190
+ );
4420
4191
  var isWithinFirstMonth = (expirationDate) => {
4421
4192
  if (!expirationDate) {
4422
4193
  return false;
@@ -4438,86 +4209,98 @@ var trackDeploymentCreation = (totalDeploymentCount, hasDeployments, trial_expir
4438
4209
  }
4439
4210
  };
4440
4211
  var MAX_PREVIOUS_PHASES_COUNT = 5;
4441
- var createDeployment = (0, import_toolkit21.createAsyncThunk)(`${sliceName2}/createDeployment`, ({ newDeployment, hasNewRetryDefault = false }, { dispatch, getState }) => {
4442
- let request;
4443
- if (newDeployment.filter_id) {
4444
- request = general_api_default.post(`${deploymentsApiUrlV2}/deployments`, newDeployment);
4445
- } else if (newDeployment.group) {
4446
- request = general_api_default.post(`${deploymentsApiUrl}/deployments/group/${newDeployment.group}`, newDeployment);
4447
- } else {
4448
- request = general_api_default.post(`${deploymentsApiUrl}/deployments`, newDeployment);
4449
- }
4450
- const totalDeploymentCount = Object.values(getDeploymentsByStatus(getState())).reduce((accu, item) => accu + item.total, 0);
4451
- const { hasDeployments } = getGlobalSettings(getState());
4452
- const { trial_expiration } = getOrganization(getState());
4453
- return request.catch((err) => commonErrorHandler(err, "Error creating deployment.", dispatch)).then((data) => {
4454
- const lastslashindex = data.headers.location.lastIndexOf("/");
4455
- const deploymentId = data.headers.location.substring(lastslashindex + 1);
4456
- const deployment = {
4457
- ...newDeployment,
4458
- id: deploymentId,
4459
- devices: newDeployment.devices ? newDeployment.devices.map((id) => ({ id, status: "pending" })) : [],
4460
- statistics: { status: {} }
4461
- };
4462
- let tasks = [
4463
- dispatch(actions2.createdDeployment(deployment)),
4464
- dispatch(getSingleDeployment(deploymentId)),
4465
- dispatch(setSnackbar4("Deployment created successfully", TIMEOUTS.fiveSeconds))
4466
- ];
4467
- trackDeploymentCreation(totalDeploymentCount, hasDeployments, trial_expiration);
4468
- const { canManageUsers } = getUserCapabilities(getState());
4469
- if (canManageUsers) {
4470
- const { phases, retries } = newDeployment;
4471
- const { previousPhases = [], retries: previousRetries = 0 } = getGlobalSettings(getState());
4472
- let newSettings = { retries: hasNewRetryDefault ? retries : previousRetries, hasDeployments: true };
4473
- if (phases) {
4474
- const standardPhases = (0, import_helpers10.standardizePhases)(phases);
4475
- let prevPhases = previousPhases.map(import_helpers10.standardizePhases);
4476
- if (!prevPhases.find((previousPhaseList) => previousPhaseList.every((oldPhase) => standardPhases.find((phase) => (0, import_helpers10.deepCompare)(phase, oldPhase))))) {
4477
- prevPhases.push(standardPhases);
4478
- }
4479
- newSettings.previousPhases = prevPhases.slice(-1 * MAX_PREVIOUS_PHASES_COUNT);
4480
- }
4481
- 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);
4482
4225
  }
4483
- return Promise.all(tasks);
4484
- });
4485
- });
4486
- var getDeploymentDevices = (0, import_toolkit21.createAsyncThunk)(`${sliceName2}/getDeploymentDevices`, (options, { dispatch, getState }) => {
4487
- const { id, page = defaultPage3, perPage = defaultPerPage3 } = options;
4488
- return general_api_default.get(`${deploymentsApiUrl}/deployments/${id}/devices/list?&page=${page}&per_page=${perPage}`).then((response) => {
4489
- const { devices: deploymentDevices = {} } = getState().deployments.byId[id] || {};
4490
- const devices = response.data.reduce((accu, item) => {
4491
- accu[item.id] = item;
4492
- const log = (deploymentDevices[item.id] || {}).log;
4493
- if (log) {
4494
- accu[item.id].log = log;
4495
- }
4496
- return accu;
4497
- }, {});
4498
- const selectedDeviceIds = Object.keys(devices);
4499
- let tasks = [
4500
- dispatch(
4501
- actions2.receivedDeploymentDevices({
4502
- id,
4503
- devices,
4504
- selectedDeviceIds,
4505
- totalDeviceCount: Number(response.headers[headerNames.total])
4506
- })
4507
- )
4508
- ];
4509
- const devicesById = getDevicesById(getState());
4510
- const lackingData = selectedDeviceIds.reduce((accu, deviceId) => {
4511
- const device = devicesById[deviceId];
4512
- if (!device || !device.identity_data || !device.attributes || Object.keys(device.attributes).length === 0) {
4513
- 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)));
4514
4261
  }
4515
- return accu;
4516
- }, []);
4517
- tasks = lackingData.reduce((accu, deviceId) => [...accu, dispatch(getDeviceById2(deviceId)), dispatch(getDeviceAuth(deviceId))], tasks);
4518
- return Promise.all(tasks);
4519
- });
4520
- });
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
+ );
4521
4304
  var parseDeviceDeployment = ({
4522
4305
  deployment: { id, artifact_name: release, status: deploymentStatus },
4523
4306
  device: { created, deleted, id: deviceId, finished, status, log }
@@ -4537,44 +4320,44 @@ var parseDeviceDeployment = ({
4537
4320
  return accu;
4538
4321
  }, "")
4539
4322
  });
4540
- var getDeviceDeployments = (0, import_toolkit21.createAsyncThunk)(`${sliceName2}/getDeviceDeployments`, (options, { dispatch }) => {
4323
+ var getDeviceDeployments = createAppAsyncThunk(`${sliceName}/getDeviceDeployments`, (options, { dispatch }) => {
4541
4324
  const { deviceId, filterSelection = [], page = defaultPage3, perPage = defaultPerPage3 } = options;
4542
4325
  const filters = filterSelection.map((item) => `&status=${item}`).join("");
4543
- 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(
4544
4327
  ({ data, headers }) => Promise.resolve(
4545
4328
  dispatch(
4546
4329
  receivedDevice({
4547
4330
  id: deviceId,
4548
4331
  deviceDeployments: data.map(parseDeviceDeployment),
4549
- deploymentsCount: Number(headers[headerNames.total])
4332
+ deploymentsCount: Number(headers[import_constants5.headerNames.total])
4550
4333
  })
4551
4334
  )
4552
4335
  )
4553
4336
  ).catch((err) => commonErrorHandler(err, "There was an error retrieving the device deployment history:", dispatch));
4554
4337
  });
4555
- var resetDeviceDeployments = (0, import_toolkit21.createAsyncThunk)(
4556
- `${sliceName2}/resetDeviceDeployments`,
4557
- (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))
4558
4341
  );
4559
- var getSingleDeployment = (0, import_toolkit21.createAsyncThunk)(
4560
- `${sliceName2}/getSingleDeployment`,
4561
- (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 }) => {
4562
4345
  const { deployments } = transformDeployments([data], getState().deployments.byId);
4563
- return Promise.resolve(dispatch(actions2.receivedDeployment(deployments[id])));
4346
+ return Promise.resolve(dispatch(actions.receivedDeployment(deployments[id])));
4564
4347
  })
4565
4348
  );
4566
- var getDeviceLog = (0, import_toolkit21.createAsyncThunk)(
4567
- `${sliceName2}/getDeviceLog`,
4568
- ({ 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) => {
4569
4352
  console.log("no log here", e);
4570
4353
  return Promise.reject();
4571
4354
  }).then(
4572
- ({ 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)])
4573
4356
  )
4574
4357
  );
4575
- var abortDeployment = (0, import_toolkit21.createAsyncThunk)(
4576
- `${sliceName2}/abortDeployment`,
4577
- (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(() => {
4578
4361
  const deploymentsByStatus = getDeploymentsByStatus(getState());
4579
4362
  let status = DEPLOYMENT_STATES.pending;
4580
4363
  let index = deploymentsByStatus.pending.deploymentIds.findIndex((id) => id === deploymentId);
@@ -4590,21 +4373,21 @@ var abortDeployment = (0, import_toolkit21.createAsyncThunk)(
4590
4373
  }, {});
4591
4374
  const total = Math.max(deploymentsByStatus[status].total - 1, 0);
4592
4375
  return Promise.all([
4593
- dispatch(actions2.receivedDeployments(deployments)),
4594
- dispatch(actions2.receivedDeploymentsForStatus({ deploymentIds, status, total })),
4595
- dispatch(actions2.removedDeployment(deploymentId)),
4376
+ dispatch(actions.receivedDeployments(deployments)),
4377
+ dispatch(actions.receivedDeploymentsForStatus({ deploymentIds, status, total })),
4378
+ dispatch(actions.removedDeployment(deploymentId)),
4596
4379
  dispatch(setSnackbar4("The deployment was successfully aborted"))
4597
4380
  ]);
4598
4381
  }).catch((err) => commonErrorHandler(err, "There was an error while aborting the deployment:", dispatch))
4599
4382
  );
4600
- var updateDeploymentControlMap = (0, import_toolkit21.createAsyncThunk)(
4601
- `${sliceName2}/updateDeploymentControlMap`,
4602
- ({ 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))))
4603
4386
  );
4604
- var setDeploymentsState = (0, import_toolkit21.createAsyncThunk)(`${sliceName2}/setDeploymentsState`, (selection, { dispatch, getState }) => {
4387
+ var setDeploymentsState = createAppAsyncThunk(`${sliceName}/setDeploymentsState`, (selection, { dispatch, getState }) => {
4605
4388
  const { page, perPage, ...selectionState } = selection;
4606
4389
  const currentState = getState().deployments.selectionState;
4607
- let nextState = {
4390
+ const nextState = {
4608
4391
  ...currentState,
4609
4392
  ...selectionState,
4610
4393
  ...Object.keys(DEPLOYMENT_STATES).reduce((accu, item) => {
@@ -4619,7 +4402,7 @@ var setDeploymentsState = (0, import_toolkit21.createAsyncThunk)(`${sliceName2}/
4619
4402
  ...selectionState.general
4620
4403
  }
4621
4404
  };
4622
- let tasks = [dispatch(actions2.setDeploymentsState(nextState))];
4405
+ const tasks = [dispatch(actions.setDeploymentsState(nextState))];
4623
4406
  if (nextState.selectedId && currentState.selectedId !== nextState.selectedId) {
4624
4407
  tasks.push(dispatch(getSingleDeployment(nextState.selectedId)));
4625
4408
  }
@@ -4640,34 +4423,32 @@ var mapExternalDeltaConfig = (config = {}) => deltaAttributeMappings.reduce((acc
4640
4423
  }
4641
4424
  return accu;
4642
4425
  }, {});
4643
- var getDeploymentsConfig = (0, import_toolkit21.createAsyncThunk)(
4644
- `${sliceName2}/getDeploymentsConfig`,
4645
- (_, { 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 }) => {
4646
4429
  const oldConfig = getState().deployments.config;
4647
4430
  const { delta = {} } = data;
4648
4431
  const { binary_delta = {}, binary_delta_limits = {} } = delta;
4649
- const { xdelta_args = {}, timeout: timeoutConfig = oldConfig.binaryDelta.timeout } = binary_delta;
4650
- 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;
4651
4434
  const config = {
4652
4435
  ...oldConfig,
4653
4436
  hasDelta: Boolean(delta.enabled),
4654
4437
  binaryDelta: {
4655
4438
  ...oldConfig.binaryDelta,
4656
- timeout: timeoutConfig,
4657
4439
  ...mapExternalDeltaConfig(xdelta_args)
4658
4440
  },
4659
4441
  binaryDeltaLimits: {
4660
4442
  ...oldConfig.binaryDeltaLimits,
4661
- timeout: timeoutLimit,
4662
4443
  ...mapExternalDeltaConfig(xdelta_args_limits)
4663
4444
  }
4664
4445
  };
4665
- return Promise.resolve(dispatch(actions2.setDeploymentsConfig(config)));
4446
+ return Promise.resolve(dispatch(actions.setDeploymentsConfig(config)));
4666
4447
  })
4667
4448
  );
4668
4449
  var deepClean = (source) => Object.entries(source).reduce((accu, [key, value]) => {
4669
4450
  if (value !== void 0) {
4670
- let cleanedValue = typeof value === "object" ? deepClean(value) : value;
4451
+ const cleanedValue = typeof value === "object" ? deepClean(value) : value;
4671
4452
  if (cleanedValue === void 0 || typeof cleanedValue === "object" && (0, import_helpers10.isEmpty)(cleanedValue)) {
4672
4453
  return accu;
4673
4454
  }
@@ -4675,32 +4456,34 @@ var deepClean = (source) => Object.entries(source).reduce((accu, [key, value]) =
4675
4456
  }
4676
4457
  return accu;
4677
4458
  }, void 0);
4678
- var saveDeltaDeploymentsConfig = (0, import_toolkit21.createAsyncThunk)(`${sliceName2}/saveDeltaDeploymentsConfig`, (config, { dispatch, getState }) => {
4679
- const configChange = {
4680
- timeout: config.timeout,
4681
- xdelta_args: deltaAttributeMappings.reduce((accu, { here, there }) => {
4682
- if (config[here] !== void 0) {
4683
- accu[there] = config[here];
4684
- }
4685
- return accu;
4686
- }, {})
4687
- };
4688
- const result = deepClean(configChange);
4689
- if (!result) {
4690
- return Promise.resolve();
4691
- }
4692
- 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(() => {
4693
- const oldConfig = getState().deployments.config;
4694
- const newConfig = {
4695
- ...oldConfig,
4696
- binaryDelta: {
4697
- ...oldConfig.binaryDelta,
4698
- ...config
4699
- }
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
+ }, {})
4700
4469
  };
4701
- return Promise.all([dispatch(actions2.setDeploymentsConfig(newConfig)), dispatch(setSnackbar4("Settings saved successfully"))]);
4702
- });
4703
- });
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
+ );
4704
4487
  // Annotate the CommonJS export names for ESM import in node:
4705
4488
  0 && (module.exports = {
4706
4489
  abortDeployment,