@wavemaker/react-runtime 11.14.2-rc.6311 → 11.14.4-rc.647538
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/actions/navigation-action.js +3 -5
- package/actions/notification-action.js +3 -6
- package/components/basic/anchor/index.js +7 -6
- package/components/basic/label/index.js +2 -2
- package/components/basic/search/index.js +3 -7
- package/components/chart/components/barColumnChart/index.js +4 -2
- package/components/chart/components/pieDonutChart/index.js +1 -3
- package/components/chart/index.js +39 -72
- package/components/chart/utils.js +12 -23
- package/components/container/index.js +7 -6
- package/components/container/panel/components/panel-header/index.js +2 -3
- package/components/container/panel/index.js +9 -13
- package/components/container/tabs/index.js +0 -1
- package/components/container/tabs/tab-pane/index.js +3 -39
- package/components/container/wizard/index.js +57 -187
- package/components/container/wizard/utils.js +1 -1
- package/components/container/wizard/wizard-action/index.js +4 -9
- package/components/container/wizard/wizard-step/index.js +8 -21
- package/components/data/form/base-form/index.js +11 -51
- package/components/data/form/form-controller/withFormController.js +10 -7
- package/components/data/list/components/GroupedListItems.js +1 -5
- package/components/data/list/components/ListItemWithTemplate.js +1 -4
- package/components/data/list/hooks/useListEffects.js +14 -34
- package/components/data/list/hooks/useListEventHandlers.js +2 -18
- package/components/data/list/hooks/useListState.js +2 -15
- package/components/data/list/index.js +0 -1
- package/components/data/list/utils/list-helpers.js +5 -3
- package/components/data/list/utils/list-widget-methods.js +1 -1
- package/components/data/live-filter/index.js +5 -6
- package/components/data/live-form/index.js +14 -24
- package/components/data/table/components/TableBody.js +21 -5
- package/components/data/table/components/TableHeader.js +1 -5
- package/components/data/table/index.js +5 -21
- package/components/data/utils/field-data-utils.js +1 -1
- package/components/dialogs/index.js +16 -14
- package/components/input/currency/index.js +7 -11
- package/components/input/default/checkbox/index.js +3 -2
- package/components/input/default/checkboxset/index.js +22 -2
- package/components/input/default/radioset/index.js +4 -5
- package/components/input/epoch/datetime/index.js +2 -6
- package/components/input/epoch/time/index.js +1 -2
- package/components/input/number/index.js +2 -2
- package/components/input/text/util.js +0 -2
- package/components/input/textarea/index.js +24 -22
- package/components/layout/leftnav/index.js +1 -1
- package/components/navbar/nav/index.js +7 -97
- package/components/navbar/nav-item/index.js +2 -5
- package/components/navigation/menu/index.js +12 -73
- package/components/navigation/popover/index.js +0 -2
- package/components/page/error-boundary/index.js +0 -1
- package/components/prefab/container/index.js +3 -10
- package/context/LocalizationProvider.js +0 -1
- package/context/PrefabContext.js +13 -138
- package/context/WidgetProvider.js +2 -2
- package/core/constants/events.js +6 -12
- package/core/constants/index.js +11 -6
- package/core/formatter/number-formatters.js +1 -1
- package/core/proxy-service.js +36 -72
- package/core/util/utils.js +4 -23
- package/higherOrder/BaseApp.js +18 -60
- package/higherOrder/BasePage.js +77 -99
- package/higherOrder/BasePrefab.js +5 -13
- package/higherOrder/withBaseWrapper.js +3 -3
- package/hooks/useDataSourceSubscription.js +1 -1
- package/hooks/useHttp.js +13 -20
- package/mui-config/theme.js +0 -3
- package/package-lock.json +1115 -1013
- package/package.json +3 -3
- package/store/index.js +1 -5
- package/variables/service-variable.js +14 -17
- package/components/chart/hooks/useBarYAxisExtras.js +0 -52
- package/components/chart/hooks/useXAxisConfig.js +0 -98
- package/utils/lib-error-skipper.js +0 -196
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wavemaker/react-runtime",
|
|
3
|
-
"version": "11.14.
|
|
3
|
+
"version": "11.14.4-rc.647538",
|
|
4
4
|
"description": "React runtime package for Wavemaker",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@mui/icons-material": "6.3.1",
|
|
46
46
|
"@mui/material": "6.3.1",
|
|
47
47
|
"@mui/x-date-pickers": "^8.5.3",
|
|
48
|
-
"@reduxjs/toolkit": "2.
|
|
48
|
+
"@reduxjs/toolkit": "^2.6.1",
|
|
49
49
|
"@tanstack/react-table": "^8.21.3",
|
|
50
50
|
"axios": "^1.7.9",
|
|
51
51
|
"dompurify": "^3.2.3",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"@types/react": "^19",
|
|
79
79
|
"@types/react-color": "^3.0.13",
|
|
80
80
|
"@types/react-dom": "^19",
|
|
81
|
-
"@wavemaker/variables": "11.14.
|
|
81
|
+
"@wavemaker/variables": "11.14.4-rc.647538",
|
|
82
82
|
"babel-plugin-module-resolver": "^5.0.2",
|
|
83
83
|
"eslint": "^9",
|
|
84
84
|
"eslint-config-next": "15.1.4",
|
package/store/index.js
CHANGED
|
@@ -28,10 +28,6 @@ var store = exports.store = (0, _toolkit.configureStore)({
|
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
|
-
|
|
32
|
-
// Only setup listeners on the client side (not during SSR)
|
|
33
|
-
if (typeof window !== "undefined") {
|
|
34
|
-
(0, _query.setupListeners)(store.dispatch);
|
|
35
|
-
}
|
|
31
|
+
(0, _query.setupListeners)(store.dispatch);
|
|
36
32
|
var useAppDispatch = exports.useAppDispatch = _reactRedux.useDispatch;
|
|
37
33
|
var useAppSelector = exports.useAppSelector = _reactRedux.useSelector;
|
|
@@ -89,7 +89,6 @@ var ServiceVariable = exports.ServiceVariable = /*#__PURE__*/function (_ServiceV
|
|
|
89
89
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "cancelTokenSource", void 0);
|
|
90
90
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "initialized", false);
|
|
91
91
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "params", undefined);
|
|
92
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "lastInvokedParams", undefined);
|
|
93
92
|
_this.setupEventHandlers(config);
|
|
94
93
|
return _this;
|
|
95
94
|
}
|
|
@@ -165,20 +164,18 @@ var ServiceVariable = exports.ServiceVariable = /*#__PURE__*/function (_ServiceV
|
|
|
165
164
|
value: function () {
|
|
166
165
|
var _invokeOnParamChange = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
167
166
|
var _this2 = this;
|
|
168
|
-
var
|
|
167
|
+
var last, latest;
|
|
169
168
|
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
170
169
|
while (1) switch (_context3.prev = _context3.next) {
|
|
171
170
|
case 0:
|
|
172
|
-
|
|
173
|
-
|
|
171
|
+
last = this.params;
|
|
172
|
+
latest = (0, _lodashEs.merge)({}, this.config.paramProvider(), this.dataBinding);
|
|
174
173
|
if (!(!(0, _lodashEs.isEqual)(last, latest) && latest !== undefined && !(0, _lodashEs.isEmpty)(latest))) {
|
|
175
|
-
_context3.next =
|
|
174
|
+
_context3.next = 11;
|
|
176
175
|
break;
|
|
177
176
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
_context3.prev = 4;
|
|
181
|
-
_context3.next = 7;
|
|
177
|
+
_context3.prev = 3;
|
|
178
|
+
_context3.next = 6;
|
|
182
179
|
return new Promise(function (resolve, reject) {
|
|
183
180
|
_this2.invoke(latest, function (data) {
|
|
184
181
|
return resolve(data);
|
|
@@ -186,20 +183,20 @@ var ServiceVariable = exports.ServiceVariable = /*#__PURE__*/function (_ServiceV
|
|
|
186
183
|
return reject(error);
|
|
187
184
|
});
|
|
188
185
|
});
|
|
189
|
-
case
|
|
190
|
-
_context3.next =
|
|
186
|
+
case 6:
|
|
187
|
+
_context3.next = 11;
|
|
191
188
|
break;
|
|
192
|
-
case
|
|
193
|
-
_context3.prev =
|
|
194
|
-
_context3.t0 = _context3["catch"](
|
|
189
|
+
case 8:
|
|
190
|
+
_context3.prev = 8;
|
|
191
|
+
_context3.t0 = _context3["catch"](3);
|
|
195
192
|
console.error("Error in invokeOnParamChange:", _context3.t0);
|
|
196
|
-
case
|
|
193
|
+
case 11:
|
|
197
194
|
return _context3.abrupt("return", this);
|
|
198
|
-
case
|
|
195
|
+
case 12:
|
|
199
196
|
case "end":
|
|
200
197
|
return _context3.stop();
|
|
201
198
|
}
|
|
202
|
-
}, _callee3, this, [[
|
|
199
|
+
}, _callee3, this, [[3, 8]]);
|
|
203
200
|
}));
|
|
204
201
|
function invokeOnParamChange() {
|
|
205
202
|
return _invokeOnParamChange.apply(this, arguments);
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.useBarYAxisExtras = useBarYAxisExtras;
|
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
10
|
-
var __jsx = _react["default"].createElement;
|
|
11
|
-
function useBarYAxisExtras(typeOrOptions) {
|
|
12
|
-
var options = typeof typeOrOptions === "string" ? {
|
|
13
|
-
type: typeOrOptions
|
|
14
|
-
} : typeOrOptions;
|
|
15
|
-
var type = options.type,
|
|
16
|
-
_options$chartWidth = options.chartWidth,
|
|
17
|
-
chartWidth = _options$chartWidth === void 0 ? 0 : _options$chartWidth,
|
|
18
|
-
_options$yAxisWidthRa = options.yAxisWidthRatio,
|
|
19
|
-
yAxisWidthRatio = _options$yAxisWidthRa === void 0 ? 0.15 : _options$yAxisWidthRa;
|
|
20
|
-
return (0, _react.useMemo)(function () {
|
|
21
|
-
if (type !== "Bar") {
|
|
22
|
-
return {};
|
|
23
|
-
}
|
|
24
|
-
var tickFontSize = 12;
|
|
25
|
-
var avgCharWidth = 7;
|
|
26
|
-
var calculateMaxChars = function calculateMaxChars() {
|
|
27
|
-
var availableWidth = chartWidth * yAxisWidthRatio;
|
|
28
|
-
var maxChars = Math.floor(availableWidth / avgCharWidth);
|
|
29
|
-
return Math.max(5, Math.min(30, maxChars));
|
|
30
|
-
};
|
|
31
|
-
var maxChars = calculateMaxChars();
|
|
32
|
-
var YTick = function YTick(_ref) {
|
|
33
|
-
var _payload$value;
|
|
34
|
-
var x = _ref.x,
|
|
35
|
-
y = _ref.y,
|
|
36
|
-
payload = _ref.payload;
|
|
37
|
-
var full = String((_payload$value = payload === null || payload === void 0 ? void 0 : payload.value) !== null && _payload$value !== void 0 ? _payload$value : "");
|
|
38
|
-
var text = full.length > maxChars ? full.slice(0, maxChars - 1) + "…" : full;
|
|
39
|
-
return __jsx("g", {
|
|
40
|
-
transform: "translate(".concat(x, ",").concat(y, ")")
|
|
41
|
-
}, __jsx("text", {
|
|
42
|
-
dy: 4,
|
|
43
|
-
textAnchor: "end",
|
|
44
|
-
fontSize: tickFontSize,
|
|
45
|
-
fill: "currentColor"
|
|
46
|
-
}, __jsx("title", null, full), text));
|
|
47
|
-
};
|
|
48
|
-
return {
|
|
49
|
-
tick: __jsx(YTick, null)
|
|
50
|
-
};
|
|
51
|
-
}, [type, chartWidth, yAxisWidthRatio]);
|
|
52
|
-
}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.useXAxisConfig = useXAxisConfig;
|
|
9
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
var _utils = require("../utils");
|
|
12
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
13
|
-
var __jsx = _react["default"].createElement;
|
|
14
|
-
function useXAxisConfig(_ref) {
|
|
15
|
-
var _chartContainerRef$cu2;
|
|
16
|
-
var type = _ref.type,
|
|
17
|
-
processedData = _ref.processedData,
|
|
18
|
-
xDataKeyArr = _ref.xDataKeyArr,
|
|
19
|
-
chartContainerRef = _ref.chartContainerRef,
|
|
20
|
-
getDefaultXAxisLabel = _ref.getDefaultXAxisLabel,
|
|
21
|
-
xnumberformat = _ref.xnumberformat,
|
|
22
|
-
showxaxis = _ref.showxaxis,
|
|
23
|
-
xaxislabeldistance = _ref.xaxislabeldistance;
|
|
24
|
-
var xAxisConfig = (0, _react.useMemo)(function () {
|
|
25
|
-
var _chartContainerRef$cu;
|
|
26
|
-
var tickFontSize = 12;
|
|
27
|
-
var numTicks = type === "Bar" ? 5 : Math.max(1, processedData && processedData.length || xDataKeyArr.length || 1);
|
|
28
|
-
var containerWidth = ((_chartContainerRef$cu = chartContainerRef.current) === null || _chartContainerRef$cu === void 0 ? void 0 : _chartContainerRef$cu.clientWidth) || 300;
|
|
29
|
-
var maxWidthPx = Math.max(40, Math.floor((containerWidth - 60) / numTicks));
|
|
30
|
-
var approxCharWidth = tickFontSize * 0.8; // heuristic for average character width
|
|
31
|
-
var maxChars = Math.max(3, Math.floor(maxWidthPx / approxCharWidth));
|
|
32
|
-
|
|
33
|
-
// Estimate overlap risk from actual labels we will render
|
|
34
|
-
var rawLabels = (processedData || []).map(function (d) {
|
|
35
|
-
return d === null || d === void 0 ? void 0 : d.x;
|
|
36
|
-
});
|
|
37
|
-
var displayLabels = rawLabels.length > 0 ? rawLabels.map(function (val, idx) {
|
|
38
|
-
var _v;
|
|
39
|
-
var v = val;
|
|
40
|
-
if (xnumberformat && typeof v === "number") {
|
|
41
|
-
v = (0, _utils.formatNumber)(v, xnumberformat);
|
|
42
|
-
} else if (xDataKeyArr.length > 0 && xDataKeyArr[idx] !== undefined) {
|
|
43
|
-
v = xDataKeyArr[idx];
|
|
44
|
-
}
|
|
45
|
-
return String((_v = v) !== null && _v !== void 0 ? _v : "");
|
|
46
|
-
}) : (xDataKeyArr || []).map(function (v) {
|
|
47
|
-
return String(v !== null && v !== void 0 ? v : "");
|
|
48
|
-
});
|
|
49
|
-
var maxLabelChars = displayLabels.length ? Math.max.apply(Math, (0, _toConsumableArray2["default"])(displayLabels.map(function (s) {
|
|
50
|
-
return s.length;
|
|
51
|
-
}))) : 0;
|
|
52
|
-
var mayOverlap = maxLabelChars * approxCharWidth > maxWidthPx;
|
|
53
|
-
var shouldStagger = type !== "Bar" && mayOverlap;
|
|
54
|
-
var XAxisTickWithTooltip = function XAxisTickWithTooltip(_ref2) {
|
|
55
|
-
var _displayValue;
|
|
56
|
-
var x = _ref2.x,
|
|
57
|
-
y = _ref2.y,
|
|
58
|
-
payload = _ref2.payload,
|
|
59
|
-
index = _ref2.index;
|
|
60
|
-
var rawValue = payload === null || payload === void 0 ? void 0 : payload.value;
|
|
61
|
-
// Preserve existing mapping/formatting behavior
|
|
62
|
-
var displayValue = rawValue;
|
|
63
|
-
if (xnumberformat && typeof rawValue === "number") {
|
|
64
|
-
displayValue = (0, _utils.formatNumber)(rawValue, xnumberformat);
|
|
65
|
-
} else if (xDataKeyArr.length > 0 && typeof index === "number" && xDataKeyArr[index] !== undefined) {
|
|
66
|
-
displayValue = xDataKeyArr[index];
|
|
67
|
-
}
|
|
68
|
-
var fullText = String((_displayValue = displayValue) !== null && _displayValue !== void 0 ? _displayValue : "");
|
|
69
|
-
var needsEllipsis = fullText.length > maxChars;
|
|
70
|
-
var truncatedText = needsEllipsis ? fullText.slice(0, Math.max(0, maxChars - 1)) + "…" : fullText;
|
|
71
|
-
var textAnchor = "middle";
|
|
72
|
-
return __jsx("g", {
|
|
73
|
-
transform: "translate(".concat(x, ",").concat(y, ")")
|
|
74
|
-
}, __jsx("text", {
|
|
75
|
-
textAnchor: textAnchor,
|
|
76
|
-
fontSize: tickFontSize,
|
|
77
|
-
fill: "currentColor"
|
|
78
|
-
}, __jsx("title", null, fullText), truncatedText));
|
|
79
|
-
};
|
|
80
|
-
return {
|
|
81
|
-
hide: !showxaxis,
|
|
82
|
-
label: {
|
|
83
|
-
// value: getDefaultXAxisLabel(),
|
|
84
|
-
position: "insideBottom",
|
|
85
|
-
offset: xaxislabeldistance,
|
|
86
|
-
fill: "#000"
|
|
87
|
-
},
|
|
88
|
-
// Ensure all x-axis labels render
|
|
89
|
-
interval: 0,
|
|
90
|
-
// Provide extra space only when staggering is needed
|
|
91
|
-
height: type === "Bar" ? undefined : shouldStagger ? 40 : undefined,
|
|
92
|
-
tickMargin: 8,
|
|
93
|
-
// Custom tick that truncates with ellipsis and shows full text in native tooltip
|
|
94
|
-
tick: __jsx(XAxisTickWithTooltip, null)
|
|
95
|
-
};
|
|
96
|
-
}, [type, processedData, xDataKeyArr, (_chartContainerRef$cu2 = chartContainerRef.current) === null || _chartContainerRef$cu2 === void 0 ? void 0 : _chartContainerRef$cu2.clientWidth, getDefaultXAxisLabel, xnumberformat, showxaxis, xaxislabeldistance]);
|
|
97
|
-
return xAxisConfig;
|
|
98
|
-
}
|
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.wrapWithThirdPartyErrorGuard = exports.isJQueryError = void 0;
|
|
8
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
-
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
10
|
-
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
11
|
-
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
12
|
-
/**
|
|
13
|
-
* Utility to wrap all methods in a script object with jQuery error handling
|
|
14
|
-
* This prevents jQuery usage from breaking the React application
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Configuration for unsupported libraries
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
var UNSUPPORTED_LIBRARIES = {
|
|
22
|
-
jquery: {
|
|
23
|
-
identifiers: ["jQuery", "$"],
|
|
24
|
-
errorMessage: "jQuery is not supported in React App",
|
|
25
|
-
notificationMessage: "jQuery functionality is not supported. Check console for details."
|
|
26
|
-
}
|
|
27
|
-
// Add more libraries here in future
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Result of unsupported library detection
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Detects if an error is related to any unsupported library
|
|
36
|
-
* @param error - The error object to check
|
|
37
|
-
* @returns Object with isUnsupported flag and library info
|
|
38
|
-
*/
|
|
39
|
-
function detectUnsupportedLibrary(error) {
|
|
40
|
-
if (!error || !error.stack) {
|
|
41
|
-
return {
|
|
42
|
-
isUnsupported: false,
|
|
43
|
-
library: null
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
var errorMessage = error.message || "";
|
|
47
|
-
var stackTrace = String(error.stack);
|
|
48
|
-
|
|
49
|
-
// Check each configured library
|
|
50
|
-
for (var _i = 0, _Object$entries = Object.entries(UNSUPPORTED_LIBRARIES); _i < _Object$entries.length; _i++) {
|
|
51
|
-
var _Object$entries$_i = (0, _slicedToArray2["default"])(_Object$entries[_i], 2),
|
|
52
|
-
libraryName = _Object$entries$_i[0],
|
|
53
|
-
config = _Object$entries$_i[1];
|
|
54
|
-
var identifiers = config.identifiers;
|
|
55
|
-
|
|
56
|
-
// Check if error message contains library identifiers
|
|
57
|
-
if (identifiers.some(function (identifier) {
|
|
58
|
-
return errorMessage.includes(identifier);
|
|
59
|
-
})) {
|
|
60
|
-
return {
|
|
61
|
-
isUnsupported: true,
|
|
62
|
-
library: libraryName,
|
|
63
|
-
config: config
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Check if stack trace contains library identifiers
|
|
68
|
-
var stackLines = stackTrace.split("\n");
|
|
69
|
-
var _iterator = _createForOfIteratorHelper(stackLines),
|
|
70
|
-
_step;
|
|
71
|
-
try {
|
|
72
|
-
var _loop = function _loop() {
|
|
73
|
-
var line = _step.value;
|
|
74
|
-
if (identifiers.some(function (identifier) {
|
|
75
|
-
return line.includes(identifier);
|
|
76
|
-
})) {
|
|
77
|
-
return {
|
|
78
|
-
v: {
|
|
79
|
-
isUnsupported: true,
|
|
80
|
-
library: libraryName,
|
|
81
|
-
config: config
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
_ret;
|
|
87
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
88
|
-
_ret = _loop();
|
|
89
|
-
if (_ret) return _ret.v;
|
|
90
|
-
}
|
|
91
|
-
} catch (err) {
|
|
92
|
-
_iterator.e(err);
|
|
93
|
-
} finally {
|
|
94
|
-
_iterator.f();
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
return {
|
|
98
|
-
isUnsupported: false,
|
|
99
|
-
library: null
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Checks if an error is related to jQuery usage
|
|
105
|
-
* @param error - The error object to check
|
|
106
|
-
* @returns true if the error is jQuery-related
|
|
107
|
-
*/
|
|
108
|
-
var isJQueryError = exports.isJQueryError = function isJQueryError(error) {
|
|
109
|
-
if (!(error !== null && error !== void 0 && error.stack)) return false;
|
|
110
|
-
var UnSupportedFunctionality = ["jQuery", "$"];
|
|
111
|
-
|
|
112
|
-
// Check if error message contains jQuery references
|
|
113
|
-
if (error.message && UnSupportedFunctionality.some(function (func) {
|
|
114
|
-
return error.message.includes(func);
|
|
115
|
-
})) {
|
|
116
|
-
return true;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// Check stack trace for jQuery references
|
|
120
|
-
var stackLines = error.stack.split("\n");
|
|
121
|
-
var _iterator2 = _createForOfIteratorHelper(stackLines),
|
|
122
|
-
_step2;
|
|
123
|
-
try {
|
|
124
|
-
var _loop2 = function _loop2() {
|
|
125
|
-
var line = _step2.value;
|
|
126
|
-
if (UnSupportedFunctionality.some(function (func) {
|
|
127
|
-
return line.includes(func);
|
|
128
|
-
})) {
|
|
129
|
-
return {
|
|
130
|
-
v: true
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
},
|
|
134
|
-
_ret2;
|
|
135
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
136
|
-
_ret2 = _loop2();
|
|
137
|
-
if (_ret2) return _ret2.v;
|
|
138
|
-
}
|
|
139
|
-
} catch (err) {
|
|
140
|
-
_iterator2.e(err);
|
|
141
|
-
} finally {
|
|
142
|
-
_iterator2.f();
|
|
143
|
-
}
|
|
144
|
-
return false;
|
|
145
|
-
};
|
|
146
|
-
/**
|
|
147
|
-
* Wraps all methods with unsupported library error handling
|
|
148
|
-
* @param pageProxy - The page/prefab proxy object
|
|
149
|
-
* @param appContext - App context for notifications
|
|
150
|
-
* @param componentName - Name of component for logging
|
|
151
|
-
* @param libraryConfig - Optional: specific libraries to check (default: all)
|
|
152
|
-
*/
|
|
153
|
-
var wrapWithThirdPartyErrorGuard = exports.wrapWithThirdPartyErrorGuard = function wrapWithThirdPartyErrorGuard(pageProxy, appContext, componentName) {
|
|
154
|
-
var libraryConfig = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : UNSUPPORTED_LIBRARIES;
|
|
155
|
-
var skipProperties = ["Variables", "Actions", "Widgets", "App", "pageParams", "serviceDefinitions", "baseUrl", "appConfig", "notification", "toaster", "onContentReady", "onChange", "cleanup", "eval", "appLocale", "executeStartup", "formatters", "type", "componentName", "componentType", "prefabname", "onPropertyChange"];
|
|
156
|
-
Object.keys(pageProxy).forEach(function (methodName) {
|
|
157
|
-
if (typeof pageProxy[methodName] === "function" && !skipProperties.includes(methodName)) {
|
|
158
|
-
var originalMethod = pageProxy[methodName];
|
|
159
|
-
pageProxy[methodName] = function () {
|
|
160
|
-
try {
|
|
161
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
162
|
-
args[_key] = arguments[_key];
|
|
163
|
-
}
|
|
164
|
-
return originalMethod.apply(this, args);
|
|
165
|
-
} catch (error) {
|
|
166
|
-
// Detect which unsupported library caused the error
|
|
167
|
-
var detection = detectUnsupportedLibrary(error);
|
|
168
|
-
if (detection.isUnsupported && detection.library && detection.config) {
|
|
169
|
-
var library = detection.library;
|
|
170
|
-
var config = detection.config;
|
|
171
|
-
|
|
172
|
-
// Log detailed error
|
|
173
|
-
console.error("[".concat(library.toUpperCase(), " ERROR] in ").concat(componentName, ".").concat(methodName, "()"), "\n".concat(config.errorMessage), "\nError:", error);
|
|
174
|
-
|
|
175
|
-
// Show user notification
|
|
176
|
-
if (appContext !== null && appContext !== void 0 && appContext.notifyApp) {
|
|
177
|
-
appContext.notifyApp(config.notificationMessage, "Error");
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
// Return undefined to prevent further errors
|
|
181
|
-
return undefined;
|
|
182
|
-
} else {
|
|
183
|
-
// Not an unsupported library error - log normally
|
|
184
|
-
console.log("Error in ".concat(componentName, ".").concat(methodName, "():"));
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
// Preserve function name for debugging
|
|
190
|
-
Object.defineProperty(pageProxy[methodName], "name", {
|
|
191
|
-
value: "wrapped_".concat(methodName),
|
|
192
|
-
writable: false
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
});
|
|
196
|
-
};
|