@trackunit/react-core-contexts-api 1.8.74 → 1.8.79

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.
Files changed (39) hide show
  1. package/README.md +3 -6
  2. package/index.cjs.js +136 -147
  3. package/index.esm.js +102 -138
  4. package/package.json +4 -6
  5. package/src/analytics/AnalyticsContext.d.ts +3 -0
  6. package/src/assetSorting/AssetSortingContext.d.ts +7 -0
  7. package/src/confirmationDialog/ConfirmationDialogContext.d.ts +12 -0
  8. package/src/environment/EnvironmentContext.d.ts +12 -0
  9. package/src/errorHandling/ErrorHandlingContext.d.ts +3 -0
  10. package/src/exportData/ExportDataContext.d.ts +3 -0
  11. package/src/featureFlags/FeatureFlagContext.d.ts +13 -0
  12. package/src/filterBar/FilterBarContext.d.ts +12 -0
  13. package/src/index.d.ts +18 -16
  14. package/src/modalDialog/ModalDialogContext.d.ts +12 -0
  15. package/src/navigation/NavigationContext.d.ts +12 -0
  16. package/src/oemBranding/OemBrandingContext.d.ts +12 -0
  17. package/src/subscription/UserSubscriptionContext.d.ts +12 -0
  18. package/src/timeRange/TimeRangeContext.d.ts +12 -0
  19. package/src/toast/ToastContext.d.ts +12 -0
  20. package/src/token/TokenContext.d.ts +12 -0
  21. package/src/user/CurrentUserContext.d.ts +12 -0
  22. package/src/user/CurrentUserPreferenceContext.d.ts +12 -0
  23. package/src/widgetConfig/WidgetConfigContext.d.ts +12 -0
  24. package/src/IUserPreferencesContext.d.ts +0 -24
  25. package/src/analyticsContext.d.ts +0 -79
  26. package/src/assetSortingContext.d.ts +0 -52
  27. package/src/confirmationDialogContext.d.ts +0 -32
  28. package/src/currentUserContext.d.ts +0 -62
  29. package/src/environmentContext.d.ts +0 -33
  30. package/src/errorHandlingContext.d.ts +0 -26
  31. package/src/filterBarContext.d.ts +0 -37
  32. package/src/modalDialogContext.d.ts +0 -13
  33. package/src/navigationContext.d.ts +0 -81
  34. package/src/oemBrandingContext.d.ts +0 -36
  35. package/src/timeRangeContext.d.ts +0 -34
  36. package/src/toastContext.d.ts +0 -53
  37. package/src/tokenContext.d.ts +0 -6
  38. package/src/userSubscriptionContext.d.ts +0 -51
  39. package/src/widgetConfigContext.d.ts +0 -61
package/README.md CHANGED
@@ -1,14 +1,11 @@
1
- # Trackunit React Core Contexts API
2
- The `@trackunit/react-core-contexts-api` package is a small package containing reusable types for the Trackunit Iris App SDK.
1
+ # core-contexts-api
3
2
 
