@trackunit/react-core-hooks 0.2.64 → 0.2.66
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/index.cjs +387 -387
- package/index.js +387 -387
- package/package.json +5 -5
- package/src/analytics/AnalyticsProvider.d.ts +23 -23
- package/src/assetSorting/AssetSortingProvider.d.ts +36 -36
- package/src/environment/EnvironmentContextProvider.d.ts +23 -23
- package/src/global-selection/GlobalSelectionProvider.d.ts +26 -26
- package/src/index.d.ts +16 -16
- package/src/irisOemApp/IrisOemAppContextProvider.d.ts +24 -24
- package/src/runtimes/navigation/index.d.ts +1 -1
- package/src/runtimes/navigation/useDeeplink.d.ts +4 -4
- package/src/runtimes/navigation/useNavigationRuntime.d.ts +17 -17
- package/src/runtimes/navigation/useURLSynchronization.d.ts +4 -4
- package/src/runtimes/useAssetRuntime.d.ts +22 -22
- package/src/runtimes/useCustomFieldRuntime.d.ts +9 -9
- package/src/runtimes/useCustomFieldRuntimeForEntity.d.ts +23 -23
- package/src/runtimes/useRestRuntime.d.ts +10 -10
- package/src/runtimes/useSiteRuntime.d.ts +23 -23
- package/src/subscription/UserSubscriptionProvider.d.ts +24 -24
- package/src/toast/ToastProvider.d.ts +29 -29
- package/src/token/TokenProvider.d.ts +22 -22
- package/src/user/CurrentUserProvider.d.ts +27 -27
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-core-hooks",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.66",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
"type": "module",
|
|
12
12
|
"types": "./src/index.d.ts",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@trackunit/iris-app-runtime-core": "0.3.
|
|
15
|
-
"@trackunit/iris-app-runtime-core-api": "0.3.
|
|
16
|
-
"@trackunit/react-core-contexts-api": "0.2.
|
|
14
|
+
"@trackunit/iris-app-runtime-core": "0.3.52",
|
|
15
|
+
"@trackunit/iris-app-runtime-core-api": "0.3.46",
|
|
16
|
+
"@trackunit/react-core-contexts-api": "0.2.42",
|
|
17
17
|
"react": "18.2.0",
|
|
18
|
-
"react-router-dom": "6.
|
|
18
|
+
"react-router-dom": "6.11.2"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {}
|
|
21
21
|
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { BaseEvent, Event, IAnalyticsContext, UnspecifiedEvent } from "@trackunit/react-core-contexts-api";
|
|
3
|
-
export declare const AnalyticsContext: import("react").Context<IAnalyticsContext<{}> | null>;
|
|
4
|
-
export declare const AnalyticsContextProvider: import("react").Provider<IAnalyticsContext<{}> | null>;
|
|
5
|
-
/**
|
|
6
|
-
* Hook to get the analytics context.
|
|
7
|
-
*
|
|
8
|
-
* @requires AnalyticsProvider
|
|
9
|
-
* @example
|
|
10
|
-
* import { useAnalytics, useEnvironment } from "@trackunit/react-core-hooks";
|
|
11
|
-
* const { logPageView, logEvent } = useAnalytics(AllEvents);
|
|
12
|
-
*
|
|
13
|
-
* // log page view event
|
|
14
|
-
* useEffect(() => {
|
|
15
|
-
* logPageView({ pageName: "login" });
|
|
16
|
-
* }, [logPageView]);
|
|
17
|
-
*
|
|
18
|
-
* // log event when appropriate
|
|
19
|
-
* logEvent("Login", { loginPage: "New Manager" });
|
|
20
|
-
*
|
|
21
|
-
* @see {@link IAnalyticsContext}
|
|
22
|
-
*/
|
|
23
|
-
export declare const useAnalytics: <T extends Record<string, Event<BaseEvent | UnspecifiedEvent>>>(type: T) => IAnalyticsContext<T>;
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { BaseEvent, Event, IAnalyticsContext, UnspecifiedEvent } from "@trackunit/react-core-contexts-api";
|
|
3
|
+
export declare const AnalyticsContext: import("react").Context<IAnalyticsContext<{}> | null>;
|
|
4
|
+
export declare const AnalyticsContextProvider: import("react").Provider<IAnalyticsContext<{}> | null>;
|
|
5
|
+
/**
|
|
6
|
+
* Hook to get the analytics context.
|
|
7
|
+
*
|
|
8
|
+
* @requires AnalyticsProvider
|
|
9
|
+
* @example
|
|
10
|
+
* import { useAnalytics, useEnvironment } from "@trackunit/react-core-hooks";
|
|
11
|
+
* const { logPageView, logEvent } = useAnalytics(AllEvents);
|
|
12
|
+
*
|
|
13
|
+
* // log page view event
|
|
14
|
+
* useEffect(() => {
|
|
15
|
+
* logPageView({ pageName: "login" });
|
|
16
|
+
* }, [logPageView]);
|
|
17
|
+
*
|
|
18
|
+
* // log event when appropriate
|
|
19
|
+
* logEvent("Login", { loginPage: "New Manager" });
|
|
20
|
+
*
|
|
21
|
+
* @see {@link IAnalyticsContext}
|
|
22
|
+
*/
|
|
23
|
+
export declare const useAnalytics: <T extends Record<string, Event<BaseEvent | UnspecifiedEvent>>>(type: T) => IAnalyticsContext<T>;
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { IAssetSortingContext } from "@trackunit/react-core-contexts-api";
|
|
3
|
-
/**
|
|
4
|
-
* This is a provider for the AssetSortingContext.
|
|
5
|
-
*/
|
|
6
|
-
export declare const AssetSortingProvider: import("react").Provider<IAssetSortingContext | null>;
|
|
7
|
-
/**
|
|
8
|
-
* This is a hook to use the AssetSortingContext.
|
|
9
|
-
*
|
|
10
|
-
* @requires AssetSortingProvider
|
|
11
|
-
* @example
|
|
12
|
-
* import { useAssetSorting } from "@trackunit/react-core-hooks";
|
|
13
|
-
* const { sortingState, setSortBy } = useAssetSorting();
|
|
14
|
-
*
|
|
15
|
-
* const initialSort = useMemo(
|
|
16
|
-
* () => ({
|
|
17
|
-
* property: {
|
|
18
|
-
* label: sortingState.sortBy,
|
|
19
|
-
* value: sortingState.sortBy,
|
|
20
|
-
* },
|
|
21
|
-
* order: sortingState.order,
|
|
22
|
-
* }),
|
|
23
|
-
* [sortingState]
|
|
24
|
-
* );
|
|
25
|
-
*
|
|
26
|
-
* return (
|
|
27
|
-
* <Table
|
|
28
|
-
* ...
|
|
29
|
-
* headerOnSort={setSortBy}
|
|
30
|
-
* headerInitialSort={initialSort}
|
|
31
|
-
* />
|
|
32
|
-
* );
|
|
33
|
-
*
|
|
34
|
-
* @see {@link IAssetSortingContext}
|
|
35
|
-
*/
|
|
36
|
-
export declare const useAssetSorting: () => IAssetSortingContext;
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IAssetSortingContext } from "@trackunit/react-core-contexts-api";
|
|
3
|
+
/**
|
|
4
|
+
* This is a provider for the AssetSortingContext.
|
|
5
|
+
*/
|
|
6
|
+
export declare const AssetSortingProvider: import("react").Provider<IAssetSortingContext | null>;
|
|
7
|
+
/**
|
|
8
|
+
* This is a hook to use the AssetSortingContext.
|
|
9
|
+
*
|
|
10
|
+
* @requires AssetSortingProvider
|
|
11
|
+
* @example
|
|
12
|
+
* import { useAssetSorting } from "@trackunit/react-core-hooks";
|
|
13
|
+
* const { sortingState, setSortBy } = useAssetSorting();
|
|
14
|
+
*
|
|
15
|
+
* const initialSort = useMemo(
|
|
16
|
+
* () => ({
|
|
17
|
+
* property: {
|
|
18
|
+
* label: sortingState.sortBy,
|
|
19
|
+
* value: sortingState.sortBy,
|
|
20
|
+
* },
|
|
21
|
+
* order: sortingState.order,
|
|
22
|
+
* }),
|
|
23
|
+
* [sortingState]
|
|
24
|
+
* );
|
|
25
|
+
*
|
|
26
|
+
* return (
|
|
27
|
+
* <Table
|
|
28
|
+
* ...
|
|
29
|
+
* headerOnSort={setSortBy}
|
|
30
|
+
* headerInitialSort={initialSort}
|
|
31
|
+
* />
|
|
32
|
+
* );
|
|
33
|
+
*
|
|
34
|
+
* @see {@link IAssetSortingContext}
|
|
35
|
+
*/
|
|
36
|
+
export declare const useAssetSorting: () => IAssetSortingContext;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { IEnvironmentContext } from "@trackunit/react-core-contexts-api";
|
|
3
|
-
interface IProps {
|
|
4
|
-
value: IEnvironmentContext;
|
|
5
|
-
children?: React.ReactNode;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* This is a provider for the EnvironmentContext.
|
|
9
|
-
*/
|
|
10
|
-
export declare const EnvironmentContextProvider: (props: IProps) => JSX.Element;
|
|
11
|
-
/**
|
|
12
|
-
* This is a hook to use the EnvironmentContext.
|
|
13
|
-
*
|
|
14
|
-
* @requires EnvironmentContext
|
|
15
|
-
* @example
|
|
16
|
-
* import { useEnvironment } from "@trackunit/react-core-hooks";
|
|
17
|
-
* const { googleMapsApiKey } = useEnvironment();
|
|
18
|
-
* // use api key for something...
|
|
19
|
-
*
|
|
20
|
-
* @see (@link IEnvironmentContext)
|
|
21
|
-
*/
|
|
22
|
-
export declare const useEnvironment: () => IEnvironmentContext;
|
|
23
|
-
export {};
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IEnvironmentContext } from "@trackunit/react-core-contexts-api";
|
|
3
|
+
interface IProps {
|
|
4
|
+
value: IEnvironmentContext;
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* This is a provider for the EnvironmentContext.
|
|
9
|
+
*/
|
|
10
|
+
export declare const EnvironmentContextProvider: (props: IProps) => JSX.Element;
|
|
11
|
+
/**
|
|
12
|
+
* This is a hook to use the EnvironmentContext.
|
|
13
|
+
*
|
|
14
|
+
* @requires EnvironmentContext
|
|
15
|
+
* @example
|
|
16
|
+
* import { useEnvironment } from "@trackunit/react-core-hooks";
|
|
17
|
+
* const { googleMapsApiKey } = useEnvironment();
|
|
18
|
+
* // use api key for something...
|
|
19
|
+
*
|
|
20
|
+
* @see (@link IEnvironmentContext)
|
|
21
|
+
*/
|
|
22
|
+
export declare const useEnvironment: () => IEnvironmentContext;
|
|
23
|
+
export {};
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { IGlobalSelectionContext } from "@trackunit/react-core-contexts-api";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
/**
|
|
4
|
-
* This is a hook to use the GlobalSelectionContext.
|
|
5
|
-
*
|
|
6
|
-
* @requires GlobalSelectionProvider
|
|
7
|
-
* @example
|
|
8
|
-
* import { useGlobalSelection } from "@trackunit/react-core-hooks";
|
|
9
|
-
*
|
|
10
|
-
* export const useActiveGlobalGroupIdFilter = () => {
|
|
11
|
-
* const { selection } = useGlobalSelection();
|
|
12
|
-
* return (selection?.type === "group") ? selection.groupId : undefined;
|
|
13
|
-
* };
|
|
14
|
-
*
|
|
15
|
-
* @see {@link IGlobalSelectionContext}
|
|
16
|
-
*/
|
|
17
|
-
export declare const useGlobalSelection: () => IGlobalSelectionContext;
|
|
18
|
-
interface IProps {
|
|
19
|
-
value: IGlobalSelectionContext;
|
|
20
|
-
children?: React.ReactNode;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* This is a provider for the GlobalSelectionContext.
|
|
24
|
-
*/
|
|
25
|
-
export declare const GlobalSelectionProvider: (props: IProps) => JSX.Element;
|
|
26
|
-
export {};
|
|
1
|
+
import { IGlobalSelectionContext } from "@trackunit/react-core-contexts-api";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
/**
|
|
4
|
+
* This is a hook to use the GlobalSelectionContext.
|
|
5
|
+
*
|
|
6
|
+
* @requires GlobalSelectionProvider
|
|
7
|
+
* @example
|
|
8
|
+
* import { useGlobalSelection } from "@trackunit/react-core-hooks";
|
|
9
|
+
*
|
|
10
|
+
* export const useActiveGlobalGroupIdFilter = () => {
|
|
11
|
+
* const { selection } = useGlobalSelection();
|
|
12
|
+
* return (selection?.type === "group") ? selection.groupId : undefined;
|
|
13
|
+
* };
|
|
14
|
+
*
|
|
15
|
+
* @see {@link IGlobalSelectionContext}
|
|
16
|
+
*/
|
|
17
|
+
export declare const useGlobalSelection: () => IGlobalSelectionContext;
|
|
18
|
+
interface IProps {
|
|
19
|
+
value: IGlobalSelectionContext;
|
|
20
|
+
children?: React.ReactNode;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* This is a provider for the GlobalSelectionContext.
|
|
24
|
+
*/
|
|
25
|
+
export declare const GlobalSelectionProvider: (props: IProps) => JSX.Element;
|
|
26
|
+
export {};
|
package/src/index.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
export * from "./analytics/AnalyticsProvider";
|
|
2
|
-
export * from "./assetSorting/AssetSortingProvider";
|
|
3
|
-
export * from "./environment/EnvironmentContextProvider";
|
|
4
|
-
export * from "./global-selection/GlobalSelectionProvider";
|
|
5
|
-
export * from "./irisOemApp/IrisOemAppContextProvider";
|
|
6
|
-
export * from "./runtimes/navigation";
|
|
7
|
-
export * from "./runtimes/navigation/useNavigationRuntime";
|
|
8
|
-
export * from "./runtimes/useAssetRuntime";
|
|
9
|
-
export * from "./runtimes/useCustomFieldRuntime";
|
|
10
|
-
export * from "./runtimes/useCustomFieldRuntimeForEntity";
|
|
11
|
-
export * from "./runtimes/useRestRuntime";
|
|
12
|
-
export * from "./runtimes/useSiteRuntime";
|
|
13
|
-
export * from "./subscription/UserSubscriptionProvider";
|
|
14
|
-
export * from "./toast/ToastProvider";
|
|
15
|
-
export * from "./token/TokenProvider";
|
|
16
|
-
export * from "./user/CurrentUserProvider";
|
|
1
|
+
export * from "./analytics/AnalyticsProvider";
|
|
2
|
+
export * from "./assetSorting/AssetSortingProvider";
|
|
3
|
+
export * from "./environment/EnvironmentContextProvider";
|
|
4
|
+
export * from "./global-selection/GlobalSelectionProvider";
|
|
5
|
+
export * from "./irisOemApp/IrisOemAppContextProvider";
|
|
6
|
+
export * from "./runtimes/navigation";
|
|
7
|
+
export * from "./runtimes/navigation/useNavigationRuntime";
|
|
8
|
+
export * from "./runtimes/useAssetRuntime";
|
|
9
|
+
export * from "./runtimes/useCustomFieldRuntime";
|
|
10
|
+
export * from "./runtimes/useCustomFieldRuntimeForEntity";
|
|
11
|
+
export * from "./runtimes/useRestRuntime";
|
|
12
|
+
export * from "./runtimes/useSiteRuntime";
|
|
13
|
+
export * from "./subscription/UserSubscriptionProvider";
|
|
14
|
+
export * from "./toast/ToastProvider";
|
|
15
|
+
export * from "./token/TokenProvider";
|
|
16
|
+
export * from "./user/CurrentUserProvider";
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { IOemBrandingContext } from "@trackunit/react-core-contexts-api";
|
|
3
|
-
/**
|
|
4
|
-
* This is a hook to use the IOemBrandingContext.
|
|
5
|
-
*
|
|
6
|
-
* @requires OemBrandingContextProvider
|
|
7
|
-
* @example
|
|
8
|
-
* import { useOemBrandingContext } from "@trackunit/react-core-hooks";
|
|
9
|
-
* const { getOemBranding, getImageByBrand } = useOemBrandingContext();
|
|
10
|
-
* // use oem branding
|
|
11
|
-
* const branding = getOemBranding("some brand")
|
|
12
|
-
*
|
|
13
|
-
* @see {@link IOemBrandingContext}
|
|
14
|
-
*/
|
|
15
|
-
export declare const useOemBrandingContext: () => IOemBrandingContext;
|
|
16
|
-
interface IProps {
|
|
17
|
-
value: IOemBrandingContext;
|
|
18
|
-
children?: React.ReactNode;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* This is a provider for the IOemBrandingContext.
|
|
22
|
-
*/
|
|
23
|
-
export declare const OemBrandingContextProvider: (props: IProps) => JSX.Element;
|
|
24
|
-
export {};
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IOemBrandingContext } from "@trackunit/react-core-contexts-api";
|
|
3
|
+
/**
|
|
4
|
+
* This is a hook to use the IOemBrandingContext.
|
|
5
|
+
*
|
|
6
|
+
* @requires OemBrandingContextProvider
|
|
7
|
+
* @example
|
|
8
|
+
* import { useOemBrandingContext } from "@trackunit/react-core-hooks";
|
|
9
|
+
* const { getOemBranding, getImageByBrand } = useOemBrandingContext();
|
|
10
|
+
* // use oem branding
|
|
11
|
+
* const branding = getOemBranding("some brand")
|
|
12
|
+
*
|
|
13
|
+
* @see {@link IOemBrandingContext}
|
|
14
|
+
*/
|
|
15
|
+
export declare const useOemBrandingContext: () => IOemBrandingContext;
|
|
16
|
+
interface IProps {
|
|
17
|
+
value: IOemBrandingContext;
|
|
18
|
+
children?: React.ReactNode;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* This is a provider for the IOemBrandingContext.
|
|
22
|
+
*/
|
|
23
|
+
export declare const OemBrandingContextProvider: (props: IProps) => JSX.Element;
|
|
24
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./useURLSynchronization";
|
|
1
|
+
export * from "./useURLSynchronization";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type DeepLink = {
|
|
2
|
-
path: string;
|
|
3
|
-
search: Location["search"];
|
|
4
|
-
};
|
|
1
|
+
export type DeepLink = {
|
|
2
|
+
path: string;
|
|
3
|
+
search: Location["search"];
|
|
4
|
+
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { INavigationRuntime } from "@trackunit/iris-app-runtime-core";
|
|
2
|
-
export interface UseNavigationRuntime extends INavigationRuntime {
|
|
3
|
-
}
|
|
4
|
-
/**
|
|
5
|
-
* A hook to expose navigation runtime for React components
|
|
6
|
-
*
|
|
7
|
-
* @requires NavigationRuntime
|
|
8
|
-
* @returns {UseNavigationRuntime} navigationRuntime
|
|
9
|
-
* @example
|
|
10
|
-
* import { useNavigationRuntime } from "@trackunit/react-core-hooks";
|
|
11
|
-
* const { navigateTo } = useNavigationRuntime();
|
|
12
|
-
* // ...
|
|
13
|
-
* <Link onClick={() => gotoAssetHome(asset.id)} to="">
|
|
14
|
-
* {asset.name}
|
|
15
|
-
* </Link>
|
|
16
|
-
*/
|
|
17
|
-
export declare const useNavigationRuntime: () => UseNavigationRuntime;
|
|
1
|
+
import { INavigationRuntime } from "@trackunit/iris-app-runtime-core";
|
|
2
|
+
export interface UseNavigationRuntime extends INavigationRuntime {
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* A hook to expose navigation runtime for React components
|
|
6
|
+
*
|
|
7
|
+
* @requires NavigationRuntime
|
|
8
|
+
* @returns {UseNavigationRuntime} navigationRuntime
|
|
9
|
+
* @example
|
|
10
|
+
* import { useNavigationRuntime } from "@trackunit/react-core-hooks";
|
|
11
|
+
* const { navigateTo } = useNavigationRuntime();
|
|
12
|
+
* // ...
|
|
13
|
+
* <Link onClick={() => gotoAssetHome(asset.id)} to="">
|
|
14
|
+
* {asset.name}
|
|
15
|
+
* </Link>
|
|
16
|
+
*/
|
|
17
|
+
export declare const useNavigationRuntime: () => UseNavigationRuntime;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A react hook for notifying host about location changes
|
|
3
|
-
*/
|
|
4
|
-
export declare const useURLSynchronization: () => void;
|
|
1
|
+
/**
|
|
2
|
+
* A react hook for notifying host about location changes
|
|
3
|
+
*/
|
|
4
|
+
export declare const useURLSynchronization: () => void;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { AssetInfo } from "@trackunit/iris-app-runtime-core";
|
|
2
|
-
export interface UseAssetRuntime {
|
|
3
|
-
assetInfo: AssetInfo | undefined;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* A hook to expose asset runtime for React components
|
|
7
|
-
*
|
|
8
|
-
* @requires AssetRuntime
|
|
9
|
-
* @returns {UseAssetRuntime} assetRuntime
|
|
10
|
-
* @example
|
|
11
|
-
* import { useAssetRuntime } from "@trackunit/react-core-hooks";
|
|
12
|
-
* const { assetInfo } = useAssetRuntime();
|
|
13
|
-
* useEffect(() => {
|
|
14
|
-
* (async () => {
|
|
15
|
-
* if (assetInfo) {
|
|
16
|
-
* getAssetLocation({ variables: { id: assetInfo.assetId } });
|
|
17
|
-
* }
|
|
18
|
-
* })();
|
|
19
|
-
* }, [assetInfo, getAssetLocation]);
|
|
20
|
-
*
|
|
21
|
-
*/
|
|
22
|
-
export declare const useAssetRuntime: () => UseAssetRuntime;
|
|
1
|
+
import { AssetInfo } from "@trackunit/iris-app-runtime-core";
|
|
2
|
+
export interface UseAssetRuntime {
|
|
3
|
+
assetInfo: AssetInfo | undefined;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* A hook to expose asset runtime for React components
|
|
7
|
+
*
|
|
8
|
+
* @requires AssetRuntime
|
|
9
|
+
* @returns {UseAssetRuntime} assetRuntime
|
|
10
|
+
* @example
|
|
11
|
+
* import { useAssetRuntime } from "@trackunit/react-core-hooks";
|
|
12
|
+
* const { assetInfo } = useAssetRuntime();
|
|
13
|
+
* useEffect(() => {
|
|
14
|
+
* (async () => {
|
|
15
|
+
* if (assetInfo) {
|
|
16
|
+
* getAssetLocation({ variables: { id: assetInfo.assetId } });
|
|
17
|
+
* }
|
|
18
|
+
* })();
|
|
19
|
+
* }, [assetInfo, getAssetLocation]);
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
export declare const useAssetRuntime: () => UseAssetRuntime;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ICustomFieldRuntime } from "@trackunit/iris-app-runtime-core";
|
|
2
|
-
export interface UseCustomFieldRuntime extends ICustomFieldRuntime {
|
|
3
|
-
}
|
|
4
|
-
/**
|
|
5
|
-
* A hook to expose custom field runtime methods
|
|
6
|
-
*
|
|
7
|
-
* @returns {UseCustomFieldRuntime} CustomFieldRuntime
|
|
8
|
-
*/
|
|
9
|
-
export declare const useCustomFieldRuntime: () => UseCustomFieldRuntime;
|
|
1
|
+
import { ICustomFieldRuntime } from "@trackunit/iris-app-runtime-core";
|
|
2
|
+
export interface UseCustomFieldRuntime extends ICustomFieldRuntime {
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* A hook to expose custom field runtime methods
|
|
6
|
+
*
|
|
7
|
+
* @returns {UseCustomFieldRuntime} CustomFieldRuntime
|
|
8
|
+
*/
|
|
9
|
+
export declare const useCustomFieldRuntime: () => UseCustomFieldRuntime;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { ValueAndDefinition } from "@trackunit/iris-app-runtime-core";
|
|
2
|
-
import { EntityIdentity, ValueAndDefinitionKey } from "@trackunit/iris-app-runtime-core-api";
|
|
3
|
-
/**
|
|
4
|
-
* This hook is a wrapper around useCustomFieldRuntime that automatically fetches and sets custom fields for a given entity.
|
|
5
|
-
*
|
|
6
|
-
* @param entity The entity to fetch and set custom fields for.
|
|
7
|
-
* @returns The custom fields for the entity, and functions to set custom fields for the entity.
|
|
8
|
-
* @example
|
|
9
|
-
* import { useAssetRuntime, useCustomFieldRuntimeForEntity } from '@trackunit/react-core-hooks';
|
|
10
|
-
* const { assetInfo } = useAssetRuntime();
|
|
11
|
-
* const { customFields, setCustomFieldsForEntity } = useCustomFieldRuntimeForEntity( {
|
|
12
|
-
* id: assetInfo?.assetId || '',
|
|
13
|
-
* type: 'ASSET'
|
|
14
|
-
* });
|
|
15
|
-
*
|
|
16
|
-
* // set custom field data
|
|
17
|
-
* setCustomFieldsForEntity({"key": "value"});
|
|
18
|
-
*/
|
|
19
|
-
export declare const useCustomFieldRuntimeForEntity: (entity: EntityIdentity) => {
|
|
20
|
-
customFields: ValueAndDefinition[] | undefined;
|
|
21
|
-
setCustomFieldsFromFormDataForEntity: (formData: Record<string, boolean | string | string[] | number>) => Promise<void>;
|
|
22
|
-
setCustomFieldsForEntity: (values: ValueAndDefinitionKey[]) => Promise<void>;
|
|
23
|
-
};
|
|
1
|
+
import { ValueAndDefinition } from "@trackunit/iris-app-runtime-core";
|
|
2
|
+
import { EntityIdentity, ValueAndDefinitionKey } from "@trackunit/iris-app-runtime-core-api";
|
|
3
|
+
/**
|
|
4
|
+
* This hook is a wrapper around useCustomFieldRuntime that automatically fetches and sets custom fields for a given entity.
|
|
5
|
+
*
|
|
6
|
+
* @param entity The entity to fetch and set custom fields for.
|
|
7
|
+
* @returns The custom fields for the entity, and functions to set custom fields for the entity.
|
|
8
|
+
* @example
|
|
9
|
+
* import { useAssetRuntime, useCustomFieldRuntimeForEntity } from '@trackunit/react-core-hooks';
|
|
10
|
+
* const { assetInfo } = useAssetRuntime();
|
|
11
|
+
* const { customFields, setCustomFieldsForEntity } = useCustomFieldRuntimeForEntity( {
|
|
12
|
+
* id: assetInfo?.assetId || '',
|
|
13
|
+
* type: 'ASSET'
|
|
14
|
+
* });
|
|
15
|
+
*
|
|
16
|
+
* // set custom field data
|
|
17
|
+
* setCustomFieldsForEntity({"key": "value"});
|
|
18
|
+
*/
|
|
19
|
+
export declare const useCustomFieldRuntimeForEntity: (entity: EntityIdentity) => {
|
|
20
|
+
customFields: ValueAndDefinition[] | undefined;
|
|
21
|
+
setCustomFieldsFromFormDataForEntity: (formData: Record<string, boolean | string | string[] | number>) => Promise<void>;
|
|
22
|
+
setCustomFieldsForEntity: (values: ValueAndDefinitionKey[]) => Promise<void>;
|
|
23
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { IRestRuntime } from "@trackunit/iris-app-runtime-core";
|
|
2
|
-
interface UseRestRuntime extends IRestRuntime {
|
|
3
|
-
}
|
|
4
|
-
/**
|
|
5
|
-
* A hook to expose rest runtime to be used in React components
|
|
6
|
-
*
|
|
7
|
-
* @returns {UseRestRuntime} a RestRuntime
|
|
8
|
-
*/
|
|
9
|
-
export declare const useRestRuntime: () => UseRestRuntime;
|
|
10
|
-
export {};
|
|
1
|
+
import { IRestRuntime } from "@trackunit/iris-app-runtime-core";
|
|
2
|
+
interface UseRestRuntime extends IRestRuntime {
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* A hook to expose rest runtime to be used in React components
|
|
6
|
+
*
|
|
7
|
+
* @returns {UseRestRuntime} a RestRuntime
|
|
8
|
+
*/
|
|
9
|
+
export declare const useRestRuntime: () => UseRestRuntime;
|
|
10
|
+
export {};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { SiteInfo } from "@trackunit/iris-app-runtime-core";
|
|
2
|
-
export interface UseSiteRuntime {
|
|
3
|
-
siteInfo?: SiteInfo;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* A hook to expose site runtime for React components
|
|
7
|
-
*
|
|
8
|
-
* @requires SiteRuntime
|
|
9
|
-
* @returns {UseSiteRuntime} siteRuntime
|
|
10
|
-
* @example
|
|
11
|
-
* import { useSiteRuntime } from "@trackunit/react-core-hooks";
|
|
12
|
-
* const { siteInfo } = useSiteRuntime();
|
|
13
|
-
* // use siteInfo to get assets for instance.
|
|
14
|
-
* useEffect(() => {
|
|
15
|
-
* (async () => {
|
|
16
|
-
* if (siteInfo?.siteId) {
|
|
17
|
-
* getSiteAssets({ variables: { siteId: siteInfo?.siteId, siteIdStr: siteInfo?.siteId } });
|
|
18
|
-
* }
|
|
19
|
-
* })();
|
|
20
|
-
* }, [getSiteAssets, siteInfo]);
|
|
21
|
-
*
|
|
22
|
-
*/
|
|
23
|
-
export declare const useSiteRuntime: () => UseSiteRuntime;
|
|
1
|
+
import { SiteInfo } from "@trackunit/iris-app-runtime-core";
|
|
2
|
+
export interface UseSiteRuntime {
|
|
3
|
+
siteInfo?: SiteInfo;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* A hook to expose site runtime for React components
|
|
7
|
+
*
|
|
8
|
+
* @requires SiteRuntime
|
|
9
|
+
* @returns {UseSiteRuntime} siteRuntime
|
|
10
|
+
* @example
|
|
11
|
+
* import { useSiteRuntime } from "@trackunit/react-core-hooks";
|
|
12
|
+
* const { siteInfo } = useSiteRuntime();
|
|
13
|
+
* // use siteInfo to get assets for instance.
|
|
14
|
+
* useEffect(() => {
|
|
15
|
+
* (async () => {
|
|
16
|
+
* if (siteInfo?.siteId) {
|
|
17
|
+
* getSiteAssets({ variables: { siteId: siteInfo?.siteId, siteIdStr: siteInfo?.siteId } });
|
|
18
|
+
* }
|
|
19
|
+
* })();
|
|
20
|
+
* }, [getSiteAssets, siteInfo]);
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
export declare const useSiteRuntime: () => UseSiteRuntime;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { IUserSubscriptionContext } from "@trackunit/react-core-contexts-api";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
interface IProps {
|
|
4
|
-
value: IUserSubscriptionContext;
|
|
5
|
-
children?: React.ReactNode;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* This is a provider for the UserSubscriptionContext.
|
|
9
|
-
*/
|
|
10
|
-
export declare const UserSubscriptionProvider: (props: IProps) => JSX.Element;
|
|
11
|
-
/**
|
|
12
|
-
* This is a hook to use the UserSubscriptionContext.
|
|
13
|
-
*
|
|
14
|
-
* @requires UserSubscriptionProvider
|
|
15
|
-
* @example
|
|
16
|
-
* import { useUserSubscription } from "@trackunit/react-core-hooks";
|
|
17
|
-
* const { numberOfDaysWithAccessToHistoricalData, packageType } = useUserSubscription();
|
|
18
|
-
* // use it for something
|
|
19
|
-
* const data = fetchData(numberOfDaysWithAccessToHistoricalData)
|
|
20
|
-
*
|
|
21
|
-
* @see {@link IUserSubscriptionContext}
|
|
22
|
-
*/
|
|
23
|
-
export declare const useUserSubscription: () => IUserSubscriptionContext;
|
|
24
|
-
export {};
|
|
1
|
+
import { IUserSubscriptionContext } from "@trackunit/react-core-contexts-api";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
interface IProps {
|
|
4
|
+
value: IUserSubscriptionContext;
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* This is a provider for the UserSubscriptionContext.
|
|
9
|
+
*/
|
|
10
|
+
export declare const UserSubscriptionProvider: (props: IProps) => JSX.Element;
|
|
11
|
+
/**
|
|
12
|
+
* This is a hook to use the UserSubscriptionContext.
|
|
13
|
+
*
|
|
14
|
+
* @requires UserSubscriptionProvider
|
|
15
|
+
* @example
|
|
16
|
+
* import { useUserSubscription } from "@trackunit/react-core-hooks";
|
|
17
|
+
* const { numberOfDaysWithAccessToHistoricalData, packageType } = useUserSubscription();
|
|
18
|
+
* // use it for something
|
|
19
|
+
* const data = fetchData(numberOfDaysWithAccessToHistoricalData)
|
|
20
|
+
*
|
|
21
|
+
* @see {@link IUserSubscriptionContext}
|
|
22
|
+
*/
|
|
23
|
+
export declare const useUserSubscription: () => IUserSubscriptionContext;
|
|
24
|
+
export {};
|