@trackunit/react-core-contexts-api 0.2.30 → 0.2.32

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 CHANGED
@@ -2,6 +2,21 @@
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: {},
18
+ });
19
+
5
20
  exports.AssetSortByProperty = void 0;
6
21
  (function (AssetSortByProperty) {
7
22
  AssetSortByProperty["Activity"] = "ACTIVITY";
@@ -42,3 +57,4 @@ const UserSubscriptionPackage = {
42
57
  };
43
58
 
44
59
  exports.UserSubscriptionPackage = UserSubscriptionPackage;
60
+ exports.createEvent = createEvent;
package/index.js CHANGED
@@ -1,3 +1,18 @@
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
+ });
15
+
1
16
  var AssetSortByProperty;
2
17
  (function (AssetSortByProperty) {
3
18
  AssetSortByProperty["Activity"] = "ACTIVITY";
@@ -37,4 +52,4 @@ const UserSubscriptionPackage = {
37
52
  NONE: "NONE",
38
53
  };
39
54
 
40
- export { AssetSortByProperty, SortOrder, UserSubscriptionPackage };
55
+ export { AssetSortByProperty, SortOrder, UserSubscriptionPackage, createEvent };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-core-contexts-api",
3
- "version": "0.2.30",
3
+ "version": "0.2.32",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "module": "./index.js",
@@ -17,6 +17,19 @@ export type Event<T> = {
17
17
  */
18
18
  properties: T;
19
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>;
20
33
  export interface IAnalyticsContext<Events extends Record<string, Event<BaseEvent | UnspecifiedEvent>>> {
21
34
  /**
22
35
  * @template EventName
package/src/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export * from "./assetSortingContext";
3
3
  export * from "./currentUserContext";
4
4
  export * from "./environmentContext";
5
5
  export * from "./globalSelectionContext";
6
+ export * from "./oemBrandingContext";
6
7
  export * from "./toastContext";
7
8
  export * from "./tokenContext";
8
9
  export * from "./userSubscriptionContext";
@@ -0,0 +1,39 @@
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
+ banner: 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
+ export type OemBrandingImageType = "logo" | "darkLogo" | "banner" | "platformLogo";
36
+ export interface IOemBrandingContext {
37
+ getOemBranding: (brand: string) => Promise<OemBranding | null>;
38
+ getOemImage: (imageType: OemBrandingImageType, brand: string) => Promise<string | null>;
39
+ }