Skip to content

Commit 370b46c

Browse files
authored
Merge pull request #962 from HiEventsDev/develop
2 parents 58b706e + abe88cd commit 370b46c

File tree

18 files changed

+134
-20
lines changed

18 files changed

+134
-20
lines changed

backend/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ yarn-error.log
2222
/.vscode
2323
.idea
2424
/app-back
25+
.vapor

frontend/src/api/client.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ api.interceptors.response.use(
4747
if (isAuthError && (!isAllowedUnauthenticatedPath || isManageEventPath)) {
4848
// Store the current URL before redirecting to the login page
4949
window?.localStorage?.setItem(PREVIOUS_URL_KEY, window?.location.href);
50-
window?.location?.replace(LOGIN_PATH);
50+
// Preserve query params (UTM tracking) during redirect
51+
const searchParams = window?.location?.search || '';
52+
window?.location?.replace(LOGIN_PATH + searchParams);
5153
}
5254

5355
return Promise.reject(error);

frontend/src/components/common/CheckInStatusModal/index.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ export const CheckInStatusModal = ({
2424
}: CheckInStatusModalProps) => {
2525
const {data: checkInListsResponse, isLoading, ...rest} = useGetEventCheckInLists(eventId);
2626

27-
console.log('CheckInStatusModal - checkInListsResponse:', checkInListsResponse, 'isLoading:', isLoading, 'rest:', rest);
28-
2927
if (isLoading) {
3028
return (
3129
<Modal.Root opened={isOpen} onClose={onClose} size="md">

frontend/src/components/common/StatusToggle/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {useUpdateEventStatus} from '../../../mutations/useUpdateEventStatus';
88
import {useUpdateOrganizerStatus} from '../../../mutations/useUpdateOrganizerStatus';
99
import {IdParam} from '../../../types';
1010
import classes from './StatusToggle.module.scss';
11+
import {trackEvent, AnalyticsEvents} from '../../../utilites/analytics';
1112

1213
interface StatusToggleProps {
1314
entityType: 'event' | 'organizer';
@@ -47,6 +48,9 @@ export const StatusToggle: React.FC<StatusToggleProps> = ({
4748

4849
mutation.mutate(mutationParams as any, {
4950
onSuccess: () => {
51+
if (entityType === 'event' && newStatus === 'LIVE') {
52+
trackEvent(AnalyticsEvents.EVENT_PUBLISHED);
53+
}
5054
const successMessage = entityType === 'event'
5155
? t`Event status updated`
5256
: t`Organizer status updated`;

frontend/src/components/forms/OrganizerForm/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {useFormErrorResponseHandler} from "../../../hooks/useFormErrorResponseHa
1212
import {useGetMe} from "../../../queries/useGetMe.ts";
1313
import {IconBuilding} from "@tabler/icons-react";
1414
import classes from "../../routes/welcome/Welcome.module.scss";
15+
import {trackEvent, AnalyticsEvents} from "../../../utilites/analytics.ts";
1516

1617
interface OrganizerFormProps {
1718
onSuccess?: (organizer: Organizer) => void;
@@ -82,6 +83,7 @@ export const OrganizerCreateForm = ({onSuccess, onCancel}: OrganizerFormProps) =
8283
organizerData: values,
8384
}, {
8485
onSuccess: ({data: organizer}) => {
86+
trackEvent(AnalyticsEvents.ORGANIZER_CREATED);
8587
if (onSuccess) {
8688
onSuccess(organizer);
8789
}

frontend/src/components/modals/CreateWebhookModal/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ export const CreateWebhookModal = ({onClose}: GenericModalProps) => {
3737
const createMutation = useCreateWebhook();
3838

3939
const handleSubmit = (requestData: WebhookRequest) => {
40-
console.log(eventId, requestData);
4140
createMutation.mutate({
4241
eventId: eventId as IdParam,
4342
webhook: requestData

frontend/src/components/routes/account/ManageAccount/sections/PaymentSettings/index.tsx

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {Anchor, Button, Grid, Group, Text, ThemeIcon, Title} from "@mantine/core
88
import {Account, StripeConnectAccountsResponse} from "../../../../../../types.ts";
99
import paymentClasses from "./PaymentSettings.module.scss";
1010
import classes from "../../ManageAccount.module.scss";
11-
import {useEffect, useState} from "react";
11+
import {useEffect, useRef, useState} from "react";
1212
import {IconAlertCircle, IconBrandStripe, IconCheck, IconExternalLink, IconInfoCircle} from '@tabler/icons-react';
1313
import {Card} from "../../../../../common/Card";
1414
import {formatCurrency} from "../../../../../../utilites/currency.ts";
@@ -19,6 +19,7 @@ import {VatSettings} from './VatSettings';
1919
import {VatSettingsModal} from './VatSettings/VatSettingsModal.tsx';
2020
import {VatNotice, getVatInfo} from './VatNotice';
2121
import {useGetAccountVatSetting} from '../../../../../../queries/useGetAccountVatSetting.ts';
22+
import {trackEvent, AnalyticsEvents} from "../../../../../../utilites/analytics.ts";
2223

2324
interface FeePlanDisplayProps {
2425
configuration?: {
@@ -725,6 +726,27 @@ const PaymentSettings = () => {
725726

726727
const [showVatModal, setShowVatModal] = useState(false);
727728
const [hasCheckedVatModal, setHasCheckedVatModal] = useState(false);
729+
const hasTrackedStripeConnection = useRef(false);
730+
731+
// Track Stripe connection when user returns with completed setup
732+
useEffect(() => {
733+
if (typeof window === 'undefined') return;
734+
if (hasTrackedStripeConnection.current) return;
735+
if (!stripeAccountsQuery.data) return;
736+
737+
const urlParams = new URLSearchParams(window.location.search);
738+
const isReturn = urlParams.get('is_return') === '1';
739+
if (!isReturn) return;
740+
741+
const completedAccount = stripeAccountsQuery.data.stripe_connect_accounts.find(
742+
acc => acc.is_setup_complete
743+
);
744+
745+
if (completedAccount) {
746+
hasTrackedStripeConnection.current = true;
747+
trackEvent(AnalyticsEvents.STRIPE_CONNECTED);
748+
}
749+
}, [stripeAccountsQuery.data]);
728750

729751
// Check if user is returning from Stripe and needs to fill VAT info
730752
// Only for Hi.Events Cloud - open-source doesn't have VAT handling

frontend/src/components/routes/auth/Login/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {Button, PasswordInput, TextInput, Collapse, UnstyledButton} from "@mantine/core";
2-
import {NavLink} from "react-router";
2+
import {NavLink, useLocation} from "react-router";
33
import {useMutation} from "@tanstack/react-query";
44
import {notifications} from '@mantine/notifications';
55
import {authClient} from "../../../../api/auth.client.ts";
@@ -15,6 +15,7 @@ import {showError} from "../../../../utilites/notifications.tsx";
1515
import {IconTicket, IconChevronDown} from "@tabler/icons-react";
1616

1717
const Login = () => {
18+
const location = useLocation();
1819
const form = useForm({
1920
initialValues: {
2021
email: '',
@@ -80,7 +81,7 @@ const Login = () => {
8081
<p>
8182
<Trans>
8283
Don't have an account?{' '}
83-
<NavLink to={'/auth/register'}>
84+
<NavLink to={`/auth/register${location.search}`}>
8485
Sign up
8586
</NavLink>
8687
</Trans>

frontend/src/components/routes/auth/Register/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const Register = () => {
2929
locale: getClientLocale(),
3030
invite_token: '',
3131
currency_code: getUserCurrency(),
32-
marketing_opt_in: true,
32+
marketing_opt_in: false,
3333
},
3434
validate: {
3535
password: hasLength({min: 8}, t`Password must be at least 8 characters`),
@@ -43,7 +43,7 @@ export const Register = () => {
4343
const registerUser = (data: RegisterAccountRequest) => {
4444
mutate.mutate({registerData: data}, {
4545
onSuccess: () => {
46-
navigate('/welcome');
46+
navigate(`/welcome${location.search}`);
4747
},
4848
onError: (error: any) => {
4949
errorHandler(form, error, error.response?.data?.message);
@@ -67,7 +67,7 @@ export const Register = () => {
6767
<p>
6868
<Trans>
6969
Already have an account?{' '}
70-
<NavLink to={'/auth/login'}>
70+
<NavLink to={`/auth/login${location.search}`}>
7171
{t`Log in`}
7272
</NavLink>
7373
</Trans>

frontend/src/components/routes/event/EventDashboard/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {useEffect, useState} from 'react';
2222
import {StripePlatform} from "../../../../types.ts";
2323
import {isHiEvents} from "../../../../utilites/helpers.ts";
2424
import {StripeConnectButton} from "../../../common/StripeConnectButton";
25+
import {trackEvent, AnalyticsEvents} from "../../../../utilites/analytics.ts";
2526

2627
export const DashBoardSkeleton = () => {
2728
return (
@@ -67,16 +68,20 @@ export const EventDashboard = () => {
6768
};
6869

6970
const handleStatusToggle = () => {
71+
const newStatus = event?.status === 'LIVE' ? 'DRAFT' : 'LIVE';
7072
const message = event?.status === 'LIVE'
7173
? t`Are you sure you want to make this event draft? This will make the event invisible to the public`
7274
: t`Are you sure you want to make this event public? This will make the event visible to the public`;
7375

7476
confirmationDialog(message, () => {
7577
statusToggleMutation.mutate({
7678
eventId,
77-
status: event?.status === 'LIVE' ? 'DRAFT' : 'LIVE'
79+
status: newStatus
7880
}, {
7981
onSuccess: () => {
82+
if (newStatus === 'LIVE') {
83+
trackEvent(AnalyticsEvents.EVENT_PUBLISHED);
84+
}
8085
showSuccess(t`Event status updated`);
8186
},
8287
onError: (error: any) => {

0 commit comments

Comments
 (0)