@trackunit/react-core-contexts 2.1.47 → 2.1.48-alpha-df0e8d549b3.0
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 +4 -40
- package/index.esm.js +5 -40
- package/package.json +8 -8
- package/src/index.d.ts +0 -1
- package/src/featureFlags/FeatureFlagProviderIrisApp.d.ts +0 -5
package/index.cjs.js
CHANGED
|
@@ -1,45 +1,21 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
var irisAppRuntimeCore = require('@trackunit/iris-app-runtime-core');
|
|
5
|
-
var reactCoreContextsApi = require('@trackunit/react-core-contexts-api');
|
|
6
|
-
var react = require('react');
|
|
7
4
|
var client = require('@apollo/client');
|
|
8
5
|
var reactCoreHooks = require('@trackunit/react-core-hooks');
|
|
6
|
+
var react = require('react');
|
|
9
7
|
var context = require('@apollo/client/link/context');
|
|
10
8
|
var removeTypename = require('@apollo/client/link/remove-typename');
|
|
11
9
|
var utilities = require('@apollo/client/utilities');
|
|
12
10
|
var graphql = require('graphql');
|
|
13
11
|
var graphqlSse = require('graphql-sse');
|
|
14
12
|
var error = require('@apollo/client/link/error');
|
|
13
|
+
var irisAppRuntimeCore = require('@trackunit/iris-app-runtime-core');
|
|
14
|
+
var reactCoreContextsApi = require('@trackunit/react-core-contexts-api');
|
|
15
15
|
var i18nLibraryTranslation = require('@trackunit/i18n-library-translation');
|
|
16
16
|
var reactComponents = require('@trackunit/react-components');
|
|
17
17
|
var irisAppRuntimeCoreApi = require('@trackunit/iris-app-runtime-core-api');
|
|
18
18
|
|
|
19
|
-
/**
|
|
20
|
-
* This is a provider for the Featureflags.
|
|
21
|
-
*/
|
|
22
|
-
const FeatureFlagProviderIrisApp = ({ children }) => {
|
|
23
|
-
const [featureFlags, setFeatureFlags] = react.useState(null);
|
|
24
|
-
react.useEffect(() => {
|
|
25
|
-
const updateEnv = async () => {
|
|
26
|
-
try {
|
|
27
|
-
setFeatureFlags(await irisAppRuntimeCore.FeatureFlagRuntime.getFeatureFlags());
|
|
28
|
-
}
|
|
29
|
-
catch (error) {
|
|
30
|
-
setFeatureFlags(null);
|
|
31
|
-
// eslint-disable-next-line no-console
|
|
32
|
-
console.error("Could not load environment!");
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
void updateEnv();
|
|
36
|
-
}, []);
|
|
37
|
-
if (!featureFlags) {
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
return jsxRuntime.jsx(reactCoreContextsApi.FeatureFlagContextProvider, { value: featureFlags, children: children });
|
|
41
|
-
};
|
|
42
|
-
|
|
43
19
|
/**
|
|
44
20
|
* This error link is used to capture error information, i. e. traceId, graphQL errors, network errors, etc.
|
|
45
21
|
*/
|
|
@@ -373,17 +349,6 @@ const createApolloClient = ({ graphqlPublicUrl, graphqlInternalUrl, graphqlRepor
|
|
|
373
349
|
LegacyServicePlan: {
|
|
374
350
|
keyFields: false,
|
|
375
351
|
},
|
|
376
|
-
// Merge disjoint sub-selections of the non-normalized `latest` object instead of
|
|
377
|
-
// replacing it, so concurrent queries don't clobber each other's subtrees. Global for
|
|
378
|
-
// all cache-reading Asset.locations consumers;
|
|
379
|
-
// see libs/fleet/map-page/docs/adr/0003-asset-identity-cache-prewarm.md
|
|
380
|
-
Locations: {
|
|
381
|
-
fields: {
|
|
382
|
-
latest: {
|
|
383
|
-
merge: true,
|
|
384
|
-
},
|
|
385
|
-
},
|
|
386
|
-
},
|
|
387
352
|
},
|
|
388
353
|
}),
|
|
389
354
|
defaultOptions,
|
|
@@ -984,10 +949,9 @@ const TrackunitProviders = ({ translations, children, errorHandler }) => {
|
|
|
984
949
|
i18nLibraryTranslation.registerTranslations(translations); // Register the apps translations if passed.
|
|
985
950
|
}
|
|
986
951
|
i18nLibraryTranslation.initializeTranslationsForApp(); // Initialize all registered translations
|
|
987
|
-
return (jsxRuntime.jsx(EnvironmentProviderIrisApp, { children: jsxRuntime.jsx(ErrorHandlingProviderIrisApp, { errorHandler: errorHandler, children: jsxRuntime.jsx(ThemeCssProviderIrisApp, { children: jsxRuntime.jsx(TokenProviderIrisApp, { children: jsxRuntime.jsx(CurrentUserPreferenceProviderIrisApp, { children: jsxRuntime.jsx(CurrentUserProviderIrisApp, { children: jsxRuntime.jsx(UserSubscriptionProviderIrisApp, { children: jsxRuntime.jsx(AnalyticsProviderIrisApp, { children: jsxRuntime.jsx(OemBrandingContextProviderIrisApp, { children: jsxRuntime.jsx(AssetSortingProviderIrisApp, { children: jsxRuntime.jsx(ManagerApolloProvider, { children: jsxRuntime.jsx(NavigationProviderIrisApp, { children: jsxRuntime.jsx(ToastProviderIrisApp, { children: jsxRuntime.jsx(ModalDialogContextProviderIrisApp, { children: jsxRuntime.jsx(ConfirmationDialogProviderIrisApp, { children: jsxRuntime.jsx(FilterBarProviderIrisApp, { children: jsxRuntime.jsx(ExportDataProviderIrisApp, { children: jsxRuntime.jsx(TimeRangeProviderIrisApp, { children: jsxRuntime.jsx(WidgetConfigProviderIrisApp, { children: jsxRuntime.jsx(GeolocationProviderIrisApp, { children: jsxRuntime.jsx(react.Suspense, { fallback: jsxRuntime.jsx(reactComponents.Spinner, { centering: "centered", "data-testid": "trackunit-providers" }), children:
|
|
952
|
+
return (jsxRuntime.jsx(EnvironmentProviderIrisApp, { children: jsxRuntime.jsx(ErrorHandlingProviderIrisApp, { errorHandler: errorHandler, children: jsxRuntime.jsx(ThemeCssProviderIrisApp, { children: jsxRuntime.jsx(TokenProviderIrisApp, { children: jsxRuntime.jsx(CurrentUserPreferenceProviderIrisApp, { children: jsxRuntime.jsx(CurrentUserProviderIrisApp, { children: jsxRuntime.jsx(UserSubscriptionProviderIrisApp, { children: jsxRuntime.jsx(AnalyticsProviderIrisApp, { children: jsxRuntime.jsx(OemBrandingContextProviderIrisApp, { children: jsxRuntime.jsx(AssetSortingProviderIrisApp, { children: jsxRuntime.jsx(ManagerApolloProvider, { children: jsxRuntime.jsx(NavigationProviderIrisApp, { children: jsxRuntime.jsx(ToastProviderIrisApp, { children: jsxRuntime.jsx(ModalDialogContextProviderIrisApp, { children: jsxRuntime.jsx(ConfirmationDialogProviderIrisApp, { children: jsxRuntime.jsx(FilterBarProviderIrisApp, { children: jsxRuntime.jsx(ExportDataProviderIrisApp, { children: jsxRuntime.jsx(TimeRangeProviderIrisApp, { children: jsxRuntime.jsx(WidgetConfigProviderIrisApp, { children: jsxRuntime.jsx(GeolocationProviderIrisApp, { children: jsxRuntime.jsx(react.Suspense, { fallback: jsxRuntime.jsx(reactComponents.Spinner, { centering: "centered", "data-testid": "trackunit-providers" }), children: children }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }));
|
|
988
953
|
};
|
|
989
954
|
|
|
990
|
-
exports.FeatureFlagProviderIrisApp = FeatureFlagProviderIrisApp;
|
|
991
955
|
exports.ManagerApolloProvider = ManagerApolloProvider;
|
|
992
956
|
exports.ToastProviderIrisApp = ToastProviderIrisApp;
|
|
993
957
|
exports.TrackunitProviders = TrackunitProviders;
|
package/index.esm.js
CHANGED
|
@@ -1,43 +1,19 @@
|
|
|
1
1
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { FeatureFlagRuntime, ToastRuntime, AnalyticsRuntime, registerHostChangeHandler, AssetSortingRuntime, ConfirmationDialogRuntime, EnvironmentRuntime, ExportDataRuntime, AssetsFilterBarRuntime, CustomersFilterBarRuntime, SitesFilterBarRuntime, GeolocationRuntime, ModalDialogRuntime, NavigationRuntime, OemBrandingRuntime, ThemeCssRuntime, TimeRangeRuntime, TokenRuntime, CurrentUserRuntime, CurrentUserPreferenceRuntime, UserSubscriptionRuntime, WidgetConfigRuntime } from '@trackunit/iris-app-runtime-core';
|
|
3
|
-
import { FeatureFlagContextProvider, ToastProvider, AnalyticsContextProvider, AssetSortingProvider, ConfirmationDialogProvider, EnvironmentContextProvider, ErrorHandlingContextProvider, ExportDataContext, FilterBarProvider, GeolocationProvider, ModalDialogContextProvider, NavigationContextProvider, OemBrandingContextProvider, TimeRangeProvider, TokenProvider, CurrentUserProvider, CurrentUserPreferenceProvider, UserSubscriptionProvider, WidgetConfigProvider } from '@trackunit/react-core-contexts-api';
|
|
4
|
-
import { useState, useEffect, useMemo, useCallback, useReducer, Suspense } from 'react';
|
|
5
2
|
import { ApolloLink, Observable, createHttpLink, from, split, ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';
|
|
6
3
|
import { useEnvironment, useToken, useErrorHandler } from '@trackunit/react-core-hooks';
|
|
4
|
+
import { useState, useEffect, useMemo, useCallback, useReducer, Suspense } from 'react';
|
|
7
5
|
import { setContext } from '@apollo/client/link/context';
|
|
8
6
|
import { removeTypenameFromVariables } from '@apollo/client/link/remove-typename';
|
|
9
7
|
import { getMainDefinition, Observable as Observable$1 } from '@apollo/client/utilities';
|
|
10
8
|
import { print } from 'graphql';
|
|
11
9
|
import { createClient } from 'graphql-sse';
|
|
12
10
|
import { onError } from '@apollo/client/link/error';
|
|
11
|
+
import { ToastRuntime, AnalyticsRuntime, registerHostChangeHandler, AssetSortingRuntime, ConfirmationDialogRuntime, EnvironmentRuntime, ExportDataRuntime, AssetsFilterBarRuntime, CustomersFilterBarRuntime, SitesFilterBarRuntime, GeolocationRuntime, ModalDialogRuntime, NavigationRuntime, OemBrandingRuntime, ThemeCssRuntime, TimeRangeRuntime, TokenRuntime, CurrentUserRuntime, CurrentUserPreferenceRuntime, UserSubscriptionRuntime, WidgetConfigRuntime } from '@trackunit/iris-app-runtime-core';
|
|
12
|
+
import { ToastProvider, AnalyticsContextProvider, AssetSortingProvider, ConfirmationDialogProvider, EnvironmentContextProvider, ErrorHandlingContextProvider, ExportDataContext, FilterBarProvider, GeolocationProvider, ModalDialogContextProvider, NavigationContextProvider, OemBrandingContextProvider, TimeRangeProvider, TokenProvider, CurrentUserProvider, CurrentUserPreferenceProvider, UserSubscriptionProvider, WidgetConfigProvider } from '@trackunit/react-core-contexts-api';
|
|
13
13
|
import { registerTranslations, initializeTranslationsForApp } from '@trackunit/i18n-library-translation';
|
|
14
14
|
import { Spinner } from '@trackunit/react-components';
|
|
15
15
|
import { Channels, SortOrder, AssetSortByProperty } from '@trackunit/iris-app-runtime-core-api';
|
|
16
16
|
|
|
17
|
-
/**
|
|
18
|
-
* This is a provider for the Featureflags.
|
|
19
|
-
*/
|
|
20
|
-
const FeatureFlagProviderIrisApp = ({ children }) => {
|
|
21
|
-
const [featureFlags, setFeatureFlags] = useState(null);
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
const updateEnv = async () => {
|
|
24
|
-
try {
|
|
25
|
-
setFeatureFlags(await FeatureFlagRuntime.getFeatureFlags());
|
|
26
|
-
}
|
|
27
|
-
catch (error) {
|
|
28
|
-
setFeatureFlags(null);
|
|
29
|
-
// eslint-disable-next-line no-console
|
|
30
|
-
console.error("Could not load environment!");
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
void updateEnv();
|
|
34
|
-
}, []);
|
|
35
|
-
if (!featureFlags) {
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
return jsx(FeatureFlagContextProvider, { value: featureFlags, children: children });
|
|
39
|
-
};
|
|
40
|
-
|
|
41
17
|
/**
|
|
42
18
|
* This error link is used to capture error information, i. e. traceId, graphQL errors, network errors, etc.
|
|
43
19
|
*/
|
|
@@ -371,17 +347,6 @@ const createApolloClient = ({ graphqlPublicUrl, graphqlInternalUrl, graphqlRepor
|
|
|
371
347
|
LegacyServicePlan: {
|
|
372
348
|
keyFields: false,
|
|
373
349
|
},
|
|
374
|
-
// Merge disjoint sub-selections of the non-normalized `latest` object instead of
|
|
375
|
-
// replacing it, so concurrent queries don't clobber each other's subtrees. Global for
|
|
376
|
-
// all cache-reading Asset.locations consumers;
|
|
377
|
-
// see libs/fleet/map-page/docs/adr/0003-asset-identity-cache-prewarm.md
|
|
378
|
-
Locations: {
|
|
379
|
-
fields: {
|
|
380
|
-
latest: {
|
|
381
|
-
merge: true,
|
|
382
|
-
},
|
|
383
|
-
},
|
|
384
|
-
},
|
|
385
350
|
},
|
|
386
351
|
}),
|
|
387
352
|
defaultOptions,
|
|
@@ -982,7 +947,7 @@ const TrackunitProviders = ({ translations, children, errorHandler }) => {
|
|
|
982
947
|
registerTranslations(translations); // Register the apps translations if passed.
|
|
983
948
|
}
|
|
984
949
|
initializeTranslationsForApp(); // Initialize all registered translations
|
|
985
|
-
return (jsx(EnvironmentProviderIrisApp, { children: jsx(ErrorHandlingProviderIrisApp, { errorHandler: errorHandler, children: jsx(ThemeCssProviderIrisApp, { children: jsx(TokenProviderIrisApp, { children: jsx(CurrentUserPreferenceProviderIrisApp, { children: jsx(CurrentUserProviderIrisApp, { children: jsx(UserSubscriptionProviderIrisApp, { children: jsx(AnalyticsProviderIrisApp, { children: jsx(OemBrandingContextProviderIrisApp, { children: jsx(AssetSortingProviderIrisApp, { children: jsx(ManagerApolloProvider, { children: jsx(NavigationProviderIrisApp, { children: jsx(ToastProviderIrisApp, { children: jsx(ModalDialogContextProviderIrisApp, { children: jsx(ConfirmationDialogProviderIrisApp, { children: jsx(FilterBarProviderIrisApp, { children: jsx(ExportDataProviderIrisApp, { children: jsx(TimeRangeProviderIrisApp, { children: jsx(WidgetConfigProviderIrisApp, { children: jsx(GeolocationProviderIrisApp, { children: jsx(Suspense, { fallback: jsx(Spinner, { centering: "centered", "data-testid": "trackunit-providers" }), children:
|
|
950
|
+
return (jsx(EnvironmentProviderIrisApp, { children: jsx(ErrorHandlingProviderIrisApp, { errorHandler: errorHandler, children: jsx(ThemeCssProviderIrisApp, { children: jsx(TokenProviderIrisApp, { children: jsx(CurrentUserPreferenceProviderIrisApp, { children: jsx(CurrentUserProviderIrisApp, { children: jsx(UserSubscriptionProviderIrisApp, { children: jsx(AnalyticsProviderIrisApp, { children: jsx(OemBrandingContextProviderIrisApp, { children: jsx(AssetSortingProviderIrisApp, { children: jsx(ManagerApolloProvider, { children: jsx(NavigationProviderIrisApp, { children: jsx(ToastProviderIrisApp, { children: jsx(ModalDialogContextProviderIrisApp, { children: jsx(ConfirmationDialogProviderIrisApp, { children: jsx(FilterBarProviderIrisApp, { children: jsx(ExportDataProviderIrisApp, { children: jsx(TimeRangeProviderIrisApp, { children: jsx(WidgetConfigProviderIrisApp, { children: jsx(GeolocationProviderIrisApp, { children: jsx(Suspense, { fallback: jsx(Spinner, { centering: "centered", "data-testid": "trackunit-providers" }), children: children }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }));
|
|
986
951
|
};
|
|
987
952
|
|
|
988
|
-
export {
|
|
953
|
+
export { ManagerApolloProvider, ToastProviderIrisApp, TrackunitProviders };
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-core-contexts",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.48-alpha-df0e8d549b3.0",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=24.x"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@trackunit/iris-app-api": "2.0.
|
|
11
|
-
"@trackunit/iris-app-runtime-core-api": "1.16.
|
|
12
|
-
"@trackunit/react-core-hooks": "1.17.
|
|
13
|
-
"@trackunit/i18n-library-translation": "2.0.
|
|
14
|
-
"@trackunit/react-components": "2.1.
|
|
15
|
-
"@trackunit/iris-app-runtime-core": "1.17.
|
|
10
|
+
"@trackunit/iris-app-api": "2.0.40-alpha-df0e8d549b3.0",
|
|
11
|
+
"@trackunit/iris-app-runtime-core-api": "1.16.53-alpha-df0e8d549b3.0",
|
|
12
|
+
"@trackunit/react-core-hooks": "1.17.59-alpha-df0e8d549b3.0",
|
|
13
|
+
"@trackunit/i18n-library-translation": "2.0.48-alpha-df0e8d549b3.0",
|
|
14
|
+
"@trackunit/react-components": "2.1.47-alpha-df0e8d549b3.0",
|
|
15
|
+
"@trackunit/iris-app-runtime-core": "1.17.54-alpha-df0e8d549b3.0",
|
|
16
16
|
"graphql-sse": "^2.5.4",
|
|
17
|
-
"@trackunit/react-core-contexts-api": "1.17.
|
|
17
|
+
"@trackunit/react-core-contexts-api": "1.17.53-alpha-df0e8d549b3.0"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"@apollo/client": "^3.13.8",
|
package/src/index.d.ts
CHANGED