@hortiview/modulebase 1.1.0-alpha.8ea7f643.1 → 1.1.1-alpha.3d69639d.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 (32) hide show
  1. package/dist/IsRestoringProvider-SzKJZczp.js +931 -0
  2. package/dist/{ModuleCore-DuJVrj6v.js → ModuleCore-DRMqZO8r.js} +5947 -5758
  3. package/dist/assets/ModuleCore.css +1 -1
  4. package/dist/{chunk-LFPYN7LY-DmQ3La_a.js → chunk-EVOBXE3Y-BoyVF_Ri.js} +2921 -2784
  5. package/dist/components/ModuleBase.js +28 -19
  6. package/dist/components/ModuleCore.js +1 -1
  7. package/dist/constants.js +2 -2
  8. package/dist/hooks/useBreadcrumbTranslation.js +13 -14
  9. package/dist/hooks/useCustom.js +1 -1
  10. package/dist/hooks/useCustomMutation.js +5 -16
  11. package/dist/hooks/useEntity.js +1 -1
  12. package/dist/hooks/useOffline.js +1 -1
  13. package/dist/hooks/useOption.js +1 -1
  14. package/dist/hooks/useStores.js +1 -1
  15. package/dist/lib/hooks/useStores.d.ts +2 -33
  16. package/dist/lib/main.d.ts +2 -4
  17. package/dist/lib/types/BaseProps.d.ts +3 -6
  18. package/dist/main.js +174 -181
  19. package/dist/module-router.js +875 -837
  20. package/dist/{omit-Do6MFRwA.js → omit-DYPaIq41.js} +121 -128
  21. package/dist/provider/SignalR/SignalRProvider.js +469 -463
  22. package/dist/{useMutation-Aoachkw_.js → useCustomMutation-9VUQ7NbQ.js} +40 -20
  23. package/dist/{useQuery-DEU_AUtf.js → useQuery-DUDyh33-.js} +107 -108
  24. package/dist/utils/helper.js +1 -1
  25. package/package.json +24 -24
  26. package/dist/IsRestoringProvider-CBSZo7ur.js +0 -312
  27. package/dist/QueryClientProvider-DyiNrPkn.js +0 -514
  28. package/dist/hooks/useServiceBus.js +0 -25
  29. package/dist/lib/hooks/useServiceBus.d.ts +0 -19
  30. package/dist/lib/types/Deprecated.d.ts +0 -103
  31. package/dist/mutation-CmhiEgfA.js +0 -237
  32. package/dist/types/Deprecated.js +0 -1
@@ -1,21 +1,30 @@
1
- import { jsx as a } from "react/jsx-runtime";
2
- import { useEffect as h } from "react";
3
- import { R as p, a as i, O as c, u as m } from "../chunk-LFPYN7LY-DmQ3La_a.js";
4
- import { SignalRProvider as u } from "../provider/SignalR/SignalRProvider.js";
5
- import { useBasePropsStore as o } from "../stores/BasePropsStore.js";
6
- import { M as d, a as f } from "../ModuleCore-DuJVrj6v.js";
7
- const s = (t) => t.map((e) => e.children ? /* @__PURE__ */ a(i, { path: e.path, element: e.element, children: s(e.children) }, e.path) : /* @__PURE__ */ a(i, { path: e.path, element: e.element }, e.path)), v = () => {
8
- const t = o((r) => r.currentNavigationPath), e = o((r) => r.basePath), n = m();
9
- h(() => {
10
- t && e && t.startsWith(e) && n(t, { replace: !0 });
11
- }, [t, e, n]);
12
- }, g = () => (v(), /* @__PURE__ */ a(c, {})), B = ({
13
- props: t,
14
- routes: e,
15
- env: n = void 0,
16
- useSignalR: r = !1,
17
- queryClient: l = f
18
- }) => /* @__PURE__ */ a(d, { props: t, env: n, queryClient: l, children: /* @__PURE__ */ a(u, { enabled: r, children: /* @__PURE__ */ a(p, { children: /* @__PURE__ */ a(i, { path: t.basePath, element: /* @__PURE__ */ a(g, {}), children: s(e) }) }) }) });
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { useEffect as s } from "react";
3
+ import { c as u, R as c, O as l, u as m } from "../chunk-EVOBXE3Y-BoyVF_Ri.js";
4
+ import { SignalRProvider as d } from "../provider/SignalR/SignalRProvider.js";
5
+ import { useBasePropsStore as f } from "../stores/BasePropsStore.js";
6
+ import { M as p, a as v } from "../ModuleCore-DRMqZO8r.js";
7
+ const g = () => {
8
+ const e = f((o) => o.currentNavigationPath), t = m();
9
+ s(() => {
10
+ e && t(e, { replace: !0 });
11
+ }, [e, t]);
12
+ }, h = () => (g(), /* @__PURE__ */ r(l, {})), x = ({
13
+ props: e,
14
+ routes: t,
15
+ env: o = void 0,
16
+ useSignalR: a = !1,
17
+ queryClient: i = v
18
+ }) => {
19
+ const n = u([
20
+ {
21
+ path: e.basePath,
22
+ children: t,
23
+ element: /* @__PURE__ */ r(h, {})
24
+ }
25
+ ]);
26
+ return /* @__PURE__ */ r(p, { props: e, env: o, queryClient: i, children: /* @__PURE__ */ r(d, { enabled: a, children: /* @__PURE__ */ r(c, { router: n }) }) });
27
+ };
19
28
  export {
20
- B as ModuleBase
29
+ x as ModuleBase
21
30
  };
