@trackunit/react-core-contexts 0.4.672 → 0.4.673
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 +2 -8
- package/index.esm.js +2 -8
- package/package.json +2 -3
package/index.cjs.js
CHANGED
|
@@ -6,7 +6,6 @@ var context = require('@apollo/client/link/context');
|
|
|
6
6
|
var error = require('@apollo/client/link/error');
|
|
7
7
|
var removeTypename = require('@apollo/client/link/remove-typename');
|
|
8
8
|
var reactCoreHooks = require('@trackunit/react-core-hooks');
|
|
9
|
-
var apolloUploadClient = require('apollo-upload-client');
|
|
10
9
|
var React = require('react');
|
|
11
10
|
require('@js-temporal/polyfill');
|
|
12
11
|
var i18nLibraryTranslation = require('@trackunit/i18n-library-translation');
|
|
@@ -32,7 +31,7 @@ function _interopNamespaceDefault(e) {
|
|
|
32
31
|
|
|
33
32
|
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
34
33
|
|
|
35
|
-
const createApolloClient = ({ graphqlManagerUrl, graphqlPublicUrl,
|
|
34
|
+
const createApolloClient = ({ graphqlManagerUrl, graphqlPublicUrl, graphqlInternalUrl, graphqlReportUrl, isDev, tracingHeaders, firstToken, errorHandler, }) => {
|
|
36
35
|
let token;
|
|
37
36
|
if (!token) {
|
|
38
37
|
token = firstToken;
|
|
@@ -43,9 +42,6 @@ const createApolloClient = ({ graphqlManagerUrl, graphqlPublicUrl, graphqlManage
|
|
|
43
42
|
const publicGraphQLLink = client.createHttpLink({
|
|
44
43
|
uri: request => graphqlPublicUrl + "/" + request.operationName,
|
|
45
44
|
});
|
|
46
|
-
const imageUploadGraphQLLink = apolloUploadClient.createUploadLink({
|
|
47
|
-
uri: request => graphqlManagerImageUploadUrl + "/" + request.operationName,
|
|
48
|
-
});
|
|
49
45
|
const internalGraphQLLink = client.createHttpLink({
|
|
50
46
|
uri: request => graphqlInternalUrl + "/" + request.operationName,
|
|
51
47
|
});
|
|
@@ -171,7 +167,6 @@ const createApolloClient = ({ graphqlManagerUrl, graphqlPublicUrl, graphqlManage
|
|
|
171
167
|
errorLink,
|
|
172
168
|
authLink,
|
|
173
169
|
removeTypenameLink,
|
|
174
|
-
client.split(operation => operation.getContext().clientName === "imageupload", imageUploadGraphQLLink),
|
|
175
170
|
client.split(operation => operation.getContext().clientName === "manager", managerGraphQLLink, client.split(operation => operation.getContext().clientName === "report", reportGraphQLLink, client.split(() => global.gql === "internal", internalGraphQLLink, publicGraphQLLink))),
|
|
176
171
|
]),
|
|
177
172
|
}),
|
|
@@ -184,7 +179,7 @@ const createApolloClient = ({ graphqlManagerUrl, graphqlPublicUrl, graphqlManage
|
|
|
184
179
|
};
|
|
185
180
|
};
|
|
186
181
|
const useApolloClient = () => {
|
|
187
|
-
const { graphqlManagerUrl, graphqlPublicUrl, graphqlInternalUrl,
|
|
182
|
+
const { graphqlManagerUrl, graphqlPublicUrl, graphqlInternalUrl, graphqlReportUrl, environment, tracingHeaders } = reactCoreHooks.useEnvironment();
|
|
188
183
|
const { token } = reactCoreHooks.useToken();
|
|
189
184
|
const errorHandler = reactCoreHooks.useErrorHandler();
|
|
190
185
|
const clientRef = React.useRef(null);
|
|
@@ -195,7 +190,6 @@ const useApolloClient = () => {
|
|
|
195
190
|
clientRef.current = createApolloClient({
|
|
196
191
|
graphqlManagerUrl,
|
|
197
192
|
graphqlPublicUrl,
|
|
198
|
-
graphqlManagerImageUploadUrl,
|
|
199
193
|
graphqlInternalUrl,
|
|
200
194
|
graphqlReportUrl,
|
|
201
195
|
isDev: environment === "dev",
|
package/index.esm.js
CHANGED
|
@@ -4,7 +4,6 @@ import { setContext } from '@apollo/client/link/context';
|
|
|
4
4
|
import { onError } from '@apollo/client/link/error';
|
|
5
5
|
import { removeTypenameFromVariables } from '@apollo/client/link/remove-typename';
|
|
6
6
|
import { useEnvironment, useToken, useErrorHandler, AnalyticsContextProvider, AssetSortingProvider, ConfirmationDialogProvider, EnvironmentContextProvider, ErrorHandlingContextProvider, FilterBarProvider, ModalDialogContextProvider, NavigationContextProvider, OemBrandingContextProvider, ToastProvider, TokenProvider, CurrentUserProvider, CurrentUserPreferenceProvider, UserSubscriptionProvider } from '@trackunit/react-core-hooks';
|
|
7
|
-
import { createUploadLink } from 'apollo-upload-client';
|
|
8
7
|
import * as React from 'react';
|
|
9
8
|
import { useRef, useMemo, useEffect, useState } from 'react';
|
|
10
9
|
import '@js-temporal/polyfill';
|
|
@@ -12,7 +11,7 @@ import { registerTranslations, initializeTranslationsForApp } from '@trackunit/i
|
|
|
12
11
|
import { Spinner } from '@trackunit/react-components';
|
|
13
12
|
import { AnalyticsContextRuntime, setupHostConnector, AssetSortingRuntime, ConfirmationDialogRuntime, EnvironmentRuntime, FilterBarRuntime, ModalDialogRuntime, NavigationRuntime, OemBrandingContextRuntime, ThemeCssRuntime, ToastRuntime, TokenRuntime, CurrentUserRuntime, CurrentUserPreferenceRuntime, UserSubscriptionRuntime } from '@trackunit/iris-app-runtime-core';
|
|
14
13
|
|
|
15
|
-
const createApolloClient = ({ graphqlManagerUrl, graphqlPublicUrl,
|
|
14
|
+
const createApolloClient = ({ graphqlManagerUrl, graphqlPublicUrl, graphqlInternalUrl, graphqlReportUrl, isDev, tracingHeaders, firstToken, errorHandler, }) => {
|
|
16
15
|
let token;
|
|
17
16
|
if (!token) {
|
|
18
17
|
token = firstToken;
|
|
@@ -23,9 +22,6 @@ const createApolloClient = ({ graphqlManagerUrl, graphqlPublicUrl, graphqlManage
|
|
|
23
22
|
const publicGraphQLLink = createHttpLink({
|
|
24
23
|
uri: request => graphqlPublicUrl + "/" + request.operationName,
|
|
25
24
|
});
|
|
26
|
-
const imageUploadGraphQLLink = createUploadLink({
|
|
27
|
-
uri: request => graphqlManagerImageUploadUrl + "/" + request.operationName,
|
|
28
|
-
});
|
|
29
25
|
const internalGraphQLLink = createHttpLink({
|
|
30
26
|
uri: request => graphqlInternalUrl + "/" + request.operationName,
|
|
31
27
|
});
|
|
@@ -151,7 +147,6 @@ const createApolloClient = ({ graphqlManagerUrl, graphqlPublicUrl, graphqlManage
|
|
|
151
147
|
errorLink,
|
|
152
148
|
authLink,
|
|
153
149
|
removeTypenameLink,
|
|
154
|
-
split(operation => operation.getContext().clientName === "imageupload", imageUploadGraphQLLink),
|
|
155
150
|
split(operation => operation.getContext().clientName === "manager", managerGraphQLLink, split(operation => operation.getContext().clientName === "report", reportGraphQLLink, split(() => global.gql === "internal", internalGraphQLLink, publicGraphQLLink))),
|
|
156
151
|
]),
|
|
157
152
|
}),
|
|
@@ -164,7 +159,7 @@ const createApolloClient = ({ graphqlManagerUrl, graphqlPublicUrl, graphqlManage
|
|
|
164
159
|
};
|
|
165
160
|
};
|
|
166
161
|
const useApolloClient = () => {
|
|
167
|
-
const { graphqlManagerUrl, graphqlPublicUrl, graphqlInternalUrl,
|
|
162
|
+
const { graphqlManagerUrl, graphqlPublicUrl, graphqlInternalUrl, graphqlReportUrl, environment, tracingHeaders } = useEnvironment();
|
|
168
163
|
const { token } = useToken();
|
|
169
164
|
const errorHandler = useErrorHandler();
|
|
170
165
|
const clientRef = useRef(null);
|
|
@@ -175,7 +170,6 @@ const useApolloClient = () => {
|
|
|
175
170
|
clientRef.current = createApolloClient({
|
|
176
171
|
graphqlManagerUrl,
|
|
177
172
|
graphqlPublicUrl,
|
|
178
|
-
graphqlManagerImageUploadUrl,
|
|
179
173
|
graphqlInternalUrl,
|
|
180
174
|
graphqlReportUrl,
|
|
181
175
|
isDev: environment === "dev",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-core-contexts",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.673",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -16,8 +16,7 @@
|
|
|
16
16
|
"jest-fetch-mock": "^3.0.3",
|
|
17
17
|
"@trackunit/i18n-library-translation": "*",
|
|
18
18
|
"@trackunit/react-components": "*",
|
|
19
|
-
"@trackunit/iris-app-api": "*"
|
|
20
|
-
"apollo-upload-client": "^17.0.0"
|
|
19
|
+
"@trackunit/iris-app-api": "*"
|
|
21
20
|
},
|
|
22
21
|
"module": "./index.esm.js",
|
|
23
22
|
"main": "./index.cjs.js",
|