@@ -4,11 +4,18 @@ import { useState } from "react";
4
4
import { observer } from "mobx-react" ;
5
5
import { useParams , useRouter , useSearchParams } from "next/navigation" ;
6
6
// constants
7
- import { EPageAccess , EProjectFeatureKey , PROJECT_TRACKER_ELEMENTS } from "@plane/constants" ;
7
+ import {
8
+ EPageAccess ,
9
+ EProjectFeatureKey ,
10
+ PROJECT_PAGE_TRACKER_EVENTS ,
11
+ PROJECT_TRACKER_ELEMENTS ,
12
+ } from "@plane/constants" ;
8
13
// plane types
9
14
import { TPage } from "@plane/types" ;
10
15
// plane ui
11
16
import { Breadcrumbs , Button , Header , setToast , TOAST_TYPE } from "@plane/ui" ;
17
+ // helpers
18
+ import { captureError , captureSuccess } from "@/helpers/event-tracker.helper" ;
12
19
// hooks
13
20
import { useProject } from "@/hooks/store" ;
14
21
// plane web
@@ -37,16 +44,29 @@ export const PagesListHeader = observer(() => {
37
44
38
45
await createPage ( payload )
39
46
. then ( ( res ) => {
47
+ captureSuccess ( {
48
+ eventName : PROJECT_PAGE_TRACKER_EVENTS . create ,
49
+ payload : {
50
+ id : res ?. id ,
51
+ state : "SUCCESS" ,
52
+ } ,
53
+ } ) ;
40
54
const pageId = `/${ workspaceSlug } /projects/${ currentProjectDetails ?. id } /pages/${ res ?. id } ` ;
41
55
router . push ( pageId ) ;
42
56
} )
43
- . catch ( ( err ) =>
57
+ . catch ( ( err ) => {
58
+ captureError ( {
59
+ eventName : PROJECT_PAGE_TRACKER_EVENTS . create ,
60
+ payload : {
61
+ state : "ERROR" ,
62
+ } ,
63
+ } ) ;
44
64
setToast ( {
45
65
type : TOAST_TYPE . ERROR ,
46
66
title : "Error!" ,
47
67
message : err ?. data ?. error || "Page could not be created. Please try again." ,
48
- } )
49
- )
68
+ } ) ;
69
+ } )
50
70
. finally ( ( ) => setIsCreatingPage ( false ) ) ;
51
71
} ;
52
72
0 commit comments