Skip to content
Merged
3 changes: 3 additions & 0 deletions apps/web/public/static/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -3491,5 +3491,8 @@
"meeting_link": "Meeting link",
"my_bookings": "My Bookings",
"phone": "Phone",
"free": "Free",
"user_email": "User Email",
"user_name": "User Name",
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Add your new strings above here ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { Table } from "@tanstack/react-table";
import { useCallback } from "react";

import { convertFacetedValuesToMap, type FacetedValue } from "@calcom/features/data-table";
import { useLocale } from "@calcom/lib/hooks/useLocale";
Copy link
Contributor

@coderabbitai coderabbitai bot Aug 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

i18n hookup looks good; ensure keys exist.

Importing useLocale and using t is correct. Please verify that "paid" and "free" keys exist in locale JSONs.

Also applies to: 28-28


🏁 Script executed:

#!/bin/bash
# Verify i18n keys exist somewhere in locale JSON files
rg -nP '"(paid|free|user_email|user_name)"\s*:' -g '!**/node_modules/**' -S

Length of output: 3059


Add missing i18n keys for “free”, “user_email”, and “user_name”

The lookup for “paid” succeeded across all locale JSONs, but the keys “free”, “user_email”, and “user_name” were not found. Please add these entries to each common.json (and any other relevant namespace) under apps/web/public/static/locales/*/. For example, in apps/web/public/static/locales/en/common.json:

 {
   "paid": "Paid",
+  "free": "Free",
+  "user_email": "User email",
+  "user_name": "User name",
   …
 }

– Repeat for every locale to ensure complete coverage.

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In packages/features/insights/hooks/useInsightsBookingFacetedUniqueValues.ts
around line 5, the code references i18n keys "free", "user_email", and
"user_name" that are missing; add these keys to every locale file (e.g.,
apps/web/public/static/locales/*/common.json and any other used namespace) with
appropriate translations (matching structure of existing keys like "paid"),
ensure JSON syntax is valid, and run the i18n/locales validation or app build to
confirm no missing-key errors remain.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eunjae-lee this is correct. user_email, user_name doesn't exist in common.json

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Udit-takkar thanks for pointing it out ! just added a commit for that

import { BookingStatus } from "@calcom/prisma/enums";
import { trpc } from "@calcom/trpc";

Expand All @@ -24,6 +25,7 @@ export const useInsightsBookingFacetedUniqueValues = ({
teamId: number | undefined;
isAll: boolean;
}) => {
const { t } = useLocale();
const { data: users } = trpc.viewer.insights.userList.useQuery(
{
teamId,
Expand Down Expand Up @@ -68,9 +70,14 @@ export const useInsightsBookingFacetedUniqueValues = ({
label: eventType.teamId ? `${eventType.title} (${eventType.team?.name})` : eventType.title,
})) ?? []
);
} else if (columnId === "paid") {
return convertFacetedValuesToMap([
{ value: "true", label: t("paid") },
{ value: "false", label: t("free") },
]);
}
return new Map<FacetedValue, number>();
},
[users, eventTypes]
[users, eventTypes, t]
);
};
56 changes: 56 additions & 0 deletions packages/features/insights/hooks/useInsightsBookings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ type DummyTableRow = {
userId: number | null;
eventTypeId: number | null;
status: BookingStatus;
paid: boolean;
userEmail: string | null;
userName: string | null;
rating: number | null;
};

const emptyData: DummyTableRow[] = [];
Expand Down Expand Up @@ -67,6 +71,58 @@ export const useInsightsBookings = () => {
},
cell: () => null,
}),
columnHelper.accessor("paid", {
id: "paid",
header: t("paid"),
size: 150,
meta: {
filter: {
type: ColumnFilterType.SINGLE_SELECT,
},
},
enableColumnFilter: true,
enableSorting: false,
cell: () => null,
}),
columnHelper.accessor("userEmail", {
id: "userEmail",
header: t("user_email"),
size: 200,
meta: {
filter: {
type: ColumnFilterType.TEXT,
},
},
enableColumnFilter: true,
enableSorting: false,
cell: () => null,
}),
columnHelper.accessor("userName", {
id: "userName",
header: t("user_name"),
size: 200,
meta: {
filter: {
type: ColumnFilterType.TEXT,
},
},
enableColumnFilter: true,
enableSorting: false,
cell: () => null,
}),
columnHelper.accessor("rating", {
id: "rating",
header: t("rating"),
size: 150,
meta: {
filter: {
type: ColumnFilterType.NUMBER,
},
},
enableColumnFilter: true,
enableSorting: false,
cell: () => null,
}),
];
}, [t]);

Expand Down
34 changes: 33 additions & 1 deletion packages/lib/server/service/InsightsBookingBaseService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@ import md5 from "md5";
import { z } from "zod";

import dayjs from "@calcom/dayjs";
import { makeSqlCondition } from "@calcom/features/data-table/lib/server";
import { ZColumnFilter } from "@calcom/features/data-table/lib/types";
import type { ColumnFilter } from "@calcom/features/data-table/lib/types";
import { isSingleSelectFilterValue, isMultiSelectFilterValue } from "@calcom/features/data-table/lib/utils";
import {
isSingleSelectFilterValue,
isMultiSelectFilterValue,
isTextFilterValue,
isNumberFilterValue,
} from "@calcom/features/data-table/lib/utils";
import type { DateRange } from "@calcom/features/insights/server/insightsDateUtils";
import type { readonlyPrisma } from "@calcom/prisma";
import { MembershipRole } from "@calcom/prisma/enums";
Expand Down Expand Up @@ -319,6 +325,32 @@ export class InsightsBookingBaseService {
return Prisma.sql`"status" IN (${Prisma.join(statusValues)})`;
}

if (id === "paid" && isSingleSelectFilterValue(value)) {
const paidValue = value.data === "true";
return Prisma.sql`"paid" = ${paidValue}`;
}

if (id === "userEmail" && isTextFilterValue(value)) {
const condition = makeSqlCondition(value);
if (condition) {
return Prisma.sql`"userEmail" ${condition}`;
}
}

if (id === "userName" && isTextFilterValue(value)) {
const condition = makeSqlCondition(value);
if (condition) {
return Prisma.sql`"userName" ${condition}`;
}
}

if (id === "rating" && isNumberFilterValue(value)) {
const condition = makeSqlCondition(value);
if (condition) {
return Prisma.sql`"rating" ${condition}`;
}
}

return null;
}

Expand Down
Loading