@trackunit/react-core-hooks 1.7.121 → 1.7.127

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 (31) hide show
  1. package/index.cjs.js +25 -142
  2. package/index.esm.js +6 -102
  3. package/package.json +4 -3
  4. package/src/analytics/{AnalyticsProvider.d.ts → useAnalytics.d.ts} +0 -2
  5. package/src/assetSorting/{AssetSortingProvider.d.ts → useAssetSorting.d.ts} +1 -6
  6. package/src/confirmationDialog/useConfirmationDialog.d.ts +5 -0
  7. package/src/environment/useEnvironment.d.ts +11 -0
  8. package/src/errorHandling/{ErrorHandlingProvider.d.ts → useErrorHandler.d.ts} +2 -5
  9. package/src/exportData/useExportDataContext.d.ts +11 -0
  10. package/src/featureFlags/useFeatureFlags.d.ts +11 -0
  11. package/src/filterBar/useFilterBarContext.d.ts +15 -0
  12. package/src/index.d.ts +18 -18
  13. package/src/modalDialog/useModalDialogContext.d.ts +4 -0
  14. package/src/navigation/{NavigationContextProvider.d.ts → useNavigateInHost.d.ts} +0 -10
  15. package/src/oemBranding/{OemBrandingContextProvider.d.ts → useOemBrandingContext.d.ts} +0 -10
  16. package/src/subscription/{UserSubscriptionProvider.d.ts → useUserSubscription.d.ts} +1 -11
  17. package/src/timeRange/useTimeRange.d.ts +15 -0
  18. package/src/toast/useToast.d.ts +18 -0
  19. package/src/token/useToken.d.ts +10 -0
  20. package/src/user/{CurrentUserProvider.d.ts → useCurrentUser.d.ts} +0 -10
  21. package/src/user/{CurrentUserPreferenceProvider.d.ts → useCurrentUserPreference.d.ts} +0 -11
  22. package/src/widgetConfig/{WidgetConfigProvider.d.ts → useWidgetConfig.d.ts} +2 -13
  23. package/src/confirmationDialog/ConfirmationDialogProvider.d.ts +0 -14
  24. package/src/environment/EnvironmentContextProvider.d.ts +0 -22
  25. package/src/exportData/ExportDataContextState.d.ts +0 -15
  26. package/src/featureFlags/FeatureFlagContextProvider.d.ts +0 -22
  27. package/src/filterBar/FilterBarProvider.d.ts +0 -26
  28. package/src/modalDialog/ModalDialogProvider.d.ts +0 -14
  29. package/src/timeRange/TimeRangeProvider.d.ts +0 -26
  30. package/src/toast/ToastProvider.d.ts +0 -28
  31. package/src/token/TokenProvider.d.ts +0 -21
package/index.cjs.js CHANGED
@@ -1,11 +1,9 @@
1
1
  'use strict';
2
2
 
3
+ var reactCoreContextsApi = require('@trackunit/react-core-contexts-api');
3
4
  var react = require('react');
4
- var jsxRuntime = require('react/jsx-runtime');
5
5
  var irisAppRuntimeCore = require('@trackunit/iris-app-runtime-core');
6
6
 
7
- const AnalyticsContext = react.createContext(null);
8
- const AnalyticsContextProvider = AnalyticsContext.Provider; // easy import
9
7
  /**
10
8
  * Hook to get the analytics context.
11
9
  *
@@ -23,7 +21,7 @@ const AnalyticsContextProvider = AnalyticsContext.Provider; // easy import
23
21
  * @see { AnalyticsRuntimeApiSync}
24
22
  */
25
23
  const useAnalytics = (events) => {
26
- const context = react.useContext(AnalyticsContext);
24
+ const context = react.useContext(reactCoreContextsApi.AnalyticsContext);
27
25
  if (!context) {
28
26
  throw new Error("useAnalytics must be used within an AnalyticsProvider");
29
27
  }
@@ -54,11 +52,6 @@ const logEventWithDescription = (logEvent, events) => {
54
52
  };
55
53
  };
56
54
 
57
- const AssetSortingContext = react.createContext(null);
58
- /**
59
- * This is a provider for the AssetSortingContext.
60
- */
61
- const AssetSortingProvider = AssetSortingContext.Provider;
62
55
  /**
63
56
  * This is a hook to use the AssetSortingContext.
64
57
  *
@@ -88,36 +81,24 @@ const AssetSortingProvider = AssetSortingContext.Provider;
88
81
  * @see { AssetSortingState}
89
82
  */
90
83
  const useAssetSorting = () => {
91
- const context = react.useContext(AssetSortingContext);
84
+ const context = react.useContext(reactCoreContextsApi.AssetSortingContext);
92
85
  if (!context) {
93
86
  throw new Error("useAssetSorting must be used within a AssetSortingProvider");
94
87
  }
95
88
  return context;
96
89
  };
97
90
 
98
- const ConfirmationDialogContext = react.createContext(null);
99
- /**
100
- * This is a provider for the ConfirmationDialogContext.
101
- */
102
- const ConfirmationDialogProvider = (props) => (jsxRuntime.jsx(ConfirmationDialogContext.Provider, { ...props }));
103
91
  /**
104
92
  * This is a hook to use the ConfirmationDialogContext.
105
93
  */
106
94
  const useConfirmationDialog = () => {
107
- const confirmationDialogContext = react.useContext(ConfirmationDialogContext);
95
+ const confirmationDialogContext = react.useContext(reactCoreContextsApi.ConfirmationDialogContext);
108
96
  if (!confirmationDialogContext) {
109
97
  throw new Error("useConfirmationDialog must be used within the ConfirmationDialogProvider");
110
98
  }
111
99
  return confirmationDialogContext;
112
100
  };
113
101
 
114
- const EnvironmentContext = react.createContext(null);
115
- /**
116
- * This is a provider for the EnvironmentContext.
117
- */
118
- const EnvironmentContextProvider = (props) => {
119
- return jsxRuntime.jsx(EnvironmentContext.Provider, { ...props });
120
- };
121
102
  /**
122
103
  * This is a hook to use the EnvironmentContext.
123
104
  *
@@ -129,15 +110,13 @@ const EnvironmentContextProvider = (props) => {
129
110
  * @see (@link EnvironmentState)
130
111
  */
131
112
  const useEnvironment = () => {
132
- const context = react.useContext(EnvironmentContext);
113
+ const context = react.useContext(reactCoreContextsApi.EnvironmentContext);
133
114
  if (!context) {
134
115
  throw new Error("useEnvironment must be used within an EnvironmentContext");
135
116
  }
136
117
  return context;
137
118
  };
138
119
 
139
- const ErrorHandlingContext = react.createContext(null);
140
- const ErrorHandlingContextProvider = ErrorHandlingContext.Provider; // easy import
141
120
  /**
142
121
  * Hook to get the error handling context.
143
122
  *
@@ -152,7 +131,7 @@ const ErrorHandlingContextProvider = ErrorHandlingContext.Provider; // easy impo
152
131
  * @see { ErrorHandlingContext}
153
132
  */
