The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
pushed schema changes
Steven Tey45627b102606
diff --git a/apps/web/lib/analytics/constants.ts b/apps/web/lib/analytics/constants.tsindex e8246e43ed..7efc8c9648 100644--- a/apps/web/lib/analytics/constants.ts+++ b/apps/web/lib/analytics/constants.ts@@ -83,6 +83,7 @@ export const INTERVAL_DATA: Record<export const VALID_ANALYTICS_ENDPOINTS = ["count","timeseries",+ "continents","countries","cities","devices",@@ -95,6 +96,7 @@ export const VALID_ANALYTICS_ENDPOINTS = [] as const;export const SINGULAR_ANALYTICS_ENDPOINTS = {+ continents: "continent",countries: "country",cities: "city",devices: "device",@@ -109,6 +111,7 @@ export const VALID_ANALYTICS_FILTERS = ["interval","start","end",+ "continent","country","city","device",diff --git a/apps/web/lib/zod/schemas/clicks-analytics.ts b/apps/web/lib/zod/schemas/clicks-analytics.tsindex 122086b300..047a510271 100644--- a/apps/web/lib/zod/schemas/clicks-analytics.ts+++ b/apps/web/lib/zod/schemas/clicks-analytics.ts@@ -1,5 +1,5 @@import z from "@/lib/zod";-import { COUNTRY_CODES } from "@dub/utils";+import { CONTINENT_CODES, COUNTRY_CODES } from "@dub/utils";// Click analytics response schemasexport const clickAnalyticsResponse = {@@ -16,11 +16,24 @@ export const clickAnalyticsResponse = {}).openapi({ ref: "ClicksTimeseries" }),+ continents: z+ .object({+ continent: z+ .enum(CONTINENT_CODES)+ .describe(+ "The 2-letter ISO 3166-1 code representing the continent associated with the location of the user.",+ ),+ clicks: z.number().describe("The number of clicks from this continent"),+ })+ .openapi({ ref: "ClicksContinents" }),+countries: z.object({country: z.enum(COUNTRY_CODES)- .describe("The 2-letter country code: https://d.to/geo"),+ .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",+ ),clicks: z.number().describe("The number of clicks from this country"),}).openapi({ ref: "ClicksCountries" }),diff --git a/apps/web/lib/zod/schemas/composite-analytics.ts b/apps/web/lib/zod/schemas/composite-analytics.tsindex 3e49e437d7..f5f7925739 100644--- a/apps/web/lib/zod/schemas/composite-analytics.ts+++ b/apps/web/lib/zod/schemas/composite-analytics.ts@@ -1,5 +1,5 @@import z from "@/lib/zod";-import { COUNTRY_CODES } from "@dub/utils";+import { CONTINENT_CODES, COUNTRY_CODES } from "@dub/utils";export const compositeAnalyticsResponse = {count: z.object({@@ -17,11 +17,27 @@ export const compositeAnalyticsResponse = {amount: z.number().describe("The total amount of sales in the interval"),}),+ continents: z.object({+ continent: z+ .enum(CONTINENT_CODES)+ .describe(+ "The 2-letter ISO 3166-1 code representing the continent associated with the location of the user.",+ ),+ clicks: z.number().describe("The number of clicks from this continent"),+ leads: z.number().describe("The number of leads from this continent"),+ sales: z.number().describe("The number of sales from this continent"),+ amount: z+ .number()+ .describe("The total amount of sales from this continent"),+ }),+countries: z.object({country: z.enum(COUNTRY_CODES)- .describe("The 2-letter country code: https://d.to/geo"),+ .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",+ ),clicks: z.number().describe("The number of clicks from this country"),leads: z.number().describe("The number of leads from this country"),sales: z.number().describe("The number of sales from this country"),diff --git a/apps/web/lib/zod/schemas/leads-analytics.ts b/apps/web/lib/zod/schemas/leads-analytics.tsindex 8816490f52..6100df7ec3 100644--- a/apps/web/lib/zod/schemas/leads-analytics.ts+++ b/apps/web/lib/zod/schemas/leads-analytics.ts@@ -1,5 +1,5 @@import z from "@/lib/zod";-import { COUNTRY_CODES } from "@dub/utils";+import { CONTINENT_CODES, COUNTRY_CODES } from "@dub/utils";export const leadAnalyticsResponse = {count: z@@ -15,11 +15,24 @@ export const leadAnalyticsResponse = {}).openapi({ ref: "LeadsTimeseries" }),+ continents: z+ .object({+ continent: z+ .enum(CONTINENT_CODES)+ .describe(+ "The 2-letter ISO 3166-1 code representing the continent associated with the location of the user.",+ ),+ leads: z.number().describe("The number of leads from this continent"),+ })+ .openapi({ ref: "LeadsContinents" }),+countries: z.object({country: z.enum(COUNTRY_CODES)- .describe("The 2-letter country code: https://d.to/geo"),+ .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",+ ),leads: z.number().describe("The number of leads from this country"),}).openapi({ ref: "LeadsCountries" }),diff --git a/apps/web/lib/zod/schemas/sales-analytics.ts b/apps/web/lib/zod/schemas/sales-analytics.tsindex 5b2aa8ef83..4b6cecfa60 100644--- a/apps/web/lib/zod/schemas/sales-analytics.ts+++ b/apps/web/lib/zod/schemas/sales-analytics.ts@@ -1,5 +1,5 @@import z from "@/lib/zod";-import { COUNTRY_CODES } from "@dub/utils";+import { CONTINENT_CODES, COUNTRY_CODES } from "@dub/utils";export const saleAnalyticsResponse = {count: z@@ -17,11 +17,24 @@ export const saleAnalyticsResponse = {}).openapi({ ref: "SalesTimeseries" }),+ continents: z+ .object({+ continent: z+ .enum(CONTINENT_CODES)+ .describe(+ "The 2-letter ISO 3166-1 code representing the continent associated with the location of the user.",+ ),+ sales: z.number().describe("The number of sales from this continent"),+ })+ .openapi({ ref: "SalesContinents" }),+countries: z.object({country: z.enum(COUNTRY_CODES)- .describe("The 2-letter country code: https://d.to/geo"),+ .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",+ ),sales: z.number().describe("The number of sales from this country"),amount: z.number()diff --git a/packages/utils/src/constants/continents.ts b/packages/utils/src/constants/continents.tsnew file mode 100644index 0000000000..5f447a6a21--- /dev/null+++ b/packages/utils/src/constants/continents.ts@@ -0,0 +1,11 @@+export const CONTINENTS: { [key: string]: string } = {+ AF: "Africa",+ AN: "Antarctica",+ AS: "Asia",+ EU: "Europe",+ NA: "North America",+ OC: "Oceania",+ SA: "South America",+};++export const CONTINENT_CODES = Object.keys(CONTINENTS) as [string, ...string[]];diff --git a/packages/utils/src/constants/countries.ts b/packages/utils/src/constants/countries.tsindex ecf76fb154..b9921ed091 100644--- a/packages/utils/src/constants/countries.ts+++ b/packages/utils/src/constants/countries.ts@@ -252,33 +252,3 @@ export const COUNTRIES: { [key: string]: string } = {};export const COUNTRY_CODES = Object.keys(COUNTRIES) as [string, ...string[]];--export const EU_COUNTRY_CODES = [- "AT",- "BE",- "BG",- "CY",- "CZ",- "DE",- "DK",- "EE",- "ES",- "FI",- "FR",- "GR",- "HR",- "HU",- "IE",- "IT",- "LT",- "LU",- "LV",- "MT",- "NL",- "PL",- "PT",- "RO",- "SE",- "SI",- "SK",-];diff --git a/packages/utils/src/constants/index.ts b/packages/utils/src/constants/index.tsindex 7c52a9daf3..1d28d1cf7a 100644--- a/packages/utils/src/constants/index.ts+++ b/packages/utils/src/constants/index.ts@@ -1,4 +1,5 @@export * from "./cctlds";+export * from "./continents";export * from "./countries";export * from "./domains";export * from "./dub-domains";