@wavemaker-ai/react-runtime 1.0.0-rc.309 → 1.0.0-rc.314

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 (574) 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.js +251 -346
  6. package/actions/notification-action.js +121 -149
  7. package/actions/timer-action.js +95 -151
  8. package/actions/toast-provider.js +62 -76
  9. package/actions/toast.js +95 -91
  10. package/actions/toast.service.js +59 -79
  11. package/actions/types/index.js +6 -9
  12. package/components/advanced/carousel/index.js +358 -366
  13. package/components/advanced/carousel/props.js +0 -5
  14. package/components/advanced/carousel/template.js +102 -80
  15. package/components/advanced/login/index.js +227 -285
  16. package/components/advanced/login/props.js +0 -5
  17. package/components/advanced/marquee/index.js +169 -163
  18. package/components/advanced/marquee/props.js +0 -5
  19. package/components/basic/anchor/index.js +207 -187
  20. package/components/basic/anchor/props.js +0 -5
  21. package/components/basic/audio/index.js +110 -72
  22. package/components/basic/audio/props.js +0 -5
  23. package/components/basic/html/index.js +163 -203
  24. package/components/basic/html/props.js +0 -5
  25. package/components/basic/html/utils.js +30 -28
  26. package/components/basic/icon/index.js +98 -84
  27. package/components/basic/icon/props.js +0 -5
  28. package/components/basic/iframe/iframe.utils.js +7 -16
  29. package/components/basic/iframe/index.js +97 -103
  30. package/components/basic/iframe/props.js +0 -5
  31. package/components/basic/label/index.js +156 -134
  32. package/components/basic/label/props.js +0 -5
  33. package/components/basic/message/index.js +129 -113
  34. package/components/basic/message/props.js +0 -5
  35. package/components/basic/picture/index.js +156 -127
  36. package/components/basic/picture/props.js +0 -5
  37. package/components/basic/progress-bar/index.js +240 -176
  38. package/components/basic/progress-bar/props.js +5 -31
  39. package/components/basic/progress-circle/index.js +166 -183
  40. package/components/basic/progress-circle/props.js +14 -34
  41. package/components/basic/richtexteditor/index.js +430 -396
  42. package/components/basic/richtexteditor/props.js +0 -5
  43. package/components/basic/search/index.js +812 -931
  44. package/components/basic/search/props.js +0 -5
  45. package/components/basic/search/providers.js +233 -380
  46. package/components/basic/spinner/index.js +210 -200
  47. package/components/basic/spinner/props.js +4 -22
  48. package/components/basic/tile/index.js +73 -81
  49. package/components/basic/tile/props.js +0 -5
  50. package/components/basic/tree/Components/TreeNodeComponent.js +238 -170
  51. package/components/basic/tree/hooks/useTreePartialNodeApi.js +143 -135
  52. package/components/basic/tree/index.js +378 -454
  53. package/components/basic/tree/props.js +0 -5
  54. package/components/basic/tree/utils.js +129 -185
  55. package/components/basic/video/index.js +161 -107
  56. package/components/basic/video/props.js +0 -5
  57. package/components/chart/index.js +42 -50
  58. package/components/chart/props.js +31 -37
  59. package/components/chart/src/ChartRenderer.js +172 -154
  60. package/components/chart/src/chart.js +391 -213
  61. package/components/chart/src/chartStyles.generated.js +6 -14
  62. package/components/chart/src/chartUtils.js +228 -272
  63. package/components/chart/src/constants.d.ts +13 -0
  64. package/components/chart/src/constants.js +316 -90
  65. package/components/chart/src/d3Setup.js +11 -30
  66. package/components/chart/src/dataUtils.js +362 -446
  67. package/components/chart/src/formatUtils.js +47 -38
  68. package/components/chart/src/index.js +11 -19
  69. package/components/chart/src/nvd3Source.generated.js +5 -13
  70. package/components/chart/src/pieDonutResponsiveLayout.d.ts +5 -0
  71. package/components/chart/src/pieDonutResponsiveLayout.js +76 -96
  72. package/components/chart/src/types.js +0 -5
  73. package/components/common/AppSpinner.js +17 -33
  74. package/components/common/app-spinner.js +11 -22
  75. package/components/common/customTemplate/index.d.ts +3 -0
  76. package/components/common/customTemplate/index.js +6 -0
  77. package/components/common/customTemplate/props.d.ts +20 -0
  78. package/components/common/customTemplate/props.js +0 -0
  79. package/components/common/customTemplate/template.d.ts +3 -0
  80. package/components/common/customTemplate/template.js +27 -0
  81. package/components/common/customTemplate/useCustomTemplate.d.ts +8 -0
  82. package/components/common/customTemplate/useCustomTemplate.js +17 -0
  83. package/components/common/customTemplate/utils.d.ts +6 -0
  84. package/components/common/customTemplate/utils.js +12 -0
  85. package/components/common/index.js +4 -12
  86. package/components/constants.js +81 -77
  87. package/components/container/accordion/accordion-pane/index.js +105 -118
  88. package/components/container/accordion/accordion-pane/props.js +5 -21
  89. package/components/container/accordion/index.js +225 -243
  90. package/components/container/accordion/props.js +5 -16
  91. package/components/container/index.js +214 -150
  92. package/components/container/layout-grid/grid-column/index.js +68 -43
  93. package/components/container/layout-grid/grid-column/props.js +0 -5
  94. package/components/container/layout-grid/grid-row/index.js +12 -29
  95. package/components/container/layout-grid/grid-row/props.js +0 -5
  96. package/components/container/layout-grid/index.js +53 -38
  97. package/components/container/layout-grid/props.js +0 -5
  98. package/components/container/linear-layout/index.js +56 -60
  99. package/components/container/linear-layout/linear-layout-item/index.js +43 -47
  100. package/components/container/linear-layout/linear-layout-item/props.js +0 -5
  101. package/components/container/linear-layout/props.js +0 -5
  102. package/components/container/panel/components/panel-content/index.js +7 -16
  103. package/components/container/panel/components/panel-header/index.js +166 -146
  104. package/components/container/panel/components/panel-header/props.js +0 -5
  105. package/components/container/panel/hooks.js +76 -102
  106. package/components/container/panel/index.js +289 -252
  107. package/components/container/panel/props.js +0 -5
  108. package/components/container/props.js +0 -5
  109. package/components/container/repeat-template/index.js +65 -44
  110. package/components/container/repeat-template/props.js +0 -5
  111. package/components/container/tabs/index.js +517 -526
  112. package/components/container/tabs/props.js +5 -28
  113. package/components/container/tabs/tab-pane/index.js +105 -100
  114. package/components/container/tabs/tab-pane/props.js +0 -5
  115. package/components/container/tabs/utils.js +30 -35
  116. package/components/container/wizard/WizardContext.js +9 -11
  117. package/components/container/wizard/components/StepComponents.js +76 -99
  118. package/components/container/wizard/components/WizardStep.js +107 -85
  119. package/components/container/wizard/index.js +791 -921
  120. package/components/container/wizard/props.js +0 -5
  121. package/components/container/wizard/utils.js +97 -131
  122. package/components/container/wizard/wizard-action/index.js +41 -81
  123. package/components/container/wizard/wizard-step/index.js +140 -120
  124. package/components/data/card/card-actions/index.js +13 -31
  125. package/components/data/card/card-content/index.js +27 -36
  126. package/components/data/card/card-footer/index.js +13 -31
  127. package/components/data/card/index.js +192 -199
  128. package/components/data/card/props.js +0 -5
  129. package/components/data/form/base-form/constant.js +5 -8
  130. package/components/data/form/base-form/hooks/index.js +26 -77
  131. package/components/data/form/base-form/hooks/useFormDataSync.js +106 -212
  132. package/components/data/form/base-form/hooks/useFormOperations.js +109 -161
  133. package/components/data/form/base-form/hooks/useFormSubmission.js +220 -280
  134. package/components/data/form/base-form/hooks/useFormValidation.js +119 -168
  135. package/components/data/form/base-form/hooks/useParentFormRelationship.js +67 -103
  136. package/components/data/form/base-form/index.js +531 -646
  137. package/components/data/form/base-form/props.js +74 -151
  138. package/components/data/form/base-form/utils.js +210 -323
  139. package/components/data/form/dynamic-fields/constant.js +43 -53
  140. package/components/data/form/dynamic-fields/index.js +135 -144
  141. package/components/data/form/dynamic-fields/props.js +0 -5
  142. package/components/data/form/dynamic-fields/utils.js +99 -158
  143. package/components/data/form/form-action/index.js +107 -85
  144. package/components/data/form/form-body/index.js +52 -26
  145. package/components/data/form/form-context.js +43 -59
  146. package/components/data/form/form-controller/hooks/index.js +43 -57
  147. package/components/data/form/form-controller/props.js +5 -8
  148. package/components/data/form/form-controller/utils.js +54 -49
  149. package/components/data/form/form-controller/validation-contrustor.js +203 -426
  150. package/components/data/form/form-controller/withFormController.js +319 -269
  151. package/components/data/form/form-dynamic-section/index.js +47 -41
  152. package/components/data/form/form-dynamic-section/props.js +0 -5
  153. package/components/data/form/form-field/base-field.js +97 -109
  154. package/components/data/form/form-field/index.js +91 -82
  155. package/components/data/form/form-field/props.js +0 -5
  156. package/components/data/form/form-footer/index.js +52 -25
  157. package/components/data/form/form-header/index.js +61 -58
  158. package/components/data/form/index.js +95 -74
  159. package/components/data/form/props.js +0 -5
  160. package/components/data/list/components/GroupHeader.js +34 -33
  161. package/components/data/list/components/GroupedListItems.js +108 -104
  162. package/components/data/list/components/ListContainer.js +22 -27
  163. package/components/data/list/components/ListDND.js +193 -185
  164. package/components/data/list/components/ListHeader.js +32 -49
  165. package/components/data/list/components/ListItem.js +153 -146
  166. package/components/data/list/components/ListItemWithTemplate.js +87 -105
  167. package/components/data/list/components/ListItems.js +180 -194
  168. package/components/data/list/components/ListPagination.js +127 -153
  169. package/components/data/list/components/LoadMoreButton.js +25 -33
  170. package/components/data/list/components/NoDataMessage.js +9 -22
  171. package/components/data/list/components/StandardListItems.js +79 -85
  172. package/components/data/list/components/index.js +31 -119
  173. package/components/data/list/components/props.js +0 -5
  174. package/components/data/list/hooks/index.js +22 -75
  175. package/components/data/list/hooks/props.js +0 -5
  176. package/components/data/list/hooks/useCurrentPageItems.js +20 -38
  177. package/components/data/list/hooks/useGroupedData.js +19 -33
  178. package/components/data/list/hooks/useListData.js +17 -47
  179. package/components/data/list/hooks/useListEffects.js +168 -237
  180. package/components/data/list/hooks/useListEventHandlers.js +301 -285
  181. package/components/data/list/hooks/useListPagination.js +90 -136
  182. package/components/data/list/hooks/useListState.js +49 -91
  183. package/components/data/list/hooks/useListStateManager.js +104 -159
  184. package/components/data/list/hooks/usePaginatedGroupedData.js +74 -110
  185. package/components/data/list/index.d.ts +1 -0
  186. package/components/data/list/index.js +579 -621
  187. package/components/data/list/props.d.ts +4 -0
  188. package/components/data/list/props.js +0 -5
  189. package/components/data/list/templates/media-template.js +29 -50
  190. package/components/data/list/utils/constants.js +20 -32
  191. package/components/data/list/utils/list-helpers.d.ts +2 -1
  192. package/components/data/list/utils/list-helpers.js +71 -115
  193. package/components/data/list/utils/list-widget-methods.js +56 -76
  194. package/components/data/list/utils/widget-instance-utils.js +20 -57
  195. package/components/data/live-filter/index.js +219 -271
  196. package/components/data/live-filter/props.js +5 -12
  197. package/components/data/live-form/index.js +68 -91
  198. package/components/data/live-form/props.js +5 -12
  199. package/components/data/pagination/components/BasicPagination.js +124 -104
  200. package/components/data/pagination/components/ClassicPagination.js +167 -190
  201. package/components/data/pagination/components/InlinePagination.js +97 -98
  202. package/components/data/pagination/components/LoadingComponent.js +17 -30
  203. package/components/data/pagination/components/PageSizeSelector.js +176 -169
  204. package/components/data/pagination/components/PagerNavigation.js +84 -105
  205. package/components/data/pagination/components/TotalRecords.js +48 -47
  206. package/components/data/pagination/components/index.js +14 -47
  207. package/components/data/pagination/components/props.js +0 -5
  208. package/components/data/pagination/hooks/index.js +6 -19
  209. package/components/data/pagination/hooks/props.js +0 -5
  210. package/components/data/pagination/hooks/useNavigationSize.js +12 -21
  211. package/components/data/pagination/hooks/usePagination.js +702 -905
  212. package/components/data/pagination/index.js +336 -389
  213. package/components/data/table/components/AddNewRow.js +122 -154
  214. package/components/data/table/components/EditableCell.js +68 -75
  215. package/components/data/table/components/FieldValidationError.js +19 -20
  216. package/components/data/table/components/RowCells.js +97 -80
  217. package/components/data/table/components/RowExpansionButton.js +43 -39
  218. package/components/data/table/components/SummaryCell.js +54 -88
  219. package/components/data/table/components/SummaryRow.js +45 -52
  220. package/components/data/table/components/SummaryRowFooter.js +35 -42
  221. package/components/data/table/components/TableBody.js +222 -218
  222. package/components/data/table/components/TableDataRow.js +113 -106
  223. package/components/data/table/components/TableFilters.js +391 -390
  224. package/components/data/table/components/TableFooterActions.js +25 -32
  225. package/components/data/table/components/TableHeader.js +460 -435
  226. package/components/data/table/components/TablePanelHeading.js +157 -181
  227. package/components/data/table/components/index.js +27 -95
  228. package/components/data/table/hooks/index.js +21 -230
  229. package/components/data/table/hooks/use-edited-rows.js +59 -94
  230. package/components/data/table/hooks/useCellState.js +58 -83
  231. package/components/data/table/hooks/useCustomExpressionColumns.js +65 -86
  232. package/components/data/table/hooks/useDynamicColumns.js +59 -92
  233. package/components/data/table/hooks/useEditingState.js +30 -41
  234. package/components/data/table/hooks/useFormWidget.js +163 -172
  235. package/components/data/table/hooks/usePaginationState.js +67 -77
  236. package/components/data/table/hooks/usePanelStructure.js +47 -41
  237. package/components/data/table/hooks/useResponsiveColumns.js +14 -20
  238. package/components/data/table/hooks/useRowExpansion.js +131 -127
  239. package/components/data/table/hooks/useRowHandlers.js +56 -69
  240. package/components/data/table/hooks/useRowSelection.js +249 -329
  241. package/components/data/table/hooks/useServerSideSorting.js +109 -175
  242. package/components/data/table/hooks/useTableColumns.js +322 -331
  243. package/components/data/table/hooks/useTableData.js +111 -166
  244. package/components/data/table/hooks/useTableEdit.js +526 -564
  245. package/components/data/table/hooks/useTableEffects.js +60 -107
  246. package/components/data/table/hooks/useTableFilter.js +244 -237
  247. package/components/data/table/hooks/useTableInitialization.js +44 -76
  248. package/components/data/table/hooks/useTableState.js +39 -61
  249. package/components/data/table/hooks/useTableStateManager.js +295 -468
  250. package/components/data/table/index.js +1553 -1713
  251. package/components/data/table/live-table/index.js +157 -219
  252. package/components/data/table/props.js +0 -5
  253. package/components/data/table/table-action/index.js +97 -75
  254. package/components/data/table/table-column/index.js +48 -42
  255. package/components/data/table/table-group/index.js +7 -25
  256. package/components/data/table/table-row/index.js +63 -55
  257. package/components/data/table/table-row-action/index.js +102 -77
  258. package/components/data/table/utils/buildSelectionColumns.js +86 -137
  259. package/components/data/table/utils/columnBuilder.js +116 -158
  260. package/components/data/table/utils/columnProxy.js +48 -66
  261. package/components/data/table/utils/columnWidthDistribution.js +40 -64
  262. package/components/data/table/utils/constants.js +92 -40
  263. package/components/data/table/utils/crud-handlers.js +292 -473
  264. package/components/data/table/utils/dynamic-columns.js +99 -144
  265. package/components/data/table/utils/groupHeaderUtils.js +36 -61
  266. package/components/data/table/utils/index.d.ts +8 -5
  267. package/components/data/table/utils/index.js +419 -639
  268. package/components/data/table/utils/renderDisplayCell.js +127 -169
  269. package/components/data/table/utils/script-page-size-broadcast.js +17 -29
  270. package/components/data/table/utils/selectionUtils.js +59 -113
  271. package/components/data/table/utils/table-helpers.js +38 -74
  272. package/components/data/table/utils/validation.js +35 -78
  273. package/components/data/table/utils/widgetMapping.d.ts +5 -0
  274. package/components/data/table/utils/widgetMapping.js +41 -0
  275. package/components/data/types.js +112 -112
  276. package/components/data/utils/field-data-utils.js +38 -42
  277. package/components/data/utils/filter-field-util.js +42 -44
  278. package/components/data/utils/index.js +112 -111
  279. package/components/dialogs/alert-dialog/index.js +83 -78
  280. package/components/dialogs/alert-dialog/props.js +0 -5
  281. package/components/dialogs/confirm-dialog/index.js +102 -92
  282. package/components/dialogs/confirm-dialog/props.js +0 -5
  283. package/components/dialogs/dialog/index.js +93 -69
  284. package/components/dialogs/dialog/props.js +0 -5
  285. package/components/dialogs/dialog-actions/index.js +12 -26
  286. package/components/dialogs/dialog-actions/props.js +0 -5
  287. package/components/dialogs/dialog-body/index.js +13 -30
  288. package/components/dialogs/dialog-body/props.js +0 -5
  289. package/components/dialogs/dialog-content/index.js +48 -41
  290. package/components/dialogs/dialog-content/props.js +0 -5
  291. package/components/dialogs/dialog-header/index.js +88 -101
  292. package/components/dialogs/dialog-header/props.js +0 -5
  293. package/components/dialogs/iframe-dialog/index.js +136 -128
  294. package/components/dialogs/iframe-dialog/props.js +0 -5
  295. package/components/dialogs/index.js +104 -101
  296. package/components/dialogs/login-dialog/index.js +285 -347
  297. package/components/dialogs/login-dialog/props.js +0 -5
  298. package/components/dialogs/page-dialog/index.js +95 -86
  299. package/components/dialogs/page-dialog/props.js +0 -5
  300. package/components/dialogs/props.js +0 -5
  301. package/components/dialogs/withDialogWrapper.js +110 -83
  302. package/components/form/button/index.js +296 -245
  303. package/components/form/button/props.js +0 -5
  304. package/components/form/button-group/index.js +80 -69
  305. package/components/form/button-group/props.js +0 -5
  306. package/components/input/calendar/index.js +409 -362
  307. package/components/input/calendar/props.js +0 -5
  308. package/components/input/calendar/utils.js +164 -172
  309. package/components/input/chips/SortableChip/index.js +109 -100
  310. package/components/input/chips/SortableChip/props.js +0 -5
  311. package/components/input/chips/index.js +663 -570
  312. package/components/input/chips/props.js +0 -5
  313. package/components/input/chips/utils.js +131 -122
  314. package/components/input/color-picker/index.js +536 -594
  315. package/components/input/color-picker/props.js +0 -5
  316. package/components/input/composite/index.js +71 -110
  317. package/components/input/composite/props.js +0 -5
  318. package/components/input/currency/index.js +277 -224
  319. package/components/input/currency/props.js +0 -5
  320. package/components/input/default/checkbox/index.js +329 -250
  321. package/components/input/default/checkbox/props.js +0 -5
  322. package/components/input/default/checkboxset/index.d.ts +2 -0
  323. package/components/input/default/checkboxset/index.js +529 -446
  324. package/components/input/default/checkboxset/props.d.ts +4 -0
  325. package/components/input/default/checkboxset/props.js +0 -5
  326. package/components/input/default/checkboxset/utils.js +15 -25
  327. package/components/input/default/radioset/index.d.ts +2 -0
  328. package/components/input/default/radioset/index.js +409 -350
  329. package/components/input/default/radioset/props.d.ts +6 -0
  330. package/components/input/default/radioset/props.js +0 -5
  331. package/components/input/default/switch/index.js +494 -458
  332. package/components/input/default/switch/prop.js +0 -5
  333. package/components/input/epoch/date/components/DatePickerPopover.js +242 -193
  334. package/components/input/epoch/date/index.js +638 -518
  335. package/components/input/epoch/date/props.js +0 -5
  336. package/components/input/epoch/date/styled.js +61 -70
  337. package/components/input/epoch/date/utils.js +67 -115
  338. package/components/input/epoch/datetime/index.js +758 -695
  339. package/components/input/epoch/datetime/props.js +0 -5
  340. package/components/input/epoch/datetime/utils.js +121 -186
  341. package/components/input/epoch/time/index.js +441 -415
  342. package/components/input/epoch/time/props.js +0 -5
  343. package/components/input/epoch/time/utils.js +101 -112
  344. package/components/input/fileupload/Utils.js +70 -97
  345. package/components/input/fileupload/components/ListItems.js +132 -130
  346. package/components/input/fileupload/components/MultiUpload.js +80 -77
  347. package/components/input/fileupload/components/SingleUpload.js +57 -57
  348. package/components/input/fileupload/index.js +253 -178
  349. package/components/input/fileupload/props.js +0 -5
  350. package/components/input/fileupload/useFileUpload.js +209 -258
  351. package/components/input/number/index.js +434 -393
  352. package/components/input/number/props.js +0 -5
  353. package/components/input/rating/index.js +401 -394
  354. package/components/input/rating/props.js +0 -5
  355. package/components/input/select/index.js +408 -463
  356. package/components/input/select/props.js +0 -5
  357. package/components/input/slider/index.js +339 -332
  358. package/components/input/slider/props.js +0 -5
  359. package/components/input/text/index.d.ts +3 -3
  360. package/components/input/text/index.js +438 -475
  361. package/components/input/text/props.d.ts +1 -1
  362. package/components/input/text/props.js +0 -5
  363. package/components/input/text/util.js +82 -222
  364. package/components/input/textarea/index.js +322 -358
  365. package/components/input/textarea/props.js +0 -5
  366. package/components/input/upload/index.js +135 -131
  367. package/components/input/upload/props.js +0 -5
  368. package/components/input/util/index.js +9 -11
  369. package/components/layout/footer/index.js +12 -35
  370. package/components/layout/footer/props.js +0 -5
  371. package/components/layout/header/index.js +12 -38
  372. package/components/layout/header/props.js +0 -5
  373. package/components/layout/leftnav/index.js +38 -44
  374. package/components/layout/leftnav/props.js +0 -5
  375. package/components/layout/rightnav/index.js +12 -36
  376. package/components/layout/rightnav/props.js +0 -5
  377. package/components/layout/topnav/index.js +24 -38
  378. package/components/layout/topnav/props.js +0 -5
  379. package/components/navbar/index.js +119 -98
  380. package/components/navbar/nav/index.js +236 -232
  381. package/components/navbar/nav/props.js +0 -5
  382. package/components/navbar/nav-item/index.js +74 -65
  383. package/components/navbar/nav-item/props.js +0 -5
  384. package/components/navigation/breadcrumb/index.js +38 -61
  385. package/components/navigation/breadcrumb/props.js +0 -5
  386. package/components/navigation/menu/components/ListItems.js +76 -67
  387. package/components/navigation/menu/constants.js +27 -42
  388. package/components/navigation/menu/hooks/useHoverState.hook.js +20 -47
  389. package/components/navigation/menu/hooks/useKeyboardMovements.hook.js +34 -28
  390. package/components/navigation/menu/hooks/useTransformedDataset.hook.js +21 -14
  391. package/components/navigation/menu/index.js +911 -846
  392. package/components/navigation/menu/props.js +0 -5
  393. package/components/navigation/menu/utils/action-task.js +6 -9
  394. package/components/navigation/menu/utils/role-filter.js +41 -56
  395. package/components/navigation/popover/index.js +191 -205
  396. package/components/navigation/popover/props.js +5 -8
  397. package/components/page/content/index.js +9 -31
  398. package/components/page/content/props.js +0 -5
  399. package/components/page/error-boundary/index.js +115 -105
  400. package/components/page/error-boundary/props.js +0 -5
  401. package/components/page/index.js +84 -102
  402. package/components/page/page-content/index.js +21 -30
  403. package/components/page/page-content/props.js +0 -5
  404. package/components/page/partial/index.js +50 -45
  405. package/components/page/partial/props.js +0 -5
  406. package/components/page/partial-container/index.js +81 -107
  407. package/components/page/partial-container/props.d.ts +1 -1
  408. package/components/page/partial-container/props.js +0 -5
  409. package/components/page/props.js +0 -5
  410. package/components/page/toast-container/index.js +20 -41
  411. package/components/page/toast-container/props.js +0 -5
  412. package/components/prefab/container/index.js +60 -53
  413. package/components/prefab/container/props.js +0 -5
  414. package/components/prefab/index.js +76 -61
  415. package/components/prefab/props.js +0 -5
  416. package/context/AppContext.d.ts +1 -1
  417. package/context/AppContext.js +17 -18
  418. package/context/AppSpinnerProvider.js +19 -34
  419. package/context/LayoutProvider.js +54 -57
  420. package/context/LocalizationProvider.js +34 -49
  421. package/context/PrefabContext.js +68 -119
  422. package/context/WidgetProvider.js +160 -166
  423. package/core/app-config.js +0 -1
  424. package/core/app.service.js +200 -327
  425. package/core/appVariablesStore.js +10 -15
  426. package/core/appstore.js +37 -53
  427. package/core/constants/currency-constant.js +81 -83
  428. package/core/constants/events.js +34 -44
  429. package/core/constants/index.js +21 -31
  430. package/core/dialog.service.js +52 -72
  431. package/core/event-notifier.js +94 -131
  432. package/core/formatter/array-formatters.js +18 -32
  433. package/core/formatter/date-formatters.js +140 -204
  434. package/core/formatter/index.js +64 -117
  435. package/core/formatter/number-formatters.js +115 -159
  436. package/core/formatter/security-formatters.js +233 -283
  437. package/core/formatter/string-formatters.js +23 -45
  438. package/core/formatter/types.js +12 -18
  439. package/core/formatters.js +6 -24
  440. package/core/proxy-service.js +242 -306
  441. package/core/script-registry.js +87 -134
  442. package/core/security.service.js +8 -11
  443. package/core/util/compare.js +13 -25
  444. package/core/util/dom.js +32 -63
  445. package/core/util/index.d.ts +5 -0
  446. package/core/util/index.js +95 -95
  447. package/core/util/safe-is-equal.js +42 -94
  448. package/core/util/security.js +114 -153
  449. package/core/util/utils.d.ts +8 -1
  450. package/core/util/utils.js +124 -132
  451. package/core/widget-observer.js +34 -61
  452. package/higherOrder/BaseApp.js +327 -500
  453. package/higherOrder/BaseAppProps.js +0 -5
  454. package/higherOrder/BaseDateTime.js +277 -231
  455. package/higherOrder/BasePage.js +479 -735
  456. package/higherOrder/BasePartial.js +87 -114
  457. package/higherOrder/BasePrefab.js +190 -206
  458. package/higherOrder/DataNav.js +287 -302
  459. package/higherOrder/helper.js +62 -48
  460. package/higherOrder/props.js +0 -5
  461. package/higherOrder/withBaseWrapper.js +123 -168
  462. package/higherOrder/withStandalone.js +28 -26
  463. package/hooks/useAccess.js +113 -289
  464. package/hooks/useAppConfig.js +15 -40
  465. package/hooks/useAuth.js +256 -495
  466. package/hooks/useDataSourceSubscription.d.ts +3 -3
  467. package/hooks/useDataSourceSubscription.js +99 -109
  468. package/hooks/useDebounce.js +28 -56
  469. package/hooks/useDeviceVisibility.js +14 -23
  470. package/hooks/useHttp.d.ts +1 -0
  471. package/hooks/useHttp.js +318 -493
  472. package/libs/index.js +4 -13
  473. package/libs/prefab/index.js +6 -20
  474. package/mui-config/theme-provider.js +9 -17
  475. package/mui-config/theme.js +6 -9
  476. package/package-lock.json +822 -3191
  477. package/package.json +3 -19
  478. package/providers/AppProviders.js +21 -24
  479. package/runtime-dynamic/App.js +65 -93
  480. package/runtime-dynamic/app-initializer.js +207 -400
  481. package/runtime-dynamic/components/ErrorBoundary.js +59 -76
  482. package/runtime-dynamic/components/PageWrapper.js +23 -35
  483. package/runtime-dynamic/components/PrefabPreview.js +40 -69
  484. package/runtime-dynamic/components/partial-content.d.ts +2 -3
  485. package/runtime-dynamic/components/partial-content.js +66 -48
  486. package/runtime-dynamic/components/prefab-content.js +37 -30
  487. package/runtime-dynamic/components/use-dynamic-component.js +62 -150
  488. package/runtime-dynamic/factories/build-base-page-like-component.js +44 -58
  489. package/runtime-dynamic/factories/dynamic-component.d.ts +9 -0
  490. package/runtime-dynamic/factories/dynamic-component.js +83 -0
  491. package/runtime-dynamic/factories/prefab-factory.js +60 -81
  492. package/runtime-dynamic/factories/startup-info.js +12 -25
  493. package/runtime-dynamic/factories/utils.d.ts +1 -9
  494. package/runtime-dynamic/factories/utils.js +47 -130
  495. package/runtime-dynamic/index.js +56 -191
  496. package/runtime-dynamic/main.js +42 -70
  497. package/runtime-dynamic/preview-mode.js +14 -29
  498. package/runtime-dynamic/preview-navigation.js +21 -30
  499. package/runtime-dynamic/preview-path.d.ts +5 -0
  500. package/runtime-dynamic/preview-path.js +13 -0
  501. package/runtime-dynamic/preview-resource-base.js +15 -31
  502. package/runtime-dynamic/registry/component-registry.js +269 -334
  503. package/runtime-dynamic/registry/custom-widget-registry.js +11 -15
  504. package/runtime-dynamic/registry/index.js +24 -63
  505. package/runtime-dynamic/registry/store.d.ts +1 -0
  506. package/runtime-dynamic/registry/store.js +18 -23
  507. package/runtime-dynamic/routes.js +53 -81
  508. package/runtime-dynamic/services/app-extension-provider.js +17 -44
  509. package/runtime-dynamic/services/autolayout-inject.d.ts +4 -0
  510. package/runtime-dynamic/services/autolayout-inject.js +27 -0
  511. package/runtime-dynamic/services/cache.js +27 -33
  512. package/runtime-dynamic/services/compile-render.d.ts +9 -0
  513. package/runtime-dynamic/services/compile-render.js +142 -0
  514. package/runtime-dynamic/services/component-ref-provider.js +70 -124
  515. package/runtime-dynamic/services/css-scoping.js +27 -28
  516. package/runtime-dynamic/services/fragment-url.js +37 -50
  517. package/runtime-dynamic/services/index.js +48 -152
  518. package/runtime-dynamic/services/markup-transpiler.d.ts +2 -2
  519. package/runtime-dynamic/services/markup-transpiler.js +39 -231
  520. package/runtime-dynamic/services/prefab-resources.js +42 -130
  521. package/runtime-dynamic/services/resource-manager.d.ts +2 -1
  522. package/runtime-dynamic/services/resource-manager.js +32 -63
  523. package/runtime-dynamic/services/script-executor.js +50 -61
  524. package/runtime-dynamic/services/variable-factory.js +141 -184
  525. package/runtime-dynamic/services/variable-registry.js +69 -115
  526. package/runtime-dynamic/services/variable-transpiler.js +73 -103
  527. package/runtime-dynamic/shims/next-image.js +79 -50
  528. package/runtime-dynamic/shims/next-link.js +58 -32
  529. package/runtime-dynamic/shims/next-navigation.js +17 -34
  530. package/runtime-dynamic/utils/index.d.ts +2 -0
  531. package/runtime-dynamic/utils/index.js +22 -24
  532. package/store/bindActions/i18nActions.js +16 -18
  533. package/store/index.js +29 -35
  534. package/store/middleware/navigationMiddleware.js +25 -45
  535. package/store/middleware/pendingTabNavigationIntentMiddleware.js +20 -25
  536. package/store/slices/appConfigSlice.js +65 -94
  537. package/store/slices/authSlice.js +317 -471
  538. package/store/slices/i18nSlice.js +169 -168
  539. package/store/slices/navigationSlice.js +22 -20
  540. package/store/util/resolve-path.d.ts +1 -0
  541. package/store/util/resolve-path.js +7 -0
  542. package/store/viewport.service.js +150 -194
  543. package/types/index.js +10 -15
  544. package/utils/attr.js +198 -41
  545. package/utils/custom-expression/index.js +55 -151
  546. package/utils/custom-expression/parser.js +106 -182
  547. package/utils/dataset-util.js +113 -154
  548. package/utils/eval-expression.js +10 -19
  549. package/utils/form-state.util.js +60 -118
  550. package/utils/form-utils.js +49 -190
  551. package/utils/format-util.js +113 -184
  552. package/utils/layoutsize-util.js +11 -17
  553. package/utils/lib-error-skipper.js +54 -52
  554. package/utils/page-params-util.js +50 -40
  555. package/utils/pending-tab-navigation-intent.js +7 -17
  556. package/utils/resource-url.js +8 -19
  557. package/utils/state-persistance.js +136 -253
  558. package/utils/style-utils.d.ts +2 -0
  559. package/utils/style-utils.js +25 -74
  560. package/utils/transformedDataset-utils.js +353 -381
  561. package/utils/widget-cleanup-util.js +42 -74
  562. package/utils/widgets.js +19 -31
  563. package/variables/base-variable.js +117 -166
  564. package/variables/constants.js +5 -8
  565. package/variables/crud-variable.js +150 -181
  566. package/variables/live-variable.d.ts +1 -1
  567. package/variables/live-variable.js +140 -174
  568. package/variables/metadata.service.js +74 -116
  569. package/variables/model-variable.js +68 -78
  570. package/variables/service-variable.js +171 -285
  571. package/wm-namespace.js +11 -14
  572. package/components/chart/src/css.d.js +0 -1
  573. package/tsconfig.declaration.tsbuildinfo +0 -1
  574. 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,67 @@ 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(() => {
227
+ var _a2, _b2;
243
228
  if (appContext && !appContext.isAppReady) {
244
229
  return false;
245
230
  }
246
-
247
- // Wait for access check to complete
248
231
  if (accessLoading) {
249
232
  return false;
250
233
  }
251
-
252
- // Don't initialize if no access
253
234
  if (!hasAccess && isSecurityEnabled) {
254
235
  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");
236
+ appContext == null ? void 0 : appContext.notifyApp(
237
+ ((_b2 = (_a2 = pageContext == null ? void 0 : pageContext.appLocale) == null ? void 0 : _a2.LABELS) == null ? void 0 : _b2.ACCESS_DENIED) || "Access Denied",
238
+ "Error"
239
+ );
257
240
  }
258
241
  return false;
259
242
  }
260
243
  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) {
244
+ }, [appContext == null ? void 0 : appContext.isAppReady, accessLoading, hasAccess, isSecurityEnabled, isAuthenticated]);
245
+ useEffect(() => {
246
+ if (!(appContext == null ? void 0 : appContext.isAppReady) || !pageProxyRef.current) {
266
247
  return;
267
248
  }
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
249
+ setPageContext((prev) => {
250
+ const updatedVariables = __spreadValues(__spreadValues({}, prev.Variables), appContext.Variables || {});
251
+ const updatedActions = __spreadValues(__spreadValues({}, prev.Actions), appContext.Actions || {});
275
252
  pageProxyRef.current.Variables = updatedVariables;
276
253
  pageProxyRef.current.Actions = updatedActions;
277
- return _objectSpread(_objectSpread({}, prev), {}, {
278
- App: _objectSpread(_objectSpread({}, prev.App), {}, {
254
+ return __spreadProps(__spreadValues({}, prev), {
255
+ App: __spreadProps(__spreadValues({}, prev.App), {
279
256
  Variables: appContext.Variables || {},
280
257
  Actions: appContext.Actions || {}
281
258
  }),
@@ -283,135 +260,93 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
283
260
  Actions: updatedActions
284
261
  });
285
262
  });
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
263
+ }, [appContext == null ? void 0 : appContext.isAppReady, appContext == null ? void 0 : appContext.Variables, appContext == null ? void 0 : appContext.Actions]);
264
+ useEffect(() => {
291
265
  if (!shouldInitialize || isInitialized || isInitializingRef.current || !isMountedRef.current) {
292
266
  return;
293
267
  }
294
-
295
- // Set initialization flag
296
268
  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
- }();
269
+ const initializeComponent = async () => {
270
+ var _a2;
271
+ try {
272
+ overriddenPropsRegistryRef.current = createOverriddenPropsRegistry();
273
+ const pageProxy = createStateProxy(
274
+ pageContext,
275
+ [],
276
+ setPageContext,
277
+ overriddenPropsRegistryRef.current
278
+ );
279
+ pageProxyRef.current = pageProxy;
280
+ const pageVariables = getVariables(pageProxy);
281
+ let appVariables = { Variables: {}, Actions: {} };
282
+ if (appContext == null ? void 0 : appContext.isAppReady) {
283
+ appVariables = {
284
+ Variables: appContext.Variables || {},
285
+ Actions: appContext.Actions || {}
286
+ };
287
+ } else {
288
+ const APP_VARIABLES = appstore.get("AppConfig").appVariables;
289
+ appVariables = APP_VARIABLES ? getAppVariablesInstance(pageProxy, APP_VARIABLES) : { Variables: {}, Actions: {} };
290
+ }
291
+ const { Variables, Actions } = mergeVariablesAndActions(pageVariables, appVariables);
292
+ const urlParams = Object.fromEntries(pageParams.entries());
293
+ const newParams = computeMergedPageParams(urlParams, {
294
+ componentType: componentInfo == null ? void 0 : componentInfo.componentType,
295
+ props
296
+ });
297
+ pageProxy.pageParams = newParams;
298
+ if ((componentInfo == null ? void 0 : componentInfo.componentType) !== "PAGE") {
299
+ pageProxy.partialParams = newParams;
300
+ (_a2 = props.onLoad) == null ? void 0 : _a2.call(props, pageProxy);
301
+ }
302
+ appProxy.appLocale = i18n.appLocale || {};
303
+ const localeFormats = {
304
+ date: i18n.dateFormat,
305
+ time: i18n.timeFormat,
306
+ currency: i18n.currencyCode
307
+ };
308
+ appProxy.localeFormats = localeFormats;
309
+ pageProxy.localeFormats = localeFormats;
310
+ pageProxy.Variables = Variables;
311
+ pageProxy.Actions = Actions;
312
+ pageProxy.pageReady = pageReady;
313
+ pageProxy.App = __spreadValues(__spreadValues({}, appProxy), initialAppConfig);
314
+ pageProxy.selectedLocale = i18n.selectedLocale || "en";
315
+ pageProxy.overriddenPropsRegistry = overriddenPropsRegistryRef.current;
316
+ setupVariableSubscriptions(pageVariables.Variables);
317
+ if ((componentInfo == null ? void 0 : componentInfo.componentType) === "PAGE" && appProxy) {
318
+ const pageName2 = componentInfo == null ? void 0 : componentInfo.componentName;
319
+ appProxy.updateActivePage(pageName2);
320
+ appProxy.activePage = pageProxy;
321
+ appProxy.activePageName = pageName2;
322
+ Object.assign(appProxy.Widgets, pageProxy.Widgets);
323
+ } else if ((componentInfo == null ? void 0 : componentInfo.componentName) === "Common" && (componentInfo == null ? void 0 : componentInfo.componentType) === "PARTIAL" && appProxy) {
324
+ Object.assign(appProxy.Widgets, pageProxy.Widgets);
325
+ }
326
+ addPageScript(appProxy, pageProxy);
327
+ wrapWithThirdPartyErrorGuard(
328
+ pageProxy,
329
+ appContext,
330
+ (componentInfo == null ? void 0 : componentInfo.componentName) || "Prefab"
331
+ );
332
+ if ((componentInfo == null ? void 0 : componentInfo.componentType) === "PAGE") {
333
+ global.wm = appProxy ? __spreadProps(__spreadValues({}, pageProxy), { App: appProxy }) : pageProxy;
334
+ }
335
+ setIsInitialized(true);
336
+ } catch (error) {
337
+ console.error("Error during component initialization:", error);
338
+ setIsInitialized(true);
339
+ } finally {
340
+ isInitializingRef.current = false;
341
+ }
342
+ };
399
343
  initializeComponent();
400
-
401
- // Cleanup function
402
- return function () {
403
- var _overriddenPropsRegis;
404
- // Cancel all pending page operations
344
+ return () => {
345
+ var _a2;
405
346
  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") {
347
+ const { Variables = {}, Actions = {} } = getVariables(pageProxyRef.current) || {};
348
+ Object.values(Variables).forEach((variable) => {
349
+ if ((variable == null ? void 0 : variable.cancel) && typeof variable.cancel === "function") {
415
350
  try {
416
351
  variable.cancel();
417
352
  } catch (error) {
@@ -419,10 +354,8 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
419
354
  }
420
355
  }
421
356
  });
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") {
357
+ Object.values(Actions).forEach((action) => {
358
+ if ((action == null ? void 0 : action.cancel) && typeof action.cancel === "function") {
426
359
  try {
427
360
  action.cancel();
428
361
  } catch (error) {
@@ -431,135 +364,99 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
431
364
  }
432
365
  });
433
366
  }
434
-
435
- // Clear pending startup operations
436
367
  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) {
368
+ (_a2 = overriddenPropsRegistryRef.current) == null ? void 0 : _a2.clear();
369
+ subscriptionsRef.current.forEach(({ variable, event, handler }) => {
370
+ if (variable == null ? void 0 : variable.unsubscribe) {
446
371
  try {
447
372
  variable.unsubscribe(event, handler);
448
373
  } catch (error) {
449
- console.warn("Failed to unsubscribe from ".concat(event, ":"), error);
374
+ console.warn(`Failed to unsubscribe from ${event}:`, error);
450
375
  }
451
376
  }
452
377
  });
453
378
  subscriptionsRef.current = [];
454
379
  };
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) {
380
+ }, [shouldInitialize]);
381
+ useEffect(() => {
382
+ if (!(appContext == null ? void 0 : appContext.isAppReady) || !pageProxyRef.current || appVarSubscriptionsDoneRef.current) {
462
383
  return;
463
384
  }
464
385
  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);
386
+ const { Variables: pageVars = {} } = getVariables(pageProxyRef.current) || {
387
+ Variables: {}
388
+ };
389
+ const pageVarNames = new Set(Object.keys(pageVars || {}));
390
+ subscribeAppVariablesIfNeeded(
391
+ appContext.Variables || {},
392
+ pageVarNames
393
+ );
472
394
  appVarSubscriptionsDoneRef.current = true;
473
395
  } catch (e) {
474
- // no-op
475
396
  }
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);
397
+ }, [appContext == null ? void 0 : appContext.isAppReady]);
398
+ useEffect(() => {
399
+ if (prefabInfo && (componentInfo == null ? void 0 : componentInfo.componentType) === "PREFAB") {
400
+ const handlePrefabStateRefresh = (data) => {
401
+ const proxy = pageProxyRef.current;
402
+ Object.keys(data).forEach((key) => {
403
+ var _a2;
404
+ const propKey = data[key].key;
405
+ let newValue = (_a2 = data[key].newValue) != null ? _a2 : data[key].oldValue;
406
+ if (newValue && typeof newValue === "object") {
407
+ newValue = cloneDeep(newValue);
489
408
  }
490
-
491
- // Call onPropertyChange if available
492
409
  if (proxy && proxy.onPropertyChange) {
493
410
  proxy[propKey] = newValue;
494
411
  proxy.onPropertyChange(propKey, newValue, data[key].oldValue);
495
412
  }
496
413
  });
497
414
  };
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);
415
+ EVENTEMITTER_METHODS.PREFAB_STATE_SYNC_ON(prefabInfo == null ? void 0 : prefabInfo.name, handlePrefabStateRefresh);
416
+ return () => {
417
+ EVENTEMITTER_METHODS.PREFAB_STATE_SYNC_OFF(prefabInfo == null ? void 0 : prefabInfo.name, handlePrefabStateRefresh);
501
418
  };
502
419
  }
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") {
420
+ }, [prefabInfo, componentInfo == null ? void 0 : componentInfo.componentType]);
421
+ const setupVariableSubscriptions = (variables) => {
422
+ const handleVariableEvent = (variableName, event, variable) => {
423
+ const updateState = variable;
424
+ updateState.loading = event === VariableEvents.BEFORE_INVOKE;
425
+ updateState.error = event === VariableEvents.ERROR ? variable : null;
426
+ if (get(variable, "spinnerContext") === "page") {
514
427
  if (updateState.loading) {
515
- var message = (0, _get["default"])(variable, "spinnerMessage");
428
+ const message = get(variable, "spinnerMessage");
516
429
  show(message);
517
430
  } else {
518
431
  hide();
519
432
  }
520
433
  }
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);
434
+ setPageContext((prev) => __spreadProps(__spreadValues({}, prev), {
435
+ Variables: __spreadProps(__spreadValues({}, prev.Variables), {
436
+ [variableName]: updateState
437
+ })
438
+ }));
439
+ if (event === VariableEvents.AFTER_INVOKE) {
440
+ pendingStartupOpsRef.current.delete(variableName);
528
441
  }
529
442
  };
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];
443
+ Object.entries(variables).forEach(([name, variable]) => {
536
444
  if (subscribedVariableNamesRef.current.has(name)) {
537
445
  return;
538
446
  }
539
- Object.values(_types.VariableEvents).forEach(function (event) {
540
- var handler = function handler() {
541
- return handleVariableEvent(name, event, variable);
542
- };
447
+ Object.values(VariableEvents).forEach((event) => {
448
+ const handler = () => handleVariableEvent(name, event, variable);
543
449
  if (variable && typeof variable.subscribe === "function") {
544
450
  variable.subscribe(event, handler);
545
- subscriptionsRef.current.push({
546
- variable: variable,
547
- event: event,
548
- handler: handler
549
- });
451
+ subscriptionsRef.current.push({ variable, event, handler });
550
452
  }
551
453
  });
552
454
  subscribedVariableNamesRef.current.add(name);
553
455
  });
554
456
  };
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];
457
+ const subscribeAppVariablesIfNeeded = (appVars, pageVarNames) => {
458
+ const appVarsOnly = {};
459
+ Object.entries(appVars || {}).forEach(([name, variable]) => {
563
460
  if (!pageVarNames.has(name) && !subscribedVariableNamesRef.current.has(name)) {
564
461
  appVarsOnly[name] = variable;
565
462
  }
@@ -568,203 +465,111 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
568
465
  setupVariableSubscriptions(appVarsOnly);
569
466
  }
570
467
  };
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();
468
+ const executeStartupOperations = async (Variables, Actions) => {
469
+ const { startUpActions = [], startUpVariables = [] } = componentInfo || {};
470
+ startUpVariables.forEach((name) => pendingStartupOpsRef.current.add(name));
471
+ startUpActions.forEach((name) => pendingStartupOpsRef.current.add(name));
472
+ if (startUpActions.length === 0 && startUpVariables.length === 0) {
473
+ return;
474
+ }
475
+ try {
476
+ startUpActions.forEach((actionName) => {
477
+ var _a2;
478
+ if ((_a2 = Actions[actionName]) == null ? void 0 : _a2.invoke) {
479
+ Actions[actionName].invoke();
636
480
  }
637
- }, _callee2, null, [[5, 15]]);
638
- }));
639
- return function executeStartupOperations(_x, _x2) {
640
- return _ref10.apply(this, arguments);
641
- };
642
- }();
481
+ pendingStartupOpsRef.current.delete(String(actionName));
482
+ });
483
+ const variablePromises = startUpVariables.map((varName) => {
484
+ var _a2;
485
+ if ((_a2 = Variables[varName]) == null ? void 0 : _a2.invoke) {
486
+ return Variables[varName].invoke().catch((error) => {
487
+ console.log(`Error invoking ${varName}:`, error);
488
+ return null;
489
+ });
490
+ }
491
+ return Promise.resolve();
492
+ });
493
+ await Promise.allSettled(variablePromises);
494
+ startUpVariableLoadedRef.current = true;
495
+ pendingStartupOpsRef.current.clear();
496
+ setTimeout(() => {
497
+ if ((componentInfo == null ? void 0 : componentInfo.componentType) === "PAGE") {
498
+ appContext == null ? void 0 : appContext.notify("page-variables-data-loaded", {
499
+ pageName: componentInfo == null ? void 0 : componentInfo.componentName
500
+ });
501
+ }
502
+ }, 0);
503
+ } catch (error) {
504
+ console.error("Error during startup operations:", error);
505
+ }
506
+ };
643
507
  function layoutReady() {
644
508
  setIsLayoutReady(true);
645
509
  }
