@trackunit/react-core-contexts 0.4.547 → 0.4.550

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.js CHANGED
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var jsxRuntime = require('react/jsx-runtime');
6
4
  var client = require('@apollo/client');
7
5
  var context = require('@apollo/client/link/context');
@@ -15,55 +13,24 @@ var i18nLibraryTranslation = require('@trackunit/i18n-library-translation');
15
13
  var reactComponents = require('@trackunit/react-components');
16
14
  var irisAppRuntimeCore = require('@trackunit/iris-app-runtime-core');
17
15
 
18
- function _interopNamespace(e) {
19
- if (e && e.__esModule) return e;
20
- var n = Object.create(null);
21
- if (e) {
22
- Object.keys(e).forEach(function (k) {
23
- if (k !== 'default') {
24
- var d = Object.getOwnPropertyDescriptor(e, k);
25
- Object.defineProperty(n, k, d.get ? d : {
26
- enumerable: true,
27
- get: function () { return e[k]; }
28
- });
29
- }
16
+ function _interopNamespaceDefault(e) {
17
+ var n = Object.create(null);
18
+ if (e) {
19
+ Object.keys(e).forEach(function (k) {
20
+ if (k !== 'default') {
21
+ var d = Object.getOwnPropertyDescriptor(e, k);
22
+ Object.defineProperty(n, k, d.get ? d : {
23
+ enumerable: true,
24
+ get: function () { return e[k]; }
30
25
  });
31
- }
32
- n["default"] = e;
33
- return Object.freeze(n);
26
+ }
27
+ });
28
+ }
29
+ n.default = e;
30
+ return Object.freeze(n);
34
31
  }
35
32
 
36
- var React__namespace = /*#__PURE__*/_interopNamespace(React);
37
-
38
- /******************************************************************************
39
- Copyright (c) Microsoft Corporation.
40
-
41
- Permission to use, copy, modify, and/or distribute this software for any
42
- purpose with or without fee is hereby granted.
43
-
44
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
45
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
46
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
47
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
48
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
49
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
50
- PERFORMANCE OF THIS SOFTWARE.
51
- ***************************************************************************** */
52
-
53
- function __awaiter(thisArg, _arguments, P, generator) {
54
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
55
- return new (P || (P = Promise))(function (resolve, reject) {
56
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
57
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
58
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
59
- step((generator = generator.apply(thisArg, _arguments || [])).next());
60
- });
61
- }
62
-
63
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
64
- var e = new Error(message);
65
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
66
- };
33
+ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
67
34
 
68
35
  const createApolloClient = ({ graphqlManagerUrl, graphqlPublicUrl, graphqlManagerImageUploadUrl, graphqlInternalUrl, graphqlReportUrl, isDev, tracingHeaders, firstToken, errorHandler, }) => {
69
36
  let token;
@@ -85,8 +52,12 @@ const createApolloClient = ({ graphqlManagerUrl, graphqlPublicUrl, graphqlManage
85
52
  const reportGraphQLLink = apolloUploadClient.createUploadLink({
86
53
  uri: request => graphqlReportUrl + "/" + request.operationName,
87
54
  });
88
- const authLink = context.setContext((_1, _a) => __awaiter(void 0, [_1, _a], void 0, function* (_, { headers }) {
89
- const newHeaders = Object.assign(Object.assign(Object.assign({}, headers), tracingHeaders), { Authorization: token ? `Bearer ${token}` : null });
55
+ const authLink = context.setContext(async (_, { headers }) => {
56
+ const newHeaders = {
57
+ ...headers,
58
+ ...tracingHeaders,
59
+ Authorization: token ? `Bearer ${token}` : null,
60
+ };
90
61
  if (global.language) {
91
62
  newHeaders["Accept-Language"] = global.language;
92
63
  }
@@ -104,7 +75,7 @@ const createApolloClient = ({ graphqlManagerUrl, graphqlPublicUrl, graphqlManage
104
75
  return {
105
76
  headers: newHeaders,
106
77
  };
107
- }));
78
+ });
108
79
  const errorLink = error.onError((errorResponse) => {
109
80
  var _a, _b;
110
81
  const traceIds = []; // Used to hold id's for use in Sentry
@@ -310,16 +281,16 @@ const ConfirmationDialogProviderIrisApp = ({ children }) => {
310
281
  const EnvironmentProviderIrisApp = ({ children }) => {
311
282
  const [environment, setEnvironment] = React.useState(null);
312
283
  React.useEffect(() => {
313
- const updateEnv = () => __awaiter(void 0, void 0, void 0, function* () {
284
+ const updateEnv = async () => {
314
285
  try {
315
- setEnvironment(yield irisAppRuntimeCore.EnvironmentRuntime.getEnvironmentContext());
286
+ setEnvironment(await irisAppRuntimeCore.EnvironmentRuntime.getEnvironmentContext());
316
287
  }
317
288
  catch (error) {
318
289
  setEnvironment(null);
319
290
  // eslint-disable-next-line no-console
320
291
  console.error("Could not load environment!");
321
292
  }
322
- });
293
+ };
323
294
  updateEnv();
324
295
  }, []);
325
296
  if (!environment) {
@@ -397,9 +368,9 @@ const NavigationProviderIrisApp = ({ children }) => {
397
368
  const OemBrandingContextProviderIrisApp = ({ children }) => {
398
369
  const [oemBrandingContext, setOemBrandingContext] = React__namespace.useState(null);
399
370
  React__namespace.useEffect(() => {
400
- const updateContext = () => __awaiter(void 0, void 0, void 0, function* () {
371
+ const updateContext = async () => {
401
372
  try {
402
- setOemBrandingContext(yield irisAppRuntimeCore.OemBrandingContextRuntime.getOemBrandingContextRuntime());
373
+ setOemBrandingContext(await irisAppRuntimeCore.OemBrandingContextRuntime.getOemBrandingContextRuntime());
403
374
  }
404
375
  catch (error) {
405
376
  setOemBrandingContext(null);
@@ -407,7 +378,7 @@ const OemBrandingContextProviderIrisApp = ({ children }) => {
407
378
  console.error("Could not load Iris App Oem!");
408
379
  return;
409
380
  }
410
- });
381
+ };
411
382
  updateContext();
412
383
  }, []);
413
384
  if (!oemBrandingContext) {
@@ -446,14 +417,14 @@ const ToastProviderIrisApp = ({ children }) => {
446
417
  const TokenProviderIrisApp = ({ children }) => {
447
418
  const [tokenContext, setTokenContext] = React__namespace.useState(null);
448
419
  React__namespace.useEffect(() => {
449
- const updateContext = () => __awaiter(void 0, void 0, void 0, function* () {
420
+ const updateContext = async () => {
450
421
  try {
451
- setTokenContext(yield irisAppRuntimeCore.TokenRuntime.getTokenContext());
422
+ setTokenContext(await irisAppRuntimeCore.TokenRuntime.getTokenContext());
452
423
  }
453
424
  catch (error) {
454
425
  setTokenContext(null);
455
426
  }
456
- });
427
+ };
457
428
  updateContext();
458
429
  }, []);
459
430
  const methods = React__namespace.useMemo(() => ({
package/index.esm.js CHANGED
@@ -12,36 +12,6 @@ import { registerTranslations, initializeTranslationsForApp } from '@trackunit/i
12
12
  import { Spinner } from '@trackunit/react-components';
13
13
  import { AnalyticsContextRuntime, setupHostConnector, AssetSortingRuntime, ConfirmationDialogRuntime, EnvironmentRuntime, FilterBarRuntime, ModalDialogRuntime, NavigationRuntime, OemBrandingContextRuntime, ThemeCssRuntime, ToastRuntime, TokenRuntime, CurrentUserRuntime, CurrentUserPreferenceRuntime, UserSubscriptionRuntime } from '@trackunit/iris-app-runtime-core';
14
14
 
15
- /******************************************************************************
16
- Copyright (c) Microsoft Corporation.
17
-
18
- Permission to use, copy, modify, and/or distribute this software for any
19
- purpose with or without fee is hereby granted.
20
-
21
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
22
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
23
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
24
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
25
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
26
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
27
- PERFORMANCE OF THIS SOFTWARE.
28
- ***************************************************************************** */
29
-
30
- function __awaiter(thisArg, _arguments, P, generator) {
31
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
32
- return new (P || (P = Promise))(function (resolve, reject) {
33
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
34
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
35
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
36
- step((generator = generator.apply(thisArg, _arguments || [])).next());
37
- });
38
- }
39
-
40
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
41
- var e = new Error(message);
42
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
43
- };
44
-
45
15
  const createApolloClient = ({ graphqlManagerUrl, graphqlPublicUrl, graphqlManagerImageUploadUrl, graphqlInternalUrl, graphqlReportUrl, isDev, tracingHeaders, firstToken, errorHandler, }) => {
46
16
  let token;
47
17
  if (!token) {
@@ -62,8 +32,12 @@ const createApolloClient = ({ graphqlManagerUrl, graphqlPublicUrl, graphqlManage
62
32
  const reportGraphQLLink = createUploadLink({
63
33
  uri: request => graphqlReportUrl + "/" + request.operationName,
64
34
  });
65
- const authLink = setContext((_1, _a) => __awaiter(void 0, [_1, _a], void 0, function* (_, { headers }) {
66
- const newHeaders = Object.assign(Object.assign(Object.assign({}, headers), tracingHeaders), { Authorization: token ? `Bearer ${token}` : null });
35
+ const authLink = setContext(async (_, { headers }) => {
36
+ const newHeaders = {
37
+ ...headers,
38
+ ...tracingHeaders,
39
+ Authorization: token ? `Bearer ${token}` : null,
40
+ };
67
41
  if (global.language) {
68
42
  newHeaders["Accept-Language"] = global.language;
69
43
  }
@@ -81,7 +55,7 @@ const createApolloClient = ({ graphqlManagerUrl, graphqlPublicUrl, graphqlManage
81
55
  return {
82
56
  headers: newHeaders,
83
57
  };
84
- }));
58
+ });
85
59
  const errorLink = onError((errorResponse) => {
86
60
  var _a, _b;
87
61
  const traceIds = []; // Used to hold id's for use in Sentry
@@ -287,16 +261,16 @@ const ConfirmationDialogProviderIrisApp = ({ children }) => {
287
261
  const EnvironmentProviderIrisApp = ({ children }) => {
288
262
  const [environment, setEnvironment] = useState(null);
289
263
  useEffect(() => {
290
- const updateEnv = () => __awaiter(void 0, void 0, void 0, function* () {
264
+ const updateEnv = async () => {
291
265
  try {
292
- setEnvironment(yield EnvironmentRuntime.getEnvironmentContext());
266
+ setEnvironment(await EnvironmentRuntime.getEnvironmentContext());
293
267
  }
294
268
  catch (error) {
295
269
  setEnvironment(null);
296
270
  // eslint-disable-next-line no-console
297
271
  console.error("Could not load environment!");
298
272
  }
299
- });
273
+ };
300
274
  updateEnv();
301
275
  }, []);
302
276
  if (!environment) {
@@ -374,9 +348,9 @@ const NavigationProviderIrisApp = ({ children }) => {
374
348
  const OemBrandingContextProviderIrisApp = ({ children }) => {
375
349
  const [oemBrandingContext, setOemBrandingContext] = React.useState(null);
376
350
  React.useEffect(() => {
377
- const updateContext = () => __awaiter(void 0, void 0, void 0, function* () {
351
+ const updateContext = async () => {
378
352
  try {
379
- setOemBrandingContext(yield OemBrandingContextRuntime.getOemBrandingContextRuntime());
353
+ setOemBrandingContext(await OemBrandingContextRuntime.getOemBrandingContextRuntime());
380
354
  }
381
355
  catch (error) {
382
356
  setOemBrandingContext(null);
@@ -384,7 +358,7 @@ const OemBrandingContextProviderIrisApp = ({ children }) => {
384
358
  console.error("Could not load Iris App Oem!");
385
359
  return;
386
360
  }
387
- });
361
+ };
388
362
  updateContext();
389
363
  }, []);
390
364
  if (!oemBrandingContext) {
@@ -423,14 +397,14 @@ const ToastProviderIrisApp = ({ children }) => {
423
397
  const TokenProviderIrisApp = ({ children }) => {
424
398
  const [tokenContext, setTokenContext] = React.useState(null);
425
399
  React.useEffect(() => {
426
- const updateContext = () => __awaiter(void 0, void 0, void 0, function* () {
400
+ const updateContext = async () => {
427
401
  try {
428
- setTokenContext(yield TokenRuntime.getTokenContext());
402
+ setTokenContext(await TokenRuntime.getTokenContext());
429
403
  }
430
404
  catch (error) {
431
405
  setTokenContext(null);
432
406
  }
433
- });
407
+ };
434
408
  updateContext();
435
409
  }, []);
436
410
  const methods = React.useMemo(() => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-core-contexts",
3
- "version": "0.4.547",
3
+ "version": "0.4.550",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -11,7 +11,7 @@
11
11
  "@trackunit/react-core-contexts-api": "*",
12
12
  "@trackunit/react-core-hooks": "*",
13
13
  "apollo-upload-client": "^17.0.0",
14
- "react": "^18.2.0",
14
+ "react": "18.3.1",
15
15
  "@js-temporal/polyfill": "^0.4.4",
16
16
  "@trackunit/iris-app-runtime-core": "*",
17
17
  "jest-fetch-mock": "^3.0.3",
@@ -20,5 +20,6 @@
20
20
  "@trackunit/iris-app-api": "*"
21
21
  },
22
22
  "module": "./index.esm.js",
23
- "main": "./index.cjs.js"
24
- }
23
+ "main": "./index.cjs.js",
24
+ "types": "./index.esm.d.ts"
25
+ }
@@ -9,5 +9,5 @@ interface ManagerApolloProviderProps {
9
9
  * @param {ManagerApolloProviderProps} props The props.
10
10
  * @returns {JSX.Element} The provider.
11
11
  */
12
- export declare const ManagerApolloProvider: ({ children }: ManagerApolloProviderProps) => JSX.Element;
12
+ export declare const ManagerApolloProvider: ({ children }: ManagerApolloProviderProps) => import("react/jsx-runtime").JSX.Element;
13
13
  export {};
@@ -11,4 +11,4 @@ export interface TrackunitProvidersProps {
11
11
  /**
12
12
  * This is a provider for the TrackunitDataProviders.
13
13
  */
14
- export declare const TrackunitProviders: ({ translations, children, errorHandler }: TrackunitProvidersProps) => JSX.Element;
14
+ export declare const TrackunitProviders: ({ translations, children, errorHandler }: TrackunitProvidersProps) => import("react/jsx-runtime").JSX.Element;
@@ -2,4 +2,4 @@ import { type PropsWithChildren } from "react";
2
2
  /**
3
3
  * This is a provider for the AnalyticsProvider.
4
4
  */
5
- export declare const AnalyticsProviderIrisApp: ({ children }: PropsWithChildren) => JSX.Element;
5
+ export declare const AnalyticsProviderIrisApp: ({ children }: PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
@@ -5,5 +5,5 @@ interface Props {
5
5
  /**
6
6
  * This is a provider for the AssetSortingContext.
7
7
  */
8
- export declare const AssetSortingProviderIrisApp: ({ children }: Props) => JSX.Element | null;
8
+ export declare const AssetSortingProviderIrisApp: ({ children }: Props) => import("react/jsx-runtime").JSX.Element | null;
9
9
  export {};
@@ -1,9 +1,8 @@
1
- /// <reference types="react" />
2
1
  interface Props {
3
2
  children: React.ReactNode;
4
3
  }
5
4
  /**
6
5
  * This is a provider for the ConfirmationDialogContext.
7
6
  */
8
- export declare const ConfirmationDialogProviderIrisApp: ({ children }: Props) => JSX.Element;
7
+ export declare const ConfirmationDialogProviderIrisApp: ({ children }: Props) => import("react/jsx-runtime").JSX.Element;
9
8
  export {};
@@ -2,4 +2,4 @@ import { type PropsWithChildren } from "react";
2
2
  /**
3
3
  * This is a provider for the EnvironmentContext.
4
4
  */
5
- export declare const EnvironmentProviderIrisApp: ({ children }: PropsWithChildren) => JSX.Element | null;
5
+ export declare const EnvironmentProviderIrisApp: ({ children }: PropsWithChildren) => import("react/jsx-runtime").JSX.Element | null;
@@ -6,5 +6,5 @@ interface ErrorHandlingProviderIrisAppProps extends PropsWithChildren {
6
6
  /**
7
7
  * This is a provider for the ErrorHandlingProvider.
8
8
  */
9
- export declare const ErrorHandlingProviderIrisApp: ({ children, errorHandler }: ErrorHandlingProviderIrisAppProps) => JSX.Element;
9
+ export declare const ErrorHandlingProviderIrisApp: ({ children, errorHandler }: ErrorHandlingProviderIrisAppProps) => import("react/jsx-runtime").JSX.Element;
10
10
  export {};
@@ -2,4 +2,4 @@ import { type PropsWithChildren } from "react";
2
2
  /**
3
3
  * This is a provider for the FilterBarContext.
4
4
  */
5
- export declare const FilterBarProviderIrisApp: ({ children }: PropsWithChildren) => JSX.Element | null;
5
+ export declare const FilterBarProviderIrisApp: ({ children }: PropsWithChildren) => import("react/jsx-runtime").JSX.Element | null;
@@ -5,5 +5,5 @@ interface Props {
5
5
  /**
6
6
  * This is a provider for the Modal Dialog Context.
7
7
  */
8
- export declare const ModalDialogContextProviderIrisApp: ({ children }: Props) => JSX.Element;
8
+ export declare const ModalDialogContextProviderIrisApp: ({ children }: Props) => import("react/jsx-runtime").JSX.Element;
9
9
  export {};
@@ -5,5 +5,5 @@ interface IProps {
5
5
  /**
6
6
  * This is a provider for the NavigationContext.
7
7
  */
8
- export declare const NavigationProviderIrisApp: ({ children }: IProps) => JSX.Element;
8
+ export declare const NavigationProviderIrisApp: ({ children }: IProps) => import("react/jsx-runtime").JSX.Element;
9
9
  export {};
@@ -5,5 +5,5 @@ interface IProps {
5
5
  /**
6
6
  * This is a provider for the IOemBrandingContext.
7
7
  */
8
- export declare const OemBrandingContextProviderIrisApp: ({ children }: IProps) => JSX.Element | null;
8
+ export declare const OemBrandingContextProviderIrisApp: ({ children }: IProps) => import("react/jsx-runtime").JSX.Element | null;
9
9
  export {};
@@ -2,4 +2,4 @@ import { type PropsWithChildren } from "react";
2
2
  /**
3
3
  * This is a provider for the ToastContext.
4
4
  */
5
- export declare const ThemeCssProviderIrisApp: ({ children }: PropsWithChildren) => JSX.Element;
5
+ export declare const ThemeCssProviderIrisApp: ({ children }: PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
@@ -1,9 +1,8 @@
1
- /// <reference types="react" />
2
1
  interface Props {
3
2
  children: React.ReactNode;
4
3
  }
5
4
  /**
6
5
  * This is a provider for the ToastContext.
7
6
  */
8
- export declare const ToastProviderIrisApp: ({ children }: Props) => JSX.Element;
7
+ export declare const ToastProviderIrisApp: ({ children }: Props) => import("react/jsx-runtime").JSX.Element;
9
8
  export {};
@@ -5,5 +5,5 @@ interface IProps {
5
5
  /**
6
6
  * This is a provider for the TokenContext.
7
7
  */
8
- export declare const TokenProviderIrisApp: ({ children }: IProps) => JSX.Element | null;
8
+ export declare const TokenProviderIrisApp: ({ children }: IProps) => import("react/jsx-runtime").JSX.Element | null;
9
9
  export {};
@@ -5,5 +5,5 @@ interface IProps {
5
5
  /**
6
6
  * This is a provider for the CurrentUserContext.
7
7
  */
8
- export declare const CurrentUserProviderIrisApp: ({ children }: IProps) => JSX.Element | null;
8
+ export declare const CurrentUserProviderIrisApp: ({ children }: IProps) => import("react/jsx-runtime").JSX.Element | null;
9
9
  export {};
@@ -7,5 +7,5 @@ interface IProps {
7
7
  /**
8
8
  * This is a provider for the CurrentUserContext.
9
9
  */
10
- export declare const CurrentUserPreferenceProviderIrisApp: ({ children }: IProps) => JSX.Element | null;
10
+ export declare const CurrentUserPreferenceProviderIrisApp: ({ children }: IProps) => import("react/jsx-runtime").JSX.Element | null;
11
11
  export {};
@@ -5,5 +5,5 @@ interface IProps {
5
5
  /**
6
6
  * This is a provider for the UserSubscriptionContext.
7
7
  */
8
- export declare const UserSubscriptionProviderIrisApp: ({ children }: IProps) => JSX.Element | null;
8
+ export declare const UserSubscriptionProviderIrisApp: ({ children }: IProps) => import("react/jsx-runtime").JSX.Element | null;
9
9
  export {};