@databiosphere/findable-ui 34.1.0 → 35.0.2

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 (272) hide show
  1. package/.release-please-manifest.json +1 -1
  2. package/CHANGELOG.md +26 -0
  3. package/lib/components/DataDictionary/components/Table/columns/columnDef.d.ts +6 -0
  4. package/lib/components/DataDictionary/components/Table/columns/columnDef.js +33 -0
  5. package/lib/components/DataDictionary/components/Table/columns/columnIdentifier.d.ts +5 -0
  6. package/lib/components/DataDictionary/components/Table/columns/columnIdentifier.js +5 -0
  7. package/lib/components/DataDictionary/components/Table/columns/types.d.ts +2 -0
  8. package/lib/components/DataDictionary/components/Table/components/BasicCell/types.d.ts +4 -0
  9. package/lib/components/DataDictionary/components/Table/components/BasicCell/types.js +1 -0
  10. package/lib/components/Detail/components/Table/components/TableHead/tableHead.d.ts +8 -0
  11. package/lib/components/Detail/components/Table/components/TableHead/tableHead.js +36 -0
  12. package/lib/components/Filter/components/Filter/filter.stories.d.ts +25 -0
  13. package/lib/components/Filter/components/Filter/filter.stories.js +42 -0
  14. package/lib/components/Filter/components/FilterTag/filterTag.stories.d.ts +16 -0
  15. package/lib/components/Filter/components/FilterTag/filterTag.stories.js +17 -0
  16. package/lib/components/Filter/components/Filters/filters.stories.d.ts +6 -0
  17. package/lib/components/Filter/components/Filters/filters.stories.js +91 -0
  18. package/lib/components/Index/components/Cell/cell.d.ts +7 -0
  19. package/lib/components/Index/components/Cell/cell.js +10 -0
  20. package/lib/components/Index/components/EntitiesView/constants.d.ts +1 -0
  21. package/lib/components/Index/components/EntitiesView/constants.js +1 -0
  22. package/lib/components/Index/components/Hero/components/Summaries/summaries.stories.d.ts +13 -0
  23. package/lib/components/Index/components/Hero/components/Summaries/summaries.stories.js +18 -0
  24. package/lib/components/Index/components/Hero/hero.stories.d.ts +23 -0
  25. package/lib/components/Index/components/Hero/hero.stories.js +22 -0
  26. package/lib/components/Index/components/NTag/components/Tooltip/tooltip.d.ts +8 -0
  27. package/lib/components/Index/components/NTag/components/Tooltip/tooltip.js +57 -0
  28. package/lib/components/Index/components/NTag/components/Tooltip/tooltip.styles.d.ts +4 -0
  29. package/lib/components/Index/components/NTag/components/Tooltip/tooltip.styles.js +10 -0
  30. package/lib/components/Index/components/NTag/nTag.d.ts +10 -0
  31. package/lib/components/Index/components/NTag/nTag.js +8 -0
  32. package/lib/components/Index/components/NTagCell/nTagCell.d.ts +11 -0
  33. package/lib/components/Index/components/NTagCell/nTagCell.js +29 -0
  34. package/lib/components/Index/components/NTagCell/nTagCell.stories.d.ts +5 -0
  35. package/lib/components/Index/components/NTagCell/nTagCell.stories.js +16 -0
  36. package/lib/components/Index/components/TitleCell/titleCell.d.ts +6 -0
  37. package/lib/components/Index/components/TitleCell/titleCell.js +10 -0
  38. package/lib/components/Index/components/TitleCell/titleCell.styles.d.ts +3 -0
  39. package/lib/components/Index/components/TitleCell/titleCell.styles.js +6 -0
  40. package/lib/components/Index/index.stories.d.ts +6 -0
  41. package/lib/components/Index/index.stories.js +26 -0
  42. package/lib/components/Layout/components/BackPage/components/BackPageHero/backPageHero.stories.d.ts +6 -0
  43. package/lib/components/Layout/components/BackPage/components/BackPageHero/backPageHero.stories.js +10 -0
  44. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/AuthenticationMenu/authenticationMenu.stories.d.ts +5 -0
  45. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/AuthenticationMenu/authenticationMenu.stories.js +29 -0
  46. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.d.ts +6 -0
  47. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.js +13 -0
  48. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.styles.d.ts +36 -0
  49. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.styles.js +9 -0
  50. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.d.ts +5 -0
  51. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.js +10 -0
  52. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.styles.d.ts +36 -0
  53. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.styles.js +9 -0
  54. package/lib/components/Layout/components/Header/hooks/useMeasureHeader.d.ts +5 -0
  55. package/lib/components/Layout/components/Header/hooks/useMeasureHeader.js +19 -0
  56. package/lib/components/Layout/components/Outline/common/constants.d.ts +2 -0
  57. package/lib/components/Layout/components/Outline/common/constants.js +1 -0
  58. package/lib/components/Login/login.stories.d.ts +6 -0
  59. package/lib/components/Login/login.stories.js +31 -0
  60. package/lib/components/Table/components/CheckboxMenu/checkboxMenu.d.ts +16 -0
  61. package/lib/components/Table/components/CheckboxMenu/checkboxMenu.js +28 -0
  62. package/lib/components/Table/components/CheckboxMenu/checkboxMenu.stories.d.ts +5 -0
  63. package/lib/components/Table/components/CheckboxMenu/checkboxMenu.stories.js +46 -0
  64. package/lib/components/Table/components/CheckboxMenu/checkboxMenu.styles.d.ts +3 -0
  65. package/lib/components/Table/components/CheckboxMenu/checkboxMenu.styles.js +21 -0
  66. package/lib/components/Table/components/EntityViewToggle/entityViewToggle.d.ts +2 -0
  67. package/lib/components/Table/components/EntityViewToggle/entityViewToggle.js +37 -0
  68. package/lib/components/TableCreator/common/constants.d.ts +6 -0
  69. package/lib/components/TableCreator/common/constants.js +19 -0
  70. package/lib/components/TableCreator/common/entities.d.ts +5 -0
  71. package/lib/components/TableCreator/common/entities.js +1 -0
  72. package/lib/components/TableCreator/tableCreator.styles.d.ts +4 -0
  73. package/lib/components/TableCreator/tableCreator.styles.js +4 -0
  74. package/lib/components/common/Alert/alert.stories.d.ts +6 -0
  75. package/lib/components/common/Alert/alert.stories.js +36 -0
  76. package/lib/components/common/Alert/components/AlertText/alertText.styles.d.ts +4 -0
  77. package/lib/components/common/Alert/components/AlertText/alertText.styles.js +19 -0
  78. package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.d.ts +7 -0
  79. package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.js +5 -0
  80. package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.styles.d.ts +3 -0
  81. package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.styles.js +19 -0
  82. package/lib/components/common/Banner/components/DismissibleBanner/dismissibleBanner.d.ts +10 -0
  83. package/lib/components/common/Banner/components/DismissibleBanner/dismissibleBanner.js +16 -0
  84. package/lib/components/common/Banner/components/SessionTimeout/sessionTimeout.styles.d.ts +3 -0
  85. package/lib/components/common/Banner/components/SessionTimeout/sessionTimeout.styles.js +21 -0
  86. package/lib/components/common/Button/components/LoginButton/loginButton.d.ts +3 -0
  87. package/lib/components/common/Button/components/LoginButton/loginButton.js +6 -0
  88. package/lib/components/common/Button/components/LoginButton/loginButton.styles.d.ts +7 -0
  89. package/lib/components/common/Button/components/LoginButton/loginButton.styles.js +11 -0
  90. package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.d.ts +5 -0
  91. package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.js +10 -0
  92. package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.stories.d.ts +3 -0
  93. package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.stories.js +9 -0
  94. package/lib/hooks/stateSyncManager/hook.d.ts +19 -0
  95. package/lib/hooks/stateSyncManager/hook.js +35 -0
  96. package/lib/hooks/stateSyncManager/hooks/UseBeforePopState/hook.d.ts +1 -0
  97. package/lib/hooks/stateSyncManager/hooks/UseBeforePopState/hook.js +21 -0
  98. package/lib/hooks/stateSyncManager/hooks/UseMetaCommands/hook.d.ts +2 -0
  99. package/lib/hooks/stateSyncManager/hooks/UseMetaCommands/hook.js +23 -0
  100. package/lib/hooks/stateSyncManager/hooks/UseMetaCommands/types.d.ts +4 -0
  101. package/lib/hooks/stateSyncManager/hooks/UseStateSync/hook.d.ts +2 -0
  102. package/lib/hooks/stateSyncManager/hooks/UseStateSync/hook.js +40 -0
  103. package/lib/hooks/stateSyncManager/hooks/UseStateSync/utils.d.ts +30 -0
  104. package/lib/hooks/stateSyncManager/hooks/UseStateSync/utils.js +41 -0
  105. package/lib/hooks/stateSyncManager/types.d.ts +26 -0
  106. package/lib/hooks/stateSyncManager/types.js +1 -0
  107. package/lib/hooks/useAuthentication/common/constants.d.ts +4 -0
  108. package/lib/hooks/useAuthentication/common/constants.js +19 -0
  109. package/lib/hooks/useAuthentication/common/entities.d.ts +25 -0
  110. package/lib/hooks/useAuthentication/common/entities.js +11 -0
  111. package/lib/hooks/useAuthentication/common/utils.d.ts +15 -0
  112. package/lib/hooks/useAuthentication/common/utils.js +25 -0
  113. package/lib/hooks/useAuthentication/useAuthentication.d.ts +6 -0
  114. package/lib/hooks/useAuthentication/useAuthentication.js +9 -0
  115. package/lib/hooks/useAuthentication/useAuthenticationComplete.d.ts +6 -0
  116. package/lib/hooks/useAuthentication/useAuthenticationComplete.js +55 -0
  117. package/lib/hooks/useAuthentication/useAuthenticationForm.d.ts +20 -0
  118. package/lib/hooks/useAuthentication/useAuthenticationForm.js +88 -0
  119. package/lib/hooks/useAuthentication/useAuthenticationNIHExpiry.d.ts +18 -0
  120. package/lib/hooks/useAuthentication/useAuthenticationNIHExpiry.js +50 -0
  121. package/lib/hooks/useAuthentication/useAuthenticationStatus.d.ts +20 -0
  122. package/lib/hooks/useAuthentication/useAuthenticationStatus.js +32 -0
  123. package/lib/hooks/useAuthentication/useFetchGoogleProfile.d.ts +21 -0
  124. package/lib/hooks/useAuthentication/useFetchGoogleProfile.js +41 -0
  125. package/lib/hooks/useAuthentication/useFetchTerraNIHProfile.d.ts +18 -0
  126. package/lib/hooks/useAuthentication/useFetchTerraNIHProfile.js +62 -0
  127. package/lib/hooks/useAuthentication/useFetchTerraProfile.d.ts +24 -0
  128. package/lib/hooks/useAuthentication/useFetchTerraProfile.js +62 -0
  129. package/lib/hooks/useAuthentication/useFetchTerraTermsOfService.d.ts +15 -0
  130. package/lib/hooks/useAuthentication/useFetchTerraTermsOfService.js +62 -0
  131. package/lib/hooks/useAuthentication/useTokenClient.d.ts +11 -0
  132. package/lib/hooks/useAuthentication/useTokenClient.js +29 -0
  133. package/lib/hooks/useAuthenticationConfig.d.ts +6 -0
  134. package/lib/hooks/useAuthenticationConfig.js +14 -0
  135. package/lib/hooks/useCategoryConfigs.d.ts +6 -0
  136. package/lib/hooks/useCategoryConfigs.js +17 -0
  137. package/lib/hooks/useEntityListRelatedView.d.ts +15 -0
  138. package/lib/hooks/useEntityListRelatedView.js +62 -0
  139. package/lib/hooks/useExploreMode.d.ts +14 -0
  140. package/lib/hooks/useExploreMode.js +20 -0
  141. package/lib/hooks/useFileManifest/common/buildFileManifestRequestURL.d.ts +15 -0
  142. package/lib/hooks/useFileManifest/common/buildFileManifestRequestURL.js +27 -0
  143. package/lib/hooks/useFileManifest/useFileManifestURL.d.ts +5 -0
  144. package/lib/hooks/useFileManifest/useFileManifestURL.js +11 -0
  145. package/lib/hooks/useFileManifest/useRequestFileManifest.d.ts +9 -0
  146. package/lib/hooks/useFileManifest/useRequestFileManifest.js +37 -0
  147. package/lib/hooks/useLayoutState.d.ts +6 -0
  148. package/lib/hooks/useLayoutState.js +9 -0
  149. package/lib/hooks/useMenu.d.ts +10 -0
  150. package/lib/hooks/useMenu.js +17 -0
  151. package/lib/hooks/useMenuWithPosition.d.ts +14 -0
  152. package/lib/hooks/useMenuWithPosition.js +33 -0
  153. package/lib/hooks/useSessionTimeout.d.ts +11 -0
  154. package/lib/hooks/useSessionTimeout.js +28 -0
  155. package/lib/providers/authentication.d.ts +51 -0
  156. package/lib/providers/authentication.js +110 -0
  157. package/lib/providers/exploreState/actions/stateToUrl/action.d.ts +9 -0
  158. package/lib/providers/exploreState/actions/stateToUrl/action.js +14 -0
  159. package/lib/providers/exploreState/actions/stateToUrl/dispatch.d.ts +7 -0
  160. package/lib/providers/exploreState/actions/{syncStateFromUrl → stateToUrl}/dispatch.js +3 -3
  161. package/lib/providers/exploreState/actions/stateToUrl/types.d.ts +12 -0
  162. package/lib/providers/exploreState/actions/stateToUrl/types.js +5 -0
  163. package/lib/providers/exploreState/actions/urlToState/action.d.ts +9 -0
  164. package/lib/providers/exploreState/actions/urlToState/action.js +38 -0
  165. package/lib/providers/exploreState/actions/urlToState/dispatch.d.ts +7 -0
  166. package/lib/providers/exploreState/actions/urlToState/dispatch.js +12 -0
  167. package/lib/providers/exploreState/actions/urlToState/types.d.ts +9 -0
  168. package/lib/providers/exploreState/actions/urlToState/types.js +1 -0
  169. package/lib/providers/exploreState/actions/urlToState/utils.d.ts +7 -0
  170. package/lib/providers/exploreState/actions/urlToState/utils.js +13 -0
  171. package/lib/providers/{exploreStateSync/hooks/UseMetaCommands/utils.d.ts → exploreState/entities/query/buildQuery.d.ts} +10 -14
  172. package/lib/providers/{exploreStateSync/hooks/UseMetaCommands/utils.js → exploreState/entities/query/buildQuery.js} +13 -21
  173. package/lib/providers/exploreState/entities/state.d.ts +10 -0
  174. package/lib/providers/exploreState/entities/state.js +36 -0
  175. package/lib/providers/exploreState/entities/types.d.ts +16 -0
  176. package/lib/providers/exploreState/entities/types.js +1 -0
  177. package/lib/providers/exploreState/entities.d.ts +1 -1
  178. package/lib/providers/exploreState/initializer/constants.js +1 -0
  179. package/lib/providers/exploreState/initializer/utils.js +26 -1
  180. package/lib/providers/exploreState.d.ts +8 -4
  181. package/lib/providers/exploreState.js +20 -15
  182. package/lib/providers/layoutState.d.ts +40 -0
  183. package/lib/providers/layoutState.js +47 -0
  184. package/lib/providers/services/provider.d.ts +14 -0
  185. package/lib/providers/services/provider.js +18 -0
  186. package/lib/providers/services/wasPop/context.d.ts +2 -0
  187. package/lib/providers/services/wasPop/context.js +5 -0
  188. package/lib/providers/services/wasPop/hook.d.ts +2 -0
  189. package/lib/providers/services/wasPop/hook.js +5 -0
  190. package/lib/providers/services/wasPop/provider.d.ts +16 -0
  191. package/lib/providers/services/wasPop/provider.js +30 -0
  192. package/lib/providers/services/wasPop/types.d.ts +6 -0
  193. package/lib/providers/services/wasPop/types.js +1 -0
  194. package/lib/services/beforePopState/popStateBus.d.ts +20 -0
  195. package/lib/services/beforePopState/popStateBus.js +58 -0
  196. package/lib/services/beforePopState/types.d.ts +11 -0
  197. package/lib/services/beforePopState/types.js +1 -0
  198. package/lib/services/beforePopState/useOnPopState.d.ts +2 -0
  199. package/lib/services/beforePopState/useOnPopState.js +10 -0
  200. package/lib/services/beforePopState/usePopStateBus.d.ts +6 -0
  201. package/lib/services/beforePopState/usePopStateBus.js +12 -0
  202. package/lib/styles/common/mixins/shadows.d.ts +3 -0
  203. package/lib/styles/common/mixins/shadows.js +4 -0
  204. package/lib/styles/common/mui/palette.d.ts +47 -0
  205. package/lib/styles/common/mui/palette.js +47 -0
  206. package/lib/theme/common/entities.d.ts +6 -0
  207. package/lib/theme/common/entities.js +1 -0
  208. package/lib/views/ExploreView/exploreView.js +15 -2
  209. package/lib/views/ExploreView/utils.d.ts +14 -0
  210. package/lib/views/ExploreView/utils.js +17 -0
  211. package/package.json +1 -1
  212. package/src/hooks/stateSyncManager/hook.ts +47 -0
  213. package/src/hooks/stateSyncManager/hooks/UseBeforePopState/hook.ts +30 -0
  214. package/src/hooks/stateSyncManager/hooks/UseMetaCommands/hook.ts +30 -0
  215. package/src/hooks/stateSyncManager/hooks/UseMetaCommands/types.ts +4 -0
  216. package/src/hooks/stateSyncManager/hooks/UseStateSync/hook.ts +52 -0
  217. package/src/hooks/stateSyncManager/hooks/UseStateSync/utils.ts +58 -0
  218. package/src/hooks/stateSyncManager/types.ts +34 -0
  219. package/src/providers/exploreState/actions/stateToUrl/action.ts +20 -0
  220. package/src/providers/exploreState/actions/stateToUrl/dispatch.ts +14 -0
  221. package/src/providers/exploreState/actions/stateToUrl/types.ts +15 -0
  222. package/src/providers/exploreState/actions/urlToState/action.ts +74 -0
  223. package/src/providers/exploreState/actions/urlToState/dispatch.ts +14 -0
  224. package/src/providers/exploreState/actions/urlToState/types.ts +11 -0
  225. package/src/providers/exploreState/actions/urlToState/utils.ts +18 -0
  226. package/src/providers/{exploreStateSync/hooks/UseMetaCommands/utils.ts → exploreState/entities/query/buildQuery.ts} +23 -26
  227. package/src/providers/exploreState/entities/state.ts +50 -0
  228. package/src/providers/exploreState/entities/types.ts +19 -0
  229. package/src/providers/exploreState/entities.ts +1 -1
  230. package/src/providers/exploreState/initializer/constants.ts +1 -0
  231. package/src/providers/exploreState/initializer/utils.ts +30 -1
  232. package/src/providers/exploreState.tsx +27 -20
  233. package/src/providers/services/provider.tsx +25 -0
  234. package/src/providers/services/wasPop/context.ts +7 -0
  235. package/src/providers/services/wasPop/hook.ts +7 -0
  236. package/src/providers/services/wasPop/provider.tsx +45 -0
  237. package/src/providers/services/wasPop/types.ts +7 -0
  238. package/src/services/beforePopState/popStateBus.ts +64 -0
  239. package/src/services/beforePopState/types.ts +15 -0
  240. package/src/services/beforePopState/useOnPopState.ts +15 -0
  241. package/src/services/beforePopState/usePopStateBus.ts +14 -0
  242. package/src/views/ExploreView/exploreView.tsx +17 -3
  243. package/src/views/ExploreView/utils.ts +25 -0
  244. package/lib/providers/exploreState/actions/syncStateFromUrl/action.d.ts +0 -10
  245. package/lib/providers/exploreState/actions/syncStateFromUrl/action.js +0 -25
  246. package/lib/providers/exploreState/actions/syncStateFromUrl/dispatch.d.ts +0 -7
  247. package/lib/providers/exploreState/actions/syncStateFromUrl/types.d.ts +0 -8
  248. package/lib/providers/exploreState/actions/syncStateFromUrl/utils.d.ts +0 -9
  249. package/lib/providers/exploreState/actions/syncStateFromUrl/utils.js +0 -23
  250. package/lib/providers/exploreState/hooks/UseBeforePopState/useBeforePopState.d.ts +0 -18
  251. package/lib/providers/exploreState/hooks/UseBeforePopState/useBeforePopState.js +0 -41
  252. package/lib/providers/exploreState/hooks/UseBeforePopState/utils.d.ts +0 -23
  253. package/lib/providers/exploreState/hooks/UseBeforePopState/utils.js +0 -68
  254. package/lib/providers/exploreStateSync/hooks/UseMetaCommands/handlers.d.ts +0 -10
  255. package/lib/providers/exploreStateSync/hooks/UseMetaCommands/handlers.js +0 -18
  256. package/lib/providers/exploreStateSync/hooks/UseMetaCommands/hook.d.ts +0 -1
  257. package/lib/providers/exploreStateSync/hooks/UseMetaCommands/hook.js +0 -33
  258. package/lib/providers/exploreStateSync/hooks/UseMetaCommands/types.d.ts +0 -11
  259. package/lib/providers/exploreStateSync/provider.d.ts +0 -19
  260. package/lib/providers/exploreStateSync/provider.js +0 -22
  261. package/src/providers/exploreState/actions/syncStateFromUrl/action.ts +0 -44
  262. package/src/providers/exploreState/actions/syncStateFromUrl/dispatch.ts +0 -16
  263. package/src/providers/exploreState/actions/syncStateFromUrl/types.ts +0 -13
  264. package/src/providers/exploreState/actions/syncStateFromUrl/utils.ts +0 -31
  265. package/src/providers/exploreState/hooks/UseBeforePopState/useBeforePopState.ts +0 -46
  266. package/src/providers/exploreState/hooks/UseBeforePopState/utils.ts +0 -93
  267. package/src/providers/exploreStateSync/hooks/UseMetaCommands/handlers.ts +0 -25
  268. package/src/providers/exploreStateSync/hooks/UseMetaCommands/hook.ts +0 -38
  269. package/src/providers/exploreStateSync/hooks/UseMetaCommands/types.ts +0 -13
  270. package/src/providers/exploreStateSync/provider.tsx +0 -29
  271. /package/lib/{providers/exploreState/actions/syncStateFromUrl → components/DataDictionary/components/Table/columns}/types.js +0 -0
  272. /package/lib/{providers/exploreStateSync → hooks/stateSyncManager}/hooks/UseMetaCommands/types.js +0 -0
