Commit 02dedae 1 parent b6a0172 commit 02dedae Copy full SHA for 02dedae
File tree 2 files changed +9
-0
lines changed
app/groups/[groupId]/expenses
2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change 5
5
ReceiptExtractedInfo ,
6
6
extractExpenseInformationFromImage ,
7
7
} from '@/app/groups/[groupId]/expenses/create-from-receipt-button-actions'
8
+ import { useAnalytics } from '@/components/track-page'
8
9
import { Badge } from '@/components/ui/badge'
9
10
import { Button } from '@/components/ui/button'
10
11
import {
@@ -54,9 +55,11 @@ export function CreateFromReceiptButton({
54
55
| ( ReceiptExtractedInfo & { url : string ; width ?: number ; height ?: number } )
55
56
> ( null )
56
57
const isDesktop = useMediaQuery ( '(min-width: 640px)' )
58
+ const sendEvent = useAnalytics ( )
57
59
58
60
const handleFileChange = async ( file : File ) => {
59
61
const upload = async ( ) => {
62
+ sendEvent ( { event : 'expense: scan receipt' , props : { groupId } } )
60
63
try {
61
64
setPending ( true )
62
65
console . log ( 'Uploading image…' )
@@ -204,6 +207,10 @@ export function CreateFromReceiptButton({
204
207
disabled = { pending || ! receiptInfo }
205
208
onClick = { ( ) => {
206
209
if ( ! receiptInfo ) return
210
+ sendEvent ( {
211
+ event : 'expense: create from receipt' ,
212
+ props : { groupId } ,
213
+ } )
207
214
router . push (
208
215
`/groups/${ groupId } /expenses/create?amount=${
209
216
receiptInfo . amount
Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ type Event =
9
9
| { event : 'group: create' ; props : { } }
10
10
| { event : 'group: update' ; props : { groupId : string } }
11
11
| { event : 'expense: create' ; props : { groupId : string } }
12
+ | { event : 'expense: scan receipt' ; props : { groupId : string } }
13
+ | { event : 'expense: create from receipt' ; props : { groupId : string } }
12
14
| { event : 'expense: update' ; props : { groupId : string ; expenseId : string } }
13
15
| { event : 'expense: delete' ; props : { groupId : string ; expenseId : string } }
14
16
| { event : 'group: export expenses' ; props : { groupId : string } }
You can’t perform that action at this time.
0 commit comments