@trackunit/iris-app-runtime-core-api 0.3.73 → 0.3.75
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.js +27 -14
- package/index.esm.js +24 -15
- package/package.json +2 -2
- package/src/AssetRuntime.d.ts +2 -8
- package/src/HostConnector.d.ts +4 -15
- package/src/NavigationRuntime.d.ts +43 -0
- package/src/SiteRuntime.d.ts +2 -4
- package/src/index.d.ts +1 -0
package/index.cjs.js
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
5
|
+
const assetHomePageIds = [
|
6
|
+
"status",
|
7
|
+
"movement",
|
8
|
+
"events",
|
9
|
+
"insights",
|
10
|
+
"specification",
|
11
|
+
"telematics",
|
12
|
+
"activity-timeline",
|
13
|
+
];
|
14
14
|
|
15
15
|
exports.CustomFieldType = void 0;
|
16
16
|
(function (CustomFieldType) {
|
@@ -72,14 +72,27 @@ exports.UnitSi = void 0;
|
|
72
72
|
UnitSi["hour"] = "hour";
|
73
73
|
})(exports.UnitSi || (exports.UnitSi = {}));
|
74
74
|
|
75
|
+
/**
|
76
|
+
* type guard for IrisAppOptions
|
77
|
+
*/
|
78
|
+
const isIrisOptions = (options) => {
|
79
|
+
if (!options) {
|
80
|
+
return false;
|
81
|
+
}
|
82
|
+
return (typeof options === "object" &&
|
83
|
+
("irisAppId") in options &&
|
84
|
+
Boolean(options.irisAppId) &&
|
85
|
+
("extensionId") in options);
|
86
|
+
};
|
87
|
+
|
75
88
|
exports.BodyType = void 0;
|
76
89
|
(function (BodyType) {
|
77
90
|
BodyType[BodyType["Json"] = 0] = "Json";
|
78
91
|
BodyType[BodyType["FormData"] = 1] = "FormData";
|
79
92
|
})(exports.BodyType || (exports.BodyType = {}));
|
80
93
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
94
|
+
const siteHomePageIds = ["overview", "assets", "asset-visibility"];
|
95
|
+
|
96
|
+
exports.assetHomePageIds = assetHomePageIds;
|
97
|
+
exports.isIrisOptions = isIrisOptions;
|
98
|
+
exports.siteHomePageIds = siteHomePageIds;
|
package/index.esm.js
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
1
|
+
const assetHomePageIds = [
|
2
|
+
"status",
|
3
|
+
"movement",
|
4
|
+
"events",
|
5
|
+
"insights",
|
6
|
+
"specification",
|
7
|
+
"telematics",
|
8
|
+
"activity-timeline",
|
9
|
+
];
|
10
10
|
|
11
11
|
var CustomFieldType;
|
12
12
|
(function (CustomFieldType) {
|
@@ -68,16 +68,25 @@ var UnitSi;
|
|
68
68
|
UnitSi["hour"] = "hour";
|
69
69
|
})(UnitSi || (UnitSi = {}));
|
70
70
|
|
71
|
+
/**
|
72
|
+
* type guard for IrisAppOptions
|
73
|
+
*/
|
74
|
+
const isIrisOptions = (options) => {
|
75
|
+
if (!options) {
|
76
|
+
return false;
|
77
|
+
}
|
78
|
+
return (typeof options === "object" &&
|
79
|
+
("irisAppId") in options &&
|
80
|
+
Boolean(options.irisAppId) &&
|
81
|
+
("extensionId") in options);
|
82
|
+
};
|
83
|
+
|
71
84
|
var BodyType;
|
72
85
|
(function (BodyType) {
|
73
86
|
BodyType[BodyType["Json"] = 0] = "Json";
|
74
87
|
BodyType[BodyType["FormData"] = 1] = "FormData";
|
75
88
|
})(BodyType || (BodyType = {}));
|
76
89
|
|
77
|
-
|
78
|
-
(function (SiteHomeSubPage) {
|
79
|
-
SiteHomeSubPage["INFORMATION"] = "information";
|
80
|
-
SiteHomeSubPage["HISTORY"] = "history";
|
81
|
-
})(SiteHomeSubPage || (SiteHomeSubPage = {}));
|
90
|
+
const siteHomePageIds = ["overview", "assets", "asset-visibility"];
|
82
91
|
|
83
|
-
export {
|
92
|
+
export { BodyType, CustomFieldType, UnitSi, UnitUs, assetHomePageIds, isIrisOptions, siteHomePageIds };
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@trackunit/iris-app-runtime-core-api",
|
3
|
-
"version": "0.3.
|
3
|
+
"version": "0.3.75",
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
6
6
|
"engines": {
|
@@ -9,7 +9,7 @@
|
|
9
9
|
"module": "./index.esm.js",
|
10
10
|
"main": "./index.cjs.js",
|
11
11
|
"dependencies": {
|
12
|
-
"@trackunit/react-core-contexts-api": "0.2.
|
12
|
+
"@trackunit/react-core-contexts-api": "0.2.62"
|
13
13
|
},
|
14
14
|
"peerDependencies": {}
|
15
15
|
}
|
package/src/AssetRuntime.d.ts
CHANGED
@@ -1,11 +1,5 @@
|
|
1
1
|
export interface AssetInfo {
|
2
2
|
assetId: string;
|
3
3
|
}
|
4
|
-
export declare
|
5
|
-
|
6
|
-
EVENTS = "events",
|
7
|
-
INSIGHTS = "insights",
|
8
|
-
TELEMATICS = "telematics",
|
9
|
-
SPECIFICATION = "specification",
|
10
|
-
ACTIVITY_TIMELINE = "activity-timeline"
|
11
|
-
}
|
4
|
+
export declare const assetHomePageIds: readonly ["status", "movement", "events", "insights", "specification", "telematics", "activity-timeline"];
|
5
|
+
export type AssetHomePageId = (typeof assetHomePageIds)[number];
|
package/src/HostConnector.d.ts
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
import { FilterBarValues, IAnalyticsContextAsync, IAssetSortingContext, ICurrentUserContext, IEnvironmentContext, IGlobalSelectionContext, ITokenContext, IUserSubscriptionContext, OemBranding, OemBrandingImageType, SystemOfMeasurementType, TimeZonePreferenceType } from "@trackunit/react-core-contexts-api";
|
2
|
-
import {
|
2
|
+
import { AssetInfo } from "./AssetRuntime";
|
3
3
|
import { CurrentUserRole } from "./CurrentUserRuntime";
|
4
4
|
import { EntityIdentity, ValueAndDefinition, ValueAndDefinitionKey } from "./CustomFieldRuntime";
|
5
|
+
import { INavigationRuntime } from "./NavigationRuntime";
|
5
6
|
import { BodyType, HttpResponse, RequestParams } from "./RestRuntime";
|
6
|
-
import {
|
7
|
+
import { SiteInfo } from "./SiteRuntime";
|
7
8
|
import { PublicToast } from "./ToastRuntime";
|
8
9
|
export interface CustomFieldError {
|
9
10
|
/**
|
@@ -11,21 +12,10 @@ export interface CustomFieldError {
|
|
11
12
|
*/
|
12
13
|
customFieldKeys: string[];
|
13
14
|
}
|
14
|
-
export interface HostConnectorApi extends IAnalyticsContextAsync<{}
|
15
|
+
export interface HostConnectorApi extends IAnalyticsContextAsync<{}>, INavigationRuntime {
|
15
16
|
getAssetInfo(): Promise<AssetInfo>;
|
16
17
|
getAssetSortingState(): Promise<IAssetSortingContext["sortingState"]>;
|
17
18
|
setAssetSortingState(...args: Parameters<IAssetSortingContext["setSortBy"]>): Promise<void>;
|
18
|
-
gotoAssetHome(assetId: string, options?: {
|
19
|
-
irisAppId?: string;
|
20
|
-
extensionId?: string;
|
21
|
-
subPage?: AssetHomeSubPage;
|
22
|
-
}): Promise<boolean>;
|
23
|
-
gotoSiteHome(siteId: string, options?: {
|
24
|
-
irisAppId?: string;
|
25
|
-
extensionId?: string;
|
26
|
-
subPage?: SiteHomeSubPage;
|
27
|
-
}): Promise<boolean>;
|
28
|
-
gotoAppLibrary(irisAppId?: string): Promise<boolean>;
|
29
19
|
requestTrackunitRestApi: <T, E>(path: string, method: string, requestParams?: RequestParams, body?: unknown, bodyType?: BodyType, secureByDefault?: boolean) => Promise<HttpResponse<T, E>>;
|
30
20
|
getCustomFieldsFor(entity: EntityIdentity): Promise<ValueAndDefinition[]>;
|
31
21
|
setCustomFieldsFor(entity: EntityIdentity, values: ValueAndDefinitionKey[]): Promise<void | CustomFieldError>;
|
@@ -38,7 +28,6 @@ export interface HostConnectorApi extends IAnalyticsContextAsync<{}> {
|
|
38
28
|
getCurrentUserLanguage(): Promise<string>;
|
39
29
|
getCurrentUserTimeZonePreference(): Promise<TimeZonePreferenceType>;
|
40
30
|
getCurrentUserSystemOfMeasurement(): Promise<SystemOfMeasurementType>;
|
41
|
-
setDeepLink: SetDeepLink;
|
42
31
|
addToast(toast: PublicToast): Promise<void | "primaryAction" | "secondaryAction">;
|
43
32
|
getCurrentUserRole(userIds: string | string[]): Promise<CurrentUserRole | undefined>;
|
44
33
|
getAppName(): string | undefined;
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import { AssetHomePageId } from "./AssetRuntime";
|
2
|
+
import { SetDeepLink } from "./HostConnector";
|
3
|
+
import { SiteHomePageId } from "./SiteRuntime";
|
4
|
+
export type AutocompletePreservingString = string & {};
|
5
|
+
/**
|
6
|
+
* Page would often go in the sidebar. In asset home "status", "telematics" etc are pages
|
7
|
+
*/
|
8
|
+
type Page<TPage extends string> = {
|
9
|
+
page: TPage;
|
10
|
+
};
|
11
|
+
/**
|
12
|
+
* SubPage allows for extra deep navigation inside of the app.
|
13
|
+
*/
|
14
|
+
type SubPage = {
|
15
|
+
subPage?: string;
|
16
|
+
};
|
17
|
+
type NeverPage = {
|
18
|
+
page?: never;
|
19
|
+
};
|
20
|
+
type NeverIrisApp = {
|
21
|
+
irisAppId?: never;
|
22
|
+
extensionId?: never;
|
23
|
+
};
|
24
|
+
export type IrisAppOptions = {
|
25
|
+
irisAppId: string;
|
26
|
+
extensionId: string;
|
27
|
+
} & SubPage & NeverPage;
|
28
|
+
declare const mainApps: readonly ["fleet", "reports", "sites"];
|
29
|
+
export type MainFleetApp = (typeof mainApps)[number];
|
30
|
+
export type AssetHomeStandardOptions = Page<AssetHomePageId> & SubPage & NeverIrisApp;
|
31
|
+
export type SiteHomeStandardOptions = Page<SiteHomePageId> & SubPage & NeverIrisApp;
|
32
|
+
/**
|
33
|
+
* type guard for IrisAppOptions
|
34
|
+
*/
|
35
|
+
export declare const isIrisOptions: (options: IrisAppOptions | unknown) => options is IrisAppOptions;
|
36
|
+
export interface INavigationRuntime {
|
37
|
+
setDeepLink: SetDeepLink;
|
38
|
+
gotoAssetHome: (assetId: string, options?: IrisAppOptions | AssetHomeStandardOptions) => Promise<boolean>;
|
39
|
+
gotoSiteHome: (siteId: string, options?: IrisAppOptions | SiteHomeStandardOptions) => Promise<boolean>;
|
40
|
+
gotoAppLibrary: (irisAppId?: string) => Promise<boolean>;
|
41
|
+
gotoFleetApp: (options: IrisAppOptions | MainFleetApp) => Promise<boolean>;
|
42
|
+
}
|
43
|
+
export {};
|
package/src/SiteRuntime.d.ts
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
export interface SiteInfo {
|
2
2
|
siteId: string;
|
3
3
|
}
|
4
|
-
export declare
|
5
|
-
|
6
|
-
HISTORY = "history"
|
7
|
-
}
|
4
|
+
export declare const siteHomePageIds: readonly ["overview", "assets", "asset-visibility"];
|
5
|
+
export type SiteHomePageId = (typeof siteHomePageIds)[number];
|
package/src/index.d.ts
CHANGED
@@ -3,6 +3,7 @@ export * from "./ChildConnector";
|
|
3
3
|
export * from "./CurrentUserRuntime";
|
4
4
|
export * from "./CustomFieldRuntime";
|
5
5
|
export * from "./HostConnector";
|
6
|
+
export * from "./NavigationRuntime";
|
6
7
|
export * from "./RestRuntime";
|
7
8
|
export * from "./SiteRuntime";
|
8
9
|
export * from "./ToastRuntime";
|