@@ -0,0 +1,12 @@
1
+ import { ExploreActionKind } from "../../../exploreState";
2
+ /**
3
+ * Action creator for URL >> state sync.
4
+ * @param payload - Payload.
5
+ * @returns Action with payload and action type.
6
+ */
7
+ export function urlToState(payload) {
8
+ return {
9
+ payload,
10
+ type: ExploreActionKind.UrlToState,
11
+ };
12
+ }
@@ -0,0 +1,9 @@
1
+ import { NextRouter } from "next/router";
2
+ import { ExploreActionKind } from "../../../exploreState";
3
+ export type UrlToStateAction = {
4
+ payload: UrlToStatePayload;
5
+ type: ExploreActionKind.UrlToState;
6
+ };
7
+ export type UrlToStatePayload = {
8
+ query: NextRouter["query"];
9
+ };
@@ -0,0 +1,7 @@
1
+ import { SelectedFilter } from "../../../../common/entities";
2
+ /**
3
+ * Returns the selected filters from the filter parameter value.
4
+ * @param paramValue - The filter parameter value.
5
+ * @returns The selected filters or an empty array.
6
+ */
7
+ export declare function decodeFilterParamValue(paramValue: string | string[] | undefined): SelectedFilter[];
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Returns the selected filters from the filter parameter value.
3
+ * @param paramValue - The filter parameter value.
4
+ * @returns The selected filters or an empty array.
5
+ */
6
+ export function decodeFilterParamValue(paramValue) {
7
+ if (typeof paramValue === "string") {
8
+ // Return decoded filter param value if it is a string.
9
+ return JSON.parse(decodeURIComponent(paramValue));
10
+ }
11
+ // Default to an empty array.
12
+ return [];
13
+ }
@@ -1,14 +1,15 @@
1
1
  import { NextRouter } from "next/router";
