@trackunit/react-core-contexts 0.0.64 → 0.1.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.
package/index.js
CHANGED
|
@@ -3,11 +3,11 @@ import { ApolloClient, InMemoryCache, from, split as split$1, ApolloProvider } f
|
|
|
3
3
|
import { setContext } from '@apollo/client/link/context';
|
|
4
4
|
import { onError } from '@apollo/client/link/error';
|
|
5
5
|
import * as Sentry from '@sentry/browser';
|
|
6
|
-
import { useEnvironment, useToken, ToastProvider, EnvironmentContextProvider, TokenProvider, CurrentUserProvider, UserSubscriptionProvider as UserSubscriptionProvider$1, useURLSynchronization } from '@trackunit/react-core-hooks';
|
|
6
|
+
import { useEnvironment, useToken, ToastProvider, EnvironmentContextProvider, GlobalSelectionProvider, TokenProvider, CurrentUserProvider, UserSubscriptionProvider as UserSubscriptionProvider$1, useURLSynchronization } from '@trackunit/react-core-hooks';
|
|
7
7
|
import { createUploadLink } from 'apollo-upload-client';
|
|
8
|
-
import { ToastRuntime, EnvironmentRuntime, TokenRuntime, CurrentUserRuntime, UserSubscriptionRuntime } from '@trackunit/iris-app-runtime-core';
|
|
8
|
+
import { ToastRuntime, EnvironmentRuntime, GlobalSelectionRuntime, TokenRuntime, CurrentUserRuntime, UserSubscriptionRuntime } from '@trackunit/iris-app-runtime-core';
|
|
9
9
|
import * as React from 'react';
|
|
10
|
-
import { useMemo } from 'react';
|
|
10
|
+
import { useMemo, useState, useEffect } from 'react';
|
|
11
11
|
import { registerTranslations, initializeTranslationsForApp } from '@trackunit/i18n-library-translation';
|
|
12
12
|
import { Spinner } from '@trackunit/react-components';
|
|
13
13
|
import { BrowserRouter } from 'react-router-dom';
|
|
@@ -2475,6 +2475,25 @@ const TileEnvironmentProvider = ({
|
|
|
2475
2475
|
}));
|
|
2476
2476
|
};
|
|
2477
2477
|
|
|
2478
|
+
const TileGlobalSelectionProvider = ({
|
|
2479
|
+
children
|
|
2480
|
+
}) => {
|
|
2481
|
+
const [GlobalSelectionContext, setGlobalSelectionContext] = useState(null);
|
|
2482
|
+
useEffect(() => {
|
|
2483
|
+
GlobalSelectionRuntime.getGlobalSelection().catch(() => null).then(setGlobalSelectionContext);
|
|
2484
|
+
}, []);
|
|
2485
|
+
|
|
2486
|
+
if (!GlobalSelectionContext) {
|
|
2487
|
+
return null;
|
|
2488
|
+
}
|
|
2489
|
+
|
|
2490
|
+
return jsx(GlobalSelectionProvider, Object.assign({
|
|
2491
|
+
value: GlobalSelectionContext
|
|
2492
|
+
}, {
|
|
2493
|
+
children: children
|
|
2494
|
+
}));
|
|
2495
|
+
};
|
|
2496
|
+
|
|
2478
2497
|
const TileTokenProvider = ({
|
|
2479
2498
|
children
|
|
2480
2499
|
}) => {
|
|
@@ -2546,8 +2565,10 @@ const TrackunitDataProviders = ({
|
|
|
2546
2565
|
children: jsx(TileTokenProvider, {
|
|
2547
2566
|
children: jsx(TileCurrentUserProvider, {
|
|
2548
2567
|
children: jsx(UserSubscriptionProvider, {
|
|
2549
|
-
children: jsx(
|
|
2550
|
-
children:
|
|
2568
|
+
children: jsx(TileGlobalSelectionProvider, {
|
|
2569
|
+
children: jsx(ManagerApolloProvider, {
|
|
2570
|
+
children: children
|
|
2571
|
+
})
|
|
2551
2572
|
})
|
|
2552
2573
|
})
|
|
2553
2574
|
})
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-core-contexts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"graphql": "^15.8.0",
|
|
8
|
-
"@trackunit/iris-app-runtime-core": "0.
|
|
9
|
-
"@trackunit/react-core-contexts-api": "0.0
|
|
10
|
-
"@trackunit/react-core-hooks": "0.
|
|
8
|
+
"@trackunit/iris-app-runtime-core": "0.1.1",
|
|
9
|
+
"@trackunit/react-core-contexts-api": "0.1.0",
|
|
10
|
+
"@trackunit/react-core-hooks": "0.1.1",
|
|
11
11
|
"react": "17.0.2",
|
|
12
|
-
"@trackunit/react-core-contexts-test": "0.0.
|
|
12
|
+
"@trackunit/react-core-contexts-test": "0.0.54",
|
|
13
13
|
"@apollo/client": "3.6.9",
|
|
14
14
|
"@sentry/browser": "^7.15.0",
|
|
15
15
|
"apollo-upload-client": "^14.1.3",
|