@northern.tech/store 0.36.2 → 0.36.3

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 (114) hide show
  1. package/dist/api/general-api.cjs +3 -3
  2. package/dist/api/general-api.cjs.map +1 -1
  3. package/dist/api/users-api.cjs +2 -2
  4. package/dist/api/users-api.cjs.map +1 -1
  5. package/dist/api/users-api.js.map +1 -1
  6. package/dist/appSlice/index.cjs.map +1 -1
  7. package/dist/appSlice/selectors.cjs.map +1 -1
  8. package/dist/appSlice/selectors.d.cts +1 -1
  9. package/dist/appSlice/selectors.d.ts +1 -1
  10. package/dist/appSlice/selectors.js.map +1 -1
  11. package/dist/appSlice/thunks.d.cts +1 -1
  12. package/dist/appSlice/thunks.d.ts +1 -1
  13. package/dist/auth.cjs +2 -2
  14. package/dist/auth.cjs.map +1 -1
  15. package/dist/auth.js.map +1 -1
  16. package/dist/commonSelectors.cjs +2 -2
  17. package/dist/commonSelectors.cjs.map +1 -1
  18. package/dist/commonSelectors.d.cts +1 -1
  19. package/dist/commonSelectors.d.ts +1 -1
  20. package/dist/commonSelectors.js.map +1 -1
  21. package/dist/constants.cjs.map +1 -1
  22. package/dist/constants.js.map +1 -1
  23. package/dist/deploymentsSlice/index.cjs.map +1 -1
  24. package/dist/deploymentsSlice/index.js.map +1 -1
  25. package/dist/deploymentsSlice/selectors.cjs.map +1 -1
  26. package/dist/deploymentsSlice/selectors.d.cts +1 -1
  27. package/dist/deploymentsSlice/selectors.d.ts +1 -1
  28. package/dist/deploymentsSlice/selectors.js.map +1 -1
  29. package/dist/deploymentsSlice/thunks.d.cts +1 -1
  30. package/dist/deploymentsSlice/thunks.d.ts +1 -1
  31. package/dist/devicesSlice/index.cjs.map +1 -1
  32. package/dist/devicesSlice/index.js.map +1 -1
  33. package/dist/devicesSlice/selectors.cjs.map +1 -1
  34. package/dist/devicesSlice/selectors.d.cts +1 -1
  35. package/dist/devicesSlice/selectors.d.ts +1 -1
  36. package/dist/devicesSlice/selectors.js.map +1 -1
  37. package/dist/devicesSlice/thunks.d.cts +1 -1
  38. package/dist/devicesSlice/thunks.d.ts +1 -1
  39. package/dist/liststatehook.cjs.map +1 -1
  40. package/dist/liststatehook.js.map +1 -1
  41. package/dist/locationutils.cjs.map +1 -1
  42. package/dist/locationutils.js.map +1 -1
  43. package/dist/monitorSlice/index.cjs.map +1 -1
  44. package/dist/monitorSlice/index.js.map +1 -1
  45. package/dist/monitorSlice/mocks.cjs.map +1 -1
  46. package/dist/monitorSlice/mocks.js.map +1 -1
  47. package/dist/monitorSlice/selectors.d.cts +1 -1
  48. package/dist/monitorSlice/selectors.d.ts +1 -1
  49. package/dist/monitorSlice/thunks.cjs.map +1 -1
  50. package/dist/monitorSlice/thunks.d.cts +1 -1
  51. package/dist/monitorSlice/thunks.d.ts +1 -1
  52. package/dist/monitorSlice/thunks.js.map +1 -1
  53. package/dist/onboardingSlice/index.cjs.map +1 -1
  54. package/dist/onboardingSlice/mocks.cjs.map +1 -1
  55. package/dist/onboardingSlice/selectors.d.cts +1 -1
  56. package/dist/onboardingSlice/selectors.d.ts +1 -1
  57. package/dist/onboardingSlice/thunks.d.cts +1 -1
  58. package/dist/onboardingSlice/thunks.d.ts +1 -1
  59. package/dist/organizationSlice/index.cjs.map +1 -1
  60. package/dist/organizationSlice/selectors.cjs.map +1 -1
  61. package/dist/organizationSlice/selectors.d.cts +1 -1
  62. package/dist/organizationSlice/selectors.d.ts +1 -1
  63. package/dist/organizationSlice/selectors.js.map +1 -1
  64. package/dist/organizationSlice/thunks.d.cts +4 -41
  65. package/dist/organizationSlice/thunks.d.ts +4 -41
  66. package/dist/releasesSlice/index.cjs.map +1 -1
  67. package/dist/releasesSlice/selectors.cjs.map +1 -1
  68. package/dist/releasesSlice/selectors.d.cts +1 -1
  69. package/dist/releasesSlice/selectors.d.ts +1 -1
  70. package/dist/releasesSlice/selectors.js.map +1 -1
  71. package/dist/releasesSlice/thunks.cjs +39 -16
  72. package/dist/releasesSlice/thunks.cjs.map +1 -1
  73. package/dist/releasesSlice/thunks.d.cts +3 -9
  74. package/dist/releasesSlice/thunks.d.ts +3 -9
  75. package/dist/releasesSlice/thunks.js +38 -15
  76. package/dist/releasesSlice/thunks.js.map +1 -1
  77. package/dist/sockethook.cjs +3 -3
  78. package/dist/sockethook.cjs.map +1 -1
  79. package/dist/sockethook.js.map +1 -1
  80. package/dist/{store-Dd0Y2JCN.d.cts → store-DBUTT4FF.d.cts} +112 -4
  81. package/dist/{store-Co2ptTSm.d.ts → store-gkY5P9Uz.d.ts} +112 -4
  82. package/dist/store.cjs.map +1 -1
  83. package/dist/store.d.cts +1 -2
  84. package/dist/store.d.ts +1 -2
  85. package/dist/store.js.map +1 -1
  86. package/dist/storehooks.cjs +4 -4
  87. package/dist/storehooks.cjs.map +1 -1
  88. package/dist/storehooks.d.cts +1 -1
  89. package/dist/storehooks.d.ts +1 -1
  90. package/dist/storehooks.js.map +1 -1
  91. package/dist/thunks.cjs +48 -24
  92. package/dist/thunks.cjs.map +1 -1
  93. package/dist/thunks.js +41 -17
  94. package/dist/thunks.js.map +1 -1
  95. package/dist/useDeploymentDevice.cjs +2 -2
  96. package/dist/useDeploymentDevice.cjs.map +1 -1
  97. package/dist/useDeploymentDevice.js.map +1 -1
  98. package/dist/usersSlice/index.cjs.map +1 -1
  99. package/dist/usersSlice/selectors.cjs.map +1 -1
  100. package/dist/usersSlice/selectors.d.cts +1 -1
  101. package/dist/usersSlice/selectors.d.ts +1 -1
  102. package/dist/usersSlice/selectors.js.map +1 -1
  103. package/dist/usersSlice/thunks.d.cts +1 -1
  104. package/dist/usersSlice/thunks.d.ts +1 -1
  105. package/dist/utils.cjs +2 -0
  106. package/dist/utils.cjs.map +1 -1
  107. package/dist/utils.d.cts +2 -2
  108. package/dist/utils.d.ts +2 -2
  109. package/dist/utils.js +3 -2
  110. package/dist/utils.js.map +1 -1
  111. package/package.json +4 -4
  112. package/dist/utils-C_9XEfi_.d.ts +0 -104
  113. package/dist/utils-DbXmZmGq.d.cts +0 -104
  114. /package/dist/{chunk-D6vf50IK.cjs → rolldown-runtime-D6vf50IK.cjs} +0 -0
@@ -2,13 +2,13 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_chunk = require("../chunk-D6vf50IK.cjs");
5
+ const require_rolldown_runtime = require("../rolldown-runtime-D6vf50IK.cjs");
6
6
  const require_constants = require("../constants.cjs");
7
7
  const require_auth = require("../auth.cjs");
8
8
  let universal_cookie = require("universal-cookie");
9
- universal_cookie = require_chunk.__toESM(universal_cookie, 1);
9
+ universal_cookie = require_rolldown_runtime.__toESM(universal_cookie, 1);
10
10
  let axios = require("axios");
11
- axios = require_chunk.__toESM(axios, 1);
11
+ axios = require_rolldown_runtime.__toESM(axios, 1);
12
12
  //#region src/api/general-api.ts
13
13
  const cookies = new universal_cookie.default();
