@trackunit/iris-app-runtime-core 0.3.187-alpha-2936c016d71.0 → 0.3.188

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
@@ -1,40 +1,8 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var irisAppRuntimeCoreApi = require('@trackunit/iris-app-runtime-core-api');
6
4
  var penpal = require('penpal');
7
5
 
8
- /******************************************************************************
9
- Copyright (c) Microsoft Corporation.
10
-
11
- Permission to use, copy, modify, and/or distribute this software for any
12
- purpose with or without fee is hereby granted.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
15
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
16
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
17
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
18
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
19
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20
- PERFORMANCE OF THIS SOFTWARE.
21
- ***************************************************************************** */
22
-
23
- function __awaiter(thisArg, _arguments, P, generator) {
24
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
25
- return new (P || (P = Promise))(function (resolve, reject) {
26
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
27
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
28
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
29
- step((generator = generator.apply(thisArg, _arguments || [])).next());
30
- });
31
- }
32
-
33
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
34
- var e = new Error(message);
35
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
36
- };
37
-
38
6
  const doNothingByDefault = () => { };
39
7
  /**
40
8
  * Setup using the subscribedMethods to subscribe to events from the host.
@@ -43,7 +11,12 @@ const doNothingByDefault = () => { };
43
11
  * @returns { Connection<HostConnectorApi> } the connection to the host
44
12
  */
