@equinor/echo-framework 0.7.12 → 0.8.1

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.
Files changed (97) hide show
  1. package/dist/components/contextualAppLinks/externalLinkButtons/externalLinkButtons.helpers.d.ts +47 -0
  2. package/dist/components/contextualAppLinks/externalLinkButtons/externalLinkButtons.helpers.test.d.ts +1 -0
  3. package/dist/components/contextualAppLinks/externalLinkButtons/externalLinkToCommApp.d.ts +14 -0
  4. package/dist/components/contextualAppLinks/externalLinkButtons/externalLinkToMcApp.d.ts +3 -1
  5. package/dist/components/contextualAppLinks/externalLinkButtons/externalLinkToProCoSys.d.ts +1 -2
  6. package/dist/components/contextualAppLinks/externalLinkButtons/externalLinkToSap.d.ts +3 -0
  7. package/dist/components/contextualAppLinks/externalLinkButtons/externalLinkToSemiDoc.d.ts +4 -0
  8. package/dist/components/contextualAppLinks/externalLinkButtons/externalLinkToTr2000.d.ts +2 -0
  9. package/dist/components/contextualAppLinks/externalLinkButtons/iconButtonSpinner.d.ts +18 -0
  10. package/dist/components/contextualAppLinks/externalLinkButtons/index.d.ts +1 -0
  11. package/dist/components/externalLinkButton/externalLinkButton.d.ts +16 -7
  12. package/dist/components/panel/corePanelLeft.d.ts +1 -4
  13. package/dist/components/panel/corePanelRight.d.ts +1 -4
  14. package/dist/components/realTimeData/hooks/useSignalR.d.ts +3 -2
  15. package/dist/coreApplication/EchoContent.d.ts +0 -1
  16. package/dist/coreApplication/index.d.ts +0 -1
  17. package/dist/hooks/index.d.ts +0 -2
  18. package/dist/hooks/useSemi.d.ts +11 -7
  19. package/dist/hooks/useTagDetails.d.ts +10 -3
  20. package/dist/index.d.ts +11 -6
  21. package/dist/services/api/api-manager.d.ts +1 -1
  22. package/dist/services/api/api-tag-details.d.ts +18 -0
  23. package/dist/services/api/api-tag-details.test.d.ts +1 -0
  24. package/dist/services/api/api-tags.d.ts +17 -0
  25. package/dist/services/api/api-tags.test.d.ts +1 -0
  26. package/dist/services/api/index.d.ts +1 -0
  27. package/dist/services/echopediaAnalyticsModule/echopediaAnalyticsModule.d.ts +1 -0
  28. package/dist/src/components/containers/layout.module.css.js +1 -4
  29. package/dist/src/components/containers/layouts.js +9 -57
  30. package/dist/src/components/contextualAppLinks/externalAppsMenu.js +9 -33
  31. package/dist/src/components/contextualAppLinks/externalAppsMenu.module.css.js +1 -1
  32. package/dist/src/components/contextualAppLinks/externalLinkButtons/allExternalLinks.js +66 -11
  33. package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkButtons.helpers.js +169 -0
  34. package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToCommApp.js +93 -0
  35. package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToMcApp.js +60 -5
  36. package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToProCoSys.js +43 -11
  37. package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToSafeX.js +1 -1
  38. package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToSap.js +58 -11
  39. package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToSemiDoc.js +16 -5
  40. package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToStid.js +1 -1
  41. package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToTr2000.js +67 -16
  42. package/dist/src/components/contextualAppLinks/externalLinkButtons/iconButtonSpinner.js +44 -0
  43. package/dist/src/components/contextualAppLinks/externalLinkButtons/iconButtonSpinner.module.css.js +15 -0
  44. package/dist/src/components/externalLinkButton/externalLinkButton.js +89 -34
  45. package/dist/src/components/externalLinkButton/externalLinkButton.module.css.js +5 -4
  46. package/dist/src/components/footer/footer.module.css.js +1 -1
  47. package/dist/src/components/panel/corePanelLeft.js +2 -5
  48. package/dist/src/components/panel/corePanelLeft.module.css.js +1 -1
  49. package/dist/src/components/panel/corePanelRight.js +2 -4
  50. package/dist/src/components/panel/corePanelRight.module.css.js +1 -1
  51. package/dist/src/components/realTimeData/components/connectorForIMSTag/IMSConnector.module.css.js +3 -2
  52. package/dist/src/components/realTimeData/components/connectorForIMSTag/RealTimeConnectorForIMSTag.js +32 -7
  53. package/dist/src/components/realTimeData/hooks/useSignalR.js +4 -2
  54. package/dist/src/components/toaster/toaster.js +1 -2
  55. package/dist/src/components/toaster/toaster.module.css.js +1 -2
  56. package/dist/src/coreApplication/EchoContent.js +2 -7
  57. package/dist/src/globalStyles.css.js +1 -1
  58. package/dist/src/hooks/index.js +0 -6
  59. package/dist/src/hooks/useSemi.js +40 -14
  60. package/dist/src/hooks/useTagDetails.js +116 -45
  61. package/dist/src/icons/common/CommissionApp-icon.png.js +7 -0
  62. package/dist/src/icons/common/Evision.svg.js +3 -2
  63. package/dist/src/icons/common/Fusion.svg.js +30 -25
  64. package/dist/src/icons/common/McApp.svg.js +10 -6
  65. package/dist/src/icons/common/Notification.svg.js +82 -0
  66. package/dist/src/icons/common/ProCoSysIcon.svg.js +3 -2
  67. package/dist/src/icons/common/SapLogo.svg.js +5 -4
  68. package/dist/src/icons/common/SemiIcon.svg.js +11 -11
  69. package/dist/src/icons/common/Stid.svg.js +3 -2
  70. package/dist/src/icons/common/TR2000.svg.js +8 -6
  71. package/dist/src/icons/common/WorkOrder.svg.js +72 -0
  72. package/dist/src/icons/common/Yammer.svg.js +2 -1
  73. package/dist/src/icons/common/satos-logo.png.js +7 -0
  74. package/dist/src/index.js +15 -16
  75. package/dist/src/services/api/api-manager.js +2 -2
  76. package/dist/src/services/api/api-realtimedata.js +3 -1
  77. package/dist/src/services/api/api-tag-details.js +66 -0
  78. package/dist/src/services/api/api-tags.js +29 -0
  79. package/dist/src/services/echopediaAnalyticsModule/echopediaAnalyticsModule.js +10 -0
  80. package/dist/src/types/pingableSources.js +1 -0
  81. package/dist/src/utils/navigationUtils.js +28 -0
  82. package/dist/src/utils/plantInfo.js +1 -0
  83. package/dist/types/api-proCoSysTagResponse.d.ts +8 -0
  84. package/dist/types/pingableSources.d.ts +2 -1
  85. package/dist/utils/index.d.ts +1 -0
  86. package/dist/utils/navigationUtils.d.ts +7 -0
  87. package/dist/utils/navigationUtils.test.d.ts +1 -0
  88. package/dist/utils/plantInfo.d.ts +6 -0
  89. package/dist/utils/plantInfo.test.d.ts +1 -0
  90. package/package.json +31 -31
  91. package/dist/coreApplication/EchoBarComponent.d.ts +0 -6
  92. package/dist/hooks/useIsLandscape.d.ts +0 -1
  93. package/dist/hooks/useScreenOrientation.d.ts +0 -1
  94. package/dist/src/coreApplication/EchoBarComponent.js +0 -190
  95. package/dist/src/coreApplication/EchoContent.module.css.js +0 -20
  96. package/dist/src/hooks/useIsLandscape.js +0 -52
  97. package/dist/src/hooks/useScreenOrientation.js +0 -44
