From 10c56a91dacd61070d1188dfa9342c9dd5f64d29 Mon Sep 17 00:00:00 2001 From: Javier Adriel Date: Thu, 30 Jun 2022 16:27:36 -0500 Subject: [PATCH] Check if user is in EU (#2143) --- .../Console/Marketplace/SetEmailModal.tsx | 28 ++++++- .../Console/Marketplace/euTimezones.ts | 78 +++++++++++++++++++ 2 files changed, 103 insertions(+), 3 deletions(-) create mode 100644 portal-ui/src/screens/Console/Marketplace/euTimezones.ts diff --git a/portal-ui/src/screens/Console/Marketplace/SetEmailModal.tsx b/portal-ui/src/screens/Console/Marketplace/SetEmailModal.tsx index 69f241903..6608f6829 100644 --- a/portal-ui/src/screens/Console/Marketplace/SetEmailModal.tsx +++ b/portal-ui/src/screens/Console/Marketplace/SetEmailModal.tsx @@ -27,6 +27,7 @@ import { ErrorResponseHandler } from "../../../common/types"; import InputBoxWrapper from "../Common/FormComponents/InputBoxWrapper/InputBoxWrapper"; import { setErrorSnackMessage, setSnackBarMessage } from "../../../systemSlice"; import { useAppDispatch } from "../../../store"; +import { euTimezones } from "./euTimezones"; const styles = (theme: Theme) => createStyles({ @@ -70,9 +71,15 @@ const SetEmailModal = ({ open, closeModal }: ISetEmailModalProps) => { }; const onConfirm = () => { - invokeApi("POST", "/api/v1/mp-integration", { email }); + const isInEU = isEU(); + invokeApi("POST", "/api/v1/mp-integration", { email, isInEU}); }; + const isEU = () => { + const tz = Intl.DateTimeFormat().resolvedOptions().timeZone; + return euTimezones.includes(tz.toLocaleLowerCase()); + } + return open ? ( { }} confirmationContent={ - Would you like to register an email for your account? +

+ Your Marketplace subscription includes support access from the + + MinIO Subscription Network (SUBNET) + . +
+ Enter your email to register now. +

+

+ To register later, contact support@min.io. +

+
} /> diff --git a/portal-ui/src/screens/Console/Marketplace/euTimezones.ts b/portal-ui/src/screens/Console/Marketplace/euTimezones.ts new file mode 100644 index 000000000..dbbd4d488 --- /dev/null +++ b/portal-ui/src/screens/Console/Marketplace/euTimezones.ts @@ -0,0 +1,78 @@ +// This file is part of MinIO Console Server +// Copyright (c) 2022 MinIO, Inc. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +export const euTimezones = [ + "europe/amsterdam", + "europe/andorra", + "europe/astrakhan", + "europe/athens", + "europe/belgrade", + "europe/berlin", + "europe/bratislava", + "europe/brussels", + "europe/bucharest", + "europe/budapest", + "europe/busingen", + "europe/chisinau", + "europe/copenhagen", + "europe/dublin", + "europe/gibraltar", + "europe/guernsey", + "europe/helsinki", + "europe/isle_of_man", + "europe/istanbul", + "europe/jersey", + "europe/kaliningrad", + "europe/kiev", + "europe/kirov", + "europe/lisbon", + "europe/ljubljana", + "europe/london", + "europe/luxembourg", + "europe/madrid", + "europe/malta", + "europe/mariehamn", + "europe/minsk", + "europe/monaco", + "europe/moscow", + "europe/oslo", + "europe/paris", + "europe/podgorica", + "europe/prague", + "europe/riga", + "europe/rome", + "europe/samara", + "europe/san_marino", + "europe/sarajevo", + "europe/saratov", + "europe/simferopol", + "europe/skopje", + "europe/sofia", + "europe/stockholm", + "europe/tallinn", + "europe/tirane", + "europe/ulyanovsk", + "europe/uzhgorod", + "europe/vaduz", + "europe/vatican", + "europe/vienna", + "europe/vilnius", + "europe/volgograd", + "europe/warsaw", + "europe/zagreb", + "europe/zaporozhye", + "europe/zurich" + ]; \ No newline at end of file