45
13
  const setupHostConnector = (subscribedMethods) => {
46
- const methods = Object.assign({ onFilterBarValuesChanged: doNothingByDefault, onTokenChanged: doNothingByDefault, onAssetSortingStateChanged: doNothingByDefault }, subscribedMethods);
14
+ const methods = {
15
+ onFilterBarValuesChanged: doNothingByDefault,
16
+ onTokenChanged: doNothingByDefault,
17
+ onAssetSortingStateChanged: doNothingByDefault,
18
+ ...subscribedMethods,
19
+ };
47
20
  const connection = penpal.connectToParent({ methods });
48
21
  connection.promise.catch(err => {
49
22
  // TODO consider how to handle this catch
@@ -63,71 +36,71 @@ const getHostConnector = () => {
63
36
  };
64
37
 
65
38
  const AnalyticsContextRuntime = {
66
- logPageView: (details) => __awaiter(void 0, void 0, void 0, function* () {
67
- const api = yield getHostConnector();
39
+ logPageView: async (details) => {
40
+ const api = await getHostConnector();
68
41
  api.logPageView(details);
69
- }),
70
- logError: (details) => __awaiter(void 0, void 0, void 0, function* () {
71
- const api = yield getHostConnector();
42
+ },
43
+ logError: async (details) => {
44
+ const api = await getHostConnector();
72
45
  api.logError(details);
73
- }),
74
- logEvent: (eventName, details, nameSupplement) => __awaiter(void 0, void 0, void 0, function* () {
75
- const api = yield getHostConnector();
46
+ },
47
+ logEvent: async (eventName, details, nameSupplement) => {
48
+ const api = await getHostConnector();
76
49
  api.logEvent(eventName, details, nameSupplement);
77
- }),
78
- setUserProperty: (name, data) => __awaiter(void 0, void 0, void 0, function* () {
79
- const api = yield getHostConnector();
50
+ },
51
+ setUserProperty: async (name, data) => {
52
+ const api = await getHostConnector();
80
53
  api.setUserProperty(name, data);
81
- }),
54
+ },
82
55
  };
83
56
 
84
57
  const AssetRuntime = {
85
- getAssetInfo: () => __awaiter(void 0, void 0, void 0, function* () {
86
- const api = yield getHostConnector();
58
+ getAssetInfo: async () => {
59
+ const api = await getHostConnector();
87
60
  return api.getAssetInfo();
88
- }),
61
+ },
89
62
  };
90
63
 
91
64
  const AssetSortingRuntime = {
92
- getAssetSortingState: () => __awaiter(void 0, void 0, void 0, function* () {
93
- const api = yield getHostConnector();
65
+ getAssetSortingState: async () => {
66
+ const api = await getHostConnector();
94
67
  return api.getAssetSortingState();
95
- }),
96
- setAssetSortingState: (...args) => __awaiter(void 0, void 0, void 0, function* () {
97
- const api = yield getHostConnector();
68
+ },
69
+ setAssetSortingState: async (...args) => {
70
+ const api = await getHostConnector();
98
71
  return api.setAssetSortingState(...args);
99
- }),
72
+ },
100
73
  };
101
74
 
102
75
  const ConfirmationDialogRuntime = {
103
- confirm(props) {
104
- return __awaiter(this, void 0, void 0, function* () {
105
- const api = yield getHostConnector();
106
- return api.confirm(Object.assign({}, props));
76
+ async confirm(props) {
77
+ const api = await getHostConnector();
78
+ return api.confirm({
79
+ ...props,
107
80
  });
108
81
  },
109
82
  };
110
83
 
111
84
  const CurrentUserPreferenceRuntime = {
112
- getCurrentUserLanguage: () => __awaiter(void 0, void 0, void 0, function* () {
113
- const api = yield getHostConnector();
85
+ getCurrentUserLanguage: async () => {
86
+ const api = await getHostConnector();
114
87
  return api.getCurrentUserLanguage();
115
- }),
116
- getCurrentUserTimeZonePreference: () => __awaiter(void 0, void 0, void 0, function* () {
117
- const api = yield getHostConnector();
88
+ },
89
+ getCurrentUserTimeZonePreference: async () => {
90
+ const api = await getHostConnector();
118
91
  return api.getCurrentUserTimeZonePreference();
119
- }),
120
- getCurrentUserSystemOfMeasurement: () => __awaiter(void 0, void 0, void 0, function* () {
121
- const api = yield getHostConnector();
92
+ },
93
+ getCurrentUserSystemOfMeasurement: async () => {
94
+ const api = await getHostConnector();
122
95
  return api.getCurrentUserSystemOfMeasurement();
123
- }),
96
+ },
124
97
  };
125
98
 
126
99
  const CurrentUserRuntime = {
127
- getCurrentUserContext: () => __awaiter(void 0, void 0, void 0, function* () {
128
- const api = yield getHostConnector();
100
+ getCurrentUserContext: async () => {
101
+ const api = await getHostConnector();
129
102
  return api.getCurrentUserContext();
130
- }),
103
+ },
131
104
  };
132
105
 
133
106
  /**
@@ -295,122 +268,116 @@ const isValidCustomFieldValue = (value) => {
295
268
  };
296
269
 
297
270
  const CustomerRuntime = {
298
- getCustomerInfo: () => __awaiter(void 0, void 0, void 0, function* () {
299
- const api = yield getHostConnector();
271
+ getCustomerInfo: async () => {
272
+ const api = await getHostConnector();
300
273
  return api.getCustomerInfo();
301
- }),
274
+ },
302
275
  };
303
276
 
304
277
  const EnvironmentRuntime = {
305
- getEnvironmentContext: () => __awaiter(void 0, void 0, void 0, function* () {
306
- const api = yield getHostConnector();
278
+ getEnvironmentContext: async () => {
279
+ const api = await getHostConnector();
307
280
  return api.getEnvironmentContext();
308
- }),
281
+ },
309
282
  };
310
283
 
311
284
  const EventRuntime = {
312
- getEventInfo: () => __awaiter(void 0, void 0, void 0, function* () {
313
- const api = yield getHostConnector();
285
+ getEventInfo: async () => {
286
+ const api = await getHostConnector();
314
287
  return api.getEventInfo();
315
- }),
288
+ },
316
289
  };
317
290
 
318
291
  const FilterBarRuntime = {
319
- getFilterBarValues: () => __awaiter(void 0, void 0, void 0, function* () {
320
- const api = yield getHostConnector();
292
+ getFilterBarValues: async () => {
293
+ const api = await getHostConnector();
321
294
  return api.getFilterBarValues();
322
- }),
295
+ },
323
296
  };
324
297
 
325
298
  const OemBrandingContextRuntime = {
326
- getOemBrandingContextRuntime: () => __awaiter(void 0, void 0, void 0, function* () {
327
- const api = yield getHostConnector();
299
+ getOemBrandingContextRuntime: async () => {
300
+ const api = await getHostConnector();
328
301
  return {
329
302
  getAllBrandingDetails: api.getAllBrandingDetails,
330
303
  getOemImage: api.getOemImage,
331
304
  getOemBranding: api.getOemBranding,
332
305
  };
333
- }),
306
+ },
334
307
  };
335
308
 
336
309
  const ModalDialogRuntime = {
337
- openModal() {
338
- return __awaiter(this, void 0, void 0, function* () {
339
- const scrollX = window.scrollX || 0;
340
- const scrollY = window.scrollY || 0;
341
- const api = yield getHostConnector();
342
- return api.openModal({ scrollX, scrollY });
343
- });
310
+ async openModal() {
311
+ const scrollX = window.scrollX || 0;
312
+ const scrollY = window.scrollY || 0;
313
+ const api = await getHostConnector();
314
+ return api.openModal({ scrollX, scrollY });
344
315
  },
345
- closeModal() {
346
- return __awaiter(this, void 0, void 0, function* () {
347
- const api = yield getHostConnector();
348
- return api.closeModal();
349
- });
316
+ async closeModal() {
317
+ const api = await getHostConnector();
318
+ return api.closeModal();
350
319
  },
351
320
  };
352
321
 
353
322
  const NavigationRuntime = {
354
- gotoAssetHome: (assetId, options) => __awaiter(void 0, void 0, void 0, function* () {
355
- const api = yield getHostConnector();
323
+ gotoAssetHome: async (assetId, options) => {
324
+ const api = await getHostConnector();
356
325
  return api.gotoAssetHome(assetId, options);
357
- }),
358
- gotoSiteHome: (siteId, options) => __awaiter(void 0, void 0, void 0, function* () {
359
- const api = yield getHostConnector();
326
+ },
327
+ gotoSiteHome: async (siteId, options) => {
328
+ const api = await getHostConnector();
360
329
  return api.gotoSiteHome(siteId, options);
361
- }),
362
- gotoAppLibrary: (irisAppId) => __awaiter(void 0, void 0, void 0, function* () {
363
- const api = yield getHostConnector();
330
+ },
331
+ gotoAppLibrary: async (irisAppId) => {
332
+ const api = await getHostConnector();
364
333
  return api.gotoAppLibrary(irisAppId);
365
- }),
366
- gotoFleetApp: (options) => __awaiter(void 0, void 0, void 0, function* () {
367
- const api = yield getHostConnector();
334
+ },
335
+ gotoFleetApp: async (options) => {
336
+ const api = await getHostConnector();
368
337
  return api.gotoFleetApp(options);
369
- }),
370
- gotoCustomerHome: (customerId, options) => __awaiter(void 0, void 0, void 0, function* () {
371
- const api = yield getHostConnector();
338
+ },
339
+ gotoCustomerHome: async (customerId, options) => {
340
+ const api = await getHostConnector();
372
341
  return api.gotoCustomerHome(customerId, options);
373
- }),
374
- gotoAdmin: (url) => __awaiter(void 0, void 0, void 0, function* () {
375
- const api = yield getHostConnector();
342
+ },
343
+ gotoAdmin: async (url) => {
344
+ const api = await getHostConnector();
376
345
  return api.gotoAdmin(url);
377
- }),
378
- gotoMarketplace: () => __awaiter(void 0, void 0, void 0, function* () {
379
- const api = yield getHostConnector();
346
+ },
347
+ gotoMarketplace: async () => {
348
+ const api = await getHostConnector();
380
349
  return api.gotoMarketplace();
381
- }),
382
- reloadManager: () => __awaiter(void 0, void 0, void 0, function* () {
383
- const api = yield getHostConnector();
350
+ },
351
+ reloadManager: async () => {
352
+ const api = await getHostConnector();
384
353
  return api.reloadManager();
385
- }),
386
- hasAccessTo: (options) => __awaiter(void 0, void 0, void 0, function* () {
387
- const api = yield getHostConnector();
354
+ },
355
+ hasAccessTo: async (options) => {
356
+ const api = await getHostConnector();
388
357
  return api.hasAccessTo(options);
389
- }),
358
+ },
390
359
  };
391
360
 
392
361
  const ParamsRuntime = {
393
- getAppName: () => __awaiter(void 0, void 0, void 0, function* () {
394
- const api = yield getHostConnector();
362
+ getAppName: async () => {
363
+ const api = await getHostConnector();
395
364
  return api.getAppName();
396
- }),
397
- getOrgName: () => __awaiter(void 0, void 0, void 0, function* () {
398
- const api = yield getHostConnector();
365
+ },
366
+ getOrgName: async () => {
367
+ const api = await getHostConnector();
399
368
  return api.getOrgName();
400
- }),
401
- getExtensionName: () => __awaiter(void 0, void 0, void 0, function* () {
402
- const api = yield getHostConnector();
369
+ },
370
+ getExtensionName: async () => {
371
+ const api = await getHostConnector();
403
372
  return api.getExtensionName();
404
- }),
373
+ },
405
374
  };
406
375
 
407
376
  const RestRuntime = {
408
377
  apiHost: "https://API_HOST",
409
- request(path, method, requestParams, body, bodyType, secureByDefault) {
410
- return __awaiter(this, void 0, void 0, function* () {
411
- const api = yield getHostConnector();
412
- return api.requestTrackunitRestApi(path, method, requestParams, body, bodyType, secureByDefault);
413
- });
378
+ async request(path, method, requestParams, body, bodyType, secureByDefault) {
379
+ const api = await getHostConnector();
380
+ return api.requestTrackunitRestApi(path, method, requestParams, body, bodyType, secureByDefault);
414
381
  },
415
382
  };
416
383
 
@@ -422,53 +389,55 @@ const RouterRuntime = {
422
389
  };
423
390
 
424
391
  const SiteRuntime = {
425
- getSiteInfo: () => __awaiter(void 0, void 0, void 0, function* () {
426
- const api = yield getHostConnector();
392
+ getSiteInfo: async () => {
393
+ const api = await getHostConnector();
427
394
  return api.getSiteInfo();
428
- }),
395
+ },
429
396
  };
430
397
 
431
398
  const ThemeCssRuntime = {
432
- getThemeCssProperties: () => __awaiter(void 0, void 0, void 0, function* () {
433
- const api = yield getHostConnector();
399
+ getThemeCssProperties: async () => {
400
+ const api = await getHostConnector();
434
401
  return api.getThemeCssProperties();
435
- }),
402
+ },
436
403
  };
437
404
 
438
405
  const ToastRuntime = {
439
- addToast(toast) {
440
- return __awaiter(this, void 0, void 0, function* () {
441
- var _a, _b;
442
- const api = yield getHostConnector();
443
- return api
444
- .addToast(Object.assign(Object.assign({}, toast), { primaryAction: (_a = toast.primaryAction) === null || _a === void 0 ? void 0 : _a.label, secondaryAction: (_b = toast.secondaryAction) === null || _b === void 0 ? void 0 : _b.label }))
445
- .then(res => {
446
- var _a, _b, _c, _d;
447
- switch (res) {
448
- case "primaryAction":
449
- (_b = (_a = toast.primaryAction) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.call(_a);
450
- break;
451
- case "secondaryAction":
452
- (_d = (_c = toast.secondaryAction) === null || _c === void 0 ? void 0 : _c.onClick) === null || _d === void 0 ? void 0 : _d.call(_c);
453
- break;
454
- }
455
- });
406
+ async addToast(toast) {
407
+ var _a, _b;
408
+ const api = await getHostConnector();
409
+ return api
410
+ .addToast({
411
+ ...toast,
412
+ primaryAction: (_a = toast.primaryAction) === null || _a === void 0 ? void 0 : _a.label,
413
+ secondaryAction: (_b = toast.secondaryAction) === null || _b === void 0 ? void 0 : _b.label,
414
+ })
415
+ .then(res => {
416
+ var _a, _b, _c, _d;
417
+ switch (res) {
418
+ case "primaryAction":
419
+ (_b = (_a = toast.primaryAction) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.call(_a);
420
+ break;
421
+ case "secondaryAction":
422
+ (_d = (_c = toast.secondaryAction) === null || _c === void 0 ? void 0 : _c.onClick) === null || _d === void 0 ? void 0 : _d.call(_c);
423
+ break;
424
+ }
456
425
  });
457
426
  },
458
427
  };
459
428
 
460
429
  const TokenRuntime = {
461
- getTokenContext: () => __awaiter(void 0, void 0, void 0, function* () {
462
- const api = yield getHostConnector();
430
+ getTokenContext: async () => {
431
+ const api = await getHostConnector();
463
432
  return api.getTokenContext();
464
- }),
433
+ },
465
434
  };
466
435
 
467
436
  const UserSubscriptionRuntime = {
468
- getUserSubscriptionContext: () => __awaiter(void 0, void 0, void 0, function* () {
469
- const api = yield getHostConnector();
437
+ getUserSubscriptionContext: async () => {
438
+ const api = await getHostConnector();
470
439
  return api.getUserSubscriptionContext();
471
- }),
440
+ },
472
441
  };
473
442
 
474
443
  exports.AnalyticsContextRuntime = AnalyticsContextRuntime;
@@ -500,8 +469,8 @@ exports.getStringValue = getStringValue;
500
469
  exports.isValidCustomFieldValue = isValidCustomFieldValue;
501
470
  exports.setupHostConnector = setupHostConnector;
502
471
  Object.keys(irisAppRuntimeCoreApi).forEach(function (k) {
503
- if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
504
- enumerable: true,
505
- get: function () { return irisAppRuntimeCoreApi[k]; }
506
- });
472
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
473
+ enumerable: true,
474
+ get: function () { return irisAppRuntimeCoreApi[k]; }
475
+ });
507
476
  });
package/index.esm.js CHANGED
@@ -1,36 +1,6 @@
1
1
  export * from '@trackunit/iris-app-runtime-core-api';
2
2
  import { connectToParent } from 'penpal';
3
3
 
4
- /******************************************************************************
5
- Copyright (c) Microsoft Corporation.
6
-
7
- Permission to use, copy, modify, and/or distribute this software for any
8
- purpose with or without fee is hereby granted.
9
-
10
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
11
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
12
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
13
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
14
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
15
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16
- PERFORMANCE OF THIS SOFTWARE.
17
- ***************************************************************************** */
18
-
19
- function __awaiter(thisArg, _arguments, P, generator) {
20
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
21
- return new (P || (P = Promise))(function (resolve, reject) {
22
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
23
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
24
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
25
- step((generator = generator.apply(thisArg, _arguments || [])).next());
26
- });
27
- }
28
-
29
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
30
- var e = new Error(message);
31
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
32
- };
33
-
34
4
  const doNothingByDefault = () => { };
35
5
  /**
36
6
  * Setup using the subscribedMethods to subscribe to events from the host.
@@ -39,7 +9,12 @@ const doNothingByDefault = () => { };
39
9
  * @returns { Connection<HostConnectorApi> } the connection to the host
40
10
  */
41
11
  const setupHostConnector = (subscribedMethods) => {
42
- const methods = Object.assign({ onFilterBarValuesChanged: doNothingByDefault, onTokenChanged: doNothingByDefault, onAssetSortingStateChanged: doNothingByDefault }, subscribedMethods);
12
+ const methods = {
13
+ onFilterBarValuesChanged: doNothingByDefault,
14
+ onTokenChanged: doNothingByDefault,
15
+ onAssetSortingStateChanged: doNothingByDefault,
16
+ ...subscribedMethods,
17
+ };
43
18
  const connection = connectToParent({ methods });
44
19
  connection.promise.catch(err => {
45
20
  // TODO consider how to handle this catch
@@ -59,71 +34,71 @@ const getHostConnector = () => {
59
34
  };
60
35
 
61
36
  const AnalyticsContextRuntime = {
62
- logPageView: (details) => __awaiter(void 0, void 0, void 0, function* () {
63
- const api = yield getHostConnector();
37
+ logPageView: async (details) => {
38
+ const api = await getHostConnector();
64
39
  api.logPageView(details);
65
- }),
66
- logError: (details) => __awaiter(void 0, void 0, void 0, function* () {
67
- const api = yield getHostConnector();
40
+ },
41
+ logError: async (details) => {
42
+ const api = await getHostConnector();
68
43
  api.logError(details);
69
- }),
70
- logEvent: (eventName, details, nameSupplement) => __awaiter(void 0, void 0, void 0, function* () {
71
- const api = yield getHostConnector();
44
+ },
45
+ logEvent: async (eventName, details, nameSupplement) => {
46
+ const api = await getHostConnector();
72
47
  api.logEvent(eventName, details, nameSupplement);
73
- }),
74
- setUserProperty: (name, data) => __awaiter(void 0, void 0, void 0, function* () {
75
- const api = yield getHostConnector();
48
+ },
49
+ setUserProperty: async (name, data) => {
50
+ const api = await getHostConnector();
76
51
  api.setUserProperty(name, data);
77
- }),
52
+ },
78
53
  };
79
54
 
80
55
  const AssetRuntime = {
81
- getAssetInfo: () => __awaiter(void 0, void 0, void 0, function* () {
82
- const api = yield getHostConnector();
56
+ getAssetInfo: async () => {
57
+ const api = await getHostConnector();
83
58
  return api.getAssetInfo();
84
- }),
59
+ },
85
60
  };
86
61
 
87
62
  const AssetSortingRuntime = {
88
- getAssetSortingState: () => __awaiter(void 0, void 0, void 0, function* () {
89
- const api = yield getHostConnector();
63
+ getAssetSortingState: async () => {
64
+ const api = await getHostConnector();
90
65
  return api.getAssetSortingState();
91
- }),
92
- setAssetSortingState: (...args) => __awaiter(void 0, void 0, void 0, function* () {
93
- const api = yield getHostConnector();
66
+ },
67
+ setAssetSortingState: async (...args) => {
68
+ const api = await getHostConnector();
94
69
  return api.setAssetSortingState(...args);
95
- }),
70
+ },
96
71
  };
97
72
 
98
73
  const ConfirmationDialogRuntime = {
99
- confirm(props) {
100
- return __awaiter(this, void 0, void 0, function* () {
101
- const api = yield getHostConnector();
102
- return api.confirm(Object.assign({}, props));
74
+ async confirm(props) {
75
+ const api = await getHostConnector();
76
+ return api.confirm({
77
+ ...props,
103
78
  });
104
79
  },
105
80
  };
106
81
 
107
82
  const CurrentUserPreferenceRuntime = {
108
- getCurrentUserLanguage: () => __awaiter(void 0, void 0, void 0, function* () {
109
- const api = yield getHostConnector();
83
+ getCurrentUserLanguage: async () => {
84
+ const api = await getHostConnector();
110
85
  return api.getCurrentUserLanguage();
111
- }),
112
- getCurrentUserTimeZonePreference: () => __awaiter(void 0, void 0, void 0, function* () {
113
- const api = yield getHostConnector();
86
+ },
87
+ getCurrentUserTimeZonePreference: async () => {
88
+ const api = await getHostConnector();
114
89
  return api.getCurrentUserTimeZonePreference();
115
- }),
116
- getCurrentUserSystemOfMeasurement: () => __awaiter(void 0, void 0, void 0, function* () {
117
- const api = yield getHostConnector();
90
+ },
91
+ getCurrentUserSystemOfMeasurement: async () => {
92
+ const api = await getHostConnector();
118
93
  return api.getCurrentUserSystemOfMeasurement();
119
- }),
94
+ },
120
95
  };
121
96
 
122
97
  const CurrentUserRuntime = {
123
- getCurrentUserContext: () => __awaiter(void 0, void 0, void 0, function* () {
124
- const api = yield getHostConnector();
98
+ getCurrentUserContext: async () => {
99
+ const api = await getHostConnector();
125
100
  return api.getCurrentUserContext();
126
- }),
101
+ },
127
102
  };
128
103
 
129
104
  /**
@@ -291,122 +266,116 @@ const isValidCustomFieldValue = (value) => {
291
266
  };
292
267
 
293
268
  const CustomerRuntime = {
294
- getCustomerInfo: () => __awaiter(void 0, void 0, void 0, function* () {
295
- const api = yield getHostConnector();
269
+ getCustomerInfo: async () => {
270
+ const api = await getHostConnector();
296
271
  return api.getCustomerInfo();
297
- }),
272
+ },
298
273
  };
299
274
 
300
275
  const EnvironmentRuntime = {
301
- getEnvironmentContext: () => __awaiter(void 0, void 0, void 0, function* () {
302
- const api = yield getHostConnector();
276
+ getEnvironmentContext: async () => {
277
+ const api = await getHostConnector();
303
278
  return api.getEnvironmentContext();
304
- }),
279
+ },
305
280
  };
306
281
 
307
282
  const EventRuntime = {
308
- getEventInfo: () => __awaiter(void 0, void 0, void 0, function* () {
309
- const api = yield getHostConnector();
283
+ getEventInfo: async () => {
284
+ const api = await getHostConnector();
310
285
  return api.getEventInfo();
311
- }),
286
+ },
312
287
  };
313
288
 
314
289
  const FilterBarRuntime = {
315
- getFilterBarValues: () => __awaiter(void 0, void 0, void 0, function* () {
316
- const api = yield getHostConnector();
290
+ getFilterBarValues: async () => {
291
+ const api = await getHostConnector();
317
292
  return api.getFilterBarValues();
318
- }),
293
+ },
319
294
  };
320
295
 
321
296
  const OemBrandingContextRuntime = {
322
- getOemBrandingContextRuntime: () => __awaiter(void 0, void 0, void 0, function* () {
323
- const api = yield getHostConnector();
297
+ getOemBrandingContextRuntime: async () => {
298
+ const api = await getHostConnector();
324
299
  return {
325
300
  getAllBrandingDetails: api.getAllBrandingDetails,
326
301
  getOemImage: api.getOemImage,
327
302
  getOemBranding: api.getOemBranding,
328
303
  };
329
- }),
304
+ },
330
305
  };
331
306
 
332
307
  const ModalDialogRuntime = {
333
- openModal() {
334
- return __awaiter(this, void 0, void 0, function* () {
335
- const scrollX = window.scrollX || 0;
336
- const scrollY = window.scrollY || 0;
337
- const api = yield getHostConnector();
338
- return api.openModal({ scrollX, scrollY });
339
- });
308
+ async openModal() {
309
+ const scrollX = window.scrollX || 0;
310
+ const scrollY = window.scrollY || 0;
311
+ const api = await getHostConnector();
312
+ return api.openModal({ scrollX, scrollY });
340
313
  },
341
- closeModal() {
342
- return __awaiter(this, void 0, void 0, function* () {
343
- const api = yield getHostConnector();
344
- return api.closeModal();
345
- });
314
+ async closeModal() {
315
+ const api = await getHostConnector();
316
+ return api.closeModal();
346
317
  },
347
318
  };
348
319
 
349
320
  const NavigationRuntime = {
350
- gotoAssetHome: (assetId, options) => __awaiter(void 0, void 0, void 0, function* () {
351
- const api = yield getHostConnector();
321
+ gotoAssetHome: async (assetId, options) => {
322
+ const api = await getHostConnector();
352
323
  return api.gotoAssetHome(assetId, options);
353
- }),
354
- gotoSiteHome: (siteId, options) => __awaiter(void 0, void 0, void 0, function* () {
355
- const api = yield getHostConnector();
324
+ },
325
+ gotoSiteHome: async (siteId, options) => {
326
+ const api = await getHostConnector();
356
327
  return api.gotoSiteHome(siteId, options);
357
- }),
358
- gotoAppLibrary: (irisAppId) => __awaiter(void 0, void 0, void 0, function* () {
359
- const api = yield getHostConnector();
328
+ },
329
+ gotoAppLibrary: async (irisAppId) => {
330
+ const api = await getHostConnector();
360
331
  return api.gotoAppLibrary(irisAppId);
361
- }),
362
- gotoFleetApp: (options) => __awaiter(void 0, void 0, void 0, function* () {
363
- const api = yield getHostConnector();
332
+ },
333
+ gotoFleetApp: async (options) => {
334
+ const api = await getHostConnector();
364
335
  return api.gotoFleetApp(options);
365
- }),
366
- gotoCustomerHome: (customerId, options) => __awaiter(void 0, void 0, void 0, function* () {
367
- const api = yield getHostConnector();
336
+ },
337
+ gotoCustomerHome: async (customerId, options) => {
338
+ const api = await getHostConnector();
368
339
  return api.gotoCustomerHome(customerId, options);
369
- }),
370
- gotoAdmin: (url) => __awaiter(void 0, void 0, void 0, function* () {
371
- const api = yield getHostConnector();
340
+ },
341
+ gotoAdmin: async (url) => {
342
+ const api = await getHostConnector();
372
343
  return api.gotoAdmin(url);
373
- }),
374
- gotoMarketplace: () => __awaiter(void 0, void 0, void 0, function* () {
375
- const api = yield getHostConnector();
344
+ },
345
+ gotoMarketplace: async () => {
346
+ const api = await getHostConnector();
376
347
  return api.gotoMarketplace();
377
- }),
378
- reloadManager: () => __awaiter(void 0, void 0, void 0, function* () {
379
- const api = yield getHostConnector();
348
+ },
349
+ reloadManager: async () => {
350
+ const api = await getHostConnector();
380
351
  return api.reloadManager();
381
- }),
382
- hasAccessTo: (options) => __awaiter(void 0, void 0, void 0, function* () {
383
- const api = yield getHostConnector();
352
+ },
353
+ hasAccessTo: async (options) => {
354
+ const api = await getHostConnector();
384
355
  return api.hasAccessTo(options);
385
- }),
356
+ },
386
357
  };
387
358
 
388
359
  const ParamsRuntime = {
389
- getAppName: () => __awaiter(void 0, void 0, void 0, function* () {
390
- const api = yield getHostConnector();
360
+ getAppName: async () => {
361
+ const api = await getHostConnector();
391
362
  return api.getAppName();
392
- }),
393
- getOrgName: () => __awaiter(void 0, void 0, void 0, function* () {
394
- const api = yield getHostConnector();
363
+ },
364
+ getOrgName: async () => {
365
+ const api = await getHostConnector();
395
366
  return api.getOrgName();
396
- }),
397
- getExtensionName: () => __awaiter(void 0, void 0, void 0, function* () {
398
- const api = yield getHostConnector();
367
+ },
368
+ getExtensionName: async () => {
369
+ const api = await getHostConnector();
399
370
  return api.getExtensionName();
400
- }),
371
+ },
401
372
  };
402
373
 
403
374
  const RestRuntime = {
404
375
  apiHost: "https://API_HOST",
405
- request(path, method, requestParams, body, bodyType, secureByDefault) {
406
- return __awaiter(this, void 0, void 0, function* () {
407
- const api = yield getHostConnector();
408
- return api.requestTrackunitRestApi(path, method, requestParams, body, bodyType, secureByDefault);
409
- });
376
+ async request(path, method, requestParams, body, bodyType, secureByDefault) {
377
+ const api = await getHostConnector();
378
+ return api.requestTrackunitRestApi(path, method, requestParams, body, bodyType, secureByDefault);
410
379
  },
411
380
  };
412
381
 
@@ -418,53 +387,55 @@ const RouterRuntime = {
418
387
  };
419
388
 
420
389
  const SiteRuntime = {
421
- getSiteInfo: () => __awaiter(void 0, void 0, void 0, function* () {
422
- const api = yield getHostConnector();
390
+ getSiteInfo: async () => {
391
+ const api = await getHostConnector();
423
392
  return api.getSiteInfo();
424
- }),
393
+ },
425
394
  };
426
395
 
427
396
  const ThemeCssRuntime = {
428
- getThemeCssProperties: () => __awaiter(void 0, void 0, void 0, function* () {
429
- const api = yield getHostConnector();
397
+ getThemeCssProperties: async () => {
398
+ const api = await getHostConnector();
430
399
  return api.getThemeCssProperties();
431
- }),
400
+ },
432
401
  };
433
402
 
434
403
  const ToastRuntime = {
435
- addToast(toast) {
436
- return __awaiter(this, void 0, void 0, function* () {
437
- var _a, _b;
438
- const api = yield getHostConnector();
439
- return api
440
- .addToast(Object.assign(Object.assign({}, toast), { primaryAction: (_a = toast.primaryAction) === null || _a === void 0 ? void 0 : _a.label, secondaryAction: (_b = toast.secondaryAction) === null || _b === void 0 ? void 0 : _b.label }))
441
- .then(res => {
442
- var _a, _b, _c, _d;
443
- switch (res) {
444
- case "primaryAction":
445
- (_b = (_a = toast.primaryAction) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.call(_a);
446
- break;
447
- case "secondaryAction":
448
- (_d = (_c = toast.secondaryAction) === null || _c === void 0 ? void 0 : _c.onClick) === null || _d === void 0 ? void 0 : _d.call(_c);
449
- break;
450
- }
451
- });
404
+ async addToast(toast) {
405
+ var _a, _b;
406
+ const api = await getHostConnector();
407
+ return api
408
+ .addToast({
409
+ ...toast,
410
+ primaryAction: (_a = toast.primaryAction) === null || _a === void 0 ? void 0 : _a.label,
411
+ secondaryAction: (_b = toast.secondaryAction) === null || _b === void 0 ? void 0 : _b.label,
412
+ })
413
+ .then(res => {
414
+ var _a, _b, _c, _d;
415
+ switch (res) {
416
+ case "primaryAction":
417
+ (_b = (_a = toast.primaryAction) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.call(_a);
418
+ break;
419
+ case "secondaryAction":
420
+ (_d = (_c = toast.secondaryAction) === null || _c === void 0 ? void 0 : _c.onClick) === null || _d === void 0 ? void 0 : _d.call(_c);
421
+ break;
422
+ }
452
423
  });
453
424
  },
454
425
  };
455
426
 
456
427
  const TokenRuntime = {
457
- getTokenContext: () => __awaiter(void 0, void 0, void 0, function* () {
458
- const api = yield getHostConnector();
428
+ getTokenContext: async () => {
429
+ const api = await getHostConnector();
459
430
  return api.getTokenContext();
460
- }),
431
+ },
461
432
  };
462
433
 
463
434
  const UserSubscriptionRuntime = {
464
- getUserSubscriptionContext: () => __awaiter(void 0, void 0, void 0, function* () {
465
- const api = yield getHostConnector();
435
+ getUserSubscriptionContext: async () => {
436
+ const api = await getHostConnector();
466
437
  return api.getUserSubscriptionContext();
467
- }),
438
+ },
468
439
  };
469
440
 
470
441
  export { AnalyticsContextRuntime, AssetRuntime, AssetSortingRuntime, ConfirmationDialogRuntime, CurrentUserPreferenceRuntime, CurrentUserRuntime, CustomerRuntime, EnvironmentRuntime, EventRuntime, FilterBarRuntime, ModalDialogRuntime, NavigationRuntime, OemBrandingContextRuntime, ParamsRuntime, RestRuntime, RouterRuntime, SiteRuntime, ThemeCssRuntime, 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.187-alpha-2936c016d71.0",
3
+ "version": "0.3.188",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -13,5 +13,6 @@
13
13
  "jest-fetch-mock": "^3.0.3"
14
14
  },
15
15
  "module": "./index.esm.js",
16
- "main": "./index.cjs.js"
17
- }
16
+ "main": "./index.cjs.js",
17
+ "types": "./index.esm.d.ts"
18
+ }
@@ -32,4 +32,4 @@ export declare const getCustomFieldValueForDisplayInUI: (value: number | string
32
32
  /**
33
33
  * type guard to ensure that a value is of a type compatible with custom fields
34
34
  */
35
- export declare const isValidCustomFieldValue: (value: unknown) => value is string | number | boolean | DropdownSelection | string[] | DropdownSelection[] | null;
35
+ export declare const isValidCustomFieldValue: (value: unknown) => value is boolean | string | string[] | DropdownSelection[] | DropdownSelection | number | null;