@trackunit/iris-app-runtime-core-api 0.3.82 → 0.3.83

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 CHANGED
@@ -2,16 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const assetHomePageIds = [
6
- "status",
7
- "movement",
8
- "events",
9
- "insights",
10
- "specification",
11
- "telematics",
12
- "activity-timeline",
13
- ];
14
-
15
5
  exports.CustomFieldType = void 0;
16
6
  (function (CustomFieldType) {
17
7
  CustomFieldType["BOOLEAN"] = "BOOLEAN";
@@ -72,27 +62,8 @@ exports.UnitSi = void 0;
72
62
  UnitSi["hour"] = "hour";
73
63
  })(exports.UnitSi || (exports.UnitSi = {}));
74
64
 
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
-
88
65
  exports.BodyType = void 0;
89
66
  (function (BodyType) {
90
67
  BodyType[BodyType["Json"] = 0] = "Json";
91
68
  BodyType[BodyType["FormData"] = 1] = "FormData";
92
69
  })(exports.BodyType || (exports.BodyType = {}));
93
-
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,13 +1,3 @@
1
- const assetHomePageIds = [
2
- "status",
3
- "movement",
4
- "events",
5
- "insights",
6
- "specification",
7
- "telematics",
8
- "activity-timeline",
9
- ];
10
-
11
1
  var CustomFieldType;
12
2
  (function (CustomFieldType) {
13
3
  CustomFieldType["BOOLEAN"] = "BOOLEAN";
@@ -68,25 +58,10 @@ var UnitSi;
68
58
  UnitSi["hour"] = "hour";
69
59
  })(UnitSi || (UnitSi = {}));
70
60
 
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
-
84
61
  var BodyType;
85
62
  (function (BodyType) {
86
63
  BodyType[BodyType["Json"] = 0] = "Json";
87
64
  BodyType[BodyType["FormData"] = 1] = "FormData";
88
65
  })(BodyType || (BodyType = {}));
89
66
 
90
- const siteHomePageIds = ["overview", "assets", "asset-visibility"];
91
-
92
- export { BodyType, CustomFieldType, UnitSi, UnitUs, assetHomePageIds, isIrisOptions, siteHomePageIds };
67
+ export { BodyType, CustomFieldType, UnitSi, UnitUs };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/iris-app-runtime-core-api",
3
- "version": "0.3.82",
3
+ "version": "0.3.83",
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.68"
12
+ "@trackunit/react-core-contexts-api": "0.2.69"
13
13
  },
14
14
  "peerDependencies": {}
15
15
  }
@@ -1,5 +1,3 @@
1
1
  export interface AssetInfo {
2
2
  assetId: string;
3
3
  }
4
- export declare const assetHomePageIds: readonly ["status", "movement", "events", "insights", "specification", "telematics", "activity-timeline"];
5
- export type AssetHomePageId = (typeof assetHomePageIds)[number];
@@ -1,8 +1,7 @@
1
- import { FilterBarValues, IAnalyticsContextAsync, IAssetSortingContext, ICurrentUserContext, IEnvironmentContext, IGlobalSelectionContext, ITokenContext, IUserSubscriptionContext, OemBranding, OemBrandingImageType, SystemOfMeasurementType, TimeZonePreferenceType } from "@trackunit/react-core-contexts-api";
1
+ import { FilterBarValues, IAnalyticsContextAsync, IAssetSortingContext, ICurrentUserContext, ICurrentUserPreferenceContext, IEnvironmentContext, IGlobalSelectionContext, INavigationContext, IOemBrandingContext, ITokenContext, IUserSubscriptionContext, SetDeepLinkPromise } from "@trackunit/react-core-contexts-api";
2
2
  import { AssetInfo } from "./AssetRuntime";
3
3
  import { CurrentUserRole } from "./CurrentUserRuntime";
4
4
  import { EntityIdentity, ValueAndDefinition, ValueAndDefinitionKey } from "./CustomFieldRuntime";
5
- import { INavigationRuntime } from "./NavigationRuntime";
6
5
  import { BodyType, HttpResponse, RequestParams } from "./RestRuntime";
7
6
  import { SiteInfo } from "./SiteRuntime";
8
7
  import { PublicToast } from "./ToastRuntime";
@@ -12,36 +11,38 @@ export interface CustomFieldError {
12
11
  */
13
12
  customFieldKeys: string[];
14
13
  }
