fix: call history to free users (#27473)
* fix: call history to free users Signed-off-by: Jagadish Madavalkar <jagadish.me07@gmail.com> * bypass paywall for insights/call-history * improve naming --------- Signed-off-by: Jagadish Madavalkar <jagadish.me07@gmail.com> Co-authored-by: Romit <85230081+romitg2@users.noreply.github.com> Co-authored-by: Romit <romitgabani@icloud.com>
This commit is contained in:
co-authored by
Romit
Romit
parent
512002aaef
commit
39135f84ef
@@ -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" />,
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user