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.

Update default avatar URL

Steven Teyd6f48bff5047
diff --git a/apps/web/app/api/programs/[programId]/sales/route.ts b/apps/web/app/api/programs/[programId]/sales/route.ts
index ba487c4285..8b82677721 100644
--- a/apps/web/app/api/programs/[programId]/sales/route.ts
+++ b/apps/web/app/api/programs/[programId]/sales/route.ts
@@ -57,8 +57,6 @@ export const GET = withWorkspace(
orderBy: { [sortBy]: sortOrder },
});
- console.log({ sales });
-
return NextResponse.json(z.array(ProgramSaleResponseSchema).parse(sales));
},
);
diff --git a/apps/web/lib/analytics/get-events.ts b/apps/web/lib/analytics/get-events.ts
index da9df34cbe..6f672c78e9 100644
--- a/apps/web/lib/analytics/get-events.ts
+++ b/apps/web/lib/analytics/get-events.ts
@@ -1,6 +1,7 @@
import { tb } from "@/lib/tinybird";
import { prisma } from "@dub/prisma";
import { Link } from "@dub/prisma/client";
+import { DICEBEAR_AVATAR_URL } from "@dub/utils";
import { transformLink } from "../api/links";
import { decodeLinkIfCaseSensitive } from "../api/links/case-sensitivity";
import { generateRandomName } from "../names";
@@ -35,7 +36,6 @@ export const getEvents = async (params: EventsFilters) => {
trigger,
region,
country,
- isDemo,
order,
sortOrder,
dataAvailableFrom,
@@ -138,7 +138,7 @@ export const getEvents = async (params: EventsFilters) => {
id: evt.customer_id,
name: "Deleted Customer",
- avatar: `https://api.dicebear.com/9.x/micah/svg?seed=${evt.customer_id}`,
+ avatar: `${DICEBEAR_AVATAR_URL}${evt.customer_id}`,
externalId: evt.customer_id,
createdAt: new Date("1970-01-01"),
},
@@ -208,9 +208,7 @@ const getCustomersMap = async (customerIds: string[]) => {
externalId: customer.externalId || "",
name: customer.name || customer.email || generateRandomName(),
email: customer.email || "",
- avatar:
- customer.avatar ||
- `https://api.dicebear.com/9.x/notionists/svg?seed=${customer.id}`,
+ avatar: customer.avatar || `${DICEBEAR_AVATAR_URL}${customer.id}`,
country: customer.country || "",
createdAt: customer.createdAt,
});
diff --git a/apps/web/lib/api/customers/get-customer-or-throw.ts b/apps/web/lib/api/customers/get-customer-or-throw.ts
index 1e34cac2d7..4f4a3cbb43 100644
--- a/apps/web/lib/api/customers/get-customer-or-throw.ts
+++ b/apps/web/lib/api/customers/get-customer-or-throw.ts
@@ -1,4 +1,5 @@
import { prisma } from "@dub/prisma";
+import { DICEBEAR_AVATAR_URL } from "@dub/utils";
import { DubApiError } from "../errors";
import { CustomerWithLink } from "./transform-customer";
@@ -59,7 +60,7 @@ export const getCustomerOrThrow = async (
}
if (!customer.avatar) {
- customer.avatar = `https://api.dicebear.com/9.x/notionists/svg?seed=${customer.id}`;
+ customer.avatar = `${DICEBEAR_AVATAR_URL}${customer.id}`;
}
return customer;
diff --git a/apps/web/lib/webhook/sample-events/lead-created.json b/apps/web/lib/webhook/sample-events/lead-created.json
index 209cdedee9..d4dad794fd 100644
--- a/apps/web/lib/webhook/sample-events/lead-created.json
+++ b/apps/web/lib/webhook/sample-events/lead-created.json
@@ -5,7 +5,7 @@
"externalId": "cus_BH6tDUWc9n0Y2pf55tVbk1hc",
"name": "Tiny Beige Badger",
"email": "[email protected]",
- "avatar": "https://api.dicebear.com/9.x/notionists/svg?seed=cus_BH6tDUWc9n0Y2pf55tVbk1hc",
+ "avatar": "https://api.dicebear.com/7.x/initials/svg?backgroundType=gradientLinear&fontFamily=Helvetica&fontSize=40&seed=cus_BH6tDUWc9n0Y2pf55tVbk1hc",
"createdAt": "2025-01-14T04:49:23.385Z"
},
"click": {
diff --git a/apps/web/lib/webhook/sample-events/sale-created.json b/apps/web/lib/webhook/sample-events/sale-created.json
index 27163a2f67..5c0f6a712a 100644
--- a/apps/web/lib/webhook/sample-events/sale-created.json
+++ b/apps/web/lib/webhook/sample-events/sale-created.json
@@ -5,7 +5,7 @@
"externalId": "cus_jTrfVKYN3Buc3F80JoqBiY0g",
"name": "Rural Red Goldfish",
"email": "[email protected]",
- "avatar": "https://api.dicebear.com/9.x/notionists/svg?seed=cus_jTrfVKYN3Buc3F80JoqBiY0g",
+ "avatar": "https://api.dicebear.com/7.x/initials/svg?backgroundType=gradientLinear&fontFamily=Helvetica&fontSize=40&seed=cus_jTrfVKYN3Buc3F80JoqBiY0g",
"createdAt": "2024-10-12T04:55:36.007Z"
},
"click": {
diff --git a/apps/web/lib/webhook/transform.ts b/apps/web/lib/webhook/transform.ts
index d039dc1324..cb1d4ec56c 100644
--- a/apps/web/lib/webhook/transform.ts
+++ b/apps/web/lib/webhook/transform.ts
@@ -3,7 +3,7 @@ import {
webhookPayloadSchema,
} from "@/lib/webhook/schemas";
import { Webhook } from "@dub/prisma/client";
-import { nanoid, toCamelCase } from "@dub/utils";
+import { DICEBEAR_AVATAR_URL, nanoid, toCamelCase } from "@dub/utils";
import { ExpandedLink, transformLink } from "../api/links/utils/transform-link";
import { generateRandomName } from "../names";
import { WebhookTrigger } from "../types";
@@ -54,9 +54,7 @@ const transformWebhookCustomer = (customer: any) => {
name: customer.name || customer.email || generateRandomName(),
externalId: customer.externalId || "",
country: undefined,
- avatar:
- customer.avatar ||
- `https://api.dicebear.com/9.x/notionists/svg?seed=${customer.id}`,
+ avatar: customer.avatar || `${DICEBEAR_AVATAR_URL}${customer.id}`,
};
};
diff --git a/apps/web/tests/partners/create-partner.test.ts b/apps/web/tests/partners/create-partner.test.ts
index 583f9f65af..1a972ffdaa 100644
--- a/apps/web/tests/partners/create-partner.test.ts
+++ b/apps/web/tests/partners/create-partner.test.ts
@@ -60,7 +60,6 @@ describe.sequential("POST /partners", async () => {
name: generateRandomName(),
email: randomEmail(),
tenantId: randomId(),
- image: `https://api.dicebear.com/9.x/notionists/svg?seed=hello`,
description: "A description of the partner",
country: "US",
};
diff --git a/apps/web/tests/utils/helpers.ts b/apps/web/tests/utils/helpers.ts
index c59f5e69c4..a0a133dd03 100644
--- a/apps/web/tests/utils/helpers.ts
+++ b/apps/web/tests/utils/helpers.ts
@@ -1,5 +1,5 @@
import { generateRandomName } from "@/lib/names";
-import { nanoid } from "@dub/utils";
+import { DICEBEAR_AVATAR_URL, nanoid } from "@dub/utils";
export const randomId = () => nanoid(24);
@@ -12,7 +12,7 @@ export const randomCustomer = () => {
externalId,
name: customerName,
email: `${customerName.split(" ").join(".").toLowerCase()}@example.com`,
- avatar: `https://api.dicebear.com/9.x/notionists/svg?seed=${externalId}`,
+ avatar: `${DICEBEAR_AVATAR_URL}${externalId}`,
};
};