The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
update search input
Steven Tey8d4c2f6f5913
diff --git a/apps/web/scripts/framer/mark-commissions-paid.ts b/apps/web/scripts/framer/mark-commissions-paid.tsnew file mode 100644index 0000000000..e778236f12--- /dev/null+++ b/apps/web/scripts/framer/mark-commissions-paid.ts@@ -0,0 +1,113 @@+import { prisma } from "@dub/prisma";+import "dotenv-flow/config";+import * as fs from "fs";+import * as Papa from "papaparse";++const eventIds: string[] = [];++async function main() {+ Papa.parse(fs.createReadStream("framer_paid_event_ids.csv", "utf-8"), {+ header: true,+ skipEmptyLines: true,+ step: (result: { data: { event_id: string } }) => {+ eventIds.push(result.data.event_id);+ },+ complete: async () => {+ // const commissionsToUpdate = await prisma.commission.findMany({+ // where: {+ // eventId: { in: eventIds },+ // },+ // orderBy: {+ // createdAt: "asc",+ // },+ // });++ // console.log(+ // `Found ${commissionsToUpdate.length} commissions to mark as paid`,+ // );++ // const payoutsToUpdate = await prisma.commission.groupBy({+ // by: ["payoutId"],+ // where: {+ // eventId: { in: eventIds },+ // },+ // _count: true,+ // orderBy: {+ // _count: {+ // eventId: "desc",+ // },+ // },+ // });++ // console.log(+ // `Found ${payoutsToUpdate.length} payouts to update commission totals`,+ // );++ const commissions = await prisma.commission.updateMany({+ where: {+ eventId: { in: eventIds },+ },+ data: {+ status: "paid",+ payoutId: null,+ },+ });++ console.log(+ `Updated ${commissions} commissions to have a payoutId of null`,+ );++ const payoutIdsToUpdate = await prisma.commission.groupBy({+ by: ["payoutId"],+ where: {+ eventId: { in: eventIds },+ },+ });++ for (const payout of payoutIdsToUpdate) {+ if (!payout.payoutId) {+ continue;+ }++ const commissionGroupedByPayout = await prisma.commission.groupBy({+ by: ["payoutId"],+ where: {+ payoutId: payout.payoutId,+ },+ _sum: {+ earnings: true,+ },+ });++ const finalCommissionAmount =+ commissionGroupedByPayout[0]._sum.earnings;++ if (!finalCommissionAmount) {+ console.log(+ `No commission amount found for payout ${payout.payoutId}, deleting payout...`,+ );+ await prisma.payout.delete({+ where: {+ id: payout.payoutId,+ },+ });+ continue;+ }++ console.log(+ `Updating payout ${payout.payoutId} with amount ${finalCommissionAmount}`,+ );+ await prisma.payout.update({+ where: {+ id: payout.payoutId,+ },+ data: {+ amount: finalCommissionAmount,+ },+ });+ }+ },+ });+}++main();diff --git a/apps/web/ui/customers/customer-table/customer-table.tsx b/apps/web/ui/customers/customer-table/customer-table.tsxindex 1bffdcd839..c7e5b622af 100644--- a/apps/web/ui/customers/customer-table/customer-table.tsx+++ b/apps/web/ui/customers/customer-table/customer-table.tsx@@ -278,8 +278,8 @@ export function CustomerTable() {onRemove={onRemove}/><SearchBoxPersisted- placeholder="Search..."- inputClassName="md:w-72"+ placeholder="Search by email, name, or external ID"+ inputClassName="md:w-[21rem]"/></div><AnimatedSizeContainer height>diff --git a/packages/utils/src/constants/plan-compare.tsx b/packages/utils/src/constants/plan-compare.tsxindex 780028fe9b..b1d1f0789a 100644--- a/packages/utils/src/constants/plan-compare.tsx+++ b/packages/utils/src/constants/plan-compare.tsx@@ -187,8 +187,8 @@ export const PLAN_COMPARE_FEATURES: {advanced: true,enterprise: true,},- text: "Real-time events stream",- href: "https://dub.co/help/article/real-time-events-stream",+ text: "Conversion tracking",+ href: "https://dub.co/help/article/dub-conversions",},{check: {@@ -197,8 +197,18 @@ export const PLAN_COMPARE_FEATURES: {advanced: true,enterprise: true,},- text: "Conversion tracking",- href: "https://dub.co/help/article/dub-conversions",+ text: "Customer insights",+ href: "https://dub.co/help/article/customer-insights",+ },+ {+ check: {+ default: false,+ business: true,+ advanced: true,+ enterprise: true,+ },+ text: "Real-time events stream",+ href: "https://dub.co/help/article/real-time-events-stream",},],},