-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [ONL-8253] feat: Added typings. * [ONL-8253] chore: Stop building node v16. * [ONL-8253] chore: Fixed default export. * 3.5.0 * [ONL-8253] pr: Addressed comments.
- Loading branch information
Showing
6 changed files
with
715 additions
and
387 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[*.{js,jsx,ts,tsx,vue,css,scss}] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
export enum HuhaTaskStatus { | ||
IN_PROGRESS = 'In progress', | ||
COMPLETED = 'Completed', | ||
ABANDONED = 'Abandoned', | ||
} | ||
|
||
export interface HuhaOptions { | ||
trackOnGoogleAnalytics?: boolean, | ||
trackOnIntercom?: boolean, | ||
trackOnSegment?: boolean, | ||
} | ||
|
||
export interface HuhaTaskProps { | ||
name: string, | ||
label?: string, | ||
category?: string, | ||
value?: string | number, | ||
parentTask?: HuhaTask | null, | ||
execId?: string, | ||
persistent?: boolean, | ||
} | ||
|
||
export class HuhaTask implements HuhaOptions { | ||
name: string; | ||
label?: string; | ||
category?: string; | ||
value?: string | number; | ||
status: HuhaTaskStatus; | ||
effort: number; | ||
errors: number; | ||
start: number; | ||
end?: number; | ||
execId: string; | ||
persistent: boolean; | ||
parentExecId?: string; | ||
parentTask?: HuhaTask | null; | ||
trackOnGoogleAnalytics?: boolean; | ||
trackOnIntercom?: boolean; | ||
trackOnSegment?: boolean; | ||
|
||
constructor(props: HuhaTaskProps, options: HuhaOptions); | ||
|
||
addInteraction(): void; | ||
addError(): void; | ||
finish(status: HuhaTaskStatus): void; | ||
complete(): void; | ||
abandon(): void; | ||
track(): void; | ||
|
||
get time(): number; | ||
|
||
sendToGoogleAnalytics(): void; | ||
sendToIntercom(): void; | ||
sendToSegment(): void; | ||
|
||
updateFromLocalStorage(): void; | ||
removeFromLocalStorage(): void; | ||
} | ||
|
||
export interface HuhaEventProps { | ||
name: string, | ||
object?: string, | ||
action?: string, | ||
category?: string, | ||
value?: string | number, | ||
task?: string | HuhaTask | null, | ||
eventGroup?: string, | ||
} | ||
|
||
export class HuhaEvent implements HuhaOptions { | ||
name: string; | ||
object?: string; | ||
action?: string; | ||
category?: string; | ||
value?: string | number; | ||
task?: string | HuhaTask | null; | ||
eventGroup?: string; | ||
trackOnGoogleAnalytics?: boolean; | ||
trackOnIntercom?: boolean; | ||
trackOnSegment?: boolean; | ||
|
||
constructor(props: HuhaEventProps, options: HuhaOptions); | ||
|
||
track(): void; | ||
sendToGoogleAnalytics(): void; | ||
sendToSegment(): void; | ||
} | ||
|
||
export default class Huha implements HuhaOptions { | ||
tasks: HuhaTask[]; | ||
events: HuhaEvent[]; | ||
|
||
trackOnGoogleAnalytics?: boolean; | ||
trackOnIntercom?: boolean; | ||
trackOnSegment?: boolean; | ||
|
||
constructor(options: HuhaOptions); | ||
|
||
createTask(properties: HuhaTaskProps): HuhaTask; | ||
createEvent(properties: HuhaEventProps): HuhaEvent; | ||
getTask(name: string): HuhaTask | null; | ||
|
||
setUpEvents(): void; | ||
registerEvent(capturedEvent: string, element: Element): void; | ||
|
||
abandonInProgressTasks(): void; | ||
} |
Oops, something went wrong.