@@ -1,5 +1,5 @@
1
1
  import "react/jsx-runtime";
2
- import { M as l, a as u } from "../ModuleCore-DuJVrj6v.js";
2
+ import { M as l, a as u } from "../ModuleCore-DRMqZO8r.js";
3
3
  import "react";
4
4
  import "../stores/BasePropsStore.js";
5
5
  import "../stores/EnvironmentStore.js";
package/dist/constants.js CHANGED
@@ -1,6 +1,6 @@
1
1
  const a = [
2
- "addTranslation",
3
- "navigateTo",
2
+ "addBreadcrumbTranslation",
3
+ "navigateInHortiview",
4
4
  "modulePermissionToken",
5
5
  "organizationId",
6
6
  "currentLanguageId",
@@ -1,23 +1,22 @@
1
- import { useCallback as d } from "react";
2
- import { useBasePropsStore as s } from "../stores/BasePropsStore.js";
3
- const u = () => {
4
- const o = s((a) => a.addBreadcrumbTranslation), t = s((a) => a.addTranslation);
5
- return d(
6
- (a, r) => {
7
- const e = a, n = typeof r == "boolean" ? a : r;
8
- if (o) {
9
- o(
10
- { key: e, value: n },
1
+ import { useCallback as s } from "react";
2
+ import { useBasePropsStore as c } from "../stores/BasePropsStore.js";
3
+ const d = () => {
4
+ const a = c((r) => r.addBreadcrumbTranslation);
5
+ return s(
6
+ (r, e) => {
7
+ const t = r, o = typeof e == "boolean", n = o ? r : e;
8
+ if (a) {
9
+ a(
10
+ { key: t, value: n },
11
11
  //if boolean hide the translation in the breadcrumb
12
- typeof r == "boolean"
12
+ o
13
13
  );
14
14
  return;
15
15
  }
16
- t && t({ key: e, value: n }, typeof r == "boolean");
17
16
  },
18
- [o, t]
17
+ [a]
19
18
  );
20
19
  };
21
20
  export {
22
- u as useBreadcrumbTranslation
21
+ d as useBreadcrumbTranslation
23
22
  };
@@ -1,4 +1,4 @@
1
- import { u as i } from "../useQuery-DEU_AUtf.js";
1
+ import { u as i } from "../useQuery-DUDyh33-.js";
2
2
  import { fetchFromCustomApi as n } from "../utils/fetches.js";
3
3
  import { universalSelector as p } from "../utils/helper.js";
4
4
  const C = ({
@@ -1,25 +1,14 @@
1
- import { u as s } from "../useMutation-Aoachkw_.js";
1
+ import { u as x } from "../useCustomMutation-9VUQ7NbQ.js";
2
2
  import "react/jsx-runtime";
3
3
  import "react";
4
4
  import "../provider/SignalR/SignalRProvider.js";
5
5
  import "../stores/BasePropsStore.js";
6
- import "../ModuleCore-DuJVrj6v.js";
7
- import { mutateOnCustomApi as a } from "../utils/fetches.js";
6
+ import "../ModuleCore-DRMqZO8r.js";
7
+ import "../utils/fetches.js";
8
8
  import "../types/Entities.js";
9
9
  import "../api-COabZnyn.js";
10
- import "../omit-Do6MFRwA.js";
10
+ import "../omit-DYPaIq41.js";
11
11
  import "../stores/EnvironmentStore.js";
12
- const g = ({
13
- endpoint: t,
14
- method: o,
15
- token: m,
16
- headers: r,
17
- noAuth: i,
18
- ...p
19
- }) => s({
20
- mutationFn: ({ input: u, replaceEndpointWith: n }) => a(n ?? t, u, o, m, r, i),
21
- ...p
22
- });
23
12
  export {
24
- g as useCustomMutation
13
+ x as useCustomMutation
25
14
  };
@@ -1,4 +1,4 @@
1
- import { u as p } from "../useQuery-DEU_AUtf.js";
1
+ import { u as p } from "../useQuery-DUDyh33-.js";
2
2
  import { useMemo as g, useCallback as Q } from "react";
3
3
  import { useBasePropsStore as m } from "../stores/BasePropsStore.js";
4
4
  import { AllEntitiesTypeResultMap as v } from "../types/Entities.js";
@@ -1,4 +1,4 @@
1
- import { u as y } from "../QueryClientProvider-DyiNrPkn.js";
1
+ import { u as y } from "../IsRestoringProvider-SzKJZczp.js";
2
2
  import { useBasePropsStore as i } from "../stores/BasePropsStore.js";
3
3
  import { fetchFromCustomApi as f, getFarmOrgEntities as m, getModuleDependedEntities as d } from "../utils/fetches.js";
4
4
  import { getModuleQueryKey as o } from "../utils/helper.js";
@@ -1,4 +1,4 @@
1
- import { u as m } from "../useQuery-DEU_AUtf.js";
1
+ import { u as m } from "../useQuery-DUDyh33-.js";
2
2
  import { g as c } from "../api-COabZnyn.js";
3
3
  import { useBasePropsStore as n } from "../stores/BasePropsStore.js";
4
4
  import { fetchFromCommonApi as i, fetchFromModuleApi as p } from "../utils/fetches.js";
@@ -1,4 +1,4 @@
1
- import { o as r } from "../omit-Do6MFRwA.js";
1
+ import { o as r } from "../omit-DYPaIq41.js";
2
2
  import { useBasePropsStore as e } from "../stores/BasePropsStore.js";
3
3
  import { useEnvironmentStore as t } from "../stores/EnvironmentStore.js";
4
4
  const i = () => {
@@ -1,37 +1,6 @@
1
- export declare const useBaseProps: () => Pick<import('../main').DeprecatedBaseProps & {
2
- isOnline?: boolean;
3
- modulePermissionToken?: string;
4
- moduleId?: string;
5
- organizationId?: string;
6
- basePath?: string;
7
- currentNavigationPath?: string;
8
- sourcePath?: string | null;
9
- currentLanguage?: string;
10
- currentLanguageId?: string;
11
- commonOptions?: import('../main').AllDropdownsData<import('../main').CommonOption>["items"];
12
- refreshModulePermissionToken?: () => Promise<string | undefined>;
13
- riseNotification?: (message: import('../main').AlertServiceBusMessage) => Promise<unknown>;
14
- navigateInHortiview?: (path: string) => void;
15
- addBreadcrumbTranslation?: (translation: {
16
- key: string;
17
- value: string;
18
- }, hide?: boolean) => void;
19
- showSnackbar?: (message: string, icon?: string) => void;
20
- showMessage?: (message: import('../main').SystemMessage) => void;
21
- pendingActions?: import('../main').ActionItem[];
22
- getPendingActions?: () => import('../main').ActionItem[];
23
- resolveAction?: (key: string, result?: string) => void;
24
- startResolvingAction?: (key: string) => void;
25
- addAction?: (functionName: string, args: unknown[], key?: string) => void;
26
- getActions?: () => import('../main').ActionItem[];
27
- getActionByKey?: (key: string) => import('../main').ActionItem | undefined;
28
- logEvent?: (event: import('../main').AppInsightsEvent, customProperties?: import('../main').AppInsightsProperties) => void;
29
- logError?: (exception: import('../main').AppInsightsException) => void;
30
- throwError?: (message: string, code: number) => void;
31
- environmentVariables?: import('../main').EnvironmentVariable[];
32
- } & {
1
+ export declare const useBaseProps: () => Pick<import('../main').BaseProps & {
33
2
  setBaseProps: (props: import('../main').BaseProps) => void;
34
- }, keyof import('../main').DeprecatedBaseProps | "isOnline" | "modulePermissionToken" | "moduleId" | "organizationId" | "basePath" | "currentNavigationPath" | "sourcePath" | "currentLanguage" | "currentLanguageId" | "commonOptions" | "refreshModulePermissionToken" | "riseNotification" | "navigateInHortiview" | "addBreadcrumbTranslation" | "showSnackbar" | "showMessage" | "pendingActions" | "getPendingActions" | "resolveAction" | "startResolvingAction" | "addAction" | "getActions" | "getActionByKey" | "logEvent" | "logError" | "throwError" | "environmentVariables">;
3
+ }, keyof import('../main').BaseProps>;
35
4
  export declare const useConfig: () => Pick<{
36
5
  environment: import('../main').HortiViewEnvironments;
37
6
  setEnvironment: (environment: import('../main').HortiViewEnvironments) => void;
@@ -1,16 +1,15 @@
1
1
  export { ModuleBase } from './components/ModuleBase';
2
2
  export { ModuleCore } from './components/ModuleCore';
3
+ export type * from './types/ActionStorage';
3
4
  export type * from './types/AppInsights';
4
5
  export type * from './types/BaseProps';
5
6
  export type * from './types/CommonOptions';
6
- export type * from './types/Deprecated';
7
7
  export type * from './types/Environment';
8
8
  export type * from './types/EnvironmentVariable';
9
9
  export type * from './types/ModuleApi';
10
10
  export type * from './types/Requests';
11
11
  export type * from './types/ServiceBus';
12
12
  export type * from './types/SystemMessage';
13
- export type * from './types/ActionStorage';
14
13
  export * from './enum/ActionStorage';
15
14
  export { useBreadcrumbTranslation } from './hooks/useBreadcrumbTranslation';
16
15
  export { useOffline } from './hooks/useOffline';
@@ -22,7 +21,6 @@ export { useCustom } from './hooks/useCustom';
22
21
  export { useCustomMutation } from './hooks/useCustomMutation';
23
22
  export { useEntity } from './hooks/useEntity';
24
23
  export { useOption } from './hooks/useOption';
25
- export { useNotification, useServiceBus } from './hooks/useServiceBus';
26
- export { QueryClient, useInfiniteQuery, useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
24
+ export { QueryClient, useInfiniteQuery, useMutation, useQuery, useQueryClient, } from '@tanstack/react-query';
27
25
  export { mutateOnCustomApi } from './utils/fetches';
28
26
  export * from './utils/helper';
@@ -1,9 +1,7 @@
1
1
  import { ActionItem } from './ActionStorage';
2
2
  import { AppInsightsEvent, AppInsightsException, AppInsightsProperties } from './AppInsights';
3
3
  import { AllDropdownsData, CommonOption } from './CommonOptions';
4
- import { DeprecatedBaseProps } from './Deprecated';
5
4
  import { EnvironmentVariable } from './EnvironmentVariable';
6
- import { AlertServiceBusMessage } from './ServiceBus';
7
5
  import { SystemMessage } from './SystemMessage';
8
6
  /**
9
7
  * Properties that are passed to the Base component by the host application
@@ -17,19 +15,19 @@ import { SystemMessage } from './SystemMessage';
17
15
  * @param addTranslation function to add a translation to the i18n instance of the host application
18
16
  * @param currentNavigationPath current path of the route, that is changed, when the host application navigates
19
17
  */
20
- export type BaseProps = DeprecatedBaseProps & {
18
+ export type BaseProps = {
19
+ alertRules?: string;
21
20
  isOnline?: boolean;
22
21
  modulePermissionToken?: string;
23
22
  moduleId?: string;
24
23
  organizationId?: string;
25
24
  basePath?: string;
26
25
  currentNavigationPath?: string;
27
- sourcePath?: string | null;
28
26
  currentLanguage?: string;
29
27
  currentLanguageId?: string;
30
28
  commonOptions?: AllDropdownsData<CommonOption>['items'];
29
+ environmentVariables?: EnvironmentVariable[];
31
30
  refreshModulePermissionToken?: () => Promise<string | undefined>;
32
- riseNotification?: (message: AlertServiceBusMessage) => Promise<unknown>;
33
31
  navigateInHortiview?: (path: string) => void;
34
32
  addBreadcrumbTranslation?: (translation: {
35
33
  key: string;
@@ -47,5 +45,4 @@ export type BaseProps = DeprecatedBaseProps & {
47
45
  logEvent?: (event: AppInsightsEvent, customProperties?: AppInsightsProperties) => void;
48
46
  logError?: (exception: AppInsightsException) => void;
49
47
  throwError?: (message: string, code: number) => void;
50
- environmentVariables?: EnvironmentVariable[];
51
48
  };