@wavemaker-ai/react-runtime 1.0.0-rc.322 → 1.0.0-rc.326

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 (258) hide show
  1. package/actions/login-action.js +1 -1
  2. package/components/advanced/carousel/index.d.ts +1 -0
  3. package/components/advanced/carousel/template.d.ts +1 -0
  4. package/components/advanced/login/index.d.ts +1 -0
  5. package/components/advanced/marquee/index.d.ts +1 -0
  6. package/components/basic/anchor/index.d.ts +1 -0
  7. package/components/basic/anchor/index.js +19 -14
  8. package/components/basic/audio/index.d.ts +1 -0
  9. package/components/basic/html/index.d.ts +1 -0
  10. package/components/basic/icon/index.d.ts +1 -0
  11. package/components/basic/icon/index.js +13 -16
  12. package/components/basic/iframe/index.d.ts +1 -0
  13. package/components/basic/label/index.d.ts +1 -0
  14. package/components/basic/label/index.js +5 -3
  15. package/components/basic/label/props.d.ts +1 -1
  16. package/components/basic/picture/index.d.ts +1 -0
  17. package/components/basic/picture/index.js +3 -2
  18. package/components/basic/progress-bar/index.d.ts +1 -0
  19. package/components/basic/progress-circle/index.d.ts +1 -0
  20. package/components/basic/richtexteditor/index.d.ts +2 -0
  21. package/components/basic/search/index.d.ts +6 -0
  22. package/components/basic/search/index.js +69 -9
  23. package/components/basic/search/props.d.ts +4 -0
  24. package/components/basic/spinner/index.d.ts +2 -0
  25. package/components/basic/spinner/index.js +11 -9
  26. package/components/basic/spinner/props.d.ts +5 -0
  27. package/components/basic/tile/index.d.ts +1 -0
  28. package/components/basic/tree/index.d.ts +1 -0
  29. package/components/basic/video/index.d.ts +1 -0
  30. package/components/chart/index.d.ts +2 -0
  31. package/components/chart/props.d.ts +1 -0
  32. package/components/chart/src/chart.js +12 -1
  33. package/components/chart/src/types.d.ts +2 -0
  34. package/components/common/WmAppIcon/index.d.ts +15 -0
  35. package/components/common/WmAppIcon/index.js +130 -0
  36. package/components/common/WmAppIcon/props.d.ts +17 -0
  37. package/components/common/WmAppIcon/props.js +0 -0
  38. package/components/common/index.d.ts +3 -1
  39. package/components/common/index.js +10 -2
  40. package/components/common/wm-skeleton.d.ts +7 -0
  41. package/components/common/wm-skeleton.js +11 -1
  42. package/components/container/accordion/accordion-pane/index.d.ts +2 -0
  43. package/components/container/accordion/accordion-pane/index.js +10 -1
  44. package/components/container/accordion/accordion-pane/props.d.ts +1 -0
  45. package/components/container/accordion/index.d.ts +1 -0
  46. package/components/container/accordion/index.js +2 -2
  47. package/components/container/index.d.ts +1 -0
  48. package/components/container/index.js +6 -1
  49. package/components/container/layout-grid/grid-column/index.d.ts +1 -0
  50. package/components/container/layout-grid/grid-row/index.d.ts +1 -0
  51. package/components/container/layout-grid/grid-row/index.js +1 -1
  52. package/components/container/layout-grid/index.d.ts +1 -0
  53. package/components/container/linear-layout/index.d.ts +1 -0
  54. package/components/container/linear-layout/linear-layout-item/index.d.ts +1 -0
  55. package/components/container/panel/components/panel-header/index.js +16 -16
  56. package/components/container/panel/index.d.ts +1 -0
  57. package/components/container/repeat-template/index.d.ts +1 -0
  58. package/components/container/tabs/index.d.ts +1 -0
  59. package/components/container/tabs/index.js +18 -18
  60. package/components/container/tabs/props.d.ts +1 -0
  61. package/components/container/tabs/tab-pane/index.d.ts +2 -0
  62. package/components/container/tabs/tab-pane/index.js +2 -0
  63. package/components/container/tabs/tab-pane/props.d.ts +1 -0
  64. package/components/container/wizard/components/StepComponents.js +14 -6
  65. package/components/container/wizard/index.d.ts +2 -0
  66. package/components/container/wizard/index.js +2 -2
  67. package/components/container/wizard/props.d.ts +4 -0
  68. package/components/container/wizard/wizard-step/index.d.ts +1 -0
  69. package/components/container/wizard/wizard-step/index.js +6 -0
  70. package/components/data/card/card-actions/index.d.ts +1 -0
  71. package/components/data/card/card-content/index.d.ts +1 -0
  72. package/components/data/card/card-footer/index.d.ts +1 -0
  73. package/components/data/card/index.d.ts +1 -0
  74. package/components/data/card/index.js +13 -6
  75. package/components/data/form/base-form/hooks/useFormSubmission.d.ts +1 -1
  76. package/components/data/form/base-form/hooks/useFormSubmission.js +3 -1
  77. package/components/data/form/base-form/index.js +11 -14
  78. package/components/data/form/base-form/props.d.ts +3 -0
  79. package/components/data/form/dynamic-fields/index.js +1 -0
  80. package/components/data/form/form-action/index.d.ts +2 -0
  81. package/components/data/form/form-action/index.js +6 -4
  82. package/components/data/form/form-controller/withFormController.js +19 -2
  83. package/components/data/form/form-field/base-field.js +8 -5
  84. package/components/data/form/form-field/index.js +14 -9
  85. package/components/data/form/form-field/props.d.ts +1 -0
  86. package/components/data/form/form-header/index.d.ts +1 -1
  87. package/components/data/form/form-header/index.js +10 -1
  88. package/components/data/form/index.js +5 -3
  89. package/components/data/form/props.d.ts +1 -0
  90. package/components/data/list/components/ListHeader.js +19 -3
  91. package/components/data/list/components/ListItemWithTemplate.js +10 -3
  92. package/components/data/list/components/ListItems.d.ts +1 -1
  93. package/components/data/list/components/ListItems.js +5 -1
  94. package/components/data/list/components/LoadMoreButton.js +14 -2
  95. package/components/data/list/components/StandardListItems.js +1 -1
  96. package/components/data/list/components/props.d.ts +11 -5
  97. package/components/data/list/hooks/props.d.ts +2 -2
  98. package/components/data/list/hooks/useListEffects.js +1 -1
  99. package/components/data/list/hooks/useListEventHandlers.js +3 -2
  100. package/components/data/list/index.d.ts +5 -1
  101. package/components/data/list/index.js +28 -7
  102. package/components/data/list/props.d.ts +14 -2
  103. package/components/data/list/utils/constants.d.ts +0 -1
  104. package/components/data/list/utils/constants.js +0 -2
  105. package/components/data/list/utils/list-helpers.d.ts +5 -1
  106. package/components/data/list/utils/list-helpers.js +10 -0
  107. package/components/data/pagination/components/PageSizeSelector.js +49 -155
  108. package/components/data/pagination/hooks/usePagination.js +24 -1
  109. package/components/data/table/components/RowCells.js +18 -4
  110. package/components/data/table/components/TableBody.js +5 -3
  111. package/components/data/table/components/TableDataRow.js +16 -3
  112. package/components/data/table/components/TableHeader.js +10 -8
  113. package/components/data/table/components/TablePanelHeading.js +15 -3
  114. package/components/data/table/hooks/useDynamicColumns.js +1 -1
  115. package/components/data/table/hooks/useResponsiveColumns.d.ts +1 -0
  116. package/components/data/table/hooks/useRowExpansion.js +41 -31
  117. package/components/data/table/hooks/useRowHandlers.js +0 -1
  118. package/components/data/table/hooks/useServerSideSorting.js +0 -1
  119. package/components/data/table/hooks/useTableColumns.js +17 -9
  120. package/components/data/table/hooks/useTableData.js +30 -2
  121. package/components/data/table/hooks/useTableEdit.js +0 -1
  122. package/components/data/table/index.d.ts +4 -0
  123. package/components/data/table/index.js +93 -47
  124. package/components/data/table/live-table/index.d.ts +1 -0
  125. package/components/data/table/live-table/index.js +0 -1
  126. package/components/data/table/props.d.ts +15 -2
  127. package/components/data/table/table-action/index.d.ts +1 -0
  128. package/components/data/table/table-column/index.d.ts +1 -0
  129. package/components/data/table/table-row/index.d.ts +1 -0
  130. package/components/data/table/table-row-action/index.d.ts +1 -0
  131. package/components/data/table/utils/buildSelectionColumns.d.ts +1 -1
  132. package/components/data/table/utils/buildSelectionColumns.js +95 -71
  133. package/components/data/table/utils/columnBuilder.d.ts +29 -2
  134. package/components/data/table/utils/columnBuilder.js +40 -26
  135. package/components/data/table/utils/columnWidthDistribution.d.ts +1 -1
  136. package/components/data/table/utils/columnWidthDistribution.js +14 -1
  137. package/components/data/table/utils/constants.d.ts +0 -4
  138. package/components/data/table/utils/constants.js +0 -7
  139. package/components/data/table/utils/dynamic-columns.d.ts +1 -1
  140. package/components/data/table/utils/dynamic-columns.js +3 -8
  141. package/components/data/table/utils/expansionColumn.d.ts +23 -0
  142. package/components/data/table/utils/expansionColumn.js +56 -0
  143. package/components/data/table/utils/index.d.ts +14 -2
  144. package/components/data/table/utils/index.js +45 -19
  145. package/components/dialogs/alert-dialog/index.d.ts +2 -0
  146. package/components/dialogs/confirm-dialog/index.d.ts +2 -0
  147. package/components/dialogs/dialog/index.d.ts +2 -0
  148. package/components/dialogs/dialog/index.js +3 -2
  149. package/components/dialogs/dialog-actions/index.d.ts +1 -0
  150. package/components/dialogs/dialog-body/index.d.ts +1 -0
  151. package/components/dialogs/dialog-content/index.d.ts +1 -0
  152. package/components/dialogs/dialog-header/index.d.ts +1 -0
  153. package/components/dialogs/dialog-header/index.js +11 -12
  154. package/components/dialogs/iframe-dialog/index.d.ts +2 -0
  155. package/components/dialogs/login-dialog/index.d.ts +4 -0
  156. package/components/dialogs/login-dialog/index.js +2 -1
  157. package/components/dialogs/login-dialog/props.d.ts +1 -0
  158. package/components/dialogs/page-dialog/index.d.ts +4 -0
  159. package/components/dialogs/page-dialog/index.js +2 -1
  160. package/components/dialogs/page-dialog/props.d.ts +1 -0
  161. package/components/form/button/index.d.ts +1 -0
  162. package/components/form/button/index.js +29 -33
  163. package/components/form/button-group/index.d.ts +1 -0
  164. package/components/input/calendar/index.d.ts +2 -0
  165. package/components/input/chips/index.d.ts +2 -0
  166. package/components/input/chips/index.js +9 -3
  167. package/components/input/chips/utils.d.ts +5 -0
  168. package/components/input/chips/utils.js +29 -0
  169. package/components/input/color-picker/index.d.ts +2 -0
  170. package/components/input/composite/index.d.ts +1 -0
  171. package/components/input/composite/index.js +1 -0
  172. package/components/input/currency/index.d.ts +2 -0
  173. package/components/input/default/checkbox/index.d.ts +6 -0
  174. package/components/input/default/checkbox/index.js +48 -18
  175. package/components/input/default/checkbox/props.d.ts +8 -0
  176. package/components/input/default/checkboxset/index.d.ts +2 -0
  177. package/components/input/default/radioset/index.d.ts +2 -0
  178. package/components/input/default/radioset/index.js +2 -1
  179. package/components/input/default/switch/index.d.ts +6 -0
  180. package/components/input/default/switch/index.js +36 -9
  181. package/components/input/default/switch/prop.d.ts +2 -0
  182. package/components/input/epoch/date/index.d.ts +1 -0
  183. package/components/input/epoch/datetime/index.d.ts +1 -0
  184. package/components/input/epoch/time/index.d.ts +1 -0
  185. package/components/input/fileupload/components/ListItems.d.ts +5 -1
  186. package/components/input/fileupload/components/ListItems.js +27 -5
  187. package/components/input/fileupload/components/MultiUpload.js +12 -1
  188. package/components/input/fileupload/components/SingleUpload.js +12 -1
  189. package/components/input/fileupload/index.d.ts +3 -0
  190. package/components/input/fileupload/index.js +11 -0
  191. package/components/input/fileupload/props.d.ts +10 -0
  192. package/components/input/number/index.d.ts +2 -0
  193. package/components/input/rating/index.d.ts +6 -0
  194. package/components/input/rating/index.js +10 -5
  195. package/components/input/rating/props.d.ts +8 -0
  196. package/components/input/select/index.d.ts +2 -0
  197. package/components/input/select/index.js +1 -2
  198. package/components/input/slider/index.d.ts +6 -0
  199. package/components/input/slider/index.js +19 -2
  200. package/components/input/slider/props.d.ts +2 -0
  201. package/components/input/text/index.d.ts +7 -1
  202. package/components/input/text/index.js +25 -6
  203. package/components/input/text/props.d.ts +8 -0
  204. package/components/input/textarea/index.d.ts +2 -0
  205. package/components/input/textarea/index.js +10 -5
  206. package/components/input/textarea/util.d.ts +1 -0
  207. package/components/input/textarea/util.js +17 -0
  208. package/components/input/upload/index.d.ts +2 -0
  209. package/components/navbar/index.d.ts +7 -0
  210. package/components/navbar/index.js +21 -7
  211. package/components/navbar/nav/index.d.ts +1 -0
  212. package/components/navbar/nav-item/index.d.ts +1 -0
  213. package/components/navigation/breadcrumb/index.d.ts +1 -0
  214. package/components/navigation/menu/index.d.ts +3 -1
  215. package/components/navigation/menu/index.js +22 -4
  216. package/components/navigation/menu/props.d.ts +1 -0
  217. package/components/navigation/popover/index.d.ts +1 -0
  218. package/components/navigation/popover/index.js +23 -9
  219. package/components/page/index.js +1 -1
  220. package/components/page/page-content/index.js +6 -2
  221. package/components/page/partial/index.d.ts +1 -0
  222. package/components/page/partial-container/index.js +2 -1
  223. package/components/prefab/index.js +3 -2
  224. package/components/prefab/props.d.ts +1 -0
  225. package/context/WidgetProvider.js +2 -1
  226. package/core/appstore.d.ts +10 -0
  227. package/core/appstore.js +9 -1
  228. package/core/constants/events.d.ts +3 -0
  229. package/core/constants/events.js +13 -1
  230. package/core/proxy-service.d.ts +1 -0
  231. package/core/proxy-service.js +54 -3
  232. package/core/util/index.d.ts +2 -0
  233. package/core/util/index.js +32 -1
  234. package/higherOrder/BasePage.js +106 -30
  235. package/higherOrder/props.d.ts +1 -0
  236. package/higherOrder/useActivePageReactivity.d.ts +21 -0
  237. package/higherOrder/useActivePageReactivity.js +57 -0
  238. package/higherOrder/withBaseWrapper.js +11 -7
  239. package/higherOrder/withRenderLogger.d.ts +15 -0
  240. package/higherOrder/withRenderLogger.js +53 -0
  241. package/hooks/useAuth.js +7 -1
  242. package/package-lock.json +273 -263
  243. package/package.json +4 -3
  244. package/runtime-dynamic/components/partial-content.js +3 -1
  245. package/runtime-dynamic/factories/dynamic-component.js +44 -8
  246. package/runtime-dynamic/factories/utils.js +7 -1
  247. package/runtime-dynamic/services/compile-render.js +2 -1
  248. package/runtime-dynamic/services/css-scoping.d.ts +2 -0
  249. package/runtime-dynamic/services/css-scoping.js +39 -20
  250. package/store/slices/i18nSlice.d.ts +2 -0
  251. package/store/slices/i18nSlice.js +3 -1
  252. package/types/index.d.ts +6 -0
  253. package/utils/attr.js +4 -1
  254. package/utils/custom-expression/parser.js +11 -8
  255. package/utils/svg-icon.d.ts +27 -0
  256. package/utils/svg-icon.js +75 -0
  257. package/utils/transformedDataset-utils.d.ts +3 -3
  258. package/utils/transformedDataset-utils.js +1 -2
