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.

more changes

Steven Teyaf4c93c4dc91
diff --git a/apps/web/lib/zod/schemas/analytics-response.ts b/apps/web/lib/zod/schemas/analytics-response.ts
index 9f3da8c35d..86f4a9ccbe 100644
--- a/apps/web/lib/zod/schemas/analytics-response.ts
+++ b/apps/web/lib/zod/schemas/analytics-response.ts
@@ -1,6 +1,6 @@
import { TRIGGER_TYPES } from "@/lib/analytics/constants";
import z from "@/lib/zod";
-import { CONTINENT_CODES, COUNTRY_CODES } from "@dub/utils";
+import { CONTINENT_CODES } from "@dub/utils";
const analyticsTriggersResponse = z
.object({
@@ -89,9 +89,9 @@ export const analyticsResponse = {
countries: z
.object({
country: z
- .enum(COUNTRY_CODES)
+ .string()
.describe(
- "The 2-letter ISO 3166-1 country code for the country associated with the location of the user. Learn more: https://d.to/geo",
+ "The 2-letter ISO 3166-1 country code of the country. Learn more: https://d.to/geo",
),
region: z.literal("*").default("*"),
city: z.literal("*").default("*"),
@@ -117,13 +117,13 @@ export const analyticsResponse = {
regions: z
.object({
country: z
- .enum(COUNTRY_CODES)
- .describe("The 2-letter country code of the region: https://d.to/geo"),
- region: z
.string()
.describe(
- "The 2-letter ISO 3166-2 region code representing the region associated with the location of the user.",
+ "The 2-letter ISO 3166-1 country code of the country. Learn more: https://d.to/geo",
),
+ region: z
+ .string()
+ .describe("The 2-letter ISO 3166-2 region code of the region."),
city: z.literal("*").default("*"),
clicks: z
.number()
@@ -147,8 +147,10 @@ export const analyticsResponse = {
cities: z
.object({
country: z
- .enum(COUNTRY_CODES)
- .describe("The 2-letter country code of the city: https://d.to/geo"),
+ .string()
+ .describe(
+ "The 2-letter ISO 3166-1 country code of the country where this city is located. Learn more: https://d.to/geo",
+ ),
region: z
.string()
.describe(
diff --git a/apps/web/lib/zod/schemas/analytics.ts b/apps/web/lib/zod/schemas/analytics.ts
index 33abaa9663..2098ad20d7 100644
--- a/apps/web/lib/zod/schemas/analytics.ts
+++ b/apps/web/lib/zod/schemas/analytics.ts
@@ -140,7 +140,9 @@ export const analyticsQuerySchema = z
country: z
.enum(COUNTRY_CODES)
.optional()
- .describe("The country to retrieve analytics for.")
+ .describe(
+ "The country to retrieve analytics for. Must be passed as a 2-letter ISO 3166-1 country code. Learn more: https://d.to/geo",
+ )
.openapi({ ref: "countryCode" }),
city: z
.string()
diff --git a/apps/web/lib/zod/schemas/partners.ts b/apps/web/lib/zod/schemas/partners.ts
index ec76db8864..5d4a44f146 100644
--- a/apps/web/lib/zod/schemas/partners.ts
+++ b/apps/web/lib/zod/schemas/partners.ts
@@ -322,9 +322,11 @@ export const createPartnerSchema = z.object({
name: z
.string()
.trim()
- .min(1)
.max(100)
- .describe("Full legal name of the partner."),
+ .nullish()
+ .describe(
+ "The partner's full legal name. If undefined, the partner's name will be generated from the email address (e.g. `[email protected]` -> `John`).",
+ ),
email: z
.string()
.trim()
@@ -332,34 +334,40 @@ export const createPartnerSchema = z.object({
.max(190)
.email()
.describe(
- "Email for the partner in your system. Partners will be able to claim their profile by signing up to Dub Partners with this email.",
+ "The partner's email address in your system. Partners will be able to claim their profile by signing up at partners.dub.co with this email.",
),
username: z
.string()
.max(100)
.nullish()
.describe(
- "A unique username for the partner in your system (max 100 characters). This will be used to create a short link for the partner using your program's default domain. If not provided, Dub will try to generate a username from the partner's name or email.",
+ "The partner's unique username in your system (max 100 characters). This will be used to create a short link for the partner using your program's default domain. If not provided, Dub will try to generate a username from the partner's name or email.",
),
image: z
.string()
.nullish()
.describe(
- "Avatar image for the partner – if not provided, a default avatar will be used.",
+ "The partner's avatar image. If not provided, a default avatar will be used.",
),
country: z
.enum(COUNTRY_CODES)
.nullish()
- .describe("Country where the partner is based."),
+ .describe(
+ "The partner's country of residence. Must be passed as a 2-letter ISO 3166-1 country code. Learn more: https://d.to/geo",
+ ),
description: z
.string()
.max(5000)
.nullish()
- .describe("A brief description of the partner and their background."),
+ .describe(
+ "A brief description of the partner and their background. Max 5,000 characters.",
+ ),
tenantId: z
.string()
.optional()
- .describe("The ID of the partner in your system."),
+ .describe(
+ "The partner's unique ID in your system. Useful for retrieving the partner's links and stats later on. If not provided, the partner will be created as a standalone partner.",
+ ),
linkProps: createLinkBodySchema
.omit({
url: true,