@wavemaker-ai/react-runtime 1.0.0-rc.312 → 1.0.0-rc.317

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 (593) hide show
  1. package/.npmignore +4 -0
  2. package/actions/base-action.js +12 -29
  3. package/actions/login-action.js +35 -52
  4. package/actions/logout-action.js +21 -38
  5. package/actions/navigation-action.d.ts +1 -0
  6. package/actions/navigation-action.js +275 -345
  7. package/actions/notification-action.js +121 -149
  8. package/actions/timer-action.js +95 -151
  9. package/actions/toast-provider.js +62 -76
  10. package/actions/toast.js +95 -91
  11. package/actions/toast.service.js +59 -79
  12. package/actions/types/index.js +6 -9
  13. package/components/advanced/carousel/index.js +358 -366
  14. package/components/advanced/carousel/props.js +0 -5
  15. package/components/advanced/carousel/template.js +102 -80
  16. package/components/advanced/login/index.js +227 -285
  17. package/components/advanced/login/props.js +0 -5
  18. package/components/advanced/marquee/index.js +169 -163
  19. package/components/advanced/marquee/props.js +0 -5
  20. package/components/auth/RoleAuthGuard.d.ts +6 -0
  21. package/components/auth/RoleAuthGuard.js +65 -0
  22. package/components/basic/anchor/index.js +207 -187
  23. package/components/basic/anchor/props.js +0 -5
  24. package/components/basic/audio/index.js +110 -72
  25. package/components/basic/audio/props.js +0 -5
  26. package/components/basic/html/index.js +163 -203
  27. package/components/basic/html/props.js +0 -5
  28. package/components/basic/html/utils.js +30 -28
  29. package/components/basic/icon/index.js +98 -84
  30. package/components/basic/icon/props.js +0 -5
  31. package/components/basic/iframe/iframe.utils.js +7 -16
  32. package/components/basic/iframe/index.js +97 -103
  33. package/components/basic/iframe/props.js +0 -5
  34. package/components/basic/label/index.js +156 -134
  35. package/components/basic/label/props.js +0 -5
  36. package/components/basic/message/index.js +129 -113
  37. package/components/basic/message/props.js +0 -5
  38. package/components/basic/picture/index.js +156 -127
  39. package/components/basic/picture/props.js +0 -5
  40. package/components/basic/progress-bar/index.js +240 -176
  41. package/components/basic/progress-bar/props.js +5 -31
  42. package/components/basic/progress-circle/index.js +166 -183
  43. package/components/basic/progress-circle/props.js +14 -34
  44. package/components/basic/richtexteditor/index.js +430 -396
  45. package/components/basic/richtexteditor/props.js +0 -5
  46. package/components/basic/search/index.js +813 -931
  47. package/components/basic/search/props.js +0 -5
  48. package/components/basic/search/providers.js +233 -380
  49. package/components/basic/spinner/index.js +210 -200
  50. package/components/basic/spinner/props.js +4 -22
  51. package/components/basic/tile/index.js +73 -81
  52. package/components/basic/tile/props.js +0 -5
  53. package/components/basic/tree/Components/TreeNodeComponent.d.ts +1 -1
  54. package/components/basic/tree/Components/TreeNodeComponent.js +244 -170
  55. package/components/basic/tree/hooks/useTreePartialNodeApi.js +143 -135
  56. package/components/basic/tree/hooks/useTreePersistedState.d.ts +3 -0
  57. package/components/basic/tree/hooks/useTreePersistedState.js +38 -0
  58. package/components/basic/tree/index.d.ts +1 -0
  59. package/components/basic/tree/index.js +453 -454
  60. package/components/basic/tree/props.d.ts +18 -1
  61. package/components/basic/tree/props.js +0 -5
  62. package/components/basic/tree/utils.d.ts +16 -1
  63. package/components/basic/tree/utils.js +240 -185
  64. package/components/basic/video/index.js +161 -107
  65. package/components/basic/video/props.js +0 -5
  66. package/components/chart/index.js +42 -50
  67. package/components/chart/props.js +31 -37
  68. package/components/chart/src/ChartRenderer.js +172 -154
  69. package/components/chart/src/chart.js +391 -213
  70. package/components/chart/src/chartStyles.generated.js +6 -14
  71. package/components/chart/src/chartUtils.js +228 -272
  72. package/components/chart/src/constants.d.ts +13 -0
  73. package/components/chart/src/constants.js +316 -90
  74. package/components/chart/src/d3Setup.js +11 -30
  75. package/components/chart/src/dataUtils.js +363 -447
  76. package/components/chart/src/formatUtils.js +47 -38
  77. package/components/chart/src/index.js +11 -19
  78. package/components/chart/src/nvd3Source.generated.js +5 -13
  79. package/components/chart/src/pieDonutResponsiveLayout.d.ts +5 -0
  80. package/components/chart/src/pieDonutResponsiveLayout.js +76 -96
  81. package/components/chart/src/types.js +0 -5
  82. package/components/common/AppSpinner.js +17 -33
  83. package/components/common/app-spinner.js +11 -22
  84. package/components/common/customTemplate/index.d.ts +3 -0
  85. package/components/common/customTemplate/index.js +6 -0
  86. package/components/common/customTemplate/props.d.ts +20 -0
  87. package/components/common/customTemplate/props.js +0 -0
  88. package/components/common/customTemplate/template.d.ts +3 -0
  89. package/components/common/customTemplate/template.js +27 -0
  90. package/components/common/customTemplate/useCustomTemplate.d.ts +8 -0
  91. package/components/common/customTemplate/useCustomTemplate.js +17 -0
  92. package/components/common/customTemplate/utils.d.ts +6 -0
  93. package/components/common/customTemplate/utils.js +12 -0
  94. package/components/common/index.js +4 -12
  95. package/components/constants.js +81 -77
  96. package/components/container/accordion/accordion-pane/index.js +105 -118
  97. package/components/container/accordion/accordion-pane/props.js +5 -21
  98. package/components/container/accordion/index.js +225 -243
  99. package/components/container/accordion/props.js +5 -16
  100. package/components/container/index.js +210 -155
  101. package/components/container/layout-grid/grid-column/index.js +69 -43
  102. package/components/container/layout-grid/grid-column/props.js +0 -5
  103. package/components/container/layout-grid/grid-row/index.js +12 -29
  104. package/components/container/layout-grid/grid-row/props.js +0 -5
  105. package/components/container/layout-grid/index.js +53 -38
  106. package/components/container/layout-grid/props.js +0 -5
  107. package/components/container/linear-layout/index.js +56 -60
  108. package/components/container/linear-layout/linear-layout-item/index.js +43 -47
  109. package/components/container/linear-layout/linear-layout-item/props.js +0 -5
  110. package/components/container/linear-layout/props.js +0 -5
  111. package/components/container/panel/components/panel-content/index.js +7 -16
  112. package/components/container/panel/components/panel-header/index.js +166 -146
  113. package/components/container/panel/components/panel-header/props.js +0 -5
  114. package/components/container/panel/hooks.js +76 -102
  115. package/components/container/panel/index.js +289 -252
  116. package/components/container/panel/props.js +0 -5
  117. package/components/container/props.js +0 -5
  118. package/components/container/repeat-template/index.js +65 -44
  119. package/components/container/repeat-template/props.js +0 -5
  120. package/components/container/tabs/index.js +517 -526
  121. package/components/container/tabs/props.js +5 -28
  122. package/components/container/tabs/tab-pane/index.js +105 -100
  123. package/components/container/tabs/tab-pane/props.js +0 -5
  124. package/components/container/tabs/utils.js +30 -35
  125. package/components/container/wizard/WizardContext.js +9 -11
  126. package/components/container/wizard/components/StepComponents.js +76 -99
  127. package/components/container/wizard/components/WizardStep.js +107 -85
  128. package/components/container/wizard/index.js +791 -921
  129. package/components/container/wizard/props.js +0 -5
  130. package/components/container/wizard/utils.js +97 -131
  131. package/components/container/wizard/wizard-action/index.js +41 -81
  132. package/components/container/wizard/wizard-step/index.js +140 -120
  133. package/components/data/card/card-actions/index.js +13 -31
  134. package/components/data/card/card-content/index.js +27 -36
  135. package/components/data/card/card-footer/index.js +13 -31
  136. package/components/data/card/index.js +192 -199
  137. package/components/data/card/props.js +0 -5
  138. package/components/data/form/base-form/constant.js +5 -8
  139. package/components/data/form/base-form/hooks/index.js +26 -77
  140. package/components/data/form/base-form/hooks/useFormDataSync.js +106 -212
  141. package/components/data/form/base-form/hooks/useFormOperations.js +109 -161
  142. package/components/data/form/base-form/hooks/useFormSubmission.js +220 -280
  143. package/components/data/form/base-form/hooks/useFormValidation.js +119 -168
  144. package/components/data/form/base-form/hooks/useParentFormRelationship.js +67 -103
  145. package/components/data/form/base-form/index.js +534 -647
  146. package/components/data/form/base-form/props.js +74 -151
  147. package/components/data/form/base-form/utils.js +210 -323
  148. package/components/data/form/dynamic-fields/constant.js +43 -53
  149. package/components/data/form/dynamic-fields/index.js +135 -144
  150. package/components/data/form/dynamic-fields/props.js +0 -5
  151. package/components/data/form/dynamic-fields/utils.js +99 -158
  152. package/components/data/form/form-action/index.js +107 -85
  153. package/components/data/form/form-body/index.js +52 -26
  154. package/components/data/form/form-context.js +43 -59
  155. package/components/data/form/form-controller/hooks/index.js +43 -57
  156. package/components/data/form/form-controller/props.js +5 -8
  157. package/components/data/form/form-controller/utils.js +54 -49
  158. package/components/data/form/form-controller/validation-contrustor.js +203 -426
  159. package/components/data/form/form-controller/withFormController.js +320 -274
  160. package/components/data/form/form-dynamic-section/index.js +47 -41
  161. package/components/data/form/form-dynamic-section/props.js +0 -5
  162. package/components/data/form/form-field/base-field.js +97 -109
  163. package/components/data/form/form-field/index.js +91 -82
  164. package/components/data/form/form-field/props.js +0 -5
  165. package/components/data/form/form-footer/index.js +52 -25
  166. package/components/data/form/form-header/index.js +61 -58
  167. package/components/data/form/index.js +95 -74
  168. package/components/data/form/props.js +0 -5
  169. package/components/data/list/components/GroupHeader.js +34 -33
  170. package/components/data/list/components/GroupedListItems.js +108 -104
  171. package/components/data/list/components/ListContainer.js +22 -27
  172. package/components/data/list/components/ListDND.js +193 -185
  173. package/components/data/list/components/ListHeader.js +32 -49
  174. package/components/data/list/components/ListItem.js +153 -146
  175. package/components/data/list/components/ListItemWithTemplate.js +87 -105
  176. package/components/data/list/components/ListItems.js +180 -194
  177. package/components/data/list/components/ListPagination.js +127 -153
  178. package/components/data/list/components/LoadMoreButton.js +25 -33
  179. package/components/data/list/components/NoDataMessage.js +9 -22
  180. package/components/data/list/components/StandardListItems.js +79 -85
  181. package/components/data/list/components/index.js +31 -119
  182. package/components/data/list/components/props.js +0 -5
  183. package/components/data/list/hooks/index.js +22 -75
  184. package/components/data/list/hooks/props.js +0 -5
  185. package/components/data/list/hooks/useCurrentPageItems.js +20 -38
  186. package/components/data/list/hooks/useGroupedData.js +19 -33
  187. package/components/data/list/hooks/useListData.js +17 -47
  188. package/components/data/list/hooks/useListEffects.js +168 -237
  189. package/components/data/list/hooks/useListEventHandlers.js +301 -285
  190. package/components/data/list/hooks/useListPagination.js +90 -136
  191. package/components/data/list/hooks/useListState.js +49 -91
  192. package/components/data/list/hooks/useListStateManager.js +104 -159
  193. package/components/data/list/hooks/usePaginatedGroupedData.js +74 -110
  194. package/components/data/list/index.d.ts +1 -0
  195. package/components/data/list/index.js +579 -621
  196. package/components/data/list/props.d.ts +4 -0
  197. package/components/data/list/props.js +0 -5
  198. package/components/data/list/templates/media-template.js +29 -50
  199. package/components/data/list/utils/constants.js +20 -32
  200. package/components/data/list/utils/list-helpers.d.ts +2 -1
  201. package/components/data/list/utils/list-helpers.js +71 -115
  202. package/components/data/list/utils/list-widget-methods.js +56 -76
  203. package/components/data/list/utils/widget-instance-utils.js +20 -57
  204. package/components/data/live-filter/index.js +219 -271
  205. package/components/data/live-filter/props.js +5 -12
  206. package/components/data/live-form/index.js +68 -91
  207. package/components/data/live-form/props.js +5 -12
  208. package/components/data/pagination/components/BasicPagination.js +124 -104
  209. package/components/data/pagination/components/ClassicPagination.js +167 -190
  210. package/components/data/pagination/components/InlinePagination.js +97 -98
  211. package/components/data/pagination/components/LoadingComponent.js +17 -30
  212. package/components/data/pagination/components/PageSizeSelector.js +176 -169
  213. package/components/data/pagination/components/PagerNavigation.js +84 -105
  214. package/components/data/pagination/components/TotalRecords.js +48 -47
  215. package/components/data/pagination/components/index.js +14 -47
  216. package/components/data/pagination/components/props.js +0 -5
  217. package/components/data/pagination/hooks/index.js +6 -19
  218. package/components/data/pagination/hooks/props.js +0 -5
  219. package/components/data/pagination/hooks/useNavigationSize.js +12 -21
  220. package/components/data/pagination/hooks/usePagination.js +701 -905
  221. package/components/data/pagination/index.js +336 -389
  222. package/components/data/table/components/AddNewRow.js +122 -154
  223. package/components/data/table/components/EditableCell.js +68 -75
  224. package/components/data/table/components/FieldValidationError.js +19 -20
  225. package/components/data/table/components/RowCells.js +97 -80
  226. package/components/data/table/components/RowExpansionButton.js +43 -39
  227. package/components/data/table/components/SummaryCell.js +54 -88
  228. package/components/data/table/components/SummaryRow.js +45 -52
  229. package/components/data/table/components/SummaryRowFooter.js +35 -42
  230. package/components/data/table/components/TableBody.js +222 -218
  231. package/components/data/table/components/TableDataRow.js +113 -106
  232. package/components/data/table/components/TableFilters.js +391 -390
  233. package/components/data/table/components/TableFooterActions.js +25 -32
  234. package/components/data/table/components/TableHeader.js +460 -435
  235. package/components/data/table/components/TablePanelHeading.js +157 -181
  236. package/components/data/table/components/index.js +27 -95
  237. package/components/data/table/hooks/index.js +21 -230
  238. package/components/data/table/hooks/use-edited-rows.js +59 -94
  239. package/components/data/table/hooks/useCellState.js +58 -83
  240. package/components/data/table/hooks/useCustomExpressionColumns.js +65 -86
  241. package/components/data/table/hooks/useDynamicColumns.js +59 -92
  242. package/components/data/table/hooks/useEditingState.js +30 -41
  243. package/components/data/table/hooks/useFormWidget.js +163 -172
  244. package/components/data/table/hooks/usePaginationState.js +67 -77
  245. package/components/data/table/hooks/usePanelStructure.js +47 -41
  246. package/components/data/table/hooks/useResponsiveColumns.js +14 -20
  247. package/components/data/table/hooks/useRowExpansion.js +131 -127
  248. package/components/data/table/hooks/useRowHandlers.js +56 -69
  249. package/components/data/table/hooks/useRowSelection.js +249 -329
  250. package/components/data/table/hooks/useServerSideSorting.js +109 -175
  251. package/components/data/table/hooks/useTableColumns.js +322 -331
  252. package/components/data/table/hooks/useTableData.js +111 -166
  253. package/components/data/table/hooks/useTableEdit.js +526 -564
  254. package/components/data/table/hooks/useTableEffects.js +60 -107
  255. package/components/data/table/hooks/useTableFilter.js +244 -237
  256. package/components/data/table/hooks/useTableInitialization.js +44 -76
  257. package/components/data/table/hooks/useTableState.js +39 -61
  258. package/components/data/table/hooks/useTableStateManager.js +295 -468
  259. package/components/data/table/index.js +1556 -1713
  260. package/components/data/table/live-table/index.js +157 -219
  261. package/components/data/table/props.js +0 -5
  262. package/components/data/table/table-action/index.js +97 -75
  263. package/components/data/table/table-column/index.js +48 -42
  264. package/components/data/table/table-group/index.js +7 -25
  265. package/components/data/table/table-row/index.js +63 -55
  266. package/components/data/table/table-row-action/index.js +102 -77
  267. package/components/data/table/utils/buildSelectionColumns.js +86 -137
  268. package/components/data/table/utils/columnBuilder.d.ts +1 -1
  269. package/components/data/table/utils/columnBuilder.js +121 -160
  270. package/components/data/table/utils/columnProxy.js +48 -66
  271. package/components/data/table/utils/columnWidthDistribution.js +40 -64
  272. package/components/data/table/utils/constants.js +92 -40
  273. package/components/data/table/utils/crud-handlers.js +292 -473
  274. package/components/data/table/utils/dynamic-columns.js +99 -144
  275. package/components/data/table/utils/groupHeaderUtils.js +36 -61
  276. package/components/data/table/utils/index.d.ts +17 -13
  277. package/components/data/table/utils/index.js +483 -639
  278. package/components/data/table/utils/renderDisplayCell.js +127 -169
  279. package/components/data/table/utils/script-page-size-broadcast.js +17 -29
  280. package/components/data/table/utils/selectionUtils.js +59 -113
  281. package/components/data/table/utils/table-helpers.js +38 -74
  282. package/components/data/table/utils/validation.js +35 -78
  283. package/components/data/table/utils/widgetMapping.d.ts +5 -0
  284. package/components/data/table/utils/widgetMapping.js +41 -0
  285. package/components/data/types.js +112 -112
  286. package/components/data/utils/field-data-utils.js +38 -42
  287. package/components/data/utils/filter-field-util.js +42 -44
  288. package/components/data/utils/index.js +112 -111
  289. package/components/dialogs/alert-dialog/index.js +83 -78
  290. package/components/dialogs/alert-dialog/props.js +0 -5
  291. package/components/dialogs/confirm-dialog/index.js +102 -92
  292. package/components/dialogs/confirm-dialog/props.js +0 -5
  293. package/components/dialogs/dialog/index.js +93 -69
  294. package/components/dialogs/dialog/props.js +0 -5
  295. package/components/dialogs/dialog-actions/index.js +12 -26
  296. package/components/dialogs/dialog-actions/props.js +0 -5
  297. package/components/dialogs/dialog-body/index.js +13 -30
  298. package/components/dialogs/dialog-body/props.js +0 -5
  299. package/components/dialogs/dialog-content/index.js +48 -41
  300. package/components/dialogs/dialog-content/props.js +0 -5
  301. package/components/dialogs/dialog-header/index.js +88 -101
  302. package/components/dialogs/dialog-header/props.js +0 -5
  303. package/components/dialogs/iframe-dialog/index.js +136 -128
  304. package/components/dialogs/iframe-dialog/props.js +0 -5
  305. package/components/dialogs/index.js +104 -101
  306. package/components/dialogs/login-dialog/index.js +285 -347
  307. package/components/dialogs/login-dialog/props.js +0 -5
  308. package/components/dialogs/page-dialog/index.js +95 -86
  309. package/components/dialogs/page-dialog/props.js +0 -5
  310. package/components/dialogs/props.js +0 -5
  311. package/components/dialogs/withDialogWrapper.js +110 -83
  312. package/components/form/button/index.js +296 -245
  313. package/components/form/button/props.js +0 -5
  314. package/components/form/button-group/index.js +80 -69
  315. package/components/form/button-group/props.js +0 -5
  316. package/components/input/calendar/index.js +409 -362
  317. package/components/input/calendar/props.js +0 -5
  318. package/components/input/calendar/utils.js +164 -172
  319. package/components/input/chips/SortableChip/index.js +109 -100
  320. package/components/input/chips/SortableChip/props.js +0 -5
  321. package/components/input/chips/index.js +663 -570
  322. package/components/input/chips/props.js +0 -5
  323. package/components/input/chips/utils.js +131 -122
  324. package/components/input/color-picker/index.js +536 -594
  325. package/components/input/color-picker/props.js +0 -5
  326. package/components/input/composite/index.js +71 -110
  327. package/components/input/composite/props.js +0 -5
  328. package/components/input/currency/index.js +277 -224
  329. package/components/input/currency/props.js +0 -5
  330. package/components/input/default/checkbox/index.js +329 -250
  331. package/components/input/default/checkbox/props.js +0 -5
  332. package/components/input/default/checkboxset/index.d.ts +2 -0
  333. package/components/input/default/checkboxset/index.js +529 -446
  334. package/components/input/default/checkboxset/props.d.ts +4 -0
  335. package/components/input/default/checkboxset/props.js +0 -5
  336. package/components/input/default/checkboxset/utils.js +15 -25
  337. package/components/input/default/radioset/index.d.ts +2 -0
  338. package/components/input/default/radioset/index.js +409 -350
  339. package/components/input/default/radioset/props.d.ts +6 -0
  340. package/components/input/default/radioset/props.js +0 -5
  341. package/components/input/default/switch/index.js +494 -458
  342. package/components/input/default/switch/prop.js +0 -5
  343. package/components/input/epoch/date/components/DatePickerPopover.js +242 -193
  344. package/components/input/epoch/date/index.js +638 -518
  345. package/components/input/epoch/date/props.js +0 -5
  346. package/components/input/epoch/date/styled.js +61 -70
  347. package/components/input/epoch/date/utils.js +67 -115
  348. package/components/input/epoch/datetime/index.js +758 -695
  349. package/components/input/epoch/datetime/props.js +0 -5
  350. package/components/input/epoch/datetime/utils.js +121 -186
  351. package/components/input/epoch/time/index.js +441 -415
  352. package/components/input/epoch/time/props.js +0 -5
  353. package/components/input/epoch/time/utils.js +101 -112
  354. package/components/input/fileupload/Utils.js +70 -97
  355. package/components/input/fileupload/components/ListItems.js +132 -130
  356. package/components/input/fileupload/components/MultiUpload.js +80 -77
  357. package/components/input/fileupload/components/SingleUpload.js +57 -57
  358. package/components/input/fileupload/index.js +253 -178
  359. package/components/input/fileupload/props.js +0 -5
  360. package/components/input/fileupload/useFileUpload.js +209 -258
  361. package/components/input/number/index.js +434 -393
  362. package/components/input/number/props.js +0 -5
  363. package/components/input/rating/index.js +401 -394
  364. package/components/input/rating/props.js +0 -5
  365. package/components/input/select/index.js +408 -463
  366. package/components/input/select/props.js +0 -5
  367. package/components/input/slider/index.js +339 -332
  368. package/components/input/slider/props.js +0 -5
  369. package/components/input/text/index.d.ts +3 -3
  370. package/components/input/text/index.js +438 -475
  371. package/components/input/text/props.d.ts +1 -1
  372. package/components/input/text/props.js +0 -5
  373. package/components/input/text/util.js +82 -222
  374. package/components/input/textarea/index.js +322 -358
  375. package/components/input/textarea/props.js +0 -5
  376. package/components/input/upload/index.js +135 -131
  377. package/components/input/upload/props.js +0 -5
  378. package/components/input/util/index.js +9 -11
  379. package/components/layout/footer/index.js +12 -35
  380. package/components/layout/footer/props.js +0 -5
  381. package/components/layout/header/index.js +12 -38
  382. package/components/layout/header/props.js +0 -5
  383. package/components/layout/leftnav/index.js +57 -44
  384. package/components/layout/leftnav/props.d.ts +9 -0
  385. package/components/layout/leftnav/props.js +0 -5
  386. package/components/layout/leftnav/utils/page-class-util.d.ts +9 -0
  387. package/components/layout/leftnav/utils/page-class-util.js +28 -0
  388. package/components/layout/rightnav/index.js +12 -36
  389. package/components/layout/rightnav/props.js +0 -5
  390. package/components/layout/topnav/index.js +24 -38
  391. package/components/layout/topnav/props.js +0 -5
  392. package/components/navbar/index.js +119 -98
  393. package/components/navbar/nav/index.js +236 -232
  394. package/components/navbar/nav/props.js +0 -5
  395. package/components/navbar/nav-item/index.js +74 -65
  396. package/components/navbar/nav-item/props.js +0 -5
  397. package/components/navigation/breadcrumb/index.js +38 -61
  398. package/components/navigation/breadcrumb/props.js +0 -5
  399. package/components/navigation/menu/components/ListItems.js +76 -67
  400. package/components/navigation/menu/constants.js +27 -42
  401. package/components/navigation/menu/hooks/useHoverState.hook.js +20 -47
  402. package/components/navigation/menu/hooks/useKeyboardMovements.hook.js +34 -28
  403. package/components/navigation/menu/hooks/useTransformedDataset.hook.js +21 -14
  404. package/components/navigation/menu/index.js +911 -846
  405. package/components/navigation/menu/props.js +0 -5
  406. package/components/navigation/menu/utils/action-task.js +6 -9
  407. package/components/navigation/menu/utils/role-filter.js +41 -56
  408. package/components/navigation/popover/index.js +192 -205
  409. package/components/navigation/popover/props.js +5 -8
  410. package/components/page/content/index.js +9 -31
  411. package/components/page/content/props.js +0 -5
  412. package/components/page/error-boundary/index.js +115 -105
  413. package/components/page/error-boundary/props.js +0 -5
  414. package/components/page/index.js +100 -102
  415. package/components/page/page-content/index.js +21 -30
  416. package/components/page/page-content/props.js +0 -5
  417. package/components/page/page-context.d.ts +4 -0
  418. package/components/page/page-context.js +5 -0
  419. package/components/page/partial/index.js +50 -45
  420. package/components/page/partial/props.js +0 -5
  421. package/components/page/partial-container/index.js +78 -107
  422. package/components/page/partial-container/props.d.ts +1 -1
  423. package/components/page/partial-container/props.js +0 -5
  424. package/components/page/props.js +0 -5
  425. package/components/page/toast-container/index.js +20 -41
  426. package/components/page/toast-container/props.js +0 -5
  427. package/components/prefab/container/index.js +60 -53
  428. package/components/prefab/container/props.js +0 -5
  429. package/components/prefab/index.js +76 -61
  430. package/components/prefab/props.js +0 -5
  431. package/context/AppContext.d.ts +1 -1
  432. package/context/AppContext.js +17 -18
  433. package/context/AppSpinnerProvider.js +19 -34
  434. package/context/LayoutProvider.js +54 -57
  435. package/context/LocalizationProvider.js +34 -49
  436. package/context/PrefabContext.js +68 -119
  437. package/context/WidgetProvider.js +160 -166
  438. package/core/app-config.js +0 -1
  439. package/core/app.service.js +200 -327
  440. package/core/appVariablesStore.js +10 -15
  441. package/core/appstore.js +37 -53
  442. package/core/constants/currency-constant.js +81 -83
  443. package/core/constants/events.js +34 -44
  444. package/core/constants/index.js +21 -31
  445. package/core/dialog.service.js +52 -72
  446. package/core/event-notifier.js +94 -131
  447. package/core/formatter/array-formatters.js +18 -32
  448. package/core/formatter/date-formatters.js +140 -204
  449. package/core/formatter/index.js +64 -117
  450. package/core/formatter/number-formatters.js +115 -159
  451. package/core/formatter/security-formatters.js +233 -283
  452. package/core/formatter/string-formatters.js +23 -45
  453. package/core/formatter/types.js +12 -18
  454. package/core/formatters.js +6 -24
  455. package/core/proxy-service.js +242 -306
  456. package/core/script-registry.js +87 -134
  457. package/core/security.service.js +8 -11
  458. package/core/util/compare.js +13 -25
  459. package/core/util/dom.js +32 -63
  460. package/core/util/index.js +92 -98
  461. package/core/util/safe-is-equal.js +42 -94
  462. package/core/util/security.js +114 -153
  463. package/core/util/utils.d.ts +4 -1
  464. package/core/util/utils.js +88 -159
  465. package/core/widget-observer.js +34 -61
  466. package/higherOrder/BaseApp.js +328 -502
  467. package/higherOrder/BaseAppProps.d.ts +1 -0
  468. package/higherOrder/BaseAppProps.js +0 -5
  469. package/higherOrder/BaseDateTime.js +277 -231
  470. package/higherOrder/BasePage.js +474 -740
  471. package/higherOrder/BasePartial.js +87 -114
  472. package/higherOrder/BasePrefab.js +190 -206
  473. package/higherOrder/DataNav.js +287 -302
  474. package/higherOrder/helper.js +62 -48
  475. package/higherOrder/props.js +0 -5
  476. package/higherOrder/withBaseWrapper.js +123 -168
  477. package/higherOrder/withStandalone.js +28 -26
  478. package/hooks/useAccess.js +113 -289
  479. package/hooks/useAppConfig.js +15 -40
  480. package/hooks/useAuth.js +256 -495
  481. package/hooks/useDataSourceSubscription.d.ts +3 -3
  482. package/hooks/useDataSourceSubscription.js +99 -109
  483. package/hooks/useDebounce.js +28 -56
  484. package/hooks/useDeviceVisibility.js +14 -23
  485. package/hooks/useHttp.d.ts +1 -0
  486. package/hooks/useHttp.js +314 -493
  487. package/libs/index.js +4 -13
  488. package/libs/prefab/index.js +6 -20
  489. package/mui-config/theme-provider.js +9 -17
  490. package/mui-config/theme.js +6 -9
  491. package/package-lock.json +816 -3207
  492. package/package.json +3 -19
  493. package/providers/AppProviders.js +21 -24
  494. package/runtime-dynamic/App.js +65 -93
  495. package/runtime-dynamic/app-initializer.js +193 -411
  496. package/runtime-dynamic/components/ErrorBoundary.js +59 -76
  497. package/runtime-dynamic/components/PageWrapper.js +23 -35
  498. package/runtime-dynamic/components/PrefabPreview.js +40 -69
  499. package/runtime-dynamic/components/partial-content.d.ts +2 -3
  500. package/runtime-dynamic/components/partial-content.js +66 -45
  501. package/runtime-dynamic/components/prefab-content.js +37 -30
  502. package/runtime-dynamic/components/use-dynamic-component.js +55 -157
  503. package/runtime-dynamic/factories/build-base-page-like-component.d.ts +1 -1
  504. package/runtime-dynamic/factories/build-base-page-like-component.js +44 -58
  505. package/runtime-dynamic/factories/dynamic-component.d.ts +9 -0
  506. package/runtime-dynamic/factories/dynamic-component.js +91 -0
  507. package/runtime-dynamic/factories/prefab-factory.d.ts +1 -1
  508. package/runtime-dynamic/factories/prefab-factory.js +60 -81
  509. package/runtime-dynamic/factories/startup-info.js +12 -25
  510. package/runtime-dynamic/factories/utils.d.ts +2 -10
  511. package/runtime-dynamic/factories/utils.js +47 -129
  512. package/runtime-dynamic/index.js +56 -191
  513. package/runtime-dynamic/main.js +42 -70
  514. package/runtime-dynamic/preview-mode.js +14 -29
  515. package/runtime-dynamic/preview-navigation.js +21 -30
  516. package/runtime-dynamic/preview-path.d.ts +5 -0
  517. package/runtime-dynamic/preview-path.js +13 -0
  518. package/runtime-dynamic/preview-resource-base.js +15 -31
  519. package/runtime-dynamic/registry/component-registry.js +269 -334
  520. package/runtime-dynamic/registry/custom-widget-registry.js +11 -15
  521. package/runtime-dynamic/registry/index.js +24 -63
  522. package/runtime-dynamic/registry/store.d.ts +1 -0
  523. package/runtime-dynamic/registry/store.js +18 -23
  524. package/runtime-dynamic/routes.js +53 -81
  525. package/runtime-dynamic/services/app-extension-provider.js +17 -44
  526. package/runtime-dynamic/services/autolayout-inject.d.ts +4 -0
  527. package/runtime-dynamic/services/autolayout-inject.js +27 -0
  528. package/runtime-dynamic/services/compile-render.d.ts +9 -0
  529. package/runtime-dynamic/services/compile-render.js +142 -0
  530. package/runtime-dynamic/services/component-ref-provider.d.ts +18 -3
  531. package/runtime-dynamic/services/component-ref-provider.js +52 -129
  532. package/runtime-dynamic/services/css-scoping.js +23 -28
  533. package/runtime-dynamic/services/fragment-url.js +37 -50
  534. package/runtime-dynamic/services/index.d.ts +2 -3
  535. package/runtime-dynamic/services/index.js +31 -152
  536. package/runtime-dynamic/services/markup-transpiler.d.ts +2 -2
  537. package/runtime-dynamic/services/markup-transpiler.js +39 -231
  538. package/runtime-dynamic/services/prefab-resources.js +40 -118
  539. package/runtime-dynamic/services/resource-manager.d.ts +2 -2
  540. package/runtime-dynamic/services/resource-manager.js +24 -65
  541. package/runtime-dynamic/services/script-executor.js +46 -63
  542. package/runtime-dynamic/services/variable-factory.js +141 -184
  543. package/runtime-dynamic/services/variable-registry.js +65 -115
  544. package/runtime-dynamic/services/variable-transpiler.js +73 -103
  545. package/runtime-dynamic/shims/next-image.js +79 -50
  546. package/runtime-dynamic/shims/next-link.js +58 -32
  547. package/runtime-dynamic/shims/next-navigation.js +17 -34
  548. package/runtime-dynamic/utils/index.js +15 -30
  549. package/store/bindActions/i18nActions.js +16 -18
  550. package/store/index.js +29 -35
  551. package/store/middleware/navigationMiddleware.js +25 -45
  552. package/store/middleware/pendingTabNavigationIntentMiddleware.js +20 -25
  553. package/store/slices/appConfigSlice.js +65 -94
  554. package/store/slices/authSlice.js +317 -471
  555. package/store/slices/i18nSlice.js +169 -168
  556. package/store/slices/navigationSlice.js +22 -20
  557. package/store/util/resolve-path.d.ts +1 -0
  558. package/store/util/resolve-path.js +7 -0
  559. package/store/viewport.service.js +150 -194
  560. package/types/index.js +10 -15
  561. package/utils/attr.js +191 -41
  562. package/utils/custom-expression/index.js +58 -151
  563. package/utils/custom-expression/parser.js +108 -182
  564. package/utils/dataset-util.js +113 -154
  565. package/utils/eval-expression.js +10 -19
  566. package/utils/form-state.util.js +60 -118
  567. package/utils/form-utils.js +49 -190
  568. package/utils/format-util.js +113 -184
  569. package/utils/layoutsize-util.js +11 -17
  570. package/utils/lib-error-skipper.js +54 -52
  571. package/utils/page-params-util.js +50 -40
  572. package/utils/pending-tab-navigation-intent.js +7 -17
  573. package/utils/resource-url.js +8 -19
  574. package/utils/state-persistance.d.ts +1 -1
  575. package/utils/state-persistance.js +136 -253
  576. package/utils/style-utils.js +24 -78
  577. package/utils/transformedDataset-utils.js +353 -381
  578. package/utils/widget-cleanup-util.js +42 -74
  579. package/utils/widgets.js +19 -31
  580. package/variables/base-variable.js +117 -166
  581. package/variables/constants.js +5 -8
  582. package/variables/crud-variable.js +150 -181
  583. package/variables/live-variable.d.ts +1 -1
  584. package/variables/live-variable.js +140 -174
  585. package/variables/metadata.service.js +74 -116
  586. package/variables/model-variable.js +68 -78
  587. package/variables/service-variable.js +171 -285
  588. package/wm-namespace.js +11 -14
  589. package/components/chart/src/css.d.js +0 -1
  590. package/runtime-dynamic/services/cache.d.ts +0 -29
  591. package/runtime-dynamic/services/cache.js +0 -57
  592. package/tsconfig.declaration.tsbuildinfo +0 -1
  593. package/types/global.d.js +0 -3
