Add events handling and enhance analytics tracking (#47)
* Add events handling and enhance analytics tracking Added a new events system to track user actions throughout the application. Specific significant events such as user signup, sign-in, and checkout have dedicated handlers. Updated the analytics system to handle these event triggers and improved analytics reporting. An analytics provider has been implemented to manage event subscriptions and analytics event mappings. * Remove unused dependencies from package.json files Unused packages "@tanstack/react-table" and "next" have been removed from the packages/shared and tooling directories respectively. These changes help ensure that only needed packages are included in the project, reducing potential security risks and unnecessary processing overhead. * Update dependencies Multiple package versions were updated including "@tanstack/react-query" and "lucide-react"
This commit is contained in:
committed by
GitHub
parent
868f907c81
commit
5eefa7ff16
@@ -35,10 +35,10 @@
|
||||
"@kit/ui": "workspace:^",
|
||||
"@radix-ui/react-icons": "^1.3.0",
|
||||
"@supabase/supabase-js": "^2.44.4",
|
||||
"@tanstack/react-query": "5.51.9",
|
||||
"@tanstack/react-query": "5.51.11",
|
||||
"@types/react": "^18.3.3",
|
||||
"@types/react-dom": "^18.3.0",
|
||||
"lucide-react": "^0.411.0",
|
||||
"lucide-react": "^0.412.0",
|
||||
"next": "14.2.5",
|
||||
"next-themes": "0.3.0",
|
||||
"react": "18.3.1",
|
||||
|
||||
@@ -22,10 +22,10 @@
|
||||
"@makerkit/data-loader-supabase-core": "^0.0.8",
|
||||
"@makerkit/data-loader-supabase-nextjs": "^1.2.3",
|
||||
"@supabase/supabase-js": "^2.44.4",
|
||||
"@tanstack/react-query": "5.51.9",
|
||||
"@tanstack/react-query": "5.51.11",
|
||||
"@tanstack/react-table": "^8.19.3",
|
||||
"@types/react": "^18.3.3",
|
||||
"lucide-react": "^0.411.0",
|
||||
"lucide-react": "^0.412.0",
|
||||
"next": "14.2.5",
|
||||
"react": "18.3.1",
|
||||
"react-dom": "18.3.1",
|
||||
|
||||
@@ -29,9 +29,9 @@
|
||||
"@marsidev/react-turnstile": "^0.7.2",
|
||||
"@radix-ui/react-icons": "^1.3.0",
|
||||
"@supabase/supabase-js": "^2.44.4",
|
||||
"@tanstack/react-query": "5.51.9",
|
||||
"@tanstack/react-query": "5.51.11",
|
||||
"@types/react": "^18.3.3",
|
||||
"lucide-react": "^0.411.0",
|
||||
"lucide-react": "^0.412.0",
|
||||
"next": "14.2.5",
|
||||
"react-hook-form": "^7.52.1",
|
||||
"react-i18next": "^15.0.0",
|
||||
|
||||
@@ -7,6 +7,7 @@ import { useTranslation } from 'react-i18next';
|
||||
import { toast } from 'sonner';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { useAppEvents } from '@kit/shared/events';
|
||||
import { useSignInWithOtp } from '@kit/supabase/hooks/use-sign-in-with-otp';
|
||||
import { Alert, AlertDescription, AlertTitle } from '@kit/ui/alert';
|
||||
import { Button } from '@kit/ui/button';
|
||||
@@ -44,6 +45,7 @@ export function MagicLinkAuthContainer({
|
||||
const { captchaToken, resetCaptchaToken } = useCaptchaToken();
|
||||
const { t } = useTranslation();
|
||||
const signInWithOtpMutation = useSignInWithOtp();
|
||||
const appEvents = useAppEvents();
|
||||
|
||||
const form = useForm({
|
||||
resolver: zodResolver(
|
||||
@@ -65,8 +67,8 @@ export function MagicLinkAuthContainer({
|
||||
|
||||
const emailRedirectTo = url.href;
|
||||
|
||||
const promise = () =>
|
||||
signInWithOtpMutation.mutateAsync({
|
||||
const promise = async () => {
|
||||
await signInWithOtpMutation.mutateAsync({
|
||||
email,
|
||||
options: {
|
||||
emailRedirectTo,
|
||||
@@ -75,6 +77,14 @@ export function MagicLinkAuthContainer({
|
||||
},
|
||||
});
|
||||
|
||||
appEvents.emit({
|
||||
type: 'user.signedUp',
|
||||
payload: {
|
||||
method: 'magiclink',
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
toast.promise(promise, {
|
||||
loading: t('auth:sendingEmailLink'),
|
||||
success: t(`auth:sendLinkSuccessToast`),
|
||||
|
||||
@@ -4,6 +4,7 @@ import { useCallback, useRef, useState } from 'react';
|
||||
|
||||
import { CheckCircledIcon } from '@radix-ui/react-icons';
|
||||
|
||||
import { useAppEvents } from '@kit/shared/events';
|
||||
import { useSignUpWithEmailAndPassword } from '@kit/supabase/hooks/use-sign-up-with-email-password';
|
||||
import { Alert, AlertDescription, AlertTitle } from '@kit/ui/alert';
|
||||
import { If } from '@kit/ui/if';
|
||||
@@ -33,8 +34,10 @@ export function EmailPasswordSignUpContainer({
|
||||
|
||||
const signUpMutation = useSignUpWithEmailAndPassword();
|
||||
const redirecting = useRef(false);
|
||||
const loading = signUpMutation.isPending || redirecting.current;
|
||||
const [showVerifyEmailAlert, setShowVerifyEmailAlert] = useState(false);
|
||||
const appEvents = useAppEvents();
|
||||
|
||||
const loading = signUpMutation.isPending || redirecting.current;
|
||||
|
||||
const onSignupRequested = useCallback(
|
||||
async (credentials: { email: string; password: string }) => {
|
||||
@@ -49,6 +52,13 @@ export function EmailPasswordSignUpContainer({
|
||||
captchaToken,
|
||||
});
|
||||
|
||||
appEvents.emit({
|
||||
type: 'user.signedUp',
|
||||
payload: {
|
||||
method: 'password',
|
||||
},
|
||||
});
|
||||
|
||||
setShowVerifyEmailAlert(true);
|
||||
|
||||
if (onSignUp) {
|
||||
@@ -61,6 +71,7 @@ export function EmailPasswordSignUpContainer({
|
||||
}
|
||||
},
|
||||
[
|
||||
appEvents,
|
||||
captchaToken,
|
||||
emailRedirectTo,
|
||||
loading,
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
"@kit/tsconfig": "workspace:*",
|
||||
"@kit/ui": "workspace:*",
|
||||
"@supabase/supabase-js": "^2.44.4",
|
||||
"@tanstack/react-query": "5.51.9",
|
||||
"@tanstack/react-query": "5.51.11",
|
||||
"@types/react": "^18.3.3",
|
||||
"lucide-react": "^0.411.0",
|
||||
"lucide-react": "^0.412.0",
|
||||
"react": "18.3.1",
|
||||
"react-dom": "18.3.1",
|
||||
"react-i18next": "^15.0.0"
|
||||
|
||||
@@ -33,13 +33,13 @@
|
||||
"@kit/tsconfig": "workspace:*",
|
||||
"@kit/ui": "workspace:^",
|
||||
"@supabase/supabase-js": "^2.44.4",
|
||||
"@tanstack/react-query": "5.51.9",
|
||||
"@tanstack/react-query": "5.51.11",
|
||||
"@tanstack/react-table": "^8.19.3",
|
||||
"@types/react": "^18.3.3",
|
||||
"@types/react-dom": "^18.3.0",
|
||||
"class-variance-authority": "^0.7.0",
|
||||
"date-fns": "^3.6.0",
|
||||
"lucide-react": "^0.411.0",
|
||||
"lucide-react": "^0.412.0",
|
||||
"next": "14.2.5",
|
||||
"react": "18.3.1",
|
||||
"react-dom": "18.3.1",
|
||||
|
||||
Reference in New Issue
Block a user