@@ -22,7 +22,7 @@ var EchoCore__default = /*#__PURE__*/_interopDefaultLegacy(EchoCore);
22
22
 
23
23
  var baseApiUrl = EchoCore.EchoEnv.env().REACT_APP_API_URL;
24
24
 
25
- function request(url, requestType) {
25
+ function request(url, requestType, abortSignal) {
26
26
  return _tslib.__awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
27
27
  var response, contentType, text;
28
28
  return regeneratorRuntime.wrap(function _callee$(_context) {
@@ -30,7 +30,7 @@ function request(url, requestType) {
30
30
  switch (_context.prev = _context.next) {
31
31
  case 0:
32
32
  _context.next = 2;
33
- return EchoCore__default["default"].EchoClient.fetch(url);
33
+ return EchoCore__default["default"].EchoClient.fetch(url, undefined, undefined, undefined, abortSignal);
34
34
 
35
35
  case 2:
36
36
  response = _context.sent;
@@ -22,7 +22,9 @@ function getTimeseriesByName(name, instCode) {
22
22
 
23
23
  case 4:
24
24
  response = _context.sent;
25
- timeseries = response.data.items[0];
25
+ timeseries = response.data.items.find(function (item) {
26
+ return item.name === name;
27
+ });
26
28
  return _context.abrupt("return", timeseries);
27
29
 
28
30
  case 9:
@@ -0,0 +1,66 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', {
4
+ value: true
5
+ });
6
+
7
+ var _tslib = require('../../../_virtual/_tslib.js');
8
+
9
+ var echoBase = require('@equinor/echo-base');
10
+
11
+ var echoSearch = require('@equinor/echo-search');
12
+ /**
13
+ * Wraps Search.Tags.getTagDetailsAsync(), and throws proper NotFoundError if search was unable to find the given tag.
14
+ * It also converts Search's result.error responses to proper errors and throws them.
15
+ *
16
+ * @param {Object} param
17
+ * @param {string} params.tagNo The tag number to query.
18
+ * @param {string} params.instCode Plant installation code for the given tag.
19
+ * @param {AbortSignal} params.abortSignal A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object.
20
+ * @throws {NotFoundError} NotFoundError when there are no matches for the tagNo instCode pair.
21
+ * @throws {BaseError} In any other failed API call.
22
+ * @returns {Promise<TagDetailsDto>} Promise resolving in tag details DTO.
23
+ */
24
+
25
+
26
+ function getTagDetails(_ref) {
27
+ var tagNo = _ref.tagNo,
28
+ instCode = _ref.instCode,
29
+ abortSignal = _ref.abortSignal;
30
+ return _tslib.__awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
31
+ var result;
32
+ return regeneratorRuntime.wrap(function _callee$(_context) {
33
+ while (1) {
34
+ switch (_context.prev = _context.next) {
35
+ case 0:
36
+ _context.next = 2;
37
+ return echoSearch.Search.Tags.getTagDetailsAsync(tagNo, instCode, abortSignal);
38
+
39
+ case 2:
40
+ result = _context.sent;
41
+ echoSearch.resultHelper.throwIfError(result);
42
+
43
+ if (result.value) {
44
+ _context.next = 6;
45
+ break;
46
+ }
47
+
48
+ throw new echoBase.NotFoundError({
49
+ message: "Could not find ".concat(instCode, " ").concat(tagNo),
50
+ httpStatusCode: 404,
51
+ url: 'getTagDetails'
52
+ });
53
+
54
+ case 6:
55
+ return _context.abrupt("return", result.value);
56
+
57
+ case 7:
58
+ case "end":
59
+ return _context.stop();
60
+ }
61
+ }
62
+ }, _callee);
63
+ }));
64
+ }
65
+
66
+ exports.getTagDetails = getTagDetails;
@@ -0,0 +1,29 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', {
4
+ value: true
5
+ });
6
+
7
+ var apiManager = require('./api-manager.js');
8
+ /**
9
+ * Fetches tag information from ProCoSys.
10
+ *
11
+ * @param {Object} param
12
+ * @param {string} params.tagNo The tag number to query.
13
+ * @param {string} params.instCode Plant installation code for the given tag.
14
+ * @param {AbortSignal} params.abortSignal A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object.
15
+ * @throws {BaseError} If the response can't be parsed to JSON.
16
+ * @throws {Error} In any other API call issues.
17
+ * @returns {Promise<TProCoSysApiTag[]>} Promise resolving in array of tags.
18
+ */
19
+
20
+
21
+ function getTagFromProCoSys(_ref) {
22
+ var instCode = _ref.instCode,
23
+ tagNo = _ref.tagNo,
24
+ abortSignal = _ref.abortSignal;
25
+ var url = "".concat(apiManager.baseApiUrl, "/").concat(instCode, "/tags/procosys?tagNo=").concat(tagNo);
26
+ return apiManager.request(url, [], abortSignal);
27
+ }
28
+
29
+ exports.getTagFromProCoSys = getTagFromProCoSys;
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', {
4
+ value: true
5
+ });
6
+
7
+ var EchoCore = require('@equinor/echo-core');
8
+
9
+ var echopediaAnalyticsModule = EchoCore.analytics.createAnalyticsModule('ep');
10
+ exports.echopediaAnalyticsModule = echopediaAnalyticsModule;
@@ -7,4 +7,5 @@ exports.PingableSources = void 0;
7
7
 