646
-
647
- // Widget state update function
648
510
  function updateWidgetState(widgetName, newProps) {
649
511
  if (!widgetName || !newProps || Object.keys(newProps).length === 0) return;
650
- if ((0, _compare["default"])(pageContext.Widgets[widgetName], newProps)) return;
651
- var registry = overriddenPropsRegistryRef.current;
512
+ if (compare(pageContext.Widgets[widgetName], newProps)) return;
513
+ const registry = overriddenPropsRegistryRef.current;
652
514
  if (registry) {
653
- Object.keys(newProps).forEach(function (key) {
654
- if (newProps[key] !== undefined) {
515
+ Object.keys(newProps).forEach((key) => {
516
+ if (newProps[key] !== void 0) {
655
517
  registry.trackInternalUpdate(widgetName, key, newProps[key]);
656
518
  }
657
519
  });
658
520
  }
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]) {
521
+ setPageContext((prev) => __spreadProps(__spreadValues({}, prev), {
522
+ Widgets: __spreadProps(__spreadValues({}, prev.Widgets), {
523
+ [widgetName]: __spreadValues(__spreadValues({}, prev.Widgets[widgetName]), newProps)
524
+ })
525
+ }));
526
+ withSuspendedTracking(overriddenPropsRegistryRef.current, () => {
527
+ Object.keys(newProps).forEach((key) => {
528
+ var _a2, _b2, _c2;
529
+ 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) {
530
+ if ((_c2 = (_b2 = pageProxyRef.current) == null ? void 0 : _b2.Widgets) == null ? void 0 : _c2[widgetName]) {
672
531
  pageProxyRef.current.Widgets[widgetName][key] = newProps[key];
673
532
  }
674
533
  }
675
534
  });
676
535
  });
677
536
  }
678
-
679
- // Content ready callback
680
- function onContentReady() {
681
- return _onContentReady.apply(this, arguments);
537
+ async function onContentReady() {
538
+ if (pageContext.onReady) {
539
+ await pageContext.onReady();
540
+ }
541
+ if ((appContext == null ? void 0 : appContext.onPageReady) && pageContext.componentType === "PAGE") {
542
+ appContext.onPageReady(pageContext.componentName, pageProxyRef.current, void 0);
543
+ }
544
+ return Promise.resolve();
682
545
  }
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);
546
+ async function executeStartup() {
547
+ await (appContext == null ? void 0 : appContext.executeStartAppOperations());
706
548
  }
707
- function executeStartup() {
708
- return _executeStartup.apply(this, arguments);
549
+ async function executePageStartup() {
550
+ await executeStartupOperations(pageContext.Variables, pageContext.Actions);
709
551
  }
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);
724
- }
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);
742
- }
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) {
552
+ useEffect(() => {
553
+ var _a2;
554
+ const newAppLocale = merge({}, i18n.appLocale || {}, (prefabInfo == null ? void 0 : prefabInfo.appLocale) || {});
555
+ if (!isEqual(pageContext.appLocale, newAppLocale)) {
556
+ setPageContext((prev) => __spreadProps(__spreadValues({}, prev), {
557
+ appLocale: newAppLocale
558
+ }));
559
+ if ((_a2 = pageProxyRef.current) == null ? void 0 : _a2.App) {
753
560
  pageProxyRef.current.App.appLocale = newAppLocale;
754
561
  }
755
562
  }
756
563
  }, [i18n.appLocale]);
757
- (0, _react.useEffect)(function () {
758
- var localeFormats = {
564
+ useEffect(() => {
565
+ const localeFormats = {
759
566
  date: i18n.dateFormat,
760
567
  time: i18n.timeFormat,
761
568
  currency: i18n.currencyCode
762
569
  };
763
- setPageContext(function (prev) {
764
- return _objectSpread(_objectSpread({}, prev), {}, {
765
- localeFormats: localeFormats
766
- });
767
- });
570
+ setPageContext((prev) => __spreadProps(__spreadValues({}, prev), {
571
+ localeFormats
572
+ }));
768
573
  if (pageProxyRef.current) {
769
574
  pageProxyRef.current.localeFormats = localeFormats;
770
575
  if (pageProxyRef.current.App) {
@@ -772,138 +577,77 @@ var withPageContext = exports.withPageContext = function withPageContext(Wrapped
772
577
  }
773
578
  }
774
579
  }, [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
- });
580
+ const pageName = (appProxy == null ? void 0 : appProxy.activePageName) || "";
581
+ useEffect(() => {
582
+ if ((componentInfo == null ? void 0 : componentInfo.componentType) === "PARTIAL" && pageName) {
583
+ setPageContext((prev) => __spreadProps(__spreadValues({}, prev), {
584
+ App: __spreadProps(__spreadValues({}, prev.App), {
585
+ activePageName: pageName
586
+ })
587
+ }));
786
588
  }
787
589
  }, [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 () {
590
+ useEffect(() => {
793
591
  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
- }();
592
+ const runStartup = async () => {
593
+ if (!isMountedRef.current) return;
594
+ if ((securityConfig == null ? void 0 : securityConfig.authenticated) && (appProxy == null ? void 0 : appProxy.executeSessionFailureRequests)) {
595
+ await appProxy.executeSessionFailureRequests();
596
+ }
597
+ await executeStartup();
598
+ await onContentReady();
599
+ await executePageStartup();
600
+ onStartupCompletedRef.current = true;
601
+ if (pendingAccordionExpansion) {
602
+ accordionExpansionHandler(pageProxyRef, pendingAccordionExpansion, dispatch);
603
+ }
604
+ const tabNameFromUrl = !urlTabProcessedRef.current ? pageParams == null ? void 0 : pageParams.get("tabName") : null;
605
+ const tabNameToSelect = tabNameFromUrl || pendingTabSelection;
606
+ if (tabNameToSelect) {
607
+ tabSelectionHandler(pageProxyRef, tabNameToSelect, dispatch);
608
+ }
609
+ };
846
610
  runStartup();
847
611
  }
848
612
  }, [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 () {
613
+ useEffect(() => {
856
614
  isMountedRef.current = true;
857
- return function () {
615
+ return () => {
858
616
  isMountedRef.current = false;
859
- // Cleanup viewport service when component unmounts
860
- _viewport.viewportService.destroy();
617
+ viewportService.destroy();
861
618
  };
862
619
  }, []);
863
-
864
- // Handle access denied case
865
- if (!accessLoading && !hasAccess && !(componentInfo !== null && componentInfo !== void 0 && componentInfo.isPartOfPrefab)) {
620
+ if (!accessLoading && !hasAccess && !(componentInfo == null ? void 0 : componentInfo.isPartOfPrefab)) {
866
621
  return null;
867
622
  }
868
-
869
- // Handle access error case
870
623
  if (accessError && !accessLoading) {
871
- console.error("Access check failed for ".concat(componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.componentName, ":"), accessError);
624
+ console.error(`Access check failed for ${componentInfo == null ? void 0 : componentInfo.componentName}:`, accessError);
872
625
  return null;
873
626
  }
874
-
875
- // Show loading spinner while checking access or app is not ready
876
627
  if (accessLoading || appContext && !appContext.isAppReady || !isInitialized) {
877
- return __jsx(_spinner.WmSpinner, {
878
- name: "page",
879
- caption: "",
880
- listener: {}
881
- });
628
+ return /* @__PURE__ */ jsx(WmSpinner, { name: "page", caption: "", listener: {} });
882
629
  }
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());
630
+ if ((appContext == null ? void 0 : appContext.autoUpdateVariables) && onStartupCompletedRef.current) {
631
+ const appVariables = appContext.Variables;
632
+ appContext.autoUpdateVariables.forEach((value) => {
633
+ var _a2, _b2;
634
+ ((_a2 = appVariables[value]) == null ? void 0 : _a2.invokeOnParamChange) && ((_b2 = appVariables[value]) == null ? void 0 : _b2.invokeOnParamChange());
888
635
  });
889
636
  }
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);
637
+ if (((_c = componentInfo == null ? void 0 : componentInfo.autoUpdateVariables) == null ? void 0 : _c.length) && onStartupCompletedRef.current) {
638
+ const pageVariables = pageContext.Variables;
639
+ componentInfo.autoUpdateVariables.forEach((value) => {
640
+ var _a2, _b2;
641
+ (_b2 = (_a2 = pageVariables[value]) == null ? void 0 : _a2.invokeOnParamChange) == null ? void 0 : _b2.call(_a2);
895
642
  });
896
643
  }
897
-
898
- // Render the component
899
- return __jsx(_WidgetProvider.WidgetProvider, {
900
- value: {
901
- value: pageContext,
902
- proxy: pageProxyRef.current
903
- }
904
- }, __jsx(WrappedComponent, props));
644
+ return /* @__PURE__ */ jsx(WidgetProvider, { value: { value: pageContext, proxy: pageProxyRef.current }, children: /* @__PURE__ */ jsx(WrappedComponent, __spreadValues({}, props)) });
905
645
  };
906
- PageContextComponent.displayName = "WithPageContext(".concat(WrappedComponent.displayName || WrappedComponent.name || "Component", ")");
646
+ PageContextComponent.displayName = `WithPageContext(${WrappedComponent.displayName || WrappedComponent.name || "Component"})`;
907
647
  return PageContextComponent;
908
648
  };
909
- var _default = exports["default"] = withPageContext;
649
+ var BasePage_default = withPageContext;
650
+ export {
651
+ BasePage_default as default,
652
+ withPageContext
653
+ };