@wavemaker/react-runtime 11.14.1-rc.241 → 11.14.2-1.6423

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/actions/navigation-action.js +5 -3
  2. package/actions/notification-action.js +6 -3
  3. package/components/basic/anchor/index.js +6 -7
  4. package/components/basic/label/index.js +2 -2
  5. package/components/basic/search/index.js +7 -3
  6. package/components/chart/components/barColumnChart/index.js +2 -4
  7. package/components/chart/components/pieDonutChart/index.js +3 -1
  8. package/components/chart/hooks/useBarYAxisExtras.js +52 -0
  9. package/components/chart/hooks/useXAxisConfig.js +98 -0
  10. package/components/chart/index.js +72 -39
  11. package/components/chart/utils.js +23 -12
  12. package/components/container/index.js +6 -7
  13. package/components/container/panel/components/panel-header/index.js +3 -2
  14. package/components/container/panel/index.js +13 -9
  15. package/components/container/tabs/index.js +1 -0
  16. package/components/container/tabs/tab-pane/index.js +39 -3
  17. package/components/container/wizard/index.js +187 -57
  18. package/components/container/wizard/utils.js +1 -1
  19. package/components/container/wizard/wizard-action/index.js +9 -4
  20. package/components/container/wizard/wizard-step/index.js +21 -8
  21. package/components/data/form/base-form/index.js +51 -11
  22. package/components/data/form/form-controller/withFormController.js +7 -10
  23. package/components/data/list/components/GroupedListItems.js +5 -1
  24. package/components/data/list/components/ListItemWithTemplate.js +4 -1
  25. package/components/data/list/hooks/useListEffects.js +34 -14
  26. package/components/data/list/hooks/useListEventHandlers.js +18 -2
  27. package/components/data/list/hooks/useListState.js +15 -2
  28. package/components/data/list/index.js +1 -0
  29. package/components/data/list/utils/list-helpers.js +3 -5
  30. package/components/data/list/utils/list-widget-methods.js +1 -1
  31. package/components/data/live-filter/index.js +6 -5
  32. package/components/data/live-form/index.js +24 -14
  33. package/components/data/table/components/TableBody.js +5 -21
  34. package/components/data/table/components/TableHeader.js +5 -1
  35. package/components/data/table/index.js +21 -5
  36. package/components/data/utils/field-data-utils.js +1 -1
  37. package/components/dialogs/index.js +14 -16
  38. package/components/input/currency/index.js +11 -7
  39. package/components/input/default/checkbox/index.js +2 -3
  40. package/components/input/default/checkboxset/index.js +2 -22
  41. package/components/input/default/radioset/index.js +5 -4
  42. package/components/input/epoch/datetime/index.js +6 -2
  43. package/components/input/epoch/time/index.js +2 -1
  44. package/components/input/number/index.js +2 -2
  45. package/components/input/text/util.js +2 -0
  46. package/components/input/textarea/index.js +22 -24
  47. package/components/layout/leftnav/index.js +1 -1
  48. package/components/navbar/nav/index.js +97 -7
  49. package/components/navbar/nav-item/index.js +5 -2
  50. package/components/navigation/menu/index.js +73 -12
  51. package/components/navigation/popover/index.js +2 -0
  52. package/components/page/error-boundary/index.js +1 -0
  53. package/components/prefab/container/index.js +10 -3
  54. package/context/LocalizationProvider.js +1 -0
  55. package/context/PrefabContext.js +138 -13
  56. package/context/WidgetProvider.js +2 -2
  57. package/core/constants/events.js +12 -6
  58. package/core/constants/index.js +6 -11
  59. package/core/formatter/number-formatters.js +1 -1
  60. package/core/proxy-service.js +72 -36
  61. package/core/util/utils.js +23 -4
  62. package/higherOrder/BaseApp.js +60 -18
  63. package/higherOrder/BasePage.js +99 -77
  64. package/higherOrder/BasePrefab.js +13 -5
  65. package/higherOrder/withBaseWrapper.js +3 -3
  66. package/hooks/useDataSourceSubscription.js +1 -1
  67. package/hooks/useHttp.js +20 -13
  68. package/mui-config/theme.js +3 -0
  69. package/package-lock.json +781 -669
  70. package/package.json +3 -3
  71. package/store/index.js +5 -1
  72. package/utils/lib-error-skipper.js +196 -0
  73. package/variables/service-variable.js +17 -14