14
14
  const unauthorizedRedirect = (error) => {
@@ -1 +1 @@
1
- {"version":3,"file":"general-api.cjs","names":["Cookies","getToken","TIMEOUTS"],"sources":["../../src/api/general-api.ts"],"sourcesContent":["// Copyright 2017 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport type { AxiosError, AxiosProgressEvent, AxiosRequestConfig, GenericAbortSignal, InternalAxiosRequestConfig } from 'axios';\nimport axios, { isCancel } from 'axios';\nimport Cookies from 'universal-cookie';\n\nimport { cleanUp, getToken } from '../auth';\nimport { TIMEOUTS } from '../constants';\n\nconst cookies = new Cookies();\n\nconst unauthorizedRedirect = (error: AxiosError): Promise<never> => {\n if (!isCancel(error) && error.response?.status === 401 && getToken() && !window.location.pathname.endsWith('/subscription')) {\n // a new jwt might have been set by sso while the current request was in-flight with an old token\n // => reload instead of logging out\n if (cookies.get('JWT', { doNotParse: true })) {\n window.location.reload();\n return Promise.reject(error);\n }\n cleanUp();\n window.location.replace('/ui/');\n }\n return Promise.reject(error);\n};\n\nexport const commonRequestConfig: AxiosRequestConfig = { timeout: TIMEOUTS.refreshDefault, headers: { 'Content-Type': 'application/json' } };\n\nexport const authenticatedRequest = axios.create(commonRequestConfig);\nauthenticatedRequest.interceptors.response.use(res => res, unauthorizedRedirect);\nauthenticatedRequest.interceptors.request.use(\n (config: InternalAxiosRequestConfig) => {\n config.headers.Authorization = `Bearer ${getToken()}`;\n return config;\n },\n (error: AxiosError) => Promise.reject(error)\n);\n\nconst Api = {\n get: authenticatedRequest.get,\n delete: <T = unknown, D = unknown>(url: string, data?: D) => authenticatedRequest.request<T>({ method: 'delete', url, data }),\n patch: authenticatedRequest.patch,\n post: authenticatedRequest.post,\n postUnauthorized: <T = unknown, D = unknown>(url: string, data?: D, config: AxiosRequestConfig = {}) =>\n axios.post<T>(url, data, { ...commonRequestConfig, ...config }),\n put: authenticatedRequest.put,\n upload: <T = unknown>(url: string, formData: FormData, progress: (event: AxiosProgressEvent) => void, cancelSignal: GenericAbortSignal) =>\n authenticatedRequest.post<T>(url, formData, {\n headers: { 'Content-Type': 'multipart/form-data' },\n onUploadProgress: progress,\n timeout: 0,\n signal: cancelSignal\n }),\n uploadPut: <T = unknown>(url: string, formData: FormData, progress: (event: AxiosProgressEvent) => void, cancelSignal: GenericAbortSignal) =>\n authenticatedRequest.put<T>(url, formData, {\n headers: { 'Content-Type': 'multipart/form-data' },\n onUploadProgress: progress,\n timeout: 0,\n signal: cancelSignal\n })\n};\n\nexport default Api;\n"],"mappings":";;;;;;;;;;;;AAoBA,MAAM,UAAU,IAAIA,iBAAAA,QAAQ;AAE5B,MAAM,wBAAwB,UAAsC;CAClE,IAAI,EAAA,GAAA,MAAA,U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S;EACT,QAAQ;CACV,CAAC;AACL"}
1
+ {"version":3,"file":"general-api.cjs","names":["Cookies","getToken","TIMEOUTS"],"sources":["../../src/api/general-api.ts"],"sourcesContent":["// Copyright 2017 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport type { AxiosError, AxiosProgressEvent, AxiosRequestConfig, GenericAbortSignal, InternalAxiosRequestConfig } from 'axios';\nimport axios, { isCancel } from 'axios';\nimport Cookies from 'universal-cookie';\n\nimport { cleanUp, getToken } from '../auth';\nimport { TIMEOUTS } from '../constants';\n\nconst cookies = new Cookies();\n\nconst unauthorizedRedirect = (error: AxiosError): Promise<never> => {\n if (!isCancel(error) && error.response?.status === 401 && getToken() && !window.location.pathname.endsWith('/subscription')) {\n // a new jwt might have been set by sso while the current request was in-flight with an old token\n // => reload instead of logging out\n if (cookies.get('JWT', { doNotParse: true })) {\n window.location.reload();\n return Promise.reject(error);\n }\n cleanUp();\n window.location.replace('/ui/');\n }\n return Promise.reject(error);\n};\n\nexport const commonRequestConfig: AxiosRequestConfig = { timeout: TIMEOUTS.refreshDefault, headers: { 'Content-Type': 'application/json' } };\n\nexport const authenticatedRequest = axios.create(commonRequestConfig);\nauthenticatedRequest.interceptors.response.use(res => res, unauthorizedRedirect);\nauthenticatedRequest.interceptors.request.use(\n (config: InternalAxiosRequestConfig) => {\n config.headers.Authorization = `Bearer ${getToken()}`;\n return config;\n },\n (error: AxiosError) => Promise.reject(error)\n);\n\nconst Api = {\n get: authenticatedRequest.get,\n delete: <T = unknown, D = unknown>(url: string, data?: D) => authenticatedRequest.request<T>({ method: 'delete', url, data }),\n patch: authenticatedRequest.patch,\n post: authenticatedRequest.post,\n postUnauthorized: <T = unknown, D = unknown>(url: string, data?: D, config: AxiosRequestConfig = {}) =>\n axios.post<T>(url, data, { ...commonRequestConfig, ...config }),\n put: authenticatedRequest.put,\n upload: <T = unknown>(url: string, formData: FormData, progress: (event: AxiosProgressEvent) => void, cancelSignal: GenericAbortSignal) =>\n authenticatedRequest.post<T>(url, formData, {\n headers: { 'Content-Type': 'multipart/form-data' },\n onUploadProgress: progress,\n timeout: 0,\n signal: cancelSignal\n }),\n uploadPut: <T = unknown>(url: string, formData: FormData, progress: (event: AxiosProgressEvent) => void, cancelSignal: GenericAbortSignal) =>\n authenticatedRequest.put<T>(url, formData, {\n headers: { 'Content-Type': 'multipart/form-data' },\n onUploadProgress: progress,\n timeout: 0,\n signal: cancelSignal\n })\n};\n\nexport default Api;\n"],"mappings":";;;;;;;;;;;;AAoBA,MAAM,UAAU,IAAIA,iBAAAA,QAAQ;AAE5B,MAAM,wBAAwB,UAAsC;CAClE,IAAI,EAAA,GAAA,MAAA,SAAA,CAAU,KAAK,KAAK,MAAM,UAAU,WAAW,OAAOC,aAAAA,SAAS,KAAK,CAAC,OAAO,SAAS,SAAS,SAAS,eAAe,GAAG;EAG3H,IAAI,QAAQ,IAAI,OAAO,EAAE,YAAY,KAAK,CAAC,GAAG;GAC5C,OAAO,SAAS,OAAO;GACvB,OAAO,QAAQ,OAAO,KAAK;EAC7B;EACA,aAAA,QAAQ;EACR,OAAO,SAAS,QAAQ,MAAM;CAChC;CACA,OAAO,QAAQ,OAAO,KAAK;AAC7B;AAEA,MAAa,sBAA0C;CAAE,SAASC,kBAAAA,SAAS;CAAgB,SAAS,EAAE,gBAAgB,mBAAmB;AAAE;AAE3I,MAAa,uBAAuB,MAAA,QAAM,OAAO,mBAAmB;AACpE,qBAAqB,aAAa,SAAS,KAAI,QAAO,KAAK,oBAAoB;AAC/E,qBAAqB,aAAa,QAAQ,KACvC,WAAuC;CACtC,OAAO,QAAQ,gBAAgB,UAAUD,aAAAA,SAAS;CAClD,OAAO;AACT,IACC,UAAsB,QAAQ,OAAO,KAAK,CAC7C;AAEA,MAAM,MAAM;CACV,KAAK,qBAAqB;CAC1B,SAAmC,KAAa,SAAa,qBAAqB,QAAW;EAAE,QAAQ;EAAU;EAAK;CAAK,CAAC;CAC5H,OAAO,qBAAqB;CAC5B,MAAM,qBAAqB;CAC3B,mBAA6C,KAAa,MAAU,SAA6B,CAAC,MAChG,MAAA,QAAM,KAAQ,KAAK,MAAM;EAAE,GAAG;EAAqB,GAAG;CAAO,CAAC;CAChE,KAAK,qBAAqB;CAC1B,SAAsB,KAAa,UAAoB,UAA+C,iBACpG,qBAAqB,KAAQ,KAAK,UAAU;EAC1C,SAAS,EAAE,gBAAgB,sBAAsB;EACjD,kBAAkB;EAClB,SAAS;EACT,QAAQ;CACV,CAAC;CACH,YAAyB,KAAa,UAAoB,UAA+C,iBACvG,qBAAqB,IAAO,KAAK,UAAU;EACzC,SAAS,EAAE,gBAAgB,sBAAsB;EACjD,kBAAkB;EAClB,SAAS;EACT,QAAQ;CACV,CAAC;AACL"}
@@ -1,8 +1,8 @@
1
- const require_chunk = require("../chunk-D6vf50IK.cjs");
1
+ const require_rolldown_runtime = require("../rolldown-runtime-D6vf50IK.cjs");
2
2
  const require_auth = require("../auth.cjs");
3
3
  const require_api_general_api = require("./general-api.cjs");
4
4
  let axios = require("axios");
5
- axios = require_chunk.__toESM(axios, 1);
5
+ axios = require_rolldown_runtime.__toESM(axios, 1);
6
6
  //#region src/api/users-api.ts
7
7
  const Api = {
8
8
  postLogin: (url, { email: username, password = "", ...body }) => axios.default.post(url, body, {
@@ -1 +1 @@
1
- {"version":3,"file":"users-api.cjs","names":["commonRequestConfig","getToken"],"sources":["../../src/api/users-api.ts"],"sourcesContent":["// Copyright 2016 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport type { LoginOptions } from '@northern.tech/types/MenderTypes';\nimport axios from 'axios';\n\nimport { getToken } from '../auth';\nimport { commonRequestConfig } from './general-api';\n\ntype PostLoginBody = LoginOptions & {\n email: string;\n password?: string;\n};\n\ntype VerifyTFAData = Pick<LoginOptions, 'token2fa'>;\n\nconst Api = {\n postLogin: (url: string, { email: username, password = '', ...body }: PostLoginBody) =>\n axios\n .post(url, body, { ...commonRequestConfig, auth: { username, password } })\n .then(res => ({ text: res.data as string, code: res.status, contentType: res.headers?.['content-type'] as string | undefined })),\n putVerifyTFA: (url: string, userData: VerifyTFAData) => {\n let body: VerifyTFAData = {};\n if (Object.hasOwn(userData, 'token2fa')) {\n body = { token2fa: userData.token2fa };\n }\n return axios.put(url, body, { ...commonRequestConfig, headers: { ...commonRequestConfig.headers, Authorization: `Bearer ${getToken()}` } });\n }\n};\n\nexport default Api;\n"],"mappings":";;;;;;AA0BA,MAAM,MAAM;CACV,YAAY,KAAa,EAAE,OAAO,UAAU,WAAW,IAAI,GAAG,WAC5D,MAAA,QACG,KAAK,KAAK,MAAM;EAAE,GAAGA,wBAAAA;EAAqB,MAAM;GAAE;GAAU;EAAS;CAAE,CAAC,EACxE,MAAK,SAAQ;EAAE,MAAM,IAAI;EAAgB,MAAM,IAAI;EAAQ,aAAa,IAAI,UAAU;CAAsC,EAAE;CACnI,eAAe,KAAa,aAA4B;EACtD,IAAI,OAAsB,CAAC;EAC3B,IAAI,OAAO,OAAO,UAAU,UAAU,GACpC,OAAO,EAAE,UAAU,SAAS,SAAS;EAEvC,OAAO,MAAA,QAAM,IAAI,KAAK,MAAM;GAAE,GAAGA,wBAAAA;GAAqB,SAAS;IAAE,GAAGA,wBAAAA,oBAAoB;IAAS,eAAe,UAAUC,aAAAA,SAAS;GAAI;EAAE,CAAC;CAC5I;AACF"}
1
+ {"version":3,"file":"users-api.cjs","names":["commonRequestConfig","getToken"],"sources":["../../src/api/users-api.ts"],"sourcesContent":["// Copyright 2016 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport type { LoginOptions } from '@northern.tech/types/MenderTypes';\nimport axios from 'axios';\n\nimport { getToken } from '../auth';\nimport { commonRequestConfig } from './general-api';\n\ntype PostLoginBody = LoginOptions & {\n email: string;\n password?: string;\n};\n\ntype VerifyTFAData = Pick<LoginOptions, 'token2fa'>;\n\nconst Api = {\n postLogin: (url: string, { email: username, password = '', ...body }: PostLoginBody) =>\n axios\n .post(url, body, { ...commonRequestConfig, auth: { username, password } })\n .then(res => ({ text: res.data as string, code: res.status, contentType: res.headers?.['content-type'] as string | undefined })),\n putVerifyTFA: (url: string, userData: VerifyTFAData) => {\n let body: VerifyTFAData = {};\n if (Object.hasOwn(userData, 'token2fa')) {\n body = { token2fa: userData.token2fa };\n }\n return axios.put(url, body, { ...commonRequestConfig, headers: { ...commonRequestConfig.headers, Authorization: `Bearer ${getToken()}` } });\n }\n};\n\nexport default Api;\n"],"mappings":";;;;;;AA0BA,MAAM,MAAM;CACV,YAAY,KAAa,EAAE,OAAO,UAAU,WAAW,IAAI,GAAG,WAC5D,MAAA,QACG,KAAK,KAAK,MAAM;EAAE,GAAGA,wBAAAA;EAAqB,MAAM;GAAE;GAAU;EAAS;CAAE,CAAC,CAAC,CACzE,MAAK,SAAQ;EAAE,MAAM,IAAI;EAAgB,MAAM,IAAI;EAAQ,aAAa,IAAI,UAAU;CAAsC,EAAE;CACnI,eAAe,KAAa,aAA4B;EACtD,IAAI,OAAsB,CAAC;EAC3B,IAAI,OAAO,OAAO,UAAU,UAAU,GACpC,OAAO,EAAE,UAAU,SAAS,SAAS;EAEvC,OAAO,MAAA,QAAM,IAAI,KAAK,MAAM;GAAE,GAAGA,wBAAAA;GAAqB,SAAS;IAAE,GAAGA,wBAAAA,oBAAoB;IAAS,eAAe,UAAUC,aAAAA,SAAS;GAAI;EAAE,CAAC;CAC5I;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"users-api.js","names":[],"sources":["../../src/api/users-api.ts"],"sourcesContent":["// Copyright 2016 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport type { LoginOptions } from '@northern.tech/types/MenderTypes';\nimport axios from 'axios';\n\nimport { getToken } from '../auth';\nimport { commonRequestConfig } from './general-api';\n\ntype PostLoginBody = LoginOptions & {\n email: string;\n password?: string;\n};\n\ntype VerifyTFAData = Pick<LoginOptions, 'token2fa'>;\n\nconst Api = {\n postLogin: (url: string, { email: username, password = '', ...body }: PostLoginBody) =>\n axios\n .post(url, body, { ...commonRequestConfig, auth: { username, password } })\n .then(res => ({ text: res.data as string, code: res.status, contentType: res.headers?.['content-type'] as string | undefined })),\n putVerifyTFA: (url: string, userData: VerifyTFAData) => {\n let body: VerifyTFAData = {};\n if (Object.hasOwn(userData, 'token2fa')) {\n body = { token2fa: userData.token2fa };\n }\n return axios.put(url, body, { ...commonRequestConfig, headers: { ...commonRequestConfig.headers, Authorization: `Bearer ${getToken()}` } });\n }\n};\n\nexport default Api;\n"],"mappings":";;;;AA0BA,MAAM,MAAM;CACV,YAAY,KAAa,EAAE,OAAO,UAAU,WAAW,IAAI,GAAG,WAC5D,MACG,KAAK,KAAK,MAAM;EAAE,GAAG;EAAqB,MAAM;GAAE;GAAU;EAAS;CAAE,CAAC,EACxE,MAAK,SAAQ;EAAE,MAAM,IAAI;EAAgB,MAAM,IAAI;EAAQ,aAAa,IAAI,UAAU;CAAsC,EAAE;CACnI,eAAe,KAAa,aAA4B;EACtD,IAAI,OAAsB,CAAC;EAC3B,IAAI,OAAO,OAAO,UAAU,UAAU,GACpC,OAAO,EAAE,UAAU,SAAS,SAAS;EAEvC,OAAO,MAAM,IAAI,KAAK,MAAM;GAAE,GAAG;GAAqB,SAAS;IAAE,GAAG,oBAAoB;IAAS,eAAe,UAAU,SAAS;GAAI;EAAE,CAAC;CAC5I;AACF"}
1
+ {"version":3,"file":"users-api.js","names":[],"sources":["../../src/api/users-api.ts"],"sourcesContent":["// Copyright 2016 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport type { LoginOptions } from '@northern.tech/types/MenderTypes';\nimport axios from 'axios';\n\nimport { getToken } from '../auth';\nimport { commonRequestConfig } from './general-api';\n\ntype PostLoginBody = LoginOptions & {\n email: string;\n password?: string;\n};\n\ntype VerifyTFAData = Pick<LoginOptions, 'token2fa'>;\n\nconst Api = {\n postLogin: (url: string, { email: username, password = '', ...body }: PostLoginBody) =>\n axios\n .post(url, body, { ...commonRequestConfig, auth: { username, password } })\n .then(res => ({ text: res.data as string, code: res.status, contentType: res.headers?.['content-type'] as string | undefined })),\n putVerifyTFA: (url: string, userData: VerifyTFAData) => {\n let body: VerifyTFAData = {};\n if (Object.hasOwn(userData, 'token2fa')) {\n body = { token2fa: userData.token2fa };\n }\n return axios.put(url, body, { ...commonRequestConfig, headers: { ...commonRequestConfig.headers, Authorization: `Bearer ${getToken()}` } });\n }\n};\n\nexport default Api;\n"],"mappings":";;;;AA0BA,MAAM,MAAM;CACV,YAAY,KAAa,EAAE,OAAO,UAAU,WAAW,IAAI,GAAG,WAC5D,MACG,KAAK,KAAK,MAAM;EAAE,GAAG;EAAqB,MAAM;GAAE;GAAU;EAAS;CAAE,CAAC,CAAC,CACzE,MAAK,SAAQ;EAAE,MAAM,IAAI;EAAgB,MAAM,IAAI;EAAQ,aAAa,IAAI,UAAU;CAAsC,EAAE;CACnI,eAAe,KAAa,aAA4B;EACtD,IAAI,OAAsB,CAAC;EAC3B,IAAI,OAAO,OAAO,UAAU,UAAU,GACpC,OAAO,EAAE,UAAU,SAAS,SAAS;EAEvC,OAAO,MAAM,IAAI,KAAK,MAAM;GAAE,GAAG;GAAqB,SAAS;IAAE,GAAG,oBAAoB;IAAS,eAAe,UAAU,SAAS;GAAI;EAAE,CAAC;CAC5I;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["SORTING_OPTIONS"],"sources":["../../src/appSlice/index.ts"],"sourcesContent":["// Copyright 2023 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport type { SnackbarProps } from '@mui/material';\n\nimport type { PayloadAction } from '@reduxjs/toolkit';\nimport { createSlice } from '@reduxjs/toolkit';\n\nimport type { SortOptions } from '../constants';\nimport { SORTING_OPTIONS } from '../constants';\n\nexport const sliceName = 'app';\n\nconst getYesterday = () => {\n const today = new Date();\n today.setDate(today.getDate() - 1);\n return today.toISOString();\n};\n\nexport interface SnackbarContent extends Pick<SnackbarProps, 'action' | 'autoHideDuration' | 'message' | 'open'> {\n preventClickToCopy?: boolean;\n}\n\nexport interface SearchState {\n deviceIds: string[];\n isSearching: boolean;\n page?: number;\n perPage?: number;\n searchTerm: string;\n searchTotal: number;\n sort: SortOptions;\n}\n\nexport interface Upload {\n cancelSource: any;\n inprogress?: boolean;\n name?: string;\n progress: number;\n size?: number;\n}\n\ntype VersionInformation = {\n docsVersion?: string;\n version?: string;\n};\n\nexport type SentryConfig = {\n isReduxEnabled?: string; // no parsing done here as this has to be accessed outside of the store\n location: string;\n replaysSessionSampleRate?: number;\n tracesSampleRate?: number;\n};\n\nexport type AppSliceType = {\n appInitDone: boolean;\n cancelSource: any;\n commit: string;\n demoArtifactLink: string;\n docsVersion: string;\n features: Record<string, boolean>;\n feedbackProbability: number;\n firstLoginAfterSignup: boolean;\n hostAddress: string | null;\n hostedAnnouncement: string;\n newThreshold: string;\n offlineThreshold: string;\n recaptchaSiteKey: string;\n searchState: SearchState;\n sentry: SentryConfig;\n snackbar: SnackbarContent;\n stripeAPIKey: string;\n trackerCode: string;\n uploadsById: Record<string, Upload>;\n versionInformation: VersionInformation;\n yesterday?: string;\n};\n\nexport const initialState: AppSliceType = {\n appInitDone: false,\n cancelSource: undefined,\n commit: '',\n demoArtifactLink: 'https://dgsbl4vditpls.cloudfront.net/mender-demo-artifact.mender',\n hostAddress: null,\n snackbar: {\n action: undefined,\n autoHideDuration: undefined,\n message: '',\n open: false,\n preventClickToCopy: false\n },\n // return boolean rather than organization details\n features: {\n hasAiEnabled: false,\n hasAuditlogs: false,\n hasDeltaProgress: false,\n hasMultitenancy: false,\n hasDeviceConfig: false,\n hasDeviceConnect: false,\n hasFeedbackEnabled: false,\n hasManifestsEnabled: false,\n hasMonitor: false,\n hasMCUEnabled: false,\n isHosted: true,\n isEnterprise: false\n },\n feedbackProbability: 0.3,\n firstLoginAfterSignup: false,\n hostedAnnouncement: '',\n docsVersion: '',\n recaptchaSiteKey: '',\n searchState: {\n deviceIds: [],\n searchTerm: '',\n searchTotal: 0,\n isSearching: false,\n sort: {\n direction: SORTING_OPTIONS.desc\n // key: null,\n // scope: null\n }\n },\n sentry: {\n location: '',\n replaysSessionSampleRate: 0.1,\n tracesSampleRate: 1.0\n },\n stripeAPIKey: '',\n trackerCode: '',\n uploadsById: {\n // id: { progress: 0, cancelSource: undefined }\n },\n newThreshold: getYesterday(),\n offlineThreshold: getYesterday(),\n versionInformation: { docsVersion: '', version: '' },\n yesterday: undefined\n};\n\nexport const appSlice = createSlice({\n name: sliceName,\n initialState,\n reducers: {\n setFeatures: (state, action: PayloadAction<Record<string, boolean>>) => {\n state.features = {\n ...state.features,\n ...action.payload\n };\n },\n setSnackbar: (state, { payload }: PayloadAction<SnackbarContent | string>) => {\n if (typeof payload === 'string' || payload instanceof String) {\n state.snackbar = {\n ...initialState.snackbar,\n message: payload,\n open: !!payload\n };\n return;\n }\n const { message, autoHideDuration, action, preventClickToCopy = false } = payload;\n state.snackbar = {\n message,\n autoHideDuration,\n action,\n preventClickToCopy,\n open: !!message\n };\n },\n setFirstLoginAfterSignup: (state, action: PayloadAction<boolean>) => {\n state.firstLoginAfterSignup = action.payload;\n },\n setAnnouncement: (state, action: PayloadAction<string>) => {\n state.hostedAnnouncement = action.payload;\n },\n setSearchState: (state, action) => {\n state.searchState = {\n ...state.searchState,\n ...action.payload\n };\n },\n setOfflineThreshold: (state, action: PayloadAction<string>) => {\n state.offlineThreshold = action.payload;\n },\n initUpload: (state, action: PayloadAction<{ id: string; upload: Upload }>) => {\n const { id, upload } = action.payload;\n state.uploadsById[id] = upload;\n },\n uploadProgress: (state, action: PayloadAction<{ id: string; progress: number }>) => {\n const { id, progress } = action.payload;\n state.uploadsById[id] = {\n ...state.uploadsById[id],\n progress\n };\n },\n cleanUpUpload: (state, action: PayloadAction<string>) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [action.payload]: current, ...remainder } = state.uploadsById;\n state.uploadsById = remainder;\n },\n setVersionInformation: (state, action: PayloadAction<VersionInformation>) => {\n state.versionInformation = {\n ...state.versionInformation,\n ...action.payload\n };\n },\n setEnvironmentData: (state, action) => ({ ...state, ...action.payload }),\n setAppInitDone: state => {\n state.appInitDone = true;\n }\n }\n});\n\nexport const actions = appSlice.actions;\nexport default appSlice.reducer;\n"],"mappings":";;;;;;;AAqBA,MAAa,YAAY;AAEzB,MAAM,qBAAqB;CACzB,MAAM,wBAAQ,IAAI,KAAK;CACvB,MAAM,QAAQ,MAAM,QAAQ,IAAI,CAAC;CACjC,OAAO,MAAM,YAAY;AAC3B;AA4DA,MAAa,eAA6B;CACxC,aAAa;CACb,cAAc,KAAA;CACd,QAAQ;CACR,kBAAkB;CAClB,aAAa;CACb,UAAU;EACR,QAAQ,KAAA;EACR,kBAAkB,KAAA;EAClB,SAAS;EACT,MAAM;EACN,oBAAoB;CACtB;CAEA,UAAU;EACR,cAAc;EACd,cAAc;EACd,kBAAkB;EAClB,iBAAiB;EACjB,iBAAiB;EACjB,kBAAkB;EAClB,oBAAoB;EACpB,qBAAqB;EACrB,YAAY;EACZ,eAAe;EACf,UAAU;EACV,cAAc;CAChB;CACA,qBAAqB;CACrB,uBAAuB;CACvB,oBAAoB;CACpB,aAAa;CACb,kBAAkB;CAClB,aAAa;EACX,WAAW,CAAC;EACZ,YAAY;EACZ,aAAa;EACb,aAAa;EACb,MAAM,EACJ,WAAWA,+BAAAA,gBAAgB,KAG7B;CACF;CACA,QAAQ;EACN,UAAU;EACV,0BAA0B;EAC1B,kBAAkB;CACpB;CACA,cAAc;CACd,aAAa;CACb,aAAa,CAEb;CACA,cAAc,aAAa;CAC3B,kBAAkB,aAAa;CAC/B,oBAAoB;EAAE,aAAa;EAAI,SAAS;CAAG;CACnD,WAAW,KAAA;AACb;AAEA,MAAa,YAAA,GAAA,iBAAA,aAAuB;CAClC,MAAA;CACA;CACA,UAAU;EACR,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+ {"version":3,"file":"index.cjs","names":["SORTING_OPTIONS"],"sources":["../../src/appSlice/index.ts"],"sourcesContent":["// Copyright 2023 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport type { SnackbarProps } from '@mui/material';\n\nimport type { PayloadAction } from '@reduxjs/toolkit';\nimport { createSlice } from '@reduxjs/toolkit';\n\nimport type { SortOptions } from '../constants';\nimport { SORTING_OPTIONS } from '../constants';\n\nexport const sliceName = 'app';\n\nconst getYesterday = () => {\n const today = new Date();\n today.setDate(today.getDate() - 1);\n return today.toISOString();\n};\n\nexport interface SnackbarContent extends Pick<SnackbarProps, 'action' | 'autoHideDuration' | 'message' | 'open'> {\n preventClickToCopy?: boolean;\n}\n\nexport interface SearchState {\n deviceIds: string[];\n isSearching: boolean;\n page?: number;\n perPage?: number;\n searchTerm: string;\n searchTotal: number;\n sort: SortOptions;\n}\n\nexport interface Upload {\n cancelSource: any;\n inprogress?: boolean;\n name?: string;\n progress: number;\n size?: number;\n}\n\ntype VersionInformation = {\n docsVersion?: string;\n version?: string;\n};\n\nexport type SentryConfig = {\n isReduxEnabled?: string; // no parsing done here as this has to be accessed outside of the store\n location: string;\n replaysSessionSampleRate?: number;\n tracesSampleRate?: number;\n};\n\nexport type AppSliceType = {\n appInitDone: boolean;\n cancelSource: any;\n commit: string;\n demoArtifactLink: string;\n docsVersion: string;\n features: Record<string, boolean>;\n feedbackProbability: number;\n firstLoginAfterSignup: boolean;\n hostAddress: string | null;\n hostedAnnouncement: string;\n newThreshold: string;\n offlineThreshold: string;\n recaptchaSiteKey: string;\n searchState: SearchState;\n sentry: SentryConfig;\n snackbar: SnackbarContent;\n stripeAPIKey: string;\n trackerCode: string;\n uploadsById: Record<string, Upload>;\n versionInformation: VersionInformation;\n yesterday?: string;\n};\n\nexport const initialState: AppSliceType = {\n appInitDone: false,\n cancelSource: undefined,\n commit: '',\n demoArtifactLink: 'https://dgsbl4vditpls.cloudfront.net/mender-demo-artifact.mender',\n hostAddress: null,\n snackbar: {\n action: undefined,\n autoHideDuration: undefined,\n message: '',\n open: false,\n preventClickToCopy: false\n },\n // return boolean rather than organization details\n features: {\n hasAiEnabled: false,\n hasAuditlogs: false,\n hasDeltaProgress: false,\n hasMultitenancy: false,\n hasDeviceConfig: false,\n hasDeviceConnect: false,\n hasFeedbackEnabled: false,\n hasManifestsEnabled: false,\n hasMonitor: false,\n hasMCUEnabled: false,\n isHosted: true,\n isEnterprise: false\n },\n feedbackProbability: 0.3,\n firstLoginAfterSignup: false,\n hostedAnnouncement: '',\n docsVersion: '',\n recaptchaSiteKey: '',\n searchState: {\n deviceIds: [],\n searchTerm: '',\n searchTotal: 0,\n isSearching: false,\n sort: {\n direction: SORTING_OPTIONS.desc\n // key: null,\n // scope: null\n }\n },\n sentry: {\n location: '',\n replaysSessionSampleRate: 0.1,\n tracesSampleRate: 1.0\n },\n stripeAPIKey: '',\n trackerCode: '',\n uploadsById: {\n // id: { progress: 0, cancelSource: undefined }\n },\n newThreshold: getYesterday(),\n offlineThreshold: getYesterday(),\n versionInformation: { docsVersion: '', version: '' },\n yesterday: undefined\n};\n\nexport const appSlice = createSlice({\n name: sliceName,\n initialState,\n reducers: {\n setFeatures: (state, action: PayloadAction<Record<string, boolean>>) => {\n state.features = {\n ...state.features,\n ...action.payload\n };\n },\n setSnackbar: (state, { payload }: PayloadAction<SnackbarContent | string>) => {\n if (typeof payload === 'string' || payload instanceof String) {\n state.snackbar = {\n ...initialState.snackbar,\n message: payload,\n open: !!payload\n };\n return;\n }\n const { message, autoHideDuration, action, preventClickToCopy = false } = payload;\n state.snackbar = {\n message,\n autoHideDuration,\n action,\n preventClickToCopy,\n open: !!message\n };\n },\n setFirstLoginAfterSignup: (state, action: PayloadAction<boolean>) => {\n state.firstLoginAfterSignup = action.payload;\n },\n setAnnouncement: (state, action: PayloadAction<string>) => {\n state.hostedAnnouncement = action.payload;\n },\n setSearchState: (state, action) => {\n state.searchState = {\n ...state.searchState,\n ...action.payload\n };\n },\n setOfflineThreshold: (state, action: PayloadAction<string>) => {\n state.offlineThreshold = action.payload;\n },\n initUpload: (state, action: PayloadAction<{ id: string; upload: Upload }>) => {\n const { id, upload } = action.payload;\n state.uploadsById[id] = upload;\n },\n uploadProgress: (state, action: PayloadAction<{ id: string; progress: number }>) => {\n const { id, progress } = action.payload;\n state.uploadsById[id] = {\n ...state.uploadsById[id],\n progress\n };\n },\n cleanUpUpload: (state, action: PayloadAction<string>) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [action.payload]: current, ...remainder } = state.uploadsById;\n state.uploadsById = remainder;\n },\n setVersionInformation: (state, action: PayloadAction<VersionInformation>) => {\n state.versionInformation = {\n ...state.versionInformation,\n ...action.payload\n };\n },\n setEnvironmentData: (state, action) => ({ ...state, ...action.payload }),\n setAppInitDone: state => {\n state.appInitDone = true;\n }\n }\n});\n\nexport const actions = appSlice.actions;\nexport default appSlice.reducer;\n"],"mappings":";;;;;;;AAqBA,MAAa,YAAY;AAEzB,MAAM,qBAAqB;CACzB,MAAM,wBAAQ,IAAI,KAAK;CACvB,MAAM,QAAQ,MAAM,QAAQ,IAAI,CAAC;CACjC,OAAO,MAAM,YAAY;AAC3B;AA4DA,MAAa,eAA6B;CACxC,aAAa;CACb,cAAc,KAAA;CACd,QAAQ;CACR,kBAAkB;CAClB,aAAa;CACb,UAAU;EACR,QAAQ,KAAA;EACR,kBAAkB,KAAA;EAClB,SAAS;EACT,MAAM;EACN,oBAAoB;CACtB;CAEA,UAAU;EACR,cAAc;EACd,cAAc;EACd,kBAAkB;EAClB,iBAAiB;EACjB,iBAAiB;EACjB,kBAAkB;EAClB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AAO;GAC9B,MAAM,YAAY,MAAM;EAC1B;EACA,iBAAiB,OAAO,WAA4D;GAClF,MAAM,EAAE,IAAI,aAAa,OAAO;GAChC,MAAM,YAAY,MAAM;IACtB,GAAG,MAAM,YAAY;IACrB;GACF;EACF;EACA,gBAAgB,OAAO,WAAkC;GAEvD,MAAM,GAAG,OAAO,UAAU,SAAS,GAAG,cAAc,MAAM;GAC1D,MAAM,cAAc;EACtB;EACA,wBAAwB,OAAO,WAA8C;GAC3E,MAAM,qBAAqB;IACzB,GAAG,MAAM;IACT,GAAG,OAAO;GACZ;EACF;EACA,qBAAqB,OAAO,YAAY;GAAE,GAAG;GAAO,GAAG,OAAO;EAAQ;EACtE,iBAAgB,UAAS;GACvB,MAAM,cAAc;EACtB;CACF;AACF,CAAC;AAED,MAAa,UAAU,SAAS;AAChC,IAAA,mBAAe,SAAS"}
@@ -1 +1 @@
1
- {"version":3,"file":"selectors.cjs","names":[],"sources":["../../src/appSlice/selectors.ts"],"sourcesContent":["// Copyright 2023 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport { versionCompare } from '@northern.tech/utils/helpers';\nimport { createSelector } from '@reduxjs/toolkit';\n\nimport type { RootState } from '../store';\n\nexport const getDocsVersion = (state: RootState) => state.app.docsVersion;\nexport const getFeatures = (state: RootState) => state.app.features;\nexport const getFullVersionInformation = (state: RootState) => state.app.versionInformation;\nexport const getSearchState = (state: RootState) => state.app.searchState;\nexport const getUploads = (state: RootState) => state.app.uploadsById;\nexport const getSnackbar = (state: RootState) => state.app.snackbar;\nexport const getHostAddress = (state: RootState) => state.app.hostAddress;\nexport const getHostedAnnouncement = (state: RootState) => state.app.hostedAnnouncement;\nexport const getRecaptchaKey = (state: RootState) => state.app.recaptchaSiteKey;\nexport const getStripeKey = (state: RootState) => state.app.stripeAPIKey;\nexport const getTrackerCode = (state: RootState) => state.app.trackerCode;\nexport const getSentryConfig = (state: RootState) => state.app.sentry;\nexport const getCommit = (state: RootState) => state.app.commit;\nexport const getIsFirstLogin = (state: RootState) => state.app.firstLoginAfterSignup;\nexport const getFeedbackProbability = (state: RootState) => state.app.feedbackProbability;\nexport const getAppInitDone = (state: RootState) => state.app.appInitDone;\n\nexport const getIsUploading = createSelector([getUploads], uploadsById => !!Object.keys(uploadsById).length);\nexport const getSearchedDevices = createSelector([getSearchState], ({ deviceIds }) => deviceIds);\nexport const getVersionInformation = createSelector([getFullVersionInformation, getFeatures], ({ version, ...remainder }, { isHosted }) =>\n isHosted && version !== 'next' ? remainder : { ...remainder }\n);\nexport const getIsPreview = createSelector([getFullVersionInformation], ({ version }) => versionCompare(version, 'next') > -1);\n"],"mappings":";;;;AAkBA,MAAa,kBAAkB,UAAqB,MAAM,IAAI;AAC9D,MAAa,eAAe,UAAqB,MAAM,IAAI;AAC3D,MAAa,6BAA6B,UAAqB,MAAM,IAAI;AACzE,MAAa,kBAAkB,UAAqB,MAAM,IAAI;AAC9D,MAAa,cAAc,UAAqB,MAAM,IAAI;AAC1D,MAAa,eAAe,UAAqB,MAAM,IAAI;AAC3D,MAAa,kBAAkB,UAAqB,MAAM,IAAI;AAC9D,MAAa,yBAAyB,UAAqB,MAAM,IAAI;AACrE,MAAa,mBAAmB,UAAqB,MAAM,IAAI;AAC/D,MAAa,gBAAgB,UAAqB,MAAM,IAAI;AAC5D,MAAa,kBAAkB,UAAqB,MAAM,IAAI;AAC9D,MAAa,mBAAmB,UAAqB,MAAM,IAAI;AAC/D,MAAa,aAAa,UAAqB,MAAM,IAAI;AACzD,MAAa,mBAAmB,UAAqB,MAAM,IAAI;AAC/D,MAAa,0BAA0B,UAAqB,MAAM,IAAI;AACtE,MAAa,kBAAkB,UAAqB,MAAM,IAAI;AAE9D,MAAa,kBAAA,GAAA,iBAAA,gBAAgC,CAAC,UAAU,IAAG,gBAAe,CAAC,CAAC,OAAO,KAAK,WAAW,EAAE,MAAM;AAC3G,MAAa,sBAAA,GAAA,iBAAA,gBAAoC,CAAC,cAAc,IAAI,EAAE,gBAAgB,SAAS;AAC/F,MAAa,yBAAA,GAAA,iBAAA,gBAAuC,CAAC,2BAA2B,WAAW,IAAI,EAAE,SAAS,GAAG,aAAa,EAAE,eAC1H,YAAY,YAAY,SAAS,YAAY,EAAE,GAAG,UAAU,CAC9D;AACA,MAAa,gBAAA,GAAA,iBAAA,gBAA8B,CAAC,yBAAyB,IAAI,EAAE,eAAA,GAAA,6BAAA,gBAA6B,SAAS,MAAM,IAAI,EAAE"}
1
+ {"version":3,"file":"selectors.cjs","names":[],"sources":["../../src/appSlice/selectors.ts"],"sourcesContent":["// Copyright 2023 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport { versionCompare } from '@northern.tech/utils/helpers';\nimport { createSelector } from '@reduxjs/toolkit';\n\nimport type { RootState } from '../store';\n\nexport const getDocsVersion = (state: RootState) => state.app.docsVersion;\nexport const getFeatures = (state: RootState) => state.app.features;\nexport const getFullVersionInformation = (state: RootState) => state.app.versionInformation;\nexport const getSearchState = (state: RootState) => state.app.searchState;\nexport const getUploads = (state: RootState) => state.app.uploadsById;\nexport const getSnackbar = (state: RootState) => state.app.snackbar;\nexport const getHostAddress = (state: RootState) => state.app.hostAddress;\nexport const getHostedAnnouncement = (state: RootState) => state.app.hostedAnnouncement;\nexport const getRecaptchaKey = (state: RootState) => state.app.recaptchaSiteKey;\nexport const getStripeKey = (state: RootState) => state.app.stripeAPIKey;\nexport const getTrackerCode = (state: RootState) => state.app.trackerCode;\nexport const getSentryConfig = (state: RootState) => state.app.sentry;\nexport const getCommit = (state: RootState) => state.app.commit;\nexport const getIsFirstLogin = (state: RootState) => state.app.firstLoginAfterSignup;\nexport const getFeedbackProbability = (state: RootState) => state.app.feedbackProbability;\nexport const getAppInitDone = (state: RootState) => state.app.appInitDone;\n\nexport const getIsUploading = createSelector([getUploads], uploadsById => !!Object.keys(uploadsById).length);\nexport const getSearchedDevices = createSelector([getSearchState], ({ deviceIds }) => deviceIds);\nexport const getVersionInformation = createSelector([getFullVersionInformation, getFeatures], ({ version, ...remainder }, { isHosted }) =>\n isHosted && version !== 'next' ? remainder : { ...remainder }\n);\nexport const getIsPreview = createSelector([getFullVersionInformation], ({ version }) => versionCompare(version, 'next') > -1);\n"],"mappings":";;;;AAkBA,MAAa,kBAAkB,UAAqB,MAAM,IAAI;AAC9D,MAAa,eAAe,UAAqB,MAAM,IAAI;AAC3D,MAAa,6BAA6B,UAAqB,MAAM,IAAI;AACzE,MAAa,kBAAkB,UAAqB,MAAM,IAAI;AAC9D,MAAa,cAAc,UAAqB,MAAM,IAAI;AAC1D,MAAa,eAAe,UAAqB,MAAM,IAAI;AAC3D,MAAa,kBAAkB,UAAqB,MAAM,IAAI;AAC9D,MAAa,yBAAyB,UAAqB,MAAM,IAAI;AACrE,MAAa,mBAAmB,UAAqB,MAAM,IAAI;AAC/D,MAAa,gBAAgB,UAAqB,MAAM,IAAI;AAC5D,MAAa,kBAAkB,UAAqB,MAAM,IAAI;AAC9D,MAAa,mBAAmB,UAAqB,MAAM,IAAI;AAC/D,MAAa,aAAa,UAAqB,MAAM,IAAI;AACzD,MAAa,mBAAmB,UAAqB,MAAM,IAAI;AAC/D,MAAa,0BAA0B,UAAqB,MAAM,IAAI;AACtE,MAAa,kBAAkB,UAAqB,MAAM,IAAI;AAE9D,MAAa,kBAAA,GAAA,iBAAA,eAAA,CAAgC,CAAC,UAAU,IAAG,gBAAe,CAAC,CAAC,OAAO,KAAK,WAAW,CAAC,CAAC,MAAM;AAC3G,MAAa,sBAAA,GAAA,iBAAA,eAAA,CAAoC,CAAC,cAAc,IAAI,EAAE,gBAAgB,SAAS;AAC/F,MAAa,yBAAA,GAAA,iBAAA,eAAA,CAAuC,CAAC,2BAA2B,WAAW,IAAI,EAAE,SAAS,GAAG,aAAa,EAAE,eAC1H,YAAY,YAAY,SAAS,YAAY,EAAE,GAAG,UAAU,CAC9D;AACA,MAAa,gBAAA,GAAA,iBAAA,eAAA,CAA8B,CAAC,yBAAyB,IAAI,EAAE,eAAA,GAAA,6BAAA,eAAA,CAA6B,SAAS,MAAM,IAAI,EAAE"}
@@ -6,7 +6,7 @@ import { s as DeviceSliceType } from "../index-DbfM03Gj.cjs";
6
6
  import { a as Upload, i as SnackbarContent, n as SearchState, r as SentryConfig, t as AppSliceType } from "../index-C8QadAm7.cjs";
7
7
  import { t as MonitorSliceType } from "../index-5Q-iI4EB.cjs";
8
8
  import { t as OrganizationSliceType } from "../index-Bj3OArhr.cjs";
9
- import { r as RootState } from "../store-Dd0Y2JCN.cjs";
9
+ import { r as RootState } from "../store-DBUTT4FF.cjs";
10
10
 
11
11
  //#region src/appSlice/selectors.d.ts
12
12
  declare const getDocsVersion: (state: RootState) => string;
@@ -6,7 +6,7 @@ import { s as DeviceSliceType } from "../index-CPdMUfRr.js";
6
6
  import { a as Upload, i as SnackbarContent, n as SearchState, r as SentryConfig, t as AppSliceType } from "../index-BLvjQfGj.js";
7
7
  import { t as MonitorSliceType } from "../index-ByfjrTdH.js";
8
8
  import { t as OrganizationSliceType } from "../index-BBsUj1a8.js";
9
- import { r as RootState } from "../store-Co2ptTSm.js";
9
+ import { r as RootState } from "../store-gkY5P9Uz.js";
10
10
 
11
11
  //#region src/appSlice/selectors.d.ts
12
12
  declare const getDocsVersion: (state: RootState) => string;
@@ -1 +1 @@
1
- {"version":3,"file":"selectors.js","names":[],"sources":["../../src/appSlice/selectors.ts"],"sourcesContent":["// Copyright 2023 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport { versionCompare } from '@northern.tech/utils/helpers';\nimport { createSelector } from '@reduxjs/toolkit';\n\nimport type { RootState } from '../store';\n\nexport const getDocsVersion = (state: RootState) => state.app.docsVersion;\nexport const getFeatures = (state: RootState) => state.app.features;\nexport const getFullVersionInformation = (state: RootState) => state.app.versionInformation;\nexport const getSearchState = (state: RootState) => state.app.searchState;\nexport const getUploads = (state: RootState) => state.app.uploadsById;\nexport const getSnackbar = (state: RootState) => state.app.snackbar;\nexport const getHostAddress = (state: RootState) => state.app.hostAddress;\nexport const getHostedAnnouncement = (state: RootState) => state.app.hostedAnnouncement;\nexport const getRecaptchaKey = (state: RootState) => state.app.recaptchaSiteKey;\nexport const getStripeKey = (state: RootState) => state.app.stripeAPIKey;\nexport const getTrackerCode = (state: RootState) => state.app.trackerCode;\nexport const getSentryConfig = (state: RootState) => state.app.sentry;\nexport const getCommit = (state: RootState) => state.app.commit;\nexport const getIsFirstLogin = (state: RootState) => state.app.firstLoginAfterSignup;\nexport const getFeedbackProbability = (state: RootState) => state.app.feedbackProbability;\nexport const getAppInitDone = (state: RootState) => state.app.appInitDone;\n\nexport const getIsUploading = createSelector([getUploads], uploadsById => !!Object.keys(uploadsById).length);\nexport const getSearchedDevices = createSelector([getSearchState], ({ deviceIds }) => deviceIds);\nexport const getVersionInformation = createSelector([getFullVersionInformation, getFeatures], ({ version, ...remainder }, { isHosted }) =>\n isHosted && version !== 'next' ? remainder : { ...remainder }\n);\nexport const getIsPreview = createSelector([getFullVersionInformation], ({ version }) => versionCompare(version, 'next') > -1);\n"],"mappings":";;;AAkBA,MAAa,kBAAkB,UAAqB,MAAM,IAAI;AAC9D,MAAa,eAAe,UAAqB,MAAM,IAAI;AAC3D,MAAa,6BAA6B,UAAqB,MAAM,IAAI;AACzE,MAAa,kBAAkB,UAAqB,MAAM,IAAI;AAC9D,MAAa,cAAc,UAAqB,MAAM,IAAI;AAC1D,MAAa,eAAe,UAAqB,MAAM,IAAI;AAC3D,MAAa,kBAAkB,UAAqB,MAAM,IAAI;AAC9D,MAAa,yBAAyB,UAAqB,MAAM,IAAI;AACrE,MAAa,mBAAmB,UAAqB,MAAM,IAAI;AAC/D,MAAa,gBAAgB,UAAqB,MAAM,IAAI;AAC5D,MAAa,kBAAkB,UAAqB,MAAM,IAAI;AAC9D,MAAa,mBAAmB,UAAqB,MAAM,IAAI;AAC/D,MAAa,aAAa,UAAqB,MAAM,IAAI;AACzD,MAAa,mBAAmB,UAAqB,MAAM,IAAI;AAC/D,MAAa,0BAA0B,UAAqB,MAAM,IAAI;AACtE,MAAa,kBAAkB,UAAqB,MAAM,IAAI;AAE9D,MAAa,iBAAiB,eAAe,CAAC,UAAU,IAAG,gBAAe,CAAC,CAAC,OAAO,KAAK,WAAW,EAAE,MAAM;AAC3G,MAAa,qBAAqB,eAAe,CAAC,cAAc,IAAI,EAAE,gBAAgB,SAAS;AAC/F,MAAa,wBAAwB,eAAe,CAAC,2BAA2B,WAAW,IAAI,EAAE,SAAS,GAAG,aAAa,EAAE,eAC1H,YAAY,YAAY,SAAS,YAAY,EAAE,GAAG,UAAU,CAC9D;AACA,MAAa,eAAe,eAAe,CAAC,yBAAyB,IAAI,EAAE,cAAc,eAAe,SAAS,MAAM,IAAI,EAAE"}
1
+ {"version":3,"file":"selectors.js","names":[],"sources":["../../src/appSlice/selectors.ts"],"sourcesContent":["// Copyright 2023 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport { versionCompare } from '@northern.tech/utils/helpers';\nimport { createSelector } from '@reduxjs/toolkit';\n\nimport type { RootState } from '../store';\n\nexport const getDocsVersion = (state: RootState) => state.app.docsVersion;\nexport const getFeatures = (state: RootState) => state.app.features;\nexport const getFullVersionInformation = (state: RootState) => state.app.versionInformation;\nexport const getSearchState = (state: RootState) => state.app.searchState;\nexport const getUploads = (state: RootState) => state.app.uploadsById;\nexport const getSnackbar = (state: RootState) => state.app.snackbar;\nexport const getHostAddress = (state: RootState) => state.app.hostAddress;\nexport const getHostedAnnouncement = (state: RootState) => state.app.hostedAnnouncement;\nexport const getRecaptchaKey = (state: RootState) => state.app.recaptchaSiteKey;\nexport const getStripeKey = (state: RootState) => state.app.stripeAPIKey;\nexport const getTrackerCode = (state: RootState) => state.app.trackerCode;\nexport const getSentryConfig = (state: RootState) => state.app.sentry;\nexport const getCommit = (state: RootState) => state.app.commit;\nexport const getIsFirstLogin = (state: RootState) => state.app.firstLoginAfterSignup;\nexport const getFeedbackProbability = (state: RootState) => state.app.feedbackProbability;\nexport const getAppInitDone = (state: RootState) => state.app.appInitDone;\n\nexport const getIsUploading = createSelector([getUploads], uploadsById => !!Object.keys(uploadsById).length);\nexport const getSearchedDevices = createSelector([getSearchState], ({ deviceIds }) => deviceIds);\nexport const getVersionInformation = createSelector([getFullVersionInformation, getFeatures], ({ version, ...remainder }, { isHosted }) =>\n isHosted && version !== 'next' ? remainder : { ...remainder }\n);\nexport const getIsPreview = createSelector([getFullVersionInformation], ({ version }) => versionCompare(version, 'next') > -1);\n"],"mappings":";;;AAkBA,MAAa,kBAAkB,UAAqB,MAAM,IAAI;AAC9D,MAAa,eAAe,UAAqB,MAAM,IAAI;AAC3D,MAAa,6BAA6B,UAAqB,MAAM,IAAI;AACzE,MAAa,kBAAkB,UAAqB,MAAM,IAAI;AAC9D,MAAa,cAAc,UAAqB,MAAM,IAAI;AAC1D,MAAa,eAAe,UAAqB,MAAM,IAAI;AAC3D,MAAa,kBAAkB,UAAqB,MAAM,IAAI;AAC9D,MAAa,yBAAyB,UAAqB,MAAM,IAAI;AACrE,MAAa,mBAAmB,UAAqB,MAAM,IAAI;AAC/D,MAAa,gBAAgB,UAAqB,MAAM,IAAI;AAC5D,MAAa,kBAAkB,UAAqB,MAAM,IAAI;AAC9D,MAAa,mBAAmB,UAAqB,MAAM,IAAI;AAC/D,MAAa,aAAa,UAAqB,MAAM,IAAI;AACzD,MAAa,mBAAmB,UAAqB,MAAM,IAAI;AAC/D,MAAa,0BAA0B,UAAqB,MAAM,IAAI;AACtE,MAAa,kBAAkB,UAAqB,MAAM,IAAI;AAE9D,MAAa,iBAAiB,eAAe,CAAC,UAAU,IAAG,gBAAe,CAAC,CAAC,OAAO,KAAK,WAAW,CAAC,CAAC,MAAM;AAC3G,MAAa,qBAAqB,eAAe,CAAC,cAAc,IAAI,EAAE,gBAAgB,SAAS;AAC/F,MAAa,wBAAwB,eAAe,CAAC,2BAA2B,WAAW,IAAI,EAAE,SAAS,GAAG,aAAa,EAAE,eAC1H,YAAY,YAAY,SAAS,YAAY,EAAE,GAAG,UAAU,CAC9D;AACA,MAAa,eAAe,eAAe,CAAC,yBAAyB,IAAI,EAAE,cAAc,eAAe,SAAS,MAAM,IAAI,EAAE"}
@@ -1,5 +1,5 @@
1
1
  import { n as SearchState } from "../index-C8QadAm7.cjs";
2
- import { r as RootState, t as AppDispatch } from "../store-Dd0Y2JCN.cjs";
2
+ import { r as RootState, t as AppDispatch } from "../store-DBUTT4FF.cjs";
3
3
 
4
4
  //#region src/appSlice/thunks.d.ts
5
5
  declare const setFirstLoginAfterSignup: import("@reduxjs/toolkit").AsyncThunk<void, boolean, {
@@ -1,5 +1,5 @@
1
1
  import { n as SearchState } from "../index-BLvjQfGj.js";
2
- import { r as RootState, t as AppDispatch } from "../store-Co2ptTSm.js";
2
+ import { r as RootState, t as AppDispatch } from "../store-gkY5P9Uz.js";
3
3
 
4
4
  //#region src/appSlice/thunks.d.ts
5
5
  declare const setFirstLoginAfterSignup: import("@reduxjs/toolkit").AsyncThunk<void, boolean, {
package/dist/auth.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_chunk = require("./chunk-D6vf50IK.cjs");
2
+ const require_rolldown_runtime = require("./rolldown-runtime-D6vf50IK.cjs");
3
3
  const require_constants = require("./constants.cjs");
4
4
  let universal_cookie = require("universal-cookie");
5
- universal_cookie = require_chunk.__toESM(universal_cookie, 1);
5
+ universal_cookie = require_rolldown_runtime.__toESM(universal_cookie, 1);
6
6
  let _northern_tech_utils_constants = require("@northern.tech/utils/constants");
7
7
  //#region src/auth.ts
8
8
  const cookies = new universal_cookie.default();
package/dist/auth.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"auth.cjs","names":["Cookies","maxSessionAge","TIMEOUTS"],"sources":["../src/auth.ts"],"sourcesContent":["// Copyright 2016 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport Cookies from 'universal-cookie';\n\nimport { TIMEOUTS, maxSessionAge } from './constants';\nimport type { UserSession } from './usersSlice';\n\nconst cookies = new Cookies();\n\nconst emptySession = Object.freeze({ token: '', expiresAt: undefined }) as Readonly<UserSession>;\n\nlet tokenCache = '';\n\nexport const getSessionInfo = (): UserSession => {\n let sessionInfo = { ...emptySession } as UserSession;\n try {\n sessionInfo = JSON.parse(window.localStorage.getItem('JWT') ?? '');\n } catch {\n // most likely not logged in - nothing to do here\n }\n\n // check for cookie first to handles sso login while an old/expired token may still exist in cache/ localStorage\n const jwtTokenFromCookie = cookies.get('JWT', { doNotParse: true }) ?? '';\n if (jwtTokenFromCookie) {\n setSessionInfo({ token: jwtTokenFromCookie });\n cookies.remove('JWT');\n cookies.remove('JWT', { path: '/' });\n return { token: jwtTokenFromCookie, expiresAt: undefined };\n }\n if (sessionInfo.expiresAt && new Date(sessionInfo.expiresAt) < new Date()) {\n cleanUp();\n return { ...emptySession };\n }\n sessionInfo.token = sessionInfo.token || '';\n tokenCache = sessionInfo.token;\n return sessionInfo;\n};\n\nexport const getToken = () => (tokenCache ? tokenCache : getSessionInfo().token);\n\nexport const setSessionInfo = ({ token, expiresAt }: UserSession) => {\n tokenCache = token;\n window.localStorage.setItem('JWT', JSON.stringify({ token, expiresAt }));\n};\n\nexport const cleanUp = () => {\n tokenCache = '';\n cookies.remove('JWT');\n cookies.remove('JWT', { path: '/' });\n window.localStorage.removeItem('JWT');\n window.localStorage.removeItem('oauth');\n};\n\nexport const updateMaxAge = ({ expiresAt, token }) => {\n const oAuthExpiration = Number(window.localStorage.getItem('oauth'));\n let updateWithOAuth = false;\n if (oAuthExpiration) {\n const soon = Date.now() + maxSessionAge * TIMEOUTS.oneSecond;\n updateWithOAuth = oAuthExpiration <= soon;\n if (updateWithOAuth) {\n window.localStorage.removeItem('oauth');\n }\n }\n if (token && expiresAt && (!oAuthExpiration || updateWithOAuth)) {\n const expiration = new Date();\n expiration.setSeconds(expiration.getSeconds() + maxSessionAge);\n setSessionInfo({ token, expiresAt: expiration.toISOString() });\n }\n};\n"],"mappings":";;;;;;;AAkBA,MAAM,UAAU,IAAIA,iBAAAA,QAAQ;AAE5B,MAAM,eAAe,OAAO,OAAO;CAAE,OAAO;CAAI,WAAW,K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AAO;CAE1C;CACA,IAAI,SAAS,cAAc,CAAC,mBAAmB,kBAAkB;EAC/D,MAAM,6BAAa,IAAI,KAAK;EAC5B,WAAW,WAAW,WAAW,WAAW,IAAID,+BAAAA,aAAa;EAC7D,eAAe;GAAE;GAAO,WAAW,WAAW,YAAY;EAAE,CAAC;CAC/D;AACF"}
1
+ {"version":3,"file":"auth.cjs","names":["Cookies","maxSessionAge","TIMEOUTS"],"sources":["../src/auth.ts"],"sourcesContent":["// Copyright 2016 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport Cookies from 'universal-cookie';\n\nimport { TIMEOUTS, maxSessionAge } from './constants';\nimport type { UserSession } from './usersSlice';\n\nconst cookies = new Cookies();\n\nconst emptySession = Object.freeze({ token: '', expiresAt: undefined }) as Readonly<UserSession>;\n\nlet tokenCache = '';\n\nexport const getSessionInfo = (): UserSession => {\n let sessionInfo = { ...emptySession } as UserSession;\n try {\n sessionInfo = JSON.parse(window.localStorage.getItem('JWT') ?? '');\n } catch {\n // most likely not logged in - nothing to do here\n }\n\n // check for cookie first to handles sso login while an old/expired token may still exist in cache/ localStorage\n const jwtTokenFromCookie = cookies.get('JWT', { doNotParse: true }) ?? '';\n if (jwtTokenFromCookie) {\n setSessionInfo({ token: jwtTokenFromCookie });\n cookies.remove('JWT');\n cookies.remove('JWT', { path: '/' });\n return { token: jwtTokenFromCookie, expiresAt: undefined };\n }\n if (sessionInfo.expiresAt && new Date(sessionInfo.expiresAt) < new Date()) {\n cleanUp();\n return { ...emptySession };\n }\n sessionInfo.token = sessionInfo.token || '';\n tokenCache = sessionInfo.token;\n return sessionInfo;\n};\n\nexport const getToken = () => (tokenCache ? tokenCache : getSessionInfo().token);\n\nexport const setSessionInfo = ({ token, expiresAt }: UserSession) => {\n tokenCache = token;\n window.localStorage.setItem('JWT', JSON.stringify({ token, expiresAt }));\n};\n\nexport const cleanUp = () => {\n tokenCache = '';\n cookies.remove('JWT');\n cookies.remove('JWT', { path: '/' });\n window.localStorage.removeItem('JWT');\n window.localStorage.removeItem('oauth');\n};\n\nexport const updateMaxAge = ({ expiresAt, token }) => {\n const oAuthExpiration = Number(window.localStorage.getItem('oauth'));\n let updateWithOAuth = false;\n if (oAuthExpiration) {\n const soon = Date.now() + maxSessionAge * TIMEOUTS.oneSecond;\n updateWithOAuth = oAuthExpiration <= soon;\n if (updateWithOAuth) {\n window.localStorage.removeItem('oauth');\n }\n }\n if (token && expiresAt && (!oAuthExpiration || updateWithOAuth)) {\n const expiration = new Date();\n expiration.setSeconds(expiration.getSeconds() + maxSessionAge);\n setSessionInfo({ token, expiresAt: expiration.toISOString() });\n }\n};\n"],"mappings":";;;;;;;AAkBA,MAAM,UAAU,IAAIA,iBAAAA,QAAQ;AAE5B,MAAM,eAAe,OAAO,OAAO;CAAE,OAAO;CAAI,WAAW,KAAA;AAAU,CAAC;AAEtE,IAAI,aAAa;AAEjB,MAAa,uBAAoC;CAC/C,IAAI,cAAc,EAAE,GAAG,aAAa;CACpC,IAAI;EACF,cAAc,KAAK,MAAM,OAAO,aAAa,QAAQ,KAAK,KAAK,EAAE;CACnE,QAAQ,CAER;CAGA,MAAM,qBAAqB,QAAQ,IAAI,OAAO,EAAE,YAAY,KAAK,CAAC,KAAK;CACvE,IAAI,oBAAoB;EACtB,eAAe,EAAE,OAAO,mBAAmB,CAAC;EAC5C,QAAQ,OAAO,KAAK;EACpB,QAAQ,OAAO,OAAO,EAAE,MAAM,IAAI,CAAC;EACnC,OAAO;GAAE,OAAO;GAAoB,WAAW,KAAA;EAAU;CAC3D;CACA,IAAI,YAAY,aAAa,IAAI,KAAK,YAAY,SAAS,oBAAI,IAAI,KAAK,GAAG;EACzE,QAAQ;EACR,OAAO,EAAE,GAAG,aAAa;CAC3B;CACA,YAAY,QAAQ,YAAY,SAAS;CACzC,aAAa,YAAY;CACzB,OAAO;AACT;AAEA,MAAa,iBAAkB,aAAa,aAAa,eAAe,CAAC,CAAC;AAE1E,MAAa,kBAAkB,EAAE,OAAO,gBAA6B;CACnE,aAAa;CACb,OAAO,aAAa,QAAQ,OAAO,KAAK,UAAU;EAAE;EAAO;CAAU,CAAC,CAAC;AACzE;AAEA,MAAa,gBAAgB;CAC3B,aAAa;CACb,QAAQ,OAAO,KAAK;CACpB,QAAQ,OAAO,OAAO,EAAE,MAAM,IAAI,CAAC;CACnC,OAAO,aAAa,WAAW,KAAK;CACpC,OAAO,aAAa,WAAW,OAAO;AACxC;AAEA,MAAa,gBAAgB,EAAE,WAAW,YAAY;CACpD,MAAM,kBAAkB,OAAO,OAAO,aAAa,QAAQ,OAAO,CAAC;CACnE,IAAI,kBAAkB;CACtB,IAAI,iBAAiB;EAEnB,kBAAkB,mBADL,KAAK,IAAI,IAAIC,+BAAAA,gBAAgBC,kBAAAA,SAAS;EAEnD,IAAI,iBACF,OAAO,aAAa,WAAW,OAAO;CAE1C;CACA,IAAI,SAAS,cAAc,CAAC,mBAAmB,kBAAkB;EAC/D,MAAM,6BAAa,IAAI,KAAK;EAC5B,WAAW,WAAW,WAAW,WAAW,IAAID,+BAAAA,aAAa;EAC7D,eAAe;GAAE;GAAO,WAAW,WAAW,YAAY;EAAE,CAAC;CAC/D;AACF"}
package/dist/auth.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"auth.js","names":[],"sources":["../src/auth.ts"],"sourcesContent":["// Copyright 2016 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport Cookies from 'universal-cookie';\n\nimport { TIMEOUTS, maxSessionAge } from './constants';\nimport type { UserSession } from './usersSlice';\n\nconst cookies = new Cookies();\n\nconst emptySession = Object.freeze({ token: '', expiresAt: undefined }) as Readonly<UserSession>;\n\nlet tokenCache = '';\n\nexport const getSessionInfo = (): UserSession => {\n let sessionInfo = { ...emptySession } as UserSession;\n try {\n sessionInfo = JSON.parse(window.localStorage.getItem('JWT') ?? '');\n } catch {\n // most likely not logged in - nothing to do here\n }\n\n // check for cookie first to handles sso login while an old/expired token may still exist in cache/ localStorage\n const jwtTokenFromCookie = cookies.get('JWT', { doNotParse: true }) ?? '';\n if (jwtTokenFromCookie) {\n setSessionInfo({ token: jwtTokenFromCookie });\n cookies.remove('JWT');\n cookies.remove('JWT', { path: '/' });\n return { token: jwtTokenFromCookie, expiresAt: undefined };\n }\n if (sessionInfo.expiresAt && new Date(sessionInfo.expiresAt) < new Date()) {\n cleanUp();\n return { ...emptySession };\n }\n sessionInfo.token = sessionInfo.token || '';\n tokenCache = sessionInfo.token;\n return sessionInfo;\n};\n\nexport const getToken = () => (tokenCache ? tokenCache : getSessionInfo().token);\n\nexport const setSessionInfo = ({ token, expiresAt }: UserSession) => {\n tokenCache = token;\n window.localStorage.setItem('JWT', JSON.stringify({ token, expiresAt }));\n};\n\nexport const cleanUp = () => {\n tokenCache = '';\n cookies.remove('JWT');\n cookies.remove('JWT', { path: '/' });\n window.localStorage.removeItem('JWT');\n window.localStorage.removeItem('oauth');\n};\n\nexport const updateMaxAge = ({ expiresAt, token }) => {\n const oAuthExpiration = Number(window.localStorage.getItem('oauth'));\n let updateWithOAuth = false;\n if (oAuthExpiration) {\n const soon = Date.now() + maxSessionAge * TIMEOUTS.oneSecond;\n updateWithOAuth = oAuthExpiration <= soon;\n if (updateWithOAuth) {\n window.localStorage.removeItem('oauth');\n }\n }\n if (token && expiresAt && (!oAuthExpiration || updateWithOAuth)) {\n const expiration = new Date();\n expiration.setSeconds(expiration.getSeconds() + maxSessionAge);\n setSessionInfo({ token, expiresAt: expiration.toISOString() });\n }\n};\n"],"mappings":";;;AAkBA,MAAM,UAAU,IAAI,QAAQ;AAE5B,MAAM,eAAe,OAAO,OAAO;CAAE,OAAO;CAAI,WAAW,KAAA;AAAU,CAAC;AAEtE,IAAI,aAAa;AAEjB,MAAa,uBAAoC;CAC/C,IAAI,cAAc,EAAE,GAAG,aAAa;CACpC,IAAI;EACF,cAAc,KAAK,MAAM,OAAO,aAAa,QAAQ,KAAK,KAAK,EAAE;CACnE,QAAQ,CAER;CAGA,MAAM,qBAAqB,QAAQ,IAAI,OAAO,EAAE,YAAY,KAAK,CAAC,KAAK;CACvE,IAAI,oBAAoB;EACtB,eAAe,EAAE,OAAO,mBAAmB,CAAC;EAC5C,QAAQ,OAAO,KAAK;EACpB,QAAQ,OAAO,OAAO,EAAE,MAAM,IAAI,CAAC;EACnC,OAAO;GAAE,OAAO;GAAoB,WAAW,KAAA;EAAU;CAC3D;CACA,IAAI,YAAY,aAAa,IAAI,KAAK,YAAY,SAAS,oBAAI,IAAI,KAAK,GAAG;EACzE,QAAQ;EACR,OAAO,EAAE,GAAG,aAAa;CAC3B;CACA,YAAY,QAAQ,YAAY,SAAS;CACzC,aAAa,YAAY;CACzB,OAAO;AACT;AAEA,MAAa,iBAAkB,aAAa,aAAa,eAAe,EAAE;AAE1E,MAAa,kBAAkB,EAAE,OAAO,gBAA6B;CACnE,aAAa;CACb,OAAO,aAAa,QAAQ,OAAO,KAAK,UAAU;EAAE;EAAO;CAAU,CAAC,CAAC;AACzE;AAEA,MAAa,gBAAgB;CAC3B,aAAa;CACb,QAAQ,OAAO,KAAK;CACpB,QAAQ,OAAO,OAAO,EAAE,MAAM,IAAI,CAAC;CACnC,OAAO,aAAa,WAAW,KAAK;CACpC,OAAO,aAAa,WAAW,OAAO;AACxC;AAEA,MAAa,gBAAgB,EAAE,WAAW,YAAY;CACpD,MAAM,kBAAkB,OAAO,OAAO,aAAa,QAAQ,OAAO,CAAC;CACnE,IAAI,kBAAkB;CACtB,IAAI,iBAAiB;EAEnB,kBAAkB,mBADL,KAAK,IAAI,IAAI,gBAAgB,SAAS;EAEnD,IAAI,iBACF,OAAO,aAAa,WAAW,OAAO;CAE1C;CACA,IAAI,SAAS,cAAc,CAAC,mBAAmB,kBAAkB;EAC/D,MAAM,6BAAa,IAAI,KAAK;EAC5B,WAAW,WAAW,WAAW,WAAW,IAAI,aAAa;EAC7D,eAAe;GAAE;GAAO,WAAW,WAAW,YAAY;EAAE,CAAC;CAC/D;AACF"}
1
+ {"version":3,"file":"auth.js","names":[],"sources":["../src/auth.ts"],"sourcesContent":["// Copyright 2016 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport Cookies from 'universal-cookie';\n\nimport { TIMEOUTS, maxSessionAge } from './constants';\nimport type { UserSession } from './usersSlice';\n\nconst cookies = new Cookies();\n\nconst emptySession = Object.freeze({ token: '', expiresAt: undefined }) as Readonly<UserSession>;\n\nlet tokenCache = '';\n\nexport const getSessionInfo = (): UserSession => {\n let sessionInfo = { ...emptySession } as UserSession;\n try {\n sessionInfo = JSON.parse(window.localStorage.getItem('JWT') ?? '');\n } catch {\n // most likely not logged in - nothing to do here\n }\n\n // check for cookie first to handles sso login while an old/expired token may still exist in cache/ localStorage\n const jwtTokenFromCookie = cookies.get('JWT', { doNotParse: true }) ?? '';\n if (jwtTokenFromCookie) {\n setSessionInfo({ token: jwtTokenFromCookie });\n cookies.remove('JWT');\n cookies.remove('JWT', { path: '/' });\n return { token: jwtTokenFromCookie, expiresAt: undefined };\n }\n if (sessionInfo.expiresAt && new Date(sessionInfo.expiresAt) < new Date()) {\n cleanUp();\n return { ...emptySession };\n }\n sessionInfo.token = sessionInfo.token || '';\n tokenCache = sessionInfo.token;\n return sessionInfo;\n};\n\nexport const getToken = () => (tokenCache ? tokenCache : getSessionInfo().token);\n\nexport const setSessionInfo = ({ token, expiresAt }: UserSession) => {\n tokenCache = token;\n window.localStorage.setItem('JWT', JSON.stringify({ token, expiresAt }));\n};\n\nexport const cleanUp = () => {\n tokenCache = '';\n cookies.remove('JWT');\n cookies.remove('JWT', { path: '/' });\n window.localStorage.removeItem('JWT');\n window.localStorage.removeItem('oauth');\n};\n\nexport const updateMaxAge = ({ expiresAt, token }) => {\n const oAuthExpiration = Number(window.localStorage.getItem('oauth'));\n let updateWithOAuth = false;\n if (oAuthExpiration) {\n const soon = Date.now() + maxSessionAge * TIMEOUTS.oneSecond;\n updateWithOAuth = oAuthExpiration <= soon;\n if (updateWithOAuth) {\n window.localStorage.removeItem('oauth');\n }\n }\n if (token && expiresAt && (!oAuthExpiration || updateWithOAuth)) {\n const expiration = new Date();\n expiration.setSeconds(expiration.getSeconds() + maxSessionAge);\n setSessionInfo({ token, expiresAt: expiration.toISOString() });\n }\n};\n"],"mappings":";;;AAkBA,MAAM,UAAU,IAAI,QAAQ;AAE5B,MAAM,eAAe,OAAO,OAAO;CAAE,OAAO;CAAI,WAAW,KAAA;AAAU,CAAC;AAEtE,IAAI,aAAa;AAEjB,MAAa,uBAAoC;CAC/C,IAAI,cAAc,EAAE,GAAG,aAAa;CACpC,IAAI;EACF,cAAc,KAAK,MAAM,OAAO,aAAa,QAAQ,KAAK,KAAK,EAAE;CACnE,QAAQ,CAER;CAGA,MAAM,qBAAqB,QAAQ,IAAI,OAAO,EAAE,YAAY,KAAK,CAAC,KAAK;CACvE,IAAI,oBAAoB;EACtB,eAAe,EAAE,OAAO,mBAAmB,CAAC;EAC5C,QAAQ,OAAO,KAAK;EACpB,QAAQ,OAAO,OAAO,EAAE,MAAM,IAAI,CAAC;EACnC,OAAO;GAAE,OAAO;GAAoB,WAAW,KAAA;EAAU;CAC3D;CACA,IAAI,YAAY,aAAa,IAAI,KAAK,YAAY,SAAS,oBAAI,IAAI,KAAK,GAAG;EACzE,QAAQ;EACR,OAAO,EAAE,GAAG,aAAa;CAC3B;CACA,YAAY,QAAQ,YAAY,SAAS;CACzC,aAAa,YAAY;CACzB,OAAO;AACT;AAEA,MAAa,iBAAkB,aAAa,aAAa,eAAe,CAAC,CAAC;AAE1E,MAAa,kBAAkB,EAAE,OAAO,gBAA6B;CACnE,aAAa;CACb,OAAO,aAAa,QAAQ,OAAO,KAAK,UAAU;EAAE;EAAO;CAAU,CAAC,CAAC;AACzE;AAEA,MAAa,gBAAgB;CAC3B,aAAa;CACb,QAAQ,OAAO,KAAK;CACpB,QAAQ,OAAO,OAAO,EAAE,MAAM,IAAI,CAAC;CACnC,OAAO,aAAa,WAAW,KAAK;CACpC,OAAO,aAAa,WAAW,OAAO;AACxC;AAEA,MAAa,gBAAgB,EAAE,WAAW,YAAY;CACpD,MAAM,kBAAkB,OAAO,OAAO,aAAa,QAAQ,OAAO,CAAC;CACnE,IAAI,kBAAkB;CACtB,IAAI,iBAAiB;EAEnB,kBAAkB,mBADL,KAAK,IAAI,IAAI,gBAAgB,SAAS;EAEnD,IAAI,iBACF,OAAO,aAAa,WAAW,OAAO;CAE1C;CACA,IAAI,SAAS,cAAc,CAAC,mBAAmB,kBAAkB;EAC/D,MAAM,6BAAa,IAAI,KAAK;EAC5B,WAAW,WAAW,WAAW,WAAW,IAAI,aAAa;EAC7D,eAAe;GAAE;GAAO,WAAW,WAAW,YAAY;EAAE,CAAC;CAC/D;AACF"}
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_chunk = require("./chunk-D6vf50IK.cjs");
2
+ const require_rolldown_runtime = require("./rolldown-runtime-D6vf50IK.cjs");
3
3
  const require_appSlice_constants = require("./appSlice/constants.cjs");
4
4
  const require_onboardingSlice_constants = require("./onboardingSlice/constants.cjs");
5
5
  const require_constants = require("./constants.cjs");
@@ -15,7 +15,7 @@ const require_usersSlice_selectors = require("./usersSlice/selectors.cjs");
15
15
  let _reduxjs_toolkit = require("@reduxjs/toolkit");
16
16
  let _northern_tech_utils_helpers = require("@northern.tech/utils/helpers");
17
17
  let dayjs = require("dayjs");
18
- dayjs = require_chunk.__toESM(dayjs, 1);
18
+ dayjs = require_rolldown_runtime.__toESM(dayjs, 1);
19
19
  let _northern_tech_utils_constants = require("@northern.tech/utils/constants");
20
20
  //#region src/commonSelectors.ts
21
21
  const getIsEnterprise = (0, _reduxjs_toolkit.createSelector)([require_organizationSlice_selectors.getOrganization, require_appSlice_selectors.getFeatures], ({ plan = require_appSlice_constants.PLANS.os.id }, { isEnterprise, isHosted }) => isEnterprise || isHosted && plan === require_appSlice_constants.PLANS.enterprise.id);
@@ -1 +1 @@
1
- {"version":3,"file":"commonSelectors.cjs","names":["getOrganization","getFeatures","PLANS","getCurrentUser","getRolesById","rolesByName","mapUserRolesToUiPermissions","getIsServiceProvider","uiPermissionsById","ADDONS","getGlobalSettings","getFilteringAttributes","ATTRIBUTE_SCOPES","getOnboarding","getUserSettings","onboardingSteps","getDevicesById","getDeviceById","getDeploymentsById","getDeploymentsSelectionState","getReleasesById","getSelectedDeploymentDeviceIds","getIssueCountsByType","DEVICE_ISSUE_OPTIONS","getGroupsById","UNGROUPED_GROUP","ALL_DEVICES","defaultReports","getListedDevices","getSearchedDevices","listItemMapper","getAuditLogEntry","getRolesList","rolesById","serviceProviderRolesById","getHas2FA","getUserSettingsInitialized","getSecurityAlertDismissedTimestamp"],"sources":["../src/commonSelectors.ts"],"sourcesContent":["// Copyright 2024 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport type { AuditLog as AuditLogEvent } from '@northern.tech/types/types.gen';\nimport type { DeviceIssueOption } from '@northern.tech/utils/constants';\nimport { attributeDuplicateFilter, getDemoDeviceAddress as getDemoDeviceAddressHelper } from '@northern.tech/utils/helpers';\nimport { createSelector } from '@reduxjs/toolkit';\nimport dayjs from 'dayjs';\n\nimport { ADDONS, PLANS, defaultReports } from './appSlice/constants';\nimport { getFeatures, getSearchedDevices } from './appSlice/selectors';\nimport { DEVICE_LIST_MAXIMUM_LENGTH, UNGROUPED_GROUP } from './commonConstants';\nimport { ALL_DEVICES, ATTRIBUTE_SCOPES, DEVICE_ISSUE_OPTIONS, rolesById, rolesByName, serviceProviderRolesById, uiPermissionsById } from './constants';\nimport type { Role } from './constants';\nimport type { Deployment } from './deploymentsSlice';\nimport { getDeploymentsById, getDeploymentsSelectionState, getSelectedDeploymentDeviceIds } from './deploymentsSlice/selectors';\nimport type { Device, DeviceGroup } from './devicesSlice';\nimport { getDeviceById, getDevicesById, getFilteringAttributes, getGroupsById, getListedDevices } from './devicesSlice/selectors';\nimport { getIssueCountsByType } from './monitorSlice/selectors';\nimport { onboardingSteps } from './onboardingSlice/constants';\nimport { getOnboarding } from './onboardingSlice/selectors';\nimport { getAuditLogEntry, getIsServiceProvider, getOrganization } from './organizationSlice/selectors';\nimport { getReleasesById } from './releasesSlice/selectors';\nimport {\n getCurrentUser,\n getGlobalSettings,\n getHas2FA,\n getRolesById,\n getRolesList,\n getSecurityAlertDismissedTimestamp,\n getUserSettings,\n getUserSettingsInitialized\n} from './usersSlice/selectors';\nimport { listItemMapper, mapUserRolesToUiPermissions } from './utils';\n\nexport const getIsEnterprise = createSelector(\n [getOrganization, getFeatures],\n ({ plan = PLANS.os.id }, { isEnterprise, isHosted }) => isEnterprise || (isHosted && plan === PLANS.enterprise.id)\n);\n\nexport const getUserRoles = createSelector([getCurrentUser, getRolesById, getIsEnterprise], (currentUser, rolesById, isEnterprise) => {\n const isAdmin = currentUser.roles?.length ? currentUser.roles.some(role => role === rolesByName.admin) : !isEnterprise;\n const uiPermissions = isAdmin ? mapUserRolesToUiPermissions([rolesByName.admin], rolesById) : mapUserRolesToUiPermissions(currentUser.roles || [], rolesById);\n return { isAdmin, uiPermissions };\n});\n\nconst hasPermission = (thing: Record<string, string[]>, permission: string): boolean =>\n Object.values(thing).some(permissions => permissions.includes(permission));\n\nexport const getUserCapabilities = createSelector([getUserRoles, getIsServiceProvider], ({ uiPermissions }, isServiceProvider) => {\n const canManageReleases = hasPermission(uiPermissions.releases, uiPermissionsById.manage.value);\n const canReadReleases = canManageReleases || hasPermission(uiPermissions.releases, uiPermissionsById.read.value);\n const canUploadReleases = canManageReleases || hasPermission(uiPermissions.releases, uiPermissionsById.upload.value);\n\n const canAuditlog = uiPermissions.auditlog.includes(uiPermissionsById.read.value);\n\n const canReadUsers = uiPermissions.userManagement.includes(uiPermissionsById.read.value);\n const canManageUsers = uiPermissions.userManagement.includes(uiPermissionsById.manage.value);\n\n const canReadDevices = hasPermission(uiPermissions.groups, uiPermissionsById.read.value);\n const canWriteDevices = Object.values(uiPermissions.groups).some(\n groupPermissions => groupPermissions.includes(uiPermissionsById.read.value) && groupPermissions.length > 1\n );\n const canTroubleshoot = hasPermission(uiPermissions.groups, uiPermissionsById.connect.value);\n const canManageDevices = hasPermission(uiPermissions.groups, uiPermissionsById.manage.value);\n const canConfigure = hasPermission(uiPermissions.groups, uiPermissionsById.configure.value);\n\n const canDeploy =\n (uiPermissions.deployments?.includes(uiPermissionsById.deploy.value) ?? false) || hasPermission(uiPermissions.groups, uiPermissionsById.deploy.value);\n const canReadDeployments = uiPermissions.deployments?.includes(uiPermissionsById.read.value) ?? false;\n\n return {\n canAuditlog,\n canConfigure,\n canDeploy,\n canManageDevices,\n canManageReleases,\n canManageUsers,\n canReadDeployments,\n canReadDevices,\n canReadReleases,\n canReadUsers,\n canTroubleshoot,\n canUploadReleases,\n canWriteDevices,\n groupsPermissions: uiPermissions.groups,\n releasesPermissions: uiPermissions.releases,\n SPTenant: isServiceProvider\n };\n});\n\nexport const getTenantCapabilities = createSelector(\n [getFeatures, getOrganization, getIsEnterprise],\n (\n {\n hasAuditlogs: isAuditlogEnabled,\n hasDeviceConfig: isDeviceConfigEnabled,\n hasDeviceConnect: isDeviceConnectEnabled,\n hasMonitor: isMonitorEnabled,\n isHosted\n },\n { addons = [], plan = PLANS.os.id },\n isEnterprise\n ) => {\n const canDelta = isEnterprise || plan === PLANS.professional.id;\n const hasAuditlogs = isAuditlogEnabled && isEnterprise;\n const hasDeviceConfig = addons.some(addon => addon.name === ADDONS.configure.id && addon.enabled) || (isDeviceConfigEnabled && !isHosted);\n const hasDeviceConnect = addons.some(addon => addon.name === ADDONS.troubleshoot.id && addon.enabled) || (isDeviceConnectEnabled && !isHosted);\n const hasMonitor = isMonitorEnabled && addons.some(addon => addon.name === ADDONS.monitor.id && addon.enabled);\n return {\n canDelta,\n canRetry: canDelta,\n canSchedule: canDelta,\n hasAuditlogs,\n hasDeviceConfig,\n hasDeviceConnect,\n hasFullFiltering: canDelta,\n hasMonitor,\n isEnterprise,\n plan\n };\n }\n);\n\nexport const getFilterAttributes = createSelector(\n [getGlobalSettings, getFilteringAttributes],\n ({ previousFilters }, { identityAttributes, inventoryAttributes, systemAttributes, tagAttributes }) => {\n const deviceNameAttribute = { key: 'name', value: 'Name', scope: ATTRIBUTE_SCOPES.tags, category: ATTRIBUTE_SCOPES.tags, priority: 1 };\n const deviceIdAttribute = { key: 'id', value: 'Device ID', scope: ATTRIBUTE_SCOPES.identity, category: ATTRIBUTE_SCOPES.identity, priority: 1 };\n const checkInAttribute = { key: 'check_in_time', value: 'Latest activity', scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };\n const updateAttribute = { ...checkInAttribute, key: 'updated_ts', value: 'Last inventory update' };\n const firstRequestAttribute = { key: 'created_ts', value: 'First request', scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };\n const attributes = [\n ...previousFilters.map(item => ({\n ...item,\n value: deviceIdAttribute.key === item.key ? deviceIdAttribute.value : item.key,\n category: 'recently used',\n priority: 0\n })),\n deviceNameAttribute,\n deviceIdAttribute,\n ...identityAttributes.map(item => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.identity, category: ATTRIBUTE_SCOPES.identity, priority: 1 })),\n ...inventoryAttributes.map(item => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.inventory, category: ATTRIBUTE_SCOPES.inventory, priority: 2 })),\n ...tagAttributes.map(item => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.tags, category: ATTRIBUTE_SCOPES.tags, priority: 3 })),\n checkInAttribute,\n updateAttribute,\n firstRequestAttribute,\n ...systemAttributes.map(item => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 }))\n ];\n return attributeDuplicateFilter(attributes, 'key');\n }\n);\n\nexport const getOnboardingState = createSelector([getOnboarding, getUserSettings], ({ complete, progress, showTips, ...remainder }, { onboarding = {} }) => ({\n ...remainder,\n ...onboarding,\n complete: onboarding.complete || complete,\n progress:\n Object.keys(onboardingSteps).findIndex(step => step === progress) > Object.keys(onboardingSteps).findIndex(step => step === onboarding.progress)\n ? progress\n : onboarding.progress,\n showTips: !onboarding.showTips ? onboarding.showTips : showTips\n}));\n\nexport const getDemoDeviceAddress = createSelector([getDevicesById, getOnboarding], (devicesById, { approach, demoArtifactPort }) => {\n const demoDeviceAddress = `http://${getDemoDeviceAddressHelper(Object.values(devicesById), approach)}`;\n return demoArtifactPort ? `${demoDeviceAddress}:${demoArtifactPort}` : demoDeviceAddress;\n});\n\nexport const getDeviceConfigDeployment = createSelector([getDeviceById, getDeploymentsById], (device, deploymentsById) => {\n const { config = {} } = device;\n const { deployment_id: configDeploymentId = '' } = config;\n const deviceConfigDeployment = deploymentsById[configDeploymentId] ?? {};\n return { device, deviceConfigDeployment };\n});\n\nexport const getDeploymentRelease = createSelector(\n [getDeploymentsById, getDeploymentsSelectionState, getReleasesById],\n (deploymentsById, { selectedId = '' }, releasesById) => {\n const deployment = deploymentsById[selectedId] ?? {};\n return deployment?.artifact_name && releasesById[deployment.artifact_name] ? releasesById[deployment.artifact_name] : { device_types_compatible: [] };\n }\n);\n\nexport const getSelectedDeploymentData = createSelector(\n [getDeploymentsById, getDeploymentsSelectionState, getDevicesById, getSelectedDeploymentDeviceIds],\n (deploymentsById, { selectedId = '' }, devicesById, selectedDeviceIds) => {\n const deployment = deploymentsById[selectedId] ?? {};\n const { devices = {} } = deployment as Deployment;\n return {\n deployment,\n selectedDevices: selectedDeviceIds.map(deviceId => ({ ...devicesById[deviceId], ...(devices[deviceId] ?? {}) }))\n };\n }\n);\n\nexport const getAvailableIssueOptionsByType = createSelector([getTenantCapabilities, getIssueCountsByType], ({ hasFullFiltering, hasMonitor }, issueCounts) =>\n Object.values<DeviceIssueOption>(DEVICE_ISSUE_OPTIONS).reduce(\n (accu, { isCategory, key, needsFullFiltering, needsMonitor, title }) => {\n if (isCategory || (needsFullFiltering && !hasFullFiltering) || (needsMonitor && !hasMonitor)) {\n return accu;\n }\n accu[key] = { count: issueCounts[key].filtered, key, title };\n return accu;\n },\n {} as Record<string, { count: number; key: string; title: string }>\n )\n);\n\nexport const getGroupNames = createSelector([getGroupsById, getUserRoles], (groupsById, { uiPermissions }) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [UNGROUPED_GROUP.id]: ungrouped, ...groups } = groupsById;\n return Object.keys(\n Object.entries(groups).reduce(\n (accu, [groupName, group]) => {\n if (group.filters || uiPermissions.groups[ALL_DEVICES]) {\n accu[groupName] = group;\n }\n return accu;\n },\n { ...uiPermissions.groups } as Record<string, DeviceGroup>\n )\n ).sort();\n});\n\nexport const getDeviceReportsForUser = createSelector(\n [getUserSettings, getCurrentUser, getGlobalSettings, getDevicesById],\n ({ reports }, { id: currentUserId }, globalSettings, devicesById) =>\n reports || globalSettings[`${currentUserId}-reports`] || (Object.keys(devicesById).length ? defaultReports : [])\n);\n\nconst listTypeDeviceIdMap = {\n deviceList: getListedDevices,\n search: getSearchedDevices\n};\nconst deviceMapDefault = { defaultObject: { auth_sets: [] }, cutOffSize: DEVICE_LIST_MAXIMUM_LENGTH };\nconst getDeviceMappingDefaults = () => deviceMapDefault;\n\nexport const getMappedDevicesList = createSelector(\n [getDevicesById, (state, listType) => listTypeDeviceIdMap[listType](state), getDeviceMappingDefaults],\n listItemMapper\n);\n\nexport const getAuditlogDevice = createSelector([getAuditLogEntry, getDevicesById], (auditlogEvent, devicesById) => {\n let auditlogDevice: Partial<Device> = {};\n if (auditlogEvent) {\n const { object } = auditlogEvent as AuditLogEvent;\n const objectData = object as AuditLogEvent['object'] | undefined;\n if (objectData?.type === 'device' && objectData.id) {\n auditlogDevice = { id: objectData.id, ...(objectData.device ?? {}) } as Device;\n }\n }\n return { ...auditlogDevice, ...(auditlogDevice.id ? devicesById[auditlogDevice.id] : {}) };\n});\n\ntype RoleItem = Role | { value: string };\nexport const getRelevantRoles = createSelector([getOrganization, getRolesList], ({ service_provider }, roles) => {\n if (service_provider) {\n return roles.reduce(\n (accu, role) => {\n if (rolesById[role.value as keyof typeof rolesById]) {\n return accu;\n }\n accu.push(role);\n return accu;\n },\n [...Object.values(serviceProviderRolesById)] as RoleItem[]\n );\n }\n return Object.keys(rolesById)\n .reverse()\n .reduce((accu, key) => {\n const index = accu.findIndex(({ value }) => value === key);\n if (index >= 0) {\n accu = [accu[index], ...accu.filter((_, itemIndex) => index !== itemIndex)];\n }\n return accu;\n }, roles);\n});\n\nexport const getShowSecurityAlert = createSelector(\n [getCurrentUser, getHas2FA, getFeatures, getIsEnterprise, getUserSettingsInitialized, getSecurityAlertDismissedTimestamp],\n (currentUser, has2FA, features, isEnterprise, settingsInitialized, dismissedTimestamp) => {\n const isOAuth2 = !!currentUser?.sso?.length;\n const userVerified = !!currentUser.verified;\n\n const isHosted = features?.isHosted;\n const canHave2FA = isEnterprise || isHosted;\n const secureOAuthUser = isOAuth2 && userVerified;\n if (!currentUser || !settingsInitialized || has2FA || !canHave2FA || secureOAuthUser) {\n return false;\n }\n\n if (dismissedTimestamp === null) {\n return true;\n }\n\n const today = dayjs();\n const dismissedMonthAgo = today.diff(dismissedTimestamp, 'months');\n\n return dismissedMonthAgo > 0;\n }\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA6CA,MAAa,mBAAA,GAAA,iBAAA,gBACX,CAACA,oCAAAA,iBAAiBC,2BAAAA,WAAW,IAC5B,EAAE,OAAOC,2BAAAA,MAAM,GAAG,MAAM,EAAE,cAAc,eAAe,gBAAiB,YAAY,SAASA,2BAAAA,MAAM,WAAW,EACjH;AAEA,MAAa,gBAAA,GAAA,iBAAA,gBAA8B;CAACC,6BAAAA;CAAgBC,6BAAAA;CAAc;AAAe,IAAI,aAAa,WAAW,iBAAiB;CACpI,MAAM,UAAU,YAAY,OAAO,SAAS,YAAY,MAAM,MAAK,SAAQ,SAASC,+BAAAA,YAAY,KAAK,IAAI,CAAC;CAE1G,OAAO;EAAE;EAAS,eADI,UAAUC,cAAAA,4BAA4B,CAACD,+BAAAA,YAAY,KAAK,GAAG,SAAS,IAAIC,cAAAA,4BAA4B,YAAY,SAAS,CAAC,GAAG,SAAS;CAC5H;AAClC,CAAC;AAED,MAAM,iBAAiB,OAAiC,eACtD,OAAO,OAAO,KAAK,EAAE,MAAK,gBAAe,YAAY,SAAS,UAAU,CAAC;AAE3E,MAAa,uBAAA,GAAA,iBAAA,gBAAqC,CAAC,cAAcC,oCAAAA,oBAAoB,IAAI,EAAE,iBAAiB,sBAAsB;CAChI,MAAM,oBAAoB,cAAc,cAAc,UAAUC,+BAAAA,kBAAkB,OAAO,KAAK;CAC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gB,aACX,YAAY,cAElC,OAAO;CAGT,IAAI,uBAAuB,MACzB,OAAO;CAMT,QAAA,GAAA,MAAA,SAF8B,EAAE,KAAK,oBAAoB,QAElC,IAAI;AAC7B,CACF"}
1
+ {"version":3,"file":"commonSelectors.cjs","names":["getOrganization","getFeatures","PLANS","getCurrentUser","getRolesById","rolesByName","mapUserRolesToUiPermissions","getIsServiceProvider","uiPermissionsById","ADDONS","getGlobalSettings","getFilteringAttributes","ATTRIBUTE_SCOPES","getOnboarding","getUserSettings","onboardingSteps","getDevicesById","getDeviceById","getDeploymentsById","getDeploymentsSelectionState","getReleasesById","getSelectedDeploymentDeviceIds","getIssueCountsByType","DEVICE_ISSUE_OPTIONS","getGroupsById","UNGROUPED_GROUP","ALL_DEVICES","defaultReports","getListedDevices","getSearchedDevices","listItemMapper","getAuditLogEntry","getRolesList","rolesById","serviceProviderRolesById","getHas2FA","getUserSettingsInitialized","getSecurityAlertDismissedTimestamp"],"sources":["../src/commonSelectors.ts"],"sourcesContent":["// Copyright 2024 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport type { AuditLog as AuditLogEvent } from '@northern.tech/types/types.gen';\nimport type { DeviceIssueOption } from '@northern.tech/utils/constants';\nimport { attributeDuplicateFilter, getDemoDeviceAddress as getDemoDeviceAddressHelper } from '@northern.tech/utils/helpers';\nimport { createSelector } from '@reduxjs/toolkit';\nimport dayjs from 'dayjs';\n\nimport { ADDONS, PLANS, defaultReports } from './appSlice/constants';\nimport { getFeatures, getSearchedDevices } from './appSlice/selectors';\nimport { DEVICE_LIST_MAXIMUM_LENGTH, UNGROUPED_GROUP } from './commonConstants';\nimport { ALL_DEVICES, ATTRIBUTE_SCOPES, DEVICE_ISSUE_OPTIONS, rolesById, rolesByName, serviceProviderRolesById, uiPermissionsById } from './constants';\nimport type { Role } from './constants';\nimport type { Deployment } from './deploymentsSlice';\nimport { getDeploymentsById, getDeploymentsSelectionState, getSelectedDeploymentDeviceIds } from './deploymentsSlice/selectors';\nimport type { Device, DeviceGroup } from './devicesSlice';\nimport { getDeviceById, getDevicesById, getFilteringAttributes, getGroupsById, getListedDevices } from './devicesSlice/selectors';\nimport { getIssueCountsByType } from './monitorSlice/selectors';\nimport { onboardingSteps } from './onboardingSlice/constants';\nimport { getOnboarding } from './onboardingSlice/selectors';\nimport { getAuditLogEntry, getIsServiceProvider, getOrganization } from './organizationSlice/selectors';\nimport { getReleasesById } from './releasesSlice/selectors';\nimport {\n getCurrentUser,\n getGlobalSettings,\n getHas2FA,\n getRolesById,\n getRolesList,\n getSecurityAlertDismissedTimestamp,\n getUserSettings,\n getUserSettingsInitialized\n} from './usersSlice/selectors';\nimport { listItemMapper, mapUserRolesToUiPermissions } from './utils';\n\nexport const getIsEnterprise = createSelector(\n [getOrganization, getFeatures],\n ({ plan = PLANS.os.id }, { isEnterprise, isHosted }) => isEnterprise || (isHosted && plan === PLANS.enterprise.id)\n);\n\nexport const getUserRoles = createSelector([getCurrentUser, getRolesById, getIsEnterprise], (currentUser, rolesById, isEnterprise) => {\n const isAdmin = currentUser.roles?.length ? currentUser.roles.some(role => role === rolesByName.admin) : !isEnterprise;\n const uiPermissions = isAdmin ? mapUserRolesToUiPermissions([rolesByName.admin], rolesById) : mapUserRolesToUiPermissions(currentUser.roles || [], rolesById);\n return { isAdmin, uiPermissions };\n});\n\nconst hasPermission = (thing: Record<string, string[]>, permission: string): boolean =>\n Object.values(thing).some(permissions => permissions.includes(permission));\n\nexport const getUserCapabilities = createSelector([getUserRoles, getIsServiceProvider], ({ uiPermissions }, isServiceProvider) => {\n const canManageReleases = hasPermission(uiPermissions.releases, uiPermissionsById.manage.value);\n const canReadReleases = canManageReleases || hasPermission(uiPermissions.releases, uiPermissionsById.read.value);\n const canUploadReleases = canManageReleases || hasPermission(uiPermissions.releases, uiPermissionsById.upload.value);\n\n const canAuditlog = uiPermissions.auditlog.includes(uiPermissionsById.read.value);\n\n const canReadUsers = uiPermissions.userManagement.includes(uiPermissionsById.read.value);\n const canManageUsers = uiPermissions.userManagement.includes(uiPermissionsById.manage.value);\n\n const canReadDevices = hasPermission(uiPermissions.groups, uiPermissionsById.read.value);\n const canWriteDevices = Object.values(uiPermissions.groups).some(\n groupPermissions => groupPermissions.includes(uiPermissionsById.read.value) && groupPermissions.length > 1\n );\n const canTroubleshoot = hasPermission(uiPermissions.groups, uiPermissionsById.connect.value);\n const canManageDevices = hasPermission(uiPermissions.groups, uiPermissionsById.manage.value);\n const canConfigure = hasPermission(uiPermissions.groups, uiPermissionsById.configure.value);\n\n const canDeploy =\n (uiPermissions.deployments?.includes(uiPermissionsById.deploy.value) ?? false) || hasPermission(uiPermissions.groups, uiPermissionsById.deploy.value);\n const canReadDeployments = uiPermissions.deployments?.includes(uiPermissionsById.read.value) ?? false;\n\n return {\n canAuditlog,\n canConfigure,\n canDeploy,\n canManageDevices,\n canManageReleases,\n canManageUsers,\n canReadDeployments,\n canReadDevices,\n canReadReleases,\n canReadUsers,\n canTroubleshoot,\n canUploadReleases,\n canWriteDevices,\n groupsPermissions: uiPermissions.groups,\n releasesPermissions: uiPermissions.releases,\n SPTenant: isServiceProvider\n };\n});\n\nexport const getTenantCapabilities = createSelector(\n [getFeatures, getOrganization, getIsEnterprise],\n (\n {\n hasAuditlogs: isAuditlogEnabled,\n hasDeviceConfig: isDeviceConfigEnabled,\n hasDeviceConnect: isDeviceConnectEnabled,\n hasMonitor: isMonitorEnabled,\n isHosted\n },\n { addons = [], plan = PLANS.os.id },\n isEnterprise\n ) => {\n const canDelta = isEnterprise || plan === PLANS.professional.id;\n const hasAuditlogs = isAuditlogEnabled && isEnterprise;\n const hasDeviceConfig = addons.some(addon => addon.name === ADDONS.configure.id && addon.enabled) || (isDeviceConfigEnabled && !isHosted);\n const hasDeviceConnect = addons.some(addon => addon.name === ADDONS.troubleshoot.id && addon.enabled) || (isDeviceConnectEnabled && !isHosted);\n const hasMonitor = isMonitorEnabled && addons.some(addon => addon.name === ADDONS.monitor.id && addon.enabled);\n return {\n canDelta,\n canRetry: canDelta,\n canSchedule: canDelta,\n hasAuditlogs,\n hasDeviceConfig,\n hasDeviceConnect,\n hasFullFiltering: canDelta,\n hasMonitor,\n isEnterprise,\n plan\n };\n }\n);\n\nexport const getFilterAttributes = createSelector(\n [getGlobalSettings, getFilteringAttributes],\n ({ previousFilters }, { identityAttributes, inventoryAttributes, systemAttributes, tagAttributes }) => {\n const deviceNameAttribute = { key: 'name', value: 'Name', scope: ATTRIBUTE_SCOPES.tags, category: ATTRIBUTE_SCOPES.tags, priority: 1 };\n const deviceIdAttribute = { key: 'id', value: 'Device ID', scope: ATTRIBUTE_SCOPES.identity, category: ATTRIBUTE_SCOPES.identity, priority: 1 };\n const checkInAttribute = { key: 'check_in_time', value: 'Latest activity', scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };\n const updateAttribute = { ...checkInAttribute, key: 'updated_ts', value: 'Last inventory update' };\n const firstRequestAttribute = { key: 'created_ts', value: 'First request', scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };\n const attributes = [\n ...previousFilters.map(item => ({\n ...item,\n value: deviceIdAttribute.key === item.key ? deviceIdAttribute.value : item.key,\n category: 'recently used',\n priority: 0\n })),\n deviceNameAttribute,\n deviceIdAttribute,\n ...identityAttributes.map(item => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.identity, category: ATTRIBUTE_SCOPES.identity, priority: 1 })),\n ...inventoryAttributes.map(item => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.inventory, category: ATTRIBUTE_SCOPES.inventory, priority: 2 })),\n ...tagAttributes.map(item => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.tags, category: ATTRIBUTE_SCOPES.tags, priority: 3 })),\n checkInAttribute,\n updateAttribute,\n firstRequestAttribute,\n ...systemAttributes.map(item => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 }))\n ];\n return attributeDuplicateFilter(attributes, 'key');\n }\n);\n\nexport const getOnboardingState = createSelector([getOnboarding, getUserSettings], ({ complete, progress, showTips, ...remainder }, { onboarding = {} }) => ({\n ...remainder,\n ...onboarding,\n complete: onboarding.complete || complete,\n progress:\n Object.keys(onboardingSteps).findIndex(step => step === progress) > Object.keys(onboardingSteps).findIndex(step => step === onboarding.progress)\n ? progress\n : onboarding.progress,\n showTips: !onboarding.showTips ? onboarding.showTips : showTips\n}));\n\nexport const getDemoDeviceAddress = createSelector([getDevicesById, getOnboarding], (devicesById, { approach, demoArtifactPort }) => {\n const demoDeviceAddress = `http://${getDemoDeviceAddressHelper(Object.values(devicesById), approach)}`;\n return demoArtifactPort ? `${demoDeviceAddress}:${demoArtifactPort}` : demoDeviceAddress;\n});\n\nexport const getDeviceConfigDeployment = createSelector([getDeviceById, getDeploymentsById], (device, deploymentsById) => {\n const { config = {} } = device;\n const { deployment_id: configDeploymentId = '' } = config;\n const deviceConfigDeployment = deploymentsById[configDeploymentId] ?? {};\n return { device, deviceConfigDeployment };\n});\n\nexport const getDeploymentRelease = createSelector(\n [getDeploymentsById, getDeploymentsSelectionState, getReleasesById],\n (deploymentsById, { selectedId = '' }, releasesById) => {\n const deployment = deploymentsById[selectedId] ?? {};\n return deployment?.artifact_name && releasesById[deployment.artifact_name] ? releasesById[deployment.artifact_name] : { device_types_compatible: [] };\n }\n);\n\nexport const getSelectedDeploymentData = createSelector(\n [getDeploymentsById, getDeploymentsSelectionState, getDevicesById, getSelectedDeploymentDeviceIds],\n (deploymentsById, { selectedId = '' }, devicesById, selectedDeviceIds) => {\n const deployment = deploymentsById[selectedId] ?? {};\n const { devices = {} } = deployment as Deployment;\n return {\n deployment,\n selectedDevices: selectedDeviceIds.map(deviceId => ({ ...devicesById[deviceId], ...(devices[deviceId] ?? {}) }))\n };\n }\n);\n\nexport const getAvailableIssueOptionsByType = createSelector([getTenantCapabilities, getIssueCountsByType], ({ hasFullFiltering, hasMonitor }, issueCounts) =>\n Object.values<DeviceIssueOption>(DEVICE_ISSUE_OPTIONS).reduce(\n (accu, { isCategory, key, needsFullFiltering, needsMonitor, title }) => {\n if (isCategory || (needsFullFiltering && !hasFullFiltering) || (needsMonitor && !hasMonitor)) {\n return accu;\n }\n accu[key] = { count: issueCounts[key].filtered, key, title };\n return accu;\n },\n {} as Record<string, { count: number; key: string; title: string }>\n )\n);\n\nexport const getGroupNames = createSelector([getGroupsById, getUserRoles], (groupsById, { uiPermissions }) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [UNGROUPED_GROUP.id]: ungrouped, ...groups } = groupsById;\n return Object.keys(\n Object.entries(groups).reduce(\n (accu, [groupName, group]) => {\n if (group.filters || uiPermissions.groups[ALL_DEVICES]) {\n accu[groupName] = group;\n }\n return accu;\n },\n { ...uiPermissions.groups } as Record<string, DeviceGroup>\n )\n ).sort();\n});\n\nexport const getDeviceReportsForUser = createSelector(\n [getUserSettings, getCurrentUser, getGlobalSettings, getDevicesById],\n ({ reports }, { id: currentUserId }, globalSettings, devicesById) =>\n reports || globalSettings[`${currentUserId}-reports`] || (Object.keys(devicesById).length ? defaultReports : [])\n);\n\nconst listTypeDeviceIdMap = {\n deviceList: getListedDevices,\n search: getSearchedDevices\n};\nconst deviceMapDefault = { defaultObject: { auth_sets: [] }, cutOffSize: DEVICE_LIST_MAXIMUM_LENGTH };\nconst getDeviceMappingDefaults = () => deviceMapDefault;\n\nexport const getMappedDevicesList = createSelector(\n [getDevicesById, (state, listType) => listTypeDeviceIdMap[listType](state), getDeviceMappingDefaults],\n listItemMapper\n);\n\nexport const getAuditlogDevice = createSelector([getAuditLogEntry, getDevicesById], (auditlogEvent, devicesById) => {\n let auditlogDevice: Partial<Device> = {};\n if (auditlogEvent) {\n const { object } = auditlogEvent as AuditLogEvent;\n const objectData = object as AuditLogEvent['object'] | undefined;\n if (objectData?.type === 'device' && objectData.id) {\n auditlogDevice = { id: objectData.id, ...(objectData.device ?? {}) } as Device;\n }\n }\n return { ...auditlogDevice, ...(auditlogDevice.id ? devicesById[auditlogDevice.id] : {}) };\n});\n\ntype RoleItem = Role | { value: string };\nexport const getRelevantRoles = createSelector([getOrganization, getRolesList], ({ service_provider }, roles) => {\n if (service_provider) {\n return roles.reduce(\n (accu, role) => {\n if (rolesById[role.value as keyof typeof rolesById]) {\n return accu;\n }\n accu.push(role);\n return accu;\n },\n [...Object.values(serviceProviderRolesById)] as RoleItem[]\n );\n }\n return Object.keys(rolesById)\n .reverse()\n .reduce((accu, key) => {\n const index = accu.findIndex(({ value }) => value === key);\n if (index >= 0) {\n accu = [accu[index], ...accu.filter((_, itemIndex) => index !== itemIndex)];\n }\n return accu;\n }, roles);\n});\n\nexport const getShowSecurityAlert = createSelector(\n [getCurrentUser, getHas2FA, getFeatures, getIsEnterprise, getUserSettingsInitialized, getSecurityAlertDismissedTimestamp],\n (currentUser, has2FA, features, isEnterprise, settingsInitialized, dismissedTimestamp) => {\n const isOAuth2 = !!currentUser?.sso?.length;\n const userVerified = !!currentUser.verified;\n\n const isHosted = features?.isHosted;\n const canHave2FA = isEnterprise || isHosted;\n const secureOAuthUser = isOAuth2 && userVerified;\n if (!currentUser || !settingsInitialized || has2FA || !canHave2FA || secureOAuthUser) {\n return false;\n }\n\n if (dismissedTimestamp === null) {\n return true;\n }\n\n const today = dayjs();\n const dismissedMonthAgo = today.diff(dismissedTimestamp, 'months');\n\n return dismissedMonthAgo > 0;\n }\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA6CA,MAAa,mBAAA,GAAA,iBAAA,eAAA,CACX,CAACA,oCAAAA,iBAAiBC,2BAAAA,WAAW,IAC5B,EAAE,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AAkC,CAAChB,oCAAAA,iBAAiBgC,6BAAAA,YAAY,IAAI,EAAE,oBAAoB,UAAU;CAC/G,IAAI,kBACF,OAAO,MAAM,QACV,MAAM,SAAS;EACd,IAAIC,+BAAAA,UAAU,KAAK,QACjB,OAAO;EAET,KAAK,KAAK,IAAI;EACd,OAAO;CACT,GACA,CAAC,GAAG,OAAO,OAAOC,+BAAAA,wBAAwB,CAAC,CAC7C;CAEF,OAAO,OAAO,KAAKD,+BAAAA,SAAS,CAAC,CAC1B,QAAQ,CAAC,CACT,QAAQ,MAAM,QAAQ;EACrB,MAAM,QAAQ,KAAK,WAAW,EAAE,YAAY,UAAU,GAAG;EACzD,IAAI,SAAS,GACX,OAAO,CAAC,KAAK,QAAQ,GAAG,KAAK,QAAQ,GAAG,cAAc,UAAU,SAAS,CAAC;EAE5E,OAAO;CACT,GAAG,KAAK;AACZ,CAAC;AAED,MAAa,wBAAA,GAAA,iBAAA,eAAA,CACX;CAAC9B,6BAAAA;CAAgBgC,6BAAAA;CAAWlC,2BAAAA;CAAa;CAAiBmC,6BAAAA;CAA4BC,6BAAAA;AAAkC,IACvH,aAAa,QAAQ,UAAU,cAAc,qBAAqB,uBAAuB;CACxF,MAAM,WAAW,CAAC,CAAC,aAAa,KAAK;CACrC,MAAM,eAAe,CAAC,CAAC,YAAY;CAEnC,MAAM,WAAW,UAAU;CAG3B,IAAI,CAAC,eAAe,CAAC,uBAAuB,UAAU,EAFnC,gBAAgB,aACX,YAAY,cAElC,OAAO;CAGT,IAAI,uBAAuB,MACzB,OAAO;CAMT,QAAA,GAAA,MAAA,QAAA,CAF8B,CAAC,CAAC,KAAK,oBAAoB,QAElC,IAAI;AAC7B,CACF"}
@@ -9,7 +9,7 @@ import { c as InventoryAttributes, r as DeviceGroup, s as DeviceSliceType, t as
9
9
  import { t as AppSliceType } from "./index-C8QadAm7.cjs";
10
10
  import { t as MonitorSliceType } from "./index-5Q-iI4EB.cjs";
11
11
  import { t as OrganizationSliceType } from "./index-Bj3OArhr.cjs";
12
- import { r as RootState } from "./store-Dd0Y2JCN.cjs";
12
+ import { r as RootState } from "./store-DBUTT4FF.cjs";
13
13
  import { AuditLog } from "@northern.tech/types/types.gen";
14
14
 
15
15
  //#region src/commonSelectors.d.ts
@@ -9,7 +9,7 @@ import { c as InventoryAttributes, r as DeviceGroup, s as DeviceSliceType, t as
9
9
  import { t as AppSliceType } from "./index-BLvjQfGj.js";
10
10
  import { t as MonitorSliceType } from "./index-ByfjrTdH.js";
11
11
  import { t as OrganizationSliceType } from "./index-BBsUj1a8.js";
12
- import { r as RootState } from "./store-Co2ptTSm.js";
12
+ import { r as RootState } from "./store-gkY5P9Uz.js";
13
13
  import { AuditLog } from "@northern.tech/types/types.gen";
14
14
 
15
15
  //#region src/commonSelectors.d.ts
@@ -1 +1 @@
1
- {"version":3,"file":"commonSelectors.js","names":["getDemoDeviceAddressHelper"],"sources":["../src/commonSelectors.ts"],"sourcesContent":["// Copyright 2024 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport type { AuditLog as AuditLogEvent } from '@northern.tech/types/types.gen';\nimport type { DeviceIssueOption } from '@northern.tech/utils/constants';\nimport { attributeDuplicateFilter, getDemoDeviceAddress as getDemoDeviceAddressHelper } from '@northern.tech/utils/helpers';\nimport { createSelector } from '@reduxjs/toolkit';\nimport dayjs from 'dayjs';\n\nimport { ADDONS, PLANS, defaultReports } from './appSlice/constants';\nimport { getFeatures, getSearchedDevices } from './appSlice/selectors';\nimport { DEVICE_LIST_MAXIMUM_LENGTH, UNGROUPED_GROUP } from './commonConstants';\nimport { ALL_DEVICES, ATTRIBUTE_SCOPES, DEVICE_ISSUE_OPTIONS, rolesById, rolesByName, serviceProviderRolesById, uiPermissionsById } from './constants';\nimport type { Role } from './constants';\nimport type { Deployment } from './deploymentsSlice';\nimport { getDeploymentsById, getDeploymentsSelectionState, getSelectedDeploymentDeviceIds } from './deploymentsSlice/selectors';\nimport type { Device, DeviceGroup } from './devicesSlice';\nimport { getDeviceById, getDevicesById, getFilteringAttributes, getGroupsById, getListedDevices } from './devicesSlice/selectors';\nimport { getIssueCountsByType } from './monitorSlice/selectors';\nimport { onboardingSteps } from './onboardingSlice/constants';\nimport { getOnboarding } from './onboardingSlice/selectors';\nimport { getAuditLogEntry, getIsServiceProvider, getOrganization } from './organizationSlice/selectors';\nimport { getReleasesById } from './releasesSlice/selectors';\nimport {\n getCurrentUser,\n getGlobalSettings,\n getHas2FA,\n getRolesById,\n getRolesList,\n getSecurityAlertDismissedTimestamp,\n getUserSettings,\n getUserSettingsInitialized\n} from './usersSlice/selectors';\nimport { listItemMapper, mapUserRolesToUiPermissions } from './utils';\n\nexport const getIsEnterprise = createSelector(\n [getOrganization, getFeatures],\n ({ plan = PLANS.os.id }, { isEnterprise, isHosted }) => isEnterprise || (isHosted && plan === PLANS.enterprise.id)\n);\n\nexport const getUserRoles = createSelector([getCurrentUser, getRolesById, getIsEnterprise], (currentUser, rolesById, isEnterprise) => {\n const isAdmin = currentUser.roles?.length ? currentUser.roles.some(role => role === rolesByName.admin) : !isEnterprise;\n const uiPermissions = isAdmin ? mapUserRolesToUiPermissions([rolesByName.admin], rolesById) : mapUserRolesToUiPermissions(currentUser.roles || [], rolesById);\n return { isAdmin, uiPermissions };\n});\n\nconst hasPermission = (thing: Record<string, string[]>, permission: string): boolean =>\n Object.values(thing).some(permissions => permissions.includes(permission));\n\nexport const getUserCapabilities = createSelector([getUserRoles, getIsServiceProvider], ({ uiPermissions }, isServiceProvider) => {\n const canManageReleases = hasPermission(uiPermissions.releases, uiPermissionsById.manage.value);\n const canReadReleases = canManageReleases || hasPermission(uiPermissions.releases, uiPermissionsById.read.value);\n const canUploadReleases = canManageReleases || hasPermission(uiPermissions.releases, uiPermissionsById.upload.value);\n\n const canAuditlog = uiPermissions.auditlog.includes(uiPermissionsById.read.value);\n\n const canReadUsers = uiPermissions.userManagement.includes(uiPermissionsById.read.value);\n const canManageUsers = uiPermissions.userManagement.includes(uiPermissionsById.manage.value);\n\n const canReadDevices = hasPermission(uiPermissions.groups, uiPermissionsById.read.value);\n const canWriteDevices = Object.values(uiPermissions.groups).some(\n groupPermissions => groupPermissions.includes(uiPermissionsById.read.value) && groupPermissions.length > 1\n );\n const canTroubleshoot = hasPermission(uiPermissions.groups, uiPermissionsById.connect.value);\n const canManageDevices = hasPermission(uiPermissions.groups, uiPermissionsById.manage.value);\n const canConfigure = hasPermission(uiPermissions.groups, uiPermissionsById.configure.value);\n\n const canDeploy =\n (uiPermissions.deployments?.includes(uiPermissionsById.deploy.value) ?? false) || hasPermission(uiPermissions.groups, uiPermissionsById.deploy.value);\n const canReadDeployments = uiPermissions.deployments?.includes(uiPermissionsById.read.value) ?? false;\n\n return {\n canAuditlog,\n canConfigure,\n canDeploy,\n canManageDevices,\n canManageReleases,\n canManageUsers,\n canReadDeployments,\n canReadDevices,\n canReadReleases,\n canReadUsers,\n canTroubleshoot,\n canUploadReleases,\n canWriteDevices,\n groupsPermissions: uiPermissions.groups,\n releasesPermissions: uiPermissions.releases,\n SPTenant: isServiceProvider\n };\n});\n\nexport const getTenantCapabilities = createSelector(\n [getFeatures, getOrganization, getIsEnterprise],\n (\n {\n hasAuditlogs: isAuditlogEnabled,\n hasDeviceConfig: isDeviceConfigEnabled,\n hasDeviceConnect: isDeviceConnectEnabled,\n hasMonitor: isMonitorEnabled,\n isHosted\n },\n { addons = [], plan = PLANS.os.id },\n isEnterprise\n ) => {\n const canDelta = isEnterprise || plan === PLANS.professional.id;\n const hasAuditlogs = isAuditlogEnabled && isEnterprise;\n const hasDeviceConfig = addons.some(addon => addon.name === ADDONS.configure.id && addon.enabled) || (isDeviceConfigEnabled && !isHosted);\n const hasDeviceConnect = addons.some(addon => addon.name === ADDONS.troubleshoot.id && addon.enabled) || (isDeviceConnectEnabled && !isHosted);\n const hasMonitor = isMonitorEnabled && addons.some(addon => addon.name === ADDONS.monitor.id && addon.enabled);\n return {\n canDelta,\n canRetry: canDelta,\n canSchedule: canDelta,\n hasAuditlogs,\n hasDeviceConfig,\n hasDeviceConnect,\n hasFullFiltering: canDelta,\n hasMonitor,\n isEnterprise,\n plan\n };\n }\n);\n\nexport const getFilterAttributes = createSelector(\n [getGlobalSettings, getFilteringAttributes],\n ({ previousFilters }, { identityAttributes, inventoryAttributes, systemAttributes, tagAttributes }) => {\n const deviceNameAttribute = { key: 'name', value: 'Name', scope: ATTRIBUTE_SCOPES.tags, category: ATTRIBUTE_SCOPES.tags, priority: 1 };\n const deviceIdAttribute = { key: 'id', value: 'Device ID', scope: ATTRIBUTE_SCOPES.identity, category: ATTRIBUTE_SCOPES.identity, priority: 1 };\n const checkInAttribute = { key: 'check_in_time', value: 'Latest activity', scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };\n const updateAttribute = { ...checkInAttribute, key: 'updated_ts', value: 'Last inventory update' };\n const firstRequestAttribute = { key: 'created_ts', value: 'First request', scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };\n const attributes = [\n ...previousFilters.map(item => ({\n ...item,\n value: deviceIdAttribute.key === item.key ? deviceIdAttribute.value : item.key,\n category: 'recently used',\n priority: 0\n })),\n deviceNameAttribute,\n deviceIdAttribute,\n ...identityAttributes.map(item => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.identity, category: ATTRIBUTE_SCOPES.identity, priority: 1 })),\n ...inventoryAttributes.map(item => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.inventory, category: ATTRIBUTE_SCOPES.inventory, priority: 2 })),\n ...tagAttributes.map(item => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.tags, category: ATTRIBUTE_SCOPES.tags, priority: 3 })),\n checkInAttribute,\n updateAttribute,\n firstRequestAttribute,\n ...systemAttributes.map(item => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 }))\n ];\n return attributeDuplicateFilter(attributes, 'key');\n }\n);\n\nexport const getOnboardingState = createSelector([getOnboarding, getUserSettings], ({ complete, progress, showTips, ...remainder }, { onboarding = {} }) => ({\n ...remainder,\n ...onboarding,\n complete: onboarding.complete || complete,\n progress:\n Object.keys(onboardingSteps).findIndex(step => step === progress) > Object.keys(onboardingSteps).findIndex(step => step === onboarding.progress)\n ? progress\n : onboarding.progress,\n showTips: !onboarding.showTips ? onboarding.showTips : showTips\n}));\n\nexport const getDemoDeviceAddress = createSelector([getDevicesById, getOnboarding], (devicesById, { approach, demoArtifactPort }) => {\n const demoDeviceAddress = `http://${getDemoDeviceAddressHelper(Object.values(devicesById), approach)}`;\n return demoArtifactPort ? `${demoDeviceAddress}:${demoArtifactPort}` : demoDeviceAddress;\n});\n\nexport const getDeviceConfigDeployment = createSelector([getDeviceById, getDeploymentsById], (device, deploymentsById) => {\n const { config = {} } = device;\n const { deployment_id: configDeploymentId = '' } = config;\n const deviceConfigDeployment = deploymentsById[configDeploymentId] ?? {};\n return { device, deviceConfigDeployment };\n});\n\nexport const getDeploymentRelease = createSelector(\n [getDeploymentsById, getDeploymentsSelectionState, getReleasesById],\n (deploymentsById, { selectedId = '' }, releasesById) => {\n const deployment = deploymentsById[selectedId] ?? {};\n return deployment?.artifact_name && releasesById[deployment.artifact_name] ? releasesById[deployment.artifact_name] : { device_types_compatible: [] };\n }\n);\n\nexport const getSelectedDeploymentData = createSelector(\n [getDeploymentsById, getDeploymentsSelectionState, getDevicesById, getSelectedDeploymentDeviceIds],\n (deploymentsById, { selectedId = '' }, devicesById, selectedDeviceIds) => {\n const deployment = deploymentsById[selectedId] ?? {};\n const { devices = {} } = deployment as Deployment;\n return {\n deployment,\n selectedDevices: selectedDeviceIds.map(deviceId => ({ ...devicesById[deviceId], ...(devices[deviceId] ?? {}) }))\n };\n }\n);\n\nexport const getAvailableIssueOptionsByType = createSelector([getTenantCapabilities, getIssueCountsByType], ({ hasFullFiltering, hasMonitor }, issueCounts) =>\n Object.values<DeviceIssueOption>(DEVICE_ISSUE_OPTIONS).reduce(\n (accu, { isCategory, key, needsFullFiltering, needsMonitor, title }) => {\n if (isCategory || (needsFullFiltering && !hasFullFiltering) || (needsMonitor && !hasMonitor)) {\n return accu;\n }\n accu[key] = { count: issueCounts[key].filtered, key, title };\n return accu;\n },\n {} as Record<string, { count: number; key: string; title: string }>\n )\n);\n\nexport const getGroupNames = createSelector([getGroupsById, getUserRoles], (groupsById, { uiPermissions }) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [UNGROUPED_GROUP.id]: ungrouped, ...groups } = groupsById;\n return Object.keys(\n Object.entries(groups).reduce(\n (accu, [groupName, group]) => {\n if (group.filters || uiPermissions.groups[ALL_DEVICES]) {\n accu[groupName] = group;\n }\n return accu;\n },\n { ...uiPermissions.groups } as Record<string, DeviceGroup>\n )\n ).sort();\n});\n\nexport const getDeviceReportsForUser = createSelector(\n [getUserSettings, getCurrentUser, getGlobalSettings, getDevicesById],\n ({ reports }, { id: currentUserId }, globalSettings, devicesById) =>\n reports || globalSettings[`${currentUserId}-reports`] || (Object.keys(devicesById).length ? defaultReports : [])\n);\n\nconst listTypeDeviceIdMap = {\n deviceList: getListedDevices,\n search: getSearchedDevices\n};\nconst deviceMapDefault = { defaultObject: { auth_sets: [] }, cutOffSize: DEVICE_LIST_MAXIMUM_LENGTH };\nconst getDeviceMappingDefaults = () => deviceMapDefault;\n\nexport const getMappedDevicesList = createSelector(\n [getDevicesById, (state, listType) => listTypeDeviceIdMap[listType](state), getDeviceMappingDefaults],\n listItemMapper\n);\n\nexport const getAuditlogDevice = createSelector([getAuditLogEntry, getDevicesById], (auditlogEvent, devicesById) => {\n let auditlogDevice: Partial<Device> = {};\n if (auditlogEvent) {\n const { object } = auditlogEvent as AuditLogEvent;\n const objectData = object as AuditLogEvent['object'] | undefined;\n if (objectData?.type === 'device' && objectData.id) {\n auditlogDevice = { id: objectData.id, ...(objectData.device ?? {}) } as Device;\n }\n }\n return { ...auditlogDevice, ...(auditlogDevice.id ? devicesById[auditlogDevice.id] : {}) };\n});\n\ntype RoleItem = Role | { value: string };\nexport const getRelevantRoles = createSelector([getOrganization, getRolesList], ({ service_provider }, roles) => {\n if (service_provider) {\n return roles.reduce(\n (accu, role) => {\n if (rolesById[role.value as keyof typeof rolesById]) {\n return accu;\n }\n accu.push(role);\n return accu;\n },\n [...Object.values(serviceProviderRolesById)] as RoleItem[]\n );\n }\n return Object.keys(rolesById)\n .reverse()\n .reduce((accu, key) => {\n const index = accu.findIndex(({ value }) => value === key);\n if (index >= 0) {\n accu = [accu[index], ...accu.filter((_, itemIndex) => index !== itemIndex)];\n }\n return accu;\n }, roles);\n});\n\nexport const getShowSecurityAlert = createSelector(\n [getCurrentUser, getHas2FA, getFeatures, getIsEnterprise, getUserSettingsInitialized, getSecurityAlertDismissedTimestamp],\n (currentUser, has2FA, features, isEnterprise, settingsInitialized, dismissedTimestamp) => {\n const isOAuth2 = !!currentUser?.sso?.length;\n const userVerified = !!currentUser.verified;\n\n const isHosted = features?.isHosted;\n const canHave2FA = isEnterprise || isHosted;\n const secureOAuthUser = isOAuth2 && userVerified;\n if (!currentUser || !settingsInitialized || has2FA || !canHave2FA || secureOAuthUser) {\n return false;\n }\n\n if (dismissedTimestamp === null) {\n return true;\n }\n\n const today = dayjs();\n const dismissedMonthAgo = today.diff(dismissedTimestamp, 'months');\n\n return dismissedMonthAgo > 0;\n }\n);\n"],"mappings":";;;;;;;;;;;;;;;;AA6CA,MAAa,kBAAkB,eAC7B,CAAC,iBAAiB,WAAW,IAC5B,EAAE,OAAO,MAAM,GAAG,MAAM,EAAE,cAAc,eAAe,gBAAiB,YAAY,SAAS,MAAM,WAAW,EACjH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,eAAe,MAAM,CAAC;CAAG;AAC3F,CAAC;AAGD,MAAa,mBAAmB,eAAe,CAAC,iBAAiB,YAAY,IAAI,EAAE,oBAAoB,UAAU;CAC/G,IAAI,kBACF,OAAO,MAAM,QACV,MAAM,SAAS;EACd,IAAI,UAAU,KAAK,QACjB,OAAO;EAET,KAAK,KAAK,IAAI;EACd,OAAO;CACT,GACA,CAAC,GAAG,OAAO,OAAO,wBAAwB,CAAC,CAC7C;CAEF,OAAO,OAAO,KAAK,SAAS,EACzB,QAAQ,EACR,QAAQ,MAAM,QAAQ;EACrB,MAAM,QAAQ,KAAK,WAAW,EAAE,YAAY,UAAU,GAAG;EACzD,IAAI,SAAS,GACX,OAAO,CAAC,KAAK,QAAQ,GAAG,KAAK,QAAQ,GAAG,cAAc,UAAU,SAAS,CAAC;EAE5E,OAAO;CACT,GAAG,KAAK;AACZ,CAAC;AAED,MAAa,uBAAuB,eAClC;CAAC;CAAgB;CAAW;CAAa;CAAiB;CAA4B;AAAkC,IACvH,aAAa,QAAQ,UAAU,cAAc,qBAAqB,uBAAuB;CACxF,MAAM,WAAW,CAAC,CAAC,aAAa,KAAK;CACrC,MAAM,eAAe,CAAC,CAAC,YAAY;CAEnC,MAAM,WAAW,UAAU;CAG3B,IAAI,CAAC,eAAe,CAAC,uBAAuB,UAAU,EAFnC,gBAAgB,aACX,YAAY,cAElC,OAAO;CAGT,IAAI,uBAAuB,MACzB,OAAO;CAMT,OAHc,MACgB,EAAE,KAAK,oBAAoB,QAElC,IAAI;AAC7B,CACF"}
1
+ {"version":3,"file":"commonSelectors.js","names":["getDemoDeviceAddressHelper"],"sources":["../src/commonSelectors.ts"],"sourcesContent":["// Copyright 2024 Northern.tech AS\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport type { AuditLog as AuditLogEvent } from '@northern.tech/types/types.gen';\nimport type { DeviceIssueOption } from '@northern.tech/utils/constants';\nimport { attributeDuplicateFilter, getDemoDeviceAddress as getDemoDeviceAddressHelper } from '@northern.tech/utils/helpers';\nimport { createSelector } from '@reduxjs/toolkit';\nimport dayjs from 'dayjs';\n\nimport { ADDONS, PLANS, defaultReports } from './appSlice/constants';\nimport { getFeatures, getSearchedDevices } from './appSlice/selectors';\nimport { DEVICE_LIST_MAXIMUM_LENGTH, UNGROUPED_GROUP } from './commonConstants';\nimport { ALL_DEVICES, ATTRIBUTE_SCOPES, DEVICE_ISSUE_OPTIONS, rolesById, rolesByName, serviceProviderRolesById, uiPermissionsById } from './constants';\nimport type { Role } from './constants';\nimport type { Deployment } from './deploymentsSlice';\nimport { getDeploymentsById, getDeploymentsSelectionState, getSelectedDeploymentDeviceIds } from './deploymentsSlice/selectors';\nimport type { Device, DeviceGroup } from './devicesSlice';\nimport { getDeviceById, getDevicesById, getFilteringAttributes, getGroupsById, getListedDevices } from './devicesSlice/selectors';\nimport { getIssueCountsByType } from './monitorSlice/selectors';\nimport { onboardingSteps } from './onboardingSlice/constants';\nimport { getOnboarding } from './onboardingSlice/selectors';\nimport { getAuditLogEntry, getIsServiceProvider, getOrganization } from './organizationSlice/selectors';\nimport { getReleasesById } from './releasesSlice/selectors';\nimport {\n getCurrentUser,\n getGlobalSettings,\n getHas2FA,\n getRolesById,\n getRolesList,\n getSecurityAlertDismissedTimestamp,\n getUserSettings,\n getUserSettingsInitialized\n} from './usersSlice/selectors';\nimport { listItemMapper, mapUserRolesToUiPermissions } from './utils';\n\nexport const getIsEnterprise = createSelector(\n [getOrganization, getFeatures],\n ({ plan = PLANS.os.id }, { isEnterprise, isHosted }) => isEnterprise || (isHosted && plan === PLANS.enterprise.id)\n);\n\nexport const getUserRoles = createSelector([getCurrentUser, getRolesById, getIsEnterprise], (currentUser, rolesById, isEnterprise) => {\n const isAdmin = currentUser.roles?.length ? currentUser.roles.some(role => role === rolesByName.admin) : !isEnterprise;\n const uiPermissions = isAdmin ? mapUserRolesToUiPermissions([rolesByName.admin], rolesById) : mapUserRolesToUiPermissions(currentUser.roles || [], rolesById);\n return { isAdmin, uiPermissions };\n});\n\nconst hasPermission = (thing: Record<string, string[]>, permission: string): boolean =>\n Object.values(thing).some(permissions => permissions.includes(permission));\n\nexport const getUserCapabilities = createSelector([getUserRoles, getIsServiceProvider], ({ uiPermissions }, isServiceProvider) => {\n const canManageReleases = hasPermission(uiPermissions.releases, uiPermissionsById.manage.value);\n const canReadReleases = canManageReleases || hasPermission(uiPermissions.releases, uiPermissionsById.read.value);\n const canUploadReleases = canManageReleases || hasPermission(uiPermissions.releases, uiPermissionsById.upload.value);\n\n const canAuditlog = uiPermissions.auditlog.includes(uiPermissionsById.read.value);\n\n const canReadUsers = uiPermissions.userManagement.includes(uiPermissionsById.read.value);\n const canManageUsers = uiPermissions.userManagement.includes(uiPermissionsById.manage.value);\n\n const canReadDevices = hasPermission(uiPermissions.groups, uiPermissionsById.read.value);\n const canWriteDevices = Object.values(uiPermissions.groups).some(\n groupPermissions => groupPermissions.includes(uiPermissionsById.read.value) && groupPermissions.length > 1\n );\n const canTroubleshoot = hasPermission(uiPermissions.groups, uiPermissionsById.connect.value);\n const canManageDevices = hasPermission(uiPermissions.groups, uiPermissionsById.manage.value);\n const canConfigure = hasPermission(uiPermissions.groups, uiPermissionsById.configure.value);\n\n const canDeploy =\n (uiPermissions.deployments?.includes(uiPermissionsById.deploy.value) ?? false) || hasPermission(uiPermissions.groups, uiPermissionsById.deploy.value);\n const canReadDeployments = uiPermissions.deployments?.includes(uiPermissionsById.read.value) ?? false;\n\n return {\n canAuditlog,\n canConfigure,\n canDeploy,\n canManageDevices,\n canManageReleases,\n canManageUsers,\n canReadDeployments,\n canReadDevices,\n canReadReleases,\n canReadUsers,\n canTroubleshoot,\n canUploadReleases,\n canWriteDevices,\n groupsPermissions: uiPermissions.groups,\n releasesPermissions: uiPermissions.releases,\n SPTenant: isServiceProvider\n };\n});\n\nexport const getTenantCapabilities = createSelector(\n [getFeatures, getOrganization, getIsEnterprise],\n (\n {\n hasAuditlogs: isAuditlogEnabled,\n hasDeviceConfig: isDeviceConfigEnabled,\n hasDeviceConnect: isDeviceConnectEnabled,\n hasMonitor: isMonitorEnabled,\n isHosted\n },\n { addons = [], plan = PLANS.os.id },\n isEnterprise\n ) => {\n const canDelta = isEnterprise || plan === PLANS.professional.id;\n const hasAuditlogs = isAuditlogEnabled && isEnterprise;\n const hasDeviceConfig = addons.some(addon => addon.name === ADDONS.configure.id && addon.enabled) || (isDeviceConfigEnabled && !isHosted);\n const hasDeviceConnect = addons.some(addon => addon.name === ADDONS.troubleshoot.id && addon.enabled) || (isDeviceConnectEnabled && !isHosted);\n const hasMonitor = isMonitorEnabled && addons.some(addon => addon.name === ADDONS.monitor.id && addon.enabled);\n return {\n canDelta,\n canRetry: canDelta,\n canSchedule: canDelta,\n hasAuditlogs,\n hasDeviceConfig,\n hasDeviceConnect,\n hasFullFiltering: canDelta,\n hasMonitor,\n isEnterprise,\n plan\n };\n }\n);\n\nexport const getFilterAttributes = createSelector(\n [getGlobalSettings, getFilteringAttributes],\n ({ previousFilters }, { identityAttributes, inventoryAttributes, systemAttributes, tagAttributes }) => {\n const deviceNameAttribute = { key: 'name', value: 'Name', scope: ATTRIBUTE_SCOPES.tags, category: ATTRIBUTE_SCOPES.tags, priority: 1 };\n const deviceIdAttribute = { key: 'id', value: 'Device ID', scope: ATTRIBUTE_SCOPES.identity, category: ATTRIBUTE_SCOPES.identity, priority: 1 };\n const checkInAttribute = { key: 'check_in_time', value: 'Latest activity', scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };\n const updateAttribute = { ...checkInAttribute, key: 'updated_ts', value: 'Last inventory update' };\n const firstRequestAttribute = { key: 'created_ts', value: 'First request', scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 };\n const attributes = [\n ...previousFilters.map(item => ({\n ...item,\n value: deviceIdAttribute.key === item.key ? deviceIdAttribute.value : item.key,\n category: 'recently used',\n priority: 0\n })),\n deviceNameAttribute,\n deviceIdAttribute,\n ...identityAttributes.map(item => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.identity, category: ATTRIBUTE_SCOPES.identity, priority: 1 })),\n ...inventoryAttributes.map(item => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.inventory, category: ATTRIBUTE_SCOPES.inventory, priority: 2 })),\n ...tagAttributes.map(item => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.tags, category: ATTRIBUTE_SCOPES.tags, priority: 3 })),\n checkInAttribute,\n updateAttribute,\n firstRequestAttribute,\n ...systemAttributes.map(item => ({ key: item, value: item, scope: ATTRIBUTE_SCOPES.system, category: ATTRIBUTE_SCOPES.system, priority: 4 }))\n ];\n return attributeDuplicateFilter(attributes, 'key');\n }\n);\n\nexport const getOnboardingState = createSelector([getOnboarding, getUserSettings], ({ complete, progress, showTips, ...remainder }, { onboarding = {} }) => ({\n ...remainder,\n ...onboarding,\n complete: onboarding.complete || complete,\n progress:\n Object.keys(onboardingSteps).findIndex(step => step === progress) > Object.keys(onboardingSteps).findIndex(step => step === onboarding.progress)\n ? progress\n : onboarding.progress,\n showTips: !onboarding.showTips ? onboarding.showTips : showTips\n}));\n\nexport const getDemoDeviceAddress = createSelector([getDevicesById, getOnboarding], (devicesById, { approach, demoArtifactPort }) => {\n const demoDeviceAddress = `http://${getDemoDeviceAddressHelper(Object.values(devicesById), approach)}`;\n return demoArtifactPort ? `${demoDeviceAddress}:${demoArtifactPort}` : demoDeviceAddress;\n});\n\nexport const getDeviceConfigDeployment = createSelector([getDeviceById, getDeploymentsById], (device, deploymentsById) => {\n const { config = {} } = device;\n const { deployment_id: configDeploymentId = '' } = config;\n const deviceConfigDeployment = deploymentsById[configDeploymentId] ?? {};\n return { device, deviceConfigDeployment };\n});\n\nexport const getDeploymentRelease = createSelector(\n [getDeploymentsById, getDeploymentsSelectionState, getReleasesById],\n (deploymentsById, { selectedId = '' }, releasesById) => {\n const deployment = deploymentsById[selectedId] ?? {};\n return deployment?.artifact_name && releasesById[deployment.artifact_name] ? releasesById[deployment.artifact_name] : { device_types_compatible: [] };\n }\n);\n\nexport const getSelectedDeploymentData = createSelector(\n [getDeploymentsById, getDeploymentsSelectionState, getDevicesById, getSelectedDeploymentDeviceIds],\n (deploymentsById, { selectedId = '' }, devicesById, selectedDeviceIds) => {\n const deployment = deploymentsById[selectedId] ?? {};\n const { devices = {} } = deployment as Deployment;\n return {\n deployment,\n selectedDevices: selectedDeviceIds.map(deviceId => ({ ...devicesById[deviceId], ...(devices[deviceId] ?? {}) }))\n };\n }\n);\n\nexport const getAvailableIssueOptionsByType = createSelector([getTenantCapabilities, getIssueCountsByType], ({ hasFullFiltering, hasMonitor }, issueCounts) =>\n Object.values<DeviceIssueOption>(DEVICE_ISSUE_OPTIONS).reduce(\n (accu, { isCategory, key, needsFullFiltering, needsMonitor, title }) => {\n if (isCategory || (needsFullFiltering && !hasFullFiltering) || (needsMonitor && !hasMonitor)) {\n return accu;\n }\n accu[key] = { count: issueCounts[key].filtered, key, title };\n return accu;\n },\n {} as Record<string, { count: number; key: string; title: string }>\n )\n);\n\nexport const getGroupNames = createSelector([getGroupsById, getUserRoles], (groupsById, { uiPermissions }) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { [UNGROUPED_GROUP.id]: ungrouped, ...groups } = groupsById;\n return Object.keys(\n Object.entries(groups).reduce(\n (accu, [groupName, group]) => {\n if (group.filters || uiPermissions.groups[ALL_DEVICES]) {\n accu[groupName] = group;\n }\n return accu;\n },\n { ...uiPermissions.groups } as Record<string, DeviceGroup>\n )\n ).sort();\n});\n\nexport const getDeviceReportsForUser = createSelector(\n [getUserSettings, getCurrentUser, getGlobalSettings, getDevicesById],\n ({ reports }, { id: currentUserId }, globalSettings, devicesById) =>\n reports || globalSettings[`${currentUserId}-reports`] || (Object.keys(devicesById).length ? defaultReports : [])\n);\n\nconst listTypeDeviceIdMap = {\n deviceList: getListedDevices,\n search: getSearchedDevices\n};\nconst deviceMapDefault = { defaultObject: { auth_sets: [] }, cutOffSize: DEVICE_LIST_MAXIMUM_LENGTH };\nconst getDeviceMappingDefaults = () => deviceMapDefault;\n\nexport const getMappedDevicesList = createSelector(\n [getDevicesById, (state, listType) => listTypeDeviceIdMap[listType](state), getDeviceMappingDefaults],\n listItemMapper\n);\n\nexport const getAuditlogDevice = createSelector([getAuditLogEntry, getDevicesById], (auditlogEvent, devicesById) => {\n let auditlogDevice: Partial<Device> = {};\n if (auditlogEvent) {\n const { object } = auditlogEvent as AuditLogEvent;\n const objectData = object as AuditLogEvent['object'] | undefined;\n if (objectData?.type === 'device' && objectData.id) {\n auditlogDevice = { id: objectData.id, ...(objectData.device ?? {}) } as Device;\n }\n }\n return { ...auditlogDevice, ...(auditlogDevice.id ? devicesById[auditlogDevice.id] : {}) };\n});\n\ntype RoleItem = Role | { value: string };\nexport const getRelevantRoles = createSelector([getOrganization, getRolesList], ({ service_provider }, roles) => {\n if (service_provider) {\n return roles.reduce(\n (accu, role) => {\n if (rolesById[role.value as keyof typeof rolesById]) {\n return accu;\n }\n accu.push(role);\n return accu;\n },\n [...Object.values(serviceProviderRolesById)] as RoleItem[]\n );\n }\n return Object.keys(rolesById)\n .reverse()\n .reduce((accu, key) => {\n const index = accu.findIndex(({ value }) => value === key);\n if (index >= 0) {\n accu = [accu[index], ...accu.filter((_, itemIndex) => index !== itemIndex)];\n }\n return accu;\n }, roles);\n});\n\nexport const getShowSecurityAlert = createSelector(\n [getCurrentUser, getHas2FA, getFeatures, getIsEnterprise, getUserSettingsInitialized, getSecurityAlertDismissedTimestamp],\n (currentUser, has2FA, features, isEnterprise, settingsInitialized, dismissedTimestamp) => {\n const isOAuth2 = !!currentUser?.sso?.length;\n const userVerified = !!currentUser.verified;\n\n const isHosted = features?.isHosted;\n const canHave2FA = isEnterprise || isHosted;\n const secureOAuthUser = isOAuth2 && userVerified;\n if (!currentUser || !settingsInitialized || has2FA || !canHave2FA || secureOAuthUser) {\n return false;\n }\n\n if (dismissedTimestamp === null) {\n return true;\n }\n\n const today = dayjs();\n const dismissedMonthAgo = today.diff(dismissedTimestamp, 'months');\n\n return dismissedMonthAgo > 0;\n }\n);\n"],"mappings":";;;;;;;;;;;;;;;;AA6CA,MAAa,kBAAkB,eAC7B,CAAC,iBAAiB,WAAW,IAC5B,EAAE,OAAO,MAAM,GAAG,MAAM,EAAE,cAAc,eAAe,gBAAiB,YAAY,SAAS,MAAM,WAAW,EACjH;AAEA,MAAa,eAAe,eAAe;CAAC;CAAgB;CAAc;AAAe,IAAI,aAAa,WAAW,iBAAiB;CACpI,MAAM,UAAU,YAAY,OAAO,SAAS,YAAY,MAAM,MAAK,SAAQ,SAAS,YAAY,KAAK,IAAI,CAAC;CAE1G,OAAO;EAAE;EAAS,eADI,UAAU,4BAA4B,CAAC,YAAY,KAAK,GAAG,SAAS,IAAI,4BAA4B,YAAY,SAAS,CAAC,GAAG,SAAS;CAC5H;AAClC,CAAC;AAED,MAAM,iBAAiB,OAAiC,eACtD,OAAO,OAAO,KAAK,CAAC,CAAC,MAAK,gBAAe,YAAY,SAAS,UAAU,CAAC;AAE3E,MAAa,sBAAsB,eAAe,CAAC,cAAc,oBAAoB,IAAI,EAAE,iBAAiB,sBAAsB;CAChI,MAAM,oBAAoB,cAAc,cAAc,UAAU,kBAAkB,OAAO,KAAK;CAC9F,MAAM,kBAAkB,qBAAqB,cAAc,cAAc,UAAU,kBAAkB,KAAK,KAAK;CAC/G,MAAM,oBAAoB,qBAAqB,cAAc,cAAc,UAAU,kBAAkB,OAAO,KAAK;CAEnH,MAAM,cAAc,cAAc,SAAS,SAAS,kBAAkB,KAAK,KAAK;CAEhF,MAAM,eAAe,cAAc,eAAe,SAAS,kBAAkB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