@trackunit/react-core-contexts 0.0.55 → 0.0.58

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,8 @@ 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';
12
+ import { Spinner } from '@trackunit/react-components';
11
13
  import { BrowserRouter } from 'react-router-dom';
12
14
 
13
15
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -2580,13 +2582,28 @@ const TrackunitRouter = ({
2580
2582
  };
2581
2583
 
2582
2584
  const TrackunitProviders = ({
2585
+ translations,
2583
2586
  children
2584
- }) => jsx(TrackunitDataProviders, {
2585
- children: jsx(ToastProviderApp, {
2586
- children: jsx(TrackunitRouter, {
2587
- children: children
2587
+ }) => {
2588
+ if (translations) {
2589
+ registerTranslations(translations); // Register the apps translations if passed.
2590
+ }
2591
+
2592
+ initializeTranslationsForApp(); // Initialize all registered translations
2593
+
2594
+ return jsx(TrackunitDataProviders, {
2595
+ children: jsx(ToastProviderApp, {
2596
+ children: jsx(React.Suspense, Object.assign({
2597
+ fallback: jsx(Spinner, {
2598
+ centered: true
2599
+ })
2600
+ }, {
2601
+ children: jsx(TrackunitRouter, {
2602
+ children: children
2603
+ })
2604
+ }))
2588
2605
  })
2589
- })
2590
- });
2606
+ });
2607
+ };
2591
2608
 
2592
2609
  export { ManagerApolloProvider, ToastProviderApp, TrackunitProviders };
package/package.json CHANGED
@@ -1,18 +1,20 @@
1
1
  {
2
2
  "name": "@trackunit/react-core-contexts",
3
- "version": "0.0.55",
3
+ "version": "0.0.58",
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",
17
+ "@trackunit/react-components": "0.0.183",
16
18
  "react-router-dom": "6.4.1"
17
19
  },
18
20
  "module": "./index.js",