ws-process 0.3.52 → 0.3.54

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/Loading.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import React, { Component } from 'react';
2
2
  import './Loading.css';
3
3
  import { tryit, byId } from 'ui5-lib-rc';
4
- import { initialState } from './reducer';
4
+ import { initialState } from './reducer.js';
5
5
 
6
6
  const ref = React.createRef();
7
7
 
package/index.js CHANGED
@@ -5,7 +5,7 @@ import * as Sentry from '@sentry/react';
5
5
  import {
6
6
  defined, clone, makeid, tryit, wait,
7
7
  } from '@bsgp/lib-core';
8
- import { ref, Loading, getRef } from './Loading-esm';
8
+ import { ref, Loading, getRef } from './Loading.js';
9
9
  import {
10
10
  storeSplittedData,
11
11
  clearDataSplitted,
@@ -19,10 +19,10 @@ import {
19
19
  addWSRequest,
20
20
  addConcurrency,
21
21
  subtractConcurrency,
22
- } from './actions';
22
+ } from './actions.js';
23
23
 
24
- import reducer, { initialState } from './reducer';
25
- import { cutStringByLength, createSplitPayload } from './lib/split-payload';
24
+ import reducer, { initialState } from './reducer.js';
25
+ import { cutStringByLength, createSplitPayload } from './lib/split-payload.js';
26
26
 
