File tree Expand file tree Collapse file tree 2 files changed +13
-16
lines changed Expand file tree Collapse file tree 2 files changed +13
-16
lines changed Original file line number Diff line number Diff line change @@ -53,9 +53,10 @@ export const trackLead = async ({
5353 // otherwise, throw an error (this is for mode="deferred" lead tracking)
5454 if ( ! clickId ) {
5555 if ( ! customer || ! customer . clickId ) {
56- return trackLeadResponseSchema . parse ( {
57- click : null ,
58- customer : null ,
56+ throw new DubApiError ( {
57+ code : "bad_request" ,
58+ message :
59+ "The `clickId` property was not provided in the request, and no existing customer with the provided `customerExternalId` was found." ,
5960 } ) ;
6061 }
6162
Original file line number Diff line number Diff line change @@ -73,19 +73,15 @@ export const trackLeadRequestSchema = z.object({
7373} ) ;
7474
7575export const trackLeadResponseSchema = z . object ( {
76- click : z
77- . object ( {
78- id : z . string ( ) ,
79- } )
80- . nullable ( ) ,
81- customer : z
82- . object ( {
83- name : z . string ( ) . nullable ( ) ,
84- email : z . string ( ) . nullable ( ) ,
85- avatar : z . string ( ) . nullable ( ) ,
86- externalId : z . string ( ) . nullable ( ) ,
87- } )
88- . nullable ( ) ,
76+ click : z . object ( {
77+ id : z . string ( ) ,
78+ } ) ,
79+ customer : z . object ( {
80+ name : z . string ( ) . nullable ( ) ,
81+ email : z . string ( ) . nullable ( ) ,
82+ avatar : z . string ( ) . nullable ( ) ,
83+ externalId : z . string ( ) . nullable ( ) ,
84+ } ) ,
8985} ) ;
9086
9187export const leadEventSchemaTB = clickEventSchemaTB
You can’t perform that action at this time.
0 commit comments