@beinformed/react 1.0.0-beta.0 → 1.0.0-beta.1

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 (100) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/{beforeRenderHooks-Gb0tcmCY.d.ts → beforeRenderHooks-B0CWdI7P.d.ts} +1 -1
  3. package/dist/{beforeRenderHooks-CNvsMmi8.d.cts → beforeRenderHooks-CKR6eECI.d.cts} +1 -1
  4. package/dist/{chunk-HDOILTJ2.js → chunk-3UHZ6GBP.js} +2 -2
  5. package/dist/chunk-3UHZ6GBP.js.map +1 -0
  6. package/dist/{chunk-RKGGCIUD.js → chunk-5MOCT43G.js} +2 -2
  7. package/dist/{chunk-YJNJVQFW.js → chunk-7JMMW2FM.js} +2 -2
  8. package/dist/{chunk-YJNJVQFW.js.map → chunk-7JMMW2FM.js.map} +1 -1
  9. package/dist/{chunk-VG3QU524.js → chunk-7LGDJBGK.js} +3 -3
  10. package/dist/chunk-7LGDJBGK.js.map +1 -0
  11. package/dist/{chunk-X2C7CKOK.js → chunk-A3D5R7MI.js} +2 -2
  12. package/dist/{chunk-X2C7CKOK.js.map → chunk-A3D5R7MI.js.map} +1 -1
  13. package/dist/chunk-ALGSLJJI.js +2 -0
  14. package/dist/chunk-ALGSLJJI.js.map +1 -0
  15. package/dist/{chunk-K3DTH6XN.js → chunk-FBCZEJSD.js} +2 -2
  16. package/dist/chunk-FBCZEJSD.js.map +1 -0
  17. package/dist/{chunk-DI7VM62A.js → chunk-GD4NSZBN.js} +2 -2
  18. package/dist/chunk-GD4NSZBN.js.map +1 -0
  19. package/dist/chunk-GHKA2XFO.js +2 -0
  20. package/dist/chunk-GHKA2XFO.js.map +1 -0
  21. package/dist/chunk-HTR32BUX.js +2 -0
  22. package/dist/{chunk-6KRECIRI.js.map → chunk-HTR32BUX.js.map} +1 -1
  23. package/dist/{chunk-WBPDMDW4.js → chunk-L7DO7AZT.js} +2 -2
  24. package/dist/{chunk-WBPDMDW4.js.map → chunk-L7DO7AZT.js.map} +1 -1
  25. package/dist/chunk-LJM2ADG6.js +2 -0
  26. package/dist/chunk-LJM2ADG6.js.map +1 -0
  27. package/dist/chunk-LUXTQYD2.js +2 -0
  28. package/dist/chunk-LUXTQYD2.js.map +1 -0
  29. package/dist/chunk-LYHN5GC6.js +2 -0
  30. package/dist/chunk-LYHN5GC6.js.map +1 -0
  31. package/dist/{chunk-A4USB53Q.js → chunk-TDYPCNQI.js} +2 -2
  32. package/dist/{chunk-A4USB53Q.js.map → chunk-TDYPCNQI.js.map} +1 -1
  33. package/dist/{chunk-X3N2NQVZ.js → chunk-TRPPQFNA.js} +2 -2
  34. package/dist/{chunk-4AC7YQ5Q.js → chunk-TYEAR2B7.js} +2 -2
  35. package/dist/chunk-X6L6BWD4.js +2 -0
  36. package/dist/chunk-X6L6BWD4.js.map +1 -0
  37. package/dist/{chunk-Z2Y3OPVI.js → chunk-ZNJONDQ6.js} +2 -2
  38. package/dist/chunk-ZNJONDQ6.js.map +1 -0
  39. package/dist/client/index.cjs +5 -5
  40. package/dist/client/index.cjs.map +1 -1
  41. package/dist/client/index.d.cts +3 -3
  42. package/dist/client/index.d.ts +3 -3
  43. package/dist/client/index.js +1 -1
  44. package/dist/hooks/index.cjs +1 -1
  45. package/dist/hooks/index.cjs.map +1 -1
  46. package/dist/hooks/index.d.cts +117 -64
  47. package/dist/hooks/index.d.ts +117 -64
  48. package/dist/hooks/index.js +1 -1
  49. package/dist/i18n/index.cjs +1 -1
  50. package/dist/i18n/index.cjs.map +1 -1
  51. package/dist/i18n/index.d.cts +2 -2
  52. package/dist/i18n/index.d.ts +2 -2
  53. package/dist/i18n/index.js +1 -1
  54. package/dist/index.cjs +6 -6
  55. package/dist/index.cjs.map +1 -1
  56. package/dist/index.d.cts +6 -5
  57. package/dist/index.d.ts +6 -5
  58. package/dist/index.js +1 -1
  59. package/dist/index.js.map +1 -1
  60. package/dist/redux/index.cjs +1 -1
  61. package/dist/redux/index.cjs.map +1 -1
  62. package/dist/redux/index.d.cts +215 -28
  63. package/dist/redux/index.d.ts +215 -28
  64. package/dist/redux/index.js +1 -1
  65. package/dist/server/index.cjs +2 -2
  66. package/dist/server/index.cjs.map +1 -1
  67. package/dist/server/index.d.cts +3 -3
  68. package/dist/server/index.d.ts +3 -3
  69. package/dist/server/index.js +1 -1
  70. package/dist/{styled-components.d-CrkOxzv5.d.cts → styled-components.d-C19eFejP.d.cts} +7 -13
  71. package/dist/{styled-components.d-CrkOxzv5.d.ts → styled-components.d-C19eFejP.d.ts} +7 -13
  72. package/dist/theme/index.cjs +1 -1
  73. package/dist/theme/index.cjs.map +1 -1
  74. package/dist/theme/index.d.cts +1 -1
  75. package/dist/theme/index.d.ts +1 -1
  76. package/dist/theme/index.js +1 -1
  77. package/dist/{useForm-DW-a5mcV.d.ts → useForm-BWwXFuv5.d.cts} +3 -3
  78. package/dist/{useForm-CG_DMYfZ.d.cts → useForm-DqaU9T78.d.ts} +3 -3
  79. package/package.json +15 -15
  80. package/dist/chunk-3OP2KQ56.js +0 -2
  81. package/dist/chunk-3OP2KQ56.js.map +0 -1
  82. package/dist/chunk-6KRECIRI.js +0 -2
  83. package/dist/chunk-B7PQLTVC.js +0 -2
  84. package/dist/chunk-B7PQLTVC.js.map +0 -1
  85. package/dist/chunk-DI7VM62A.js.map +0 -1
  86. package/dist/chunk-HDOILTJ2.js.map +0 -1
  87. package/dist/chunk-K3DTH6XN.js.map +0 -1
  88. package/dist/chunk-UZIZDEU6.js +0 -2
  89. package/dist/chunk-UZIZDEU6.js.map +0 -1
  90. package/dist/chunk-VFLYA5WJ.js +0 -2
  91. package/dist/chunk-VFLYA5WJ.js.map +0 -1
  92. package/dist/chunk-VG3QU524.js.map +0 -1
  93. package/dist/chunk-Y7ESITVO.js +0 -2
  94. package/dist/chunk-Y7ESITVO.js.map +0 -1
  95. package/dist/chunk-YG7XDCNV.js +0 -2
  96. package/dist/chunk-YG7XDCNV.js.map +0 -1
  97. package/dist/chunk-Z2Y3OPVI.js.map +0 -1
  98. /package/dist/{chunk-RKGGCIUD.js.map → chunk-5MOCT43G.js.map} +0 -0
  99. /package/dist/{chunk-X3N2NQVZ.js.map → chunk-TRPPQFNA.js.map} +0 -0
  100. /package/dist/{chunk-4AC7YQ5Q.js.map → chunk-TYEAR2B7.js.map} +0 -0
