Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

wip

Kiran K1215a43b0eba
diff --git a/apps/web/app/api/analytics/client/route.ts b/apps/web/app/api/analytics/client/route.ts
index 3335215dd6..b6a2d17996 100644
--- a/apps/web/app/api/analytics/client/route.ts
+++ b/apps/web/app/api/analytics/client/route.ts
@@ -7,6 +7,7 @@ import { NextResponse } from "next/server";
export const GET = withAuth(async ({ workspace, link, searchParams }) => {
const parsedParams = analyticsQuerySchema.parse(searchParams);
+
const response = await getAnalytics({
...parsedParams,
linkId: link.id,
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/referrals/events.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/referrals/events.tsx
index 60691e07af..ad6fb43a09 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/referrals/events.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/referrals/events.tsx
@@ -28,6 +28,8 @@ export const Events = (props: EventsProps) => {
const searchParams = useSearchParams();
const { events, isLoading } = useEvents();
+ console.log("events", events);
+
const event = (searchParams.get("event") || "clicks") as EventType;
return <div>Events</div>;
@@ -70,6 +72,13 @@ export const Events = (props: EventsProps) => {
// );
}
+const saleText = {
+ "Subscription creation": "upgraded their account",
+ "Subscription paid": "paid their subscription",
+ "Plan upgraded": "upgraded their plan",
+ default: "made a payment",
+};
+
function ClickDescription({ event }: { event: ClickEvent }) {
return (
<>
@@ -116,12 +125,7 @@ function LeadDescription({ event }: { event: LeadEvent }) {
);
}
-const saleText = {
- "Subscription creation": "upgraded their account",
- "Subscription paid": "paid their subscription",
- "Plan upgraded": "upgraded their plan",
- default: "made a payment",
-};
+
function SaleDescription({ event }: { event: SaleEvent }) {
return (
diff --git a/apps/web/lib/referrals/auth.ts b/apps/web/lib/referrals/auth.ts
index cebd5ac7fc..cd80149c6e 100644
--- a/apps/web/lib/referrals/auth.ts
+++ b/apps/web/lib/referrals/auth.ts
@@ -37,29 +37,31 @@ export const withAuth = (handler: WithAuthHandler) => {
const searchParams = getSearchParams(req.url);
const authorizationHeader = req.headers.get("Authorization");
- if (!authorizationHeader) {
- throw new DubApiError({
- code: "unauthorized",
- message: "Missing Authorization header.",
- });
- }
-
- if (!authorizationHeader.includes("Bearer ")) {
- throw new DubApiError({
- code: "bad_request",
- message:
- "Misconfigured authorization header. Did you forget to add 'Bearer '? Learn more: https://d.to/auth",
- });
- }
-
- tokenFromHeader = authorizationHeader.replace("Bearer ", "");
-
- if (!tokenFromHeader) {
- throw new DubApiError({
- code: "unauthorized",
- message: "Missing Authorization header.",
- });
- }
+ // if (!authorizationHeader) {
+ // throw new DubApiError({
+ // code: "unauthorized",
+ // message: "Missing Authorization header.",
+ // });
+ // }
+
+ // if (!authorizationHeader.includes("Bearer ")) {
+ // throw new DubApiError({
+ // code: "bad_request",
+ // message:
+ // "Misconfigured authorization header. Did you forget to add 'Bearer '? Learn more: https://d.to/auth",
+ // });
+ // }
+
+ // tokenFromHeader = authorizationHeader.replace("Bearer ", "");
+
+ // if (!tokenFromHeader) {
+ // throw new DubApiError({
+ // code: "unauthorized",
+ // message: "Missing Authorization header.",
+ // });
+ // }
+
+ tokenFromHeader = "Wu2HvXx2w99h1nFnXY2rnVE6532bVqLAoJht";
const publicToken = await prisma.referralPublicToken.findUnique({
where: {