@trackunit/react-core-contexts 0.4.137 → 0.4.139
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 +22 -1
- package/index.js +24 -3
- package/package.json +6 -6
- package/src/analytics/AnalyticsProvider.d.ts +10 -0
package/index.cjs
CHANGED
|
@@ -186,6 +186,27 @@ const ToastProviderApp = ({ children }) => {
|
|
|
186
186
|
return jsxRuntime.jsx(reactCoreHooks.ToastProvider, Object.assign({ value: value }, { children: children }));
|
|
187
187
|
};
|
|
188
188
|
|
|
189
|
+
/**
|
|
190
|
+
* This is a provider for the AnalyticsProvider.
|
|
191
|
+
*/
|
|
192
|
+
const AnalyticsProvider = ({ children }) => {
|
|
193
|
+
const contextValue = React.useMemo(() => ({
|
|
194
|
+
logPageView: details => {
|
|
195
|
+
irisAppRuntimeCore.AnalyticsContextRuntime.logPageView(details);
|
|
196
|
+
},
|
|
197
|
+
logEvent: (eventName, details, nameSupplement) => {
|
|
198
|
+
irisAppRuntimeCore.AnalyticsContextRuntime.logEvent(eventName, details, nameSupplement);
|
|
199
|
+
},
|
|
200
|
+
logError: details => {
|
|
201
|
+
irisAppRuntimeCore.AnalyticsContextRuntime.logError(details);
|
|
202
|
+
},
|
|
203
|
+
setUserProperty: (name, value) => {
|
|
204
|
+
irisAppRuntimeCore.AnalyticsContextRuntime.setUserProperty(name, value);
|
|
205
|
+
},
|
|
206
|
+
}), []);
|
|
207
|
+
return jsxRuntime.jsx(reactCoreHooks.AnalyticsContextProvider, Object.assign({ value: contextValue }, { children: children }));
|
|
208
|
+
};
|
|
209
|
+
|
|
189
210
|
/**
|
|
190
211
|
* Subscribe to methods initiated by changes in the host
|
|
191
212
|
*
|
|
@@ -329,7 +350,7 @@ const UserSubscriptionProvider = ({ children }) => {
|
|
|
329
350
|
/**
|
|
330
351
|
* This is a provider for the TrackunitDataProviders.
|
|
331
352
|
*/
|
|
332
|
-
const TrackunitDataProviders = ({ children }) => (jsxRuntime.jsx(TileEnvironmentProvider, { children: jsxRuntime.jsx(TileTokenProvider, { children: jsxRuntime.jsx(TileCurrentUserProvider, { children: jsxRuntime.jsx(UserSubscriptionProvider, { children: jsxRuntime.jsx(TileGlobalSelectionProvider, { children: jsxRuntime.jsx(TileAssetSortingProvider, { children: jsxRuntime.jsx(ManagerApolloProvider, Object.assign({ isIrisApp: true }, { children: children })) }) }) }) }) }) }));
|
|
353
|
+
const TrackunitDataProviders = ({ children }) => (jsxRuntime.jsx(TileEnvironmentProvider, { children: jsxRuntime.jsx(TileTokenProvider, { children: jsxRuntime.jsx(TileCurrentUserProvider, { children: jsxRuntime.jsx(UserSubscriptionProvider, { children: jsxRuntime.jsx(AnalyticsProvider, { children: jsxRuntime.jsx(TileGlobalSelectionProvider, { children: jsxRuntime.jsx(TileAssetSortingProvider, { children: jsxRuntime.jsx(ManagerApolloProvider, Object.assign({ isIrisApp: true }, { children: children })) }) }) }) }) }) }) }));
|
|
333
354
|
|
|
334
355
|
const HostNavigator = ({ children }) => {
|
|
335
356
|
reactCoreHooks.useURLSynchronization();
|
package/index.js
CHANGED
|
@@ -3,11 +3,11 @@ import { ApolloClient, InMemoryCache, from, split, ApolloProvider } from '@apoll
|
|
|
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, ToastProvider, AssetSortingProvider, EnvironmentContextProvider, GlobalSelectionProvider, TokenProvider, CurrentUserProvider, UserSubscriptionProvider as UserSubscriptionProvider$1, useURLSynchronization } from '@trackunit/react-core-hooks';
|
|
6
|
+
import { useEnvironment, useToken, ToastProvider, AnalyticsContextProvider, AssetSortingProvider, EnvironmentContextProvider, GlobalSelectionProvider, TokenProvider, CurrentUserProvider, UserSubscriptionProvider as UserSubscriptionProvider$1, useURLSynchronization } from '@trackunit/react-core-hooks';
|
|
7
7
|
import { createUploadLink } from 'apollo-upload-client';
|
|
8
8
|
import * as React from 'react';
|
|
9
9
|
import { useMemo, useEffect, useState } from 'react';
|
|
10
|
-
import { ToastRuntime, setupHostConnector, AssetSortingRuntime, EnvironmentRuntime, GlobalSelectionRuntime, TokenRuntime, CurrentUserRuntime, UserSubscriptionRuntime } from '@trackunit/iris-app-runtime-core';
|
|
10
|
+
import { ToastRuntime, AnalyticsContextRuntime, setupHostConnector, AssetSortingRuntime, EnvironmentRuntime, GlobalSelectionRuntime, TokenRuntime, CurrentUserRuntime, UserSubscriptionRuntime } from '@trackunit/iris-app-runtime-core';
|
|
11
11
|
import '@js-temporal/polyfill';
|
|
12
12
|
import { registerTranslations, initializeTranslationsForApp } from '@trackunit/i18n-library-translation';
|
|
13
13
|
import { Spinner } from '@trackunit/react-components';
|
|
@@ -162,6 +162,27 @@ const ToastProviderApp = ({ children }) => {
|
|
|
162
162
|
return jsx(ToastProvider, Object.assign({ value: value }, { children: children }));
|
|
163
163
|
};
|
|
164
164
|
|
|
165
|
+
/**
|
|
166
|
+
* This is a provider for the AnalyticsProvider.
|
|
167
|
+
*/
|
|
168
|
+
const AnalyticsProvider = ({ children }) => {
|
|
169
|
+
const contextValue = useMemo(() => ({
|
|
170
|
+
logPageView: details => {
|
|
171
|
+
AnalyticsContextRuntime.logPageView(details);
|
|
172
|
+
},
|
|
173
|
+
logEvent: (eventName, details, nameSupplement) => {
|
|
174
|
+
AnalyticsContextRuntime.logEvent(eventName, details, nameSupplement);
|
|
175
|
+
},
|
|
176
|
+
logError: details => {
|
|
177
|
+
AnalyticsContextRuntime.logError(details);
|
|
178
|
+
},
|
|
179
|
+
setUserProperty: (name, value) => {
|
|
180
|
+
AnalyticsContextRuntime.setUserProperty(name, value);
|
|
181
|
+
},
|
|
182
|
+
}), []);
|
|
183
|
+
return jsx(AnalyticsContextProvider, Object.assign({ value: contextValue }, { children: children }));
|
|
184
|
+
};
|
|
185
|
+
|
|
165
186
|
/**
|
|
166
187
|
* Subscribe to methods initiated by changes in the host
|
|
167
188
|
*
|
|
@@ -305,7 +326,7 @@ const UserSubscriptionProvider = ({ children }) => {
|
|
|
305
326
|
/**
|
|
306
327
|
* This is a provider for the TrackunitDataProviders.
|
|
307
328
|
*/
|
|
308
|
-
const TrackunitDataProviders = ({ children }) => (jsx(TileEnvironmentProvider, { children: jsx(TileTokenProvider, { children: jsx(TileCurrentUserProvider, { children: jsx(UserSubscriptionProvider, { children: jsx(TileGlobalSelectionProvider, { children: jsx(TileAssetSortingProvider, { children: jsx(ManagerApolloProvider, Object.assign({ isIrisApp: true }, { children: children })) }) }) }) }) }) }));
|
|
329
|
+
const TrackunitDataProviders = ({ children }) => (jsx(TileEnvironmentProvider, { children: jsx(TileTokenProvider, { children: jsx(TileCurrentUserProvider, { children: jsx(UserSubscriptionProvider, { children: jsx(AnalyticsProvider, { children: jsx(TileGlobalSelectionProvider, { children: jsx(TileAssetSortingProvider, { children: jsx(ManagerApolloProvider, Object.assign({ isIrisApp: true }, { children: children })) }) }) }) }) }) }) }));
|
|
309
330
|
|
|
310
331
|
const HostNavigator = ({ children }) => {
|
|
311
332
|
useURLSynchronization();
|
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.139",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"dependencies": {
|
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
"@js-temporal/polyfill": "0.4.3",
|
|
10
10
|
"@sentry/browser": "7.50.0",
|
|
11
11
|
"@trackunit/i18n-library-translation": "0.0.46",
|
|
12
|
-
"@trackunit/iris-app-runtime-core": "0.3.
|
|
13
|
-
"@trackunit/react-components": "0.1.
|
|
14
|
-
"@trackunit/react-core-contexts-api": "0.2.
|
|
15
|
-
"@trackunit/react-core-contexts-test": "0.1.
|
|
16
|
-
"@trackunit/react-core-hooks": "0.2.
|
|
12
|
+
"@trackunit/iris-app-runtime-core": "0.3.39",
|
|
13
|
+
"@trackunit/react-components": "0.1.90",
|
|
14
|
+
"@trackunit/react-core-contexts-api": "0.2.30",
|
|
15
|
+
"@trackunit/react-core-contexts-test": "0.1.57",
|
|
16
|
+
"@trackunit/react-core-hooks": "0.2.52",
|
|
17
17
|
"apollo-upload-client": "17.0.0",
|
|
18
18
|
"react": "18.2.0",
|
|
19
19
|
"react-router-dom": "6.4.5"
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
interface Props {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
allowAnalytics?: boolean;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* This is a provider for the AnalyticsProvider.
|
|
8
|
+
*/
|
|
9
|
+
declare const AnalyticsProvider: ({ children }: Props) => JSX.Element;
|
|
10
|
+
export default AnalyticsProvider;
|