@@ -7,14 +7,18 @@ import runCommands from './utils/runCommands'
77import runVSCodeCommands from './utils/runVSCodeCommands'
88import * as telemetry from '../telemetry'
99import { runTest } from '../../actions/onTest'
10- import logger from '../logger'
1110import { VERSION } from '../../environment'
11+ import * as webhooks from './webhooks'
1212
1313// run at the end of when a tutorial is configured
1414export const onInit = async ( actions : TT . StepActions ) : Promise < void > => {
1515 await loadCommits ( actions ?. commits )
1616 await runCommands ( actions ?. commands )
1717 await runVSCodeCommands ( actions ?. vscodeCommands )
18+ webhooks . onInit ( {
19+ // tutorialId,
20+ version : VERSION ,
21+ } )
1822}
1923
2024// run when a level starts
@@ -47,6 +51,10 @@ export const onReset = async (actions: TT.StepActions): Promise<void> => {
4751 await resetWatchers ( )
4852 await runCommands ( actions ?. commands )
4953 await runVSCodeCommands ( actions ?. vscodeCommands )
54+ webhooks . onReset ( {
55+ // tutorialId,
56+ version : VERSION ,
57+ } )
5058}
5159
5260// run when an uncaught exception is thrown
@@ -66,6 +74,12 @@ export const onStepComplete = async ({
6674} ) : Promise < void > => {
6775 git . saveCommit ( `Save progress: ${ stepId } ` )
6876 telemetry . onEvent ( 'step_complete' , { tutorialId, stepId, levelId, version : VERSION } )
77+ webhooks . onStepComplete ( {
78+ tutorialId,
79+ version : VERSION ,
80+ levelId,
81+ stepId,
82+ } )
6983}
7084
7185// run when a level is complete (all tasks pass or no tasks)
@@ -77,9 +91,18 @@ export const onLevelComplete = async ({
7791 levelId : string
7892} ) : Promise < void > => {
7993 telemetry . onEvent ( 'level_complete' , { tutorialId, levelId, version : VERSION } )
94+ webhooks . onLevelComplete ( {
95+ tutorialId,
96+ version : VERSION ,
97+ levelId,
98+ } )
8099}
81100
82101// run when all levels are complete
83102export const onTutorialComplete = async ( { tutorialId } : { tutorialId : string } ) : Promise < void > => {
84103 telemetry . onEvent ( 'tutorial_complete' , { tutorialId, version : VERSION } )
104+ webhooks . onTutorialComplete ( {
105+ tutorialId,
106+ version : VERSION ,
107+ } )
85108}
0 commit comments