2
- import { ExploreState } from "../../../exploreState";
3
- import { ExploreQueryState } from "./types";
2
+ import { SelectedFilter } from "../../../../common/entities";
3
+ import { EntityState } from "../types";
4
4
  /**
5
- * Builds a query object from state.
5
+ * Builds a query object from entity related state.
6
6
  * State values are expected to be undefined, string, or an array.
7
7
  * Undefined values and empty arrays are not included in the query.
8
- * @param state - State -- partial explore state.
8
+ * @param entityListType - Entity list type.
9
+ * @param state - Entity related state.
9
10
  * @returns A query object.
10
11
  */
11
- export declare function buildQuery(state: ExploreQueryState): NextRouter["query"];
12
+ export declare function buildQuery(entityListType: string, state: EntityState): NextRouter["query"];
12
13
  /**
13
14
  * Extracts URL-relevant values from the ExploreState for query parameter synchronization.
14
15
  *
@@ -18,17 +19,12 @@ export declare function buildQuery(state: ExploreQueryState): NextRouter["query"
18
19
  *
19
20
  * The extracted properties are:
20
21
  * - catalog: Current catalog selection (string | undefined)
21
- * - entityListType: Current active tab value (string)
22
+ * - entityListType: Entity list type (string)
22
23
  * - ff: Feature flag state (string | undefined)
23
24
  * - filter: Applied filters (SelectedFilter[])
24
25
  *
25
- * @param exploreState - Explore state.
26
+ * @param entityListType - Entity list type.
27
+ * @param state - Entity related state.
26
28
  * @returns Subset of state used for URL query parameters.
27
29
  */