@@ -1,12 +1,13 @@
1
1
  import * as _beinformed_ui_models from '@beinformed/ui/models';
2
- import { ListModel, DetailModel, TabModel, SourceReferenceCollection, ContentModel, Href, ModelCatalogModel, ConceptIndexModel, ConceptDetailModel, ContentIndexModel, ContentTOCModel, ContentTypeModel, ModularUIModel, ApplicationModel, CaseViewModel, GroupingPanelModel, ListDetailModel, CaseSearchModel, UserProfileModel, ErrorResponse } from '@beinformed/ui/models';
2
+ import { ListModel, DetailModel, TabModel, SourceReferenceCollection, ContentModel, Href, ListDetailModel, FilterCollection, IFilter, AttributeModel, ModelCatalogModel, ConceptIndexModel, ConceptDetailModel, ContentIndexModel, ContentTOCModel, ContentTypeModel, ModularUIModel, ApplicationModel, CaseViewModel, GroupingPanelModel, UserProfileModel, ErrorResponse, CaseSearchModel } from '@beinformed/ui/models';
3
3
  import * as _reduxjs_toolkit from '@reduxjs/toolkit';
4
4
  import { AuthenticationType, ModularUIResponse, ModularUIRequest } from '@beinformed/ui/modularui';
5
- export { U as UpdateFormOptions, b as useAttributeUpdate, u as useForm, a as useFormNavigation, c as useRepeatableAttributeSet } from '../useForm-CG_DMYfZ.cjs';
5
+ import { EffectCallback, DependencyList } from 'react';
6
+ export { U as UpdateFormOptions, b as useAttributeUpdate, u as useForm, a as useFormNavigation, c as useRepeatableAttributeSet } from '../useForm-BWwXFuv5.cjs';
6
7
  import * as lodash from 'lodash';
7
8
  import { MessageParameters, ISO_DATE } from '@beinformed/ui/types';
8
- import { B as ModelEntry, M as MessageObject, S as ShowNotificationArguments, P as PreferencesState, V as RouterLocation, $ as RootState } from '../styled-components.d-CrkOxzv5.cjs';
9
9
  import { ModularUIRequestOptions } from '@beinformed/ui/utils';
10
+ import { B as ModelEntry, M as MessageObject, S as ShowNotificationArguments, P as PreferencesState, T as ProgressIndicatorState, V as RouterLocation, $ as RootState } from '../styled-components.d-C19eFejP.cjs';
10
11
  import 'history';
11
12
  import 'redux';
12
13
  import 'immer';