154
133
  const useErrorHandler = () => {
155
- const context = react.useContext(ErrorHandlingContext);
134
+ const context = react.useContext(reactCoreContextsApi.ErrorHandlingContext);
156
135
  if (!context) {
157
136
  throw new Error("useErrorHandler must be used within an ErrorHandlingContextProvider");
158
137
  }
@@ -170,10 +149,9 @@ const useErrorHandler = () => {
170
149
  * }
171
150
  */
172
151
  const useErrorHandlerOrNull = () => {
173
- return react.useContext(ErrorHandlingContext) || null;
152
+ return react.useContext(reactCoreContextsApi.ErrorHandlingContext) || null;
174
153
  };
175
154
 
176
- const ExportDataContext = react.createContext(undefined);
177
155
  /**
178
156
  * This is a hook to use the ExportDataContext.
179
157
  *
@@ -185,20 +163,13 @@ const ExportDataContext = react.createContext(undefined);
185
163
  * @see (@link ExportDataProps)
186
164
  */
187
165
  const useExportDataContext = () => {
188
- const context = react.useContext(ExportDataContext);
166
+ const context = react.useContext(reactCoreContextsApi.ExportDataContext);
189
167
  if (context === undefined) {
190
168
  throw new Error("useExportDataContext must be used within an ExportDataContext");
191
169
  }
192
170
  return context;
193
171
  };
194
172
 
195
- const FeatureFlagContext = react.createContext(null);
196
- /**
197
- * This is a provider for the FeatureFlagContext.
198
- */
199
- const FeatureFlagContextProvider = (props) => {
200
- return jsxRuntime.jsx(FeatureFlagContext.Provider, { ...props });
201
- };
202
173
  /**
203
174
  * This is a hook to use the FeatureFlagContext.
204
175
  *
@@ -210,7 +181,7 @@ const FeatureFlagContextProvider = (props) => {
210
181
  * @see (@link FeatureFlagContext)
211
182
  */
212
183
  const useFeatureFlags = () => {
213
- const context = react.useContext(FeatureFlagContext);
184
+ const context = react.useContext(reactCoreContextsApi.FeatureFlagContext);
214
185
  if (!context) {
215
186
  throw new Error("useFeatureFlags must be used within a FeatureFlagContext");
216
187
  }
@@ -236,7 +207,6 @@ const fetchAssetBlobUrl = async (fullUrl, headers) => {
236
207
  }
237
208
  };
238
209
 
239
- const FilterBarContext = react.createContext(null);
240
210
  /**
241
211
  * This is a hook to use the FilterBarProvider.
242
212
  *
@@ -252,18 +222,13 @@ const FilterBarContext = react.createContext(null);
252
222
  * @see { FilterBarContext}
253
223
  */
254
224
  const useFilterBarContext = () => {
255
- const context = react.useContext(FilterBarContext);
225
+ const context = react.useContext(reactCoreContextsApi.FilterBarContext);
256
226
  if (!context) {
257
227
  throw new Error("useFilterBar must be used within the FilterBarContext");
258
228
  }
259
229
  return context;
260
230
  };
261
- /**
262
- * This is a provider for the FilterBarContext.
263
- */
264
- const FilterBarProvider = (props) => jsxRuntime.jsx(FilterBarContext.Provider, { ...props });
265
231
 
266
- const TokenContext = react.createContext(null);
267
232
  /**
268
233
  * This is a hook to use the TokenContext.
269
234
  *
@@ -274,18 +239,12 @@ const TokenContext = react.createContext(null);
274
239
  * @see {ITokenContext}
275
240
  */
276
241
  const useToken = () => {
277
- const context = react.useContext(TokenContext);
242
+ const context = react.useContext(reactCoreContextsApi.TokenContext);
278
243
  if (!context) {
279
244
  throw new Error("useToken must be used within the TokenContext");
280
245
  }
281
246
  return context;
282
247
  };
283
- /**
284
- * This is a provider for the TokenContext.
285
- */
286
- const TokenProvider = (props) => {
287
- return jsxRuntime.jsx(TokenContext.Provider, { ...props });
288
- };
289
248
 
290
249
  const base64ToBlob = (base64, contentType = "") => {
291
250
  const result = base64.split(",");
@@ -409,29 +368,17 @@ const useIrisAppImage = () => {
409
368
  };
410
369
  };
411
370
 
412
- const ModalDialogContext = react.createContext(null);
413
- /**
414
- * This is a provider for the ModalDialogContext.
415
- */
416
- const ModalDialogContextProvider = (props) => (jsxRuntime.jsx(ModalDialogContext.Provider, { ...props }));
417
371
  /**
418
372
  * This is a hook to use the useModalDialogContext.
419
373
  */
420
374
  const useModalDialogContext = () => {
421
- const modalDialogContext = react.useContext(ModalDialogContext);
375
+ const modalDialogContext = react.useContext(reactCoreContextsApi.ModalDialogContext);
422
376
  if (!modalDialogContext) {
423
377
  throw new Error("useModalDialogContext must be used within the ModalDialogContextProvider");
424
378
  }
425
379
  return modalDialogContext;
426
380
  };
427
381
 
428
- const NavigationContext = react.createContext(null);
429
- /**
430
- * This is a provider for the NavigationContext.
431
- */
432
- const NavigationContextProvider = (props) => {
433
- return jsxRuntime.jsx(NavigationContext.Provider, { ...props });
434
- };
435
382
  /**
436
383
  * This is a hook to use the NavigationContext.
437
384
  *
@@ -441,7 +388,7 @@ const NavigationContextProvider = (props) => {
441
388
  * @see (@link NavigationRuntimeApi)
442
389
  */
443
390
  const useNavigateInHost = () => {
444
- const context = react.useContext(NavigationContext);
391
+ const context = react.useContext(reactCoreContextsApi.NavigationContext);
445
392
  if (!context) {
446
393
  throw new Error("useNavigateInHost must be used within an NavigationContext");
447
394
  }
@@ -463,7 +410,7 @@ const useNavigateInHost = () => {
463
410
  * @see (@link NavigationRuntimeApi)
464
411
  */
465
412
  const useHasAccessTo = (options) => {
466
- const context = react.useContext(NavigationContext);
413
+ const context = react.useContext(reactCoreContextsApi.NavigationContext);
467
414
  if (!context) {
468
415
  throw new Error("useHasAccessTo must be used within an NavigationContext");
469
416
  }
@@ -480,7 +427,6 @@ const useHasAccessTo = (options) => {
480
427
  return { hasAccess };
481
428
  };
482
429
 
483
- const OEMBrandingService = react.createContext(null);
484
430
  /**
485
431
  * This is a hook to use the OemBrandingContext.
486
432
  *
@@ -493,18 +439,12 @@ const OEMBrandingService = react.createContext(null);
493
439
  * @see { OemBrandingContext}
494
440
  */
495
441
  const useOemBrandingContext = () => {
496
- const context = react.useContext(OEMBrandingService);
442
+ const context = react.useContext(reactCoreContextsApi.OemBrandingContext);
497
443
  if (!context) {
498
444
  throw new Error("useOemBranding must be used within an OemBrandingContextProvider");
499
445
  }
500
446
  return context;
501
447
  };
502
- /**
503
- * This is a provider for the OemBrandingContext.
504
- */
505
- const OemBrandingContextProvider = (props) => {
506
- return jsxRuntime.jsx(OEMBrandingService.Provider, { ...props });
507
- };
508
448
 
509
449
  /**
510
450
  * A hook to expose asset runtime for React components
@@ -737,17 +677,10 @@ const useSiteRuntime = () => {
737
677
  return { siteInfo, loading, error };
738
678
  };
739
679
 
740
- const UserSubscriptionContext = react.createContext(null);
741
- /**
742
- * This is a provider for the UserSubscriptionContext.
743
- */
744
- const UserSubscriptionProvider = (props) => {
745
- return jsxRuntime.jsx(UserSubscriptionContext.Provider, { ...props });
746
- };
747
680
  /**
748
681
  * This is a hook to use the UserSubscriptionContext.
749
682
  *
750
- * @requires UserSubscriptionProvider
683
+ * @requires UserSubscriptionContext
751
684
  * @example
752
685
  * import { useUserSubscription } from "@trackunit/react-core-hooks";
753
686
  * const { numberOfDaysWithAccessToHistoricalData, packageType } = useUserSubscription();
@@ -756,14 +689,13 @@ const UserSubscriptionProvider = (props) => {
756
689
  * @see { UserSubscription}
757
690
  */
758
691
  const useUserSubscription = () => {
759
- const context = react.useContext(UserSubscriptionContext);
692
+ const context = react.useContext(reactCoreContextsApi.UserSubscriptionContext);
760
693
  if (!context) {
761
- throw new Error("Cannot use useUserSubscription outside UserSubscriptionProvider");
694
+ throw new Error("useUserSubscription must be used within the UserSubscriptionContext");
762
695
  }
763
696
  return context;
764
697
  };
765
698
 
766
- const TimeRangeContext = react.createContext(null);
767
699
  /**
768
700
  * This is a hook to use the TimeRangeProvider.
769
701
  *
@@ -779,22 +711,13 @@ const TimeRangeContext = react.createContext(null);
779
711
  * @see { TimeRangeContext}
780
712
  */
781
713
  const useTimeRange = () => {
782
- const context = react.useContext(TimeRangeContext);
714
+ const context = react.useContext(reactCoreContextsApi.TimeRangeContext);
783
715
  if (!context) {
784
716
  throw new Error("useTimeRange must be used within the TimeRangeContext");
785
717
  }
786
718
  return context;
787
719
  };
788
- /**
789
- * This is a provider for the TimeRangeContext.
790
- */
791
- const TimeRangeProvider = (props) => jsxRuntime.jsx(TimeRangeContext.Provider, { ...props });
792
720
 
793
- const ToastContext = react.createContext(null);
794
- /**
795
- * This is a provider for the ToastContext.
796
- */
797
- const ToastProvider = (props) => jsxRuntime.jsx(ToastContext.Provider, { ...props });
798
721
  /**
799
722
  * This is a hook to use the ToastContext.
800
723
  *
@@ -813,20 +736,13 @@ const ToastProvider = (props) => jsxRuntime.jsx(ToastContext.Provider, { ...prop
813
736
  * @see { IToastContext}
814
737
  */
815
738
  const useToast = () => {
816
- const toastContext = react.useContext(ToastContext);
739
+ const toastContext = react.useContext(reactCoreContextsApi.ToastContext);
817
740
  if (!toastContext) {
818
741
  throw new Error("useToast must be used within the ToastProvider");
819
742
  }
820
743
  return toastContext;
821
744
  };
822
745
 
823
- const CurrentUserPreferenceContext = react.createContext(null);
824
- /**
825
- *
826
- */
827
- const CurrentUserPreferenceProvider = (props) => {
828
- return jsxRuntime.jsx(CurrentUserPreferenceContext.Provider, { ...props });
829
- };
830
746
  /**
831
747
  * This is a hook providing the Current User language.
832
748
  *
@@ -840,7 +756,7 @@ const CurrentUserPreferenceProvider = (props) => {
840
756
  * @see { CurrentUserPreferenceState}
841
757
  */
842
758
  const useCurrentUserLanguage = () => {
843
- const context = react.useContext(CurrentUserPreferenceContext);
759
+ const context = react.useContext(reactCoreContextsApi.CurrentUserPreferenceContext);
844
760
  if (!context) {
845
761
  throw new Error("useCurrentUserLanguage must be used within the CurrentUserPreferenceProvider");
846
762
  }
@@ -868,7 +784,7 @@ const useCurrentUserLanguage = () => {
868
784
  * @see { CurrentUserPreferenceState}
869
785
  */
870
786
  const useCurrentUserTimeZonePreference = () => {
871
- const context = react.useContext(CurrentUserPreferenceContext);
787
+ const context = react.useContext(reactCoreContextsApi.CurrentUserPreferenceContext);
872
788
  if (!context) {
873
789
  throw new Error("useCurrentUserTimeZone must be used within the CurrentUserPreferenceProvider");
874
790
  }
@@ -892,7 +808,7 @@ const useCurrentUserTimeZonePreference = () => {
892
808
  * @see { CurrentUserPreferenceState}
893
809
  */
894
810
  const useCurrentUserSystemOfMeasurement = () => {
895
- const context = react.useContext(CurrentUserPreferenceContext);
811
+ const context = react.useContext(reactCoreContextsApi.CurrentUserPreferenceContext);
896
812
  if (!context) {
897
813
  throw new Error("useCurrentUserSystemOfMeasurement must be used within the CurrentUserPreferenceProvider");
898
814
  }
@@ -913,13 +829,6 @@ const setGlobalLanguage = (language) => {
913
829
  }
914
830
  };
915
831
 
916
- const CurrentUserContext = react.createContext(null);
917
- /**
918
- * This is a provider for the CurrentUserContext.
919
- */
920
- const CurrentUserProvider = (props) => {
921
- return jsxRuntime.jsx(CurrentUserContext.Provider, { ...props });
922
- };
923
832
  /**
924
833
  * This is a hook providing the CurrentUserContext.
925
834
  *
@@ -935,14 +844,13 @@ const CurrentUserProvider = (props) => {
935
844
  * @see { CurrentUserContext}
936
845
  */
937
846
  const useCurrentUser = () => {
938
- const context = react.useContext(CurrentUserContext);
847
+ const context = react.useContext(reactCoreContextsApi.CurrentUserContext);
939
848
  if (!context) {
940
849
  throw new Error("useCurrentUser must be used within the CurrentUserProvider");
941
850
  }
942
851
  return context;
943
852
  };
944
853
 
945
- const WidgetConfigContext = react.createContext(null);
946
854
  /**
947
855
  * This is a hook to use the WidgetConfigProvider.
948
856
  *
@@ -958,16 +866,12 @@ const WidgetConfigContext = react.createContext(null);
958
866
  * @see { WidgetConfigContext}
959
867
  */
960
868
  const useWidgetConfigAsync = () => {
961
- const context = react.useContext(WidgetConfigContext);
869
+ const context = react.useContext(reactCoreContextsApi.WidgetConfigContext);
962
870
  if (!context) {
963
871
  throw new Error("useWidgetConfig must be used within the WidgetConfigContext");
964
872
  }
965
873
  return context;
966
874
  };
967
- /**
968
- * This is a provider for the WidgetConfigContext.
969
- */
970
- const WidgetConfigProvider = (props) => jsxRuntime.jsx(WidgetConfigContext.Provider, { ...props });
971
875
  /**
972
876
  * This is a hook to use the WidgetConfigContext.
973
877
  *
@@ -1045,27 +949,6 @@ const useWidgetConfig = () => {
1045
949
  return result;
1046
950
  };
1047
951
 
1048
- exports.AnalyticsContext = AnalyticsContext;
1049
- exports.AnalyticsContextProvider = AnalyticsContextProvider;
1050
- exports.AssetSortingProvider = AssetSortingProvider;
1051
- exports.ConfirmationDialogProvider = ConfirmationDialogProvider;
1052
- exports.CurrentUserPreferenceProvider = CurrentUserPreferenceProvider;
1053
- exports.CurrentUserProvider = CurrentUserProvider;
1054
- exports.EnvironmentContextProvider = EnvironmentContextProvider;
1055
- exports.ErrorHandlingContext = ErrorHandlingContext;
1056
- exports.ErrorHandlingContextProvider = ErrorHandlingContextProvider;
1057
- exports.ExportDataContext = ExportDataContext;
1058
- exports.FeatureFlagContextProvider = FeatureFlagContextProvider;
1059
- exports.FilterBarProvider = FilterBarProvider;
1060
- exports.ModalDialogContextProvider = ModalDialogContextProvider;
1061
- exports.NavigationContextProvider = NavigationContextProvider;
1062
- exports.OemBrandingContextProvider = OemBrandingContextProvider;
1063
- exports.TimeRangeProvider = TimeRangeProvider;
1064
- exports.ToastProvider = ToastProvider;
1065
- exports.TokenProvider = TokenProvider;
1066
- exports.UserSubscriptionProvider = UserSubscriptionProvider;
1067
- exports.WidgetConfigContext = WidgetConfigContext;
1068
- exports.WidgetConfigProvider = WidgetConfigProvider;
1069
952
  exports.fetchAssetBlobUrl = fetchAssetBlobUrl;
1070
953
  exports.useAnalytics = useAnalytics;
1071
954
  exports.useAssetRuntime = useAssetRuntime;
package/index.esm.js CHANGED
@@ -1,9 +1,7 @@
1
- import { createContext, useContext, useMemo, useState, useCallback, useEffect, useRef } from 'react';
2
- import { jsx } from 'react/jsx-runtime';
1
+ import { AnalyticsContext, AssetSortingContext, ConfirmationDialogContext, EnvironmentContext, ErrorHandlingContext, ExportDataContext, FeatureFlagContext, FilterBarContext, TokenContext, ModalDialogContext, NavigationContext, OemBrandingContext, UserSubscriptionContext, TimeRangeContext, ToastContext, CurrentUserPreferenceContext, CurrentUserContext, WidgetConfigContext } from '@trackunit/react-core-contexts-api';
2
+ import { useContext, useMemo, useState, useCallback, useEffect, useRef } from 'react';
3
3
  import { AssetRuntime, CustomerRuntime, EventRuntime, ParamsRuntime, SiteRuntime, WidgetConfigRuntime } from '@trackunit/iris-app-runtime-core';
4
4
 
5
- const AnalyticsContext = createContext(null);
6
- const AnalyticsContextProvider = AnalyticsContext.Provider; // easy import
7
5
  /**
8
6
  * Hook to get the analytics context.
9
7
  *
@@ -52,11 +50,6 @@ const logEventWithDescription = (logEvent, events) => {
52
50
  };
53
51
  };
54
52
 
55
- const AssetSortingContext = createContext(null);
56
- /**
57
- * This is a provider for the AssetSortingContext.
58
- */
59
- const AssetSortingProvider = AssetSortingContext.Provider;
60
53
  /**
61
54
  * This is a hook to use the AssetSortingContext.
62
55
  *
@@ -93,11 +86,6 @@ const useAssetSorting = () => {
93
86
  return context;
94
87
  };
95
88
 
96
- const ConfirmationDialogContext = createContext(null);
97
- /**
98
- * This is a provider for the ConfirmationDialogContext.
99
- */
100
- const ConfirmationDialogProvider = (props) => (jsx(ConfirmationDialogContext.Provider, { ...props }));
101
89
  /**
102
90
  * This is a hook to use the ConfirmationDialogContext.
103
91
  */
@@ -109,13 +97,6 @@ const useConfirmationDialog = () => {
109
97
  return confirmationDialogContext;
110
98
  };
111
99
 
112
- const EnvironmentContext = createContext(null);
113
- /**
114
- * This is a provider for the EnvironmentContext.
115
- */
116
- const EnvironmentContextProvider = (props) => {
117
- return jsx(EnvironmentContext.Provider, { ...props });
118
- };
119
100
  /**
120
101
  * This is a hook to use the EnvironmentContext.
121
102
  *
@@ -134,8 +115,6 @@ const useEnvironment = () => {
134
115
  return context;
135
116
  };
136
117
 
137
- const ErrorHandlingContext = createContext(null);
138
- const ErrorHandlingContextProvider = ErrorHandlingContext.Provider; // easy import
139
118
  /**
140
119
  * Hook to get the error handling context.
141
120
  *
@@ -171,7 +150,6 @@ const useErrorHandlerOrNull = () => {
171
150
  return useContext(ErrorHandlingContext) || null;
172
151
  };
173
152
 
174
- const ExportDataContext = createContext(undefined);
175
153
  /**
176
154
  * This is a hook to use the ExportDataContext.
177
155
  *
@@ -190,13 +168,6 @@ const useExportDataContext = () => {
190
168
  return context;
191
169
  };
192
170
 
193
- const FeatureFlagContext = createContext(null);
194
- /**
195
- * This is a provider for the FeatureFlagContext.
196
- */
197
- const FeatureFlagContextProvider = (props) => {
198
- return jsx(FeatureFlagContext.Provider, { ...props });
199
- };
200
171
  /**
201
172
  * This is a hook to use the FeatureFlagContext.
202
173
  *
@@ -234,7 +205,6 @@ const fetchAssetBlobUrl = async (fullUrl, headers) => {
234
205
  }
235
206
  };
236
207
 
237
- const FilterBarContext = createContext(null);
238
208
  /**
239
209
  * This is a hook to use the FilterBarProvider.
240
210
  *
@@ -256,12 +226,7 @@ const useFilterBarContext = () => {
256
226
  }
257
227
  return context;
258
228
  };
259
- /**
260
- * This is a provider for the FilterBarContext.
261
- */
262
- const FilterBarProvider = (props) => jsx(FilterBarContext.Provider, { ...props });
263
229
 
264
- const TokenContext = createContext(null);
265
230
  /**
266
231
  * This is a hook to use the TokenContext.
267
232
  *
@@ -278,12 +243,6 @@ const useToken = () => {
278
243
  }
279
244
  return context;
280
245
  };
281
- /**
282
- * This is a provider for the TokenContext.
283
- */
284
- const TokenProvider = (props) => {
285
- return jsx(TokenContext.Provider, { ...props });
286
- };
287
246
 
288
247
  const base64ToBlob = (base64, contentType = "") => {
289
248
  const result = base64.split(",");
@@ -407,11 +366,6 @@ const useIrisAppImage = () => {
407
366
  };
408
367
  };
409
368
 
410
- const ModalDialogContext = createContext(null);
411
- /**
412
- * This is a provider for the ModalDialogContext.
413
- */
414
- const ModalDialogContextProvider = (props) => (jsx(ModalDialogContext.Provider, { ...props }));
415
369
  /**
416
370
  * This is a hook to use the useModalDialogContext.
417
371
  */
@@ -423,13 +377,6 @@ const useModalDialogContext = () => {
423
377
  return modalDialogContext;
424
378
  };
425
379
 
426
- const NavigationContext = createContext(null);
427
- /**
428
- * This is a provider for the NavigationContext.
429
- */
430
- const NavigationContextProvider = (props) => {
431
- return jsx(NavigationContext.Provider, { ...props });
432
- };
433
380
  /**
434
381
  * This is a hook to use the NavigationContext.
435
382
  *
@@ -478,7 +425,6 @@ const useHasAccessTo = (options) => {
478
425
  return { hasAccess };
479
426
  };
480
427
 
481
- const OEMBrandingService = createContext(null);
482
428
  /**
483
429
  * This is a hook to use the OemBrandingContext.
484
430
  *
@@ -491,18 +437,12 @@ const OEMBrandingService = createContext(null);
491
437
  * @see { OemBrandingContext}
492
438
  */
493
439
  const useOemBrandingContext = () => {
494
- const context = useContext(OEMBrandingService);
440
+ const context = useContext(OemBrandingContext);
495
441
  if (!context) {
496
442
  throw new Error("useOemBranding must be used within an OemBrandingContextProvider");
497
443
  }
498
444
  return context;
499
445
  };
500
- /**
501
- * This is a provider for the OemBrandingContext.
502
- */
503
- const OemBrandingContextProvider = (props) => {
504
- return jsx(OEMBrandingService.Provider, { ...props });
505
- };
506
446
 
507
447
  /**
508
448
  * A hook to expose asset runtime for React components
@@ -735,17 +675,10 @@ const useSiteRuntime = () => {
735
675
  return { siteInfo, loading, error };
736
676
  };
737
677
 
738
- const UserSubscriptionContext = createContext(null);
739
- /**
740
- * This is a provider for the UserSubscriptionContext.
741
- */
742
- const UserSubscriptionProvider = (props) => {
743
- return jsx(UserSubscriptionContext.Provider, { ...props });
744
- };
745
678
  /**
746
679
  * This is a hook to use the UserSubscriptionContext.
747
680
  *
748
- * @requires UserSubscriptionProvider
681
+ * @requires UserSubscriptionContext
749
682
  * @example
750
683
  * import { useUserSubscription } from "@trackunit/react-core-hooks";
751
684
  * const { numberOfDaysWithAccessToHistoricalData, packageType } = useUserSubscription();
@@ -756,12 +689,11 @@ const UserSubscriptionProvider = (props) => {
756
689
  const useUserSubscription = () => {
757
690
  const context = useContext(UserSubscriptionContext);
758
691
  if (!context) {
759
- throw new Error("Cannot use useUserSubscription outside UserSubscriptionProvider");
692
+ throw new Error("useUserSubscription must be used within the UserSubscriptionContext");
760
693
  }
761
694
  return context;
762
695
  };
763
696
 
764
- const TimeRangeContext = createContext(null);
765
697
  /**
766
698
  * This is a hook to use the TimeRangeProvider.
767
699
  *
@@ -783,16 +715,7 @@ const useTimeRange = () => {
783
715
  }
784
716
  return context;
785
717
  };
786
- /**
787
- * This is a provider for the TimeRangeContext.
788
- */
789
- const TimeRangeProvider = (props) => jsx(TimeRangeContext.Provider, { ...props });
790
718
 
791
- const ToastContext = createContext(null);
792
- /**
793
- * This is a provider for the ToastContext.
794
- */
795
- const ToastProvider = (props) => jsx(ToastContext.Provider, { ...props });
796
719
  /**
797
720
  * This is a hook to use the ToastContext.
798
721
  *
@@ -818,13 +741,6 @@ const useToast = () => {
818
741
  return toastContext;
819
742
  };
820
743
 
821
- const CurrentUserPreferenceContext = createContext(null);
822
- /**
823
- *
824
- */
825
- const CurrentUserPreferenceProvider = (props) => {
826
- return jsx(CurrentUserPreferenceContext.Provider, { ...props });
827
- };
828
744
  /**
829
745
  * This is a hook providing the Current User language.
830
746
  *
@@ -911,13 +827,6 @@ const setGlobalLanguage = (language) => {
911
827
  }
912
828
  };
913
829
 
914
- const CurrentUserContext = createContext(null);
915
- /**
916
- * This is a provider for the CurrentUserContext.
917
- */
918
- const CurrentUserProvider = (props) => {
919
- return jsx(CurrentUserContext.Provider, { ...props });
920
- };
921
830
  /**
922
831
  * This is a hook providing the CurrentUserContext.
923
832
  *
@@ -940,7 +849,6 @@ const useCurrentUser = () => {
940
849
  return context;
941
850
  };
942
851
 
943
- const WidgetConfigContext = createContext(null);
944
852
  /**
945
853
  * This is a hook to use the WidgetConfigProvider.
946
854
  *
@@ -962,10 +870,6 @@ const useWidgetConfigAsync = () => {
962
870
  }
963
871
  return context;
964
872
  };
965
- /**
966
- * This is a provider for the WidgetConfigContext.
967
- */
968
- const WidgetConfigProvider = (props) => jsx(WidgetConfigContext.Provider, { ...props });
969
873
  /**
970
874
  * This is a hook to use the WidgetConfigContext.
971
875
  *
@@ -1043,4 +947,4 @@ const useWidgetConfig = () => {
1043
947
  return result;
1044
948
  };
1045
949
 
1046
- export { AnalyticsContext, AnalyticsContextProvider, AssetSortingProvider, ConfirmationDialogProvider, CurrentUserPreferenceProvider, CurrentUserProvider, EnvironmentContextProvider, ErrorHandlingContext, ErrorHandlingContextProvider, ExportDataContext, FeatureFlagContextProvider, FilterBarProvider, ModalDialogContextProvider, NavigationContextProvider, OemBrandingContextProvider, TimeRangeProvider, ToastProvider, TokenProvider, UserSubscriptionProvider, WidgetConfigContext, WidgetConfigProvider, fetchAssetBlobUrl, useAnalytics, useAssetRuntime, useAssetSorting, useConfirmationDialog, useCurrentUser, useCurrentUserLanguage, useCurrentUserSystemOfMeasurement, useCurrentUserTimeZonePreference, useCustomerRuntime, useEnvironment, useErrorHandler, useErrorHandlerOrNull, useEventRuntime, useExportDataContext, useFeatureBranchQueryString, useFeatureFlags, useFilterBarContext, useHasAccessTo, useImageUploader, useIrisAppId, useIrisAppImage, useIrisAppName, useModalDialogContext, useNavigateInHost, useOemBrandingContext, useSiteRuntime, useTimeRange, useToast, useToken, useUserSubscription, useWidgetConfig, useWidgetConfigAsync };
950
+ export { fetchAssetBlobUrl, useAnalytics, useAssetRuntime, useAssetSorting, useConfirmationDialog, useCurrentUser, useCurrentUserLanguage, useCurrentUserSystemOfMeasurement, useCurrentUserTimeZonePreference, useCustomerRuntime, useEnvironment, useErrorHandler, useErrorHandlerOrNull, useEventRuntime, useExportDataContext, useFeatureBranchQueryString, useFeatureFlags, useFilterBarContext, useHasAccessTo, useImageUploader, useIrisAppId, useIrisAppImage, useIrisAppName, useModalDialogContext, useNavigateInHost, useOemBrandingContext, useSiteRuntime, useTimeRange, useToast, useToken, useUserSubscription, useWidgetConfig, useWidgetConfigAsync };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-core-hooks",
3
- "version": "1.7.121",
3
+ "version": "1.7.127",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -8,8 +8,9 @@
8
8
  },
9
9
  "dependencies": {
10
10
  "react": "19.0.0",
11
- "@trackunit/iris-app-runtime-core": "1.8.117",
12
- "@trackunit/iris-app-runtime-core-api": "1.7.117"
11
+ "@trackunit/iris-app-runtime-core": "1.8.123",
12
+ "@trackunit/iris-app-runtime-core-api": "1.7.123",
13
+ "@trackunit/react-core-contexts-api": "1.8.82"
13
14
  },
14
15
  "module": "./index.esm.js",
15
16
  "main": "./index.cjs.js",
@@ -1,6 +1,4 @@
1
1
  import { AnalyticsRuntimeApiSync, EventDictionary } from "@trackunit/iris-app-runtime-core-api";
2
- export declare const AnalyticsContext: import("react").Context<AnalyticsRuntimeApiSync<Record<string, never>> | null>;
3
- export declare const AnalyticsContextProvider: import("react").Provider<AnalyticsRuntimeApiSync<Record<string, never>> | null>;
4
2
  /**
5
3
  * Hook to get the analytics context.
6
4
  *
@@ -1,8 +1,3 @@
1
- import { AssetSortingState } from "@trackunit/iris-app-runtime-core-api";
2
- /**
3
- * This is a provider for the AssetSortingContext.
4
- */
5
- export declare const AssetSortingProvider: import("react").Provider<AssetSortingState | null>;
6
1
  /**
7
2
  * This is a hook to use the AssetSortingContext.
8
3
  *
@@ -31,4 +26,4 @@ export declare const AssetSortingProvider: import("react").Provider<AssetSorting
31
26
  * );
32
27
  * @see { AssetSortingState}
33
28
  */
34
- export declare const useAssetSorting: () => AssetSortingState;
29
+ export declare const useAssetSorting: () => import("@trackunit/iris-app-runtime-core-api").AssetSortingState;
@@ -0,0 +1,5 @@
1
+ import { ConfirmationDialogRuntimeApi } from "@trackunit/iris-app-runtime-core-api";
2
+ /**
3
+ * This is a hook to use the ConfirmationDialogContext.
4
+ */
5
+ export declare const useConfirmationDialog: () => ConfirmationDialogRuntimeApi;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This is a hook to use the EnvironmentContext.
3
+ *
4
+ * @requires EnvironmentContext
5
+ * @example
6
+ * import { useEnvironment } from "@trackunit/react-core-hooks";
7
+ * const { googleMapsApiKey } = useEnvironment();
8
+ * // use api key for something...
9
+ * @see (@link EnvironmentState)
10
+ */
11
+ export declare const useEnvironment: () => import("@trackunit/iris-app-runtime-core-api").EnvironmentState;
@@ -1,6 +1,3 @@
1
- import { ErrorHandlingContextValue } from "@trackunit/iris-app-runtime-core-api";
2
- export declare const ErrorHandlingContext: import("react").Context<ErrorHandlingContextValue | null>;
3
- export declare const ErrorHandlingContextProvider: import("react").Provider<ErrorHandlingContextValue | null>;
4
1
  /**
5
2
  * Hook to get the error handling context.
6
3
  *
@@ -14,7 +11,7 @@ export declare const ErrorHandlingContextProvider: import("react").Provider<Erro
14
11
  * }
15
12
  * @see { ErrorHandlingContext}
16
13
  */
17
- export declare const useErrorHandler: () => ErrorHandlingContextValue;
14
+ export declare const useErrorHandler: () => import("@trackunit/iris-app-runtime-core-api").ErrorHandlingContextValue;
18
15
  /**
19
16
  * Hook to get the error handling context or null if not available.
20
17
  *
@@ -26,4 +23,4 @@ export declare const useErrorHandler: () => ErrorHandlingContextValue;
26
23
  * logError(new Error("Something went wrong"));
27
24
  * }
28
25
  */
29
- export declare const useErrorHandlerOrNull: () => ErrorHandlingContextValue | null;
26
+ export declare const useErrorHandlerOrNull: () => import("@trackunit/iris-app-runtime-core-api").ErrorHandlingContextValue | null;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This is a hook to use the ExportDataContext.
3
+ *
4
+ * @requires ExportDataContext
5
+ * @example
6
+ * import { useExportDataContext } from "@trackunit/react-core-hooks";
7
+ * const { exportData } = useExportDataContext();
8
+ * // call exportData to export data...
9
+ * @see (@link ExportDataProps)
10
+ */
11
+ export declare const useExportDataContext: () => import("@trackunit/iris-app-runtime-core-api").ExportDataRuntimeApi;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * This is a hook to use the FeatureFlagContext.
3
+ *
4
+ * @requires FeatureFlagContext
5
+ * @example
6
+ * import { useFeatureFlags } from "@trackunit/react-core-hooks";
7
+ * const { flags } = useFeatureFlags();
8
+ * // use flags to control visibility/access ...
9
+ * @see (@link FeatureFlagContext)
10
+ */
11
+ export declare const useFeatureFlags: () => import("@trackunit/iris-app-runtime-core-api").FeatureFlagState;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * This is a hook to use the FilterBarProvider.
3
+ *
4
+ * @requires FilterBarProvider
5
+ * @example
6
+ * import { useFilterBar } from "@trackunit/react-core-hooks";
7
+ *
8
+ * export const useFilterBarValues = () => {
9
+ * const { filterBarValues } = useFilterBar();
10
+ *
11
+ * ...
12
+ * };
13
+ * @see { FilterBarContext}
14
+ */
15
+ export declare const useFilterBarContext: () => import("@trackunit/iris-app-runtime-core-api").FilterBarContext;
package/src/index.d.ts CHANGED
@@ -1,27 +1,27 @@
1
- export * from "./analytics/AnalyticsProvider";
2
- export * from "./assetSorting/AssetSortingProvider";
3
- export * from "./confirmationDialog/ConfirmationDialogProvider";
4
- export * from "./environment/EnvironmentContextProvider";
5
- export * from "./errorHandling/ErrorHandlingProvider";
6
- export * from "./exportData/ExportDataContextState";
7
- export * from "./featureFlags/FeatureFlagContextProvider";
1
+ export * from "./analytics/useAnalytics";
2
+ export * from "./assetSorting/useAssetSorting";
3
+ export * from "./confirmationDialog/useConfirmationDialog";
4
+ export * from "./environment/useEnvironment";
5
+ export * from "./errorHandling/useErrorHandler";
6
+ export * from "./exportData/useExportDataContext";
7
+ export * from "./featureFlags/useFeatureFlags";
8
8
  export * from "./fetchAssetBlobUrl";
9
- export * from "./filterBar/FilterBarProvider";
9
+ export * from "./filterBar/useFilterBarContext";
10
10
  export * from "./images/useImageUploader";
11
11
  export * from "./images/useIrisAppImage";
12
- export * from "./modalDialog/ModalDialogProvider";
13
- export * from "./navigation/NavigationContextProvider";
14
- export * from "./oemBranding/OemBrandingContextProvider";
12
+ export * from "./modalDialog/useModalDialogContext";
13
+ export * from "./navigation/useNavigateInHost";
14
+ export * from "./oemBranding/useOemBrandingContext";
15
15
  export * from "./runtimes/useAssetRuntime";
16
16
  export * from "./runtimes/useCustomerRuntime";
17
17
  export * from "./runtimes/useEventRuntime";
18
18
  export * from "./runtimes/useParamsRuntime";
19
19
  export * from "./runtimes/useSiteRuntime";
20
- export * from "./subscription/UserSubscriptionProvider";
21
- export * from "./timeRange/TimeRangeProvider";
22
- export * from "./toast/ToastProvider";
23
- export * from "./token/TokenProvider";
20
+ export * from "./subscription/useUserSubscription";
21
+ export * from "./timeRange/useTimeRange";
22
+ export * from "./toast/useToast";
23
+ export * from "./token/useToken";
24
24
  export * from "./useFeatureBranchQueryString";
25
- export * from "./user/CurrentUserPreferenceProvider";
26
- export * from "./user/CurrentUserProvider";
27
- export * from "./widgetConfig/WidgetConfigProvider";
25
+ export * from "./user/useCurrentUserPreference";
26
+ export * from "./user/useCurrentUser";
27
+ export * from "./widgetConfig/useWidgetConfig";
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This is a hook to use the useModalDialogContext.
3
+ */
4
+ export declare const useModalDialogContext: () => import("@trackunit/iris-app-runtime-core-api").ModalDialogRuntimeApi;
@@ -1,13 +1,4 @@
1
1
  import { HasAccessToOptions, NavigationRuntimeApi } from "@trackunit/iris-app-runtime-core-api";
2
- import { ReactNode } from "react";
3
- interface NavigationContextProviderProps {
4
- value: NavigationRuntimeApi;
5
- children?: ReactNode;
6
- }
7
- /**
8
- * This is a provider for the NavigationContext.
9
- */
10
- export declare const NavigationContextProvider: (props: NavigationContextProviderProps) => import("react/jsx-runtime").JSX.Element;
11
2
  /**
12
3
  * This is a hook to use the NavigationContext.
13
4
  *
@@ -35,4 +26,3 @@ export declare const useNavigateInHost: () => NavigationRuntimeApi;
35
26
  export declare const useHasAccessTo: (options: HasAccessToOptions) => {
36
27
  hasAccess: boolean | undefined;
37
28
  };
38
- export {};
@@ -1,5 +1,4 @@
1
1
  import { OemBrandingRuntimeApi } from "@trackunit/iris-app-runtime-core-api";
2
- import { ReactNode } from "react";
3
2
  /**
4
3
  * This is a hook to use the OemBrandingContext.
5
4
  *
@@ -12,12 +11,3 @@ import { ReactNode } from "react";
12
11
  * @see { OemBrandingContext}
13
12
  */
14
13
  export declare const useOemBrandingContext: () => OemBrandingRuntimeApi;
15
- interface OemBrandingContextProviderProps {
16
- value: OemBrandingRuntimeApi;
17
- children?: ReactNode;
18
- }
19
- /**
20
- * This is a provider for the OemBrandingContext.
21
- */
22
- export declare const OemBrandingContextProvider: (props: OemBrandingContextProviderProps) => import("react/jsx-runtime").JSX.Element;
23
- export {};
@@ -1,17 +1,8 @@
1
1
  import { UserSubscription } from "@trackunit/iris-app-runtime-core-api";
2
- import { ReactNode } from "react";
3
- interface UserSubscriptionProviderProps {
4
- value: UserSubscription;
5
- children?: ReactNode;
6
- }
7
- /**
8
- * This is a provider for the UserSubscriptionContext.
9
- */
10
- export declare const UserSubscriptionProvider: (props: UserSubscriptionProviderProps) => import("react/jsx-runtime").JSX.Element;
11
2
  /**
12
3
  * This is a hook to use the UserSubscriptionContext.
13
4
  *
14
- * @requires UserSubscriptionProvider
5
+ * @requires UserSubscriptionContext
15
6
  * @example
16
7
  * import { useUserSubscription } from "@trackunit/react-core-hooks";
17
8
  * const { numberOfDaysWithAccessToHistoricalData, packageType } = useUserSubscription();
@@ -20,4 +11,3 @@ export declare const UserSubscriptionProvider: (props: UserSubscriptionProviderP
20
11
  * @see { UserSubscription}
21
12
  */
22
13
  export declare const useUserSubscription: () => UserSubscription;
23
- export {};
@@ -0,0 +1,15 @@
1
+ /**
2
+ * This is a hook to use the TimeRangeProvider.
3
+ *
4
+ * @requires TimeRangeProvider
5
+ * @example
6
+ * import { useTimeRange } from "@trackunit/react-core-hooks";
7
+ *
8
+ * export const useTimeRange = () => {
9
+ * const { timeRange } = useTimeRange();
10
+ *
11
+ * ...
12
+ * };
13
+ * @see { TimeRangeContext}
14
+ */
15
+ export declare const useTimeRange: () => import("@trackunit/iris-app-runtime-core-api").TimeRangeContext;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * This is a hook to use the ToastContext.
3
+ *
4
+ * @requires ToastProvider
5
+ * @example
6
+ * import { useToast } from "@trackunit/react-core-hooks";
7
+ * const { addToast } = useToast();
8
+ * // use the toast
9
+ * error &&
10
+ * addToast({
11
+ * intent: "warning",
12
+ * title: t("assetHome.specification.failedToSave"),
13
+ * description: error?.message,
14
+ * duration: 3000,
15
+ * });
16
+ * @see { IToastContext}
17
+ */
18
+ export declare const useToast: () => import("@trackunit/react-core-contexts-api").IToastContext;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This is a hook to use the TokenContext.
3
+ *
4
+ * @requires TokenProvider
5
+ * @example
6
+ * import { useToken } from "@trackunit/react-core-hooks";
7
+ * const { token } = useToken();
8
+ * @see {ITokenContext}
9
+ */
10
+ export declare const useToken: () => import("@trackunit/iris-app-runtime-core-api").ITokenContext;
@@ -1,13 +1,4 @@
1
1
  import { CurrentUserState } from "@trackunit/iris-app-runtime-core-api";
2
- import { ReactNode } from "react";
3
- interface Props {
4
- value: CurrentUserState;
5
- children?: ReactNode;
6
- }
7
- /**
8
- * This is a provider for the CurrentUserContext.
9
- */
10
- export declare const CurrentUserProvider: (props: Props) => import("react/jsx-runtime").JSX.Element;
11
2
  /**
12
3
  * This is a hook providing the CurrentUserContext.
13
4
  *
@@ -23,4 +14,3 @@ export declare const CurrentUserProvider: (props: Props) => import("react/jsx-ru
23
14
  * @see { CurrentUserContext}
24
15
  */
25
16
  export declare const useCurrentUser: () => CurrentUserState;
26
- export {};
@@ -1,13 +1,3 @@
1
- import { CurrentUserPreferenceState } from "@trackunit/iris-app-runtime-core-api";
2
- import { ReactNode } from "react";
3
- interface Props {
4
- value: CurrentUserPreferenceState;
5
- children?: ReactNode;
6
- }
7
- /**
8
- *
9
- */
10
- export declare const CurrentUserPreferenceProvider: (props: Props) => import("react/jsx-runtime").JSX.Element;
11
1
  /**
12
2
  * This is a hook providing the Current User language.
13
3
  *
@@ -56,4 +46,3 @@ export declare const useCurrentUserSystemOfMeasurement: () => {
56
46
  systemOfMeasurement: import("@trackunit/iris-app-runtime-core-api").SystemOfMeasurementType | null;
57
47
  setSystemOfMeasurement: ((systemOfMeasurement: import("@trackunit/iris-app-runtime-core-api").SystemOfMeasurementType) => void) | undefined;
58
48
  };
59
- export {};
@@ -1,6 +1,4 @@
1
- import { LoadingState, WidgetConfigContext as WidgetConfigContextType } from "@trackunit/iris-app-runtime-core-api";
2
- import { ReactNode } from "react";
3
- export declare const WidgetConfigContext: import("react").Context<WidgetConfigContextType | null>;
1
+ import { LoadingState } from "@trackunit/iris-app-runtime-core-api";
4
2
  /**
5
3
  * This is a hook to use the WidgetConfigProvider.
6
4
  *
@@ -15,15 +13,7 @@ export declare const WidgetConfigContext: import("react").Context<WidgetConfigCo
15
13
  * };
16
14
  * @see { WidgetConfigContext}
17
15
  */
18
- export declare const useWidgetConfigAsync: () => WidgetConfigContextType;
19
- interface WidgetConfigContextProps {
20
- value: WidgetConfigContextType;
21
- children?: ReactNode;
22
- }
23
- /**
24
- * This is a provider for the WidgetConfigContext.
25
- */
26
- export declare const WidgetConfigProvider: (props: WidgetConfigContextProps) => import("react/jsx-runtime").JSX.Element;
16
+ export declare const useWidgetConfigAsync: () => import("@trackunit/iris-app-runtime-core").WidgetConfigContext;
27
17
  /**
28
18
  * This is a hook to use the WidgetConfigContext.
29
19
  *
@@ -58,4 +48,3 @@ export declare const useWidgetConfig: () => {
58
48
  } | null;
59
49
  }) => Promise<void>;
60
50
  };
61
- export {};
@@ -1,14 +0,0 @@
1
- import { ConfirmationDialogRuntimeApi } from "@trackunit/iris-app-runtime-core-api";
2
- import { ReactNode } from "react";
3
- export interface ConfirmationDialogContextProviderProps {
4
- value: ConfirmationDialogRuntimeApi;
5
- children: ReactNode;
6
- }
7
- /**
8
- * This is a provider for the ConfirmationDialogContext.
9
- */
10
- export declare const ConfirmationDialogProvider: (props: ConfirmationDialogContextProviderProps) => ReactNode;
11
- /**
12
- * This is a hook to use the ConfirmationDialogContext.
13
- */
14
- export declare const useConfirmationDialog: () => ConfirmationDialogRuntimeApi;
@@ -1,22 +0,0 @@
1
- import { EnvironmentState } from "@trackunit/iris-app-runtime-core-api";
2
- import { ReactNode } from "react";
3
- interface EnvironmentContextProviderProps {
4
- value: EnvironmentState;
5
- children?: ReactNode;
6
- }
7
- /**
8
- * This is a provider for the EnvironmentContext.
9
- */
10
- export declare const EnvironmentContextProvider: (props: EnvironmentContextProviderProps) => import("react/jsx-runtime").JSX.Element;
11
- /**
12
- * This is a hook to use the EnvironmentContext.
13
- *
14
- * @requires EnvironmentContext
15
- * @example
16
- * import { useEnvironment } from "@trackunit/react-core-hooks";
17
- * const { googleMapsApiKey } = useEnvironment();
18
- * // use api key for something...
19
- * @see (@link EnvironmentState)
20
- */
21
- export declare const useEnvironment: () => EnvironmentState;
22
- export {};
@@ -1,15 +0,0 @@
1
- import { ExportDataRuntimeApi } from "@trackunit/iris-app-runtime-core-api";
2
- export interface ExportDataContextState extends ExportDataRuntimeApi {
3
- }
4
- export declare const ExportDataContext: import("react").Context<ExportDataContextState | undefined>;
5
- /**
6
- * This is a hook to use the ExportDataContext.
7
- *
8
- * @requires ExportDataContext
9
- * @example
10
- * import { useExportDataContext } from "@trackunit/react-core-hooks";
11
- * const { exportData } = useExportDataContext();
12
- * // call exportData to export data...
13
- * @see (@link ExportDataProps)
14
- */
15
- export declare const useExportDataContext: () => ExportDataContextState;
@@ -1,22 +0,0 @@
1
- import { FeatureFlagState } from "@trackunit/iris-app-runtime-core-api";
2
- import { ReactNode } from "react";
3
- export interface FeatureFlagContextProviderProps {
4
- children?: ReactNode;
5
- /** Override the value of the FeatureFlag context. Useful for testing purposes. */
6
- value: FeatureFlagState;
7
- }
8
- /**
9
- * This is a provider for the FeatureFlagContext.
10
- */
11
- export declare const FeatureFlagContextProvider: (props: FeatureFlagContextProviderProps) => import("react/jsx-runtime").JSX.Element;
12
- /**
13
- * This is a hook to use the FeatureFlagContext.
14
- *
15
- * @requires FeatureFlagContext
16
- * @example
17
- * import { useFeatureFlags } from "@trackunit/react-core-hooks";
18
- * const { flags } = useFeatureFlags();
19
- * // use flags to control visibility/access ...
20
- * @see (@link FeatureFlagContext)
21
- */
22
- export declare const useFeatureFlags: () => FeatureFlagState;
@@ -1,26 +0,0 @@
1
- import { FilterBarContext as FilterBarContextType } from "@trackunit/iris-app-runtime-core-api";
2
- import { ReactNode } from "react";
3
- /**
4
- * This is a hook to use the FilterBarProvider.
5
- *
6
- * @requires FilterBarProvider
7
- * @example
8
- * import { useFilterBar } from "@trackunit/react-core-hooks";
9
- *
10
- * export const useFilterBarValues = () => {
11
- * const { filterBarValues } = useFilterBar();
12
- *
13
- * ...
14
- * };
15
- * @see { FilterBarContext}
16
- */
17
- export declare const useFilterBarContext: () => FilterBarContextType;
18
- interface FilterBarContextProps {
19
- value: FilterBarContextType;
20
- children?: ReactNode;
21
- }
22
- /**
23
- * This is a provider for the FilterBarContext.
24
- */
25
- export declare const FilterBarProvider: (props: FilterBarContextProps) => import("react/jsx-runtime").JSX.Element;
26
- export {};
@@ -1,14 +0,0 @@
1
- import { ModalDialogRuntimeApi } from "@trackunit/iris-app-runtime-core-api";
2
- import { ReactNode } from "react";
3
- export interface ModalDialogProviderProps {
4
- value: ModalDialogRuntimeApi;
5
- children: ReactNode;
6
- }
7
- /**
8
- * This is a provider for the ModalDialogContext.
9
- */
10
- export declare const ModalDialogContextProvider: (props: ModalDialogProviderProps) => import("react/jsx-runtime").JSX.Element;
11
- /**
12
- * This is a hook to use the useModalDialogContext.
13
- */
14
- export declare const useModalDialogContext: () => ModalDialogRuntimeApi;
@@ -1,26 +0,0 @@
1
- import { TimeRangeContext as TimeRangeContextType } from "@trackunit/iris-app-runtime-core-api";
2
- import { ReactNode } from "react";
3
- /**
4
- * This is a hook to use the TimeRangeProvider.
5
- *
6
- * @requires TimeRangeProvider
7
- * @example
8
- * import { useTimeRange } from "@trackunit/react-core-hooks";
9
- *
10
- * export const useTimeRange = () => {
11
- * const { timeRange } = useTimeRange();
12
- *
13
- * ...
14
- * };
15
- * @see { TimeRangeContext}
16
- */
17
- export declare const useTimeRange: () => TimeRangeContextType;
18
- interface TimeRangeContextProps {
19
- value: TimeRangeContextType;
20
- children?: ReactNode;
21
- }
22
- /**
23
- * This is a provider for the TimeRangeContext.
24
- */
25
- export declare const TimeRangeProvider: (props: TimeRangeContextProps) => import("react/jsx-runtime").JSX.Element;
26
- export {};
@@ -1,28 +0,0 @@
1
- import { IToastContext } from "@trackunit/iris-app-runtime-core-api";
2
- import { ReactNode } from "react";
3
- export interface ToastContextProviderProps {
4
- value: IToastContext;
5
- children: ReactNode;
6
- }
7
- /**
8
- * This is a provider for the ToastContext.
9
- */
10
- export declare const ToastProvider: (props: ToastContextProviderProps) => import("react/jsx-runtime").JSX.Element;
11
- /**
12
- * This is a hook to use the ToastContext.
13
- *
14
- * @requires ToastProvider
15
- * @example
16
- * import { useToast } from "@trackunit/react-core-hooks";
17
- * const { addToast } = useToast();
18
- * // use the toast
19
- * error &&
20
- * addToast({
21
- * intent: "warning",
22
- * title: t("assetHome.specification.failedToSave"),
23
- * description: error?.message,
24
- * duration: 3000,
25
- * });
26
- * @see { IToastContext}
27
- */
28
- export declare const useToast: () => IToastContext;
@@ -1,21 +0,0 @@
1
- import { ITokenContext } from "@trackunit/iris-app-runtime-core-api";
2
- import { ReactNode } from "react";
3
- /**
4
- * This is a hook to use the TokenContext.
5
- *
6
- * @requires TokenProvider
7
- * @example
8
- * import { useToken } from "@trackunit/react-core-hooks";
9
- * const { token } = useToken();
10
- * @see {ITokenContext}
11
- */
12
- export declare const useToken: () => ITokenContext;
13
- interface TokenProviderProps {
14
- value: ITokenContext;
15
- children?: ReactNode;
16
- }
17
- /**
18
- * This is a provider for the TokenContext.
19
- */
20
- export declare const TokenProvider: (props: TokenProviderProps) => import("react/jsx-runtime").JSX.Element;
21
- export {};