8
8
  (function (PingableSources) {
9
9
  PingableSources["Sap"] = "https://p03web.statoil.no/sap/public/icmandir/its/lsgui/images/img/splashscreen_corbu.png";
10
+ PingableSources["Statos"] = "https://satos.equinor.com/files/4/bilder/johan_svedrup.png";
10
11
  })(exports.PingableSources || (exports.PingableSources = {}));
@@ -0,0 +1,28 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', {
4
+ value: true
5
+ });
6
+
7
+ var echopediaAnalyticsModule = require('../services/echopediaAnalyticsModule/echopediaAnalyticsModule.js');
8
+ /**
9
+ * Helper function to execute a redirection to an outer source.
10
+ *
11
+ * @param {string} link Link to navigate to.
12
+ * @param {boolean} redirect Set this to 'true' to load the given url to navigate to in the current tab / window.
13
+ */
14
+
15
+
16
+ var goToExternalLink = function goToExternalLink(link, redirect) {
17
+ echopediaAnalyticsModule.echopediaAnalyticsModule.trackEventBy('ExternalLink', 'Opened', {
18
+ linkTo: link
19
+ });
20
+
21
+ if (redirect) {
22
+ window.location.href = link;
23
+ } else {
24
+ window.open(link, '_blank');
25
+ }
26
+ };
27
+
28
+ exports.goToExternalLink = goToExternalLink;
@@ -528,3 +528,4 @@ exports.getPlant = getPlant;
528
528
  exports.getPlantBySapId = getPlantBySapId;