@@ -23,11 +23,15 @@ var _lodash = require("lodash");
23
23
  var _link = _interopRequireDefault(require("next/link"));
24
24
  var _ListItems = require("./components/ListItems");
25
25
  var _utils = require("@wavemaker/react-runtime/core/util/utils");
26
- var _excluded = ["menualign", "menuposition", "menulayout", "menuclass", "linktarget", "iconclass", "type", "animateitems", "disableMenuContext", "showonhover", "panelPosition", "autoclose", "autoopen", "hint", "arialabel", "width", "height", "iconposition", "caption", "shortcutkey", "onClick", "onSelect", "navNodes", "styles", "conditionalstyles", "className", "children", "listener", "name", "resetNavNodes", "nodes$", "dataset", "orderby", "itemlabel", "itemlink", "itemicon", "itemaction", "userrole", "itemchildren", "isactive", "displayValue", "onActionsclick", "dataPath"];
26
+ var _navigation = require("next/navigation");
27
+ var _excluded = ["menualign", "menuposition", "menulayout", "menuclass", "linktarget", "iconclass", "type", "animateitems", "disableMenuContext", "showonhover", "panelPosition", "autoclose", "autoopen", "hint", "arialabel", "width", "height", "iconposition", "caption", "shortcutkey", "onClick", "onSelect", "navNodes", "styles", "conditionalstyles", "className", "children", "listener", "name", "resetNavNodes", "nodes$", "dataset", "orderby", "itemlabel", "itemlink", "itemicon", "itemaction", "userrole", "itemchildren", "isactive", "displayValue", "onActionsclick", "dataPath", "isFromNav", "onNavItemActivate"];
27
28
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
28
29
  var __jsx = _react["default"].createElement;
29
30
  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; }
30
31
  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; }
