@trackunit/react-core-contexts-api 0.2.39 → 0.2.41
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 +49 -49
- package/index.js +49 -49
- package/package.json +1 -1
- package/src/analyticsContext.d.ts +78 -78
- package/src/assetSortingContext.d.ts +34 -34
- package/src/currentUserContext.d.ts +60 -60
- package/src/environmentContext.d.ts +31 -30
- package/src/globalSelectionContext.d.ts +18 -18
- package/src/index.d.ts +9 -9
- package/src/oemBrandingContext.d.ts +45 -45
- package/src/toastContext.d.ts +20 -20
- package/src/tokenContext.d.ts +6 -6
- package/src/userSubscriptionContext.d.ts +39 -39
package/index.cjs
CHANGED
@@ -2,59 +2,59 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
/**
|
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>}
|
13
|
-
*/
|
14
|
-
const createEvent = (event) => ({
|
15
|
-
description: event === null || event === void 0 ? void 0 : event.description,
|
16
|
-
amplitudeName: event === null || event === void 0 ? void 0 : event.amplitudeName,
|
17
|
-
properties: {},
|
5
|
+
/**
|
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>}
|
13
|
+
*/
|
14
|
+
const createEvent = (event) => ({
|
15
|
+
description: event === null || event === void 0 ? void 0 : event.description,
|
16
|
+
amplitudeName: event === null || event === void 0 ? void 0 : event.amplitudeName,
|
17
|
+
properties: {},
|
18
18
|
});
|
19
19
|
|
20
|
-
exports.AssetSortByProperty = void 0;
|
21
|
-
(function (AssetSortByProperty) {
|
22
|
-
AssetSortByProperty["Activity"] = "ACTIVITY";
|
23
|
-
AssetSortByProperty["Brand"] = "BRAND";
|
24
|
-
AssetSortByProperty["Category"] = "CATEGORY";
|
25
|
-
AssetSortByProperty["Criticality"] = "CRITICALITY";
|
26
|
-
AssetSortByProperty["DigitalKeyMode"] = "DIGITAL_KEY_MODE";
|
27
|
-
AssetSortByProperty["ExternalReference"] = "EXTERNAL_REFERENCE";
|
28
|
-
AssetSortByProperty["Location"] = "LOCATION";
|
29
|
-
AssetSortByProperty["LocationUpdatedAt"] = "LOCATION_UPDATED_AT";
|
30
|
-
AssetSortByProperty["Model"] = "MODEL";
|
31
|
-
AssetSortByProperty["Name"] = "NAME";
|
32
|
-
AssetSortByProperty["OwnerAccountName"] = "OWNER_ACCOUNT_NAME";
|
33
|
-
AssetSortByProperty["ProductionYear"] = "PRODUCTION_YEAR";
|
34
|
-
AssetSortByProperty["SerialNumber"] = "SERIAL_NUMBER";
|
35
|
-
AssetSortByProperty["ServicePlanAssignmentStatus"] = "SERVICE_PLAN_ASSIGNMENT_STATUS";
|
36
|
-
AssetSortByProperty["ServicePlanOverdueness"] = "SERVICE_PLAN_OVERDUENESS";
|
37
|
-
AssetSortByProperty["ServicePlanStatus"] = "SERVICE_PLAN_STATUS";
|
38
|
-
AssetSortByProperty["TelematicsDeviceSerialNumber"] = "TELEMATICS_DEVICE_SERIAL_NUMBER";
|
39
|
-
AssetSortByProperty["Type"] = "TYPE";
|
40
|
-
})(exports.AssetSortByProperty || (exports.AssetSortByProperty = {}));
|
41
|
-
exports.SortOrder = void 0;
|
42
|
-
(function (SortOrder) {
|
43
|
-
SortOrder["Asc"] = "ASC";
|
44
|
-
SortOrder["Desc"] = "DESC";
|
20
|
+
exports.AssetSortByProperty = void 0;
|
21
|
+
(function (AssetSortByProperty) {
|
22
|
+
AssetSortByProperty["Activity"] = "ACTIVITY";
|
23
|
+
AssetSortByProperty["Brand"] = "BRAND";
|
24
|
+
AssetSortByProperty["Category"] = "CATEGORY";
|
25
|
+
AssetSortByProperty["Criticality"] = "CRITICALITY";
|
26
|
+
AssetSortByProperty["DigitalKeyMode"] = "DIGITAL_KEY_MODE";
|
27
|
+
AssetSortByProperty["ExternalReference"] = "EXTERNAL_REFERENCE";
|
28
|
+
AssetSortByProperty["Location"] = "LOCATION";
|
29
|
+
AssetSortByProperty["LocationUpdatedAt"] = "LOCATION_UPDATED_AT";
|
30
|
+
AssetSortByProperty["Model"] = "MODEL";
|
31
|
+
AssetSortByProperty["Name"] = "NAME";
|
32
|
+
AssetSortByProperty["OwnerAccountName"] = "OWNER_ACCOUNT_NAME";
|
33
|
+
AssetSortByProperty["ProductionYear"] = "PRODUCTION_YEAR";
|
34
|
+
AssetSortByProperty["SerialNumber"] = "SERIAL_NUMBER";
|
35
|
+
AssetSortByProperty["ServicePlanAssignmentStatus"] = "SERVICE_PLAN_ASSIGNMENT_STATUS";
|
36
|
+
AssetSortByProperty["ServicePlanOverdueness"] = "SERVICE_PLAN_OVERDUENESS";
|
37
|
+
AssetSortByProperty["ServicePlanStatus"] = "SERVICE_PLAN_STATUS";
|
38
|
+
AssetSortByProperty["TelematicsDeviceSerialNumber"] = "TELEMATICS_DEVICE_SERIAL_NUMBER";
|
39
|
+
AssetSortByProperty["Type"] = "TYPE";
|
40
|
+
})(exports.AssetSortByProperty || (exports.AssetSortByProperty = {}));
|
41
|
+
exports.SortOrder = void 0;
|
42
|
+
(function (SortOrder) {
|
43
|
+
SortOrder["Asc"] = "ASC";
|
44
|
+
SortOrder["Desc"] = "DESC";
|
45
45
|
})(exports.SortOrder || (exports.SortOrder = {}));
|
46
46
|
|
47
|
-
const UserSubscriptionPackage = {
|
48
|
-
EXPLORE_FLEET_OWNER: "Explore (Fleet Owner)",
|
49
|
-
EVOLVE_FLEET_OWNER: "Evolve (Fleet Owner)",
|
50
|
-
EXPAND_FLEET_OWNER: "Expand (Fleet Owner)",
|
51
|
-
EXPLORE_OEM: "Explore (OEM)",
|
52
|
-
EVOLVE_OEM: "Evolve (OEM)",
|
53
|
-
EXPAND_OEM: "Expand (OEM)",
|
54
|
-
COLLECT: "COLLECT",
|
55
|
-
INSIGHT: "INSIGHT",
|
56
|
-
VIEW: "VIEW",
|
57
|
-
NONE: "NONE",
|
47
|
+
const UserSubscriptionPackage = {
|
48
|
+
EXPLORE_FLEET_OWNER: "Explore (Fleet Owner)",
|
49
|
+
EVOLVE_FLEET_OWNER: "Evolve (Fleet Owner)",
|
50
|
+
EXPAND_FLEET_OWNER: "Expand (Fleet Owner)",
|
51
|
+
EXPLORE_OEM: "Explore (OEM)",
|
52
|
+
EVOLVE_OEM: "Evolve (OEM)",
|
53
|
+
EXPAND_OEM: "Expand (OEM)",
|
54
|
+
COLLECT: "COLLECT",
|
55
|
+
INSIGHT: "INSIGHT",
|
56
|
+
VIEW: "VIEW",
|
57
|
+
NONE: "NONE",
|
58
58
|
};
|
59
59
|
|
60
60
|
exports.UserSubscriptionPackage = UserSubscriptionPackage;
|
package/index.js
CHANGED
@@ -1,56 +1,56 @@
|
|
1
|
-
/**
|
2
|
-
* Takes an event type and a description and returns an event
|
3
|
-
*
|
4
|
-
* @template T The event type.
|
5
|
-
* Use existing from EventTypes.ts or make custom inline for one offs.
|
6
|
-
* Defaults to BaseEvent
|
7
|
-
* @param {{ description: string }} event with the interface of the event type to be filled later
|
8
|
-
* @returns {*} {Event<T>}
|
9
|
-
*/
|
10
|
-
const createEvent = (event) => ({
|
11
|
-
description: event === null || event === void 0 ? void 0 : event.description,
|
12
|
-
amplitudeName: event === null || event === void 0 ? void 0 : event.amplitudeName,
|
13
|
-
properties: {},
|
1
|
+
/**
|
2
|
+
* Takes an event type and a description and returns an event
|
3
|
+
*
|
4
|
+
* @template T The event type.
|
5
|
+
* Use existing from EventTypes.ts or make custom inline for one offs.
|
6
|
+
* Defaults to BaseEvent
|
7
|
+
* @param {{ description: string }} event with the interface of the event type to be filled later
|
8
|
+
* @returns {*} {Event<T>}
|
9
|
+
*/
|
10
|
+
const createEvent = (event) => ({
|
11
|
+
description: event === null || event === void 0 ? void 0 : event.description,
|
12
|
+
amplitudeName: event === null || event === void 0 ? void 0 : event.amplitudeName,
|
13
|
+
properties: {},
|
14
14
|
});
|
15
15
|
|
16
|
-
var AssetSortByProperty;
|
17
|
-
(function (AssetSortByProperty) {
|
18
|
-
AssetSortByProperty["Activity"] = "ACTIVITY";
|
19
|
-
AssetSortByProperty["Brand"] = "BRAND";
|
20
|
-
AssetSortByProperty["Category"] = "CATEGORY";
|
21
|
-
AssetSortByProperty["Criticality"] = "CRITICALITY";
|
22
|
-
AssetSortByProperty["DigitalKeyMode"] = "DIGITAL_KEY_MODE";
|
23
|
-
AssetSortByProperty["ExternalReference"] = "EXTERNAL_REFERENCE";
|
24
|
-
AssetSortByProperty["Location"] = "LOCATION";
|
25
|
-
AssetSortByProperty["LocationUpdatedAt"] = "LOCATION_UPDATED_AT";
|
26
|
-
AssetSortByProperty["Model"] = "MODEL";
|
27
|
-
AssetSortByProperty["Name"] = "NAME";
|
28
|
-
AssetSortByProperty["OwnerAccountName"] = "OWNER_ACCOUNT_NAME";
|
29
|
-
AssetSortByProperty["ProductionYear"] = "PRODUCTION_YEAR";
|
30
|
-
AssetSortByProperty["SerialNumber"] = "SERIAL_NUMBER";
|
31
|
-
AssetSortByProperty["ServicePlanAssignmentStatus"] = "SERVICE_PLAN_ASSIGNMENT_STATUS";
|
32
|
-
AssetSortByProperty["ServicePlanOverdueness"] = "SERVICE_PLAN_OVERDUENESS";
|
33
|
-
AssetSortByProperty["ServicePlanStatus"] = "SERVICE_PLAN_STATUS";
|
34
|
-
AssetSortByProperty["TelematicsDeviceSerialNumber"] = "TELEMATICS_DEVICE_SERIAL_NUMBER";
|
35
|
-
AssetSortByProperty["Type"] = "TYPE";
|
36
|
-
})(AssetSortByProperty || (AssetSortByProperty = {}));
|
37
|
-
var SortOrder;
|
38
|
-
(function (SortOrder) {
|
39
|
-
SortOrder["Asc"] = "ASC";
|
40
|
-
SortOrder["Desc"] = "DESC";
|
16
|
+
var AssetSortByProperty;
|
17
|
+
(function (AssetSortByProperty) {
|
18
|
+
AssetSortByProperty["Activity"] = "ACTIVITY";
|
19
|
+
AssetSortByProperty["Brand"] = "BRAND";
|
20
|
+
AssetSortByProperty["Category"] = "CATEGORY";
|
21
|
+
AssetSortByProperty["Criticality"] = "CRITICALITY";
|
22
|
+
AssetSortByProperty["DigitalKeyMode"] = "DIGITAL_KEY_MODE";
|
23
|
+
AssetSortByProperty["ExternalReference"] = "EXTERNAL_REFERENCE";
|
24
|
+
AssetSortByProperty["Location"] = "LOCATION";
|
25
|
+
AssetSortByProperty["LocationUpdatedAt"] = "LOCATION_UPDATED_AT";
|
26
|
+
AssetSortByProperty["Model"] = "MODEL";
|
27
|
+
AssetSortByProperty["Name"] = "NAME";
|
28
|
+
AssetSortByProperty["OwnerAccountName"] = "OWNER_ACCOUNT_NAME";
|
29
|
+
AssetSortByProperty["ProductionYear"] = "PRODUCTION_YEAR";
|
30
|
+
AssetSortByProperty["SerialNumber"] = "SERIAL_NUMBER";
|
31
|
+
AssetSortByProperty["ServicePlanAssignmentStatus"] = "SERVICE_PLAN_ASSIGNMENT_STATUS";
|
32
|
+
AssetSortByProperty["ServicePlanOverdueness"] = "SERVICE_PLAN_OVERDUENESS";
|
33
|
+
AssetSortByProperty["ServicePlanStatus"] = "SERVICE_PLAN_STATUS";
|
34
|
+
AssetSortByProperty["TelematicsDeviceSerialNumber"] = "TELEMATICS_DEVICE_SERIAL_NUMBER";
|
35
|
+
AssetSortByProperty["Type"] = "TYPE";
|
36
|
+
})(AssetSortByProperty || (AssetSortByProperty = {}));
|
37
|
+
var SortOrder;
|
38
|
+
(function (SortOrder) {
|
39
|
+
SortOrder["Asc"] = "ASC";
|
40
|
+
SortOrder["Desc"] = "DESC";
|
41
41
|
})(SortOrder || (SortOrder = {}));
|
42
42
|
|
43
|
-
const UserSubscriptionPackage = {
|
44
|
-
EXPLORE_FLEET_OWNER: "Explore (Fleet Owner)",
|
45
|
-
EVOLVE_FLEET_OWNER: "Evolve (Fleet Owner)",
|
46
|
-
EXPAND_FLEET_OWNER: "Expand (Fleet Owner)",
|
47
|
-
EXPLORE_OEM: "Explore (OEM)",
|
48
|
-
EVOLVE_OEM: "Evolve (OEM)",
|
49
|
-
EXPAND_OEM: "Expand (OEM)",
|
50
|
-
COLLECT: "COLLECT",
|
51
|
-
INSIGHT: "INSIGHT",
|
52
|
-
VIEW: "VIEW",
|
53
|
-
NONE: "NONE",
|
43
|
+
const UserSubscriptionPackage = {
|
44
|
+
EXPLORE_FLEET_OWNER: "Explore (Fleet Owner)",
|
45
|
+
EVOLVE_FLEET_OWNER: "Evolve (Fleet Owner)",
|
46
|
+
EXPAND_FLEET_OWNER: "Expand (Fleet Owner)",
|
47
|
+
EXPLORE_OEM: "Explore (OEM)",
|
48
|
+
EVOLVE_OEM: "Evolve (OEM)",
|
49
|
+
EXPAND_OEM: "Expand (OEM)",
|
50
|
+
COLLECT: "COLLECT",
|
51
|
+
INSIGHT: "INSIGHT",
|
52
|
+
VIEW: "VIEW",
|
53
|
+
NONE: "NONE",
|
54
54
|
};
|
55
55
|
|
56
56
|
export { AssetSortByProperty, SortOrder, UserSubscriptionPackage, createEvent };
|
package/package.json
CHANGED
@@ -1,78 +1,78 @@
|
|
1
|
-
export type UnspecifiedEvent = Record<string, string | number | boolean | null | undefined | (string | number)[]>;
|
2
|
-
export interface BaseEvent {
|
3
|
-
additionalProperties?: UnspecifiedEvent;
|
4
|
-
}
|
5
|
-
export type Event<T> = {
|
6
|
-
/**
|
7
|
-
* Explain what this event means
|
8
|
-
*/
|
9
|
-
description?: string;
|
10
|
-
/**
|
11
|
-
* Alternative name to show in Amplitude. Only here for legacy reasons.
|
12
|
-
*/
|
13
|
-
amplitudeName?: string;
|
14
|
-
/**
|
15
|
-
* The properties to log. Pick an existing type or make a custom one.
|
16
|
-
* Be specific.
|
17
|
-
*/
|
18
|
-
properties: T;
|
19
|
-
};
|
20
|
-
/**
|
21
|
-
* Takes an event type and a description and returns an event
|
22
|
-
*
|
23
|
-
* @template T The event type.
|
24
|
-
* Use existing from EventTypes.ts or make custom inline for one offs.
|
25
|
-
* Defaults to BaseEvent
|
26
|
-
* @param {{ description: string }} event with the interface of the event type to be filled later
|
27
|
-
* @returns {*} {Event<T>}
|
28
|
-
*/
|
29
|
-
export declare const createEvent: <T extends object = BaseEvent>(event?: {
|
30
|
-
amplitudeName?: string;
|
31
|
-
description?: string;
|
32
|
-
}) => Event<T>;
|
33
|
-
export interface IAnalyticsContext<Events extends Record<string, Event<BaseEvent | UnspecifiedEvent>>> {
|
34
|
-
/**
|
35
|
-
* @template EventName
|
36
|
-
* @param {EventName} eventName Name of the event. Used to look up event interface in EventName.ts
|
37
|
-
* @param {Events[T]["properties"]} details Event parameters. Must match event interface.
|
38
|
-
* @param {{prefix: string, postfix: string}} nameSupplement Generally not reccommended.
|
39
|
-
*
|
40
|
-
* **Prefix**: Add a prefix to begging event name when logging.
|
41
|
-
*
|
42
|
-
* **Postfix**: Add string to end of event name when logging.
|
43
|
-
* Makes unique events possible, while sharing the same EventName + type.
|
44
|
-
* Only here because the analytics team wants each report to log a unique event
|
45
|
-
* for easier comparison in Databricks.
|
46
|
-
*/
|
47
|
-
logEvent<T extends keyof Events>(eventName: T, details: Events[T]["properties"], nameSupplement?: {
|
48
|
-
prefix?: string;
|
49
|
-
postfix?: string;
|
50
|
-
}): void;
|
51
|
-
/**
|
52
|
-
*
|
53
|
-
* @param details
|
54
|
-
*/
|
55
|
-
logPageView(details: {
|
56
|
-
pageName: string;
|
57
|
-
} & BaseEvent): void;
|
58
|
-
/**
|
59
|
-
* Log an error event.
|
60
|
-
*
|
61
|
-
* @param details The error event to log.
|
62
|
-
*/
|
63
|
-
logError(details: UnspecifiedEvent): void;
|
64
|
-
/**
|
65
|
-
* Track this user property for each event.
|
66
|
-
*
|
67
|
-
* @param name key of property to set
|
68
|
-
* @param data value of property to set
|
69
|
-
*/
|
70
|
-
setUserProperty(name: string, data: string | number): void;
|
71
|
-
}
|
72
|
-
type PromisifyMethod<T> = T extends (...args: infer U) => infer V ? (...args: U) => Promise<V> : T;
|
73
|
-
type PromisifyObject<T> = {
|
74
|
-
[K in keyof T]: PromisifyMethod<T[K]>;
|
75
|
-
};
|
76
|
-
export interface IAnalyticsContextAsync<T extends Record<string, Event<BaseEvent | UnspecifiedEvent>>> extends PromisifyObject<IAnalyticsContext<T>> {
|
77
|
-
}
|
78
|
-
export {};
|
1
|
+
export type UnspecifiedEvent = Record<string, string | number | boolean | null | undefined | (string | number)[]>;
|
2
|
+
export interface BaseEvent {
|
3
|
+
additionalProperties?: UnspecifiedEvent;
|
4
|
+
}
|
5
|
+
export type Event<T> = {
|
6
|
+
/**
|
7
|
+
* Explain what this event means
|
8
|
+
*/
|
9
|
+
description?: string;
|
10
|
+
/**
|
11
|
+
* Alternative name to show in Amplitude. Only here for legacy reasons.
|
12
|
+
*/
|
13
|
+
amplitudeName?: string;
|
14
|
+
/**
|
15
|
+
* The properties to log. Pick an existing type or make a custom one.
|
16
|
+
* Be specific.
|
17
|
+
*/
|
18
|
+
properties: T;
|
19
|
+
};
|
20
|
+
/**
|
21
|
+
* Takes an event type and a description and returns an event
|
22
|
+
*
|
23
|
+
* @template T The event type.
|
24
|
+
* Use existing from EventTypes.ts or make custom inline for one offs.
|
25
|
+
* Defaults to BaseEvent
|
26
|
+
* @param {{ description: string }} event with the interface of the event type to be filled later
|
27
|
+
* @returns {*} {Event<T>}
|
28
|
+
*/
|
29
|
+
export declare const createEvent: <T extends object = BaseEvent>(event?: {
|
30
|
+
amplitudeName?: string;
|
31
|
+
description?: string;
|
32
|
+
}) => Event<T>;
|
33
|
+
export interface IAnalyticsContext<Events extends Record<string, Event<BaseEvent | UnspecifiedEvent>>> {
|
34
|
+
/**
|
35
|
+
* @template EventName
|
36
|
+
* @param {EventName} eventName Name of the event. Used to look up event interface in EventName.ts
|
37
|
+
* @param {Events[T]["properties"]} details Event parameters. Must match event interface.
|
38
|
+
* @param {{prefix: string, postfix: string}} nameSupplement Generally not reccommended.
|
39
|
+
*
|
40
|
+
* **Prefix**: Add a prefix to begging event name when logging.
|
41
|
+
*
|
42
|
+
* **Postfix**: Add string to end of event name when logging.
|
43
|
+
* Makes unique events possible, while sharing the same EventName + type.
|
44
|
+
* Only here because the analytics team wants each report to log a unique event
|
45
|
+
* for easier comparison in Databricks.
|
46
|
+
*/
|
47
|
+
logEvent<T extends keyof Events>(eventName: T, details: Events[T]["properties"], nameSupplement?: {
|
48
|
+
prefix?: string;
|
49
|
+
postfix?: string;
|
50
|
+
}): void;
|
51
|
+
/**
|
52
|
+
*
|
53
|
+
* @param details
|
54
|
+
*/
|
55
|
+
logPageView(details: {
|
56
|
+
pageName: string;
|
57
|
+
} & BaseEvent): void;
|
58
|
+
/**
|
59
|
+
* Log an error event.
|
60
|
+
*
|
61
|
+
* @param details The error event to log.
|
62
|
+
*/
|
63
|
+
logError(details: UnspecifiedEvent): void;
|
64
|
+
/**
|
65
|
+
* Track this user property for each event.
|
66
|
+
*
|
67
|
+
* @param name key of property to set
|
68
|
+
* @param data value of property to set
|
69
|
+
*/
|
70
|
+
setUserProperty(name: string, data: string | number): void;
|
71
|
+
}
|
72
|
+
type PromisifyMethod<T> = T extends (...args: infer U) => infer V ? (...args: U) => Promise<V> : T;
|
73
|
+
type PromisifyObject<T> = {
|
74
|
+
[K in keyof T]: PromisifyMethod<T[K]>;
|
75
|
+
};
|
76
|
+
export interface IAnalyticsContextAsync<T extends Record<string, Event<BaseEvent | UnspecifiedEvent>>> extends PromisifyObject<IAnalyticsContext<T>> {
|
77
|
+
}
|
78
|
+
export {};
|
@@ -1,34 +1,34 @@
|
|
1
|
-
export interface IAssetSortingContext {
|
2
|
-
sortingState: SortingState;
|
3
|
-
setSortBy: (sortBy: AssetSortByProperty, order?: SortOrder) => void;
|
4
|
-
}
|
5
|
-
export interface SortingState {
|
6
|
-
/** The property to sort by. */
|
7
|
-
sortBy: AssetSortByProperty;
|
8
|
-
/** The property to sort by. */
|
9
|
-
order: SortOrder;
|
10
|
-
}
|
11
|
-
export declare enum AssetSortByProperty {
|
12
|
-
Activity = "ACTIVITY",
|
13
|
-
Brand = "BRAND",
|
14
|
-
Category = "CATEGORY",
|
15
|
-
Criticality = "CRITICALITY",
|
16
|
-
DigitalKeyMode = "DIGITAL_KEY_MODE",
|
17
|
-
ExternalReference = "EXTERNAL_REFERENCE",
|
18
|
-
Location = "LOCATION",
|
19
|
-
LocationUpdatedAt = "LOCATION_UPDATED_AT",
|
20
|
-
Model = "MODEL",
|
21
|
-
Name = "NAME",
|
22
|
-
OwnerAccountName = "OWNER_ACCOUNT_NAME",
|
23
|
-
ProductionYear = "PRODUCTION_YEAR",
|
24
|
-
SerialNumber = "SERIAL_NUMBER",
|
25
|
-
ServicePlanAssignmentStatus = "SERVICE_PLAN_ASSIGNMENT_STATUS",
|
26
|
-
ServicePlanOverdueness = "SERVICE_PLAN_OVERDUENESS",
|
27
|
-
ServicePlanStatus = "SERVICE_PLAN_STATUS",
|
28
|
-
TelematicsDeviceSerialNumber = "TELEMATICS_DEVICE_SERIAL_NUMBER",
|
29
|
-
Type = "TYPE"
|
30
|
-
}
|
31
|
-
export declare enum SortOrder {
|
32
|
-
Asc = "ASC",
|
33
|
-
Desc = "DESC"
|
34
|
-
}
|
1
|
+
export interface IAssetSortingContext {
|
2
|
+
sortingState: SortingState;
|
3
|
+
setSortBy: (sortBy: AssetSortByProperty, order?: SortOrder) => void;
|
4
|
+
}
|
5
|
+
export interface SortingState {
|
6
|
+
/** The property to sort by. */
|
7
|
+
sortBy: AssetSortByProperty;
|
8
|
+
/** The property to sort by. */
|
9
|
+
order: SortOrder;
|
10
|
+
}
|
11
|
+
export declare enum AssetSortByProperty {
|
12
|
+
Activity = "ACTIVITY",
|
13
|
+
Brand = "BRAND",
|
14
|
+
Category = "CATEGORY",
|
15
|
+
Criticality = "CRITICALITY",
|
16
|
+
DigitalKeyMode = "DIGITAL_KEY_MODE",
|
17
|
+
ExternalReference = "EXTERNAL_REFERENCE",
|
18
|
+
Location = "LOCATION",
|
19
|
+
LocationUpdatedAt = "LOCATION_UPDATED_AT",
|
20
|
+
Model = "MODEL",
|
21
|
+
Name = "NAME",
|
22
|
+
OwnerAccountName = "OWNER_ACCOUNT_NAME",
|
23
|
+
ProductionYear = "PRODUCTION_YEAR",
|
24
|
+
SerialNumber = "SERIAL_NUMBER",
|
25
|
+
ServicePlanAssignmentStatus = "SERVICE_PLAN_ASSIGNMENT_STATUS",
|
26
|
+
ServicePlanOverdueness = "SERVICE_PLAN_OVERDUENESS",
|
27
|
+
ServicePlanStatus = "SERVICE_PLAN_STATUS",
|
28
|
+
TelematicsDeviceSerialNumber = "TELEMATICS_DEVICE_SERIAL_NUMBER",
|
29
|
+
Type = "TYPE"
|
30
|
+
}
|
31
|
+
export declare enum SortOrder {
|
32
|
+
Asc = "ASC",
|
33
|
+
Desc = "DESC"
|
34
|
+
}
|
@@ -1,60 +1,60 @@
|
|
1
|
-
import { UserSubscriptionPackageType } from "./userSubscriptionContext";
|
2
|
-
export interface ICurrentUserContext {
|
3
|
-
tasUserId: string | undefined;
|
4
|
-
/**
|
5
|
-
* userName used when logging in. Undefined if not authenticated
|
6
|
-
*/
|
7
|
-
userName: string | undefined;
|
8
|
-
/**
|
9
|
-
* user role of current user. Undefined if not authenticated
|
10
|
-
*/
|
11
|
-
userRole: string | undefined;
|
12
|
-
/**
|
13
|
-
* Legacy user id. Undefined if not authenticated
|
14
|
-
*/
|
15
|
-
userId: number | undefined;
|
16
|
-
/**
|
17
|
-
* Legacy customer id. Undefined if not authenticated
|
18
|
-
*/
|
19
|
-
customerId: number | undefined;
|
20
|
-
/**
|
21
|
-
* Account ID. undefined if not authenticated
|
22
|
-
*/
|
23
|
-
accountId: string | undefined;
|
24
|
-
/**
|
25
|
-
* If currently assuming a different user, this contains the information of that user. Null if not assuming
|
26
|
-
*/
|
27
|
-
assumedUser: {
|
28
|
-
userId: number;
|
29
|
-
customerId: number;
|
30
|
-
accountId: string;
|
31
|
-
tasUserId: string | undefined;
|
32
|
-
} | null;
|
33
|
-
email: string | undefined;
|
34
|
-
name: string | undefined;
|
35
|
-
jobTitle: string | undefined;
|
36
|
-
/**
|
37
|
-
* Is the user currently assuming a different user
|
38
|
-
*/
|
39
|
-
isAssuming: boolean;
|
40
|
-
/**
|
41
|
-
* Is the user a Trackunit user
|
42
|
-
*/
|
43
|
-
isTrackunitUser: boolean;
|
44
|
-
/**
|
45
|
-
* Is there an authenticated user or not
|
46
|
-
*/
|
47
|
-
isAuthenticated: boolean;
|
48
|
-
/**
|
49
|
-
* Is user verified in Okta
|
50
|
-
*/
|
51
|
-
isVerified: boolean | undefined;
|
52
|
-
/**
|
53
|
-
* Is user is account owner
|
54
|
-
*/
|
55
|
-
isAccountOwner: boolean | undefined;
|
56
|
-
/**
|
57
|
-
* accounts subscription package name
|
58
|
-
*/
|
59
|
-
subscriptionPackage: UserSubscriptionPackageType | undefined;
|
60
|
-
}
|
1
|
+
import { UserSubscriptionPackageType } from "./userSubscriptionContext";
|
2
|
+
export interface ICurrentUserContext {
|
3
|
+
tasUserId: string | undefined;
|
4
|
+
/**
|
5
|
+
* userName used when logging in. Undefined if not authenticated
|
6
|
+
*/
|
7
|
+
userName: string | undefined;
|
8
|
+
/**
|
9
|
+
* user role of current user. Undefined if not authenticated
|
10
|
+
*/
|
11
|
+
userRole: string | undefined;
|
12
|
+
/**
|
13
|
+
* Legacy user id. Undefined if not authenticated
|
14
|
+
*/
|
15
|
+
userId: number | undefined;
|
16
|
+
/**
|
17
|
+
* Legacy customer id. Undefined if not authenticated
|
18
|
+
*/
|
19
|
+
customerId: number | undefined;
|
20
|
+
/**
|
21
|
+
* Account ID. undefined if not authenticated
|
22
|
+
*/
|
23
|
+
accountId: string | undefined;
|
24
|
+
/**
|
25
|
+
* If currently assuming a different user, this contains the information of that user. Null if not assuming
|
26
|
+
*/
|
27
|
+
assumedUser: {
|
28
|
+
userId: number;
|
29
|
+
customerId: number;
|
30
|
+
accountId: string;
|
31
|
+
tasUserId: string | undefined;
|
32
|
+
} | null;
|
33
|
+
email: string | undefined;
|
34
|
+
name: string | undefined;
|
35
|
+
jobTitle: string | undefined;
|
36
|
+
/**
|
37
|
+
* Is the user currently assuming a different user
|
38
|
+
*/
|
39
|
+
isAssuming: boolean;
|
40
|
+
/**
|
41
|
+
* Is the user a Trackunit user
|
42
|
+
*/
|
43
|
+
isTrackunitUser: boolean;
|
44
|
+
/**
|
45
|
+
* Is there an authenticated user or not
|
46
|
+
*/
|
47
|
+
isAuthenticated: boolean;
|
48
|
+
/**
|
49
|
+
* Is user verified in Okta
|
50
|
+
*/
|
51
|
+
isVerified: boolean | undefined;
|
52
|
+
/**
|
53
|
+
* Is user is account owner
|
54
|
+
*/
|
55
|
+
isAccountOwner: boolean | undefined;
|
56
|
+
/**
|
57
|
+
* accounts subscription package name
|
58
|
+
*/
|
59
|
+
subscriptionPackage: UserSubscriptionPackageType | undefined;
|
60
|
+
}
|
@@ -1,30 +1,31 @@
|
|
1
|
-
export interface ITracingHeaders {
|
2
|
-
"X-TrackunitAppVersion": string;
|
3
|
-
"session-id": string;
|
4
|
-
}
|
5
|
-
export interface IEnvironmentContext {
|
6
|
-
auth: {
|
7
|
-
url: string;
|
8
|
-
clientId: string;
|
9
|
-
issuer: string;
|
10
|
-
};
|
11
|
-
tracingHeaders: ITracingHeaders;
|
12
|
-
managerClassicUrl: string;
|
13
|
-
googleMapsApiKey: string;
|
14
|
-
amplitudeApiKey: string;
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
1
|
+
export interface ITracingHeaders {
|
2
|
+
"X-TrackunitAppVersion": string;
|
3
|
+
"session-id": string;
|
4
|
+
}
|
5
|
+
export interface IEnvironmentContext {
|
6
|
+
auth: {
|
7
|
+
url: string;
|
8
|
+
clientId: string;
|
9
|
+
issuer: string;
|
10
|
+
};
|
11
|
+
tracingHeaders: ITracingHeaders;
|
12
|
+
managerClassicUrl: string;
|
13
|
+
googleMapsApiKey: string;
|
14
|
+
amplitudeApiKey: string;
|
15
|
+
amplitudeApiEndpoint: string;
|
16
|
+
graphqlPublicUrl: string;
|
17
|
+
graphqlManagerUrl: string;
|
18
|
+
graphqlManagerImageUploadUrl: string;
|
19
|
+
graphqlReportUrl: string;
|
20
|
+
buildVersion: string;
|
21
|
+
commitNumber: number;
|
22
|
+
buildDate: string;
|
23
|
+
publicUrl: string;
|
24
|
+
irisAppSdkServerUrl: string;
|
25
|
+
isDev: boolean;
|
26
|
+
environment: string;
|
27
|
+
sentryDsn: string;
|
28
|
+
sessionId: string;
|
29
|
+
trackunitRestApiUrl: string;
|
30
|
+
hubspotRequestAppAccessFormId: string;
|
31
|
+
}
|
@@ -1,18 +1,18 @@
|
|
1
|
-
export interface IGlobalSelectionContext {
|
2
|
-
/**
|
3
|
-
* Details about the globally selected entity and its type
|
4
|
-
* returns `null` if no selection currently.
|
5
|
-
*/
|
6
|
-
selection: Readonly<SiteSelection | GroupSelection> | null;
|
7
|
-
}
|
8
|
-
export interface SiteSelection extends TypedSelection<"site"> {
|
9
|
-
siteId: string;
|
10
|
-
}
|
11
|
-
export interface GroupSelection extends TypedSelection<"group"> {
|
12
|
-
groupId: string;
|
13
|
-
}
|
14
|
-
interface TypedSelection<Type extends string> {
|
15
|
-
type: Type;
|
16
|
-
displayName: string;
|
17
|
-
}
|
18
|
-
export {};
|
1
|
+
export interface IGlobalSelectionContext {
|
2
|
+
/**
|
3
|
+
* Details about the globally selected entity and its type
|
4
|
+
* returns `null` if no selection currently.
|
5
|
+
*/
|
6
|
+
selection: Readonly<SiteSelection | GroupSelection> | null;
|
7
|
+
}
|
8
|
+
export interface SiteSelection extends TypedSelection<"site"> {
|
9
|
+
siteId: string;
|
10
|
+
}
|
11
|
+
export interface GroupSelection extends TypedSelection<"group"> {
|
12
|
+
groupId: string;
|
13
|
+
}
|
14
|
+
interface TypedSelection<Type extends string> {
|
15
|
+
type: Type;
|
16
|
+
displayName: string;
|
17
|
+
}
|
18
|
+
export {};
|
package/src/index.d.ts
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
export * from "./analyticsContext";
|
2
|
-
export * from "./assetSortingContext";
|
3
|
-
export * from "./currentUserContext";
|
4
|
-
export * from "./environmentContext";
|
5
|
-
export * from "./globalSelectionContext";
|
6
|
-
export * from "./oemBrandingContext";
|
7
|
-
export * from "./toastContext";
|
8
|
-
export * from "./tokenContext";
|
9
|
-
export * from "./userSubscriptionContext";
|
1
|
+
export * from "./analyticsContext";
|
2
|
+
export * from "./assetSortingContext";
|
3
|
+
export * from "./currentUserContext";
|
4
|
+
export * from "./environmentContext";
|
5
|
+
export * from "./globalSelectionContext";
|
6
|
+
export * from "./oemBrandingContext";
|
7
|
+
export * from "./toastContext";
|
8
|
+
export * from "./tokenContext";
|
9
|
+
export * from "./userSubscriptionContext";
|
@@ -1,45 +1,45 @@
|
|
1
|
-
/**
|
2
|
-
* Branding information for an asset
|
3
|
-
*/
|
4
|
-
export interface OemBranding {
|
5
|
-
/**
|
6
|
-
* Weather or not the logo exist for this brand.
|
7
|
-
*/
|
8
|
-
logo: boolean;
|
9
|
-
/**
|
10
|
-
* Weather or not the darkLogo exist for this brand.
|
11
|
-
*/
|
12
|
-
darkLogo: boolean;
|
13
|
-
/**
|
14
|
-
* Weather or not the banner exist for this brand.
|
15
|
-
*/
|
16
|
-
assetBanner: boolean;
|
17
|
-
/**
|
18
|
-
* The color to use for this brand if it is set.
|
19
|
-
*/
|
20
|
-
color?: string;
|
21
|
-
/**
|
22
|
-
* Weather or not the platformLogo exist for this brand.
|
23
|
-
*/
|
24
|
-
platformLogo: boolean;
|
25
|
-
/**
|
26
|
-
* The conditions for the OEM branding to be applied
|
27
|
-
*/
|
28
|
-
conditions?: {
|
29
|
-
/**
|
30
|
-
* The can profiles for the OEM branding to be applied
|
31
|
-
*/
|
32
|
-
canProfiles?: string[];
|
33
|
-
};
|
34
|
-
/**
|
35
|
-
* Default list of asset model images.
|
36
|
-
*/
|
37
|
-
modelImages?: {
|
38
|
-
[key: string]: string;
|
39
|
-
};
|
40
|
-
}
|
41
|
-
export type OemBrandingImageType = "logo" | "darkLogo" | "assetBanner" | "platformLogo" | "modelImages";
|
42
|
-
export interface IOemBrandingContext {
|
43
|
-
getOemBranding: (brand: string) => Promise<OemBranding | null>;
|
44
|
-
getOemImage: (imageType: OemBrandingImageType, brand: string, model?: string) => Promise<string | null>;
|
45
|
-
}
|
1
|
+
/**
|
2
|
+
* Branding information for an asset
|
3
|
+
*/
|
4
|
+
export interface OemBranding {
|
5
|
+
/**
|
6
|
+
* Weather or not the logo exist for this brand.
|
7
|
+
*/
|
8
|
+
logo: boolean;
|
9
|
+
/**
|
10
|
+
* Weather or not the darkLogo exist for this brand.
|
11
|
+
*/
|
12
|
+
darkLogo: boolean;
|
13
|
+
/**
|
14
|
+
* Weather or not the banner exist for this brand.
|
15
|
+
*/
|
16
|
+
assetBanner: boolean;
|
17
|
+
/**
|
18
|
+
* The color to use for this brand if it is set.
|
19
|
+
*/
|
20
|
+
color?: string;
|
21
|
+
/**
|
22
|
+
* Weather or not the platformLogo exist for this brand.
|
23
|
+
*/
|
24
|
+
platformLogo: boolean;
|
25
|
+
/**
|
26
|
+
* The conditions for the OEM branding to be applied
|
27
|
+
*/
|
28
|
+
conditions?: {
|
29
|
+
/**
|
30
|
+
* The can profiles for the OEM branding to be applied
|
31
|
+
*/
|
32
|
+
canProfiles?: string[];
|
33
|
+
};
|
34
|
+
/**
|
35
|
+
* Default list of asset model images.
|
36
|
+
*/
|
37
|
+
modelImages?: {
|
38
|
+
[key: string]: string;
|
39
|
+
};
|
40
|
+
}
|
41
|
+
export type OemBrandingImageType = "logo" | "darkLogo" | "assetBanner" | "platformLogo" | "modelImages";
|
42
|
+
export interface IOemBrandingContext {
|
43
|
+
getOemBranding: (brand: string) => Promise<OemBranding | null>;
|
44
|
+
getOemImage: (imageType: OemBrandingImageType, brand: string, model?: string) => Promise<string | null>;
|
45
|
+
}
|
package/src/toastContext.d.ts
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
/// <reference types="react" />
|
2
|
-
export type ToastColors = "info" | "warning" | "danger" | "success";
|
3
|
-
export type ToastAction = {
|
4
|
-
label: string;
|
5
|
-
onClick: () => void;
|
6
|
-
loading?: boolean;
|
7
|
-
};
|
8
|
-
export interface Toast {
|
9
|
-
id?: string;
|
10
|
-
intent: ToastColors;
|
11
|
-
title: string;
|
12
|
-
description?: string;
|
13
|
-
primaryAction?: ToastAction;
|
14
|
-
secondaryAction?: ToastAction;
|
15
|
-
duration?: number;
|
16
|
-
}
|
17
|
-
export interface IToastContext {
|
18
|
-
addToast: (toast: Toast) => Promise<void | "primaryAction" | "secondaryAction">;
|
19
|
-
setIsManifestError?: React.Dispatch<React.SetStateAction<boolean>>;
|
20
|
-
}
|
1
|
+
/// <reference types="react" />
|
2
|
+
export type ToastColors = "info" | "warning" | "danger" | "success";
|
3
|
+
export type ToastAction = {
|
4
|
+
label: string;
|
5
|
+
onClick: () => void;
|
6
|
+
loading?: boolean;
|
7
|
+
};
|
8
|
+
export interface Toast {
|
9
|
+
id?: string;
|
10
|
+
intent: ToastColors;
|
11
|
+
title: string;
|
12
|
+
description?: string;
|
13
|
+
primaryAction?: ToastAction;
|
14
|
+
secondaryAction?: ToastAction;
|
15
|
+
duration?: number;
|
16
|
+
}
|
17
|
+
export interface IToastContext {
|
18
|
+
addToast: (toast: Toast) => Promise<void | "primaryAction" | "secondaryAction">;
|
19
|
+
setIsManifestError?: React.Dispatch<React.SetStateAction<boolean>>;
|
20
|
+
}
|
package/src/tokenContext.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
export interface ITokenContext {
|
2
|
-
/**
|
3
|
-
* The current valid token or null if no token is available.
|
4
|
-
*/
|
5
|
-
token?: string;
|
6
|
-
}
|
1
|
+
export interface ITokenContext {
|
2
|
+
/**
|
3
|
+
* The current valid token or null if no token is available.
|
4
|
+
*/
|
5
|
+
token?: string;
|
6
|
+
}
|
@@ -1,39 +1,39 @@
|
|
1
|
-
export interface IUserSubscriptionContext {
|
2
|
-
/**
|
3
|
-
* The users subscription package
|
4
|
-
*/
|
5
|
-
packageType: UserSubscriptionPackageType;
|
6
|
-
/**
|
7
|
-
* Extra features enabled for the current user. Will be null if still loading
|
8
|
-
*/
|
9
|
-
features: IFeature[] | null;
|
10
|
-
/**
|
11
|
-
* Number of days you can see back in time for this subscription.
|
12
|
-
*
|
13
|
-
* Returns the number of days
|
14
|
-
*/
|
15
|
-
numberOfDaysWithAccessToHistoricalData: number;
|
16
|
-
/**
|
17
|
-
* Number of days you can see back in time for insights for this subscription.
|
18
|
-
*
|
19
|
-
* Returns the number of days
|
20
|
-
*/
|
21
|
-
numberOfDaysWithAccessToHistoricalInsights: number;
|
22
|
-
}
|
23
|
-
export declare const UserSubscriptionPackage: {
|
24
|
-
readonly EXPLORE_FLEET_OWNER: "Explore (Fleet Owner)";
|
25
|
-
readonly EVOLVE_FLEET_OWNER: "Evolve (Fleet Owner)";
|
26
|
-
readonly EXPAND_FLEET_OWNER: "Expand (Fleet Owner)";
|
27
|
-
readonly EXPLORE_OEM: "Explore (OEM)";
|
28
|
-
readonly EVOLVE_OEM: "Evolve (OEM)";
|
29
|
-
readonly EXPAND_OEM: "Expand (OEM)";
|
30
|
-
readonly COLLECT: "COLLECT";
|
31
|
-
readonly INSIGHT: "INSIGHT";
|
32
|
-
readonly VIEW: "VIEW";
|
33
|
-
readonly NONE: "NONE";
|
34
|
-
};
|
35
|
-
export type UserSubscriptionPackageType = keyof typeof UserSubscriptionPackage;
|
36
|
-
export interface IFeature {
|
37
|
-
id: string;
|
38
|
-
name: string;
|
39
|
-
}
|
1
|
+
export interface IUserSubscriptionContext {
|
2
|
+
/**
|
3
|
+
* The users subscription package
|
4
|
+
*/
|
5
|
+
packageType: UserSubscriptionPackageType;
|
6
|
+
/**
|
7
|
+
* Extra features enabled for the current user. Will be null if still loading
|
8
|
+
*/
|
9
|
+
features: IFeature[] | null;
|
10
|
+
/**
|
11
|
+
* Number of days you can see back in time for this subscription.
|
12
|
+
*
|
13
|
+
* Returns the number of days
|
14
|
+
*/
|
15
|
+
numberOfDaysWithAccessToHistoricalData: number;
|
16
|
+
/**
|
17
|
+
* Number of days you can see back in time for insights for this subscription.
|
18
|
+
*
|
19
|
+
* Returns the number of days
|
20
|
+
*/
|
21
|
+
numberOfDaysWithAccessToHistoricalInsights: number;
|
22
|
+
}
|
23
|
+
export declare const UserSubscriptionPackage: {
|
24
|
+
readonly EXPLORE_FLEET_OWNER: "Explore (Fleet Owner)";
|
25
|
+
readonly EVOLVE_FLEET_OWNER: "Evolve (Fleet Owner)";
|
26
|
+
readonly EXPAND_FLEET_OWNER: "Expand (Fleet Owner)";
|
27
|
+
readonly EXPLORE_OEM: "Explore (OEM)";
|
28
|
+
readonly EVOLVE_OEM: "Evolve (OEM)";
|
29
|
+
readonly EXPAND_OEM: "Expand (OEM)";
|
30
|
+
readonly COLLECT: "COLLECT";
|
31
|
+
readonly INSIGHT: "INSIGHT";
|
32
|
+
readonly VIEW: "VIEW";
|
33
|
+
readonly NONE: "NONE";
|
34
|
+
};
|
35
|
+
export type UserSubscriptionPackageType = keyof typeof UserSubscriptionPackage;
|
36
|
+
export interface IFeature {
|
37
|
+
id: string;
|
38
|
+
name: string;
|
39
|
+
}
|