529
529
  exports.getPlantCodesOnInstallation = getPlantCodesOnInstallation;
530
530
  exports.getPlantsOnInstallation = getPlantsOnInstallation;
531
+ exports.setPlantInfo = setPlantInfo;
@@ -0,0 +1,8 @@
1
+ export declare type ProCoSysApiTag = {
2
+ id: number;
3
+ tagNo: string;
4
+ description: string;
5
+ isMaster: boolean;
6
+ projectName: string;
7
+ registerId: string;
8
+ };
@@ -1,3 +1,4 @@
1
1
  export declare enum PingableSources {
2
- Sap = "https://p03web.statoil.no/sap/public/icmandir/its/lsgui/images/img/splashscreen_corbu.png"
2
+ Sap = "https://p03web.statoil.no/sap/public/icmandir/its/lsgui/images/img/splashscreen_corbu.png",
3
+ Statos = "https://satos.equinor.com/files/4/bilder/johan_svedrup.png"
3
4
  }
@@ -1 +1,2 @@
1
+ export * from './navigationUtils';
1
2
  export * from './plantInfo';
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Helper function to execute a redirection to an outer source.
3
+ *
4
+ * @param {string} link Link to navigate to.
5
+ * @param {boolean} redirect Set this to 'true' to load the given url to navigate to in the current tab / window.
6
+ */
7
+ export declare const goToExternalLink: (link: string, redirect?: boolean | undefined) => void;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,10 @@
1
1
  import { EchoHubPlant } from '../types/echoHubPlant';
