|
@@ -8,6 +8,7 @@ import { LogEvents } from "@/shared/lib/analytics/events";
|
|
|
import { ActionError, actionClient } from "@/shared/api/safe-actions";
|
|
|
import { signUpSchema } from "@/features/auth/signup/schema/signup.schema";
|
|
|
import { auth } from "@/features/auth/lib/better-auth";
|
|
|
+import { env } from "@/env";
|
|
|
|
|
|
export const signUpAction = actionClient.schema(signUpSchema).action(async ({ parsedInput }) => {
|
|
|
const t = await getI18n();
|
|
@@ -24,16 +25,18 @@ export const signUpAction = actionClient.schema(signUpSchema).action(async ({ pa
|
|
|
},
|
|
|
});
|
|
|
|
|
|
- const analytics = await setupAnalytics({
|
|
|
- userId: user.user.id,
|
|
|
- fullName: `${parsedInput.firstName} ${parsedInput.lastName}`,
|
|
|
- email: parsedInput.email,
|
|
|
- });
|
|
|
+ if (env.NEXT_PUBLIC_OPENPANEL_CLIENT_ID) {
|
|
|
+ const analytics = await setupAnalytics({
|
|
|
+ userId: user.user.id,
|
|
|
+ fullName: `${parsedInput.firstName} ${parsedInput.lastName}`,
|
|
|
+ email: parsedInput.email,
|
|
|
+ });
|
|
|
|
|
|
- analytics.track({
|
|
|
- event: LogEvents.Registered.name,
|
|
|
- channel: LogEvents.Registered.channel,
|
|
|
- });
|
|
|
+ analytics.track({
|
|
|
+ event: LogEvents.Registered.name,
|
|
|
+ channel: LogEvents.Registered.channel,
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
return user;
|
|
|
} catch (error) {
|