diff --git a/packages/client/src/pages/Confirm/sub-components/auth.js b/packages/client/src/pages/Confirm/sub-components/auth.js index e99665c3d2..34997a89db 100644 --- a/packages/client/src/pages/Confirm/sub-components/auth.js +++ b/packages/client/src/pages/Confirm/sub-components/auth.js @@ -25,18 +25,26 @@ // International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode import React, { useEffect } from "react"; +import { useTranslation } from "react-i18next"; import { Loader } from "@docspace/shared/components/loader"; import Section from "@docspace/shared/components/section"; +import OperationContainer from "@docspace/shared/components/operation-container"; import { loginWithConfirmKey } from "@docspace/shared/api/user"; import { useSearchParams } from "react-router-dom"; import { combineUrl } from "@docspace/shared/utils/combineUrl"; import { toastr } from "@docspace/shared/components/toast"; import { frameCallEvent } from "@docspace/shared/utils/common"; import SectionWrapper from "SRC_DIR/components/Section"; + const Auth = (props) => { //console.log("Auth render"); const { linkData } = props; let [searchParams, setSearchParams] = useSearchParams(); + const { t } = useTranslation(["Common"]); + let referenceUrl = searchParams.get("referenceUrl"); + const isFileHandler = referenceUrl.indexOf("filehandler.ashx") !== -1; + const isExternalDownloading = referenceUrl.indexOf("action=download") !== -1; + useEffect(() => { loginWithConfirmKey({ ConfirmData: { @@ -48,15 +56,17 @@ const Auth = (props) => { //console.log("Login with confirm key success", res); frameCallEvent({ event: "onAuthSuccess" }); - const url = searchParams.get("referenceUrl"); - - if (url) { + if (referenceUrl) { try { - new URL(url); - return window.location.replace(url); + new URL(referenceUrl); + if (isFileHandler && isExternalDownloading) { + return; + } else { + return window.location.replace(referenceUrl); + } } catch { return window.location.replace( - combineUrl(window.location.origin, url), + combineUrl(window.location.origin, referenceUrl), ); } } @@ -70,7 +80,15 @@ const Auth = (props) => { }); }); - return ; + return isFileHandler && isExternalDownloading ? ( + + ) : ( + + ); }; const AuthPage = (props) => ( diff --git a/packages/shared/components/operation-container/OperationContainer.styled.ts b/packages/shared/components/operation-container/OperationContainer.styled.ts new file mode 100644 index 0000000000..f3d9959aca --- /dev/null +++ b/packages/shared/components/operation-container/OperationContainer.styled.ts @@ -0,0 +1,55 @@ +// (c) Copyright Ascensio System SIA 2009-2024 +// +// This program is a free software product. +// You can redistribute it and/or modify it under the terms +// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software +// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended +// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of +// any third-party rights. +// +// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see +// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html +// +// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021. +// +// The interactive user interfaces in modified source and object code versions of the Program must +// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3. +// +// Pursuant to Section 7(b) of the License you must retain the original Product logo when +// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under +// trademark law for use of our trademarks. +// +// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing +// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0 +// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + +import styled from "styled-components"; + +const StyledOperationContainer = styled.div` + background: ${(props) => props.theme.errorContainer.background}; + cursor: default; + height: 100%; + width: 100%; + overflow: hidden; + display: flex; + flex-direction: column; + align-items: center; + margin: 0 auto 8px 0; + padding: 100px 20px 20px 20px; + border: 0; + box-sizing: border-box; + + .operation-logo { + margin-top: 115px; + margin-bottom: 50px; + } + + .operation-description { + margin-top: 16px; + color: ${(props) => + props.theme.preparationPortalProgress.descriptionTextColor}; + } +`; + +export { StyledOperationContainer }; diff --git a/packages/shared/components/operation-container/OperationContainer.types.ts b/packages/shared/components/operation-container/OperationContainer.types.ts new file mode 100644 index 0000000000..47e1dba80a --- /dev/null +++ b/packages/shared/components/operation-container/OperationContainer.types.ts @@ -0,0 +1,31 @@ +// (c) Copyright Ascensio System SIA 2009-2024 +// +// This program is a free software product. +// You can redistribute it and/or modify it under the terms +// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software +// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended +// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of +// any third-party rights. +// +// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see +// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html +// +// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021. +// +// The interactive user interfaces in modified source and object code versions of the Program must +// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3. +// +// Pursuant to Section 7(b) of the License you must retain the original Product logo when +// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under +// trademark law for use of our trademarks. +// +// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing +// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0 +// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode + +export interface IOperationContainer { + url?: string; + title: string; + description: string; +} diff --git a/packages/shared/components/operation-container/index.tsx b/packages/shared/components/operation-container/index.tsx new file mode 100644 index 0000000000..276231f652 --- /dev/null +++ b/packages/shared/components/operation-container/index.tsx @@ -0,0 +1,56 @@ +// (c) Copyright Ascensio System SIA 2009-2024 +// +// This program is a free software product. +// You can redistribute it and/or modify it under the terms +// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software +// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended +// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of +// any third-party rights. +// +// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see +// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html +// +// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021. +// +// The interactive user interfaces in modified source and object code versions of the Program must +// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3. +// +// Pursuant to Section 7(b) of the License you must retain the original Product logo when +// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under +// trademark law for use of our trademarks. +// +// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing +// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0 +// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode +import React, { useEffect } from "react"; + +import DownloadingReactSvg from "PUBLIC_DIR/images/downloading.react.svg"; + +import { StyledOperationContainer } from "./OperationContainer.styled"; +import { IOperationContainer } from "./OperationContainer.types"; +import { Text } from "../text"; +import PortalLogo from "../portal-logo/PortalLogo"; + +const OperationContainer = (props: IOperationContainer) => { + const { url, title, description } = props; + + useEffect(() => { + if (url) window.location.replace(url); + }, [url]); + + return ( + + + + + {title} + + + {description} + + + ); +}; + +export default OperationContainer; diff --git a/public/images/downloading.react.svg b/public/images/downloading.react.svg new file mode 100644 index 0000000000..4a1e8a5dcf --- /dev/null +++ b/public/images/downloading.react.svg @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/locales/en/Common.json b/public/locales/en/Common.json index d38ffc9648..6b51d43777 100644 --- a/public/locales/en/Common.json +++ b/public/locales/en/Common.json @@ -140,6 +140,8 @@ "DontShowAgain": "Don't show again", "Download": "Download", "DownloadApps": "Download applications", + "DownloadOperationTitle": "File downloading in progress", + "DownloadOperationDescription": "Once ready, you can find the files in your browser's download folder and close this tab.", "DropzoneTitleExsts": "(JPG or PNG)", "DropzoneTitleLink": "Select new image", "DropzoneTitleSecondary": "or drop file here", @@ -510,4 +512,4 @@ "Yes": "Yes", "Yesterday": "Yesterday", "You": "You" -} \ No newline at end of file +}