diff --git a/clients/apps/web/src/components/Accounts/AccountCreateModal.tsx b/clients/apps/web/src/components/Accounts/AccountCreateModal.tsx index 4393be7cc4..901be5ce90 100644 --- a/clients/apps/web/src/components/Accounts/AccountCreateModal.tsx +++ b/clients/apps/web/src/components/Accounts/AccountCreateModal.tsx @@ -178,7 +178,7 @@ const AccountCreateModal = ({ )}
- +

If this is a personal account, please select your country of residence. If this is an organization or business, select the diff --git a/clients/apps/web/src/utils/config.ts b/clients/apps/web/src/utils/config.ts index d4140161d4..b4945e47b9 100644 --- a/clients/apps/web/src/utils/config.ts +++ b/clients/apps/web/src/utils/config.ts @@ -15,7 +15,7 @@ const stringToNumber = ( * document.querySelectorAll('.PressableContext').forEach((d) => { if (d.checked && d.name !== '') { whitelist.push(d.name) } }) * whitelist.join(',') * - * All countries supported by Stripe except Gibraltar (transfers not supported) + * All countries supported by Stripe Connect Express except Gibraltar (transfers not supported) * */ const STRIPE_COUNTRIES = diff --git a/clients/packages/polarkit/src/components/ui/atoms/CountryPicker.tsx b/clients/packages/polarkit/src/components/ui/atoms/CountryPicker.tsx index b576605d9b..87869aecab 100644 --- a/clients/packages/polarkit/src/components/ui/atoms/CountryPicker.tsx +++ b/clients/packages/polarkit/src/components/ui/atoms/CountryPicker.tsx @@ -1,7 +1,7 @@ 'use client' import { CONFIG } from '@/utils/config' -import { getCountryData, getEmojiFlag, TCountryCode } from 'countries-list' +import { countries, getCountryData, getEmojiFlag, TCountryCode } from 'countries-list' import { Select, @@ -11,32 +11,53 @@ import { SelectValue, } from 'polarkit/components/ui/atoms/select' -const countryWhiteList = CONFIG.STRIPE_COUNTRIES_WHITELIST_CSV.split( - ',', -) as TCountryCode[] +const getCountryList = (codes: TCountryCode[]) => { + return codes.map((countryCode) => ({ + code: countryCode, + country: getCountryData(countryCode), + emoji: getEmojiFlag(countryCode), + })).sort((a, b) => a.country.name.localeCompare(b.country.name)) +} -const availableCountries = countryWhiteList.map((countryCode) => ({ - code: countryCode, - country: getCountryData(countryCode), - emoji: getEmojiFlag(countryCode), +const countryCodes = Object.keys(countries) as TCountryCode[] +const allCountries = getCountryList(countryCodes.filter((countryCode) => { + switch (countryCode.toUpperCase()) { + // US Trade Embargos (Stripe can check regions) + case 'CU': + case 'IR': + case 'KP': + case 'SY': + case 'RU': + return false + default: + return true + } })) +const stripeConnectWhitelist = CONFIG.STRIPE_COUNTRIES_WHITELIST_CSV.split( + ',', +) as TCountryCode[] +const stripeConnectCountries = getCountryList(stripeConnectWhitelist) + const CountryPicker = ({ value, onChange, autoComplete, + stripeConnectOnly = false, }: { value?: string onChange: (value: string) => void autoComplete?: string + stripeConnectOnly?: boolean }) => { + const countryMap = stripeConnectOnly ? stripeConnectCountries : allCountries return (