@trackunit/react-core-contexts 0.0.21 → 0.0.24

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/README.md CHANGED
@@ -15,7 +15,7 @@ Inside the provider the following hooks from `react-core-hooks` can be used:
15
15
  - Obtain an access token from the `useToken` hook.
16
16
 
17
17
  ## Trackunit
18
- This package was developed by Trackunit ApS.
18
+ This package was developed by Trackunit ApS.
19
19
  Trackunit is the leading SaaS-based IoT solution for the construction industry, offering an ecosystem of hardware, fleet management software & telematics.
20
20
 
21
21
  ![The Trackunit logo](https://trackunit.com/wp-content/uploads/2022/03/top-logo.svg)
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ interface Props {
3
+ children: React.ReactNode;
4
+ }
5
+ export declare const TrackunitRouter: ({ children }: Props) => JSX.Element;
6
+ export {};
package/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from "./ManagerApolloProvider";
2
+ export * from "./toast/ToastProviderApp";
2
3
  export * from "./TrackunitProviders";
package/index.js CHANGED
@@ -3,11 +3,12 @@ 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, EnvironmentContextProvider, TokenProvider, CurrentUserProvider, UserSubscriptionProvider as UserSubscriptionProvider$1 } from '@trackunit/react-core-hooks';
6
+ import { useEnvironment, useToken, ToastProvider, EnvironmentContextProvider, TokenProvider, CurrentUserProvider, UserSubscriptionProvider as UserSubscriptionProvider$1 } from '@trackunit/react-core-hooks';
7
7
  import { createUploadLink } from 'apollo-upload-client';
8
- import { BrowserRouter } from 'react-router-dom';
9
- import { EnvironmentRuntime, TokenRuntime, CurrentUserRuntime, UserSubscriptionRuntime } from '@trackunit/iris-app-runtime-core';
8
+ import { ToastRuntime, EnvironmentRuntime, TokenRuntime, CurrentUserRuntime, UserSubscriptionRuntime } from '@trackunit/iris-app-runtime-core';
10
9
  import * as React from 'react';
10
+ import { useMemo } from 'react';
11
+ import { BrowserRouter } from 'react-router-dom';
11
12
 
12
13
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
13
14
 
@@ -1926,6 +1927,19 @@ const ManagerApolloProvider = ({
1926
1927
  }));
1927
1928
  };
1928
1929
 
1930
+ const ToastProviderApp = ({
1931
+ children
1932
+ }) => {
1933
+ const value = useMemo(() => ({
1934
+ addToast: ToastRuntime.addToast
1935
+ }), []);
1936
+ return jsx(ToastProvider, Object.assign({
1937
+ value: value
1938
+ }, {
1939
+ children: children
1940
+ }));
1941
+ };
1942
+
1929
1943
  var wellKnownSymbol$4 = wellKnownSymbol$c;
1930
1944
  var create$1 = objectCreate;
1931
1945
  var definePropertyModule = objectDefineProperty;
@@ -2440,12 +2454,27 @@ const TrackunitDataProviders = ({
2440
2454
  })
2441
2455
  });
2442
2456
 
2457
+ const TrackunitRouter = ({
2458
+ children
2459
+ }) => {
2460
+ const {
2461
+ publicUrl
2462
+ } = useEnvironment();
2463
+ return jsx(BrowserRouter, Object.assign({
2464
+ basename: publicUrl
2465
+ }, {
2466
+ children: children
2467
+ }));
2468
+ };
2469
+
2443
2470
  const TrackunitProviders = ({
2444
2471
  children
2445
2472
  }) => jsx(TrackunitDataProviders, {
2446
- children: jsx(BrowserRouter, {
2447
- children: children
2473
+ children: jsx(ToastProviderApp, {
2474
+ children: jsx(TrackunitRouter, {
2475
+ children: children
2476
+ })
2448
2477
  })
2449
2478
  });
2450
2479
 
2451
- export { ManagerApolloProvider, TrackunitProviders };
2480
+ export { ManagerApolloProvider, ToastProviderApp, TrackunitProviders };
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@trackunit/react-core-contexts",
3
- "version": "0.0.21",
3
+ "version": "0.0.24",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "MIT",
6
6
  "dependencies": {
7
7
  "graphql": "^15.8.0",
8
- "@trackunit/iris-app-runtime-core": "0.0.49",
9
- "@trackunit/react-core-contexts-api": "0.0.45",
10
- "@trackunit/react-core-hooks": "0.0.48",
8
+ "@trackunit/iris-app-runtime-core": "0.0.51",
9
+ "@trackunit/react-core-contexts-api": "0.0.47",
10
+ "@trackunit/react-core-hooks": "0.0.50",
11
11
  "react": "17.0.1",
12
- "@trackunit/react-core-contexts-test": "0.0.18",
12
+ "@trackunit/react-core-contexts-test": "0.0.20",
13
13
  "@apollo/client": "3.6.9",
14
14
  "@sentry/browser": "^6.19.4",
15
15
  "apollo-upload-client": "^14.1.3",
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ interface Props {
3
+ children: React.ReactNode;
4
+ }
5
+ export declare const ToastProviderApp: ({ children }: Props) => JSX.Element;
6
+ export {};