( id: string, email: string, createdAt: Date )
| 18 | const client: customerIoClient | null = customerIoClient(); |
| 19 | |
| 20 | export const createUserEvent = async ( |
| 21 | id: string, |
| 22 | email: string, |
| 23 | createdAt: Date |
| 24 | ) => { |
| 25 | if (process.env.NODE_ENV === 'test') { |
| 26 | return; |
| 27 | } |
| 28 | try { |
| 29 | client?.identify(email, { |
| 30 | id, |
| 31 | created_at: createdAt.getTime() / 1000, |
| 32 | }); |
| 33 | } catch (e) { |
| 34 | console.error('failed to track event'); |
| 35 | } |
| 36 | }; |
| 37 | |
| 38 | export const createAccountEvent = async (email: string, accountId: string) => { |
| 39 | if (process.env.NODE_ENV === 'test') { |