@trackunit/react-core-contexts 1.9.105 → 1.9.107

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.
package/index.cjs.js CHANGED
@@ -14,6 +14,7 @@ var irisAppRuntimeCore = require('@trackunit/iris-app-runtime-core');
14
14
  require('@js-temporal/polyfill');
15
15
  var i18nLibraryTranslation = require('@trackunit/i18n-library-translation');
16
16
  var reactComponents = require('@trackunit/react-components');
17
+ var irisAppRuntimeCoreApi = require('@trackunit/iris-app-runtime-core-api');
17
18
 
18
19
  const generateHeaders = (token, tracingHeaders) => {
19
20
  const headers = {
@@ -245,16 +246,16 @@ const ToastProviderIrisApp = ({ children }) => {
245
246
  const AnalyticsProviderIrisApp = ({ children }) => {
246
247
  const contextValue = react.useMemo(() => ({
247
248
  logPageView: details => {
248
- irisAppRuntimeCore.AnalyticsContextRuntime.logPageView(details);
249
+ void irisAppRuntimeCore.AnalyticsRuntime().logPageView(details);
249
250
  },
250
251
  logEvent: (eventName, details, nameSupplement) => {
251
- irisAppRuntimeCore.AnalyticsContextRuntime.logEvent(eventName, details, nameSupplement);
252
+ void irisAppRuntimeCore.AnalyticsRuntime().logEvent(eventName, details, nameSupplement);
252
253
  },
253
254
  logError: details => {
254
- irisAppRuntimeCore.AnalyticsContextRuntime.logError(details);
255
+ void irisAppRuntimeCore.AnalyticsRuntime().logError(details);
255
256
  },
256
257
  setUserProperty: (name, value) => {
257
- irisAppRuntimeCore.AnalyticsContextRuntime.setUserProperty(name, value);
258
+ void irisAppRuntimeCore.AnalyticsRuntime().setUserProperty(name, value);
258
259
  },
259
260
  }), []);
260
261
  return jsxRuntime.jsx(reactCoreHooks.AnalyticsContextProvider, { value: contextValue, children: children });
@@ -280,7 +281,7 @@ const useSubscribeToHostChanges = (methods) => {
280
281
  const AssetSortingProviderIrisApp = ({ children }) => {
281
282
  const [assetSortingState, setAssetSortingState] = react.useState(null);
282
283
  react.useEffect(() => {
283
- irisAppRuntimeCore.AssetSortingRuntime.getAssetSortingState()
284
+ void irisAppRuntimeCore.AssetSortingRuntime.getAssetSortingState()
284
285
  .catch(() => null)
285
286
  .then(setAssetSortingState);
286
287
  }, []);
@@ -289,7 +290,10 @@ const AssetSortingProviderIrisApp = ({ children }) => {
289
290
  }), [setAssetSortingState]);
290
291
  useSubscribeToHostChanges(methods);
291
292
  const contextValue = react.useMemo(() => ({
292
- sortingState: assetSortingState,
293
+ sortingState: assetSortingState ?? {
294
+ sortBy: irisAppRuntimeCoreApi.AssetSortByProperty.Criticality,
295
+ order: irisAppRuntimeCoreApi.SortOrder.Desc,
296
+ },
293
297
  setSortBy: irisAppRuntimeCore.AssetSortingRuntime.setAssetSortingState,
294
298
  }), [assetSortingState]);
295
299
  if (!assetSortingState) {
@@ -434,26 +438,7 @@ const NavigationProviderIrisApp = ({ children }) => {
434
438
  * This is a provider for the OemBrandingContext.
435
439
  */
436
440
  const OemBrandingContextProviderIrisApp = ({ children }) => {
437
- const [oemBrandingContext, setOemBrandingContext] = react.useState(null);
438
- const [ctxError, setCtxError] = react.useState(false);
439
- react.useEffect(() => {
440
- irisAppRuntimeCore.OemBrandingContextRuntime.getOemBrandingContextRuntime()
441
- .then((ctx) => {
442
- if (!ctx) {
443
- setCtxError(true);
444
- return;
445
- }
446
- setOemBrandingContext(ctx);
447
- })
448
- .catch(() => setCtxError(true));
449
- }, []);
450
- if (ctxError) {
451
- throw new Error("OemBranding context is invalid");
452
- }
453
- if (!oemBrandingContext) {
454
- return null;
455
- }
456
- return jsxRuntime.jsx(reactCoreHooks.OemBrandingContextProvider, { value: oemBrandingContext, children: children });
441
+ return jsxRuntime.jsx(reactCoreHooks.OemBrandingContextProvider, { value: irisAppRuntimeCore.OemBrandingRuntime, children: children });
457
442
  };
458
443
 
459
444
  /**
package/index.esm.js CHANGED
@@ -8,10 +8,11 @@ import { useEnvironment, useToken, useErrorHandler, ToastProvider, AnalyticsCont
8
8
  import { print } from 'graphql';
9
9
  import { createClient } from 'graphql-sse';
10
10
  import { useState, useMemo, useEffect, useCallback, Suspense } from 'react';
11
- import { ToastRuntime, AnalyticsContextRuntime, setupHostConnector, AssetSortingRuntime, ConfirmationDialogRuntime, EnvironmentRuntime, ExportDataRuntime, AssetsFilterBarRuntime, CustomersFilterBarRuntime, SitesFilterBarRuntime, ModalDialogRuntime, NavigationRuntime, OemBrandingContextRuntime, ThemeCssRuntime, TimeRangeRuntime, TokenRuntime, CurrentUserRuntime, CurrentUserPreferenceRuntime, UserSubscriptionRuntime, WidgetConfigRuntime } from '@trackunit/iris-app-runtime-core';
11
+ import { ToastRuntime, AnalyticsRuntime, setupHostConnector, AssetSortingRuntime, ConfirmationDialogRuntime, EnvironmentRuntime, ExportDataRuntime, AssetsFilterBarRuntime, CustomersFilterBarRuntime, SitesFilterBarRuntime, ModalDialogRuntime, NavigationRuntime, OemBrandingRuntime, ThemeCssRuntime, TimeRangeRuntime, TokenRuntime, CurrentUserRuntime, CurrentUserPreferenceRuntime, UserSubscriptionRuntime, WidgetConfigRuntime } from '@trackunit/iris-app-runtime-core';
12
12
  import '@js-temporal/polyfill';
13
13
  import { registerTranslations, initializeTranslationsForApp } from '@trackunit/i18n-library-translation';
14
14
  import { Spinner } from '@trackunit/react-components';
15
+ import { AssetSortByProperty, SortOrder } from '@trackunit/iris-app-runtime-core-api';
15
16
 
16
17
  const generateHeaders = (token, tracingHeaders) => {
17
18
  const headers = {
@@ -243,16 +244,16 @@ const ToastProviderIrisApp = ({ children }) => {
243
244
  const AnalyticsProviderIrisApp = ({ children }) => {
244
245
  const contextValue = useMemo(() => ({
245
246
  logPageView: details => {
246
- AnalyticsContextRuntime.logPageView(details);
247
+ void AnalyticsRuntime().logPageView(details);
247
248
  },
248
249
  logEvent: (eventName, details, nameSupplement) => {
249
- AnalyticsContextRuntime.logEvent(eventName, details, nameSupplement);
250
+ void AnalyticsRuntime().logEvent(eventName, details, nameSupplement);
250
251
  },
251
252
  logError: details => {
252
- AnalyticsContextRuntime.logError(details);
253
+ void AnalyticsRuntime().logError(details);
253
254
  },
254
255
  setUserProperty: (name, value) => {
255
- AnalyticsContextRuntime.setUserProperty(name, value);
256
+ void AnalyticsRuntime().setUserProperty(name, value);
256
257
  },
257
258
  }), []);
258
259
  return jsx(AnalyticsContextProvider, { value: contextValue, children: children });
@@ -278,7 +279,7 @@ const useSubscribeToHostChanges = (methods) => {
278
279
  const AssetSortingProviderIrisApp = ({ children }) => {
279
280
  const [assetSortingState, setAssetSortingState] = useState(null);
280
281
  useEffect(() => {
281
- AssetSortingRuntime.getAssetSortingState()
282
+ void AssetSortingRuntime.getAssetSortingState()
282
283
  .catch(() => null)
283
284
  .then(setAssetSortingState);
284
285
  }, []);
@@ -287,7 +288,10 @@ const AssetSortingProviderIrisApp = ({ children }) => {
287
288
  }), [setAssetSortingState]);
288
289
  useSubscribeToHostChanges(methods);
289
290
  const contextValue = useMemo(() => ({
290
- sortingState: assetSortingState,
291
+ sortingState: assetSortingState ?? {
292
+ sortBy: AssetSortByProperty.Criticality,
293
+ order: SortOrder.Desc,
294
+ },
291
295
  setSortBy: AssetSortingRuntime.setAssetSortingState,
292
296
  }), [assetSortingState]);
293
297
  if (!assetSortingState) {
@@ -432,26 +436,7 @@ const NavigationProviderIrisApp = ({ children }) => {
432
436
  * This is a provider for the OemBrandingContext.
433
437
  */
434
438
  const OemBrandingContextProviderIrisApp = ({ children }) => {
435
- const [oemBrandingContext, setOemBrandingContext] = useState(null);
436
- const [ctxError, setCtxError] = useState(false);
437
- useEffect(() => {
438
- OemBrandingContextRuntime.getOemBrandingContextRuntime()
439
- .then((ctx) => {
440
- if (!ctx) {
441
- setCtxError(true);
442
- return;
443
- }
444
- setOemBrandingContext(ctx);
445
- })
446
- .catch(() => setCtxError(true));
447
- }, []);
448
- if (ctxError) {
449
- throw new Error("OemBranding context is invalid");
450
- }
451
- if (!oemBrandingContext) {
452
- return null;
453
- }
454
- return jsx(OemBrandingContextProvider, { value: oemBrandingContext, children: children });
439
+ return jsx(OemBrandingContextProvider, { value: OemBrandingRuntime, children: children });
455
440
  };
456
441
 
457
442
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-core-contexts",
3
- "version": "1.9.105",
3
+ "version": "1.9.107",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -9,12 +9,12 @@
9
9
  "dependencies": {
10
10
  "@apollo/client": "3.13.8",
11
11
  "react": "19.0.0",
12
- "@trackunit/iris-app-api": "1.9.10",
13
- "@trackunit/iris-app-runtime-core-api": "1.7.78",
14
- "@trackunit/react-core-hooks": "1.7.82",
15
- "@trackunit/i18n-library-translation": "1.7.86",
16
- "@trackunit/react-components": "1.10.42",
17
- "@trackunit/iris-app-runtime-core": "1.8.78",
12
+ "@trackunit/iris-app-api": "1.9.11",
13
+ "@trackunit/iris-app-runtime-core-api": "1.7.80",
14
+ "@trackunit/react-core-hooks": "1.7.84",
15
+ "@trackunit/i18n-library-translation": "1.7.88",
16
+ "@trackunit/react-components": "1.10.44",
17
+ "@trackunit/iris-app-runtime-core": "1.8.80",
18
18
  "graphql": "^16.10.0",
19
19
  "graphql-sse": "^2.5.4",
20
20
  "@js-temporal/polyfill": "^0.5.1"
@@ -1,5 +1,5 @@
1
- import { type PropsWithChildren } from "react";
1
+ import { ReactNode, type PropsWithChildren } from "react";
2
2
  /**
3
3
  * This is a provider for the AnalyticsProvider.
4
4
  */
5
- export declare const AnalyticsProviderIrisApp: ({ children }: PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
5
+ export declare const AnalyticsProviderIrisApp: ({ children }: PropsWithChildren) => ReactNode;
@@ -5,5 +5,5 @@ interface Props {
5
5
  /**
6
6
  * This is a provider for the AssetSortingContext.
7
7
  */
8
- export declare const AssetSortingProviderIrisApp: ({ children }: Props) => import("react/jsx-runtime").JSX.Element | null;
8
+ export declare const AssetSortingProviderIrisApp: ({ children }: Props) => ReactNode;
9
9
  export {};
@@ -4,5 +4,5 @@ interface OemBrandingContextProviderIrisAppProps {
4
4
  /**
5
5
  * This is a provider for the OemBrandingContext.
6
6
  */
7
- export declare const OemBrandingContextProviderIrisApp: ({ children }: OemBrandingContextProviderIrisAppProps) => import("react/jsx-runtime").JSX.Element | null;
7
+ export declare const OemBrandingContextProviderIrisApp: ({ children }: OemBrandingContextProviderIrisAppProps) => import("react/jsx-runtime").JSX.Element;
8
8
  export {};
@@ -1,6 +1,6 @@
1
- import { IUserPreferencesContext } from "@trackunit/iris-app-runtime-core-api";
1
+ import { CurrentUserPreferenceState } from "@trackunit/iris-app-runtime-core-api";
2
2
  import { ReactNode } from "react";
3
- export type UserPreferencesContextIrisApp = Pick<IUserPreferencesContext, "language" | "timeZonePreference" | "timeZonePreference">;
3
+ export type UserPreferencesContextIrisApp = Pick<CurrentUserPreferenceState, "language" | "timeZonePreference" | "timeZonePreference">;
4
4
  interface CurrentUserPreferenceProviderIrisAppProps {
5
5
  children: ReactNode;
6
6
  }