Skip to content

Commit

Permalink
Remove Leafwatch Completely
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoginth committed Dec 6, 2024
1 parent 156e788 commit cc1ecc1
Show file tree
Hide file tree
Showing 23 changed files with 3 additions and 128 deletions.
3 changes: 0 additions & 3 deletions apps/web/src/components/Post/Actions/Menu/CopyPostText.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { MenuItem } from "@headlessui/react";
import { Leafwatch } from "@helpers/leafwatch";
import { ClipboardDocumentIcon } from "@heroicons/react/24/outline";
import { POST } from "@hey/data/tracking";
import getPostData from "@hey/helpers/getPostData";
import stopEventPropagation from "@hey/helpers/stopEventPropagation";
import type { Post } from "@hey/indexer";
Expand Down Expand Up @@ -29,7 +27,6 @@ const CopyPostText: FC<CopyPostTextProps> = ({ post }) => {
stopEventPropagation(event);
await navigator.clipboard.writeText(filteredContent || "");
toast.success("Content copied to clipboard!");
Leafwatch.track(POST.COPY_TEXT, { postId: post.id });
}}
>
<div className="flex items-center space-x-2">
Expand Down
10 changes: 0 additions & 10 deletions apps/web/src/components/Post/Actions/Menu/HideComment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import type { ApolloCache } from "@apollo/client";
import { useHiddenCommentFeedStore } from "@components/Post";
import { MenuItem } from "@headlessui/react";
import errorToast from "@helpers/errorToast";
import { Leafwatch } from "@helpers/leafwatch";
import { CheckCircleIcon, NoSymbolIcon } from "@heroicons/react/24/outline";
import { POST } from "@hey/data/tracking";
import stopEventPropagation from "@hey/helpers/stopEventPropagation";
import {
type Post,
Expand Down Expand Up @@ -35,10 +33,6 @@ const HideComment: FC<HideCommentProps> = ({ post }) => {
const [hideComment] = useHideReplyMutation({
onCompleted: () => {
toast.success("Comment hidden");
Leafwatch.track(POST.TOGGLE_HIDE_COMMENT, {
hidden: true,
postId: post.id
});
},
onError,
update: updateCache,
Expand All @@ -48,10 +42,6 @@ const HideComment: FC<HideCommentProps> = ({ post }) => {
const [unhideComment] = useUnhideReplyMutation({
onCompleted: () => {
toast.success("Comment unhidden");
Leafwatch.track(POST.TOGGLE_HIDE_COMMENT, {
hidden: false,
postId: post.id
});
},
onError,
update: updateCache,
Expand Down
4 changes: 0 additions & 4 deletions apps/web/src/components/Post/Actions/Menu/NotInterested.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import type { ApolloCache } from "@apollo/client";
import { MenuItem } from "@headlessui/react";
import errorToast from "@helpers/errorToast";
import { Leafwatch } from "@helpers/leafwatch";
import { EyeIcon, EyeSlashIcon } from "@heroicons/react/24/outline";
import { POST } from "@hey/data/tracking";
import stopEventPropagation from "@hey/helpers/stopEventPropagation";
import type { Post } from "@hey/indexer";
import cn from "@hey/ui/cn";
Expand Down Expand Up @@ -39,7 +37,6 @@ const NotInterested: FC<NotInterestedProps> = ({ post }) => {
const [addPublicationNotInterested] = useAddPublicationNotInterestedMutation({
onCompleted: () => {
toast.success("Marked as not Interested");
Leafwatch.track(POST.NOT_INTERESTED, { postId: post.id });
},
onError,
update: (cache) => updateCache(cache, true),
Expand All @@ -50,7 +47,6 @@ const NotInterested: FC<NotInterestedProps> = ({ post }) => {
useUndoPublicationNotInterestedMutation({
onCompleted: () => {
toast.success("Undo Not interested");
Leafwatch.track(POST.UNDO_NOT_INTERESTED, { postId: post.id });
},
onError,
update: (cache) => updateCache(cache, false),
Expand Down
3 changes: 0 additions & 3 deletions apps/web/src/components/Post/Actions/Menu/Share.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { MenuItem } from "@headlessui/react";
import { Leafwatch } from "@helpers/leafwatch";
import { ClipboardDocumentIcon } from "@heroicons/react/24/outline";
import { POST } from "@hey/data/tracking";
import stopEventPropagation from "@hey/helpers/stopEventPropagation";
import type { Post } from "@hey/indexer";
import cn from "@hey/ui/cn";
Expand All @@ -28,7 +26,6 @@ const Share: FC<ShareProps> = ({ post }) => {
`${location.origin}/posts/${post?.id}`
);
toast.success("Copied to clipboard!");
Leafwatch.track(POST.SHARE, { postId: post.id });
}}
>
<div className="flex items-center space-x-2">
Expand Down
3 changes: 0 additions & 3 deletions apps/web/src/components/Post/Actions/Share/Repost.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { useApolloClient } from "@apollo/client";
import { MenuItem } from "@headlessui/react";
import errorToast from "@helpers/errorToast";
import { Leafwatch } from "@helpers/leafwatch";
import { ArrowsRightLeftIcon } from "@heroicons/react/24/outline";
import { Errors } from "@hey/data/errors";
import { POST } from "@hey/data/tracking";
import selfFundedTransactionData from "@hey/helpers/selfFundedTransactionData";
import sponsoredTransactionData from "@hey/helpers/sponsoredTransactionData";
import { type Post, TriStateValue, useRepostMutation } from "@hey/indexer";
Expand Down Expand Up @@ -73,7 +71,6 @@ const Repost: FC<RepostProps> = ({ isLoading, post, setIsLoading }) => {
updateCache();
addTransaction(generateOptimisticRepost({ txHash: hash }));
toast.success("Post has been mirrored!");
Leafwatch.track(POST.REPOST, { postId: post.id });
};

const [repost] = useRepostMutation({
Expand Down
3 changes: 0 additions & 3 deletions apps/web/src/components/Post/Actions/Share/UndoRepost.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { useApolloClient } from "@apollo/client";
import { MenuItem } from "@headlessui/react";
import errorToast from "@helpers/errorToast";
import { Leafwatch } from "@helpers/leafwatch";
import { ArrowsRightLeftIcon } from "@heroicons/react/24/outline";
import { Errors } from "@hey/data/errors";
import { POST } from "@hey/data/tracking";
import { isRepost } from "@hey/helpers/postHelpers";
import { type AnyPost, useDeletePostMutation } from "@hey/indexer";
import cn from "@hey/ui/cn";
Expand Down Expand Up @@ -41,7 +39,6 @@ const UndoRepost: FC<UndoRepostProps> = ({ isLoading, post, setIsLoading }) => {

const [deletePost] = useDeletePostMutation({
onCompleted: () => {
Leafwatch.track(POST.UNDO_REPOST);
toast.success("Undone repost");
},
update: updateCache
Expand Down
11 changes: 0 additions & 11 deletions apps/web/src/components/Post/Actions/Tip/Action.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import errorToast from "@helpers/errorToast";
import { getAuthApiHeaders } from "@helpers/getAuthApiHeaders";
import { Leafwatch } from "@helpers/leafwatch";
import { HeyTipping } from "@hey/abis";
import {
APP_NAME,
Expand All @@ -11,7 +10,6 @@ import {
STATIC_IMAGES_URL
} from "@hey/data/constants";
import { Errors } from "@hey/data/errors";
import { POST } from "@hey/data/tracking";
import formatAddress from "@hey/helpers/formatAddress";
import type { Post } from "@hey/indexer";
import type { AllowedToken } from "@hey/types/hey";
Expand Down Expand Up @@ -143,10 +141,6 @@ const Action: FC<ActionProps> = ({ closePopover, post, triggerConfetti }) => {
args: [HEY_TIPPING, MAX_UINT256],
functionName: "approve"
});
Leafwatch.track(POST.TIP.ENABLE, {
address,
currency: selectedCurrency?.symbol
});
return;
} catch (error) {
onError(error);
Expand Down Expand Up @@ -190,11 +184,6 @@ const Action: FC<ActionProps> = ({ closePopover, post, triggerConfetti }) => {
{ headers: getAuthApiHeaders() }
);

Leafwatch.track(POST.TIP.TIP, {
address,
amount,
currency: selectedCurrency?.symbol
});
addTip(post.id);
closePopover();
triggerConfetti();
Expand Down
10 changes: 1 addition & 9 deletions apps/web/src/components/Post/OpenAction/Collect.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { Leafwatch } from "@helpers/leafwatch";
import { FeatureFlag } from "@hey/data/feature-flags";
import { POST } from "@hey/data/tracking";
import allowedPostActionModules from "@hey/helpers/allowedPostActionModules";
import type { Post } from "@hey/indexer";
import { Button, Modal } from "@hey/ui";
Expand Down Expand Up @@ -32,13 +30,7 @@ const Collect: FC<CollectProps> = ({ post }) => {
return (
<>
<Button
onClick={() => {
setShowCollectModal(true);
Leafwatch.track(POST.COLLECT_MODULE.OPEN_COLLECT, {
postId: post.id,
source: "button"
});
}}
onClick={() => setShowCollectModal(true)}
outline={!hasActed}
size="sm"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import LoginButton from "@components/Shared/LoginButton";
import NoBalanceError from "@components/Shared/NoBalanceError";
import errorToast from "@helpers/errorToast";
import getCurrentSession from "@helpers/getCurrentSession";
import { Leafwatch } from "@helpers/leafwatch";
import { Errors } from "@hey/data/errors";
import { POST } from "@hey/data/tracking";
import getCollectModuleData from "@hey/helpers/getCollectModuleData";
import getPostActionActOnKey from "@hey/helpers/getPostActionActOnKey";
import type { AnyPost, PostAction } from "@hey/indexer";
Expand Down Expand Up @@ -136,11 +134,6 @@ const CollectAction: FC<CollectActionProps> = ({
onCollectSuccess?.();
updateCache();
toast.success("Collected");
Leafwatch.track(POST.COLLECT_MODULE.COLLECT, {
amount,
collectModule: postAction?.__typename,
postId: post?.id
});
};

const { data: allowanceData, loading: allowanceLoading } =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { getAuthApiHeaders } from "@helpers/getAuthApiHeaders";
import { Leafwatch } from "@helpers/leafwatch";
import { ArrowDownTrayIcon } from "@heroicons/react/24/outline";
import { HEY_API_URL } from "@hey/data/constants";
import { FeatureFlag } from "@hey/data/feature-flags";
import { POST } from "@hey/data/tracking";
import type { AnyPost } from "@hey/indexer";
import { Tooltip } from "@hey/ui";
import { useFlag } from "@unleash/proxy-client-react";
Expand Down Expand Up @@ -47,7 +45,6 @@ const DownloadCollectors: FC<DownloadCollectorsProps> = ({ post }) => {
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
Leafwatch.track(POST.COLLECT_MODULE.DOWNLOAD_COLLECTORS);
})
.finally(() => setDisabled(false)),
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import CountdownTimer from "@components/Shared/CountdownTimer";
import Collectors from "@components/Shared/Modal/Collectors";
import Slug from "@components/Shared/Slug";
import { Leafwatch } from "@helpers/leafwatch";
import {
BanknotesIcon,
CheckCircleIcon,
Expand All @@ -16,7 +15,6 @@ import {
COLLECT_FEES_ADDRESS,
POLYGONSCAN_URL
} from "@hey/data/constants";
import { POST } from "@hey/data/tracking";
import formatDate from "@hey/helpers/datetime/formatDate";
import formatAddress from "@hey/helpers/formatAddress";
import getAccount from "@hey/helpers/getAccount";
Expand Down Expand Up @@ -270,10 +268,7 @@ const CollectModule: FC<CollectModuleProps> = ({ postAction, post }) => {
</div>
</div>
<Modal
onClose={() => {
Leafwatch.track(POST.OPEN_COLLECTORS);
setShowCollectorsModal(false);
}}
onClose={() => setShowCollectorsModal(false)}
show={showCollectorsModal}
title="Collectors"
size="md"
Expand Down
10 changes: 1 addition & 9 deletions apps/web/src/components/Post/OpenAction/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { Leafwatch } from "@helpers/leafwatch";
import { ShoppingBagIcon } from "@heroicons/react/24/outline";
import { POST } from "@hey/data/tracking";
import allowedPostActionModules from "@hey/helpers/allowedPostActionModules";
import humanize from "@hey/helpers/humanize";
import nFormatter from "@hey/helpers/nFormatter";
Expand All @@ -26,13 +24,7 @@ const OpenAction: FC<OpenActionProps> = ({ post }) => {
<button
aria-label="Collect"
className="rounded-full p-1.5 outline-offset-2 hover:bg-gray-300/20"
onClick={() => {
setShowCollectModal(true);
Leafwatch.track(POST.COLLECT_MODULE.OPEN_COLLECT, {
postId: post.id,
source: "icon"
});
}}
onClick={() => setShowCollectModal(true)}
type="button"
>
<Tooltip
Expand Down
3 changes: 0 additions & 3 deletions apps/web/src/components/Post/Poll/Choices.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import Beta from "@components/Shared/Badges/Beta";
import { getAuthApiHeaders } from "@helpers/getAuthApiHeaders";
import { Leafwatch } from "@helpers/leafwatch";
import {
Bars3BottomLeftIcon,
CheckCircleIcon
} from "@heroicons/react/24/solid";
import { HEY_API_URL } from "@hey/data/constants";
import { Errors } from "@hey/data/errors";
import { POST } from "@hey/data/tracking";
import getTimetoNow from "@hey/helpers/datetime/getTimetoNow";
import humanize from "@hey/helpers/humanize";
import stopEventPropagation from "@hey/helpers/stopEventPropagation";
Expand Down Expand Up @@ -60,7 +58,6 @@ const Choices: FC<ChoicesProps> = ({ poll }) => {
);

queryClient.refetchQueries({ queryKey: [GET_POLL_QUERY_KEY, poll.id] });
Leafwatch.track(POST.WIDGET.POLL.VOTE, { poll_id: id });
toast.success("Your poll has been casted!");
} catch {
toast.error(Errors.SomethingWentWrong);
Expand Down
7 changes: 0 additions & 7 deletions apps/web/src/components/Search/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import Sidebar from "@components/Shared/Sidebar";
import { Leafwatch } from "@helpers/leafwatch";
import { PencilSquareIcon, UsersIcon } from "@heroicons/react/24/outline";
import { PAGEVIEW } from "@hey/data/tracking";
import { GridItemEight, GridItemFour, GridLayout } from "@hey/ui";
import type { NextPage } from "next";
import { useRouter } from "next/router";
import { useEffect } from "react";
import Custom404 from "src/pages/404";
import Accounts from "./Accounts";
import Posts from "./Posts";
Expand All @@ -16,10 +13,6 @@ const Search: NextPage = () => {
? encodeURIComponent(query.q.join(" "))
: encodeURIComponent(query.q || "");

useEffect(() => {
Leafwatch.track(PAGEVIEW, { page: "search" });
}, []);

if (!query.q || !["profiles", "posts"].includes(query.type as string)) {
return <Custom404 />;
}
Expand Down
3 changes: 0 additions & 3 deletions apps/web/src/components/Settings/Account/Email/EmailForm.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import errorToast from "@helpers/errorToast";
import { getAuthApiHeaders } from "@helpers/getAuthApiHeaders";
import { Leafwatch } from "@helpers/leafwatch";
import { NoSymbolIcon } from "@heroicons/react/24/outline";
import { HEY_API_URL } from "@hey/data/constants";
import { Errors } from "@hey/data/errors";
import { SETTINGS } from "@hey/data/tracking";
import isEmailAllowed from "@hey/helpers/isEmailAllowed";
import { Button, Form, Input, useZodForm } from "@hey/ui";
import axios from "axios";
Expand Down Expand Up @@ -56,7 +54,6 @@ const EmailForm: FC = () => {
{ headers: getAuthApiHeaders() }
);
setEmailState(email as string);
Leafwatch.track(SETTINGS.ACCOUNT.SET_EMAIL);

return toast.success("Email verification sent to your email!");
} catch (error) {
Expand Down
3 changes: 0 additions & 3 deletions apps/web/src/components/Settings/Account/Email/Resend.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import errorToast from "@helpers/errorToast";
import { getAuthApiHeaders } from "@helpers/getAuthApiHeaders";
import { Leafwatch } from "@helpers/leafwatch";
import { HEY_API_URL } from "@hey/data/constants";
import { Errors } from "@hey/data/errors";
import { SETTINGS } from "@hey/data/tracking";
import { Button } from "@hey/ui";
import axios from "axios";
import type { FC } from "react";
Expand Down Expand Up @@ -46,7 +44,6 @@ const Resend: FC = () => {
{ headers: getAuthApiHeaders() }
);
setSent(true);
Leafwatch.track(SETTINGS.ACCOUNT.RESEND_EMAIL_VERIFICATION);

return toast.success("Email verification sent to your email!");
} catch (error) {
Expand Down
3 changes: 0 additions & 3 deletions apps/web/src/components/Settings/Account/Verification.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { Leafwatch } from "@helpers/leafwatch";
import { MinusCircleIcon } from "@heroicons/react/24/outline";
import { CheckBadgeIcon, CheckCircleIcon } from "@heroicons/react/24/solid";
import { SETTINGS } from "@hey/data/tracking";
import getNumberOfDaysFromDate from "@hey/helpers/datetime/getNumberOfDaysFromDate";
import { useAccountStatsQuery } from "@hey/indexer";
import { Button, Card, H5 } from "@hey/ui";
Expand Down Expand Up @@ -86,7 +84,6 @@ const Verification: FC = () => {
disabled={!hasAllRequirements}
onClick={() => {
// TODO: Migrate to Hey API
Leafwatch.track(SETTINGS.ACCOUNT.REQUEST_VERIFICATION);
toast.success("Verification request sent to staff!");
}}
>
Expand Down
7 changes: 0 additions & 7 deletions apps/web/src/components/Settings/Account/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import MetaTags from "@components/Common/MetaTags";
import SuperFollow from "@components/Settings/Account/SuperFollow";
import NotLoggedIn from "@components/Shared/NotLoggedIn";
import { Leafwatch } from "@helpers/leafwatch";
import { APP_NAME } from "@hey/data/constants";
import { PAGEVIEW } from "@hey/data/tracking";
import { GridItemEight, GridItemFour, GridLayout } from "@hey/ui";
import type { NextPage } from "next";
import { useEffect } from "react";
import { useAccountStore } from "src/store/persisted/useAccountStore";
import SettingsSidebar from "../Sidebar";
import Email from "./Email";
Expand All @@ -16,10 +13,6 @@ import Verification from "./Verification";
const AccountSettings: NextPage = () => {
const { currentAccount } = useAccountStore();

useEffect(() => {
Leafwatch.track(PAGEVIEW, { page: "settings", subpage: "account" });
}, []);

if (!currentAccount) {
return <NotLoggedIn />;
}
Expand Down
Loading

0 comments on commit cc1ecc1

Please sign in to comment.