@@ -1,4 +1,5 @@
1
1
  import get from "lodash-es/get";
2
+ import has from "lodash-es/has";
2
3
  import { store } from "../../store";
3
4
  import { isArray, isObject, isString } from "lodash-es";
4
5
  const VALIDATOR = {
@@ -89,8 +90,37 @@ const getTimezone = () => {
89
90
  return timezone || "UTC";
90
91
  };
91
92
  const formatMessage = (fragment, expression) => {
92
- return get(fragment, `appLocale.${expression}`, expression);
93
+ const path = `appLocale.${expression}`;
94
+ return has(fragment, path) ? get(fragment, path) : void 0;
93
95
  };
96
+ function syncLocaleMessages(target, messages) {
97
+ if (!target || typeof target !== "object") {
98
+ return false;
99
+ }
100
+ let synced = true;
101
+ Object.keys(target).forEach((key) => {
102
+ if (!(key in messages)) {
103
+ try {
104
+ delete target[key];
105
+ } catch (e) {
106
+ synced = false;
107
+ }
108
+ }
109
+ });
110
+ Object.keys(messages).forEach((key) => {
111
+ try {
112
+ const descriptor = Object.getOwnPropertyDescriptor(target, key);
113
+ if (descriptor && !descriptor.configurable && !descriptor.writable) {
114
+ synced = false;
115
+ return;
116
+ }
117
+ target[key] = messages[key];
118
+ } catch (e) {
119
+ synced = false;
120
+ }
121
+ });
122
+ return synced;
123
+ }
94
124
  function reload() {
95
125
  window.location.reload();
96
126
  }
@@ -186,6 +216,7 @@ export {
186
216
  reload,
187
217
  replace,
188
218
  setSessionStorageItem,
219
+ syncLocaleMessages,
189
220
  toBoolean,
190
221
  toNumber
191
222
  };
@@ -35,7 +35,10 @@ import { redirectToLogin } from "../store/slices/authSlice";
35
35
  import {
36
36
  VariableEvents
37
37
  } from "../types";
38
- import { createStateProxy } from "../core/proxy-service";
38
+ import {
39
+ clearPageWidgetProxyCache,
40
+ createStateProxy
41
+ } from "../core/proxy-service";
39
42
  import {
40
43
  accordionExpansionHandler,
41
44
  mergeVariablesAndActions,
@@ -49,6 +52,7 @@ import {
49
52
  } from "../core/script-registry";
50
53
  import formatters from "../core/formatters";
51
54
  import { useAppProxy } from "../context/AppContext";
55
+ import { syncLocaleMessages } from "../core/util";
52
56
  import {
53
57
  computeMergedPageParams,
54
58
  computePartialParamKey,
@@ -57,12 +61,13 @@ import {
57
61
  import { useAppSpinner } from "../context/AppSpinnerProvider";
58
62
  import get from "lodash-es/get";
59
63
  import { EVENTEMITTER_METHODS } from "../core/constants/events";
64
+ import { useActivePageReactivity } from "./useActivePageReactivity";
60
65
  import { wrapWithThirdPartyErrorGuard } from "../utils/lib-error-skipper";
61
66
  import { viewportService } from "../store/viewport.service";
62
67
  import { formatMessage } from "../core/util";
63
68
  const withPageContext = (WrappedComponent, addPageScript, getVariables, componentInfo, prefabInfo) => {
64
69
  const PageContextComponent = (props) => {
65
- var _a, _b, _c;
70
+ var _a, _b, _c, _d, _e, _f;
66
71
  const dispatch = useAppDispatch();
67
72
  const { show, hide } = (_a = useAppSpinner()) != null ? _a : {};
68
73
  const i18n = useAppSelector((state) => state.i18n);
@@ -112,6 +117,8 @@ const withPageContext = (WrappedComponent, addPageScript, getVariables, componen
112
117
  const subscribedVariableNamesRef = useRef(/* @__PURE__ */ new Set());
113
118
  const overriddenPropsRegistryRef = useRef(null);
114
119
  const onStartupCompletedRef = useRef(false);
120
+ const lastSyncedLocaleRevisionRef = useRef(-1);
121
+ const appliedLocaleRef = useRef(void 0);
115
122
  const [isPageReady, setIsPageReady] = useState(false);
116
123
  const pageReady = useCallback(() => {
117
124
  setIsPageReady(true);
@@ -140,7 +147,8 @@ const withPageContext = (WrappedComponent, addPageScript, getVariables, componen
140
147
  date: i18n.dateFormat,
141
148
  time: i18n.timeFormat,
142
149
  currency: i18n.currencyCode
143
- }
150
+ },
151
+ i18n
144
152
  }, prefabInfo), props), componentInfo), {
145
153
  executeStartup,
146
154
  formatters,
@@ -150,7 +158,18 @@ const withPageContext = (WrappedComponent, addPageScript, getVariables, componen
150
158
  layoutReady,
151
159
  activePageName: componentInfo == null ? void 0 : componentInfo.componentName
152
160
  }));
153
- const initialAppConfig = useMemo(() => appContext, [appContext]);
161
+ useActivePageReactivity({
162
+ componentType: componentInfo == null ? void 0 : componentInfo.componentType,
163
+ appProxy,
164
+ setPageContext,
165
+ isMountedRef,
166
+ activePageDeps: componentInfo == null ? void 0 : componentInfo.activePageDeps
167
+ });
168
+ useEffect(() => {
169
+ if ((componentInfo == null ? void 0 : componentInfo.componentType) === "PAGE" && (appProxy == null ? void 0 : appProxy.activePageName) === (componentInfo == null ? void 0 : componentInfo.componentName)) {
170
+ EVENTEMITTER_METHODS.ACTIVE_PAGE_SYNC_EMIT();
171
+ }
172
+ }, [pageContext, componentInfo == null ? void 0 : componentInfo.componentType, componentInfo == null ? void 0 : componentInfo.componentName, appProxy]);
154
173
  const partialParamValuesKey = computePartialParamKey(
155
174
  componentInfo == null ? void 0 : componentInfo.componentType,
156
175
  props.params,
@@ -289,7 +308,13 @@ const withPageContext = (WrappedComponent, addPageScript, getVariables, componen
289
308
  pageProxy.partialParams = newParams;
290
309
  (_a2 = props.onLoad) == null ? void 0 : _a2.call(props, pageProxy);
291
310
  }
292
- appProxy.appLocale = i18n.appLocale || {};
311
+ const mergedAppLocale = i18n.appLocale || {};
312
+ if (!appProxy.appLocale) {
313
+ appProxy.appLocale = {};
314
+ }
315
+ if (!syncLocaleMessages(appProxy.appLocale, mergedAppLocale)) {
316
+ appProxy.appLocale = __spreadValues({}, mergedAppLocale);
317
+ }
293
318
  const localeFormats = {
294
319
  date: i18n.dateFormat,
295
320
  time: i18n.timeFormat,
@@ -300,15 +325,17 @@ const withPageContext = (WrappedComponent, addPageScript, getVariables, componen
300
325
  pageProxy.Variables = Variables;
301
326
  pageProxy.Actions = Actions;
302
327
  pageProxy.pageReady = pageReady;
303
- pageProxy.App = __spreadValues(__spreadValues({}, appProxy), initialAppConfig);
328
+ pageProxy.App = appProxy != null ? appProxy : appContext;
304
329
  pageProxy.selectedLocale = i18n.selectedLocale || "en";
305
330
  pageProxy.overriddenPropsRegistry = overriddenPropsRegistryRef.current;
306
331
  setupVariableSubscriptions(pageVariables.Variables);
332
+ await executeStartupVariables(pageVariables.Variables);
307
333
  if ((componentInfo == null ? void 0 : componentInfo.componentType) === "PAGE" && appProxy) {
308
334
  const pageName2 = componentInfo == null ? void 0 : componentInfo.componentName;
309
335
  appProxy.updateActivePage(pageName2);
310
336
  appProxy.activePage = pageProxy;
311
337
  appProxy.activePageName = pageName2;
338
+ clearPageWidgetProxyCache(appProxy.Widgets);
312
339
  Object.setPrototypeOf(appProxy.Widgets, pageProxy.Widgets);
313
340
  } else if ((componentInfo == null ? void 0 : componentInfo.componentName) === "Common" && (componentInfo == null ? void 0 : componentInfo.componentType) === "PARTIAL" && appProxy) {
314
341
  Object.keys(pageProxy.Widgets).forEach((key) => {
@@ -457,21 +484,11 @@ const withPageContext = (WrappedComponent, addPageScript, getVariables, componen
457
484
  setupVariableSubscriptions(appVarsOnly);
458
485
  }
459
486
  };
460
- const executeStartupOperations = async (Variables, Actions) => {
461
- const { startUpActions = [], startUpVariables = [] } = componentInfo || {};
487
+ const executeStartupVariables = async (Variables) => {
488
+ const startUpVariables = (componentInfo == null ? void 0 : componentInfo.startUpVariables) || [];
489
+ if (!startUpVariables.length) return;
462
490
  startUpVariables.forEach((name) => pendingStartupOpsRef.current.add(name));
463
- startUpActions.forEach((name) => pendingStartupOpsRef.current.add(name));
464
- if (startUpActions.length === 0 && startUpVariables.length === 0) {
465
- return;
466
- }
467
491
  try {
468
- startUpActions.forEach((actionName) => {
469
- var _a2;
470
- if ((_a2 = Actions[actionName]) == null ? void 0 : _a2.invoke) {
471
- Actions[actionName].invoke();
472
- }
473
- pendingStartupOpsRef.current.delete(String(actionName));
474
- });
475
492
  const variablePromises = startUpVariables.map((varName) => {
476
493
  var _a2;
477
494
  if ((_a2 = Variables[varName]) == null ? void 0 : _a2.invoke) {
@@ -493,7 +510,24 @@ const withPageContext = (WrappedComponent, addPageScript, getVariables, componen
493
510
  }
494
511
  }, 0);
495
512
  } catch (error) {
496
- console.error("Error during startup operations:", error);
513
+ console.error("Error during startup variables:", error);
514
+ }
515
+ };
516
+ const executeStartupActions = async (Actions) => {
517
+ const startUpActions = (componentInfo == null ? void 0 : componentInfo.startUpActions) || [];
518
+ if (!startUpActions.length) return;
519
+ startUpActions.forEach((name) => pendingStartupOpsRef.current.add(name));
520
+ try {
521
+ startUpActions.forEach((actionName) => {
522
+ var _a2;
523
+ if ((_a2 = Actions[actionName]) == null ? void 0 : _a2.invoke) {
524
+ Actions[actionName].invoke();
525
+ }
526
+ pendingStartupOpsRef.current.delete(String(actionName));
527
+ });
528
+ pendingStartupOpsRef.current.clear();
529
+ } catch (error) {
530
+ console.error("Error during startup actions:", error);
497
531
  }
498
532
  };
499
533
  function layoutReady() {
@@ -538,19 +572,61 @@ const withPageContext = (WrappedComponent, addPageScript, getVariables, componen
538
572
  async function executeStartup() {
539
573
  await (appContext == null ? void 0 : appContext.executeStartAppOperations());
540
574
  }
541
- async function executePageStartup() {
542
- await executeStartupOperations(pageContext.Variables, pageContext.Actions);
575
+ useEffect(() => {
576
+ const prevLocale = appliedLocaleRef.current;
577
+ appliedLocaleRef.current = i18n.selectedLocale;
578
+ const isLocaleSwitch = prevLocale !== void 0 && prevLocale !== i18n.selectedLocale;
579
+ if (isLocaleSwitch && pageProxyRef.current) {
580
+ pageProxyRef.current.Widgets = {};
581
+ }
582
+ setPageContext((prev) => {
583
+ if (prev.selectedLocale === i18n.selectedLocale) {
584
+ return prev;
585
+ }
586
+ return __spreadValues(__spreadProps(__spreadValues({}, prev), {
587
+ selectedLocale: i18n.selectedLocale
588
+ }), isLocaleSwitch && { Widgets: {} });
589
+ });
590
+ }, [i18n.selectedLocale]);
591
+ const applyLocaleToProxies = useCallback(
592
+ (newAppLocale) => {
593
+ var _a2;
594
+ if (appProxy) {
595
+ if (!appProxy.appLocale) {
596
+ appProxy.appLocale = {};
597
+ }
598
+ if (!syncLocaleMessages(appProxy.appLocale, newAppLocale)) {
599
+ appProxy.appLocale = __spreadValues({}, newAppLocale);
600
+ }
601
+ }
602
+ if (pageProxyRef.current) {
603
+ if (!pageProxyRef.current.appLocale) {
604
+ pageProxyRef.current.appLocale = {};
605
+ }
606
+ if (!syncLocaleMessages(pageProxyRef.current.appLocale, newAppLocale)) {
607
+ pageProxyRef.current.appLocale = __spreadValues({}, newAppLocale);
608
+ }
609
+ if (pageProxyRef.current.App) {
610
+ pageProxyRef.current.App.appLocale = (_a2 = appProxy == null ? void 0 : appProxy.appLocale) != null ? _a2 : newAppLocale;
611
+ }
612
+ }
613
+ },
614
+ [appProxy == null ? void 0 : appProxy.appLocale]
615
+ );
616
+ if (isInitialized && pageProxyRef.current && ((_c = i18n.localeRevision) != null ? _c : 0) !== lastSyncedLocaleRevisionRef.current) {
617
+ const isLocaleChange = lastSyncedLocaleRevisionRef.current >= 0;
618
+ lastSyncedLocaleRevisionRef.current = (_d = i18n.localeRevision) != null ? _d : 0;
619
+ applyLocaleToProxies(i18n.appLocale);
620
+ if (isLocaleChange && (componentInfo == null ? void 0 : componentInfo.componentType) === "PAGE") {
621
+ addPageScript(appProxy, pageProxyRef.current);
622
+ }
543
623
  }
544
624
  useEffect(() => {
545
- var _a2;
546
625
  const newAppLocale = merge({}, i18n.appLocale || {}, (prefabInfo == null ? void 0 : prefabInfo.appLocale) || {});
547
626
  if (!isEqual(pageContext.appLocale, newAppLocale)) {
548
627
  setPageContext((prev) => __spreadProps(__spreadValues({}, prev), {
549
628
  appLocale: newAppLocale
550
629
  }));
551
- if ((_a2 = pageProxyRef.current) == null ? void 0 : _a2.App) {
552
- pageProxyRef.current.App.appLocale = newAppLocale;
553
- }
554
630
  }
555
631
  }, [i18n.appLocale]);
556
632
  useEffect(() => {
@@ -586,9 +662,9 @@ const withPageContext = (WrappedComponent, addPageScript, getVariables, componen
586
662
  if ((securityConfig == null ? void 0 : securityConfig.authenticated) && (appProxy == null ? void 0 : appProxy.executeSessionFailureRequests)) {
587
663
  await appProxy.executeSessionFailureRequests();
588
664
  }
589
- await executeStartup();
665
+ await (appContext == null ? void 0 : appContext.executeStartAppOperations());
590
666
  await onContentReady();
591
- await executePageStartup();
667
+ executeStartupActions(pageContext.Actions);
592
668
  onStartupCompletedRef.current = true;
593
669
  if (pendingAccordionExpansion) {
594
670
  accordionExpansionHandler(pageProxyRef, pendingAccordionExpansion, dispatch);
@@ -626,14 +702,14 @@ const withPageContext = (WrappedComponent, addPageScript, getVariables, componen
626
702
  ((_a2 = appVariables[value]) == null ? void 0 : _a2.invokeOnParamChange) && ((_b2 = appVariables[value]) == null ? void 0 : _b2.invokeOnParamChange());
627
703
  });
628
704
  }
629
- if (((_c = componentInfo == null ? void 0 : componentInfo.autoUpdateVariables) == null ? void 0 : _c.length) && onStartupCompletedRef.current) {
705
+ if (((_e = componentInfo == null ? void 0 : componentInfo.autoUpdateVariables) == null ? void 0 : _e.length) && onStartupCompletedRef.current) {
630
706
  const pageVariables = pageContext.Variables;
631
707
  componentInfo.autoUpdateVariables.forEach((value) => {
632
708
  var _a2, _b2;
633
709
  (_b2 = (_a2 = pageVariables[value]) == null ? void 0 : _a2.invokeOnParamChange) == null ? void 0 : _b2.call(_a2);
634
710
  });
635
711
  }
636
- return /* @__PURE__ */ jsx(WidgetProvider, { value: { value: pageContext, proxy: pageProxyRef.current }, children: /* @__PURE__ */ jsx(WrappedComponent, __spreadValues({}, props)) });
712
+ return /* @__PURE__ */ jsx(WidgetProvider, { value: { value: pageContext, proxy: pageProxyRef.current }, children: /* @__PURE__ */ jsx(WrappedComponent, __spreadValues({}, props), `locale-${(_f = i18n.localeRevision) != null ? _f : 0}`) });
637
713
  };
638
714
  PageContextComponent.displayName = `WithPageContext(${WrappedComponent.displayName || WrappedComponent.name || "Component"})`;
639
715
  return PageContextComponent;
@@ -77,6 +77,7 @@ export interface Props {
77
77
  * Not emitted by codegen — omit (default) to show skeleton when `loading` is true.
78
78
  */
79
79
  showSkeleton?: boolean;
80
+ widget?: string;
80
81
  }
81
82
  /**
82
83
  * Interface for props injected by the BaseDialog (withDialogWrapper) HOC.
@@ -0,0 +1,21 @@
1
+ import React from "react";
2
+ import { PageContextState } from "@wavemaker-ai/react-runtime/types";
3
+ interface UseActivePageReactivityParams {
4
+ componentType?: string;
5
+ appProxy: any;
6
+ setPageContext: React.Dispatch<React.SetStateAction<PageContextState>>;
7
+ isMountedRef: React.RefObject<boolean>;
8
+ /** Active-page dependency paths this component reads (`App.activePage.*`), declared by codegen. */
9
+ activePageDeps?: string[];
10
+ }
11
+ /**
12
+ * Cross-context reactivity (value-gated): the active page broadcasts on every commit; this hook
13
+ * re-renders the consuming partial/prefab only when one of its codegen-declared `App.activePage.*`
14
+ * dependency paths actually changed. Works for Variables, Widgets, or anything after `activePage`,
15
+ * since the comparison is on the resolved value (the runtime creates new references on change).
16
+ *
17
+ * Propagation is page -> island only (acyclic). Partials with no declared deps never subscribe, so
18
+ * unrelated partials (header/footer) stay untouched. Re-subscribes/resets on navigation.
19
+ */
20
+ export declare const useActivePageReactivity: ({ componentType, appProxy, setPageContext, isMountedRef, activePageDeps, }: UseActivePageReactivityParams) => void;
21
+ export default useActivePageReactivity;
@@ -0,0 +1,57 @@
1
+ "use client";
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
+ var __spreadValues = (a, b) => {
10
+ for (var prop in b || (b = {}))
11
+ if (__hasOwnProp.call(b, prop))
12
+ __defNormalProp(a, prop, b[prop]);
13
+ if (__getOwnPropSymbols)
14
+ for (var prop of __getOwnPropSymbols(b)) {
15
+ if (__propIsEnum.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ }
18
+ return a;
19
+ };
20
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21
+ import { useEffect, useRef } from "react";
22
+ import { EVENTEMITTER_METHODS } from "../core/constants/events";
23
+ const resolvePath = (root, path) => path.split(".").reduce((obj, key) => obj == null ? void 0 : obj[key], root);
24
+ const useActivePageReactivity = ({
25
+ componentType,
26
+ appProxy,
27
+ setPageContext,
28
+ isMountedRef,
29
+ activePageDeps
30
+ }) => {
31
+ var _a;
32
+ const snapshotRef = useRef([]);
33
+ const activePage = appProxy == null ? void 0 : appProxy.activePage;
34
+ const declaredKey = (_a = activePageDeps == null ? void 0 : activePageDeps.join("|")) != null ? _a : "";
35
+ useEffect(() => {
36
+ if (componentType === "PAGE" || !(activePageDeps == null ? void 0 : activePageDeps.length)) return;
37
+ const readValues = () => activePageDeps.map((path) => resolvePath(activePage, path));
38
+ snapshotRef.current = readValues();
39
+ const onActivePageChange = () => {
40
+ if (!isMountedRef.current) return;
41
+ const next = readValues();
42
+ if (next.some((value, i) => !Object.is(value, snapshotRef.current[i]))) {
43
+ snapshotRef.current = next;
44
+ setPageContext((prev) => __spreadProps(__spreadValues({}, prev), { App: __spreadValues({}, prev.App) }));
45
+ }
46
+ };
47
+ EVENTEMITTER_METHODS.ACTIVE_PAGE_SYNC_ON(onActivePageChange);
48
+ return () => {
49
+ EVENTEMITTER_METHODS.ACTIVE_PAGE_SYNC_OFF(onActivePageChange);
50
+ };
51
+ }, [componentType, activePage, declaredKey]);
52
+ };
53
+ var useActivePageReactivity_default = useActivePageReactivity;
54
+ export {
55
+ useActivePageReactivity_default as default,
56
+ useActivePageReactivity
57
+ };
@@ -30,7 +30,7 @@ var __objRest = (source, exclude) => {
30
30
  }
31
31
  return target;
32
32
  };
33
- import { jsx } from "react/jsx-runtime";
33
+ import { createElement } from "react";
34
34
  import React, { useEffect, useMemo, useCallback } from "react";
35
35
  import isEqual from "lodash-es/isEqual";
36
36
  import { useDeviceVisibility } from "../hooks/useDeviceVisibility";
@@ -48,7 +48,7 @@ const withBaseWrapper = (WrappedComponent) => {
48
48
  useEffect(() => {
49
49
  if (name && (props == null ? void 0 : props.iswidget) !== "false" && (pageContext == null ? void 0 : pageContext.Widgets)) {
50
50
  const widget = (widgetFromContext == null ? void 0 : widgetFromContext["data-widget-id"]) === componentWidgetId ? widgetFromContext : {};
51
- const registryEntry = __spreadProps(__spreadValues(__spreadValues({}, props), widget), {
51
+ const registryEntry = __spreadProps(__spreadValues(__spreadValues({}, widget), props), {
52
52
  "data-widget-id": componentWidgetId || void 0,
53
53
  // Ensure widget-id is stored
54
54
  viewParent: proxy
@@ -57,6 +57,7 @@ const withBaseWrapper = (WrappedComponent) => {
57
57
  }
58
58
  }, [name, pageContext == null ? void 0 : pageContext.Widgets, componentWidgetId, props]);
59
59
  const mergedProps = useMemo(() => {
60
+ var _a2;
60
61
  if (!name || !(pageContext == null ? void 0 : pageContext.Widgets) || (props == null ? void 0 : props.iswidget) === "false") {
61
62
  return props;
62
63
  }
@@ -72,8 +73,8 @@ const withBaseWrapper = (WrappedComponent) => {
72
73
  const widgetOverrides = registry == null ? void 0 : registry.getWidgetOverrides(name, componentWidgetId || "");
73
74
  if (widgetOverrides) {
74
75
  Object.keys(widgetOverrides).forEach((key) => {
75
- var _a2;
76
- const internalValue = (_a2 = registry == null ? void 0 : registry.getLastInternalValue) == null ? void 0 : _a2.call(registry, name, key);
76
+ var _a3;
77
+ const internalValue = (_a3 = registry == null ? void 0 : registry.getLastInternalValue) == null ? void 0 : _a3.call(registry, name, key);
77
78
  mergedState[key] = internalValue !== void 0 ? internalValue : widgetOverrides[key];
78
79
  if (props.prefab && key !== "inbound" && key !== "outbound" && key !== "show") {
79
80
  const updatedInbound = __spreadProps(__spreadValues({}, props.inbound), {
@@ -94,7 +95,7 @@ const withBaseWrapper = (WrappedComponent) => {
94
95
  });
95
96
  }
96
97
  } else if (shouldMergeFromContext) {
97
- mergedState = __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, widget), props), (props == null ? void 0 : props.formfield) ? { datavalue: props.datavalue } : { datavalue: widgetDatavalue != null ? widgetDatavalue : props.datavalue }), component === "WmFormField" && !props["value"] && { value: datavalue, datavalue });
98
+ mergedState = __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, widget), props), (props == null ? void 0 : props.formfield) ? { datavalue: props.datavalue } : { datavalue: (_a2 = props.datavalue) != null ? _a2 : widgetDatavalue }), component === "WmFormField" && !props["value"] && { value: datavalue, datavalue });
98
99
  } else {
99
100
  mergedState = __spreadValues(__spreadValues({}, props), component === "WmFormField" && !props["value"] && { value: datavalue, datavalue });
100
101
  }
@@ -122,6 +123,8 @@ const withBaseWrapper = (WrappedComponent) => {
122
123
  delete propsForComparison.listener;
123
124
  delete stateForComparison.viewParent;
124
125
  delete propsForComparison.viewParent;
126
+ delete stateForComparison.children;
127
+ delete propsForComparison.children;
125
128
  if (!isEqual(stateForComparison, propsForComparison)) {
126
129
  updateWidgetState(name, mergedProps);
127
130
  }
@@ -151,7 +154,7 @@ const withBaseWrapper = (WrappedComponent) => {
151
154
  }
152
155
  const shouldHide = !showValue && !isDeferLoad;
153
156
  const updateon = (props == null ? void 0 : props.updateon) === "default" ? "keypress" : props == null ? void 0 : props.updateon;
154
- return /* @__PURE__ */ jsx(
157
+ return /* @__PURE__ */ createElement(
155
158
  WrappedComponent,
156
159
  __spreadProps(__spreadValues(__spreadProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, rest), mergedProps), updateon && { updateon }), shouldHide && { hidden: true }), deferload !== void 0 && { deferload: deferload.toString() }), {
157
160
  show: (_d = mergedProps == null ? void 0 : mergedProps.show) == null ? void 0 : _d.toString(),
@@ -160,7 +163,8 @@ const withBaseWrapper = (WrappedComponent) => {
160
163
  styles: computedStyles
161
164
  }), (props == null ? void 0 : props.dataset) && { dataset: props == null ? void 0 : props.dataset }), {
162
165
  destroy,
163
- viewParent: proxy
166
+ viewParent: proxy,
167
+ key: (pageContext == null ? void 0 : pageContext.selectedLocale) || "en"
164
168
  })
165
169
  );
166
170
  };
@@ -0,0 +1,15 @@
1
+ import { ComponentType } from "react";
2
+ /**
3
+ * Dev HOC that logs why a component re-rendered.
4
+ *
5
+ * On every render it diffs the current props against the previous render's
6
+ * props (shallow, by reference) and logs which keys changed, with prev/next
7
+ * values. Useful for spotting unstable props (new object/array/fn identity)
8
+ * that cause avoidable re-renders.
9
+ *
10
+ * Pure React (no jsx-runtime patching, no external dep), so it works in any
11
+ * bundler/runtime — unlike why-did-you-render.
12
+ *
13
+ * NOTE: no NODE_ENV gate for now (per request) — logs in all environments.
14
+ */
15
+ export declare function withRenderLogger<P extends Record<string, any>>(WrappedComponent: ComponentType<P>, label?: string): ComponentType<P>;
@@ -0,0 +1,53 @@
1
+ "use client";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
6
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
+ var __spreadValues = (a, b) => {
8
+ for (var prop in b || (b = {}))
9
+ if (__hasOwnProp.call(b, prop))
10
+ __defNormalProp(a, prop, b[prop]);
11
+ if (__getOwnPropSymbols)
12
+ for (var prop of __getOwnPropSymbols(b)) {
13
+ if (__propIsEnum.call(b, prop))
14
+ __defNormalProp(a, prop, b[prop]);
15
+ }
16
+ return a;
17
+ };
18
+ import { jsx } from "react/jsx-runtime";
19
+ import { useRef } from "react";
20
+ function withRenderLogger(WrappedComponent, label) {
21
+ const name = label || WrappedComponent.displayName || WrappedComponent.name || "Component";
22
+ const WithRenderLogger = (props) => {
23
+ const prevProps = useRef(null);
24
+ const renderCount = useRef(0);
25
+ renderCount.current += 1;
26
+ const changed = {};
27
+ if (prevProps.current) {
28
+ const keys = /* @__PURE__ */ new Set([...Object.keys(prevProps.current), ...Object.keys(props)]);
29
+ keys.forEach((key) => {
30
+ if (prevProps.current[key] !== props[key]) {
31
+ changed[key] = { prev: prevProps.current[key], next: props[key] };
32
+ }
33
+ });
34
+ }
35
+ const changedKeys = Object.keys(changed);
36
+ if (prevProps.current === null) {
37
+ console.log(`%c[render] ${name} #${renderCount.current} (mount)`, "color:#888");
38
+ } else {
39
+ console.log(
40
+ `%c[render] ${name} #${renderCount.current} \u2014 ${changedKeys.length ? `changed: ${changedKeys.join(", ")}` : "no prop changes (state/context/parent re-render)"}`,
41
+ changedKeys.length ? "color:#d9480f" : "color:#1971c2",
42
+ changedKeys.length ? changed : ""
43
+ );
44
+ }
45
+ prevProps.current = props;
46
+ return /* @__PURE__ */ jsx(WrappedComponent, __spreadValues({}, props));
47
+ };
48
+ WithRenderLogger.displayName = `withRenderLogger(${name})`;
49
+ return WithRenderLogger;
50
+ }
51
+ export {
52
+ withRenderLogger
53
+ };
package/hooks/useAuth.js CHANGED
@@ -36,6 +36,12 @@ const useAuth = () => {
36
36
  const { isLoggedIn, loggedInUser, securityConfig, isPageLoading, error } = useAppSelector(
37
37
  (state) => state.auth
38
38
  );
39
+ const securityEnabled = useAppSelector(
40
+ (state) => {
41
+ var _a, _b, _c;
42
+ return !!((_c = (_b = (_a = state.info) == null ? void 0 : _a.appConfig) == null ? void 0 : _b.appProperties) == null ? void 0 : _c.securityEnabled);
43
+ }
44
+ );
39
45
  const handleLogin = async (options) => {
40
46
  try {
41
47
  const loginResponse = await dispatch(login(options)).unwrap();
@@ -76,7 +82,7 @@ const useAuth = () => {
76
82
  return widgetRoles.some((role) => includes(userRoles, role));
77
83
  };
78
84
  const getLoggedInUserDetails = async (baseURL) => {
79
- if (!baseURL) {
85
+ if (!securityEnabled) {
80
86
  dispatch(setPageLoading(true));
81
87
  await dispatch(getServiceDefinitions(baseURL)).unwrap();
82
88
  dispatch(setPageLoading(false));