@trackunit/iris-app-runtime-core 0.3.172 → 0.3.174

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
@@ -43,10 +43,9 @@ const doNothingByDefault = () => { };
43
43
  * @returns { Connection<HostConnectorApi> } the connection to the host
44
44
  */
45
45
  const setupHostConnector = (subscribedMethods) => {
46
- var _a;
47
46
  const methods = Object.assign({ onFilterBarValuesChanged: doNothingByDefault, onTokenChanged: doNothingByDefault, onAssetSortingStateChanged: doNothingByDefault }, subscribedMethods);
48
47
  const connection = penpal.connectToParent({ methods });
49
- (_a = connection.promise) === null || _a === void 0 ? void 0 : _a.catch(err => {
48
+ connection.promise.catch(err => {
50
49
  // TODO consider how to handle this catch
51
50
  // eslint-disable-next-line no-console
52
51
  console.log(err);
@@ -135,6 +134,8 @@ const CurrentUserRuntime = {
135
134
  * Get the value of a custom field from a raw value.
136
135
  *
137
136
  * @param customFieldDefinition the definition of the custom field
137
+ * @param customFieldDefinition.type the type of the custom field definition
138
+ * @param customFieldDefinition.isInteger whether the custom field is an integer
138
139
  * @param newValue the new value to set
139
140
  * @returns { CustomFieldValue } an updated CustomFieldValue
140
141
  */
@@ -171,7 +172,7 @@ const getCustomFieldValueToSaveFromRawValue = (customFieldDefinition, newValue)
171
172
  stringArrayValue.push(item);
172
173
  }
173
174
  else {
174
- stringArrayValue.push(item === null || item === void 0 ? void 0 : item.value);
175
+ stringArrayValue.push(item.value);
175
176
  }
176
177
  });
177
178
  }
@@ -180,7 +181,7 @@ const getCustomFieldValueToSaveFromRawValue = (customFieldDefinition, newValue)
180
181
  stringArrayValue.push(newValue);
181
182
  }
182
183
  else if (typeof newValue === "object") {
183
- stringArrayValue.push(newValue === null || newValue === void 0 ? void 0 : newValue.value);
184
+ stringArrayValue.push(newValue.value);
184
185
  }
185
186
  }
