@trackunit/react-core-contexts-api 0.2.67 → 0.2.69
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 +26 -0
- package/index.esm.js +24 -1
- package/package.json +2 -2
- package/src/IUserPreferencesContext.d.ts +5 -0
- package/src/index.d.ts +1 -0
- package/src/navigationContext.d.ts +54 -0
package/index.cjs.js
CHANGED
@@ -102,6 +102,29 @@ exports.SortOrder = void 0;
|
|
102
102
|
SortOrder["Desc"] = "DESC";
|
103
103
|
})(exports.SortOrder || (exports.SortOrder = {}));
|
104
104
|
|
105
|
+
const assetHomePageIds = [
|
106
|
+
"status",
|
107
|
+
"movement",
|
108
|
+
"events",
|
109
|
+
"insights",
|
110
|
+
"specification",
|
111
|
+
"telematics",
|
112
|
+
"activity-timeline",
|
113
|
+
];
|
114
|
+
const siteHomePageIds = ["overview", "assets", "asset-visibility"];
|
115
|
+
/**
|
116
|
+
* type guard for IrisAppOptions
|
117
|
+
*/
|
118
|
+
const isIrisOptions = (options) => {
|
119
|
+
if (!options) {
|
120
|
+
return false;
|
121
|
+
}
|
122
|
+
return (typeof options === "object" &&
|
123
|
+
("irisAppId") in options &&
|
124
|
+
Boolean(options.irisAppId) &&
|
125
|
+
("extensionId") in options);
|
126
|
+
};
|
127
|
+
|
105
128
|
const UserSubscriptionPackage = {
|
106
129
|
EXPLORE_FLEET_OWNER: "Explore (Fleet Owner)",
|
107
130
|
EVOLVE_FLEET_OWNER: "Evolve (Fleet Owner)",
|
@@ -118,5 +141,8 @@ const UserSubscriptionPackage = {
|
|
118
141
|
exports.SystemOfMeasurement = SystemOfMeasurement;
|
119
142
|
exports.TimeZonePreference = TimeZonePreference;
|
120
143
|
exports.UserSubscriptionPackage = UserSubscriptionPackage;
|
144
|
+
exports.assetHomePageIds = assetHomePageIds;
|
121
145
|
exports.createEvent = createEvent;
|
146
|
+
exports.isIrisOptions = isIrisOptions;
|
147
|
+
exports.siteHomePageIds = siteHomePageIds;
|
122
148
|
exports.validateStringAsAssetSortByProperty = validateStringAsAssetSortByProperty;
|
package/index.esm.js
CHANGED
@@ -98,6 +98,29 @@ var SortOrder;
|
|
98
98
|
SortOrder["Desc"] = "DESC";
|
99
99
|
})(SortOrder || (SortOrder = {}));
|
100
100
|
|
101
|
+
const assetHomePageIds = [
|
102
|
+
"status",
|
103
|
+
"movement",
|
104
|
+
"events",
|
105
|
+
"insights",
|
106
|
+
"specification",
|
107
|
+
"telematics",
|
108
|
+
"activity-timeline",
|
109
|
+
];
|
110
|
+
const siteHomePageIds = ["overview", "assets", "asset-visibility"];
|
111
|
+
/**
|
112
|
+
* type guard for IrisAppOptions
|
113
|
+
*/
|
114
|
+
const isIrisOptions = (options) => {
|
115
|
+
if (!options) {
|
116
|
+
return false;
|
117
|
+
}
|
118
|
+
return (typeof options === "object" &&
|
119
|
+
("irisAppId") in options &&
|
120
|
+
Boolean(options.irisAppId) &&
|
121
|
+
("extensionId") in options);
|
122
|
+
};
|
123
|
+
|
101
124
|
const UserSubscriptionPackage = {
|
102
125
|
EXPLORE_FLEET_OWNER: "Explore (Fleet Owner)",
|
103
126
|
EVOLVE_FLEET_OWNER: "Evolve (Fleet Owner)",
|
@@ -111,4 +134,4 @@ const UserSubscriptionPackage = {
|
|
111
134
|
NONE: "NONE",
|
112
135
|
};
|
113
136
|
|
114
|
-
export { AssetSortByProperty, SortOrder, SystemOfMeasurement, TimeZonePreference, UserSubscriptionPackage, createEvent, validateStringAsAssetSortByProperty };
|
137
|
+
export { AssetSortByProperty, SortOrder, SystemOfMeasurement, TimeZonePreference, UserSubscriptionPackage, assetHomePageIds, createEvent, isIrisOptions, siteHomePageIds, validateStringAsAssetSortByProperty };
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@trackunit/react-core-contexts-api",
|
3
|
-
"version": "0.2.
|
3
|
+
"version": "0.2.69",
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
6
6
|
"engines": {
|
@@ -9,7 +9,7 @@
|
|
9
9
|
"module": "./index.esm.js",
|
10
10
|
"main": "./index.cjs.js",
|
11
11
|
"dependencies": {
|
12
|
-
"@trackunit/shared-utils": "0.0.
|
12
|
+
"@trackunit/shared-utils": "0.0.15"
|
13
13
|
},
|
14
14
|
"peerDependencies": {}
|
15
15
|
}
|
@@ -17,3 +17,8 @@ export interface IUserPreferencesContext {
|
|
17
17
|
systemOfMeasurement?: SystemOfMeasurementType;
|
18
18
|
setSystemOfMeasurement?: (systemOfMeasurement: SystemOfMeasurementType) => void;
|
19
19
|
}
|
20
|
+
export interface ICurrentUserPreferenceContext {
|
21
|
+
getCurrentUserLanguage: () => Promise<string>;
|
22
|
+
getCurrentUserTimeZonePreference: () => Promise<TimeZonePreferenceType>;
|
23
|
+
getCurrentUserSystemOfMeasurement: () => Promise<SystemOfMeasurementType>;
|
24
|
+
}
|
package/src/index.d.ts
CHANGED
@@ -5,6 +5,7 @@ export * from "./currentUserContext";
|
|
5
5
|
export * from "./environmentContext";
|
6
6
|
export * from "./filterBarContext";
|
7
7
|
export * from "./globalSelectionContext";
|
8
|
+
export * from "./navigationContext";
|
8
9
|
export * from "./oemBrandingContext";
|
9
10
|
export * from "./toastContext";
|
10
11
|
export * from "./tokenContext";
|
@@ -0,0 +1,54 @@
|
|
1
|
+
export type AutocompletePreservingString = string & {};
|
2
|
+
/**
|
3
|
+
* Page would often go in the sidebar. In asset home "status", "telematics" etc are pages
|
4
|
+
*/
|
5
|
+
type Page<TPage extends string> = {
|
6
|
+
page: TPage;
|
7
|
+
} & SubPage & QueryString;
|
8
|
+
/**
|
9
|
+
* SubPage allows for extra deep navigation inside of the app.
|
10
|
+
*/
|
11
|
+
type SubPage = {
|
12
|
+
subPage?: string;
|
13
|
+
};
|
14
|
+
type QueryString = {
|
15
|
+
queryString?: string;
|
16
|
+
};
|
17
|
+
type NeverPage = {
|
18
|
+
page?: never;
|
19
|
+
};
|
20
|
+
type NeverIrisApp = {
|
21
|
+
irisAppId?: never;
|
22
|
+
extensionId?: never;
|
23
|
+
};
|
24
|
+
export type IrisAppOptions = {
|
25
|
+
irisAppId: string;
|
26
|
+
extensionId: string;
|
27
|
+
} & SubPage & QueryString & NeverPage;
|
28
|
+
declare const mainApps: readonly ["fleet", "reports", "sites"];
|
29
|
+
export type MainFleetApp = (typeof mainApps)[number];
|
30
|
+
export type FleetAppStandardOptions = Page<MainFleetApp> & NeverIrisApp;
|
31
|
+
export declare const assetHomePageIds: readonly ["status", "movement", "events", "insights", "specification", "telematics", "activity-timeline"];
|
32
|
+
export type AssetHomePageId = (typeof assetHomePageIds)[number];
|
33
|
+
export type AssetHomeStandardOptions = Page<AssetHomePageId> & NeverIrisApp;
|
34
|
+
export declare const siteHomePageIds: readonly ["overview", "assets", "asset-visibility"];
|
35
|
+
export type SiteHomePageId = (typeof siteHomePageIds)[number];
|
36
|
+
export type SiteHomeStandardOptions = Page<SiteHomePageId> & NeverIrisApp;
|
37
|
+
/**
|
38
|
+
* type guard for IrisAppOptions
|
39
|
+
*/
|
40
|
+
export declare const isIrisOptions: (options: IrisAppOptions | unknown) => options is IrisAppOptions;
|
41
|
+
export type SetDeepLinkPromise = (deepLink: DeepLink) => Promise<void>;
|
42
|
+
export type DeepLink = {
|
43
|
+
path: string;
|
44
|
+
pathname: string;
|
45
|
+
search: Location["search"];
|
46
|
+
hash: Location["hash"];
|
47
|
+
};
|
48
|
+
export interface INavigationContext {
|
49
|
+
gotoAssetHome: (assetId: string, options?: IrisAppOptions | AssetHomeStandardOptions) => Promise<boolean>;
|
50
|
+
gotoSiteHome: (siteId: string, options?: IrisAppOptions | SiteHomeStandardOptions) => Promise<boolean>;
|
51
|
+
gotoAppLibrary: (irisAppId?: string) => Promise<boolean>;
|
52
|
+
gotoFleetApp: (options: IrisAppOptions | FleetAppStandardOptions) => Promise<boolean>;
|
53
|
+
}
|
54
|
+
export {};
|