@trackunit/react-core-contexts 0.0.55 → 0.0.57

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.
@@ -1,6 +1,8 @@
1
+ import { TranslationResource } from "@trackunit/i18n-library-translation";
1
2
  import * as React from "react";
2
- interface Props {
3
+ export interface TrackunitProvidersProps {
4
+ /** A translation resource for the App extensions to be registered before initialization */
5
+ translations?: TranslationResource<string>;
3
6
  children: React.ReactNode;
4
7
  }
5
- export declare const TrackunitProviders: ({ children }: Props) => JSX.Element;
6
- export {};
8
+ export declare const TrackunitProviders: ({ translations, children }: TrackunitProvidersProps) => JSX.Element;
package/index.js CHANGED
@@ -8,6 +8,7 @@ import { createUploadLink } from 'apollo-upload-client';
8
8
  import { ToastRuntime, EnvironmentRuntime, TokenRuntime, CurrentUserRuntime, UserSubscriptionRuntime } from '@trackunit/iris-app-runtime-core';
9
9
  import * as React from 'react';
10
10
  import { useMemo } from 'react';
11
+ import { registerTranslations, initializeTranslationsForApp } from '@trackunit/i18n-library-translation';
11
12
  import { BrowserRouter } from 'react-router-dom';
12
13
 
13
14
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -2580,13 +2581,22 @@ const TrackunitRouter = ({
2580
2581
  };
2581
2582
 
2582
2583
  const TrackunitProviders = ({
2584
+ translations,
2583
2585
  children
2584
- }) => jsx(TrackunitDataProviders, {
2585
- children: jsx(ToastProviderApp, {
2586
- children: jsx(TrackunitRouter, {
2587
- children: children
2586
+ }) => {
2587
+ if (translations) {
2588
+ registerTranslations(translations); // Register the apps translations if passed.
2589
+ }
2590
+
2591
+ initializeTranslationsForApp(); // Initialize all registered translations
2592
+
2593
+ return jsx(TrackunitDataProviders, {
2594
+ children: jsx(ToastProviderApp, {
2595
+ children: jsx(TrackunitRouter, {
2596
+ children: children
2597
+ })
2588
2598
  })
2589
- })
2590
- });
2599
+ });
2600
+ };
2591
2601
 
2592
2602
  export { ManagerApolloProvider, ToastProviderApp, TrackunitProviders };
package/package.json CHANGED
@@ -1,18 +1,19 @@
1
1
  {
2
2
  "name": "@trackunit/react-core-contexts",
3
- "version": "0.0.55",
3
+ "version": "0.0.57",
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.0.77",
9
- "@trackunit/react-core-contexts-api": "0.0.67",
10
- "@trackunit/react-core-hooks": "0.0.76",
8
+ "@trackunit/iris-app-runtime-core": "0.0.78",
9
+ "@trackunit/react-core-contexts-api": "0.0.68",
10
+ "@trackunit/react-core-hooks": "0.0.77",
11
11
  "react": "17.0.2",
12
- "@trackunit/react-core-contexts-test": "0.0.48",
12
+ "@trackunit/react-core-contexts-test": "0.0.49",
13
13
  "@apollo/client": "3.6.9",
14
14
  "@sentry/browser": "^7.15.0",
15
15
  "apollo-upload-client": "^14.1.3",
16
+ "@trackunit/i18n-library-translation": "0.0.2",
16
17
  "react-router-dom": "6.4.1"
17
18
  },
18
19
  "module": "./index.js",