@trackunit/iris-app-runtime-core 1.8.75 → 1.8.78

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
@@ -3,7 +3,9 @@
3
3
  var irisAppRuntimeCoreApi = require('@trackunit/iris-app-runtime-core-api');
4
4
  var penpal = require('penpal');
5
5
 
6
- const doNothingByDefault = () => { };
6
+ const doNothingByDefault = () => {
7
+ // do nothing by default
8
+ };
7
9
  /**
8
10
  * Setup using the subscribedMethods to subscribe to events from the host.
9
11
  *
@@ -34,7 +36,7 @@ const hostConnector = setupHostConnector({});
34
36
  /**
35
37
  * Gets the host connector.
36
38
  *
37
- * @returns { Promise<HostConnectorApi> } the connection to the host
39
+ * @returns { Promise<Connection<HostConnectorApi>> } the connection to the host
38
40
  */
39
41
  const getHostConnector = () => {
40
42
  return hostConnector.promise;
@@ -362,6 +364,18 @@ const OemBrandingContextRuntime = {
362
364
  getOemBranding: api.getOemBranding,
363
365
  };
364
366
  },
367
+ getAllBrandingDetails: async () => {
368
+ const api = await getHostConnector();
369
+ return api.getAllBrandingDetails();
370
+ },
371
+ getOemImage: async (imageId, size) => {
372
+ const api = await getHostConnector();
373
+ return api.getOemImage(imageId, size);
374
+ },
375
+ getOemBranding: async (accountId) => {
376
+ const api = await getHostConnector();
377
+ return api.getOemBranding(accountId);
378
+ },
365
379
  };
366
380
 
367
381
  const ModalDialogRuntime = {
@@ -475,14 +489,28 @@ const ParamsRuntime = {
475
489
  },
476
490
  };
477
491
 
492
+ /**
493
+ * Rest Runtime API accessor.
494
+ * This API is deprecated and will be removed in the future.
495
+ *
496
+ * @deprecated Use the Public Graphql instead.
497
+ */
478
498
  const RestRuntime = {
479
499
  apiHost: "https://API_HOST",
480
500
  async request(path, method, requestParams, body, bodyType, secureByDefault) {
481
501
  const api = await getHostConnector();
482
502
  return api.requestTrackunitRestApi(path, method, requestParams, body, bodyType, secureByDefault);
483
503
  },
504
+ async requestTrackunitRestApi(path, method, requestParams, body, bodyType, secureByDefault) {
505
+ const api = await getHostConnector();
506
+ return api.requestTrackunitRestApi(path, method, requestParams, body, bodyType, secureByDefault);
507
+ },
484
508
  };
485
509
 
