@northern.tech/store 0.2.1 → 0.3.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 (391) hide show
  1. package/dist/actions.cjs +1812 -0
  2. package/dist/actions.cjs.map +1 -0
  3. package/dist/actions.js +18 -1860
  4. package/dist/actions.js.map +1 -1
  5. package/dist/api/general-api.cjs +336 -0
  6. package/dist/api/general-api.cjs.map +1 -0
  7. package/dist/api/general-api.js +15 -1051
  8. package/dist/api/general-api.js.map +1 -1
  9. package/dist/api/users-api.cjs +342 -0
  10. package/dist/api/users-api.cjs.map +1 -0
  11. package/dist/api/users-api.js +12 -1062
  12. package/dist/api/users-api.js.map +1 -1
  13. package/dist/appSlice/constants.cjs +207 -0
  14. package/dist/appSlice/constants.cjs.map +1 -0
  15. package/dist/appSlice/{constants.d.mts → constants.d.cts} +12 -1
  16. package/dist/appSlice/constants.d.ts +12 -1
  17. package/dist/appSlice/constants.js +39 -181
  18. package/dist/appSlice/constants.js.map +1 -1
  19. package/dist/appSlice/index.cjs +393 -0
  20. package/dist/appSlice/index.cjs.map +1 -0
  21. package/dist/appSlice/index.js +18 -1112
  22. package/dist/appSlice/index.js.map +1 -1
  23. package/dist/appSlice/selectors.cjs +58 -0
  24. package/dist/appSlice/selectors.cjs.map +1 -0
  25. package/dist/appSlice/selectors.js +17 -46
  26. package/dist/appSlice/selectors.js.map +1 -1
  27. package/dist/appSlice/thunks.cjs +4670 -0
  28. package/dist/appSlice/thunks.cjs.map +1 -0
  29. package/dist/appSlice/thunks.js +42 -5750
  30. package/dist/appSlice/thunks.js.map +1 -1
  31. package/dist/auth.cjs +320 -0
  32. package/dist/auth.cjs.map +1 -0
  33. package/dist/auth.js +20 -1031
  34. package/dist/auth.js.map +1 -1
  35. package/dist/{chunk-5VNQCCAQ.mjs → chunk-25AKG5HH.js} +5 -2
  36. package/dist/chunk-25AKG5HH.js.map +1 -0
  37. package/dist/{chunk-QQBUNZHA.mjs → chunk-4B3IMP4I.js} +17 -12
  38. package/dist/{chunk-QQBUNZHA.mjs.map → chunk-4B3IMP4I.js.map} +1 -1
  39. package/dist/{chunk-3ORTTLIB.mjs → chunk-7PVGDMNM.js} +2 -2
  40. package/dist/{chunk-IFWKT27G.mjs → chunk-A6CT6GTI.js} +3 -3
  41. package/dist/{chunk-ZK4W5T53.mjs → chunk-AMGWP7A4.js} +2 -2
  42. package/dist/{chunk-G4FGNSV3.mjs → chunk-CK6YE6AN.js} +1 -1
  43. package/dist/{chunk-4SDUITD4.mjs → chunk-CYV6632F.js} +2 -2
  44. package/dist/{chunk-KJAZNKV2.mjs → chunk-DGD6FVWF.js} +29 -29
  45. package/dist/{chunk-DIZJVB6M.mjs → chunk-DQ4ZLUIU.js} +75 -431
  46. package/dist/chunk-DQ4ZLUIU.js.map +1 -0
  47. package/dist/{chunk-JA27QXVB.mjs → chunk-E5LEU5PF.js} +3 -3
  48. package/dist/{chunk-B42NUKMZ.mjs → chunk-FGKMJS3B.js} +1 -1
  49. package/dist/{chunk-NJNSCJEY.mjs → chunk-GZ5VQMDM.js} +18 -21
  50. package/dist/chunk-GZ5VQMDM.js.map +1 -0
  51. package/dist/{chunk-O6TYYKSD.mjs → chunk-H6DUEJFF.js} +20 -70
  52. package/dist/chunk-H6DUEJFF.js.map +1 -0
  53. package/dist/{chunk-WYHJFSMQ.mjs → chunk-JAROCU6M.js} +3 -3
  54. package/dist/{chunk-QBKCUIWO.mjs → chunk-JIS4PA3R.js} +1 -1
  55. package/dist/{chunk-XD7INCM4.mjs → chunk-KAQJH2YL.js} +4 -4
  56. package/dist/{chunk-2Z3RFYW4.mjs → chunk-LIJIIRON.js} +1 -1
  57. package/dist/{chunk-IU4OXOPA.mjs → chunk-MRCFLG45.js} +1 -1
  58. package/dist/chunk-NMAXZ3ZY.js +1 -0
  59. package/dist/{chunk-K2NZL5V4.mjs → chunk-Q6M5TTDQ.js} +2 -2
  60. package/dist/{chunk-CHUCIHMY.mjs → chunk-RX55KAKX.js} +2 -2
  61. package/dist/{chunk-ZE7R2XXE.mjs → chunk-UEP36GCI.js} +3 -3
  62. package/dist/{chunk-WCUGLHYM.mjs → chunk-UVQX743T.js} +13 -13
  63. package/dist/{chunk-H5UCKQWK.mjs → chunk-V4DKKRWS.js} +14 -14
  64. package/dist/{chunk-XC5UXEIB.mjs → chunk-VOCOFE4I.js} +2 -2
  65. package/dist/{chunk-R7LXL3KJ.mjs → chunk-XTRPX7JZ.js} +3 -3
  66. package/dist/{chunk-6CSGHZ3E.mjs → chunk-XXHONFSQ.js} +3 -3
  67. package/dist/{chunk-KPPU6OWF.mjs → chunk-YETZPQFR.js} +4 -19
  68. package/dist/chunk-YETZPQFR.js.map +1 -0
  69. package/dist/{chunk-KZSTW27Q.mjs → chunk-YGBFDXXA.js} +2 -2
  70. package/dist/{chunk-H2PQQMRY.mjs → chunk-YO22XLHI.js} +1 -1
  71. package/dist/{chunk-65YIOCCD.mjs → chunk-YT73QWCN.js} +3 -3
  72. package/dist/{chunk-AZRVRNXT.mjs → chunk-YTQUNAZP.js} +3 -3
  73. package/dist/commonConstants.cjs +285 -0
  74. package/dist/commonConstants.cjs.map +1 -0
  75. package/dist/{commonConstants.d.mts → commonConstants.d.cts} +3 -3
  76. package/dist/commonConstants.d.ts +3 -3
  77. package/dist/commonConstants.js +37 -268
  78. package/dist/commonConstants.js.map +1 -1
  79. package/dist/commonSelectors.cjs +1487 -0
  80. package/dist/commonSelectors.cjs.map +1 -0
  81. package/dist/commonSelectors.js +53 -1500
  82. package/dist/commonSelectors.js.map +1 -1
  83. package/dist/constants.cjs +1297 -0
  84. package/dist/constants.cjs.map +1 -0
  85. package/dist/{constants.d.mts → constants.d.cts} +10 -10
  86. package/dist/constants.d.ts +1 -1
  87. package/dist/constants.js +220 -1189
  88. package/dist/constants.js.map +1 -1
  89. package/dist/deploymentdevicehook.cjs +4686 -0
  90. package/dist/deploymentdevicehook.cjs.map +1 -0
  91. package/dist/deploymentdevicehook.d.cts +3 -0
  92. package/dist/deploymentdevicehook.d.ts +3 -0
  93. package/dist/deploymentdevicehook.js +60 -0
  94. package/dist/deploymentdevicehook.js.map +1 -0
  95. package/dist/deploymentsSlice/constants.cjs +562 -0
  96. package/dist/deploymentsSlice/constants.cjs.map +1 -0
  97. package/dist/deploymentsSlice/constants.js +39 -1006
  98. package/dist/deploymentsSlice/constants.js.map +1 -1
  99. package/dist/deploymentsSlice/index.cjs +648 -0
  100. package/dist/deploymentsSlice/index.cjs.map +1 -0
  101. package/dist/deploymentsSlice/index.js +18 -1104
  102. package/dist/deploymentsSlice/index.js.map +1 -1
  103. package/dist/deploymentsSlice/selectors.cjs +561 -0
  104. package/dist/deploymentsSlice/selectors.cjs.map +1 -0
  105. package/dist/deploymentsSlice/selectors.js +22 -1014
  106. package/dist/deploymentsSlice/selectors.js.map +1 -1
  107. package/dist/deploymentsSlice/thunks.cjs +4686 -0
  108. package/dist/deploymentsSlice/thunks.cjs.map +1 -0
  109. package/dist/deploymentsSlice/thunks.js +60 -5757
  110. package/dist/deploymentsSlice/thunks.js.map +1 -1
  111. package/dist/devicesSlice/constants.cjs +435 -0
  112. package/dist/devicesSlice/constants.cjs.map +1 -0
  113. package/dist/devicesSlice/constants.js +37 -1007
  114. package/dist/devicesSlice/constants.js.map +1 -1
  115. package/dist/devicesSlice/index.cjs +586 -0
  116. package/dist/devicesSlice/index.cjs.map +1 -0
  117. package/dist/devicesSlice/index.js +18 -1161
  118. package/dist/devicesSlice/index.js.map +1 -1
  119. package/dist/devicesSlice/selectors.cjs +531 -0
  120. package/dist/devicesSlice/selectors.cjs.map +1 -0
  121. package/dist/devicesSlice/selectors.js +50 -1097
  122. package/dist/devicesSlice/selectors.js.map +1 -1
  123. package/dist/devicesSlice/thunks.cjs +4758 -0
  124. package/dist/devicesSlice/thunks.cjs.map +1 -0
  125. package/dist/devicesSlice/thunks.js +132 -5793
  126. package/dist/devicesSlice/thunks.js.map +1 -1
  127. package/dist/monitorSlice/constants.cjs +165 -0
  128. package/dist/monitorSlice/constants.cjs.map +1 -0
  129. package/dist/monitorSlice/constants.js +11 -970
  130. package/dist/monitorSlice/constants.js.map +1 -1
  131. package/dist/monitorSlice/index.cjs +435 -0
  132. package/dist/monitorSlice/index.cjs.map +1 -0
  133. package/dist/monitorSlice/index.js +18 -1022
  134. package/dist/monitorSlice/index.js.map +1 -1
  135. package/dist/monitorSlice/selectors.cjs +31 -0
  136. package/dist/monitorSlice/selectors.cjs.map +1 -0
  137. package/dist/monitorSlice/selectors.js +5 -25
  138. package/dist/monitorSlice/selectors.js.map +1 -1
  139. package/dist/monitorSlice/thunks.cjs +2623 -0
  140. package/dist/monitorSlice/thunks.cjs.map +1 -0
  141. package/dist/monitorSlice/thunks.js +41 -2624
  142. package/dist/monitorSlice/thunks.js.map +1 -1
  143. package/dist/onboardingSlice/constants.cjs +71 -0
  144. package/dist/onboardingSlice/constants.cjs.map +1 -0
  145. package/dist/onboardingSlice/constants.js +7 -64
  146. package/dist/onboardingSlice/constants.js.map +1 -1
  147. package/dist/onboardingSlice/index.cjs +80 -0
  148. package/dist/onboardingSlice/index.cjs.map +1 -0
  149. package/dist/onboardingSlice/index.js +13 -71
  150. package/dist/onboardingSlice/index.js.map +1 -1
  151. package/dist/onboardingSlice/selectors.cjs +31 -0
  152. package/dist/onboardingSlice/selectors.cjs.map +1 -0
  153. package/dist/onboardingSlice/selectors.js +5 -25
  154. package/dist/onboardingSlice/selectors.js.map +1 -1
  155. package/dist/onboardingSlice/thunks.cjs +4774 -0
  156. package/dist/onboardingSlice/thunks.cjs.map +1 -0
  157. package/dist/onboardingSlice/thunks.js +48 -5753
  158. package/dist/onboardingSlice/thunks.js.map +1 -1
  159. package/dist/organizationSlice/constants.cjs +830 -0
  160. package/dist/organizationSlice/constants.cjs.map +1 -0
  161. package/dist/organizationSlice/constants.js +33 -1014
  162. package/dist/organizationSlice/constants.js.map +1 -1
  163. package/dist/organizationSlice/index.cjs +505 -0
  164. package/dist/organizationSlice/index.cjs.map +1 -0
  165. package/dist/organizationSlice/index.js +18 -1067
  166. package/dist/organizationSlice/index.js.map +1 -1
  167. package/dist/organizationSlice/selectors.cjs +300 -0
  168. package/dist/organizationSlice/selectors.cjs.map +1 -0
  169. package/dist/organizationSlice/selectors.js +36 -1013
  170. package/dist/organizationSlice/selectors.js.map +1 -1
  171. package/dist/organizationSlice/thunks.cjs +5006 -0
  172. package/dist/organizationSlice/thunks.cjs.map +1 -0
  173. package/dist/organizationSlice/thunks.js +98 -5776
  174. package/dist/organizationSlice/thunks.js.map +1 -1
  175. package/dist/releasesSlice/constants.cjs +40 -0
  176. package/dist/releasesSlice/constants.cjs.map +1 -0
  177. package/dist/releasesSlice/constants.js +11 -31
  178. package/dist/releasesSlice/constants.js.map +1 -1
  179. package/dist/releasesSlice/index.cjs +355 -0
  180. package/dist/releasesSlice/index.cjs.map +1 -0
  181. package/dist/releasesSlice/index.js +18 -1070
  182. package/dist/releasesSlice/index.js.map +1 -1
  183. package/dist/releasesSlice/selectors.cjs +290 -0
  184. package/dist/releasesSlice/selectors.cjs.map +1 -0
  185. package/dist/releasesSlice/selectors.js +25 -1009
  186. package/dist/releasesSlice/selectors.js.map +1 -1
  187. package/dist/releasesSlice/thunks.cjs +2896 -0
  188. package/dist/releasesSlice/thunks.cjs.map +1 -0
  189. package/dist/releasesSlice/thunks.js +63 -2931
  190. package/dist/releasesSlice/thunks.js.map +1 -1
  191. package/dist/selectors.cjs +1641 -0
  192. package/dist/selectors.cjs.map +1 -0
  193. package/dist/{selectors.d.mts → selectors.d.cts} +9 -9
  194. package/dist/selectors.js +206 -1582
  195. package/dist/selectors.js.map +1 -1
  196. package/dist/store.cjs +1932 -0
  197. package/dist/store.cjs.map +1 -0
  198. package/dist/store.js +28 -1980
  199. package/dist/store.js.map +1 -1
  200. package/dist/storehooks.cjs +5565 -0
  201. package/dist/storehooks.cjs.map +1 -0
  202. package/dist/storehooks.js +122 -5802
  203. package/dist/storehooks.js.map +1 -1
  204. package/dist/thunks.cjs +5675 -0
  205. package/dist/thunks.cjs.map +1 -0
  206. package/dist/{thunks.d.mts → thunks.d.cts} +8 -8
  207. package/dist/thunks.js +360 -5910
  208. package/dist/thunks.js.map +1 -1
  209. package/dist/usersSlice/constants.cjs +798 -0
  210. package/dist/usersSlice/constants.cjs.map +1 -0
  211. package/dist/usersSlice/constants.js +42 -1001
  212. package/dist/usersSlice/constants.js.map +1 -1
  213. package/dist/usersSlice/index.cjs +890 -0
  214. package/dist/usersSlice/index.cjs.map +1 -0
  215. package/dist/usersSlice/index.js +18 -1107
  216. package/dist/usersSlice/index.js.map +1 -1
  217. package/dist/usersSlice/selectors.cjs +826 -0
  218. package/dist/usersSlice/selectors.cjs.map +1 -0
  219. package/dist/usersSlice/selectors.js +35 -1034
  220. package/dist/usersSlice/selectors.js.map +1 -1
  221. package/dist/usersSlice/thunks.cjs +4732 -0
  222. package/dist/usersSlice/thunks.cjs.map +1 -0
  223. package/dist/usersSlice/thunks.js +106 -5780
  224. package/dist/usersSlice/thunks.js.map +1 -1
  225. package/dist/utils.cjs +739 -0
  226. package/dist/utils.cjs.map +1 -0
  227. package/dist/{utils.d.mts → utils.d.cts} +1 -3
  228. package/dist/utils.d.ts +1 -3
  229. package/dist/utils.js +42 -1186
  230. package/dist/utils.js.map +1 -1
  231. package/package.json +71 -47
  232. package/dist/actions.mjs +0 -21
  233. package/dist/api/general-api.mjs +0 -18
  234. package/dist/api/general-api.mjs.map +0 -1
  235. package/dist/api/users-api.mjs +0 -15
  236. package/dist/api/users-api.mjs.map +0 -1
  237. package/dist/appSlice/constants.mjs +0 -42
  238. package/dist/appSlice/constants.mjs.map +0 -1
  239. package/dist/appSlice/index.mjs +0 -21
  240. package/dist/appSlice/index.mjs.map +0 -1
  241. package/dist/appSlice/selectors.mjs +0 -20
  242. package/dist/appSlice/selectors.mjs.map +0 -1
  243. package/dist/appSlice/thunks.mjs +0 -45
  244. package/dist/appSlice/thunks.mjs.map +0 -1
  245. package/dist/auth.mjs +0 -23
  246. package/dist/auth.mjs.map +0 -1
  247. package/dist/chunk-5VNQCCAQ.mjs.map +0 -1
  248. package/dist/chunk-DIZJVB6M.mjs.map +0 -1
  249. package/dist/chunk-KPPU6OWF.mjs.map +0 -1
  250. package/dist/chunk-LZOMFHX3.mjs +0 -38
  251. package/dist/chunk-LZOMFHX3.mjs.map +0 -1
  252. package/dist/chunk-NJNSCJEY.mjs.map +0 -1
  253. package/dist/chunk-O6TYYKSD.mjs.map +0 -1
  254. package/dist/chunk-V32GTKOS.mjs +0 -1
  255. package/dist/chunk-V32GTKOS.mjs.map +0 -1
  256. package/dist/commonConstants.mjs +0 -40
  257. package/dist/commonConstants.mjs.map +0 -1
  258. package/dist/commonSelectors.mjs +0 -56
  259. package/dist/commonSelectors.mjs.map +0 -1
  260. package/dist/constants.mjs +0 -223
  261. package/dist/constants.mjs.map +0 -1
  262. package/dist/deploymentsSlice/constants.mjs +0 -42
  263. package/dist/deploymentsSlice/constants.mjs.map +0 -1
  264. package/dist/deploymentsSlice/index.mjs +0 -21
  265. package/dist/deploymentsSlice/index.mjs.map +0 -1
  266. package/dist/deploymentsSlice/selectors.mjs +0 -25
  267. package/dist/deploymentsSlice/selectors.mjs.map +0 -1
  268. package/dist/deploymentsSlice/thunks.mjs +0 -63
  269. package/dist/deploymentsSlice/thunks.mjs.map +0 -1
  270. package/dist/devicesSlice/constants.mjs +0 -40
  271. package/dist/devicesSlice/constants.mjs.map +0 -1
  272. package/dist/devicesSlice/index.mjs +0 -21
  273. package/dist/devicesSlice/index.mjs.map +0 -1
  274. package/dist/devicesSlice/selectors.mjs +0 -53
  275. package/dist/devicesSlice/selectors.mjs.map +0 -1
  276. package/dist/devicesSlice/thunks.mjs +0 -135
  277. package/dist/devicesSlice/thunks.mjs.map +0 -1
  278. package/dist/monitorSlice/constants.mjs +0 -14
  279. package/dist/monitorSlice/constants.mjs.map +0 -1
  280. package/dist/monitorSlice/index.mjs +0 -21
  281. package/dist/monitorSlice/index.mjs.map +0 -1
  282. package/dist/monitorSlice/selectors.mjs +0 -8
  283. package/dist/monitorSlice/selectors.mjs.map +0 -1
  284. package/dist/monitorSlice/thunks.mjs +0 -44
  285. package/dist/monitorSlice/thunks.mjs.map +0 -1
  286. package/dist/onboardingSlice/constants.mjs +0 -10
  287. package/dist/onboardingSlice/constants.mjs.map +0 -1
  288. package/dist/onboardingSlice/index.mjs +0 -16
  289. package/dist/onboardingSlice/index.mjs.map +0 -1
  290. package/dist/onboardingSlice/selectors.mjs +0 -8
  291. package/dist/onboardingSlice/selectors.mjs.map +0 -1
  292. package/dist/onboardingSlice/thunks.mjs +0 -51
  293. package/dist/onboardingSlice/thunks.mjs.map +0 -1
  294. package/dist/organizationSlice/constants.mjs +0 -36
  295. package/dist/organizationSlice/constants.mjs.map +0 -1
  296. package/dist/organizationSlice/index.mjs +0 -21
  297. package/dist/organizationSlice/index.mjs.map +0 -1
  298. package/dist/organizationSlice/selectors.mjs +0 -39
  299. package/dist/organizationSlice/selectors.mjs.map +0 -1
  300. package/dist/organizationSlice/thunks.mjs +0 -101
  301. package/dist/organizationSlice/thunks.mjs.map +0 -1
  302. package/dist/releasesSlice/constants.mjs +0 -14
  303. package/dist/releasesSlice/constants.mjs.map +0 -1
  304. package/dist/releasesSlice/index.mjs +0 -21
  305. package/dist/releasesSlice/index.mjs.map +0 -1
  306. package/dist/releasesSlice/selectors.mjs +0 -28
  307. package/dist/releasesSlice/selectors.mjs.map +0 -1
  308. package/dist/releasesSlice/thunks.mjs +0 -66
  309. package/dist/releasesSlice/thunks.mjs.map +0 -1
  310. package/dist/selectors.mjs +0 -209
  311. package/dist/selectors.mjs.map +0 -1
  312. package/dist/store.mjs +0 -32
  313. package/dist/store.mjs.map +0 -1
  314. package/dist/storehooks.mjs +0 -282
  315. package/dist/storehooks.mjs.map +0 -1
  316. package/dist/thunks.mjs +0 -363
  317. package/dist/thunks.mjs.map +0 -1
  318. package/dist/usersSlice/constants.mjs +0 -45
  319. package/dist/usersSlice/constants.mjs.map +0 -1
  320. package/dist/usersSlice/index.mjs +0 -21
  321. package/dist/usersSlice/index.mjs.map +0 -1
  322. package/dist/usersSlice/selectors.mjs +0 -38
  323. package/dist/usersSlice/selectors.mjs.map +0 -1
  324. package/dist/usersSlice/thunks.mjs +0 -109
  325. package/dist/usersSlice/thunks.mjs.map +0 -1
  326. package/dist/utils.mjs +0 -49
  327. package/dist/utils.mjs.map +0 -1
  328. /package/dist/{actions.d.mts → actions.d.cts} +0 -0
  329. /package/dist/api/{general-api.d.mts → general-api.d.cts} +0 -0
  330. /package/dist/api/{users-api.d.mts → users-api.d.cts} +0 -0
  331. /package/dist/appSlice/{index.d.mts → index.d.cts} +0 -0
  332. /package/dist/appSlice/{selectors.d.mts → selectors.d.cts} +0 -0
  333. /package/dist/appSlice/{thunks.d.mts → thunks.d.cts} +0 -0
  334. /package/dist/{auth.d.mts → auth.d.cts} +0 -0
  335. /package/dist/{chunk-3ORTTLIB.mjs.map → chunk-7PVGDMNM.js.map} +0 -0
  336. /package/dist/{chunk-IFWKT27G.mjs.map → chunk-A6CT6GTI.js.map} +0 -0
  337. /package/dist/{chunk-ZK4W5T53.mjs.map → chunk-AMGWP7A4.js.map} +0 -0
  338. /package/dist/{chunk-G4FGNSV3.mjs.map → chunk-CK6YE6AN.js.map} +0 -0
  339. /package/dist/{chunk-4SDUITD4.mjs.map → chunk-CYV6632F.js.map} +0 -0
  340. /package/dist/{chunk-KJAZNKV2.mjs.map → chunk-DGD6FVWF.js.map} +0 -0
  341. /package/dist/{chunk-JA27QXVB.mjs.map → chunk-E5LEU5PF.js.map} +0 -0
  342. /package/dist/{chunk-B42NUKMZ.mjs.map → chunk-FGKMJS3B.js.map} +0 -0
  343. /package/dist/{chunk-WYHJFSMQ.mjs.map → chunk-JAROCU6M.js.map} +0 -0
  344. /package/dist/{chunk-QBKCUIWO.mjs.map → chunk-JIS4PA3R.js.map} +0 -0
  345. /package/dist/{chunk-XD7INCM4.mjs.map → chunk-KAQJH2YL.js.map} +0 -0
  346. /package/dist/{chunk-2Z3RFYW4.mjs.map → chunk-LIJIIRON.js.map} +0 -0
  347. /package/dist/{chunk-IU4OXOPA.mjs.map → chunk-MRCFLG45.js.map} +0 -0
  348. /package/dist/{actions.mjs.map → chunk-NMAXZ3ZY.js.map} +0 -0
  349. /package/dist/{chunk-K2NZL5V4.mjs.map → chunk-Q6M5TTDQ.js.map} +0 -0
  350. /package/dist/{chunk-CHUCIHMY.mjs.map → chunk-RX55KAKX.js.map} +0 -0
  351. /package/dist/{chunk-ZE7R2XXE.mjs.map → chunk-UEP36GCI.js.map} +0 -0
  352. /package/dist/{chunk-WCUGLHYM.mjs.map → chunk-UVQX743T.js.map} +0 -0
  353. /package/dist/{chunk-H5UCKQWK.mjs.map → chunk-V4DKKRWS.js.map} +0 -0
  354. /package/dist/{chunk-XC5UXEIB.mjs.map → chunk-VOCOFE4I.js.map} +0 -0
  355. /package/dist/{chunk-R7LXL3KJ.mjs.map → chunk-XTRPX7JZ.js.map} +0 -0
  356. /package/dist/{chunk-6CSGHZ3E.mjs.map → chunk-XXHONFSQ.js.map} +0 -0
  357. /package/dist/{chunk-KZSTW27Q.mjs.map → chunk-YGBFDXXA.js.map} +0 -0
  358. /package/dist/{chunk-H2PQQMRY.mjs.map → chunk-YO22XLHI.js.map} +0 -0
  359. /package/dist/{chunk-65YIOCCD.mjs.map → chunk-YT73QWCN.js.map} +0 -0
  360. /package/dist/{chunk-AZRVRNXT.mjs.map → chunk-YTQUNAZP.js.map} +0 -0
  361. /package/dist/{commonSelectors.d.mts → commonSelectors.d.cts} +0 -0
  362. /package/dist/deploymentsSlice/{constants.d.mts → constants.d.cts} +0 -0
  363. /package/dist/deploymentsSlice/{index.d.mts → index.d.cts} +0 -0
  364. /package/dist/deploymentsSlice/{selectors.d.mts → selectors.d.cts} +0 -0
  365. /package/dist/deploymentsSlice/{thunks.d.mts → thunks.d.cts} +0 -0
  366. /package/dist/devicesSlice/{constants.d.mts → constants.d.cts} +0 -0
  367. /package/dist/devicesSlice/{index.d.mts → index.d.cts} +0 -0
  368. /package/dist/devicesSlice/{selectors.d.mts → selectors.d.cts} +0 -0
  369. /package/dist/devicesSlice/{thunks.d.mts → thunks.d.cts} +0 -0
  370. /package/dist/monitorSlice/{constants.d.mts → constants.d.cts} +0 -0
  371. /package/dist/monitorSlice/{index.d.mts → index.d.cts} +0 -0
  372. /package/dist/monitorSlice/{selectors.d.mts → selectors.d.cts} +0 -0
  373. /package/dist/monitorSlice/{thunks.d.mts → thunks.d.cts} +0 -0
  374. /package/dist/onboardingSlice/{constants.d.mts → constants.d.cts} +0 -0
  375. /package/dist/onboardingSlice/{index.d.mts → index.d.cts} +0 -0
  376. /package/dist/onboardingSlice/{selectors.d.mts → selectors.d.cts} +0 -0
  377. /package/dist/onboardingSlice/{thunks.d.mts → thunks.d.cts} +0 -0
  378. /package/dist/organizationSlice/{constants.d.mts → constants.d.cts} +0 -0
  379. /package/dist/organizationSlice/{index.d.mts → index.d.cts} +0 -0
  380. /package/dist/organizationSlice/{selectors.d.mts → selectors.d.cts} +0 -0
  381. /package/dist/organizationSlice/{thunks.d.mts → thunks.d.cts} +0 -0
  382. /package/dist/releasesSlice/{constants.d.mts → constants.d.cts} +0 -0
  383. /package/dist/releasesSlice/{index.d.mts → index.d.cts} +0 -0
  384. /package/dist/releasesSlice/{selectors.d.mts → selectors.d.cts} +0 -0
  385. /package/dist/releasesSlice/{thunks.d.mts → thunks.d.cts} +0 -0
  386. /package/dist/{store.d.mts → store.d.cts} +0 -0
  387. /package/dist/{storehooks.d.mts → storehooks.d.cts} +0 -0
  388. /package/dist/usersSlice/{constants.d.mts → constants.d.cts} +0 -0
  389. /package/dist/usersSlice/{index.d.mts → index.d.cts} +0 -0
  390. /package/dist/usersSlice/{selectors.d.mts → selectors.d.cts} +0 -0
  391. /package/dist/usersSlice/{thunks.d.mts → thunks.d.cts} +0 -0