@@ -1,210 +1,190 @@
1
- "use strict";
2
1
  "use client";
3
-
4
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5
- var _typeof3 = require("@babel/runtime/helpers/typeof");
6
- Object.defineProperty(exports, "__esModule", {
7
- value: true
8
- });
9
- exports.withPageContext = exports["default"] = void 0;
10
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
12
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
14
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
- var _react = _interopRequireWildcard(require("react"));
16
- var _navigation = require("next/navigation");
17
- var _isEqual = _interopRequireDefault(require("lodash-es/isEqual"));
18
- var _cloneDeep = _interopRequireDefault(require("lodash-es/cloneDeep"));
19
- var _merge = _interopRequireDefault(require("lodash-es/merge"));
20
- var _compare = _interopRequireDefault(require("../core/util/compare"));
21
- var _WidgetProvider = require("@wavemaker-ai/react-runtime/context/WidgetProvider");
22
- var _spinner = require("@wavemaker-ai/react-runtime/components/basic/spinner");
23
- var _appVariablesStore = require("@wavemaker-ai/react-runtime/core/appVariablesStore");
24
- var _store = require("@wavemaker-ai/react-runtime/store");
25
- var _AppContext = require("@wavemaker-ai/react-runtime/context/AppContext");
26
- var _useAccess2 = _interopRequireDefault(require("@wavemaker-ai/react-runtime/hooks/useAccess"));
27
- var _authSlice = require("@wavemaker-ai/react-runtime/store/slices/authSlice");
28
- var _types = require("@wavemaker-ai/react-runtime/types");
29
- var _proxyService = require("@wavemaker-ai/react-runtime/core/proxy-service");
30
- var _helper = require("@wavemaker-ai/react-runtime/higherOrder/helper");
31
- var _toast = require("@wavemaker-ai/react-runtime/actions/toast.service");
32
- var _appstore = _interopRequireDefault(require("@wavemaker-ai/react-runtime/core/appstore"));
33
- var _scriptRegistry = require("@wavemaker-ai/react-runtime/core/script-registry");
34
- var _formatters = _interopRequireDefault(require("../core/formatters"));
35
- var _AppContext2 = require("../context/AppContext");
36
- var _pageParamsUtil = require("../utils/page-params-util");
37
- var _AppSpinnerProvider = require("../context/AppSpinnerProvider");
38
- var _get = _interopRequireDefault(require("lodash-es/get"));
39
- var _events = require("../core/constants/events");
40
- var _libErrorSkipper = require("../utils/lib-error-skipper");
41
- var _viewport = require("../store/viewport.service");
42
- var _util = require("../core/util");
43
- var _utils = require("../core/util/utils");
44
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
45
- var __jsx = _react["default"].createElement;
46
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
47
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
48
- var withPageContext = exports.withPageContext = function withPageContext(WrappedComponent, addPageScript, getVariables, componentInfo, prefabInfo) {
49
- var PageContextComponent = function PageContextComponent(props) {
50
- var _useAppSpinner, _info$appConfig;
51
- var dispatch = (0, _store.useAppDispatch)();
52
- var _ref = (_useAppSpinner = (0, _AppSpinnerProvider.useAppSpinner)()) !== null && _useAppSpinner !== void 0 ? _useAppSpinner : {},
53
- show = _ref.show,
54
- hide = _ref.hide;
55
- var i18n = (0, _store.useAppSelector)(function (state) {
56
- return state.i18n;
57
- });
58
- var info = (0, _store.useAppSelector)(function (state) {
59
- return state.info;
60
- });
61
- var pageParams = (0, _navigation.useSearchParams)();
62
- // Get app context if available (when used within BaseApp)
63
- var appContext = (0, _AppContext.useAppContext)();
64
- var appProxy = (0, _AppContext2.useAppProxy)();
65
-
66
- // Use optimized access hook instead of useAccess
67
- var _useAccess = (0, _useAccess2["default"])({
68
- componentName: (componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentName) || "Main",
69
- type: (componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentType) || "PAGE"
70
- }),
71
- hasAccess = _useAccess.hasAccess,
72
- accessLoading = _useAccess.loading,
73
- accessError = _useAccess.error;
74
-
75
- // Get security status for debugging
76
- var isSecurityEnabled = (0, _store.useAppSelector)(function (state) {
77
- var _state$auth$securityC;
78
- return (_state$auth$securityC = state.auth.securityConfig) === null || _state$auth$securityC === void 0 ? void 0 : _state$auth$securityC.isSecurityEnabled;
79
- });
80
- var securityConfig = (0, _store.useAppSelector)(function (state) {
81
- return state.auth.securityConfig;
82
- });
83
- var isAuthenticated = (0, _store.useAppSelector)(function (state) {
84
- var _state$auth$loggedInU;
85
- return (_state$auth$loggedInU = state.auth.loggedInUser) === null || _state$auth$loggedInU === void 0 ? void 0 : _state$auth$loggedInU.isAuthenticated;
86
- });
87
- var loggedInUser = (0, _store.useAppSelector)(function (state) {
88
- return state.auth.loggedInUser;
89
- });
90
- var appConfig = (0, _store.useAppSelector)(function (state) {
91
- return state.info.appConfig;
92
- });
93
- var pendingAccordionExpansion = (0, _store.useAppSelector)(function (state) {
94
- return state.navigation.pendingAccordionExpansion;
95
- });
96
- var pendingTabSelection = (0, _store.useAppSelector)(function (state) {
97
- return state.navigation.pendingTabSelection;
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 { jsx } from "react/jsx-runtime";
22
+ import { useState, useEffect, useRef, useMemo, useCallback } from "react";
23
+ import { useSearchParams } from "next/navigation";
24
+ import isEqual from "lodash-es/isEqual";
25
+ import cloneDeep from "lodash-es/cloneDeep";
26
+ import merge from "lodash-es/merge";
27
+ import compare from "../core/util/compare";
28
+ import { WidgetProvider } from "../context/WidgetProvider";
29
+ import { WmSpinner } from "../components/basic/spinner";
30
+ import { getAppVariablesInstance } from "../core/appVariablesStore";
31
+ import { useAppSelector, useAppDispatch } from "../store";
32
+ import { useAppContext } from "../context/AppContext";
33
+ import useAccess from "../hooks/useAccess";
34
+ import { redirectToLogin } from "../store/slices/authSlice";
35
+ import {
36
+ VariableEvents
37
+ } from "../types";
38
+ import { createStateProxy } from "../core/proxy-service";
39
+ import {
40
+ accordionExpansionHandler,
41
+ mergeVariablesAndActions,
42
+ tabSelectionHandler
43
+ } from "./helper";
44
+ import { toastService } from "../actions/toast.service";
45
+ import appstore from "../core/appstore";
46
+ import {
47
+ createOverriddenPropsRegistry,
48
+ withSuspendedTracking
49
+ } from "../core/script-registry";
50
+ import formatters from "../core/formatters";
51
+ import { useAppProxy } from "../context/AppContext";
52
+ import {
53
+ computeMergedPageParams,
54
+ computePartialParamKey,
55
+ extractPartialParamValues
56
+ } from "../utils/page-params-util";
57
+ import { useAppSpinner } from "../context/AppSpinnerProvider";
58
+ import get from "lodash-es/get";
59
+ import { EVENTEMITTER_METHODS } from "../core/constants/events";
60
+ import { wrapWithThirdPartyErrorGuard } from "../utils/lib-error-skipper";
61
+ import { viewportService } from "../store/viewport.service";
62
+ import { formatMessage } from "../core/util";
63
+ const withPageContext = (WrappedComponent, addPageScript, getVariables, componentInfo, prefabInfo) => {
64
+ const PageContextComponent = (props) => {
65
+ var _a, _b, _c;
66
+ const dispatch = useAppDispatch();
67
+ const { show, hide } = (_a = useAppSpinner()) != null ? _a : {};
68
+ const i18n = useAppSelector((state) => state.i18n);
69
+ const info = useAppSelector((state) => state.info);
70
+ const pageParams = useSearchParams();
71
+ const appContext = useAppContext();
72
+ const appProxy = useAppProxy();
73
+ const {
74
+ hasAccess,
75
+ loading: accessLoading,
76
+ error: accessError
77
+ } = useAccess({
78
+ componentName: (componentInfo == null ? void 0 : componentInfo.componentName) || "Main",
79
+ type: (componentInfo == null ? void 0 : componentInfo.componentType) || "PAGE"
98
80
  });
99
-
100
- // Initialization state management
101
- var _useState = (0, _react.useState)(false),
102
- isInitialized = _useState[0],
103
- setIsInitialized = _useState[1];
104
- var _useState2 = (0, _react.useState)(false),
105
- startupComplete = _useState2[0],
106
- setStartupComplete = _useState2[1];
107
- var _useState3 = (0, _react.useState)(false),
108
- isLayoutReady = _useState3[0],
109
- setIsLayoutReady = _useState3[1];
110
-
111
- // Refs for managing component lifecycle
112
- var redirectHandledRef = (0, _react.useRef)(false);
113
- var subscriptionsRef = (0, _react.useRef)([]);
114
- var pendingStartupOpsRef = (0, _react.useRef)(new Set());
115
- var startUpVariableLoadedRef = (0, _react.useRef)(false);
116
- var pageProxyRef = (0, _react.useRef)(null);
117
- var urlTabProcessedRef = (0, _react.useRef)(false); // Track if URL tab parameter has been processed
118
- var isInitializingRef = (0, _react.useRef)(false);
119
- var isMountedRef = (0, _react.useRef)(true);
120
- var appVarSubscriptionsDoneRef = (0, _react.useRef)(false);
121
- var subscribedVariableNamesRef = (0, _react.useRef)(new Set());
122
- var overriddenPropsRegistryRef = (0, _react.useRef)(null);
123
- var onStartupCompletedRef = (0, _react.useRef)(false);
124
- var _useState4 = (0, _react.useState)(false),
125
- isPageReady = _useState4[0],
126
- setIsPageReady = _useState4[1];
127
- var pageReady = (0, _react.useCallback)(function () {
81
+ const isSecurityEnabled = useAppSelector(
82
+ (state) => {
83
+ var _a2;
84
+ return (_a2 = state.auth.securityConfig) == null ? void 0 : _a2.isSecurityEnabled;
85
+ }
86
+ );
87
+ const securityConfig = useAppSelector((state) => state.auth.securityConfig);
88
+ const isAuthenticated = useAppSelector(
89
+ (state) => {
90
+ var _a2;
91
+ return (_a2 = state.auth.loggedInUser) == null ? void 0 : _a2.isAuthenticated;
92
+ }
93
+ );
94
+ const appConfig = useAppSelector((state) => state.info.appConfig);
95
+ const pendingAccordionExpansion = useAppSelector(
96
+ (state) => state.navigation.pendingAccordionExpansion
97
+ );
98
+ const pendingTabSelection = useAppSelector(
99
+ (state) => state.navigation.pendingTabSelection
100
+ );
101
+ const [isInitialized, setIsInitialized] = useState(false);
102
+ const [isLayoutReady, setIsLayoutReady] = useState(false);
103
+ const redirectHandledRef = useRef(false);
104
+ const subscriptionsRef = useRef([]);
105
+ const pendingStartupOpsRef = useRef(/* @__PURE__ */ new Set());
106
+ const startUpVariableLoadedRef = useRef(false);
107
+ const pageProxyRef = useRef(null);
108
+ const urlTabProcessedRef = useRef(false);
109
+ const isInitializingRef = useRef(false);
110
+ const isMountedRef = useRef(true);
111
+ const appVarSubscriptionsDoneRef = useRef(false);
112
+ const subscribedVariableNamesRef = useRef(/* @__PURE__ */ new Set());
113
+ const overriddenPropsRegistryRef = useRef(null);
114
+ const onStartupCompletedRef = useRef(false);
115
+ const [isPageReady, setIsPageReady] = useState(false);
116
+ const pageReady = useCallback(() => {
128
117
  setIsPageReady(true);
129
118
  }, []);
130
-
131
- // Initial page context state
132
- var _useState5 = (0, _react.useState)(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
133
- Widgets: {},
134
- Variables: {},
135
- Actions: {},
136
- onReady: function onReady() {},
137
- serviceDefinitions: (0, _cloneDeep["default"])((prefabInfo === null || prefabInfo === void 0 ? void 0 : prefabInfo.serviceDefs) || (appContext === null || appContext === void 0 ? void 0 : appContext.serviceDefinitions) || {}),
138
- pageParams: props.pageParams || {},
139
- 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) || "",
140
- appConfig: appContext === null || appContext === void 0 ? void 0 : appContext.appConfig,
141
- notification: {},
142
- toaster: _toast.toastService,
143
- onContentReady: onContentReady,
144
- onChange: updateWidgetState,
145
- pageReady: pageReady,
146
- App: {},
147
- eval: appContext === null || appContext === void 0 ? void 0 : appContext.eval,
148
- appLocale: (componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.appLocale) || i18n.appLocale || {},
149
- localeFormats: {
150
- date: i18n.dateFormat,
151
- time: i18n.timeFormat,
152
- currency: i18n.currencyCode
153
- }
154
- }, prefabInfo), props), componentInfo), {}, {
155
- executeStartup: executeStartup,
156
- formatters: _formatters["default"],
157
- Viewport: _viewport.viewportService.getViewport(),
158
- formatMessage: _util.formatMessage,
159
- overriddenPropsRegistryRef: overriddenPropsRegistryRef.current,
160
- layoutReady: layoutReady,
161
- activePageName: componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentName
162
- })),
163
- pageContext = _useState5[0],
164
- setPageContext = _useState5[1];
165
- // Enhanced initial app config that inherits from app context if available
166
- var initialAppConfig = (0, _react.useMemo)(function () {
167
- return appContext;
168
- }, [appContext]);
169
-
170
- // Compute a stable key from partial param values for dependency tracking
171
- var partialParamValuesKey = (0, _pageParamsUtil.computePartialParamKey)(componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentType, props.params, props);
172
- var authLoggedInUser = (0, _store.useAppSelector)(function (state) {
173
- return state.auth.loggedInUser;
174
- });
175
- (0, _react.useEffect)(function () {
119
+ const [pageContext, setPageContext] = useState(__spreadProps(__spreadValues(__spreadValues(__spreadValues({
120
+ Widgets: {},
121
+ Variables: {},
122
+ Actions: {},
123
+ onReady: () => {
124
+ },
125
+ serviceDefinitions: cloneDeep(
126
+ (prefabInfo == null ? void 0 : prefabInfo.serviceDefs) || (appContext == null ? void 0 : appContext.serviceDefinitions) || {}
127
+ ),
128
+ pageParams: props.pageParams || {},
129
+ baseUrl: (prefabInfo == null ? void 0 : prefabInfo.baseUrl) || ((_b = info == null ? void 0 : info.appConfig) == null ? void 0 : _b.url) || "",
130
+ appConfig: appContext == null ? void 0 : appContext.appConfig,
131
+ notification: {},
132
+ toaster: toastService,
133
+ onContentReady,
134
+ onChange: updateWidgetState,
135
+ pageReady,
136
+ App: {},
137
+ eval: appContext == null ? void 0 : appContext.eval,
138
+ appLocale: (componentInfo == null ? void 0 : componentInfo.appLocale) || i18n.appLocale || {},
139
+ localeFormats: {
140
+ date: i18n.dateFormat,
141
+ time: i18n.timeFormat,
142
+ currency: i18n.currencyCode
143
+ }
144
+ }, prefabInfo), props), componentInfo), {
145
+ executeStartup,
146
+ formatters,
147
+ Viewport: viewportService.getViewport(),
148
+ formatMessage,
149
+ overriddenPropsRegistryRef: overriddenPropsRegistryRef.current,
150
+ layoutReady,
151
+ activePageName: componentInfo == null ? void 0 : componentInfo.componentName
152
+ }));
153
+ const initialAppConfig = useMemo(() => appContext, [appContext]);
154
+ const partialParamValuesKey = computePartialParamKey(
155
+ componentInfo == null ? void 0 : componentInfo.componentType,
156
+ props.params,
157
+ props
158
+ );
159
+ const authLoggedInUser = useAppSelector((state) => state.auth.loggedInUser);
160
+ useEffect(() => {
176
161
  if (!pageProxyRef.current) return;
177
162
  pageProxyRef.current.appConfig.loggedInUser = authLoggedInUser;
178
- setPageContext(function (prev) {
179
- return _objectSpread(_objectSpread({}, prev), {}, {
180
- appConfig: _objectSpread(_objectSpread({}, prev.appConfig), {}, {
181
- loggedInUser: authLoggedInUser
182
- })
183
- });
184
- });
163
+ setPageContext((prev) => __spreadProps(__spreadValues({}, prev), {
164
+ appConfig: __spreadProps(__spreadValues({}, prev.appConfig), { loggedInUser: authLoggedInUser })
165
+ }));
185
166
  }, [authLoggedInUser]);
186
- (0, _react.useEffect)(function () {
187
- pageContext.serviceDefinitions = (0, _cloneDeep["default"])((prefabInfo === null || prefabInfo === void 0 ? void 0 : prefabInfo.serviceDefs) || (appContext === null || appContext === void 0 ? void 0 : appContext.serviceDefinitions) || {});
188
- setPageContext(function (prev) {
189
- return _objectSpread(_objectSpread({}, prev), {}, {
190
- serviceDefinitions: (0, _cloneDeep["default"])((prefabInfo === null || prefabInfo === void 0 ? void 0 : prefabInfo.serviceDefs) || (appContext === null || appContext === void 0 ? void 0 : appContext.serviceDefinitions) || {})
191
- });
192
- });
193
- }, [appContext === null || appContext === void 0 ? void 0 : appContext.serviceDefinitions, prefabInfo === null || prefabInfo === void 0 ? void 0 : prefabInfo.serviceDefs]);
194
- // Subscribe for partial params changes - sync prop values to pageParams
195
- (0, _react.useEffect)(function () {
196
- if ((componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentType) !== "PARTIAL" || !pageProxyRef.current) {
167
+ useEffect(() => {
168
+ pageContext.serviceDefinitions = cloneDeep(
169
+ (prefabInfo == null ? void 0 : prefabInfo.serviceDefs) || (appContext == null ? void 0 : appContext.serviceDefinitions) || {}
170
+ );
171
+ setPageContext((prev) => __spreadProps(__spreadValues({}, prev), {
172
+ serviceDefinitions: cloneDeep(
173
+ (prefabInfo == null ? void 0 : prefabInfo.serviceDefs) || (appContext == null ? void 0 : appContext.serviceDefinitions) || {}
174
+ )
175
+ }));
176
+ }, [appContext == null ? void 0 : appContext.serviceDefinitions, prefabInfo == null ? void 0 : prefabInfo.serviceDefs]);
177
+ useEffect(() => {
178
+ if ((componentInfo == null ? void 0 : componentInfo.componentType) !== "PARTIAL" || !pageProxyRef.current) {
197
179
  return;
198
180
  }
199
- var paramValues = (0, _pageParamsUtil.extractPartialParamValues)(props.params || [], props);
200
-
201
- // Update pageParams for each param key when prop values change
202
- Object.entries(paramValues).forEach(function (_ref2) {
203
- var _pageProxyRef$current;
204
- var _ref3 = (0, _slicedToArray2["default"])(_ref2, 2),
205
- key = _ref3[0],
206
- newValue = _ref3[1];
207
- if (!(0, _isEqual["default"])((_pageProxyRef$current = pageProxyRef.current.pageParams) === null || _pageProxyRef$current === void 0 ? void 0 : _pageProxyRef$current[key], newValue)) {
181
+ const paramValues = extractPartialParamValues(
182
+ props.params || [],
183
+ props
184
+ );
185
+ Object.entries(paramValues).forEach(([key, newValue]) => {
186
+ var _a2;
187
+ if (!isEqual((_a2 = pageProxyRef.current.pageParams) == null ? void 0 : _a2[key], newValue)) {
208
188
  if (!pageProxyRef.current.pageParams) {
209
189
  pageProxyRef.current.pageParams = {};
210
190
  }
@@ -212,70 +192,57 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
212
192
  }
213
193
  });
214
194
  }, [partialParamValuesKey]);
215
-
216
- // Handle redirect to login if authentication is required
217
- (0, _react.useEffect)(function () {
218
- var _appConfig$pages;
219
- if ((componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentType) !== "PAGE" || redirectHandledRef.current || accessLoading || !isSecurityEnabled) {
195
+ useEffect(() => {
196
+ var _a2;
197
+ if ((componentInfo == null ? void 0 : componentInfo.componentType) !== "PAGE" || redirectHandledRef.current || accessLoading || !isSecurityEnabled) {
220
198
  return;
221
199
  }
222
-
223
- // Check if page requires authentication
224
- var pageConfig = appConfig === null || appConfig === void 0 || (_appConfig$pages = appConfig.pages) === null || _appConfig$pages === void 0 ? void 0 : _appConfig$pages.find(function (p) {
225
- var _componentInfo$compon;
226
- return p.name.toLowerCase() === (componentInfo === null || componentInfo === void 0 || (_componentInfo$compon = componentInfo.componentName) === null || _componentInfo$compon === void 0 ? void 0 : _componentInfo$compon.toLowerCase());
227
- });
228
-
229
- // Redirect to login if page requires authentication and user is not authenticated
230
- var requiresAuth = (pageConfig === null || pageConfig === void 0 ? void 0 : pageConfig.permission) === "Authenticated" || (pageConfig === null || pageConfig === void 0 ? void 0 : pageConfig.permission) === "Role";
200
+ const pageConfig = (_a2 = appConfig == null ? void 0 : appConfig.pages) == null ? void 0 : _a2.find(
201
+ (p) => {
202
+ var _a3;
203
+ return p.name.toLowerCase() === ((_a3 = componentInfo == null ? void 0 : componentInfo.componentName) == null ? void 0 : _a3.toLowerCase());
204
+ }
205
+ );
206
+ const requiresAuth = (pageConfig == null ? void 0 : pageConfig.permission) === "Authenticated" || (pageConfig == null ? void 0 : pageConfig.permission) === "Role";
231
207
  if (requiresAuth && !isAuthenticated) {
232
208
  redirectHandledRef.current = true;
233
- dispatch((0, _authSlice.redirectToLogin)({
234
- redirectTo: componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentName,
235
- securityConfig: securityConfig
236
- }));
209
+ dispatch(
210
+ redirectToLogin({
211
+ redirectTo: componentInfo == null ? void 0 : componentInfo.componentName,
212
+ securityConfig
213
+ })
214
+ );
237
215
  }
238
- }, [accessLoading, isSecurityEnabled, isAuthenticated, appConfig, componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentType, componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentName, dispatch, securityConfig]);
239
-
240
- // Check if we should proceed with initialization
241
- var shouldInitialize = (0, _react.useMemo)(function () {
242
- // Wait for app to be ready (if app context exists)
216
+ }, [
217
+ accessLoading,
218
+ isSecurityEnabled,
219
+ isAuthenticated,
220
+ appConfig,
221
+ componentInfo == null ? void 0 : componentInfo.componentType,
222
+ componentInfo == null ? void 0 : componentInfo.componentName,
223
+ dispatch,
224
+ securityConfig
225
+ ]);
226
+ const shouldInitialize = useMemo(() => {
243
227
  if (appContext && !appContext.isAppReady) {
244
228
  return false;
245
229
  }
246
-
247
- // Wait for access check to complete
248
230
  if (accessLoading) {
249
231
  return false;
250
232
  }
251
-
252
- // Don't initialize if no access
253
- if (!hasAccess && isSecurityEnabled) {
254
- if (isAuthenticated) {
255
- var _pageContext$appLocal;
256
- appContext === null || appContext === void 0 || appContext.notifyApp((pageContext === null || pageContext === void 0 || (_pageContext$appLocal = pageContext.appLocale) === null || _pageContext$appLocal === void 0 || (_pageContext$appLocal = _pageContext$appLocal.LABELS) === null || _pageContext$appLocal === void 0 ? void 0 : _pageContext$appLocal.ACCESS_DENIED) || "Access Denied", "Error");
257
- }
258
- return false;
259
- }
260
233
  return true;
261
- }, [appContext === null || appContext === void 0 ? void 0 : appContext.isAppReady, accessLoading, hasAccess, isSecurityEnabled, isAuthenticated]);
262
-
263
- // Update page context with app variables when app context changes
264
- (0, _react.useEffect)(function () {
265
- if (!(appContext !== null && appContext !== void 0 && appContext.isAppReady) || !pageProxyRef.current) {
234
+ }, [appContext == null ? void 0 : appContext.isAppReady, accessLoading, hasAccess, isSecurityEnabled, isAuthenticated]);
235
+ useEffect(() => {
236
+ if (!(appContext == null ? void 0 : appContext.isAppReady) || !pageProxyRef.current) {
266
237
  return;
267
238
  }
268
-
269
- // Update page context with app variables without triggering re-initialization
270
- setPageContext(function (prev) {
271
- var updatedVariables = _objectSpread(_objectSpread({}, prev.Variables), appContext.Variables || {});
272
- var updatedActions = _objectSpread(_objectSpread({}, prev.Actions), appContext.Actions || {});
273
-
274
- // Update proxy with the same object references
239
+ setPageContext((prev) => {
240
+ const updatedVariables = __spreadValues(__spreadValues({}, prev.Variables), appContext.Variables || {});
241
+ const updatedActions = __spreadValues(__spreadValues({}, prev.Actions), appContext.Actions || {});
275
242
  pageProxyRef.current.Variables = updatedVariables;
276
243
  pageProxyRef.current.Actions = updatedActions;
277
- return _objectSpread(_objectSpread({}, prev), {}, {
278
- App: _objectSpread(_objectSpread({}, prev.App), {}, {
244
+ return __spreadProps(__spreadValues({}, prev), {
245
+ App: __spreadProps(__spreadValues({}, prev.App), {
279
246
  Variables: appContext.Variables || {},
280
247
  Actions: appContext.Actions || {}
281
248
  }),
@@ -283,135 +250,93 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
283
250
  Actions: updatedActions
284
251
  });
285
252
  });
286
- }, [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]);
287
-
288
- // Main initialization effect - runs only when conditions are met
289
- (0, _react.useEffect)(function () {
290
- // Early returns for non-initialization cases
253
+ }, [appContext == null ? void 0 : appContext.isAppReady, appContext == null ? void 0 : appContext.Variables, appContext == null ? void 0 : appContext.Actions]);
254
+ useEffect(() => {
291
255
  if (!shouldInitialize || isInitialized || isInitializingRef.current || !isMountedRef.current) {
292
256
  return;
293
257
  }
294
-
295
- // Set initialization flag
296
258
  isInitializingRef.current = true;
297
- var initializeComponent = /*#__PURE__*/function () {
298
- var _ref4 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
299
- var pageProxy, pageVariables, appVariables, APP_VARIABLES, _mergeVariablesAndAct, Variables, Actions, urlParams, newParams, localeFormats, _pageName;
300
- return _regenerator["default"].wrap(function _callee$(_context) {
301
- while (1) switch (_context.prev = _context.next) {
302
- case 0:
303
- try {
304
- // Create overridden props registry
305
- overriddenPropsRegistryRef.current = (0, _scriptRegistry.createOverriddenPropsRegistry)();
306
- // Create page proxy
307
- pageProxy = (0, _proxyService.createStateProxy)(pageContext, [], setPageContext, overriddenPropsRegistryRef.current);
308
- pageProxyRef.current = pageProxy;
309
-
310
- // Initialize variables and actions
311
- pageVariables = getVariables(pageProxy); // Handle app variables based on app context availability
312
- appVariables = {
313
- Variables: {},
314
- Actions: {}
315
- };
316
- if (appContext !== null && appContext !== void 0 && appContext.isAppReady) {
317
- // If app context is available and ready, use app variables directly
318
- appVariables = {
319
- Variables: appContext.Variables || {},
320
- Actions: appContext.Actions || {}
321
- };
322
- } else {
323
- // Fallback to traditional app variable initialization
324
- // @ts-ignore
325
- APP_VARIABLES = _appstore["default"].get("AppConfig").appVariables;
326
- appVariables = APP_VARIABLES ? (0, _appVariablesStore.getAppVariablesInstance)(pageProxy, APP_VARIABLES) : {
327
- Variables: {},
328
- Actions: {}
329
- };
330
- }
331
- _mergeVariablesAndAct = (0, _helper.mergeVariablesAndActions)(pageVariables, appVariables), Variables = _mergeVariablesAndAct.Variables, Actions = _mergeVariablesAndAct.Actions; // Compute page params from URL and include partial params when applicable
332
- urlParams = Object.fromEntries(pageParams.entries());
333
- newParams = (0, _pageParamsUtil.computeMergedPageParams)(urlParams, {
334
- componentType: componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentType,
335
- props: props
336
- });
337
- appProxy.appLocale = i18n.appLocale || {};
338
- localeFormats = {
339
- date: i18n.dateFormat,
340
- time: i18n.timeFormat,
341
- currency: i18n.currencyCode
342
- };
343
- appProxy.localeFormats = localeFormats;
344
- pageProxy.localeFormats = localeFormats;
345
-
346
- // Update proxy with merged variables and actions
347
- pageProxy.Variables = Variables;
348
- pageProxy.Actions = Actions;
349
- pageProxy.pageParams = _objectSpread({}, newParams);
350
- pageProxy.pageReady = pageReady;
351
- pageProxy.App = _objectSpread(_objectSpread({}, appProxy), initialAppConfig);
352
- pageProxy.selectedLocale = i18n.selectedLocale || "en";
353
- pageProxy.overriddenPropsRegistry = overriddenPropsRegistryRef.current;
354
-
355
- // Setup variable event handlers
356
- setupVariableSubscriptions(pageVariables.Variables);
357
- if ((componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentType) === "PAGE" && appProxy) {
358
- _pageName = componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentName;
359
- appProxy.updateActivePage(_pageName);
360
- appProxy.activePage = pageProxy;
361
- appProxy.activePageName = _pageName;
362
- appProxy.Widgets = (0, _utils.mergeProxies)(appProxy.Widgets, pageProxy.Widgets);
363
- } else if ((componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentName) === "Common" && (componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentType) === "PARTIAL" && appProxy) {
364
- appProxy.Widgets = (0, _utils.mergeProxies)(appProxy.Widgets, pageProxy.Widgets);
365
- }
366
-
367
- // Initialize page script
368
- addPageScript(appProxy, pageProxy);
369
-
370
- // Gaurd for unsupported third party functionality
371
- (0, _libErrorSkipper.wrapWithThirdPartyErrorGuard)(pageProxy, appContext, (componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentName) || "Prefab");
372
-
373
- // Setup global wm object for pages
374
- if ((componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentType) === "PAGE") {
375
- global.wm = appProxy ? _objectSpread(_objectSpread({}, pageProxy), {}, {
376
- App: appProxy
377
- }) : pageProxy;
378
- }
379
-
380
- // Mark as initialized
381
- setIsInitialized(true);
382
- } catch (error) {
383
- console.error("Error during component initialization:", error);
384
- // Still mark as initialized to prevent hanging
385
- setIsInitialized(true);
386
- } finally {
387
- isInitializingRef.current = false;
388
- }
389
- case 1:
390
- case "end":
391
- return _context.stop();
392
- }
393
- }, _callee);
394
- }));
395
- return function initializeComponent() {
396
- return _ref4.apply(this, arguments);
397
- };
398
- }();
259
+ const initializeComponent = async () => {
260
+ var _a2;
261
+ try {
262
+ overriddenPropsRegistryRef.current = createOverriddenPropsRegistry();
263
+ const pageProxy = createStateProxy(
264
+ pageContext,
265
+ [],
266
+ setPageContext,
267
+ overriddenPropsRegistryRef.current
268
+ );
269
+ pageProxyRef.current = pageProxy;
270
+ const pageVariables = getVariables(pageProxy);
271
+ let appVariables = { Variables: {}, Actions: {} };
272
+ if (appContext == null ? void 0 : appContext.isAppReady) {
273
+ appVariables = {
274
+ Variables: appContext.Variables || {},
275
+ Actions: appContext.Actions || {}
276
+ };
277
+ } else {
278
+ const APP_VARIABLES = appstore.get("AppConfig").appVariables;
279
+ appVariables = APP_VARIABLES ? getAppVariablesInstance(pageProxy, APP_VARIABLES) : { Variables: {}, Actions: {} };
280
+ }
281
+ const { Variables, Actions } = mergeVariablesAndActions(pageVariables, appVariables);
282
+ const urlParams = Object.fromEntries(pageParams.entries());
283
+ const newParams = computeMergedPageParams(urlParams, {
284
+ componentType: componentInfo == null ? void 0 : componentInfo.componentType,
285
+ props
286
+ });
287
+ pageProxy.pageParams = newParams;
288
+ if ((componentInfo == null ? void 0 : componentInfo.componentType) !== "PAGE") {
289
+ pageProxy.partialParams = newParams;
290
+ (_a2 = props.onLoad) == null ? void 0 : _a2.call(props, pageProxy);
291
+ }
292
+ appProxy.appLocale = i18n.appLocale || {};
293
+ const localeFormats = {
294
+ date: i18n.dateFormat,
295
+ time: i18n.timeFormat,
296
+ currency: i18n.currencyCode
297
+ };
298
+ appProxy.localeFormats = localeFormats;
299
+ pageProxy.localeFormats = localeFormats;
300
+ pageProxy.Variables = Variables;
301
+ pageProxy.Actions = Actions;
302
+ pageProxy.pageReady = pageReady;
303
+ pageProxy.App = __spreadValues(__spreadValues({}, appProxy), initialAppConfig);
304
+ pageProxy.selectedLocale = i18n.selectedLocale || "en";
305
+ pageProxy.overriddenPropsRegistry = overriddenPropsRegistryRef.current;
306
+ setupVariableSubscriptions(pageVariables.Variables);
307
+ if ((componentInfo == null ? void 0 : componentInfo.componentType) === "PAGE" && appProxy) {
308
+ const pageName2 = componentInfo == null ? void 0 : componentInfo.componentName;
309
+ appProxy.updateActivePage(pageName2);
310
+ appProxy.activePage = pageProxy;
311
+ appProxy.activePageName = pageName2;
312
+ Object.assign(appProxy.Widgets, pageProxy.Widgets);
313
+ } else if ((componentInfo == null ? void 0 : componentInfo.componentName) === "Common" && (componentInfo == null ? void 0 : componentInfo.componentType) === "PARTIAL" && appProxy) {
314
+ Object.assign(appProxy.Widgets, pageProxy.Widgets);
315
+ }
316
+ addPageScript(appProxy, pageProxy);
317
+ wrapWithThirdPartyErrorGuard(
318
+ pageProxy,
319
+ appContext,
320
+ (componentInfo == null ? void 0 : componentInfo.componentName) || "Prefab"
321
+ );
322
+ if ((componentInfo == null ? void 0 : componentInfo.componentType) === "PAGE") {
323
+ global.wm = appProxy ? __spreadProps(__spreadValues({}, pageProxy), { App: appProxy }) : pageProxy;
324
+ }
325
+ setIsInitialized(true);
326
+ } catch (error) {
327
+ console.error("Error during component initialization:", error);
328
+ setIsInitialized(true);
329
+ } finally {
330
+ isInitializingRef.current = false;
331
+ }
332
+ };
399
333
  initializeComponent();
400
-
401
- // Cleanup function
402
- return function () {
403
- var _overriddenPropsRegis;
404
- // Cancel all pending page operations
334
+ return () => {
335
+ var _a2;
405
336
  if (pageProxyRef.current) {
406
- var _ref5 = getVariables(pageProxyRef.current) || {},
407
- _ref5$Variables = _ref5.Variables,
408
- Variables = _ref5$Variables === void 0 ? {} : _ref5$Variables,
409
- _ref5$Actions = _ref5.Actions,
410
- Actions = _ref5$Actions === void 0 ? {} : _ref5$Actions;
411
-
412
- // Cancel page variables
413
- Object.values(Variables).forEach(function (variable) {
414
- if (variable !== null && variable !== void 0 && variable.cancel && typeof variable.cancel === "function") {
337
+ const { Variables = {}, Actions = {} } = getVariables(pageProxyRef.current) || {};
338
+ Object.values(Variables).forEach((variable) => {
339
+ if ((variable == null ? void 0 : variable.cancel) && typeof variable.cancel === "function") {
415
340
  try {
416
341
  variable.cancel();
417
342
  } catch (error) {
@@ -419,10 +344,8 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
419
344
  }
420
345
  }
421
346
  });
422
-
423
- // Cancel page actions
424
- Object.values(Actions).forEach(function (action) {
425
- if (action !== null && action !== void 0 && action.cancel && typeof action.cancel === "function") {
347
+ Object.values(Actions).forEach((action) => {
348
+ if ((action == null ? void 0 : action.cancel) && typeof action.cancel === "function") {
426
349
  try {
427
350
  action.cancel();
428
351
  } catch (error) {
@@ -431,135 +354,99 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
431
354
  }
432
355
  });
433
356
  }
434
-
435
- // Clear pending startup operations
436
357
  pendingStartupOpsRef.current.clear();
437
- (_overriddenPropsRegis = overriddenPropsRegistryRef.current) === null || _overriddenPropsRegis === void 0 || _overriddenPropsRegis.clear();
438
- // clearOverriddenProps();
439
-
440
- // Unsubscribe from events
441
- subscriptionsRef.current.forEach(function (_ref6) {
442
- var variable = _ref6.variable,
443
- event = _ref6.event,
444
- handler = _ref6.handler;
445
- if (variable !== null && variable !== void 0 && variable.unsubscribe) {
358
+ (_a2 = overriddenPropsRegistryRef.current) == null ? void 0 : _a2.clear();
359
+ subscriptionsRef.current.forEach(({ variable, event, handler }) => {
360
+ if (variable == null ? void 0 : variable.unsubscribe) {
446
361
  try {
447
362
  variable.unsubscribe(event, handler);
448
363
  } catch (error) {
449
- console.warn("Failed to unsubscribe from ".concat(event, ":"), error);
364
+ console.warn(`Failed to unsubscribe from ${event}:`, error);
450
365
  }
451
366
  }
452
367
  });
453
368
  subscriptionsRef.current = [];
454
369
  };
455
- }, [shouldInitialize]); // Only depend on shouldInitialize
456
-
457
- // Subscribe to app-level variables when app becomes ready
458
- // This MUST happen before executeStartAppOperations() is called (via executeStartup)
459
- // so that widgets can receive loading state updates when app variables are invoked
460
- (0, _react.useEffect)(function () {
461
- if (!(appContext !== null && appContext !== void 0 && appContext.isAppReady) || !pageProxyRef.current || appVarSubscriptionsDoneRef.current) {
370
+ }, [shouldInitialize]);
371
+ useEffect(() => {
372
+ if (!(appContext == null ? void 0 : appContext.isAppReady) || !pageProxyRef.current || appVarSubscriptionsDoneRef.current) {
462
373
  return;
463
374
  }
464
375
  try {
465
- var _ref7 = getVariables(pageProxyRef.current) || {
466
- Variables: {}
467
- },
468
- _ref7$Variables = _ref7.Variables,
469
- pageVars = _ref7$Variables === void 0 ? {} : _ref7$Variables;
470
- var pageVarNames = new Set(Object.keys(pageVars || {}));
471
- subscribeAppVariablesIfNeeded(appContext.Variables || {}, pageVarNames);
376
+ const { Variables: pageVars = {} } = getVariables(pageProxyRef.current) || {
377
+ Variables: {}
378
+ };
379
+ const pageVarNames = new Set(Object.keys(pageVars || {}));
380
+ subscribeAppVariablesIfNeeded(
381
+ appContext.Variables || {},
382
+ pageVarNames
383
+ );
472
384
  appVarSubscriptionsDoneRef.current = true;
473
385
  } catch (e) {
474
- // no-op
475
386
  }
476
- }, [appContext === null || appContext === void 0 ? void 0 : appContext.isAppReady]);
477
-
478
- // Prefab state sync
479
- (0, _react.useEffect)(function () {
480
- if (prefabInfo && (componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentType) === "PREFAB") {
481
- var handlePrefabStateRefresh = function handlePrefabStateRefresh(data) {
482
- var proxy = pageProxyRef.current;
483
- Object.keys(data).forEach(function (key) {
484
- var _data$key$newValue;
485
- var propKey = data[key].key;
486
- var newValue = (_data$key$newValue = data[key].newValue) !== null && _data$key$newValue !== void 0 ? _data$key$newValue : data[key].oldValue;
487
- if (newValue && (0, _typeof2["default"])(newValue) === "object") {
488
- newValue = (0, _cloneDeep["default"])(newValue);
387
+ }, [appContext == null ? void 0 : appContext.isAppReady]);
388
+ useEffect(() => {
389
+ if (prefabInfo && (componentInfo == null ? void 0 : componentInfo.componentType) === "PREFAB") {
390
+ const handlePrefabStateRefresh = (data) => {
391
+ const proxy = pageProxyRef.current;
392
+ Object.keys(data).forEach((key) => {
393
+ var _a2;
394
+ const propKey = data[key].key;
395
+ let newValue = (_a2 = data[key].newValue) != null ? _a2 : data[key].oldValue;
396
+ if (newValue && typeof newValue === "object") {
397
+ newValue = cloneDeep(newValue);
489
398
  }
490
-
491
- // Call onPropertyChange if available
492
399
  if (proxy && proxy.onPropertyChange) {
493
400
  proxy[propKey] = newValue;
494
401
  proxy.onPropertyChange(propKey, newValue, data[key].oldValue);
495
402
  }
496
403
  });
497
404
  };
498
- _events.EVENTEMITTER_METHODS.PREFAB_STATE_SYNC_ON(prefabInfo === null || prefabInfo === void 0 ? void 0 : prefabInfo.name, handlePrefabStateRefresh);
499
- return function () {
500
- _events.EVENTEMITTER_METHODS.PREFAB_STATE_SYNC_OFF(prefabInfo === null || prefabInfo === void 0 ? void 0 : prefabInfo.name, handlePrefabStateRefresh);
405
+ EVENTEMITTER_METHODS.PREFAB_STATE_SYNC_ON(prefabInfo == null ? void 0 : prefabInfo.name, handlePrefabStateRefresh);
406
+ return () => {
407
+ EVENTEMITTER_METHODS.PREFAB_STATE_SYNC_OFF(prefabInfo == null ? void 0 : prefabInfo.name, handlePrefabStateRefresh);
501
408
  };
502
409
  }
503
- }, [prefabInfo, componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentType]);
504
-
505
- // Setup variable subscriptions
506
- var setupVariableSubscriptions = function setupVariableSubscriptions(variables) {
507
- var handleVariableEvent = function handleVariableEvent(variableName, event, variable) {
508
- // not required because while unmounting page,variables invocation get cancelled and state update will not happen
509
-
510
- var updateState = variable;
511
- updateState.loading = event === _types.VariableEvents.BEFORE_INVOKE;
512
- updateState.error = event === _types.VariableEvents.ERROR ? variable : null;
513
- if ((0, _get["default"])(variable, "spinnerContext") === "page") {
410
+ }, [prefabInfo, componentInfo == null ? void 0 : componentInfo.componentType]);
411
+ const setupVariableSubscriptions = (variables) => {
412
+ const handleVariableEvent = (variableName, event, variable) => {
413
+ const updateState = variable;
414
+ updateState.loading = event === VariableEvents.BEFORE_INVOKE;
415
+ updateState.error = event === VariableEvents.ERROR ? variable : null;
416
+ if (get(variable, "spinnerContext") === "page") {
514
417
  if (updateState.loading) {
515
- var message = (0, _get["default"])(variable, "spinnerMessage");
418
+ const message = get(variable, "spinnerMessage");
516
419
  show(message);
517
420
  } else {
518
421
  hide();
519
422
  }
520
423
  }
521
- setPageContext(function (prev) {
522
- return _objectSpread(_objectSpread({}, prev), {}, {
523
- Variables: _objectSpread(_objectSpread({}, prev.Variables), {}, (0, _defineProperty2["default"])({}, variableName, updateState))
524
- });
525
- });
526
- if (event === _types.VariableEvents.AFTER_INVOKE) {
527
- pendingStartupOpsRef.current["delete"](variableName);
424
+ setPageContext((prev) => __spreadProps(__spreadValues({}, prev), {
425
+ Variables: __spreadProps(__spreadValues({}, prev.Variables), {
426
+ [variableName]: updateState
427
+ })
428
+ }));
429
+ if (event === VariableEvents.AFTER_INVOKE) {
430
+ pendingStartupOpsRef.current.delete(variableName);
528
431
  }
529
432
  };
530
-
531
- // Set up subscriptions (avoid duplicates by name)
532
- Object.entries(variables).forEach(function (_ref8) {
533
- var _ref9 = (0, _slicedToArray2["default"])(_ref8, 2),
534
- name = _ref9[0],
535
- variable = _ref9[1];
433
+ Object.entries(variables).forEach(([name, variable]) => {
536
434
  if (subscribedVariableNamesRef.current.has(name)) {
537
435
  return;
538
436
  }
539
- Object.values(_types.VariableEvents).forEach(function (event) {
540
- var handler = function handler() {
541
- return handleVariableEvent(name, event, variable);
542
- };
437
+ Object.values(VariableEvents).forEach((event) => {
438
+ const handler = () => handleVariableEvent(name, event, variable);
543
439
  if (variable && typeof variable.subscribe === "function") {
544
440
  variable.subscribe(event, handler);
545
- subscriptionsRef.current.push({
546
- variable: variable,
547
- event: event,
548
- handler: handler
549
- });
441
+ subscriptionsRef.current.push({ variable, event, handler });
550
442
  }
551
443
  });
552
444
  subscribedVariableNamesRef.current.add(name);
553
445
  });
554
446
  };
555
-
556
- // Subscribe to app-level variables that are not shadowed by page variables
557
- var subscribeAppVariablesIfNeeded = function subscribeAppVariablesIfNeeded(appVars, pageVarNames) {
558
- var appVarsOnly = {};
559
- Object.entries(appVars || {}).forEach(function (_ref0) {
560
- var _ref1 = (0, _slicedToArray2["default"])(_ref0, 2),
561
- name = _ref1[0],
562
- variable = _ref1[1];
447
+ const subscribeAppVariablesIfNeeded = (appVars, pageVarNames) => {
448
+ const appVarsOnly = {};
449
+ Object.entries(appVars || {}).forEach(([name, variable]) => {
563
450
  if (!pageVarNames.has(name) && !subscribedVariableNamesRef.current.has(name)) {
564
451
  appVarsOnly[name] = variable;
565
452
  }
@@ -568,203 +455,111 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
568
455
  setupVariableSubscriptions(appVarsOnly);
569
456
  }
570
457
  };
571
-
572
- // Execute startup operations
573
- var executeStartupOperations = /*#__PURE__*/function () {
574
- var _ref10 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(Variables, Actions) {
575
- var _ref11, _ref11$startUpActions, startUpActions, _ref11$startUpVariabl, startUpVariables, variablePromises;
576
- return _regenerator["default"].wrap(function _callee2$(_context2) {
577
- while (1) switch (_context2.prev = _context2.next) {
578
- case 0:
579
- _ref11 = componentInfo || {}, _ref11$startUpActions = _ref11.startUpActions, startUpActions = _ref11$startUpActions === void 0 ? [] : _ref11$startUpActions, _ref11$startUpVariabl = _ref11.startUpVariables, startUpVariables = _ref11$startUpVariabl === void 0 ? [] : _ref11$startUpVariabl; // Track startup operations
580
- startUpVariables.forEach(function (name) {
581
- return pendingStartupOpsRef.current.add(name);
582
- });
583
- startUpActions.forEach(function (name) {
584
- return pendingStartupOpsRef.current.add(name);
585
- });
586
-
587
- // If no startup operations, mark as complete immediately
588
- if (!(startUpActions.length === 0 && startUpVariables.length === 0)) {
589
- _context2.next = 5;
590
- break;
591
- }
592
- return _context2.abrupt("return");
593
- case 5:
594
- _context2.prev = 5;
595
- // Execute startup actions
596
- startUpActions.forEach(function (actionName) {
597
- var _Actions$actionName;
598
- if ((_Actions$actionName = Actions[actionName]) !== null && _Actions$actionName !== void 0 && _Actions$actionName.invoke) {
599
- Actions[actionName].invoke();
600
- }
601
- pendingStartupOpsRef.current["delete"](String(actionName));
602
- });
603
-
604
- // Execute startup variables
605
- variablePromises = startUpVariables.map(function (varName) {
606
- var _Variables$varName;
607
- if ((_Variables$varName = Variables[varName]) !== null && _Variables$varName !== void 0 && _Variables$varName.invoke) {
608
- return Variables[varName].invoke()["catch"](function (error) {
609
- console.log("Error invoking ".concat(varName, ":"), error);
610
- return null;
611
- });
612
- }
613
- return Promise.resolve();
614
- });
615
- _context2.next = 10;
616
- return Promise.allSettled(variablePromises);
617
- case 10:
618
- startUpVariableLoadedRef.current = true;
619
- pendingStartupOpsRef.current.clear();
620
- setTimeout(function () {
621
- if ((componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentType) === "PAGE") {
622
- appContext === null || appContext === void 0 || appContext.notify("page-variables-data-loaded", {
623
- pageName: componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentName
624
- });
625
- }
626
- }, 0);
627
- _context2.next = 18;
628
- break;
629
- case 15:
630
- _context2.prev = 15;
631
- _context2.t0 = _context2["catch"](5);
632
- console.error("Error during startup operations:", _context2.t0);
633
- case 18:
634
- case "end":
635
- return _context2.stop();
458
+ const executeStartupOperations = async (Variables, Actions) => {
459
+ const { startUpActions = [], startUpVariables = [] } = componentInfo || {};
460
+ startUpVariables.forEach((name) => pendingStartupOpsRef.current.add(name));
461
+ startUpActions.forEach((name) => pendingStartupOpsRef.current.add(name));
462
+ if (startUpActions.length === 0 && startUpVariables.length === 0) {
463
+ return;
464
+ }
465
+ try {
466
+ startUpActions.forEach((actionName) => {
467
+ var _a2;
468
+ if ((_a2 = Actions[actionName]) == null ? void 0 : _a2.invoke) {
469
+ Actions[actionName].invoke();
636
470
  }
637
- }, _callee2, null, [[5, 15]]);
638
- }));
639
- return function executeStartupOperations(_x, _x2) {
640
- return _ref10.apply(this, arguments);
641
- };
642
- }();
471
+ pendingStartupOpsRef.current.delete(String(actionName));
472
+ });
473
+ const variablePromises = startUpVariables.map((varName) => {
474
+ var _a2;
475
+ if ((_a2 = Variables[varName]) == null ? void 0 : _a2.invoke) {
476
+ return Variables[varName].invoke().catch((error) => {
477
+ console.log(`Error invoking ${varName}:`, error);
478
+ return null;
479
+ });
480
+ }
481
+ return Promise.resolve();
482
+ });
483
+ await Promise.allSettled(variablePromises);
484
+ startUpVariableLoadedRef.current = true;
485
+ pendingStartupOpsRef.current.clear();
486
+ setTimeout(() => {
487
+ if ((componentInfo == null ? void 0 : componentInfo.componentType) === "PAGE") {
488
+ appContext == null ? void 0 : appContext.notify("page-variables-data-loaded", {
489
+ pageName: componentInfo == null ? void 0 : componentInfo.componentName
490
+ });
491
+ }
492
+ }, 0);
493
+ } catch (error) {
494
+ console.error("Error during startup operations:", error);
495
+ }
496
+ };
643
497
  function layoutReady() {
644
498
  setIsLayoutReady(true);
645
499
  }
646
-
647
- // Widget state update function
648
500
  function updateWidgetState(widgetName, newProps) {
649
501
  if (!widgetName || !newProps || Object.keys(newProps).length === 0) return;
650
- if ((0, _compare["default"])(pageContext.Widgets[widgetName], newProps)) return;
651
- var registry = overriddenPropsRegistryRef.current;
502
+ if (compare(pageContext.Widgets[widgetName], newProps)) return;
503
+ const registry = overriddenPropsRegistryRef.current;
652
504
  if (registry) {
653
- Object.keys(newProps).forEach(function (key) {
654
- if (newProps[key] !== undefined) {
505
+ Object.keys(newProps).forEach((key) => {
506
+ if (newProps[key] !== void 0) {
655
507
  registry.trackInternalUpdate(widgetName, key, newProps[key]);
656
508
  }
657
509
  });
658
510
  }
659
- setPageContext(function (prev) {
660
- return _objectSpread(_objectSpread({}, prev), {}, {
661
- Widgets: _objectSpread(_objectSpread({}, prev.Widgets), {}, (0, _defineProperty2["default"])({}, widgetName, _objectSpread(_objectSpread({}, prev.Widgets[widgetName]), newProps)))
662
- });
663
- });
664
-
665
- // Suspend tracking to prevent internal state updates from being tracked as script overrides
666
- (0, _scriptRegistry.withSuspendedTracking)(overriddenPropsRegistryRef.current, function () {
667
- Object.keys(newProps).forEach(function (key) {
668
- var _pageContext$Widgets$;
669
- 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) {
670
- var _pageProxyRef$current2;
671
- if ((_pageProxyRef$current2 = pageProxyRef.current) !== null && _pageProxyRef$current2 !== void 0 && (_pageProxyRef$current2 = _pageProxyRef$current2.Widgets) !== null && _pageProxyRef$current2 !== void 0 && _pageProxyRef$current2[widgetName]) {
511
+ setPageContext((prev) => __spreadProps(__spreadValues({}, prev), {
512
+ Widgets: __spreadProps(__spreadValues({}, prev.Widgets), {
513
+ [widgetName]: __spreadValues(__spreadValues({}, prev.Widgets[widgetName]), newProps)
514
+ })
515
+ }));
516
+ withSuspendedTracking(overriddenPropsRegistryRef.current, () => {
517
+ Object.keys(newProps).forEach((key) => {
518
+ var _a2, _b2, _c2;
519
+ if (!isEqual((_a2 = pageContext.Widgets[widgetName]) == null ? void 0 : _a2[key], newProps == null ? void 0 : newProps[key]) && (newProps == null ? void 0 : newProps[key]) !== void 0) {
520
+ if ((_c2 = (_b2 = pageProxyRef.current) == null ? void 0 : _b2.Widgets) == null ? void 0 : _c2[widgetName]) {
672
521
  pageProxyRef.current.Widgets[widgetName][key] = newProps[key];
673
522
  }
674
523
  }
675
524
  });
676
525
  });
677
526
  }
678
-
679
- // Content ready callback
680
- function onContentReady() {
681
- return _onContentReady.apply(this, arguments);
682
- }
683
- function _onContentReady() {
684
- _onContentReady = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee4() {
685
- return _regenerator["default"].wrap(function _callee4$(_context4) {
686
- while (1) switch (_context4.prev = _context4.next) {
687
- case 0:
688
- if (!pageContext.onReady) {
689
- _context4.next = 3;
690
- break;
691
- }
692
- _context4.next = 3;
693
- return pageContext.onReady();
694
- case 3:
695
- if (appContext !== null && appContext !== void 0 && appContext.onPageReady && pageContext.componentType === "PAGE") {
696
- appContext.onPageReady(pageContext.componentName, pageProxyRef.current, undefined);
697
- }
698
- return _context4.abrupt("return", Promise.resolve());
699
- case 5:
700
- case "end":
701
- return _context4.stop();
702
- }
703
- }, _callee4);
704
- }));
705
- return _onContentReady.apply(this, arguments);
706
- }
707
- function executeStartup() {
708
- return _executeStartup.apply(this, arguments);
527
+ async function onContentReady() {
528
+ if (pageContext.onReady) {
529
+ await pageContext.onReady();
530
+ }
531
+ if ((appContext == null ? void 0 : appContext.onPageReady) && pageContext.componentType === "PAGE") {
532
+ appContext.onPageReady(pageContext.componentName, pageProxyRef.current, void 0);
533
+ }
534
+ return Promise.resolve();
709
535
  }
710
- function _executeStartup() {
711
- _executeStartup = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee5() {
712
- return _regenerator["default"].wrap(function _callee5$(_context5) {
713
- while (1) switch (_context5.prev = _context5.next) {
714
- case 0:
715
- _context5.next = 2;
716
- return appContext === null || appContext === void 0 ? void 0 : appContext.executeStartAppOperations();
717
- case 2:
718
- case "end":
719
- return _context5.stop();
720
- }
721
- }, _callee5);
722
- }));
723
- return _executeStartup.apply(this, arguments);
536
+ async function executeStartup() {
537
+ await (appContext == null ? void 0 : appContext.executeStartAppOperations());
724
538
  }
725
- function executePageStartup() {
726
- return _executePageStartup.apply(this, arguments);
727
- } // Update pageContext.appLocale when i18n.appLocale changes
728
- function _executePageStartup() {
729
- _executePageStartup = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee6() {
730
- return _regenerator["default"].wrap(function _callee6$(_context6) {
731
- while (1) switch (_context6.prev = _context6.next) {
732
- case 0:
733
- _context6.next = 2;
734
- return executeStartupOperations(pageContext.Variables, pageContext.Actions);
735
- case 2:
736
- case "end":
737
- return _context6.stop();
738
- }
739
- }, _callee6);
740
- }));
741
- return _executePageStartup.apply(this, arguments);
539
+ async function executePageStartup() {
540
+ await executeStartupOperations(pageContext.Variables, pageContext.Actions);
742
541
  }
743
- (0, _react.useEffect)(function () {
744
- var newAppLocale = (0, _merge["default"])({}, i18n.appLocale || {}, (prefabInfo === null || prefabInfo === void 0 ? void 0 : prefabInfo.appLocale) || {});
745
- if (!(0, _isEqual["default"])(pageContext.appLocale, newAppLocale)) {
746
- var _pageProxyRef$current3;
747
- setPageContext(function (prev) {
748
- return _objectSpread(_objectSpread({}, prev), {}, {
749
- appLocale: newAppLocale
750
- });
751
- });
752
- if ((_pageProxyRef$current3 = pageProxyRef.current) !== null && _pageProxyRef$current3 !== void 0 && _pageProxyRef$current3.App) {
542
+ useEffect(() => {
543
+ var _a2;
544
+ const newAppLocale = merge({}, i18n.appLocale || {}, (prefabInfo == null ? void 0 : prefabInfo.appLocale) || {});
545
+ if (!isEqual(pageContext.appLocale, newAppLocale)) {
546
+ setPageContext((prev) => __spreadProps(__spreadValues({}, prev), {
547
+ appLocale: newAppLocale
548
+ }));
549
+ if ((_a2 = pageProxyRef.current) == null ? void 0 : _a2.App) {
753
550
  pageProxyRef.current.App.appLocale = newAppLocale;
754
551
  }
755
552
  }
756
553
  }, [i18n.appLocale]);
757
- (0, _react.useEffect)(function () {
758
- var localeFormats = {
554
+ useEffect(() => {
555
+ const localeFormats = {
759
556
  date: i18n.dateFormat,
760
557
  time: i18n.timeFormat,
761
558
  currency: i18n.currencyCode
762
559
  };
763
- setPageContext(function (prev) {
764
- return _objectSpread(_objectSpread({}, prev), {}, {
765
- localeFormats: localeFormats
766
- });
767
- });
560
+ setPageContext((prev) => __spreadProps(__spreadValues({}, prev), {
561
+ localeFormats
562
+ }));
768
563
  if (pageProxyRef.current) {
769
564
  pageProxyRef.current.localeFormats = localeFormats;
770
565
  if (pageProxyRef.current.App) {
@@ -772,138 +567,77 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
772
567
  }
773
568
  }
774
569
  }, [i18n.dateFormat, i18n.timeFormat, i18n.currencyCode]);
775
- var pageName = (appProxy === null || appProxy === void 0 ? void 0 : appProxy.activePageName) || "";
776
- (0, _react.useEffect)(function () {
777
- if ((componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentType) === "PARTIAL" && pageName) {
778
- // update the app active page name
779
- setPageContext(function (prev) {
780
- return _objectSpread(_objectSpread({}, prev), {}, {
781
- App: _objectSpread(_objectSpread({}, prev.App), {}, {
782
- activePageName: pageName
783
- })
784
- });
785
- });
570
+ const pageName = (appProxy == null ? void 0 : appProxy.activePageName) || "";
571
+ useEffect(() => {
572
+ if ((componentInfo == null ? void 0 : componentInfo.componentType) === "PARTIAL" && pageName) {
573
+ setPageContext((prev) => __spreadProps(__spreadValues({}, prev), {
574
+ App: __spreadProps(__spreadValues({}, prev.App), {
575
+ activePageName: pageName
576
+ })
577
+ }));
786
578
  }
787
579
  }, [pageName]);
788
-
789
- // Execute startup when both conditions are met:
790
- // 1. Page is initialized (context ready)
791
- // 2. Page component has called pageReady() after widgets have rendered and subscribed
792
- (0, _react.useEffect)(function () {
580
+ useEffect(() => {
793
581
  if (isInitialized && isPageReady && isMountedRef.current && !onStartupCompletedRef.current && pageProxyRef.current) {
794
- var runStartup = /*#__PURE__*/function () {
795
- var _ref12 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee3() {
796
- var tabNameFromUrl, tabNameToSelect;
797
- return _regenerator["default"].wrap(function _callee3$(_context3) {
798
- while (1) switch (_context3.prev = _context3.next) {
799
- case 0:
800
- if (isMountedRef.current) {
801
- _context3.next = 2;
802
- break;
803
- }
804
- return _context3.abrupt("return");
805
- case 2:
806
- if (!(securityConfig !== null && securityConfig !== void 0 && securityConfig.authenticated && appProxy !== null && appProxy !== void 0 && appProxy.executeSessionFailureRequests)) {
807
- _context3.next = 5;
808
- break;
809
- }
810
- _context3.next = 5;
811
- return appProxy.executeSessionFailureRequests();
812
- case 5:
813
- _context3.next = 7;
814
- return executeStartup();
815
- case 7:
816
- _context3.next = 9;
817
- return onContentReady();
818
- case 9:
819
- _context3.next = 11;
820
- return executePageStartup();
821
- case 11:
822
- onStartupCompletedRef.current = true;
823
- // Handle pending accordion expansion from navigation using Redux
824
- if (pendingAccordionExpansion) {
825
- (0, _helper.accordionExpansionHandler)(pageProxyRef, pendingAccordionExpansion, dispatch);
826
- }
827
-
828
- // Handle tab selection from URL query parameter or Redux
829
- // URL parameter is only processed once on initial page load
830
- // Redux state is used for programmatic navigation
831
- tabNameFromUrl = !urlTabProcessedRef.current ? pageParams === null || pageParams === void 0 ? void 0 : pageParams.get("tabName") : null;
832
- tabNameToSelect = tabNameFromUrl || pendingTabSelection;
833
- if (tabNameToSelect) {
834
- (0, _helper.tabSelectionHandler)(pageProxyRef, tabNameToSelect, dispatch);
835
- }
836
- case 16:
837
- case "end":
838
- return _context3.stop();
839
- }
840
- }, _callee3);
841
- }));
842
- return function runStartup() {
843
- return _ref12.apply(this, arguments);
844
- };
845
- }();
582
+ const runStartup = async () => {
583
+ if (!isMountedRef.current) return;
584
+ if ((securityConfig == null ? void 0 : securityConfig.authenticated) && (appProxy == null ? void 0 : appProxy.executeSessionFailureRequests)) {
585
+ await appProxy.executeSessionFailureRequests();
586
+ }
587
+ await executeStartup();
588
+ await onContentReady();
589
+ await executePageStartup();
590
+ onStartupCompletedRef.current = true;
591
+ if (pendingAccordionExpansion) {
592
+ accordionExpansionHandler(pageProxyRef, pendingAccordionExpansion, dispatch);
593
+ }
594
+ const tabNameFromUrl = !urlTabProcessedRef.current ? pageParams == null ? void 0 : pageParams.get("tabName") : null;
595
+ const tabNameToSelect = tabNameFromUrl || pendingTabSelection;
596
+ if (tabNameToSelect) {
597
+ tabSelectionHandler(pageProxyRef, tabNameToSelect, dispatch);
598
+ }
599
+ };
846
600
  runStartup();
847
601
  }
848
602
  }, [isInitialized, isPageReady]);
849
- // Call onContentReady when startup operations are complete
850
- (0, _react.useEffect)(function () {
851
- if (startupComplete && (pageContext.type === "PAGE" ? isLayoutReady : true)) {
852
- onContentReady();
853
- }
854
- }, [startupComplete, isLayoutReady]);
855
- (0, _react.useEffect)(function () {
603
+ useEffect(() => {
856
604
  isMountedRef.current = true;
857
- return function () {
605
+ return () => {
858
606
  isMountedRef.current = false;
859
- // Cleanup viewport service when component unmounts
860
- _viewport.viewportService.destroy();
607
+ viewportService.destroy();
861
608
  };
862
609
  }, []);
863
-
864
- // Handle access denied case
865
- if (!accessLoading && !hasAccess && !(componentInfo !== null && componentInfo !== void 0 && componentInfo.isPartOfPrefab)) {
610
+ if (!accessLoading && !hasAccess && !(componentInfo == null ? void 0 : componentInfo.isPartOfPrefab)) {
866
611
  return null;
867
612
  }
868
-
869
- // Handle access error case
870
613
  if (accessError && !accessLoading) {
871
- console.error("Access check failed for ".concat(componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentName, ":"), accessError);
614
+ console.error(`Access check failed for ${componentInfo == null ? void 0 : componentInfo.componentName}:`, accessError);
872
615
  return null;
873
616
  }
874
-
875
- // Show loading spinner while checking access or app is not ready
876
617
  if (accessLoading || appContext && !appContext.isAppReady || !isInitialized) {
877
- return __jsx(_spinner.WmSpinner, {
878
- name: "page",
879
- caption: "",
880
- listener: {}
881
- });
618
+ return /* @__PURE__ */ jsx(WmSpinner, { name: "page", caption: "", listener: {} });
882
619
  }
883
- if (appContext !== null && appContext !== void 0 && appContext.autoUpdateVariables && onStartupCompletedRef.current) {
884
- var appVariables = appContext.Variables;
885
- appContext.autoUpdateVariables.forEach(function (value) {
886
- var _appVariables$value, _appVariables$value2;
887
- ((_appVariables$value = appVariables[value]) === null || _appVariables$value === void 0 ? void 0 : _appVariables$value.invokeOnParamChange) && ((_appVariables$value2 = appVariables[value]) === null || _appVariables$value2 === void 0 ? void 0 : _appVariables$value2.invokeOnParamChange());
620
+ if ((appContext == null ? void 0 : appContext.autoUpdateVariables) && onStartupCompletedRef.current) {
621
+ const appVariables = appContext.Variables;
622
+ appContext.autoUpdateVariables.forEach((value) => {
623
+ var _a2, _b2;
624
+ ((_a2 = appVariables[value]) == null ? void 0 : _a2.invokeOnParamChange) && ((_b2 = appVariables[value]) == null ? void 0 : _b2.invokeOnParamChange());
888
625
  });
889
626
  }
890
- if (pageContext.autoUpdateVariables && onStartupCompletedRef.current) {
891
- var pageVariables = pageContext.Variables;
892
- componentInfo === null || componentInfo === void 0 || componentInfo.autoUpdateVariables.forEach(function (value) {
893
- var _pageVariables$value, _pageVariables$value$;
894
- (_pageVariables$value = pageVariables[value]) === null || _pageVariables$value === void 0 || (_pageVariables$value$ = _pageVariables$value.invokeOnParamChange) === null || _pageVariables$value$ === void 0 || _pageVariables$value$.call(_pageVariables$value);
627
+ if (((_c = componentInfo == null ? void 0 : componentInfo.autoUpdateVariables) == null ? void 0 : _c.length) && onStartupCompletedRef.current) {
628
+ const pageVariables = pageContext.Variables;
629
+ componentInfo.autoUpdateVariables.forEach((value) => {
630
+ var _a2, _b2;
631
+ (_b2 = (_a2 = pageVariables[value]) == null ? void 0 : _a2.invokeOnParamChange) == null ? void 0 : _b2.call(_a2);
895
632
  });
896
633
  }
897
-
898
- // Render the component
899
- return __jsx(_WidgetProvider.WidgetProvider, {
900
- value: {
901
- value: pageContext,
902
- proxy: pageProxyRef.current
903
- }
904
- }, __jsx(WrappedComponent, props));
634
+ return /* @__PURE__ */ jsx(WidgetProvider, { value: { value: pageContext, proxy: pageProxyRef.current }, children: /* @__PURE__ */ jsx(WrappedComponent, __spreadValues({}, props)) });
905
635
  };
906
- PageContextComponent.displayName = "WithPageContext(".concat(WrappedComponent.displayName || WrappedComponent.name || "Component", ")");
636
+ PageContextComponent.displayName = `WithPageContext(${WrappedComponent.displayName || WrappedComponent.name || "Component"})`;
907
637
  return PageContextComponent;
908
638
  };
909
- var _default = exports["default"] = withPageContext;
639
+ var BasePage_default = withPageContext;
640
+ export {
641
+ BasePage_default as default,
642
+ withPageContext
643
+ };