Skip to content

Scheduling infrastructure for absolutely everyone.

fix: call history to free users (#27473)

Jagadish Madavalkar39135f84eff3
diff --git a/apps/web/app/(use-page-wrapper)/insights/UpgradeTipWrapper.tsx b/apps/web/app/(use-page-wrapper)/insights/UpgradeTipWrapper.tsx
index e3d8ecd5493..2bc0756255b 100644
--- a/apps/web/app/(use-page-wrapper)/insights/UpgradeTipWrapper.tsx
+++ b/apps/web/app/(use-page-wrapper)/insights/UpgradeTipWrapper.tsx
@@ -1,6 +1,7 @@
"use client";
import { useSession } from "next-auth/react";
+import { usePathname } from "next/navigation";
import { WEBAPP_URL } from "@calcom/lib/constants";
import { useLocale } from "@calcom/lib/hooks/useLocale";
@@ -13,6 +14,12 @@ import { UpgradeTip } from "~/shell/UpgradeTip";
export default function UpgradeTipWrapper({ children }: { children: React.ReactNode }) {
const { t } = useLocale();
const session = useSession();
+ const pathname = usePathname();
+
+ if (pathname?.startsWith("/insights/call-history")) {
+ return !session.data?.user ? null : <>{children}</>;
+ }
+
const features = [
{
icon: <Icon name="users" className="h-5 w-5 text-red-500" />,
diff --git a/apps/web/modules/shell/navigation/Navigation.tsx b/apps/web/modules/shell/navigation/Navigation.tsx
index 62b71a81e1c..ed436401b5a 100644
--- a/apps/web/modules/shell/navigation/Navigation.tsx
+++ b/apps/web/modules/shell/navigation/Navigation.tsx
@@ -20,7 +20,7 @@ export const MORE_SEPARATOR_NAME = "more";
const getNavigationItems = (
orgBranding: OrganizationBranding,
- hasInsightsAccess: boolean
+ hasAllInsightsAccess: boolean
): NavigationItemType[] => [
{
name: "event_types_page_title",
@@ -111,7 +111,7 @@ const getNavigationItems = (
icon: "chart-bar",
isCurrent: ({ pathname: path, item }) => path?.startsWith(item.href) ?? false,
moreOnMobile: true,
- child: hasInsightsAccess
+ child: hasAllInsightsAccess
? [
{
name: "bookings",
@@ -135,7 +135,14 @@ const getNavigationItems = (
isCurrent: ({ pathname: path }) => path?.startsWith("/insights/call-history") ?? false,
},
]
- : undefined,
+ : [
+ {
+ name: "call_history",
+ href: "/insights/call-history",
+ // icon: "phone",
+ isCurrent: ({ pathname: path }) => path?.startsWith("/insights/call-history") ?? false,
+ }
+ ],
},
];
@@ -193,9 +200,9 @@ const useNavigationItems = (isPlatformNavigation = false) => {
const orgBranding = useOrgBranding();
const { hasPaidPlan, isPending } = useHasPaidPlan();
return useMemo(() => {
- const hasInsightsAccess = !isPending && !!hasPaidPlan;
+ const hasAllInsightsAccess = !isPending && !!hasPaidPlan;
const items = !isPlatformNavigation
- ? getNavigationItems(orgBranding, hasInsightsAccess)
+ ? getNavigationItems(orgBranding, hasAllInsightsAccess)
: platformNavigationItems;
const desktopNavigationItems = items.filter((item) => item.name !== MORE_SEPARATOR_NAME);