mirror of
https://github.com/XFox111/TabsAsideExtension.git
synced 2026-04-22 07:58:01 +03:00
hotfix: wrapped analytics into try/catch to prevent failing on firefox
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { trackError } from "@/features/analytics";
|
||||
import { track, trackError } from "@/features/analytics";
|
||||
import { collectionCount, getCollections, saveCollections } from "@/features/collectionStorage";
|
||||
import { migrateStorage } from "@/features/migration";
|
||||
import { showWelcomeDialog } from "@/features/v3welcome/utils/showWelcomeDialog";
|
||||
@@ -31,7 +31,7 @@ export default defineBackground(() =>
|
||||
browser.runtime.onInstalled.addListener(async ({ reason, previousVersion }) =>
|
||||
{
|
||||
logger("onInstalled", reason, previousVersion);
|
||||
analytics.track("extension_installed", { reason, previousVersion: previousVersion ?? "none" });
|
||||
track("extension_installed", { reason, previousVersion: previousVersion ?? "none" });
|
||||
|
||||
const previousMajor: number = previousVersion ? parseInt(previousVersion.split(".")[0]) : 0;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { getCollectionTitle } from "@/entrypoints/sidepanel/utils/getCollectionTitle";
|
||||
import { track } from "@/features/analytics";
|
||||
import { useGroupColors } from "@/hooks/useGroupColors";
|
||||
import { CollectionItem, GroupItem } from "@/models/CollectionModels";
|
||||
import * as fui from "@fluentui/react-components";
|
||||
@@ -27,9 +28,9 @@ export default function EditDialog(props: GroupEditDialogProps): ReactElement
|
||||
const handleSave = () =>
|
||||
{
|
||||
if (props.type === "collection" ? props.collection !== null : props.group !== null)
|
||||
analytics.track("item_edited", { type: props.type });
|
||||
track("item_edited", { type: props.type });
|
||||
else
|
||||
analytics.track("item_created", { type: props.type });
|
||||
track("item_created", { type: props.type });
|
||||
|
||||
if (props.type === "collection")
|
||||
props.onSave({
|
||||
|
||||
@@ -5,6 +5,7 @@ import CloudIssueMessages from "@/entrypoints/sidepanel/layouts/collections/mess
|
||||
import CtaMessage from "@/entrypoints/sidepanel/layouts/collections/messages/CtaMessage";
|
||||
import filterCollections, { CollectionFilterType } from "@/entrypoints/sidepanel/utils/filterCollections";
|
||||
import sortCollections from "@/entrypoints/sidepanel/utils/sortCollections";
|
||||
import { track } from "@/features/analytics";
|
||||
import useSettings from "@/hooks/useSettings";
|
||||
import { CollectionItem } from "@/models/CollectionModels";
|
||||
import { DndContext, DragEndEvent, DragOverlay, DragStartEvent, MouseSensor, TouchSensor, useSensor, useSensors } from "@dnd-kit/core";
|
||||
@@ -65,7 +66,7 @@ export default function CollectionListView(): ReactElement
|
||||
if (sortMode !== "custom")
|
||||
setSortMode("custom");
|
||||
|
||||
analytics.track("used_drag_and_drop");
|
||||
track("used_drag_and_drop");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { BuyMeACoffee20Regular } from "@/assets/BuyMeACoffee20";
|
||||
import { buyMeACoffeeLink, storeLink } from "@/data/links";
|
||||
import { track } from "@/features/analytics";
|
||||
import { useBmcStyles } from "@/hooks/useBmcStyles";
|
||||
import extLink from "@/utils/extLink";
|
||||
import { Button, Link, MessageBar, MessageBarActions, MessageBarBody, MessageBarProps, MessageBarTitle } from "@fluentui/react-components";
|
||||
@@ -29,9 +30,9 @@ export default function CtaMessage(props: MessageBarProps): ReactElement
|
||||
setCounter(counter);
|
||||
|
||||
if (counter === -1)
|
||||
analytics.track("bmc_clicked");
|
||||
track("bmc_clicked");
|
||||
else
|
||||
analytics.track("cta_dismissed");
|
||||
track("cta_dismissed");
|
||||
};
|
||||
|
||||
if (counter < 50)
|
||||
@@ -41,7 +42,7 @@ export default function CtaMessage(props: MessageBarProps): ReactElement
|
||||
<MessageBar layout="multiline" icon={ <HeartFilled color="red" /> } { ...props }>
|
||||
<MessageBarBody>
|
||||
<MessageBarTitle>{ i18n.t("cta_message.title") }</MessageBarTitle>
|
||||
{ i18n.t("cta_message.message") } <Link { ...extLink(storeLink) } onClick={ () => analytics.track("feedback_clicked") }>{ i18n.t("cta_message.feedback") }</Link>
|
||||
{ i18n.t("cta_message.message") } <Link { ...extLink(storeLink) } onClick={ () => track("feedback_clicked") }>{ i18n.t("cta_message.feedback") }</Link>
|
||||
</MessageBarBody>
|
||||
<MessageBarActions
|
||||
containerAction={
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { BuyMeACoffee20Filled, BuyMeACoffee20Regular } from "@/assets/BuyMeACoffee20";
|
||||
import { buyMeACoffeeLink, githubLinks, storeLink } from "@/data/links";
|
||||
import { track } from "@/features/analytics";
|
||||
import useSettings from "@/hooks/useSettings";
|
||||
import extLink from "@/utils/extLink";
|
||||
import sendNotification from "@/utils/sendNotification";
|
||||
@@ -41,10 +42,10 @@ export default function MoreButton(): ReactElement
|
||||
|
||||
<fui.MenuDivider />
|
||||
|
||||
<fui.MenuItemLink icon={ <BmcIcon /> } { ...extLink(buyMeACoffeeLink) } onClick={ () => analytics.track("feedback_clicked") }>
|
||||
<fui.MenuItemLink icon={ <BmcIcon /> } { ...extLink(buyMeACoffeeLink) } onClick={ () => track("feedback_clicked") }>
|
||||
{ i18n.t("common.cta.sponsor") }
|
||||
</fui.MenuItemLink>
|
||||
<fui.MenuItemLink icon={ <FeedbackIcon /> } { ...extLink(storeLink) } onClick={ () => analytics.track("bmc_clicked") }>
|
||||
<fui.MenuItemLink icon={ <FeedbackIcon /> } { ...extLink(storeLink) } onClick={ () => track("bmc_clicked") }>
|
||||
{ i18n.t("common.cta.feedback") }
|
||||
</fui.MenuItemLink>
|
||||
<fui.MenuItemLink icon={ <LearnIcon /> } { ...extLink(githubLinks.release) } >
|
||||
|
||||
Reference in New Issue
Block a user