15
- export interface HostConnectorApi extends IAnalyticsContextAsync<{}>, INavigationRuntime {
16
- getAssetInfo(): Promise<AssetInfo>;
14
+ export interface HostConnectorApi extends IAnalyticsContextAsync<{}>, INavigationContext, IOemBrandingContext, ICurrentUserPreferenceContext {
17
15
  getAssetSortingState(): Promise<IAssetSortingContext["sortingState"]>;
18
16
  setAssetSortingState(...args: Parameters<IAssetSortingContext["setSortBy"]>): Promise<void>;
19
- requestTrackunitRestApi: <T, E>(path: string, method: string, requestParams?: RequestParams, body?: unknown, bodyType?: BodyType, secureByDefault?: boolean) => Promise<HttpResponse<T, E>>;
20
- getCustomFieldsFor(entity: EntityIdentity): Promise<ValueAndDefinition[]>;
21
- setCustomFieldsFor(entity: EntityIdentity, values: ValueAndDefinitionKey[]): Promise<void | CustomFieldError>;
22
17
  getEnvironmentContext(): Promise<IEnvironmentContext>;
23
- getUserSubscriptionContext(): Promise<IUserSubscriptionContext>;
24
18
  getTokenContext(): Promise<ITokenContext>;
19
+ getCurrentUserContext(): Promise<ICurrentUserContext>;
20
+ getCurrentUserRole(userIds: string | string[]): Promise<CurrentUserRole | undefined>;
21
+ getUserSubscriptionContext(): Promise<IUserSubscriptionContext>;
25
22
  getGlobalSelectionContext(): Promise<IGlobalSelectionContext>;
23
+ /**
24
+ * use this to keep the deep link in sync with the host page.
25
+ */
26
+ setDeepLink: SetDeepLinkPromise;
27
+ getCustomFieldsFor(entity: EntityIdentity): Promise<ValueAndDefinition[]>;
28
+ setCustomFieldsFor(entity: EntityIdentity, values: ValueAndDefinitionKey[]): Promise<void | CustomFieldError>;
29
+ /**
30
+ * Used to get the current filter bar values, only if the host page has a filterbar.
31
+ */
26
32
  getFilterBarValues(): Promise<FilterBarValues>;
27
- getCurrentUserContext(): Promise<ICurrentUserContext>;
28
- getCurrentUserLanguage(): Promise<string>;
29
- getCurrentUserTimeZonePreference(): Promise<TimeZonePreferenceType>;
30
- getCurrentUserSystemOfMeasurement(): Promise<SystemOfMeasurementType>;
33
+ /**
34
+ * Adds a toast to the host pages toast stack.
35
+ *
36
+ * @param toast the toast to add
37
+ */
31
38
  addToast(toast: PublicToast): Promise<void | "primaryAction" | "secondaryAction">;
32
- getCurrentUserRole(userIds: string | string[]): Promise<CurrentUserRole | undefined>;
33
39
  getAppName(): string | undefined;
34
40
  getOrgName(): string | undefined;
35
41
  getExtensionName(): string | undefined;
36
42
  getSiteInfo(): Promise<SiteInfo>;
37
- getAllBrandingDetails(): Promise<Record<string, OemBranding>>;
38
- getOemBranding: (brand: string) => Promise<OemBranding | null>;
39
- getOemImage: (imageType: OemBrandingImageType, brand: string, model?: string) => Promise<string | null>;
43
+ getAssetInfo(): Promise<AssetInfo>;
44
+ /**
45
+ * @deprecated you should use GQL instead
46
+ */
47
+ requestTrackunitRestApi: <T, E>(path: string, method: string, requestParams?: RequestParams, body?: unknown, bodyType?: BodyType, secureByDefault?: boolean) => Promise<HttpResponse<T, E>>;
40
48
  }
41
- export type SetDeepLink = (deepLink: DeepLink) => void;
42
- export type DeepLink = {
43
- path: string;
44
- pathname: string;
45
- search: Location["search"];
46
- hash: Location["hash"];
47
- };
@@ -1,47 +1,3 @@
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
- } & SubPage & QueryString;
11
- /**
12
- * SubPage allows for extra deep navigation inside of the app.
13
- */
14
- type SubPage = {
15
- subPage?: string;
16
- };
17
- type QueryString = {
18
- queryString?: string;
19
- };
20
- type NeverPage = {
21
- page?: never;
22
- };
23
- type NeverIrisApp = {
24
- irisAppId?: never;
25
- extensionId?: never;
26
- };
27
- export type IrisAppOptions = {
28
- irisAppId: string;
29
- extensionId: string;
30
- } & SubPage & QueryString & NeverPage;
31
- declare const mainApps: readonly ["fleet", "reports", "sites"];
32
- export type MainFleetApp = (typeof mainApps)[number];
33
- export type AssetHomeStandardOptions = Page<AssetHomePageId> & NeverIrisApp;
34
- export type SiteHomeStandardOptions = Page<SiteHomePageId> & NeverIrisApp;
35
- export type FleetAppStandardOptions = Page<MainFleetApp> & NeverIrisApp;
36
- /**
37
- * type guard for IrisAppOptions
38
- */
39
- export declare const isIrisOptions: (options: IrisAppOptions | unknown) => options is IrisAppOptions;
40
- export interface INavigationRuntime {
41
- setDeepLink: SetDeepLink;
42
- gotoAssetHome: (assetId: string, options?: IrisAppOptions | AssetHomeStandardOptions) => Promise<boolean>;
43
- gotoSiteHome: (siteId: string, options?: IrisAppOptions | SiteHomeStandardOptions) => Promise<boolean>;
44
- gotoAppLibrary: (irisAppId?: string) => Promise<boolean>;
45
- gotoFleetApp: (options: IrisAppOptions | FleetAppStandardOptions) => Promise<boolean>;
1
+ import { INavigationContext } from "@trackunit/react-core-contexts-api";
2
+ export interface INavigationRuntime extends INavigationContext {
46
3
  }
47
- export {};
@@ -1,5 +1,3 @@
1
1
  export interface SiteInfo {
2
2
  siteId: string;
3
3
  }
4
- export declare const siteHomePageIds: readonly ["overview", "assets", "asset-visibility"];
5
- export type SiteHomePageId = (typeof siteHomePageIds)[number];