@gen-epix/ui-client-common 4.4.2 → 4.5.1

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 (190) hide show
  1. package/README.md +7 -6
  2. package/dist/@types/mui.d.ts +13 -5
  3. package/dist/@types/ui-client-common.d.ts +1 -0
  4. package/dist/_chunks/ApplicationFooter.js +44 -44
  5. package/dist/_chunks/ApplicationFooter.js.map +1 -1
  6. package/dist/_chunks/Breadcrumbs.js +13 -13
  7. package/dist/_chunks/Breadcrumbs.js.map +1 -1
  8. package/dist/_chunks/CrudPage.js +300 -300
  9. package/dist/_chunks/CrudPage.js.map +1 -1
  10. package/dist/_chunks/Notifications.js +51 -51
  11. package/dist/_chunks/Notifications.js.map +1 -1
  12. package/dist/_chunks/OutageList.js +29 -29
  13. package/dist/_chunks/OutageUtil.js +1 -2
  14. package/dist/_chunks/OutageUtil.js.map +1 -1
  15. package/dist/_chunks/QueryClientService.js +96 -388
  16. package/dist/_chunks/QueryClientService.js.map +1 -1
  17. package/dist/_chunks/Table.js +518 -512
  18. package/dist/_chunks/Table.js.map +1 -1
  19. package/dist/_chunks/TableUtil.js +8 -16
  20. package/dist/_chunks/TableUtil.js.map +1 -1
  21. package/dist/_chunks/TextFilter.js +14 -12
  22. package/dist/_chunks/TextFilter.js.map +1 -1
  23. package/dist/_chunks/UserInvitationsAdminPage.js +77 -77
  24. package/dist/_chunks/UserInvitationsAdminPage.js.map +1 -1
  25. package/dist/_chunks/UserManagerUtil.js +210 -209
  26. package/dist/_chunks/UserManagerUtil.js.map +1 -1
  27. package/dist/_chunks/_baseFlatten.js +8 -8
  28. package/dist/_chunks/_baseFlatten.js.map +1 -1
  29. package/dist/_chunks/_baseGet.js +280 -0
  30. package/dist/_chunks/_baseGet.js.map +1 -0
  31. package/dist/_chunks/_baseIteratee.js +274 -0
  32. package/dist/_chunks/_baseIteratee.js.map +1 -0
  33. package/dist/_chunks/_baseUnset.js +22 -299
  34. package/dist/_chunks/_baseUnset.js.map +1 -1
  35. package/dist/_chunks/last.js +13 -0
  36. package/dist/_chunks/last.js.map +1 -0
  37. package/dist/_chunks/omit.js +41 -40
  38. package/dist/_chunks/omit.js.map +1 -1
  39. package/dist/_chunks/tableStore.js +190 -183
  40. package/dist/_chunks/tableStore.js.map +1 -1
  41. package/dist/_chunks/uniq.js +44 -0
  42. package/dist/_chunks/uniq.js.map +1 -0
  43. package/dist/_chunks/useMutation.js +22 -22
  44. package/dist/_chunks/useMutation.js.map +1 -1
  45. package/dist/_chunks/useQueryMemo.js +25 -8
  46. package/dist/_chunks/useQueryMemo.js.map +1 -1
  47. package/dist/classes/abstracts/FilterAbstract/index.js +3 -1
  48. package/dist/classes/abstracts/FilterAbstract/index.js.map +1 -1
  49. package/dist/classes/filters/MultiSelectFilter.d.ts +1 -1
  50. package/dist/classes/services/AuthenticationService/AuthenticationService.d.ts +1 -1
  51. package/dist/classes/services/AuthenticationService/index.js +15 -15
  52. package/dist/classes/services/AuthenticationService/index.js.map +1 -1
  53. package/dist/classes/services/AuthorizationService/index.js +4 -4
  54. package/dist/classes/services/AuthorizationService/index.js.map +1 -1
  55. package/dist/classes/services/BackendVersionService/index.js +3 -2
  56. package/dist/classes/services/BackendVersionService/index.js.map +1 -1
  57. package/dist/classes/services/BreadcrumbService/index.js +16 -38
  58. package/dist/classes/services/BreadcrumbService/index.js.map +1 -1
  59. package/dist/classes/services/EmotionCacheService/index.js +9 -8
  60. package/dist/classes/services/EmotionCacheService/index.js.map +1 -1
  61. package/dist/classes/services/I18nService/index.js +11 -10
  62. package/dist/classes/services/I18nService/index.js.map +1 -1
  63. package/dist/classes/services/InactivityService/index.js +12 -12
  64. package/dist/classes/services/InactivityService/index.js.map +1 -1
  65. package/dist/classes/services/LogService/index.js +39 -33
  66. package/dist/classes/services/LogService/index.js.map +1 -1
  67. package/dist/classes/services/NotificationService/index.js +8 -8
  68. package/dist/classes/services/NotificationService/index.js.map +1 -1
  69. package/dist/classes/services/PageEventBusService/index.js +13 -9
  70. package/dist/classes/services/PageEventBusService/index.js.map +1 -1
  71. package/dist/classes/services/RouterService/index.js +3 -6
  72. package/dist/classes/services/RouterService/index.js.map +1 -1
  73. package/dist/components/app/App/App.d.ts +1 -1
  74. package/dist/components/app/App/index.js +34 -38
  75. package/dist/components/app/App/index.js.map +1 -1
  76. package/dist/components/app/ApplicationBootstrapWithAuthentication/index.js +28 -28
  77. package/dist/components/app/ApplicationBootstrapWithAuthentication/index.js.map +1 -1
  78. package/dist/components/app/ApplicationBootstrapWithoutAuthorization/index.js +47 -45
  79. package/dist/components/app/ApplicationBootstrapWithoutAuthorization/index.js.map +1 -1
  80. package/dist/components/app/AuthenticationWrapper/index.js +35 -35
  81. package/dist/components/app/AuthenticationWrapper/index.js.map +1 -1
  82. package/dist/components/app/AuthorizationWrapper/index.js +19 -19
  83. package/dist/components/app/AuthorizationWrapper/index.js.map +1 -1
  84. package/dist/components/app/RouterRoot/index.js +52 -50
  85. package/dist/components/app/RouterRoot/index.js.map +1 -1
  86. package/dist/components/epi/EpiContactDetailsDialog/index.js +21 -21
  87. package/dist/components/epi/EpiContactDetailsDialog/index.js.map +1 -1
  88. package/dist/components/filters/BooleanFilterField/index.js +5 -5
  89. package/dist/components/filters/DateFilterField/index.js +3 -3
  90. package/dist/components/filters/GeoFilterField/index.js +4 -4
  91. package/dist/components/filters/MultiSelectFilterField/index.js +4 -4
  92. package/dist/components/filters/NumberRangeFilterField/index.js +3 -3
  93. package/dist/components/filters/TextFilterField/index.js +3 -3
  94. package/dist/components/ui/ApplicationBar/index.js +188 -188
  95. package/dist/components/ui/ApplicationBar/index.js.map +1 -1
  96. package/dist/components/ui/GenericErrorMessage/index.js +29 -29
  97. package/dist/components/ui/GenericErrorMessage/index.js.map +1 -1
  98. package/dist/components/ui/LicensesDialog/index.js +38 -38
  99. package/dist/components/ui/LicensesDialog/index.js.map +1 -1
  100. package/dist/components/ui/MyPermissionsDialog/index.js +16 -16
  101. package/dist/components/ui/MyPermissionsDialog/index.js.map +1 -1
  102. package/dist/components/ui/NavLink/index.js +6 -6
  103. package/dist/components/ui/OrganizationSwitcherDialog/index.js +21 -21
  104. package/dist/components/ui/OrganizationSwitcherDialog/index.js.map +1 -1
  105. package/dist/components/ui/PageContainer/index.js +24 -24
  106. package/dist/components/ui/PageContainer/index.js.map +1 -1
  107. package/dist/components/ui/Sidebar/index.js +30 -30
  108. package/dist/components/ui/UserFeedbackDialog/index.js +12 -12
  109. package/dist/components/ui/UserFeedbackDialog/index.js.map +1 -1
  110. package/dist/components/ui/UserInactivityConfirmation/index.js.map +1 -1
  111. package/dist/constants/config.constants.d.ts +0 -2
  112. package/dist/constants/config.constants.js +2 -2
  113. package/dist/constants/config.constants.js.map +1 -1
  114. package/dist/dataHooks/useIdentifierIssuerOwnOrganizationQuery/index.js +12 -12
  115. package/dist/dataHooks/useIdentifierIssuerOwnOrganizationQuery/index.js.map +1 -1
  116. package/dist/dataHooks/useIdentifierIssuerQuery/index.js +14 -14
  117. package/dist/dataHooks/useIdentifierIssuerQuery/index.js.map +1 -1
  118. package/dist/dataHooks/useInviteUserConstraintsQuery/index.js +12 -12
  119. package/dist/dataHooks/useInviteUserConstraintsQuery/index.js.map +1 -1
  120. package/dist/dataHooks/useOrganizationAdminPoliciesQuery/index.js +13 -13
  121. package/dist/dataHooks/useOrganizationAdminPoliciesQuery/index.js.map +1 -1
  122. package/dist/dataHooks/useOrganizationIdentifierIssuerLinksQuery/index.js +4 -4
  123. package/dist/dataHooks/useOrganizationIdentifierIssuerLinksQuery/index.js.map +1 -1
  124. package/dist/dataHooks/useOrganizationsQuery/index.js +13 -13
  125. package/dist/dataHooks/useOrganizationsQuery/index.js.map +1 -1
  126. package/dist/dataHooks/useUsersQuery/index.js +10 -10
  127. package/dist/dataHooks/useUsersQuery/index.js.map +1 -1
  128. package/dist/hoc/withPermissions/index.js.map +1 -1
  129. package/dist/hooks/useConfig/index.js +2 -2
  130. package/dist/hooks/useConfig/index.js.map +1 -1
  131. package/dist/hooks/useCreateMutation/index.js +12 -12
  132. package/dist/hooks/useCreateMutation/index.js.map +1 -1
  133. package/dist/hooks/useDeleteMutation/index.js +16 -9
  134. package/dist/hooks/useDeleteMutation/index.js.map +1 -1
  135. package/dist/hooks/useEditMutation/index.js +48 -33
  136. package/dist/hooks/useEditMutation/index.js.map +1 -1
  137. package/dist/hooks/useItemQuery/index.js +4 -4
  138. package/dist/hooks/useItemQuery/index.js.map +1 -1
  139. package/dist/hooks/useUpdateBreadcrumb/index.js.map +1 -1
  140. package/dist/locale/en.json +1 -0
  141. package/dist/locale/nl.json +1 -0
  142. package/dist/models/config.models.d.ts +1 -5
  143. package/dist/models/theme.models.d.ts +19 -16
  144. package/dist/pages/AcceptInvitationPage/index.js +25 -25
  145. package/dist/pages/AcceptInvitationPage/index.js.map +1 -1
  146. package/dist/pages/AdminPage/index.js +16 -16
  147. package/dist/pages/AdminPage/index.js.map +1 -1
  148. package/dist/pages/ChooseIdentityProviderPage/index.js +21 -21
  149. package/dist/pages/ChooseIdentityProviderPage/index.js.map +1 -1
  150. package/dist/pages/IdentifierIssuersAdminPage/index.js +5 -5
  151. package/dist/pages/IdentifierIssuersAdminPage/index.js.map +1 -1
  152. package/dist/pages/OrganizationAdminPoliciesAdminPage/index.js +5 -5
  153. package/dist/pages/OrganizationAdminPoliciesAdminPage/index.js.map +1 -1
  154. package/dist/pages/OrganizationContactsAdminPage/index.js +6 -6
  155. package/dist/pages/OrganizationContactsAdminPage/index.js.map +1 -1
  156. package/dist/pages/OrganizationSitesAdminPage/index.js +9 -9
  157. package/dist/pages/OrganizationSitesAdminPage/index.js.map +1 -1
  158. package/dist/pages/OrganizationsAdminPage/index.js +13 -13
  159. package/dist/pages/OrganizationsAdminPage/index.js.map +1 -1
  160. package/dist/pages/OutagesAdminPage/index.js +20 -20
  161. package/dist/pages/OutagesAdminPage/index.js.map +1 -1
  162. package/dist/pages/PostLoginPage/index.js +6 -6
  163. package/dist/pages/PostLoginPage/index.js.map +1 -1
  164. package/dist/pages/PostLogoutPage/index.js +8 -8
  165. package/dist/pages/PostLogoutPage/index.js.map +1 -1
  166. package/dist/pages/UsersAdminPage/index.js +39 -39
  167. package/dist/pages/UsersAdminPage/index.js.map +1 -1
  168. package/dist/setup/setup.d.ts +1 -1
  169. package/dist/setup/setup.js +11 -4
  170. package/dist/setup/setup.js.map +1 -1
  171. package/dist/theme/demoTheme/index.js +17 -15
  172. package/dist/theme/demoTheme/index.js.map +1 -1
  173. package/dist/utils/DataHookUtil/index.js +1 -1
  174. package/dist/utils/DataHookUtil/index.js.map +1 -1
  175. package/dist/utils/DependencyContainerUtil/DependencyContainerUtil.d.ts +2 -3
  176. package/dist/utils/DependencyContainerUtil/index.js +10 -16
  177. package/dist/utils/DependencyContainerUtil/index.js.map +1 -1
  178. package/dist/utils/MenuDataUtil/index.js +1 -1
  179. package/dist/utils/MenuDataUtil/index.js.map +1 -1
  180. package/dist/utils/StandardConfigUtil/index.js +0 -4
  181. package/dist/utils/StandardConfigUtil/index.js.map +1 -1
  182. package/dist/utils/TimeUtil/index.js +1 -1
  183. package/dist/utils/TimeUtil/index.js.map +1 -1
  184. package/package.json +11 -14
  185. package/dist/context/uiClientCommonConfigContext/UiClientCommonConfigContext.d.ts +0 -9
  186. package/dist/context/uiClientCommonConfigContext/UiClientCommonConfigContextProvider.d.ts +0 -6
  187. package/dist/context/uiClientCommonConfigContext/index.d.ts +0 -3
  188. package/dist/context/uiClientCommonConfigContext/index.js +0 -34
  189. package/dist/context/uiClientCommonConfigContext/index.js.map +0 -1
  190. package/dist/context/uiClientCommonConfigContext/useUiClientCommonConfigContext.d.ts +0 -3
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["rootContainer","QueryClientService","useOrganizationsQuery","useQueryMemo","container","API_ORGANIZATION_TOKEN","COMMON_QUERY_KEY","useOrganizationMapQuery","organizationsQuery","useMemo","DataHookUtil","item","useOrganizationOptionsQuery","StringUtil","a","b"],"sources":["../../../src/dataHooks/useOrganizationsQuery/useOrganizationsQuery.ts"],"sourcesContent":["import { container as rootContainer } from 'tsyringe';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { useMemo } from 'react';\nimport type { CommonDbOrganization } from '@gen-epix/api-commondb';\nimport { StringUtil } from '@gen-epix/ui-core/utils/StringUtil';\n\nimport { API_ORGANIZATION_TOKEN } from '../../constants/api.constants';\nimport type {\n UseMap,\n UseOptions,\n} from '../../models/data-hooks.models';\nimport { DataHookUtil } from '../../utils/DataHookUtil';\nimport { useQueryMemo } from '../../hooks/useQueryMemo';\nimport { QueryClientService } from '../../classes/services/QueryClientService';\nimport { COMMON_QUERY_KEY } from '../../constants/query.constants';\n\nexport const useOrganizationsQuery = (): UseQueryResult<CommonDbOrganization[]> => {\n return useQueryMemo({\n queryFn: async ({ signal }) => {\n const response = await rootContainer.resolve(API_ORGANIZATION_TOKEN).organizationsGetAll(null, null, { signal });\n return response.data;\n },\n queryKey: rootContainer.resolve(QueryClientService).getGenericKey(COMMON_QUERY_KEY.ORGANIZATIONS),\n });\n};\n\nexport const useOrganizationMapQuery = (): UseMap<CommonDbOrganization> => {\n const organizationsQuery = useOrganizationsQuery();\n\n return useMemo(() => {\n return DataHookUtil.createUseMapDataHook<CommonDbOrganization>(organizationsQuery, item => item.id);\n }, [organizationsQuery]);\n};\n\nexport const useOrganizationOptionsQuery = (): UseOptions<string> => {\n const organizationsQuery = useOrganizationsQuery();\n\n return useMemo(() => {\n return DataHookUtil.createUseOptionsDataHook<CommonDbOrganization>(organizationsQuery, item => item.id, item => item.name, [], (a, b) => StringUtil.advancedSortComperator(a.name, b.name));\n }, [organizationsQuery]);\n};\n"],"mappings":";;;;;;;;;AAgBA,IAAaE,UACJC,EAAa;CAClB,SAAS,OAAO,EAAE,iBAET,MADgBH,EAAc,QAAQK,CAAsB,CAAC,CAAC,oBAAoB,MAAM,MAAM,EAAE,UAAO,CAAC,EAAA,CAC/F;CAElB,UAAUL,EAAc,QAAQC,CAAkB,CAAC,CAAC,cAAcK,EAAiB,aAAa;AAClG,CAAC,GAGUC,UAA8D;CACzE,IAAMC,IAAqBN,EAAsB;CAEjD,OAAOO,QACEC,EAAa,qBAA2CF,IAAoB,MAAQG,EAAK,EAAE,GACjG,CAACH,CAAkB,CAAC;AACzB,GAEaI,UAAwD;CACnE,IAAMJ,IAAqBN,EAAsB;CAEjD,OAAOO,QACEC,EAAa,yBAA+CF,IAAoB,MAAQG,EAAK,KAAI,MAAQA,EAAK,MAAM,CAAC,IAAI,GAAG,MAAME,EAAW,uBAAuBC,EAAE,MAAMC,EAAE,IAAI,CAAC,GACzL,CAACP,CAAkB,CAAC;AACzB"}
1
+ {"version":3,"file":"index.js","names":["useQueryMemo","QueryClientService","useOrganizationsQuery","container","API_ORGANIZATION_TOKEN","COMMON_QUERY_KEY","useOrganizationMapQuery","organizationsQuery","useMemo","DataHookUtil","item","useOrganizationOptionsQuery","StringUtil","a","b"],"sources":["../../../src/dataHooks/useOrganizationsQuery/useOrganizationsQuery.ts"],"sourcesContent":["import { container } from 'tsyringe';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { useMemo } from 'react';\nimport type { CommonDbOrganization } from '@gen-epix/api-commondb';\nimport { StringUtil } from '@gen-epix/ui-core/utils/StringUtil';\n\nimport { API_ORGANIZATION_TOKEN } from '../../constants/api.constants';\nimport type {\n UseMap,\n UseOptions,\n} from '../../models/data-hooks.models';\nimport { DataHookUtil } from '../../utils/DataHookUtil';\nimport { useQueryMemo } from '../../hooks/useQueryMemo';\nimport { QueryClientService } from '../../classes/services/QueryClientService';\nimport { COMMON_QUERY_KEY } from '../../constants/query.constants';\n\nexport const useOrganizationsQuery = (): UseQueryResult<CommonDbOrganization[]> => {\n return useQueryMemo({\n queryFn: async ({ signal }) => {\n const response = await container.resolve(API_ORGANIZATION_TOKEN).organizationsGetAll(null, null, { signal });\n return response.data;\n },\n queryKey: container.resolve(QueryClientService).getGenericKey(COMMON_QUERY_KEY.ORGANIZATIONS),\n });\n};\n\nexport const useOrganizationMapQuery = (): UseMap<CommonDbOrganization> => {\n const organizationsQuery = useOrganizationsQuery();\n\n return useMemo(() => {\n return DataHookUtil.createUseMapDataHook<CommonDbOrganization>(organizationsQuery, item => item.id);\n }, [organizationsQuery]);\n};\n\nexport const useOrganizationOptionsQuery = (): UseOptions<string> => {\n const organizationsQuery = useOrganizationsQuery();\n\n return useMemo(() => {\n return DataHookUtil.createUseOptionsDataHook<CommonDbOrganization>(organizationsQuery, item => item.id, item => item.name, [], (a, b) => StringUtil.advancedSortComperator(a.name, b.name));\n }, [organizationsQuery]);\n};\n"],"mappings":";;;;;;;;;AAgBA,IAAaE,UACJF,EAAa;CAClB,SAAS,OAAO,EAAE,iBAET,MADgBG,EAAU,QAAQC,CAAsB,CAAC,CAAC,oBAAoB,MAAM,MAAM,EAAE,UAAO,CAAC,EAAA,CAC3F;CAElB,UAAUD,EAAU,QAAQF,CAAkB,CAAC,CAAC,cAAcI,EAAiB,aAAa;AAC9F,CAAC,GAGUC,UAA8D;CACzE,IAAMC,IAAqBL,EAAsB;CAEjD,OAAOM,QACEC,EAAa,qBAA2CF,IAAoB,MAAQG,EAAK,EAAE,GACjG,CAACH,CAAkB,CAAC;AACzB,GAEaI,UAAwD;CACnE,IAAMJ,IAAqBL,EAAsB;CAEjD,OAAOM,QACEC,EAAa,yBAA+CF,IAAoB,MAAQG,EAAK,KAAI,MAAQA,EAAK,MAAM,CAAC,IAAI,GAAG,MAAME,EAAW,uBAAuBC,EAAE,MAAMC,EAAE,IAAI,CAAC,GACzL,CAACP,CAAkB,CAAC;AACzB"}
@@ -1,22 +1,22 @@
1
1
  import { UserUtil as e } from "../../utils/UserUtil/index.js";
