@wavemaker/react-runtime 11.14.2-rc.6311 → 11.15.0-1.246
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 +73 -18
- 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 +31 -11
- 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 +4 -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/repeat-template/index.js +33 -0
- package/components/container/tabs/index.js +83 -14
- package/components/container/tabs/tab-pane/index.js +33 -10
- 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 +985 -183
- 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 +67 -45
- 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 +51 -18
- 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 -52
- 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 +209 -72
- 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 +105 -32
- 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 +85 -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 +41 -3
- 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 +840 -740
- 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");
|
|
@@ -25,26 +27,62 @@ var _useAccess2 = _interopRequireDefault(require("@wavemaker/react-runtime/hooks
|
|
|
25
27
|
var _authSlice = require("@wavemaker/react-runtime/store/slices/authSlice");
|
|
26
28
|
var _types = require("@wavemaker/react-runtime/types");
|
|
27
29
|
var _proxyService = require("@wavemaker/react-runtime/core/proxy-service");
|
|
28
|
-
var _navigationMiddleware = require("@wavemaker/react-runtime/store/middleware/navigationMiddleware");
|
|
29
30
|
var _helper = require("@wavemaker/react-runtime/higherOrder/helper");
|
|
30
31
|
var _toast = require("@wavemaker/react-runtime/actions/toast.service");
|
|
31
32
|
var _appstore = _interopRequireDefault(require("@wavemaker/react-runtime/core/appstore"));
|
|
32
33
|
var _scriptRegistry = require("@wavemaker/react-runtime/core/script-registry");
|
|
33
34
|
var _formatters = _interopRequireDefault(require("../core/formatters"));
|
|
34
35
|
var _AppContext2 = require("../context/AppContext");
|
|
35
|
-
var _widgetCleanupUtil = require("../utils/widget-cleanup-util");
|
|
36
36
|
var _pageParamsUtil = require("../utils/page-params-util");
|
|
37
|
-
var _constants = require("../core/constants");
|
|
38
37
|
var _AppSpinnerProvider = require("../context/AppSpinnerProvider");
|
|
39
|
-
var
|
|
38
|
+
var _get = _interopRequireDefault(require("lodash/get"));
|
|
40
39
|
var _events = require("../core/constants/events");
|
|
41
40
|
var _libErrorSkipper = require("../utils/lib-error-skipper");
|
|
41
|
+
var _viewport = require("../store/viewport.service");
|
|
42
|
+
var _util = require("../core/util");
|
|
42
43
|
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
44
|
var __jsx = _react["default"].createElement;
|
|
44
45
|
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
46
|
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
|
-
|
|
47
|
+
/**
|
|
48
|
+
* Module-level Maps for page ready signaling.
|
|
49
|
+
* Each component is tracked by its componentName, preventing conflicts between
|
|
50
|
+
* pages, partials, and prefabs.
|
|
51
|
+
*/
|
|
52
|
+
var pageReadyCallbacks = new Map();
|
|
53
|
+
var pageReadySignalled = new Set();
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Hook to signal that a page component has rendered and is ready.
|
|
57
|
+
* Call this at the top of your page component to trigger startup operations.
|
|
58
|
+
*
|
|
59
|
+
* This ensures widgets have mounted and subscribed before variables are invoked.
|
|
60
|
+
*
|
|
61
|
+
* @param componentName - The unique name of the component (e.g., "ChooseAPlansGrid")
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* import { usePageReady } from '@wavemaker/react-runtime/higherOrder/BasePage';
|
|
65
|
+
*
|
|
66
|
+
* const ChooseAPlansGridComponent = () => {
|
|
67
|
+
* usePageReady("ChooseAPlansGrid"); // Signal ready on mount
|
|
68
|
+
* return <WmPage>...</WmPage>;
|
|
69
|
+
* };
|
|
70
|
+
*/
|
|
71
|
+
var usePageReady = exports.usePageReady = function usePageReady(componentName) {
|
|
72
|
+
var signalledRef = (0, _react.useRef)(false);
|
|
73
|
+
(0, _react.useEffect)(function () {
|
|
74
|
+
if (!componentName || signalledRef.current) return;
|
|
75
|
+
signalledRef.current = true;
|
|
76
|
+
pageReadySignalled.add(componentName);
|
|
77
|
+
|
|
78
|
+
// Call callback if already registered (parent effect ran first)
|
|
79
|
+
var callback = pageReadyCallbacks.get(componentName);
|
|
80
|
+
if (callback) {
|
|
81
|
+
callback();
|
|
82
|
+
}
|
|
83
|
+
// Otherwise, the parent's effect will check pageReadySignalled and call handlePageReady
|
|
84
|
+
}, [componentName]);
|
|
85
|
+
};
|
|
48
86
|
var withPageContext = exports.withPageContext = function withPageContext(WrappedComponent, addPageScript, getVariables, componentInfo, prefabInfo) {
|
|
49
87
|
var PageContextComponent = function PageContextComponent(props) {
|
|
50
88
|
var _info$appConfig;
|
|
@@ -90,6 +128,12 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
|
|
|
90
128
|
var appConfig = (0, _store.useAppSelector)(function (state) {
|
|
91
129
|
return state.info.appConfig;
|
|
92
130
|
});
|
|
131
|
+
var pendingAccordionExpansion = (0, _store.useAppSelector)(function (state) {
|
|
132
|
+
return state.navigation.pendingAccordionExpansion;
|
|
133
|
+
});
|
|
134
|
+
var pendingTabSelection = (0, _store.useAppSelector)(function (state) {
|
|
135
|
+
return state.navigation.pendingTabSelection;
|
|
136
|
+
});
|
|
93
137
|
|
|
94
138
|
// Initialization state management
|
|
95
139
|
var _useState = (0, _react.useState)(false),
|
|
@@ -102,13 +146,12 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
|
|
|
102
146
|
var pendingStartupOpsRef = (0, _react.useRef)(new Set());
|
|
103
147
|
var startUpVariableLoadedRef = (0, _react.useRef)(false);
|
|
104
148
|
var pageProxyRef = (0, _react.useRef)(null);
|
|
149
|
+
var urlTabProcessedRef = (0, _react.useRef)(false); // Track if URL tab parameter has been processed
|
|
105
150
|
var isInitializingRef = (0, _react.useRef)(false);
|
|
106
151
|
var isMountedRef = (0, _react.useRef)(true);
|
|
107
|
-
var usedFallbackAppVarsRef = (0, _react.useRef)(false);
|
|
108
152
|
var appVarSubscriptionsDoneRef = (0, _react.useRef)(false);
|
|
109
153
|
var subscribedVariableNamesRef = (0, _react.useRef)(new Set());
|
|
110
|
-
var
|
|
111
|
-
var isContentReadyRef = (0, _react.useRef)(false);
|
|
154
|
+
var overriddenPropsRegistryRef = (0, _react.useRef)(null);
|
|
112
155
|
|
|
113
156
|
// Initial page context state
|
|
114
157
|
var _useState2 = (0, _react.useState)(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
@@ -117,20 +160,22 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
|
|
|
117
160
|
Actions: {},
|
|
118
161
|
onReady: function onReady() {},
|
|
119
162
|
serviceDefinitions: (0, _cloneDeep["default"])((prefabInfo === null || prefabInfo === void 0 ? void 0 : prefabInfo.serviceDefs) || (appContext === null || appContext === void 0 ? void 0 : appContext.serviceDefinitions) || {}),
|
|
120
|
-
pageParams: {},
|
|
163
|
+
pageParams: props.pageParams || {},
|
|
121
164
|
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
165
|
appConfig: appContext === null || appContext === void 0 ? void 0 : appContext.appConfig,
|
|
123
166
|
notification: {},
|
|
124
167
|
toaster: _toast.toastService,
|
|
125
168
|
onContentReady: onContentReady,
|
|
126
169
|
onChange: updateWidgetState,
|
|
127
|
-
cleanup: cleanup,
|
|
128
170
|
App: {},
|
|
129
171
|
eval: appContext === null || appContext === void 0 ? void 0 : appContext.eval,
|
|
130
172
|
appLocale: componentInfo.appLocale || i18n.appLocale || {}
|
|
131
173
|
}, prefabInfo), props), componentInfo), {}, {
|
|
132
174
|
executeStartup: executeStartup,
|
|
133
|
-
formatters: _formatters["default"]
|
|
175
|
+
formatters: _formatters["default"],
|
|
176
|
+
Viewport: _viewport.viewportService.getViewport(),
|
|
177
|
+
formatMessage: _util.formatMessage,
|
|
178
|
+
overriddenPropsRegistryRef: overriddenPropsRegistryRef.current
|
|
134
179
|
})),
|
|
135
180
|
pageContext = _useState2[0],
|
|
136
181
|
setPageContext = _useState2[1];
|
|
@@ -139,6 +184,32 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
|
|
|
139
184
|
return appContext;
|
|
140
185
|
}, [appContext]);
|
|
141
186
|
|
|
187
|
+
// Compute a stable key from partial param values for dependency tracking
|
|
188
|
+
var partialParamValuesKey = (0, _pageParamsUtil.computePartialParamKey)(componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentType, props.params, props);
|
|
189
|
+
|
|
190
|
+
// Subscribe for partial params changes - sync prop values to pageParams
|
|
191
|
+
(0, _react.useEffect)(function () {
|
|
192
|
+
if ((componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentType) !== "PARTIAL" || !pageProxyRef.current) {
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
var paramValues = (0, _pageParamsUtil.extractPartialParamValues)(props.params || [], props);
|
|
196
|
+
|
|
197
|
+
// Update pageParams for each param key when prop values change
|
|
198
|
+
Object.entries(paramValues).forEach(function (_ref) {
|
|
199
|
+
var _pageProxyRef$current;
|
|
200
|
+
var _ref2 = (0, _slicedToArray2["default"])(_ref, 2),
|
|
201
|
+
key = _ref2[0],
|
|
202
|
+
newValue = _ref2[1];
|
|
203
|
+
if (!(0, _isEqual["default"])((_pageProxyRef$current = pageProxyRef.current.pageParams) === null || _pageProxyRef$current === void 0 ? void 0 : _pageProxyRef$current[key], newValue)) {
|
|
204
|
+
if (!pageProxyRef.current.pageParams) {
|
|
205
|
+
pageProxyRef.current.pageParams = {};
|
|
206
|
+
}
|
|
207
|
+
pageProxyRef.current.pageParams[key] = newValue;
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
211
|
+
}, [partialParamValuesKey]);
|
|
212
|
+
|
|
142
213
|
// Handle redirect to login if authentication is required
|
|
143
214
|
(0, _react.useEffect)(function () {
|
|
144
215
|
var _appConfig$pages;
|
|
@@ -163,32 +234,6 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
|
|
|
163
234
|
}
|
|
164
235
|
}, [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
236
|
|
|
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
237
|
// Check if we should proceed with initialization
|
|
193
238
|
var shouldInitialize = (0, _react.useMemo)(function () {
|
|
194
239
|
// Wait for app to be ready (if app context exists)
|
|
@@ -235,7 +280,7 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
|
|
|
235
280
|
Actions: updatedActions
|
|
236
281
|
});
|
|
237
282
|
});
|
|
238
|
-
}, [appContext === null || appContext === void 0 ? void 0 : appContext.isAppReady]);
|
|
283
|
+
}, [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
284
|
|
|
240
285
|
// Main initialization effect - runs only when conditions are met
|
|
241
286
|
(0, _react.useEffect)(function () {
|
|
@@ -247,25 +292,18 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
|
|
|
247
292
|
// Set initialization flag
|
|
248
293
|
isInitializingRef.current = true;
|
|
249
294
|
var initializeComponent = /*#__PURE__*/function () {
|
|
250
|
-
var
|
|
295
|
+
var _ref3 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
251
296
|
var pageProxy, pageVariables, appVariables, APP_VARIABLES, _mergeVariablesAndAct, Variables, Actions, urlParams, newParams, pageName;
|
|
252
297
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
253
298
|
while (1) switch (_context.prev = _context.next) {
|
|
254
299
|
case 0:
|
|
255
300
|
try {
|
|
301
|
+
// Create overridden props registry
|
|
302
|
+
overriddenPropsRegistryRef.current = (0, _scriptRegistry.createOverriddenPropsRegistry)();
|
|
256
303
|
// Create page proxy
|
|
257
|
-
pageProxy = (0, _proxyService.createStateProxy)(pageContext, [], setPageContext);
|
|
304
|
+
pageProxy = (0, _proxyService.createStateProxy)(pageContext, [], setPageContext, overriddenPropsRegistryRef.current);
|
|
258
305
|
pageProxyRef.current = pageProxy;
|
|
259
306
|
|
|
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
307
|
// Initialize variables and actions
|
|
270
308
|
pageVariables = getVariables(pageProxy); // Handle app variables based on app context availability
|
|
271
309
|
appVariables = {
|
|
@@ -278,7 +316,6 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
|
|
|
278
316
|
Variables: appContext.Variables || {},
|
|
279
317
|
Actions: appContext.Actions || {}
|
|
280
318
|
};
|
|
281
|
-
usedFallbackAppVarsRef.current = false;
|
|
282
319
|
} else {
|
|
283
320
|
// Fallback to traditional app variable initialization
|
|
284
321
|
// @ts-ignore
|
|
@@ -287,7 +324,6 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
|
|
|
287
324
|
Variables: {},
|
|
288
325
|
Actions: {}
|
|
289
326
|
};
|
|
290
|
-
usedFallbackAppVarsRef.current = true;
|
|
291
327
|
}
|
|
292
328
|
_mergeVariablesAndAct = (0, _helper.mergeVariablesAndActions)(pageVariables, appVariables), Variables = _mergeVariablesAndAct.Variables, Actions = _mergeVariablesAndAct.Actions; // Compute page params from URL and include partial params when applicable
|
|
293
329
|
urlParams = Object.fromEntries(pageParams.entries());
|
|
@@ -302,8 +338,8 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
|
|
|
302
338
|
pageProxy.Actions = Actions;
|
|
303
339
|
pageProxy.pageParams = _objectSpread({}, newParams);
|
|
304
340
|
pageProxy.App = _objectSpread(_objectSpread({}, appProxy), initialAppConfig);
|
|
305
|
-
pageProxy.pageParams = _objectSpread({}, newParams);
|
|
306
341
|
pageProxy.selectedLocale = i18n.selectedLocale || "en";
|
|
342
|
+
pageProxy.overriddenPropsRegistry = overriddenPropsRegistryRef.current;
|
|
307
343
|
|
|
308
344
|
// Setup variable event handlers
|
|
309
345
|
setupVariableSubscriptions(pageVariables.Variables);
|
|
@@ -311,6 +347,8 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
|
|
|
311
347
|
pageName = componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentName;
|
|
312
348
|
appProxy.updateActivePage(pageName);
|
|
313
349
|
appProxy.activePage = pageProxy;
|
|
350
|
+
} else if ((componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentName) === "Common" && (componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentType) === "PARTIAL" && appProxy) {
|
|
351
|
+
appProxy.Widgets = pageProxy === null || pageProxy === void 0 ? void 0 : pageProxy.Widgets;
|
|
314
352
|
}
|
|
315
353
|
|
|
316
354
|
// Initialize page script
|
|
@@ -342,21 +380,21 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
|
|
|
342
380
|
}, _callee);
|
|
343
381
|
}));
|
|
344
382
|
return function initializeComponent() {
|
|
345
|
-
return
|
|
383
|
+
return _ref3.apply(this, arguments);
|
|
346
384
|
};
|
|
347
385
|
}();
|
|
348
386
|
initializeComponent();
|
|
349
387
|
|
|
350
388
|
// Cleanup function
|
|
351
389
|
return function () {
|
|
352
|
-
var
|
|
390
|
+
var _overriddenPropsRegis;
|
|
353
391
|
// Cancel all pending page operations
|
|
354
392
|
if (pageProxyRef.current) {
|
|
355
|
-
var
|
|
356
|
-
|
|
357
|
-
Variables =
|
|
358
|
-
|
|
359
|
-
Actions =
|
|
393
|
+
var _ref4 = getVariables(pageProxyRef.current) || {},
|
|
394
|
+
_ref4$Variables = _ref4.Variables,
|
|
395
|
+
Variables = _ref4$Variables === void 0 ? {} : _ref4$Variables,
|
|
396
|
+
_ref4$Actions = _ref4.Actions,
|
|
397
|
+
Actions = _ref4$Actions === void 0 ? {} : _ref4$Actions;
|
|
360
398
|
|
|
361
399
|
// Cancel page variables
|
|
362
400
|
Object.values(Variables).forEach(function (variable) {
|
|
@@ -383,13 +421,14 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
|
|
|
383
421
|
|
|
384
422
|
// Clear pending startup operations
|
|
385
423
|
pendingStartupOpsRef.current.clear();
|
|
386
|
-
(0
|
|
424
|
+
(_overriddenPropsRegis = overriddenPropsRegistryRef.current) === null || _overriddenPropsRegis === void 0 || _overriddenPropsRegis.clear();
|
|
425
|
+
// clearOverriddenProps();
|
|
387
426
|
|
|
388
427
|
// Unsubscribe from events
|
|
389
|
-
subscriptionsRef.current.forEach(function (
|
|
390
|
-
var variable =
|
|
391
|
-
event =
|
|
392
|
-
handler =
|
|
428
|
+
subscriptionsRef.current.forEach(function (_ref5) {
|
|
429
|
+
var variable = _ref5.variable,
|
|
430
|
+
event = _ref5.event,
|
|
431
|
+
handler = _ref5.handler;
|
|
393
432
|
if (variable !== null && variable !== void 0 && variable.unsubscribe) {
|
|
394
433
|
try {
|
|
395
434
|
variable.unsubscribe(event, handler);
|
|
@@ -399,23 +438,22 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
|
|
|
399
438
|
}
|
|
400
439
|
});
|
|
401
440
|
subscriptionsRef.current = [];
|
|
402
|
-
|
|
403
|
-
// Cancel any pending cleanup operations
|
|
404
|
-
(_cleanupUtilRef$curre = cleanupUtilRef.current) === null || _cleanupUtilRef$curre === void 0 || _cleanupUtilRef$curre.cancel();
|
|
405
441
|
};
|
|
406
442
|
}, [shouldInitialize]); // Only depend on shouldInitialize
|
|
407
443
|
|
|
408
|
-
//
|
|
444
|
+
// Subscribe to app-level variables when app becomes ready
|
|
445
|
+
// This MUST happen before executeStartAppOperations() is called (via executeStartup)
|
|
446
|
+
// so that widgets can receive loading state updates when app variables are invoked
|
|
409
447
|
(0, _react.useEffect)(function () {
|
|
410
|
-
if (!(appContext !== null && appContext !== void 0 && appContext.isAppReady) || !pageProxyRef.current ||
|
|
448
|
+
if (!(appContext !== null && appContext !== void 0 && appContext.isAppReady) || !pageProxyRef.current || appVarSubscriptionsDoneRef.current) {
|
|
411
449
|
return;
|
|
412
450
|
}
|
|
413
451
|
try {
|
|
414
|
-
var
|
|
452
|
+
var _ref6 = getVariables(pageProxyRef.current) || {
|
|
415
453
|
Variables: {}
|
|
416
454
|
},
|
|
417
|
-
|
|
418
|
-
pageVars =
|
|
455
|
+
_ref6$Variables = _ref6.Variables,
|
|
456
|
+
pageVars = _ref6$Variables === void 0 ? {} : _ref6$Variables;
|
|
419
457
|
var pageVarNames = new Set(Object.keys(pageVars || {}));
|
|
420
458
|
subscribeAppVariablesIfNeeded(appContext.Variables || {}, pageVarNames);
|
|
421
459
|
appVarSubscriptionsDoneRef.current = true;
|
|
@@ -459,9 +497,9 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
|
|
|
459
497
|
var updateState = variable;
|
|
460
498
|
updateState.loading = event === _types.VariableEvents.BEFORE_INVOKE;
|
|
461
499
|
updateState.error = event === _types.VariableEvents.ERROR ? variable : null;
|
|
462
|
-
if ((0,
|
|
500
|
+
if ((0, _get["default"])(variable, "spinnerContext") === "page") {
|
|
463
501
|
if (updateState.loading) {
|
|
464
|
-
var message = (0,
|
|
502
|
+
var message = (0, _get["default"])(variable, "spinnerMessage");
|
|
465
503
|
show(message);
|
|
466
504
|
} else {
|
|
467
505
|
hide();
|
|
@@ -478,10 +516,10 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
|
|
|
478
516
|
};
|
|
479
517
|
|
|
480
518
|
// Set up subscriptions (avoid duplicates by name)
|
|
481
|
-
Object.entries(variables).forEach(function (
|
|
482
|
-
var
|
|
483
|
-
name =
|
|
484
|
-
variable =
|
|
519
|
+
Object.entries(variables).forEach(function (_ref7) {
|
|
520
|
+
var _ref8 = (0, _slicedToArray2["default"])(_ref7, 2),
|
|
521
|
+
name = _ref8[0],
|
|
522
|
+
variable = _ref8[1];
|
|
485
523
|
if (subscribedVariableNamesRef.current.has(name)) {
|
|
486
524
|
return;
|
|
487
525
|
}
|
|
@@ -505,10 +543,10 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
|
|
|
505
543
|
// Subscribe to app-level variables that are not shadowed by page variables
|
|
506
544
|
var subscribeAppVariablesIfNeeded = function subscribeAppVariablesIfNeeded(appVars, pageVarNames) {
|
|
507
545
|
var appVarsOnly = {};
|
|
508
|
-
Object.entries(appVars || {}).forEach(function (
|
|
509
|
-
var
|
|
510
|
-
name =
|
|
511
|
-
variable =
|
|
546
|
+
Object.entries(appVars || {}).forEach(function (_ref9) {
|
|
547
|
+
var _ref0 = (0, _slicedToArray2["default"])(_ref9, 2),
|
|
548
|
+
name = _ref0[0],
|
|
549
|
+
variable = _ref0[1];
|
|
512
550
|
if (!pageVarNames.has(name) && !subscribedVariableNamesRef.current.has(name)) {
|
|
513
551
|
appVarsOnly[name] = variable;
|
|
514
552
|
}
|
|
@@ -520,12 +558,12 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
|
|
|
520
558
|
|
|
521
559
|
// Execute startup operations
|
|
522
560
|
var executeStartupOperations = /*#__PURE__*/function () {
|
|
523
|
-
var
|
|
524
|
-
var
|
|
561
|
+
var _ref1 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(Variables, Actions) {
|
|
562
|
+
var _ref10, _ref10$startUpActions, startUpActions, _ref10$startUpVariabl, startUpVariables, variablePromises;
|
|
525
563
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
526
564
|
while (1) switch (_context2.prev = _context2.next) {
|
|
527
565
|
case 0:
|
|
528
|
-
|
|
566
|
+
_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
567
|
startUpVariables.forEach(function (name) {
|
|
530
568
|
return pendingStartupOpsRef.current.add(name);
|
|
531
569
|
});
|
|
@@ -566,75 +604,115 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
|
|
|
566
604
|
case 10:
|
|
567
605
|
startUpVariableLoadedRef.current = true;
|
|
568
606
|
pendingStartupOpsRef.current.clear();
|
|
569
|
-
|
|
607
|
+
setTimeout(function () {
|
|
608
|
+
if ((componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentType) === "PAGE") {
|
|
609
|
+
appContext === null || appContext === void 0 || appContext.notify("page-variables-data-loaded", {
|
|
610
|
+
pageName: componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentName
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
}, 0);
|
|
614
|
+
_context2.next = 18;
|
|
570
615
|
break;
|
|
571
|
-
case
|
|
572
|
-
_context2.prev =
|
|
616
|
+
case 15:
|
|
617
|
+
_context2.prev = 15;
|
|
573
618
|
_context2.t0 = _context2["catch"](5);
|
|
574
619
|
console.error("Error during startup operations:", _context2.t0);
|
|
575
|
-
case
|
|
620
|
+
case 18:
|
|
576
621
|
case "end":
|
|
577
622
|
return _context2.stop();
|
|
578
623
|
}
|
|
579
|
-
}, _callee2, null, [[5,
|
|
624
|
+
}, _callee2, null, [[5, 15]]);
|
|
580
625
|
}));
|
|
581
626
|
return function executeStartupOperations(_x, _x2) {
|
|
582
|
-
return
|
|
627
|
+
return _ref1.apply(this, arguments);
|
|
583
628
|
};
|
|
584
629
|
}();
|
|
585
630
|
|
|
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
631
|
// Widget state update function
|
|
593
632
|
function updateWidgetState(widgetName, newProps) {
|
|
594
633
|
if (!widgetName || !newProps || Object.keys(newProps).length === 0) return;
|
|
595
|
-
if ((0,
|
|
634
|
+
if ((0, _compare["default"])(pageContext.Widgets[widgetName], newProps)) return;
|
|
596
635
|
setPageContext(function (prev) {
|
|
597
636
|
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
598
637
|
Widgets: _objectSpread(_objectSpread({}, prev.Widgets), {}, (0, _defineProperty2["default"])({}, widgetName, _objectSpread(_objectSpread({}, prev.Widgets[widgetName]), newProps)))
|
|
599
638
|
});
|
|
600
639
|
});
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
640
|
+
|
|
641
|
+
// Suspend tracking to prevent internal state updates from being tracked as script overrides
|
|
642
|
+
(0, _scriptRegistry.withSuspendedTracking)(overriddenPropsRegistryRef.current, function () {
|
|
643
|
+
Object.keys(newProps).forEach(function (key) {
|
|
644
|
+
var _pageContext$Widgets$;
|
|
645
|
+
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) {
|
|
646
|
+
pageProxyRef.current.Widgets[widgetName][key] = newProps[key];
|
|
647
|
+
}
|
|
648
|
+
});
|
|
606
649
|
});
|
|
607
650
|
}
|
|
608
651
|
|
|
609
652
|
// Content ready callback
|
|
610
653
|
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();
|
|
654
|
+
return _onContentReady.apply(this, arguments);
|
|
618
655
|
}
|
|
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() {
|
|
656
|
+
function _onContentReady() {
|
|
657
|
+
_onContentReady = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee4() {
|
|
624
658
|
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
625
659
|
while (1) switch (_context4.prev = _context4.next) {
|
|
626
660
|
case 0:
|
|
627
|
-
|
|
661
|
+
if (!pageContext.onReady) {
|
|
662
|
+
_context4.next = 3;
|
|
663
|
+
break;
|
|
664
|
+
}
|
|
628
665
|
_context4.next = 3;
|
|
629
|
-
return
|
|
666
|
+
return pageContext.onReady();
|
|
630
667
|
case 3:
|
|
668
|
+
if (appContext !== null && appContext !== void 0 && appContext.onPageReady && pageContext.componentType === "PAGE") {
|
|
669
|
+
appContext.onPageReady(pageContext.componentName, pageProxyRef.current, undefined);
|
|
670
|
+
}
|
|
671
|
+
return _context4.abrupt("return", Promise.resolve());
|
|
672
|
+
case 5:
|
|
631
673
|
case "end":
|
|
632
674
|
return _context4.stop();
|
|
633
675
|
}
|
|
634
676
|
}, _callee4);
|
|
635
677
|
}));
|
|
678
|
+
return _onContentReady.apply(this, arguments);
|
|
679
|
+
}
|
|
680
|
+
function executeStartup() {
|
|
636
681
|
return _executeStartup.apply(this, arguments);
|
|
637
682
|
}
|
|
683
|
+
function _executeStartup() {
|
|
684
|
+
_executeStartup = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee5() {
|
|
685
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
686
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
687
|
+
case 0:
|
|
688
|
+
_context5.next = 2;
|
|
689
|
+
return appContext === null || appContext === void 0 ? void 0 : appContext.executeStartAppOperations();
|
|
690
|
+
case 2:
|
|
691
|
+
case "end":
|
|
692
|
+
return _context5.stop();
|
|
693
|
+
}
|
|
694
|
+
}, _callee5);
|
|
695
|
+
}));
|
|
696
|
+
return _executeStartup.apply(this, arguments);
|
|
697
|
+
}
|
|
698
|
+
function executePageStartup() {
|
|
699
|
+
return _executePageStartup.apply(this, arguments);
|
|
700
|
+
} // Update pageContext.appLocale when i18n.appLocale changes
|
|
701
|
+
function _executePageStartup() {
|
|
702
|
+
_executePageStartup = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee6() {
|
|
703
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
704
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
705
|
+
case 0:
|
|
706
|
+
_context6.next = 2;
|
|
707
|
+
return executeStartupOperations(pageContext.Variables, pageContext.Actions);
|
|
708
|
+
case 2:
|
|
709
|
+
case "end":
|
|
710
|
+
return _context6.stop();
|
|
711
|
+
}
|
|
712
|
+
}, _callee6);
|
|
713
|
+
}));
|
|
714
|
+
return _executePageStartup.apply(this, arguments);
|
|
715
|
+
}
|
|
638
716
|
(0, _react.useEffect)(function () {
|
|
639
717
|
var newAppLocale = (0, _merge["default"])({}, i18n.appLocale || {}, (prefabInfo === null || prefabInfo === void 0 ? void 0 : prefabInfo.appLocale) || {});
|
|
640
718
|
if (!(0, _isEqual["default"])(pageContext.appLocale, newAppLocale)) {
|
|
@@ -643,49 +721,95 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
|
|
|
643
721
|
appLocale: newAppLocale
|
|
644
722
|
});
|
|
645
723
|
});
|
|
646
|
-
|
|
724
|
+
pageProxyRef.current.App.appLocale = newAppLocale;
|
|
647
725
|
}
|
|
648
726
|
}, [i18n.appLocale]);
|
|
649
|
-
var onContentReadyCalledRef = (0, _react.useRef)(false);
|
|
650
727
|
var onStartupCompletedRef = (0, _react.useRef)(false);
|
|
651
|
-
|
|
728
|
+
var _useState3 = (0, _react.useState)(false),
|
|
729
|
+
isPageReady = _useState3[0],
|
|
730
|
+
setIsPageReady = _useState3[1];
|
|
731
|
+
|
|
732
|
+
// Callback for when page component signals it's ready
|
|
733
|
+
// This is called by usePageReady() hook in the page component
|
|
734
|
+
var handlePageReady = (0, _react.useCallback)(function () {
|
|
735
|
+
setIsPageReady(true);
|
|
736
|
+
}, []);
|
|
737
|
+
|
|
738
|
+
// Register the callback at module level so usePageReady() can call it
|
|
739
|
+
// Uses componentName as key to avoid conflicts between pages/partials/prefabs
|
|
740
|
+
var componentName = componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentName;
|
|
741
|
+
(0, _react.useEffect)(function () {
|
|
742
|
+
if (!componentName) return;
|
|
743
|
+
pageReadyCallbacks.set(componentName, handlePageReady);
|
|
744
|
+
|
|
745
|
+
// Check if child already signalled ready before this effect ran
|
|
746
|
+
if (pageReadySignalled.has(componentName)) {
|
|
747
|
+
handlePageReady();
|
|
748
|
+
}
|
|
749
|
+
return function () {
|
|
750
|
+
pageReadyCallbacks["delete"](componentName);
|
|
751
|
+
pageReadySignalled["delete"](componentName);
|
|
752
|
+
};
|
|
753
|
+
}, [componentName, handlePageReady]);
|
|
754
|
+
|
|
755
|
+
// Execute startup when both conditions are met:
|
|
756
|
+
// 1. Page is initialized (context ready)
|
|
757
|
+
// 2. Page component has signaled ready (widgets have rendered and subscribed)
|
|
652
758
|
(0, _react.useEffect)(function () {
|
|
653
|
-
if (isInitialized && isMountedRef.current && !
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
// 1. First RAF: waits for browser to schedule the next paint
|
|
658
|
-
// 2. Second RAF: waits for the paint to complete and any nested renders
|
|
659
|
-
// This is a reliable pattern to ensure component is fully rendered
|
|
660
|
-
requestAnimationFrame(function () {
|
|
661
|
-
if (!isMountedRef.current) return;
|
|
662
|
-
requestAnimationFrame(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
759
|
+
if (isInitialized && isPageReady && isMountedRef.current && !onStartupCompletedRef.current && pageProxyRef.current) {
|
|
760
|
+
var runStartup = /*#__PURE__*/function () {
|
|
761
|
+
var _ref11 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
762
|
+
var tabNameFromUrl, tabNameToSelect;
|
|
663
763
|
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
664
764
|
while (1) switch (_context3.prev = _context3.next) {
|
|
665
765
|
case 0:
|
|
666
|
-
if (
|
|
667
|
-
_context3.next =
|
|
766
|
+
if (isMountedRef.current) {
|
|
767
|
+
_context3.next = 2;
|
|
668
768
|
break;
|
|
669
769
|
}
|
|
670
|
-
_context3.
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
_context3.next = 5;
|
|
770
|
+
return _context3.abrupt("return");
|
|
771
|
+
case 2:
|
|
772
|
+
_context3.next = 4;
|
|
674
773
|
return executeStartup();
|
|
675
|
-
case
|
|
676
|
-
|
|
774
|
+
case 4:
|
|
775
|
+
_context3.next = 6;
|
|
776
|
+
return onContentReady();
|
|
677
777
|
case 6:
|
|
778
|
+
_context3.next = 8;
|
|
779
|
+
return executePageStartup();
|
|
780
|
+
case 8:
|
|
781
|
+
onStartupCompletedRef.current = true;
|
|
782
|
+
// Handle pending accordion expansion from navigation using Redux
|
|
783
|
+
if (pendingAccordionExpansion) {
|
|
784
|
+
(0, _helper.accordionExpansionHandler)(pageProxyRef, pendingAccordionExpansion, dispatch);
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
// Handle tab selection from URL query parameter or Redux
|
|
788
|
+
// URL parameter is only processed once on initial page load
|
|
789
|
+
// Redux state is used for programmatic navigation
|
|
790
|
+
tabNameFromUrl = !urlTabProcessedRef.current ? pageParams === null || pageParams === void 0 ? void 0 : pageParams.get("tabName") : null;
|
|
791
|
+
tabNameToSelect = tabNameFromUrl || pendingTabSelection;
|
|
792
|
+
if (tabNameToSelect) {
|
|
793
|
+
(0, _helper.tabSelectionHandler)(pageProxyRef, tabNameToSelect, dispatch);
|
|
794
|
+
}
|
|
795
|
+
case 13:
|
|
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
|
|