@gen-epix/ui-client-common 4.3.2 → 4.4.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.
- package/README.md +9 -10
- package/dist/@types/mui.d.ts +1 -1
- package/dist/_chunks/ApplicationFooter.js +49 -49
- package/dist/_chunks/ApplicationFooter.js.map +1 -1
- package/dist/_chunks/Breadcrumbs.js +23 -22
- package/dist/_chunks/Breadcrumbs.js.map +1 -1
- package/dist/_chunks/CrudPage.js +211 -210
- package/dist/_chunks/CrudPage.js.map +1 -1
- package/dist/_chunks/GeoFilter.js.map +1 -1
- package/dist/_chunks/Notifications.js +67 -66
- package/dist/_chunks/Notifications.js.map +1 -1
- package/dist/_chunks/OutageList.js +30 -30
- package/dist/_chunks/OutageList.js.map +1 -1
- package/dist/_chunks/OutageUtil.js +2 -2
- package/dist/_chunks/OutageUtil.js.map +1 -1
- package/dist/_chunks/QueryClientProvider.js +1 -1
- package/dist/_chunks/QueryClientProvider.js.map +1 -1
- package/dist/_chunks/QueryClientService.js +405 -115
- package/dist/_chunks/QueryClientService.js.map +1 -1
- package/dist/_chunks/Reflect.js +642 -0
- package/dist/_chunks/Reflect.js.map +1 -0
- package/dist/_chunks/Table.js +572 -574
- package/dist/_chunks/Table.js.map +1 -1
- package/dist/_chunks/TableUtil.js +5 -5
- package/dist/_chunks/TableUtil.js.map +1 -1
- package/dist/_chunks/TextFilter.js +1 -1
- package/dist/_chunks/TextFilter.js.map +1 -1
- package/dist/_chunks/UserInvitationsAdminPage.js +109 -107
- package/dist/_chunks/UserInvitationsAdminPage.js.map +1 -1
- package/dist/_chunks/UserManagerUtil.js +7 -15
- package/dist/_chunks/UserManagerUtil.js.map +1 -1
- package/dist/_chunks/_baseAssignValue.js.map +1 -1
- package/dist/_chunks/_baseFlatten.js +8 -8
- package/dist/_chunks/_baseFlatten.js.map +1 -1
- package/dist/_chunks/_baseUnset.js +299 -22
- package/dist/_chunks/_baseUnset.js.map +1 -1
- package/dist/_chunks/_cacheHas.js.map +1 -1
- package/dist/_chunks/_setToString.js.map +1 -1
- package/dist/_chunks/decorate.js +9 -0
- package/dist/_chunks/decorateParam.js +8 -0
- package/dist/_chunks/format.js.map +1 -1
- package/dist/_chunks/isArrayLike.js.map +1 -1
- package/dist/_chunks/isObject.js.map +1 -1
- package/dist/_chunks/isSymbol.js.map +1 -1
- package/dist/_chunks/middleware.js +1 -1
- package/dist/_chunks/middleware.js.map +1 -1
- package/dist/_chunks/omit.js +39 -40
- package/dist/_chunks/omit.js.map +1 -1
- package/dist/_chunks/query.js +13 -17
- package/dist/_chunks/query.js.map +1 -1
- package/dist/_chunks/react.js +1 -1
- package/dist/_chunks/react.js.map +1 -1
- package/dist/_chunks/tableStore.js +40 -54
- package/dist/_chunks/tableStore.js.map +1 -1
- package/dist/_chunks/toDate.js.map +1 -1
- package/dist/_chunks/useColumnsMenu.js +2 -2
- package/dist/_chunks/useColumnsMenu.js.map +1 -1
- package/dist/_chunks/useMutation.js +31 -30
- package/dist/_chunks/useMutation.js.map +1 -1
- package/dist/_chunks/useQueryMemo.js +5 -5
- package/dist/_chunks/useQueryMemo.js.map +1 -1
- package/dist/_chunks/vanilla.js +1 -1
- package/dist/_chunks/vanilla.js.map +1 -1
- package/dist/_chunks/yup.js +2 -2
- package/dist/_chunks/yup.js.map +1 -1
- package/dist/classes/TableEventBus/TableEventBus.d.ts +1 -1
- package/dist/classes/TableEventBus/index.js.map +1 -1
- package/dist/classes/abstracts/FilterAbstract/index.js.map +1 -1
- package/dist/classes/filters/BooleanFilter.d.ts +1 -1
- package/dist/classes/filters/DateFilter.d.ts +2 -2
- package/dist/classes/filters/GeoFilter.d.ts +2 -2
- package/dist/classes/filters/MultiSelectFilter.d.ts +2 -2
- package/dist/classes/filters/NumberRangeFilter.d.ts +1 -1
- package/dist/classes/filters/TextFilter.d.ts +1 -1
- package/dist/classes/services/AuthenticationService/AuthenticationService.d.ts +5 -3
- package/dist/classes/services/AuthenticationService/index.js +34 -661
- package/dist/classes/services/AuthenticationService/index.js.map +1 -1
- package/dist/classes/services/AuthorizationService/AuthorizationService.d.ts +4 -4
- package/dist/classes/services/AuthorizationService/index.js +12 -10
- package/dist/classes/services/AuthorizationService/index.js.map +1 -1
- package/dist/classes/services/BackendVersionService/BackendVersionService.d.ts +0 -3
- package/dist/classes/services/BackendVersionService/index.js +5 -8
- package/dist/classes/services/BackendVersionService/index.js.map +1 -1
- package/dist/classes/services/BreadcrumbService/BreadcrumbService.d.ts +1 -3
- package/dist/classes/services/BreadcrumbService/index.js +19 -21
- package/dist/classes/services/BreadcrumbService/index.js.map +1 -1
- package/dist/classes/services/EmotionCacheService/EmotionCacheService.d.ts +4 -4
- package/dist/classes/services/EmotionCacheService/index.js +17 -14
- package/dist/classes/services/EmotionCacheService/index.js.map +1 -1
- package/dist/classes/services/FeatureFlagsService/FeatureFlagsService.d.ts +0 -3
- package/dist/classes/services/FeatureFlagsService/index.js +5 -8
- package/dist/classes/services/FeatureFlagsService/index.js.map +1 -1
- package/dist/classes/services/I18nService/I18nService.d.ts +3 -3
- package/dist/classes/services/I18nService/index.js +25 -29
- package/dist/classes/services/I18nService/index.js.map +1 -1
- package/dist/classes/services/InactivityService/InactivityService.d.ts +6 -3
- package/dist/classes/services/InactivityService/index.js +42 -36
- package/dist/classes/services/InactivityService/index.js.map +1 -1
- package/dist/classes/services/LogService/LogService.d.ts +7 -4
- package/dist/classes/services/LogService/index.js +39 -32
- package/dist/classes/services/LogService/index.js.map +1 -1
- package/dist/classes/services/NavigationHistoryService/NavigationHistoryService.d.ts +0 -3
- package/dist/classes/services/NavigationHistoryService/index.js +5 -8
- package/dist/classes/services/NavigationHistoryService/index.js.map +1 -1
- package/dist/classes/services/NotificationService/NotificationService.d.ts +4 -4
- package/dist/classes/services/NotificationService/index.js +21 -21
- package/dist/classes/services/NotificationService/index.js.map +1 -1
- package/dist/classes/services/PageEventBusService/PageEventBusService.d.ts +4 -3
- package/dist/classes/services/PageEventBusService/index.js +18 -15
- package/dist/classes/services/PageEventBusService/index.js.map +1 -1
- package/dist/classes/services/QueryClientService/QueryClientService.d.ts +6 -7
- package/dist/classes/services/QueryClientService/index.js +1 -2
- package/dist/classes/services/RouterService/RouterService.d.ts +6 -9
- package/dist/classes/services/RouterService/index.js +8 -12
- package/dist/classes/services/RouterService/index.js.map +1 -1
- package/dist/classes/services/UserSettingsService/UserSettingsService.d.ts +0 -3
- package/dist/classes/services/UserSettingsService/index.js +5 -8
- package/dist/classes/services/UserSettingsService/index.js.map +1 -1
- package/dist/components/app/App/App.d.ts +5 -1
- package/dist/components/app/App/index.js +31 -37
- package/dist/components/app/App/index.js.map +1 -1
- package/dist/components/app/ApplicationBootstrapWithAuthentication/index.js +50 -49
- package/dist/components/app/ApplicationBootstrapWithAuthentication/index.js.map +1 -1
- package/dist/components/app/ApplicationBootstrapWithoutAuthorization/index.js +42 -41
- package/dist/components/app/ApplicationBootstrapWithoutAuthorization/index.js.map +1 -1
- package/dist/components/app/AuthenticationWrapper/index.js +68 -67
- package/dist/components/app/AuthenticationWrapper/index.js.map +1 -1
- package/dist/components/app/AuthorizationWrapper/index.js +33 -32
- package/dist/components/app/AuthorizationWrapper/index.js.map +1 -1
- package/dist/components/app/RouterRoot/index.js +62 -61
- package/dist/components/app/RouterRoot/index.js.map +1 -1
- package/dist/components/epi/EpiContactDetailsDialog/index.js +38 -37
- package/dist/components/epi/EpiContactDetailsDialog/index.js.map +1 -1
- package/dist/components/filters/BooleanFilterField/index.js +5 -5
- package/dist/components/filters/BooleanFilterField/index.js.map +1 -1
- package/dist/components/filters/DateFilterField/index.js +3 -3
- package/dist/components/filters/DateFilterField/index.js.map +1 -1
- package/dist/components/filters/GeoFilterField/index.js +4 -4
- package/dist/components/filters/GeoFilterField/index.js.map +1 -1
- package/dist/components/filters/MultiSelectFilterField/index.js +4 -4
- package/dist/components/filters/MultiSelectFilterField/index.js.map +1 -1
- package/dist/components/filters/NumberRangeFilterField/index.js +3 -3
- package/dist/components/filters/NumberRangeFilterField/index.js.map +1 -1
- package/dist/components/filters/TextFilterField/index.js +3 -3
- package/dist/components/filters/TextFilterField/index.js.map +1 -1
- package/dist/components/ui/ApplicationBar/index.js +242 -241
- package/dist/components/ui/ApplicationBar/index.js.map +1 -1
- package/dist/components/ui/ApplicationFooter/index.js +1 -2
- package/dist/components/ui/Breadcrumbs/Breadcrumb.d.ts +1 -1
- package/dist/components/ui/Breadcrumbs/index.js +1 -2
- package/dist/components/ui/ConsentDialog/index.js +11 -6
- package/dist/components/ui/ConsentDialog/index.js.map +1 -1
- package/dist/components/ui/GenericErrorMessage/index.js +51 -50
- package/dist/components/ui/GenericErrorMessage/index.js.map +1 -1
- package/dist/components/ui/LicensesDialog/index.js +66 -69
- package/dist/components/ui/LicensesDialog/index.js.map +1 -1
- package/dist/components/ui/MyPermissionsDialog/index.js +26 -25
- package/dist/components/ui/MyPermissionsDialog/index.js.map +1 -1
- package/dist/components/ui/NavLink/index.js +6 -6
- package/dist/components/ui/NavLink/index.js.map +1 -1
- package/dist/components/ui/Notifications/NotificationItem.d.ts +1 -1
- package/dist/components/ui/Notifications/index.js +1 -2
- package/dist/components/ui/OrganizationSwitcherDialog/index.js +69 -76
- package/dist/components/ui/OrganizationSwitcherDialog/index.js.map +1 -1
- package/dist/components/ui/OutageList/index.js +1 -2
- package/dist/components/ui/OutagesDialog/index.js.map +1 -1
- package/dist/components/ui/PageContainer/PageContainer.d.ts +1 -1
- package/dist/components/ui/PageContainer/index.js +57 -52
- package/dist/components/ui/PageContainer/index.js.map +1 -1
- package/dist/components/ui/ResponseHandler/ResponseHandler.d.ts +1 -1
- package/dist/components/ui/ResponseHandler/index.js.map +1 -1
- package/dist/components/ui/Sidebar/SidebarItem.d.ts +1 -1
- package/dist/components/ui/Sidebar/SidebarMenuItem.d.ts +1 -1
- package/dist/components/ui/Sidebar/index.js +45 -45
- package/dist/components/ui/Sidebar/index.js.map +1 -1
- package/dist/components/ui/Table/Table.d.ts +1 -1
- package/dist/components/ui/Table/TableActionsCell.d.ts +1 -1
- package/dist/components/ui/Table/TableCell.d.ts +1 -1
- package/dist/components/ui/Table/TableCheckboxCell.d.ts +1 -1
- package/dist/components/ui/Table/TableCheckboxHeader.d.ts +1 -1
- package/dist/components/ui/Table/TableColumnsEditorDialog.d.ts +1 -1
- package/dist/components/ui/Table/TableFilter.d.ts +2 -2
- package/dist/components/ui/Table/TableHeaderCell.d.ts +1 -1
- package/dist/components/ui/Table/TableHeaderFilter.d.ts +2 -2
- package/dist/components/ui/Table/TableReadableIndexCell.d.ts +1 -1
- package/dist/components/ui/Table/index.js +1 -2
- package/dist/components/ui/UserFeedbackDialog/index.js +65 -64
- package/dist/components/ui/UserFeedbackDialog/index.js.map +1 -1
- package/dist/components/ui/UserInactivityConfirmation/index.js +26 -25
- package/dist/components/ui/UserInactivityConfirmation/index.js.map +1 -1
- package/dist/constants/api.constants.d.ts +8 -0
- package/dist/constants/api.constants.js +6 -0
- package/dist/constants/api.constants.js.map +1 -0
- package/dist/constants/config.constants.d.ts +5 -0
- package/dist/constants/config.constants.js +6 -0
- package/dist/constants/config.constants.js.map +1 -0
- package/dist/constants/{query.js → query.constants.js} +2 -2
- package/dist/constants/query.constants.js.map +1 -0
- package/dist/context/uiClientCommonConfigContext/UiClientCommonConfigContext.d.ts +6 -2
- package/dist/context/uiClientCommonConfigContext/UiClientCommonConfigContextProvider.d.ts +2 -2
- package/dist/context/uiClientCommonConfigContext/index.js +28 -12
- package/dist/context/uiClientCommonConfigContext/index.js.map +1 -1
- package/dist/context/uiClientCommonConfigContext/useUiClientCommonConfigContext.d.ts +2 -1
- package/dist/dataHooks/useIdentifierIssuerOwnOrganizationQuery/index.js +17 -16
- package/dist/dataHooks/useIdentifierIssuerOwnOrganizationQuery/index.js.map +1 -1
- package/dist/dataHooks/useIdentifierIssuerOwnOrganizationQuery/useIdentifierIssuerOwnOrganizationQuery.d.ts +1 -1
- package/dist/dataHooks/useIdentifierIssuerQuery/index.js +18 -17
- package/dist/dataHooks/useIdentifierIssuerQuery/index.js.map +1 -1
- package/dist/dataHooks/useIdentifierIssuerQuery/useIdentifierIssuerQuery.d.ts +1 -1
- package/dist/dataHooks/useInviteUserConstraintsQuery/index.js +11 -10
- package/dist/dataHooks/useInviteUserConstraintsQuery/index.js.map +1 -1
- package/dist/dataHooks/useOrganizationAdminPoliciesQuery/index.js +22 -21
- package/dist/dataHooks/useOrganizationAdminPoliciesQuery/index.js.map +1 -1
- package/dist/dataHooks/useOrganizationAdminPoliciesQuery/useOrganizationAdminPoliciesQuery.d.ts +1 -1
- package/dist/dataHooks/useOrganizationIdentifierIssuerLinksQuery/index.js +8 -7
- package/dist/dataHooks/useOrganizationIdentifierIssuerLinksQuery/index.js.map +1 -1
- package/dist/dataHooks/useOrganizationsQuery/index.js +17 -16
- package/dist/dataHooks/useOrganizationsQuery/index.js.map +1 -1
- package/dist/dataHooks/useOrganizationsQuery/useOrganizationsQuery.d.ts +1 -1
- package/dist/dataHooks/useUsersQuery/index.js +18 -17
- package/dist/dataHooks/useUsersQuery/index.js.map +1 -1
- package/dist/dataHooks/useUsersQuery/useUsersQuery.d.ts +1 -1
- package/dist/hoc/withPermissions/index.js +12 -11
- package/dist/hoc/withPermissions/index.js.map +1 -1
- package/dist/hooks/useColumnsMenu/index.js +1 -2
- package/dist/hooks/useColumnsMenu/useColumnsMenu.d.ts +2 -2
- package/dist/hooks/useConfig/index.d.ts +1 -0
- package/dist/hooks/useConfig/index.js +7 -0
- package/dist/hooks/useConfig/index.js.map +1 -0
- package/dist/hooks/useConfig/useConfig.d.ts +2 -0
- package/dist/hooks/useCreateMutation/index.js +25 -24
- package/dist/hooks/useCreateMutation/index.js.map +1 -1
- package/dist/hooks/useCreateMutation/useCreateMutation.d.ts +1 -1
- package/dist/hooks/useDeleteMutation/index.js +24 -23
- package/dist/hooks/useDeleteMutation/index.js.map +1 -1
- package/dist/hooks/useDeleteMutation/useDeleteMutation.d.ts +1 -1
- package/dist/hooks/useEditMutation/index.js +33 -32
- package/dist/hooks/useEditMutation/index.js.map +1 -1
- package/dist/hooks/useEditMutation/useEditMutation.d.ts +1 -1
- package/dist/hooks/useInitializeTableStore/index.js.map +1 -1
- package/dist/hooks/useInitializeTableStore/useInitializeTableStore.d.ts +1 -1
- package/dist/hooks/useItemQuery/index.js +36 -35
- package/dist/hooks/useItemQuery/index.js.map +1 -1
- package/dist/hooks/useItemQuery/useItemQuery.d.ts +1 -1
- package/dist/hooks/useQueryMemo/index.js +1 -2
- package/dist/hooks/useUpdateBreadcrumb/index.js +10 -9
- package/dist/hooks/useUpdateBreadcrumb/index.js.map +1 -1
- package/dist/hooks/useUpdateDocumentTitle/index.js +4 -3
- package/dist/hooks/useUpdateDocumentTitle/index.js.map +1 -1
- package/dist/models/{admin.js → admin.models.js} +2 -2
- package/dist/models/admin.models.js.map +1 -0
- package/dist/models/{dataHooks.d.ts → data-hooks.models.d.ts} +1 -1
- package/dist/models/{table.d.ts → table.models.d.ts} +2 -2
- package/dist/models/{table.js → table.models.js} +2 -2
- package/dist/models/table.models.js.map +1 -0
- package/dist/pages/AcceptInvitationPage/index.js +40 -39
- package/dist/pages/AcceptInvitationPage/index.js.map +1 -1
- package/dist/pages/AdminPage/index.js +39 -38
- package/dist/pages/AdminPage/index.js.map +1 -1
- package/dist/pages/ChooseIdentityProviderPage/ChooseIdentityProviderPage.d.ts +1 -1
- package/dist/pages/ChooseIdentityProviderPage/index.js +38 -37
- package/dist/pages/ChooseIdentityProviderPage/index.js.map +1 -1
- package/dist/pages/CrudPage/CrudPage.d.ts +6 -6
- package/dist/pages/CrudPage/CrudPageDeleteDialog.d.ts +1 -1
- package/dist/pages/CrudPage/CrudPageEditDialog.d.ts +2 -2
- package/dist/pages/CrudPage/index.js +1 -2
- package/dist/pages/ErrorPage/index.js.map +1 -1
- package/dist/pages/IdentifierIssuersAdminPage/index.js +41 -40
- package/dist/pages/IdentifierIssuersAdminPage/index.js.map +1 -1
- package/dist/pages/OrganizationAdminPoliciesAdminPage/index.js +58 -57
- package/dist/pages/OrganizationAdminPoliciesAdminPage/index.js.map +1 -1
- package/dist/pages/OrganizationContactsAdminPage/index.js +49 -48
- package/dist/pages/OrganizationContactsAdminPage/index.js.map +1 -1
- package/dist/pages/OrganizationSitesAdminPage/index.js +44 -43
- package/dist/pages/OrganizationSitesAdminPage/index.js.map +1 -1
- package/dist/pages/OrganizationsAdminPage/index.js +57 -56
- package/dist/pages/OrganizationsAdminPage/index.js.map +1 -1
- package/dist/pages/OutagesAdminPage/index.js +63 -62
- package/dist/pages/OutagesAdminPage/index.js.map +1 -1
- package/dist/pages/PostLoginPage/index.js +14 -13
- package/dist/pages/PostLoginPage/index.js.map +1 -1
- package/dist/pages/PostLogoutPage/index.js +19 -18
- package/dist/pages/PostLogoutPage/index.js.map +1 -1
- package/dist/pages/RouterErrorPage/index.js.map +1 -1
- package/dist/pages/UserInvitationsAdminPage/index.js +1 -2
- package/dist/pages/UsersAdminPage/UsersAdminPage.d.ts +1 -1
- package/dist/pages/UsersAdminPage/index.js +110 -109
- package/dist/pages/UsersAdminPage/index.js.map +1 -1
- package/dist/routes/adminRoutes.d.ts +1 -1
- package/dist/routes/index.js +1 -1
- package/dist/routes/index.js.map +1 -1
- package/dist/routes/routes.d.ts +1 -1
- package/dist/setup/setup.js.map +1 -1
- package/dist/stores/oidcStore/index.js.map +1 -1
- package/dist/stores/outagesStore/index.js.map +1 -1
- package/dist/stores/outagesStore/outagesStore.d.ts +1 -1
- package/dist/stores/tableStore/index.js +1 -2
- package/dist/stores/tableStore/tableStore.d.ts +2 -2
- package/dist/theme/demoTheme/index.js.map +1 -1
- package/dist/utils/AxiosUtil/index.js.map +1 -1
- package/dist/utils/DataHookUtil/DataHookUtil.d.ts +1 -1
- package/dist/utils/DataHookUtil/index.js.map +1 -1
- package/dist/utils/DependencyContainerUtil/DependencyContainerUtil.d.ts +6 -0
- package/dist/utils/DependencyContainerUtil/index.d.ts +1 -0
- package/dist/utils/DependencyContainerUtil/index.js +22 -0
- package/dist/utils/DependencyContainerUtil/index.js.map +1 -0
- package/dist/utils/LoadableUtil/LoadableUtil.d.ts +1 -1
- package/dist/utils/LoadableUtil/index.js.map +1 -1
- package/dist/utils/MenuDataUtil/MenuDataUtil.d.ts +1 -1
- package/dist/utils/MenuDataUtil/index.js.map +1 -1
- package/dist/utils/NotificationUtil/index.js.map +1 -1
- package/dist/utils/OutageUtil/OutageUtil.d.ts +1 -1
- package/dist/utils/OutageUtil/index.js +1 -2
- package/dist/utils/StandardConfigUtil/StandardConfigUtil.d.ts +1 -1
- package/dist/utils/StandardConfigUtil/index.js.map +1 -1
- package/dist/utils/TableUtil/TableUtil.d.ts +4 -4
- package/dist/utils/TableUtil/index.js +1 -2
- package/dist/utils/TimeUtil/index.js.map +1 -1
- package/dist/utils/UserManagerUtil/index.js +1 -2
- package/dist/utils/UserUtil/index.js.map +1 -1
- package/package.json +96 -86
- package/dist/_chunks/_baseGet.js +0 -280
- package/dist/_chunks/_baseGet.js.map +0 -1
- package/dist/_chunks/_baseIteratee.js +0 -274
- package/dist/_chunks/_baseIteratee.js.map +0 -1
- package/dist/_chunks/last.js +0 -13
- package/dist/_chunks/last.js.map +0 -1
- package/dist/_chunks/uniq.js +0 -44
- package/dist/_chunks/uniq.js.map +0 -1
- package/dist/classes/services/ApiService/ApiService.d.ts +0 -19
- package/dist/classes/services/ApiService/index.d.ts +0 -1
- package/dist/classes/services/ApiService/index.js +0 -21
- package/dist/classes/services/ApiService/index.js.map +0 -1
- package/dist/classes/services/ConfigService/ConfigService.d.ts +0 -9
- package/dist/classes/services/ConfigService/index.d.ts +0 -1
- package/dist/classes/services/ConfigService/index.js +0 -21
- package/dist/classes/services/ConfigService/index.js.map +0 -1
- package/dist/constants/query.js.map +0 -1
- package/dist/models/admin.js.map +0 -1
- package/dist/models/table.js.map +0 -1
- /package/dist/constants/{query.d.ts → query.constants.d.ts} +0 -0
- /package/dist/models/{admin.d.ts → admin.models.d.ts} +0 -0
- /package/dist/models/{api.d.ts → api.models.d.ts} +0 -0
- /package/dist/models/{api.js → api.models.js} +0 -0
- /package/dist/models/{auth.d.ts → auth.models.d.ts} +0 -0
- /package/dist/models/{auth.js → auth.models.js} +0 -0
- /package/dist/models/{config.d.ts → config.models.d.ts} +0 -0
- /package/dist/models/{config.js → config.models.js} +0 -0
- /package/dist/models/{data.js → data-hooks.models.js} +0 -0
- /package/dist/models/{data.d.ts → data.models.d.ts} +0 -0
- /package/dist/models/{dataHooks.js → data.models.js} +0 -0
- /package/dist/models/{filter.d.ts → filter.models.d.ts} +0 -0
- /package/dist/models/{filter.js → filter.models.js} +0 -0
- /package/dist/models/{notification.d.ts → notification.models.d.ts} +0 -0
- /package/dist/models/{notification.js → notification.models.js} +0 -0
- /package/dist/models/{outage.d.ts → outage.models.d.ts} +0 -0
- /package/dist/models/{outage.js → outage.models.js} +0 -0
- /package/dist/models/{reactRouter.d.ts → react-router.models.d.ts} +0 -0
- /package/dist/models/{reactRouter.js → react-router.models.js} +0 -0
- /package/dist/models/{theme.d.ts → theme.models.d.ts} +0 -0
- /package/dist/models/{theme.js → theme.models.js} +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EventBusAbstract } from '@gen-epix/ui-core/classes/abstracts/EventBusAbstract';
|
|
2
|
+
import { WindowService } from '@gen-epix/ui-core/classes/services/WindowService';
|
|
2
3
|
export type LanguageConfig = {
|
|
3
4
|
bundles: string[];
|
|
4
5
|
code: string;
|
|
@@ -7,14 +8,13 @@ type I18nEvent = {
|
|
|
7
8
|
onUserLanguageChange: string;
|
|
8
9
|
};
|
|
9
10
|
export declare class I18nService extends EventBusAbstract<I18nEvent> {
|
|
10
|
-
private static __instance;
|
|
11
11
|
private getCurrentLanguageCode;
|
|
12
12
|
private isInitialized;
|
|
13
13
|
private languageConfigs;
|
|
14
14
|
private languageLoaded;
|
|
15
15
|
private setNewLanguageCode;
|
|
16
|
-
private
|
|
17
|
-
|
|
16
|
+
private readonly windowService;
|
|
17
|
+
constructor(windowService: WindowService);
|
|
18
18
|
init(kwArgs: {
|
|
19
19
|
getCurrentLanguageCode: () => Promise<string> | string;
|
|
20
20
|
languageConfigs: LanguageConfig[];
|
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { t as e } from "../../../_chunks/decorate.js";
|
|
2
|
+
import { WINDOW_SERVICE_TOKEN as t } from "../../../constants/config.constants.js";
|
|
3
|
+
import { t as n } from "../../../_chunks/decorateParam.js";
|
|
4
|
+
import r, { changeLanguage as i, use as a } from "i18next";
|
|
5
|
+
import { inject as o, singleton as s } from "tsyringe";
|
|
6
|
+
import { EventBusAbstract as c } from "@gen-epix/ui-core/classes/abstracts/EventBusAbstract";
|
|
7
|
+
import { initReactI18next as l } from "react-i18next";
|
|
6
8
|
//#region src/classes/services/I18nService/I18nService.ts
|
|
7
|
-
var
|
|
8
|
-
static __instance;
|
|
9
|
+
var u = class extends c {
|
|
9
10
|
getCurrentLanguageCode;
|
|
10
11
|
isInitialized = !1;
|
|
11
12
|
languageConfigs;
|
|
12
13
|
languageLoaded = {};
|
|
13
14
|
setNewLanguageCode;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
static getInstance() {
|
|
18
|
-
return s.__instance = i.getHmrSingleton("i18nService", s.__instance, () => new s()), s.__instance;
|
|
15
|
+
windowService;
|
|
16
|
+
constructor(e) {
|
|
17
|
+
super(), this.windowService = e;
|
|
19
18
|
}
|
|
20
19
|
async init(e) {
|
|
21
20
|
if (this.setNewLanguageCode = e.setNewLanguageCode, this.getCurrentLanguageCode = e.getCurrentLanguageCode, this.languageConfigs = e.languageConfigs, this.isInitialized) {
|
|
@@ -23,7 +22,7 @@ var s = class s extends a {
|
|
|
23
22
|
return;
|
|
24
23
|
}
|
|
25
24
|
let t = await this.getCurrentLanguageCode(), n = this.languageConfigs.find((e) => e.code === t);
|
|
26
|
-
await
|
|
25
|
+
await a(l).init({
|
|
27
26
|
fallbackLng: n.code,
|
|
28
27
|
interpolation: { escapeValue: !1 },
|
|
29
28
|
lng: n.code,
|
|
@@ -36,32 +35,29 @@ var s = class s extends a {
|
|
|
36
35
|
}), await this.loadResources(n.code), this.updateLangAttribute(n.code), this.isInitialized = !0;
|
|
37
36
|
}
|
|
38
37
|
async switchLanguage(e) {
|
|
39
|
-
await this.switchLanguageConfig(e), await this.loadResources(e), await
|
|
38
|
+
await this.switchLanguageConfig(e), await this.loadResources(e), await i(e);
|
|
40
39
|
}
|
|
41
40
|
async switchLanguageConfig(e) {
|
|
42
41
|
await this.setNewLanguageCode(e), this.updateLangAttribute(e);
|
|
43
42
|
}
|
|
44
43
|
async loadResources(e) {
|
|
45
44
|
if (this.languageLoaded[e]) return;
|
|
46
|
-
let
|
|
47
|
-
if (!
|
|
48
|
-
await Promise.all(
|
|
49
|
-
let
|
|
50
|
-
if (!
|
|
51
|
-
let i = await
|
|
52
|
-
|
|
45
|
+
let t = this.languageConfigs.find((t) => t.code === e);
|
|
46
|
+
if (!t) throw Error(`No i18n config found for code: ${e}`);
|
|
47
|
+
await Promise.all(t.bundles.map(async (e) => {
|
|
48
|
+
let n = await fetch(e);
|
|
49
|
+
if (!n.ok) throw Error(`Failed to load i18n bundle: ${e}`);
|
|
50
|
+
let i = await n.json();
|
|
51
|
+
r.addResourceBundle(t.code, "translation", i.translation, !0, !1);
|
|
53
52
|
})), this.languageLoaded[e] = !0;
|
|
54
53
|
}
|
|
55
|
-
updateLangAttribute(
|
|
56
|
-
let
|
|
57
|
-
|
|
58
|
-
console.warn("Document is not available, cannot set lang attribute");
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
n.documentElement.setAttribute("lang", t);
|
|
54
|
+
updateLangAttribute(e) {
|
|
55
|
+
let t = this.windowService.document;
|
|
56
|
+
t ? t.documentElement.setAttribute("lang", e) : console.warn("Document is not available, cannot set lang attribute");
|
|
62
57
|
}
|
|
63
58
|
};
|
|
59
|
+
u = e([s(), n(0, o(t))], u);
|
|
64
60
|
//#endregion
|
|
65
|
-
export {
|
|
61
|
+
export { u as I18nService };
|
|
66
62
|
|
|
67
63
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/classes/services/I18nService/I18nService.ts"],"sourcesContent":["import i18next, {\n changeLanguage,\n use,\n} from 'i18next';\nimport { initReactI18next } from 'react-i18next';\nimport { EventBusAbstract } from '@gen-epix/ui-core/classes/abstracts/EventBusAbstract';\nimport {
|
|
1
|
+
{"version":3,"file":"index.js","names":["_decorate","_decorateParam","__decorate","__decorateParam","i18next","I18nService","EventBusAbstract","windowService","kwArgs","currentLanguageCode","defaultLanguageConfig","x","use","initReactI18next","text","value","options","key","lng","ns","code","changeLanguage","config","response","bundleUrl","json","doc","singleton","inject","WINDOW_SERVICE_TOKEN"],"sources":["../../../../src/classes/services/I18nService/I18nService.ts"],"sourcesContent":["import i18next, {\n changeLanguage,\n use,\n} from 'i18next';\nimport { initReactI18next } from 'react-i18next';\nimport { EventBusAbstract } from '@gen-epix/ui-core/classes/abstracts/EventBusAbstract';\nimport type { WindowService } from '@gen-epix/ui-core/classes/services/WindowService';\nimport {\n inject,\n singleton,\n} from 'tsyringe';\n\nimport { WINDOW_SERVICE_TOKEN } from '../../../constants/config.constants';\n\nexport type LanguageConfig = {\n bundles: string[];\n code: string;\n};\n\ntype Bundle = {\n translation: Record<string, string>;\n};\n\ntype I18nEvent = {\n onUserLanguageChange: string;\n};\n\n@singleton()\nexport class I18nService extends EventBusAbstract<I18nEvent> {\n\n private getCurrentLanguageCode: () => Promise<string> | string;\n private isInitialized = false;\n private languageConfigs: LanguageConfig[];\n private languageLoaded: Record<string, boolean> = {};\n private setNewLanguageCode: (code: string) => Promise<void> | void;\n private readonly windowService: WindowService;\n\n public constructor(@inject(WINDOW_SERVICE_TOKEN) windowService: WindowService) {\n super();\n this.windowService = windowService;\n }\n\n\n public async init(kwArgs: {\n getCurrentLanguageCode: () => Promise<string> | string;\n languageConfigs: LanguageConfig[];\n setNewLanguageCode: (code: string) => Promise<void> | void;\n }): Promise<void> {\n this.setNewLanguageCode = kwArgs.setNewLanguageCode;\n this.getCurrentLanguageCode = kwArgs.getCurrentLanguageCode;\n this.languageConfigs = kwArgs.languageConfigs;\n if (this.isInitialized) {\n console.warn('I18nService is already initialized');\n return;\n }\n const currentLanguageCode = await this.getCurrentLanguageCode();\n const defaultLanguageConfig = this.languageConfigs.find(x => x.code === currentLanguageCode);\n\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n await use(initReactI18next)\n .init({\n fallbackLng: defaultLanguageConfig.code,\n interpolation: {\n escapeValue: false, // react already safes from xss => https://www.i18next.com/translation-function/interpolation#unescape\n },\n lng: defaultLanguageConfig.code,\n missingInterpolationHandler: (text, value, options) => {\n console.warn(`Missing interpolation for key: \"${text}\" with value: \"${JSON.stringify(value)}\" and options: \"${JSON.stringify(options)}\"`);\n },\n missingKeyHandler: (lng, ns, key) => {\n console.warn(`Missing translation for key: \"${key}\" in language: \"${lng.join(', ')}\" and namespace: \"${ns}\"`);\n },\n });\n\n await this.loadResources(defaultLanguageConfig.code);\n this.updateLangAttribute(defaultLanguageConfig.code);\n this.isInitialized = true;\n }\n\n public async switchLanguage(code: string): Promise<void> {\n await this.switchLanguageConfig(code);\n\n await this.loadResources(code);\n await changeLanguage(code);\n }\n\n public async switchLanguageConfig(code: string): Promise<void> {\n await this.setNewLanguageCode(code);\n this.updateLangAttribute(code);\n }\n\n private async loadResources(code: string): Promise<void> {\n if (this.languageLoaded[code]) {\n return;\n }\n const config = this.languageConfigs.find(x => x.code === code);\n if (!config) {\n throw new Error(`No i18n config found for code: ${code}`);\n }\n await Promise.all(config.bundles.map(async (bundleUrl) => {\n const response = await fetch(bundleUrl);\n if (!response.ok) {\n throw new Error(`Failed to load i18n bundle: ${bundleUrl}`);\n }\n const json = await response.json() as Bundle;\n i18next.addResourceBundle(\n config.code,\n 'translation',\n json.translation,\n true,\n false,\n );\n }));\n this.languageLoaded[code] = true;\n }\n\n private updateLangAttribute(code: string): void {\n const doc = this.windowService.document;\n if (!doc) {\n console.warn('Document is not available, cannot set lang attribute');\n return;\n }\n doc.documentElement.setAttribute('lang', code);\n }\n}\n"],"mappings":";;;;;;;;AA4BO,IAAMK,IAAN,cAA0BC,EAA4B;CAE3D;CACA,gBAAwB;CACxB;CACA,iBAAkD,CAAC;CACnD;CACA;CAEA,YAAmB,GAA4D;EAE7E,AADA,MAAM,GACN,KAAK,gBAAgBC;CACvB;CAGA,MAAa,KAAK,GAIA;EAIhB,IAHA,KAAK,qBAAqBC,EAAO,oBACjC,KAAK,yBAAyBA,EAAO,wBACrC,KAAK,kBAAkBA,EAAO,iBAC1B,KAAK,eAAe;GACtB,QAAQ,KAAK,oCAAoC;GACjD;EACF;EACA,IAAMC,IAAsB,MAAM,KAAK,uBAAuB,GACxDC,IAAwB,KAAK,gBAAgB,MAAK,MAAKC,EAAE,SAASF,CAAmB;EAqB3F,AAjBA,MAAMG,EAAIC,CAAgB,CAAC,CACxB,KAAK;GACJ,aAAaH,EAAsB;GACnC,eAAe,EACb,aAAa,GACf;GACA,KAAKA,EAAsB;GAC3B,8BAA8B,GAAM,GAAO,MAAY;IACrD,QAAQ,KAAK,mCAAmCI,EAAK,iBAAiB,KAAK,UAAUC,CAAK,EAAE,kBAAkB,KAAK,UAAUC,CAAO,EAAE,EAAE;GAC1I;GACA,oBAAoB,GAAK,GAAI,MAAQ;IACnC,QAAQ,KAAK,iCAAiCC,EAAI,kBAAkBC,EAAI,KAAK,IAAI,EAAE,oBAAoBC,EAAG,EAAE;GAC9G;EACF,CAAC,GAEH,MAAM,KAAK,cAAcT,EAAsB,IAAI,GACnD,KAAK,oBAAoBA,EAAsB,IAAI,GACnD,KAAK,gBAAgB;CACvB;CAEA,MAAa,eAAe,GAA6B;EAIvD,AAHA,MAAM,KAAK,qBAAqBU,CAAI,GAEpC,MAAM,KAAK,cAAcA,CAAI,GAC7B,MAAMC,EAAeD,CAAI;CAC3B;CAEA,MAAa,qBAAqB,GAA6B;EAE7D,AADA,MAAM,KAAK,mBAAmBA,CAAI,GAClC,KAAK,oBAAoBA,CAAI;CAC/B;CAEA,MAAc,cAAc,GAA6B;EACvD,IAAI,KAAK,eAAeA,IACtB;EAEF,IAAME,IAAS,KAAK,gBAAgB,MAAK,MAAKX,EAAE,SAASS,CAAI;EAC7D,IAAI,CAACE,GACH,MAAU,MAAM,kCAAkCF,GAAM;EAgB1D,AAdA,MAAM,QAAQ,IAAIE,EAAO,QAAQ,IAAI,OAAO,MAAc;GACxD,IAAMC,IAAW,MAAM,MAAMC,CAAS;GACtC,IAAI,CAACD,EAAS,IACZ,MAAU,MAAM,+BAA+BC,GAAW;GAE5D,IAAMC,IAAO,MAAMF,EAAS,KAAK;GACjC,EAAQ,kBACND,EAAO,MACP,eACAG,EAAK,aACL,IACA,EACF;EACF,CAAC,CAAC,GACF,KAAK,eAAeL,KAAQ;CAC9B;CAEA,oBAA4B,GAAoB;EAC9C,IAAMM,IAAM,KAAK,cAAc;EAC/B,AAAKA,IAILA,EAAI,gBAAgB,aAAa,QAAQN,CAAI,IAH3C,QAAQ,KAAK,sDAAsD;CAIvE;AACF;AAlGC,IAAApB,EAAA,CAAA2B,EAAU,GAAA1B,EAAA,GAUW2B,EAAOC,CAAoB,CAAA,CAAA,GAAAxB,CAAA"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { SubscribableAbstract } from '@gen-epix/ui-core/classes/abstracts/SubscribableAbstract';
|
|
2
|
+
import { AuthenticationService } from '../AuthenticationService';
|
|
3
|
+
import { LogService } from '../LogService';
|
|
4
|
+
import { ConfigBase } from '../../../models/config.models';
|
|
2
5
|
export type InactivityState = {
|
|
3
6
|
idleDiff: number;
|
|
4
7
|
isIdle: boolean;
|
|
@@ -7,15 +10,15 @@ export type InactivityState = {
|
|
|
7
10
|
readableNotificationDiff: string;
|
|
8
11
|
};
|
|
9
12
|
export declare class InactivityService extends SubscribableAbstract<InactivityState> {
|
|
10
|
-
private
|
|
13
|
+
private readonly authenticationService;
|
|
11
14
|
private idleDiff;
|
|
12
15
|
private idleSince;
|
|
13
16
|
private isIdle;
|
|
14
17
|
private isPaused;
|
|
18
|
+
private readonly logService;
|
|
15
19
|
private notificationDiff;
|
|
16
20
|
private readonly onActivityDebounced;
|
|
17
|
-
|
|
18
|
-
static getInstance(): InactivityService;
|
|
21
|
+
constructor(config: ConfigBase, logService: LogService, authenticationService: AuthenticationService);
|
|
19
22
|
logout(): void;
|
|
20
23
|
pause(): void;
|
|
21
24
|
reset(): void;
|
|
@@ -2,34 +2,36 @@ import { n as e, t } from "../../../_chunks/rolldown-runtime.js";
|
|
|
2
2
|
import { TimeUtil as n } from "../../../utils/TimeUtil/index.js";
|
|
3
3
|
import { a as r, t as i } from "../../../_chunks/isObject.js";
|
|
4
4
|
import { t as a } from "../../../_chunks/isSymbol.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
5
|
+
import { t as o } from "../../../_chunks/decorate.js";
|
|
6
|
+
import { CONFIG_TOKEN as s } from "../../../constants/config.constants.js";
|
|
7
|
+
import { t as c } from "../../../_chunks/decorateParam.js";
|
|
8
|
+
import { AuthenticationService as l } from "../AuthenticationService/index.js";
|
|
9
|
+
import { LogService as u } from "../LogService/index.js";
|
|
10
|
+
import { CommonDbLogLevel as d } from "@gen-epix/api-commondb";
|
|
11
|
+
import { inject as f, singleton as p } from "tsyringe";
|
|
12
|
+
import { Subject as m } from "@gen-epix/ui-core/classes/Subject";
|
|
13
|
+
import { SubscribableAbstract as h } from "@gen-epix/ui-core/classes/abstracts/SubscribableAbstract";
|
|
12
14
|
//#region ../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/now.js
|
|
13
|
-
var
|
|
15
|
+
var g = /* @__PURE__ */ t(((e, t) => {
|
|
14
16
|
var n = r();
|
|
15
17
|
t.exports = function() {
|
|
16
18
|
return n.Date.now();
|
|
17
19
|
};
|
|
18
|
-
})),
|
|
20
|
+
})), _ = /* @__PURE__ */ t(((e, t) => {
|
|
19
21
|
var n = /\s/;
|
|
20
22
|
function r(e) {
|
|
21
23
|
for (var t = e.length; t-- && n.test(e.charAt(t)););
|
|
22
24
|
return t;
|
|
23
25
|
}
|
|
24
26
|
t.exports = r;
|
|
25
|
-
})),
|
|
26
|
-
var n =
|
|
27
|
+
})), v = /* @__PURE__ */ t(((e, t) => {
|
|
28
|
+
var n = _(), r = /^\s+/;
|
|
27
29
|
function i(e) {
|
|
28
30
|
return e && e.slice(0, n(e) + 1).replace(r, "");
|
|
29
31
|
}
|
|
30
32
|
t.exports = i;
|
|
31
|
-
})),
|
|
32
|
-
var n =
|
|
33
|
+
})), y = /* @__PURE__ */ t(((e, t) => {
|
|
34
|
+
var n = v(), r = i(), o = a(), s = NaN, c = /^[-+]0x[0-9a-f]+$/i, l = /^0b[01]+$/i, u = /^0o[0-7]+$/i, d = parseInt;
|
|
33
35
|
function f(e) {
|
|
34
36
|
if (typeof e == "number") return e;
|
|
35
37
|
if (o(e)) return s;
|
|
@@ -43,8 +45,8 @@ var p = /* @__PURE__ */ t(((e, t) => {
|
|
|
43
45
|
return i || u.test(e) ? d(e.slice(2), i ? 2 : 8) : c.test(e) ? s : +e;
|
|
44
46
|
}
|
|
45
47
|
t.exports = f;
|
|
46
|
-
})),
|
|
47
|
-
var n = i(), r =
|
|
48
|
+
})), b = /* @__PURE__ */ t(((e, t) => {
|
|
49
|
+
var n = i(), r = g(), a = y(), o = "Expected a function", s = Math.max, c = Math.min;
|
|
48
50
|
function l(e, t, i) {
|
|
49
51
|
var l, u, d, f, p, m, h = 0, g = !1, _ = !1, v = !0;
|
|
50
52
|
if (typeof e != "function") throw TypeError(o);
|
|
@@ -89,8 +91,8 @@ var p = /* @__PURE__ */ t(((e, t) => {
|
|
|
89
91
|
return D.cancel = T, D.flush = E, D;
|
|
90
92
|
}
|
|
91
93
|
t.exports = l;
|
|
92
|
-
})),
|
|
93
|
-
var n =
|
|
94
|
+
})), x = /* @__PURE__ */ e((/* @__PURE__ */ t(((e, t) => {
|
|
95
|
+
var n = b(), r = i(), a = "Expected a function";
|
|
94
96
|
function o(e, t, i) {
|
|
95
97
|
var o = !0, s = !0;
|
|
96
98
|
if (typeof e != "function") throw TypeError(a);
|
|
@@ -101,47 +103,45 @@ var p = /* @__PURE__ */ t(((e, t) => {
|
|
|
101
103
|
});
|
|
102
104
|
}
|
|
103
105
|
t.exports = o;
|
|
104
|
-
})))(), 1),
|
|
105
|
-
|
|
106
|
+
})))(), 1), S = class extends h {
|
|
107
|
+
authenticationService;
|
|
106
108
|
idleDiff = 0;
|
|
107
109
|
idleSince = Date.now();
|
|
108
110
|
isIdle = !1;
|
|
109
111
|
isPaused = !1;
|
|
112
|
+
logService;
|
|
110
113
|
notificationDiff = 0;
|
|
111
114
|
onActivityDebounced;
|
|
112
|
-
constructor() {
|
|
113
|
-
super(new
|
|
115
|
+
constructor(e, t, n) {
|
|
116
|
+
super(new m({
|
|
114
117
|
idleDiff: 0,
|
|
115
118
|
isIdle: !1,
|
|
116
119
|
notificationDiff: 0,
|
|
117
120
|
readableIdleDiff: "",
|
|
118
121
|
readableNotificationDiff: ""
|
|
119
|
-
}))
|
|
120
|
-
let e = o.getInstance().config.userInactivityConfirmation.ALLOWED_IDLE_TIME_MS, t = o.getInstance().config.userInactivityConfirmation.NOTIFICATION_TIME_MS;
|
|
121
|
-
this.onActivityDebounced = (0, v.default)(this.onActivity.bind(this), 1e3, {
|
|
122
|
+
})), this.logService = t, this.authenticationService = n, this.onActivityDebounced = (0, x.default)(this.onActivity.bind(this), 1e3, {
|
|
122
123
|
leading: !0,
|
|
123
124
|
trailing: !0
|
|
124
|
-
})
|
|
125
|
+
});
|
|
126
|
+
let { ALLOWED_IDLE_TIME_MS: r, NOTIFICATION_TIME_MS: i } = e.userInactivityConfirmation;
|
|
127
|
+
[
|
|
125
128
|
"mousemove",
|
|
126
129
|
"keydown",
|
|
127
130
|
"scroll"
|
|
128
131
|
].forEach((e) => window.addEventListener(e, this.onActivityDebounced)), setInterval(() => {
|
|
129
|
-
if (this.idleSince > 0 && Date.now() -
|
|
132
|
+
if (this.idleSince > 0 && Date.now() - r > this.idleSince && !this.isPaused) {
|
|
130
133
|
this.idleDiff = Date.now() - this.idleSince, this.isIdle = !0;
|
|
131
|
-
let
|
|
132
|
-
this.notificationDiff =
|
|
134
|
+
let e = this.idleSince + r + i;
|
|
135
|
+
this.notificationDiff = e - Date.now(), this.notificationDiff < 0 && this.logout(), this.isIdle && this.doNext();
|
|
133
136
|
}
|
|
134
137
|
}, 500);
|
|
135
138
|
}
|
|
136
|
-
static getInstance() {
|
|
137
|
-
return e.__instance = u.getHmrSingleton("inactivityService", e.__instance, () => new e()), e.__instance;
|
|
138
|
-
}
|
|
139
139
|
logout() {
|
|
140
|
-
|
|
141
|
-
detail:
|
|
142
|
-
level:
|
|
140
|
+
this.logService.log([{
|
|
141
|
+
detail: this.authenticationService.authContextProps.user,
|
|
142
|
+
level: d.TRACE,
|
|
143
143
|
topic: "USER_LOGOUT_BY_INACTIVITY"
|
|
144
|
-
}]),
|
|
144
|
+
}]), this.logService.flushLog(), this.authenticationService.authContextProps.signoutRedirect();
|
|
145
145
|
}
|
|
146
146
|
pause() {
|
|
147
147
|
this.isPaused = !0, this.reset();
|
|
@@ -165,7 +165,13 @@ var p = /* @__PURE__ */ t(((e, t) => {
|
|
|
165
165
|
this.isIdle || (this.idleSince = Date.now());
|
|
166
166
|
}
|
|
167
167
|
};
|
|
168
|
+
S = o([
|
|
169
|
+
p(),
|
|
170
|
+
c(0, f(s)),
|
|
171
|
+
c(1, f(u)),
|
|
172
|
+
c(2, f(l))
|
|
173
|
+
], S);
|
|
168
174
|
//#endregion
|
|
169
|
-
export {
|
|
175
|
+
export { S as InactivityService };
|
|
170
176
|
|
|
171
177
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/now.js","../../../../../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_trimmedEndIndex.js","../../../../../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_baseTrim.js","../../../../../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/toNumber.js","../../../../../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/debounce.js","../../../../../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/throttle.js","../../../../src/classes/services/InactivityService/InactivityService.ts"],"sourcesContent":["var root = require('./_root');\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\nmodule.exports = now;\n","/** Used to match a single whitespace character. */\nvar reWhitespace = /\\s/;\n\n/**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace\n * character of `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the index of the last non-whitespace character.\n */\nfunction trimmedEndIndex(string) {\n var index = string.length;\n\n while (index-- && reWhitespace.test(string.charAt(index))) {}\n return index;\n}\n\nmodule.exports = trimmedEndIndex;\n","var trimmedEndIndex = require('./_trimmedEndIndex');\n\n/** Used to match leading whitespace. */\nvar reTrimStart = /^\\s+/;\n\n/**\n * The base implementation of `_.trim`.\n *\n * @private\n * @param {string} string The string to trim.\n * @returns {string} Returns the trimmed string.\n */\nfunction baseTrim(string) {\n return string\n ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')\n : string;\n}\n\nmodule.exports = baseTrim;\n","var baseTrim = require('./_baseTrim'),\n isObject = require('./isObject'),\n isSymbol = require('./isSymbol');\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = baseTrim(value);\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = toNumber;\n","var isObject = require('./isObject'),\n now = require('./now'),\n toNumber = require('./toNumber');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n timeWaiting = wait - timeSinceLastCall;\n\n return maxing\n ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)\n : timeWaiting;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n clearTimeout(timerId);\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\nmodule.exports = debounce;\n","var debounce = require('./debounce'),\n isObject = require('./isObject');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/**\n * Creates a throttled function that only invokes `func` at most once per\n * every `wait` milliseconds. The throttled function comes with a `cancel`\n * method to cancel delayed `func` invocations and a `flush` method to\n * immediately invoke them. Provide `options` to indicate whether `func`\n * should be invoked on the leading and/or trailing edge of the `wait`\n * timeout. The `func` is invoked with the last arguments provided to the\n * throttled function. Subsequent calls to the throttled function return the\n * result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the throttled function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.throttle` and `_.debounce`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to throttle.\n * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=true]\n * Specify invoking on the leading edge of the timeout.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new throttled function.\n * @example\n *\n * // Avoid excessively updating the position while scrolling.\n * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n *\n * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.\n * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n * jQuery(element).on('click', throttled);\n *\n * // Cancel the trailing throttled invocation.\n * jQuery(window).on('popstate', throttled.cancel);\n */\nfunction throttle(func, wait, options) {\n var leading = true,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (isObject(options)) {\n leading = 'leading' in options ? !!options.leading : leading;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n return debounce(func, wait, {\n 'leading': leading,\n 'maxWait': wait,\n 'trailing': trailing\n });\n}\n\nmodule.exports = throttle;\n","import throttle from 'lodash/throttle';\nimport { CommonDbLogLevel } from '@gen-epix/api-commondb';\nimport { SubscribableAbstract } from '@gen-epix/ui-core/classes/abstracts/SubscribableAbstract';\nimport { Subject } from '@gen-epix/ui-core/classes/Subject';\nimport { HmrUtil } from '@gen-epix/ui-core/utils/HmrUtil';\n\nimport { AuthenticationService } from '../AuthenticationService';\nimport { ConfigService } from '../ConfigService';\nimport { LogService } from '../LogService';\nimport { TimeUtil } from '../../../utils/TimeUtil';\n\nexport type InactivityState = {\n idleDiff: number;\n isIdle: boolean;\n notificationDiff: number;\n readableIdleDiff: string;\n readableNotificationDiff: string;\n};\n\nexport class InactivityService extends SubscribableAbstract<InactivityState> {\n private static __instance: InactivityService;\n\n private idleDiff: number = 0;\n\n private idleSince: number = Date.now();\n private isIdle: boolean = false;\n private isPaused: boolean = false;\n private notificationDiff: number = 0;\n private readonly onActivityDebounced: () => void;\n\n private constructor() {\n super(new Subject<InactivityState>({\n idleDiff: 0,\n isIdle: false,\n notificationDiff: 0,\n readableIdleDiff: '',\n readableNotificationDiff: '',\n }));\n\n const ALLOWED_IDLE_TIME_MS = ConfigService.getInstance().config.userInactivityConfirmation.ALLOWED_IDLE_TIME_MS;\n const NOTIFICATION_TIME_MS = ConfigService.getInstance().config.userInactivityConfirmation.NOTIFICATION_TIME_MS;\n\n this.onActivityDebounced = throttle(this.onActivity.bind(this), 1000, {\n leading: true,\n trailing: true,\n });\n\n ['mousemove', 'keydown', 'scroll'].forEach((event) => window.addEventListener(event, this.onActivityDebounced));\n\n setInterval(() => {\n if (this.idleSince > 0 && (Date.now() - ALLOWED_IDLE_TIME_MS) > this.idleSince && !this.isPaused) {\n this.idleDiff = Date.now() - this.idleSince;\n this.isIdle = true;\n\n const notificationEndTime = this.idleSince + ALLOWED_IDLE_TIME_MS + NOTIFICATION_TIME_MS;\n this.notificationDiff = notificationEndTime - Date.now();\n\n if (this.notificationDiff < 0) {\n this.logout();\n }\n\n if (this.isIdle) {\n this.doNext();\n }\n }\n }, 500);\n }\n\n public static getInstance(): InactivityService {\n InactivityService.__instance = HmrUtil.getHmrSingleton('inactivityService', InactivityService.__instance, () => new InactivityService());\n return InactivityService.__instance;\n }\n\n public logout(): void {\n LogService.getInstance().log([{\n detail: AuthenticationService.getInstance().authContextProps.user,\n level: CommonDbLogLevel.TRACE,\n topic: 'USER_LOGOUT_BY_INACTIVITY',\n }]);\n LogService.getInstance().flushLog();\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n AuthenticationService.getInstance().authContextProps.signoutRedirect();\n }\n\n public pause(): void {\n this.isPaused = true;\n this.reset();\n }\n\n public reset(): void {\n this.idleSince = Date.now();\n this.isIdle = false;\n this.idleDiff = 0;\n this.notificationDiff = 0;\n this.doNext();\n }\n\n public resume(): void {\n this.isPaused = false;\n this.reset();\n }\n\n private doNext(): void {\n this.next({\n idleDiff: this.idleDiff,\n isIdle: this.isIdle,\n notificationDiff: this.notificationDiff,\n readableIdleDiff: TimeUtil.getReadableTimeRemaining(this.idleDiff),\n readableNotificationDiff: TimeUtil.getReadableTimeRemaining(this.notificationDiff),\n });\n }\n\n private onActivity(): void {\n if (this.isIdle) {\n return;\n }\n this.idleSince = Date.now();\n }\n\n}\n"],"x_google_ignoreList":[0,1,2,3,4,5],"mappings":";;;;;;;;;;;;;CAAA,IAAI,IAAA,EAAA;CAsBJ,EAA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,KAAK;GACf,QAAQ,KAAK;GACb,kBAAkB,KAAK;GACvB,kBAAkB,EAAS,yBAAyB,KAAK,QAAQ;GACjE,0BAA0B,EAAS,yBAAyB,KAAK,gBAAgB;EACnF,CAAC;CACH;CAEA,aAA2B;EACrB,KAAK,WAGT,KAAK,YAAY,KAAK,IAAI;CAC5B;AAEF"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["throttle","_decorate","_decorateParam","__toESM","require__root","require_isObject","require_isSymbol","__decorate","__decorateParam","require_now","root","require__trimmedEndIndex","reWhitespace","trimmedEndIndex","index","string","require__baseTrim","reTrimStart","baseTrim","require_toNumber","isObject","isSymbol","NAN","reIsBadHex","reIsBinary","reIsOctal","freeParseInt","toNumber","value","other","isBinary","require_debounce","now","FUNC_ERROR_TEXT","nativeMax","nativeMin","debounce","lastArgs","lastThis","maxWait","result","timerId","lastCallTime","lastInvokeTime","leading","maxing","trailing","func","wait","options","invokeFunc","args","thisArg","time","leadingEdge","timerExpired","remainingWait","timeSinceLastCall","timeSinceLastInvoke","timeWaiting","shouldInvoke","trailingEdge","cancel","flush","debounced","isInvoking","import_throttle","__commonJSMin","throttle","\"leading\"","\"maxWait\"","\"trailing\"","InactivityService","SubscribableAbstract","Subject","logService","authenticationService","config","event","ALLOWED_IDLE_TIME_MS","notificationEndTime","NOTIFICATION_TIME_MS","CommonDbLogLevel","TimeUtil","singleton","inject","CONFIG_TOKEN","LogService","AuthenticationService"],"sources":["../../../../../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/now.js","../../../../../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_trimmedEndIndex.js","../../../../../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_baseTrim.js","../../../../../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/toNumber.js","../../../../../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/debounce.js","../../../../../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/throttle.js","../../../../src/classes/services/InactivityService/InactivityService.ts"],"sourcesContent":["var root = require('./_root');\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\nmodule.exports = now;\n","/** Used to match a single whitespace character. */\nvar reWhitespace = /\\s/;\n\n/**\n * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace\n * character of `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the index of the last non-whitespace character.\n */\nfunction trimmedEndIndex(string) {\n var index = string.length;\n\n while (index-- && reWhitespace.test(string.charAt(index))) {}\n return index;\n}\n\nmodule.exports = trimmedEndIndex;\n","var trimmedEndIndex = require('./_trimmedEndIndex');\n\n/** Used to match leading whitespace. */\nvar reTrimStart = /^\\s+/;\n\n/**\n * The base implementation of `_.trim`.\n *\n * @private\n * @param {string} string The string to trim.\n * @returns {string} Returns the trimmed string.\n */\nfunction baseTrim(string) {\n return string\n ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')\n : string;\n}\n\nmodule.exports = baseTrim;\n","var baseTrim = require('./_baseTrim'),\n isObject = require('./isObject'),\n isSymbol = require('./isSymbol');\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = baseTrim(value);\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = toNumber;\n","var isObject = require('./isObject'),\n now = require('./now'),\n toNumber = require('./toNumber');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n timeWaiting = wait - timeSinceLastCall;\n\n return maxing\n ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)\n : timeWaiting;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n clearTimeout(timerId);\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\nmodule.exports = debounce;\n","var debounce = require('./debounce'),\n isObject = require('./isObject');\n\n/** Error message constants. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/**\n * Creates a throttled function that only invokes `func` at most once per\n * every `wait` milliseconds. The throttled function comes with a `cancel`\n * method to cancel delayed `func` invocations and a `flush` method to\n * immediately invoke them. Provide `options` to indicate whether `func`\n * should be invoked on the leading and/or trailing edge of the `wait`\n * timeout. The `func` is invoked with the last arguments provided to the\n * throttled function. Subsequent calls to the throttled function return the\n * result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the throttled function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.throttle` and `_.debounce`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to throttle.\n * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=true]\n * Specify invoking on the leading edge of the timeout.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new throttled function.\n * @example\n *\n * // Avoid excessively updating the position while scrolling.\n * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n *\n * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.\n * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n * jQuery(element).on('click', throttled);\n *\n * // Cancel the trailing throttled invocation.\n * jQuery(window).on('popstate', throttled.cancel);\n */\nfunction throttle(func, wait, options) {\n var leading = true,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (isObject(options)) {\n leading = 'leading' in options ? !!options.leading : leading;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n return debounce(func, wait, {\n 'leading': leading,\n 'maxWait': wait,\n 'trailing': trailing\n });\n}\n\nmodule.exports = throttle;\n","import throttle from 'lodash/throttle';\nimport { CommonDbLogLevel } from '@gen-epix/api-commondb';\nimport { SubscribableAbstract } from '@gen-epix/ui-core/classes/abstracts/SubscribableAbstract';\nimport { Subject } from '@gen-epix/ui-core/classes/Subject';\nimport {\n inject,\n singleton,\n} from 'tsyringe';\n\nimport { AuthenticationService } from '../AuthenticationService';\nimport { LogService } from '../LogService';\nimport { TimeUtil } from '../../../utils/TimeUtil';\nimport { CONFIG_TOKEN } from '../../../constants/config.constants';\nimport type { ConfigBase } from '../../../models/config.models';\n\nexport type InactivityState = {\n idleDiff: number;\n isIdle: boolean;\n notificationDiff: number;\n readableIdleDiff: string;\n readableNotificationDiff: string;\n};\n\n@singleton()\nexport class InactivityService extends SubscribableAbstract<InactivityState> {\n private readonly authenticationService: AuthenticationService;\n\n private idleDiff: number = 0;\n private idleSince: number = Date.now();\n private isIdle: boolean = false;\n private isPaused: boolean = false;\n private readonly logService: LogService;\n private notificationDiff: number = 0;\n private readonly onActivityDebounced: () => void;\n\n public constructor(\n @inject(CONFIG_TOKEN) config: ConfigBase,\n @inject(LogService) logService: LogService,\n @inject(AuthenticationService) authenticationService: AuthenticationService,\n ) {\n super(new Subject<InactivityState>({\n idleDiff: 0,\n isIdle: false,\n notificationDiff: 0,\n readableIdleDiff: '',\n readableNotificationDiff: '',\n }));\n this.logService = logService;\n this.authenticationService = authenticationService;\n\n this.onActivityDebounced = throttle(this.onActivity.bind(this), 1000, {\n leading: true,\n trailing: true,\n });\n\n const { ALLOWED_IDLE_TIME_MS, NOTIFICATION_TIME_MS } = config.userInactivityConfirmation;\n ['mousemove', 'keydown', 'scroll'].forEach((event) => window.addEventListener(event, this.onActivityDebounced));\n\n setInterval(() => {\n if (this.idleSince > 0 && (Date.now() - ALLOWED_IDLE_TIME_MS) > this.idleSince && !this.isPaused) {\n this.idleDiff = Date.now() - this.idleSince;\n this.isIdle = true;\n\n const notificationEndTime = this.idleSince + ALLOWED_IDLE_TIME_MS + NOTIFICATION_TIME_MS;\n this.notificationDiff = notificationEndTime - Date.now();\n\n if (this.notificationDiff < 0) {\n this.logout();\n }\n\n if (this.isIdle) {\n this.doNext();\n }\n }\n }, 500);\n }\n\n\n public logout(): void {\n this.logService.log([{\n detail: this.authenticationService.authContextProps.user,\n level: CommonDbLogLevel.TRACE,\n topic: 'USER_LOGOUT_BY_INACTIVITY',\n }]);\n this.logService.flushLog();\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.authenticationService.authContextProps.signoutRedirect();\n }\n\n public pause(): void {\n this.isPaused = true;\n this.reset();\n }\n\n public reset(): void {\n this.idleSince = Date.now();\n this.isIdle = false;\n this.idleDiff = 0;\n this.notificationDiff = 0;\n this.doNext();\n }\n\n public resume(): void {\n this.isPaused = false;\n this.reset();\n }\n\n private doNext(): void {\n this.next({\n idleDiff: this.idleDiff,\n isIdle: this.isIdle,\n notificationDiff: this.notificationDiff,\n readableIdleDiff: TimeUtil.getReadableTimeRemaining(this.idleDiff),\n readableNotificationDiff: TimeUtil.getReadableTimeRemaining(this.notificationDiff),\n });\n }\n\n private onActivity(): void {\n if (this.isIdle) {\n return;\n }\n this.idleSince = Date.now();\n }\n\n}\n"],"ignoreList":[0,1,2,3,4,5],"mappings":";;;;;;;;;;;;;;;CAAA,IAAIU,IAAAN,EAAA;CAsBJ,EAAO,UAAU,WAJI;EACnB,OAAOM,EAAK,KAAK,IAAI;CACvB;;CCnBA,IAAIE,IAAe;CAUnB,SAASC,EAAgB,GAAQ;EAG/B,KAFA,IAAIC,IAAQC,EAAO,QAEZ,OAAWH,EAAa,KAAKG,EAAO,OAAOD,CAAK,CAAC;EACxD,OAAOA;CACT;CAEA,EAAO,UAAUD;;CClBjB,IAAIA,IAAAF,EAAA,GAGAM,IAAc;CASlB,SAASC,EAAS,GAAQ;EACxB,OAAOH,KACHA,EAAO,MAAM,GAAGF,EAAgBE,CAAM,IAAI,CAAC,CAAC,CAAC,QAAQE,GAAa,EAAE;CAE1E;CAEA,EAAO,UAAUC;;CClBjB,IAAIA,IAAAF,EAAA,GACAI,IAAAf,E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F,EAAOG,CAAqB,CAAA"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { AxiosResponse, InternalAxiosRequestConfig } from 'axios';
|
|
2
|
-
import { CommonDbLogLevel } from '@gen-epix/api-commondb';
|
|
2
|
+
import { CommonDbSystemApi, CommonDbLogLevel } from '@gen-epix/api-commondb';
|
|
3
|
+
import { AuthenticationService } from '../AuthenticationService';
|
|
4
|
+
import { ConfigBase } from '../../../models/config.models';
|
|
3
5
|
type LogServiceItem = {
|
|
4
6
|
detail?: unknown;
|
|
5
7
|
duration?: number;
|
|
@@ -7,11 +9,12 @@ type LogServiceItem = {
|
|
|
7
9
|
topic: string;
|
|
8
10
|
};
|
|
9
11
|
export declare class LogService {
|
|
10
|
-
private static __instance;
|
|
11
12
|
protected readonly requestMap: Map<string, number>;
|
|
13
|
+
private readonly authenticationService;
|
|
14
|
+
private readonly config;
|
|
12
15
|
private logItems;
|
|
13
|
-
private
|
|
14
|
-
|
|
16
|
+
private readonly systemApi;
|
|
17
|
+
constructor(config: ConfigBase, authenticationService: AuthenticationService, systemApi: CommonDbSystemApi);
|
|
15
18
|
flushLog(): void;
|
|
16
19
|
log(items: LogServiceItem[]): void;
|
|
17
20
|
onRequest(request: InternalAxiosRequestConfig): InternalAxiosRequestConfig;
|
|
@@ -1,49 +1,50 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
1
|
+
import { t as e } from "../../../_chunks/decorate.js";
|
|
2
|
+
import { CONFIG_TOKEN as t } from "../../../constants/config.constants.js";
|
|
3
|
+
import { AxiosUtil as n } from "../../../utils/AxiosUtil/index.js";
|
|
4
|
+
import { API_SYSTEM_TOKEN as r } from "../../../constants/api.constants.js";
|
|
5
|
+
import { t as i } from "../../../_chunks/decorateParam.js";
|
|
6
|
+
import { AuthenticationService as a } from "../AuthenticationService/index.js";
|
|
7
|
+
import { StringUtil as o } from "@gen-epix/ui-core/utils/StringUtil";
|
|
8
|
+
import { CommonDbLogLevel as s } from "@gen-epix/api-commondb";
|
|
9
|
+
import { inject as c, singleton as l } from "tsyringe";
|
|
10
|
+
import { isAxiosError as u } from "axios";
|
|
9
11
|
//#region src/classes/services/LogService/LogService.ts
|
|
10
|
-
var
|
|
11
|
-
static __instance;
|
|
12
|
+
var d = class {
|
|
12
13
|
requestMap;
|
|
14
|
+
authenticationService;
|
|
15
|
+
config;
|
|
13
16
|
logItems = [];
|
|
14
|
-
|
|
15
|
-
|
|
17
|
+
systemApi;
|
|
18
|
+
constructor(e, t, n) {
|
|
19
|
+
this.requestMap = /* @__PURE__ */ new Map(), this.config = e, this.authenticationService = t, this.systemApi = n, setInterval(() => {
|
|
16
20
|
this.sendLog();
|
|
17
|
-
}, e.
|
|
18
|
-
}
|
|
19
|
-
static getInstance() {
|
|
20
|
-
return c.__instance = o.getHmrSingleton("logService", c.__instance, () => new c()), c.__instance;
|
|
21
|
+
}, e.log.LOG_INTERVAL_MS);
|
|
21
22
|
}
|
|
22
23
|
flushLog() {
|
|
23
24
|
this.sendLog();
|
|
24
25
|
}
|
|
25
|
-
log(
|
|
26
|
-
let
|
|
27
|
-
this.logItems.push(...
|
|
28
|
-
command_id:
|
|
26
|
+
log(e) {
|
|
27
|
+
let t = (/* @__PURE__ */ new Date()).toISOString(), n = this.config.getSoftwareVersion();
|
|
28
|
+
this.logItems.push(...e.map((e) => ({
|
|
29
|
+
command_id: o.createUuid(),
|
|
29
30
|
detail: e.detail ? JSON.stringify(e.detail) : null,
|
|
30
31
|
duration: e.duration ?? null,
|
|
31
32
|
level: e.level,
|
|
32
|
-
software_version:
|
|
33
|
-
timestamp:
|
|
33
|
+
software_version: n,
|
|
34
|
+
timestamp: t,
|
|
34
35
|
topic: e.topic ?? null
|
|
35
36
|
})));
|
|
36
37
|
}
|
|
37
38
|
onRequest(e) {
|
|
38
39
|
if (e.headers.has("X-IGNORE-LOG")) return e;
|
|
39
|
-
let t =
|
|
40
|
+
let t = o.createUuid();
|
|
40
41
|
return e.headers.set("X-REQUEST-ID", t), this.requestMap.set(t, (/* @__PURE__ */ new Date()).getTime()), this.log([{
|
|
41
42
|
detail: {
|
|
42
43
|
requestData: e.data,
|
|
43
44
|
requestParams: e.params,
|
|
44
45
|
url: e.url
|
|
45
46
|
},
|
|
46
|
-
level:
|
|
47
|
+
level: s.TRACE,
|
|
47
48
|
topic: "REQUEST"
|
|
48
49
|
}]), e;
|
|
49
50
|
}
|
|
@@ -57,14 +58,14 @@ var c = class c {
|
|
|
57
58
|
url: e.config.url
|
|
58
59
|
},
|
|
59
60
|
duration: n,
|
|
60
|
-
level: e.status >= 200 && e.status < 300 ?
|
|
61
|
+
level: e.status >= 200 && e.status < 300 ? s.TRACE : s.ERROR,
|
|
61
62
|
topic: "RESPONSE"
|
|
62
63
|
}]), e;
|
|
63
64
|
}
|
|
64
65
|
onResponseRejected(e) {
|
|
65
|
-
if (
|
|
66
|
-
if (
|
|
67
|
-
let
|
|
66
|
+
if (u(e)) {
|
|
67
|
+
if (n.isAxiosCanceledError(e)) return;
|
|
68
|
+
let t = e?.config?.headers.get("X-REQUEST-ID"), r = (/* @__PURE__ */ new Date()).getTime() - this.requestMap.get(t);
|
|
68
69
|
this.log([{
|
|
69
70
|
detail: {
|
|
70
71
|
requestParams: e.config.params,
|
|
@@ -73,20 +74,26 @@ var c = class c {
|
|
|
73
74
|
url: e.config.url
|
|
74
75
|
},
|
|
75
76
|
duration: r,
|
|
76
|
-
level:
|
|
77
|
+
level: s.ERROR,
|
|
77
78
|
topic: "RESPONSE_ERROR"
|
|
78
79
|
}]);
|
|
79
80
|
} else this.log([{
|
|
80
81
|
detail: { error: e },
|
|
81
|
-
level:
|
|
82
|
+
level: s.ERROR,
|
|
82
83
|
topic: "RESPONSE_ERROR"
|
|
83
84
|
}]);
|
|
84
85
|
}
|
|
85
86
|
sendLog() {
|
|
86
|
-
this.logItems.length &&
|
|
87
|
+
this.logItems.length && this.authenticationService?.authContextProps?.isAuthenticated && (document.location.href.includes("accept-invitation") || (this.systemApi.log({ log_items: this.logItems }, { headers: { "X-IGNORE-LOG": "1" } }).catch(() => 0), this.logItems = []));
|
|
87
88
|
}
|
|
88
89
|
};
|
|
90
|
+
d = e([
|
|
91
|
+
l(),
|
|
92
|
+
i(0, c(t)),
|
|
93
|
+
i(1, c(a)),
|
|
94
|
+
i(2, c(r))
|
|
95
|
+
], d);
|
|
89
96
|
//#endregion
|
|
90
|
-
export {
|
|
97
|
+
export { d as LogService };
|
|
91
98
|
|
|
92
99
|
//# sourceMappingURL=index.js.map
|