2
- import { t } from "../../_chunks/QueryClientService.js";
3
- import { t as n } from "../../_chunks/useQueryMemo.js";
4
- import { DataHookUtil as r } from "../../utils/DataHookUtil/index.js";
5
- import { API_ORGANIZATION_TOKEN as i } from "../../constants/api.constants.js";
2
+ import { DataHookUtil as t } from "../../utils/DataHookUtil/index.js";
3
+ import { API_ORGANIZATION_TOKEN as n } from "../../constants/api.constants.js";
4
+ import { t as r } from "../../_chunks/useQueryMemo.js";
5
+ import { t as i } from "../../_chunks/QueryClientService.js";
6
6
  import { COMMON_QUERY_KEY as a } from "../../constants/query.constants.js";
7
7
  import { container as o } from "tsyringe";
8
8
  import { useMemo as s } from "react";
9
9
  import { useTranslation as c } from "react-i18next";
10
10
  //#region src/dataHooks/useUsersQuery/useUsersQuery.ts
11
- var l = () => n({
12
- queryFn: async ({ signal: e }) => (await o.resolve(i).usersGetAll(null, null, { signal: e })).data,
13
- queryKey: o.resolve(t).getGenericKey(a.USERS)
11
+ var l = () => r({
12
+ queryFn: async ({ signal: e }) => (await o.resolve(n).usersGetAll(null, null, { signal: e })).data,
13
+ queryKey: o.resolve(i).getGenericKey(a.USERS)
14
14
  }), u = () => {
15
15
  let e = l();
16
- return s(() => r.createUseMapDataHook(e, (e) => e.id), [e]);
16
+ return s(() => t.createUseMapDataHook(e, (e) => e.id), [e]);
17
17
  }, d = () => {
18
- let t = l(), { t: n } = c();
19
- return s(() => r.createUseOptionsDataHook(t, (e) => e.id, (t) => e.getUserDisplayValue(t, n)), [n, t]);
18
+ let n = l(), { t: r } = c();
19
+ return s(() => t.createUseOptionsDataHook(n, (e) => e.id, (t) => e.getUserDisplayValue(t, r)), [r, n]);
20
20
  };
21
21
  //#endregion
22
22
  export { d as useUserOptionsQuery, u as useUsersMapQuery, l as useUsersQuery };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["rootContainer","useQueryMemo","useUsersQuery","container","API_ORGANIZATION_TOKEN","QueryClientService","COMMON_QUERY_KEY","useUsersMapQuery","usersQuery","useMemo","DataHookUtil","item","useUserOptionsQuery","useTranslation","UserUtil","t"],"sources":["../../../src/dataHooks/useUsersQuery/useUsersQuery.ts"],"sourcesContent":["import { container as rootContainer } from 'tsyringe';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { useTranslation } from 'react-i18next';\nimport { useMemo } from 'react';\nimport type { CommonDbUser } from '@gen-epix/api-commondb';\n\nimport { API_ORGANIZATION_TOKEN } from '../../constants/api.constants';\nimport type {\n UseMap,\n UseOptions,\n} from '../../models/data-hooks.models';\nimport { DataHookUtil } from '../../utils/DataHookUtil';\nimport { useQueryMemo } from '../../hooks/useQueryMemo';\nimport { QueryClientService } from '../../classes/services/QueryClientService';\nimport { COMMON_QUERY_KEY } from '../../constants/query.constants';\nimport { UserUtil } from '../../utils/UserUtil';\n\nexport const useUsersQuery = (): UseQueryResult<CommonDbUser[]> => {\n return useQueryMemo({\n queryFn: async ({ signal }) => {\n const response = await rootContainer.resolve(API_ORGANIZATION_TOKEN).usersGetAll(null, null, { signal });\n return response.data;\n },\n queryKey: rootContainer.resolve(QueryClientService).getGenericKey(COMMON_QUERY_KEY.USERS),\n });\n};\n\nexport const useUsersMapQuery = (): UseMap<CommonDbUser> => {\n const usersQuery = useUsersQuery();\n\n return useMemo(() => {\n return DataHookUtil.createUseMapDataHook<CommonDbUser>(usersQuery, item => item.id);\n }, [usersQuery]);\n};\n\nexport const useUserOptionsQuery = (): UseOptions<string> => {\n const usersQuery = useUsersQuery();\n const { t } = useTranslation();\n\n return useMemo(() => {\n return DataHookUtil.createUseOptionsDataHook<CommonDbUser>(usersQuery, item => item.id, item => UserUtil.getUserDisplayValue(item, t));\n }, [t, usersQuery]);\n};\n"],"mappings":";;;;;;;;;;AAiBA,IAAaE,UACJD,EAAa;CAClB,SAAS,OAAO,EAAE,iBAET,MADgBD,EAAc,QAAQI,CAAsB,CAAC,CAAC,YAAY,MAAM,MAAM,EAAE,UAAO,CAAC,EAAA,CACvF;CAElB,UAAUJ,EAAc,QAAQK,CAAkB,CAAC,CAAC,cAAcC,EAAiB,KAAK;AAC1F,CAAC,GAGUC,UAA+C;CAC1D,IAAMC,IAAaN,EAAc;CAEjC,OAAOO,QACEC,EAAa,qBAAmCF,IAAY,MAAQG,EAAK,EAAE,GACjF,CAACH,CAAU,CAAC;AACjB,GAEaI,UAAgD;CAC3D,IAAMJ,IAAaN,EAAc,GAC3B,EAAE,SAAMW,EAAe;CAE7B,OAAOJ,QACEC,EAAa,yBAAuCF,IAAY,MAAQG,EAAK,KAAI,MAAQG,EAAS,oBAAoBH,GAAMI,CAAC,CAAC,GACpI,CAACA,GAAGP,CAAU,CAAC;AACpB"}
1
+ {"version":3,"file":"index.js","names":["useQueryMemo","QueryClientService","useUsersQuery","container","API_ORGANIZATION_TOKEN","COMMON_QUERY_KEY","useUsersMapQuery","usersQuery","useMemo","DataHookUtil","item","useUserOptionsQuery","useTranslation","UserUtil","t"],"sources":["../../../src/dataHooks/useUsersQuery/useUsersQuery.ts"],"sourcesContent":["import { container } from 'tsyringe';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { useTranslation } from 'react-i18next';\nimport { useMemo } from 'react';\nimport type { CommonDbUser } from '@gen-epix/api-commondb';\n\nimport { API_ORGANIZATION_TOKEN } from '../../constants/api.constants';\nimport type {\n UseMap,\n UseOptions,\n} from '../../models/data-hooks.models';\nimport { DataHookUtil } from '../../utils/DataHookUtil';\nimport { useQueryMemo } from '../../hooks/useQueryMemo';\nimport { QueryClientService } from '../../classes/services/QueryClientService';\nimport { COMMON_QUERY_KEY } from '../../constants/query.constants';\nimport { UserUtil } from '../../utils/UserUtil';\n\nexport const useUsersQuery = (): UseQueryResult<CommonDbUser[]> => {\n return useQueryMemo({\n queryFn: async ({ signal }) => {\n const response = await container.resolve(API_ORGANIZATION_TOKEN).usersGetAll(null, null, { signal });\n return response.data;\n },\n queryKey: container.resolve(QueryClientService).getGenericKey(COMMON_QUERY_KEY.USERS),\n });\n};\n\nexport const useUsersMapQuery = (): UseMap<CommonDbUser> => {\n const usersQuery = useUsersQuery();\n\n return useMemo(() => {\n return DataHookUtil.createUseMapDataHook<CommonDbUser>(usersQuery, item => item.id);\n }, [usersQuery]);\n};\n\nexport const useUserOptionsQuery = (): UseOptions<string> => {\n const usersQuery = useUsersQuery();\n const { t } = useTranslation();\n\n return useMemo(() => {\n return DataHookUtil.createUseOptionsDataHook<CommonDbUser>(usersQuery, item => item.id, item => UserUtil.getUserDisplayValue(item, t));\n }, [t, usersQuery]);\n};\n"],"mappings":";;;;;;;;;;AAiBA,IAAaE,UACJF,EAAa;CAClB,SAAS,OAAO,EAAE,iBAET,MADgBG,EAAU,QAAQC,CAAsB,CAAC,CAAC,YAAY,MAAM,MAAM,EAAE,UAAO,CAAC,EAAA,CACnF;CAElB,UAAUD,EAAU,QAAQF,CAAkB,CAAC,CAAC,cAAcI,EAAiB,KAAK;AACtF,CAAC,GAGUC,UAA+C;CAC1D,IAAMC,IAAaL,EAAc;CAEjC,OAAOM,QACEC,EAAa,qBAAmCF,IAAY,MAAQG,EAAK,EAAE,GACjF,CAACH,CAAU,CAAC;AACjB,GAEaI,UAAgD;CAC3D,IAAMJ,IAAaL,EAAc,GAC3B,EAAE,SAAMU,EAAe;CAE7B,OAAOJ,QACEC,EAAa,yBAAuCF,IAAY,MAAQG,EAAK,KAAI,MAAQG,EAAS,oBAAoBH,GAAMI,CAAC,CAAC,GACpI,CAACA,GAAGP,CAAU,CAAC;AACpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["rootContainer","withPermissions","WrappedComponent","useMemo","container","AuthorizationService","options","FallbackComponent","Component","props"],"sources":["../../../src/hoc/withPermissions/withPermissions.tsx"],"sourcesContent":["import { container as rootContainer } from 'tsyringe';\nimport { useMemo } from 'react';\nimport type { ComponentType } from 'react';\nimport type { CommonDbApiPermission } from '@gen-epix/api-commondb';\n\nimport { AuthorizationService } from '../../classes/services/AuthorizationService';\n\nexport interface WithPermissionsOptions<TApiPermission = CommonDbApiPermission> {\n readonly fallback?: ComponentType | null;\n readonly requiredPermissions: TApiPermission[];\n}\n\nexport const withPermissions = <TApiPermission = CommonDbApiPermission, TProps extends object = Record<string, never>>(\n Component: ComponentType<TProps>,\n options: WithPermissionsOptions<TApiPermission>,\n) => {\n const WrappedComponent = (props: TProps) => {\n const authorizationService = useMemo(() => rootContainer.resolve(AuthorizationService), []);\n\n if (!authorizationService.doesUserHavePermission(options.requiredPermissions as CommonDbApiPermission[])) {\n if (options.fallback) {\n const FallbackComponent = options.fallback;\n return <FallbackComponent />;\n }\n return null;\n }\n\n return <Component {...props} />;\n };\n\n // Set display name for better debugging\n WrappedComponent.displayName = `withPermissions(${Component.displayName || Component.name})`;\n\n return WrappedComponent;\n};\n"],"mappings":";;;;;AAYA,IAAaC,KACX,GACA,MACG;CACH,IAAMC,KAAoB,MAAkB;EAG1C,IAAI,CAFyBC,QAAcH,EAAc,QAAQK,CAAoB,GAAG,CAAC,CAEpF,CAAA,CAAqB,uBAAuBC,EAAQ,mBAA8C,GAAG;GACxG,IAAIA,EAAQ,UAAU;IACpB,IAAMC,IAAoBD,EAAQ;IAClC,OAAO,kBAACC,GAAD,CAAoB,CAAA;GAC7B;GACA,OAAO;EACT;EAEA,OAAO,kBAACC,GAAD,EAAW,GAAIC,EAAQ,CAAA;CAChC;CAKA,OAFA,EAAiB,cAAc,mBAAmBD,EAAU,eAAeA,EAAU,KAAK,IAEnFN;AACT"}
1
+ {"version":3,"file":"index.js","names":["withPermissions","WrappedComponent","useMemo","container","AuthorizationService","options","FallbackComponent","Component","props"],"sources":["../../../src/hoc/withPermissions/withPermissions.tsx"],"sourcesContent":["import { container } from 'tsyringe';\nimport { useMemo } from 'react';\nimport type { ComponentType } from 'react';\nimport type { CommonDbApiPermission } from '@gen-epix/api-commondb';\n\nimport { AuthorizationService } from '../../classes/services/AuthorizationService';\n\nexport interface WithPermissionsOptions<TApiPermission = CommonDbApiPermission> {\n readonly fallback?: ComponentType | null;\n readonly requiredPermissions: TApiPermission[];\n}\n\nexport const withPermissions = <TApiPermission = CommonDbApiPermission, TProps extends object = Record<string, never>>(\n Component: ComponentType<TProps>,\n options: WithPermissionsOptions<TApiPermission>,\n) => {\n const WrappedComponent = (props: TProps) => {\n const authorizationService = useMemo(() => container.resolve(AuthorizationService), []);\n\n if (!authorizationService.doesUserHavePermission(options.requiredPermissions as CommonDbApiPermission[])) {\n if (options.fallback) {\n const FallbackComponent = options.fallback;\n return <FallbackComponent />;\n }\n return null;\n }\n\n return <Component {...props} />;\n };\n\n // Set display name for better debugging\n WrappedComponent.displayName = `withPermissions(${Component.displayName || Component.name})`;\n\n return WrappedComponent;\n};\n"],"mappings":";;;;;AAYA,IAAaA,KACX,GACA,MACG;CACH,IAAMC,KAAoB,MAAkB;EAG1C,IAAI,CAFyBC,QAAcC,EAAU,QAAQC,CAAoB,GAAG,CAAC,CAEhF,CAAA,CAAqB,uBAAuBC,EAAQ,mBAA8C,GAAG;GACxG,IAAIA,EAAQ,UAAU;IACpB,IAAMC,IAAoBD,EAAQ;IAClC,OAAO,kBAACC,GAAD,CAAoB,CAAA;GAC7B;GACA,OAAO;EACT;EAEA,OAAO,kBAACC,GAAD,EAAW,GAAIC,EAAQ,CAAA;CAChC;CAKA,OAFA,EAAiB,cAAc,mBAAmBD,EAAU,eAAeA,EAAU,KAAK,IAEnFN;AACT"}
@@ -1,6 +1,6 @@
1
- import { useUiClientCommonConfigContext as e } from "../../context/uiClientCommonConfigContext/index.js";
1
+ import { DependencyContainerUtil as e } from "../../utils/DependencyContainerUtil/index.js";
2
2
  //#region src/hooks/useConfig/useConfig.ts
3
- var t = () => e().config;
3
+ var t = () => e.resolveConfig();
4
4
  //#endregion
5
5
  export { t as useConfig };
6
6
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["useConfig","useUiClientCommonConfigContext"],"sources":["../../../src/hooks/useConfig/useConfig.ts"],"sourcesContent":["import type { ConfigBase } from '../../models/config.models';\nimport { useUiClientCommonConfigContext } from '../../context/uiClientCommonConfigContext';\n\nexport const useConfig = <TConfig extends ConfigBase = ConfigBase>(): TConfig => {\n return useUiClientCommonConfigContext<TConfig>().config;\n};\n"],"mappings":";;AAGA,IAAaA,UACJC,EAAwC,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","names":["useConfig","DependencyContainerUtil"],"sources":["../../../src/hooks/useConfig/useConfig.ts"],"sourcesContent":["import type { ConfigBase } from '../../models/config.models';\nimport { DependencyContainerUtil } from '../../utils/DependencyContainerUtil';\n\n// eslint-disable-next-line @eslint-react/no-unnecessary-use-prefix\nexport const useConfig = <TConfig extends ConfigBase = ConfigBase>(): TConfig => {\n return DependencyContainerUtil.resolveConfig<TConfig>();\n};\n"],"mappings":";;AAIA,IAAaA,UACJC,EAAwB,cAAuB"}
@@ -1,20 +1,20 @@
1
- import { t as e } from "../../_chunks/QueryClientService.js";
2
- import { t } from "../../_chunks/useMutation.js";
3
- import { NotificationUtil as n } from "../../utils/NotificationUtil/index.js";
1
+ import { NotificationUtil as e } from "../../utils/NotificationUtil/index.js";
2
+ import { t } from "../../_chunks/QueryClientService.js";
3
+ import { t as n } from "../../_chunks/useMutation.js";
4
4
  import { NotificationService as r } from "../../classes/services/NotificationService/index.js";
5
- import { StringUtil as i } from "@gen-epix/ui-core/utils/StringUtil";
6
- import { container as a } from "tsyringe";
5
+ import { container as i } from "tsyringe";
6
+ import { StringUtil as a } from "@gen-epix/ui-core/utils/StringUtil";
7
7
  import { useMemo as o } from "react";
8
8
  import { ObjectUtil as s } from "@gen-epix/ui-core/utils/ObjectUtil";
9
9
  //#region src/hooks/useCreateMutation/useCreateMutation.ts
10
10
  var c = ({ associationQueryKeys: c, getErrorNotificationMessage: l, getProgressNotificationMessage: u, getSuccessNotificationMessage: d, onError: f, onSuccess: p, queryFn: m, resourceQueryKey: h }) => {
11
- let g = a.resolve(e).queryClient, _ = t({
11
+ let g = i.resolve(t).queryClient, _ = n({
12
12
  mutationFn: async (e) => m(s.deepNullifyEmptyStrings(e)),
13
- onError: async (t, i, o) => {
14
- h && g.setQueryData(h, (e) => Array.isArray(e) ? [...e.filter((e) => e?.id !== o.temporaryId)] : e), await a.resolve(e).invalidateQueryKeys(c), f && await f(t, i, o), a.resolve(r).fulfillNotification(o.notificationKey, n.wrapErrorNotificationMessage(l(i, t), t), "error");
13
+ onError: async (n, a, o) => {
14
+ h && g.setQueryData(h, (e) => Array.isArray(e) ? [...e.filter((e) => e?.id !== o.temporaryId)] : e), await i.resolve(t).invalidateQueryKeys(c), f && await f(n, a, o), i.resolve(r).fulfillNotification(o.notificationKey, e.wrapErrorNotificationMessage(l(a, n), n), "error");
15
15
  },
16
16
  onMutate: async (e) => {
17
- let t = a.resolve(r).showNotification({
17
+ let t = i.resolve(r).showNotification({
18
18
  isLoading: !0,
19
19
  message: u(e),
20
20
  severity: "info"
@@ -23,7 +23,7 @@ var c = ({ associationQueryKeys: c, getErrorNotificationMessage: l, getProgressN
23
23
  await g.cancelQueries({ queryKey: h });
24
24
  let n = g.getQueryData(h);
25
25
  if (Array.isArray(n)) {
26
- let r = i.createUuid();
26
+ let r = a.createUuid();
27
27
  return g.setQueryData(h, (t) => [{
28
28
  ...e,
29
29
  id: r
@@ -36,8 +36,8 @@ var c = ({ associationQueryKeys: c, getErrorNotificationMessage: l, getProgressN
36
36
  }
37
37
  return { notificationKey: t };
38
38
  },
39
- onSuccess: async (t, n, i) => {
40
- h && Array.isArray(i?.previousData) && !Array.isArray(t) && g.setQueryData(h, (e) => [t, ...e.filter((e) => e.id !== i.temporaryId)]), await a.resolve(e).invalidateQueryKeys(c), p && await p(t, n, i), a.resolve(r).fulfillNotification(i.notificationKey, d(t, i), "success");
39
+ onSuccess: async (e, n, a) => {
40
+ h && Array.isArray(a?.previousData) && !Array.isArray(e) && g.setQueryData(h, (t) => [e, ...t.filter((e) => e.id !== a.temporaryId)]), await i.resolve(t).invalidateQueryKeys(c), p && await p(e, n, a), i.resolve(r).fulfillNotification(a.notificationKey, d(e, a), "success");
41
41
  }
42
42
  }), v = o(() => _.mutate, [_.mutate]), y = o(() => _.isPending, [_.isPending]);
43
43
  return o(() => ({
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["rootContainer","QueryClientService","useCreateMutation","queryClient","container","createMutation","useMutation","queryFn","ObjectUtil","item","resourceQueryKey","oldItems","context","associationQueryKeys","onError","error","variables","NotificationService","NotificationUtil","getErrorNotificationMessage","notificationKey","getProgressNotificationMessage","previousData","temporaryId","StringUtil","x","onSuccess","getSuccessNotificationMessage","mutate","useMemo","isMutating"],"sources":["../../../src/hooks/useCreateMutation/useCreateMutation.ts"],"sourcesContent":["import { container as rootContainer } from 'tsyringe';\nimport { useMutation } from '@tanstack/react-query';\nimport type { ReactElement } from 'react';\nimport { useMemo } from 'react';\nimport { StringUtil } from '@gen-epix/ui-core/utils/StringUtil';\nimport { ObjectUtil } from '@gen-epix/ui-core/utils/ObjectUtil';\n\nimport { NotificationService } from '../../classes/services/NotificationService';\nimport type { GenericData } from '../../models/data.models';\nimport { NotificationUtil } from '../../utils/NotificationUtil';\nimport { QueryClientService } from '../../classes/services/QueryClientService';\n\n\nexport type MutationContextCreate<TData> = { notificationKey?: string; previousData?: TData[]; temporaryId?: string };\n\nexport type UseCreateMutationProps<TData extends GenericData | GenericData[], TVariables = TData> = {\n readonly associationQueryKeys?: string[][];\n readonly getErrorNotificationMessage: (data: TVariables, error: unknown) => ReactElement | string;\n readonly getProgressNotificationMessage: (data: TVariables) => ReactElement | string;\n readonly getSuccessNotificationMessage: (data: TData, context: MutationContextCreate<TData>) => ReactElement | string;\n readonly onError?: (error: unknown, variables: TVariables, context: MutationContextCreate<TData>) => Promise<void> | void;\n readonly onSuccess?: (item: TData, variables: TVariables, context: MutationContextCreate<TData>) => Promise<void> | void;\n readonly queryFn?: (item: TVariables) => Promise<TData>;\n readonly resourceQueryKey?: string[];\n};\n\nexport const useCreateMutation = <TData extends GenericData | GenericData[], TVariables = TData>({\n associationQueryKeys,\n getErrorNotificationMessage,\n getProgressNotificationMessage,\n getSuccessNotificationMessage,\n onError,\n onSuccess,\n queryFn,\n resourceQueryKey,\n}: UseCreateMutationProps<TData, TVariables>) => {\n const queryClient = rootContainer.resolve(QueryClientService).queryClient;\n\n const createMutation = useMutation<TData, Error, TVariables, MutationContextCreate<TData>>({\n mutationFn: async (item) => {\n return queryFn(ObjectUtil.deepNullifyEmptyStrings(item));\n },\n onError: async (error, variables, context) => {\n if (resourceQueryKey) {\n queryClient.setQueryData<TData[]>(resourceQueryKey, (oldItems: TData[]) => {\n if (!Array.isArray(oldItems)) {\n return oldItems;\n }\n return [...oldItems.filter(item => (item as GenericData)?.id !== context.temporaryId)];\n });\n }\n await rootContainer.resolve(QueryClientService).invalidateQueryKeys(associationQueryKeys);\n if (onError) {\n await onError(error, variables, context);\n }\n rootContainer.resolve(NotificationService).fulfillNotification(context.notificationKey, NotificationUtil.wrapErrorNotificationMessage(getErrorNotificationMessage(variables, error), error), 'error');\n },\n onMutate: async (variables) => {\n const notificationKey = rootContainer.resolve(NotificationService).showNotification({\n isLoading: true,\n message: getProgressNotificationMessage(variables),\n severity: 'info',\n });\n if (resourceQueryKey) {\n await queryClient.cancelQueries({ queryKey: resourceQueryKey });\n const previousData = queryClient.getQueryData<TData[]>(resourceQueryKey);\n if (Array.isArray(previousData)) {\n const temporaryId = StringUtil.createUuid();\n queryClient.setQueryData<TData[]>(resourceQueryKey, (oldItems: TData[]) => {\n return [\n {\n ...variables,\n id: temporaryId,\n },\n ...oldItems,\n ] as TData[];\n });\n return { notificationKey, previousData, temporaryId };\n }\n }\n return { notificationKey };\n },\n onSuccess: async (item, variables, context) => {\n if (resourceQueryKey && Array.isArray(context?.previousData) && !Array.isArray(item)) {\n queryClient.setQueryData<GenericData[]>(resourceQueryKey, (oldItems) => {\n return [\n item,\n ...oldItems.filter(x => x.id !== context.temporaryId),\n ];\n });\n }\n await rootContainer.resolve(QueryClientService).invalidateQueryKeys(associationQueryKeys);\n if (onSuccess) {\n await onSuccess(item, variables, context);\n }\n rootContainer.resolve(NotificationService).fulfillNotification(context.notificationKey, getSuccessNotificationMessage(item, context), 'success');\n },\n });\n\n // Note: must be done in useMemo to avoid render loops (useMutation returns a new object every time)\n const mutate = useMemo(() => createMutation.mutate, [createMutation.mutate]);\n const isMutating = useMemo(() => createMutation.isPending, [createMutation.isPending]);\n return useMemo(() => ({ isMutating, mutate }), [isMutating, mutate]);\n};\n"],"mappings":";;;;;;;;;AA0BA,IAAaE,KAAoF,EAC/F,yBACA,gCACA,mCACA,kCACA,YACA,cACA,YACA,0BAC+C;CAC/C,IAAMC,IAAcH,EAAc,QAAQC,CAAkB,CAAC,CAAC,aAExDI,IAAiBC,EAAoE;EACzF,YAAY,OAAO,MACVC,EAAQC,EAAW,wBAAwBC,CAAI,CAAC;EAEzD,SAAS,OAAO,GAAO,GAAW,MAAY;GAa5C,AAZIC,KACFP,EAAY,aAAsBO,IAAmB,MAC9C,MAAM,QAAQC,CAAQ,IAGpB,CAAC,GAAGA,EAAS,QAAO,MAASF,GAAsB,OAAOG,EAAQ,WAAW,CAAC,IAF5ED,CAGV,GAEH,MAAMX,EAAc,QAAQC,CAAkB,CAAC,CAAC,oBAAoBY,CAAoB,GACpFC,KACF,MAAMA,EAAQC,GAAOC,GAAWJ,CAAO,GAEzCR,EAAc,QAAQa,CAAmB,CAAC,CAAC,oBAAoBL,EAAQ,iBAAiBM,EAAiB,6BAA6BC,EAA4BH,GAAWD,CAAK,GAAGA,CAAK,GAAG,OAAO;EACtM;EACA,UAAU,OAAO,MAAc;GAC7B,IAAMK,IAAkBpB,EAAc,QAAQiB,CAAmB,CAAC,CAAC,iBAAiB;IAClF,WAAW;IACX,SAASI,EAA+BL,CAAS;IACjD,UAAU;GACZ,CAAC;GACD,IAAIN,GAAkB;IACpB,MAAMP,EAAY,cAAc,EAAE,UAAUO,EAAiB,CAAC;IAC9D,IAAMY,IAAenB,EAAY,aAAsBO,CAAgB;IACvE,IAAI,MAAM,QAAQY,CAAY,GAAG;KAC/B,IAAMC,IAAcC,EAAW,WAAW;KAU1C,OATArB,EAAY,aAAsBO,IAAmB,MAC5C,CACL;MACE,GAAGM;MACH,IAAIO;KACN,GACA,GAAGZ,CACL,CACD,GACM;MAAE;MAAiB;MAAc;KAAY;IACtD;GACF;GACA,OAAO,EAAE,mBAAgB;EAC3B;EACA,WAAW,OAAO,GAAM,GAAW,MAAY;GAa7C,AAZID,KAAoB,MAAM,QAAQE,GAAS,YAAY,KAAK,CAAC,MAAM,QAAQH,CAAI,KACjFN,EAAY,aAA4BO,IAAmB,MAClD,CACLD,GACA,GAAGE,EAAS,QAAO,MAAKc,EAAE,OAAOb,EAAQ,WAAW,CACtD,CACD,GAEH,MAAMZ,EAAc,QAAQC,CAAkB,CAAC,CAAC,oBAAoBY,CAAoB,GACpFa,KACF,MAAMA,EAAUjB,GAAMO,GAAWJ,CAAO,GAE1CR,EAAc,QAAQa,CAAmB,CAAC,CAAC,oBAAoBL,EAAQ,iBAAiBe,EAA8BlB,GAAMG,CAAO,GAAG,SAAS;EACjJ;CACF,CAAC,GAGKgB,IAASC,QAAcxB,EAAe,QAAQ,CAACA,EAAe,MAAM,CAAC,GACrEyB,IAAaD,QAAcxB,EAAe,WAAW,CAACA,EAAe,SAAS,CAAC;CACrF,OAAOwB,SAAe;EAAE;EAAY;CAAO,IAAI,CAACC,GAAYF,CAAM,CAAC;AACrE"}
1
+ {"version":3,"file":"index.js","names":["useMutation","useCreateMutation","queryClient","container","QueryClientService","createMutation","queryFn","ObjectUtil","item","resourceQueryKey","oldItems","context","associationQueryKeys","onError","error","variables","NotificationService","NotificationUtil","getErrorNotificationMessage","notificationKey","getProgressNotificationMessage","previousData","temporaryId","StringUtil","x","onSuccess","getSuccessNotificationMessage","mutate","useMemo","isMutating"],"sources":["../../../src/hooks/useCreateMutation/useCreateMutation.ts"],"sourcesContent":["import { container } from 'tsyringe';\nimport { useMutation } from '@tanstack/react-query';\nimport type { ReactElement } from 'react';\nimport { useMemo } from 'react';\nimport { StringUtil } from '@gen-epix/ui-core/utils/StringUtil';\nimport { ObjectUtil } from '@gen-epix/ui-core/utils/ObjectUtil';\n\nimport { NotificationService } from '../../classes/services/NotificationService';\nimport type { GenericData } from '../../models/data.models';\nimport { NotificationUtil } from '../../utils/NotificationUtil';\nimport { QueryClientService } from '../../classes/services/QueryClientService';\n\n\nexport type MutationContextCreate<TData> = { notificationKey?: string; previousData?: TData[]; temporaryId?: string };\n\nexport type UseCreateMutationProps<TData extends GenericData | GenericData[], TVariables = TData> = {\n readonly associationQueryKeys?: string[][];\n readonly getErrorNotificationMessage: (data: TVariables, error: unknown) => ReactElement | string;\n readonly getProgressNotificationMessage: (data: TVariables) => ReactElement | string;\n readonly getSuccessNotificationMessage: (data: TData, context: MutationContextCreate<TData>) => ReactElement | string;\n readonly onError?: (error: unknown, variables: TVariables, context: MutationContextCreate<TData>) => Promise<void> | void;\n readonly onSuccess?: (item: TData, variables: TVariables, context: MutationContextCreate<TData>) => Promise<void> | void;\n readonly queryFn?: (item: TVariables) => Promise<TData>;\n readonly resourceQueryKey?: string[];\n};\n\nexport const useCreateMutation = <TData extends GenericData | GenericData[], TVariables = TData>({\n associationQueryKeys,\n getErrorNotificationMessage,\n getProgressNotificationMessage,\n getSuccessNotificationMessage,\n onError,\n onSuccess,\n queryFn,\n resourceQueryKey,\n}: UseCreateMutationProps<TData, TVariables>) => {\n const queryClient = container.resolve(QueryClientService).queryClient;\n\n const createMutation = useMutation<TData, Error, TVariables, MutationContextCreate<TData>>({\n mutationFn: async (item) => {\n return queryFn(ObjectUtil.deepNullifyEmptyStrings(item));\n },\n onError: async (error, variables, context) => {\n if (resourceQueryKey) {\n queryClient.setQueryData<TData[]>(resourceQueryKey, (oldItems: TData[]) => {\n if (!Array.isArray(oldItems)) {\n return oldItems;\n }\n return [...oldItems.filter(item => (item as GenericData)?.id !== context.temporaryId)];\n });\n }\n await container.resolve(QueryClientService).invalidateQueryKeys(associationQueryKeys);\n if (onError) {\n await onError(error, variables, context);\n }\n container.resolve(NotificationService).fulfillNotification(context.notificationKey, NotificationUtil.wrapErrorNotificationMessage(getErrorNotificationMessage(variables, error), error), 'error');\n },\n onMutate: async (variables) => {\n const notificationKey = container.resolve(NotificationService).showNotification({\n isLoading: true,\n message: getProgressNotificationMessage(variables),\n severity: 'info',\n });\n if (resourceQueryKey) {\n await queryClient.cancelQueries({ queryKey: resourceQueryKey });\n const previousData = queryClient.getQueryData<TData[]>(resourceQueryKey);\n if (Array.isArray(previousData)) {\n const temporaryId = StringUtil.createUuid();\n queryClient.setQueryData<TData[]>(resourceQueryKey, (oldItems: TData[]) => {\n return [\n {\n ...variables,\n id: temporaryId,\n },\n ...oldItems,\n ] as TData[];\n });\n return { notificationKey, previousData, temporaryId };\n }\n }\n return { notificationKey };\n },\n onSuccess: async (item, variables, context) => {\n if (resourceQueryKey && Array.isArray(context?.previousData) && !Array.isArray(item)) {\n queryClient.setQueryData<GenericData[]>(resourceQueryKey, (oldItems) => {\n return [\n item,\n ...oldItems.filter(x => x.id !== context.temporaryId),\n ];\n });\n }\n await container.resolve(QueryClientService).invalidateQueryKeys(associationQueryKeys);\n if (onSuccess) {\n await onSuccess(item, variables, context);\n }\n container.resolve(NotificationService).fulfillNotification(context.notificationKey, getSuccessNotificationMessage(item, context), 'success');\n },\n });\n\n // Note: must be done in useMemo to avoid render loops (useMutation returns a new object every time)\n const mutate = useMemo(() => createMutation.mutate, [createMutation.mutate]);\n const isMutating = useMemo(() => createMutation.isPending, [createMutation.isPending]);\n return useMemo(() => ({ isMutating, mutate }), [isMutating, mutate]);\n};\n"],"mappings":";;;;;;;;;AA0BA,IAAaC,KAAoF,EAC/F,yBACA,gCACA,mCACA,kCACA,YACA,cACA,YACA,0BAC+C;CAC/C,IAAMC,IAAcC,EAAU,QAAQC,CAAkB,CAAC,CAAC,aAEpDC,IAAiBL,EAAoE;EACzF,YAAY,OAAO,MACVM,EAAQC,EAAW,wBAAwBC,CAAI,CAAC;EAEzD,SAAS,OAAO,GAAO,GAAW,MAAY;GAa5C,AAZIC,KACFP,EAAY,aAAsBO,IAAmB,MAC9C,MAAM,QAAQC,CAAQ,IAGpB,CAAC,GAAGA,EAAS,QAAO,MAASF,GAAsB,OAAOG,EAAQ,WAAW,CAAC,IAF5ED,CAGV,GAEH,MAAMP,EAAU,QAAQC,CAAkB,CAAC,CAAC,oBAAoBQ,CAAoB,GAChFC,KACF,MAAMA,EAAQC,GAAOC,GAAWJ,CAAO,GAEzCR,EAAU,QAAQa,CAAmB,CAAC,CAAC,oBAAoBL,EAAQ,iBAAiBM,EAAiB,6BAA6BC,EAA4BH,GAAWD,CAAK,GAAGA,CAAK,GAAG,OAAO;EAClM;EACA,UAAU,OAAO,MAAc;GAC7B,IAAMK,IAAkBhB,EAAU,QAAQa,CAAmB,CAAC,CAAC,iBAAiB;IAC9E,WAAW;IACX,SAASI,EAA+BL,CAAS;IACjD,UAAU;GACZ,CAAC;GACD,IAAIN,GAAkB;IACpB,MAAMP,EAAY,cAAc,EAAE,UAAUO,EAAiB,CAAC;IAC9D,IAAMY,IAAenB,EAAY,aAAsBO,CAAgB;IACvE,IAAI,MAAM,QAAQY,CAAY,GAAG;KAC/B,IAAMC,IAAcC,EAAW,WAAW;KAU1C,OATArB,EAAY,aAAsBO,IAAmB,MAC5C,CACL;MACE,GAAGM;MACH,IAAIO;KACN,GACA,GAAGZ,CACL,CACD,GACM;MAAE;MAAiB;MAAc;KAAY;IACtD;GACF;GACA,OAAO,EAAE,mBAAgB;EAC3B;EACA,WAAW,OAAO,GAAM,GAAW,MAAY;GAa7C,AAZID,KAAoB,MAAM,QAAQE,GAAS,YAAY,KAAK,CAAC,MAAM,QAAQH,CAAI,KACjFN,EAAY,aAA4BO,IAAmB,MAClD,CACLD,GACA,GAAGE,EAAS,QAAO,MAAKc,EAAE,OAAOb,EAAQ,WAAW,CACtD,CACD,GAEH,MAAMR,EAAU,QAAQC,CAAkB,CAAC,CAAC,oBAAoBQ,CAAoB,GAChFa,KACF,MAAMA,EAAUjB,GAAMO,GAAWJ,CAAO,GAE1CR,EAAU,QAAQa,CAAmB,CAAC,CAAC,oBAAoBL,EAAQ,iBAAiBe,EAA8BlB,GAAMG,CAAO,GAAG,SAAS;EAC7I;CACF,CAAC,GAGKgB,IAASC,QAAcvB,EAAe,QAAQ,CAACA,EAAe,MAAM,CAAC,GACrEwB,IAAaD,QAAcvB,EAAe,WAAW,CAACA,EAAe,SAAS,CAAC;CACrF,OAAOuB,SAAe;EAAE;EAAY;CAAO,IAAI,CAACC,GAAYF,CAAM,CAAC;AACrE"}
@@ -1,15 +1,20 @@
1
- import { t as e } from "../../_chunks/QueryClientService.js";
2
- import { t } from "../../_chunks/useMutation.js";
3
- import { NotificationUtil as n } from "../../utils/NotificationUtil/index.js";
1
+ import { NotificationUtil as e } from "../../utils/NotificationUtil/index.js";
2
+ import { t } from "../../_chunks/QueryClientService.js";
3
+ import { t as n } from "../../_chunks/useMutation.js";
4
4
  import { NotificationService as r } from "../../classes/services/NotificationService/index.js";
5
5
  import { container as i } from "tsyringe";
6
6
  import { useMemo as a } from "react";
7
7
  //#region src/hooks/useDeleteMutation/useDeleteMutation.ts
8
8
  var o = ({ associationQueryKeys: o, getErrorNotificationMessage: s, getProgressNotificationMessage: c, getSuccessNotificationMessage: l, onError: u, onSuccess: d, queryFn: f, resourceQueryKey: p }) => {
9
- let m = i.resolve(e).queryClient, h = t({
10
- mutationFn: async (e) => f(e),
11
- onError: async (t, a, c) => {
12
- p && m.setQueryData(p, (e) => Array.isArray(e) ? [...e, a] : e), o && await i.resolve(e).invalidateQueryKeys(o), u && await u(t, a, c), i.resolve(r).fulfillNotification(c.notificationKey, n.wrapErrorNotificationMessage(s(a, t), t), "error");
9
+ let m = i.resolve(t).queryClient, h = n({
10
+ mutationFn: async (e) => {
11
+ if (!f) throw Error("Delete mutation queryFn is required");
12
+ return f(e);
13
+ },
14
+ onError: async (n, a, c) => {
15
+ p && Array.isArray(c.previousData) && m.setQueryData(p, c.previousData), o && await i.resolve(t).invalidateQueryKeys(o), u && await u(n, a, c);
16
+ let l = s?.(a, n) ?? String(n);
17
+ i.resolve(r).fulfillNotification(c.notificationKey, e.wrapErrorNotificationMessage(l, n), "error");
13
18
  },
14
19
  onMutate: async (e) => {
15
20
  let t = i.resolve(r).showNotification({
@@ -27,8 +32,10 @@ var o = ({ associationQueryKeys: o, getErrorNotificationMessage: s, getProgressN
27
32
  }
28
33
  return { notificationKey: t };
29
34
  },
30
- onSuccess: async (t, n, a) => {
31
- o && await i.resolve(e).invalidateQueryKeys(o), d && await d(n, a), i.resolve(r).fulfillNotification(a.notificationKey, l(n, a), "success");
35
+ onSuccess: async (e, n, a) => {
36
+ o && await i.resolve(t).invalidateQueryKeys(o), d && await d(n, a);
37
+ let s = l?.(n, a) ?? "Deleted successfully";
38
+ i.resolve(r).fulfillNotification(a.notificationKey, s, "success");
32
39
  }
33
40
  }), g = a(() => h.mutate, [h.mutate]), _ = a(() => h.isPending, [h.isPending]);
34
41
  return a(() => ({
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["rootContainer","QueryClientService","useDeleteMutation","queryClient","container","deleteMutation","useMutation","queryFn","item","resourceQueryKey","oldItems","associationQueryKeys","onError","error","context","NotificationService","NotificationUtil","getErrorNotificationMessage","notificationKey","getProgressNotificationMessage","previousData","i","onSuccess","getSuccessNotificationMessage","mutate","useMemo","isMutating"],"sources":["../../../src/hooks/useDeleteMutation/useDeleteMutation.ts"],"sourcesContent":["import { container as rootContainer } from 'tsyringe';\nimport { useMutation } from '@tanstack/react-query';\nimport type { ReactElement } from 'react';\nimport { useMemo } from 'react';\n\nimport { NotificationService } from '../../classes/services/NotificationService';\nimport type { GenericData } from '../../models/data.models';\nimport { NotificationUtil } from '../../utils/NotificationUtil';\nimport { QueryClientService } from '../../classes/services/QueryClientService';\n\n\nexport type MutationContextDelete<TData> = { notificationKey?: string; previousData?: TData[] };\n\nexport type UseDeleteMutationProps<TData> = {\n readonly associationQueryKeys?: string[][];\n readonly getErrorNotificationMessage?: (data: TData, error: unknown) => ReactElement | string;\n readonly getProgressNotificationMessage: (data: TData) => ReactElement | string;\n readonly getSuccessNotificationMessage?: (data: TData, context: MutationContextDelete<TData>) => ReactElement | string;\n readonly onError?: (error: unknown, item: TData, context: MutationContextDelete<TData>) => Promise<void> | void;\n readonly onSuccess?: (item: TData, context: MutationContextDelete<TData>) => Promise<void> | void;\n readonly queryFn?: (data: TData) => Promise<unknown>;\n readonly resourceQueryKey?: string[];\n};\n\nexport const useDeleteMutation = <TData extends GenericData | GenericData[]>({\n associationQueryKeys,\n getErrorNotificationMessage,\n getProgressNotificationMessage,\n getSuccessNotificationMessage,\n onError,\n onSuccess,\n queryFn,\n resourceQueryKey,\n}: UseDeleteMutationProps<TData>) => {\n const queryClient = rootContainer.resolve(QueryClientService).queryClient;\n\n const deleteMutation = useMutation<unknown, Error, TData, MutationContextDelete<TData>>({\n mutationFn: async (item) => {\n return queryFn(item);\n },\n onError: async (error, item, context) => {\n if (resourceQueryKey) {\n queryClient.setQueryData(resourceQueryKey, (oldItems: TData[]) => {\n if (!Array.isArray(oldItems)) {\n return oldItems;\n }\n return [...oldItems, item];\n });\n }\n if (associationQueryKeys) {\n await rootContainer.resolve(QueryClientService).invalidateQueryKeys(associationQueryKeys);\n }\n if (onError) {\n await onError(error, item, context);\n }\n rootContainer.resolve(NotificationService).fulfillNotification(context.notificationKey, NotificationUtil.wrapErrorNotificationMessage(getErrorNotificationMessage(item, error), error), 'error');\n },\n onMutate: async (item) => {\n const notificationKey = rootContainer.resolve(NotificationService).showNotification({\n isLoading: true,\n message: getProgressNotificationMessage(item),\n severity: 'info',\n });\n if (resourceQueryKey) {\n await queryClient.cancelQueries({ queryKey: resourceQueryKey });\n const previousData = queryClient.getQueryData<TData[]>(resourceQueryKey);\n\n if (Array.isArray(previousData) && !Array.isArray(item)) {\n queryClient.setQueryData<GenericData[]>(resourceQueryKey, (oldItems) => {\n return oldItems.filter(i => i.id !== item.id);\n });\n return { notificationKey, previousData };\n }\n }\n return { notificationKey };\n },\n onSuccess: async (_data, item, context) => {\n if (associationQueryKeys) {\n await rootContainer.resolve(QueryClientService).invalidateQueryKeys(associationQueryKeys);\n }\n if (onSuccess) {\n await onSuccess(item, context);\n }\n rootContainer.resolve(NotificationService).fulfillNotification(context.notificationKey, getSuccessNotificationMessage(item, context), 'success');\n },\n });\n\n // Note: must be done in useMemo to avoid render loops (useMutation returns a new object every time)\n const mutate = useMemo(() => deleteMutation.mutate, [deleteMutation.mutate]);\n const isMutating = useMemo(() => deleteMutation.isPending, [deleteMutation.isPending]);\n return useMemo(() => ({ isMutating, mutate }), [isMutating, mutate]);\n};\n"],"mappings":";;;;;;;AAwBA,IAAaE,KAAgE,EAC3E,yBACA,gCACA,mCACA,kCACA,YACA,cACA,YACA,0BACmC;CACnC,IAAMC,IAAcH,EAAc,QAAQC,CAAkB,CAAC,CAAC,aAExDI,IAAiBC,EAAiE;EACtF,YAAY,OAAO,MACVC,EAAQC,CAAI;EAErB,SAAS,OAAO,GAAO,GAAM,MAAY;GAevC,AAdIC,KACFN,EAAY,aAAaM,IAAmB,MACrC,MAAM,QAAQC,CAAQ,IAGpB,CAAC,GAAGA,GAAUF,CAAI,IAFhBE,CAGV,GAECC,KACF,MAAMX,EAAc,QAAQC,CAAkB,CAAC,CAAC,oBAAoBU,CAAoB,GAEtFC,KACF,MAAMA,EAAQC,GAAOL,GAAMM,CAAO,GAEpCV,EAAc,QAAQW,CAAmB,CAAC,CAAC,oBAAoBD,EAAQ,iBAAiBE,EAAiB,6BAA6BC,EAA4BT,GAAMK,CAAK,GAAGA,CAAK,GAAG,OAAO;EACjM;EACA,UAAU,OAAO,MAAS;GACxB,IAAMK,IAAkBlB,EAAc,QAAQe,CAAmB,CAAC,CAAC,iBAAiB;IAClF,WAAW;IACX,SAASI,EAA+BX,CAAI;IAC5C,UAAU;GACZ,CAAC;GACD,IAAIC,GAAkB;IACpB,MAAMN,EAAY,cAAc,EAAE,UAAUM,EAAiB,CAAC;IAC9D,IAAMW,IAAejB,EAAY,aAAsBM,CAAgB;IAEvE,IAAI,MAAM,QAAQW,CAAY,KAAK,CAAC,MAAM,QAAQZ,CAAI,GAIpD,OAHAL,EAAY,aAA4BM,IAAmB,MAClDC,EAAS,QAAO,MAAKW,EAAE,OAAOb,EAAK,EAAE,CAC7C,GACM;KAAE;KAAiB;IAAa;GAE3C;GACA,OAAO,EAAE,mBAAgB;EAC3B;EACA,WAAW,OAAO,GAAO,GAAM,MAAY;GAOzC,AANIG,KACF,MAAMX,EAAc,QAAQC,CAAkB,CAAC,CAAC,oBAAoBU,CAAoB,GAEtFW,KACF,MAAMA,EAAUd,GAAMM,CAAO,GAE/BV,EAAc,QAAQW,CAAmB,CAAC,CAAC,oBAAoBD,EAAQ,iBAAiBS,EAA8Bf,GAAMM,CAAO,GAAG,SAAS;EACjJ;CACF,CAAC,GAGKU,IAASC,QAAcpB,EAAe,QAAQ,CAACA,EAAe,MAAM,CAAC,GACrEqB,IAAaD,QAAcpB,EAAe,WAAW,CAACA,EAAe,SAAS,CAAC;CACrF,OAAOoB,SAAe;EAAE;EAAY;CAAO,IAAI,CAACC,GAAYF,CAAM,CAAC;AACrE"}
1
+ {"version":3,"file":"index.js","names":["useMutation","useDeleteMutation","queryClient","container","QueryClientService","deleteMutation","queryFn","item","resourceQueryKey","context","associationQueryKeys","onError","error","errorMessage","getErrorNotificationMessage","NotificationService","NotificationUtil","notificationKey","getProgressNotificationMessage","previousData","oldItems","i","onSuccess","successMessage","getSuccessNotificationMessage","mutate","useMemo","isMutating"],"sources":["../../../src/hooks/useDeleteMutation/useDeleteMutation.ts"],"sourcesContent":["import { container } from 'tsyringe';\nimport { useMutation } from '@tanstack/react-query';\nimport type { ReactElement } from 'react';\nimport { useMemo } from 'react';\n\nimport { NotificationService } from '../../classes/services/NotificationService';\nimport type { GenericData } from '../../models/data.models';\nimport { NotificationUtil } from '../../utils/NotificationUtil';\nimport { QueryClientService } from '../../classes/services/QueryClientService';\n\n\nexport type MutationContextDelete<TData> = { notificationKey?: string; previousData?: TData[] };\n\nexport type UseDeleteMutationProps<TData> = {\n readonly associationQueryKeys?: string[][];\n readonly getErrorNotificationMessage?: (data: TData, error: unknown) => ReactElement | string;\n readonly getProgressNotificationMessage: (data: TData) => ReactElement | string;\n readonly getSuccessNotificationMessage?: (data: TData, context: MutationContextDelete<TData>) => ReactElement | string;\n readonly onError?: (error: unknown, item: TData, context: MutationContextDelete<TData>) => Promise<void> | void;\n readonly onSuccess?: (item: TData, context: MutationContextDelete<TData>) => Promise<void> | void;\n readonly queryFn?: (data: TData) => Promise<unknown>;\n readonly resourceQueryKey?: string[];\n};\n\nexport const useDeleteMutation = <TData extends GenericData | GenericData[]>({\n associationQueryKeys,\n getErrorNotificationMessage,\n getProgressNotificationMessage,\n getSuccessNotificationMessage,\n onError,\n onSuccess,\n queryFn,\n resourceQueryKey,\n}: UseDeleteMutationProps<TData>) => {\n const queryClient = container.resolve(QueryClientService).queryClient;\n\n const deleteMutation = useMutation<unknown, Error, TData, MutationContextDelete<TData>>({\n mutationFn: async (item) => {\n if (!queryFn) {\n throw new Error('Delete mutation queryFn is required');\n }\n return queryFn(item);\n },\n onError: async (error, item, context) => {\n if (resourceQueryKey && Array.isArray(context.previousData)) {\n queryClient.setQueryData<TData[]>(resourceQueryKey, context.previousData);\n }\n if (associationQueryKeys) {\n await container.resolve(QueryClientService).invalidateQueryKeys(associationQueryKeys);\n }\n if (onError) {\n await onError(error, item, context);\n }\n const errorMessage = getErrorNotificationMessage?.(item, error) ?? String(error);\n container.resolve(NotificationService).fulfillNotification(context.notificationKey, NotificationUtil.wrapErrorNotificationMessage(errorMessage, error), 'error');\n },\n onMutate: async (item) => {\n const notificationKey = container.resolve(NotificationService).showNotification({\n isLoading: true,\n message: getProgressNotificationMessage(item),\n severity: 'info',\n });\n if (resourceQueryKey) {\n await queryClient.cancelQueries({ queryKey: resourceQueryKey });\n const previousData = queryClient.getQueryData<TData[]>(resourceQueryKey);\n\n if (Array.isArray(previousData) && !Array.isArray(item)) {\n queryClient.setQueryData<GenericData[]>(resourceQueryKey, (oldItems) => {\n return oldItems.filter(i => i.id !== item.id);\n });\n return { notificationKey, previousData };\n }\n }\n return { notificationKey };\n },\n onSuccess: async (_data, item, context) => {\n if (associationQueryKeys) {\n await container.resolve(QueryClientService).invalidateQueryKeys(associationQueryKeys);\n }\n if (onSuccess) {\n await onSuccess(item, context);\n }\n const successMessage = getSuccessNotificationMessage?.(item, context) ?? 'Deleted successfully';\n container.resolve(NotificationService).fulfillNotification(context.notificationKey, successMessage, 'success');\n },\n });\n\n // Note: must be done in useMemo to avoid render loops (useMutation returns a new object every time)\n const mutate = useMemo(() => deleteMutation.mutate, [deleteMutation.mutate]);\n const isMutating = useMemo(() => deleteMutation.isPending, [deleteMutation.isPending]);\n return useMemo(() => ({ isMutating, mutate }), [isMutating, mutate]);\n};\n"],"mappings":";;;;;;;AAwBA,IAAaC,KAAgE,EAC3E,yBACA,gCACA,mCACA,kCACA,YACA,cACA,YACA,0BACmC;CACnC,IAAMC,IAAcC,EAAU,QAAQC,CAAkB,CAAC,CAAC,aAEpDC,IAAiBL,EAAiE;EACtF,YAAY,OAAO,MAAS;GAC1B,IAAI,CAACM,GACH,MAAU,MAAM,qCAAqC;GAEvD,OAAOA,EAAQC,CAAI;EACrB;EACA,SAAS,OAAO,GAAO,GAAM,MAAY;GAOvC,AANIC,KAAoB,MAAM,QAAQC,EAAQ,YAAY,KACxDP,EAAY,aAAsBM,GAAkBC,EAAQ,YAAY,GAEtEC,KACF,MAAMP,EAAU,QAAQC,CAAkB,CAAC,CAAC,oBAAoBM,CAAoB,GAElFC,KACF,MAAMA,EAAQC,GAAOL,GAAME,CAAO;GAEpC,IAAMI,IAAeC,IAA8BP,GAAMK,CAAK,KAAK,OAAOA,CAAK;GAC/E,EAAU,QAAQG,CAAmB,CAAC,CAAC,oBAAoBN,EAAQ,iBAAiBO,EAAiB,6BAA6BH,GAAcD,CAAK,GAAG,OAAO;EACjK;EACA,UAAU,OAAO,MAAS;GACxB,IAAMK,IAAkBd,EAAU,QAAQY,CAAmB,CAAC,CAAC,iBAAiB;IAC9E,WAAW;IACX,SAASG,EAA+BX,CAAI;IAC5C,UAAU;GACZ,CAAC;GACD,IAAIC,GAAkB;IACpB,MAAMN,EAAY,cAAc,EAAE,UAAUM,EAAiB,CAAC;IAC9D,IAAMW,IAAejB,EAAY,aAAsBM,CAAgB;IAEvE,IAAI,MAAM,QAAQW,CAAY,KAAK,CAAC,MAAM,QAAQZ,CAAI,GAIpD,OAHAL,EAAY,aAA4BM,IAAmB,MAClDY,EAAS,QAAO,MAAKC,EAAE,OAAOd,EAAK,EAAE,CAC7C,GACM;KAAE;KAAiB;IAAa;GAE3C;GACA,OAAO,EAAE,mBAAgB;EAC3B;EACA,WAAW,OAAO,GAAO,GAAM,MAAY;GAIzC,AAHIG,KACF,MAAMP,EAAU,QAAQC,CAAkB,CAAC,CAAC,oBAAoBM,CAAoB,GAElFY,KACF,MAAMA,EAAUf,GAAME,CAAO;GAE/B,IAAMc,IAAiBC,IAAgCjB,GAAME,CAAO,KAAK;GACzE,EAAU,QAAQM,CAAmB,CAAC,CAAC,oBAAoBN,EAAQ,iBAAiBc,GAAgB,SAAS;EAC/G;CACF,CAAC,GAGKE,IAASC,QAAcrB,EAAe,QAAQ,CAACA,EAAe,MAAM,CAAC,GACrEsB,IAAaD,QAAcrB,EAAe,WAAW,CAACA,EAAe,SAAS,CAAC;CACrF,OAAOqB,SAAe;EAAE;EAAY;CAAO,IAAI,CAACC,GAAYF,CAAM,CAAC;AACrE"}
@@ -1,58 +1,73 @@
1
- import { t as e } from "../../_chunks/QueryClientService.js";
2
- import { t } from "../../_chunks/useMutation.js";
3
- import { NotificationUtil as n } from "../../utils/NotificationUtil/index.js";
1
+ import { NotificationUtil as e } from "../../utils/NotificationUtil/index.js";
2
+ import { t } from "../../_chunks/QueryClientService.js";
3
+ import { t as n } from "../../_chunks/useMutation.js";
4
4
  import { NotificationService as r } from "../../classes/services/NotificationService/index.js";
5
5
  import { container as i } from "tsyringe";
6
6
  import { useCallback as a, useMemo as o, useRef as s } from "react";
7
7
  import { ObjectUtil as c } from "@gen-epix/ui-core/utils/ObjectUtil";
8
8
  //#region src/hooks/useEditMutation/useEditMutation.ts
9
- var l = ({ associationQueryKeys: l, getErrorNotificationMessage: u, getIntermediateItem: d, getProgressNotificationMessage: f, getSuccessNotificationMessage: p, onError: m, onSuccess: h, queryFn: g, resourceQueryKey: _ }) => {
10
- let v = i.resolve(e).queryClient, y = s(void 0), b = a((e) => {
11
- y.current = e;
12
- }, []), x = a(async (e) => g(c.deepNullifyEmptyStrings(e), y.current), [y, g]), S = t({
13
- mutationFn: x,
14
- onError: async (t, a, o) => {
15
- y.current = void 0, _ && Array.isArray(o.previousData) && v.setQueryData(_, (e) => Array.isArray(e) ? [...e.filter((e) => e.id !== o.item.id), o.item] : e), await i.resolve(e).invalidateQueryKeys(l), m && await m(t, a, o), i.resolve(r).fulfillNotification(o.notificationKey, n.wrapErrorNotificationMessage(u(o.item, a, t), t), "error");
9
+ var l = (e) => !Array.isArray(e), u = ({ associationQueryKeys: u, getErrorNotificationMessage: d, getIntermediateItem: f, getProgressNotificationMessage: p, getSuccessNotificationMessage: m, onError: h, onSuccess: g, queryFn: _, resourceQueryKey: v }) => {
10
+ let y = i.resolve(t).queryClient, b = s(void 0), x = a((e) => {
11
+ b.current = e;
12
+ }, []), S = a(async (e) => {
13
+ if (!_) throw Error("Edit mutation queryFn is required");
14
+ return _(c.deepNullifyEmptyStrings(e), b.current);
15
+ }, [b, _]), C = n({
16
+ mutationFn: S,
17
+ onError: async (n, a, o) => {
18
+ b.current = void 0;
19
+ let s = o ?? {};
20
+ v && Array.isArray(s.previousData) && y.setQueryData(v, s.previousData), await i.resolve(t).invalidateQueryKeys(u), h && await h(n, a, s);
21
+ let c = s.item ? d(s.item, a, n) : String(n);
22
+ s.notificationKey && i.resolve(r).fulfillNotification(s.notificationKey, e.wrapErrorNotificationMessage(c, n), "error");
16
23
  },
17
24
  onMutate: async (e) => {
18
- let t = i.resolve(r).showNotification({
25
+ let t = b.current;
26
+ if (!t) throw Error("previousItem is not set");
27
+ let n = i.resolve(r).showNotification({
19
28
  isLoading: !0,
20
- message: f(y.current, e),
29
+ message: p(t, e),
21
30
  severity: "info"
22
31
  });
23
- if (_) {
24
- if (!y.current) throw Error("previousItem is not set");
25
- await v.cancelQueries({ queryKey: _ });
26
- let n = v.getQueryData(_);
27
- if (Array.isArray(n) && !Array.isArray(e)) {
28
- let r = d ? d(e, y.current) : {
32
+ if (v) {
33
+ await y.cancelQueries({ queryKey: v });
34
+ let r = y.getQueryData(v);
35
+ if (Array.isArray(r) && !Array.isArray(e)) {
36
+ let i = f ? f(e, t) : {
29
37
  ...e,
30
- id: y.current.id
38
+ id: t.id
31
39
  };
32
- return v.setQueryData(_, (e) => [...e.filter((e) => e.id !== y.current.id), r]), {
33
- item: y.current,
34
- notificationKey: t,
35
- previousData: n
40
+ return y.setQueryData(v, (e) => e.map((e) => e.id === t.id ? i : e)), {
41
+ item: t,
42
+ notificationKey: n,
43
+ previousData: r
36
44
  };
37
45
  }
38
46
  }
39
- return { notificationKey: t };
47
+ return {
48
+ item: t,
49
+ notificationKey: n
50
+ };
40
51
  },
41
- onSuccess: async (t, n, a) => {
42
- y.current = void 0, await i.resolve(e).invalidateQueryKeys(l), h && await h(t, n, a), i.resolve(r).fulfillNotification(a.notificationKey, p(t, a), "success");
52
+ onSuccess: async (e, n, a) => {
53
+ if (b.current = void 0, v && Array.isArray(a?.previousData) && l(e)) {
54
+ let t = a.item?.id;
55
+ y.setQueryData(v, (n) => Array.isArray(n) ? n.map((n) => n.id === t ? e : n) : n);
56
+ }
57
+ await i.resolve(t).invalidateQueryKeys(u), g && await g(e, n, a), i.resolve(r).fulfillNotification(a.notificationKey, m(e, a), "success");
43
58
  }
44
- }), C = o(() => S.mutate, [S.mutate]), w = o(() => S.isPending, [S.isPending]);
59
+ }), w = o(() => C.mutate, [C.mutate]), T = o(() => C.isPending, [C.isPending]);
45
60
  return o(() => ({
46
- isMutating: w,
47
- mutate: C,
48
- setPreviousItem: b
61
+ isMutating: T,
62
+ mutate: w,
63
+ setPreviousItem: x
49
64
  }), [
65
+ T,
50
66
  w,
51
- C,
52
- b
67
+ x
53
68
  ]);
54
69
  };
55
70
  //#endregion
56
- export { l as useEditMutation };
71
+ export { u as useEditMutation };
57
72
 
58
73
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["rootContainer","QueryClientService","useEditMutation","queryClient","container","previousItemRef","useRef","setPreviousItem","useCallback","item","mutationFn","queryFn","ObjectUtil","variables","editMutation","useMutation","resourceQueryKey","context","oldItems","x","associationQueryKeys","onError","error","NotificationService","NotificationUtil","getErrorNotificationMessage","notificationKey","getProgressNotificationMessage","previousData","intermediateItem","getIntermediateItem","onSuccess","getSuccessNotificationMessage","mutate","useMemo","isMutating"],"sources":["../../../src/hooks/useEditMutation/useEditMutation.ts"],"sourcesContent":["import { container as rootContainer } from 'tsyringe';\nimport { useMutation } from '@tanstack/react-query';\nimport type { ReactElement } from 'react';\nimport {\n useCallback,\n useMemo,\n useRef,\n} from 'react';\nimport { ObjectUtil } from '@gen-epix/ui-core/utils/ObjectUtil';\n\nimport { NotificationService } from '../../classes/services/NotificationService';\nimport { QueryClientService } from '../../classes/services/QueryClientService';\nimport type { GenericData } from '../../models/data.models';\nimport { NotificationUtil } from '../../utils/NotificationUtil';\n\nexport type MutationContextEdit<TData> = { item?: TData; notificationKey?: string; previousData?: TData[] };\n\nexport type UseEditMutationProps<TData, TVariables = TData> = {\n readonly associationQueryKeys?: string[][];\n readonly getErrorNotificationMessage: (data: TData, variables: TVariables, error: unknown) => ReactElement | string;\n // Optional function to get an intermediate item to be set in the query cache before the mutation is completed.\n // This is useful for optimistic updates where you want to show a temporary state before the mutation is confirmed.\n // The function receives the variables and the previous item, and should return the intermediate item.\n // Only needed if the variables are different from the previous item.\n readonly getIntermediateItem?: (variables: TVariables, previousItem: TData) => TData;\n readonly getProgressNotificationMessage: (data: TData, variables: TVariables) => ReactElement | string;\n readonly getSuccessNotificationMessage: (data: TData, context: MutationContextEdit<TData>) => ReactElement | string;\n readonly onError?: (error: unknown, variables: TVariables, context: MutationContextEdit<TData>) => Promise<void> | void;\n readonly onSuccess?: (item: TData, variables: TVariables, context: MutationContextEdit<TData>) => Promise<void> | void;\n readonly queryFn?: (variables: TVariables, previousData: TData) => Promise<TData>;\n readonly resourceQueryKey?: string[];\n};\n\nexport const useEditMutation = <TData extends GenericData | GenericData[], TVariables = TData>({\n associationQueryKeys,\n getErrorNotificationMessage,\n getIntermediateItem,\n getProgressNotificationMessage,\n getSuccessNotificationMessage,\n onError,\n onSuccess,\n queryFn,\n resourceQueryKey,\n}: UseEditMutationProps<TData, TVariables>) => {\n const queryClient = rootContainer.resolve(QueryClientService).queryClient;\n const previousItemRef = useRef<TData>(undefined);\n\n const setPreviousItem = useCallback((item: TData) => {\n previousItemRef.current = item;\n }, []);\n\n const mutationFn = useCallback(async (variables: TVariables) => {\n return queryFn(ObjectUtil.deepNullifyEmptyStrings(variables), previousItemRef.current);\n }, [previousItemRef, queryFn]);\n\n const editMutation = useMutation<TData, Error, TVariables, MutationContextEdit<TData>>({\n mutationFn,\n onError: async (error, variables, context) => {\n previousItemRef.current = undefined;\n if (resourceQueryKey && Array.isArray(context.previousData)) {\n queryClient.setQueryData(resourceQueryKey, (oldItems: TData[]) => {\n if (!Array.isArray(oldItems)) {\n return oldItems;\n }\n return [...oldItems.filter(x => (x as GenericData).id !== (context.item as GenericData).id), context.item];\n });\n }\n await rootContainer.resolve(QueryClientService).invalidateQueryKeys(associationQueryKeys);\n if (onError) {\n await onError(error, variables, context);\n }\n rootContainer.resolve(NotificationService).fulfillNotification(context.notificationKey, NotificationUtil.wrapErrorNotificationMessage(getErrorNotificationMessage(context.item, variables, error), error), 'error');\n },\n onMutate: async (variables) => {\n const notificationKey = rootContainer.resolve(NotificationService).showNotification({\n isLoading: true,\n message: getProgressNotificationMessage(previousItemRef.current, variables),\n severity: 'info',\n });\n if (resourceQueryKey) {\n if (!previousItemRef.current) {\n throw new Error('previousItem is not set');\n }\n await queryClient.cancelQueries({ queryKey: resourceQueryKey });\n const previousData = queryClient.getQueryData<TData[]>(resourceQueryKey);\n if (Array.isArray(previousData) && !Array.isArray(variables)) {\n const intermediateItem = getIntermediateItem ? getIntermediateItem(variables, previousItemRef.current) : {\n ...variables,\n id: (previousItemRef.current as GenericData).id,\n } as GenericData;\n queryClient.setQueryData<GenericData[]>(resourceQueryKey, (oldItems) => {\n return [...oldItems.filter(x => x.id !== (previousItemRef.current as GenericData).id), intermediateItem] as GenericData[];\n });\n return { item: previousItemRef.current, notificationKey, previousData };\n }\n }\n return { notificationKey };\n },\n onSuccess: async (item, variables, context) => {\n previousItemRef.current = undefined;\n await rootContainer.resolve(QueryClientService).invalidateQueryKeys(associationQueryKeys);\n if (onSuccess) {\n await onSuccess(item, variables, context);\n }\n rootContainer.resolve(NotificationService).fulfillNotification(context.notificationKey, getSuccessNotificationMessage(item, context), 'success');\n },\n });\n\n // Note: must be done in useMemo to avoid render loops (useMutation returns a new object every time)\n const mutate = useMemo(() => editMutation.mutate, [editMutation.mutate]);\n const isMutating = useMemo(() => editMutation.isPending, [editMutation.isPending]);\n return useMemo(() => ({ isMutating, mutate, setPreviousItem }), [isMutating, mutate, setPreviousItem]);\n};\n"],"mappings":";;;;;;;;AAiCA,IAAaE,KAAkF,EAC7F,yBACA,gCACA,wBACA,mCACA,kCACA,YACA,cACA,YACA,0BAC6C;CAC7C,IAAMC,IAAcH,EAAc,QAAQC,CAAkB,CAAC,CAAC,aACxDI,IAAkBC,EAAc,KAAA,CAAS,GAEzCC,IAAkBC,GAAa,MAAgB;EACnD,EAAgB,UAAUC;CAC5B,GAAG,CAAC,CAAC,GAECC,IAAaF,EAAY,OAAO,MAC7BG,EAAQC,EAAW,wBAAwBC,CAAS,GAAGR,EAAgB,OAAO,GACpF,CAACA,GAAiBM,CAAO,CAAC,GAEvBG,IAAeC,EAAkE;EACrF;EACA,SAAS,OAAO,GAAO,GAAW,MAAY;GAc5C,AAbA,EAAgB,UAAU,KAAA,GACtBC,KAAoB,MAAM,QAAQC,EAAQ,YAAY,KACxDd,EAAY,aAAaa,IAAmB,MACrC,MAAM,QAAQE,CAAQ,IAGpB,CAAC,GAAGA,EAAS,QAAO,MAAMC,EAAkB,OAAQF,EAAQ,KAAqB,EAAE,GAAGA,EAAQ,IAAI,IAFhGC,CAGV,GAEH,MAAMlB,EAAc,QAAQC,CAAkB,CAAC,CAAC,oBAAoBmB,CAAoB,GACpFC,KACF,MAAMA,EAAQC,GAAOT,GAAWI,CAAO,GAEzCb,EAAc,QAAQmB,CAAmB,CAAC,CAAC,oBAAoBN,EAAQ,iBAAiBO,EAAiB,6BAA6BC,EAA4BR,EAAQ,MAAMJ,GAAWS,CAAK,GAAGA,CAAK,GAAG,OAAO;EACpN;EACA,UAAU,OAAO,MAAc;GAC7B,IAAMI,IAAkB1B,EAAc,QAAQuB,CAAmB,CAAC,CAAC,iBAAiB;IAClF,WAAW;IACX,SAASI,EAA+BtB,EAAgB,SAASQ,CAAS;IAC1E,UAAU;GACZ,CAAC;GACD,IAAIG,GAAkB;IACpB,IAAI,CAACX,EAAgB,SACnB,MAAU,MAAM,yBAAyB;IAE3C,MAAMF,EAAY,cAAc,EAAE,UAAUa,EAAiB,CAAC;IAC9D,IAAMY,IAAezB,EAAY,aAAsBa,CAAgB;IACvE,IAAI,MAAM,QAAQY,CAAY,KAAK,CAAC,MAAM,QAAQf,CAAS,GAAG;KAC5D,IAAMgB,IAAmBC,IAAsBA,EAAoBjB,GAAWR,EAAgB,OAAO,IAAI;MACvG,GAAGQ;MACH,IAAKR,EAAgB,QAAwB;KAC/C;KAIA,OAHAF,EAAY,aAA4Ba,IAAmB,MAClD,CAAC,GAAGE,EAAS,QAAO,MAAKC,EAAE,OAAQd,EAAgB,QAAwB,EAAE,GAAGwB,CAAgB,CACxG,GACM;MAAE,MAAMxB,EAAgB;MAAS;MAAiB;KAAa;IACxE;GACF;GACA,OAAO,EAAE,mBAAgB;EAC3B;EACA,WAAW,OAAO,GAAM,GAAW,MAAY;GAM7C,AALA,EAAgB,UAAU,KAAA,GAC1B,MAAML,EAAc,QAAQC,CAAkB,CAAC,CAAC,oBAAoBmB,CAAoB,GACpFW,KACF,MAAMA,EAAUtB,GAAMI,GAAWI,CAAO,GAE1Cb,EAAc,QAAQmB,CAAmB,CAAC,CAAC,oBAAoBN,EAAQ,iBAAiBe,EAA8BvB,GAAMQ,CAAO,GAAG,SAAS;EACjJ;CACF,CAAC,GAGKgB,IAASC,QAAcpB,EAAa,QAAQ,CAACA,EAAa,MAAM,CAAC,GACjEqB,IAAaD,QAAcpB,EAAa,WAAW,CAACA,EAAa,SAAS,CAAC;CACjF,OAAOoB,SAAe;EAAE;EAAY;EAAQ;CAAgB,IAAI;EAACC;EAAYF;EAAQ1B;CAAe,CAAC;AACvG"}
1
+ {"version":3,"file":"index.js","names":["useMutation","isSingleGenericData","item","useEditMutation","queryClient","container","QueryClientService","previousItemRef","useRef","setPreviousItem","useCallback","mutationFn","queryFn","ObjectUtil","variables","editMutation","safeContext","context","resourceQueryKey","associationQueryKeys","onError","error","errorMessage","getErrorNotificationMessage","NotificationService","NotificationUtil","previousItem","notificationKey","getProgressNotificationMessage","previousData","intermediateItem","getIntermediateItem","oldItems","x","previousItemId","oldItem","onSuccess","getSuccessNotificationMessage","mutate","useMemo","isMutating"],"sources":["../../../src/hooks/useEditMutation/useEditMutation.ts"],"sourcesContent":["import { container } from 'tsyringe';\nimport { useMutation } from '@tanstack/react-query';\nimport type { ReactElement } from 'react';\nimport {\n useCallback,\n useMemo,\n useRef,\n} from 'react';\nimport { ObjectUtil } from '@gen-epix/ui-core/utils/ObjectUtil';\n\nimport { NotificationService } from '../../classes/services/NotificationService';\nimport { QueryClientService } from '../../classes/services/QueryClientService';\nimport type { GenericData } from '../../models/data.models';\nimport { NotificationUtil } from '../../utils/NotificationUtil';\n\nexport type MutationContextEdit<TData> = { item?: TData; notificationKey?: string; previousData?: TData[] };\n\nexport type UseEditMutationProps<TData, TVariables = TData> = {\n readonly associationQueryKeys?: string[][];\n readonly getErrorNotificationMessage: (data: TData, variables: TVariables, error: unknown) => ReactElement | string;\n // Optional function to get an intermediate item to be set in the query cache before the mutation is completed.\n // This is useful for optimistic updates where you want to show a temporary state before the mutation is confirmed.\n // The function receives the variables and the previous item, and should return the intermediate item.\n // Only needed if the variables are different from the previous item.\n readonly getIntermediateItem?: (variables: TVariables, previousItem: TData) => TData;\n readonly getProgressNotificationMessage: (data: TData, variables: TVariables) => ReactElement | string;\n readonly getSuccessNotificationMessage: (data: TData, context: MutationContextEdit<TData>) => ReactElement | string;\n readonly onError?: (error: unknown, variables: TVariables, context: MutationContextEdit<TData>) => Promise<void> | void;\n readonly onSuccess?: (item: TData, variables: TVariables, context: MutationContextEdit<TData>) => Promise<void> | void;\n readonly queryFn?: (variables: TVariables, previousData: TData) => Promise<TData>;\n readonly resourceQueryKey?: string[];\n};\n\nconst isSingleGenericData = (item: GenericData | GenericData[]): item is GenericData => !Array.isArray(item);\n\nexport const useEditMutation = <TData extends GenericData | GenericData[], TVariables = TData>({\n associationQueryKeys,\n getErrorNotificationMessage,\n getIntermediateItem,\n getProgressNotificationMessage,\n getSuccessNotificationMessage,\n onError,\n onSuccess,\n queryFn,\n resourceQueryKey,\n}: UseEditMutationProps<TData, TVariables>) => {\n const queryClient = container.resolve(QueryClientService).queryClient;\n const previousItemRef = useRef<TData>(undefined);\n\n const setPreviousItem = useCallback((item: TData) => {\n previousItemRef.current = item;\n }, []);\n\n const mutationFn = useCallback(async (variables: TVariables) => {\n if (!queryFn) {\n throw new Error('Edit mutation queryFn is required');\n }\n return queryFn(ObjectUtil.deepNullifyEmptyStrings(variables), previousItemRef.current);\n }, [previousItemRef, queryFn]);\n\n const editMutation = useMutation<TData, Error, TVariables, MutationContextEdit<TData>>({\n mutationFn,\n onError: async (error, variables, context) => {\n previousItemRef.current = undefined;\n const safeContext: MutationContextEdit<TData> = context ?? {};\n if (resourceQueryKey && Array.isArray(safeContext.previousData)) {\n queryClient.setQueryData<TData[]>(resourceQueryKey, safeContext.previousData);\n }\n await container.resolve(QueryClientService).invalidateQueryKeys(associationQueryKeys);\n if (onError) {\n await onError(error, variables, safeContext);\n }\n const errorMessage = safeContext.item\n ? getErrorNotificationMessage(safeContext.item, variables, error)\n : String(error);\n if (safeContext.notificationKey) {\n container.resolve(NotificationService).fulfillNotification(safeContext.notificationKey, NotificationUtil.wrapErrorNotificationMessage(errorMessage, error), 'error');\n }\n },\n onMutate: async (variables) => {\n const previousItem = previousItemRef.current;\n if (!previousItem) {\n throw new Error('previousItem is not set');\n }\n const notificationKey = container.resolve(NotificationService).showNotification({\n isLoading: true,\n message: getProgressNotificationMessage(previousItem, variables),\n severity: 'info',\n });\n if (resourceQueryKey) {\n await queryClient.cancelQueries({ queryKey: resourceQueryKey });\n const previousData = queryClient.getQueryData<TData[]>(resourceQueryKey);\n\n if (Array.isArray(previousData) && !Array.isArray(variables)) {\n const intermediateItem = getIntermediateItem ? getIntermediateItem(variables, previousItem) : {\n ...variables,\n id: (previousItem as GenericData).id,\n } as GenericData;\n queryClient.setQueryData<GenericData[]>(resourceQueryKey, (oldItems) => {\n return oldItems.map(x => x.id === (previousItem as GenericData).id ? intermediateItem : x) as GenericData[];\n });\n return { item: previousItem, notificationKey, previousData };\n }\n }\n return { item: previousItem, notificationKey };\n },\n onSuccess: async (item, variables, context) => {\n previousItemRef.current = undefined;\n if (resourceQueryKey && Array.isArray(context?.previousData) && isSingleGenericData(item)) {\n const previousItemId = (context.item as GenericData)?.id;\n queryClient.setQueryData<GenericData[]>(resourceQueryKey, (oldItems) => {\n if (!Array.isArray(oldItems)) {\n return oldItems;\n }\n return oldItems.map(oldItem => oldItem.id === previousItemId ? item : oldItem);\n });\n }\n await container.resolve(QueryClientService).invalidateQueryKeys(associationQueryKeys);\n if (onSuccess) {\n await onSuccess(item, variables, context);\n }\n container.resolve(NotificationService).fulfillNotification(context.notificationKey, getSuccessNotificationMessage(item, context), 'success');\n },\n });\n\n // Note: must be done in useMemo to avoid render loops (useMutation returns a new object every time)\n const mutate = useMemo(() => editMutation.mutate, [editMutation.mutate]);\n const isMutating = useMemo(() => editMutation.isPending, [editMutation.isPending]);\n return useMemo(() => ({ isMutating, mutate, setPreviousItem }), [isMutating, mutate, setPreviousItem]);\n};\n"],"mappings":";;;;;;;;AAiCA,IAAMC,KAAuB,MAA2D,CAAC,MAAM,QAAQC,CAAI,GAE9FC,KAAkF,EAC7F,yBACA,gCACA,wBACA,mCACA,kCACA,YACA,cACA,YACA,0BAC6C;CAC7C,IAAMC,IAAcC,EAAU,QAAQC,CAAkB,CAAC,CAAC,aACpDC,IAAkBC,EAAc,KAAA,CAAS,GAEzCC,IAAkBC,GAAa,MAAgB;EACnD,EAAgB,UAAUR;CAC5B,GAAG,CAAC,CAAC,GAECS,IAAaD,EAAY,OAAO,MAA0B;EAC9D,IAAI,CAACE,GACH,MAAU,MAAM,mCAAmC;EAErD,OAAOA,EAAQC,EAAW,wBAAwBC,CAAS,GAAGP,EAAgB,OAAO;CACvF,GAAG,CAACA,GAAiBK,CAAO,CAAC,GAEvBG,IAAef,EAAkE;EACrF;EACA,SAAS,OAAO,GAAO,GAAW,MAAY;GAC5C,EAAgB,UAAU,KAAA;GAC1B,IAAMgB,IAA0CC,KAAW,CAAC;GAK5D,AAJIC,KAAoB,MAAM,QAAQF,EAAY,YAAY,KAC5DZ,EAAY,aAAsBc,GAAkBF,EAAY,YAAY,GAE9E,MAAMX,EAAU,QAAQC,CAAkB,CAAC,CAAC,oBAAoBa,CAAoB,GAChFC,KACF,MAAMA,EAAQC,GAAOP,GAAWE,CAAW;GAE7C,IAAMM,IAAeN,EAAY,OAC7BO,EAA4BP,EAAY,MAAMF,GAAWO,CAAK,IAC9D,OAAOA,CAAK;GAChB,AAAIL,EAAY,mBACdX,EAAU,QAAQmB,CAAmB,CAAC,CAAC,oBAAoBR,EAAY,iBAAiBS,EAAiB,6BAA6BH,GAAcD,CAAK,GAAG,OAAO;EAEvK;EACA,UAAU,OAAO,MAAc;GAC7B,IAAMK,IAAenB,EAAgB;GACrC,IAAI,CAACmB,GACH,MAAU,MAAM,yBAAyB;GAE3C,IAAMC,IAAkBtB,EAAU,QAAQmB,CAAmB,CAAC,CAAC,iBAAiB;IAC9E,WAAW;IACX,SAASI,EAA+BF,GAAcZ,CAAS;IAC/D,UAAU;GACZ,CAAC;GACD,IAAII,GAAkB;IACpB,MAAMd,EAAY,cAAc,EAAE,UAAUc,EAAiB,CAAC;IAC9D,IAAMW,IAAezB,EAAY,aAAsBc,CAAgB;IAEvE,IAAI,MAAM,QAAQW,CAAY,KAAK,CAAC,MAAM,QAAQf,CAAS,GAAG;KAC5D,IAAMgB,IAAmBC,IAAsBA,EAAoBjB,GAAWY,CAAY,IAAI;MAC5F,GAAGZ;MACH,IAAKY,EAA6B;KACpC;KAIA,OAHAtB,EAAY,aAA4Bc,IAAmB,MAClDc,EAAS,KAAI,MAAKC,EAAE,OAAQP,EAA6B,KAAKI,IAAmBG,CAAC,CAC1F,GACM;MAAE,MAAMP;MAAc;MAAiB;KAAa;IAC7D;GACF;GACA,OAAO;IAAE,MAAMA;IAAc;GAAgB;EAC/C;EACA,WAAW,OAAO,GAAM,GAAW,MAAY;GAE7C,IADA,EAAgB,UAAU,KAAA,GACtBR,KAAoB,MAAM,QAAQD,GAAS,YAAY,KAAKhB,EAAoBC,CAAI,GAAG;IACzF,IAAMgC,IAAkBjB,EAAQ,MAAsB;IACtD,EAAY,aAA4BC,IAAmB,MACpD,MAAM,QAAQc,CAAQ,IAGpBA,EAAS,KAAI,MAAWG,EAAQ,OAAOD,IAAiBhC,IAAOiC,CAAO,IAFpEH,CAGV;GACH;GAKA,AAJA,MAAM3B,EAAU,QAAQC,CAAkB,CAAC,CAAC,oBAAoBa,CAAoB,GAChFiB,KACF,MAAMA,EAAUlC,GAAMY,GAAWG,CAAO,GAE1CZ,EAAU,QAAQmB,CAAmB,CAAC,CAAC,oBAAoBP,EAAQ,iBAAiBoB,EAA8BnC,GAAMe,CAAO,GAAG,SAAS;EAC7I;CACF,CAAC,GAGKqB,IAASC,QAAcxB,EAAa,QAAQ,CAACA,EAAa,MAAM,CAAC,GACjEyB,IAAaD,QAAcxB,EAAa,WAAW,CAACA,EAAa,SAAS,CAAC;CACjF,OAAOwB,SAAe;EAAE;EAAY;EAAQ;CAAgB,IAAI;EAACC;EAAYF;EAAQ7B;CAAe,CAAC;AACvG"}
@@ -1,5 +1,5 @@
1
- import { t as e } from "../../_chunks/QueryClientService.js";
2
- import { t } from "../../_chunks/useQueryMemo.js";
1
+ import { t as e } from "../../_chunks/useQueryMemo.js";
2
+ import { t } from "../../_chunks/QueryClientService.js";
3
3
  import { container as n } from "tsyringe";
4
4
  import { useEffect as r, useMemo as i, useState as a } from "react";
5
5
  //#region src/hooks/useItemQuery/useItemQuery.ts
@@ -8,10 +8,10 @@ var o = [
8
8
  "removed",
9
9
  "updated"
10
10
  ], s = ({ baseQueryKey: s, itemId: c, useQueryOptions: l }) => {
11
- let { queryCache: u } = n.resolve(e), [d, f] = a(n.resolve(e).getItemFromCache(s, c)), p = t({
11
+ let { queryCache: u } = n.resolve(t), [d, f] = a(n.resolve(t).getItemFromCache(s, c)), p = e({
12
12
  ...l,
13
13
  enabled: !d && l.enabled,
14
- queryKey: n.resolve(e).getGenericKey(s, c)
14
+ queryKey: n.resolve(t).getGenericKey(s, c)
15
15
  });
16
16
  return r(() => {
17
17
  let e = u.subscribe((e) => {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["rootContainer","QueryClientService","eventTypes","useItemQuery","container","itemFromCache","setItemFromCache","useState","baseQueryKey","itemId","useQueryResult","useQueryMemo","useQueryOptions","useEffect","removeListener","queryCache","event","list","newValue","item","useMemo"],"sources":["../../../src/hooks/useItemQuery/useItemQuery.ts"],"sourcesContent":["import { container as rootContainer } from 'tsyringe';\nimport {\n useEffect,\n useMemo,\n useState,\n} from 'react';\nimport type {\n QueryCacheNotifyEvent,\n UseQueryOptions,\n} from '@tanstack/react-query';\n\nimport type { GenericData } from '../../models/data.models';\nimport { useQueryMemo } from '../useQueryMemo';\nimport { QueryClientService } from '../../classes/services/QueryClientService';\n\nexport type UseItemQueryProps<T extends GenericData, TQueryKey extends string = string> = {\n readonly baseQueryKey: TQueryKey;\n readonly itemId: string;\n readonly useQueryOptions: Omit<UseQueryOptions<T>, 'queryKey'>;\n};\n\nconst eventTypes: QueryCacheNotifyEvent['type'][] = ['added', 'removed', 'updated'];\n\nexport const useItemQuery = <T extends GenericData>({\n baseQueryKey,\n itemId,\n useQueryOptions,\n}: UseItemQueryProps<T>) => {\n const { queryCache } = rootContainer.resolve(QueryClientService);\n const [itemFromCache, setItemFromCache] = useState<T>(rootContainer.resolve(QueryClientService).getItemFromCache<T>(baseQueryKey, itemId));\n\n const useQueryResult = useQueryMemo({\n ...useQueryOptions,\n enabled: !itemFromCache && useQueryOptions.enabled,\n queryKey: rootContainer.resolve(QueryClientService).getGenericKey(baseQueryKey, itemId),\n });\n\n useEffect(() => {\n const handleQueryCacheEvent = (event: QueryCacheNotifyEvent) => {\n if (Array.isArray(event.query.queryKey) && event.query.queryKey[0] === baseQueryKey && eventTypes.includes(event.type)) {\n if (event.query.queryKey.length === 1) {\n const list = (event.query.state.data as T[]);\n if (event.type === 'removed') {\n setItemFromCache(undefined);\n return;\n }\n if (!list) {\n return;\n }\n const newValue = list?.find(item => item.id === itemId);\n if (JSON.stringify(itemFromCache) !== JSON.stringify(newValue)) {\n setItemFromCache(newValue);\n }\n } else if (event.query.queryKey.length === 2 && (event.query.state.data as T)?.id === itemId) {\n const newValue = event.query.state.data as T;\n if (JSON.stringify(itemFromCache) !== JSON.stringify(newValue)) {\n setItemFromCache(newValue);\n }\n }\n }\n };\n\n const removeListener = queryCache.subscribe(handleQueryCacheEvent);\n return () => {\n removeListener();\n };\n }, [baseQueryKey, itemId, queryCache, itemFromCache]);\n\n\n const result = useMemo(() => {\n return {\n data: itemFromCache || useQueryResult.data,\n error: itemFromCache ? false : useQueryResult.error,\n isEnabled: itemFromCache ? true : useQueryResult.isEnabled,\n isFetching: itemFromCache ? false : useQueryResult.isFetching,\n isLoading: itemFromCache ? false : useQueryResult.isLoading,\n isPending: itemFromCache ? false : useQueryResult.isPending,\n };\n }, [itemFromCache, useQueryResult.data, useQueryResult.isLoading, useQueryResult.isPending, useQueryResult.isFetching, useQueryResult.isEnabled, useQueryResult.error]);\n\n return result;\n};\n"],"mappings":";;;;;AAqBA,IAAME,IAA8C;CAAC;CAAS;CAAW;AAAS,GAErEC,KAAuC,EAClD,iBACA,WACA,yBAC0B;CAC1B,IAAM,EAAE,kBAAeH,EAAc,QAAQC,CAAkB,GACzD,CAACI,GAAeC,KAAoBC,EAAYP,EAAc,QAAQC,CAAkB,CAAC,CAAC,iBAAoBO,GAAcC,CAAM,CAAC,GAEnIC,IAAiBC,EAAa;EAClC,GAAGC;EACH,SAAS,CAACP,KAAiBO,EAAgB;EAC3C,UAAUZ,EAAc,QAAQC,CAAkB,CAAC,CAAC,cAAcO,GAAcC,CAAM;CACxF,CAAC;CA6CD,OA3CAI,QAAgB;EAyBd,IAAMC,IAAiBC,EAAW,WAxBH,MAAiC;GAC9D,IAAI,MAAM,QAAQC,EAAM,MAAM,QAAQ,KAAKA,EAAM,MAAM,SAAS,OAAOR,KAAgBN,EAAW,SAASc,EAAM,IAAI,GAAG;IACtH,IAAIA,EAAM,MAAM,SAAS,WAAW,GAAG;KACrC,IAAMC,IAAQD,EAAM,MAAM,MAAM;KAChC,IAAIA,EAAM,SAAS,WAAW;MAC5B,EAAiB,KAAA,CAAS;MAC1B;KACF;KACA,IAAI,CAACC,GACH;KAEF,IAAMC,IAAWD,GAAM,MAAK,MAAQE,EAAK,OAAOV,CAAM;KACtD,AAAI,KAAK,UAAUJ,CAAa,MAAM,KAAK,UAAUa,CAAQ,KAC3DZ,EAAiBY,CAAQ;IAE7B,OAAO,IAAIF,EAAM,MAAM,SAAS,WAAW,KAAMA,EAAM,MAAM,MAAM,MAAY,OAAOP,GAAQ;KAC5F,IAAMS,IAAWF,EAAM,MAAM,MAAM;KACnC,AAAI,KAAK,UAAUX,CAAa,MAAM,KAAK,UAAUa,CAAQ,KAC3DZ,EAAiBY,CAAQ;IAE7B;GACF;EACF,CAEiE;EACjE,aAAa;GACX,EAAe;EACjB;CACF,GAAG;EAACV;EAAcC;EAAQM;EAAYV;CAAa,CAAC,GAGrCe,SACN;EACL,MAAMf,KAAiBK,EAAe;EACtC,OAAO,MAAwBA,EAAe;EAC9C,WAAWL,IAAgB,KAAOK,EAAe;EACjD,YAAY,MAAwBA,EAAe;EACnD,WAAW,MAAwBA,EAAe;EAClD,WAAW,MAAwBA,EAAe;CACpD,IACC;EAACL;EAAeK,EAAe;EAAMA,EAAe;EAAWA,EAAe;EAAWA,EAAe;EAAYA,EAAe;EAAWA,EAAe;CAAK,CAE9J;AACT"}
1
+ {"version":3,"file":"index.js","names":["useQueryMemo","eventTypes","useItemQuery","container","QueryClientService","itemFromCache","setItemFromCache","useState","baseQueryKey","itemId","useQueryResult","useQueryOptions","useEffect","removeListener","queryCache","event","list","newValue","item","useMemo"],"sources":["../../../src/hooks/useItemQuery/useItemQuery.ts"],"sourcesContent":["import { container } from 'tsyringe';\nimport {\n useEffect,\n useMemo,\n useState,\n} from 'react';\nimport type {\n QueryCacheNotifyEvent,\n UseQueryOptions,\n} from '@tanstack/react-query';\n\nimport type { GenericData } from '../../models/data.models';\nimport { useQueryMemo } from '../useQueryMemo';\nimport { QueryClientService } from '../../classes/services/QueryClientService';\n\nexport type UseItemQueryProps<T extends GenericData, TQueryKey extends string = string> = {\n readonly baseQueryKey: TQueryKey;\n readonly itemId: string;\n readonly useQueryOptions: Omit<UseQueryOptions<T>, 'queryKey'>;\n};\n\nconst eventTypes: QueryCacheNotifyEvent['type'][] = ['added', 'removed', 'updated'];\n\nexport const useItemQuery = <T extends GenericData>({\n baseQueryKey,\n itemId,\n useQueryOptions,\n}: UseItemQueryProps<T>) => {\n const { queryCache } = container.resolve(QueryClientService);\n const [itemFromCache, setItemFromCache] = useState<T>(container.resolve(QueryClientService).getItemFromCache<T>(baseQueryKey, itemId));\n\n const useQueryResult = useQueryMemo({\n ...useQueryOptions,\n enabled: !itemFromCache && useQueryOptions.enabled,\n queryKey: container.resolve(QueryClientService).getGenericKey(baseQueryKey, itemId),\n });\n\n useEffect(() => {\n const handleQueryCacheEvent = (event: QueryCacheNotifyEvent) => {\n if (Array.isArray(event.query.queryKey) && event.query.queryKey[0] === baseQueryKey && eventTypes.includes(event.type)) {\n if (event.query.queryKey.length === 1) {\n const list = (event.query.state.data as T[]);\n if (event.type === 'removed') {\n setItemFromCache(undefined);\n return;\n }\n if (!list) {\n return;\n }\n const newValue = list?.find(item => item.id === itemId);\n if (JSON.stringify(itemFromCache) !== JSON.stringify(newValue)) {\n setItemFromCache(newValue);\n }\n } else if (event.query.queryKey.length === 2 && (event.query.state.data as T)?.id === itemId) {\n const newValue = event.query.state.data as T;\n if (JSON.stringify(itemFromCache) !== JSON.stringify(newValue)) {\n setItemFromCache(newValue);\n }\n }\n }\n };\n\n const removeListener = queryCache.subscribe(handleQueryCacheEvent);\n return () => {\n removeListener();\n };\n }, [baseQueryKey, itemId, queryCache, itemFromCache]);\n\n\n const result = useMemo(() => {\n return {\n data: itemFromCache || useQueryResult.data,\n error: itemFromCache ? false : useQueryResult.error,\n isEnabled: itemFromCache ? true : useQueryResult.isEnabled,\n isFetching: itemFromCache ? false : useQueryResult.isFetching,\n isLoading: itemFromCache ? false : useQueryResult.isLoading,\n isPending: itemFromCache ? false : useQueryResult.isPending,\n };\n }, [itemFromCache, useQueryResult.data, useQueryResult.isLoading, useQueryResult.isPending, useQueryResult.isFetching, useQueryResult.isEnabled, useQueryResult.error]);\n\n return result;\n};\n"],"mappings":";;;;;AAqBA,IAAMC,IAA8C;CAAC;CAAS;CAAW;AAAS,GAErEC,KAAuC,EAClD,iBACA,WACA,yBAC0B;CAC1B,IAAM,EAAE,kBAAeC,EAAU,QAAQC,CAAkB,GACrD,CAACC,GAAeC,KAAoBC,EAAYJ,EAAU,QAAQC,CAAkB,CAAC,CAAC,iBAAoBI,GAAcC,CAAM,CAAC,GAE/HC,IAAiBV,EAAa;EAClC,GAAGW;EACH,SAAS,CAACN,KAAiBM,EAAgB;EAC3C,UAAUR,EAAU,QAAQC,CAAkB,CAAC,CAAC,cAAcI,GAAcC,CAAM;CACpF,CAAC;CA6CD,OA3CAG,QAAgB;EAyBd,IAAMC,IAAiBC,EAAW,WAxBH,MAAiC;GAC9D,IAAI,MAAM,QAAQC,EAAM,MAAM,QAAQ,KAAKA,EAAM,MAAM,SAAS,OAAOP,KAAgBP,EAAW,SAASc,EAAM,IAAI,GAAG;IACtH,IAAIA,EAAM,MAAM,SAAS,WAAW,GAAG;KACrC,IAAMC,IAAQD,EAAM,MAAM,MAAM;KAChC,IAAIA,EAAM,SAAS,WAAW;MAC5B,EAAiB,KAAA,CAAS;MAC1B;KACF;KACA,IAAI,CAACC,GACH;KAEF,IAAMC,IAAWD,GAAM,MAAK,MAAQE,EAAK,OAAOT,CAAM;KACtD,AAAI,KAAK,UAAUJ,CAAa,MAAM,KAAK,UAAUY,CAAQ,KAC3DX,EAAiBW,CAAQ;IAE7B,OAAO,IAAIF,EAAM,MAAM,SAAS,WAAW,KAAMA,EAAM,MAAM,MAAM,MAAY,OAAON,GAAQ;KAC5F,IAAMQ,IAAWF,EAAM,MAAM,MAAM;KACnC,AAAI,KAAK,UAAUV,CAAa,MAAM,KAAK,UAAUY,CAAQ,KAC3DX,EAAiBW,CAAQ;IAE7B;GACF;EACF,CAEiE;EACjE,aAAa;GACX,EAAe;EACjB;CACF,GAAG;EAACT;EAAcC;EAAQK;EAAYT;CAAa,CAAC,GAGrCc,SACN;EACL,MAAMd,KAAiBK,EAAe;EACtC,OAAO,MAAwBA,EAAe;EAC9C,WAAWL,IAAgB,KAAOK,EAAe;EACjD,YAAY,MAAwBA,EAAe;EACnD,WAAW,MAAwBA,EAAe;EAClD,WAAW,MAAwBA,EAAe;CACpD,IACC;EAACL;EAAeK,EAAe;EAAMA,EAAe;EAAWA,EAAe;EAAWA,EAAe;EAAYA,EAAe;EAAWA,EAAe;CAAK,CAE9J;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["useUpdateBreadcrumb","update","useCallback","BreadcrumbService","position","title","useEffect"],"sources":["../../../src/hooks/useUpdateBreadcrumb/useUpdateBreadcrumb.ts"],"sourcesContent":["import { container as rootContainer } from 'tsyringe';\nimport {\n useCallback,\n useEffect,\n} from 'react';\n\nimport { BreadcrumbService } from '../../classes/services/BreadcrumbService';\n\n\nexport const useUpdateBreadcrumb = (position: string) => {\n const update = useCallback((title: string) => {\n rootContainer.resolve(BreadcrumbService).update(position, title);\n }, [position]);\n\n useEffect(() => {\n return () => {\n rootContainer.resolve(BreadcrumbService).remove(position);\n };\n }, [position]);\n\n return update;\n};\n"],"mappings":";;;;AASA,IAAaA,KAAuB,MAAqB;CACvD,IAAMC,IAASC,GAAa,MAAkB;EAC5C,EAAc,QAAQC,CAAiB,CAAC,CAAC,OAAOC,GAAUC,CAAK;CACjE,GAAG,CAACD,CAAQ,CAAC;CAQb,OANAE,cACe;EACX,EAAc,QAAQH,CAAiB,CAAC,CAAC,OAAOC,CAAQ;CAC1D,GACC,CAACA,CAAQ,CAAC,GAENH;AACT"}
1
+ {"version":3,"file":"index.js","names":["useUpdateBreadcrumb","update","useCallback","BreadcrumbService","position","title","useEffect"],"sources":["../../../src/hooks/useUpdateBreadcrumb/useUpdateBreadcrumb.ts"],"sourcesContent":["import { container } from 'tsyringe';\nimport {\n useCallback,\n useEffect,\n} from 'react';\n\nimport { BreadcrumbService } from '../../classes/services/BreadcrumbService';\n\n\nexport const useUpdateBreadcrumb = (position: string) => {\n const update = useCallback((title: string) => {\n container.resolve(BreadcrumbService).update(position, title);\n }, [position]);\n\n useEffect(() => {\n return () => {\n container.resolve(BreadcrumbService).remove(position);\n };\n }, [position]);\n\n return update;\n};\n"],"mappings":";;;;AASA,IAAaA,KAAuB,MAAqB;CACvD,IAAMC,IAASC,GAAa,MAAkB;EAC5C,EAAU,QAAQC,CAAiB,CAAC,CAAC,OAAOC,GAAUC,CAAK;CAC7D,GAAG,CAACD,CAAQ,CAAC;CAQb,OANAE,cACe;EACX,EAAU,QAAQH,CAAiB,CAAC,CAAC,OAAOC,CAAQ;CACtD,GACC,CAACA,CAAQ,CAAC,GAENH;AACT"}
@@ -114,6 +114,7 @@
114
114
  "Enable all with data": "Enable all with data",
115
115
  "Error": "Error",
116
116
  "Error anonymizing user: {{userName}}": "Error anonymizing user: {{userName}}",
117
+ "Error loading organization admins": "Error loading organization admins",
117
118
  "Execute": "Execute",
118
119
  "Expected end: ": "Expected end: ",
119
120
  "Expected start: ": "Expected start: ",
@@ -114,6 +114,7 @@
114
114
  "Enable all with data": "Alles met data inschakelen",
115
115
  "Error": "Fout",
116
116
  "Error anonymizing user: {{userName}}": "Fout bij anonimiseren van gebruiker: {{userName}}",
117
+ "Error loading organization admins": "Fout bij het laden van de organisatiebeheerders",
117
118
  "Execute": "Uitvoeren",
118
119
  "Expected end: ": "Verwacht einde: ",
119
120
  "Expected start: ": "Verwachte start: ",
@@ -1,5 +1,5 @@
1
1
  import { ReactElement } from 'react';
2
- import { CircularProgressProps, Theme } from '@mui/material';
2
+ import { Theme } from '@mui/material';
3
3
  export type ApplicationHeaderProps = {
4
4
  readonly fullHeight?: boolean;
5
5
  readonly fullWidth?: boolean;
@@ -45,10 +45,6 @@ export interface ConfigBase {
45
45
  retry: (failureCount: number, error: unknown) => boolean;
46
46
  retryDelay: (attempt: number) => number;
47
47
  };
48
- spinner: {
49
- DEFAULT_CIRCULAR_PROGRESS_SIZE: CircularProgressProps['size'];
50
- DEFAULT_TAKING_LONGER_TIMEOUT_MS: number;
51
- };
52
48
  table: {
53
49
  CONDENSED_WIDTH_PX: number;
54
50
  DEFAULT_OVERSCAN_MAIN: number;
@@ -1,17 +1,20 @@
1
- export interface GenEpixUiTheme {
2
- 'gen-epix-ui': {
3
- footer: {
4
- background: string;
5
- color: string;
6
- sectionBorderColor: string;
7
- };
8
- navbar: {
9
- activeBackground: string;
10
- activeColor: string;
11
- background: string;
12
- environmentMessageColor: string;
13
- primaryColor: string;
14
- secondaryColor: string;
15
- };
16
- };
1
+ import { GenEpixCoreComponentsTheme } from '@gen-epix/ui-core-components/models/theme.models';
2
+ export interface GenEpixUiClientCommonFooterTheme {
3
+ background: string;
4
+ color: string;
5
+ sectionBorderColor: string;
6
+ }
7
+ export interface GenEpixUiClientCommonNavbarTheme {
8
+ activeBackground: string;
9
+ activeColor: string;
10
+ background: string;
11
+ environmentMessageColor: string;
12
+ primaryColor: string;
13
+ secondaryColor: string;
14
+ }
15
+ export interface GenEpixUiClientCommonTheme extends GenEpixCoreComponentsTheme {
16
+ components: {
17
+ GenEpixUiClientCommonFooter: GenEpixUiClientCommonFooterTheme;
18
+ GenEpixUiClientCommonNavbar: GenEpixUiClientCommonNavbarTheme;
19
+ } & GenEpixCoreComponentsTheme['components'];
17
20
  }