28
- export declare function getQueryState(exploreState: ExploreState): ExploreQueryState;
29
- /**
30
- * Returns a sorted string representation of a query object.
31
- * @param query - Query object.
32
- * @returns Sorted string representation of the query object.
33
- */
34
- export declare function stringifyQuery(query: NextRouter["query"]): string;
30
+ export declare function getQueryState(entityListType: string, state: EntityState): Record<string, string | SelectedFilter[] | undefined>;
@@ -1,13 +1,14 @@
1
1
  /**
2
- * Builds a query object from state.
2
+ * Builds a query object from entity related state.
3
3
  * State values are expected to be undefined, string, or an array.
4
4
  * Undefined values and empty arrays are not included in the query.
5
- * @param state - State -- partial explore state.
5
+ * @param entityListType - Entity list type.
6
+ * @param state - Entity related state.
6
7
  * @returns A query object.
7
8
  */
8
- export function buildQuery(state) {
9
+ export function buildQuery(entityListType, state) {
9
10
  const query = {};
10
- for (const [key, value] of Object.entries(state)) {
11
+ for (const [key, value] of Object.entries(getQueryState(entityListType, state))) {
11
12
  // Handle the undefined case.
12
13
  if (value === undefined)
13
14
  continue;
@@ -32,28 +33,19 @@ export function buildQuery(state) {
32
33
  *
33
34
  * The extracted properties are:
34
35
  * - catalog: Current catalog selection (string | undefined)
35
- * - entityListType: Current active tab value (string)
36
+ * - entityListType: Entity list type (string)
36
37
  * - ff: Feature flag state (string | undefined)
37
38
  * - filter: Applied filters (SelectedFilter[])
38
39
  *
39
- * @param exploreState - Explore state.
40
+ * @param entityListType - Entity list type.
41
+ * @param state - Entity related state.
40
42
  * @returns Subset of state used for URL query parameters.
41
43
  */
42
- export function getQueryState(exploreState) {
44
+ export function getQueryState(entityListType, state) {
43
45
  return {
44
- catalog: exploreState.catalogState,
45
- entityListType: exploreState.tabValue,
46
- ff: exploreState.featureFlagState,
47
- filter: exploreState.filterState,
46
+ catalog: state.catalogState,
47
+ entityListType,
48
+ ff: state.featureFlagState,
49
+ filter: state.filterState,
48
50
  };
49
51
  }
50
- /**
51
- * Returns a sorted string representation of a query object.
52
- * @param query - Query object.
53
- * @returns Sorted string representation of the query object.
54
- */
55
- export function stringifyQuery(query) {
56
- return JSON.stringify(Object.keys(query)
57
- .sort()
58
- .reduce((acc, key) => ({ ...acc, [key]: query[key] }), {}));
59
- }
@@ -0,0 +1,10 @@
1
+ import { ExploreState } from "../../exploreState";
2
+ import { EntitiesContext, EntityState } from "./types";
3
+ /**
4
+ * Builds the next entities context.
5
+ * @param state - State.
6
+ * @param entityListType - Entity list type.
7
+ * @param nextEntityState - Next entity state.
8
+ * @returns Next entities context.
9
+ */
10
+ export declare function buildNextEntities(state: ExploreState, entityListType: string, nextEntityState: Pick<EntityState, "filterState">): EntitiesContext;
@@ -0,0 +1,36 @@
1
+ import { buildQuery } from "./query/buildQuery";
2
+ /**
3
+ * Builds the next entities context.
4
+ * @param state - State.
5
+ * @param entityListType - Entity list type.
6
+ * @param nextEntityState - Next entity state.
7
+ * @returns Next entities context.
8
+ */
9
+ export function buildNextEntities(state, entityListType, nextEntityState) {
10
+ // Get the entity key for the current entity.
11
+ // Other entities may share the same key and therefore filter state.
12
+ const key = state.entities[entityListType].entityKey;
13
+ const entities = {};
14
+ for (const [entityPath, entity] of Object.entries(state.entities)) {
15
+ // Grab the entity key for the entity.
16
+ const entityKey = entity.entityKey;
17
+ if (entityKey !== key) {
18
+ // For entities that do not share the same key, leave the context unchanged.
19
+ entities[entityPath] = entity;
20
+ continue;
21
+ }
22
+ // Clone the entity context.
23
+ const entityContext = { ...entity };
24
+ // Update entity context with "shared" context (e.g. filterState).
25
+ entityContext.query = buildQuery(entityPath, {
26
+ ...nextEntityState,
27
+ catalogState: state.catalogState,
28
+ featureFlagState: state.featureFlagState,
29
+ });
30
+ // At some point, we may need to update the entity context with additional properties that
31
+ // are not "shared" (e.g. column grouping).
32
+ // For now, this is not needed and so we update entities with the updated entity context and continue.
33
+ entities[entityPath] = entityContext;
34
+ }
35
+ return entities;
36
+ }
@@ -0,0 +1,16 @@
1
+ import { NextRouter } from "next/router";
2
+ import { SelectedFilter } from "../../../common/entities";
3
+ import { EntityPath } from "../../../config/entities";
4
+ import { CatalogState, FeatureFlagState } from "../../exploreState";
5
+ export interface EntitiesContext {
6
+ [key: EntityPath]: EntityContext;
7
+ }
8
+ export interface EntityContext {
9
+ entityKey: string;
10
+ query: NextRouter["query"];
11
+ }
12
+ export interface EntityState {
13
+ catalogState: CatalogState;
14
+ featureFlagState: FeatureFlagState;
15
+ filterState: SelectedFilter[];
16
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -4,7 +4,7 @@ import { CategoryView } from "../../common/categories/views/types";
4
4
  import { CategoryValueKey, SelectCategory, SelectedFilter } from "../../common/entities";
5
5
  import { RowPreviewState } from "../../components/Table/features/RowPreview/entities";
6
6
  import { CategoryGroup, CategoryGroupConfig, EntityPath, SavedFilter } from "../../config/entities";
7
- import { META_COMMAND } from "../exploreStateSync/hooks/UseMetaCommands/types";
7
+ import { META_COMMAND } from "../../hooks/stateSyncManager/hooks/UseMetaCommands/types";
8
8
  export interface EntityPageState {
9
9
  categoryGroupConfigKey: CategoryGroupConfigKey;
10
10
  columnVisibility: VisibilityState;
@@ -22,6 +22,7 @@ export const DEFAULT_PAGINATION_STATE = {
22
22
  export const INITIAL_STATE = {
23
23
  catalogState: undefined,
24
24
  categoryViews: [],
25
+ entities: {},
25
26
  entityPageState: {},
26
27
  entityStateByCategoryGroupConfigKey: new Map(),
27
28
  featureFlagState: undefined,
@@ -1,5 +1,6 @@
1
1
  import { getInitialColumnVisibilityState } from "../../../components/TableCreator/options/initialState/columnVisibility";
2
2
  import { SELECT_CATEGORY_KEY } from "../constants";
3
+ import { buildNextEntities } from "../entities/state";
3
4
  import { getEntityCategoryGroupConfigKey, getFilterCount } from "../utils";
4
5
  import { DEFAULT_CATEGORY_GROUP_SAVED_FILTERS, DEFAULT_ENTITY_STATE, INITIAL_STATE, } from "./constants";
5
6
  /**
@@ -130,6 +131,22 @@ function initEntityPageState(config) {
130
131
  };
131
132
  }, {});
132
133
  }
134
+ /**
135
+ * Initializes entities context.
136
+ * @param entityPageState - Entity page state.
137
+ * @returns Entities context.
138
+ */
139
+ function initEntities(entityPageState) {
140
+ return Object.keys(entityPageState).reduce((acc, entityPath) => {
141
+ return {
142
+ ...acc,
143
+ [entityPath]: {
144
+ entityKey: entityPageState[entityPath].categoryGroupConfigKey,
145
+ query: { entityListType: entityPath },
146
+ },
147
+ };
148
+ }, {});
149
+ }
133
150
  /**
134
151
  * Initializes entity state by category group config key.
135
152
  * @param config - Site config.
@@ -209,10 +226,13 @@ export function initReducerArguments(config, entityListType, decodedFilterParam,
209
226
  const categoryGroupConfigKey = getEntityCategoryGroupConfigKey(entityListType, entityPageState);
210
227
  const entityStateByCategoryGroupConfigKey = initEntityStateByCategoryGroupConfigKey(config, categoryGroupConfigKey, filterState);
211
228
  const categoryGroups = initCategoryGroups(entityStateByCategoryGroupConfigKey, categoryGroupConfigKey);
212
- return {
229
+ const entities = initEntities(entityPageState);
230
+ // Initialize state.
231
+ const state = {
213
232
  ...INITIAL_STATE,
214
233
  catalogState: decodedCatalogParam,
215
234
  categoryGroups,
235
+ entities,
216
236
  entityPageState,
217
237
  entityStateByCategoryGroupConfigKey,
218
238
  featureFlagState: decodedFeatureFlagParam,
@@ -220,4 +240,9 @@ export function initReducerArguments(config, entityListType, decodedFilterParam,
220
240
  filterState,
221
241
  tabValue: entityListType,
222
242
  };
243
+ // Return state with entities (updated by initial state).
244
+ return {
245
+ ...state,
246
+ entities: buildNextEntities(state, entityListType, { filterState }),
247
+ };
223
248
  }
@@ -5,10 +5,12 @@ import { SelectedFilter } from "../common/entities";
5
5
  import { RowPreviewState } from "../components/Table/features/RowPreview/entities";
6
6
  import { CategoryGroup, SiteConfig } from "../config/entities";
7
7
  import { ClearMetaAction } from "./exploreState/actions/clearMeta/types";
8
- import { SyncStateFromUrlAction } from "./exploreState/actions/syncStateFromUrl/types";
8
+ import { StateToUrlAction } from "./exploreState/actions/stateToUrl/types";
9
9
  import { UpdateGroupingAction } from "./exploreState/actions/updateGrouping/types";
10
10
  import { UpdateColumnVisibilityAction } from "./exploreState/actions/updateVisibility/types";
11
+ import { UrlToStateAction } from "./exploreState/actions/urlToState/types";
11
12
  import { EntityPageStateMapper, EntityStateByCategoryGroupConfigKey, ListItem, Meta } from "./exploreState/entities";
13
+ import { EntitiesContext } from "./exploreState/entities/types";
12
14
  import { ApplySavedFilterPayload, PaginateTablePayload, PatchExploreResponsePayload, ProcessExploreResponsePayload, ResetExploreResponsePayload, UpdateEntityFiltersPayload, UpdateEntityViewAccessPayload, UpdateFilterPayload, UpdateRowPreviewPayload, UpdateRowSelectionPayload, UpdateSortingPayload } from "./exploreState/payloads/entities";
13
15
  export type CatalogState = string | undefined;
14
16
  /**
@@ -25,6 +27,7 @@ export type ExploreState = {
25
27
  catalogState: CatalogState;
26
28
  categoryGroups?: CategoryGroup[];
27
29
  categoryViews: CategoryView[];
30
+ entities: EntitiesContext;
28
31
  entityPageState: EntityPageStateMapper;
29
32
  entityStateByCategoryGroupConfigKey: EntityStateByCategoryGroupConfigKey;
30
33
  featureFlagState: FeatureFlagState;
@@ -106,7 +109,7 @@ export declare enum ExploreActionKind {
106
109
  ResetExploreResponse = "RESET_EXPLORE_RESPONSE",
107
110
  ResetState = "RESET_STATE",
108
111
  SelectEntityType = "SELECT_ENTITY_TYPE",
109
- SyncStateFromUrl = "SYNC_STATE_FROM_URL",
112
+ StateToUrl = "STATE_TO_URL",
110
113
  UpdateColumnVisibility = "UPDATE_COLUMN_VISIBILITY",
111
114
  UpdateEntityFilters = "UPDATE_ENTITY_FILTERS",
112
115
  UpdateEntityViewAccess = "UPDATE_ENTITY_VIEW_ACCESS",
@@ -114,12 +117,13 @@ export declare enum ExploreActionKind {
114
117
  UpdateGrouping = "UPDATE_GROUPING",
115
118
  UpdateRowPreview = "UPDATE_ROW_PREVIEW",
116
119
  UpdateRowSelection = "UPDATE_ROW_SELECTION",
117
- UpdateSorting = "UPDATE_SORTING"
120
+ UpdateSorting = "UPDATE_SORTING",
121
+ UrlToState = "URL_TO_STATE"
118
122
  }
119
123
  /**
120
124
  * Explore action.
121
125
  */
122
- export type ExploreAction = ApplySavedFilterAction | ClearFiltersAction | ClearMetaAction | PaginateTableAction | PatchExploreResponseAction | ProcessExploreResponseAction | ResetExploreResponseAction | ResetStateAction | SelectEntityTypeAction | SyncStateFromUrlAction | UpdateColumnVisibilityAction | UpdateEntityFiltersAction | UpdateEntityViewAccessAction | UpdateFilterAction | UpdateGroupingAction | UpdateRowPreviewAction | UpdateRowSelectionAction | UpdateSortingAction;
126
+ export type ExploreAction = ApplySavedFilterAction | ClearFiltersAction | ClearMetaAction | PaginateTableAction | PatchExploreResponseAction | ProcessExploreResponseAction | ResetExploreResponseAction | ResetStateAction | SelectEntityTypeAction | StateToUrlAction | UpdateColumnVisibilityAction | UpdateEntityFiltersAction | UpdateEntityViewAccessAction | UpdateFilterAction | UpdateGroupingAction | UpdateRowPreviewAction | UpdateRowSelectionAction | UpdateSortingAction | UrlToStateAction;
123
127
  /**
124
128
  * Apply saved filter action.
125
129
  */
@@ -1,17 +1,18 @@
1
1
  import React, { createContext, useEffect, useMemo, useReducer, useState, } from "react";
2
2
  import { useToken } from "../hooks/authentication/token/useToken";
3
+ import { META_COMMAND } from "../hooks/stateSyncManager/hooks/UseMetaCommands/types";
3
4
  import { buildCategoryViews, buildNextFilterState, } from "../hooks/useCategoryFilter";
4
5
  import { useConfig } from "../hooks/useConfig";
5
6
  import { useURLFilterParams } from "../hooks/useURLFilterParams";
6
7
  import { clearMetaAction } from "./exploreState/actions/clearMeta/action";
7
- import { syncStateFromUrlAction } from "./exploreState/actions/syncStateFromUrl/action";
8
+ import { stateToUrlAction } from "./exploreState/actions/stateToUrl/action";
8
9
  import { updateGroupingAction } from "./exploreState/actions/updateGrouping/action";
9
10
  import { updateColumnVisibilityAction } from "./exploreState/actions/updateVisibility/action";
10
- import { useBeforePopState } from "./exploreState/hooks/UseBeforePopState/useBeforePopState";
11
+ import { urlToStateAction } from "./exploreState/actions/urlToState/action";
12
+ import { buildNextEntities } from "./exploreState/entities/state";
11
13
  import { DEFAULT_PAGINATION_STATE, INITIAL_STATE, } from "./exploreState/initializer/constants";
12
14
  import { initReducerArguments } from "./exploreState/initializer/utils";
13
15
  import { buildEntityStateSavedFilterState, buildNextSavedFilterState, closeRowPreview, getEntityCategoryGroupConfigKey, getEntityState, getEntityStateSavedProperty, getFilterCount, patchEntityListItems, resetPage, updateEntityPageState, updateEntityPageStateWithCommonCategoryGroupConfigKey, updateEntityStateByCategoryGroupConfigKey, updateSelectColumnVisibility, } from "./exploreState/utils";
14
- import { META_COMMAND } from "./exploreStateSync/hooks/UseMetaCommands/types";
15
16
  /**
16
17
  * Explore state context for storing and using filter-related and explore state.
17
18
  */
@@ -55,8 +56,6 @@ export function ExploreStateProvider({ children, entityListType, }) {
55
56
  type: ExploreActionKind.ResetExploreResponse,
56
57
  });
57
58
  }, [exploreDispatch, token]);
58
- // Before pop state related side effects (forward / backward navigation by browser buttons).
59
- useBeforePopState({ exploreDispatch, exploreState });
60
59
  return (React.createElement(ExploreStateContext.Provider, { value: exploreContextValue }, children));
61
60
  }
62
61
  /**
@@ -73,7 +72,7 @@ export var ExploreActionKind;
73
72
  ExploreActionKind["ResetExploreResponse"] = "RESET_EXPLORE_RESPONSE";
74
73
  ExploreActionKind["ResetState"] = "RESET_STATE";
75
74
  ExploreActionKind["SelectEntityType"] = "SELECT_ENTITY_TYPE";
76
- ExploreActionKind["SyncStateFromUrl"] = "SYNC_STATE_FROM_URL";
75
+ ExploreActionKind["StateToUrl"] = "STATE_TO_URL";
77
76
  ExploreActionKind["UpdateColumnVisibility"] = "UPDATE_COLUMN_VISIBILITY";
78
77
  ExploreActionKind["UpdateEntityFilters"] = "UPDATE_ENTITY_FILTERS";
79
78
  ExploreActionKind["UpdateEntityViewAccess"] = "UPDATE_ENTITY_VIEW_ACCESS";
@@ -82,6 +81,7 @@ export var ExploreActionKind;
82
81
  ExploreActionKind["UpdateRowPreview"] = "UPDATE_ROW_PREVIEW";
83
82
  ExploreActionKind["UpdateRowSelection"] = "UPDATE_ROW_SELECTION";
84
83
  ExploreActionKind["UpdateSorting"] = "UPDATE_SORTING";
84
+ ExploreActionKind["UrlToState"] = "URL_TO_STATE";
85
85
  })(ExploreActionKind || (ExploreActionKind = {}));
86
86
  /**
87
87
  * Explore reducer.
@@ -112,6 +112,7 @@ function exploreReducer(state, action, exploreContext) {
112
112
  });
113
113
  return {
114
114
  ...state,
115
+ entities: buildNextEntities(state, state.tabValue, { filterState }),
115
116
  entityPageState: updateEntityPageStateWithCommonCategoryGroupConfigKey(state, { grouping, rowPreview, rowSelection, sorting }),
116
117
  filterCount: getFilterCount(filterState),
117
118
  filterState,
@@ -135,6 +136,7 @@ function exploreReducer(state, action, exploreContext) {
135
136
  });
136
137
  return {
137
138
  ...state,
139
+ entities: buildNextEntities(state, state.tabValue, { filterState }),
138
140
  entityPageState: updateEntityPageStateWithCommonCategoryGroupConfigKey(state, { rowPreview, rowSelection }),
139
141
  filterCount,
140
142
  filterState,
@@ -230,11 +232,7 @@ function exploreReducer(state, action, exploreContext) {
230
232
  **/
231
233
  case ExploreActionKind.SelectEntityType: {
232
234
  if (payload === state.tabValue) {
233
- // Update meta to match command "STATE_TO_URL_REPLACE" - facilitates navigation to filters on return back to entity from elsewhere.
234
- return {
235
- ...state,
236
- meta: { command: META_COMMAND.STATE_TO_URL_REPLACE },
237
- };
235
+ return state;
238
236
  }
239
237
  const entityState = getEntityState(state, getEntityCategoryGroupConfigKey(payload, state.entityPageState));
240
238
  const rowPreview = closeRowPreview(state.rowPreview); // Close row preview, without updating the entity page state row preview.
@@ -246,17 +244,16 @@ function exploreReducer(state, action, exploreContext) {
246
244
  filterState: entityState.filterState,
247
245
  listItems: [],
248
246
  loading: true,
249
- meta: { command: META_COMMAND.STATE_TO_URL_REPLACE },
250
247
  paginationState: { ...resetPage(state.paginationState), rows: 0 },
251
248
  rowPreview,
252
249
  tabValue: payload,
253
250
  };
254
251
  }
255
252
  /**
256
- * Sync state from URL.
253
+ * State >> URL sync
257
254
  */
258
- case ExploreActionKind.SyncStateFromUrl: {
259
- return syncStateFromUrlAction(state, payload);
255
+ case ExploreActionKind.StateToUrl: {
256
+ return stateToUrlAction(state, payload);
260
257
  }
261
258
  /**
262
259
  * Update column visibility
@@ -287,6 +284,7 @@ function exploreReducer(state, action, exploreContext) {
287
284
  }, categoryGroupConfigKey);
288
285
  return {
289
286
  ...state,
287
+ entities: buildNextEntities(state, entityListType, { filterState }),
290
288
  entityPageState: updateEntityPageStateWithCommonCategoryGroupConfigKey(state, { grouping, rowPreview, rowSelection, sorting }, categoryGroupConfigKey),
291
289
  rowPreview: closeRowPreview(state.rowPreview),
292
290
  ...(payload.entityListType === state.tabValue
@@ -321,6 +319,7 @@ function exploreReducer(state, action, exploreContext) {
321
319
  });
322
320
  return {
323
321
  ...state,
322
+ entities: buildNextEntities(state, state.tabValue, { filterState }),
324
323
  entityPageState: updateEntityPageStateWithCommonCategoryGroupConfigKey(state, { rowPreview, rowSelection }),
325
324
  filterCount: getFilterCount(filterState),
326
325
  filterState,
@@ -369,6 +368,12 @@ function exploreReducer(state, action, exploreContext) {
369
368
  rowPreview,
370
369
  };
371
370
  }
371
+ /**
372
+ * URL >> state sync.
373
+ */
374
+ case ExploreActionKind.UrlToState: {
375
+ return urlToStateAction(state, payload);
376
+ }
372
377
  default:
373
378
  return state;
374
379
  }
@@ -0,0 +1,40 @@
1
+ import React, { Dispatch, ReactNode } from "react";
2
+ export declare const DEFAULT_LAYOUT_STATE: {
3
+ headerHeight: number;
4
+ };
5
+ /**
6
+ * Layout state.
7
+ */
8
+ export type LayoutState = {
9
+ headerHeight: number;
10
+ };
11
+ /**
12
+ * Model of layout state context.
13
+ */
14
+ export type LayoutStateContextProps = {
15
+ layoutDispatch: Dispatch<LayoutAction>;
16
+ layoutState: LayoutState;
17
+ };
18
+ export declare const LayoutStateContext: React.Context<LayoutStateContextProps>;
19
+ export interface LayoutStateProps {
20
+ children: ReactNode | ReactNode[];
21
+ }
22
+ export declare function LayoutStateProvider({ children, }: LayoutStateProps): JSX.Element;
23
+ /**
24
+ * Layout action kind.
25
+ */
26
+ export declare enum LayoutActionKind {
27
+ UpdateHeaderHeight = "UPDATE_HEADER_HEIGHT"
28
+ }
29
+ /**
30
+ * Layout action.
31
+ */
32
+ export type LayoutAction = UpdateHeaderHeightAction;
33
+ /**
34
+ * Update header height action.
35
+ */
36
+ type UpdateHeaderHeightAction = {
37
+ payload?: number;
38
+ type: LayoutActionKind.UpdateHeaderHeight;
39
+ };
40
+ export {};
@@ -0,0 +1,47 @@
1
+ import React, { createContext, useReducer } from "react";
2
+ import { HEADER_HEIGHT } from "../components/Layout/components/Header/common/constants";
3
+ // Default layout state.
4
+ export const DEFAULT_LAYOUT_STATE = {
5
+ headerHeight: HEADER_HEIGHT + 1, // 1px for bottom border.
6
+ };
7
+ export const LayoutStateContext = createContext({
8
+ // eslint-disable-next-line @typescript-eslint/no-empty-function -- allow dummy function for default state.
9
+ layoutDispatch: () => { },
10
+ layoutState: DEFAULT_LAYOUT_STATE,
11
+ });
12
+ export function LayoutStateProvider({ children, }) {
13
+ // Layout state.
14
+ const [layoutState, layoutDispatch] = useReducer((s, a) => layoutReducer(s, a), DEFAULT_LAYOUT_STATE);
15
+ return (React.createElement(LayoutStateContext.Provider, { value: {
16
+ layoutDispatch,
17
+ layoutState,
18
+ } }, children));
19
+ }
20
+ /**
21
+ * Layout action kind.
22
+ */
23
+ export var LayoutActionKind;
24
+ (function (LayoutActionKind) {
25
+ LayoutActionKind["UpdateHeaderHeight"] = "UPDATE_HEADER_HEIGHT";
26
+ })(LayoutActionKind || (LayoutActionKind = {}));
27
+ /**
28
+ * Layout reducer.
29
+ * @param state - Layout state.
30
+ * @param action - Layout action.
31
+ * @returns layout state.
32
+ */
33
+ function layoutReducer(state, action) {
34
+ const { payload, type } = action;
35
+ // eslint-disable-next-line sonarjs/no-small-switch -- allow small switch.
36
+ switch (type) {
37
+ // Updates header height.
38
+ case LayoutActionKind.UpdateHeaderHeight: {
39
+ return {
40
+ ...state,
41
+ headerHeight: payload ?? state.headerHeight,
42
+ };
43
+ }
44
+ default:
45
+ return state;
46
+ }
47
+ }
@@ -0,0 +1,14 @@
1
+ import { ReactNode } from "react";
2
+ /**
3
+ * ServicesProvider is a component that initializes and provides access to various service-related
4
+ * functionality throughout the application.
5
+ *
6
+ * This provider:
7
+ * 1. Registers the pop state bus to handle browser navigation events.
8
+ * 2. Provides the WasPopProvider context to track browser back/forward navigation
9
+ *
10
+ * This provider should be placed at the _app root level to ensure all components have access to these services.
11
+ */
12
+ export declare function ServicesProvider({ children, }: {
13
+ children: ReactNode;
14
+ }): JSX.Element;
@@ -0,0 +1,18 @@
1
+ import React from "react";
2
+ import { usePopStateBus } from "../../services/beforePopState/usePopStateBus";
3
+ import { WasPopProvider } from "./wasPop/provider";
4
+ /**
5
+ * ServicesProvider is a component that initializes and provides access to various service-related
6
+ * functionality throughout the application.
7
+ *
8
+ * This provider:
9
+ * 1. Registers the pop state bus to handle browser navigation events.
10
+ * 2. Provides the WasPopProvider context to track browser back/forward navigation
11
+ *
12
+ * This provider should be placed at the _app root level to ensure all components have access to these services.
13
+ */
14
+ export function ServicesProvider({ children, }) {
15
+ // Register the pop state bus.
16
+ usePopStateBus();
17
+ return React.createElement(WasPopProvider, null, children);
18
+ }
@@ -0,0 +1,2 @@
1
+ import { WasPopContextProps } from "./types";
2
+ export declare const WasPopContext: import("react").Context<WasPopContextProps>;
@@ -0,0 +1,5 @@
1
+ import { createContext } from "react";
2
+ export const WasPopContext = createContext({
3
+ onClearPopRef: () => { },
4
+ popRef: { current: undefined },
5
+ });
@@ -0,0 +1,2 @@
1
+ import { WasPopContextProps } from "./types";
2
+ export declare const useWasPop: () => WasPopContextProps;
@@ -0,0 +1,5 @@
1
+ import { useContext } from "react";
2
+ import { WasPopContext } from "./context";
3
+ export const useWasPop = () => {
4
+ return useContext(WasPopContext);
5
+ };
@@ -0,0 +1,16 @@
1
+ import { ReactNode } from "react";
2
+ /**
3
+ * WasPopProvider tracks browser navigation events to determine if the current route change
4
+ * was triggered by a popstate event (browser back/forward navigation).
5
+ *
6
+ * This provider:
7
+ * 1. Registers callbacks for route change events.
8
+ * 2. Tracks when navigation occurs via browser back/forward buttons
9
+ * 3. Provides this state via context to child components
10
+ *
11
+ * This allows components to respond differently to user-initiated navigation versus
12
+ * browser history navigation.
13
+ */
14
+ export declare function WasPopProvider({ children, }: {
15
+ children: ReactNode;
16
+ }): JSX.Element;