186
187
  return {
@@ -237,7 +238,7 @@ const getCustomFieldValueToSaveFromRawValue = (customFieldDefinition, newValue)
237
238
  */
238
239
  const getStringValue = (value) => {
239
240
  const stringValue = value;
240
- if (stringValue === null || stringValue === undefined) {
241
+ if (value === null || value === undefined) {
241
242
  return null;
242
243
  }
243
244
  else if (stringValue.trim().length === 0) {
@@ -330,6 +331,23 @@ const OemBrandingContextRuntime = {
330
331
  }),
331
332
  };
332
333
 
334
+ const ModalDialogRuntime = {
335
+ openModal() {
336
+ return __awaiter(this, void 0, void 0, function* () {
337
+ const scrollX = window.scrollX || 0;
338
+ const scrollY = window.scrollY || 0;
339
+ const api = yield getHostConnector();
340
+ return api.openModal({ scrollX, scrollY });
341
+ });
342
+ },
343
+ closeModal() {
344
+ return __awaiter(this, void 0, void 0, function* () {
345
+ const api = yield getHostConnector();
346
+ return api.closeModal();
347
+ });
348
+ },
349
+ };
350
+
333
351
  const NavigationRuntime = {
334
352
  gotoAssetHome: (assetId, options) => __awaiter(void 0, void 0, void 0, function* () {
335
353
  const api = yield getHostConnector();
@@ -454,6 +472,7 @@ exports.CustomerRuntime = CustomerRuntime;
454
472
  exports.EnvironmentRuntime = EnvironmentRuntime;
455
473
  exports.EventRuntime = EventRuntime;
456
474
  exports.FilterBarRuntime = FilterBarRuntime;
475
+ exports.ModalDialogRuntime = ModalDialogRuntime;
457
476
  exports.NavigationRuntime = NavigationRuntime;
458
477
  exports.OemBrandingContextRuntime = OemBrandingContextRuntime;
459
478
  exports.ParamsRuntime = ParamsRuntime;
package/index.esm.js CHANGED
@@ -39,10 +39,9 @@ const doNothingByDefault = () => { };
39
39
  * @returns { Connection<HostConnectorApi> } the connection to the host
40
40
  */
41
41
  const setupHostConnector = (subscribedMethods) => {
42
- var _a;
43
42
  const methods = Object.assign({ onFilterBarValuesChanged: doNothingByDefault, onTokenChanged: doNothingByDefault, onAssetSortingStateChanged: doNothingByDefault }, subscribedMethods);
44
43
  const connection = connectToParent({ methods });
45
- (_a = connection.promise) === null || _a === void 0 ? void 0 : _a.catch(err => {
44
+ connection.promise.catch(err => {
46
45
  // TODO consider how to handle this catch
47
46
  // eslint-disable-next-line no-console
48
47
  console.log(err);
@@ -131,6 +130,8 @@ const CurrentUserRuntime = {
131
130
  * Get the value of a custom field from a raw value.
132
131
  *
133
132
  * @param customFieldDefinition the definition of the custom field
133
+ * @param customFieldDefinition.type the type of the custom field definition
134
+ * @param customFieldDefinition.isInteger whether the custom field is an integer
134
135
  * @param newValue the new value to set
135
136
  * @returns { CustomFieldValue } an updated CustomFieldValue
136
137
  */
@@ -167,7 +168,7 @@ const getCustomFieldValueToSaveFromRawValue = (customFieldDefinition, newValue)
167
168
  stringArrayValue.push(item);
168
169
  }
169
170
  else {
170
- stringArrayValue.push(item === null || item === void 0 ? void 0 : item.value);
171
+ stringArrayValue.push(item.value);
171
172
  }
172
173
  });
173
174
  }
@@ -176,7 +177,7 @@ const getCustomFieldValueToSaveFromRawValue = (customFieldDefinition, newValue)
176
177
  stringArrayValue.push(newValue);
177
178
  }
178
179
  else if (typeof newValue === "object") {
179
- stringArrayValue.push(newValue === null || newValue === void 0 ? void 0 : newValue.value);
180
+ stringArrayValue.push(newValue.value);
180
181
  }
181
182
  }
182
183
  return {
@@ -233,7 +234,7 @@ const getCustomFieldValueToSaveFromRawValue = (customFieldDefinition, newValue)
233
234
  */
234
235
  const getStringValue = (value) => {
235
236
  const stringValue = value;
236
- if (stringValue === null || stringValue === undefined) {
237
+ if (value === null || value === undefined) {
237
238
  return null;
238
239
  }
239
240
  else if (stringValue.trim().length === 0) {
@@ -326,6 +327,23 @@ const OemBrandingContextRuntime = {
326
327
  }),
327
328
  };
328
329
 
330
+ const ModalDialogRuntime = {
331
+ openModal() {
332
+ return __awaiter(this, void 0, void 0, function* () {
333
+ const scrollX = window.scrollX || 0;
334
+ const scrollY = window.scrollY || 0;
335
+ const api = yield getHostConnector();
336
+ return api.openModal({ scrollX, scrollY });
337
+ });
338
+ },
339
+ closeModal() {
340
+ return __awaiter(this, void 0, void 0, function* () {
341
+ const api = yield getHostConnector();
342
+ return api.closeModal();
343
+ });
344
+ },
345
+ };
346
+
329
347
  const NavigationRuntime = {
330
348
  gotoAssetHome: (assetId, options) => __awaiter(void 0, void 0, void 0, function* () {
331
349
  const api = yield getHostConnector();
@@ -440,4 +458,4 @@ const UserSubscriptionRuntime = {
440
458
  }),
441
459
  };
442
460
 
443
- export { AnalyticsContextRuntime, AssetRuntime, AssetSortingRuntime, ConfirmationDialogRuntime, CurrentUserPreferenceRuntime, CurrentUserRuntime, CustomerRuntime, EnvironmentRuntime, EventRuntime, FilterBarRuntime, NavigationRuntime, OemBrandingContextRuntime, ParamsRuntime, RestRuntime, RouterRuntime, SiteRuntime, ToastRuntime, TokenRuntime, UserSubscriptionRuntime, getCustomFieldValueForDisplayInUI, getCustomFieldValueToSaveFromRawValue, getDateValue, getHostConnector, getStringValue, isValidCustomFieldValue, setupHostConnector };
461
+ export { AnalyticsContextRuntime, AssetRuntime, AssetSortingRuntime, ConfirmationDialogRuntime, CurrentUserPreferenceRuntime, CurrentUserRuntime, CustomerRuntime, EnvironmentRuntime, EventRuntime, FilterBarRuntime, ModalDialogRuntime, NavigationRuntime, OemBrandingContextRuntime, ParamsRuntime, RestRuntime, RouterRuntime, SiteRuntime, ToastRuntime, TokenRuntime, UserSubscriptionRuntime, getCustomFieldValueForDisplayInUI, getCustomFieldValueToSaveFromRawValue, getDateValue, getHostConnector, getStringValue, isValidCustomFieldValue, setupHostConnector };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/iris-app-runtime-core",
3
- "version": "0.3.172",
3
+ "version": "0.3.174",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -1,2 +1,2 @@
1
1
  import { IAnalyticsContextAsync } from "@trackunit/react-core-contexts-api";
2
- export declare const AnalyticsContextRuntime: IAnalyticsContextAsync<{}>;
2
+ export declare const AnalyticsContextRuntime: IAnalyticsContextAsync<Record<string, never>>;
@@ -1,5 +1,5 @@
1
1
  import { AssetInfo } from "@trackunit/iris-app-runtime-core-api";
2
- export interface IAssetRuntime {
2
+ export interface AssetRuntimeApi {
3
3
  getAssetInfo: () => Promise<AssetInfo>;
4
4
  }
5
- export declare const AssetRuntime: IAssetRuntime;
5
+ export declare const AssetRuntime: AssetRuntimeApi;
@@ -1,6 +1,6 @@
1
1
  import { AssetSortingContextValue } from "@trackunit/react-core-contexts-api";
2
- export interface IAssetSortingRuntime {
2
+ export interface AssetSortingRuntimeApi {
3
3
  getAssetSortingState: () => Promise<AssetSortingContextValue["sortingState"]>;
4
4
  setAssetSortingState: (...args: Parameters<AssetSortingContextValue["setSortBy"]>) => Promise<void>;
5
5
  }
6
- export declare const AssetSortingRuntime: IAssetSortingRuntime;
6
+ export declare const AssetSortingRuntime: AssetSortingRuntimeApi;
@@ -1,4 +1,4 @@
1
1
  import { ICurrentUserPreferenceContext } from "@trackunit/react-core-contexts-api";
2
- export interface ICurrentUserPreferenceRuntime extends ICurrentUserPreferenceContext {
2
+ export interface CurrentUserPreferenceRuntimeApi extends ICurrentUserPreferenceContext {
3
3
  }
4
- export declare const CurrentUserPreferenceRuntime: ICurrentUserPreferenceRuntime;
4
+ export declare const CurrentUserPreferenceRuntime: CurrentUserPreferenceRuntimeApi;
@@ -1,5 +1,5 @@
1
1
  import { ICurrentUserContext } from "@trackunit/react-core-contexts-api";
2
- export interface ICurrentUserRuntime {
2
+ export interface CurrentUserRuntimeApi {
3
3
  getCurrentUserContext: () => Promise<ICurrentUserContext>;
4
4
  }
5
- export declare const CurrentUserRuntime: ICurrentUserRuntime;
5
+ export declare const CurrentUserRuntime: CurrentUserRuntimeApi;
@@ -7,6 +7,8 @@ export interface DropdownSelection {
7
7
  * Get the value of a custom field from a raw value.
8
8
  *
9
9
  * @param customFieldDefinition the definition of the custom field
10
+ * @param customFieldDefinition.type the type of the custom field definition
11
+ * @param customFieldDefinition.isInteger whether the custom field is an integer
10
12
  * @param newValue the new value to set
11
13
  * @returns { CustomFieldValue } an updated CustomFieldValue
12
14
  */
@@ -17,7 +19,7 @@ export declare const getCustomFieldValueToSaveFromRawValue: (customFieldDefiniti
17
19
  /**
18
20
  * Convert the received value to a string
19
21
  */
20
- export declare const getStringValue: (value: boolean | string | string[] | DropdownSelection[] | DropdownSelection | number) => string | null;
22
+ export declare const getStringValue: (value: boolean | string | string[] | DropdownSelection[] | DropdownSelection | number | null | undefined) => string | null;
21
23
  /**
22
24
  * Format the received value to a date string
23
25
  * yyyy-mm-dd
@@ -1,5 +1,5 @@
1
1
  import { CustomerInfo } from "@trackunit/iris-app-runtime-core-api";
2
- export interface ICustomerRuntime {
2
+ export interface CustomerRuntimeApi {
3
3
  getCustomerInfo: () => Promise<CustomerInfo>;
4
4
  }
5
- export declare const CustomerRuntime: ICustomerRuntime;
5
+ export declare const CustomerRuntime: CustomerRuntimeApi;
@@ -1,5 +1,5 @@
1
1
  import { IEnvironmentContext } from "@trackunit/react-core-contexts-api";
2
- export interface IEnvironmentRuntime {
2
+ export interface EnvironmentRuntimeApi {
3
3
  getEnvironmentContext: () => Promise<IEnvironmentContext>;
4
4
  }
5
- export declare const EnvironmentRuntime: IEnvironmentRuntime;
5
+ export declare const EnvironmentRuntime: EnvironmentRuntimeApi;
@@ -1,5 +1,5 @@
1
1
  import { EventInfo } from "@trackunit/iris-app-runtime-core-api";
2
- export interface IEventRuntime {
2
+ export interface EventRuntimeApi {
3
3
  getEventInfo: () => Promise<EventInfo>;
4
4
  }
5
- export declare const EventRuntime: IEventRuntime;
5
+ export declare const EventRuntime: EventRuntimeApi;
@@ -1,5 +1,5 @@
1
1
  import { FilterBarValues } from "@trackunit/react-core-contexts-api";
2
- export interface IFilterBarRuntime {
2
+ export interface FilterBarRuntimeApi {
3
3
  getFilterBarValues: () => Promise<FilterBarValues>;
4
4
  }
5
- export declare const FilterBarRuntime: IFilterBarRuntime;
5
+ export declare const FilterBarRuntime: FilterBarRuntimeApi;
@@ -1,5 +1,5 @@
1
1
  import { IOemBrandingContext } from "@trackunit/react-core-contexts-api";
2
- export interface IOemBrandingContextRuntime {
2
+ export interface OemBrandingContextRuntimeApi {
3
3
  getOemBrandingContextRuntime: () => Promise<IOemBrandingContext>;
4
4
  }
5
- export declare const OemBrandingContextRuntime: IOemBrandingContextRuntime;
5
+ export declare const OemBrandingContextRuntime: OemBrandingContextRuntimeApi;
@@ -0,0 +1,2 @@
1
+ import { ModalDialogContextValue } from "@trackunit/react-core-contexts-api";
2
+ export declare const ModalDialogRuntime: ModalDialogContextValue;
@@ -1,6 +1,6 @@
1
- export interface IParamsRuntime {
1
+ export interface ParamsRuntimeApi {
2
2
  getAppName: () => Promise<string | undefined>;
3
3
  getExtensionName: () => Promise<string | undefined>;
4
4
  getOrgName: () => Promise<string | undefined>;
5
5
  }
6
- export declare const ParamsRuntime: IParamsRuntime;
6
+ export declare const ParamsRuntime: ParamsRuntimeApi;
@@ -1,7 +1,7 @@
1
1
  import { BodyType, HttpResponse, RequestParams } from "@trackunit/iris-app-runtime-core-api";
2
2
  export type RestRunTimeResponse = HttpResponse<any, any>;
3
- export interface IRestRuntime {
3
+ export interface 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: IRestRuntime;
7
+ export declare const RestRuntime: RestRuntimeApi;
@@ -1,4 +1,4 @@
1
- export interface IRouterRuntime {
1
+ export interface RouterRuntimeApi {
2
2
  getBasePath: () => string;
3
3
  }
4
- export declare const RouterRuntime: IRouterRuntime;
4
+ export declare const RouterRuntime: RouterRuntimeApi;
@@ -1,5 +1,5 @@
1
1
  import { SiteInfo } from "@trackunit/iris-app-runtime-core-api";
2
- export interface ISiteRuntime {
2
+ export interface SiteRuntimeApi {
3
3
  getSiteInfo: () => Promise<SiteInfo>;
4
4
  }
5
- export declare const SiteRuntime: ISiteRuntime;
5
+ export declare const SiteRuntime: SiteRuntimeApi;
@@ -1,5 +1,5 @@
1
1
  import { ITokenContext } from "@trackunit/react-core-contexts-api";
2
- export interface ITokenRuntime {
2
+ export interface TokenRuntimeApi {
3
3
  getTokenContext: () => Promise<ITokenContext>;
4
4
  }
5
- export declare const TokenRuntime: ITokenRuntime;
5
+ export declare const TokenRuntime: TokenRuntimeApi;
@@ -1,5 +1,5 @@
1
1
  import { IUserSubscriptionContext } from "@trackunit/react-core-contexts-api";
2
- export interface IUserSubscriptionRuntime {
2
+ export interface UserSubscriptionRuntimeApi {
3
3
  getUserSubscriptionContext: () => Promise<IUserSubscriptionContext>;
4
4
  }
5
- export declare const UserSubscriptionRuntime: IUserSubscriptionRuntime;
5
+ export declare const UserSubscriptionRuntime: UserSubscriptionRuntimeApi;
package/src/index.d.ts CHANGED
@@ -12,6 +12,7 @@ export * from "./EventRuntime";
12
12
  export * from "./FilterBarRuntime";
13
13
  export * from "./HostConnector";
14
14
  export * from "./IrisOemManifestRuntime";
15
+ export * from "./ModalDialogRuntime";
15
16
  export * from "./NavigationRuntime";
16
17
  export * from "./ParamsRuntime";
17
18
  export * from "./RestRuntime";