32
+ var isPathMatchingLink = function isPathMatchingLink(path, link) {
33
+ return new RegExp(link.replace("#", "").replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "i").test(path);
34
+ };
31
35
  var hasLinkToCurrentPage = function hasLinkToCurrentPage(nodes, currentPath) {
32
36
  if (!nodes || !Array.isArray(nodes)) return false;
33
37
  return nodes.some(function (node) {
@@ -191,8 +195,11 @@ var WmMenu = /*#__PURE__*/(0, _react.memo)(function (props) {
191
195
  displayValue = props.displayValue,
192
196
  onActionsclick = props.onActionsclick,
193
197
  dataPath = props.dataPath,
198
+ _props$isFromNav = props.isFromNav,
199
+ isFromNav = _props$isFromNav === void 0 ? false : _props$isFromNav,
200
+ onNavItemActivate = props.onNavItemActivate,
194
201
  restProps = (0, _objectWithoutProperties2["default"])(props, _excluded);
195
-
202
+ var path = (0, _navigation.usePathname)();
196
203
  // State
197
204
  var _useState2 = (0, _react.useState)(false),
198
205
  open = _useState2[0],
@@ -359,9 +366,14 @@ var WmMenu = /*#__PURE__*/(0, _react.memo)(function (props) {
359
366
  setActiveItem(null);
360
367
  setFocusedIndex(-1);
361
368
  }
362
- }, [onClick, listener, name, open]);
369
+
370
+ // If menu is from nav, notify nav to activate the nav item when menu button is clicked
371
+ if (isFromNav && onNavItemActivate) {
372
+ onNavItemActivate();
373
+ }
374
+ }, [onClick, listener, name, open, isFromNav, onNavItemActivate]);
363
375
  var handleMenuItemClick = (0, _react.useCallback)(function (event, item) {
364
- var _item$dataObject, _item$dataObject2;
376
+ var _item$dataObject, _item$dataObject2, _item$dataObject3;
365
377
  var _getNodeProperties = getNodeProperties(item),
366
378
  label = _getNodeProperties.label,
367
379
  icon = _getNodeProperties.icon,
@@ -386,20 +398,26 @@ var WmMenu = /*#__PURE__*/(0, _react.memo)(function (props) {
386
398
  var simplifiedItem = {
387
399
  label: label,
388
400
  dataValue: ((_item$dataObject = item.dataObject) === null || _item$dataObject === void 0 ? void 0 : _item$dataObject.dataValue) || label,
401
+ value: ((_item$dataObject2 = item.dataObject) === null || _item$dataObject2 === void 0 ? void 0 : _item$dataObject2.dataValue) || label,
389
402
  icon: icon,
390
403
  link: link,
391
- target: (_item$dataObject2 = item.dataObject) === null || _item$dataObject2 === void 0 ? void 0 : _item$dataObject2.target
404
+ target: (_item$dataObject3 = item.dataObject) === null || _item$dataObject3 === void 0 ? void 0 : _item$dataObject3.target
392
405
  };
393
406
  if (onSelect) {
394
407
  onSelect(event, props, simplifiedItem);
395
408
  }
409
+
410
+ // If menu is from nav, notify nav to activate the nav item
411
+ if (isFromNav && onNavItemActivate) {
412
+ onNavItemActivate();
413
+ }
396
414
  if (name && listener !== null && listener !== void 0 && listener.Widgets[name]) {
397
415
  listener.Widgets[name].displayValue = label;
398
416
  }
399
417
  if (listener !== null && listener !== void 0 && listener.onChange) {
400
- listener.onChange(name, _objectSpread(_objectSpread({}, props), {}, {
418
+ listener.onChange(name, {
401
419
  datavalue: label
402
- }));
420
+ });
403
421
  }
404
422
  // Then trigger item action (executes action and/or navigates to link)
405
423
  // Use setTimeout to ensure onSelect navigation completes first, then dataset link navigation happens
@@ -410,7 +428,8 @@ var WmMenu = /*#__PURE__*/(0, _react.memo)(function (props) {
410
428
  setOpen(false);
411
429
  setFocusedIndex(-1);
412
430
  }
413
- }, [flattenedNodes, onSelect, props, name, listener, autoclose, getNodeProperties]);
431
+ onActionsclick === null || onActionsclick === void 0 || onActionsclick(event, item);
432
+ }, [flattenedNodes, onSelect, props, name, listener, autoclose, getNodeProperties, isFromNav, onNavItemActivate]);
414
433
 
415
434
  // Keyboard navigation
416
435
  var focusNode = (0, _react.useCallback)(function (index) {
@@ -562,6 +581,7 @@ var WmMenu = /*#__PURE__*/(0, _react.memo)(function (props) {
562
581
  var renderMenuItems = (0, _react.useCallback)(function (nodes) {
563
582
  if (!nodes || !Array.isArray(nodes)) return null;
564
583
  return nodes.map(function (node, index) {
584
+ var _value;
565
585
  var _getNodeProperties2 = getNodeProperties(node),
566
586
  label = _getNodeProperties2.label,
567
587
  icon = _getNodeProperties2.icon,
@@ -569,6 +589,8 @@ var WmMenu = /*#__PURE__*/(0, _react.memo)(function (props) {
569
589
  hint = _getNodeProperties2.hint,
570
590
  disabled = _getNodeProperties2.disabled,
571
591
  children = _getNodeProperties2.children;
592
+ var nodeValueLink = node === null || node === void 0 || (_value = node.value) === null || _value === void 0 ? void 0 : _value.link;
593
+ var isActive = nodeValueLink && typeof nodeValueLink === "string" ? isPathMatchingLink(path, nodeValueLink) : link ? isPathMatchingLink(path, link) : false;
572
594
  var _menuposition$split = menuposition.split(","),
573
595
  _menuposition$split2 = (0, _slicedToArray2["default"])(_menuposition$split, 2),
574
596
  verticalPos = _menuposition$split2[0],
@@ -579,7 +601,10 @@ var WmMenu = /*#__PURE__*/(0, _react.memo)(function (props) {
579
601
  return __jsx(_Box["default"], {
580
602
  component: "li",
581
603
  key: index,
582
- className: (0, _clsx["default"])(children && children.length > 0 && "dropdown-submenu", "app-menu-item", hoveredNodes.has(node) && "hovered"),
604
+ className: (0, _clsx["default"])(children && children.length > 0 && "dropdown-submenu", "app-menu-item", {
605
+ active: isActive,
606
+ hovered: hoveredNodes.has(node)
607
+ }),
583
608
  onMouseEnter: function onMouseEnter() {
584
609
  return handleNodeMouseEnter(node);
585
610
  },
@@ -592,10 +617,11 @@ var WmMenu = /*#__PURE__*/(0, _react.memo)(function (props) {
592
617
  }, __jsx(_link["default"], {
593
618
  title: label,
594
619
  className: disabled ? "disabled" : "",
595
- href: "javascript:void(0)",
620
+ href: "#",
596
621
  onClick: function onClick(event) {
597
622
  handleMenuItemClick(event, node);
598
- }
623
+ },
624
+ prefetch: false
599
625
  }, children && children.length > 0 && __jsx("span", {
600
626
  className: (0, _clsx["default"])("pull-right fa caret", _constants.menuAlignClass[menualign] || "fa-caret-right")
601
627
  }), icon && __jsx("i", {
@@ -647,6 +673,41 @@ var WmMenu = /*#__PURE__*/(0, _react.memo)(function (props) {
647
673
  }
648
674
  }
649
675
  }, [transformedDataset, autoopen]);
676
+ var notifiedPathRef = (0, _react.useRef)(null);
677
+ (0, _react.useEffect)(function () {
678
+ if (!isFromNav || !onNavItemActivate || !transformedDataset || transformedDataset.length === 0) {
679
+ return;
680
+ }
681
+
682
+ // Check if any menu item is active using the same logic as renderMenuItems
683
+ var checkIfActive = function checkIfActive(nodes) {
684
+ if (!nodes || !Array.isArray(nodes)) return false;
685
+ return nodes.some(function (node) {
686
+ var _value2;
687
+ var _getNodeProperties3 = getNodeProperties(node),
688
+ link = _getNodeProperties3.link,
689
+ children = _getNodeProperties3.children;
690
+ var nodeValueLink = node === null || node === void 0 || (_value2 = node.value) === null || _value2 === void 0 ? void 0 : _value2.link;
691
+ var isActive = nodeValueLink && typeof nodeValueLink === "string" ? isPathMatchingLink(path, nodeValueLink) : link ? isPathMatchingLink(path, link) : false;
692
+ if (isActive) return true;
693
+ if (children && children.length > 0) {
694
+ return checkIfActive(children);
695
+ }
696
+ return false;
697
+ });
698
+ };
699
+ var hasActiveItem = checkIfActive(transformedDataset);
700
+
701
+ // Notify nav if there's an active item and we haven't notified for this path yet
702
+ if (hasActiveItem && notifiedPathRef.current !== path) {
703
+ onNavItemActivate();
704
+ notifiedPathRef.current = path;
705
+ setOpen(true);
706
+ } else if (!hasActiveItem) {
707
+ // Reset when no active item found
708
+ notifiedPathRef.current = null;
709
+ }
710
+ }, [path, transformedDataset, isFromNav, onNavItemActivate, getNodeProperties]);
650
711
  (0, _react.useEffect)(function () {
651
712
  // Handle outside click for both "outsideClick" and "always" autoclose modes
652
713
  if (!open || autoclose === _constants.AUTO_CLOSE.NEVER) return;
@@ -749,7 +810,7 @@ var WmMenu = /*#__PURE__*/(0, _react.memo)(function (props) {
749
810
  enterDelay: _constants.TOOLTIP_ENTER_DELAY,
750
811
  disableHoverListener: !hint
751
812
  }, type === "anchor" ? __jsx("a", (0, _extends2["default"])({
752
- className: (0, _clsx["default"])("dropdown-toggle app-anchor", "icon-position-".concat(iconposition)),
813
+ className: (0, _clsx["default"])("dropdown-toggle app-anchor"),
753
814
  "icon-position": "left",
754
815
  role: "button",
755
816
  onClick: handleMenuClick,
@@ -65,6 +65,8 @@ var WmPopover = function WmPopover(Props) {
65
65
  }
66
66
  };
67
67
  var handleClick = function handleClick(event) {
68
+ event.preventDefault();
69
+ event.stopPropagation();
68
70
  if (anchorEl) {
69
71
  if (isDialogOpen) {
70
72
  var _props$onHide;
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ "use client";
2
3
 
3
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
5
  Object.defineProperty(exports, "__esModule", {
@@ -9,20 +9,23 @@ exports["default"] = void 0;
9
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
10
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
11
  var _react = _interopRequireWildcard(require("react"));
12
- var _excluded = ["styles", "onLoad", "onDestroy", "children"];
12
+ var _excluded = ["styles", "onLoad", "onDestroy", "children", "className"];
13
13
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
14
14
  var __jsx = _react["default"].createElement;
15
+ var timeoutId = null;
15
16
  var WmPrefabContainer = function WmPrefabContainer(props) {
17
+ var DEFAULT_CLASS = "app-prefab-container full-height";
16
18
  var styles = props.styles,
17
19
  onLoad = props.onLoad,
18
20
  onDestroy = props.onDestroy,
19
21
  children = props.children,
22
+ className = props.className,
20
23
  rest = (0, _objectWithoutProperties2["default"])(props, _excluded);
21
24
  var loadedRef = (0, _react.useRef)(false);
22
25
  var ref = (0, _react.useRef)(null);
23
26
  (0, _react.useEffect)(function () {
24
27
  if (onLoad && !loadedRef.current) {
25
- setTimeout(function () {
28
+ timeoutId = setTimeout(function () {
26
29
  onLoad(Event, {
27
30
  ref: ref.current
28
31
  });
@@ -35,12 +38,16 @@ var WmPrefabContainer = function WmPrefabContainer(props) {
35
38
  ref: ref.current
36
39
  });
37
40
  }
41
+ if (timeoutId) {
42
+ clearTimeout(timeoutId);
43
+ }
38
44
  };
39
45
  }, [onLoad, onDestroy]);
40
46
  return __jsx("div", (0, _extends2["default"])({
41
47
  style: styles
42
48
  }, rest, {
43
- ref: ref
49
+ ref: ref,
50
+ className: className || DEFAULT_CLASS
44
51
  }), children);
45
52
  };
46
53
  var _default = exports["default"] = WmPrefabContainer;
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ "use client";
2
3
 
3
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
5
  var _typeof = require("@babel/runtime/helpers/typeof");
@@ -5,7 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.usePrefabContext = exports["default"] = void 0;
8
+ exports["default"] = void 0;
9
9
  var _react = _interopRequireWildcard(require("react"));
10
10
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
11
  var _lodash = require("lodash");
@@ -14,11 +14,9 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
14
14
  var __jsx = _react["default"].createElement;
15
15
  var PrefabContext = /*#__PURE__*/(0, _react.createContext)({
16
16
  inbound: {},
17
- outbound: {}
17
+ outbound: {},
18
+ prefabName: ""
18
19
  });
19
- var usePrefabContext = exports.usePrefabContext = function usePrefabContext() {
20
- return (0, _react.useContext)(PrefabContext);
21
- };
22
20
  var getChangedKeys = function getChangedKeys(prev, curr) {
23
21
  var changes = [];
24
22
  var keys = new Set([].concat((0, _toConsumableArray2["default"])(Object.keys(prev)), (0, _toConsumableArray2["default"])(Object.keys(curr))));
@@ -27,13 +25,21 @@ var getChangedKeys = function getChangedKeys(prev, curr) {
27
25
  if (ignoredKeys.includes(key)) {
28
26
  return;
29
27
  }
30
- // Skip functions - we only want to track value changes
28
+ // Handle functions - compare their definitions to avoid unnecessary renders
31
29
  var prevValue = prev[key];
32
30
  var currValue = curr[key];
33
- if (typeof prevValue === "function" || typeof currValue === "function") {
31
+ if (typeof prevValue === "function" && typeof currValue === "function") {
32
+ // Compare function definitions instead of function instances
33
+ if (prevValue.toString() !== currValue.toString() && prevValue === undefined && currValue !== undefined) {
34
+ changes.push({
35
+ key: key,
36
+ oldValue: prevValue,
37
+ newValue: currValue
38
+ });
39
+ }
34
40
  return;
35
41
  }
36
- if (!(0, _lodash.isEqual)(prevValue, currValue)) {
42
+ if (!(0, _lodash.isEqual)(prevValue, currValue) && currValue !== undefined && currValue !== null) {
37
43
  changes.push({
38
44
  key: key,
39
45
  oldValue: prevValue,
@@ -46,19 +52,138 @@ var getChangedKeys = function getChangedKeys(prev, curr) {
46
52
  var PrefabProvider = function PrefabProvider(_ref) {
47
53
  var Context = _ref.value,
48
54
  children = _ref.children;
49
- var prevInboundRef = (0, _react.useRef)(Context.inbound);
50
55
  var prevOutboundRef = (0, _react.useRef)(Context.outbound);
56
+ var pendingChangesRef = (0, _react.useRef)([]);
57
+ var retryCountRef = (0, _react.useRef)(0);
58
+ var isInitialMountRef = (0, _react.useRef)(true);
59
+ var maxRetries = 20;
60
+ var initialMountMaxRetries = 30;
61
+ var rafIdRef = (0, _react.useRef)(null);
51
62
  (0, _react.useEffect)(function () {
52
63
  var currInbound = Context.inbound;
64
+ if ((0, _lodash.isEqual)(prevOutboundRef.current, currInbound)) {
65
+ return;
66
+ }
67
+
68
+ // Fix: Compare prevInboundRef.current with currInbound, not prevOutboundRef
53
69
  var inboundChanges = getChangedKeys(prevOutboundRef.current, currInbound);
70
+
71
+ // Update ref for next comparison
54
72
  prevOutboundRef.current = currInbound;
55
73
  if (inboundChanges.length > 0) {
56
- setTimeout(function () {
57
- _events.EVENTEMITTER_METHODS.PREFAB_STATE_SYNC_EMIT(inboundChanges);
58
- }, 1000);
74
+ // Merge new changes with pending changes (deduplicate by key)
75
+ var changeMap = new Map();
76
+
77
+ // Add existing pending changes first
78
+ pendingChangesRef.current.forEach(function (change) {
79
+ changeMap.set(change.key, change);
80
+ });
81
+
82
+ // Overwrite with new changes (they're more recent)
83
+ inboundChanges.forEach(function (change) {
84
+ changeMap.set(change.key, change);
85
+ });
86
+ pendingChangesRef.current = Array.from(changeMap.values());
87
+ retryCountRef.current = 0;
88
+
89
+ // Cancel any pending RAF
90
+ if (rafIdRef.current !== null) {
91
+ cancelAnimationFrame(rafIdRef.current);
92
+ }
93
+
94
+ // Try to emit with retry mechanism
95
+ var tryEmit = function tryEmit() {
96
+ // Convert array to object format that BasePage expects: {0: change1, 1: change2, ...}
97
+ var changesAsObject = {};
98
+ pendingChangesRef.current.forEach(function (change, index) {
99
+ changesAsObject[index] = change;
100
+ });
101
+
102
+ // Emit the event
103
+ // Note: EventEmitter.emit returns true if there are listeners, false otherwise
104
+ var hasListeners = _events.EVENTEMITTER_METHODS.PREFAB_STATE_SYNC_EMIT(Context.prefabName, changesAsObject);
105
+
106
+ // Determine max retries based on whether this is initial mount
107
+ var currentMaxRetries = isInitialMountRef.current ? initialMountMaxRetries : maxRetries;
108
+
109
+ // If no listeners were registered and we haven't exceeded max retries, retry
110
+ if (!hasListeners && retryCountRef.current < currentMaxRetries) {
111
+ retryCountRef.current += 1;
112
+
113
+ // On initial mount, use more RAF cycles for slower machines
114
+ var rafCycles = isInitialMountRef.current ? 10 : 5;
115
+ var rafChain = tryEmit;
116
+ var _loop = function _loop() {
117
+ var next = rafChain;
118
+ rafChain = function rafChain() {
119
+ rafIdRef.current = requestAnimationFrame(function () {
120
+ next();
121
+ });
122
+ };
123
+ };
124
+ for (var i = 0; i < rafCycles; i++) {
125
+ _loop();
126
+ }
127
+ rafChain();
128
+ } else {
129
+ // Successfully emitted (listeners received it) or max retries reached
130
+ if (hasListeners) {
131
+ // Success! Mark as no longer initial mount after first successful emission
132
+ isInitialMountRef.current = false;
133
+ } else {
134
+ // Max retries reached but no listeners found
135
+ // This could happen if BasePage is taking longer than expected
136
+ // Reset the flag to allow normal retry behavior for future updates
137
+ // This prevents being stuck in initial mount mode indefinitely
138
+ isInitialMountRef.current = false;
139
+ console.warn("PrefabContext: Max retries reached without finding listeners. " + "BasePage may not be ready yet. Future updates will use normal retry behavior.");
140
+ }
141
+ pendingChangesRef.current = [];
142
+ retryCountRef.current = 0;
143
+ rafIdRef.current = null;
144
+ }
145
+ };
146
+
147
+ // Start emission process: wait for React commit, then BasePage initialization
148
+ // Use more RAF cycles on initial mount (hard reload scenarios)
149
+ var initialRafCycles = isInitialMountRef.current ? 5 : 3;
150
+ queueMicrotask(function () {
151
+ // Build RAF chain: each cycle waits for the next frame
152
+ var rafChain = tryEmit;
153
+ var _loop2 = function _loop2() {
154
+ var next = rafChain;
155
+ rafChain = function rafChain() {
156
+ rafIdRef.current = requestAnimationFrame(function () {
157
+ next();
158
+ });
159
+ };
160
+ };
161
+ for (var i = 0; i < initialRafCycles; i++) {
162
+ _loop2();
163
+ }
164
+
165
+ // Start the chain
166
+ rafChain();
167
+ });
59
168
  }
60
- prevInboundRef.current = currInbound;
61
169
  }, [Context.inbound]);
170
+
171
+ // Cleanup RAF on unmount and reset state on remount
172
+ (0, _react.useEffect)(function () {
173
+ return function () {
174
+ // Cancel any pending RAF operations
175
+ if (rafIdRef.current !== null) {
176
+ cancelAnimationFrame(rafIdRef.current);
177
+ rafIdRef.current = null;
178
+ }
179
+ // Reset state for clean remount
180
+ pendingChangesRef.current = [];
181
+ retryCountRef.current = 0;
182
+ // Reset initial mount flag on unmount so next mount starts fresh
183
+ // This ensures proper behavior if component unmounts and remounts
184
+ isInitialMountRef.current = true;
185
+ };
186
+ }, []);
62
187
  return __jsx(PrefabContext.Provider, {
63
188
  value: Context
64
189
  }, children);
@@ -120,7 +120,7 @@ var WidgetProvider = exports.WidgetProvider = function WidgetProvider(_ref) {
120
120
  var debouncedEmitRef = (0, _react.useRef)((0, _debounce["default"])(function (partialName, context) {
121
121
  _events.EVENTEMITTER_METHODS.PARTIAL_STATE_SYNC_EMIT({
122
122
  partialName: partialName,
123
- pageContext: pageContextRef.current
123
+ pageContext: context
124
124
  });
125
125
  }, 100));
126
126
 
@@ -148,7 +148,7 @@ var WidgetProvider = exports.WidgetProvider = function WidgetProvider(_ref) {
148
148
  */
149
149
  (0, _react.useEffect)(function () {
150
150
  if (isPage || !partialName) return;
151
- debouncedEmitRef.current(partialName, pageContext);
151
+ debouncedEmitRef.current(partialName, proxy);
152
152
  }, [isPage, partialName, pageContext]);
153
153
  return __jsx(_useHttp.HttpProvider, null, __jsx(WidgetContext.Provider, {
154
154
  value: contextValue
@@ -13,14 +13,20 @@ var EVENTEMITTER = {
13
13
  PREFAB_STATE_SYNC: "prefab-state-sync"
14
14
  };
15
15
  var EVENTEMITTER_METHODS = exports.EVENTEMITTER_METHODS = {
16
- PREFAB_STATE_SYNC_ON: function PREFAB_STATE_SYNC_ON(callback) {
17
- return prefabStateSyncEmitter.on(EVENTEMITTER.PREFAB_STATE_SYNC, callback);
16
+ PREFAB_STATE_SYNC_ON: function PREFAB_STATE_SYNC_ON() {
17
+ var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
18
+ var callback = arguments.length > 1 ? arguments[1] : undefined;
19
+ return prefabStateSyncEmitter.on(EVENTEMITTER.PREFAB_STATE_SYNC + (name ? "_" + name : ""), callback);
18
20
  },
19
- PREFAB_STATE_SYNC_OFF: function PREFAB_STATE_SYNC_OFF(callback) {
20
- return prefabStateSyncEmitter.off(EVENTEMITTER.PREFAB_STATE_SYNC, callback);
21
+ PREFAB_STATE_SYNC_OFF: function PREFAB_STATE_SYNC_OFF() {
22
+ var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
23
+ var callback = arguments.length > 1 ? arguments[1] : undefined;
24
+ return prefabStateSyncEmitter.off(EVENTEMITTER.PREFAB_STATE_SYNC + (name ? "_" + name : ""), callback);
21
25
  },
22
- PREFAB_STATE_SYNC_EMIT: function PREFAB_STATE_SYNC_EMIT(data) {
23
- return prefabStateSyncEmitter.emit(EVENTEMITTER.PREFAB_STATE_SYNC, data);
26
+ PREFAB_STATE_SYNC_EMIT: function PREFAB_STATE_SYNC_EMIT() {
27
+ var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
28
+ var data = arguments.length > 1 ? arguments[1] : undefined;
29
+ return prefabStateSyncEmitter.emit(EVENTEMITTER.PREFAB_STATE_SYNC + (name ? "_" + name : ""), data);
24
30
  },
25
31
  PARTIAL_STATE_SYNC_ON: function PARTIAL_STATE_SYNC_ON(callback) {
26
32
  return partialStateSyncEmitter.on(EVENTEMITTER.PARTIAL_STATE_SYNC, callback);
@@ -8,18 +8,13 @@ var ROUTING_BASEPATH = exports.ROUTING_BASEPATH = "react-pages";
8
8
  var hyperLinkMofify = exports.hyperLinkMofify = function hyperLinkMofify(link) {
9
9
  var hrefLink = "#";
10
10
  if (link) {
11
- if (link.startsWith("#")) {
12
- hrefLink = "/".concat(ROUTING_BASEPATH, "/") + link.substring(1);
13
- } else if (link.startsWith("/")) {
14
- // Check if basepath is already included to avoid duplication
15
- if (link.startsWith("/".concat(ROUTING_BASEPATH))) {
16
- hrefLink = link;
17
- } else {
18
- // Add basepath to relative URLs
19
- hrefLink = "/".concat(ROUTING_BASEPATH).concat(link);
20
- }
11
+ var baseRegex = new RegExp("^/".concat(ROUTING_BASEPATH, "(/|$)"));
12
+ if (/^#/.test(link)) {
13
+ var suffix = link.replace(/^#/, "");
14
+ hrefLink = /^\/.*/.test(suffix) ? "/".concat(ROUTING_BASEPATH).concat(suffix) : "/".concat(ROUTING_BASEPATH, "/").concat(suffix);
15
+ } else if (/^\//.test(link)) {
16
+ hrefLink = baseRegex.test(link) ? link : "/".concat(ROUTING_BASEPATH).concat(link);
21
17
  } else {
22
- // Use link as is for absolute URLs
23
18
  hrefLink = link;
24
19
  }
25
20
  }
@@ -36,7 +36,7 @@ var CurrencyFormatter = exports.CurrencyFormatter = /*#__PURE__*/function () {
36
36
  key: "format",
37
37
  value: function format(data, currencySymbol, fracSize) {
38
38
  var _currencySymbol = (_currencyConstant["default"][currencySymbol] || {}).symbol || currencySymbol || "";
39
- var _val = new NumberToStringFormatter().format(data, fracSize);
39
+ var _val = new NumberToStringFormatter().format(data || 0, fracSize);
40
40
  var isNegativeNumber = _val.startsWith("-");
41
41
  if (isNegativeNumber) {
42
42
  _val = _val.replace("-", "");