@trackunit/react-core-contexts-api 0.2.154 → 0.2.156
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/package.json
CHANGED
@@ -17,6 +17,7 @@ export type Event<T> = {
|
|
17
17
|
*/
|
18
18
|
properties: T;
|
19
19
|
};
|
20
|
+
export type EventDictionary = Record<string, Event<BaseEvent | UnspecifiedEvent>>;
|
20
21
|
/**
|
21
22
|
* Takes an event type and a description and returns an event
|
22
23
|
*
|
@@ -29,11 +30,12 @@ export type Event<T> = {
|
|
29
30
|
export declare const createEvent: <T extends object = BaseEvent>(event?: {
|
30
31
|
description?: string;
|
31
32
|
}) => Event<T>;
|
32
|
-
export interface IAnalyticsContext<Events extends
|
33
|
+
export interface IAnalyticsContext<Events extends EventDictionary> {
|
33
34
|
/**
|
34
35
|
* @template EventName
|
35
36
|
* @param {EventName} eventName Name of the event. Used to look up event interface in EventName.ts
|
36
37
|
* @param details Event parameters. Must match event interface.
|
38
|
+
* @param description Description of the event.
|
37
39
|
* @param {{prefix: string, postfix: string}} nameSupplement Generally not reccommended.
|
38
40
|
*
|
39
41
|
* **Prefix**: Add a prefix to begging event name when logging.
|
@@ -72,6 +74,6 @@ type PromisifyMethod<T> = T extends (...args: infer U) => infer V ? (...args: U)
|
|
72
74
|
type PromisifyObject<T> = {
|
73
75
|
[K in keyof T]: PromisifyMethod<T[K]>;
|
74
76
|
};
|
75
|
-
export interface IAnalyticsContextAsync<T extends
|
77
|
+
export interface IAnalyticsContextAsync<T extends EventDictionary> extends PromisifyObject<IAnalyticsContext<T>> {
|
76
78
|
}
|
77
79
|
export {};
|