Session 13: The Slate, Africa geo-restriction, OAuth providers, PropRow + GameCard (1311 tests)
This commit is contained in:
+29
-4
@@ -31,17 +31,42 @@ export const LOCALE_META: Record<Locale, { label: string; native: string; dir: '
|
||||
zh: { label: 'Chinese', native: '中文', dir: 'ltr', region: 'China' },
|
||||
};
|
||||
|
||||
// Localess that map to predominantly-African markets — used by the
|
||||
// pricing page to surface the Africa tier first. Browser region
|
||||
// codes (NG/KE/ZA/GH/...) are checked separately at the component
|
||||
// layer.
|
||||
// Session 12: kept as a hint for the *interface language*. Session 13
|
||||
// replaces the locale-based pricing-tier proxy with real IP geo
|
||||
// (Cloudflare CF-IPCountry header → x-vyndr-country, see middleware).
|
||||
// Pricing.tsx now reads the country code, not this set.
|
||||
export const AFRICA_LOCALES: ReadonlySet<Locale> = new Set(['sw']);
|
||||
|
||||
// Session 13 — ISO-3166-1 alpha-2 codes for the African countries we
|
||||
// surface the VYNDR Africa tier in. The list intentionally covers
|
||||
// every sovereign African state (54). Membership IS the gate: outside
|
||||
// this set, the Africa tier card is filtered out of the pricing page
|
||||
// entirely. Inside this set, it renders first.
|
||||
export const AFRICAN_COUNTRIES: ReadonlySet<string> = new Set([
|
||||
// Sub-Saharan
|
||||
'NG', 'KE', 'ZA', 'GH', 'TZ', 'ET', 'CM', 'SN', 'CI', 'UG',
|
||||
'RW', 'MZ', 'AO', 'ZW', 'BW', 'NA', 'MU', 'ML', 'BF', 'NE',
|
||||
'TD', 'MW', 'ZM', 'MG', 'CD', 'CG', 'GA', 'GQ', 'BJ', 'TG',
|
||||
'SL', 'LR', 'GN', 'GM', 'CV', 'ST', 'KM', 'SC', 'DJ', 'ER',
|
||||
'LS', 'SZ', 'SO', 'SS', 'BI',
|
||||
// North Africa (MENA overlap)
|
||||
'EG', 'MA', 'DZ', 'TN', 'LY', 'SD', 'EH',
|
||||
]);
|
||||
|
||||
export function isLocale(value: string | null | undefined): value is Locale {
|
||||
return !!value && (LOCALES as readonly string[]).includes(value);
|
||||
}
|
||||
|
||||
export function isAfricanCountry(code: string | null | undefined): boolean {
|
||||
if (!code) return false;
|
||||
return AFRICAN_COUNTRIES.has(String(code).toUpperCase());
|
||||
}
|
||||
|
||||
// Cookie name + locale-detection header name (set by middleware,
|
||||
// read by server components via next/headers).
|
||||
export const LOCALE_COOKIE = 'NEXT_LOCALE';
|
||||
export const LOCALE_HEADER = 'x-vyndr-locale';
|
||||
// Country code — Cloudflare stamps this on every edge request as
|
||||
// CF-IPCountry; middleware copies it onto a vendor-namespaced header
|
||||
// so server components don't depend on knowing about Cloudflare.
|
||||
export const COUNTRY_HEADER = 'x-vyndr-country';
|
||||
|
||||
Reference in New Issue
Block a user