@trackunit/react-core-contexts 0.4.254 → 0.4.256

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
@@ -30594,7 +30594,7 @@ var createUploadLink = function createUploadLink({
30594
30594
 
30595
30595
  var createUploadLink$1 = createUploadLink;
30596
30596
 
30597
- const createApolloClient = ({ graphqlManagerUrl, graphqlPublicUrl, graphqlManagerImageUploadUrl, graphqlReportUrl, isDev, isIrisApp, tracingHeaders, firstToken, }) => {
30597
+ const createApolloClient = ({ graphqlManagerUrl, graphqlPublicUrl, graphqlManagerImageUploadUrl, graphqlReportUrl, isDev, tracingHeaders, firstToken, }) => {
30598
30598
  let token = firstToken;
30599
30599
  const managerGraphQLLink = createUploadLink$1({
30600
30600
  uri: request => graphqlManagerUrl + "/" + request.operationName,
@@ -30610,8 +30610,12 @@ const createApolloClient = ({ graphqlManagerUrl, graphqlPublicUrl, graphqlManage
30610
30610
  });
30611
30611
  const authLink = setContext$1((_, { headers }) => __awaiter(void 0, void 0, void 0, function* () {
30612
30612
  const newHeaders = Object.assign(Object.assign(Object.assign({}, headers), tracingHeaders), { Authorization: token ? `Bearer ${token}` : null });
30613
- if (isIrisApp) {
30614
- newHeaders["TU-IRIS-APP-ID"] = "this.irisAppId";
30613
+ // remove once the token has this information
30614
+ const irisAppId = global.scope
30615
+ ? global.scope + "/" + global.module
30616
+ : null;
30617
+ if (irisAppId) {
30618
+ newHeaders["TU-IRIS-APP-ID"] = irisAppId;
30615
30619
  }
30616
30620
  return {
30617
30621
  headers: newHeaders,
@@ -30692,7 +30696,7 @@ const createApolloClient = ({ graphqlManagerUrl, graphqlPublicUrl, graphqlManage
30692
30696
  errorLink,
30693
30697
  authLink,
30694
30698
  split(operation => operation.getContext().clientName === "imageupload", imageUploadGraphQLLink),
30695
- split(operation => operation.getContext().clientName === "manager", managerGraphQLLink, split(operation => operation.getContext().clientName === "report", reportGraphQLLink, isIrisApp ? publicGraphQLLink : managerGraphQLLink)),
30699
+ split(operation => operation.getContext().clientName === "manager", managerGraphQLLink, split(operation => operation.getContext().clientName === "report", reportGraphQLLink, publicGraphQLLink)),
30696
30700
  ]),
30697
30701
  }),
30698
30702
  setToken: (newToken) => {
@@ -30703,7 +30707,7 @@ const createApolloClient = ({ graphqlManagerUrl, graphqlPublicUrl, graphqlManage
30703
30707
  },
30704
30708
  };
30705
30709
  };
30706
- const useApolloClient = (isIrisApp) => {
30710
+ const useApolloClient = () => {
30707
30711
  var _a;
30708
30712
  const { graphqlManagerUrl, graphqlPublicUrl, graphqlManagerImageUploadUrl, graphqlReportUrl, isDev, tracingHeaders } = reactCoreHooks.useEnvironment();
30709
30713
  const { isAssuming } = reactCoreHooks.useCurrentUser();
@@ -30725,7 +30729,6 @@ const useApolloClient = (isIrisApp) => {
30725
30729
  graphqlReportUrl,
30726
30730
  isDev,
30727
30731
  tracingHeaders,
30728
- isIrisApp,
30729
30732
  firstToken: token,
30730
30733
  });
30731
30734
  }
@@ -30741,8 +30744,8 @@ const useApolloClient = (isIrisApp) => {
30741
30744
  * @param {IProps} props The props.
30742
30745
  * @returns {JSX.Element} The provider.
30743
30746
  */
30744
- const ManagerApolloProvider = ({ children, isIrisApp }) => {
30745
- const client = useApolloClient(isIrisApp);
30747
+ const ManagerApolloProvider = ({ children }) => {
30748
+ const client = useApolloClient();
30746
30749
  return jsxRuntime.jsx(ApolloProvider, { client: client, children: children });
30747
30750
  };
30748
30751
 
@@ -30991,7 +30994,7 @@ const TrackunitProviders = ({ translations, children }) => {
30991
30994
  i18nLibraryTranslation.registerTranslations(translations); // Register the apps translations if passed.
30992
30995
  }
30993
30996
  i18nLibraryTranslation.initializeTranslationsForApp(); // Initialize all registered translations
30994
- return (jsxRuntime.jsx(EnvironmentProviderIrisApp, { children: jsxRuntime.jsx(TokenProviderIrisApp, { children: jsxRuntime.jsx(CurrentUserProviderIrisApp, { children: jsxRuntime.jsx(UserSubscriptionProviderIrisApp, { children: jsxRuntime.jsx(AnalyticsProviderIrisApp, { children: jsxRuntime.jsx(GlobalSelectionProviderIrisApp, { children: jsxRuntime.jsx(OemBrandingContextProviderIrisApp, { children: jsxRuntime.jsx(AssetSortingProviderIrisApp, { children: jsxRuntime.jsx(ManagerApolloProvider, { isIrisApp: true, children: jsxRuntime.jsx(ToastProviderIrisApp, { children: jsxRuntime.jsx(FilterBarProviderIrisApp, { children: jsxRuntime.jsx(React__namespace.Suspense, { fallback: jsxRuntime.jsx(reactComponents.Spinner, { centering: "centered" }), children: jsxRuntime.jsx(TrackunitRouterIrisApp, { children: children }) }) }) }) }) }) }) }) }) }) }) }) }));
30997
+ return (jsxRuntime.jsx(EnvironmentProviderIrisApp, { children: jsxRuntime.jsx(TokenProviderIrisApp, { children: jsxRuntime.jsx(CurrentUserProviderIrisApp, { children: jsxRuntime.jsx(UserSubscriptionProviderIrisApp, { children: jsxRuntime.jsx(AnalyticsProviderIrisApp, { children: jsxRuntime.jsx(GlobalSelectionProviderIrisApp, { children: jsxRuntime.jsx(OemBrandingContextProviderIrisApp, { children: jsxRuntime.jsx(AssetSortingProviderIrisApp, { children: jsxRuntime.jsx(ManagerApolloProvider, { children: jsxRuntime.jsx(ToastProviderIrisApp, { children: jsxRuntime.jsx(FilterBarProviderIrisApp, { children: jsxRuntime.jsx(React__namespace.Suspense, { fallback: jsxRuntime.jsx(reactComponents.Spinner, { centering: "centered" }), children: jsxRuntime.jsx(TrackunitRouterIrisApp, { children: children }) }) }) }) }) }) }) }) }) }) }) }) }));
30995
30998
  };
30996
30999
 
30997
31000
  exports.ManagerApolloProvider = ManagerApolloProvider;
package/index.esm.js CHANGED
@@ -30571,7 +30571,7 @@ var createUploadLink = function createUploadLink({
30571
30571
 
30572
30572
  var createUploadLink$1 = createUploadLink;
30573
30573
 
30574
- const createApolloClient = ({ graphqlManagerUrl, graphqlPublicUrl, graphqlManagerImageUploadUrl, graphqlReportUrl, isDev, isIrisApp, tracingHeaders, firstToken, }) => {
30574
+ const createApolloClient = ({ graphqlManagerUrl, graphqlPublicUrl, graphqlManagerImageUploadUrl, graphqlReportUrl, isDev, tracingHeaders, firstToken, }) => {
30575
30575
  let token = firstToken;
30576
30576
  const managerGraphQLLink = createUploadLink$1({
30577
30577
  uri: request => graphqlManagerUrl + "/" + request.operationName,
@@ -30587,8 +30587,12 @@ const createApolloClient = ({ graphqlManagerUrl, graphqlPublicUrl, graphqlManage
30587
30587
  });
30588
30588
  const authLink = setContext$1((_, { headers }) => __awaiter(void 0, void 0, void 0, function* () {
30589
30589
  const newHeaders = Object.assign(Object.assign(Object.assign({}, headers), tracingHeaders), { Authorization: token ? `Bearer ${token}` : null });
30590
- if (isIrisApp) {
30591
- newHeaders["TU-IRIS-APP-ID"] = "this.irisAppId";
30590
+ // remove once the token has this information
30591
+ const irisAppId = global.scope
30592
+ ? global.scope + "/" + global.module
30593
+ : null;
30594
+ if (irisAppId) {
30595
+ newHeaders["TU-IRIS-APP-ID"] = irisAppId;
30592
30596
  }
30593
30597
  return {
30594
30598
  headers: newHeaders,
@@ -30669,7 +30673,7 @@ const createApolloClient = ({ graphqlManagerUrl, graphqlPublicUrl, graphqlManage
30669
30673
  errorLink,
30670
30674
  authLink,
30671
30675
  split(operation => operation.getContext().clientName === "imageupload", imageUploadGraphQLLink),
30672
- split(operation => operation.getContext().clientName === "manager", managerGraphQLLink, split(operation => operation.getContext().clientName === "report", reportGraphQLLink, isIrisApp ? publicGraphQLLink : managerGraphQLLink)),
30676
+ split(operation => operation.getContext().clientName === "manager", managerGraphQLLink, split(operation => operation.getContext().clientName === "report", reportGraphQLLink, publicGraphQLLink)),
30673
30677
  ]),
30674
30678
  }),
30675
30679
  setToken: (newToken) => {
@@ -30680,7 +30684,7 @@ const createApolloClient = ({ graphqlManagerUrl, graphqlPublicUrl, graphqlManage
30680
30684
  },
30681
30685
  };
30682
30686
  };
30683
- const useApolloClient = (isIrisApp) => {
30687
+ const useApolloClient = () => {
30684
30688
  var _a;
30685
30689
  const { graphqlManagerUrl, graphqlPublicUrl, graphqlManagerImageUploadUrl, graphqlReportUrl, isDev, tracingHeaders } = useEnvironment();
30686
30690
  const { isAssuming } = useCurrentUser();
@@ -30702,7 +30706,6 @@ const useApolloClient = (isIrisApp) => {
30702
30706
  graphqlReportUrl,
30703
30707
  isDev,
30704
30708
  tracingHeaders,
30705
- isIrisApp,
30706
30709
  firstToken: token,
30707
30710
  });
30708
30711
  }
@@ -30718,8 +30721,8 @@ const useApolloClient = (isIrisApp) => {
30718
30721
  * @param {IProps} props The props.
30719
30722
  * @returns {JSX.Element} The provider.
30720
30723
  */
30721
- const ManagerApolloProvider = ({ children, isIrisApp }) => {
30722
- const client = useApolloClient(isIrisApp);
30724
+ const ManagerApolloProvider = ({ children }) => {
30725
+ const client = useApolloClient();
30723
30726
  return jsx(ApolloProvider, { client: client, children: children });
30724
30727
  };
30725
30728
 
@@ -30968,7 +30971,7 @@ const TrackunitProviders = ({ translations, children }) => {
30968
30971
  registerTranslations(translations); // Register the apps translations if passed.
30969
30972
  }
30970
30973
  initializeTranslationsForApp(); // Initialize all registered translations
30971
- return (jsx(EnvironmentProviderIrisApp, { children: jsx(TokenProviderIrisApp, { children: jsx(CurrentUserProviderIrisApp, { children: jsx(UserSubscriptionProviderIrisApp, { children: jsx(AnalyticsProviderIrisApp, { children: jsx(GlobalSelectionProviderIrisApp, { children: jsx(OemBrandingContextProviderIrisApp, { children: jsx(AssetSortingProviderIrisApp, { children: jsx(ManagerApolloProvider, { isIrisApp: true, children: jsx(ToastProviderIrisApp, { children: jsx(FilterBarProviderIrisApp, { children: jsx(React.Suspense, { fallback: jsx(Spinner, { centering: "centered" }), children: jsx(TrackunitRouterIrisApp, { children: children }) }) }) }) }) }) }) }) }) }) }) }) }));
30974
+ return (jsx(EnvironmentProviderIrisApp, { children: jsx(TokenProviderIrisApp, { children: jsx(CurrentUserProviderIrisApp, { children: jsx(UserSubscriptionProviderIrisApp, { children: jsx(AnalyticsProviderIrisApp, { children: jsx(GlobalSelectionProviderIrisApp, { children: jsx(OemBrandingContextProviderIrisApp, { children: jsx(AssetSortingProviderIrisApp, { children: jsx(ManagerApolloProvider, { children: jsx(ToastProviderIrisApp, { children: jsx(FilterBarProviderIrisApp, { children: jsx(React.Suspense, { fallback: jsx(Spinner, { centering: "centered" }), children: jsx(TrackunitRouterIrisApp, { children: children }) }) }) }) }) }) }) }) }) }) }) }) }));
30972
30975
  };
30973
30976
 
30974
30977
  export { ManagerApolloProvider, ToastProviderIrisApp, TrackunitProviders };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-core-contexts",
3
- "version": "0.4.254",
3
+ "version": "0.4.256",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -11,12 +11,12 @@
11
11
  "@apollo/client": "3.7.10",
12
12
  "@js-temporal/polyfill": "0.4.3",
13
13
  "@sentry/browser": "7.57.0",
14
- "@trackunit/i18n-library-translation": "0.0.77",
15
- "@trackunit/iris-app-runtime-core": "0.3.75",
16
- "@trackunit/react-components": "0.1.157",
14
+ "@trackunit/i18n-library-translation": "0.0.78",
15
+ "@trackunit/iris-app-runtime-core": "0.3.76",
16
+ "@trackunit/react-components": "0.1.158",
17
17
  "@trackunit/react-core-contexts-api": "0.2.57",
18
- "@trackunit/react-core-contexts-test": "0.1.107",
19
- "@trackunit/react-core-hooks": "0.2.93",
18
+ "@trackunit/react-core-contexts-test": "0.1.108",
19
+ "@trackunit/react-core-hooks": "0.2.94",
20
20
  "apollo-upload-client": "17.0.0",
21
21
  "react": "18.2.0",
22
22
  "react-router-dom": "6.11.2"
@@ -1,7 +1,6 @@
1
1
  import * as React from "react";
2
2
  interface IProps {
3
3
  children: React.ReactNode;
4
- isIrisApp?: boolean;
5
4
  }
6
5
  /**
7
6
  * This is a provider for the ManagerApolloContext.
@@ -10,5 +9,5 @@ interface IProps {
10
9
  * @param {IProps} props The props.
11
10
  * @returns {JSX.Element} The provider.
12
11
  */
13
- export declare const ManagerApolloProvider: ({ children, isIrisApp }: IProps) => JSX.Element;
12
+ export declare const ManagerApolloProvider: ({ children }: IProps) => JSX.Element;
14
13
  export {};