@@ -0,0 +1,2896 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/releasesSlice/thunks.ts
31
+ var thunks_exports = {};
32
+ __export(thunks_exports, {
33
+ cancelFileUpload: () => cancelFileUpload,
34
+ createArtifact: () => createArtifact,
35
+ editArtifact: () => editArtifact,
36
+ getArtifactInstallCount: () => getArtifactInstallCount,
37
+ getArtifactUrl: () => getArtifactUrl,
38
+ getExistingReleaseTags: () => getExistingReleaseTags,
39
+ getRelease: () => getRelease,
40
+ getReleases: () => getReleases,
41
+ getUpdateTypes: () => getUpdateTypes,
42
+ removeArtifact: () => removeArtifact,
43
+ removeRelease: () => removeRelease,
44
+ selectRelease: () => selectRelease,
45
+ setReleaseTags: () => setReleaseTags,
46
+ setReleasesListState: () => setReleasesListState,
47
+ updateReleaseInfo: () => updateReleaseInfo,
48
+ uploadArtifact: () => uploadArtifact
49
+ });
50
+ module.exports = __toCommonJS(thunks_exports);
51
+
52
+ // src/appSlice/constants.ts
53
+ var import_icons_material = require("@mui/icons-material");
54
+ var startingDeviceCount = {
55
+ os: "for first 50 devices",
56
+ professional: "for first 250 devices"
57
+ };
58
+ var apiRoot = "/api/management";
59
+ var apiUrl = {
60
+ v1: `${apiRoot}/v1`,
61
+ v2: `${apiRoot}/v2`
62
+ };
63
+ var headerNames = {
64
+ link: "link",
65
+ location: "location",
66
+ total: "x-total-count"
67
+ };
68
+ var chartTypes = {
69
+ bar: { key: "bar", Icon: import_icons_material.BarChart },
70
+ pie: { key: "pie", Icon: import_icons_material.PieChartOutline }
71
+ };
72
+ var emptyChartSelection = { software: "", group: "", chartType: chartTypes.bar.key, attribute: "artifact_name" };
73
+ var defaultReportType = "distribution";
74
+ var defaultReports = [{ ...emptyChartSelection, group: null, attribute: "artifact_name", type: defaultReportType }];
75
+ var PLANS = {
76
+ os: {
77
+ id: "os",
78
+ name: "Basic",
79
+ offer: true,
80
+ price: "$32/month",
81
+ deviceCount: startingDeviceCount.os,
82
+ offerprice: "$23/month for first 50 devices",
83
+ price2: "for first 6 months;\n$29/month thereafter",
84
+ features: ["Basic OTA features"]
85
+ },
86
+ professional: {
87
+ id: "professional",
88
+ name: "Professional",
89
+ offer: true,
90
+ price: "$269/month",
91
+ deviceCount: startingDeviceCount.professional,
92
+ offerprice: "$200/month for first 50 devices",
93
+ price2: "for first 6 months;\n$249/month thereafter",
94
+ features: ["+ Advanced OTA features", "+ Standard support"]
95
+ },
96
+ enterprise: {
97
+ id: "enterprise",
98
+ name: "Enterprise",
99
+ price: "Custom pricing",
100
+ deviceCount: "unlimited devices",
101
+ features: ["+ Enterprise-grade OTA features", "+ Premium support"]
102
+ }
103
+ };
104
+ var ADDONS = {
105
+ configure: {
106
+ id: "configure",
107
+ title: "Configure",
108
+ description: "Expand your plan with device configuration features",
109
+ needs: ["hasDeviceConfig"],
110
+ os: {
111
+ price: "$11/month",
112
+ deviceCount: startingDeviceCount.os
113
+ },
114
+ professional: {
115
+ price: "$65/month",
116
+ deviceCount: startingDeviceCount.professional
117
+ },
118
+ eligible: ["os", "professional", "enterprise"]
119
+ },
120
+ troubleshoot: {
121
+ id: "troubleshoot",
122
+ title: "Troubleshoot",
123
+ description: "Expand your plan with device troubleshooting features",
124
+ needs: ["hasDeviceConnect"],
125
+ os: {
126
+ price: "$27/month",
127
+ deviceCount: startingDeviceCount.os
128
+ },
129
+ professional: {
130
+ price: "$72/month",
131
+ deviceCount: startingDeviceCount.professional
132
+ },
133
+ eligible: ["os", "professional", "enterprise"]
134
+ },
135
+ monitor: {
136
+ id: "monitor",
137
+ title: "Monitor",
138
+ description: "Expand your plan with device monitoring features",
139
+ needs: ["hasMonitor"],
140
+ os: {
141
+ price: "-",
142
+ deviceCount: "-"
143
+ },
144
+ professional: {
145
+ price: "$86/month",
146
+ deviceCount: startingDeviceCount.professional
147
+ },
148
+ eligible: ["professional", "enterprise"]
149
+ }
150
+ };
151
+ var BENEFITS = {
152
+ auditlog: { id: "auditlog", benefit: "trace change across your devices and access troubleshooting session replay", requiredPlan: PLANS.professional.id },
153
+ dashboard: { id: "dashboard", benefit: "actionable insights into the devices you are updating with Mender", requiredPlan: PLANS.enterprise.id },
154
+ deltaGeneration: {
155
+ id: "deltaGeneration",
156
+ benefit: "automatic delta artifacts generation to minimize data transfer and improve the update delivery",
157
+ requiredPlan: PLANS.enterprise.id
158
+ },
159
+ deviceConfiguration: { id: "deviceConfiguration", benefit: "device configuration features", requiredAddon: ADDONS.configure.id },
160
+ deviceMonitor: { id: "deviceMonitor", benefit: "device monitoring features", requiredAddon: ADDONS.monitor.id, requiredPlan: PLANS.professional.id },
161
+ deviceTroubleshoot: { id: "deviceTroubleshoot", benefit: "device troubleshooting features", requiredAddon: ADDONS.troubleshoot.id },
162
+ dynamicGroups: { id: "dynamicGroups", benefit: "create dynamic groups to ease device management", requiredPlan: PLANS.enterprise.id },
163
+ fullFiltering: { id: "fullFiltering", benefit: "filtering by multiple attributes to improve the device overview", requiredPlan: PLANS.professional.id },
164
+ gateway: { id: "gateway", benefit: "see devices connected to your gateway device for easy access", requiredPlans: PLANS.professional.id },
165
+ pausedDeployments: {
166
+ id: "pausedDeployments",
167
+ benefit: "granular control about update rollout to allow synchronization across your fleet",
168
+ requiredPlan: PLANS.enterprise.id
169
+ },
170
+ phasedDeployments: { id: "phasedDeployments", benefit: "choose to roll out deployments in multiple phases", requiredPlan: PLANS.enterprise.id },
171
+ rbac: { id: "rbac", benefit: "granular role based access control", requiredPlan: PLANS.enterprise.id },
172
+ retryDeployments: { id: "retryDeployments", benefit: "optional retries for failed rollout attempts", requiredPlan: PLANS.professional.id },
173
+ scheduledDeployments: {
174
+ id: "scheduledDeployments",
175
+ benefit: "scheduled deployments to steer the distribution of your updates.",
176
+ requiredPlan: PLANS.professional.id
177
+ },
178
+ webhookEvents: {
179
+ id: "webhookEvents",
180
+ benefit: "receive inventory events and select which type(s) of events the webhook will receive",
181
+ requiredPlan: PLANS.professional.id
182
+ },
183
+ default: { id: "default", benefit: "gain access to this feature", requiredPlan: PLANS.enterprise.id }
184
+ };
185
+ var DARK_MODE = "dark";
186
+
187
+ // src/commonConstants.tsx
188
+ var import_js = require("@mdi/js");
189
+ var import_jsx_runtime = require("react/jsx-runtime");
190
+ var DEVICE_LIST_DEFAULTS = {
191
+ page: 1,
192
+ perPage: 20
193
+ };
194
+ var timeUnits = {
195
+ days: "days",
196
+ minutes: "minutes",
197
+ hours: "hours"
198
+ };
199
+ var ALL_DEVICES = "All devices";
200
+ var UNGROUPED_GROUP = { id: "*|=ungrouped=|*", name: "Unassigned" };
201
+ var DEVICE_LIST_MAXIMUM_LENGTH = 50;
202
+ var DEVICE_FILTERING_OPTIONS = {
203
+ $eq: { key: "$eq", title: "equals", shortform: "=" },
204
+ $ne: { key: "$ne", title: "not equal", shortform: "!=" },
205
+ $gt: {
206
+ key: "$gt",
207
+ title: ">",
208
+ shortform: ">",
209
+ 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.'
210
+ },
211
+ $gte: {
212
+ title: ">=",
213
+ shortform: ">=",
214
+ 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.'
215
+ },
216
+ $lt: {
217
+ key: "$lt",
218
+ title: "<",
219
+ shortform: "<",
220
+ 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.'
221
+ },
222
+ $lte: {
223
+ title: "<=",
224
+ shortform: "<=",
225
+ 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.'
226
+ },
227
+ $ltne: {
228
+ key: "$ltne",
229
+ title: "$ltne",
230
+ shortform: "ltne",
231
+ 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.'
232
+ },
233
+ $in: {
234
+ key: "$in",
235
+ title: "in",
236
+ shortform: "in",
237
+ 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.'
238
+ },
239
+ $nin: {
240
+ key: "$nin",
241
+ title: "not in",
242
+ shortform: "not in",
243
+ 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.`
244
+ },
245
+ $exists: {
246
+ key: "$exists",
247
+ title: "exists",
248
+ shortform: "exists",
249
+ value: true,
250
+ help: `The "exists" operator matches if the selected field's value has a value. No value needs to be provided for this operator.`
251
+ },
252
+ $nexists: {
253
+ key: "$nexists",
254
+ title: `doesn't exist`,
255
+ shortform: `doesn't exist`,
256
+ value: true,
257
+ 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.`
258
+ },
259
+ $regex: {
260
+ key: "$regex",
261
+ title: `matches regular expression`,
262
+ shortform: `matches`,
263
+ 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.`
264
+ }
265
+ };
266
+ var DEVICE_ISSUE_OPTIONS = {
267
+ issues: {
268
+ isCategory: true,
269
+ key: "issues",
270
+ title: "Devices with issues",
271
+ filterRule: {}
272
+ },
273
+ offline: {
274
+ issueCategory: "issues",
275
+ key: "offline",
276
+ needsFullFiltering: true,
277
+ needsMonitor: false,
278
+ needsReporting: false,
279
+ filterRule: {
280
+ scope: "system",
281
+ key: "check_in_time",
282
+ operator: DEVICE_FILTERING_OPTIONS.$ltne.key,
283
+ value: ({ offlineThreshold }) => offlineThreshold
284
+ },
285
+ title: "Offline devices"
286
+ },
287
+ failedLastUpdate: {
288
+ issueCategory: "issues",
289
+ key: "failedLastUpdate",
290
+ needsFullFiltering: false,
291
+ needsMonitor: false,
292
+ needsReporting: true,
293
+ filterRule: { scope: "monitor", key: "failed_last_update", operator: DEVICE_FILTERING_OPTIONS.$eq.key, value: true },
294
+ title: "Deployment failed"
295
+ },
296
+ monitoring: {
297
+ issueCategory: "issues",
298
+ key: "monitoring",
299
+ needsFullFiltering: false,
300
+ needsMonitor: true,
301
+ needsReporting: false,
302
+ filterRule: { scope: "monitor", key: "alerts", operator: DEVICE_FILTERING_OPTIONS.$eq.key, value: true },
303
+ title: "Monitoring alert"
304
+ },
305
+ authRequests: {
306
+ key: "authRequests",
307
+ needsFullFiltering: false,
308
+ needsMonitor: false,
309
+ needsReporting: true,
310
+ filterRule: { scope: "monitor", key: "auth_requests", operator: DEVICE_FILTERING_OPTIONS.$gt.key, value: 1 },
311
+ title: "Devices with new authentication requests"
312
+ },
313
+ gatewayDevices: {
314
+ key: "gatewayDevices",
315
+ needsFullFiltering: false,
316
+ needsMonitor: false,
317
+ needsReporting: true,
318
+ filterRule: { scope: "inventory", key: "mender_is_gateway", operator: DEVICE_FILTERING_OPTIONS.$eq.key, value: "true" },
319
+ title: "Gateway devices"
320
+ }
321
+ };
322
+ var oneSecond = 1e3;
323
+ var TIMEOUTS = {
324
+ debounceDefault: 700,
325
+ debounceShort: 300,
326
+ halfASecond: 0.5 * oneSecond,
327
+ oneSecond,
328
+ twoSeconds: 2 * oneSecond,
329
+ threeSeconds: 3 * oneSecond,
330
+ fiveSeconds: 5 * oneSecond,
331
+ refreshDefault: 10 * oneSecond,
332
+ refreshLong: 60 * oneSecond
333
+ };
334
+ var SORTING_OPTIONS = {
335
+ asc: "asc",
336
+ desc: "desc"
337
+ };
338
+ var DEVICE_ONLINE_CUTOFF = { interval: 1, intervalName: timeUnits.days };
339
+ var ATTRIBUTE_SCOPES = {
340
+ inventory: "inventory",
341
+ identity: "identity",
342
+ monitor: "monitor",
343
+ system: "system",
344
+ tags: "tags"
345
+ };
346
+ var defaultIdAttribute = Object.freeze({ attribute: "id", scope: ATTRIBUTE_SCOPES.identity });
347
+ var credentialTypes = {
348
+ aws: "aws",
349
+ http: "http",
350
+ sas: "sas",
351
+ x509: "x509"
352
+ };
353
+ var EXTERNAL_PROVIDER = {
354
+ "iot-core": {
355
+ credentialsType: credentialTypes.aws,
356
+ icon: import_js.mdiAws,
357
+ title: "AWS IoT Core",
358
+ twinTitle: "Device Shadow",
359
+ provider: "iot-core",
360
+ enabled: true,
361
+ deviceTwin: true,
362
+ configHint: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: "For help finding your AWS IoT Core connection string, check the AWS IoT documentation." })
363
+ },
364
+ "iot-hub": {
365
+ credentialsType: credentialTypes.sas,
366
+ icon: import_js.mdiMicrosoftAzure,
367
+ title: "Azure IoT Hub",
368
+ twinTitle: "Device Twin",
369
+ provider: "iot-hub",
370
+ enabled: true,
371
+ deviceTwin: true,
372
+ configHint: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
373
+ "For help finding your Azure IoT Hub connection string, look under 'Shared access policies' in the Microsoft Azure UI as described",
374
+ " ",
375
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
376
+ "a",
377
+ {
378
+ href: "https://devblogs.microsoft.com/iotdev/understand-different-connection-strings-in-azure-iot-hub/#iothubconn",
379
+ target: "_blank",
380
+ rel: "noopener noreferrer",
381
+ children: "here"
382
+ }
383
+ ),
384
+ "."
385
+ ] })
386
+ },
387
+ webhook: {
388
+ credentialsType: credentialTypes.http,
389
+ deviceTwin: false,
390
+ // disable the webhook provider here, since it is treated different than other integrations, with a custom configuration & management view, etc.
391
+ enabled: false,
392
+ provider: "webhook"
393
+ }
394
+ };
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,
406
+ description: "",
407
+ permissions: [],
408
+ uiPermissions: Object.freeze({ ...emptyUiPermissions })
409
+ });
410
+
411
+ // src/deploymentsSlice/constants.ts
412
+ var alreadyInstalled = "already-installed";
413
+ var deploymentsApiUrl = `${apiUrl.v1}/deployments`;
414
+ var deploymentsApiUrlV2 = `${apiUrl.v2}/deployments`;
415
+ var deploymentSubstates = {
416
+ aborted: "aborted",
417
+ alreadyInstalled,
418
+ decommissioned: "decommissioned",
419
+ downloading: "downloading",
420
+ failure: "failure",
421
+ installing: "installing",
422
+ noartifact: "noartifact",
423
+ pause_before_committing: "pause_before_committing",
424
+ pause_before_installing: "pause_before_installing",
425
+ pause_before_rebooting: "pause_before_rebooting",
426
+ pending: "pending",
427
+ rebooting: "rebooting",
428
+ success: "success"
429
+ };
430
+ var deploymentStatesToSubstates = {
431
+ failures: [deploymentSubstates.failure, deploymentSubstates.aborted, deploymentSubstates.decommissioned],
432
+ inprogress: [deploymentSubstates.downloading, deploymentSubstates.installing, deploymentSubstates.rebooting],
433
+ paused: [deploymentSubstates.pause_before_installing, deploymentSubstates.pause_before_rebooting, deploymentSubstates.pause_before_committing],
434
+ pending: [deploymentSubstates.pending],
435
+ successes: [deploymentSubstates.success, deploymentSubstates.alreadyInstalled, deploymentSubstates.noartifact]
436
+ };
437
+ var deploymentStatesToSubstatesWithSkipped = {
438
+ ...deploymentStatesToSubstates,
439
+ failures: [deploymentSubstates.failure],
440
+ skipped: [deploymentSubstates.aborted, deploymentSubstates.noartifact, deploymentSubstates.alreadyInstalled, deploymentSubstates.decommissioned],
441
+ successes: [deploymentSubstates.success]
442
+ };
443
+ var installationSubstatesMap = {
444
+ download: {
445
+ title: "download",
446
+ done: "downloaded",
447
+ successIndicators: [deploymentSubstates.installing, deploymentSubstates.rebooting, ...deploymentStatesToSubstates.paused, deploymentSubstates.success],
448
+ failureIndicators: deploymentStatesToSubstates.failures,
449
+ pauseConfigurationIndicator: "ArtifactInstall_Enter"
450
+ },
451
+ install: {
452
+ title: "install",
453
+ done: "installed",
454
+ successIndicators: [
455
+ deploymentSubstates.rebooting,
456
+ deploymentSubstates.pause_before_rebooting,
457
+ deploymentSubstates.pause_before_committing,
458
+ deploymentSubstates.success
459
+ ],
460
+ failureIndicators: deploymentStatesToSubstates.failures,
461
+ pauseConfigurationIndicator: "ArtifactReboot_Enter"
462
+ },
463
+ reboot: {
464
+ title: "reboot",
465
+ done: "rebooted",
466
+ successIndicators: [deploymentSubstates.pause_before_committing, deploymentSubstates.success],
467
+ failureIndicators: deploymentStatesToSubstates.failures,
468
+ pauseConfigurationIndicator: "ArtifactCommit_Enter"
469
+ },
470
+ commit: {
471
+ title: "commit",
472
+ done: "committed",
473
+ successIndicators: deploymentStatesToSubstates.successes,
474
+ failureIndicators: deploymentStatesToSubstates.failures,
475
+ pauseConfigurationIndicator: void 0
476
+ }
477
+ };
478
+ var DEPLOYMENT_STATES = {
479
+ finished: "finished",
480
+ inprogress: "inprogress",
481
+ pending: "pending",
482
+ scheduled: "scheduled"
483
+ };
484
+ var listDefaultsByState = {
485
+ [DEPLOYMENT_STATES.inprogress]: { page: 1, perPage: 10 },
486
+ [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 }
490
+ };
491
+ var DEFAULT_PENDING_INPROGRESS_COUNT = 10;
492
+ var DEPLOYMENT_ROUTES = {
493
+ active: {
494
+ key: "active",
495
+ route: "/deployments/active",
496
+ states: [DEPLOYMENT_STATES.pending, DEPLOYMENT_STATES.inprogress],
497
+ title: "Active"
498
+ },
499
+ finished: {
500
+ key: "finished",
501
+ route: "/deployments/finished",
502
+ states: [DEPLOYMENT_STATES.finished],
503
+ title: "Finished"
504
+ },
505
+ scheduled: {
506
+ key: "scheduled",
507
+ route: "/deployments/scheduled",
508
+ states: [DEPLOYMENT_STATES.scheduled],
509
+ title: "Scheduled"
510
+ }
511
+ };
512
+ var defaultStats = {
513
+ [deploymentSubstates.aborted]: 0,
514
+ [deploymentSubstates.alreadyInstalled]: 0,
515
+ [deploymentSubstates.decommissioned]: 0,
516
+ [deploymentSubstates.downloading]: 0,
517
+ [deploymentSubstates.failure]: 0,
518
+ [deploymentSubstates.installing]: 0,
519
+ [deploymentSubstates.noartifact]: 0,
520
+ [deploymentSubstates.pause_before_committing]: 0,
521
+ [deploymentSubstates.pause_before_installing]: 0,
522
+ [deploymentSubstates.pause_before_rebooting]: 0,
523
+ [deploymentSubstates.pending]: 0,
524
+ [deploymentSubstates.rebooting]: 0,
525
+ [deploymentSubstates.success]: 0
526
+ };
527
+ var deploymentPrototype = {
528
+ devices: {},
529
+ name: void 0,
530
+ statistics: { status: {} }
531
+ };
532
+ var pauseMap = {
533
+ [deploymentSubstates.pause_before_installing]: {
534
+ title: installationSubstatesMap.download.done,
535
+ followUp: installationSubstatesMap.download.pauseConfigurationIndicator
536
+ },
537
+ [deploymentSubstates.pause_before_rebooting]: {
538
+ title: installationSubstatesMap.install.done,
539
+ followUp: installationSubstatesMap.install.pauseConfigurationIndicator
540
+ },
541
+ [deploymentSubstates.pause_before_committing]: {
542
+ title: installationSubstatesMap.reboot.done,
543
+ followUp: installationSubstatesMap.reboot.pauseConfigurationIndicator
544
+ }
545
+ };
546
+ var limitDefault = { min: 5, max: 100, default: 10 };
547
+
548
+ // src/devicesSlice/constants.ts
549
+ var emptyFilter = { key: null, value: "", operator: DEVICE_FILTERING_OPTIONS.$eq.key, scope: "inventory" };
550
+ var deviceAuthV2 = `${apiUrl.v2}/devauth`;
551
+ var deviceConnect = `${apiUrl.v1}/deviceconnect`;
552
+ var inventoryApiUrl = `${apiUrl.v1}/inventory`;
553
+ var inventoryApiUrlV2 = `${apiUrl.v2}/inventory`;
554
+ var deviceConfig = `${apiUrl.v1}/deviceconfig/configurations/device`;
555
+ var reportingApiUrl = `${apiUrl.v1}/reporting`;
556
+ var iotManagerBaseURL = `${apiUrl.v1}/iot-manager`;
557
+ var DEVICE_STATES = {
558
+ accepted: "accepted",
559
+ pending: "pending",
560
+ preauth: "preauthorized",
561
+ rejected: "rejected"
562
+ };
563
+ var geoAttributes = ["geo-lat", "geo-lon"].map((attribute) => ({ attribute, scope: "inventory" }));
564
+
565
+ // src/monitorSlice/constants.ts
566
+ var alertChannels = { email: "email" };
567
+ var monitorApiUrlv1 = `${apiUrl.v1}/devicemonitor`;
568
+
569
+ // src/onboardingSlice/constants.ts
570
+ var onboardingSteps = {
571
+ ONBOARDING_START: "onboarding-start",
572
+ DEVICES_PENDING_ONBOARDING_START: "devices-pending-onboarding-start",
573
+ DASHBOARD_ONBOARDING_START: "dashboard-onboarding-start",
574
+ DASHBOARD_ONBOARDING_PENDINGS: "dashboard-onboarding-pendings",
575
+ DEVICES_DELAYED_ONBOARDING: "devices-delayed-onboarding",
576
+ DEVICES_PENDING_ONBOARDING: "devices-pending-onboarding",
577
+ DEVICES_ACCEPTED_ONBOARDING: "devices-accepted-onboarding",
578
+ DEVICES_PENDING_ACCEPTING_ONBOARDING: "devices-pending-accepting-onboarding",
579
+ DEVICES_DEPLOY_RELEASE_ONBOARDING: "devices-deploy-release-onboarding",
580
+ SCHEDULING_ARTIFACT_SELECTION: "scheduling-artifact-selection",
581
+ SCHEDULING_ALL_DEVICES_SELECTION: "scheduling-all-devices-selection",
582
+ SCHEDULING_GROUP_SELECTION: "scheduling-group-selection",
583
+ SCHEDULING_RELEASE_TO_DEVICES: "scheduling-release-to-devices",
584
+ DEPLOYMENTS_INPROGRESS: "deployments-inprogress",
585
+ DEPLOYMENTS_PAST: "deployments-past",
586
+ DEPLOYMENTS_PAST_COMPLETED: "deployments-past-completed",
587
+ DEPLOYMENTS_PAST_COMPLETED_FAILURE: "deployments-past-completed-failure",
588
+ ONBOARDING_CANCELED: "onboarding-canceled"
589
+ };
590
+ var orderedOnboardingSteps = [
591
+ onboardingSteps.DASHBOARD_ONBOARDING_START,
592
+ onboardingSteps.DEVICES_PENDING_ONBOARDING_START,
593
+ onboardingSteps.DEVICES_DELAYED_ONBOARDING,
594
+ onboardingSteps.DEVICES_PENDING_ONBOARDING,
595
+ onboardingSteps.DEVICES_PENDING_ACCEPTING_ONBOARDING,
596
+ onboardingSteps.DASHBOARD_ONBOARDING_PENDINGS,
597
+ onboardingSteps.DEVICES_ACCEPTED_ONBOARDING,
598
+ onboardingSteps.DEVICES_DEPLOY_RELEASE_ONBOARDING,
599
+ onboardingSteps.SCHEDULING_ALL_DEVICES_SELECTION,
600
+ onboardingSteps.SCHEDULING_GROUP_SELECTION,
601
+ onboardingSteps.SCHEDULING_ARTIFACT_SELECTION,
602
+ onboardingSteps.SCHEDULING_RELEASE_TO_DEVICES,
603
+ onboardingSteps.DEPLOYMENTS_INPROGRESS,
604
+ onboardingSteps.DEPLOYMENTS_PAST,
605
+ onboardingSteps.DEPLOYMENTS_PAST_COMPLETED,
606
+ onboardingSteps.DEPLOYMENTS_PAST_COMPLETED_FAILURE,
607
+ onboardingSteps.ONBOARDING_CANCELED
608
+ ];
609
+
610
+ // src/organizationSlice/constants.ts
611
+ var auditLogsApiUrl = `${apiUrl.v1}/auditlogs`;
612
+ var tenantadmApiUrlv1 = `${apiUrl.v1}/tenantadm`;
613
+ var tenantadmApiUrlv2 = `${apiUrl.v2}/tenantadm`;
614
+ var ssoIdpApiUrlv1 = `${apiUrl.v1}/useradm/sso/idp/metadata`;
615
+ var AUDIT_LOGS_TYPES = [
616
+ { title: "Artifact", queryParameter: "object_type", value: "artifact" },
617
+ { title: "Deployment", queryParameter: "object_deployment_name", value: "deployment" },
618
+ { title: "Device", queryParameter: "object_id", value: "device" },
619
+ { title: "User", queryParameter: "object_id", value: "user" }
620
+ ];
621
+ var SP_AUDIT_LOGS_TYPES = [AUDIT_LOGS_TYPES[3], { title: "Tenant", queryParameter: "object_id", value: "tenant" }];
622
+ var emptyWebhook = {
623
+ description: "",
624
+ enabled: true,
625
+ credentials: {
626
+ type: EXTERNAL_PROVIDER.webhook.credentialsType,
627
+ [EXTERNAL_PROVIDER.webhook.credentialsType]: {
628
+ secret: "",
629
+ url: ""
630
+ }
631
+ }
632
+ };
633
+ var TENANT_LIST_DEFAULT = {
634
+ page: 1,
635
+ perPage: 20
636
+ };
637
+
638
+ // src/releasesSlice/constants.ts
639
+ var ARTIFACT_GENERATION_TYPE = { SINGLE_FILE: "single_file" };
640
+ var rootfsImageVersion = "rootfs-image.version";
641
+ var softwareTitleMap = { [rootfsImageVersion]: { title: "Root filesystem", priority: 0, key: rootfsImageVersion } };
642
+
643
+ // src/usersSlice/constants.ts
644
+ var useradmApiUrlv1 = `${apiUrl.v1}/useradm`;
645
+ var useradmApiUrlv2 = `${apiUrl.v2}/useradm`;
646
+ var staticRolesByName = {
647
+ admin: "RBAC_ROLE_PERMIT_ALL",
648
+ readOnly: "RBAC_ROLE_OBSERVER",
649
+ ci: "RBAC_ROLE_CI",
650
+ deploymentsManager: "RBAC_ROLE_DEPLOYMENTS_MANAGER",
651
+ terminalAccess: "RBAC_ROLE_REMOTE_TERMINAL"
652
+ };
653
+ var PermissionTypes = {
654
+ Any: "any",
655
+ Get: "GET",
656
+ Post: "POST",
657
+ Put: "PUT",
658
+ Delete: "DELETE",
659
+ Patch: "PATCH",
660
+ DeviceGroup: "DEVICE_GROUP",
661
+ DeviceId: "DEVICE_ID"
662
+ };
663
+ var permissionSetIds = {
664
+ Basic: "Basic",
665
+ ConfigureDevices: "ConfigureDevices",
666
+ ConnectToDevices: "ConnectToDevices",
667
+ DeployToDevices: "DeployToDevices",
668
+ ManageDevices: "ManageDevices",
669
+ ManageReleases: "ManageReleases",
670
+ ManageTenants: "ManageTenants",
671
+ ManageUsers: "ManageUsers",
672
+ ReadAuditLogs: "ReadAuditLogs",
673
+ ReadDevices: "ReadDevices",
674
+ ReadReleases: "ReadReleases",
675
+ ReadTenants: "ReadTenants",
676
+ ReadUsers: "ReadUsers",
677
+ SuperUser: "SuperUser",
678
+ UploadArtifacts: "UploadArtifacts"
679
+ };
680
+ var uiPermissionsById = {
681
+ configure: {
682
+ explanations: { groups: `'Configure' allows the user to use mender-configure features and apply configurations.` },
683
+ permissionLevel: 2,
684
+ permissionSets: { groups: permissionSetIds.ConfigureDevices },
685
+ title: "Configure",
686
+ value: "configure",
687
+ verbs: [PermissionTypes.Get, PermissionTypes.Put, PermissionTypes.Post]
688
+ },
689
+ connect: {
690
+ explanations: { groups: `'Connect' allows the user to use mender-connect features and Troubleshoot add-ons.` },
691
+ permissionLevel: 2,
692
+ permissionSets: { groups: permissionSetIds.ConnectToDevices },
693
+ title: "Connect",
694
+ value: "connect",
695
+ verbs: [PermissionTypes.Get, PermissionTypes.Put]
696
+ },
697
+ deploy: {
698
+ explanations: { groups: `'Deploy' allows the user to deploy software or configuration updates to devices.` },
699
+ permissionLevel: 2,
700
+ permissionSets: { deployments: permissionSetIds.DeployToDevices, groups: permissionSetIds.DeployToDevices },
701
+ title: "Deploy",
702
+ value: "deploy",
703
+ verbs: [PermissionTypes.Post]
704
+ },
705
+ manage: {
706
+ explanations: {
707
+ 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.`,
708
+ releases: `'Manage' allows the user to upload new artifacts, edit release descriptions and remove artifacts.`
709
+ },
710
+ permissionLevel: 2,
711
+ permissionSets: {
712
+ groups: permissionSetIds.ManageDevices,
713
+ releases: permissionSetIds.ManageReleases,
714
+ tenantManagement: permissionSetIds.ManageTenants,
715
+ userManagement: permissionSetIds.ManageUsers
716
+ },
717
+ title: "Manage",
718
+ value: "manage",
719
+ verbs: [PermissionTypes.Post, PermissionTypes.Put, PermissionTypes.Patch]
720
+ },
721
+ read: {
722
+ explanations: { groups: `'Read' allows the user to view devices.` },
723
+ permissionLevel: 1,
724
+ permissionSets: {
725
+ auditlog: permissionSetIds.ReadAuditLogs,
726
+ groups: permissionSetIds.ReadDevices,
727
+ releases: permissionSetIds.ReadReleases,
728
+ tenantManagement: permissionSetIds.ReadTenants,
729
+ userManagement: permissionSetIds.ReadUsers
730
+ },
731
+ title: "Read",
732
+ value: "read",
733
+ verbs: [PermissionTypes.Get, PermissionTypes.Post]
734
+ },
735
+ upload: {
736
+ explanations: { groups: `'Upload' allows the user to upload new Artifacts.` },
737
+ unscopedOnly: { releases: true },
738
+ permissionLevel: 1,
739
+ permissionSets: { releases: permissionSetIds.UploadArtifacts },
740
+ title: "Upload",
741
+ value: "upload",
742
+ verbs: [PermissionTypes.Post, PermissionTypes.Put, PermissionTypes.Patch]
743
+ }
744
+ };
745
+ var scopedPermissionAreas = {
746
+ groups: { key: "groups", excessiveAccessSelector: ALL_DEVICES, scopeType: "DeviceGroups" },
747
+ releases: { key: "releases", excessiveAccessSelector: ALL_RELEASES, scopeType: "Releases" }
748
+ };
749
+ var uiPermissionsByArea = {
750
+ auditlog: {
751
+ endpoints: [{ path: /\/(auditlog)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.read] }],
752
+ explanation: "Granting access to the audit log will allow tracing changes to devices, releases and user accounts, as well as providing information about deployments.",
753
+ key: "auditlog",
754
+ uiPermissions: [uiPermissionsById.read],
755
+ title: "System audit log"
756
+ },
757
+ deployments: {
758
+ endpoints: [
759
+ { path: /\/(deployments\/deployments)/i, types: [PermissionTypes.Post, PermissionTypes.Put], uiPermissions: [uiPermissionsById.deploy] },
760
+ { path: /\/(deployments\/deployments)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.read] },
761
+ { path: /\/(deployments\/config)/i, types: [PermissionTypes.Get, PermissionTypes.Put], uiPermissions: [uiPermissionsById.manage] }
762
+ ],
763
+ explanation: "Providing deploy permissions will allow deployments to be created using the releases and devices a user has access to.",
764
+ key: "deployments",
765
+ uiPermissions: [uiPermissionsById.read, uiPermissionsById.deploy],
766
+ title: "Deployments"
767
+ },
768
+ groups: {
769
+ endpoints: [
770
+ {
771
+ path: /\/(devauth|inventory|deviceconfig|devicemonitor|deviceconnect\/devices)/i,
772
+ types: [PermissionTypes.Get],
773
+ uiPermissions: [uiPermissionsById.read]
774
+ },
775
+ { path: /\/(devauth|inventory)/i, types: [PermissionTypes.Put, PermissionTypes.Post], uiPermissions: [uiPermissionsById.manage] },
776
+ { path: /\/(deviceconfig)/i, types: [PermissionTypes.Get, PermissionTypes.Put, PermissionTypes.Post], uiPermissions: [uiPermissionsById.configure] },
777
+ { path: /\/(deviceconnect\/devices)/i, types: [PermissionTypes.Get, PermissionTypes.Post], uiPermissions: [uiPermissionsById.connect] }
778
+ ],
779
+ explanation: "Device group management permissions control the degree to which devices in a group can be accessed and moved to other groups.",
780
+ key: "groups",
781
+ scope: scopedPermissionAreas.groups.scopeType,
782
+ uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage, uiPermissionsById.deploy, uiPermissionsById.configure, uiPermissionsById.connect],
783
+ title: "Group Management"
784
+ },
785
+ releases: {
786
+ endpoints: [
787
+ { path: /\/(deployments\/artifacts|deployments\/deployments\/releases)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.read] },
788
+ {
789
+ path: /\/(deployments\/artifacts|deployments\/deployments\/releases)/i,
790
+ types: [PermissionTypes.Post, PermissionTypes.Put],
791
+ uiPermissions: [uiPermissionsById.read, uiPermissionsById.upload]
792
+ },
793
+ {
794
+ path: /\/(deployments\/artifacts|deployments\/deployments\/releases)/i,
795
+ types: [PermissionTypes.Delete],
796
+ uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage]
797
+ }
798
+ ],
799
+ explanation: "Release permissions can be granted to allow artifact & release modifications, as well as the creation of new releases.",
800
+ key: "releases",
801
+ scope: "ReleaseTags",
802
+ uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage, uiPermissionsById.upload],
803
+ title: "Release Management"
804
+ },
805
+ tenantManagement: {
806
+ endpoints: [
807
+ { path: /\/(tenantadm\/tenants)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.read] },
808
+ { path: /\/(tenantadm\/tenants)/i, types: [PermissionTypes.Post, PermissionTypes.Put], uiPermissions: [uiPermissionsById.manage] },
809
+ { path: /\/(users\/exists)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.manage] }
810
+ ],
811
+ explanation: "Tenant management permissions allow listing, creating and modifying child tenants",
812
+ key: "tenantManagement",
813
+ uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage],
814
+ title: "Tenant Management"
815
+ },
816
+ userManagement: {
817
+ endpoints: [
818
+ { path: /\/(useradm)/i, types: [PermissionTypes.Get], uiPermissions: [uiPermissionsById.read] },
819
+ { path: /\/(useradm)/i, types: [PermissionTypes.Post], uiPermissions: [uiPermissionsById.manage] }
820
+ ],
821
+ explanation: "User management permissions should be granted carefully, as these allow privilege increases for any users managed by a user with user management permissions",
822
+ key: "userManagement",
823
+ uiPermissions: [uiPermissionsById.read, uiPermissionsById.manage],
824
+ title: "User Management"
825
+ }
826
+ };
827
+ var permissionMapper = (permission) => permission.value;
828
+ var rolesById = Object.freeze({
829
+ [staticRolesByName.admin]: {
830
+ name: "Admin",
831
+ value: staticRolesByName.admin,
832
+ description: "Full access",
833
+ permissions: [],
834
+ // permissions refers to the values returned from the backend
835
+ uiPermissions: {
836
+ ...emptyUiPermissions,
837
+ auditlog: uiPermissionsByArea.auditlog.uiPermissions.map(permissionMapper),
838
+ deployments: uiPermissionsByArea.deployments.uiPermissions.map(permissionMapper),
839
+ groups: { [ALL_DEVICES]: uiPermissionsByArea.groups.uiPermissions.map(permissionMapper) },
840
+ releases: { [ALL_RELEASES]: uiPermissionsByArea.releases.uiPermissions.map(permissionMapper) },
841
+ userManagement: uiPermissionsByArea.userManagement.uiPermissions.map(permissionMapper)
842
+ }
843
+ },
844
+ [staticRolesByName.readOnly]: {
845
+ name: "Read Access",
846
+ value: staticRolesByName.readOnly,
847
+ description: "",
848
+ permissions: [],
849
+ uiPermissions: {
850
+ ...emptyUiPermissions,
851
+ deployments: [uiPermissionsById.read.value],
852
+ groups: { [ALL_DEVICES]: [uiPermissionsById.read.value] },
853
+ releases: { [ALL_RELEASES]: [uiPermissionsById.read.value] },
854
+ userManagement: [uiPermissionsById.read.value]
855
+ }
856
+ },
857
+ [staticRolesByName.ci]: {
858
+ name: "Releases Manager",
859
+ value: staticRolesByName.ci,
860
+ description: "",
861
+ permissions: [],
862
+ uiPermissions: {
863
+ ...emptyUiPermissions,
864
+ releases: { [ALL_RELEASES]: uiPermissionsByArea.releases.uiPermissions.map(permissionMapper) }
865
+ }
866
+ },
867
+ [staticRolesByName.deploymentsManager]: {
868
+ name: "Deployments Manager",
869
+ value: staticRolesByName.deploymentsManager,
870
+ description: "",
871
+ permissions: [],
872
+ uiPermissions: {
873
+ ...emptyUiPermissions,
874
+ deployments: uiPermissionsByArea.deployments.uiPermissions.map(permissionMapper),
875
+ groups: { [ALL_DEVICES]: [uiPermissionsById.deploy.value, uiPermissionsById.read.value] },
876
+ releases: { [ALL_RELEASES]: [uiPermissionsById.read.value] }
877
+ }
878
+ },
879
+ [staticRolesByName.terminalAccess]: {
880
+ name: "Troubleshooting",
881
+ value: staticRolesByName.terminalAccess,
882
+ description: "Access to the troubleshooting features: Remote Terminal, File Transfer, Port Forwarding",
883
+ permissions: [],
884
+ uiPermissions: {
885
+ ...emptyUiPermissions,
886
+ groups: { [ALL_DEVICES]: [uiPermissionsById.connect.value] }
887
+ }
888
+ }
889
+ });
890
+ var serviceProviderRolesById = {
891
+ admin: {
892
+ name: "Admin",
893
+ value: staticRolesByName.admin,
894
+ description: "Full access",
895
+ permissions: [],
896
+ uiPermissions: {
897
+ ...emptyUiPermissions,
898
+ auditlog: uiPermissionsByArea.auditlog.uiPermissions.map(permissionMapper),
899
+ userManagement: uiPermissionsByArea.userManagement.uiPermissions.map(permissionMapper),
900
+ tenantManagement: uiPermissionsByArea.tenantManagement.uiPermissions.map(permissionMapper)
901
+ }
902
+ },
903
+ readOnly: {
904
+ name: "Read access",
905
+ value: staticRolesByName.admin,
906
+ description: "This role can see all linked organizations but cannot make any changes",
907
+ permissions: [],
908
+ uiPermissions: {
909
+ ...emptyUiPermissions,
910
+ auditlog: [uiPermissionsById.read.value],
911
+ userManagement: [uiPermissionsById.read.value],
912
+ tenantManagement: [uiPermissionsById.read.value]
913
+ }
914
+ }
915
+ };
916
+ var defaultPermissionSets = {
917
+ [permissionSetIds.Basic]: {
918
+ name: permissionSetIds.Basic,
919
+ result: {
920
+ // this is needed to prevent the detailed permissions of the basic permission set from being interpreted as allowing read & management access to user endpoints
921
+ userManagement: [uiPermissionsById.read.value]
922
+ }
923
+ },
924
+ [permissionSetIds.SuperUser]: {
925
+ name: permissionSetIds.SuperUser,
926
+ result: {
927
+ ...rolesById[staticRolesByName.admin].uiPermissions
928
+ }
929
+ },
930
+ [permissionSetIds.ManageUsers]: {
931
+ name: permissionSetIds.ManageUsers,
932
+ result: {
933
+ userManagement: [uiPermissionsById.manage.value]
934
+ }
935
+ },
936
+ [permissionSetIds.ReadAuditLogs]: {
937
+ name: permissionSetIds.ReadAuditLogs,
938
+ result: {
939
+ auditlog: [uiPermissionsById.read.value]
940
+ }
941
+ },
942
+ [permissionSetIds.ReadReleases]: {
943
+ name: permissionSetIds.ReadReleases,
944
+ result: {
945
+ releases: { [ALL_RELEASES]: [uiPermissionsById.read.value] }
946
+ }
947
+ },
948
+ [permissionSetIds.ReadTenants]: {
949
+ name: permissionSetIds.ReadTenants,
950
+ result: {
951
+ tenantManagement: [uiPermissionsById.read.value]
952
+ }
953
+ },
954
+ [permissionSetIds.ManageTenants]: {
955
+ name: permissionSetIds.ManageTenants,
956
+ result: {
957
+ tenantManagement: [uiPermissionsById.manage.value]
958
+ }
959
+ },
960
+ [permissionSetIds.ReadUsers]: {
961
+ name: permissionSetIds.ReadUsers,
962
+ result: {
963
+ userManagement: [uiPermissionsById.read.value]
964
+ }
965
+ },
966
+ [permissionSetIds.UploadArtifacts]: {
967
+ name: permissionSetIds.UploadArtifacts,
968
+ result: {
969
+ releases: { [ALL_RELEASES]: [uiPermissionsById.upload.value] }
970
+ }
971
+ },
972
+ [permissionSetIds.ManageReleases]: {
973
+ name: permissionSetIds.ManageReleases,
974
+ result: {
975
+ releases: { [ALL_RELEASES]: [uiPermissionsById.manage.value] }
976
+ }
977
+ },
978
+ [permissionSetIds.ConfigureDevices]: {
979
+ name: permissionSetIds.ConfigureDevices,
980
+ result: {
981
+ deployments: [uiPermissionsById.read.value, uiPermissionsById.deploy.value],
982
+ groups: { [ALL_DEVICES]: [uiPermissionsById.read.value, uiPermissionsById.configure.value] }
983
+ }
984
+ },
985
+ [permissionSetIds.ConnectToDevices]: {
986
+ name: permissionSetIds.ConnectToDevices,
987
+ result: {
988
+ groups: { [ALL_DEVICES]: [uiPermissionsById.read.value, uiPermissionsById.connect.value] }
989
+ }
990
+ },
991
+ [permissionSetIds.DeployToDevices]: {
992
+ name: permissionSetIds.DeployToDevices,
993
+ result: {
994
+ deployments: [uiPermissionsById.deploy.value, uiPermissionsById.manage.value, uiPermissionsById.read.value],
995
+ groups: { [ALL_DEVICES]: [uiPermissionsById.read.value, uiPermissionsById.deploy.value] }
996
+ }
997
+ },
998
+ [permissionSetIds.ManageDevices]: {
999
+ name: permissionSetIds.ManageDevices,
1000
+ result: {
1001
+ groups: { [ALL_DEVICES]: [uiPermissionsById.read.value, uiPermissionsById.manage.value] }
1002
+ }
1003
+ },
1004
+ [permissionSetIds.ReadDevices]: {
1005
+ name: permissionSetIds.ReadDevices,
1006
+ result: {
1007
+ groups: { [ALL_DEVICES]: [uiPermissionsById.read.value] }
1008
+ }
1009
+ }
1010
+ };
1011
+ var USER_LOGOUT = "USER_LOGOUT";
1012
+ var rolesByName = {
1013
+ ...staticRolesByName,
1014
+ deploymentCreation: { action: "CREATE_DEPLOYMENT", object: { type: "DEVICE_GROUP", value: void 0 } },
1015
+ groupAccess: { action: "VIEW_DEVICE", object: { type: "DEVICE_GROUP", value: void 0 } },
1016
+ userManagement: { action: "http", object: { type: "any", value: `${useradmApiUrlv1}/.*` } }
1017
+ };
1018
+ var twoFAStates = {
1019
+ enabled: "enabled",
1020
+ disabled: "disabled",
1021
+ unverified: "unverified"
1022
+ };
1023
+ var settingsKeys = { initialized: "settings-initialized" };
1024
+ var READ_STATES = {
1025
+ read: "read",
1026
+ seen: "seen",
1027
+ unread: "unread"
1028
+ };
1029
+
1030
+ // src/appSlice/index.ts
1031
+ var import_toolkit = require("@reduxjs/toolkit");
1032
+ var sliceName = "app";
1033
+ var getYesterday = () => {
1034
+ const today = /* @__PURE__ */ new Date();
1035
+ today.setDate(today.getDate() - 1);
1036
+ return today.toISOString();
1037
+ };
1038
+ var initialState = {
1039
+ cancelSource: void 0,
1040
+ demoArtifactLink: "https://dgsbl4vditpls.cloudfront.net/mender-demo-artifact.mender",
1041
+ hostAddress: null,
1042
+ snackbar: {
1043
+ open: false,
1044
+ message: "",
1045
+ maxWidth: 900,
1046
+ autoHideDuration: void 0,
1047
+ action: void 0,
1048
+ children: void 0,
1049
+ onClick: void 0,
1050
+ onClose: void 0
1051
+ },
1052
+ // return boolean rather than organization details
1053
+ features: {
1054
+ hasAuditlogs: false,
1055
+ hasDeltaProgress: false,
1056
+ hasMultitenancy: false,
1057
+ hasDeviceConfig: false,
1058
+ hasDeviceConnect: false,
1059
+ hasFeedbackEnabled: false,
1060
+ hasMonitor: false,
1061
+ hasReporting: false,
1062
+ isDemoMode: false,
1063
+ isHosted: false,
1064
+ isEnterprise: false
1065
+ },
1066
+ feedbackProbability: 0.3,
1067
+ firstLoginAfterSignup: false,
1068
+ hostedAnnouncement: "",
1069
+ docsVersion: "",
1070
+ recaptchaSiteKey: "",
1071
+ searchState: {
1072
+ deviceIds: [],
1073
+ searchTerm: "",
1074
+ searchTotal: 0,
1075
+ sort: {
1076
+ direction: SORTING_OPTIONS.desc
1077
+ // key: null,
1078
+ // scope: null
1079
+ }
1080
+ },
1081
+ stripeAPIKey: "",
1082
+ trackerCode: "",
1083
+ uploadsById: {
1084
+ // id: { uploading: false, uploadProgress: 0, cancelSource: undefined }
1085
+ },
1086
+ newThreshold: getYesterday(),
1087
+ offlineThreshold: getYesterday(),
1088
+ versionInformation: {
1089
+ Integration: "",
1090
+ "Mender-Client": "",
1091
+ "Mender-Artifact": "",
1092
+ "Meta-Mender": "",
1093
+ Deployments: "",
1094
+ Deviceauth: "",
1095
+ Inventory: "",
1096
+ GUI: "latest"
1097
+ },
1098
+ yesterday: void 0
1099
+ };
1100
+ var appSlice = (0, import_toolkit.createSlice)({
1101
+ name: sliceName,
1102
+ initialState,
1103
+ reducers: {
1104
+ setFeatures: (state, action) => {
1105
+ state.features = {
1106
+ ...state.features,
1107
+ ...action.payload
1108
+ };
1109
+ },
1110
+ setSnackbar: (state, { payload }) => {
1111
+ let { message, autoHideDuration, action, children, onClick, onClose } = payload;
1112
+ if (typeof payload === "string" || payload instanceof String) {
1113
+ message = payload;
1114
+ }
1115
+ state.snackbar = {
1116
+ open: message ? true : false,
1117
+ message,
1118
+ maxWidth: 900,
1119
+ autoHideDuration,
1120
+ action,
1121
+ children,
1122
+ onClick,
1123
+ onClose
1124
+ };
1125
+ },
1126
+ setFirstLoginAfterSignup: (state, action) => {
1127
+ state.firstLoginAfterSignup = action.payload;
1128
+ },
1129
+ setAnnouncement: (state, action) => {
1130
+ state.hostedAnnouncement = action.payload;
1131
+ },
1132
+ setSearchState: (state, action) => {
1133
+ state.searchState = {
1134
+ ...state.searchState,
1135
+ ...action.payload
1136
+ };
1137
+ },
1138
+ setOfflineThreshold: (state, action) => {
1139
+ state.offlineThreshold = action.payload;
1140
+ },
1141
+ initUpload: (state, action) => {
1142
+ const { id, upload } = action.payload;
1143
+ state.uploadsById[id] = upload;
1144
+ },
1145
+ uploadProgress: (state, action) => {
1146
+ const { id, progress: progress2 } = action.payload;
1147
+ state.uploadsById[id] = {
1148
+ ...state.uploadsById[id],
1149
+ progress: progress2
1150
+ };
1151
+ },
1152
+ cleanUpUpload: (state, action) => {
1153
+ const { [action.payload]: current, ...remainder } = state.uploadsById;
1154
+ state.uploadsById = remainder;
1155
+ },
1156
+ setVersionInformation: (state, action) => {
1157
+ state.versionInformation = {
1158
+ ...state.versionInformation,
1159
+ ...action.payload
1160
+ };
1161
+ },
1162
+ setEnvironmentData: (state, action) => {
1163
+ return { ...state, ...action.payload };
1164
+ }
1165
+ }
1166
+ });
1167
+ var actions = appSlice.actions;
1168
+ var appSlice_default = appSlice.reducer;
1169
+
1170
+ // src/deploymentsSlice/index.ts
1171
+ var import_toolkit2 = require("@reduxjs/toolkit");
1172
+ var sliceName2 = "deployments";
1173
+ var initialState2 = {
1174
+ byId: {
1175
+ // [id]: { statistics: { status: {}, total_size }, devices: { [deploymentId]: { id, log } }, totalDeviceCount }
1176
+ },
1177
+ byStatus: {
1178
+ finished: { deploymentIds: [], total: 0 },
1179
+ inprogress: { deploymentIds: [], total: 0 },
1180
+ pending: { deploymentIds: [], total: 0 },
1181
+ scheduled: { deploymentIds: [], total: 0 }
1182
+ },
1183
+ config: {
1184
+ binaryDelta: {
1185
+ timeout: -1,
1186
+ duplicatesWindow: -1,
1187
+ compressionLevel: -1,
1188
+ disableChecksum: false,
1189
+ disableDecompression: false,
1190
+ inputWindow: -1,
1191
+ instructionBuffer: -1,
1192
+ sourceWindow: -1
1193
+ },
1194
+ binaryDeltaLimits: {
1195
+ timeout: { ...limitDefault, default: 60, max: 3600, min: 60 },
1196
+ sourceWindow: limitDefault,
1197
+ inputWindow: limitDefault,
1198
+ duplicatesWindow: limitDefault,
1199
+ instructionBuffer: limitDefault
1200
+ }
1201
+ },
1202
+ deploymentDeviceLimit: 5e3,
1203
+ selectedDeviceIds: [],
1204
+ selectionState: {
1205
+ finished: { ...DEVICE_LIST_DEFAULTS, endDate: void 0, search: "", selection: [], startDate: void 0, total: 0, type: "" },
1206
+ inprogress: { ...DEVICE_LIST_DEFAULTS, perPage: DEFAULT_PENDING_INPROGRESS_COUNT, selection: [] },
1207
+ pending: { ...DEVICE_LIST_DEFAULTS, perPage: DEFAULT_PENDING_INPROGRESS_COUNT, selection: [] },
1208
+ scheduled: { ...DEVICE_LIST_DEFAULTS, selection: [] },
1209
+ general: {
1210
+ state: DEPLOYMENT_ROUTES.active.key,
1211
+ showCreationDialog: false,
1212
+ showReportDialog: false,
1213
+ reportType: null
1214
+ // DeploymentConstants.DEPLOYMENT_TYPES.configuration|DeploymentConstants.DEPLOYMENT_TYPES.software
1215
+ },
1216
+ selectedId: void 0
1217
+ }
1218
+ };
1219
+ var deploymentsSlice = (0, import_toolkit2.createSlice)({
1220
+ name: sliceName2,
1221
+ initialState: initialState2,
1222
+ reducers: {
1223
+ createdDeployment: (state, action) => {
1224
+ state.byId[action.payload.id] = {
1225
+ ...deploymentPrototype,
1226
+ ...action.payload
1227
+ };
1228
+ state.byStatus[DEPLOYMENT_STATES.pending].total = state.byStatus[DEPLOYMENT_STATES.pending].total + 1;
1229
+ state.byStatus[DEPLOYMENT_STATES.pending].deploymentIds = [...state.byStatus.pending.deploymentIds, action.payload.id];
1230
+ 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;
1231
+ },
1232
+ removedDeployment: (state, action) => {
1233
+ const { [action.payload]: removedDeployment, ...remainder } = state.byId;
1234
+ state.byId = remainder;
1235
+ },
1236
+ receivedDeployment: (state, action) => {
1237
+ state.byId[action.payload.id] = {
1238
+ ...state.byId[action.payload.id] || {},
1239
+ ...action.payload
1240
+ };
1241
+ },
1242
+ receivedDeploymentDeviceLog: (state, action) => {
1243
+ const { id, deviceId, log } = action.payload;
1244
+ const deployment = {
1245
+ ...deploymentPrototype,
1246
+ ...state.byId[id]
1247
+ };
1248
+ state.byId[id] = {
1249
+ ...deployment,
1250
+ devices: {
1251
+ ...deployment.devices,
1252
+ [deviceId]: {
1253
+ ...deployment.devices[deviceId],
1254
+ log
1255
+ }
1256
+ }
1257
+ };
1258
+ },
1259
+ receivedDeploymentDevices: (state, action) => {
1260
+ const { id, devices, selectedDeviceIds, totalDeviceCount } = action.payload;
1261
+ state.byId[id] = {
1262
+ ...state.byId[id],
1263
+ devices,
1264
+ totalDeviceCount
1265
+ };
1266
+ state.selectedDeviceIds = selectedDeviceIds;
1267
+ },
1268
+ receivedDeployments: (state, action) => {
1269
+ state.byId = {
1270
+ ...state.byId,
1271
+ ...action.payload
1272
+ };
1273
+ },
1274
+ receivedDeploymentsForStatus: (state, action) => {
1275
+ const { status, deploymentIds, total } = action.payload;
1276
+ state.byStatus[status].deploymentIds = deploymentIds;
1277
+ state.byStatus[status].total = total;
1278
+ },
1279
+ selectDeploymentsForStatus: (state, action) => {
1280
+ const { status, deploymentIds, total } = action.payload;
1281
+ state.selectionState[status].selection = deploymentIds;
1282
+ state.selectionState[status].total = total;
1283
+ },
1284
+ setDeploymentsState: (state, action) => {
1285
+ state.selectionState = action.payload;
1286
+ },
1287
+ setDeploymentsConfig: (state, action) => {
1288
+ state.config = action.payload;
1289
+ }
1290
+ }
1291
+ });
1292
+ var actions2 = deploymentsSlice.actions;
1293
+ var deploymentsSlice_default = deploymentsSlice.reducer;
1294
+
1295
+ // src/devicesSlice/index.ts
1296
+ var import_helpers = require("@northern.tech/utils/helpers");
1297
+ var import_toolkit3 = require("@reduxjs/toolkit");
1298
+ var sliceName3 = "devices";
1299
+ var initialState3 = {
1300
+ byId: {
1301
+ // [deviceId]: {
1302
+ // ...,
1303
+ // twinsByIntegration: { [external.provider.id]: twinData }
1304
+ // }
1305
+ },
1306
+ byStatus: {
1307
+ [DEVICE_STATES.accepted]: { deviceIds: [], total: 0 },
1308
+ active: { deviceIds: [], total: 0 },
1309
+ inactive: { deviceIds: [], total: 0 },
1310
+ [DEVICE_STATES.pending]: { deviceIds: [], total: 0 },
1311
+ [DEVICE_STATES.preauth]: { deviceIds: [], total: 0 },
1312
+ [DEVICE_STATES.rejected]: { deviceIds: [], total: 0 }
1313
+ },
1314
+ deviceList: {
1315
+ deviceIds: [],
1316
+ ...DEVICE_LIST_DEFAULTS,
1317
+ selectedAttributes: [],
1318
+ selectedIssues: [],
1319
+ selection: [],
1320
+ sort: {
1321
+ direction: SORTING_OPTIONS.desc
1322
+ // key: null,
1323
+ // scope: null
1324
+ },
1325
+ state: DEVICE_STATES.accepted,
1326
+ total: 0
1327
+ },
1328
+ filters: [
1329
+ // { key: 'device_type', value: 'raspberry', operator: '$eq', scope: 'inventory' }
1330
+ ],
1331
+ filteringAttributes: { identityAttributes: [], inventoryAttributes: [], systemAttributes: [], tagAttributes: [] },
1332
+ filteringAttributesLimit: 10,
1333
+ filteringAttributesConfig: {
1334
+ attributes: {
1335
+ // inventory: ['some_attribute']
1336
+ },
1337
+ count: 0,
1338
+ limit: 100
1339
+ },
1340
+ reports: [
1341
+ // { items: [{ key: "someKey", count: 42 }], otherCount: 123, total: <otherCount + itemsCount> }
1342
+ ],
1343
+ total: 0,
1344
+ limit: 0,
1345
+ groups: {
1346
+ byId: {
1347
+ // groupName: { deviceIds: [], total: 0, filters: [] },
1348
+ // dynamo: { deviceIds: [], total: 3, filters: [{ a: 1 }] }
1349
+ },
1350
+ selectedGroup: void 0
1351
+ }
1352
+ };
1353
+ var devicesSlice = (0, import_toolkit3.createSlice)({
1354
+ name: sliceName3,
1355
+ initialState: initialState3,
1356
+ reducers: {
1357
+ receivedGroups: (state, action) => {
1358
+ state.groups.byId = action.payload;
1359
+ },
1360
+ addToGroup: (state, action) => {
1361
+ const { group, deviceIds } = action.payload;
1362
+ const maybeExistingGroup = {
1363
+ filters: [],
1364
+ deviceIds: [],
1365
+ ...state.groups.byId[group]
1366
+ };
1367
+ state.groups.byId[group] = {
1368
+ ...maybeExistingGroup,
1369
+ deviceIds: [...maybeExistingGroup.deviceIds, ...deviceIds].filter(import_helpers.duplicateFilter),
1370
+ total: (maybeExistingGroup.total || 0) + 1
1371
+ };
1372
+ },
1373
+ removeFromGroup: (state, action) => {
1374
+ const { group, deviceIds: removedIds } = action.payload;
1375
+ const { deviceIds = [], total = 0, ...maybeExistingGroup } = state.groups.byId[group] || {};
1376
+ const changedGroup = {
1377
+ ...maybeExistingGroup,
1378
+ deviceIds: deviceIds.filter((id) => !removedIds.includes(id)),
1379
+ total: Math.max(total - removedIds.length, 0)
1380
+ };
1381
+ if (changedGroup.total || changedGroup.deviceIds.length) {
1382
+ state.groups.byId[group] = changedGroup;
1383
+ return;
1384
+ } else if (state.groups.selectedGroup === group) {
1385
+ state.groups.selectedGroup = void 0;
1386
+ }
1387
+ const { [group]: removal, ...remainingById } = state.groups.byId;
1388
+ state.groups.byId = remainingById;
1389
+ },
1390
+ addGroup: (state, action) => {
1391
+ const { groupName, group } = action.payload;
1392
+ state.groups.byId[groupName] = {
1393
+ ...state.groups.byId[groupName],
1394
+ ...group
1395
+ };
1396
+ },
1397
+ selectGroup: (state, { payload: group }) => {
1398
+ state.deviceList.deviceIds = state.groups.byId[group] && state.groups.byId[group].deviceIds.length > 0 ? state.groups.byId[group].deviceIds : [];
1399
+ state.groups.selectedGroup = group;
1400
+ },
1401
+ removeGroup: (state, action) => {
1402
+ const { [action.payload]: removal, ...remainingById } = state.groups.byId;
1403
+ state.groups.byId = remainingById;
1404
+ state.groups.selectedGroup = state.groups.selectedGroup === action.payload ? void 0 : state.groups.selectedGroup;
1405
+ },
1406
+ setDeviceListState: (state, action) => {
1407
+ state.deviceList = {
1408
+ ...state.deviceList,
1409
+ ...action.payload,
1410
+ sort: {
1411
+ ...state.deviceList.sort,
1412
+ ...action.payload.sort
1413
+ }
1414
+ };
1415
+ },
1416
+ setFilterAttributes: (state, action) => {
1417
+ state.filteringAttributes = action.payload;
1418
+ },
1419
+ setFilterablesConfig: (state, action) => {
1420
+ state.filteringAttributesConfig = action.payload;
1421
+ },
1422
+ receivedDevices: (state, action) => {
1423
+ state.byId = {
1424
+ ...state.byId,
1425
+ ...action.payload
1426
+ };
1427
+ },
1428
+ setDeviceFilters: (state, action) => {
1429
+ if ((0, import_helpers.deepCompare)(action.payload, state.filters)) {
1430
+ return;
1431
+ }
1432
+ state.filters = action.payload.filter((filter) => filter.key && filter.operator && filter.scope && typeof filter.value !== "undefined");
1433
+ },
1434
+ setInactiveDevices: (state, action) => {
1435
+ const { activeDeviceTotal, inactiveDeviceTotal } = action.payload;
1436
+ state.byStatus.active.total = activeDeviceTotal;
1437
+ state.byStatus.inactive.total = inactiveDeviceTotal;
1438
+ },
1439
+ setDeviceReports: (state, action) => {
1440
+ state.reports = action.payload;
1441
+ },
1442
+ setDevicesByStatus: (state, action) => {
1443
+ const { forceUpdate, status, total, deviceIds } = action.payload;
1444
+ state.byStatus[status] = total || forceUpdate ? { deviceIds, total } : state.byStatus[status];
1445
+ },
1446
+ setDevicesCountByStatus: (state, action) => {
1447
+ const { count, status } = action.payload;
1448
+ state.byStatus[status].total = count;
1449
+ },
1450
+ setTotalDevices: (state, action) => {
1451
+ state.total = action.payload;
1452
+ },
1453
+ setDeviceLimit: (state, action) => {
1454
+ state.limit = action.payload;
1455
+ },
1456
+ receivedDevice: (state, action) => {
1457
+ state.byId[action.payload.id] = {
1458
+ ...state.byId[action.payload.id],
1459
+ ...action.payload
1460
+ };
1461
+ },
1462
+ maybeUpdateDevicesByStatus: (state, action) => {
1463
+ const { deviceId, authId } = action.payload;
1464
+ const device = state.byId[deviceId];
1465
+ const hasMultipleAuthSets = authId ? device.auth_sets.filter((authset) => authset.id !== authId).length > 0 : false;
1466
+ if (!hasMultipleAuthSets && Object.values(DEVICE_STATES).includes(device.status)) {
1467
+ const deviceIds = state.byStatus[device.status].deviceIds.filter((id) => id !== deviceId);
1468
+ state.byStatus[device.status] = { deviceIds, total: Math.max(0, state.byStatus[device.status].total - 1) };
1469
+ }
1470
+ }
1471
+ }
1472
+ });
1473
+ var actions3 = devicesSlice.actions;
1474
+ var devicesSlice_default = devicesSlice.reducer;
1475
+
1476
+ // src/monitorSlice/index.ts
1477
+ var import_toolkit4 = require("@reduxjs/toolkit");
1478
+ var sliceName4 = "monitor";
1479
+ var initialState4 = {
1480
+ alerts: {
1481
+ alertList: { ...DEVICE_LIST_DEFAULTS, total: 0 },
1482
+ byDeviceId: {}
1483
+ },
1484
+ issueCounts: {
1485
+ byType: Object.values(DEVICE_ISSUE_OPTIONS).reduce((accu, { key }) => ({ ...accu, [key]: { filtered: 0, total: 0 } }), {})
1486
+ },
1487
+ settings: {
1488
+ global: {
1489
+ channels: {
1490
+ ...Object.keys(alertChannels).reduce((accu, item) => ({ ...accu, [item]: { enabled: true } }), {})
1491
+ }
1492
+ }
1493
+ }
1494
+ };
1495
+ var monitorSlice = (0, import_toolkit4.createSlice)({
1496
+ name: sliceName4,
1497
+ initialState: initialState4,
1498
+ reducers: {
1499
+ changeAlertChannel: (state, action) => {
1500
+ const { channel, enabled } = action.payload;
1501
+ state.settings.global.channels[channel] = { enabled };
1502
+ },
1503
+ receiveDeviceAlerts: (state, action) => {
1504
+ const { deviceId, alerts } = action.payload;
1505
+ state.alerts.byDeviceId[deviceId] = { alerts };
1506
+ },
1507
+ receiveLatestDeviceAlerts: (state, action) => {
1508
+ const { deviceId, alerts } = action.payload;
1509
+ state.alerts.byDeviceId[deviceId] = { ...state.alerts.byDeviceId[deviceId], latest: alerts };
1510
+ },
1511
+ receiveDeviceIssueCounts: (state, action) => {
1512
+ const { issueType, counts } = action.payload;
1513
+ state.issueCounts.byType[issueType] = counts;
1514
+ },
1515
+ setAlertListState: (state, action) => {
1516
+ state.alerts.alertList = { ...state.alerts.alertList, ...action.payload };
1517
+ }
1518
+ }
1519
+ });
1520
+ var actions4 = monitorSlice.actions;
1521
+ var monitorSlice_default = monitorSlice.reducer;
1522
+
1523
+ // src/onboardingSlice/index.ts
1524
+ var import_toolkit5 = require("@reduxjs/toolkit");
1525
+ var sliceName5 = "onboarding";
1526
+ var initialState5 = {
1527
+ approach: null,
1528
+ complete: false,
1529
+ deviceType: null,
1530
+ demoArtifactPort: 85,
1531
+ progress: null,
1532
+ showTips: null,
1533
+ showTipsDialog: false
1534
+ };
1535
+ var onboardingSlice = (0, import_toolkit5.createSlice)({
1536
+ name: sliceName5,
1537
+ initialState: initialState5,
1538
+ reducers: {
1539
+ setOnboardingState: (state, action) => {
1540
+ return { ...state, ...action.payload };
1541
+ },
1542
+ setDemoArtifactPort: (state, action) => {
1543
+ state.demoArtifactPort = action.payload;
1544
+ },
1545
+ setShowOnboardingHelp: (state, action) => {
1546
+ state.showTips = action.payload;
1547
+ },
1548
+ setShowDismissOnboardingTipsDialog: (state, action) => {
1549
+ state.showTipsDialog = action.payload;
1550
+ },
1551
+ setOnboardingComplete: (state, action) => {
1552
+ state.complete = action.payload;
1553
+ },
1554
+ setOnboardingProgress: (state, action) => {
1555
+ state.progress = action.payload;
1556
+ },
1557
+ setOnboardingDeviceType: (state, action) => {
1558
+ state.deviceType = action.payload;
1559
+ },
1560
+ setOnboardingApproach: (state, action) => {
1561
+ state.approach = action.payload;
1562
+ }
1563
+ }
1564
+ });
1565
+ var actions5 = onboardingSlice.actions;
1566
+ var onboardingSlice_default = onboardingSlice.reducer;
1567
+
1568
+ // src/organizationSlice/index.ts
1569
+ var import_toolkit6 = require("@reduxjs/toolkit");
1570
+ var sliceName6 = "organization";
1571
+ var initialState6 = {
1572
+ card: {
1573
+ last4: "",
1574
+ expiration: { month: 1, year: 2020 },
1575
+ brand: ""
1576
+ },
1577
+ intentId: null,
1578
+ tenantList: {
1579
+ ...TENANT_LIST_DEFAULT,
1580
+ total: 0,
1581
+ tenants: [],
1582
+ selectedTenant: null,
1583
+ sort: {
1584
+ direction: SORTING_OPTIONS.desc,
1585
+ key: "name"
1586
+ }
1587
+ },
1588
+ organization: {
1589
+ // id, name, status, tenant_token, plan
1590
+ },
1591
+ auditlog: {
1592
+ events: [],
1593
+ selectionState: {
1594
+ ...DEVICE_LIST_DEFAULTS,
1595
+ detail: void 0,
1596
+ endDate: void 0,
1597
+ selectedIssue: void 0,
1598
+ sort: { direction: SORTING_OPTIONS.desc },
1599
+ startDate: void 0,
1600
+ total: 0,
1601
+ type: void 0,
1602
+ user: void 0
1603
+ }
1604
+ },
1605
+ externalDeviceIntegrations: [
1606
+ // { <connection_string|x509|...>, id, provider }
1607
+ ],
1608
+ ssoConfigs: [],
1609
+ webhooks: {
1610
+ // [id]: { events: [] }
1611
+ // for now:
1612
+ events: [],
1613
+ eventsTotal: 0
1614
+ }
1615
+ };
1616
+ var organizationSlice = (0, import_toolkit6.createSlice)({
1617
+ name: sliceName6,
1618
+ initialState: initialState6,
1619
+ reducers: {
1620
+ receiveAuditLogs: (state, action) => {
1621
+ const { events, total } = action.payload;
1622
+ state.auditlog.events = events;
1623
+ state.auditlog.selectionState.total = total;
1624
+ },
1625
+ setAuditLogState: (state, action) => {
1626
+ state.auditlog.selectionState = {
1627
+ ...state.auditlog.selectionState,
1628
+ ...action.payload
1629
+ };
1630
+ },
1631
+ receiveCurrentCard: (state, action) => {
1632
+ state.card = action.payload;
1633
+ },
1634
+ receiveSetupIntent: (state, action) => {
1635
+ state.intentId = action.payload;
1636
+ },
1637
+ setOrganization: (state, action) => {
1638
+ state.organization = { ...state.organization, ...action.payload };
1639
+ },
1640
+ setTenantListState: (state, action) => {
1641
+ state.tenantList = action.payload;
1642
+ },
1643
+ receiveExternalDeviceIntegrations: (state, action) => {
1644
+ state.externalDeviceIntegrations = action.payload;
1645
+ },
1646
+ receiveSsoConfigs: (state, action) => {
1647
+ state.ssoConfigs = action.payload;
1648
+ },
1649
+ receiveWebhookEvents: (state, action) => {
1650
+ const { value, total } = action.payload;
1651
+ state.webhooks.events = value;
1652
+ state.webhooks.eventsTotal = total;
1653
+ }
1654
+ }
1655
+ });
1656
+ var actions6 = organizationSlice.actions;
1657
+ var organizationSlice_default = organizationSlice.reducer;
1658
+
1659
+ // src/releasesSlice/index.ts
1660
+ var import_toolkit7 = require("@reduxjs/toolkit");
1661
+ var sliceName7 = "releases";
1662
+ var initialState7 = {
1663
+ /*
1664
+ * Return list of saved artifacts objects
1665
+ */
1666
+ /*
1667
+ * return list of artifacts where duplicate names are collated with device compatibility lists combined
1668
+ */
1669
+ // artifacts: AppStore.getCollatedArtifacts(AppStore.getArtifactsRepo()),
1670
+ artifacts: [],
1671
+ /*
1672
+ * Return list of saved release objects
1673
+ */
1674
+ byId: {
1675
+ /*
1676
+ [releaseName]: {
1677
+ artifacts: [
1678
+ {
1679
+ id: '',
1680
+ name: '',
1681
+ description: '',
1682
+ device_types_compatible: [],
1683
+ ...
1684
+ updates: [{
1685
+ files: [
1686
+ { size: 123, name: '' }
1687
+ ],
1688
+ type_info: { type: '' }
1689
+ }],
1690
+ url: '' // optional
1691
+ }
1692
+ ],
1693
+ modified: ''
1694
+ device_types_compatible,
1695
+ name: '',
1696
+ tags: ['something'],
1697
+ notes: ''
1698
+ }
1699
+ */
1700
+ },
1701
+ releasesList: {
1702
+ ...DEVICE_LIST_DEFAULTS,
1703
+ searchedIds: [],
1704
+ releaseIds: [],
1705
+ selection: [],
1706
+ sort: {
1707
+ direction: SORTING_OPTIONS.desc,
1708
+ key: "modified"
1709
+ },
1710
+ isLoading: void 0,
1711
+ searchTerm: "",
1712
+ searchTotal: 0,
1713
+ selectedTags: [],
1714
+ total: 0,
1715
+ type: ""
1716
+ },
1717
+ tags: [],
1718
+ updateTypes: [],
1719
+ /*
1720
+ * Return single release with corresponding Artifacts
1721
+ */
1722
+ selectedRelease: null
1723
+ };
1724
+ var releaseSlice = (0, import_toolkit7.createSlice)({
1725
+ name: sliceName7,
1726
+ initialState: initialState7,
1727
+ reducers: {
1728
+ receiveRelease: (state, action) => {
1729
+ const { name } = action.payload;
1730
+ state.byId[name] = action.payload;
1731
+ },
1732
+ receiveReleases: (state, action) => {
1733
+ state.byId = action.payload;
1734
+ },
1735
+ receiveReleaseTags: (state, action) => {
1736
+ state.tags = action.payload;
1737
+ },
1738
+ receiveReleaseTypes: (state, action) => {
1739
+ state.updateTypes = action.payload;
1740
+ },
1741
+ removeRelease: (state, action) => {
1742
+ const { [action.payload]: toBeRemoved, ...byId } = state.byId;
1743
+ state.byId = byId;
1744
+ state.selectedRelease = action.payload === state.selectedRelease ? null : state.selectedRelease;
1745
+ },
1746
+ selectedRelease: (state, action) => {
1747
+ state.selectedRelease = action.payload;
1748
+ },
1749
+ setReleaseListState: (state, action) => {
1750
+ state.releasesList = action.payload;
1751
+ }
1752
+ }
1753
+ });
1754
+ var actions7 = releaseSlice.actions;
1755
+ var releasesSlice_default = releaseSlice.reducer;
1756
+
1757
+ // src/usersSlice/index.ts
1758
+ var import_toolkit8 = require("@reduxjs/toolkit");
1759
+ var sliceName8 = "users";
1760
+ var initialState8 = {
1761
+ activationCode: void 0,
1762
+ byId: {},
1763
+ currentUser: null,
1764
+ currentSession: {
1765
+ // { token: window.localStorage.getItem('JWT'), expiresAt: '2023-01-01T00:15:00.000Z' | undefined }, // expiresAt depending on the stay logged in setting
1766
+ },
1767
+ customColumns: [],
1768
+ qrCode: null,
1769
+ globalSettings: {
1770
+ id_attribute: void 0,
1771
+ previousFilters: [],
1772
+ previousPhases: [],
1773
+ retries: 0
1774
+ },
1775
+ permissionSetsById: {
1776
+ ...defaultPermissionSets
1777
+ },
1778
+ rolesById: {
1779
+ ...rolesById
1780
+ },
1781
+ settingsInitialized: false,
1782
+ showConnectDeviceDialog: false,
1783
+ showFeedbackDialog: false,
1784
+ showStartupNotification: false,
1785
+ tooltips: {
1786
+ byId: {
1787
+ // <id>: { readState: <read|unread> } // this object is getting enhanced by the tooltip texts in the app constants
1788
+ }
1789
+ },
1790
+ userSettings: {
1791
+ columnSelection: [],
1792
+ onboarding: {}
1793
+ },
1794
+ userSettingsInitialized: false
1795
+ };
1796
+ var usersSlice = (0, import_toolkit8.createSlice)({
1797
+ name: sliceName8,
1798
+ initialState: initialState8,
1799
+ reducers: {
1800
+ receivedQrCode: (state, action) => {
1801
+ state.qrCode = action.payload;
1802
+ },
1803
+ successfullyLoggedIn: (state, action) => {
1804
+ state.currentSession = action.payload;
1805
+ },
1806
+ receivedUserList: (state, action) => {
1807
+ state.byId = action.payload;
1808
+ },
1809
+ receivedActivationCode: (state, action) => {
1810
+ state.activationCode = action.payload;
1811
+ },
1812
+ receivedUser: (state, action) => {
1813
+ state.byId[action.payload.id] = action.payload;
1814
+ state.currentUser = action.payload.id;
1815
+ },
1816
+ createdUser: (state, action) => {
1817
+ state.byId[0] = action.payload;
1818
+ },
1819
+ removedUser: (state, action) => {
1820
+ const { [action.payload]: removedUser, ...byId } = state.byId;
1821
+ state.byId = byId;
1822
+ state.currentUser = state.currentUser === action.payload ? null : state.currentUser;
1823
+ },
1824
+ updatedUser: (state, action) => {
1825
+ state.byId[action.payload.id] = {
1826
+ ...state.byId[action.payload.id],
1827
+ ...action.payload
1828
+ };
1829
+ },
1830
+ receivedPermissionSets: (state, action) => {
1831
+ state.permissionSetsById = action.payload;
1832
+ },
1833
+ receivedRoles: (state, action) => {
1834
+ state.rolesById = action.payload;
1835
+ },
1836
+ createdRole: (state, action) => {
1837
+ state.rolesById[action.payload.name] = {
1838
+ ...state.rolesById[action.payload.name],
1839
+ ...action.payload
1840
+ };
1841
+ },
1842
+ removedRole: (state, action) => {
1843
+ const { [action.payload]: toBeRemoved, ...rolesById2 } = state.rolesById;
1844
+ state.rolesById = rolesById2;
1845
+ },
1846
+ setCustomColumns: (state, action) => {
1847
+ state.customColumns = action.payload;
1848
+ },
1849
+ setGlobalSettings: (state, action) => {
1850
+ state.settingsInitialized = true;
1851
+ state.globalSettings = {
1852
+ ...state.globalSettings,
1853
+ ...action.payload
1854
+ };
1855
+ },
1856
+ setUserSettings: (state, action) => {
1857
+ state.userSettingsInitialized = true;
1858
+ state.userSettings = {
1859
+ ...state.userSettings,
1860
+ ...action.payload
1861
+ };
1862
+ },
1863
+ setTooltipState: (state, action) => {
1864
+ const { id, readState = READ_STATES.read } = action.payload;
1865
+ state.tooltips.byId[id].readState = readState;
1866
+ },
1867
+ setTooltipsState: (state, action) => {
1868
+ state.tooltips.byId = {
1869
+ ...state.tooltips.byId,
1870
+ ...action.payload
1871
+ };
1872
+ },
1873
+ setShowFeedbackDialog: (state, action) => {
1874
+ state.showFeedbackDialog = action.payload;
1875
+ },
1876
+ setShowConnectingDialog: (state, action) => {
1877
+ state.showConnectDeviceDialog = action.payload;
1878
+ },
1879
+ setShowStartupNotification: (state, action) => {
1880
+ state.showStartupNotification = action.payload;
1881
+ }
1882
+ }
1883
+ });
1884
+ var actions8 = usersSlice.actions;
1885
+ var usersSlice_default = usersSlice.reducer;
1886
+
1887
+ // src/actions.ts
1888
+ var actions_default = {
1889
+ ...actions,
1890
+ ...actions2,
1891
+ ...actions3,
1892
+ ...actions4,
1893
+ ...actions5,
1894
+ ...actions6,
1895
+ ...actions7,
1896
+ ...actions8
1897
+ };
1898
+
1899
+ // src/api/general-api.ts
1900
+ var import_axios = __toESM(require("axios"), 1);
1901
+
1902
+ // src/auth.ts
1903
+ var import_universal_cookie = __toESM(require("universal-cookie"), 1);
1904
+ var cookies = new import_universal_cookie.default();
1905
+ var emptySession = Object.freeze({ token: "", exiresAt: void 0 });
1906
+ var tokenCache = "";
1907
+ var getSessionInfo = () => {
1908
+ let sessionInfo = { ...emptySession };
1909
+ try {
1910
+ sessionInfo = JSON.parse(window.localStorage.getItem("JWT") ?? "");
1911
+ } catch {
1912
+ }
1913
+ if (sessionInfo.expiresAt && new Date(sessionInfo.expiresAt) < /* @__PURE__ */ new Date()) {
1914
+ cleanUp();
1915
+ return { ...emptySession };
1916
+ }
1917
+ if (!sessionInfo.token) {
1918
+ let jwtTokenFromCookie = cookies.get("JWT", { doNotParse: true }) ?? "";
1919
+ if (jwtTokenFromCookie) {
1920
+ setSessionInfo({ token: jwtTokenFromCookie, undefined: void 0 });
1921
+ sessionInfo.token = jwtTokenFromCookie;
1922
+ cookies.remove("JWT");
1923
+ cookies.remove("JWT", { path: "/" });
1924
+ }
1925
+ }
1926
+ sessionInfo.token = sessionInfo.token || void 0;
1927
+ tokenCache = sessionInfo.token;
1928
+ return sessionInfo;
1929
+ };
1930
+ var getToken = () => tokenCache ? tokenCache : getSessionInfo().token;
1931
+ var setSessionInfo = ({ token, expiresAt }) => {
1932
+ tokenCache = token;
1933
+ window.localStorage.setItem("JWT", JSON.stringify({ token, expiresAt }));
1934
+ };
1935
+ var cleanUp = () => {
1936
+ tokenCache = "";
1937
+ cookies.remove("JWT");
1938
+ cookies.remove("JWT", { path: "/" });
1939
+ window.localStorage.removeItem("JWT");
1940
+ window.localStorage.removeItem("oauth");
1941
+ };
1942
+
1943
+ // src/api/general-api.ts
1944
+ var unauthorizedRedirect = (error) => {
1945
+ if (!(0, import_axios.isCancel)(error) && error.response?.status === 401 && getToken()) {
1946
+ cleanUp();
1947
+ window.location.replace("/ui/");
1948
+ }
1949
+ return Promise.reject(error);
1950
+ };
1951
+ var commonRequestConfig = { timeout: TIMEOUTS.refreshDefault, headers: { "Content-Type": "application/json" } };
1952
+ var authenticatedRequest = import_axios.default.create(commonRequestConfig);
1953
+ authenticatedRequest.interceptors.response.use((res) => res, unauthorizedRedirect);
1954
+ authenticatedRequest.interceptors.request.use(
1955
+ (config) => ({ ...config, headers: { ...config.headers, Authorization: `Bearer ${getToken()}` } }),
1956
+ (error) => Promise.reject(error)
1957
+ );
1958
+ var Api = {
1959
+ get: authenticatedRequest.get,
1960
+ delete: (url, data) => authenticatedRequest.request({ method: "delete", url, data }),
1961
+ patch: authenticatedRequest.patch,
1962
+ post: authenticatedRequest.post,
1963
+ postUnauthorized: (url, data, config = {}) => import_axios.default.post(url, data, { ...commonRequestConfig, ...config }),
1964
+ put: authenticatedRequest.put,
1965
+ upload: (url, formData, progress2, cancelSignal) => authenticatedRequest.post(url, formData, {
1966
+ headers: { "Content-Type": "multipart/form-data" },
1967
+ onUploadProgress: progress2,
1968
+ timeout: 0,
1969
+ signal: cancelSignal
1970
+ }),
1971
+ uploadPut: (url, formData, progress2, cancelSignal) => authenticatedRequest.put(url, formData, {
1972
+ headers: { "Content-Type": "multipart/form-data" },
1973
+ onUploadProgress: progress2,
1974
+ timeout: 0,
1975
+ signal: cancelSignal
1976
+ })
1977
+ };
1978
+ var general_api_default = Api;
1979
+
1980
+ // src/appSlice/selectors.ts
1981
+ var import_helpers2 = require("@northern.tech/utils/helpers");
1982
+ var import_toolkit9 = require("@reduxjs/toolkit");
1983
+ var getAppDocsVersion = (state) => state.app.docsVersion;
1984
+ var getFeatures = (state) => state.app.features;
1985
+ var getFullVersionInformation = (state) => state.app.versionInformation;
1986
+ var getDocsVersion = (0, import_toolkit9.createSelector)([getAppDocsVersion, getFeatures], (appDocsVersion, { isHosted }) => {
1987
+ const docsVersion = appDocsVersion ? `${appDocsVersion}/` : "development/";
1988
+ return isHosted ? "" : docsVersion;
1989
+ });
1990
+ var getSearchState = (state) => state.app.searchState;
1991
+ var getSearchedDevices = (0, import_toolkit9.createSelector)([getSearchState], ({ deviceIds }) => deviceIds);
1992
+ var getVersionInformation = (0, import_toolkit9.createSelector)(
1993
+ [getFullVersionInformation, getFeatures],
1994
+ ({ Integration, ...remainder }, { isHosted }) => isHosted && Integration !== "next" ? remainder : { ...remainder, Integration }
1995
+ );
1996
+ var getIsPreview = (0, import_toolkit9.createSelector)([getFullVersionInformation], ({ Integration }) => (0, import_helpers2.versionCompare)(Integration, "next") > -1);
1997
+
1998
+ // src/commonSelectors.ts
1999
+ var import_helpers5 = require("@northern.tech/utils/helpers");
2000
+ var import_toolkit15 = require("@reduxjs/toolkit");
2001
+
2002
+ // src/deploymentsSlice/selectors.ts
2003
+ var import_toolkit10 = require("@reduxjs/toolkit");
2004
+ var getDeploymentsById = (state) => state.deployments.byId;
2005
+ var getDeploymentsByStatus = (state) => state.deployments.byStatus;
2006
+ var getSelectedDeploymentDeviceIds = (state) => state.deployments.selectedDeviceIds;
2007
+ var getDeploymentsSelectionState = (state) => state.deployments.selectionState;
2008
+ var getMappedDeploymentSelection = (0, import_toolkit10.createSelector)(
2009
+ [getDeploymentsSelectionState, (_, deploymentsState) => deploymentsState, getDeploymentsById],
2010
+ (selectionState, deploymentsState, deploymentsById) => {
2011
+ const { selection = [] } = selectionState[deploymentsState] ?? {};
2012
+ return selection.reduce((accu, id) => {
2013
+ if (deploymentsById[id]) {
2014
+ accu.push(deploymentsById[id]);
2015
+ }
2016
+ return accu;
2017
+ }, []);
2018
+ }
2019
+ );
2020
+ var relevantDeploymentStates = [DEPLOYMENT_STATES.pending, DEPLOYMENT_STATES.inprogress, DEPLOYMENT_STATES.finished];
2021
+ var DEPLOYMENT_CUTOFF = 3;
2022
+ var getRecentDeployments = (0, import_toolkit10.createSelector)(
2023
+ [getDeploymentsById, getDeploymentsByStatus],
2024
+ (deploymentsById, deploymentsByStatus) => Object.entries(deploymentsByStatus).reduce(
2025
+ (accu, [state, byStatus]) => {
2026
+ if (!relevantDeploymentStates.includes(state) || !byStatus.deploymentIds.length) {
2027
+ return accu;
2028
+ }
2029
+ accu[state] = byStatus.deploymentIds.reduce((accu2, id) => {
2030
+ if (deploymentsById[id]) {
2031
+ accu2.push(deploymentsById[id]);
2032
+ }
2033
+ return accu2;
2034
+ }, []).slice(0, DEPLOYMENT_CUTOFF);
2035
+ accu.total += byStatus.total;
2036
+ return accu;
2037
+ },
2038
+ { total: 0 }
2039
+ )
2040
+ );
2041
+
2042
+ // src/devicesSlice/selectors.ts
2043
+ var import_helpers3 = require("@northern.tech/utils/helpers");
2044
+ var import_toolkit11 = require("@reduxjs/toolkit");
2045
+ var getAcceptedDevices = (state) => state.devices.byStatus.accepted;
2046
+ var getDevicesByStatus = (state) => state.devices.byStatus;
2047
+ var getDevicesById = (state) => state.devices.byId;
2048
+ var getGroupsById = (state) => state.devices.groups.byId;
2049
+ var getSelectedGroup = (state) => state.devices.groups.selectedGroup;
2050
+ var getListedDevices = (state) => state.devices.deviceList.deviceIds;
2051
+ var getFilteringAttributes = (state) => state.devices.filteringAttributes;
2052
+ var getFilteringAttributesFromConfig = (state) => state.devices.filteringAttributesConfig.attributes;
2053
+ var getSortedFilteringAttributes = (0, import_toolkit11.createSelector)([getFilteringAttributes], (filteringAttributes) => ({
2054
+ ...filteringAttributes,
2055
+ identityAttributes: [...filteringAttributes.identityAttributes, "id"]
2056
+ }));
2057
+ var getDeviceLimit = (state) => state.devices.limit;
2058
+ var getFilteringAttributesLimit = (state) => state.devices.filteringAttributesLimit;
2059
+ var getDeviceIdentityAttributes = (0, import_toolkit11.createSelector)(
2060
+ [getFilteringAttributes, getFilteringAttributesLimit],
2061
+ ({ identityAttributes }, filteringAttributesLimit) => {
2062
+ const attributes = identityAttributes.slice(0, filteringAttributesLimit);
2063
+ return attributes.reduce(
2064
+ (accu, value) => {
2065
+ accu.push({ value, label: value, scope: "identity" });
2066
+ return accu;
2067
+ },
2068
+ [
2069
+ { value: "name", label: "Name", scope: "tags" },
2070
+ { value: "id", label: "Device ID", scope: "identity" }
2071
+ ]
2072
+ );
2073
+ }
2074
+ );
2075
+ var getDeviceCountsByStatus = (0, import_toolkit11.createSelector)(
2076
+ [getDevicesByStatus],
2077
+ (byStatus) => Object.values(DEVICE_STATES).reduce((accu, state) => {
2078
+ accu[state] = byStatus[state].total || 0;
2079
+ return accu;
2080
+ }, {})
2081
+ );
2082
+ var getDeviceById = (0, import_toolkit11.createSelector)([getDevicesById, (_, deviceId) => deviceId], (devicesById, deviceId = "") => devicesById[deviceId] ?? {});
2083
+ var getSelectedGroupInfo = (0, import_toolkit11.createSelector)(
2084
+ [getAcceptedDevices, getGroupsById, getSelectedGroup],
2085
+ ({ total: acceptedDeviceTotal }, groupsById, selectedGroup) => {
2086
+ let groupCount = acceptedDeviceTotal;
2087
+ let groupFilters = [];
2088
+ if (selectedGroup && groupsById[selectedGroup]) {
2089
+ groupCount = groupsById[selectedGroup].total;
2090
+ groupFilters = groupsById[selectedGroup].filters || [];
2091
+ }
2092
+ return { groupCount, selectedGroup, groupFilters };
2093
+ }
2094
+ );
2095
+ var getLimitMaxed = (0, import_toolkit11.createSelector)(
2096
+ [getAcceptedDevices, getDeviceLimit],
2097
+ ({ total: acceptedDevices = 0 }, deviceLimit) => Boolean(deviceLimit && deviceLimit <= acceptedDevices)
2098
+ );
2099
+ var getGroupsByIdWithoutUngrouped = (0, import_toolkit11.createSelector)([getGroupsById], ({ [UNGROUPED_GROUP.id]: ungrouped, ...groups }) => groups);
2100
+ var getGroups = (0, import_toolkit11.createSelector)([getGroupsById], (groupsById) => {
2101
+ const groupNames = Object.keys(groupsById).sort();
2102
+ const groupedGroups = Object.entries(groupsById).sort((a, b) => a[0].localeCompare(b[0])).reduce(
2103
+ (accu, [groupname, group]) => {
2104
+ const name = groupname === UNGROUPED_GROUP.id ? UNGROUPED_GROUP.name : groupname;
2105
+ const groupItem = { ...group, groupId: name, name: groupname };
2106
+ if (group.filters.length > 0) {
2107
+ if (groupname !== UNGROUPED_GROUP.id) {
2108
+ accu.dynamic.push(groupItem);
2109
+ } else {
2110
+ accu.ungrouped.push(groupItem);
2111
+ }
2112
+ } else {
2113
+ accu.static.push(groupItem);
2114
+ }
2115
+ return accu;
2116
+ },
2117
+ { dynamic: [], static: [], ungrouped: [] }
2118
+ );
2119
+ return { groupNames, ...groupedGroups };
2120
+ });
2121
+ var getAttributesList = (0, import_toolkit11.createSelector)(
2122
+ [getFilteringAttributes, getFilteringAttributesFromConfig],
2123
+ ({ identityAttributes = [], inventoryAttributes = [] }, { identity = [], inventory = [] }) => [...identityAttributes, ...inventoryAttributes, ...identity, ...inventory].filter(import_helpers3.duplicateFilter)
2124
+ );
2125
+ var getDeviceTypes = (0, import_toolkit11.createSelector)(
2126
+ [getAcceptedDevices, getDevicesById],
2127
+ ({ deviceIds = [] }, devicesById) => Object.keys(
2128
+ deviceIds.slice(0, 200).reduce((accu, item) => {
2129
+ const { device_type: deviceTypes = [] } = devicesById[item] ? devicesById[item].attributes : {};
2130
+ accu = deviceTypes.reduce((deviceTypeAccu, deviceType) => {
2131
+ if (deviceType.length > 1) {
2132
+ deviceTypeAccu[deviceType] = deviceTypeAccu[deviceType] ? deviceTypeAccu[deviceType] + 1 : 1;
2133
+ }
2134
+ return deviceTypeAccu;
2135
+ }, accu);
2136
+ return accu;
2137
+ }, {})
2138
+ )
2139
+ );
2140
+
2141
+ // src/monitorSlice/selectors.ts
2142
+ var getIssueCountsByType = (state) => state.monitor.issueCounts.byType;
2143
+
2144
+ // src/onboardingSlice/selectors.ts
2145
+ var getOnboarding = (state) => state.onboarding;
2146
+
2147
+ // src/organizationSlice/selectors.ts
2148
+ var import_toolkit12 = require("@reduxjs/toolkit");
2149
+ var getOrganization = (state) => state.organization.organization;
2150
+ var getExternalIntegrations = (state) => state.organization.externalDeviceIntegrations;
2151
+ var getAuditLog = (state) => state.organization.auditlog.events;
2152
+ var getAuditLogSelectionState = (state) => state.organization.auditlog.selectionState;
2153
+ var getWebhookEvents = (state) => state.organization.webhooks.events;
2154
+ var getWebhookEventTotal = (state) => state.organization.webhooks.eventTotal;
2155
+ var getDeviceTwinIntegrations = (0, import_toolkit12.createSelector)(
2156
+ [getExternalIntegrations],
2157
+ (integrations) => integrations.filter((integration) => integration.id && EXTERNAL_PROVIDER[integration.provider]?.deviceTwin)
2158
+ );
2159
+ var getIsServiceProvider = (state) => state.organization.organization.service_provider;
2160
+ var getWebhooks = (0, import_toolkit12.createSelector)(
2161
+ [getExternalIntegrations],
2162
+ (integrations) => integrations.filter((integration) => integration.id && integration.provider === EXTERNAL_PROVIDER.webhook.provider)
2163
+ );
2164
+ var getWebhookEventInfo = (0, import_toolkit12.createSelector)(
2165
+ [getWebhooks, getWebhookEvents, getWebhookEventTotal],
2166
+ (webhooks, events, eventTotal) => webhooks.length ? { events, eventTotal } : { events: [], eventTotal: 0 }
2167
+ );
2168
+ var getAuditLogEntry = (0, import_toolkit12.createSelector)([getAuditLog, getAuditLogSelectionState], (events, { selectedId }) => {
2169
+ if (!selectedId) {
2170
+ return;
2171
+ }
2172
+ const [eventAction, eventTime] = atob(selectedId).split("|");
2173
+ return events.find((item) => item.action === eventAction && item.time === eventTime);
2174
+ });
2175
+
2176
+ // src/utils.ts
2177
+ var import_helpers4 = require("@northern.tech/utils/helpers");
2178
+ var filterProcessors = {
2179
+ $gt: (val) => Number(val) || val,
2180
+ $gte: (val) => Number(val) || val,
2181
+ $lt: (val) => Number(val) || val,
2182
+ $lte: (val) => Number(val) || val,
2183
+ $in: (val) => ("" + val).split(",").map((i) => i.trim()),
2184
+ $nin: (val) => ("" + val).split(",").map((i) => i.trim()),
2185
+ $exists: import_helpers4.yes,
2186
+ $nexists: () => false
2187
+ };
2188
+ var filterAliases = {
2189
+ $nexists: { alias: DEVICE_FILTERING_OPTIONS.$exists.key, value: false }
2190
+ };
2191
+ var mapFiltersToTerms = (filters) => filters.map((filter) => ({
2192
+ scope: filter.scope,
2193
+ attribute: filter.key,
2194
+ type: filterAliases[filter.operator]?.alias || filter.operator,
2195
+ value: filterProcessors.hasOwnProperty(filter.operator) ? filterProcessors[filter.operator](filter.value) : filter.value
2196
+ }));
2197
+ var convertIssueOptionsToFilters = (issuesSelection, filtersState = {}) => issuesSelection.map((item) => {
2198
+ if (typeof DEVICE_ISSUE_OPTIONS[item].filterRule.value === "function") {
2199
+ return { ...DEVICE_ISSUE_OPTIONS[item].filterRule, value: DEVICE_ISSUE_OPTIONS[item].filterRule.value(filtersState) };
2200
+ }
2201
+ return DEVICE_ISSUE_OPTIONS[item].filterRule;
2202
+ });
2203
+ var convertDeviceListStateToFilters = ({ filters = [], group, groups = { byId: {} }, offlineThreshold, selectedIssues = [], status }) => {
2204
+ let applicableFilters = [...filters];
2205
+ if (typeof group === "string" && !(groups.byId[group]?.filters || applicableFilters).length) {
2206
+ applicableFilters.push({ key: "group", value: group, operator: DEVICE_FILTERING_OPTIONS.$eq.key, scope: "system" });
2207
+ }
2208
+ const nonMonitorFilters = applicableFilters.filter(
2209
+ (filter) => !Object.values(DEVICE_ISSUE_OPTIONS).some(
2210
+ ({ filterRule }) => filter.scope !== "inventory" && filterRule.scope === filter.scope && filterRule.key === filter.key
2211
+ )
2212
+ );
2213
+ const deviceIssueFilters = convertIssueOptionsToFilters(selectedIssues, { offlineThreshold });
2214
+ applicableFilters = [...nonMonitorFilters, ...deviceIssueFilters];
2215
+ const effectiveFilters = status ? [...applicableFilters, { key: "status", value: status, operator: DEVICE_FILTERING_OPTIONS.$eq.key, scope: "identity" }] : applicableFilters;
2216
+ return { applicableFilters: nonMonitorFilters, filterTerms: mapFiltersToTerms(effectiveFilters) };
2217
+ };
2218
+ var listItemMapper = (byId, ids, { defaultObject = {}, cutOffSize = DEVICE_LIST_MAXIMUM_LENGTH }) => {
2219
+ return ids.slice(0, cutOffSize).reduce((accu, id) => {
2220
+ if (id && byId[id]) {
2221
+ accu.push({ ...defaultObject, ...byId[id] });
2222
+ }
2223
+ return accu;
2224
+ }, []);
2225
+ };
2226
+ var mergePermissions = (existingPermissions = { ...emptyUiPermissions }, addedPermissions) => Object.entries(existingPermissions).reduce(
2227
+ (accu, [key, value]) => {
2228
+ let values;
2229
+ if (!accu[key]) {
2230
+ accu[key] = value;
2231
+ return accu;
2232
+ }
2233
+ if (Array.isArray(value)) {
2234
+ values = [...value, ...accu[key]].filter(import_helpers4.duplicateFilter);
2235
+ } else {
2236
+ values = mergePermissions(accu[key], { ...value });
2237
+ }
2238
+ accu[key] = values;
2239
+ return accu;
2240
+ },
2241
+ { ...addedPermissions }
2242
+ );
2243
+ var mapUserRolesToUiPermissions = (userRoles, roles) => userRoles.reduce(
2244
+ (accu, roleId) => {
2245
+ if (!(roleId && roles[roleId])) {
2246
+ return accu;
2247
+ }
2248
+ return mergePermissions(accu, roles[roleId].uiPermissions);
2249
+ },
2250
+ { ...emptyUiPermissions }
2251
+ );
2252
+ var progress = ({ loaded, total }) => {
2253
+ let uploadProgress3 = loaded / total * 100;
2254
+ return uploadProgress3 = uploadProgress3 < 50 ? Math.ceil(uploadProgress3) : Math.round(uploadProgress3);
2255
+ };
2256
+ var isDarkMode = (mode) => mode === DARK_MODE;
2257
+
2258
+ // src/releasesSlice/selectors.ts
2259
+ var import_toolkit13 = require("@reduxjs/toolkit");
2260
+ var getSelectedReleaseId = (state) => state.releases.selectedRelease;
2261
+ var getReleasesById = (state) => state.releases.byId;
2262
+ var getReleaseTags = (state) => state.releases.tags;
2263
+ var getReleaseListState = (state) => state.releases.releasesList;
2264
+ var getListedReleases = (state) => state.releases.releasesList.releaseIds;
2265
+ var getReleaseMappingDefaults = () => ({});
2266
+ var getReleasesList = (0, import_toolkit13.createSelector)([getReleasesById, getListedReleases, getReleaseMappingDefaults], listItemMapper);
2267
+ var getReleaseTagsById = (0, import_toolkit13.createSelector)([getReleaseTags], (releaseTags) => releaseTags.reduce((accu, key) => ({ ...accu, [key]: key }), {}));
2268
+ var getHasReleases = (0, import_toolkit13.createSelector)(
2269
+ [getReleaseListState, getReleasesById],
2270
+ ({ searchTotal, total }, byId) => !!(Object.keys(byId).length || total || searchTotal)
2271
+ );
2272
+ var getSelectedRelease = (0, import_toolkit13.createSelector)([getReleasesById, getSelectedReleaseId], (byId, id) => byId[id] ?? {});
2273
+
2274
+ // src/usersSlice/selectors.ts
2275
+ var import_toolkit14 = require("@reduxjs/toolkit");
2276
+ var getRolesById = (state) => state.users.rolesById;
2277
+ var getTooltipsById = (state) => state.users.tooltips.byId;
2278
+ var getGlobalSettings = (state) => state.users.globalSettings;
2279
+ var getCurrentUserId = (state) => state.users.currentUser;
2280
+ var getUsersById = (state) => state.users.byId;
2281
+ var getCurrentUser = (0, import_toolkit14.createSelector)([getUsersById, getCurrentUserId], (usersById, userId) => usersById[userId] ?? {});
2282
+ var getUserSettings = (state) => state.users.userSettings;
2283
+ var getIsDarkMode = (0, import_toolkit14.createSelector)([getUserSettings], ({ mode }) => isDarkMode(mode));
2284
+ var getShowHelptips = (0, import_toolkit14.createSelector)(
2285
+ [getTooltipsById],
2286
+ (tooltips) => Object.values(tooltips).reduce((accu, { readState }) => accu || readState === READ_STATES.unread, false)
2287
+ );
2288
+ var getTooltipsState = (0, import_toolkit14.createSelector)(
2289
+ [getTooltipsById, getUserSettings],
2290
+ (byId, { tooltips = {} }) => Object.entries(byId).reduce(
2291
+ (accu, [id, value]) => {
2292
+ accu[id] = { ...accu[id], ...value };
2293
+ return accu;
2294
+ },
2295
+ { ...tooltips }
2296
+ )
2297
+ );
2298
+ var getHas2FA = (0, import_toolkit14.createSelector)(
2299
+ [getCurrentUser],
2300
+ (currentUser) => currentUser.hasOwnProperty("tfa_status") && currentUser.tfa_status === twoFAStates.enabled
2301
+ );
2302
+ var getIdAttribute = (0, import_toolkit14.createSelector)([getGlobalSettings], ({ id_attribute = { ...defaultIdAttribute } }) => id_attribute);
2303
+ var getOfflineThresholdSettings = (0, import_toolkit14.createSelector)([getGlobalSettings], ({ offlineThreshold }) => ({
2304
+ interval: offlineThreshold?.interval || DEVICE_ONLINE_CUTOFF.interval,
2305
+ intervalUnit: offlineThreshold?.intervalUnit || DEVICE_ONLINE_CUTOFF.intervalName
2306
+ }));
2307
+ var getRolesList = (0, import_toolkit14.createSelector)([getRolesById], (rolesById2) => Object.entries(rolesById2).map(([id, role]) => ({ id, ...role })));
2308
+
2309
+ // src/commonSelectors.ts
2310
+ var getIsEnterprise = (0, import_toolkit15.createSelector)(
2311
+ [getOrganization, getFeatures],
2312
+ ({ plan = PLANS.os.id }, { isEnterprise, isHosted }) => isEnterprise || isHosted && plan === PLANS.enterprise.id
2313
+ );
2314
+ var getAttrsEndpoint = (0, import_toolkit15.createSelector)(
2315
+ [getFeatures],
2316
+ ({ hasReporting }) => hasReporting ? `${reportingApiUrl}/devices/search/attributes` : `${inventoryApiUrlV2}/filters/attributes`
2317
+ );
2318
+ var getSearchEndpoint = (0, import_toolkit15.createSelector)(
2319
+ [getFeatures],
2320
+ ({ hasReporting }) => hasReporting ? `${reportingApiUrl}/devices/search` : `${inventoryApiUrlV2}/filters/search`
2321
+ );
2322
+ var getUserRoles = (0, import_toolkit15.createSelector)(
2323
+ [getCurrentUser, getRolesById, getIsEnterprise, getFeatures, getOrganization],
2324
+ (currentUser, rolesById2, isEnterprise, { isHosted, hasMultitenancy }, { plan = PLANS.os.id }) => {
2325
+ const isAdmin = currentUser.roles?.length ? currentUser.roles.some((role) => role === rolesByName.admin) : !(hasMultitenancy || isEnterprise || isHosted && plan !== PLANS.os.id);
2326
+ const uiPermissions = isAdmin ? mapUserRolesToUiPermissions([rolesByName.admin], rolesById2) : mapUserRolesToUiPermissions(currentUser.roles || [], rolesById2);
2327
+ return { isAdmin, uiPermissions };
2328
+ }
2329
+ );
2330
+ var hasPermission = (thing, permission) => Object.values(thing).some((permissions) => permissions.includes(permission));
2331
+ var getUserCapabilities = (0, import_toolkit15.createSelector)([getUserRoles, getIsServiceProvider], ({ uiPermissions }, isServiceProvider) => {
2332
+ const canManageReleases = hasPermission(uiPermissions.releases, uiPermissionsById.manage.value);
2333
+ const canReadReleases = canManageReleases || hasPermission(uiPermissions.releases, uiPermissionsById.read.value);
2334
+ const canUploadReleases = canManageReleases || hasPermission(uiPermissions.releases, uiPermissionsById.upload.value);
2335
+ const canAuditlog = uiPermissions.auditlog.includes(uiPermissionsById.read.value);
2336
+ const canReadUsers = uiPermissions.userManagement.includes(uiPermissionsById.read.value);
2337
+ const canManageUsers = uiPermissions.userManagement.includes(uiPermissionsById.manage.value);
2338
+ const canReadDevices = hasPermission(uiPermissions.groups, uiPermissionsById.read.value);
2339
+ const canWriteDevices = Object.values(uiPermissions.groups).some(
2340
+ (groupPermissions) => groupPermissions.includes(uiPermissionsById.read.value) && groupPermissions.length > 1
2341
+ );
2342
+ const canTroubleshoot = hasPermission(uiPermissions.groups, uiPermissionsById.connect.value);
2343
+ const canManageDevices = hasPermission(uiPermissions.groups, uiPermissionsById.manage.value);
2344
+ const canConfigure = hasPermission(uiPermissions.groups, uiPermissionsById.configure.value);
2345
+ const canDeploy = uiPermissions.deployments.includes(uiPermissionsById.deploy.value) || hasPermission(uiPermissions.groups, uiPermissionsById.deploy.value);
2346
+ const canReadDeployments = uiPermissions.deployments.includes(uiPermissionsById.read.value);
2347
+ return {
2348
+ canAuditlog,
2349
+ canConfigure,
2350
+ canDeploy,
2351
+ canManageDevices,
2352
+ canManageReleases,
2353
+ canManageUsers,
2354
+ canReadDeployments,
2355
+ canReadDevices,
2356
+ canReadReleases,
2357
+ canReadUsers,
2358
+ canTroubleshoot,
2359
+ canUploadReleases,
2360
+ canWriteDevices,
2361
+ groupsPermissions: uiPermissions.groups,
2362
+ releasesPermissions: uiPermissions.releases,
2363
+ SPTenant: isServiceProvider
2364
+ };
2365
+ });
2366
+ var getTenantCapabilities = (0, import_toolkit15.createSelector)(
2367
+ [getFeatures, getOrganization, getIsEnterprise],
2368
+ ({ hasAuditlogs: isAuditlogEnabled, hasDeviceConfig: isDeviceConfigEnabled, hasDeviceConnect: isDeviceConnectEnabled, hasMonitor: isMonitorEnabled }, { addons = [], plan = PLANS.os.id }, isEnterprise) => {
2369
+ const canDelta = isEnterprise || plan === PLANS.professional.id;
2370
+ const hasAuditlogs = isAuditlogEnabled && isEnterprise;
2371
+ const hasDeviceConfig = isDeviceConfigEnabled && addons.some((addon) => addon.name === "configure" && Boolean(addon.enabled));
2372
+ const hasDeviceConnect = isDeviceConnectEnabled && (!isEnterprise || addons.some((addon) => addon.name === "troubleshoot" && Boolean(addon.enabled)));
2373
+ const hasMonitor = isMonitorEnabled && addons.some((addon) => addon.name === "monitor" && Boolean(addon.enabled));
2374
+ return {
2375
+ canDelta,
2376
+ canRetry: canDelta,
2377
+ canSchedule: canDelta,
2378
+ hasAuditlogs,
2379
+ hasDeviceConfig,
2380
+ hasDeviceConnect,
2381
+ hasFullFiltering: canDelta,
2382
+ hasMonitor,
2383
+ isEnterprise,
2384
+ plan
2385
+ };
2386
+ }
2387
+ );
2388
+ var getFilterAttributes = (0, import_toolkit15.createSelector)(
2389
+ [getGlobalSettings, getFilteringAttributes],
2390
+ ({ previousFilters }, { identityAttributes, inventoryAttributes, systemAttributes, tagAttributes }) => {
2391
+ const deviceNameAttribute = { key: "name", value: "Name", scope: ATTRIBUTE_SCOPES.tags, category: ATTRIBUTE_SCOPES.tags, priority: 1 };
2392
+ const deviceIdAttribute = { key: "id", value: "Device ID", scope: ATTRIBUTE_SCOPES.identity, category: ATTRIBUTE_SCOPES.identity, priority: 1 };
2393
+ const checkInAttribute = { key: "check_in_time", value: "Latest activity", scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };
2394
+ const updateAttribute = { ...checkInAttribute, key: "updated_ts", value: "Last inventory update" };
2395
+ const firstRequestAttribute = { key: "created_ts", value: "First request", scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };
2396
+ const attributes = [
2397
+ ...previousFilters.map((item) => ({
2398
+ ...item,
2399
+ value: deviceIdAttribute.key === item.key ? deviceIdAttribute.value : item.key,
2400
+ category: "recently used",
2401
+ priority: 0
2402
+ })),
2403
+ deviceNameAttribute,
2404
+ deviceIdAttribute,
2405
+ ...identityAttributes.map((item) => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.identity, category: ATTRIBUTE_SCOPES.identity, priority: 1 })),
2406
+ ...inventoryAttributes.map((item) => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.inventory, category: ATTRIBUTE_SCOPES.inventory, priority: 2 })),
2407
+ ...tagAttributes.map((item) => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.tags, category: ATTRIBUTE_SCOPES.tags, priority: 3 })),
2408
+ checkInAttribute,
2409
+ updateAttribute,
2410
+ firstRequestAttribute,
2411
+ ...systemAttributes.map((item) => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 }))
2412
+ ];
2413
+ return (0, import_helpers5.attributeDuplicateFilter)(attributes, "key");
2414
+ }
2415
+ );
2416
+ var getOnboardingState = (0, import_toolkit15.createSelector)([getOnboarding, getUserSettings], ({ complete, progress: progress2, showTips, ...remainder }, { onboarding = {} }) => ({
2417
+ ...remainder,
2418
+ ...onboarding,
2419
+ complete: onboarding.complete || complete,
2420
+ progress: Object.keys(onboardingSteps).findIndex((step) => step === progress2) > Object.keys(onboardingSteps).findIndex((step) => step === onboarding.progress) ? progress2 : onboarding.progress,
2421
+ showTips: !onboarding.showTips ? onboarding.showTips : showTips
2422
+ }));
2423
+ var getDemoDeviceAddress = (0, import_toolkit15.createSelector)([getDevicesById, getOnboarding], (devicesById, { approach, demoArtifactPort }) => {
2424
+ const demoDeviceAddress = `http://${(0, import_helpers5.getDemoDeviceAddress)(Object.values(devicesById), approach)}`;
2425
+ return demoArtifactPort ? `${demoDeviceAddress}:${demoArtifactPort}` : demoDeviceAddress;
2426
+ });
2427
+ var getDeviceConfigDeployment = (0, import_toolkit15.createSelector)([getDeviceById, getDeploymentsById], (device, deploymentsById) => {
2428
+ const { config = {} } = device;
2429
+ const { deployment_id: configDeploymentId } = config;
2430
+ const deviceConfigDeployment = deploymentsById[configDeploymentId] || {};
2431
+ return { device, deviceConfigDeployment };
2432
+ });
2433
+ var getDeploymentRelease = (0, import_toolkit15.createSelector)(
2434
+ [getDeploymentsById, getDeploymentsSelectionState, getReleasesById],
2435
+ (deploymentsById, { selectedId }, releasesById) => {
2436
+ const deployment = deploymentsById[selectedId] || {};
2437
+ return deployment.artifact_name && releasesById[deployment.artifact_name] ? releasesById[deployment.artifact_name] : { device_types_compatible: [] };
2438
+ }
2439
+ );
2440
+ var getSelectedDeploymentData = (0, import_toolkit15.createSelector)(
2441
+ [getDeploymentsById, getDeploymentsSelectionState, getDevicesById, getSelectedDeploymentDeviceIds],
2442
+ (deploymentsById, { selectedId }, devicesById, selectedDeviceIds) => {
2443
+ const deployment = deploymentsById[selectedId] ?? {};
2444
+ const { devices = {} } = deployment;
2445
+ return {
2446
+ deployment,
2447
+ selectedDevices: selectedDeviceIds.map((deviceId) => ({ ...devicesById[deviceId], ...devices[deviceId] }))
2448
+ };
2449
+ }
2450
+ );
2451
+ var getAvailableIssueOptionsByType = (0, import_toolkit15.createSelector)(
2452
+ [getFeatures, getTenantCapabilities, getIssueCountsByType],
2453
+ ({ hasReporting }, { hasFullFiltering, hasMonitor }, issueCounts) => Object.values(DEVICE_ISSUE_OPTIONS).reduce((accu, { isCategory, key, needsFullFiltering, needsMonitor, needsReporting, title }) => {
2454
+ if (isCategory || needsReporting && !hasReporting || needsFullFiltering && !hasFullFiltering || needsMonitor && !hasMonitor) {
2455
+ return accu;
2456
+ }
2457
+ accu[key] = { count: issueCounts[key].filtered, key, title };
2458
+ return accu;
2459
+ }, {})
2460
+ );
2461
+ var getGroupNames = (0, import_toolkit15.createSelector)([getGroupsById, getUserRoles, (_, options = {}) => options], (groupsById, { uiPermissions }, { staticOnly }) => {
2462
+ const { [UNGROUPED_GROUP.id]: ungrouped, ...groups } = groupsById;
2463
+ if (staticOnly) {
2464
+ return Object.keys(uiPermissions.groups).sort();
2465
+ }
2466
+ return Object.keys(
2467
+ Object.entries(groups).reduce((accu, [groupName, group]) => {
2468
+ if (group.filterId || uiPermissions.groups[ALL_DEVICES]) {
2469
+ accu[groupName] = group;
2470
+ }
2471
+ return accu;
2472
+ }, uiPermissions.groups)
2473
+ ).sort();
2474
+ });
2475
+ var getDeviceReportsForUser = (0, import_toolkit15.createSelector)(
2476
+ [getUserSettings, getCurrentUser, getGlobalSettings, getDevicesById],
2477
+ ({ reports }, { id: currentUserId }, globalSettings, devicesById) => {
2478
+ return reports || globalSettings[`${currentUserId}-reports`] || (Object.keys(devicesById).length ? defaultReports : []);
2479
+ }
2480
+ );
2481
+ var listTypeDeviceIdMap = {
2482
+ deviceList: getListedDevices,
2483
+ search: getSearchedDevices
2484
+ };
2485
+ var deviceMapDefault = { defaultObject: { auth_sets: [] }, cutOffSize: DEVICE_LIST_MAXIMUM_LENGTH };
2486
+ var getDeviceMappingDefaults = () => deviceMapDefault;
2487
+ var getMappedDevicesList = (0, import_toolkit15.createSelector)(
2488
+ [getDevicesById, (state, listType) => listTypeDeviceIdMap[listType](state), getDeviceMappingDefaults],
2489
+ listItemMapper
2490
+ );
2491
+ var getAuditlogDevice = (0, import_toolkit15.createSelector)([getAuditLogEntry, getDevicesById], (auditlogEvent, devicesById) => {
2492
+ let auditlogDevice = {};
2493
+ if (auditlogEvent) {
2494
+ const { object = {} } = auditlogEvent;
2495
+ const { device = {}, id, type } = object;
2496
+ auditlogDevice = type === "device" ? { id, ...device } : auditlogDevice;
2497
+ }
2498
+ return { ...auditlogDevice, ...devicesById[auditlogDevice.id] };
2499
+ });
2500
+ var getRelevantRoles = (0, import_toolkit15.createSelector)([getOrganization, getRolesList], ({ service_provider }, roles) => {
2501
+ if (service_provider) {
2502
+ return roles.reduce((accu, role) => {
2503
+ if (rolesById[role.id]) {
2504
+ return accu;
2505
+ }
2506
+ accu.push(role);
2507
+ return accu;
2508
+ }, Object.values(serviceProviderRolesById));
2509
+ }
2510
+ return Object.keys(rolesById).reverse().reduce((accu, key) => {
2511
+ const index = accu.findIndex(({ id }) => id === key);
2512
+ accu = [accu[index], ...accu.filter((item, itemIndex) => index !== itemIndex)];
2513
+ return accu;
2514
+ }, roles);
2515
+ });
2516
+
2517
+ // src/store.ts
2518
+ var import_helpers6 = require("@northern.tech/utils/helpers");
2519
+ var import_toolkit16 = require("@reduxjs/toolkit");
2520
+ var { setSnackbar, uploadProgress } = actions_default;
2521
+ var keys = ["sessionDeploymentChecker", settingsKeys.initialized];
2522
+ var resetEnvironment = () => {
2523
+ keys.map((key) => window.sessionStorage.removeItem(key));
2524
+ };
2525
+ resetEnvironment();
2526
+ var commonErrorFallback = "Please check your connection.";
2527
+ var commonErrorHandler = (err, errorContext, dispatch, fallback, mightBeAuthRelated = false) => {
2528
+ const errMsg = (0, import_helpers6.extractErrorMessage)(err, fallback);
2529
+ if (mightBeAuthRelated || getToken()) {
2530
+ dispatch(setSnackbar({ message: (0, import_helpers6.preformatWithRequestID)(err.response, `${errorContext} ${errMsg}`), action: "Copy to clipboard" }));
2531
+ }
2532
+ return Promise.reject(err);
2533
+ };
2534
+ var rootReducer = (0, import_toolkit16.combineReducers)({
2535
+ app: appSlice_default,
2536
+ devices: devicesSlice_default,
2537
+ deployments: deploymentsSlice_default,
2538
+ monitor: monitorSlice_default,
2539
+ onboarding: onboardingSlice_default,
2540
+ organization: organizationSlice_default,
2541
+ releases: releasesSlice_default,
2542
+ users: usersSlice_default
2543
+ });
2544
+ var sessionReducer = (state, action) => {
2545
+ if (action.type === USER_LOGOUT) {
2546
+ state = void 0;
2547
+ }
2548
+ return rootReducer(state, action);
2549
+ };
2550
+ var getConfiguredStore = (options = {}) => {
2551
+ const { preloadedState = {}, ...config } = options;
2552
+ return (0, import_toolkit16.configureStore)({
2553
+ ...config,
2554
+ preloadedState,
2555
+ reducer: sessionReducer,
2556
+ middleware: (getDefaultMiddleware) => getDefaultMiddleware({
2557
+ immutableCheck: {
2558
+ ignoredPaths: ["app.uploadsById"]
2559
+ },
2560
+ serializableCheck: {
2561
+ ignoredActions: [actions6.receiveExternalDeviceIntegrations.name, setSnackbar.name, uploadProgress.name],
2562
+ ignoredActionPaths: ["uploads", "snackbar", /payload\..*$/],
2563
+ ignoredPaths: ["app.uploadsById", "app.snackbar", "organization.externalDeviceIntegrations"]
2564
+ }
2565
+ })
2566
+ });
2567
+ };
2568
+ var store = getConfiguredStore({
2569
+ preloadedState: {}
2570
+ });
2571
+
2572
+ // src/releasesSlice/thunks.ts
2573
+ var import_helpers7 = require("@northern.tech/utils/helpers");
2574
+ var import_locationutils = require("@northern.tech/utils/locationutils");
2575
+ var import_toolkit17 = require("@reduxjs/toolkit");
2576
+ var import_axios2 = require("axios");
2577
+ var import_uuid = require("uuid");
2578
+ var { setSnackbar: setSnackbar2, initUpload, uploadProgress: uploadProgress2, cleanUpUpload } = actions_default;
2579
+ var { page: defaultPage, perPage: defaultPerPage } = DEVICE_LIST_DEFAULTS;
2580
+ var sortingDefaults = { direction: SORTING_OPTIONS.desc, key: "modified" };
2581
+ var flattenRelease = (release, stateRelease) => {
2582
+ const updatedArtifacts = release.artifacts?.sort((0, import_helpers7.customSort)(1, "modified")) || [];
2583
+ const { artifacts, deviceTypes, modified } = updatedArtifacts.reduce(
2584
+ (accu, item) => {
2585
+ accu.deviceTypes.push(...item.device_types_compatible);
2586
+ const stateArtifact = stateRelease.artifacts?.find((releaseArtifact) => releaseArtifact.id === item.id) || {};
2587
+ accu.modified = accu.modified ? accu.modified : item.modified;
2588
+ accu.artifacts.push({
2589
+ ...stateArtifact,
2590
+ ...item
2591
+ });
2592
+ return accu;
2593
+ },
2594
+ { artifacts: [], deviceTypes: [], modified: void 0 }
2595
+ );
2596
+ return { ...stateRelease, ...release, artifacts, device_types_compatible: deviceTypes.filter(import_helpers7.duplicateFilter), modified };
2597
+ };
2598
+ var reduceReceivedReleases = (releases, stateReleasesById) => releases.reduce((accu, release) => {
2599
+ const stateRelease = stateReleasesById[release.name] || {};
2600
+ accu[release.name] = flattenRelease(release, stateRelease);
2601
+ return accu;
2602
+ }, {});
2603
+ var findArtifactIndexInRelease = (releases, id) => Object.values(releases).reduce(
2604
+ (accu, item) => {
2605
+ let index = item.artifacts.findIndex((releaseArtifact) => releaseArtifact.id === id);
2606
+ if (index > -1) {
2607
+ accu = { release: item, index };
2608
+ }
2609
+ return accu;
2610
+ },
2611
+ { release: null, index: -1 }
2612
+ );
2613
+ var getArtifactInstallCount = (0, import_toolkit17.createAsyncThunk)(`${sliceName7}/getArtifactInstallCount`, (id, { dispatch, getState }) => {
2614
+ let { release, index } = findArtifactIndexInRelease(getReleasesById(getState()), id);
2615
+ if (!release || index === -1) {
2616
+ return;
2617
+ }
2618
+ const releaseArtifacts = [...release.artifacts];
2619
+ const artifact = releaseArtifacts[index];
2620
+ const { key, name, version } = (0, import_helpers7.extractSoftwareItem)(artifact.artifact_provides) ?? {};
2621
+ const attribute = `${key}${name ? `.${name}` : ""}.version`;
2622
+ const { filterTerms } = convertDeviceListStateToFilters({
2623
+ filters: [{ ...emptyFilter, key: attribute, value: version, scope: "inventory" }]
2624
+ });
2625
+ return general_api_default.post(getSearchEndpoint(getState()), {
2626
+ page: 1,
2627
+ per_page: 1,
2628
+ filters: filterTerms,
2629
+ attributes: [{ scope: "identity", attribute: "status" }]
2630
+ }).catch((err) => commonErrorHandler(err, `Retrieving artifact installation count failed:`, dispatch, commonErrorFallback)).then(({ headers }) => {
2631
+ let { release: release2, index: index2 } = findArtifactIndexInRelease(getReleasesById(getState()), id);
2632
+ if (!release2 || index2 === -1) {
2633
+ return;
2634
+ }
2635
+ const installCount = Number(headers[headerNames.total]);
2636
+ const releaseArtifacts2 = [...release2.artifacts];
2637
+ releaseArtifacts2[index2] = { ...releaseArtifacts2[index2], installCount };
2638
+ release2 = {
2639
+ ...release2,
2640
+ artifacts: releaseArtifacts2
2641
+ };
2642
+ return dispatch(actions7.receiveRelease(release2));
2643
+ });
2644
+ });
2645
+ var getArtifactUrl = (0, import_toolkit17.createAsyncThunk)(
2646
+ `${sliceName7}/getArtifactUrl`,
2647
+ (id, { dispatch, getState }) => general_api_default.get(`${deploymentsApiUrl}/artifacts/${id}/download`).then((response) => {
2648
+ let { release, index } = findArtifactIndexInRelease(getReleasesById(getState()), id);
2649
+ if (!release || index === -1) {
2650
+ return dispatch(getReleases());
2651
+ }
2652
+ const releaseArtifacts = [...release.artifacts];
2653
+ releaseArtifacts[index] = {
2654
+ ...releaseArtifacts[index],
2655
+ url: response.data.uri
2656
+ };
2657
+ release = {
2658
+ ...release,
2659
+ artifacts: releaseArtifacts
2660
+ };
2661
+ return dispatch(actions7.receiveRelease(release));
2662
+ })
2663
+ );
2664
+ var createArtifact = (0, import_toolkit17.createAsyncThunk)(`${sliceName7}/createArtifact`, ({ file, meta }, { dispatch }) => {
2665
+ let formData = Object.entries(meta).reduce((accu, [key, value]) => {
2666
+ if (Array.isArray(value)) {
2667
+ accu.append(key, value.join(","));
2668
+ } else if (value instanceof Object) {
2669
+ accu.append(key, JSON.stringify(value));
2670
+ } else {
2671
+ accu.append(key, value);
2672
+ }
2673
+ return accu;
2674
+ }, new FormData());
2675
+ formData.append("type", ARTIFACT_GENERATION_TYPE.SINGLE_FILE);
2676
+ formData.append("file", file);
2677
+ const uploadId = (0, import_uuid.v4)();
2678
+ const cancelSource = new AbortController();
2679
+ return Promise.all([
2680
+ dispatch(setSnackbar2("Generating artifact")),
2681
+ dispatch(initUpload({ id: uploadId, upload: { name: file.name, size: file.size, uploadProgress: 0, cancelSource } })),
2682
+ general_api_default.upload(
2683
+ `${deploymentsApiUrl}/artifacts/generate`,
2684
+ formData,
2685
+ (e) => dispatch(uploadProgress2({ id: uploadId, progress: progress(e) })),
2686
+ cancelSource.signal
2687
+ )
2688
+ ]).then(() => {
2689
+ setTimeout(() => {
2690
+ dispatch(getReleases());
2691
+ dispatch(selectRelease(file.name));
2692
+ }, TIMEOUTS.oneSecond);
2693
+ return Promise.resolve(dispatch(setSnackbar2("Upload successful", TIMEOUTS.fiveSeconds)));
2694
+ }).catch((err) => {
2695
+ if ((0, import_axios2.isCancel)(err)) {
2696
+ return dispatch(setSnackbar2("The artifact generation has been cancelled", TIMEOUTS.fiveSeconds));
2697
+ }
2698
+ return commonErrorHandler(err, `Artifact couldn't be generated.`, dispatch);
2699
+ }).finally(() => dispatch(cleanUpUpload(uploadId)));
2700
+ });
2701
+ var uploadArtifact = (0, import_toolkit17.createAsyncThunk)(`${sliceName7}/uploadArtifact`, ({ file, meta }, { dispatch }) => {
2702
+ let formData = new FormData();
2703
+ formData.append("size", file.size);
2704
+ formData.append("description", meta.description);
2705
+ formData.append("artifact", file);
2706
+ const uploadId = (0, import_uuid.v4)();
2707
+ const cancelSource = new AbortController();
2708
+ return Promise.all([
2709
+ dispatch(setSnackbar2("Uploading artifact")),
2710
+ dispatch(initUpload({ id: uploadId, upload: { name: file.name, size: file.size, uploadProgress: 0, cancelSource } })),
2711
+ general_api_default.upload(`${deploymentsApiUrl}/artifacts`, formData, (e) => dispatch(uploadProgress2({ id: uploadId, progress: progress(e) })), cancelSource.signal)
2712
+ ]).then(() => {
2713
+ const tasks = [dispatch(setSnackbar2("Upload successful", TIMEOUTS.fiveSeconds)), dispatch(getReleases())];
2714
+ if (meta.name) {
2715
+ tasks.push(dispatch(selectRelease(meta.name)));
2716
+ }
2717
+ return Promise.all(tasks);
2718
+ }).catch((err) => {
2719
+ if ((0, import_axios2.isCancel)(err)) {
2720
+ return dispatch(setSnackbar2("The upload has been cancelled", TIMEOUTS.fiveSeconds));
2721
+ }
2722
+ return commonErrorHandler(err, `Artifact couldn't be uploaded.`, dispatch);
2723
+ }).finally(() => dispatch(cleanUpUpload(uploadId)));
2724
+ });
2725
+ var cancelFileUpload = (0, import_toolkit17.createAsyncThunk)(`${sliceName7}/cancelFileUpload`, (id, { dispatch, getState }) => {
2726
+ const { [id]: current } = getState().app.uploadsById;
2727
+ current.cancelSource.abort();
2728
+ return Promise.resolve(dispatch(cleanUpUpload(id)));
2729
+ });
2730
+ var editArtifact = (0, import_toolkit17.createAsyncThunk)(
2731
+ `${sliceName7}/editArtifact`,
2732
+ ({ id, body }, { dispatch, getState }) => general_api_default.put(`${deploymentsApiUrl}/artifacts/${id}`, body).catch((err) => commonErrorHandler(err, `Artifact details couldn't be updated.`, dispatch)).then(() => {
2733
+ const state = getState();
2734
+ let { release, index } = findArtifactIndexInRelease(getReleasesById(state), id);
2735
+ if (!release || index === -1) {
2736
+ return dispatch(getReleases());
2737
+ }
2738
+ release.artifacts[index].description = body.description;
2739
+ return Promise.all([
2740
+ dispatch(actions7.receiveRelease(release)),
2741
+ dispatch(setSnackbar2("Artifact details were updated successfully.", TIMEOUTS.fiveSeconds, "")),
2742
+ dispatch(getRelease(release.name)),
2743
+ dispatch(selectRelease(release.name))
2744
+ ]);
2745
+ })
2746
+ );
2747
+ var removeArtifact = (0, import_toolkit17.createAsyncThunk)(
2748
+ `${sliceName7}/removeArtifact`,
2749
+ (id, { dispatch, getState }) => general_api_default.delete(`${deploymentsApiUrl}/artifacts/${id}`).then(() => {
2750
+ const state = getState();
2751
+ let { release, index } = findArtifactIndexInRelease(getReleasesById(state), id);
2752
+ const releaseArtifacts = [...release.artifacts];
2753
+ releaseArtifacts.splice(index, 1);
2754
+ if (!releaseArtifacts.length) {
2755
+ const { releasesList } = state.releases;
2756
+ const releaseIds = releasesList.releaseIds.filter((id2) => release.name !== id2);
2757
+ return Promise.all([
2758
+ dispatch(actions7.removeRelease(release.name)),
2759
+ dispatch(
2760
+ setReleasesListState({
2761
+ releaseIds,
2762
+ searchTotal: releasesList.searchTerm ? releasesList.searchTotal - 1 : releasesList.searchTotal,
2763
+ total: releasesList.total - 1
2764
+ })
2765
+ )
2766
+ ]);
2767
+ }
2768
+ return Promise.all([dispatch(setSnackbar2("Artifact was removed", TIMEOUTS.fiveSeconds, "")), dispatch(actions7.receiveRelease(release))]);
2769
+ }).catch((err) => commonErrorHandler(err, `Error removing artifact:`, dispatch))
2770
+ );
2771
+ var removeRelease = (0, import_toolkit17.createAsyncThunk)(
2772
+ `${sliceName7}/removeRelease`,
2773
+ (releaseId, { dispatch, getState }) => Promise.all(getReleasesById(getState())[releaseId].artifacts.map(({ id }) => dispatch(removeArtifact(id)))).then(() => dispatch(selectRelease()))
2774
+ );
2775
+ var selectRelease = (0, import_toolkit17.createAsyncThunk)(`${sliceName7}/selectRelease`, (release, { dispatch }) => {
2776
+ const name = release ? release.name || release : null;
2777
+ let tasks = [dispatch(actions7.selectedRelease(name))];
2778
+ if (name) {
2779
+ tasks.push(dispatch(getRelease(name)));
2780
+ }
2781
+ return Promise.all(tasks);
2782
+ });
2783
+ var setReleasesListState = (0, import_toolkit17.createAsyncThunk)(`${sliceName7}/setReleasesListState`, (selectionState, { dispatch, getState }) => {
2784
+ const currentState = getState().releases.releasesList;
2785
+ let nextState = {
2786
+ ...currentState,
2787
+ ...selectionState,
2788
+ sort: { ...currentState.sort, ...selectionState.sort }
2789
+ };
2790
+ let tasks = [];
2791
+ const { isLoading: currentLoading, ...currentRequestState } = currentState;
2792
+ const { isLoading: selectionLoading, ...selectionRequestState } = nextState;
2793
+ if (!(0, import_helpers7.deepCompare)(currentRequestState, selectionRequestState)) {
2794
+ nextState.isLoading = true;
2795
+ tasks.push(dispatch(getReleases(nextState)).finally(() => dispatch(setReleasesListState({ isLoading: false }))));
2796
+ }
2797
+ tasks.push(dispatch(actions7.setReleaseListState(nextState)));
2798
+ return Promise.all(tasks);
2799
+ });
2800
+ var releaseListRetrieval = (config) => {
2801
+ const { searchTerm = "", page = defaultPage, perPage = defaultPerPage, sort = sortingDefaults, selectedTags = [], type = "" } = config;
2802
+ const { key: attribute, direction } = sort;
2803
+ const filterQuery = (0, import_locationutils.formatReleases)({ pageState: { searchTerm, selectedTags } });
2804
+ const updateType = type ? `update_type=${type}` : "";
2805
+ const sorting = attribute ? `sort=${attribute}:${direction}`.toLowerCase() : "";
2806
+ return general_api_default.get(
2807
+ `${deploymentsApiUrlV2}/deployments/releases?${[`page=${page}`, `per_page=${perPage}`, filterQuery, updateType, sorting].filter((i) => i).join("&")}`
2808
+ );
2809
+ };
2810
+ var deductSearchState = (receivedReleases, config, total, state) => {
2811
+ let releaseListState = { ...state.releasesList };
2812
+ const { searchTerm, searchOnly, sort = {}, selectedTags = [], type } = config;
2813
+ const flattenedReleases = Object.values(receivedReleases).sort((0, import_helpers7.customSort)(sort.direction === SORTING_OPTIONS.desc, sort.key));
2814
+ const releaseIds = flattenedReleases.map((item) => item.name);
2815
+ const isFiltering = !!(selectedTags.length || type || searchTerm);
2816
+ if (searchOnly) {
2817
+ releaseListState = { ...releaseListState, searchedIds: releaseIds };
2818
+ } else {
2819
+ releaseListState = {
2820
+ ...releaseListState,
2821
+ releaseIds,
2822
+ searchTotal: isFiltering ? total : state.releasesList.searchTotal,
2823
+ total: !isFiltering ? total : state.releasesList.total
2824
+ };
2825
+ }
2826
+ return releaseListState;
2827
+ };
2828
+ var getReleases = (0, import_toolkit17.createAsyncThunk)(`${sliceName7}/getReleases`, (passedConfig = {}, { dispatch, getState }) => {
2829
+ const config = { ...getState().releases.releasesList, ...passedConfig };
2830
+ return releaseListRetrieval(config).then(({ data: receivedReleases = [], headers = {} }) => {
2831
+ const total = headers[headerNames.total] ? Number(headers[headerNames.total]) : 0;
2832
+ const state = getState().releases;
2833
+ const flatReleases = reduceReceivedReleases(receivedReleases, state.byId);
2834
+ const combinedReleases = { ...state.byId, ...flatReleases };
2835
+ let tasks = [dispatch(actions7.receiveReleases(combinedReleases))];
2836
+ const releaseListState = deductSearchState(receivedReleases, config, total, state);
2837
+ tasks.push(dispatch(actions7.setReleaseListState(releaseListState)));
2838
+ return Promise.all(tasks);
2839
+ }).catch((err) => commonErrorHandler(err, `Please check your connection`, dispatch));
2840
+ });
2841
+ var getRelease = (0, import_toolkit17.createAsyncThunk)(
2842
+ `${sliceName7}/getReleases`,
2843
+ (name, { dispatch, getState }) => releaseListRetrieval({ searchTerm: name, page: 1, perPage: 1 }).then(({ data: releases }) => {
2844
+ if (releases.length) {
2845
+ const stateRelease = getReleasesById(getState())[releases[0].name] || {};
2846
+ return Promise.resolve(dispatch(actions7.receiveRelease(flattenRelease(releases[0], stateRelease))));
2847
+ }
2848
+ return Promise.resolve(null);
2849
+ })
2850
+ );
2851
+ var updateReleaseInfo = (0, import_toolkit17.createAsyncThunk)(
2852
+ `${sliceName7}/updateReleaseInfo`,
2853
+ ({ name, info }, { dispatch, getState }) => general_api_default.patch(`${deploymentsApiUrlV2}/deployments/releases/${name}`, info).catch((err) => commonErrorHandler(err, `Release details couldn't be updated.`, dispatch)).then(() => {
2854
+ return Promise.all([
2855
+ dispatch(actions7.receiveRelease({ ...getReleasesById(getState())[name], ...info, name })),
2856
+ dispatch(setSnackbar2("Release details were updated successfully.", TIMEOUTS.fiveSeconds, ""))
2857
+ ]);
2858
+ })
2859
+ );
2860
+ var setReleaseTags = (0, import_toolkit17.createAsyncThunk)(
2861
+ `${sliceName7}/setReleaseTags`,
2862
+ ({ name, tags = [] }, { dispatch, getState }) => general_api_default.put(`${deploymentsApiUrlV2}/deployments/releases/${name}/tags`, tags).catch((err) => commonErrorHandler(err, `Release tags couldn't be set.`, dispatch)).then(() => {
2863
+ return Promise.all([
2864
+ dispatch(actions7.receiveRelease({ ...getReleasesById(getState())[name], name, tags })),
2865
+ dispatch(setSnackbar2("Release tags were set successfully.", TIMEOUTS.fiveSeconds, ""))
2866
+ ]);
2867
+ })
2868
+ );
2869
+ var getExistingReleaseTags = (0, import_toolkit17.createAsyncThunk)(
2870
+ `${sliceName7}/getReleaseTags`,
2871
+ (_, { dispatch }) => general_api_default.get(`${deploymentsApiUrlV2}/releases/all/tags`).catch((err) => commonErrorHandler(err, `Existing release tags couldn't be retrieved.`, dispatch)).then(({ data: tags }) => Promise.resolve(dispatch(actions7.receiveReleaseTags(tags))))
2872
+ );
2873
+ var getUpdateTypes = (0, import_toolkit17.createAsyncThunk)(
2874
+ `${sliceName7}/getReleaseTypes`,
2875
+ (_, { dispatch }) => general_api_default.get(`${deploymentsApiUrlV2}/releases/all/types`).catch((err) => commonErrorHandler(err, `Existing update types couldn't be retrieved.`, dispatch)).then(({ data: types }) => Promise.resolve(dispatch(actions7.receiveReleaseTypes(types))))
2876
+ );
2877
+ // Annotate the CommonJS export names for ESM import in node:
2878
+ 0 && (module.exports = {
2879
+ cancelFileUpload,
2880
+ createArtifact,
2881
+ editArtifact,
2882
+ getArtifactInstallCount,
2883
+ getArtifactUrl,
2884
+ getExistingReleaseTags,
2885
+ getRelease,
2886
+ getReleases,
2887
+ getUpdateTypes,
2888
+ removeArtifact,
2889
+ removeRelease,
2890
+ selectRelease,
2891
+ setReleaseTags,
2892
+ setReleasesListState,
2893
+ updateReleaseInfo,
2894
+ uploadArtifact
2895
+ });
2896
+ //# sourceMappingURL=thunks.cjs.map