4
- Trackunit Iris Apps are used by external developers to integrate custom functionality into [the Trackunit Manager platform](https://www.trackunit.com/services/manager/).
3
+ This library contains providers
5
4
 
6
5
  For more info and a full guide on Iris App SDK Development, please visit our [Developer Hub](https://developers.trackunit.com/).
7
- ## Basic Usage
8
- This package is not meant for isolated usage but is a part of the [`@trackunit/iris-app`](https://www.npmjs.com/package/@trackunit/iris-app) package.
9
6
 
10
7
  ## Trackunit
11
8
  This package was developed by Trackunit ApS.
12
9
  Trackunit is the leading SaaS-based IoT solution for the construction industry, offering an ecosystem of hardware, fleet management software & telematics.
13
10
 
14
- ![The Trackunit logo](https://trackunit.com/wp-content/uploads/2022/03/top-logo.svg)
11
+ ![The Trackunit logo](https://trackunit.com/wp-content/uploads/2022/03/top-logo.svg)
package/index.cjs.js CHANGED
@@ -1,165 +1,154 @@
1
1
  'use strict';
2
2
 
3
- var sharedUtils = require('@trackunit/shared-utils');
3
+ var react = require('react');
4
+ var jsxRuntime = require('react/jsx-runtime');
4
5
 
6
+ const AnalyticsContext = react.createContext(null);
7
+ const AnalyticsContextProvider = AnalyticsContext.Provider; // easy import
8
+
9
+ const AssetSortingContext = react.createContext(null);
5
10
  /**
6
- * Takes an event type and a description and returns an event
7
- *
8
- * @template T The event type.
9
- * Use existing from EventTypes.ts or make custom inline for one offs.
10
- * Defaults to BaseEvent
11
- * @param {{ description: string }} event with the interface of the event type to be filled later
12
- * @returns {*} {Event<T>}
11
+ * This is a provider for the AssetSortingContext.
12
+ */
13
+ const AssetSortingProvider = AssetSortingContext.Provider;
14
+
15
+ const ConfirmationDialogContext = react.createContext(null);
16
+ /**
17
+ * This is a provider for the ConfirmationDialogContext.
18
+ */
19
+ const ConfirmationDialogProvider = (props) => (jsxRuntime.jsx(ConfirmationDialogContext.Provider, { ...props }));
20
+
21
+ const EnvironmentContext = react.createContext(null);
22
+ /**
23
+ * This is a provider for the EnvironmentContext.
24
+ */
25
+ const EnvironmentContextProvider = (props) => {
26
+ return jsxRuntime.jsx(EnvironmentContext.Provider, { ...props });
27
+ };
28
+
29
+ const ErrorHandlingContext = react.createContext(null);
30
+ const ErrorHandlingContextProvider = ErrorHandlingContext.Provider; // easy import
31
+
32
+ const ExportDataContext = react.createContext(undefined);
33
+
34
+ const FeatureFlagContext = react.createContext(null);
35
+ /**
36
+ * This is a provider for the FeatureFlagContext.
13
37
  */
14
- const createEvent = (event) => ({
15
- description: event?.description,
16
- properties: {},
17
- });
18
-
19
- exports.AssetSortByProperty = void 0;
20
- (function (AssetSortByProperty) {
21
- AssetSortByProperty["Activity"] = "ACTIVITY";
22
- AssetSortByProperty["Brand"] = "BRAND";
23
- AssetSortByProperty["Category"] = "CATEGORY";
24
- AssetSortByProperty["Criticality"] = "CRITICALITY";
25
- AssetSortByProperty["CustomField"] = "CUSTOM_FIELD";
26
- AssetSortByProperty["CustomerName"] = "CUSTOMER_NAME";
27
- AssetSortByProperty["AccessManagement"] = "ACCESS_MANAGEMENT";
28
- AssetSortByProperty["ExternalReference"] = "EXTERNAL_REFERENCE";
29
- AssetSortByProperty["Location"] = "LOCATION";
30
- AssetSortByProperty["LocationUpdatedAt"] = "LOCATION_UPDATED_AT";
31
- AssetSortByProperty["Model"] = "MODEL";
32
- AssetSortByProperty["Name"] = "NAME";
33
- AssetSortByProperty["OwnerAccountName"] = "OWNER_ACCOUNT_NAME";
34
- AssetSortByProperty["ProductionYear"] = "PRODUCTION_YEAR";
35
- AssetSortByProperty["SerialNumber"] = "SERIAL_NUMBER";
36
- AssetSortByProperty["ServicePlanAssignmentStatus"] = "SERVICE_PLAN_ASSIGNMENT_STATUS";
37
- AssetSortByProperty["ServicePlanOverdueness"] = "SERVICE_PLAN_OVERDUENESS";
38
- AssetSortByProperty["ServicePlanStatus"] = "SERVICE_PLAN_STATUS";
39
- AssetSortByProperty["TelematicsDeviceSerialNumber"] = "TELEMATICS_DEVICE_SERIAL_NUMBER";
40
- AssetSortByProperty["Type"] = "TYPE";
41
- AssetSortByProperty["PlannedServiceBooked"] = "PLANNED_SERVICE_BOOKED";
42
- AssetSortByProperty["PlannedServiceBookingDate"] = "PLANNED_SERVICE_BOOKING_DATE";
43
- AssetSortByProperty["ServicePlanPrediction"] = "SERVICE_PLAN_PREDICTION";
44
- AssetSortByProperty["IssueCreatedAt"] = "ISSUE_CREATED_AT";
45
- })(exports.AssetSortByProperty || (exports.AssetSortByProperty = {}));
46
- // The type [key in AssetSortByProperty] will ensure that ALL keys are present
47
- const stringToEnum = {
48
- ACTIVITY: exports.AssetSortByProperty.Activity,
49
- BRAND: exports.AssetSortByProperty.Brand,
50
- CATEGORY: exports.AssetSortByProperty.Category,
51
- CUSTOM_FIELD: exports.AssetSortByProperty.CustomField,
52
- CRITICALITY: exports.AssetSortByProperty.Criticality,
53
- CUSTOMER_NAME: exports.AssetSortByProperty.CustomerName,
54
- ACCESS_MANAGEMENT: exports.AssetSortByProperty.AccessManagement,
55
- EXTERNAL_REFERENCE: exports.AssetSortByProperty.ExternalReference,
56
- LOCATION: exports.AssetSortByProperty.Location,
57
- LOCATION_UPDATED_AT: exports.AssetSortByProperty.LocationUpdatedAt,
58
- MODEL: exports.AssetSortByProperty.Model,
59
- NAME: exports.AssetSortByProperty.Name,
60
- OWNER_ACCOUNT_NAME: exports.AssetSortByProperty.OwnerAccountName,
61
- PRODUCTION_YEAR: exports.AssetSortByProperty.ProductionYear,
62
- SERIAL_NUMBER: exports.AssetSortByProperty.SerialNumber,
63
- SERVICE_PLAN_ASSIGNMENT_STATUS: exports.AssetSortByProperty.ServicePlanAssignmentStatus,
64
- SERVICE_PLAN_OVERDUENESS: exports.AssetSortByProperty.ServicePlanOverdueness,
65
- SERVICE_PLAN_STATUS: exports.AssetSortByProperty.ServicePlanStatus,
66
- TELEMATICS_DEVICE_SERIAL_NUMBER: exports.AssetSortByProperty.TelematicsDeviceSerialNumber,
67
- TYPE: exports.AssetSortByProperty.Type,
68
- PLANNED_SERVICE_BOOKED: exports.AssetSortByProperty.PlannedServiceBooked,
69
- PLANNED_SERVICE_BOOKING_DATE: exports.AssetSortByProperty.PlannedServiceBookingDate,
70
- SERVICE_PLAN_PREDICTION: exports.AssetSortByProperty.ServicePlanPrediction,
71
- ISSUE_CREATED_AT: exports.AssetSortByProperty.IssueCreatedAt,
38
+ const FeatureFlagContextProvider = (props) => {
39
+ return jsxRuntime.jsx(FeatureFlagContext.Provider, { ...props });
72
40
  };
41
+
42
+ const FilterBarContext = react.createContext(null);
73
43
  /**
74
- * Ensures that a string is a valid AssetSortByProperty enum value
75
- *
76
- * @param input A string to test against AssetSortByProperty
77
- * @returns {AssetSortByProperty} The AssetSortByProperty enum value or the default value (AssetSortByProperty.Activity)
44
+ * This is a provider for the FilterBarContext.
45
+ */
46
+ const FilterBarProvider = (props) => jsxRuntime.jsx(FilterBarContext.Provider, { ...props });
47
+
48
+ const ModalDialogContext = react.createContext(null);
49
+ /**
50
+ * This is a provider for the ModalDialogContext.
51
+ */
52
+ const ModalDialogContextProvider = (props) => (jsxRuntime.jsx(ModalDialogContext.Provider, { ...props }));
53
+
54
+ const NavigationContext = react.createContext(null);
55
+ /**
56
+ * This is a provider for the NavigationContext.
78
57
  */
79
- const validateStringAsAssetSortByProperty = (input) => {
80
- const fallback = exports.AssetSortByProperty.Activity;
81
- if (!input) {
82
- return { sortBy: fallback };
83
- }
84
- // Try to get the enum value from the string. -> Fallback to the default
85
- if (sharedUtils.isUUID(input)) {
86
- return {
87
- sortBy: exports.AssetSortByProperty.CustomField,
88
- customFieldDefinitionId: input,
89
- };
90
- }
91
- return { sortBy: stringToEnum[input] ?? fallback };
58
+ const NavigationContextProvider = (props) => {
59
+ return jsxRuntime.jsx(NavigationContext.Provider, { ...props });
92
60
  };
93
- exports.SortOrder = void 0;
94
- (function (SortOrder) {
95
- SortOrder["Asc"] = "ASC";
96
- SortOrder["Desc"] = "DESC";
97
- })(exports.SortOrder || (exports.SortOrder = {}));
98
-
99
- const SystemOfMeasurement = {
100
- Si: "SI",
101
- UsCustomary: "US_CUSTOMARY",
61
+
62
+ const OEMBrandingService = react.createContext(null);
63
+ /**
64
+ * This is a provider for the OemBrandingContext.
65
+ */
66
+ const OemBrandingContextProvider = (props) => {
67
+ return jsxRuntime.jsx(OEMBrandingService.Provider, { ...props });
102
68
  };
103
- const TimeZonePreference = {
104
- CustomTimeZone: "CUSTOM_TIME_ZONE",
105
- LocalTimeZone: "LOCAL_TIME_ZONE",
106
- MachineTimeZone: "MACHINE_TIME_ZONE",
69
+
70
+ const UserSubscriptionContext = react.createContext(null);
71
+ /**
72
+ * This is a provider for the UserSubscriptionContext.
73
+ */
74
+ const UserSubscriptionProvider = (props) => {
75
+ return jsxRuntime.jsx(UserSubscriptionContext.Provider, { ...props });
76
+ };
77
+
78
+ const TimeRangeContext = react.createContext(null);
79
+ /**
80
+ * This is a provider for the TimeRangeContext.
81
+ */
82
+ const TimeRangeProvider = (props) => jsxRuntime.jsx(TimeRangeContext.Provider, { ...props });
83
+
84
+ const ToastContext = react.createContext(null);
85
+ /**
86
+ * This is a provider for the ToastContext.
87
+ */
88
+ const ToastProvider = (props) => jsxRuntime.jsx(ToastContext.Provider, { ...props });
89
+
90
+ const TokenContext = react.createContext(null);
91
+ /**
92
+ * This is a provider for the TokenContext.
93
+ */
94
+ const TokenProvider = (props) => {
95
+ return jsxRuntime.jsx(TokenContext.Provider, { ...props });
107
96
  };
108
97
 
109
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
110
- const assetHomePageIds = [
111
- "status",
112
- "movement",
113
- "events",
114
- "insights",
115
- "specification",
116
- "telematics",
117
- "contracts",
118
- ];
119
- const siteHomePageIds = ["overview", "assets", "asset-visibility"];
120
- const groupHomePageIds = ["assets", "users", "details"];
121
- const customerHomePageIds = ["info", "assets", "contact-list"];
98
+ const CurrentUserContext = react.createContext(null);
122
99
  /**
123
- * type guard for IrisAppOptions
100
+ * This is a provider for the CurrentUserContext.
124
101
  */
125
- const isIrisOptions = (options) => {
126
- if (!options) {
127
- return false;
128
- }
129
- return (typeof options === "object" &&
130
- "irisAppId" in options &&
131
- Boolean(options.irisAppId) &&
132
- "extensionId" in options);
102
+ const CurrentUserProvider = (props) => {
103
+ return jsxRuntime.jsx(CurrentUserContext.Provider, { ...props });
133
104
  };
134
105
 
135
- const UserSubscriptionPackage = {
136
- ENTRY_FLEET_OWNER: "Entry (Fleet Owner)",
137
- EXPLORE_FLEET_OWNER: "Explore (Fleet Owner)",
138
- EVOLVE_FLEET_OWNER: "Evolve (Fleet Owner)",
139
- EXPAND_FLEET_OWNER: "Expand (Fleet Owner)",
140
- EXPLORE_OEM: "Explore (OEM)",
141
- EVOLVE_OEM: "Evolve (OEM)",
142
- EXPAND_OEM: "Expand (OEM)",
143
- COLLECT: "COLLECT",
144
- INSIGHT: "INSIGHT",
145
- VIEW: "VIEW",
146
- NONE: "NONE",
147
- EXPLORE: "Explore",
148
- EVOLVE: "Evolve",
149
- EXPAND: "Expand",
150
- LINK: "Link",
151
- LIFT: "Lift",
152
- LEAP: "Leap",
153
- CUSTOMER_PORTAL: "Customer Portal",
106
+ const CurrentUserPreferenceContext = react.createContext(null);
107
+ /**
108
+ *
109
+ */
110
+ const CurrentUserPreferenceProvider = (props) => {
111
+ return jsxRuntime.jsx(CurrentUserPreferenceContext.Provider, { ...props });
154
112
  };
155
113
 
156
- exports.SystemOfMeasurement = SystemOfMeasurement;
157
- exports.TimeZonePreference = TimeZonePreference;
158
- exports.UserSubscriptionPackage = UserSubscriptionPackage;
159
- exports.assetHomePageIds = assetHomePageIds;
160
- exports.createEvent = createEvent;
161
- exports.customerHomePageIds = customerHomePageIds;
162
- exports.groupHomePageIds = groupHomePageIds;
163
- exports.isIrisOptions = isIrisOptions;
164
- exports.siteHomePageIds = siteHomePageIds;
165
- exports.validateStringAsAssetSortByProperty = validateStringAsAssetSortByProperty;
114
+ const WidgetConfigContext = react.createContext(null);
115
+ /**
116
+ * This is a provider for the WidgetConfigContext.
117
+ */
118
+ const WidgetConfigProvider = (props) => jsxRuntime.jsx(WidgetConfigContext.Provider, { ...props });
119
+
120
+ exports.AnalyticsContext = AnalyticsContext;
121
+ exports.AnalyticsContextProvider = AnalyticsContextProvider;
122
+ exports.AssetSortingContext = AssetSortingContext;
123
+ exports.AssetSortingProvider = AssetSortingProvider;
124
+ exports.ConfirmationDialogContext = ConfirmationDialogContext;
125
+ exports.ConfirmationDialogProvider = ConfirmationDialogProvider;
126
+ exports.CurrentUserContext = CurrentUserContext;
127
+ exports.CurrentUserPreferenceContext = CurrentUserPreferenceContext;
128
+ exports.CurrentUserPreferenceProvider = CurrentUserPreferenceProvider;
129
+ exports.CurrentUserProvider = CurrentUserProvider;
130
+ exports.EnvironmentContext = EnvironmentContext;
131
+ exports.EnvironmentContextProvider = EnvironmentContextProvider;
132
+ exports.ErrorHandlingContext = ErrorHandlingContext;
133
+ exports.ErrorHandlingContextProvider = ErrorHandlingContextProvider;
134
+ exports.ExportDataContext = ExportDataContext;
135
+ exports.FeatureFlagContext = FeatureFlagContext;
136
+ exports.FeatureFlagContextProvider = FeatureFlagContextProvider;
137
+ exports.FilterBarContext = FilterBarContext;
138
+ exports.FilterBarProvider = FilterBarProvider;
139
+ exports.ModalDialogContext = ModalDialogContext;
140
+ exports.ModalDialogContextProvider = ModalDialogContextProvider;
141
+ exports.NavigationContext = NavigationContext;
142
+ exports.NavigationContextProvider = NavigationContextProvider;
143
+ exports.OemBrandingContext = OEMBrandingService;
144
+ exports.OemBrandingContextProvider = OemBrandingContextProvider;
145
+ exports.TimeRangeContext = TimeRangeContext;
146
+ exports.TimeRangeProvider = TimeRangeProvider;
147
+ exports.ToastContext = ToastContext;
148
+ exports.ToastProvider = ToastProvider;
149
+ exports.TokenContext = TokenContext;
150
+ exports.TokenProvider = TokenProvider;
151
+ exports.UserSubscriptionContext = UserSubscriptionContext;
152
+ exports.UserSubscriptionProvider = UserSubscriptionProvider;
153
+ exports.WidgetConfigContext = WidgetConfigContext;
154
+ exports.WidgetConfigProvider = WidgetConfigProvider;
package/index.esm.js CHANGED
@@ -1,154 +1,118 @@
1
- import { isUUID } from '@trackunit/shared-utils';
1
+ import { createContext } from 'react';
2
+ import { jsx } from 'react/jsx-runtime';
2
3
 
4
+ const AnalyticsContext = createContext(null);
5
+ const AnalyticsContextProvider = AnalyticsContext.Provider; // easy import
6
+
7
+ const AssetSortingContext = createContext(null);
3
8
  /**
4
- * Takes an event type and a description and returns an event
5
- *
6
- * @template T The event type.
7
- * Use existing from EventTypes.ts or make custom inline for one offs.
8
- * Defaults to BaseEvent
9
- * @param {{ description: string }} event with the interface of the event type to be filled later
10
- * @returns {*} {Event<T>}
9
+ * This is a provider for the AssetSortingContext.
10
+ */
11
+ const AssetSortingProvider = AssetSortingContext.Provider;
12
+
13
+ const ConfirmationDialogContext = createContext(null);
14
+ /**
15
+ * This is a provider for the ConfirmationDialogContext.
16
+ */
17
+ const ConfirmationDialogProvider = (props) => (jsx(ConfirmationDialogContext.Provider, { ...props }));
18
+
19
+ const EnvironmentContext = createContext(null);
20
+ /**
21
+ * This is a provider for the EnvironmentContext.
22
+ */
23
+ const EnvironmentContextProvider = (props) => {
24
+ return jsx(EnvironmentContext.Provider, { ...props });
25
+ };
26
+
27
+ const ErrorHandlingContext = createContext(null);
28
+ const ErrorHandlingContextProvider = ErrorHandlingContext.Provider; // easy import
29
+
30
+ const ExportDataContext = createContext(undefined);
31
+
32
+ const FeatureFlagContext = createContext(null);
33
+ /**
34
+ * This is a provider for the FeatureFlagContext.
11
35
  */
12
- const createEvent = (event) => ({
13
- description: event?.description,
14
- properties: {},
15
- });
16
-
17
- var AssetSortByProperty;
18
- (function (AssetSortByProperty) {
19
- AssetSortByProperty["Activity"] = "ACTIVITY";
20
- AssetSortByProperty["Brand"] = "BRAND";
21
- AssetSortByProperty["Category"] = "CATEGORY";
22
- AssetSortByProperty["Criticality"] = "CRITICALITY";
23
- AssetSortByProperty["CustomField"] = "CUSTOM_FIELD";
24
- AssetSortByProperty["CustomerName"] = "CUSTOMER_NAME";
25
- AssetSortByProperty["AccessManagement"] = "ACCESS_MANAGEMENT";
26
- AssetSortByProperty["ExternalReference"] = "EXTERNAL_REFERENCE";
27
- AssetSortByProperty["Location"] = "LOCATION";
28
- AssetSortByProperty["LocationUpdatedAt"] = "LOCATION_UPDATED_AT";
29
- AssetSortByProperty["Model"] = "MODEL";
30
- AssetSortByProperty["Name"] = "NAME";
31
- AssetSortByProperty["OwnerAccountName"] = "OWNER_ACCOUNT_NAME";
32
- AssetSortByProperty["ProductionYear"] = "PRODUCTION_YEAR";
33
- AssetSortByProperty["SerialNumber"] = "SERIAL_NUMBER";
34
- AssetSortByProperty["ServicePlanAssignmentStatus"] = "SERVICE_PLAN_ASSIGNMENT_STATUS";
35
- AssetSortByProperty["ServicePlanOverdueness"] = "SERVICE_PLAN_OVERDUENESS";
36
- AssetSortByProperty["ServicePlanStatus"] = "SERVICE_PLAN_STATUS";
37
- AssetSortByProperty["TelematicsDeviceSerialNumber"] = "TELEMATICS_DEVICE_SERIAL_NUMBER";
38
- AssetSortByProperty["Type"] = "TYPE";
39
- AssetSortByProperty["PlannedServiceBooked"] = "PLANNED_SERVICE_BOOKED";
40
- AssetSortByProperty["PlannedServiceBookingDate"] = "PLANNED_SERVICE_BOOKING_DATE";
41
- AssetSortByProperty["ServicePlanPrediction"] = "SERVICE_PLAN_PREDICTION";
42
- AssetSortByProperty["IssueCreatedAt"] = "ISSUE_CREATED_AT";
43
- })(AssetSortByProperty || (AssetSortByProperty = {}));
44
- // The type [key in AssetSortByProperty] will ensure that ALL keys are present
45
- const stringToEnum = {
46
- ACTIVITY: AssetSortByProperty.Activity,
47
- BRAND: AssetSortByProperty.Brand,
48
- CATEGORY: AssetSortByProperty.Category,
49
- CUSTOM_FIELD: AssetSortByProperty.CustomField,
50
- CRITICALITY: AssetSortByProperty.Criticality,
51
- CUSTOMER_NAME: AssetSortByProperty.CustomerName,
52
- ACCESS_MANAGEMENT: AssetSortByProperty.AccessManagement,
53
- EXTERNAL_REFERENCE: AssetSortByProperty.ExternalReference,
54
- LOCATION: AssetSortByProperty.Location,
55
- LOCATION_UPDATED_AT: AssetSortByProperty.LocationUpdatedAt,
56
- MODEL: AssetSortByProperty.Model,
57
- NAME: AssetSortByProperty.Name,
58
- OWNER_ACCOUNT_NAME: AssetSortByProperty.OwnerAccountName,
59
- PRODUCTION_YEAR: AssetSortByProperty.ProductionYear,
60
- SERIAL_NUMBER: AssetSortByProperty.SerialNumber,
61
- SERVICE_PLAN_ASSIGNMENT_STATUS: AssetSortByProperty.ServicePlanAssignmentStatus,
62
- SERVICE_PLAN_OVERDUENESS: AssetSortByProperty.ServicePlanOverdueness,
63
- SERVICE_PLAN_STATUS: AssetSortByProperty.ServicePlanStatus,
64
- TELEMATICS_DEVICE_SERIAL_NUMBER: AssetSortByProperty.TelematicsDeviceSerialNumber,
65
- TYPE: AssetSortByProperty.Type,
66
- PLANNED_SERVICE_BOOKED: AssetSortByProperty.PlannedServiceBooked,
67
- PLANNED_SERVICE_BOOKING_DATE: AssetSortByProperty.PlannedServiceBookingDate,
68
- SERVICE_PLAN_PREDICTION: AssetSortByProperty.ServicePlanPrediction,
69
- ISSUE_CREATED_AT: AssetSortByProperty.IssueCreatedAt,
36
+ const FeatureFlagContextProvider = (props) => {
37
+ return jsx(FeatureFlagContext.Provider, { ...props });
70
38
  };
39
+
40
+ const FilterBarContext = createContext(null);
71
41
  /**
72
- * Ensures that a string is a valid AssetSortByProperty enum value
73
- *
74
- * @param input A string to test against AssetSortByProperty
75
- * @returns {AssetSortByProperty} The AssetSortByProperty enum value or the default value (AssetSortByProperty.Activity)
42
+ * This is a provider for the FilterBarContext.
43
+ */
44
+ const FilterBarProvider = (props) => jsx(FilterBarContext.Provider, { ...props });
45
+
46
+ const ModalDialogContext = createContext(null);
47
+ /**
48
+ * This is a provider for the ModalDialogContext.
49
+ */
50
+ const ModalDialogContextProvider = (props) => (jsx(ModalDialogContext.Provider, { ...props }));
51
+
52
+ const NavigationContext = createContext(null);
53
+ /**
54
+ * This is a provider for the NavigationContext.
76
55
  */
77
- const validateStringAsAssetSortByProperty = (input) => {
78
- const fallback = AssetSortByProperty.Activity;
79
- if (!input) {
80
- return { sortBy: fallback };
81
- }
82
- // Try to get the enum value from the string. -> Fallback to the default
83
- if (isUUID(input)) {
84
- return {
85
- sortBy: AssetSortByProperty.CustomField,
86
- customFieldDefinitionId: input,
87
- };
88
- }
89
- return { sortBy: stringToEnum[input] ?? fallback };
56
+ const NavigationContextProvider = (props) => {
57
+ return jsx(NavigationContext.Provider, { ...props });
90
58
  };
91
- var SortOrder;
92
- (function (SortOrder) {
93
- SortOrder["Asc"] = "ASC";
94
- SortOrder["Desc"] = "DESC";
95
- })(SortOrder || (SortOrder = {}));
96
-
97
- const SystemOfMeasurement = {
98
- Si: "SI",
99
- UsCustomary: "US_CUSTOMARY",
59
+
60
+ const OEMBrandingService = createContext(null);
61
+ /**
62
+ * This is a provider for the OemBrandingContext.
63
+ */
64
+ const OemBrandingContextProvider = (props) => {
65
+ return jsx(OEMBrandingService.Provider, { ...props });
100
66
  };
101
- const TimeZonePreference = {
102
- CustomTimeZone: "CUSTOM_TIME_ZONE",
103
- LocalTimeZone: "LOCAL_TIME_ZONE",
104
- MachineTimeZone: "MACHINE_TIME_ZONE",
67
+
68
+ const UserSubscriptionContext = createContext(null);
69
+ /**
70
+ * This is a provider for the UserSubscriptionContext.
71
+ */
72
+ const UserSubscriptionProvider = (props) => {
73
+ return jsx(UserSubscriptionContext.Provider, { ...props });
74
+ };
75
+
76
+ const TimeRangeContext = createContext(null);
77
+ /**
78
+ * This is a provider for the TimeRangeContext.
79
+ */
80
+ const TimeRangeProvider = (props) => jsx(TimeRangeContext.Provider, { ...props });
81
+
82
+ const ToastContext = createContext(null);
83
+ /**
84
+ * This is a provider for the ToastContext.
85
+ */
86
+ const ToastProvider = (props) => jsx(ToastContext.Provider, { ...props });
87
+
88
+ const TokenContext = createContext(null);
89
+ /**
90
+ * This is a provider for the TokenContext.
91
+ */
92
+ const TokenProvider = (props) => {
93
+ return jsx(TokenContext.Provider, { ...props });
105
94
  };
106
95
 
107
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
108
- const assetHomePageIds = [
109
- "status",
110
- "movement",
111
- "events",
112
- "insights",
113
- "specification",
114
- "telematics",
115
- "contracts",
116
- ];
117
- const siteHomePageIds = ["overview", "assets", "asset-visibility"];
118
- const groupHomePageIds = ["assets", "users", "details"];
119
- const customerHomePageIds = ["info", "assets", "contact-list"];
96
+ const CurrentUserContext = createContext(null);
120
97
  /**
121
- * type guard for IrisAppOptions
98
+ * This is a provider for the CurrentUserContext.
122
99
  */
123
- const isIrisOptions = (options) => {
124
- if (!options) {
125
- return false;
126
- }
127
- return (typeof options === "object" &&
128
- "irisAppId" in options &&
129
- Boolean(options.irisAppId) &&
130
- "extensionId" in options);
100
+ const CurrentUserProvider = (props) => {
101
+ return jsx(CurrentUserContext.Provider, { ...props });
131
102
  };
132
103
 
133
- const UserSubscriptionPackage = {
134
- ENTRY_FLEET_OWNER: "Entry (Fleet Owner)",
135
- EXPLORE_FLEET_OWNER: "Explore (Fleet Owner)",
136
- EVOLVE_FLEET_OWNER: "Evolve (Fleet Owner)",
137
- EXPAND_FLEET_OWNER: "Expand (Fleet Owner)",
138
- EXPLORE_OEM: "Explore (OEM)",
139
- EVOLVE_OEM: "Evolve (OEM)",
140
- EXPAND_OEM: "Expand (OEM)",
141
- COLLECT: "COLLECT",
142
- INSIGHT: "INSIGHT",
143
- VIEW: "VIEW",
144
- NONE: "NONE",
145
- EXPLORE: "Explore",
146
- EVOLVE: "Evolve",
147
- EXPAND: "Expand",
148
- LINK: "Link",
149
- LIFT: "Lift",
150
- LEAP: "Leap",
151
- CUSTOMER_PORTAL: "Customer Portal",
104
+ const CurrentUserPreferenceContext = createContext(null);
105
+ /**
106
+ *
107
+ */
108
+ const CurrentUserPreferenceProvider = (props) => {
109
+ return jsx(CurrentUserPreferenceContext.Provider, { ...props });
152
110
  };
153
111
 
154
- export { AssetSortByProperty, SortOrder, SystemOfMeasurement, TimeZonePreference, UserSubscriptionPackage, assetHomePageIds, createEvent, customerHomePageIds, groupHomePageIds, isIrisOptions, siteHomePageIds, validateStringAsAssetSortByProperty };
112
+ const WidgetConfigContext = createContext(null);
113
+ /**
114
+ * This is a provider for the WidgetConfigContext.
115
+ */
116
+ const WidgetConfigProvider = (props) => jsx(WidgetConfigContext.Provider, { ...props });
117
+
118
+ export { AnalyticsContext, AnalyticsContextProvider, AssetSortingContext, AssetSortingProvider, ConfirmationDialogContext, ConfirmationDialogProvider, CurrentUserContext, CurrentUserPreferenceContext, CurrentUserPreferenceProvider, CurrentUserProvider, EnvironmentContext, EnvironmentContextProvider, ErrorHandlingContext, ErrorHandlingContextProvider, ExportDataContext, FeatureFlagContext, FeatureFlagContextProvider, FilterBarContext, FilterBarProvider, ModalDialogContext, ModalDialogContextProvider, NavigationContext, NavigationContextProvider, OEMBrandingService as OemBrandingContext, OemBrandingContextProvider, TimeRangeContext, TimeRangeProvider, ToastContext, ToastProvider, TokenContext, TokenProvider, UserSubscriptionContext, UserSubscriptionProvider, WidgetConfigContext, WidgetConfigProvider };
package/package.json CHANGED
@@ -1,16 +1,14 @@
1
1
  {
2
2
  "name": "@trackunit/react-core-contexts-api",
3
- "version": "1.8.74",
3
+ "version": "1.8.79",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
7
- "node": ">=22.x"
7
+ "node": ">=24.x"
8
8
  },
9
9
  "dependencies": {
10
- "jest-fetch-mock": "^3.0.3",
11
- "@trackunit/shared-utils": "1.9.69",
12
- "@trackunit/geo-json-utils": "1.7.69",
13
- "@trackunit/react-test-setup": "1.4.69"
10
+ "react": "19.0.0",
11
+ "@trackunit/iris-app-runtime-core-api": "1.7.120"
14
12
  },
15
13
  "module": "./index.esm.js",
16
14
  "main": "./index.cjs.js",
@@ -0,0 +1,3 @@
1
+ import { AnalyticsRuntimeApiSync } from "@trackunit/iris-app-runtime-core-api";
2
+ export declare const AnalyticsContext: import("react").Context<AnalyticsRuntimeApiSync<Record<string, never>> | null>;
3
+ export declare const AnalyticsContextProvider: import("react").Provider<AnalyticsRuntimeApiSync<Record<string, never>> | null>;
@@ -0,0 +1,7 @@
1
+ import { AssetSortingState } from "@trackunit/iris-app-runtime-core-api";
2
+ declare const AssetSortingContext: import("react").Context<AssetSortingState | null>;
3
+ /**
4
+ * This is a provider for the AssetSortingContext.
5
+ */
6
+ export declare const AssetSortingProvider: import("react").Provider<AssetSortingState | null>;
7
+ export { AssetSortingContext };
@@ -0,0 +1,12 @@
1
+ import { ConfirmationDialogRuntimeApi } from "@trackunit/iris-app-runtime-core-api";
2
+ import { ReactNode } from "react";
3
+ declare const ConfirmationDialogContext: import("react").Context<ConfirmationDialogRuntimeApi | null>;
4
+ export interface ConfirmationDialogContextProviderProps {
5
+ value: ConfirmationDialogRuntimeApi;
6
+ children: ReactNode;
7
+ }
8
+ /**
9
+ * This is a provider for the ConfirmationDialogContext.
10
+ */
11
+ export declare const ConfirmationDialogProvider: (props: ConfirmationDialogContextProviderProps) => ReactNode;
12
+ export { ConfirmationDialogContext };
@@ -0,0 +1,12 @@
1
+ import { EnvironmentState } from "@trackunit/iris-app-runtime-core-api";
2
+ import { ReactNode } from "react";
3
+ declare const EnvironmentContext: import("react").Context<EnvironmentState | null>;
4
+ interface EnvironmentContextProviderProps {
5
+ value: EnvironmentState;
6
+ children?: ReactNode;
7
+ }
8
+ /**
9
+ * This is a provider for the EnvironmentContext.
10
+ */
11
+ export declare const EnvironmentContextProvider: (props: EnvironmentContextProviderProps) => import("react/jsx-runtime").JSX.Element;
12
+ export { EnvironmentContext };
@@ -0,0 +1,3 @@
1
+ import { ErrorHandlingContextValue } from "@trackunit/iris-app-runtime-core-api";
2
+ export declare const ErrorHandlingContext: import("react").Context<ErrorHandlingContextValue | null>;
3
+ export declare const ErrorHandlingContextProvider: import("react").Provider<ErrorHandlingContextValue | null>;
@@ -0,0 +1,3 @@
1
+ import { ExportDataRuntimeApi } from "@trackunit/iris-app-runtime-core-api";
2
+ export type ExportDataContextState = ExportDataRuntimeApi;
3
+ export declare const ExportDataContext: import("react").Context<ExportDataRuntimeApi | undefined>;