@@ -25,15 +26,11 @@ declare const useLogin: () => {
25
26
  * Indicates whether the user is currently authenticated.
26
27
  */
27
28
  isAuthenticated: boolean;
29
+ primaryAuthenticationType: {} | undefined;
28
30
  /**
29
31
  * An array of available authentication types supported by the application.
30
- * Defaults to an array containing the `DEFAULT_AUTHENTICATION_TYPE` if no types are available in the application state.
31
32
  */
32
- authenticationTypes: {
33
- name: string;
34
- authentication: string;
35
- isPrimary: boolean;
36
- }[];
33
+ authenticationTypes: AuthenticationType[];
37
34
  /**
38
35
  * The current authentication error message, if any.
39
36
  */
@@ -101,15 +98,11 @@ declare const useLogout: () => {
101
98
  * Indicates whether the user is currently authenticated.
102
99
  */
103
100
  isAuthenticated: boolean;
101
+ primaryAuthenticationType: {} | undefined;
104
102
  /**
105
103
  * An array of available authentication types supported by the application.
106
- * Defaults to an array containing the `DEFAULT_AUTHENTICATION_TYPE` if no types are available in the application state.
107
104
  */
108
- authenticationTypes: {
109
- name: string;
110
- authentication: string;
111
- isPrimary: boolean;
112
- }[];
105
+ authenticationTypes: AuthenticationType[];
113
106
  /**
114
107
  * Initiates the logout process.
115
108
  * If a redirect login was in progress, it redirects the user to the server's logout endpoint with a return URL to the current origin.
@@ -137,6 +130,7 @@ declare const useLogout: () => {
137
130
  arg: void;
138
131
  unwrap: () => Promise<void>;
139
132
  }) | undefined;
133
+ logoutUrl: string;
140
134
  };
141
135
 
142
136
  /**
@@ -144,9 +138,10 @@ declare const useLogout: () => {
144
138
  */
145
139
  declare const useContentFromSourceReferences: (sourceReferences: SourceReferenceCollection, renderChildSections: boolean) => ContentModel[];
146
140
 
147
- type Callback = () => void | (() => void);
148
- type DependencyList = unknown[];
149
- declare function useDeepCompareEffect(callback: Callback, dependencies: DependencyList): void;
141
+ /**
142
+ * A replacement for useEffect that compares dependencies deeply.
143
+ */
144
+ declare function useDeepCompareEffect(callback: EffectCallback, dependencies: DependencyList): void;
150
145
 
151
146
  declare const useMessage: (id: string, defaultMessage?: string, placeholders?: MessageParameters | undefined) => string;
152
147
  declare const useTranslate: () => ((id: string, defaultMessage?: string, placeholders?: MessageParameters | undefined) => string) & lodash.MemoizedFunction;
@@ -156,18 +151,20 @@ declare const useLocale: () => string;
156
151
  */
157
152
  declare const useLocaleCodes: () => string[];
158
153
 
159
- type ModalHook = (modalId: string) => {
160
- key: string | null;
161
- size?: string | null;
162
- visible: boolean;
163
- show: () => void;
164
- close: () => void;
165
- };
166
154
  /**
167
- * Manage modals
155
+ * Configuration options for low-level modular UI requests.
156
+ */
157
+ interface HookOptions {
158
+ key?: string;
159
+ origin?: string;
160
+ contextPath?: string;
161
+ removeOnUnmount?: boolean;
162
+ formdata?: string | undefined | null;
163
+ }
164
+ /**
165
+ * Configuration options for the useModularUIBasic hook.
166
+ * Allows for type enforcement, caching control, and reload behavior.
168
167
  */
169
- declare const useModal: ModalHook;
170
-
171
168
  interface UseModularUIBasicOptions<T> {
172
169
  expectedModels?: string[];
173
170
  targetModel?: new (modularuiResponse: ModularUIResponse) => T;
@@ -175,11 +172,60 @@ interface UseModularUIBasicOptions<T> {
175
172
  origin?: string;
176
173
  contextPath?: string;
177
174
  cache?: boolean;
175
+ key?: string;
176
+ isReload?: boolean;
177
+ removeOnUnmount?: boolean;
178
+ formdata?: string | undefined | null;
178
179
  }
179
180
  /**
180
- * useModularUIBasic Hook
181
+ * A simplified abstraction over useModularUI that includes automatic
182
+ * model validation and smart-reload logic based on router state.
183
+ *
184
+ * @param {string} defaultKey - The default identifier for the model.
185
+ * @param {string | Href} href - The endpoint to fetch.
186
+ * @param {UseModularUIBasicOptions} options - Extended configuration options.
187
+ */
188
+ declare const useModularUIBasic: <T>(defaultKey: string, href: string | Href, options?: UseModularUIBasicOptions<T>) => T | undefined;
189
+ /**
190
+ * Determines if a model should be reloaded based on the 'reload' timestamp
191
+ * found in the React Router location state.
192
+ * This is used for "force refresh" scenarios where a user navigates to a
193
+ * page and expects fresh data (e.g., after a form submission elsewhere).
194
+ * @param {string} modelKey - The model type key.
195
+ * @param {string} url - The resource URL.
196
+ * @returns {boolean} True if the store data is stale compared to the reload signal.
197
+ */
198
+ declare const useReload: (modelKey: string, url: string) => boolean;
199
+
200
+ interface ListNavigationOptions {
201
+ syncLocation?: boolean;
202
+ historyAction?: "push" | "replace";
203
+ }
204
+ declare const useList: (href: string | Href, options?: HookOptions) => ListModel | undefined;
205
+ declare const useListOrDetail: (href: string | Href, options?: HookOptions) => ListModel | DetailModel<_beinformed_ui_models.DetailData, _beinformed_ui_models.DetailPanelContributions> | undefined;
206
+ declare const useListDetail: (href: string | Href, options?: HookOptions) => ListDetailModel | undefined;
207
+ declare const useListNavigation: ({ syncLocation, historyAction, }?: ListNavigationOptions) => {
208
+ update: (list: ListModel, resetPage?: boolean) => void;
209
+ updateFilters: (list: ListModel, filters: FilterCollection | IFilter[]) => void;
210
+ updateFilter: (list: ListModel, filter: IFilter, value: string, attribute?: AttributeModel) => void;
211
+ updateSort: (list: ListModel, sortOption: string) => void;
212
+ updatePage: (list: ListModel, page: number) => void;
213
+ updatePageSize: (list: ListModel, pagesize: number) => void;
214
+ resetFilters: (list: ListModel) => void;
215
+ removeFilter: (list: ListModel, filter: IFilter) => void;
216
+ };
217
+
218
+ type ModalHook = (modalId: string) => {
219
+ key: string | null;
220
+ size?: string | null;
221
+ visible: boolean;
222
+ show: () => void;
223
+ close: () => void;
224
+ };
225
+ /**
226
+ * Manage modals
181
227
  */
182
- declare const useModularUIBasic: <T>(key: string, href: string | Href, options?: UseModularUIBasicOptions<T>) => T | undefined;
228
+ declare const useModal: ModalHook;
183
229
 
184
230
  interface SearchFilter {
185
231
  index?: string;
@@ -221,14 +267,22 @@ type UseModels = () => {
221
267
  declare const useModels: UseModels;
222
268
 
223
269
  /**
224
- * Use redux action and selector to retrieve the correct modular ui service model
270
+ * A custom hook to fetch and manage Be Informed modular UI resources.
271
+ * It handles automatic data fetching based on URL/query changes, manages Redux state
272
+ * synchronization, and provides cleanup logic when components unmount.
273
+ *
274
+ * @param {string} modelKey - A unique identifier for the type of model being fetched.
275
+ * @param {string | Href} url - The endpoint URL or Href instance to fetch data from.
276
+ * @param {RequestModularUIOptions} options - Configuration for the request (method, headers, etc.).
277
+ * @returns {ModelEntry} The model data retrieved from the Redux store.
225
278
  */
226
- declare const useModularUI: (modelKey: string, url: string | Href, options?: ModularUIRequestOptions) => ModelEntry;
279
+ declare const useModularUI: (modelKey: string, url: string | Href, options?: ModularUIRequestOptions) => ModelEntry | undefined;
280
+
281
+ /**
282
+ * Generates the key that is used in the modular ui reducer of redux
283
+ */
284
+ declare const useModularUIKey: (modelKey: string, url: string) => string;
227
285
 
228
- interface HookOptions {
229
- origin?: string;
230
- contextPath?: string;
231
- }
232
286
  /**
233
287
  * Load application
234
288
  */
@@ -241,14 +295,8 @@ declare const useTab: (href: string | Href, options?: HookOptions) => TabModel |
241
295
  * Load caseview by href
242
296
  */
243
297
  declare const useCaseView: (href: string | Href, options?: HookOptions) => CaseViewModel | undefined;
244
- declare const usePanel: (href: string | Href, options?: HookOptions) => ListModel | GroupingPanelModel | DetailModel<_beinformed_ui_models.DetailData, _beinformed_ui_models.DetailPanelContributions> | undefined;
245
- declare const useList: (href: string | Href, options?: HookOptions) => ListModel | undefined;
246
- declare const useListOrDetail: (href: string | Href, options?: HookOptions) => ListModel | DetailModel<_beinformed_ui_models.DetailData, _beinformed_ui_models.DetailPanelContributions> | undefined;
247
- declare const useListDetail: (href: string | Href, options?: HookOptions) => ListDetailModel | undefined;
248
298
  declare const useGroupingPanel: (href: string | Href, options?: HookOptions) => GroupingPanelModel | undefined;
249
299
  declare const useDetailPanel: (href: string | Href, options?: HookOptions) => DetailModel<_beinformed_ui_models.DetailData, _beinformed_ui_models.DetailPanelContributions> | undefined;
250
- declare const useQuicksearch: (href: string | Href, options?: HookOptions) => CaseSearchModel | undefined;
251
- declare const useSearch: (href: string | Href, options?: HookOptions) => CaseSearchModel | undefined;
252
300
  declare const useUserProfile: (href: string | Href, options?: HookOptions) => UserProfileModel | undefined;
253
301
 
254
302
  /**
@@ -289,36 +337,41 @@ declare const useErrorNotification: () => (message: MessageObject, error?: Error
289
337
  unwrap: () => Promise<void>;
290
338
  };
291
339
 
340
+ declare const usePanel: (href?: string | Href, options?: HookOptions & {
341
+ fromRoute?: boolean;
342
+ }) => ListModel | GroupingPanelModel | DetailModel | CaseSearchModel | undefined;
343
+
292
344
  declare const usePreference: (preferenceNames: string | string[]) => Pick<PreferencesState, string>;
293
345
 
294
346
  declare const useProgressIndicator: () => {
295
- start: () => {
296
- payload: undefined;
297
- type: "START_PROGRESS";
298
- };
299
- finish: () => {
300
- payload: undefined;
301
- type: "FINISH_PROGRESS";
302
- };
303
- reset: () => {
304
- payload: undefined;
305
- type: "RESET_PROGRESS";
306
- };
307
- update: (percentComplete: number) => {
308
- payload: {
309
- percentComplete: number;
310
- };
311
- type: "UPDATE_PROGRESS";
312
- };
313
- count: number;
314
- timestamp: number;
315
- percentComplete: number;
347
+ start: () => void;
348
+ finish: () => void;
349
+ reset: () => void;
350
+ update: (percentComplete: number) => void;
316
351
  };
352
+ /**
353
+ */
354
+ declare const useProgressIndicatorState: () => ProgressIndicatorState;
317
355
 
356
+ /**
357
+ * Returns the full location object from the router state.
358
+ */
318
359
  declare const useLocation: () => RouterLocation | undefined;
360
+ /**
361
+ * Returns the unique key of the current location.
362
+ */
319
363
  declare const useLocationKey: () => string;
364
+ /**
365
+ * Returns the current search (querystring) portion of the URL.
366
+ */
320
367
  declare const useQuerystring: () => string | undefined;
368
+ /**
369
+ * Returns the current URL pathname.
370
+ */
321
371
  declare const usePathname: () => string | undefined;
372
+ /**
373
+ * Provides navigation methods.
374
+ */
322
375
  declare const useNavigation: () => {
323
376
  push: (location: RouterLocation | string, state?: RootState) => {
324
377
  payload: {
@@ -350,4 +403,4 @@ declare const useNavigation: () => {
350
403
  };
351
404
  };
352
405
 
353
- export { type SearchFilter, type UseModularUIBasicOptions, useApplication, useCaseView, useCompleteSource, useConceptDetail, useConceptIndex, useConceptSearch, useContent, useContentFromSourceReferences, useContentIndex, useContentSearch, useContentTOC, useContentType, useDeepCompareEffect, useDetailPanel, useEntryDate, useErrorNotification, useGroupingPanel, useList, useListDetail, useListOrDetail, useLocale, useLocaleCodes, useLocation, useLocationKey, useLogin, useLogout, useMessage, useModal, useModelCatalog, useModels, useModularUI, useModularUIBasic, useModularUIRequest, useNavigation, useNotification, usePanel, usePathname, usePreference, useProgressIndicator, useQuerystring, useQuicksearch, useRelatedConcepts, useRetrieveFormsOnModel, useSearch, useTab, useTranslate, useUserProfile };
406
+ export { type HookOptions, type SearchFilter, type UseModularUIBasicOptions, useApplication, useCaseView, useCompleteSource, useConceptDetail, useConceptIndex, useConceptSearch, useContent, useContentFromSourceReferences, useContentIndex, useContentSearch, useContentTOC, useContentType, useDeepCompareEffect, useDetailPanel, useEntryDate, useErrorNotification, useGroupingPanel, useList, useListDetail, useListNavigation, useListOrDetail, useLocale, useLocaleCodes, useLocation, useLocationKey, useLogin, useLogout, useMessage, useModal, useModelCatalog, useModels, useModularUI, useModularUIBasic, useModularUIKey, useModularUIRequest, useNavigation, useNotification, usePanel, usePathname, usePreference, useProgressIndicator, useProgressIndicatorState, useQuerystring, useRelatedConcepts, useReload, useRetrieveFormsOnModel, useTab, useTranslate, useUserProfile };
@@ -1,12 +1,13 @@
1
1
  import * as _beinformed_ui_models from '@beinformed/ui/models';
2
- import { ListModel, DetailModel, TabModel, SourceReferenceCollection, ContentModel, Href, ModelCatalogModel, ConceptIndexModel, ConceptDetailModel, ContentIndexModel, ContentTOCModel, ContentTypeModel, ModularUIModel, ApplicationModel, CaseViewModel, GroupingPanelModel, ListDetailModel, CaseSearchModel, UserProfileModel, ErrorResponse } from '@beinformed/ui/models';
2
+ import { ListModel, DetailModel, TabModel, SourceReferenceCollection, ContentModel, Href, ListDetailModel, FilterCollection, IFilter, AttributeModel, ModelCatalogModel, ConceptIndexModel, ConceptDetailModel, ContentIndexModel, ContentTOCModel, ContentTypeModel, ModularUIModel, ApplicationModel, CaseViewModel, GroupingPanelModel, UserProfileModel, ErrorResponse, CaseSearchModel } from '@beinformed/ui/models';
3
3
  import * as _reduxjs_toolkit from '@reduxjs/toolkit';
4
4
  import { AuthenticationType, ModularUIResponse, ModularUIRequest } from '@beinformed/ui/modularui';
5
- export { U as UpdateFormOptions, b as useAttributeUpdate, u as useForm, a as useFormNavigation, c as useRepeatableAttributeSet } from '../useForm-DW-a5mcV.js';
5
+ import { EffectCallback, DependencyList } from 'react';
6
+ export { U as UpdateFormOptions, b as useAttributeUpdate, u as useForm, a as useFormNavigation, c as useRepeatableAttributeSet } from '../useForm-DqaU9T78.js';
6
7
  import * as lodash from 'lodash';
7
8
  import { MessageParameters, ISO_DATE } from '@beinformed/ui/types';
8
- import { B as ModelEntry, M as MessageObject, S as ShowNotificationArguments, P as PreferencesState, V as RouterLocation, $ as RootState } from '../styled-components.d-CrkOxzv5.js';
9
9
  import { ModularUIRequestOptions } from '@beinformed/ui/utils';
10
+ import { B as ModelEntry, M as MessageObject, S as ShowNotificationArguments, P as PreferencesState, T as ProgressIndicatorState, V as RouterLocation, $ as RootState } from '../styled-components.d-C19eFejP.js';
10
11
  import 'history';
11
12
  import 'redux';
12
13
  import 'immer';
@@ -25,15 +26,11 @@ declare const useLogin: () => {
25
26
  * Indicates whether the user is currently authenticated.
26
27
  */
27
28
  isAuthenticated: boolean;
29
+ primaryAuthenticationType: {} | undefined;
28
30
  /**
29
31
  * An array of available authentication types supported by the application.
30
- * Defaults to an array containing the `DEFAULT_AUTHENTICATION_TYPE` if no types are available in the application state.
31
32
  */
32
- authenticationTypes: {
33
- name: string;
34
- authentication: string;
35
- isPrimary: boolean;
36
- }[];
33
+ authenticationTypes: AuthenticationType[];
37
34
  /**
38
35
  * The current authentication error message, if any.
39
36
  */
@@ -101,15 +98,11 @@ declare const useLogout: () => {
101
98
  * Indicates whether the user is currently authenticated.
102
99
  */
103
100
  isAuthenticated: boolean;
101
+ primaryAuthenticationType: {} | undefined;
104
102
  /**
105
103
  * An array of available authentication types supported by the application.
106
- * Defaults to an array containing the `DEFAULT_AUTHENTICATION_TYPE` if no types are available in the application state.
107
104
  */
108
- authenticationTypes: {
109
- name: string;
110
- authentication: string;
111
- isPrimary: boolean;
112
- }[];
105
+ authenticationTypes: AuthenticationType[];
113
106
  /**
114
107
  * Initiates the logout process.
115
108
  * If a redirect login was in progress, it redirects the user to the server's logout endpoint with a return URL to the current origin.
@@ -137,6 +130,7 @@ declare const useLogout: () => {
137
130
  arg: void;
138
131
  unwrap: () => Promise<void>;
139
132
  }) | undefined;
133
+ logoutUrl: string;
140
134
  };
141
135
 
142
136
  /**
@@ -144,9 +138,10 @@ declare const useLogout: () => {
144
138
  */
145
139
  declare const useContentFromSourceReferences: (sourceReferences: SourceReferenceCollection, renderChildSections: boolean) => ContentModel[];
146
140
 
147
- type Callback = () => void | (() => void);
148
- type DependencyList = unknown[];
149
- declare function useDeepCompareEffect(callback: Callback, dependencies: DependencyList): void;
141
+ /**
142
+ * A replacement for useEffect that compares dependencies deeply.
143
+ */
144
+ declare function useDeepCompareEffect(callback: EffectCallback, dependencies: DependencyList): void;
150
145
 
151
146
  declare const useMessage: (id: string, defaultMessage?: string, placeholders?: MessageParameters | undefined) => string;
152
147
  declare const useTranslate: () => ((id: string, defaultMessage?: string, placeholders?: MessageParameters | undefined) => string) & lodash.MemoizedFunction;
@@ -156,18 +151,20 @@ declare const useLocale: () => string;
156
151
  */
157
152
  declare const useLocaleCodes: () => string[];
158
153
 
159
- type ModalHook = (modalId: string) => {
160
- key: string | null;
161
- size?: string | null;
162
- visible: boolean;
163
- show: () => void;
164
- close: () => void;
165
- };
166
154
  /**
167
- * Manage modals
155
+ * Configuration options for low-level modular UI requests.
156
+ */
157
+ interface HookOptions {
158
+ key?: string;
159
+ origin?: string;
160
+ contextPath?: string;
161
+ removeOnUnmount?: boolean;
162
+ formdata?: string | undefined | null;
163
+ }
164
+ /**
165
+ * Configuration options for the useModularUIBasic hook.
166
+ * Allows for type enforcement, caching control, and reload behavior.
168
167
  */
169
- declare const useModal: ModalHook;
170
-
171
168
  interface UseModularUIBasicOptions<T> {
172
169
  expectedModels?: string[];
173
170
  targetModel?: new (modularuiResponse: ModularUIResponse) => T;
@@ -175,11 +172,60 @@ interface UseModularUIBasicOptions<T> {
175
172
  origin?: string;
176
173
  contextPath?: string;
177
174
  cache?: boolean;
175
+ key?: string;
176
+ isReload?: boolean;
177
+ removeOnUnmount?: boolean;
178
+ formdata?: string | undefined | null;
178
179
  }
179
180
  /**
180
- * useModularUIBasic Hook
181
+ * A simplified abstraction over useModularUI that includes automatic
182
+ * model validation and smart-reload logic based on router state.
183
+ *
184
+ * @param {string} defaultKey - The default identifier for the model.
185
+ * @param {string | Href} href - The endpoint to fetch.
186
+ * @param {UseModularUIBasicOptions} options - Extended configuration options.
187
+ */
188
+ declare const useModularUIBasic: <T>(defaultKey: string, href: string | Href, options?: UseModularUIBasicOptions<T>) => T | undefined;
189
+ /**
190
+ * Determines if a model should be reloaded based on the 'reload' timestamp
191
+ * found in the React Router location state.
192
+ * This is used for "force refresh" scenarios where a user navigates to a
193
+ * page and expects fresh data (e.g., after a form submission elsewhere).
194
+ * @param {string} modelKey - The model type key.
195
+ * @param {string} url - The resource URL.
196
+ * @returns {boolean} True if the store data is stale compared to the reload signal.
197
+ */
198
+ declare const useReload: (modelKey: string, url: string) => boolean;
199
+
200
+ interface ListNavigationOptions {
201
+ syncLocation?: boolean;
202
+ historyAction?: "push" | "replace";
203
+ }
204
+ declare const useList: (href: string | Href, options?: HookOptions) => ListModel | undefined;
205
+ declare const useListOrDetail: (href: string | Href, options?: HookOptions) => ListModel | DetailModel<_beinformed_ui_models.DetailData, _beinformed_ui_models.DetailPanelContributions> | undefined;
206
+ declare const useListDetail: (href: string | Href, options?: HookOptions) => ListDetailModel | undefined;
207
+ declare const useListNavigation: ({ syncLocation, historyAction, }?: ListNavigationOptions) => {
208
+ update: (list: ListModel, resetPage?: boolean) => void;
209
+ updateFilters: (list: ListModel, filters: FilterCollection | IFilter[]) => void;
210
+ updateFilter: (list: ListModel, filter: IFilter, value: string, attribute?: AttributeModel) => void;
211
+ updateSort: (list: ListModel, sortOption: string) => void;
212
+ updatePage: (list: ListModel, page: number) => void;
213
+ updatePageSize: (list: ListModel, pagesize: number) => void;
214
+ resetFilters: (list: ListModel) => void;
215
+ removeFilter: (list: ListModel, filter: IFilter) => void;
216
+ };
217
+
218
+ type ModalHook = (modalId: string) => {
219
+ key: string | null;
220
+ size?: string | null;
221
+ visible: boolean;
222
+ show: () => void;
223
+ close: () => void;
224
+ };
225
+ /**
226
+ * Manage modals
181
227
  */
182
- declare const useModularUIBasic: <T>(key: string, href: string | Href, options?: UseModularUIBasicOptions<T>) => T | undefined;
228
+ declare const useModal: ModalHook;
183
229
 
184
230
  interface SearchFilter {
185
231
  index?: string;
@@ -221,14 +267,22 @@ type UseModels = () => {
221
267
  declare const useModels: UseModels;
222
268
 
223
269
  /**
224
- * Use redux action and selector to retrieve the correct modular ui service model
270
+ * A custom hook to fetch and manage Be Informed modular UI resources.
271
+ * It handles automatic data fetching based on URL/query changes, manages Redux state
272
+ * synchronization, and provides cleanup logic when components unmount.
273
+ *
274
+ * @param {string} modelKey - A unique identifier for the type of model being fetched.
275
+ * @param {string | Href} url - The endpoint URL or Href instance to fetch data from.
276
+ * @param {RequestModularUIOptions} options - Configuration for the request (method, headers, etc.).
277
+ * @returns {ModelEntry} The model data retrieved from the Redux store.
225
278
  */
226
- declare const useModularUI: (modelKey: string, url: string | Href, options?: ModularUIRequestOptions) => ModelEntry;
279
+ declare const useModularUI: (modelKey: string, url: string | Href, options?: ModularUIRequestOptions) => ModelEntry | undefined;
280
+
281
+ /**
282
+ * Generates the key that is used in the modular ui reducer of redux
283
+ */
284
+ declare const useModularUIKey: (modelKey: string, url: string) => string;
227
285
 
228
- interface HookOptions {
229
- origin?: string;
230
- contextPath?: string;
231
- }
232
286
  /**
233
287
  * Load application
234
288
  */
@@ -241,14 +295,8 @@ declare const useTab: (href: string | Href, options?: HookOptions) => TabModel |
241
295
  * Load caseview by href
242
296
  */
243
297
  declare const useCaseView: (href: string | Href, options?: HookOptions) => CaseViewModel | undefined;
244
- declare const usePanel: (href: string | Href, options?: HookOptions) => ListModel | GroupingPanelModel | DetailModel<_beinformed_ui_models.DetailData, _beinformed_ui_models.DetailPanelContributions> | undefined;
245
- declare const useList: (href: string | Href, options?: HookOptions) => ListModel | undefined;
246
- declare const useListOrDetail: (href: string | Href, options?: HookOptions) => ListModel | DetailModel<_beinformed_ui_models.DetailData, _beinformed_ui_models.DetailPanelContributions> | undefined;
247
- declare const useListDetail: (href: string | Href, options?: HookOptions) => ListDetailModel | undefined;
248
298
  declare const useGroupingPanel: (href: string | Href, options?: HookOptions) => GroupingPanelModel | undefined;
249
299
  declare const useDetailPanel: (href: string | Href, options?: HookOptions) => DetailModel<_beinformed_ui_models.DetailData, _beinformed_ui_models.DetailPanelContributions> | undefined;
250
- declare const useQuicksearch: (href: string | Href, options?: HookOptions) => CaseSearchModel | undefined;
251
- declare const useSearch: (href: string | Href, options?: HookOptions) => CaseSearchModel | undefined;
252
300
  declare const useUserProfile: (href: string | Href, options?: HookOptions) => UserProfileModel | undefined;
253
301
 
254
302
  /**
@@ -289,36 +337,41 @@ declare const useErrorNotification: () => (message: MessageObject, error?: Error
289
337
  unwrap: () => Promise<void>;
290
338
  };
291
339
 
340
+ declare const usePanel: (href?: string | Href, options?: HookOptions & {
341
+ fromRoute?: boolean;
342
+ }) => ListModel | GroupingPanelModel | DetailModel | CaseSearchModel | undefined;
343
+
292
344
  declare const usePreference: (preferenceNames: string | string[]) => Pick<PreferencesState, string>;
293
345
 
294
346
  declare const useProgressIndicator: () => {
295
- start: () => {
296
- payload: undefined;
297
- type: "START_PROGRESS";
298
- };
299
- finish: () => {
300
- payload: undefined;
301
- type: "FINISH_PROGRESS";
302
- };
303
- reset: () => {
304
- payload: undefined;
305
- type: "RESET_PROGRESS";
306
- };
307
- update: (percentComplete: number) => {
308
- payload: {
309
- percentComplete: number;
310
- };
311
- type: "UPDATE_PROGRESS";
312
- };
313
- count: number;
314
- timestamp: number;
315
- percentComplete: number;
347
+ start: () => void;
348
+ finish: () => void;
349
+ reset: () => void;
350
+ update: (percentComplete: number) => void;
316
351
  };
352
+ /**
353
+ */
354
+ declare const useProgressIndicatorState: () => ProgressIndicatorState;
317
355
 
356
+ /**
357
+ * Returns the full location object from the router state.
358
+ */
318
359
  declare const useLocation: () => RouterLocation | undefined;
360
+ /**
361
+ * Returns the unique key of the current location.
362
+ */
319
363
  declare const useLocationKey: () => string;
364
+ /**
365
+ * Returns the current search (querystring) portion of the URL.
366
+ */
320
367
  declare const useQuerystring: () => string | undefined;
368
+ /**
369
+ * Returns the current URL pathname.
370
+ */
321
371
  declare const usePathname: () => string | undefined;
372
+ /**
373
+ * Provides navigation methods.
374
+ */
322
375
  declare const useNavigation: () => {
323
376
  push: (location: RouterLocation | string, state?: RootState) => {
324
377
  payload: {
@@ -350,4 +403,4 @@ declare const useNavigation: () => {
350
403
  };
351
404
  };
352
405
 
353
- export { type SearchFilter, type UseModularUIBasicOptions, useApplication, useCaseView, useCompleteSource, useConceptDetail, useConceptIndex, useConceptSearch, useContent, useContentFromSourceReferences, useContentIndex, useContentSearch, useContentTOC, useContentType, useDeepCompareEffect, useDetailPanel, useEntryDate, useErrorNotification, useGroupingPanel, useList, useListDetail, useListOrDetail, useLocale, useLocaleCodes, useLocation, useLocationKey, useLogin, useLogout, useMessage, useModal, useModelCatalog, useModels, useModularUI, useModularUIBasic, useModularUIRequest, useNavigation, useNotification, usePanel, usePathname, usePreference, useProgressIndicator, useQuerystring, useQuicksearch, useRelatedConcepts, useRetrieveFormsOnModel, useSearch, useTab, useTranslate, useUserProfile };
406
+ export { type HookOptions, type SearchFilter, type UseModularUIBasicOptions, useApplication, useCaseView, useCompleteSource, useConceptDetail, useConceptIndex, useConceptSearch, useContent, useContentFromSourceReferences, useContentIndex, useContentSearch, useContentTOC, useContentType, useDeepCompareEffect, useDetailPanel, useEntryDate, useErrorNotification, useGroupingPanel, useList, useListDetail, useListNavigation, useListOrDetail, useLocale, useLocaleCodes, useLocation, useLocationKey, useLogin, useLogout, useMessage, useModal, useModelCatalog, useModels, useModularUI, useModularUIBasic, useModularUIKey, useModularUIRequest, useNavigation, useNotification, usePanel, usePathname, usePreference, useProgressIndicator, useProgressIndicatorState, useQuerystring, useRelatedConcepts, useReload, useRetrieveFormsOnModel, useTab, useTranslate, useUserProfile };
@@ -1,2 +1,2 @@
1
- import{A as E,B as F,C as G,D as H,E as I,F as J,G as K,H as L,I as M,J as N,K as O,L as P,M as Q,N as R,O as S,P as T,Q as U,R as V,S as W,T as X,U as Y,a,b,c,d,e as i,f as j,g as k,h as l,i as m,j as n,k as o,l as p,m as q,n as r,o as s,p as t,q as u,r as v,s as w,t as x,u as y,v as z,w as A,x as B,y as C,z as D}from"../chunk-UZIZDEU6.js";import{a as e,b as f,c as g,d as h}from"../chunk-RKGGCIUD.js";import"../chunk-Z2Y3OPVI.js";import"../chunk-Y7ESITVO.js";import"../chunk-JYAETKRB.js";import"../chunk-YJNJVQFW.js";import"../chunk-A4USB53Q.js";import"../chunk-WBPDMDW4.js";import"../chunk-6KRECIRI.js";import"../chunk-FW4363Y4.js";export{K as useApplication,o as useAttributeUpdate,M as useCaseView,D as useCompleteSource,z as useConceptDetail,y as useConceptIndex,G as useConceptSearch,C as useContent,j as useContentFromSourceReferences,A as useContentIndex,H as useContentSearch,B as useContentTOC,E as useContentType,k as useDeepCompareEffect,S as useDetailPanel,I as useEntryDate,X as useErrorNotification,m as useForm,n as useFormNavigation,R as useGroupingPanel,O as useList,Q as useListDetail,P as useListOrDetail,g as useLocale,h as useLocaleCodes,r as useLocation,s as useLocationKey,c as useLogin,d as useLogout,e as useMessage,q as useModal,x as useModelCatalog,J as useModels,l as useModularUI,w as useModularUIBasic,a as useModularUIRequest,v as useNavigation,W as useNotification,N as usePanel,u as usePathname,Y as usePreference,i as useProgressIndicator,t as useQuerystring,T as useQuicksearch,F as useRelatedConcepts,p as useRepeatableAttributeSet,b as useRetrieveFormsOnModel,U as useSearch,L as useTab,f as useTranslate,V as useUserProfile};
1
+ import{A as E,B as F,C as G,D as H,E as I,F as J,G as K,H as L,I as M,J as N,K as O,L as P,M as Q,N as R,O as S,P as T,Q as U,R as V,S as W,T as X,U as Y,V as Z,W as _,a,b,c,d,e,f,g,h,i as m,j as n,k as o,l as p,m as q,n as r,o as s,p as t,q as u,r as v,s as w,t as x,u as y,v as z,w as A,x as B,y as C,z as D}from"../chunk-LUXTQYD2.js";import{a as i,b as j,c as k,d as l}from"../chunk-5MOCT43G.js";import"../chunk-ZNJONDQ6.js";import"../chunk-GHKA2XFO.js";import"../chunk-JYAETKRB.js";import"../chunk-7JMMW2FM.js";import"../chunk-TDYPCNQI.js";import"../chunk-L7DO7AZT.js";import"../chunk-HTR32BUX.js";import"../chunk-FW4363Y4.js";export{q as useApplication,D as useAttributeUpdate,s as useCaseView,Q as useCompleteSource,M as useConceptDetail,L as useConceptIndex,T as useConceptSearch,P as useContent,A as useContentFromSourceReferences,N as useContentIndex,U as useContentSearch,O as useContentTOC,R as useContentType,h as useDeepCompareEffect,u as useDetailPanel,V as useEntryDate,Y as useErrorNotification,B as useForm,C as useFormNavigation,t as useGroupingPanel,F as useList,H as useListDetail,I as useListNavigation,G as useListOrDetail,k as useLocale,l as useLocaleCodes,c as useLocation,d as useLocationKey,w as useLogin,x as useLogout,i as useMessage,J as useModal,K as useModelCatalog,W as useModels,n as useModularUI,o as useModularUIBasic,m as useModularUIKey,a as useModularUIRequest,g as useNavigation,X as useNotification,Z as usePanel,f as usePathname,_ as usePreference,y as useProgressIndicator,z as useProgressIndicatorState,e as useQuerystring,S as useRelatedConcepts,p as useReload,E as useRepeatableAttributeSet,b as useRetrieveFormsOnModel,r as useTab,j as useTranslate,v as useUserProfile};
2
2
  //# sourceMappingURL=index.js.map