Skip to content

Commit

Permalink
Merge pull request midday-ai#200 from midday-ai/feature/eu-continent-…
Browse files Browse the repository at this point in the history
…header

Use header
  • Loading branch information
pontusab authored Jul 28, 2024
2 parents 70ed0b7 + 63425b2 commit f17e2bf
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 76 deletions.
2 changes: 1 addition & 1 deletion apps/dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"ai": "^3.2.37",
"change-case": "^5.4.4",
"dub": "^0.34.2",
"framer-motion": "^11.3.18",
"framer-motion": "^11.3.19",
"geist": "^1.3.1",
"headless-currency-input": "^1.1.0",
"loops": "1.0.1",
Expand Down
7 changes: 3 additions & 4 deletions apps/dashboard/src/app/[locale]/(public)/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { GoogleSignIn } from "@/components/google-sign-in";
import { OTPSignIn } from "@/components/otp-sign-in";
import { SlackSignIn } from "@/components/slack-sign-in";
import { Cookies } from "@/utils/constants";
import { getCountryCode, isEUCountry } from "@midday/location";
import { isEU } from "@midday/location";
import {
Accordion,
AccordionContent,
Expand All @@ -28,11 +28,10 @@ export default async function Page(params) {
return <DesktopCommandMenuSignIn />;
}

const countryCode = getCountryCode();
const isEU = isEUCountry(countryCode);
const cookieStore = cookies();
const preferred = cookieStore.get(Cookies.PreferredSignInProvider);
const showTrackingConsent = isEU && !cookieStore.has(Cookies.TrackingConsent);
const showTrackingConsent =
isEU() && !cookieStore.has(Cookies.TrackingConsent);
const { device } = userAgent({ headers: headers() });

let moreSignInOptions = null;
Expand Down
2 changes: 1 addition & 1 deletion apps/engine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@hono/swagger-ui": "^0.4.0",
"@hono/zod-openapi": "^0.15.1",
"@hono/zod-validator": "^0.2.2",
"hono": "^4.5.1",
"hono": "^4.5.2",
"plaid": "^26.0.0",
"typesense": "^1.8.2",
"xior": "^0.5.5",
Expand Down
2 changes: 1 addition & 1 deletion apps/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@uidotdev/usehooks": "^2.4.1",
"d3": "^7.9.0",
"date-fns": "^3.6.0",
"framer-motion": "^11.3.18",
"framer-motion": "^11.3.19",
"geist": "^1.3.1",
"next": "14.2.1",
"next-mdx-remote": "^5.0.0",
Expand Down
Binary file modified bun.lockb
Binary file not shown.
60 changes: 0 additions & 60 deletions packages/location/src/countries.ts

This file was deleted.

13 changes: 4 additions & 9 deletions packages/location/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import { headers } from "next/headers";
import { EU_COUNTRY_CODES } from "./countries";
import countries from "./countries.json";
import flags from "./country-flag";

export function getCountryCode() {
const countryCode = headers().get("x-vercel-ip-country") || "SE";

return countryCode;
return headers().get("x-vercel-ip-country") || "SE";
}

export function getCountryInfo() {
Expand All @@ -27,12 +24,10 @@ export function getCountryInfo() {
};
}

export function isEUCountry(countryCode: string) {
if (EU_COUNTRY_CODES.includes(countryCode)) {
return true;
}
export function isEU() {
const continent = headers().get("x-vercel-ip-continent") || "EU";

return false;
return continent === "EU";
}

export function getCountry() {
Expand Down

0 comments on commit f17e2bf

Please sign in to comment.