2
+ /**
3
+ * Method for setting echo hub plant information in local storage under the key echoHubPlantInfo
4
+ *
5
+ * @param {EchoHubPlant[]} plants list of plant information to add to local storage
6
+ */
7
+ export declare function setPlantInfo(plants: EchoHubPlant[]): void;
2
8
  /**
3
9
  * Method for getting echo hub plant information from local storage.
4
10
  * If plant information is not in local storage, then this method will try to fetch the information
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/echo-framework",
3
- "version": "0.7.12",
3
+ "version": "0.8.1",
4
4
  "description": "Modules and components for EchoWeb, utilizing EchoCore",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -34,32 +34,32 @@
34
34
  "echo-update-all": "echo-update -a"
35
35
  },
36
36
  "peerDependencies": {
37
- "@equinor/echo-base": "^0.6.4",
38
- "@equinor/echo-components": "^0.3.2",
39
- "@equinor/echo-core": "^0.6.9",
40
- "@equinor/echo-search": "^0.11.15",
37
+ "@equinor/echo-base": "^0.6.8",
38
+ "@equinor/echo-components": "^0.4.0",
39
+ "@equinor/echo-core": "^0.6.11",
40
+ "@equinor/echo-search": "^0.12.1",
41
41
  "@equinor/echo-utils": "^0.2.9",
42
- "@equinor/eds-core-react": "^0.17.0",
42
+ "@equinor/eds-core-react": "^0.19.0",
43
43
  "react": "^17.0.2",
44
44
  "react-dom": "^17.0.2",
45
45
  "react-router-dom": "^5.3.0",
46
- "styled-components": "^5.3.3"
46
+ "styled-components": "^5.3.5"
47
47
  },
48
48
  "devDependencies": {
49
- "@babel/core": "^7.17.5",
49
+ "@babel/core": "^7.17.9",
50
50
  "@babel/preset-env": "^7.16.11",
51
51
  "@babel/preset-react": "^7.16.7",
52
- "@equinor/echo-base": "^0.6.4",
53
- "@equinor/echo-components": "^0.3.2",
54
- "@equinor/echo-core": "^0.6.9",
52
+ "@equinor/echo-base": "^0.6.8",
53
+ "@equinor/echo-components": "^0.4.0",
54
+ "@equinor/echo-core": "^0.6.11",
55
55
  "@equinor/echo-scripts": "^0.1.5",
56
- "@equinor/echo-search": "^0.11.15",
56
+ "@equinor/echo-search": "^0.12.1",
57
57
  "@equinor/echo-update": "^1.3.0",
58
- "@equinor/echo-utils": "^0.2.9",
59
- "@equinor/eds-core-react": "^0.17.0",
58
+ "@equinor/echo-utils": "^0.2.10",
59
+ "@equinor/eds-core-react": "^0.19.0",
60
60
  "@modular-css/rollup": "^28.0.0",
61
61
  "@rollup/plugin-babel": "^5.3.1",
62
- "@rollup/plugin-commonjs": "^21.0.2",
62
+ "@rollup/plugin-commonjs": "^21.0.3",
63
63
  "@rollup/plugin-image": "^2.1.1",
64
64
  "@rollup/plugin-json": "^4.1.0",
65
65
  "@rollup/plugin-node-resolve": "^13.1.3",
@@ -68,38 +68,38 @@
68
68
  "@svgr/rollup": "^6.2.1",
69
69
  "@testing-library/react-hooks": "^7.0.2",
70
70
  "@types/jest": "^27.4.1",
71
- "@types/node": "^17.0.21",
72
- "@types/react": "^17.0.39",
73
- "@types/react-dom": "^17.0.13",
71
+ "@types/node": "^17.0.23",
72
+ "@types/react": "^17.0.43",
73
+ "@types/react-dom": "^17.0.14",
74
74
  "@types/react-router-dom": "^5.3.3",
75
- "@typescript-eslint/eslint-plugin": "^5.14.0",
76
- "@typescript-eslint/parser": "^5.14.0",
75
+ "@typescript-eslint/eslint-plugin": "^5.18.0",
76
+ "@typescript-eslint/parser": "^5.18.0",
77
77
  "@wessberg/rollup-plugin-ts": "^2.0.4",
78
- "autoprefixer": "^10.4.2",
78
+ "autoprefixer": "^10.4.4",
79
79
  "babel-jest": "^27.5.1",
80
- "eslint": "^8.10.0",
80
+ "eslint": "^8.12.0",
81
81
  "eslint-config-prettier": "^8.5.0",
82
82
  "eslint-plugin-prettier": "^4.0.0",
83
- "eslint-plugin-react": "^7.29.3",
84
- "eslint-plugin-react-hooks": "^4.3.0",
83
+ "eslint-plugin-react": "^7.29.4",
84
+ "eslint-plugin-react-hooks": "^4.4.0",
85
85
  "jest": "^27.5.1",
86
86
  "jest-expo": "^44.0.1",
87
- "postcss": "^8.4.8",
87
+ "postcss": "^8.4.12",
88
88
  "postcss-assets": "^6.0.0",
89
89
  "postcss-modules": "^4.3.1",
90
- "prettier": "^2.5.1",
90
+ "prettier": "^2.6.2",
91
91
  "react": "^17.0.2",
92
92
  "react-dom": "^17.0.2",
93
93
  "react-router-dom": "^5.3.0",
94
- "rollup": "^2.70.0",
94
+ "rollup": "^2.70.1",
95
95
  "rollup-plugin-delete": "^2.0.0",
96
96
  "rollup-plugin-postcss": "^4.0.2",
97
97
  "rollup-plugin-typescript-paths": "^1.3.1",
98
98
  "rollup-plugin-typescript2": "^0.31.2",
99
- "styled-components": "^5.3.3",
100
- "ts-jest": "^27.1.3",
99
+ "styled-components": "^5.3.5",
100
+ "ts-jest": "^27.1.4",
101
101
  "tslib": "^2.3.1",
102
- "typescript": "=4.6.2"
102
+ "typescript": "=4.6.3"
103
103
  },
104
104
  "compilerOptions": {
105
105
  "declaration": true
@@ -114,4 +114,4 @@
114
114
  "dependencies": {
115
115
  "@microsoft/signalr": "^6.0.3"
116
116
  }
117
- }
117
+ }
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- interface EchoBottomBarProps {
3
- isLandscape: boolean;
4
- }
5
- export declare const EchoBarComponent: React.FC<EchoBottomBarProps>;
6
- export default EchoBarComponent;
@@ -1 +0,0 @@
1
- export declare function useIsLandscape(): boolean;
@@ -1 +0,0 @@
1
- export declare function useScreenOrientation(): "landscape-primary" | "landscape-secondary" | "portrait-primary" | "portrait-secondary";
@@ -1,190 +0,0 @@
1
- 'use strict';
2
-
3
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
-
5
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
6
-
7
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
-
9
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
10
-
11
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
12
-
13
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
-
15
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
16
-
17
- Object.defineProperty(exports, '__esModule', {
18
- value: true
19
- });
20
-
21
- var echoBase = require('@equinor/echo-base');
22
-
23
- var echoComponents = require('@equinor/echo-components');
24
-
25
- var EchoCore = require('@equinor/echo-core');
26
-
27
- var edsCoreReact = require('@equinor/eds-core-react');
28
-
29
- var React = require('react');
30
-
31
- var reactRouterDom = require('react-router-dom');
32
-
33
- var logo_ee = require('../icons/logo_ee.js');
34
-
35
- var EchoContent_module = require('./EchoContent.module.css.js');
36
-
37
- function _interopDefaultLegacy(e) {
38
- return e && _typeof(e) === 'object' && 'default' in e ? e : {
39
- 'default': e
40
- };
41
- }
42
-
43
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
44
-
45
- var EchoBarComponent = function EchoBarComponent(_ref) {
46
- var isLandscape = _ref.isLandscape;
47
-
48
- var _React$useState = React.useState(false),
49
- _React$useState2 = _slicedToArray(_React$useState, 2),
50
- shouldRenderBar = _React$useState2[0],
51
- setShouldRenderBar = _React$useState2[1];
52
-
53
- var _React$useState3 = React.useState(''),
54
- _React$useState4 = _slicedToArray(_React$useState3, 2),
55
- activeKey = _React$useState4[0],
56
- setActiveKey = _React$useState4[1];
57
-
58
- var _React$useState5 = React.useState(false),
59
- _React$useState6 = _slicedToArray(_React$useState5, 2),
60
- isSyncing = _React$useState6[0],
61
- setIsSyncing = _React$useState6[1];
62
-
63
- var _EchoCore$usePanels = EchoCore.usePanels(),
64
- setActivePanel = _EchoCore$usePanels.setActivePanel;
65
-
66
- var goToInternalLink = EchoCore.useInternalLink();
67
-
68
- var _EchoCore$usePlantSet = EchoCore.usePlantSettings(),
69
- selectedInstCode = _EchoCore$usePlantSet.instCode;
70
-
71
- var history = reactRouterDom.useHistory();
72
- var shouldRenderBottomBar = React.useCallback(function () {
73
- var isMounted = true;
74
-
75
- if (window.innerWidth < 768 && !isLandscape || window.innerWidth < 927 && isLandscape && isMounted) {
76
- setShouldRenderBar(true);
77
- } else {
78
- setShouldRenderBar(false);
79
- }
80
-
81
- return function () {
82
- isMounted = false;
83
- };
84
- }, [isLandscape]);
85
- React.useEffect(function () {
86
- var isMounted = true;
87
- var unSubscribeSyncing = echoBase.eventHub.subscribe('isSyncing', function (active) {
88
- if (isMounted) {
89
- setIsSyncing(active);
90
- }
91
- });
92
- return function () {
93
- isMounted = false;
94
- unSubscribeSyncing();
95
- };
96
- });
97
-
98
- var onClickButton = function onClickButton(key) {
99
- setActivePanel('');
100
-
101
- if (key === activeKey) {
102
- if (key === 'menu' || key === 'search') {
103
- setActivePanel('');
104
- } else {
105
- history.go(-1);
106
- }
107
-
108
- setActiveKey('');
109
- } else {
110
- setActiveKey(key);
111
-
112
- switch (key) {
113
- case 'home':
114
- return history.push("/?instCode=".concat(selectedInstCode));
115
-
116
- case 'search':
117
- return setActivePanel(EchoCore.ECHO_CORE_SEARCH);
118
-
119
- case 'camera':
120
- return goToInternalLink('/camera');
121
-
122
- case 'menu':
123
- return setActivePanel(EchoCore.ECHO_CORE_MAIN);
124
-
125
- default:
126
- return null;
127
- }
128
- }
129
-
130
- setActiveKey('');
131
- };
132
-
133
- React.useEffect(function () {
134
- shouldRenderBottomBar();
135
- window.addEventListener('resize', shouldRenderBottomBar);
136
- return function () {
137
- window.removeEventListener('resize', shouldRenderBottomBar);
138
- };
139
- }, [shouldRenderBottomBar, shouldRenderBar]);
140
- var EchoIcon = logo_ee.icon;
141
- return shouldRenderBar ? /*#__PURE__*/React__default["default"].createElement(echoComponents.EchoBottomBar, {
142
- style: {
143
- zIndex: 'var( --echo-framework-z-level-bottom-bar)'
144
- }
145
- }, /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
146
- className: "".concat(EchoContent_module["default"].barButtons, " ").concat(activeKey === 'home' ? EchoContent_module["default"].activeButton : '')
147
- }, /*#__PURE__*/React__default["default"].createElement(edsCoreReact.Button, {
148
- variant: "ghost_icon",
149
- onClick: function onClick() {
150
- return onClickButton('home');
151
- }
152
- }, /*#__PURE__*/React__default["default"].createElement(EchoIcon, null))), /*#__PURE__*/React__default["default"].createElement("div", {
153
- className: "".concat(EchoContent_module["default"].barButtons, " ").concat(activeKey === 'search' ? EchoContent_module["default"].activeButton : '')
154
- }, /*#__PURE__*/React__default["default"].createElement(edsCoreReact.Button, {
155
- variant: "ghost_icon",
156
- onClick: function onClick() {
157
- return onClickButton('search');
158
- }
159
- }, /*#__PURE__*/React__default["default"].createElement(echoComponents.Icon, {
160
- name: 'search',
161
- color: echoComponents.themeConst.echoText
162
- }))), /*#__PURE__*/React__default["default"].createElement("div", {
163
- className: "".concat(EchoContent_module["default"].barButtons, " ").concat(activeKey === 'camera' ? EchoContent_module["default"].activeButton : '')
164
- }, /*#__PURE__*/React__default["default"].createElement(edsCoreReact.Button, {
165
- variant: "ghost_icon",
166
- onClick: function onClick() {
167
- return onClickButton('camera');
168
- }
169
- }, /*#__PURE__*/React__default["default"].createElement(echoComponents.Icon, {
170
- name: 'camera',
171
- color: echoComponents.themeConst.echoText
172
- }))), /*#__PURE__*/React__default["default"].createElement("div", {
173
- className: "".concat(EchoContent_module["default"].barButtons, " ").concat(activeKey === 'menu' ? EchoContent_module["default"].activeButton : '')
174
- }, /*#__PURE__*/React__default["default"].createElement(edsCoreReact.Button, {
175
- variant: "ghost_icon",
176
- onClick: function onClick() {
177
- return onClickButton('menu');
178
- }
179
- }, isSyncing ? /*#__PURE__*/React__default["default"].createElement(echoComponents.Icon, {
180
- className: EchoContent_module["default"].spinningIcon,
181
- color: echoComponents.themeConst.echoText,
182
- name: 'sync'
183
- }) : /*#__PURE__*/React__default["default"].createElement(echoComponents.Icon, {
184
- name: 'menu',
185
- color: echoComponents.themeConst.echoText
186
- }))))) : null;
187
- };
188
-
189
- exports.EchoBarComponent = EchoBarComponent;
190
- exports["default"] = EchoBarComponent;
@@ -1,20 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', {
4
- value: true
5
- });
6
-
7
- var styleInject_es = require('../../node_modules/style-inject/dist/style-inject.es.js');
8
-
9
- var css_248z = ".EchoContent-module_mobileWrapper__I1UNf{height:calc(100% - 60px);position:relative}.EchoContent-module_echoContentContainer__-yhpr{height:100%}.EchoContent-module_echoModuleContainer__NsbOv{width:100%}.EchoContent-module_barButtons__F8xrV{height:100%;text-align:center;width:100%}.EchoContent-module_activeButton__5xhQu{border-top:2px solid var(--equiGreen1)}@media screen and (max-width:927px) and (orientation:landscape){.EchoContent-module_activeButton__5xhQu{border-right:2px solid var(--equiGreen1);border-top:0}}@media screen and (orientation:landscape){.EchoContent-module_echoContentContainer__-yhpr{display:flex;flex-direction:row}}@media screen and (orientation:portrait){.EchoContent-module_echoModuleContainer__NsbOv{height:calc(100% - 48px);overflow:hidden}}@keyframes EchoContent-module_spinAnimation__gNXNq{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.EchoContent-module_spinningIcon__am10d{animation:EchoContent-module_spinAnimation__gNXNq 1.5s linear infinite reverse}";
10
- var style = {
11
- "mobileWrapper": "EchoContent-module_mobileWrapper__I1UNf",
12
- "echoContentContainer": "EchoContent-module_echoContentContainer__-yhpr",
13
- "echoModuleContainer": "EchoContent-module_echoModuleContainer__NsbOv",
14
- "barButtons": "EchoContent-module_barButtons__F8xrV",
15
- "activeButton": "EchoContent-module_activeButton__5xhQu",
16
- "spinningIcon": "EchoContent-module_spinningIcon__am10d",
17
- "spinAnimation": "EchoContent-module_spinAnimation__gNXNq"
18
- };
19
- styleInject_es["default"](css_248z);
20
- exports["default"] = style;
@@ -1,52 +0,0 @@
1
- 'use strict';
2
-
3
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
-
5
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
6
-
7
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
-
9
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
10
-
11
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
12
-
13
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
-
15
- Object.defineProperty(exports, '__esModule', {
16
- value: true
17
- });
18
-
19
- var React = require('react');
20
-
21
- function
22
- /* content: React.RefObject<HTMLDivElement> */
23
- useIsLandscape() {
24
- var _React$useState = React.useState(false),
25
- _React$useState2 = _slicedToArray(_React$useState, 2),
26
- isLandscape = _React$useState2[0],
27
- setIsLandscape = _React$useState2[1];
28
-
29
- var checkScreenOrientation = React.useCallback(function () {
30
- var isMounted = true;
31
-
32
- if (window.innerHeight < window.innerWidth * 0.75 && isMounted) {
33
- setIsLandscape(true);
34
- } else {
35
- setIsLandscape(false);
36
- }
37
-
38
- return function () {
39
- isMounted = false;
40
- };
41
- }, []);
42
- React.useEffect(function () {
43
- checkScreenOrientation();
44
- window.addEventListener('resize', checkScreenOrientation);
45
- return function () {
46
- window.removeEventListener('resize', checkScreenOrientation);
47
- };
48
- }, [checkScreenOrientation]);
49
- return isLandscape;
50
- }
51
-
52
- exports.useIsLandscape = useIsLandscape;