The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Add shared CountryFlag component and replace inline flag images (#3843)
Kiran K137604a64509
diff --git a/apps/web/app/(ee)/admin.dub.co/(dashboard)/payouts/paypal/page.tsx b/apps/web/app/(ee)/admin.dub.co/(dashboard)/payouts/paypal/page.tsxindex 67b4f38882..c4fde2a0ef 100644--- a/apps/web/app/(ee)/admin.dub.co/(dashboard)/payouts/paypal/page.tsx+++ b/apps/web/app/(ee)/admin.dub.co/(dashboard)/payouts/paypal/page.tsx@@ -3,6 +3,7 @@import type { PaypalPayoutResponse } from "@/lib/paypal/get-pending-payouts";import { PartnerAvatar } from "@/ui/partners/partner-avatar";import { PayoutStatusBadges } from "@/ui/partners/payout-status-badges";+import { CountryFlag } from "@/ui/shared/country-flag";import { FilterButtonTableRow } from "@/ui/shared/filter-button-table-row";import {Button,@@ -92,11 +93,7 @@ function PaypalPayoutsPageClient() {className="flex items-center gap-3"title={COUNTRIES[country] ?? country}>- <img- alt={country}- src={`https://hatscripts.github.io/circle-flags/flags/${country.toLowerCase()}.svg`}- className="size-4 shrink-0"- />+ <CountryFlag countryCode={country} /><span className="truncate text-sm text-neutral-900">{COUNTRIES[country] ?? country}</span>diff --git a/apps/web/app/(ee)/admin.dub.co/(dashboard)/payouts/stablecoin/page.tsx b/apps/web/app/(ee)/admin.dub.co/(dashboard)/payouts/stablecoin/page.tsxindex 12dd21e2f6..7c52d673cf 100644--- a/apps/web/app/(ee)/admin.dub.co/(dashboard)/payouts/stablecoin/page.tsx+++ b/apps/web/app/(ee)/admin.dub.co/(dashboard)/payouts/stablecoin/page.tsx@@ -2,6 +2,7 @@import { PartnerAvatar } from "@/ui/partners/partner-avatar";import { PayoutStatusBadges } from "@/ui/partners/payout-status-badges";+import { CountryFlag } from "@/ui/shared/country-flag";import { FilterButtonTableRow } from "@/ui/shared/filter-button-table-row";import {Button,@@ -166,11 +167,7 @@ function StablecoinPayoutsPageClient() {className="flex items-center gap-3"title={COUNTRIES[country] ?? country}>- <img- alt={country}- src={`https://hatscripts.github.io/circle-flags/flags/${country.toLowerCase()}.svg`}- className="size-4 shrink-0"- />+ <CountryFlag countryCode={country} /><span className="truncate text-sm text-neutral-900">{COUNTRIES[country] ?? country}</span>diff --git a/apps/web/app/(ee)/api/e2e/partners/pending-program-application/route.ts b/apps/web/app/(ee)/api/e2e/partners/pending-program-application/route.tsindex 0b0b1533de..7c2928c268 100644--- a/apps/web/app/(ee)/api/e2e/partners/pending-program-application/route.ts+++ b/apps/web/app/(ee)/api/e2e/partners/pending-program-application/route.ts@@ -92,8 +92,7 @@ export const POST = withWorkspace(programId,groupId,name: partner.name,- email:- partner.email ?? `${partner.id}@e2e.dub-internal-test.com`,+ email: partner.email ?? `${partner.id}@e2e.dub-internal-test.com`,country: partner.country ?? "US",formData: { fields: [] },},@@ -155,8 +154,7 @@ export const POST = withWorkspace(programId,groupId,name: partner.name,- email:- partner.email ?? `${partner.id}@e2e.dub-internal-test.com`,+ email: partner.email ?? `${partner.id}@e2e.dub-internal-test.com`,country: partner.country ?? "US",formData: { fields: [] },},diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/customers/(index)/page-client.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/customers/(index)/page-client.tsxindex 5eec060235..8492cb86d0 100644--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/customers/(index)/page-client.tsx+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/customers/(index)/page-client.tsx@@ -6,6 +6,7 @@ import usePartnerCustomersCount from "@/lib/swr/use-partner-customers-count";import useProgramEnrollment from "@/lib/swr/use-program-enrollment";import { CustomerRowItem } from "@/ui/customers/customer-row-item";import { AnimatedEmptyState } from "@/ui/shared/animated-empty-state";+import { CountryFlag } from "@/ui/shared/country-flag";import { SearchBoxPersisted } from "@/ui/shared/search-box";import {AnimatedSizeContainer,@@ -98,13 +99,7 @@ export function ProgramCustomersPageClient() {const country = row.original.country;return (<div className="flex items-center gap-2">- {country && (- <img- alt={`${country} flag`}- src={`https://hatscripts.github.io/circle-flags/flags/${country.toLowerCase()}.svg`}- className="size-4 shrink-0"- />- )}+ {country && <CountryFlag countryCode={country} />}<span className="min-w-0 truncate">{(country ? COUNTRIES[country] : null) ?? "-"}</span>diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/customers/(index)/use-partner-customer-filters.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/customers/(index)/use-partner-customer-filters.tsxindex 957cf3c8f9..e93794fdcd 100644--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/customers/(index)/use-partner-customer-filters.tsx+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/customers/(index)/use-partner-customer-filters.tsx@@ -1,4 +1,5 @@import usePartnerCustomersCount from "@/lib/swr/use-partner-customers-count";+import { CountryFlag } from "@/ui/shared/country-flag";import { useRouterStuff } from "@dub/ui";import { Globe, Hyperlink } from "@dub/ui/icons";import { COUNTRIES, linkConstructor, nFormatter } from "@dub/utils";@@ -45,13 +46,7 @@ export function usePartnerCustomerFilters() {countriesCount?.map(({ country, _count }) => ({value: country,label: COUNTRIES[country] || country,- icon: (- <img- alt={`${country} flag`}- src={`https://hatscripts.github.io/circle-flags/flags/${country.toLowerCase()}.svg`}- className="size-4"- />- ),+ icon: <CountryFlag countryCode={country} />,right: nFormatter(_count, { full: true }),})) ?? null,},diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/earnings/earnings-table.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/earnings/earnings-table.tsxindex 8d769f4547..441b35c5c2 100644--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/earnings/earnings-table.tsx+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/earnings/earnings-table.tsx@@ -8,6 +8,7 @@ import { CustomerRowItem } from "@/ui/customers/customer-row-item";import { CommissionStatusBadges } from "@/ui/partners/commission-status-badges";import { CommissionTypeBadge } from "@/ui/partners/commission-type-badge";import { AnimatedEmptyState } from "@/ui/shared/animated-empty-state";+import { CountryFlag } from "@/ui/shared/country-flag";import { FilterButtonTableRow } from "@/ui/shared/filter-button-table-row";import {CopyText,@@ -180,11 +181,7 @@ export function EarningsTablePartner({ limit }: { limit?: number }) {title={COUNTRIES[getValue()] ?? getValue()}>{getValue() ? (- <img- alt={getValue()}- src={`https://hatscripts.github.io/circle-flags/flags/${getValue().toLowerCase()}.svg`}- className="size-4 shrink-0"- />+ <CountryFlag countryCode={getValue()} />) : (<Globe className="size-4 shrink-0" />)}diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/analytics/analytics-partners-table.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/analytics/analytics-partners-table.tsxindex 16874164ad..5b5c992e41 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/analytics/analytics-partners-table.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/analytics/analytics-partners-table.tsx@@ -3,6 +3,7 @@import { AnalyticsResponse } from "@/lib/analytics/types";import { editQueryString } from "@/lib/analytics/utils";import { AnalyticsContext } from "@/ui/analytics/analytics-provider";+import { CountryFlag } from "@/ui/shared/country-flag";import {Button,Table,@@ -132,13 +133,7 @@ export function AnalyticsPartnersTable() {const country = row.original.partner.country;return (<div className="flex items-center gap-2">- {country && (- <img- alt={`${country} flag`}- src={`https://hatscripts.github.io/circle-flags/flags/${country.toLowerCase()}.svg`}- className="size-4 shrink-0"- />- )}+ {country && <CountryFlag countryCode={country} />}<span className="min-w-0 truncate">{(country ? COUNTRIES[country] : null) ?? "-"}</span>diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/analytics/commissions-analytics-cards.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/analytics/commissions-analytics-cards.tsxindex c2058c88e8..80998ceb72 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/analytics/commissions-analytics-cards.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/analytics/commissions-analytics-cards.tsx@@ -9,7 +9,11 @@ import { BarList } from "@/ui/analytics/bar-list";import { CommissionTypeIcon } from "@/ui/partners/comission-type-icon";import { GroupColorCircle } from "@/ui/partners/groups/group-color-circle";import { Modal, useRouterStuff } from "@dub/ui";-import { CircleCheck, CircleDotted, CircleHalfDottedClock } from "@dub/ui/icons";+import {+ CircleCheck,+ CircleDotted,+ CircleHalfDottedClock,+} from "@dub/ui/icons";import { cn } from "@dub/utils";import { ReactNode, useCallback, useMemo, useState } from "react";import { CommissionStatusFilter } from "./commissions-status-selector";diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/analytics/commissions-partners-table.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/analytics/commissions-partners-table.tsxindex 1ce554ab3f..b5ec6829c4 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/analytics/commissions-partners-table.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/analytics/commissions-partners-table.tsx@@ -3,6 +3,7 @@import useCommissionAnalytics, {CommissionAnalyticsPartnerRow,} from "@/lib/swr/use-commission-analytics";+import { CountryFlag } from "@/ui/shared/country-flag";import {Button,Table,@@ -128,11 +129,7 @@ export function CommissionsPartnersTable({if (!country) return <span className="text-neutral-400">—</span>;return (<div className="flex items-center gap-2">- <img- alt={`${country} flag`}- src={`https://hatscripts.github.io/circle-flags/flags/${country.toLowerCase()}.svg`}- className="size-4 shrink-0"- />+ <CountryFlag countryCode={country} /><span className="min-w-0 truncate text-sm text-neutral-700">{COUNTRIES[country] ?? country}</span>diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/analytics/program-analytics-shell.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/analytics/program-analytics-shell.tsxindex ea104373dc..4a6b284d0e 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/analytics/program-analytics-shell.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/analytics/program-analytics-shell.tsx@@ -13,7 +13,13 @@ import { ReferrersUTMs } from "@/ui/analytics/referrers-utms";import { useAnalyticsFilters } from "@/ui/analytics/use-analytics-filters";import { useAnalyticsQuery } from "@/ui/analytics/use-analytics-query";import SimpleDateRangePicker from "@/ui/shared/simple-date-range-picker";-import { Button, Filter, SquareLayoutGrid6, useMediaQuery, useRouterStuff } from "@dub/ui";+import {+ Button,+ Filter,+ SquareLayoutGrid6,+ useMediaQuery,+ useRouterStuff,+} from "@dub/ui";import { cn, fetcher } from "@dub/utils";import Link from "next/link";import { useParams } from "next/navigation";@@ -39,10 +45,8 @@ export function ProgramAnalyticsShell({ children }: { children: ReactNode }) {? (tab as ProgramAnalyticsTabId): "performance";- const {- queryString: commissionsQueryString,- status: commissionStatus,- } = useCommissionsAnalyticsQuery();+ const { queryString: commissionsQueryString, status: commissionStatus } =+ useCommissionsAnalyticsQuery();const { start, end, interval, selectedTab, saleUnit, view } = useMemo(() => {const { event, ...rest } = searchParamsObj;diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/network/network-upsell.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/network/network-upsell.tsxindex 618ef21c48..853d0ef5d3 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/network/network-upsell.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/network/network-upsell.tsx@@ -1,6 +1,7 @@"use client";import { PageContent } from "@/ui/layout/page-content";+import { CountryFlag } from "@/ui/shared/country-flag";import { buttonVariants } from "@dub/ui";import { cn, COUNTRIES } from "@dub/utils";import Link from "next/link";@@ -90,9 +91,8 @@ function ExamplePartnerCell({{partner.name}</span><div className="flex items-center gap-1">- <img- alt={`${partner.country} flag`}- src={`https://hatscripts.github.io/circle-flags/flags/${partner.country.toLowerCase()}.svg`}+ <CountryFlag+ countryCode={partner.country}className="size-2.5 rounded-full"/><span className="text-content-subtle whitespace-nowrap text-xs font-medium">diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/network/use-partner-network-filters.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/network/use-partner-network-filters.tsxindex e3cd900d17..7c961cf0e6 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/network/use-partner-network-filters.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/network/use-partner-network-filters.tsx@@ -1,4 +1,5 @@import useNetworkPartnersCount from "@/lib/swr/use-network-partners-count";+import { CountryFlag } from "@/ui/shared/country-flag";import { PlatformType } from "@dub/prisma/client";import { useRouterStuff } from "@dub/ui";import {@@ -96,11 +97,7 @@ export function usePartnerNetworkFilters({icon: FlagWavy,label: "Partner country",getOptionIcon: (value) => (- <img- alt={value}- src={`https://hatscripts.github.io/circle-flags/flags/${value.toLowerCase()}.svg`}- className="size-3.5 rounded-full"- />+ <CountryFlag countryCode={value} className="size-3.5 rounded-full" />),getOptionLabel: (value) => COUNTRIES[value],options:diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/overview-chart.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/overview-chart.tsxindex 0f46146aa5..0c642fc55b 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/overview-chart.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/overview-chart.tsx@@ -58,14 +58,15 @@ export function OverviewChart() {fetcher,);- const { data: commissions, error: commissionsError } =- useCommissionAnalytics({+ const { data: commissions, error: commissionsError } = useCommissionAnalytics(+ {groupBy: "timeseries",interval: interval as IntervalOptions | undefined,start: start ? new Date(start) : undefined,end: end ? new Date(end) : undefined,enabled: viewType === "commissions",- });+ },+ );const data = useMemo(() => {const sourceData = viewType === "commissions" ? commissions : analyticsData;diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners-graphic.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners-graphic.tsxindex 93bc24d42c..c6de506ff7 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners-graphic.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners-graphic.tsx@@ -1,3 +1,4 @@+import { CountryFlag } from "@/ui/shared/country-flag";import { capitalize, cn, nFormatter } from "@dub/utils";export function PartnersGraphic() {@@ -66,9 +67,8 @@ function ExamplePartnerCell({/><div className="flex h-full flex-col justify-between px-4 py-3"><div className="flex items-center gap-1.5">- <img- alt={`${partner.country} flag`}- src={`https://hatscripts.github.io/circle-flags/flags/${partner.country.toLowerCase()}.svg`}+ <CountryFlag+ countryCode={partner.country}className="size-3.5 rounded-full"/><span className="whitespace-nowrap text-sm font-medium text-neutral-800">diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners-upgrade-cta.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners-upgrade-cta.tsxindex 5423eca044..5d1eaad934 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners-upgrade-cta.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners-upgrade-cta.tsx@@ -2,6 +2,7 @@import { getPlanCapabilities } from "@/lib/plan-capabilities";import useWorkspace from "@/lib/swr/use-workspace";+import { CountryFlag } from "@/ui/shared/country-flag";import { buttonVariants } from "@dub/ui";import { capitalize, cn, isLegacyBusinessPlan, nFormatter } from "@dub/utils";import Link from "next/link";@@ -127,9 +128,8 @@ function ExamplePartnerCell({/><div className="flex h-full flex-col justify-between px-4 py-3"><div className="flex items-center gap-1.5">- <img- alt={`${partner.country} flag`}- src={`https://hatscripts.github.io/circle-flags/flags/${partner.country.toLowerCase()}.svg`}+ <CountryFlag+ countryCode={partner.country}className="size-3.5 rounded-full"/><span className="whitespace-nowrap text-sm font-medium text-neutral-800">diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/[partnerId]/customers/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/[partnerId]/customers/page.tsxindex 42dfbf98be..44b41802b6 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/[partnerId]/customers/page.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/[partnerId]/customers/page.tsx@@ -5,6 +5,7 @@ import usePartner from "@/lib/swr/use-partner";import useWorkspace from "@/lib/swr/use-workspace";import { EnrolledPartnerProps } from "@/lib/types";import { CustomerRowItem } from "@/ui/customers/customer-row-item";+import { CountryFlag } from "@/ui/shared/country-flag";import {LoadingSpinner,Table,@@ -67,13 +68,7 @@ function PartnerCustomers({ partner }: { partner: EnrolledPartnerProps }) {const country = row.original.country;return (<div className="flex items-center gap-2">- {country && (- <img- alt={`${country} flag`}- src={`https://hatscripts.github.io/circle-flags/flags/${country.toLowerCase()}.svg`}- className="size-4 shrink-0"- />- )}+ {country && <CountryFlag countryCode={country} />}<span className="min-w-0 truncate">{(country ? COUNTRIES[country] : null) ?? "-"}</span>diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/applications/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/applications/page-client.tsxindex ed51b35c2d..283191adba 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/applications/page-client.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/applications/page-client.tsx@@ -16,6 +16,7 @@ import { PartnerApplicationSheet } from "@/ui/partners/partner-application-sheetimport { PartnerRowItem } from "@/ui/partners/partner-row-item";import { PartnerSocialColumn } from "@/ui/partners/partner-social-column";import { AnimatedEmptyState } from "@/ui/shared/animated-empty-state";+import { CountryFlag } from "@/ui/shared/country-flag";import { SearchBoxPersisted } from "@/ui/shared/search-box";import { PlatformType } from "@dub/prisma/client";import {@@ -222,13 +223,7 @@ export function ProgramPartnersApplicationsPageClient() {const country = row.original.country;return (<div className="flex items-center gap-2">- {country && (- <img- alt={`${country} flag`}- src={`https://hatscripts.github.io/circle-flags/flags/${country.toLowerCase()}.svg`}- className="size-4 shrink-0"- />- )}+ {country && <CountryFlag countryCode={country} />}<span className="min-w-0 truncate">{(country ? COUNTRIES[country] : null) ?? "-"}</span>diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/applications/rejected/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/applications/rejected/page-client.tsxindex 6efbe7c1a0..120689d257 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/applications/rejected/page-client.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/applications/rejected/page-client.tsx@@ -14,6 +14,7 @@ import { PartnerApplicationSheet } from "@/ui/partners/partner-application-sheetimport { PartnerRowItem } from "@/ui/partners/partner-row-item";import { PartnerSocialColumn } from "@/ui/partners/partner-social-column";import { AnimatedEmptyState } from "@/ui/shared/animated-empty-state";+import { CountryFlag } from "@/ui/shared/country-flag";import { SearchBoxPersisted } from "@/ui/shared/search-box";import { PlatformType } from "@dub/prisma/client";import {@@ -200,13 +201,7 @@ export function ProgramPartnersRejectedApplicationsPageClient() {const country = row.original.country;return (<div className="flex items-center gap-2">- {country && (- <img- alt={`${country} flag`}- src={`https://hatscripts.github.io/circle-flags/flags/${country.toLowerCase()}.svg`}- className="size-4 shrink-0"- />- )}+ {country && <CountryFlag countryCode={country} />}<span className="min-w-0 truncate">{(country ? COUNTRIES[country] : null) ?? "-"}</span>diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/partners-table.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/partners-table.tsxindex de37ee8b38..2db17218d7 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/partners-table.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/partners-table.tsx@@ -22,6 +22,7 @@ import { GroupColorCircle } from "@/ui/partners/groups/group-color-circle";import { PartnerRowItem } from "@/ui/partners/partner-row-item";import { PartnerStatusBadges } from "@/ui/partners/partner-status-badges";import { AnimatedEmptyState } from "@/ui/shared/animated-empty-state";+import { CountryFlag } from "@/ui/shared/country-flag";import { ThreeDots } from "@/ui/shared/icons";import { SearchBoxPersisted } from "@/ui/shared/search-box";import { ProgramEnrollmentStatus } from "@dub/prisma/client";@@ -313,13 +314,7 @@ export function PartnersTable() {const country = row.original.country;return (<div className="flex items-center gap-2 whitespace-nowrap">- {country && (- <img- alt={`${country} flag`}- src={`https://hatscripts.github.io/circle-flags/flags/${country.toLowerCase()}.svg`}- className="size-4 shrink-0"- />- )}+ {country && <CountryFlag countryCode={country} />}<span className="whitespace-nowrap">{(country ? COUNTRIES[country] : null) ?? "-"}</span>diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/use-partner-filters.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/use-partner-filters.tsxindex 8bcde47d58..0d946d3ba0 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/use-partner-filters.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/use-partner-filters.tsx@@ -3,6 +3,7 @@ import usePartnersCount from "@/lib/swr/use-partners-count";import useWorkspace from "@/lib/swr/use-workspace";import { GroupColorCircle } from "@/ui/partners/groups/group-color-circle";import { PartnerStatusBadges } from "@/ui/partners/partner-status-badges";+import { CountryFlag } from "@/ui/shared/country-flag";import { ProgramEnrollmentStatus } from "@dub/prisma/client";import { encodeRangeToken, parseRangeToken, useRouterStuff } from "@dub/ui";import {@@ -224,11 +225,7 @@ export function usePartnerFilters(enabledFilters.includes(m.filterKey),),getOptionIcon: (value: string) => (- <img- alt={value}- src={`https://hatscripts.github.io/circle-flags/flags/${value.toLowerCase()}.svg`}- className="size-4 shrink-0"- />+ <CountryFlag countryCode={value} />),getOptionLabel: (value: string) => COUNTRIES[value],options:diff --git a/apps/web/app/app.dub.co/(onboarding)/[slug]/wrapped/[year]/client.tsx b/apps/web/app/app.dub.co/(onboarding)/[slug]/wrapped/[year]/client.tsxindex c07d6c3eb7..7367b56212 100644--- a/apps/web/app/app.dub.co/(onboarding)/[slug]/wrapped/[year]/client.tsx+++ b/apps/web/app/app.dub.co/(onboarding)/[slug]/wrapped/[year]/client.tsx@@ -1,6 +1,7 @@"use client";import useWorkspace from "@/lib/swr/use-workspace";+import { CountryFlag } from "@/ui/shared/country-flag";import { BlurImage, ExpandingArrow, STAGGER_CHILD_VARIANTS } from "@dub/ui";import { cn, OG_AVATAR_URL, smartTruncate } from "@dub/utils";import { COUNTRIES } from "@dub/utils/src/constants/countries";@@ -200,11 +201,7 @@ const StatTable = ({) : (<div className="flex items-center gap-2">{title === "Top Countries" && (- <img- src={`https://hatscripts.github.io/circle-flags/flags/${item.toLowerCase()}.svg`}- alt={COUNTRIES[item]}- className="size-4"- />+ <CountryFlag countryCode={item} />)}<div className="flex gap-0.5"><p className="font-medium text-black">diff --git a/apps/web/tests/partners/applications/approve-reject-partner-application.test.ts b/apps/web/tests/partners/applications/approve-reject-partner-application.test.tsindex 8beebe000c..69cc1ca075 100644--- a/apps/web/tests/partners/applications/approve-reject-partner-application.test.ts+++ b/apps/web/tests/partners/applications/approve-reject-partner-application.test.ts@@ -5,87 +5,90 @@ import { randomPartnerEmail } from "../../utils/helpers";import { IntegrationHarness } from "../../utils/integration";import { E2E_PARTNER_GROUP } from "../../utils/resource";-describe.sequential("POST /partners/applications/reject and /approve", async () => {- const h = new IntegrationHarness();- const { http } = await h.init();+describe.sequential(+ "POST /partners/applications/reject and /approve",+ async () => {+ const h = new IntegrationHarness();+ const { http } = await h.init();- test("reject then approve the same partner after E2E pending reset", async () => {- const partner = {- name: generateRandomName(),- email: randomPartnerEmail(),- groupId: E2E_PARTNER_GROUP.id,- country: "US" as const,- };+ test("reject then approve the same partner after E2E pending reset", async () => {+ const partner = {+ name: generateRandomName(),+ email: randomPartnerEmail(),+ groupId: E2E_PARTNER_GROUP.id,+ country: "US" as const,+ };- const { data: created, status: createStatus } = await http.post<Partner>({- path: "/partners",- body: partner,- });+ const { data: created, status: createStatus } = await http.post<Partner>({+ path: "/partners",+ body: partner,+ });- expect(createStatus).toEqual(201);- const partnerId = created.id;+ expect(createStatus).toEqual(201);+ const partnerId = created.id;- const { status: seedStatus } = await http.post<{- partnerId: string;- programApplicationId: string;- reset: boolean;- }>({- path: "/e2e/partners/pending-program-application",- body: { partnerId, groupId: E2E_PARTNER_GROUP.id },- });- expect(seedStatus).toEqual(200);+ const { status: seedStatus } = await http.post<{+ partnerId: string;+ programApplicationId: string;+ reset: boolean;+ }>({+ path: "/e2e/partners/pending-program-application",+ body: { partnerId, groupId: E2E_PARTNER_GROUP.id },+ });+ expect(seedStatus).toEqual(200);- const { data: rejectData, status: rejectStatus } = await http.post<{- partnerId: string;- }>({- path: "/partners/applications/reject",- body: {- partnerId,- rejectionReason: "other",- rejectionNote: "e2e: first rejection",- allowImmediateReapply: false,- },- });- expect(rejectStatus).toEqual(200);- expect(rejectData.partnerId).toBe(partnerId);+ const { data: rejectData, status: rejectStatus } = await http.post<{+ partnerId: string;+ }>({+ path: "/partners/applications/reject",+ body: {+ partnerId,+ rejectionReason: "other",+ rejectionNote: "e2e: first rejection",+ allowImmediateReapply: false,+ },+ });+ expect(rejectStatus).toEqual(200);+ expect(rejectData.partnerId).toBe(partnerId);- const { status: duplicateRejectStatus } = await http.post({- path: "/partners/applications/reject",- body: {- partnerId,- rejectionReason: "other",- rejectionNote: "e2e: should fail",- allowImmediateReapply: false,- },- });- expect(duplicateRejectStatus).toEqual(400);+ const { status: duplicateRejectStatus } = await http.post({+ path: "/partners/applications/reject",+ body: {+ partnerId,+ rejectionReason: "other",+ rejectionNote: "e2e: should fail",+ allowImmediateReapply: false,+ },+ });+ expect(duplicateRejectStatus).toEqual(400);- const { status: resetStatus } = await http.post({- path: "/e2e/partners/pending-program-application",- body: { partnerId, groupId: E2E_PARTNER_GROUP.id },- });- expect(resetStatus).toEqual(200);+ const { status: resetStatus } = await http.post({+ path: "/e2e/partners/pending-program-application",+ body: { partnerId, groupId: E2E_PARTNER_GROUP.id },+ });+ expect(resetStatus).toEqual(200);- const { data: approveData, status: approveStatus } = await http.post<{- partnerId: string;- }>({- path: "/partners/applications/approve",- body: {- partnerId,- groupId: E2E_PARTNER_GROUP.id,- },- });- expect(approveStatus).toEqual(200);- expect(approveData.partnerId).toBe(partnerId);+ const { data: approveData, status: approveStatus } = await http.post<{+ partnerId: string;+ }>({+ path: "/partners/applications/approve",+ body: {+ partnerId,+ groupId: E2E_PARTNER_GROUP.id,+ },+ });+ expect(approveStatus).toEqual(200);+ expect(approveData.partnerId).toBe(partnerId);- const { data: enrolled, status: getStatus } = await http.get<{- id: string;- status: string;- }>({- path: `/partners/${partnerId}`,+ const { data: enrolled, status: getStatus } = await http.get<{+ id: string;+ status: string;+ }>({+ path: `/partners/${partnerId}`,+ });+ expect(getStatus).toEqual(200);+ expect(enrolled.id).toBe(partnerId);+ expect(enrolled.status).toBe("approved");});- expect(getStatus).toEqual(200);- expect(enrolled.id).toBe(partnerId);- expect(enrolled.status).toBe("approved");- });-});+ },+);diff --git a/apps/web/ui/analytics/events/events-table.tsx b/apps/web/ui/analytics/events/events-table.tsxindex 22dcfa8fa2..35125e7c1a 100644--- a/apps/web/ui/analytics/events/events-table.tsx+++ b/apps/web/ui/analytics/events/events-table.tsx@@ -5,6 +5,7 @@ import useWorkspace from "@/lib/swr/use-workspace";import { useWorkspacePreferences } from "@/lib/swr/use-workspace-preferences";import { ClickEvent, LeadEvent, SaleEvent } from "@/lib/types";import { CustomerRowItem } from "@/ui/customers/customer-row-item";+import { CountryFlag } from "@/ui/shared/country-flag";import EmptyState from "@/ui/shared/empty-state";import { FilterButtonTableRow } from "@/ui/shared/filter-button-table-row";import {@@ -457,11 +458,7 @@ export default function EventsTable({{getValue() === "Unknown" ? (<Globe className="size-4 shrink-0" />) : (- <img- alt={getValue()}- src={`https://hatscripts.github.io/circle-flags/flags/${getValue().toLowerCase()}.svg`}- className="size-4 shrink-0"- />+ <CountryFlag countryCode={getValue()} />)}<span className="truncate">{COUNTRIES[getValue()] ?? getValue()}@@ -484,11 +481,7 @@ export default function EventsTable({{!country || country === "Unknown" ? (<Globe className="size-4 shrink-0" />) : (- <img- alt={country}- src={`https://hatscripts.github.io/circle-flags/flags/${country.toLowerCase()}.svg`}- className="size-4 shrink-0"- />+ <CountryFlag countryCode={country} />)}<span className="truncate">{getValue()}</span></div>@@ -510,11 +503,7 @@ export default function EventsTable({{!country || country === "Unknown" ? (<Globe className="size-4 shrink-0" />) : (- <img- alt={country}- src={`https://hatscripts.github.io/circle-flags/flags/${country.toLowerCase()}.svg`}- className="size-4 shrink-0"- />+ <CountryFlag countryCode={country} />)}<span className="truncate">{REGIONS[getValue()] || getValue().split("-")[1]}diff --git a/apps/web/ui/analytics/location-section.tsx b/apps/web/ui/analytics/location-section.tsxindex a8f5303362..b5f146216e 100644--- a/apps/web/ui/analytics/location-section.tsx+++ b/apps/web/ui/analytics/location-section.tsx@@ -1,4 +1,5 @@import { SINGULAR_ANALYTICS_ENDPOINTS } from "@/lib/analytics/constants";+import { CountryFlag } from "@/ui/shared/country-flag";import { useRouterStuff } from "@dub/ui";import {FlagWavy,@@ -99,11 +100,7 @@ export function LocationSection() {className="size-4 rounded-full border border-cyan-500"/>) : (- <img- alt={d.country}- src={`https://hatscripts.github.io/circle-flags/flags/${d.country.toLowerCase()}.svg`}- className="size-4 shrink-0"- />+ <CountryFlag countryCode={d.country} />),title:tab === "continents"@@ -130,11 +127,7 @@ export function LocationSection() {className="size-4 rounded-full border border-cyan-500"/>) : (- <img- alt={d.country}- src={`https://hatscripts.github.io/circle-flags/flags/${d.country.toLowerCase()}.svg`}- className="size-4 shrink-0"- />+ <CountryFlag countryCode={d.country} />),title:tab === "continents"diff --git a/apps/web/ui/analytics/use-analytics-filters.tsx b/apps/web/ui/analytics/use-analytics-filters.tsxindex ffb92aef44..01fb1d6aae 100644--- a/apps/web/ui/analytics/use-analytics-filters.tsx+++ b/apps/web/ui/analytics/use-analytics-filters.tsx@@ -5,6 +5,7 @@ import usePartner from "@/lib/swr/use-partner";import usePartnerCustomer from "@/lib/swr/use-partner-customer";import { CustomerAvatar } from "@/ui/customers/customer-avatar";import { PartnerAvatar } from "@/ui/partners/partner-avatar";+import { CountryFlag } from "@/ui/shared/country-flag";import { readStreamableValue } from "@ai-sdk/rsc";import {BlurImage,@@ -553,13 +554,7 @@ export function useAnalyticsFilters({getOptionIcon: (value) => {if (typeof value !== "string") return null;- return (- <img- alt={value}- src={`https://hatscripts.github.io/circle-flags/flags/${value.toLowerCase()}.svg`}- className="size-4 shrink-0"- />- );+ return <CountryFlag countryCode={value} />;},options:countries?.map(({ country, ...rest }) => ({@@ -577,13 +572,7 @@ export function useAnalyticsFilters({cities?.map(({ city, country, ...rest }) => ({value: city,label: city,- icon: (- <img- alt={country}- src={`https://hatscripts.github.io/circle-flags/flags/${country.toLowerCase()}.svg`}- className="size-4 shrink-0"- />- ),+ icon: <CountryFlag countryCode={country} />,right: getFilterOptionTotal(rest),})) ?? null,},@@ -595,13 +584,7 @@ export function useAnalyticsFilters({regions?.map(({ region, country, ...rest }) => ({value: region,label: REGIONS[region] || region.split("-")[1],- icon: (- <img- alt={country}- src={`https://hatscripts.github.io/circle-flags/flags/${country.toLowerCase()}.svg`}- className="size-4 shrink-0"- />- ),+ icon: <CountryFlag countryCode={country} />,right: getFilterOptionTotal(rest),})) ?? null,},diff --git a/apps/web/ui/customers/customers-table/customers-table.tsx b/apps/web/ui/customers/customers-table/customers-table.tsxindex b91c5613f2..25a4a6183e 100644--- a/apps/web/ui/customers/customers-table/customers-table.tsx+++ b/apps/web/ui/customers/customers-table/customers-table.tsx@@ -8,6 +8,7 @@ import { getCustomersQuerySchema } from "@/lib/zod/schemas/customers";import { CustomerRowItem } from "@/ui/customers/customer-row-item";import { PartnerRowItem } from "@/ui/partners/partner-row-item";import { AnimatedEmptyState } from "@/ui/shared/animated-empty-state";+import { CountryFlag } from "@/ui/shared/country-flag";import { FilterButtonTableRow } from "@/ui/shared/filter-button-table-row";import { SearchBoxPersisted } from "@/ui/shared/search-box";import {@@ -162,13 +163,7 @@ export function CustomersTable({const country = row.original.country;return (<div className="flex items-center gap-2">- {country && (- <img- alt={`${country} flag`}- src={`https://hatscripts.github.io/circle-flags/flags/${country.toLowerCase()}.svg`}- className="size-4 shrink-0"- />- )}+ {country && <CountryFlag countryCode={country} />}<span className="min-w-0 truncate">{(country ? COUNTRIES[country] : null) ?? "-"}</span>diff --git a/apps/web/ui/customers/customers-table/use-customer-filters.tsx b/apps/web/ui/customers/customers-table/use-customer-filters.tsxindex e6d374cb2c..8dca4ad36c 100644--- a/apps/web/ui/customers/customers-table/use-customer-filters.tsx+++ b/apps/web/ui/customers/customers-table/use-customer-filters.tsx@@ -2,6 +2,7 @@ import useCustomersCount from "@/lib/swr/use-customers-count";import usePartners from "@/lib/swr/use-partners";import useWorkspace from "@/lib/swr/use-workspace";import { EnrolledPartnerProps } from "@/lib/types";+import { CountryFlag } from "@/ui/shared/country-flag";import { LinkLogo, useRouterStuff } from "@dub/ui";import { FlagWavy, Hyperlink, SquareUserSparkle2, Users } from "@dub/ui/icons";import {@@ -74,13 +75,7 @@ export function useCustomerFilters(key: "country",icon: FlagWavy,label: "Country",- getOptionIcon: (value) => (- <img- alt={value}- src={`https://hatscripts.github.io/circle-flags/flags/${value.toLowerCase()}.svg`}- className="size-4 shrink-0"- />- ),+ getOptionIcon: (value) => <CountryFlag countryCode={value} />,getOptionLabel: (value) => COUNTRIES[value],options:countriesCountdiff --git a/apps/web/ui/partners/country-combobox.tsx b/apps/web/ui/partners/country-combobox.tsxindex 5548e299b2..f23e69d089 100644--- a/apps/web/ui/partners/country-combobox.tsx+++ b/apps/web/ui/partners/country-combobox.tsx@@ -1,3 +1,4 @@+import { CountryFlag } from "@/ui/shared/country-flag";import { Combobox } from "@dub/ui";import { cn, COUNTRIES } from "@dub/utils";import { ReactNode, useMemo } from "react";@@ -25,13 +26,7 @@ export function CountryCombobox({// show United States first.sort((a, b) => (a[0] === "US" ? -1 : b[0] === "US" ? 1 : 0)).map(([key, value]) => ({- icon: (- <img- alt={value}- src={`https://hatscripts.github.io/circle-flags/flags/${key.toLowerCase()}.svg`}- className="mr-1.5 size-4"- />- ),+ icon: <CountryFlag countryCode={key} className="mr-1.5" />,value: key,label: value,})),@@ -48,11 +43,7 @@ export function CountryCombobox({options={options}icon={value ? (- <img- alt={COUNTRIES[value]}- src={`https://hatscripts.github.io/circle-flags/flags/${value.toLowerCase()}.svg`}- className="mr-0.5 size-4"- />+ <CountryFlag countryCode={value} className="mr-0.5" />) : undefined}caret={true}diff --git a/apps/web/ui/partners/eligibility-requirements.tsx b/apps/web/ui/partners/eligibility-requirements.tsxindex 56db249562..d590019c84 100644--- a/apps/web/ui/partners/eligibility-requirements.tsx+++ b/apps/web/ui/partners/eligibility-requirements.tsx@@ -1,6 +1,7 @@"use client";import { EligibilityConditionDB } from "@/lib/types";+import { CountryFlag } from "@/ui/shared/country-flag";import {InlineBadgePopover,InlineBadgePopoverMenu,@@ -53,13 +54,7 @@ export function generateId(): string {const COUNTRY_ITEMS = Object.entries(COUNTRIES).map(([code, name]) => ({text: name,value: code,- icon: (- <img- alt={`${code} flag`}- src={`https://hatscripts.github.io/circle-flags/flags/${code.toLowerCase()}.svg`}- className="size-3 shrink-0"- />- ),+ icon: <CountryFlag countryCode={code} className="size-3" />,}));function CountryValueInput({diff --git a/apps/web/ui/partners/overview/blocks/countries-block.tsx b/apps/web/ui/partners/overview/blocks/countries-block.tsxindex a6049a8012..568a47536d 100644--- a/apps/web/ui/partners/overview/blocks/countries-block.tsx+++ b/apps/web/ui/partners/overview/blocks/countries-block.tsx@@ -2,6 +2,7 @@ import { editQueryString } from "@/lib/analytics/utils";import useProgram from "@/lib/swr/use-program";import useWorkspace from "@/lib/swr/use-workspace";import { AnalyticsContext } from "@/ui/analytics/analytics-provider";+import { CountryFlag } from "@/ui/shared/country-flag";import { ArrowRight, Link4, LoadingSpinner, useRouterStuff } from "@dub/ui";import { COUNTRIES, currencyFormatter, fetcher, nFormatter } from "@dub/utils";import Link from "next/link";@@ -74,11 +75,7 @@ export function CountriesBlock() {{country === "(direct)" ? (<Link4 className="size-4" />) : (- <img- src={`https://hatscripts.github.io/circle-flags/flags/${country.toLowerCase()}.svg`}- alt={`${country} flag`}- className="size-4 shrink-0"- />+ <CountryFlag countryCode={country} />)}<span className="min-w-0 truncate">{COUNTRIES?.[country] ?? country}diff --git a/apps/web/ui/partners/rewards/rewards-logic.tsx b/apps/web/ui/partners/rewards/rewards-logic.tsxindex ee1aefd822..6d4c04a187 100644--- a/apps/web/ui/partners/rewards/rewards-logic.tsx+++ b/apps/web/ui/partners/rewards/rewards-logic.tsx@@ -16,6 +16,7 @@ import {RewardConditionEntityAttribute,STRING_CONDITION_OPERATORS,} from "@/lib/zod/schemas/rewards";+import { CountryFlag } from "@/ui/shared/country-flag";import { X } from "@/ui/shared/icons";import { RewardStructure } from "@dub/prisma/client";import {@@ -545,10 +546,9 @@ function ConditionLogic({text: name,value: key,icon: (- <img- alt={`${key} flag`}- src={`https://hatscripts.github.io/circle-flags/flags/${key.toLowerCase()}.svg`}- className="size-3 shrink-0"+ <CountryFlag+ countryCode={key}+ className="size-3"/>),}),diff --git a/apps/web/ui/shared/country-flag.tsx b/apps/web/ui/shared/country-flag.tsxnew file mode 100644index 0000000000..b53d4992b3--- /dev/null+++ b/apps/web/ui/shared/country-flag.tsx@@ -0,0 +1,17 @@+import { cn } from "@dub/utils";++export function CountryFlag({+ countryCode,+ className,+}: {+ countryCode: string;+ className?: string;+}) {+ return (+ <img+ alt={`${countryCode} flag`}+ src={`https://hatscripts.github.io/circle-flags/flags/${countryCode.toLowerCase()}.svg`}+ className={cn("size-4 shrink-0", className)}+ />+ );+}