@wavemaker/react-runtime 11.14.2-rc.6311 → 12.0.0-next.28533
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/base-action.js +5 -7
- package/actions/login-action.js +7 -8
- package/actions/logout-action.js +5 -7
- package/actions/navigation-action.js +32 -10
- package/actions/notification-action.js +22 -8
- package/actions/timer-action.js +13 -15
- package/actions/toast.js +4 -2
- package/actions/toast.service.js +1 -2
- package/components/advanced/carousel/index.js +1 -1
- package/components/advanced/carousel/template.js +1 -1
- package/components/basic/anchor/index.js +26 -9
- package/components/basic/html/index.js +115 -24
- package/components/basic/icon/index.js +2 -1
- package/components/basic/iframe/index.js +2 -1
- package/components/basic/label/index.js +12 -9
- package/components/basic/message/index.js +12 -3
- package/components/basic/picture/index.js +11 -4
- package/components/basic/progress-bar/index.js +1 -1
- package/components/basic/progress-circle/index.js +34 -28
- package/components/basic/progress-circle/props.js +10 -2
- package/components/basic/richtexteditor/index.js +95 -94
- package/components/basic/search/index.js +401 -156
- package/components/basic/search/providers.js +126 -61
- package/components/basic/spinner/index.js +2 -1
- package/components/basic/tree/index.js +34 -34
- package/components/basic/tree/utils.js +10 -4
- package/components/chart/components/barColumnChart/index.js +36 -33
- package/components/chart/components/bubbleChart/index.js +35 -25
- package/components/chart/components/chartLegend/utils.js +2 -1
- package/components/chart/components/cumulativeLineChart/index.js +30 -26
- package/components/chart/components/lineAreaChart/index.js +50 -32
- package/components/chart/components/pieDonutChart/index.js +13 -4
- package/components/chart/hooks/useXAxisConfig.js +15 -8
- package/components/chart/index.js +223 -53
- package/components/chart/utils.js +12 -1
- package/components/constants.js +5 -2
- package/components/container/accordion/accordion-pane/index.js +17 -12
- package/components/container/accordion/index.js +9 -4
- package/components/container/alignment-utils.js +56 -1
- package/components/container/index.js +49 -20
- package/components/container/panel/components/panel-header/index.js +3 -4
- package/components/container/panel/index.js +15 -10
- package/components/container/tabs/index.js +92 -14
- package/components/container/tabs/tab-pane/index.js +15 -8
- package/components/container/tabs/utils.js +51 -0
- package/components/container/wizard/components/StepComponents.js +2 -1
- package/components/container/wizard/components/WizardStep.js +2 -1
- package/components/container/wizard/index.js +64 -35
- package/components/container/wizard/utils.js +46 -1
- package/components/container/wizard/wizard-step/index.js +11 -1
- package/components/data/card/card-content/index.js +1 -1
- package/components/data/form/base-form/index.js +991 -180
- package/components/data/form/base-form/props.js +3 -1
- package/components/data/form/base-form/utils.js +159 -1
- package/components/data/form/dynamic-fields/constant.js +53 -0
- package/components/data/form/dynamic-fields/index.js +10 -45
- package/components/data/form/dynamic-fields/utils.js +37 -2
- package/components/data/form/form-action/index.js +5 -4
- package/components/data/form/form-context.js +5 -1
- package/components/data/form/form-controller/utils.js +84 -0
- package/components/data/form/form-controller/validation-contrustor.js +402 -189
- package/components/data/form/form-controller/withFormController.js +191 -52
- package/components/data/form/form-field/base-field.js +54 -33
- package/components/data/form/form-field/index.js +28 -5
- package/components/data/form/form-header/index.js +3 -4
- package/components/data/form/index.js +20 -1
- package/components/data/list/components/ListDND.js +2 -1
- package/components/data/list/components/ListItem.js +6 -2
- package/components/data/list/components/ListItemWithTemplate.js +46 -2
- package/components/data/list/components/ListItems.js +17 -26
- package/components/data/list/components/ListPagination.js +3 -3
- package/components/data/list/components/StandardListItems.js +3 -4
- package/components/data/list/hooks/useListEffects.js +55 -14
- package/components/data/list/hooks/useListEventHandlers.js +3 -1
- package/components/data/list/hooks/useListState.js +3 -1
- package/components/data/list/hooks/usePaginatedGroupedData.js +18 -5
- package/components/data/list/index.js +74 -55
- package/components/data/list/utils/list-helpers.js +73 -35
- package/components/data/list/utils/list-widget-methods.js +138 -95
- package/components/data/live-filter/index.js +26 -15
- package/components/data/live-form/index.js +23 -7
- package/components/data/live-form/props.js +1 -1
- package/components/data/pagination/components/BasicPagination.js +71 -16
- package/components/data/pagination/components/PageSizeSelector.js +8 -3
- package/components/data/pagination/components/TotalRecords.js +1 -5
- package/components/data/pagination/hooks/usePagination.js +349 -66
- package/components/data/pagination/index.js +137 -19
- package/components/data/table/components/AddNewRow.js +5 -1
- package/components/data/table/components/EditableCell.js +2 -2
- package/components/data/table/components/RowCells.js +64 -0
- package/components/data/table/components/RowExpansionButton.js +2 -2
- package/components/data/table/components/SummaryCell.js +111 -0
- package/components/data/table/components/SummaryRow.js +54 -0
- package/components/data/table/components/SummaryRowFooter.js +46 -0
- package/components/data/table/components/TableBody.js +61 -59
- package/components/data/table/components/TableDataRow.js +109 -0
- package/components/data/table/components/TableFilters.js +225 -121
- package/components/data/table/components/TableHeader.js +291 -23
- package/components/data/table/components/TablePanelHeading.js +139 -8
- package/components/data/table/components/index.js +22 -1
- package/components/data/table/hooks/use-edited-rows.js +141 -0
- package/components/data/table/hooks/useCellState.js +5 -12
- package/components/data/table/hooks/useFormWidget.js +58 -51
- package/components/data/table/hooks/usePaginationState.js +45 -24
- package/components/data/table/hooks/usePanelStructure.js +4 -4
- package/components/data/table/hooks/useRowHandlers.js +39 -5
- package/components/data/table/hooks/useRowSelection.js +244 -50
- package/components/data/table/hooks/useServerSideSorting.js +81 -37
- package/components/data/table/hooks/useTableColumns.js +211 -118
- package/components/data/table/hooks/useTableData.js +54 -9
- package/components/data/table/hooks/useTableEdit.js +272 -97
- package/components/data/table/hooks/useTableEffects.js +31 -13
- package/components/data/table/hooks/useTableFilter.js +1 -1
- package/components/data/table/hooks/useTableInitialization.js +23 -22
- package/components/data/table/hooks/useTableState.js +11 -5
- package/components/data/table/hooks/useTableStateManager.js +140 -65
- package/components/data/table/index.js +637 -274
- package/components/data/table/live-table/index.js +54 -22
- package/components/data/table/table-action/index.js +1 -1
- package/components/data/table/table-group/index.js +26 -0
- package/components/data/table/table-row-action/index.js +32 -18
- package/components/data/table/utils/buildSelectionColumns.js +12 -21
- package/components/data/table/utils/columnBuilder.js +29 -14
- package/components/data/table/utils/columnProxy.js +68 -1
- package/components/data/table/utils/constants.js +6 -2
- package/components/data/table/utils/crud-handlers.js +68 -63
- package/components/data/table/utils/groupHeaderUtils.js +102 -0
- package/components/data/table/utils/index.js +210 -21
- package/components/data/table/utils/renderDisplayCell.js +6 -6
- package/components/data/table/utils/selectionUtils.js +25 -26
- package/components/data/table/utils/validation.js +1 -0
- package/components/data/utils/filter-field-util.js +3 -3
- package/components/dialogs/alert-dialog/index.js +1 -1
- package/components/dialogs/confirm-dialog/index.js +1 -1
- package/components/dialogs/dialog/index.js +4 -1
- package/components/dialogs/dialog-content/index.js +3 -1
- package/components/dialogs/dialog-header/index.js +2 -2
- package/components/dialogs/iframe-dialog/index.js +11 -5
- package/components/dialogs/index.js +1 -1
- package/components/dialogs/login-dialog/index.js +1 -1
- package/components/dialogs/page-dialog/index.js +1 -1
- package/components/form/button/index.js +33 -7
- package/components/input/calendar/index.js +18 -6
- package/components/input/chips/index.js +99 -28
- package/components/input/chips/utils.js +34 -4
- package/components/input/color-picker/index.js +74 -25
- package/components/input/composite/index.js +3 -3
- package/components/input/currency/index.js +35 -49
- package/components/input/default/checkbox/index.js +23 -28
- package/components/input/default/checkboxset/index.js +38 -18
- package/components/input/default/checkboxset/utils.js +30 -0
- package/components/input/default/radioset/index.js +36 -39
- package/components/input/default/switch/index.js +30 -13
- package/components/input/epoch/date/index.js +130 -69
- package/components/input/epoch/date/utils.js +94 -1
- package/components/input/epoch/datetime/index.js +72 -22
- package/components/input/epoch/datetime/utils.js +49 -10
- package/components/input/epoch/time/index.js +68 -19
- package/components/input/epoch/time/utils.js +62 -14
- package/components/input/fileupload/Utils.js +12 -7
- package/components/input/fileupload/components/MultiUpload.js +2 -6
- package/components/input/fileupload/components/SingleUpload.js +3 -7
- package/components/input/fileupload/index.js +6 -10
- package/components/input/fileupload/useFileUpload.js +16 -5
- package/components/input/number/index.js +158 -43
- package/components/input/rating/index.js +90 -7
- package/components/input/select/index.js +147 -70
- package/components/input/slider/index.js +84 -26
- package/components/input/text/index.js +38 -18
- package/components/input/text/util.js +283 -130
- package/components/input/textarea/index.js +13 -10
- package/components/input/upload/index.js +124 -0
- package/components/input/upload/props.js +5 -0
- package/components/input/util/index.js +11 -0
- package/components/navbar/index.js +51 -3
- package/components/navbar/nav/index.js +46 -16
- package/components/navbar/nav-item/index.js +11 -5
- package/components/navigation/menu/components/ListItems.js +3 -0
- package/components/navigation/menu/constants.js +2 -1
- package/components/navigation/menu/hooks/useHoverState.hook.js +48 -0
- package/components/navigation/menu/hooks/useKeyboardMovements.hook.js +37 -0
- package/components/navigation/menu/hooks/useTransformedDataset.hook.js +15 -0
- package/components/navigation/menu/index.js +326 -188
- package/components/navigation/menu/utils/action-task.js +14 -0
- package/components/navigation/menu/utils/role-filter.js +76 -0
- package/components/navigation/popover/index.js +99 -26
- package/components/page/partial-container/index.js +34 -5
- package/components/prefab/index.js +2 -4
- package/context/PrefabContext.js +10 -6
- package/context/WidgetProvider.js +30 -31
- package/core/app.service.js +1 -1
- package/core/constants/events.js +57 -1
- package/core/dialog.service.js +1 -2
- package/core/event-notifier.js +1 -2
- package/core/formatter/array-formatters.js +33 -0
- package/core/formatter/date-formatters.js +2 -4
- package/core/formatter/index.js +2 -1
- package/core/formatter/number-formatters.js +5 -10
- package/core/formatter/security-formatters.js +2 -4
- package/core/formatter/string-formatters.js +3 -6
- package/core/proxy-service.js +84 -13
- package/core/script-registry.js +108 -48
- package/core/util/common.js +4 -4
- package/core/util/compare.js +30 -0
- package/core/util/dom.js +8 -8
- package/core/util/index.js +16 -6
- package/core/util/safe-is-equal.js +156 -0
- package/core/util/security.js +1 -2
- package/core/util/utils.js +16 -7
- package/higherOrder/BaseApp.js +108 -65
- package/higherOrder/BaseDateTime.js +31 -13
- package/higherOrder/BasePage.js +268 -144
- package/higherOrder/BasePartial.js +1 -1
- package/higherOrder/BasePrefab.js +33 -15
- package/higherOrder/DataNav.js +99 -16
- package/higherOrder/helper.js +5 -0
- package/higherOrder/withBaseWrapper.js +41 -28
- package/hooks/useAuth.js +11 -5
- package/hooks/useHttp.js +280 -94
- package/mui-config/theme-provider.js +1 -1
- package/mui-config/theme.js +1 -1
- package/package-lock.json +824 -724
- package/package.json +8 -8
- package/store/bindActions/i18nActions.js +18 -0
- package/store/index.js +3 -1
- package/store/slices/appConfigSlice.js +2 -2
- package/store/slices/authSlice.js +31 -28
- package/store/slices/i18nSlice.js +2 -2
- package/store/slices/navigationSlice.js +35 -0
- package/store/viewport.service.js +255 -0
- package/utils/attr.js +35 -0
- package/utils/dataset-util.js +1 -2
- package/utils/form-state.util.js +43 -12
- package/utils/form-utils.js +47 -2
- package/utils/format-util.js +28 -13
- package/utils/page-params-util.js +33 -1
- package/utils/state-persistance.js +72 -13
- package/utils/transformedDataset-utils.js +35 -24
- package/variables/base-variable.js +12 -14
- package/variables/crud-variable.js +225 -0
- package/variables/live-variable.js +56 -20
- package/variables/metadata.service.js +123 -0
- package/variables/model-variable.js +21 -15
- package/variables/service-variable.js +88 -83
package/higherOrder/BasePage.js
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
"use client";
|
|
2
3
|
|
|
3
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
5
|
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
5
6
|
Object.defineProperty(exports, "__esModule", {
|
|
6
7
|
value: true
|
|
7
8
|
});
|
|
8
|
-
exports.withPageContext = exports["default"] = void 0;
|
|
9
|
+
exports.withPageContext = exports.usePageReady = exports["default"] = void 0;
|
|
9
10
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
10
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
11
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
12
12
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
15
|
var _react = _interopRequireWildcard(require("react"));
|
|
15
16
|
var _navigation = require("next/navigation");
|
|
16
17
|
var _isEqual = _interopRequireDefault(require("lodash-es/isEqual"));
|
|
17
18
|
var _cloneDeep = _interopRequireDefault(require("lodash-es/cloneDeep"));
|
|
18
19
|
var _merge = _interopRequireDefault(require("lodash-es/merge"));
|
|
20
|
+
var _compare = _interopRequireDefault(require("../core/util/compare"));
|
|
19
21
|
var _WidgetProvider = require("@wavemaker/react-runtime/context/WidgetProvider");
|
|
20
22
|
var _spinner = require("@wavemaker/react-runtime/components/basic/spinner");
|
|
21
23
|
var _appVariablesStore = require("@wavemaker/react-runtime/core/appVariablesStore");
|
|
@@ -23,28 +25,65 @@ var _store = require("@wavemaker/react-runtime/store");
|
|
|
23
25
|
var _AppContext = require("@wavemaker/react-runtime/context/AppContext");
|
|
24
26
|
var _useAccess2 = _interopRequireDefault(require("@wavemaker/react-runtime/hooks/useAccess"));
|
|
25
27
|
var _authSlice = require("@wavemaker/react-runtime/store/slices/authSlice");
|
|
28
|
+
var _navigationSlice = require("@wavemaker/react-runtime/store/slices/navigationSlice");
|
|
26
29
|
var _types = require("@wavemaker/react-runtime/types");
|
|
27
30
|
var _proxyService = require("@wavemaker/react-runtime/core/proxy-service");
|
|
28
|
-
var _navigationMiddleware = require("@wavemaker/react-runtime/store/middleware/navigationMiddleware");
|
|
29
31
|
var _helper = require("@wavemaker/react-runtime/higherOrder/helper");
|
|
30
32
|
var _toast = require("@wavemaker/react-runtime/actions/toast.service");
|
|
31
33
|
var _appstore = _interopRequireDefault(require("@wavemaker/react-runtime/core/appstore"));
|
|
32
34
|
var _scriptRegistry = require("@wavemaker/react-runtime/core/script-registry");
|
|
33
35
|
var _formatters = _interopRequireDefault(require("../core/formatters"));
|
|
34
36
|
var _AppContext2 = require("../context/AppContext");
|
|
35
|
-
var _widgetCleanupUtil = require("../utils/widget-cleanup-util");
|
|
36
37
|
var _pageParamsUtil = require("../utils/page-params-util");
|
|
37
|
-
var _constants = require("../core/constants");
|
|
38
38
|
var _AppSpinnerProvider = require("../context/AppSpinnerProvider");
|
|
39
|
-
var
|
|
39
|
+
var _get = _interopRequireDefault(require("lodash/get"));
|
|
40
40
|
var _events = require("../core/constants/events");
|
|
41
41
|
var _libErrorSkipper = require("../utils/lib-error-skipper");
|
|
42
|
+
var _viewport = require("../store/viewport.service");
|
|
43
|
+
var _util = require("../core/util");
|
|
42
44
|
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" != _typeof3(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); }
|
|
43
45
|
var __jsx = _react["default"].createElement;
|
|
44
46
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
45
47
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Module-level Maps for page ready signaling.
|
|
50
|
+
* Each component is tracked by its componentName, preventing conflicts between
|
|
51
|
+
* pages, partials, and prefabs.
|
|
52
|
+
*/
|
|
53
|
+
var pageReadyCallbacks = new Map();
|
|
54
|
+
var pageReadySignalled = new Set();
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Hook to signal that a page component has rendered and is ready.
|
|
58
|
+
* Call this at the top of your page component to trigger startup operations.
|
|
59
|
+
*
|
|
60
|
+
* This ensures widgets have mounted and subscribed before variables are invoked.
|
|
61
|
+
*
|
|
62
|
+
* @param componentName - The unique name of the component (e.g., "ChooseAPlansGrid")
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* import { usePageReady } from '@wavemaker/react-runtime/higherOrder/BasePage';
|
|
66
|
+
*
|
|
67
|
+
* const ChooseAPlansGridComponent = () => {
|
|
68
|
+
* usePageReady("ChooseAPlansGrid"); // Signal ready on mount
|
|
69
|
+
* return <WmPage>...</WmPage>;
|
|
70
|
+
* };
|
|
71
|
+
*/
|
|
72
|
+
var usePageReady = exports.usePageReady = function usePageReady(componentName) {
|
|
73
|
+
var signalledRef = (0, _react.useRef)(false);
|
|
74
|
+
(0, _react.useEffect)(function () {
|
|
75
|
+
if (!componentName || signalledRef.current) return;
|
|
76
|
+
signalledRef.current = true;
|
|
77
|
+
pageReadySignalled.add(componentName);
|
|
78
|
+
|
|
79
|
+
// Call callback if already registered (parent effect ran first)
|
|
80
|
+
var callback = pageReadyCallbacks.get(componentName);
|
|
81
|
+
if (callback) {
|
|
82
|
+
callback();
|
|
83
|
+
}
|
|
84
|
+
// Otherwise, the parent's effect will check pageReadySignalled and call handlePageReady
|
|
85
|
+
}, [componentName]);
|
|
86
|
+
};
|
|
48
87
|
var withPageContext = exports.withPageContext = function withPageContext(WrappedComponent, addPageScript, getVariables, componentInfo, prefabInfo) {
|
|
49
88
|
var PageContextComponent = function PageContextComponent(props) {
|
|
50
89
|
var _info$appConfig;
|
|
@@ -90,6 +129,9 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
|
|
|
90
129
|
var appConfig = (0, _store.useAppSelector)(function (state) {
|
|
91
130
|
return state.info.appConfig;
|
|
92
131
|
});
|
|
132
|
+
var pendingAccordionExpansion = (0, _store.useAppSelector)(function (state) {
|
|
133
|
+
return state.navigation.pendingAccordionExpansion;
|
|
134
|
+
});
|
|
93
135
|
|
|
94
136
|
// Initialization state management
|
|
95
137
|
var _useState = (0, _react.useState)(false),
|
|
@@ -104,11 +146,9 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
|
|
|
104
146
|
var pageProxyRef = (0, _react.useRef)(null);
|
|
105
147
|
var isInitializingRef = (0, _react.useRef)(false);
|
|
106
148
|
var isMountedRef = (0, _react.useRef)(true);
|
|
107
|
-
var usedFallbackAppVarsRef = (0, _react.useRef)(false);
|
|
108
149
|
var appVarSubscriptionsDoneRef = (0, _react.useRef)(false);
|
|
109
150
|
var subscribedVariableNamesRef = (0, _react.useRef)(new Set());
|
|
110
|
-
var
|
|
111
|
-
var isContentReadyRef = (0, _react.useRef)(false);
|
|
151
|
+
var overriddenPropsRegistryRef = (0, _react.useRef)(null);
|
|
112
152
|
|
|
113
153
|
// Initial page context state
|
|
114
154
|
var _useState2 = (0, _react.useState)(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
@@ -117,20 +157,22 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
|
|
|
117
157
|
Actions: {},
|
|
118
158
|
onReady: function onReady() {},
|
|
119
159
|
serviceDefinitions: (0, _cloneDeep["default"])((prefabInfo === null || prefabInfo === void 0 ? void 0 : prefabInfo.serviceDefs) || (appContext === null || appContext === void 0 ? void 0 : appContext.serviceDefinitions) || {}),
|
|
120
|
-
pageParams: {},
|
|
160
|
+
pageParams: props.pageParams || {},
|
|
121
161
|
baseUrl: (prefabInfo === null || prefabInfo === void 0 ? void 0 : prefabInfo.baseUrl) || (info === null || info === void 0 || (_info$appConfig = info.appConfig) === null || _info$appConfig === void 0 ? void 0 : _info$appConfig.url) || "",
|
|
122
162
|
appConfig: appContext === null || appContext === void 0 ? void 0 : appContext.appConfig,
|
|
123
163
|
notification: {},
|
|
124
164
|
toaster: _toast.toastService,
|
|
125
165
|
onContentReady: onContentReady,
|
|
126
166
|
onChange: updateWidgetState,
|
|
127
|
-
cleanup: cleanup,
|
|
128
167
|
App: {},
|
|
129
168
|
eval: appContext === null || appContext === void 0 ? void 0 : appContext.eval,
|
|
130
169
|
appLocale: componentInfo.appLocale || i18n.appLocale || {}
|
|
131
170
|
}, prefabInfo), props), componentInfo), {}, {
|
|
132
171
|
executeStartup: executeStartup,
|
|
133
|
-
formatters: _formatters["default"]
|
|
172
|
+
formatters: _formatters["default"],
|
|
173
|
+
Viewport: _viewport.viewportService.getViewport(),
|
|
174
|
+
formatMessage: _util.formatMessage,
|
|
175
|
+
overriddenPropsRegistryRef: overriddenPropsRegistryRef.current
|
|
134
176
|
})),
|
|
135
177
|
pageContext = _useState2[0],
|
|
136
178
|
setPageContext = _useState2[1];
|
|
@@ -139,6 +181,32 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
|
|
|
139
181
|
return appContext;
|
|
140
182
|
}, [appContext]);
|
|
141
183
|
|
|
184
|
+
// Compute a stable key from partial param values for dependency tracking
|
|
185
|
+
var partialParamValuesKey = (0, _pageParamsUtil.computePartialParamKey)(componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentType, props.params, props);
|
|
186
|
+
|
|
187
|
+
// Subscribe for partial params changes - sync prop values to pageParams
|
|
188
|
+
(0, _react.useEffect)(function () {
|
|
189
|
+
if ((componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentType) !== "PARTIAL" || !pageProxyRef.current) {
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
var paramValues = (0, _pageParamsUtil.extractPartialParamValues)(props.params || [], props);
|
|
193
|
+
|
|
194
|
+
// Update pageParams for each param key when prop values change
|
|
195
|
+
Object.entries(paramValues).forEach(function (_ref) {
|
|
196
|
+
var _pageProxyRef$current;
|
|
197
|
+
var _ref2 = (0, _slicedToArray2["default"])(_ref, 2),
|
|
198
|
+
key = _ref2[0],
|
|
199
|
+
newValue = _ref2[1];
|
|
200
|
+
if (!(0, _isEqual["default"])((_pageProxyRef$current = pageProxyRef.current.pageParams) === null || _pageProxyRef$current === void 0 ? void 0 : _pageProxyRef$current[key], newValue)) {
|
|
201
|
+
if (!pageProxyRef.current.pageParams) {
|
|
202
|
+
pageProxyRef.current.pageParams = {};
|
|
203
|
+
}
|
|
204
|
+
pageProxyRef.current.pageParams[key] = newValue;
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
208
|
+
}, [partialParamValuesKey]);
|
|
209
|
+
|
|
142
210
|
// Handle redirect to login if authentication is required
|
|
143
211
|
(0, _react.useEffect)(function () {
|
|
144
212
|
var _appConfig$pages;
|
|
@@ -163,32 +231,6 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
|
|
|
163
231
|
}
|
|
164
232
|
}, [accessLoading, isSecurityEnabled, isAuthenticated, appConfig, componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentType, componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentName, dispatch, securityConfig]);
|
|
165
233
|
|
|
166
|
-
// Handle redirect from login page to landing page if already authenticated
|
|
167
|
-
(0, _react.useEffect)(function () {
|
|
168
|
-
var _securityConfig$login;
|
|
169
|
-
if ((componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentType) !== "PAGE" || !isSecurityEnabled || !isAuthenticated || accessLoading) {
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
var loginPage = securityConfig === null || securityConfig === void 0 || (_securityConfig$login = securityConfig.loginConfig) === null || _securityConfig$login === void 0 ? void 0 : _securityConfig$login.pageName;
|
|
173
|
-
var landingPage = loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.landingPage;
|
|
174
|
-
if (!loginPage || !landingPage) {
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
// Extract the last segment of the pathname (the page name)
|
|
179
|
-
var currentPageName = componentInfo.componentName;
|
|
180
|
-
var isOnLoginPage = currentPageName === loginPage;
|
|
181
|
-
|
|
182
|
-
// If authenticated user is on login page, redirect to landing page
|
|
183
|
-
if (isOnLoginPage) {
|
|
184
|
-
var router = (0, _navigationMiddleware.getRouterInstance)();
|
|
185
|
-
if (router) {
|
|
186
|
-
console.log("BasePage: Redirecting authenticated user from login to landing page", landingPage);
|
|
187
|
-
router.push("/".concat(_constants.ROUTING_BASEPATH, "/").concat(landingPage));
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}, [componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentType, isSecurityEnabled, isAuthenticated, accessLoading, securityConfig, loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.landingPage]);
|
|
191
|
-
|
|
192
234
|
// Check if we should proceed with initialization
|
|
193
235
|
var shouldInitialize = (0, _react.useMemo)(function () {
|
|
194
236
|
// Wait for app to be ready (if app context exists)
|
|
@@ -235,7 +277,7 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
|
|
|
235
277
|
Actions: updatedActions
|
|
236
278
|
});
|
|
237
279
|
});
|
|
238
|
-
}, [appContext === null || appContext === void 0 ? void 0 : appContext.isAppReady]);
|
|
280
|
+
}, [appContext === null || appContext === void 0 ? void 0 : appContext.isAppReady, appContext === null || appContext === void 0 ? void 0 : appContext.Variables, appContext === null || appContext === void 0 ? void 0 : appContext.Actions]);
|
|
239
281
|
|
|
240
282
|
// Main initialization effect - runs only when conditions are met
|
|
241
283
|
(0, _react.useEffect)(function () {
|
|
@@ -247,25 +289,18 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
|
|
|
247
289
|
// Set initialization flag
|
|
248
290
|
isInitializingRef.current = true;
|
|
249
291
|
var initializeComponent = /*#__PURE__*/function () {
|
|
250
|
-
var
|
|
292
|
+
var _ref3 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
251
293
|
var pageProxy, pageVariables, appVariables, APP_VARIABLES, _mergeVariablesAndAct, Variables, Actions, urlParams, newParams, pageName;
|
|
252
294
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
253
295
|
while (1) switch (_context.prev = _context.next) {
|
|
254
296
|
case 0:
|
|
255
297
|
try {
|
|
298
|
+
// Create overridden props registry
|
|
299
|
+
overriddenPropsRegistryRef.current = (0, _scriptRegistry.createOverriddenPropsRegistry)();
|
|
256
300
|
// Create page proxy
|
|
257
|
-
pageProxy = (0, _proxyService.createStateProxy)(pageContext, [], setPageContext);
|
|
301
|
+
pageProxy = (0, _proxyService.createStateProxy)(pageContext, [], setPageContext, overriddenPropsRegistryRef.current);
|
|
258
302
|
pageProxyRef.current = pageProxy;
|
|
259
303
|
|
|
260
|
-
// Initialize cleanup utility
|
|
261
|
-
if (!cleanupUtilRef.current) {
|
|
262
|
-
cleanupUtilRef.current = (0, _widgetCleanupUtil.createWidgetCleanup)({
|
|
263
|
-
setPageContext: setPageContext,
|
|
264
|
-
proxyRef: pageProxyRef,
|
|
265
|
-
debounceDelay: 100
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
|
-
|
|
269
304
|
// Initialize variables and actions
|
|
270
305
|
pageVariables = getVariables(pageProxy); // Handle app variables based on app context availability
|
|
271
306
|
appVariables = {
|
|
@@ -278,7 +313,6 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
|
|
|
278
313
|
Variables: appContext.Variables || {},
|
|
279
314
|
Actions: appContext.Actions || {}
|
|
280
315
|
};
|
|
281
|
-
usedFallbackAppVarsRef.current = false;
|
|
282
316
|
} else {
|
|
283
317
|
// Fallback to traditional app variable initialization
|
|
284
318
|
// @ts-ignore
|
|
@@ -287,7 +321,6 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
|
|
|
287
321
|
Variables: {},
|
|
288
322
|
Actions: {}
|
|
289
323
|
};
|
|
290
|
-
usedFallbackAppVarsRef.current = true;
|
|
291
324
|
}
|
|
292
325
|
_mergeVariablesAndAct = (0, _helper.mergeVariablesAndActions)(pageVariables, appVariables), Variables = _mergeVariablesAndAct.Variables, Actions = _mergeVariablesAndAct.Actions; // Compute page params from URL and include partial params when applicable
|
|
293
326
|
urlParams = Object.fromEntries(pageParams.entries());
|
|
@@ -302,8 +335,8 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
|
|
|
302
335
|
pageProxy.Actions = Actions;
|
|
303
336
|
pageProxy.pageParams = _objectSpread({}, newParams);
|
|
304
337
|
pageProxy.App = _objectSpread(_objectSpread({}, appProxy), initialAppConfig);
|
|
305
|
-
pageProxy.pageParams = _objectSpread({}, newParams);
|
|
306
338
|
pageProxy.selectedLocale = i18n.selectedLocale || "en";
|
|
339
|
+
pageProxy.overriddenPropsRegistry = overriddenPropsRegistryRef.current;
|
|
307
340
|
|
|
308
341
|
// Setup variable event handlers
|
|
309
342
|
setupVariableSubscriptions(pageVariables.Variables);
|
|
@@ -311,6 +344,8 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
|
|
|
311
344
|
pageName = componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentName;
|
|
312
345
|
appProxy.updateActivePage(pageName);
|
|
313
346
|
appProxy.activePage = pageProxy;
|
|
347
|
+
} else if ((componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentName) === "Common" && (componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentType) === "PARTIAL" && appProxy) {
|
|
348
|
+
appProxy.Widgets = pageProxy === null || pageProxy === void 0 ? void 0 : pageProxy.Widgets;
|
|
314
349
|
}
|
|
315
350
|
|
|
316
351
|
// Initialize page script
|
|
@@ -342,21 +377,21 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
|
|
|
342
377
|
}, _callee);
|
|
343
378
|
}));
|
|
344
379
|
return function initializeComponent() {
|
|
345
|
-
return
|
|
380
|
+
return _ref3.apply(this, arguments);
|
|
346
381
|
};
|
|
347
382
|
}();
|
|
348
383
|
initializeComponent();
|
|
349
384
|
|
|
350
385
|
// Cleanup function
|
|
351
386
|
return function () {
|
|
352
|
-
var
|
|
387
|
+
var _overriddenPropsRegis;
|
|
353
388
|
// Cancel all pending page operations
|
|
354
389
|
if (pageProxyRef.current) {
|
|
355
|
-
var
|
|
356
|
-
|
|
357
|
-
Variables =
|
|
358
|
-
|
|
359
|
-
Actions =
|
|
390
|
+
var _ref4 = getVariables(pageProxyRef.current) || {},
|
|
391
|
+
_ref4$Variables = _ref4.Variables,
|
|
392
|
+
Variables = _ref4$Variables === void 0 ? {} : _ref4$Variables,
|
|
393
|
+
_ref4$Actions = _ref4.Actions,
|
|
394
|
+
Actions = _ref4$Actions === void 0 ? {} : _ref4$Actions;
|
|
360
395
|
|
|
361
396
|
// Cancel page variables
|
|
362
397
|
Object.values(Variables).forEach(function (variable) {
|
|
@@ -383,13 +418,14 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
|
|
|
383
418
|
|
|
384
419
|
// Clear pending startup operations
|
|
385
420
|
pendingStartupOpsRef.current.clear();
|
|
386
|
-
(0
|
|
421
|
+
(_overriddenPropsRegis = overriddenPropsRegistryRef.current) === null || _overriddenPropsRegis === void 0 || _overriddenPropsRegis.clear();
|
|
422
|
+
// clearOverriddenProps();
|
|
387
423
|
|
|
388
424
|
// Unsubscribe from events
|
|
389
|
-
subscriptionsRef.current.forEach(function (
|
|
390
|
-
var variable =
|
|
391
|
-
event =
|
|
392
|
-
handler =
|
|
425
|
+
subscriptionsRef.current.forEach(function (_ref5) {
|
|
426
|
+
var variable = _ref5.variable,
|
|
427
|
+
event = _ref5.event,
|
|
428
|
+
handler = _ref5.handler;
|
|
393
429
|
if (variable !== null && variable !== void 0 && variable.unsubscribe) {
|
|
394
430
|
try {
|
|
395
431
|
variable.unsubscribe(event, handler);
|
|
@@ -399,23 +435,22 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
|
|
|
399
435
|
}
|
|
400
436
|
});
|
|
401
437
|
subscriptionsRef.current = [];
|
|
402
|
-
|
|
403
|
-
// Cancel any pending cleanup operations
|
|
404
|
-
(_cleanupUtilRef$curre = cleanupUtilRef.current) === null || _cleanupUtilRef$curre === void 0 || _cleanupUtilRef$curre.cancel();
|
|
405
438
|
};
|
|
406
439
|
}, [shouldInitialize]); // Only depend on shouldInitialize
|
|
407
440
|
|
|
408
|
-
//
|
|
441
|
+
// Subscribe to app-level variables when app becomes ready
|
|
442
|
+
// This MUST happen before executeStartAppOperations() is called (via executeStartup)
|
|
443
|
+
// so that widgets can receive loading state updates when app variables are invoked
|
|
409
444
|
(0, _react.useEffect)(function () {
|
|
410
|
-
if (!(appContext !== null && appContext !== void 0 && appContext.isAppReady) || !pageProxyRef.current ||
|
|
445
|
+
if (!(appContext !== null && appContext !== void 0 && appContext.isAppReady) || !pageProxyRef.current || appVarSubscriptionsDoneRef.current) {
|
|
411
446
|
return;
|
|
412
447
|
}
|
|
413
448
|
try {
|
|
414
|
-
var
|
|
449
|
+
var _ref6 = getVariables(pageProxyRef.current) || {
|
|
415
450
|
Variables: {}
|
|
416
451
|
},
|
|
417
|
-
|
|
418
|
-
pageVars =
|
|
452
|
+
_ref6$Variables = _ref6.Variables,
|
|
453
|
+
pageVars = _ref6$Variables === void 0 ? {} : _ref6$Variables;
|
|
419
454
|
var pageVarNames = new Set(Object.keys(pageVars || {}));
|
|
420
455
|
subscribeAppVariablesIfNeeded(appContext.Variables || {}, pageVarNames);
|
|
421
456
|
appVarSubscriptionsDoneRef.current = true;
|
|
@@ -459,9 +494,9 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
|
|
|
459
494
|
var updateState = variable;
|
|
460
495
|
updateState.loading = event === _types.VariableEvents.BEFORE_INVOKE;
|
|
461
496
|
updateState.error = event === _types.VariableEvents.ERROR ? variable : null;
|
|
462
|
-
if ((0,
|
|
497
|
+
if ((0, _get["default"])(variable, "spinnerContext") === "page") {
|
|
463
498
|
if (updateState.loading) {
|
|
464
|
-
var message = (0,
|
|
499
|
+
var message = (0, _get["default"])(variable, "spinnerMessage");
|
|
465
500
|
show(message);
|
|
466
501
|
} else {
|
|
467
502
|
hide();
|
|
@@ -478,10 +513,10 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
|
|
|
478
513
|
};
|
|
479
514
|
|
|
480
515
|
// Set up subscriptions (avoid duplicates by name)
|
|
481
|
-
Object.entries(variables).forEach(function (
|
|
482
|
-
var
|
|
483
|
-
name =
|
|
484
|
-
variable =
|
|
516
|
+
Object.entries(variables).forEach(function (_ref7) {
|
|
517
|
+
var _ref8 = (0, _slicedToArray2["default"])(_ref7, 2),
|
|
518
|
+
name = _ref8[0],
|
|
519
|
+
variable = _ref8[1];
|
|
485
520
|
if (subscribedVariableNamesRef.current.has(name)) {
|
|
486
521
|
return;
|
|
487
522
|
}
|
|
@@ -505,10 +540,10 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
|
|
|
505
540
|
// Subscribe to app-level variables that are not shadowed by page variables
|
|
506
541
|
var subscribeAppVariablesIfNeeded = function subscribeAppVariablesIfNeeded(appVars, pageVarNames) {
|
|
507
542
|
var appVarsOnly = {};
|
|
508
|
-
Object.entries(appVars || {}).forEach(function (
|
|
509
|
-
var
|
|
510
|
-
name =
|
|
511
|
-
variable =
|
|
543
|
+
Object.entries(appVars || {}).forEach(function (_ref9) {
|
|
544
|
+
var _ref0 = (0, _slicedToArray2["default"])(_ref9, 2),
|
|
545
|
+
name = _ref0[0],
|
|
546
|
+
variable = _ref0[1];
|
|
512
547
|
if (!pageVarNames.has(name) && !subscribedVariableNamesRef.current.has(name)) {
|
|
513
548
|
appVarsOnly[name] = variable;
|
|
514
549
|
}
|
|
@@ -520,12 +555,12 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
|
|
|
520
555
|
|
|
521
556
|
// Execute startup operations
|
|
522
557
|
var executeStartupOperations = /*#__PURE__*/function () {
|
|
523
|
-
var
|
|
524
|
-
var
|
|
558
|
+
var _ref1 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(Variables, Actions) {
|
|
559
|
+
var _ref10, _ref10$startUpActions, startUpActions, _ref10$startUpVariabl, startUpVariables, variablePromises;
|
|
525
560
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
526
561
|
while (1) switch (_context2.prev = _context2.next) {
|
|
527
562
|
case 0:
|
|
528
|
-
|
|
563
|
+
_ref10 = componentInfo || {}, _ref10$startUpActions = _ref10.startUpActions, startUpActions = _ref10$startUpActions === void 0 ? [] : _ref10$startUpActions, _ref10$startUpVariabl = _ref10.startUpVariables, startUpVariables = _ref10$startUpVariabl === void 0 ? [] : _ref10$startUpVariabl; // Track startup operations
|
|
529
564
|
startUpVariables.forEach(function (name) {
|
|
530
565
|
return pendingStartupOpsRef.current.add(name);
|
|
531
566
|
});
|
|
@@ -566,75 +601,115 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
|
|
|
566
601
|
case 10:
|
|
567
602
|
startUpVariableLoadedRef.current = true;
|
|
568
603
|
pendingStartupOpsRef.current.clear();
|
|
569
|
-
|
|
604
|
+
setTimeout(function () {
|
|
605
|
+
if ((componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentType) === "PAGE") {
|
|
606
|
+
appContext === null || appContext === void 0 || appContext.notify("page-variables-data-loaded", {
|
|
607
|
+
pageName: componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentName
|
|
608
|
+
});
|
|
609
|
+
}
|
|
610
|
+
}, 0);
|
|
611
|
+
_context2.next = 18;
|
|
570
612
|
break;
|
|
571
|
-
case
|
|
572
|
-
_context2.prev =
|
|
613
|
+
case 15:
|
|
614
|
+
_context2.prev = 15;
|
|
573
615
|
_context2.t0 = _context2["catch"](5);
|
|
574
616
|
console.error("Error during startup operations:", _context2.t0);
|
|
575
|
-
case
|
|
617
|
+
case 18:
|
|
576
618
|
case "end":
|
|
577
619
|
return _context2.stop();
|
|
578
620
|
}
|
|
579
|
-
}, _callee2, null, [[5,
|
|
621
|
+
}, _callee2, null, [[5, 15]]);
|
|
580
622
|
}));
|
|
581
623
|
return function executeStartupOperations(_x, _x2) {
|
|
582
|
-
return
|
|
624
|
+
return _ref1.apply(this, arguments);
|
|
583
625
|
};
|
|
584
626
|
}();
|
|
585
627
|
|
|
586
|
-
// Cleanup function for unmounting widgets
|
|
587
|
-
function cleanup(name) {
|
|
588
|
-
var _cleanupUtilRef$curre2;
|
|
589
|
-
(_cleanupUtilRef$curre2 = cleanupUtilRef.current) === null || _cleanupUtilRef$curre2 === void 0 || _cleanupUtilRef$curre2.cleanup(name);
|
|
590
|
-
}
|
|
591
|
-
|
|
592
628
|
// Widget state update function
|
|
593
629
|
function updateWidgetState(widgetName, newProps) {
|
|
594
630
|
if (!widgetName || !newProps || Object.keys(newProps).length === 0) return;
|
|
595
|
-
if ((0,
|
|
631
|
+
if ((0, _compare["default"])(pageContext.Widgets[widgetName], newProps)) return;
|
|
596
632
|
setPageContext(function (prev) {
|
|
597
633
|
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
598
634
|
Widgets: _objectSpread(_objectSpread({}, prev.Widgets), {}, (0, _defineProperty2["default"])({}, widgetName, _objectSpread(_objectSpread({}, prev.Widgets[widgetName]), newProps)))
|
|
599
635
|
});
|
|
600
636
|
});
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
637
|
+
|
|
638
|
+
// Suspend tracking to prevent internal state updates from being tracked as script overrides
|
|
639
|
+
(0, _scriptRegistry.withSuspendedTracking)(overriddenPropsRegistryRef.current, function () {
|
|
640
|
+
Object.keys(newProps).forEach(function (key) {
|
|
641
|
+
var _pageContext$Widgets$;
|
|
642
|
+
if (!(0, _isEqual["default"])((_pageContext$Widgets$ = pageContext.Widgets[widgetName]) === null || _pageContext$Widgets$ === void 0 ? void 0 : _pageContext$Widgets$[key], newProps === null || newProps === void 0 ? void 0 : newProps[key]) && (newProps === null || newProps === void 0 ? void 0 : newProps[key]) !== undefined) {
|
|
643
|
+
pageProxyRef.current.Widgets[widgetName][key] = newProps[key];
|
|
644
|
+
}
|
|
645
|
+
});
|
|
606
646
|
});
|
|
607
647
|
}
|
|
608
648
|
|
|
609
649
|
// Content ready callback
|
|
610
650
|
function onContentReady() {
|
|
611
|
-
|
|
612
|
-
pageContext.onReady();
|
|
613
|
-
}
|
|
614
|
-
if (appContext !== null && appContext !== void 0 && appContext.onPageReady && pageContext.componentType === "PAGE") {
|
|
615
|
-
appContext.onPageReady(pageContext.componentName, pageProxyRef.current, undefined);
|
|
616
|
-
}
|
|
617
|
-
return Promise.resolve();
|
|
651
|
+
return _onContentReady.apply(this, arguments);
|
|
618
652
|
}
|
|
619
|
-
function
|
|
620
|
-
|
|
621
|
-
} // Update pageContext.appLocale when i18n.appLocale changes
|
|
622
|
-
function _executeStartup() {
|
|
623
|
-
_executeStartup = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee4() {
|
|
653
|
+
function _onContentReady() {
|
|
654
|
+
_onContentReady = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee4() {
|
|
624
655
|
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
625
656
|
while (1) switch (_context4.prev = _context4.next) {
|
|
626
657
|
case 0:
|
|
627
|
-
|
|
658
|
+
if (!pageContext.onReady) {
|
|
659
|
+
_context4.next = 3;
|
|
660
|
+
break;
|
|
661
|
+
}
|
|
628
662
|
_context4.next = 3;
|
|
629
|
-
return
|
|
663
|
+
return pageContext.onReady();
|
|
630
664
|
case 3:
|
|
665
|
+
if (appContext !== null && appContext !== void 0 && appContext.onPageReady && pageContext.componentType === "PAGE") {
|
|
666
|
+
appContext.onPageReady(pageContext.componentName, pageProxyRef.current, undefined);
|
|
667
|
+
}
|
|
668
|
+
return _context4.abrupt("return", Promise.resolve());
|
|
669
|
+
case 5:
|
|
631
670
|
case "end":
|
|
632
671
|
return _context4.stop();
|
|
633
672
|
}
|
|
634
673
|
}, _callee4);
|
|
635
674
|
}));
|
|
675
|
+
return _onContentReady.apply(this, arguments);
|
|
676
|
+
}
|
|
677
|
+
function executeStartup() {
|
|
678
|
+
return _executeStartup.apply(this, arguments);
|
|
679
|
+
}
|
|
680
|
+
function _executeStartup() {
|
|
681
|
+
_executeStartup = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee5() {
|
|
682
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
683
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
684
|
+
case 0:
|
|
685
|
+
_context5.next = 2;
|
|
686
|
+
return appContext === null || appContext === void 0 ? void 0 : appContext.executeStartAppOperations();
|
|
687
|
+
case 2:
|
|
688
|
+
case "end":
|
|
689
|
+
return _context5.stop();
|
|
690
|
+
}
|
|
691
|
+
}, _callee5);
|
|
692
|
+
}));
|
|
636
693
|
return _executeStartup.apply(this, arguments);
|
|
637
694
|
}
|
|
695
|
+
function executePageStartup() {
|
|
696
|
+
return _executePageStartup.apply(this, arguments);
|
|
697
|
+
} // Update pageContext.appLocale when i18n.appLocale changes
|
|
698
|
+
function _executePageStartup() {
|
|
699
|
+
_executePageStartup = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee6() {
|
|
700
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
701
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
702
|
+
case 0:
|
|
703
|
+
_context6.next = 2;
|
|
704
|
+
return executeStartupOperations(pageContext.Variables, pageContext.Actions);
|
|
705
|
+
case 2:
|
|
706
|
+
case "end":
|
|
707
|
+
return _context6.stop();
|
|
708
|
+
}
|
|
709
|
+
}, _callee6);
|
|
710
|
+
}));
|
|
711
|
+
return _executePageStartup.apply(this, arguments);
|
|
712
|
+
}
|
|
638
713
|
(0, _react.useEffect)(function () {
|
|
639
714
|
var newAppLocale = (0, _merge["default"])({}, i18n.appLocale || {}, (prefabInfo === null || prefabInfo === void 0 ? void 0 : prefabInfo.appLocale) || {});
|
|
640
715
|
if (!(0, _isEqual["default"])(pageContext.appLocale, newAppLocale)) {
|
|
@@ -643,49 +718,98 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
|
|
|
643
718
|
appLocale: newAppLocale
|
|
644
719
|
});
|
|
645
720
|
});
|
|
646
|
-
|
|
721
|
+
pageProxyRef.current.App.appLocale = newAppLocale;
|
|
647
722
|
}
|
|
648
723
|
}, [i18n.appLocale]);
|
|
649
|
-
var onContentReadyCalledRef = (0, _react.useRef)(false);
|
|
650
724
|
var onStartupCompletedRef = (0, _react.useRef)(false);
|
|
651
|
-
|
|
725
|
+
var _useState3 = (0, _react.useState)(false),
|
|
726
|
+
isPageReady = _useState3[0],
|
|
727
|
+
setIsPageReady = _useState3[1];
|
|
728
|
+
|
|
729
|
+
// Callback for when page component signals it's ready
|
|
730
|
+
// This is called by usePageReady() hook in the page component
|
|
731
|
+
var handlePageReady = (0, _react.useCallback)(function () {
|
|
732
|
+
setIsPageReady(true);
|
|
733
|
+
}, []);
|
|
734
|
+
|
|
735
|
+
// Register the callback at module level so usePageReady() can call it
|
|
736
|
+
// Uses componentName as key to avoid conflicts between pages/partials/prefabs
|
|
737
|
+
var componentName = componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentName;
|
|
652
738
|
(0, _react.useEffect)(function () {
|
|
653
|
-
if (
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
739
|
+
if (!componentName) return;
|
|
740
|
+
pageReadyCallbacks.set(componentName, handlePageReady);
|
|
741
|
+
|
|
742
|
+
// Check if child already signalled ready before this effect ran
|
|
743
|
+
if (pageReadySignalled.has(componentName)) {
|
|
744
|
+
handlePageReady();
|
|
745
|
+
}
|
|
746
|
+
return function () {
|
|
747
|
+
pageReadyCallbacks["delete"](componentName);
|
|
748
|
+
pageReadySignalled["delete"](componentName);
|
|
749
|
+
};
|
|
750
|
+
}, [componentName, handlePageReady]);
|
|
751
|
+
|
|
752
|
+
// Execute startup when both conditions are met:
|
|
753
|
+
// 1. Page is initialized (context ready)
|
|
754
|
+
// 2. Page component has signaled ready (widgets have rendered and subscribed)
|
|
755
|
+
(0, _react.useEffect)(function () {
|
|
756
|
+
if (isInitialized && isPageReady && isMountedRef.current && !onStartupCompletedRef.current && pageProxyRef.current) {
|
|
757
|
+
var runStartup = /*#__PURE__*/function () {
|
|
758
|
+
var _ref11 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
663
759
|
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
664
760
|
while (1) switch (_context3.prev = _context3.next) {
|
|
665
761
|
case 0:
|
|
666
|
-
if (
|
|
667
|
-
_context3.next =
|
|
762
|
+
if (isMountedRef.current) {
|
|
763
|
+
_context3.next = 2;
|
|
668
764
|
break;
|
|
669
765
|
}
|
|
670
|
-
_context3.
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
_context3.next = 5;
|
|
766
|
+
return _context3.abrupt("return");
|
|
767
|
+
case 2:
|
|
768
|
+
_context3.next = 4;
|
|
674
769
|
return executeStartup();
|
|
675
|
-
case
|
|
676
|
-
|
|
770
|
+
case 4:
|
|
771
|
+
_context3.next = 6;
|
|
772
|
+
return onContentReady();
|
|
677
773
|
case 6:
|
|
774
|
+
_context3.next = 8;
|
|
775
|
+
return executePageStartup();
|
|
776
|
+
case 8:
|
|
777
|
+
onStartupCompletedRef.current = true;
|
|
778
|
+
// Handle pending accordion expansion from navigation using Redux
|
|
779
|
+
if (pendingAccordionExpansion) {
|
|
780
|
+
setTimeout(function () {
|
|
781
|
+
try {
|
|
782
|
+
var _pageProxyRef$current2;
|
|
783
|
+
if ((_pageProxyRef$current2 = pageProxyRef.current) !== null && _pageProxyRef$current2 !== void 0 && (_pageProxyRef$current2 = _pageProxyRef$current2.Widgets) !== null && _pageProxyRef$current2 !== void 0 && (_pageProxyRef$current2 = _pageProxyRef$current2[pendingAccordionExpansion]) !== null && _pageProxyRef$current2 !== void 0 && _pageProxyRef$current2.expand) {
|
|
784
|
+
pageProxyRef.current.Widgets[pendingAccordionExpansion].expand();
|
|
785
|
+
} else {
|
|
786
|
+
console.warn("Accordion widget not found: ".concat(pendingAccordionExpansion));
|
|
787
|
+
}
|
|
788
|
+
} catch (error) {
|
|
789
|
+
console.warn("Unable to expand accordion: ".concat(pendingAccordionExpansion), error);
|
|
790
|
+
} finally {
|
|
791
|
+
dispatch((0, _navigationSlice.clearPendingAccordionExpansion)());
|
|
792
|
+
}
|
|
793
|
+
}, 0);
|
|
794
|
+
}
|
|
795
|
+
case 10:
|
|
678
796
|
case "end":
|
|
679
797
|
return _context3.stop();
|
|
680
798
|
}
|
|
681
799
|
}, _callee3);
|
|
682
|
-
}))
|
|
683
|
-
|
|
800
|
+
}));
|
|
801
|
+
return function runStartup() {
|
|
802
|
+
return _ref11.apply(this, arguments);
|
|
803
|
+
};
|
|
804
|
+
}();
|
|
805
|
+
runStartup();
|
|
684
806
|
}
|
|
685
|
-
}, [isInitialized]);
|
|
807
|
+
}, [isInitialized, isPageReady]);
|
|
686
808
|
(0, _react.useEffect)(function () {
|
|
687
809
|
return function () {
|
|
688
810
|
isMountedRef.current = false;
|
|
811
|
+
// Cleanup viewport service when component unmounts
|
|
812
|
+
_viewport.viewportService.destroy();
|
|
689
813
|
};
|
|
690
814
|
}, []);
|
|
691
815
|
|