27
27
  const local = {
28
28
  processes: {},
@@ -1419,6 +1419,7 @@ function init({
1419
1419
  store,
1420
1420
  stage,
1421
1421
  wsURL,
1422
+ dispatch,
1422
1423
  beforeEachProcess,
1423
1424
  afterEachProcess,
1424
1425
  beforeAllProcesses,
@@ -1428,6 +1429,7 @@ function init({
1428
1429
  local.store = store;
1429
1430
  local.stage = stage;
1430
1431
  local.wsURL = wsURL;
1432
+ local.hostDispatch = dispatch;
1431
1433
 
1432
1434
  local.beforeEachProcess = beforeEachProcess || (() => { });
1433
1435
  local.afterEachProcess = afterEachProcess || (() => { });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ws-process",
3
- "version": "0.3.52",
3
+ "version": "0.3.54",
4
4
  "description": "Process Management for Web Socket Client",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/reducer.js CHANGED
@@ -15,7 +15,7 @@ import {
15
15
  CLEAR_DATA_SPLITTED,
16
16
  ADD_CONCURRENCY,
17
17
  SUBTRACT_CONCURRENCY,
18
- } from './actions';
18
+ } from './actions.js';
19
19
 
20
20
  export const initialState = {
21
21
  loading: false,
package/Loading-esm.js DELETED
@@ -1,197 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getRef = getRef;
7
- exports.Loading = exports.ref = void 0;
8
-
9
- var _react = _interopRequireWildcard(require("react"));
10
-
11
- require("./Loading.css");
12
-
13
- var _ui5LibRc = require("ui5-lib-rc");
14
-
15
- var _reducer = require("./reducer");
16
-
17
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
18
-
19
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
20
-
21
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
22
-
23
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
24
-
25
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
26
-
27
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
28
-
29
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
30
-
31
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
32
-
33
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
34
-
35
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
36
-
37
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
38
-
39
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
40
-
41
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
42
-
43
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
44
-
45
- var ref = _react["default"].createRef();
46
-
47
- exports.ref = ref;
48
-
49
- function getRef() {
50
- return ref;
51
- }
52
-
53
- var Loading = /*#__PURE__*/function (_Component) {
54
- _inherits(Loading, _Component);
55
-
56
- var _super = _createSuper(Loading);
57
-
58
- function Loading() {
59
- var _this;
60
-
61
- _classCallCheck(this, Loading);
62
-
63
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
64
- args[_key] = arguments[_key];
65
- }
66
-
67
- _this = _super.call.apply(_super, [this].concat(args));
68
-
69
- _defineProperty(_assertThisInitialized(_this), "removeHiddenClass", function () {
70
- window.jQuery('#loading_dialog').removeClass('sapUiForcedHidden');
71
- });
72
-
73
- _defineProperty(_assertThisInitialized(_this), "addHiddenClass", function () {
74
- window.jQuery('#loading_dialog').addClass('sapUiForcedHidden');
75
- });
76
-
77
- _defineProperty(_assertThisInitialized(_this), "state", {
78
- wsProcess: _reducer.initialState
79
- });
80
-
81
- return _this;
82
- }
83
-
84
- _createClass(Loading, [{
85
- key: "componentDidMount",
86
- value: function componentDidMount() {
87
- this.removeHiddenClass();
88
- }
89
- }, {
90
- key: "componentWillUnmount",
91
- value: function componentWillUnmount() {
92
- this.addHiddenClass();
93
- }
94
- }, {
95
- key: "mapStateToProps",
96
- value: function mapStateToProps() {
97
- var state = this.state;
98
- var descriptions = Object.keys(state.wsProcess.processes).filter(function (key) {
99
- var process = state.wsProcess.processes[key];
100
- var showDescription = (0, _ui5LibRc.tryit)(function () {
101
- return process.options.showDescription;
102
- });
103
-
104
- if (showDescription) {
105
- return true;
106
- }
107
-
108
- return false;
109
- }).map(function (key) {
110
- var process = state.wsProcess.processes[key];
111
- var item = process.items[process.count];
112
-
113
- if (process.count < process.items.length) {
114
- return item.description;
115
- }
116
-
117
- return null;
118
- }).filter(function (desc) {
119
- return desc !== null;
120
- });
121
- var processCount = Object.keys(state.wsProcess.processes).length;
122
- return {
123
- descriptions: descriptions,
124
- processCount: processCount
125
- };
126
- }
127
- }, {
128
- key: "showDescriptionOnBusyIndicator",
129
- value: function showDescriptionOnBusyIndicator() {
130
- var _this$mapStateToProps = this.mapStateToProps(),
131
- descriptions = _this$mapStateToProps.descriptions,
132
- processCount = _this$mapStateToProps.processCount;
133
-
134
- var elBusyIndicator = (0, _ui5LibRc.tryit)( // eslint-disable-next-line no-underscore-dangle
135
- function () {
136
- return (0, _ui5LibRc.byId)('app')._oBusyBlockState.$blockLayer.children('.sapUiLocalBusyIndicatorAnimation')[0];
137
- });
138
-
139
- if (elBusyIndicator) {
140
- var className = 'busyText';
141
- var textContent = descriptions.length > 0 ? descriptions.reduce(function (acc, desc) {
142
- var newDesc = desc || 'Loading';
143
-
144
- if ((0, _ui5LibRc.tryit)(function () {
145
- return acc[acc.length - 1].desc;
146
- }) === newDesc) {
147
- acc[acc.length - 1].count += 1;
148
- } else {
149
- var each = {
150
- desc: newDesc,
151
- count: 1
152
- };
153
- acc.push(each);
154
- }
155
-
156
- return acc;
157
- }, []).map(function (each) {
158
- return each.count === 1 ? each.desc : "".concat(each.desc, " - ").concat(each.count);
159
- }).join('\n') : 'Loading';
160
-
161
- if (processCount > 3) {
162
- if (textContent === 'Loading') {
163
- textContent += " - ".concat(processCount, " processes");
164
- }
165
- }
166
-
167
- if (window.$(elBusyIndicator).children(".".concat(className)).length === 0) {
168
- var elBusyText = document.createElement('div');
169
- elBusyText.className = "".concat(className);
170
- elBusyText.textContent = textContent;
171
- window.$(elBusyIndicator).append(elBusyText);
172
- }
173
-
174
- if (window.$(elBusyIndicator).children(".".concat(className)).length === 1) {
175
- window.$(elBusyIndicator).children(".".concat(className))[0].textContent = textContent;
176
- }
177
- }
178
- }
179
- }, {
180
- key: "render",
181
- value: function render() {
182
- this.showDescriptionOnBusyIndicator();
183
- return true;
184
- }
185
- }]);
186
-
187
- return Loading;
188
- }(_react.Component); // class Loading extends Component {
189
- // render(){
190
- // return <InternalLoading ref={ref} />;
191
- // }
192
- // }
193
-
194
-
195
- exports.Loading = Loading;
196
-
197
- //# sourceMappingURL=Loading-esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["Loading.js"],"names":[],"mappings":";;;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAM,GAAG,GAAG,kBAAM,SAAN,EAAZ;;;;AAEA,SAAS,MAAT,GAAkB;AAChB,SAAO,GAAP;AACD;;IAEK,O;;;;;;;;;;;;;;;;wEASgB,YAAM;AACxB,MAAA,MAAM,CAAC,MAAP,CAAc,iBAAd,EAAiC,WAAjC,CAA6C,mBAA7C;AACD,K;;qEAEgB,YAAM;AACrB,MAAA,MAAM,CAAC,MAAP,CAAc,iBAAd,EAAiC,QAAjC,CAA0C,mBAA1C;AACD,K;;4DA4BO;AACN,MAAA,SAAS,EAAE;AADL,K;;;;;;;wCA1CY;AAClB,WAAK,iBAAL;AACD;;;2CAEsB;AACrB,WAAK,cAAL;AACD;;;sCAUiB;AAAA,UACR,KADQ,GACE,IADF,CACR,KADQ;AAGhB,UAAM,YAAY,GAAG,MAAM,CAAC,IAAP,CAAY,KAAK,CAAC,SAAN,CAAgB,SAA5B,EAClB,MADkB,CACX,UAAC,GAAD,EAAS;AACf,YAAM,OAAO,GAAG,KAAK,CAAC,SAAN,CAAgB,SAAhB,CAA0B,GAA1B,CAAhB;AACA,YAAM,eAAe,GAAG,qBAAM;AAAA,iBAAM,OAAO,CAAC,OAAR,CAAgB,eAAtB;AAAA,SAAN,CAAxB;;AACA,YAAI,eAAJ,EAAqB;AACnB,iBAAO,IAAP;AACD;;AACD,eAAO,KAAP;AACD,OARkB,EASlB,GATkB,CASd,UAAC,GAAD,EAAS;AACZ,YAAM,OAAO,GAAG,KAAK,CAAC,SAAN,CAAgB,SAAhB,C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GAAG;AAAE,cAAA,IAAI,EAAE,OAAR;AAAiB,cAAA,KAAK,EAAE;AAAxB,aAAb;AACA,YAAA,GAAG,CAAC,IAAJ,CAAS,IAAT;AACD;;AAED,iBAAO,GAAP;AACD,SAXD,EAWG,EAXH,EAYC,GAZD,CAYK,UAAC,IAAD;AAAA,iBAAW,IAAI,CAAC,KAAL,KAAe,CAAf,GAAmB,IAAI,CAAC,IAAxB,aAAkC,IAAI,CAAC,IAAvC,gBAAiD,IAAI,CAAC,KAAtD,CAAX;AAAA,SAZL,EAaC,IAbD,CAaM,IAbN,CADc,GAed,SAfJ;;AAgBA,YAAI,YAAY,GAAG,CAAnB,EAAsB;AACpB,cAAI,WAAW,KAAK,SAApB,EAA+B;AAC7B,YAAA,WAAW,iBAAU,YAAV,eAAX;AACD;AACF;;AAED,YAAI,MAAM,CAAC,CAAP,CAAS,eAAT,EAA0B,QAA1B,YAAuC,SAAvC,GAAoD,MAApD,KAA+D,CAAnE,EAAsE;AACpE,cAAM,UAAU,GAAG,QAAQ,CAAC,aAAT,CAAuB,KAAvB,CAAnB;AACA,UAAA,UAAU,CAAC,SAAX,aAA0B,SAA1B;AACA,UAAA,UAAU,CAAC,WAAX,GAAyB,WAAzB;AACA,UAAA,MAAM,CAAC,CAAP,CAAS,eAAT,EAA0B,MAA1B,CAAiC,UAAjC;AACD;;AAED,YAAI,MAAM,CAAC,CAAP,CAAS,eAAT,EAA0B,QAA1B,YAAuC,SAAvC,GAAoD,MAApD,KAA+D,CAAnE,EAAsE;AACpE,UAAA,MAAM,CACH,CADH,CACK,eADL,EAEG,QAFH,YAEgB,SAFhB,GAE6B,CAF7B,EAEgC,WAFhC,GAE8C,WAF9C;AAGD;AACF;AACF;;;6BAEQ;AACP,WAAK,8BAAL;AAEA,aACE,IADF;AAGD;;;;EAtGmB,gB,GAyGtB;AACA;AACA;AACA;AACA","file":"Loading-esm.js","sourcesContent":["import React, { Component } from 'react';\nimport './Loading.css';\nimport { tryit, byId } from 'ui5-lib-rc';\nimport { initialState } from './reducer';\n\nconst ref = React.createRef();\n\nfunction getRef() {\n return ref;\n}\n\nclass Loading extends Component {\n componentDidMount() {\n this.removeHiddenClass();\n }\n\n componentWillUnmount() {\n this.addHiddenClass();\n }\n\n removeHiddenClass = () => {\n window.jQuery('#loading_dialog').removeClass('sapUiForcedHidden');\n }\n\n addHiddenClass = () => {\n window.jQuery('#loading_dialog').addClass('sapUiForcedHidden');\n }\n\n mapStateToProps() {\n const { state } = this;\n\n const descriptions = Object.keys(state.wsProcess.processes)\n .filter((key) => {\n const process = state.wsProcess.processes[key];\n const showDescription = tryit(() => process.options.showDescription);\n if (showDescription) {\n return true;\n }\n return false;\n })\n .map((key) => {\n const process = state.wsProcess.processes[key];\n const item = process.items[process.count];\n if (process.count < process.items.length) {\n return item.description;\n }\n return null;\n })\n .filter((desc) => desc !== null);\n\n const processCount = Object.keys(state.wsProcess.processes).length;\n return { descriptions, processCount };\n }\n\n state = {\n wsProcess: initialState,\n }\n\n showDescriptionOnBusyIndicator() {\n const { descriptions, processCount } = this.mapStateToProps();\n\n const elBusyIndicator = tryit(\n // eslint-disable-next-line no-underscore-dangle\n () => byId('app')._oBusyBlockState.$blockLayer.children(\n '.sapUiLocalBusyIndicatorAnimation',\n )[0],\n );\n\n if (elBusyIndicator) {\n const className = 'busyText';\n let textContent = descriptions.length > 0\n ? descriptions\n .reduce((acc, desc) => {\n const newDesc = desc || 'Loading';\n if (tryit(() => acc[acc.length - 1].desc) === newDesc) {\n acc[acc.length - 1].count += 1;\n } else {\n const each = { desc: newDesc, count: 1 };\n acc.push(each);\n }\n\n return acc;\n }, [])\n .map((each) => (each.count === 1 ? each.desc : `${each.desc} - ${each.count}`))\n .join('\\n')\n : 'Loading';\n if (processCount > 3) {\n if (textContent === 'Loading') {\n textContent += ` - ${processCount} processes`;\n }\n }\n\n if (window.$(elBusyIndicator).children(`.${className}`).length === 0) {\n const elBusyText = document.createElement('div');\n elBusyText.className = `${className}`;\n elBusyText.textContent = textContent;\n window.$(elBusyIndicator).append(elBusyText);\n }\n\n if (window.$(elBusyIndicator).children(`.${className}`).length === 1) {\n window\n .$(elBusyIndicator)\n .children(`.${className}`)[0].textContent = textContent;\n }\n }\n }\n\n render() {\n this.showDescriptionOnBusyIndicator();\n\n return (\n true\n );\n }\n}\n\n// class Loading extends Component {\n// render(){\n// return <InternalLoading ref={ref} />;\n// }\n// }\n\nexport { ref, Loading, getRef };\n"]}