510
+ /**
511
+ * Router Runtime API accessor.
512
+ * This API is used to get the base path of the router.
513
+ */
486
514
  const RouterRuntime = {
487
515
  getBasePath: () => {
488
516
  return `${document.getElementById("baseHref")?.getAttribute("href") || "<missing baseHref>"}${global.module}`;
@@ -557,23 +585,23 @@ const UserSubscriptionRuntime = {
557
585
  };
558
586
 
559
587
  const WidgetConfigRuntime = {
560
- getData: async () => {
588
+ getWidgetData: async () => {
561
589
  const api = await getHostConnector();
562
590
  return api.getWidgetData();
563
591
  },
564
- setData: async (data, dataVersion, title) => {
592
+ setWidgetData: async (data, dataVersion, title) => {
565
593
  const api = await getHostConnector();
566
594
  return api.setWidgetData(data, dataVersion, title);
567
595
  },
568
- getDataVersion: async () => {
596
+ getWidgetDataVersion: async () => {
569
597
  const api = await getHostConnector();
570
598
  return api.getWidgetDataVersion();
571
599
  },
572
- getTitle: async () => {
600
+ getWidgetTitle: async () => {
573
601
  const api = await getHostConnector();
574
602
  return api.getWidgetTitle();
575
603
  },
576
- setTitle: async (title) => {
604
+ setWidgetTitle: async (title) => {
577
605
  const api = await getHostConnector();
578
606
  return api.setWidgetTitle(title);
579
607
  },
@@ -589,7 +617,7 @@ const WidgetConfigRuntime = {
589
617
  const api = await getHostConnector();
590
618
  return api.setLoadingState(loadingState);
591
619
  },
592
- getPollInterval: async () => {
620
+ getWidgetPollInterval: async () => {
593
621
  const api = await getHostConnector();
594
622
  return api.getWidgetPollInterval();
595
623
  },
package/index.esm.js CHANGED
@@ -1,7 +1,9 @@
1
1
  export * from '@trackunit/iris-app-runtime-core-api';
2
2
  import { connectToParent } from 'penpal';
3
3
 
4
- const doNothingByDefault = () => { };
4
+ const doNothingByDefault = () => {
5
+ // do nothing by default
6
+ };
5
7
  /**
6
8
  * Setup using the subscribedMethods to subscribe to events from the host.
7
9
  *
@@ -32,7 +34,7 @@ const hostConnector = setupHostConnector({});
32
34
  /**
33
35
  * Gets the host connector.
34
36
  *
35
- * @returns { Promise<HostConnectorApi> } the connection to the host
37
+ * @returns { Promise<Connection<HostConnectorApi>> } the connection to the host
36
38
  */
37
39
  const getHostConnector = () => {
38
40
  return hostConnector.promise;
@@ -360,6 +362,18 @@ const OemBrandingContextRuntime = {
360
362
  getOemBranding: api.getOemBranding,
361
363
  };
362
364
  },
365
+ getAllBrandingDetails: async () => {
366
+ const api = await getHostConnector();
367
+ return api.getAllBrandingDetails();
368
+ },
369
+ getOemImage: async (imageId, size) => {
370
+ const api = await getHostConnector();
371
+ return api.getOemImage(imageId, size);
372
+ },
373
+ getOemBranding: async (accountId) => {
374
+ const api = await getHostConnector();
375
+ return api.getOemBranding(accountId);
376
+ },
363
377
  };
364
378
 
365
379
  const ModalDialogRuntime = {
@@ -473,14 +487,28 @@ const ParamsRuntime = {
473
487
  },
474
488
  };
475
489
 
490
+ /**
491
+ * Rest Runtime API accessor.
492
+ * This API is deprecated and will be removed in the future.
493
+ *
494
+ * @deprecated Use the Public Graphql instead.
495
+ */
476
496
  const RestRuntime = {
477
497
  apiHost: "https://API_HOST",
478
498
  async request(path, method, requestParams, body, bodyType, secureByDefault) {
479
499
  const api = await getHostConnector();
480
500
  return api.requestTrackunitRestApi(path, method, requestParams, body, bodyType, secureByDefault);
481
501
  },
502
+ async requestTrackunitRestApi(path, method, requestParams, body, bodyType, secureByDefault) {
503
+ const api = await getHostConnector();
504
+ return api.requestTrackunitRestApi(path, method, requestParams, body, bodyType, secureByDefault);
505
+ },
482
506
  };
483
507
 
508
+ /**
509
+ * Router Runtime API accessor.
510
+ * This API is used to get the base path of the router.
511
+ */
484
512
  const RouterRuntime = {
485
513
  getBasePath: () => {
486
514
  return `${document.getElementById("baseHref")?.getAttribute("href") || "<missing baseHref>"}${global.module}`;
@@ -555,23 +583,23 @@ const UserSubscriptionRuntime = {
555
583
  };
556
584
 
557
585
  const WidgetConfigRuntime = {
558
- getData: async () => {
586
+ getWidgetData: async () => {
559
587
  const api = await getHostConnector();
560
588
  return api.getWidgetData();
561
589
  },
562
- setData: async (data, dataVersion, title) => {
590
+ setWidgetData: async (data, dataVersion, title) => {
563
591
  const api = await getHostConnector();
564
592
  return api.setWidgetData(data, dataVersion, title);
565
593
  },
566
- getDataVersion: async () => {
594
+ getWidgetDataVersion: async () => {
567
595
  const api = await getHostConnector();
568
596
  return api.getWidgetDataVersion();
569
597
  },
570
- getTitle: async () => {
598
+ getWidgetTitle: async () => {
571
599
  const api = await getHostConnector();
572
600
  return api.getWidgetTitle();
573
601
  },
574
- setTitle: async (title) => {
602
+ setWidgetTitle: async (title) => {
575
603
  const api = await getHostConnector();
576
604
  return api.setWidgetTitle(title);
577
605
  },
@@ -587,7 +615,7 @@ const WidgetConfigRuntime = {
587
615
  const api = await getHostConnector();
588
616
  return api.setLoadingState(loadingState);
589
617
  },
590
- getPollInterval: async () => {
618
+ getWidgetPollInterval: async () => {
591
619
  const api = await getHostConnector();
592
620
  return api.getWidgetPollInterval();
593
621
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/iris-app-runtime-core",
3
- "version": "1.8.75",
3
+ "version": "1.8.78",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -8,10 +8,7 @@
8
8
  },
9
9
  "dependencies": {
10
10
  "penpal": "^6.2.2",
11
- "jest-fetch-mock": "^3.0.3",
12
- "@trackunit/react-core-contexts-api": "1.8.74",
13
- "@trackunit/iris-app-runtime-core-api": "1.7.75",
14
- "@trackunit/react-test-setup": "1.4.69"
11
+ "@trackunit/iris-app-runtime-core-api": "1.7.78"
15
12
  },
16
13
  "module": "./index.esm.js",
17
14
  "main": "./index.cjs.js",
@@ -1,2 +1,2 @@
1
- import { IAnalyticsContextAsync } from "@trackunit/react-core-contexts-api";
2
- export declare const AnalyticsContextRuntime: IAnalyticsContextAsync<Record<string, never>>;
1
+ import { AnalyticsRuntimeApi } from "@trackunit/iris-app-runtime-core-api";
2
+ export declare const AnalyticsContextRuntime: AnalyticsRuntimeApi;
@@ -1,5 +1,2 @@
1
- import { AssetInfo } from "@trackunit/iris-app-runtime-core-api";
2
- export interface AssetRuntimeApi {
3
- getAssetInfo: () => Promise<AssetInfo>;
4
- }
1
+ import { AssetRuntimeApi } from "@trackunit/iris-app-runtime-core-api";
5
2
  export declare const AssetRuntime: AssetRuntimeApi;
@@ -1,6 +1,2 @@
1
- import { AssetSortingContextValue } from "@trackunit/react-core-contexts-api";
2
- export interface AssetSortingRuntimeApi {
3
- getAssetSortingState: () => Promise<AssetSortingContextValue["sortingState"]>;
4
- setAssetSortingState: (...args: Parameters<AssetSortingContextValue["setSortBy"]>) => Promise<void>;
5
- }
1
+ import { AssetSortingRuntimeApi } from "@trackunit/iris-app-runtime-core-api";
6
2
  export declare const AssetSortingRuntime: AssetSortingRuntimeApi;
@@ -1,4 +1,4 @@
1
- import { FilterBarValues } from "@trackunit/react-core-contexts-api";
1
+ import { FilterBarValues } from "@trackunit/iris-app-runtime-core-api";
2
2
  export interface AssetsFilterBarRuntimeApi {
3
3
  getAssetsFilterBarValues: () => Promise<FilterBarValues | null>;
4
4
  }
@@ -1,2 +1,2 @@
1
- import { ConfirmationDialogContextValue } from "@trackunit/react-core-contexts-api";
2
- export declare const ConfirmationDialogRuntime: ConfirmationDialogContextValue;
1
+ import { ConfirmationDialogRuntimeApi } from "@trackunit/iris-app-runtime-core-api";
2
+ export declare const ConfirmationDialogRuntime: ConfirmationDialogRuntimeApi;
@@ -1,4 +1,2 @@
1
- import { ICurrentUserPreferenceContext } from "@trackunit/react-core-contexts-api";
2
- export interface CurrentUserPreferenceRuntimeApi extends ICurrentUserPreferenceContext {
3
- }
1
+ import { CurrentUserPreferenceRuntimeApi } from "@trackunit/iris-app-runtime-core-api";
4
2
  export declare const CurrentUserPreferenceRuntime: CurrentUserPreferenceRuntimeApi;
@@ -1,5 +1,2 @@
1
- import { CurrentUserContextInterface } from "@trackunit/react-core-contexts-api";
2
- export interface CurrentUserRuntimeApi {
3
- getCurrentUserContext: () => Promise<CurrentUserContextInterface>;
4
- }
1
+ import { CurrentUserRuntimeApi } from "@trackunit/iris-app-runtime-core-api";
5
2
  export declare const CurrentUserRuntime: CurrentUserRuntimeApi;
@@ -1,5 +1,4 @@
1
- import { CustomFieldValue, UnitOfMeasurementType } from "@trackunit/iris-app-runtime-core-api";
2
- import { SystemOfMeasurementType } from "@trackunit/react-core-contexts-api";
1
+ import { CustomFieldValue, SystemOfMeasurementType, UnitOfMeasurementType } from "@trackunit/iris-app-runtime-core-api";
3
2
  export interface DropdownSelection {
4
3
  value: string;
5
4
  }
@@ -1,5 +1,2 @@
1
- import { CustomerInfo } from "@trackunit/iris-app-runtime-core-api";
2
- export interface CustomerRuntimeApi {
3
- getCustomerInfo: () => Promise<CustomerInfo>;
4
- }
1
+ import { CustomerRuntimeApi } from "@trackunit/iris-app-runtime-core-api";
5
2
  export declare const CustomerRuntime: CustomerRuntimeApi;
@@ -1,4 +1,4 @@
1
- import { FilterBarValues } from "@trackunit/react-core-contexts-api";
1
+ import { FilterBarValues } from "@trackunit/iris-app-runtime-core-api";
2
2
  export interface CustomersFilterBarRuntimeApi {
3
3
  getCustomersFilterBarValues: () => Promise<FilterBarValues | null>;
4
4
  }
@@ -1,5 +1,2 @@
1
- import { IEnvironmentContext } from "@trackunit/react-core-contexts-api";
2
- export interface EnvironmentRuntimeApi {
3
- getEnvironmentContext: () => Promise<IEnvironmentContext>;
4
- }
1
+ import { EnvironmentRuntimeApi } from "@trackunit/iris-app-runtime-core-api";
5
2
  export declare const EnvironmentRuntime: EnvironmentRuntimeApi;
@@ -1,5 +1,2 @@
1
- import { EventInfo } from "@trackunit/iris-app-runtime-core-api";
2
- export interface EventRuntimeApi {
3
- getEventInfo: () => Promise<EventInfo>;
4
- }
1
+ import { EventRuntimeApi } from "@trackunit/iris-app-runtime-core-api";
5
2
  export declare const EventRuntime: EventRuntimeApi;
@@ -1,18 +1,15 @@
1
1
  import { ChildConnectorApi, HostConnectorApi } from "@trackunit/iris-app-runtime-core-api";
2
- import { Methods } from "penpal";
2
+ import { AsyncMethodReturns, Connection, Methods } from "penpal";
3
3
  /**
4
4
  * Setup using the subscribedMethods to subscribe to events from the host.
5
5
  *
6
6
  * @param subscribedMethods the methods to subscribe to
7
7
  * @returns { Connection<HostConnectorApi> } the connection to the host
8
8
  */
9
- export declare const setupHostConnector: (subscribedMethods: Partial<ChildConnectorApi> & Methods) => {
10
- promise: Promise<import("penpal").AsyncMethodReturns<HostConnectorApi>>;
11
- destroy: Function;
12
- };
9
+ export declare const setupHostConnector: (subscribedMethods: Partial<ChildConnectorApi> & Methods) => Connection<HostConnectorApi>;
13
10
  /**
14
11
  * Gets the host connector.
15
12
  *
16
- * @returns { Promise<HostConnectorApi> } the connection to the host
13
+ * @returns { Promise<Connection<HostConnectorApi>> } the connection to the host
17
14
  */
18
- export declare const getHostConnector: () => Promise<import("penpal").AsyncMethodReturns<HostConnectorApi>>;
15
+ export declare const getHostConnector: () => Promise<AsyncMethodReturns<HostConnectorApi>>;
@@ -1,5 +1,5 @@
1
- import { OemBrandingContext } from "@trackunit/react-core-contexts-api";
1
+ import { OemBrandingContext, OemBrandingRuntimeApi } from "@trackunit/iris-app-runtime-core-api";
2
2
  export interface OemBrandingContextRuntimeApi {
3
3
  getOemBrandingContextRuntime: () => Promise<OemBrandingContext>;
4
4
  }
5
- export declare const OemBrandingContextRuntime: OemBrandingContextRuntimeApi;
5
+ export declare const OemBrandingContextRuntime: OemBrandingContextRuntimeApi & OemBrandingRuntimeApi;
@@ -1,2 +1,2 @@
1
- import { ModalDialogContextValue } from "@trackunit/react-core-contexts-api";
2
- export declare const ModalDialogRuntime: ModalDialogContextValue;
1
+ import { ModalDialogRuntimeApi } from "@trackunit/iris-app-runtime-core-api";
2
+ export declare const ModalDialogRuntime: ModalDialogRuntimeApi;
@@ -1,2 +1,2 @@
1
- import { INavigationRuntime } from "@trackunit/iris-app-runtime-core-api";
2
- export declare const NavigationRuntime: INavigationRuntime;
1
+ import { NavigationRuntimeApi } from "@trackunit/iris-app-runtime-core-api";
2
+ export declare const NavigationRuntime: NavigationRuntimeApi;
@@ -1,6 +1,2 @@
1
- export interface ParamsRuntimeApi {
2
- getAppName: () => Promise<string | undefined>;
3
- getExtensionName: () => Promise<string | undefined>;
4
- getOrgName: () => Promise<string | undefined>;
5
- }
1
+ import { ParamsRuntimeApi } from "@trackunit/iris-app-runtime-core-api";
6
2
  export declare const ParamsRuntime: ParamsRuntimeApi;
@@ -1,7 +1,13 @@
1
- import { BodyType, HttpResponse, RequestParams } from "@trackunit/iris-app-runtime-core-api";
1
+ import { BodyType, HttpResponse, RequestParams, RestRuntimeApi } from "@trackunit/iris-app-runtime-core-api";
2
2
  export type RestRunTimeResponse = HttpResponse<any, any>;
3
- export interface RestRuntimeApi {
3
+ export interface RestRuntimeApiExtended extends RestRuntimeApi {
4
4
  apiHost: string;
5
5
  request: (path: string, method: string, requestParams?: RequestParams | undefined, body?: unknown, bodyType?: BodyType | undefined, secureByDefault?: boolean | undefined) => Promise<RestRunTimeResponse>;
6
6
  }
7
- export declare const RestRuntime: RestRuntimeApi;
7
+ /**
8
+ * Rest Runtime API accessor.
9
+ * This API is deprecated and will be removed in the future.
10
+ *
11
+ * @deprecated Use the Public Graphql instead.
12
+ */
13
+ export declare const RestRuntime: RestRuntimeApiExtended;
@@ -1,4 +1,6 @@
1
- export interface RouterRuntimeApi {
2
- getBasePath: () => string;
3
- }
1
+ import { RouterRuntimeApi } from "@trackunit/iris-app-runtime-core-api";
2
+ /**
3
+ * Router Runtime API accessor.
4
+ * This API is used to get the base path of the router.
5
+ */
4
6
  export declare const RouterRuntime: RouterRuntimeApi;
@@ -1,5 +1,2 @@
1
- import { SiteInfo } from "@trackunit/iris-app-runtime-core-api";
2
- export interface SiteRuntimeApi {
3
- getSiteInfo: () => Promise<SiteInfo>;
4
- }
1
+ import { SiteRuntimeApi } from "@trackunit/iris-app-runtime-core-api";
5
2
  export declare const SiteRuntime: SiteRuntimeApi;
@@ -1,4 +1,4 @@
1
- import { FilterBarValues } from "@trackunit/react-core-contexts-api";
1
+ import { FilterBarValues } from "@trackunit/iris-app-runtime-core-api";
2
2
  export interface SitesFilterBarRuntimeApi {
3
3
  getSitesFilterBarValues: () => Promise<FilterBarValues | null>;
4
4
  }
@@ -1,5 +1,2 @@
1
- import { ThemeCssProperties } from "@trackunit/iris-app-runtime-core-api";
2
- export interface ThemeCssRuntimeApi {
3
- getThemeCssProperties: () => Promise<ThemeCssProperties | null>;
4
- }
1
+ import { ThemeCssRuntimeApi } from "@trackunit/iris-app-runtime-core-api";
5
2
  export declare const ThemeCssRuntime: ThemeCssRuntimeApi;
@@ -1,11 +1,2 @@
1
- import { TemporalPeriod, TimeRange } from "@trackunit/react-core-contexts-api";
2
- export interface TimeRangeRuntimeApi {
3
- /**
4
- * Gets the time range.
5
- */
6
- getTimeRange: () => Promise<{
7
- timeRange: TimeRange | null;
8
- temporalPeriod: TemporalPeriod | null;
9
- }>;
10
- }
1
+ import { TimeRangeRuntimeApi } from "@trackunit/iris-app-runtime-core-api";
11
2
  export declare const TimeRangeRuntime: TimeRangeRuntimeApi;
@@ -1,4 +1,4 @@
1
- import { Toast } from "@trackunit/react-core-contexts-api";
1
+ import { Toast } from "@trackunit/iris-app-runtime-core-api";
2
2
  export declare const ToastRuntime: {
3
3
  addToast(toast: Toast): Promise<void | "primaryAction" | "secondaryAction">;
4
4
  removeToast(id: string): Promise<void>;
@@ -1,5 +1,2 @@
1
- import { ITokenContext } from "@trackunit/react-core-contexts-api";
2
- export interface TokenRuntimeApi {
3
- getTokenContext: () => Promise<ITokenContext>;
4
- }
1
+ import { TokenRuntimeApi } from "@trackunit/iris-app-runtime-core-api";
5
2
  export declare const TokenRuntime: TokenRuntimeApi;
@@ -1,5 +1,2 @@
1
- import { IUserSubscriptionContext } from "@trackunit/react-core-contexts-api";
2
- export interface UserSubscriptionRuntimeApi {
3
- getUserSubscriptionContext: () => Promise<IUserSubscriptionContext>;
4
- }
1
+ import { UserSubscriptionRuntimeApi } from "@trackunit/iris-app-runtime-core-api";
5
2
  export declare const UserSubscriptionRuntime: UserSubscriptionRuntimeApi;