@trackunit/react-core-contexts 0.4.105 → 0.4.108
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 +37 -0
- package/index.js +37 -0
- package/package.json +7 -7
- package/src/ManagerApolloProvider.d.ts +7 -0
- package/src/TrackunitDataProviders.d.ts +3 -0
- package/src/TrackunitProviders.d.ts +3 -0
- package/src/TrackunitRouter.d.ts +3 -0
- package/src/UserSubscriptionProvider.d.ts +3 -0
- package/src/assetSorting/TileAssetSortingProvider.d.ts +3 -0
- package/src/developerSettings/IrisAppDeveloperSettingsContext.d.ts +3 -0
- package/src/environment/TileEnvironmentProvider.d.ts +3 -0
- package/src/global-selection/TileGlobalSelectionProvider.d.ts +3 -0
- package/src/toast/ToastProviderApp.d.ts +3 -0
- package/src/token/TileTokenProvider.d.ts +3 -0
- package/src/user/TileCurrentUserProvider.d.ts +3 -0
package/index.cjs
CHANGED
|
@@ -61,6 +61,13 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
/**
|
|
65
|
+
* This is a provider for the ManagerApolloContext.
|
|
66
|
+
* It is used to provide the apollo client to the manager app.
|
|
67
|
+
*
|
|
68
|
+
* @param {IProps} props The props.
|
|
69
|
+
* @returns {JSX.Element} The provider.
|
|
70
|
+
*/
|
|
64
71
|
const ManagerApolloProvider = ({ children, isIrisApp }) => {
|
|
65
72
|
const { publicUrl, graphqlLegacyUrl, graphqlManagerUrl, graphqlPublicUrl, graphqlManagerImageUploadUrl, graphqlReportUrl, isDev, tracingHeaders, } = reactCoreHooks.useEnvironment();
|
|
66
73
|
const { token } = reactCoreHooks.useToken();
|
|
@@ -162,6 +169,9 @@ const ManagerApolloProvider = ({ children, isIrisApp }) => {
|
|
|
162
169
|
return jsxRuntime.jsx(client.ApolloProvider, Object.assign({ client: client$1 }, { children: children }));
|
|
163
170
|
};
|
|
164
171
|
|
|
172
|
+
/**
|
|
173
|
+
* This is a provider for the ToastContext.
|
|
174
|
+
*/
|
|
165
175
|
const ToastProviderApp = ({ children }) => {
|
|
166
176
|
const value = React.useMemo(() => ({ addToast: irisAppRuntimeCore.ToastRuntime.addToast }), []);
|
|
167
177
|
return jsxRuntime.jsx(reactCoreHooks.ToastProvider, Object.assign({ value: value }, { children: children }));
|
|
@@ -181,6 +191,9 @@ const useSubscribeToHostChanges = (methods) => {
|
|
|
181
191
|
}, [methods]);
|
|
182
192
|
};
|
|
183
193
|
|
|
194
|
+
/**
|
|
195
|
+
* This is a provider for the AssetSortingContext.
|
|
196
|
+
*/
|
|
184
197
|
const TileAssetSortingProvider = ({ children }) => {
|
|
185
198
|
const [assetSortingState, setAssetSortingState] = React.useState(null);
|
|
186
199
|
React.useEffect(() => {
|
|
@@ -202,6 +215,9 @@ const TileAssetSortingProvider = ({ children }) => {
|
|
|
202
215
|
return jsxRuntime.jsx(reactCoreHooks.AssetSortingProvider, Object.assign({ value: contextValue }, { children: children }));
|
|
203
216
|
};
|
|
204
217
|
|
|
218
|
+
/**
|
|
219
|
+
* This is a provider for the EnvironmentContext.
|
|
220
|
+
*/
|
|
205
221
|
const TileEnvironmentProvider = ({ children }) => {
|
|
206
222
|
const [environment, setEnvironment] = React__namespace.useState(null);
|
|
207
223
|
React__namespace.useEffect(() => {
|
|
@@ -223,6 +239,9 @@ const TileEnvironmentProvider = ({ children }) => {
|
|
|
223
239
|
return jsxRuntime.jsx(reactCoreHooks.EnvironmentContextProvider, Object.assign({ value: environment }, { children: children }));
|
|
224
240
|
};
|
|
225
241
|
|
|
242
|
+
/**
|
|
243
|
+
* This is a provider for the GlobalSelectionContext.
|
|
244
|
+
*/
|
|
226
245
|
const TileGlobalSelectionProvider = ({ children }) => {
|
|
227
246
|
const [GlobalSelectionContext, setGlobalSelectionContext] = React.useState(null);
|
|
228
247
|
React.useEffect(() => {
|
|
@@ -240,6 +259,9 @@ const TileGlobalSelectionProvider = ({ children }) => {
|
|
|
240
259
|
return jsxRuntime.jsx(reactCoreHooks.GlobalSelectionProvider, Object.assign({ value: GlobalSelectionContext }, { children: children }));
|
|
241
260
|
};
|
|
242
261
|
|
|
262
|
+
/**
|
|
263
|
+
* This is a provider for the TokenContext.
|
|
264
|
+
*/
|
|
243
265
|
const TileTokenProvider = ({ children }) => {
|
|
244
266
|
const [tokenContext, setTokenContext] = React__namespace.useState(null);
|
|
245
267
|
React__namespace.useEffect(() => {
|
|
@@ -263,6 +285,9 @@ const TileTokenProvider = ({ children }) => {
|
|
|
263
285
|
return jsxRuntime.jsx(reactCoreHooks.TokenProvider, Object.assign({ value: tokenContext }, { children: children }));
|
|
264
286
|
};
|
|
265
287
|
|
|
288
|
+
/**
|
|
289
|
+
* This is a provider for the CurrentUserContext.
|
|
290
|
+
*/
|
|
266
291
|
const TileCurrentUserProvider = ({ children }) => {
|
|
267
292
|
const [currentuserContext, setCurrentUserContext] = React__namespace.useState(null);
|
|
268
293
|
React__namespace.useEffect(() => {
|
|
@@ -276,6 +301,9 @@ const TileCurrentUserProvider = ({ children }) => {
|
|
|
276
301
|
return jsxRuntime.jsx(reactCoreHooks.CurrentUserProvider, Object.assign({ value: currentuserContext }, { children: children }));
|
|
277
302
|
};
|
|
278
303
|
|
|
304
|
+
/**
|
|
305
|
+
* This is a provider for the UserSubscriptionContext.
|
|
306
|
+
*/
|
|
279
307
|
const UserSubscriptionProvider = ({ children }) => {
|
|
280
308
|
const [subscription, setSubscription] = React__namespace.useState(null);
|
|
281
309
|
React__namespace.useEffect(() => {
|
|
@@ -289,6 +317,9 @@ const UserSubscriptionProvider = ({ children }) => {
|
|
|
289
317
|
return jsxRuntime.jsx(reactCoreHooks.UserSubscriptionProvider, Object.assign({ value: subscription }, { children: children }));
|
|
290
318
|
};
|
|
291
319
|
|
|
320
|
+
/**
|
|
321
|
+
* This is a provider for the TrackunitDataProviders.
|
|
322
|
+
*/
|
|
292
323
|
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 })) }) }) }) }) }) }));
|
|
293
324
|
|
|
294
325
|
const HostNavigator = ({ children }) => {
|
|
@@ -296,11 +327,17 @@ const HostNavigator = ({ children }) => {
|
|
|
296
327
|
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
297
328
|
return jsxRuntime.jsx(jsxRuntime.Fragment, { children: children });
|
|
298
329
|
};
|
|
330
|
+
/**
|
|
331
|
+
* This is a router for the Trackunit app.
|
|
332
|
+
*/
|
|
299
333
|
const TrackunitRouter = ({ children }) => {
|
|
300
334
|
var _a;
|
|
301
335
|
return (jsxRuntime.jsx(reactRouterDom.BrowserRouter, Object.assign({ basename: `${((_a = document.getElementById("baseHref")) === null || _a === void 0 ? void 0 : _a.getAttribute("href")) || "<missing baseHref>"}${global.module}` }, { children: jsxRuntime.jsx(HostNavigator, { children: children }) })));
|
|
302
336
|
};
|
|
303
337
|
|
|
338
|
+
/**
|
|
339
|
+
* This is a provider for the TrackunitDataProviders.
|
|
340
|
+
*/
|
|
304
341
|
const TrackunitProviders = ({ translations, children }) => {
|
|
305
342
|
if (translations) {
|
|
306
343
|
i18nLibraryTranslation.registerTranslations(translations); // Register the apps translations if passed.
|
package/index.js
CHANGED
|
@@ -37,6 +37,13 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
/**
|
|
41
|
+
* This is a provider for the ManagerApolloContext.
|
|
42
|
+
* It is used to provide the apollo client to the manager app.
|
|
43
|
+
*
|
|
44
|
+
* @param {IProps} props The props.
|
|
45
|
+
* @returns {JSX.Element} The provider.
|
|
46
|
+
*/
|
|
40
47
|
const ManagerApolloProvider = ({ children, isIrisApp }) => {
|
|
41
48
|
const { publicUrl, graphqlLegacyUrl, graphqlManagerUrl, graphqlPublicUrl, graphqlManagerImageUploadUrl, graphqlReportUrl, isDev, tracingHeaders, } = useEnvironment();
|
|
42
49
|
const { token } = useToken();
|
|
@@ -138,6 +145,9 @@ const ManagerApolloProvider = ({ children, isIrisApp }) => {
|
|
|
138
145
|
return jsx(ApolloProvider, Object.assign({ client: client }, { children: children }));
|
|
139
146
|
};
|
|
140
147
|
|
|
148
|
+
/**
|
|
149
|
+
* This is a provider for the ToastContext.
|
|
150
|
+
*/
|
|
141
151
|
const ToastProviderApp = ({ children }) => {
|
|
142
152
|
const value = useMemo(() => ({ addToast: ToastRuntime.addToast }), []);
|
|
143
153
|
return jsx(ToastProvider, Object.assign({ value: value }, { children: children }));
|
|
@@ -157,6 +167,9 @@ const useSubscribeToHostChanges = (methods) => {
|
|
|
157
167
|
}, [methods]);
|
|
158
168
|
};
|
|
159
169
|
|
|
170
|
+
/**
|
|
171
|
+
* This is a provider for the AssetSortingContext.
|
|
172
|
+
*/
|
|
160
173
|
const TileAssetSortingProvider = ({ children }) => {
|
|
161
174
|
const [assetSortingState, setAssetSortingState] = useState(null);
|
|
162
175
|
useEffect(() => {
|
|
@@ -178,6 +191,9 @@ const TileAssetSortingProvider = ({ children }) => {
|
|
|
178
191
|
return jsx(AssetSortingProvider, Object.assign({ value: contextValue }, { children: children }));
|
|
179
192
|
};
|
|
180
193
|
|
|
194
|
+
/**
|
|
195
|
+
* This is a provider for the EnvironmentContext.
|
|
196
|
+
*/
|
|
181
197
|
const TileEnvironmentProvider = ({ children }) => {
|
|
182
198
|
const [environment, setEnvironment] = React.useState(null);
|
|
183
199
|
React.useEffect(() => {
|
|
@@ -199,6 +215,9 @@ const TileEnvironmentProvider = ({ children }) => {
|
|
|
199
215
|
return jsx(EnvironmentContextProvider, Object.assign({ value: environment }, { children: children }));
|
|
200
216
|
};
|
|
201
217
|
|
|
218
|
+
/**
|
|
219
|
+
* This is a provider for the GlobalSelectionContext.
|
|
220
|
+
*/
|
|
202
221
|
const TileGlobalSelectionProvider = ({ children }) => {
|
|
203
222
|
const [GlobalSelectionContext, setGlobalSelectionContext] = useState(null);
|
|
204
223
|
useEffect(() => {
|
|
@@ -216,6 +235,9 @@ const TileGlobalSelectionProvider = ({ children }) => {
|
|
|
216
235
|
return jsx(GlobalSelectionProvider, Object.assign({ value: GlobalSelectionContext }, { children: children }));
|
|
217
236
|
};
|
|
218
237
|
|
|
238
|
+
/**
|
|
239
|
+
* This is a provider for the TokenContext.
|
|
240
|
+
*/
|
|
219
241
|
const TileTokenProvider = ({ children }) => {
|
|
220
242
|
const [tokenContext, setTokenContext] = React.useState(null);
|
|
221
243
|
React.useEffect(() => {
|
|
@@ -239,6 +261,9 @@ const TileTokenProvider = ({ children }) => {
|
|
|
239
261
|
return jsx(TokenProvider, Object.assign({ value: tokenContext }, { children: children }));
|
|
240
262
|
};
|
|
241
263
|
|
|
264
|
+
/**
|
|
265
|
+
* This is a provider for the CurrentUserContext.
|
|
266
|
+
*/
|
|
242
267
|
const TileCurrentUserProvider = ({ children }) => {
|
|
243
268
|
const [currentuserContext, setCurrentUserContext] = React.useState(null);
|
|
244
269
|
React.useEffect(() => {
|
|
@@ -252,6 +277,9 @@ const TileCurrentUserProvider = ({ children }) => {
|
|
|
252
277
|
return jsx(CurrentUserProvider, Object.assign({ value: currentuserContext }, { children: children }));
|
|
253
278
|
};
|
|
254
279
|
|
|
280
|
+
/**
|
|
281
|
+
* This is a provider for the UserSubscriptionContext.
|
|
282
|
+
*/
|
|
255
283
|
const UserSubscriptionProvider = ({ children }) => {
|
|
256
284
|
const [subscription, setSubscription] = React.useState(null);
|
|
257
285
|
React.useEffect(() => {
|
|
@@ -265,6 +293,9 @@ const UserSubscriptionProvider = ({ children }) => {
|
|
|
265
293
|
return jsx(UserSubscriptionProvider$1, Object.assign({ value: subscription }, { children: children }));
|
|
266
294
|
};
|
|
267
295
|
|
|
296
|
+
/**
|
|
297
|
+
* This is a provider for the TrackunitDataProviders.
|
|
298
|
+
*/
|
|
268
299
|
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 })) }) }) }) }) }) }));
|
|
269
300
|
|
|
270
301
|
const HostNavigator = ({ children }) => {
|
|
@@ -272,11 +303,17 @@ const HostNavigator = ({ children }) => {
|
|
|
272
303
|
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
273
304
|
return jsx(Fragment, { children: children });
|
|
274
305
|
};
|
|
306
|
+
/**
|
|
307
|
+
* This is a router for the Trackunit app.
|
|
308
|
+
*/
|
|
275
309
|
const TrackunitRouter = ({ children }) => {
|
|
276
310
|
var _a;
|
|
277
311
|
return (jsx(BrowserRouter, Object.assign({ basename: `${((_a = document.getElementById("baseHref")) === null || _a === void 0 ? void 0 : _a.getAttribute("href")) || "<missing baseHref>"}${global.module}` }, { children: jsx(HostNavigator, { children: children }) })));
|
|
278
312
|
};
|
|
279
313
|
|
|
314
|
+
/**
|
|
315
|
+
* This is a provider for the TrackunitDataProviders.
|
|
316
|
+
*/
|
|
280
317
|
const TrackunitProviders = ({ translations, children }) => {
|
|
281
318
|
if (translations) {
|
|
282
319
|
registerTranslations(translations); // Register the apps translations if passed.
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-core-contexts",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.108",
|
|
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.3.
|
|
9
|
-
"@trackunit/react-core-contexts-api": "0.2.
|
|
10
|
-
"@trackunit/react-core-contexts-test": "0.1.
|
|
11
|
-
"@trackunit/react-core-hooks": "0.2.
|
|
8
|
+
"@trackunit/iris-app-runtime-core": "0.3.26",
|
|
9
|
+
"@trackunit/react-core-contexts-api": "0.2.23",
|
|
10
|
+
"@trackunit/react-core-contexts-test": "0.1.43",
|
|
11
|
+
"@trackunit/react-core-hooks": "0.2.39",
|
|
12
12
|
"react": "18.2.0",
|
|
13
13
|
"@apollo/client": "3.7.10",
|
|
14
14
|
"@sentry/browser": "7.24.2",
|
|
15
15
|
"apollo-upload-client": "17.0.0",
|
|
16
|
-
"@trackunit/i18n-library-translation": "0.0.
|
|
17
|
-
"@trackunit/react-components": "0.1.
|
|
16
|
+
"@trackunit/i18n-library-translation": "0.0.37",
|
|
17
|
+
"@trackunit/react-components": "0.1.76",
|
|
18
18
|
"react-router-dom": "6.4.5"
|
|
19
19
|
},
|
|
20
20
|
"module": "./index.js",
|
|
@@ -3,5 +3,12 @@ interface IProps {
|
|
|
3
3
|
children: React.ReactNode;
|
|
4
4
|
isIrisApp?: boolean;
|
|
5
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* This is a provider for the ManagerApolloContext.
|
|
8
|
+
* It is used to provide the apollo client to the manager app.
|
|
9
|
+
*
|
|
10
|
+
* @param {IProps} props The props.
|
|
11
|
+
* @returns {JSX.Element} The provider.
|
|
12
|
+
*/
|
|
6
13
|
export declare const ManagerApolloProvider: ({ children, isIrisApp }: IProps) => JSX.Element;
|
|
7
14
|
export {};
|
|
@@ -5,4 +5,7 @@ export interface TrackunitProvidersProps {
|
|
|
5
5
|
translations?: TranslationResource<string>;
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* This is a provider for the TrackunitDataProviders.
|
|
10
|
+
*/
|
|
8
11
|
export declare const TrackunitProviders: ({ translations, children }: TrackunitProvidersProps) => JSX.Element;
|
package/src/TrackunitRouter.d.ts
CHANGED
|
@@ -2,5 +2,8 @@ import * as React from "react";
|
|
|
2
2
|
interface IProps {
|
|
3
3
|
children: React.ReactNode;
|
|
4
4
|
}
|
|
5
|
+
/**
|
|
6
|
+
* This is a provider for the UserSubscriptionContext.
|
|
7
|
+
*/
|
|
5
8
|
declare const UserSubscriptionProvider: ({ children }: IProps) => JSX.Element | null;
|
|
6
9
|
export default UserSubscriptionProvider;
|
|
@@ -2,5 +2,8 @@ import { ReactNode } from "react";
|
|
|
2
2
|
interface Props {
|
|
3
3
|
children: ReactNode;
|
|
4
4
|
}
|
|
5
|
+
/**
|
|
6
|
+
* This is a provider for the AssetSortingContext.
|
|
7
|
+
*/
|
|
5
8
|
declare const TileAssetSortingProvider: ({ children }: Props) => JSX.Element | null;
|
|
6
9
|
export default TileAssetSortingProvider;
|
|
@@ -2,5 +2,8 @@ import * as React from "react";
|
|
|
2
2
|
interface IProps {
|
|
3
3
|
children: React.ReactNode;
|
|
4
4
|
}
|
|
5
|
+
/**
|
|
6
|
+
* This is a provider for the DeveloperSettingsContext.
|
|
7
|
+
*/
|
|
5
8
|
declare const IrisAppDeveloperSettingsProvider: ({ children }: IProps) => JSX.Element | null;
|
|
6
9
|
export default IrisAppDeveloperSettingsProvider;
|
|
@@ -2,5 +2,8 @@ import * as React from "react";
|
|
|
2
2
|
interface IProps {
|
|
3
3
|
children: React.ReactNode;
|
|
4
4
|
}
|
|
5
|
+
/**
|
|
6
|
+
* This is a provider for the EnvironmentContext.
|
|
7
|
+
*/
|
|
5
8
|
declare const TileEnvironmentProvider: ({ children }: IProps) => JSX.Element | null;
|
|
6
9
|
export default TileEnvironmentProvider;
|
|
@@ -2,5 +2,8 @@ import * as React from "react";
|
|
|
2
2
|
interface IProps {
|
|
3
3
|
children: React.ReactNode;
|
|
4
4
|
}
|
|
5
|
+
/**
|
|
6
|
+
* This is a provider for the CurrentUserContext.
|
|
7
|
+
*/
|
|
5
8
|
declare const TileCurrentUserProvider: ({ children }: IProps) => JSX.Element | null;
|
|
6
9
|
export default TileCurrentUserProvider;
|