From d3f853b755cac8feb7dabeddbee9704b94fb68fb Mon Sep 17 00:00:00 2001 From: Timofey Boyko Date: Thu, 29 Aug 2024 10:03:06 +0300 Subject: [PATCH] Add temp MSW server --- packages/login/next.config.js | 20 +- packages/login/package.json | 7 +- packages/login/playwright.config.ts | 8 +- packages/login/public/mockServiceWorker.js | 287 +++++++++++++ packages/login/server.js | 6 +- packages/login/src/app/layout.tsx | 40 +- .../login/src/components/LoginForm/index.tsx | 2 +- packages/login/src/providers/index.tsx | 13 +- packages/login/src/utils/actions.ts | 125 +++--- packages/public/images/arrow-left.react.svg | 3 + packages/public/images/arrow.left.react.svg | 3 + packages/public/images/arrow.right.react.svg | 3 + packages/public/images/avatar.base.react.svg | 9 + packages/public/images/avatar.dark.react.svg | 9 + .../images/background.pattern.black.react.svg | 5 + .../images/background.pattern.green.react.svg | 5 + .../background.pattern.lightBlue.react.svg | 5 + .../background.pattern.orange.react.svg | 5 + .../background.pattern.purple.react.svg | 5 + .../images/background.pattern.react.svg | 5 + .../images/background.pattern.red.react.svg | 5 + .../public/images/catalog.folder.react.svg | 10 + packages/public/images/cross.edit.react.svg | 10 + packages/public/images/cross.react.svg | 3 + packages/public/images/document.react.svg | 3 + packages/public/images/download.react.svg | 10 + packages/public/images/eye.off.react.svg | 10 + packages/public/images/eye.react.svg | 3 + packages/public/images/flags/ar-SA.react.svg | 4 + packages/public/images/flags/az.react.svg | 6 + packages/public/images/flags/bg.react.svg | 5 + packages/public/images/flags/cs.react.svg | 5 + packages/public/images/flags/de-AT.react.svg | 5 + packages/public/images/flags/de-CH.react.svg | 5 + packages/public/images/flags/de.react.svg | 5 + packages/public/images/flags/el-GR.react.svg | 10 + packages/public/images/flags/en-GB.react.svg | 9 + packages/public/images/flags/en-US.react.svg | 28 ++ packages/public/images/flags/es-MX.react.svg | 387 ++++++++++++++++++ packages/public/images/flags/es.react.svg | 41 ++ packages/public/images/flags/fi.react.svg | 4 + packages/public/images/flags/fr.react.svg | 5 + packages/public/images/flags/hy-AM.react.svg | 5 + packages/public/images/flags/it.react.svg | 5 + packages/public/images/flags/ja-JP.react.svg | 4 + packages/public/images/flags/ko-KR.react.svg | 23 ++ packages/public/images/flags/lo-LA.react.svg | 6 + packages/public/images/flags/lv.react.svg | 4 + packages/public/images/flags/nl.react.svg | 5 + packages/public/images/flags/pl.react.svg | 4 + packages/public/images/flags/pt-BR.react.svg | 17 + packages/public/images/flags/pt.react.svg | 29 ++ packages/public/images/flags/ro.react.svg | 5 + packages/public/images/flags/ru.react.svg | 5 + packages/public/images/flags/si.react.svg | 53 +++ packages/public/images/flags/sk.react.svg | 9 + packages/public/images/flags/sl.react.svg | 9 + packages/public/images/flags/sr.react.svg | 52 +++ packages/public/images/flags/tr.react.svg | 5 + packages/public/images/flags/uk-UA.react.svg | 4 + packages/public/images/flags/vi.react.svg | 4 + packages/public/images/flags/zh-CN.react.svg | 8 + .../public/images/icons/17/cross.react.svg | 3 + packages/public/images/icons/24/file.svg | 8 + packages/public/images/info.react.svg | 3 + .../public/images/logo/dark_lightsmall.svg | 6 + .../public/images/logo/dark_loginpage.svg | 6 + packages/public/images/logo/docseditor.svg | 27 ++ .../public/images/logo/docseditorembed.svg | 27 ++ packages/public/images/logo/leftmenu.svg | 5 + packages/public/images/logo/lightsmall.svg | 6 + packages/public/images/logo/loginpage.svg | 6 + packages/public/images/pencil.react.svg | 10 + packages/public/images/refresh.react.svg | 10 + packages/public/images/right.arrow.react.svg | 3 + packages/public/images/sso.react.svg | 3 + packages/shared/__mocks__/e2e/browser.ts | 4 + packages/shared/__mocks__/e2e/capabilities.ts | 25 -- .../shared/__mocks__/e2e/handlers/index.ts | 4 + .../shared/__mocks__/e2e/handlers/logo.ts | 20 + .../e2e/handlers/settings/colorTheme.ts | 97 +++++ .../__mocks__/e2e/handlers/settings/index.ts | 19 + .../e2e/handlers/settings/licenseRequired.ts | 24 ++ .../e2e/handlers/settings/machineName.ts | 23 ++ .../e2e/handlers/settings/portalCultures.ts | 56 +++ .../settings/portalPasswordSettings.ts | 33 ++ .../e2e/handlers/settings/portalTimeZones.ts | 64 +++ .../e2e/handlers/settings/settings.ts | 290 +++++++++++++ packages/shared/__mocks__/e2e/index.ts | 31 +- .../shared/__mocks__/e2e/msw-provider.tsx | 54 +++ packages/shared/__mocks__/e2e/node.ts | 4 + packages/shared/__mocks__/e2e/settings.ts | 356 ---------------- packages/shared/__mocks__/e2e/utils.ts | 3 + packages/shared/package.json | 3 +- packages/shared/utils/common.ts | 1 + packages/shared/utils/next-ssr-helper.ts | 2 + yarn.lock | 288 ++++++++++++- 97 files changed, 2414 insertions(+), 504 deletions(-) create mode 100644 packages/login/public/mockServiceWorker.js create mode 100644 packages/public/images/arrow-left.react.svg create mode 100644 packages/public/images/arrow.left.react.svg create mode 100644 packages/public/images/arrow.right.react.svg create mode 100644 packages/public/images/avatar.base.react.svg create mode 100644 packages/public/images/avatar.dark.react.svg create mode 100644 packages/public/images/background.pattern.black.react.svg create mode 100644 packages/public/images/background.pattern.green.react.svg create mode 100644 packages/public/images/background.pattern.lightBlue.react.svg create mode 100644 packages/public/images/background.pattern.orange.react.svg create mode 100644 packages/public/images/background.pattern.purple.react.svg create mode 100644 packages/public/images/background.pattern.react.svg create mode 100644 packages/public/images/background.pattern.red.react.svg create mode 100644 packages/public/images/catalog.folder.react.svg create mode 100644 packages/public/images/cross.edit.react.svg create mode 100644 packages/public/images/cross.react.svg create mode 100644 packages/public/images/document.react.svg create mode 100644 packages/public/images/download.react.svg create mode 100644 packages/public/images/eye.off.react.svg create mode 100644 packages/public/images/eye.react.svg create mode 100644 packages/public/images/flags/ar-SA.react.svg create mode 100644 packages/public/images/flags/az.react.svg create mode 100644 packages/public/images/flags/bg.react.svg create mode 100644 packages/public/images/flags/cs.react.svg create mode 100644 packages/public/images/flags/de-AT.react.svg create mode 100644 packages/public/images/flags/de-CH.react.svg create mode 100644 packages/public/images/flags/de.react.svg create mode 100644 packages/public/images/flags/el-GR.react.svg create mode 100644 packages/public/images/flags/en-GB.react.svg create mode 100644 packages/public/images/flags/en-US.react.svg create mode 100644 packages/public/images/flags/es-MX.react.svg create mode 100644 packages/public/images/flags/es.react.svg create mode 100644 packages/public/images/flags/fi.react.svg create mode 100644 packages/public/images/flags/fr.react.svg create mode 100644 packages/public/images/flags/hy-AM.react.svg create mode 100644 packages/public/images/flags/it.react.svg create mode 100644 packages/public/images/flags/ja-JP.react.svg create mode 100644 packages/public/images/flags/ko-KR.react.svg create mode 100644 packages/public/images/flags/lo-LA.react.svg create mode 100644 packages/public/images/flags/lv.react.svg create mode 100644 packages/public/images/flags/nl.react.svg create mode 100644 packages/public/images/flags/pl.react.svg create mode 100644 packages/public/images/flags/pt-BR.react.svg create mode 100644 packages/public/images/flags/pt.react.svg create mode 100644 packages/public/images/flags/ro.react.svg create mode 100644 packages/public/images/flags/ru.react.svg create mode 100644 packages/public/images/flags/si.react.svg create mode 100644 packages/public/images/flags/sk.react.svg create mode 100644 packages/public/images/flags/sl.react.svg create mode 100644 packages/public/images/flags/sr.react.svg create mode 100644 packages/public/images/flags/tr.react.svg create mode 100644 packages/public/images/flags/uk-UA.react.svg create mode 100644 packages/public/images/flags/vi.react.svg create mode 100644 packages/public/images/flags/zh-CN.react.svg create mode 100644 packages/public/images/icons/17/cross.react.svg create mode 100644 packages/public/images/icons/24/file.svg create mode 100644 packages/public/images/info.react.svg create mode 100644 packages/public/images/logo/dark_lightsmall.svg create mode 100644 packages/public/images/logo/dark_loginpage.svg create mode 100644 packages/public/images/logo/docseditor.svg create mode 100644 packages/public/images/logo/docseditorembed.svg create mode 100644 packages/public/images/logo/leftmenu.svg create mode 100644 packages/public/images/logo/lightsmall.svg create mode 100644 packages/public/images/logo/loginpage.svg create mode 100644 packages/public/images/pencil.react.svg create mode 100644 packages/public/images/refresh.react.svg create mode 100644 packages/public/images/right.arrow.react.svg create mode 100644 packages/public/images/sso.react.svg create mode 100644 packages/shared/__mocks__/e2e/browser.ts delete mode 100644 packages/shared/__mocks__/e2e/capabilities.ts create mode 100644 packages/shared/__mocks__/e2e/handlers/index.ts create mode 100644 packages/shared/__mocks__/e2e/handlers/logo.ts create mode 100644 packages/shared/__mocks__/e2e/handlers/settings/colorTheme.ts create mode 100644 packages/shared/__mocks__/e2e/handlers/settings/index.ts create mode 100644 packages/shared/__mocks__/e2e/handlers/settings/licenseRequired.ts create mode 100644 packages/shared/__mocks__/e2e/handlers/settings/machineName.ts create mode 100644 packages/shared/__mocks__/e2e/handlers/settings/portalCultures.ts create mode 100644 packages/shared/__mocks__/e2e/handlers/settings/portalPasswordSettings.ts create mode 100644 packages/shared/__mocks__/e2e/handlers/settings/portalTimeZones.ts create mode 100644 packages/shared/__mocks__/e2e/handlers/settings/settings.ts create mode 100644 packages/shared/__mocks__/e2e/msw-provider.tsx create mode 100644 packages/shared/__mocks__/e2e/node.ts delete mode 100644 packages/shared/__mocks__/e2e/settings.ts create mode 100644 packages/shared/__mocks__/e2e/utils.ts diff --git a/packages/login/next.config.js b/packages/login/next.config.js index d909856a7d..f01221c3c0 100644 --- a/packages/login/next.config.js +++ b/packages/login/next.config.js @@ -26,12 +26,23 @@ /** @type {import('next').NextConfig} */ -const path = require("path"); const pkg = require("./package.json"); +const IS_TEST = process.env.TEST; + +const output = IS_TEST ? {} : { output: "standalone" }; +const imgGenerator = IS_TEST + ? {} + : { + generator: { + emit: false, + filename: "static/chunks/[path][name][ext]?[hash]", + }, + }; + const nextConfig = { basePath: "/login", - output: "standalone", + ...output, compiler: { styledComponents: true, }, @@ -74,10 +85,7 @@ module.exports = { // Reapply the existing rule, but only for svg imports ending in ?url { type: "asset/resource", - generator: { - emit: false, - filename: "static/chunks/[path][name][ext]?[hash]", - }, + ...imgGenerator, test: /\.(svg|png|jpe?g|gif|ico|woff2)$/i, resourceQuery: /url/, // *.svg?url }, diff --git a/packages/login/package.json b/packages/login/package.json index 6616cbedac..db160af124 100644 --- a/packages/login/package.json +++ b/packages/login/package.json @@ -11,10 +11,9 @@ "lint": "next lint", "clean": "shx rm -rf .next", "deploy": "shx --silent mkdir -p ../../../publish/web/login && shx --silent mkdir -p ../../../publish/web/login/.next && shx --silent mkdir -p ../../../publish/web/login/node_modules && shx --silent mkdir -p ../../../publish/web/login/.next/static && shx cp -r .next/standalone/node_modules/* ../../../publish/web/login/node_modules && shx cp -r .next/static/* ../../../publish/web/login/.next/static && shx cp -r .next/standalone/packages/login/.next/* ../../../publish/web/login/.next && shx cp -f server.prod.js ../../../publish/web/login/server.js", - "test:build": "node ./scripts/buildTranslations.js && TEST=true next build", - "test:start": "PORT=5111 NODE_ENV=development TEST=true node server.js", - "test:e2e": "npx playwright test", - "test:e2e:ui": "npx playwright test --ui" + "test:build": "node ./scripts/buildTranslations.js && TEST=true API_HOST=https://api.example.com next build", + "test:start": "PORT=5111 API_HOST=https://api.example.com NODE_ENV=production TEST=true node server.js", + "test:e2e": "npx playwright test" }, "dependencies": { "@hcaptcha/react-hcaptcha": "^1.10.1", diff --git a/packages/login/playwright.config.ts b/packages/login/playwright.config.ts index d9ff55cf94..9b3dd30de5 100644 --- a/packages/login/playwright.config.ts +++ b/packages/login/playwright.config.ts @@ -1,5 +1,9 @@ import { defineConfig, devices } from "@playwright/test"; +import { BASE_URL } from "@docspace/shared/__mocks__/e2e"; + +const PORT = 5111; + /** * Read environment variables from file. * https://github.com/motdotla/dotenv @@ -25,7 +29,7 @@ export default defineConfig({ /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ use: { /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL: "http://127.0.0.1:5111", + baseURL: `${BASE_URL}:${PORT}`, /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ trace: "on-first-retry", @@ -72,7 +76,7 @@ export default defineConfig({ /* Run your local dev server before starting the tests */ webServer: { command: "yarn test:start", - port: 5111, + port: PORT, timeout: 1000 * 60 * 5, }, }); diff --git a/packages/login/public/mockServiceWorker.js b/packages/login/public/mockServiceWorker.js new file mode 100644 index 0000000000..9148ff615b --- /dev/null +++ b/packages/login/public/mockServiceWorker.js @@ -0,0 +1,287 @@ +/* eslint-disable */ +/* tslint:disable */ + +/** + * Mock Service Worker (2.0.14). + * @see https://github.com/mswjs/msw + * - Please do NOT modify this file. + * - Please do NOT serve this file on production. + */ + +const INTEGRITY_CHECKSUM = "c5f7f8e188b673ea4e677df7ea3c5a39"; +const IS_MOCKED_RESPONSE = Symbol("isMockedResponse"); +const activeClientIds = new Set(); + +self.addEventListener("install", function () { + self.skipWaiting(); +}); + +self.addEventListener("activate", function (event) { + event.waitUntil(self.clients.claim()); +}); + +self.addEventListener("message", async function (event) { + const clientId = event.source.id; + + if (!clientId || !self.clients) { + return; + } + + const client = await self.clients.get(clientId); + + if (!client) { + return; + } + + const allClients = await self.clients.matchAll({ + type: "window", + }); + + switch (event.data) { + case "KEEPALIVE_REQUEST": { + sendToClient(client, { + type: "KEEPALIVE_RESPONSE", + }); + break; + } + + case "INTEGRITY_CHECK_REQUEST": { + sendToClient(client, { + type: "INTEGRITY_CHECK_RESPONSE", + payload: INTEGRITY_CHECKSUM, + }); + break; + } + + case "MOCK_ACTIVATE": { + activeClientIds.add(clientId); + + sendToClient(client, { + type: "MOCKING_ENABLED", + payload: true, + }); + break; + } + + case "MOCK_DEACTIVATE": { + activeClientIds.delete(clientId); + break; + } + + case "CLIENT_CLOSED": { + activeClientIds.delete(clientId); + + const remainingClients = allClients.filter((client) => { + return client.id !== clientId; + }); + + // Unregister itself when there are no more clients + if (remainingClients.length === 0) { + self.registration.unregister(); + } + + break; + } + } +}); + +self.addEventListener("fetch", function (event) { + const { request } = event; + + // Bypass navigation requests. + if (request.mode === "navigate") { + return; + } + + // Opening the DevTools triggers the "only-if-cached" request + // that cannot be handled by the worker. Bypass such requests. + if (request.cache === "only-if-cached" && request.mode !== "same-origin") { + return; + } + + // Bypass all requests when there are no active clients. + // Prevents the self-unregistered worked from handling requests + // after it's been deleted (still remains active until the next reload). + if (activeClientIds.size === 0) { + return; + } + + // Generate unique request ID. + const requestId = crypto.randomUUID(); + event.respondWith(handleRequest(event, requestId)); +}); + +async function handleRequest(event, requestId) { + const client = await resolveMainClient(event); + const response = await getResponse(event, client, requestId); + + // Send back the response clone for the "response:*" life-cycle events. + // Ensure MSW is active and ready to handle the message, otherwise + // this message will pend indefinitely. + if (client && activeClientIds.has(client.id)) { + (async function () { + const responseClone = response.clone(); + + sendToClient( + client, + { + type: "RESPONSE", + payload: { + requestId, + isMockedResponse: IS_MOCKED_RESPONSE in response, + type: responseClone.type, + status: responseClone.status, + statusText: responseClone.statusText, + body: responseClone.body, + headers: Object.fromEntries(responseClone.headers.entries()), + }, + }, + [responseClone.body] + ); + })(); + } + + return response; +} + +// Resolve the main client for the given event. +// Client that issues a request doesn't necessarily equal the client +// that registered the worker. It's with the latter the worker should +// communicate with during the response resolving phase. +async function resolveMainClient(event) { + const client = await self.clients.get(event.clientId); + + if (client?.frameType === "top-level") { + return client; + } + + const allClients = await self.clients.matchAll({ + type: "window", + }); + + return allClients + .filter((client) => { + // Get only those clients that are currently visible. + return client.visibilityState === "visible"; + }) + .find((client) => { + // Find the client ID that's recorded in the + // set of clients that have registered the worker. + return activeClientIds.has(client.id); + }); +} + +async function getResponse(event, client, requestId) { + const { request } = event; + + // Clone the request because it might've been already used + // (i.e. its body has been read and sent to the client). + const requestClone = request.clone(); + + function passthrough() { + const headers = Object.fromEntries(requestClone.headers.entries()); + + // Remove internal MSW request header so the passthrough request + // complies with any potential CORS preflight checks on the server. + // Some servers forbid unknown request headers. + delete headers["x-msw-intention"]; + + return fetch(requestClone, { headers }); + } + + // Bypass mocking when the client is not active. + if (!client) { + return passthrough(); + } + + // Bypass initial page load requests (i.e. static assets). + // The absence of the immediate/parent client in the map of the active clients + // means that MSW hasn't dispatched the "MOCK_ACTIVATE" event yet + // and is not ready to handle requests. + if (!activeClientIds.has(client.id)) { + return passthrough(); + } + + // Bypass requests with the explicit bypass header. + // Such requests can be issued by "ctx.fetch()". + const mswIntention = request.headers.get("x-msw-intention"); + if (["bypass", "passthrough"].includes(mswIntention)) { + return passthrough(); + } + + // Notify the client that a request has been intercepted. + const requestBuffer = await request.arrayBuffer(); + const clientMessage = await sendToClient( + client, + { + type: "REQUEST", + payload: { + id: requestId, + url: request.url, + mode: request.mode, + method: request.method, + headers: Object.fromEntries(request.headers.entries()), + cache: request.cache, + credentials: request.credentials, + destination: request.destination, + integrity: request.integrity, + redirect: request.redirect, + referrer: request.referrer, + referrerPolicy: request.referrerPolicy, + body: requestBuffer, + keepalive: request.keepalive, + }, + }, + [requestBuffer] + ); + + switch (clientMessage.type) { + case "MOCK_RESPONSE": { + return respondWithMock(clientMessage.data); + } + + case "MOCK_NOT_FOUND": { + return passthrough(); + } + } + + return passthrough(); +} + +function sendToClient(client, message, transferrables = []) { + return new Promise((resolve, reject) => { + const channel = new MessageChannel(); + + channel.port1.onmessage = (event) => { + if (event.data && event.data.error) { + return reject(event.data.error); + } + + resolve(event.data); + }; + + client.postMessage( + message, + [channel.port2].concat(transferrables.filter(Boolean)) + ); + }); +} + +async function respondWithMock(response) { + // Setting response status code to 0 is a no-op. + // However, when responding with a "Response.error()", the produced Response + // instance will have status code set to 0. Since it's not possible to create + // a Response instance with status code 0, handle that use-case separately. + if (response.status === 0) { + return Response.error(); + } + + const mockedResponse = new Response(response.body, response); + + Reflect.defineProperty(mockedResponse, IS_MOCKED_RESPONSE, { + value: true, + enumerable: true, + }); + + return mockedResponse; +} diff --git a/packages/login/server.js b/packages/login/server.js index 8da98ba8a0..f71c747697 100644 --- a/packages/login/server.js +++ b/packages/login/server.js @@ -47,13 +47,13 @@ app.prepare().then(() => { await handle(req, res, parsedUrl); } catch (err) { console.error("Error occurred handling", req.url, err); - res.statusCode = 500; - res.end("internal server error"); + // res.statusCode = 500; + // res.end("internal server error"); } }) .once("error", (err) => { console.error(err); - process.exit(1); + // process.exit(1); }) .listen(port, () => { console.log(`Server is listening on port ${port}`); diff --git a/packages/login/src/app/layout.tsx b/packages/login/src/app/layout.tsx index a5cce15095..ff7035c4d8 100644 --- a/packages/login/src/app/layout.tsx +++ b/packages/login/src/app/layout.tsx @@ -40,6 +40,16 @@ import { } from "@/utils/actions"; import "../styles/globals.scss"; +import { MSWProvider } from "@docspace/shared/__mocks__/e2e"; + +if (process.env.NEXT_RUNTIME === "nodejs") { + console.log("SERVER LISTEN"); + + const { server } = require("../mocks/node"); + server.listen(); + + Reflect.set(fetch, "__FOO", "YES"); +} export default async function RootLayout({ children, @@ -124,20 +134,22 @@ export default async function RootLayout({ - - - - {children} - - + + + + + {children} + + + ); diff --git a/packages/login/src/components/LoginForm/index.tsx b/packages/login/src/components/LoginForm/index.tsx index eef99f3131..92aae0b7f1 100644 --- a/packages/login/src/components/LoginForm/index.tsx +++ b/packages/login/src/components/LoginForm/index.tsx @@ -74,7 +74,7 @@ import { StyledCaptcha } from "./LoginForm.styled"; import { LoginDispatchContext, LoginValueContext } from "../Login"; import OAuthClientInfo from "../ConsentInfo"; -// import { gitAvailablePortals } from "@/utils/actions"; +// import { getAvailablePortals } from "@/utils/actions"; let showToastr = true; diff --git a/packages/login/src/providers/index.tsx b/packages/login/src/providers/index.tsx index 4d14786662..17eed2b80f 100644 --- a/packages/login/src/providers/index.tsx +++ b/packages/login/src/providers/index.tsx @@ -28,11 +28,13 @@ import React from "react"; import { I18nextProvider } from "react-i18next"; +import { usePathname, useSearchParams } from "next/navigation"; import { ThemeProvider } from "@docspace/shared/components/theme-provider"; import { TFirebaseSettings } from "@docspace/shared/api/settings/types"; import FirebaseHelper from "@docspace/shared/utils/firebase"; import { TUser } from "@docspace/shared/api/people/types"; +import { MSWProvider } from "@docspace/shared/__mocks__/e2e"; import { TDataContext } from "@/types"; import useI18N from "@/hooks/useI18N"; @@ -41,7 +43,8 @@ import useTheme from "@/hooks/useTheme"; import pkgFile from "../../package.json"; import ErrorBoundaryWrapper from "./ErrorBoundary"; -import { usePathname, useSearchParams } from "next/navigation"; + +const IS_TEST = process.env.TEST; export const Providers = ({ children, @@ -83,7 +86,7 @@ export const Providers = ({ i18n, }); - return ( + const content = ( ); + + // if (IS_TEST) { + // return {content}; + // } + + return content; }; diff --git a/packages/login/src/utils/actions.ts b/packages/login/src/utils/actions.ts index 5ce03ee056..5b5fe8ecbf 100644 --- a/packages/login/src/utils/actions.ts +++ b/packages/login/src/utils/actions.ts @@ -26,7 +26,7 @@ "use server"; -import { cookies, headers } from "next/headers"; +import { headers } from "next/headers"; import { createRequest, @@ -53,26 +53,13 @@ import { } from "@/types"; import { TScope } from "@docspace/shared/utils/oauth/types"; import { transformToClientProps } from "@docspace/shared/utils/oauth"; -import { - colorThemeSuccess, - getMockSettingsResponse, - isLicenseRequiredSuccess, - machineNameSuccess, - portalCulturesSuccess, - settingsPasswordSuccess, - settingsSuccessNoAuthWizard, -} from "@docspace/shared/__mocks__/e2e"; -import { - getMockResponse, - portalTimeZonesSuccess, -} from "@docspace/shared/__mocks__/e2e/settings"; - -const IS_TEST = process.env.TEST; export const checkIsAuthenticated = async () => { const [request] = createRequest(["/authentication"], [["", ""]], "GET"); - const res = await fetch(request); + const res = await fetch(request, { + cache: "no-store", + }); if (!res.ok) return; @@ -88,9 +75,11 @@ export async function getSettings() { "GET", ); - const settingsRes = IS_TEST - ? getMockResponse(settingsSuccessNoAuthWizard) - : await fetch(getSettings); + console.log(getSettings.url); + + const settingsRes = await fetch(getSettings, { + cache: "no-store", + }); if (settingsRes.status === 403) return `access-restricted`; @@ -110,7 +99,9 @@ export async function getVersionBuild() { "GET", ); - const res = await fetch(getSettings); + const res = await fetch(getSettings, { + cache: "no-store", + }); if (!res.ok) return; @@ -126,9 +117,11 @@ export async function getColorTheme() { "GET", ); - const res = IS_TEST - ? getMockResponse(colorThemeSuccess) - : await fetch(getColorTheme); + console.log(Reflect.get(fetch, "__FOO"), getColorTheme.url); + + const res = await fetch(getColorTheme, { + cache: "no-store", + }); if (!res.ok) return; @@ -144,7 +137,9 @@ export async function getThirdPartyProviders() { "GET", ); - const res = await fetch(getThirdParty); + const res = await fetch(getThirdParty, { + cache: "no-store", + }); if (!res.ok) return; @@ -156,7 +151,9 @@ export async function getThirdPartyProviders() { export async function getCapabilities() { const [getCapabilities] = createRequest([`/capabilities`], [["", ""]], "GET"); - const res = await fetch(getCapabilities); + const res = await fetch(getCapabilities, { + cache: "no-store", + }); if (!res.ok) return; @@ -168,7 +165,9 @@ export async function getCapabilities() { export async function getSSO() { const [getSSO] = createRequest([`/settings/ssov2`], [["", ""]], "GET"); - const res = await fetch(getSSO); + const res = await fetch(getSSO, { + cache: "no-store", + }); if (!res.ok) return; @@ -184,7 +183,9 @@ export async function getUser() { const [getUser] = createRequest([`/people/@self`], [["", ""]], "GET"); if (!cookie?.includes("asc_auth_key")) return undefined; - const userRes = await fetch(getUser); + const userRes = await fetch(getUser, { + cache: "no-store", + }); if (userRes.status === 401) return undefined; @@ -198,7 +199,9 @@ export async function getUser() { export async function getScopeList() { const [getScopeList] = createRequest([`/scopes`], [["", ""]], "GET"); - const scopeList = await fetch(getScopeList); + const scopeList = await fetch(getScopeList, { + cache: "no-store", + }); if (!scopeList.ok) return; @@ -214,7 +217,9 @@ export async function getOAuthClient(clientId: string) { "GET", ); - const oauthClient = await fetch(getOAuthClient); + const oauthClient = await fetch(getOAuthClient, { + cache: "no-store", + }); if (!oauthClient.ok) return; @@ -230,9 +235,9 @@ export async function getPortalCultures() { "GET", ); - const res = IS_TEST - ? getMockResponse(portalCulturesSuccess) - : await fetch(getPortalCultures); + const res = await fetch(getPortalCultures, { + cache: "no-store", + }); if (!res.ok) return; @@ -245,7 +250,7 @@ export async function gitAvailablePortals(data: { email: string; passwordHash: string; }) { - const [gitAvailablePortals] = createRequest( + const [getAvailablePortals] = createRequest( [`/portal/signin`], [["Content-Type", "application/json"]], "POST", @@ -253,22 +258,22 @@ export async function gitAvailablePortals(data: { true, ); - console.log(gitAvailablePortals.url); - - const response = await fetch(gitAvailablePortals); + const response = await fetch(getAvailablePortals, { + cache: "no-store", + }); if (!response.ok) return null; const { response: portals } = await response.json(); - console.log(portals); - // return config; } export async function getConfig() { const baseUrl = getBaseUrl(); const config = await ( - await fetch(`${baseUrl}/static/scripts/config.json`) + await fetch(`${baseUrl}/static/scripts/config.json`, { + cache: "no-store", + }) ).json(); return config; @@ -281,7 +286,9 @@ export async function getCompanyInfoSettings() { "GET", ); - const res = await fetch(getCompanyInfoSettings); + const res = await fetch(getCompanyInfoSettings, { + cache: "no-store", + }); if (!res.ok) throw new Error(res.statusText); @@ -298,9 +305,9 @@ export async function getPortalPasswordSettings( [confirmKey ? ["Confirm", confirmKey] : ["", ""]], "GET", ); - const res = IS_TEST - ? getMockResponse(settingsPasswordSuccess) - : await fetch(getPortalPasswordSettings); + const res = await fetch(getPortalPasswordSettings, { + cache: "no-store", + }); if (!res.ok) return; @@ -319,7 +326,9 @@ export async function getUserFromConfirm( "GET", ); - const res = await fetch(getUserFromConfirm); + const res = await fetch(getUserFromConfirm, { + cache: "no-store", + }); if (!res.ok) return; @@ -339,9 +348,9 @@ export async function getMachineName(confirmKey: string | null = null) { "GET", ); - const res = IS_TEST - ? getMockResponse(machineNameSuccess) - : await fetch(getMachineName); + const res = await fetch(getMachineName, { + cache: "no-store", + }); if (!res.ok) throw new Error(res.statusText); @@ -357,9 +366,9 @@ export async function getIsLicenseRequired() { "GET", ); - const res = IS_TEST - ? getMockResponse(isLicenseRequiredSuccess) - : await fetch(getIsLicenseRequired); + const res = await fetch(getIsLicenseRequired, { + cache: "no-store", + }); if (!res.ok) throw new Error(res.statusText); @@ -375,9 +384,9 @@ export async function getPortalTimeZones(confirmKey: string | null = null) { "GET", ); - const res = IS_TEST - ? getMockResponse(portalTimeZonesSuccess) - : await fetch(getPortalTimeZones); + const res = await fetch(getPortalTimeZones, { + cache: "no-store", + }); if (!res.ok) throw new Error(res.statusText); @@ -393,7 +402,9 @@ export async function getTfaSecretKeyAndQR(confirmKey: string | null = null) { "GET", ); - const res = await fetch(getTfaSecretKeyAndQR); + const res = await fetch(getTfaSecretKeyAndQR, { + cache: "no-store", + }); if (!res.ok) throw new Error(res.statusText); @@ -410,7 +421,9 @@ export async function checkConfirmLink(data: TConfirmLinkParams) { JSON.stringify(data), ); - const response = await fetch(checkConfirmLink); + const response = await fetch(checkConfirmLink, { + cache: "no-store", + }); if (!response.ok) throw new Error(response.statusText); diff --git a/packages/public/images/arrow-left.react.svg b/packages/public/images/arrow-left.react.svg new file mode 100644 index 0000000000..13911134f5 --- /dev/null +++ b/packages/public/images/arrow-left.react.svg @@ -0,0 +1,3 @@ + + + diff --git a/packages/public/images/arrow.left.react.svg b/packages/public/images/arrow.left.react.svg new file mode 100644 index 0000000000..6f2f162f99 --- /dev/null +++ b/packages/public/images/arrow.left.react.svg @@ -0,0 +1,3 @@ + + + diff --git a/packages/public/images/arrow.right.react.svg b/packages/public/images/arrow.right.react.svg new file mode 100644 index 0000000000..8b480c2349 --- /dev/null +++ b/packages/public/images/arrow.right.react.svg @@ -0,0 +1,3 @@ + + + diff --git a/packages/public/images/avatar.base.react.svg b/packages/public/images/avatar.base.react.svg new file mode 100644 index 0000000000..c3c03f9e95 --- /dev/null +++ b/packages/public/images/avatar.base.react.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/packages/public/images/avatar.dark.react.svg b/packages/public/images/avatar.dark.react.svg new file mode 100644 index 0000000000..9e2a52c2b4 --- /dev/null +++ b/packages/public/images/avatar.dark.react.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/packages/public/images/background.pattern.black.react.svg b/packages/public/images/background.pattern.black.react.svg new file mode 100644 index 0000000000..0cbe2bf836 --- /dev/null +++ b/packages/public/images/background.pattern.black.react.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/packages/public/images/background.pattern.green.react.svg b/packages/public/images/background.pattern.green.react.svg new file mode 100644 index 0000000000..5342bdd2cc --- /dev/null +++ b/packages/public/images/background.pattern.green.react.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/packages/public/images/background.pattern.lightBlue.react.svg b/packages/public/images/background.pattern.lightBlue.react.svg new file mode 100644 index 0000000000..33f664bdd4 --- /dev/null +++ b/packages/public/images/background.pattern.lightBlue.react.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/packages/public/images/background.pattern.orange.react.svg b/packages/public/images/background.pattern.orange.react.svg new file mode 100644 index 0000000000..5110b46622 --- /dev/null +++ b/packages/public/images/background.pattern.orange.react.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/packages/public/images/background.pattern.purple.react.svg b/packages/public/images/background.pattern.purple.react.svg new file mode 100644 index 0000000000..418ae5df23 --- /dev/null +++ b/packages/public/images/background.pattern.purple.react.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/packages/public/images/background.pattern.react.svg b/packages/public/images/background.pattern.react.svg new file mode 100644 index 0000000000..989e5d7442 --- /dev/null +++ b/packages/public/images/background.pattern.react.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/packages/public/images/background.pattern.red.react.svg b/packages/public/images/background.pattern.red.react.svg new file mode 100644 index 0000000000..468f7bd2c4 --- /dev/null +++ b/packages/public/images/background.pattern.red.react.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/packages/public/images/catalog.folder.react.svg b/packages/public/images/catalog.folder.react.svg new file mode 100644 index 0000000000..cc1ef29ffc --- /dev/null +++ b/packages/public/images/catalog.folder.react.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/packages/public/images/cross.edit.react.svg b/packages/public/images/cross.edit.react.svg new file mode 100644 index 0000000000..a961c98d3b --- /dev/null +++ b/packages/public/images/cross.edit.react.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/packages/public/images/cross.react.svg b/packages/public/images/cross.react.svg new file mode 100644 index 0000000000..6ab63f380b --- /dev/null +++ b/packages/public/images/cross.react.svg @@ -0,0 +1,3 @@ + + + diff --git a/packages/public/images/document.react.svg b/packages/public/images/document.react.svg new file mode 100644 index 0000000000..b155114e82 --- /dev/null +++ b/packages/public/images/document.react.svg @@ -0,0 +1,3 @@ + + + diff --git a/packages/public/images/download.react.svg b/packages/public/images/download.react.svg new file mode 100644 index 0000000000..d0e7785d54 --- /dev/null +++ b/packages/public/images/download.react.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/packages/public/images/eye.off.react.svg b/packages/public/images/eye.off.react.svg new file mode 100644 index 0000000000..c65e8f2497 --- /dev/null +++ b/packages/public/images/eye.off.react.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/packages/public/images/eye.react.svg b/packages/public/images/eye.react.svg new file mode 100644 index 0000000000..9c0a7c426a --- /dev/null +++ b/packages/public/images/eye.react.svg @@ -0,0 +1,3 @@ + + + diff --git a/packages/public/images/flags/ar-SA.react.svg b/packages/public/images/flags/ar-SA.react.svg new file mode 100644 index 0000000000..3d495caaa6 --- /dev/null +++ b/packages/public/images/flags/ar-SA.react.svg @@ -0,0 +1,4 @@ + + + + diff --git a/packages/public/images/flags/az.react.svg b/packages/public/images/flags/az.react.svg new file mode 100644 index 0000000000..f9b80c8fc2 --- /dev/null +++ b/packages/public/images/flags/az.react.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/public/images/flags/bg.react.svg b/packages/public/images/flags/bg.react.svg new file mode 100644 index 0000000000..d78bc9d44d --- /dev/null +++ b/packages/public/images/flags/bg.react.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/packages/public/images/flags/cs.react.svg b/packages/public/images/flags/cs.react.svg new file mode 100644 index 0000000000..0ae79fb7e8 --- /dev/null +++ b/packages/public/images/flags/cs.react.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/packages/public/images/flags/de-AT.react.svg b/packages/public/images/flags/de-AT.react.svg new file mode 100644 index 0000000000..b4427aa046 --- /dev/null +++ b/packages/public/images/flags/de-AT.react.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/packages/public/images/flags/de-CH.react.svg b/packages/public/images/flags/de-CH.react.svg new file mode 100644 index 0000000000..4169c56afd --- /dev/null +++ b/packages/public/images/flags/de-CH.react.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/packages/public/images/flags/de.react.svg b/packages/public/images/flags/de.react.svg new file mode 100644 index 0000000000..9833047901 --- /dev/null +++ b/packages/public/images/flags/de.react.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/packages/public/images/flags/el-GR.react.svg b/packages/public/images/flags/el-GR.react.svg new file mode 100644 index 0000000000..0cd39701c6 --- /dev/null +++ b/packages/public/images/flags/el-GR.react.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/packages/public/images/flags/en-GB.react.svg b/packages/public/images/flags/en-GB.react.svg new file mode 100644 index 0000000000..ecfd14fdff --- /dev/null +++ b/packages/public/images/flags/en-GB.react.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/packages/public/images/flags/en-US.react.svg b/packages/public/images/flags/en-US.react.svg new file mode 100644 index 0000000000..194ca6cbc5 --- /dev/null +++ b/packages/public/images/flags/en-US.react.svg @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/public/images/flags/es-MX.react.svg b/packages/public/images/flags/es-MX.react.svg new file mode 100644 index 0000000000..a281d56679 --- /dev/null +++ b/packages/public/images/flags/es-MX.react.svg @@ -0,0 +1,387 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/public/images/flags/es.react.svg b/packages/public/images/flags/es.react.svg new file mode 100644 index 0000000000..7b47936490 --- /dev/null +++ b/packages/public/images/flags/es.react.svg @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/public/images/flags/fi.react.svg b/packages/public/images/flags/fi.react.svg new file mode 100644 index 0000000000..827cd8aced --- /dev/null +++ b/packages/public/images/flags/fi.react.svg @@ -0,0 +1,4 @@ + + + + diff --git a/packages/public/images/flags/fr.react.svg b/packages/public/images/flags/fr.react.svg new file mode 100644 index 0000000000..77f768d445 --- /dev/null +++ b/packages/public/images/flags/fr.react.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/packages/public/images/flags/hy-AM.react.svg b/packages/public/images/flags/hy-AM.react.svg new file mode 100644 index 0000000000..ca5197baeb --- /dev/null +++ b/packages/public/images/flags/hy-AM.react.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/packages/public/images/flags/it.react.svg b/packages/public/images/flags/it.react.svg new file mode 100644 index 0000000000..4f8a5b75e1 --- /dev/null +++ b/packages/public/images/flags/it.react.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/packages/public/images/flags/ja-JP.react.svg b/packages/public/images/flags/ja-JP.react.svg new file mode 100644 index 0000000000..c90c22581f --- /dev/null +++ b/packages/public/images/flags/ja-JP.react.svg @@ -0,0 +1,4 @@ + + + + diff --git a/packages/public/images/flags/ko-KR.react.svg b/packages/public/images/flags/ko-KR.react.svg new file mode 100644 index 0000000000..167473ff58 --- /dev/null +++ b/packages/public/images/flags/ko-KR.react.svg @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/public/images/flags/lo-LA.react.svg b/packages/public/images/flags/lo-LA.react.svg new file mode 100644 index 0000000000..30da08a4e9 --- /dev/null +++ b/packages/public/images/flags/lo-LA.react.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/public/images/flags/lv.react.svg b/packages/public/images/flags/lv.react.svg new file mode 100644 index 0000000000..9176cfb92d --- /dev/null +++ b/packages/public/images/flags/lv.react.svg @@ -0,0 +1,4 @@ + + + + diff --git a/packages/public/images/flags/nl.react.svg b/packages/public/images/flags/nl.react.svg new file mode 100644 index 0000000000..f3251f7629 --- /dev/null +++ b/packages/public/images/flags/nl.react.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/packages/public/images/flags/pl.react.svg b/packages/public/images/flags/pl.react.svg new file mode 100644 index 0000000000..6e6ce5585b --- /dev/null +++ b/packages/public/images/flags/pl.react.svg @@ -0,0 +1,4 @@ + + + + diff --git a/packages/public/images/flags/pt-BR.react.svg b/packages/public/images/flags/pt-BR.react.svg new file mode 100644 index 0000000000..5eb57e23aa --- /dev/null +++ b/packages/public/images/flags/pt-BR.react.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/packages/public/images/flags/pt.react.svg b/packages/public/images/flags/pt.react.svg new file mode 100644 index 0000000000..4120b6a158 --- /dev/null +++ b/packages/public/images/flags/pt.react.svg @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/public/images/flags/ro.react.svg b/packages/public/images/flags/ro.react.svg new file mode 100644 index 0000000000..f84646bc4e --- /dev/null +++ b/packages/public/images/flags/ro.react.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/packages/public/images/flags/ru.react.svg b/packages/public/images/flags/ru.react.svg new file mode 100644 index 0000000000..f9fa3c970d --- /dev/null +++ b/packages/public/images/flags/ru.react.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/packages/public/images/flags/si.react.svg b/packages/public/images/flags/si.react.svg new file mode 100644 index 0000000000..f235785230 --- /dev/null +++ b/packages/public/images/flags/si.react.svg @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/public/images/flags/sk.react.svg b/packages/public/images/flags/sk.react.svg new file mode 100644 index 0000000000..91cc397d2c --- /dev/null +++ b/packages/public/images/flags/sk.react.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/packages/public/images/flags/sl.react.svg b/packages/public/images/flags/sl.react.svg new file mode 100644 index 0000000000..c5b07456f2 --- /dev/null +++ b/packages/public/images/flags/sl.react.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/packages/public/images/flags/sr.react.svg b/packages/public/images/flags/sr.react.svg new file mode 100644 index 0000000000..4ba78943e1 --- /dev/null +++ b/packages/public/images/flags/sr.react.svg @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/public/images/flags/tr.react.svg b/packages/public/images/flags/tr.react.svg new file mode 100644 index 0000000000..5755325227 --- /dev/null +++ b/packages/public/images/flags/tr.react.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/packages/public/images/flags/uk-UA.react.svg b/packages/public/images/flags/uk-UA.react.svg new file mode 100644 index 0000000000..e2ece7e433 --- /dev/null +++ b/packages/public/images/flags/uk-UA.react.svg @@ -0,0 +1,4 @@ + + + + diff --git a/packages/public/images/flags/vi.react.svg b/packages/public/images/flags/vi.react.svg new file mode 100644 index 0000000000..50cefb1608 --- /dev/null +++ b/packages/public/images/flags/vi.react.svg @@ -0,0 +1,4 @@ + + + + diff --git a/packages/public/images/flags/zh-CN.react.svg b/packages/public/images/flags/zh-CN.react.svg new file mode 100644 index 0000000000..767808e001 --- /dev/null +++ b/packages/public/images/flags/zh-CN.react.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/packages/public/images/icons/17/cross.react.svg b/packages/public/images/icons/17/cross.react.svg new file mode 100644 index 0000000000..cd087f4c73 --- /dev/null +++ b/packages/public/images/icons/17/cross.react.svg @@ -0,0 +1,3 @@ + + + diff --git a/packages/public/images/icons/24/file.svg b/packages/public/images/icons/24/file.svg new file mode 100644 index 0000000000..856ba11b99 --- /dev/null +++ b/packages/public/images/icons/24/file.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/packages/public/images/info.react.svg b/packages/public/images/info.react.svg new file mode 100644 index 0000000000..96708b568f --- /dev/null +++ b/packages/public/images/info.react.svg @@ -0,0 +1,3 @@ + + + diff --git a/packages/public/images/logo/dark_lightsmall.svg b/packages/public/images/logo/dark_lightsmall.svg new file mode 100644 index 0000000000..16b27c3cec --- /dev/null +++ b/packages/public/images/logo/dark_lightsmall.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/public/images/logo/dark_loginpage.svg b/packages/public/images/logo/dark_loginpage.svg new file mode 100644 index 0000000000..5496225714 --- /dev/null +++ b/packages/public/images/logo/dark_loginpage.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/public/images/logo/docseditor.svg b/packages/public/images/logo/docseditor.svg new file mode 100644 index 0000000000..cf18297bdd --- /dev/null +++ b/packages/public/images/logo/docseditor.svg @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/public/images/logo/docseditorembed.svg b/packages/public/images/logo/docseditorembed.svg new file mode 100644 index 0000000000..e98c69bcc4 --- /dev/null +++ b/packages/public/images/logo/docseditorembed.svg @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/public/images/logo/leftmenu.svg b/packages/public/images/logo/leftmenu.svg new file mode 100644 index 0000000000..e3d7dee1cf --- /dev/null +++ b/packages/public/images/logo/leftmenu.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/packages/public/images/logo/lightsmall.svg b/packages/public/images/logo/lightsmall.svg new file mode 100644 index 0000000000..3e09fc4bc7 --- /dev/null +++ b/packages/public/images/logo/lightsmall.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/public/images/logo/loginpage.svg b/packages/public/images/logo/loginpage.svg new file mode 100644 index 0000000000..6f61c6575f --- /dev/null +++ b/packages/public/images/logo/loginpage.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/public/images/pencil.react.svg b/packages/public/images/pencil.react.svg new file mode 100644 index 0000000000..e50b6b8e6e --- /dev/null +++ b/packages/public/images/pencil.react.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/packages/public/images/refresh.react.svg b/packages/public/images/refresh.react.svg new file mode 100644 index 0000000000..613c98d55b --- /dev/null +++ b/packages/public/images/refresh.react.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/packages/public/images/right.arrow.react.svg b/packages/public/images/right.arrow.react.svg new file mode 100644 index 0000000000..470e18397a --- /dev/null +++ b/packages/public/images/right.arrow.react.svg @@ -0,0 +1,3 @@ + + + diff --git a/packages/public/images/sso.react.svg b/packages/public/images/sso.react.svg new file mode 100644 index 0000000000..aad954d269 --- /dev/null +++ b/packages/public/images/sso.react.svg @@ -0,0 +1,3 @@ + + + diff --git a/packages/shared/__mocks__/e2e/browser.ts b/packages/shared/__mocks__/e2e/browser.ts new file mode 100644 index 0000000000..ddcb45cdd6 --- /dev/null +++ b/packages/shared/__mocks__/e2e/browser.ts @@ -0,0 +1,4 @@ +import { setupWorker } from "msw/browser"; +import handlers from "./handlers"; + +export const worker = setupWorker(...handlers); diff --git a/packages/shared/__mocks__/e2e/capabilities.ts b/packages/shared/__mocks__/e2e/capabilities.ts deleted file mode 100644 index c976190afb..0000000000 --- a/packages/shared/__mocks__/e2e/capabilities.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { http, HttpResponse } from "msw"; - -export const capabilitiesWithSSO = { - response: { - ldapEnabled: false, - providers: [], - ssoLabel: "Single Sign-on", - oauthEnabled: true, - ssoUrl: "http://192.168.0.16/sso/login", - identityServerEnabled: true, - }, - count: 1, - links: [ - { - href: "http://192.168.0.16/api/2.0/capabilities", - action: "GET", - }, - ], - status: 0, - statusCode: 200, -}; - -export default http.get("/api/2.0/capabilities", async () => { - return HttpResponse.json(capabilitiesWithSSO); -}); diff --git a/packages/shared/__mocks__/e2e/handlers/index.ts b/packages/shared/__mocks__/e2e/handlers/index.ts new file mode 100644 index 0000000000..9e89692e56 --- /dev/null +++ b/packages/shared/__mocks__/e2e/handlers/index.ts @@ -0,0 +1,4 @@ +import { logo } from "./logo"; +import settingsHandlers from "./settings"; + +export default [...settingsHandlers, logo]; diff --git a/packages/shared/__mocks__/e2e/handlers/logo.ts b/packages/shared/__mocks__/e2e/handlers/logo.ts new file mode 100644 index 0000000000..8b75de9565 --- /dev/null +++ b/packages/shared/__mocks__/e2e/handlers/logo.ts @@ -0,0 +1,20 @@ +import { http, HttpResponse } from "msw"; + +import LogoTestSvgUrl from "PUBLIC_DIR/images/logo/loginpage.svg?url"; + +import { BASE_URL } from "../utils"; + +const PATH = "logo.ashx"; + +const url = `${BASE_URL}:5111/${PATH}`; + +export const logo = http.get(url, ({ request }) => { + const reqUrl = new URL(request.url); + + const logoType = reqUrl.searchParams.get("logotype"); + const dark = reqUrl.searchParams.get("dark"); + const defaultParam = reqUrl.searchParams.get("default"); + const culture = reqUrl.searchParams.get("culture"); + + return HttpResponse.json(LogoTestSvgUrl); +}); diff --git a/packages/shared/__mocks__/e2e/handlers/settings/colorTheme.ts b/packages/shared/__mocks__/e2e/handlers/settings/colorTheme.ts new file mode 100644 index 0000000000..3946549e2f --- /dev/null +++ b/packages/shared/__mocks__/e2e/handlers/settings/colorTheme.ts @@ -0,0 +1,97 @@ +import { http, HttpResponse } from "msw"; + +import { API_PREFIX, BASE_URL } from "../../utils"; + +const PATH = "settings/colortheme"; + +export const colorTheme = http.get(`${BASE_URL}/${API_PREFIX}/${PATH}`, () => { + return HttpResponse.json({ + response: { + themes: [ + { + id: 1, + name: "blue", + main: { + accent: "#4781D1", + buttons: "#5299E0", + }, + text: { + accent: "#FFFFFF", + buttons: "#FFFFFF", + }, + }, + { + id: 2, + name: "orange", + main: { + accent: "#F97A0B", + buttons: "#FF9933", + }, + text: { + accent: "#FFFFFF", + buttons: "#FFFFFF", + }, + }, + { + id: 3, + name: "green", + main: { + accent: "#2DB482", + buttons: "#22C386", + }, + text: { + accent: "#FFFFFF", + buttons: "#FFFFFF", + }, + }, + { + id: 4, + name: "red", + main: { + accent: "#F2675A", + buttons: "#F27564", + }, + text: { + accent: "#FFFFFF", + buttons: "#FFFFFF", + }, + }, + { + id: 5, + name: "purple", + main: { + accent: "#6D4EC2", + buttons: "#8570BD", + }, + text: { + accent: "#FFFFFF", + buttons: "#FFFFFF", + }, + }, + { + id: 6, + name: "light-blue", + main: { + accent: "#11A4D4", + buttons: "#13B7EC", + }, + text: { + accent: "#FFFFFF", + buttons: "#FFFFFF", + }, + }, + ], + selected: 1, + limit: 9, + }, + count: 1, + links: [ + { + href: `${BASE_URL}/${API_PREFIX}/${PATH}`, + action: "GET", + }, + ], + status: 0, + ok: true, + }); +}); diff --git a/packages/shared/__mocks__/e2e/handlers/settings/index.ts b/packages/shared/__mocks__/e2e/handlers/settings/index.ts new file mode 100644 index 0000000000..9189f1b882 --- /dev/null +++ b/packages/shared/__mocks__/e2e/handlers/settings/index.ts @@ -0,0 +1,19 @@ +import { colorTheme } from "./colorTheme"; +import { licenseRequired } from "./licenseRequired"; +import { machineName } from "./machineName"; +import { portalCultures } from "./portalCultures"; +import { portalPasswordSettings } from "./portalPasswordSettings"; +import { portalTimeZone } from "./portalTimeZones"; +import { settings } from "./settings"; + +const settingsHandlers = [ + settings, + colorTheme, + licenseRequired, + machineName, + portalCultures, + portalPasswordSettings, + portalTimeZone, +]; + +export default settingsHandlers; diff --git a/packages/shared/__mocks__/e2e/handlers/settings/licenseRequired.ts b/packages/shared/__mocks__/e2e/handlers/settings/licenseRequired.ts new file mode 100644 index 0000000000..a4a0d3e8ac --- /dev/null +++ b/packages/shared/__mocks__/e2e/handlers/settings/licenseRequired.ts @@ -0,0 +1,24 @@ +import { http, HttpResponse } from "msw"; + +import { API_PREFIX, BASE_URL } from "../../utils"; + +const PATH = "settings/license/required"; + +const url = `${BASE_URL}/${API_PREFIX}/${PATH}`; + +export const licenseRequired = http.get(url, ({ cookies }) => { + const isRequired = cookies.license_required; + return HttpResponse.json({ + response: !!isRequired, + count: 1, + links: [ + { + href: url, + action: "GET", + }, + ], + status: 0, + statusCode: 200, + ok: true, + }); +}); diff --git a/packages/shared/__mocks__/e2e/handlers/settings/machineName.ts b/packages/shared/__mocks__/e2e/handlers/settings/machineName.ts new file mode 100644 index 0000000000..3ca4248db5 --- /dev/null +++ b/packages/shared/__mocks__/e2e/handlers/settings/machineName.ts @@ -0,0 +1,23 @@ +import { http, HttpResponse } from "msw"; + +import { API_PREFIX, BASE_URL } from "../../utils"; + +const PATH = "settings/machine"; + +const url = `${BASE_URL}/${API_PREFIX}/${PATH}`; + +export const machineName = http.get(url, () => { + return HttpResponse.json({ + response: "127.0.0.1", + count: 1, + links: [ + { + href: url, + action: "GET", + }, + ], + status: 0, + statusCode: 200, + ok: true, + }); +}); diff --git a/packages/shared/__mocks__/e2e/handlers/settings/portalCultures.ts b/packages/shared/__mocks__/e2e/handlers/settings/portalCultures.ts new file mode 100644 index 0000000000..020bd5b705 --- /dev/null +++ b/packages/shared/__mocks__/e2e/handlers/settings/portalCultures.ts @@ -0,0 +1,56 @@ +import { http, HttpResponse } from "msw"; + +import { API_PREFIX, BASE_URL } from "../../utils"; + +const PATH = "settings/cultures"; + +const url = `${BASE_URL}/${API_PREFIX}/${PATH}`; + +export const portalCultures = http.get(url, () => { + return HttpResponse.json({ + response: [ + "az", + "cs", + "de", + "en-GB", + "en-US", + "es", + "fr", + "it", + "lv", + "nl", + "pl", + "pt-BR", + "pt", + "ro", + "sk", + "sl", + "fi", + "vi", + "tr", + "el-GR", + "bg", + "ru", + "sr-Cyrl-RS", + "sr-Latn-RS", + "uk-UA", + "hy-AM", + "ar-SA", + "si", + "lo-LA", + "zh-CN", + "ja-JP", + "ko-KR", + ], + count: 32, + links: [ + { + href: url, + action: "GET", + }, + ], + status: 0, + statusCode: 200, + ok: true, + }); +}); diff --git a/packages/shared/__mocks__/e2e/handlers/settings/portalPasswordSettings.ts b/packages/shared/__mocks__/e2e/handlers/settings/portalPasswordSettings.ts new file mode 100644 index 0000000000..dd153ae47a --- /dev/null +++ b/packages/shared/__mocks__/e2e/handlers/settings/portalPasswordSettings.ts @@ -0,0 +1,33 @@ +import { http, HttpResponse } from "msw"; + +import { API_PREFIX, BASE_URL } from "../../utils"; + +const PATH = "settings/security/password"; + +const url = `${BASE_URL}/${API_PREFIX}/${PATH}`; + +export const portalPasswordSettings = http.get(url, () => { + return HttpResponse.json({ + response: { + minLength: 8, + upperCase: false, + digits: false, + specSymbols: false, + allowedCharactersRegexStr: "[\\x21-\\x7E]", + digitsRegexStr: "(?=.*\\d)", + upperCaseRegexStr: "(?=.*[A-Z])", + specSymbolsRegexStr: + "(?=.*[\\x21-\\x2F\\x3A-\\x40\\x5B-\\x60\\x7B-\\x7E])", + }, + count: 1, + links: [ + { + href: url, + action: "GET", + }, + ], + status: 0, + statusCode: 200, + ok: true, + }); +}); diff --git a/packages/shared/__mocks__/e2e/handlers/settings/portalTimeZones.ts b/packages/shared/__mocks__/e2e/handlers/settings/portalTimeZones.ts new file mode 100644 index 0000000000..ea339f2b6b --- /dev/null +++ b/packages/shared/__mocks__/e2e/handlers/settings/portalTimeZones.ts @@ -0,0 +1,64 @@ +import { http, HttpResponse } from "msw"; + +import { API_PREFIX, BASE_URL } from "../../utils"; + +const PATH = "settings/timezones"; + +const url = `${BASE_URL}/${API_PREFIX}/${PATH}`; + +export const portalTimeZone = http.get(url, () => { + return HttpResponse.json({ + response: [ + { + id: "Pacific/Niue", + displayName: "(UTC-11:00) Niue Time", + }, + { + id: "Pacific/Midway", + displayName: "(UTC-11:00) Samoa Standard Time (Midway)", + }, + { + id: "Pacific/Pago_Pago", + displayName: "(UTC-11:00) Samoa Standard Time (Pago Pago)", + }, + { + id: "Pacific/Rarotonga", + displayName: "(UTC-10:00) Cook Islands Standard Time (Rarotonga)", + }, + { + id: "America/Adak", + displayName: "(UTC-10:00) Hawaii-Aleutian Time (Adak)", + }, + { + id: "Pacific/Honolulu", + displayName: "(UTC-10:00) Hawaii-Aleutian Time (Adak) (Honolulu)", + }, + { + id: "Pacific/Tahiti", + displayName: "(UTC-10:00) Tahiti Time", + }, + { + id: "Pacific/Marquesas", + displayName: "(UTC-09:30) Marquesas Time", + }, + { + id: "America/Anchorage", + displayName: "(UTC-09:00) Alaska Time (Anchorage)", + }, + { + id: "America/Juneau", + displayName: "(UTC-09:00) Alaska Time (Juneau)", + }, + ], + count: 10, + links: [ + { + href: url, + action: "GET", + }, + ], + status: 0, + statusCode: 200, + ok: true, + }); +}); diff --git a/packages/shared/__mocks__/e2e/handlers/settings/settings.ts b/packages/shared/__mocks__/e2e/handlers/settings/settings.ts new file mode 100644 index 0000000000..c69e48b6fe --- /dev/null +++ b/packages/shared/__mocks__/e2e/handlers/settings/settings.ts @@ -0,0 +1,290 @@ +import { http, HttpResponse } from "msw"; + +import { API_PREFIX, BASE_URL } from "../../utils"; + +const PATH = "settings"; + +const url = `${BASE_URL}/${API_PREFIX}/${PATH}`; + +export const settings = http.get(url, ({ request, cookies }) => { + const reqUrl = new URL(request.url); + + const withPasswordParam = reqUrl.searchParams.get("withPassword"); + + const withPassword = withPasswordParam ? withPasswordParam === "true" : false; + const isAuth = cookies.asc_auth_key; + const isWizard = cookies.is_wizard; + const isForbidden = cookies.settings_forbidden; + const isNotFound = cookies.settings_not_found; + const isError = cookies.settings_error; + + // TODO add error message + if (isError) return HttpResponse.json(null, { status: 500 }); + + // TODO add error message + if (isNotFound) return HttpResponse.json(null, { status: 404 }); + + // TODO add error message + if (isForbidden) return HttpResponse.json(null, { status: 403 }); + + if (isWizard) + return HttpResponse.json({ + response: { + trustedDomainsType: 0, + culture: "en-US", + utcOffset: "00:00:00", + utcHoursOffset: 0, + greetingSettings: "Web Office", + ownerId: "00000000-0000-0000-0000-000000000000", + enabledJoin: false, + enableAdmMess: false, + thirdpartyEnable: false, + docSpace: true, + standalone: true, + baseDomain: BASE_URL, + wizardToken: + "type=Wizard&key=462096722976.4OD9HUTNJZGBFMMPVOTCBNOVCPGLTBKUNPKGCNY&uid=66faa6e4-f133-11ea-b126-00ffeec8b4ef", + passwordHash: { + size: 256, + iterations: 100000, + salt: "4d9abe238e2f7b14a30a4565d62214a795a15abb798ed61118a69820d6a6146c", + }, + version: ".", + recaptchaType: 0, + recaptchaPublicKey: "", + debugInfo: false, + tenantStatus: 0, + tenantAlias: "localhost", + forumLink: "https://forum.onlyoffice.com", + legalTerms: + "https://help.onlyoffice.co/products/files/doceditor.aspx?fileid=5048502&doc=SXhWMEVzSEYxNlVVaXJJeUVtS0kyYk14YWdXTEFUQmRWL250NllHNUFGbz0_IjUwNDg1MDIi0", + cookieSettingsEnabled: false, + limitedAccessSpace: false, + userNameRegex: "^[\\p{L}\\p{M}' \\-]+$", + maxImageUploadSize: 0, + }, + count: 1, + links: [ + { + href: url, + action: "GET", + }, + ], + status: 0, + statusCode: 200, + ok: true, + }); + + if (!isAuth) + return HttpResponse.json({ + response: { + trustedDomainsType: 0, + culture: "en-GB", + utcOffset: "00:00:00", + utcHoursOffset: 0, + greetingSettings: "Web Office", + ownerId: "00000000-0000-0000-0000-000000000000", + enabledJoin: false, + enableAdmMess: false, + thirdpartyEnable: false, + docSpace: true, + standalone: true, + baseDomain: BASE_URL, + passwordHash: { + size: 256, + iterations: 100000, + salt: "4d9abe238e2f7b14a30a4565d62214a795a15abb798ed61118a69820d6a6146c", + }, + version: ".", + recaptchaType: 0, + recaptchaPublicKey: "", + debugInfo: false, + tenantStatus: 0, + tenantAlias: "localhost", + forumLink: "https://forum.onlyoffice.com", + legalTerms: + "https://help.onlyoffice.co/products/files/doceditor.aspx?fileid=5048502&doc=SXhWMEVzSEYxNlVVaXJJeUVtS0kyYk14YWdXTEFUQmRWL250NllHNUFGbz0_IjUwNDg1MDIi0", + cookieSettingsEnabled: false, + limitedAccessSpace: false, + userNameRegex: "^[\\p{L}\\p{M}' \\-]+$", + maxImageUploadSize: 0, + }, + count: 1, + links: [ + { + href: url, + action: "GET", + }, + ], + status: 0, + statusCode: 200, + }); + + if (withPassword) + return HttpResponse.json({ + response: { + timezone: "Asia/Tbilisi", + trustedDomains: [], + trustedDomainsType: 1, + culture: "ru", + utcOffset: "04:00:00", + utcHoursOffset: 4, + greetingSettings: "Web Office", + ownerId: "66faa6e4-f133-11ea-b126-00ffeec8b4ef", + nameSchemaId: "Common", + enableAdmMess: false, + docSpace: true, + standalone: true, + baseDomain: BASE_URL, + passwordHash: { + size: 256, + iterations: 100000, + salt: "4d9abe238e2f7b14a30a4565d62214a795a15abb798ed61118a69820d6a6146c", + }, + firebase: { + apiKey: "", + authDomain: "", + projectId: "", + storageBucket: "", + messagingSenderId: "", + appId: "", + measurementId: "", + databaseURL: "", + }, + version: ".", + recaptchaType: 0, + debugInfo: false, + socketUrl: "/socket.io", + tenantStatus: 0, + tenantAlias: "localhost", + helpLink: "https://helpcenter.onlyoffice.com", + forumLink: "https://forum.onlyoffice.com", + apiDocsLink: "https://api.onlyoffice.com", + domainValidator: { + regex: "^[a-z0-9]([a-z0-9-]){1,61}[a-z0-9]$", + minLength: 3, + maxLength: 63, + }, + zendeskKey: "", + tagManagerId: "", + bookTrainingEmail: "training@onlyoffice.com", + documentationEmail: "documentation@onlyoffice.com", + legalTerms: + "https://help.onlyoffice.co/products/files/doceditor.aspx?fileid=5048502&doc=SXhWMEVzSEYxNlVVaXJJeUVtS0kyYk14YWdXTEFUQmRWL250NllHNUFGbz0_IjUwNDg1MDIi0", + cookieSettingsEnabled: false, + limitedAccessSpace: false, + userNameRegex: "^[\\p{L}\\p{M}' \\-]+$", + invitationLimit: 2147483647, + plugins: { + enabled: true, + upload: true, + delete: true, + }, + deepLink: { + androidPackageName: "com.onlyoffice.documents", + url: "oodocuments://openfile", + iosPackageId: "944896972", + }, + formGallery: { + path: "/api/oforms/", + domain: "https://cmsoforms.teamlab.info", + ext: ".pdf", + uploadPath: "/api/upload", + uploadDomain: "https://oforms.teamlab.info", + uploadExt: ".pdf", + uploadDashboard: "/dashboard/api", + }, + maxImageUploadSize: 5242880, + }, + count: 1, + links: [ + { + href: url, + action: "GET", + }, + ], + status: 0, + statusCode: 200, + }); + + return HttpResponse.json({ + response: { + timezone: "Asia/Tbilisi", + trustedDomains: [], + trustedDomainsType: 1, + culture: "ru", + utcOffset: "04:00:00", + utcHoursOffset: 4, + greetingSettings: "Web Office", + ownerId: "66faa6e4-f133-11ea-b126-00ffeec8b4ef", + nameSchemaId: "Common", + enableAdmMess: false, + docSpace: true, + standalone: true, + baseDomain: BASE_URL, + firebase: { + apiKey: "", + authDomain: "", + projectId: "", + storageBucket: "", + messagingSenderId: "", + appId: "", + measurementId: "", + databaseURL: "", + }, + version: ".", + recaptchaType: 0, + debugInfo: false, + socketUrl: "/socket.io", + tenantStatus: 0, + tenantAlias: "localhost", + helpLink: "https://helpcenter.onlyoffice.com", + forumLink: "https://forum.onlyoffice.com", + apiDocsLink: "https://api.onlyoffice.com", + domainValidator: { + regex: "^[a-z0-9]([a-z0-9-]){1,61}[a-z0-9]$", + minLength: 3, + maxLength: 63, + }, + zendeskKey: "", + tagManagerId: "", + bookTrainingEmail: "training@onlyoffice.com", + documentationEmail: "documentation@onlyoffice.com", + legalTerms: + "https://help.onlyoffice.co/products/files/doceditor.aspx?fileid=5048502&doc=SXhWMEVzSEYxNlVVaXJJeUVtS0kyYk14YWdXTEFUQmRWL250NllHNUFGbz0_IjUwNDg1MDIi0", + cookieSettingsEnabled: false, + limitedAccessSpace: false, + userNameRegex: "^[\\p{L}\\p{M}' \\-]+$", + invitationLimit: 2147483647, + plugins: { + enabled: true, + upload: true, + delete: true, + }, + deepLink: { + androidPackageName: "com.onlyoffice.documents", + url: "oodocuments://openfile", + iosPackageId: "944896972", + }, + formGallery: { + path: "/api/oforms/", + domain: "https://cmsoforms.teamlab.info", + ext: ".pdf", + uploadPath: "/api/upload", + uploadDomain: "https://oforms.teamlab.info", + uploadExt: ".pdf", + uploadDashboard: "/dashboard/api", + }, + maxImageUploadSize: 5242880, + }, + count: 1, + links: [ + { + href: url, + action: "GET", + }, + ], + status: 0, + statusCode: 200, + }); +}); diff --git a/packages/shared/__mocks__/e2e/index.ts b/packages/shared/__mocks__/e2e/index.ts index db595e1ec3..b524c819fd 100644 --- a/packages/shared/__mocks__/e2e/index.ts +++ b/packages/shared/__mocks__/e2e/index.ts @@ -1,28 +1,5 @@ -import getMockSettingsResponse, { - settingsSuccessNoAuth, - settingsError, - settingsForbidden, - settingsNotFound, - settingsSuccessNoAuthWizard, - settingsPasswordSuccess, - machineNameSuccess, - isLicenseRequiredSuccess, - portalTimeZonesSuccess, - portalCulturesSuccess, - colorThemeSuccess, -} from "./settings"; +import { BASE_URL } from "./utils"; +import handlers from "./handlers"; +import { MSWProvider } from "./msw-provider"; -export { - getMockSettingsResponse, - settingsSuccessNoAuth, - settingsError, - settingsForbidden, - settingsNotFound, - settingsSuccessNoAuthWizard, - settingsPasswordSuccess, - machineNameSuccess, - isLicenseRequiredSuccess, - portalTimeZonesSuccess, - portalCulturesSuccess, - colorThemeSuccess, -}; +export { BASE_URL, handlers, MSWProvider }; diff --git a/packages/shared/__mocks__/e2e/msw-provider.tsx b/packages/shared/__mocks__/e2e/msw-provider.tsx new file mode 100644 index 0000000000..cda13a1b5a --- /dev/null +++ b/packages/shared/__mocks__/e2e/msw-provider.tsx @@ -0,0 +1,54 @@ +/* eslint-disable import/extensions */ +/* eslint-disable @typescript-eslint/no-var-requires */ +/* eslint-disable global-require */ + +"use client"; + +import { Suspense, useEffect, useState } from "react"; + +let mockingPromise: Promise | undefined; + +// if we're running in the browser, start the worker +if (typeof window !== "undefined") { + const { worker } = require("./browser"); + mockingPromise = worker.start({ + serviceWorker: { + // This is useful if your application follows + // a strict directory structure. + url: "/login/mockServiceWorker.js", + }, + }); +} + +function MSWProviderWrapper({ + children, +}: Readonly<{ + children: React.ReactNode; +}>) { + const [isPromiseComplete, setIsPromiseComplete] = useState(false); + + useEffect(() => { + if (mockingPromise) + mockingPromise!.then(() => { + setIsPromiseComplete(true); + }); + }, []); + + if (isPromiseComplete) return children; + + return null; +} + +export function MSWProvider({ + children, +}: Readonly<{ + children: React.ReactNode; +}>) { + // if MSW is enabled, we need to wait for the worker to start, so we wrap the + // children in a Suspense boundary until the worker is ready + return ( + + {children} + + ); +} diff --git a/packages/shared/__mocks__/e2e/node.ts b/packages/shared/__mocks__/e2e/node.ts new file mode 100644 index 0000000000..764ff92749 --- /dev/null +++ b/packages/shared/__mocks__/e2e/node.ts @@ -0,0 +1,4 @@ +import { setupServer } from "msw/node"; +import handlers from "./handlers"; + +export const server = setupServer(...handlers); diff --git a/packages/shared/__mocks__/e2e/settings.ts b/packages/shared/__mocks__/e2e/settings.ts deleted file mode 100644 index 4ba8dff90c..0000000000 --- a/packages/shared/__mocks__/e2e/settings.ts +++ /dev/null @@ -1,356 +0,0 @@ -export const settingsSuccessNoAuth = new Response( - JSON.stringify({ - response: { - trustedDomainsType: 0, - culture: "en-GB", - utcOffset: "00:00:00", - utcHoursOffset: 0, - greetingSettings: "Web Office", - ownerId: "00000000-0000-0000-0000-000000000000", - enabledJoin: false, - enableAdmMess: false, - thirdpartyEnable: false, - docSpace: true, - standalone: true, - baseDomain: "localhost", - passwordHash: { - size: 256, - iterations: 100000, - salt: "4d9abe238e2f7b14a30a4565d62214a795a15abb798ed61118a69820d6a6146c", - }, - version: ".", - recaptchaType: 0, - recaptchaPublicKey: "", - debugInfo: false, - tenantStatus: 0, - tenantAlias: "localhost", - forumLink: "https://forum.onlyoffice.com", - legalTerms: - "https://help.onlyoffice.co/products/files/doceditor.aspx?fileid=5048502&doc=SXhWMEVzSEYxNlVVaXJJeUVtS0kyYk14YWdXTEFUQmRWL250NllHNUFGbz0_IjUwNDg1MDIi0", - cookieSettingsEnabled: false, - limitedAccessSpace: false, - userNameRegex: "^[\\p{L}\\p{M}' \\-]+$", - maxImageUploadSize: 0, - }, - count: 1, - links: [ - { - href: "http://192.168.0.16/api/2.0/settings?withPassword=false", - action: "GET", - }, - ], - status: 0, - statusCode: 200, - }), - { status: 200 }, -); - -export const settingsSuccessNoAuthWizard = { - response: { - trustedDomainsType: 0, - culture: "en-US", - utcOffset: "00:00:00", - utcHoursOffset: 0, - greetingSettings: "Web Office", - ownerId: "00000000-0000-0000-0000-000000000000", - enabledJoin: false, - enableAdmMess: false, - thirdpartyEnable: false, - docSpace: true, - standalone: true, - baseDomain: "localhost", - wizardToken: - "type=Wizard&key=462096722976.4OD9HUTNJZGBFMMPVOTCBNOVCPGLTBKUNPKGCNY&uid=66faa6e4-f133-11ea-b126-00ffeec8b4ef", - passwordHash: { - size: 256, - iterations: 100000, - salt: "4d9abe238e2f7b14a30a4565d62214a795a15abb798ed61118a69820d6a6146c", - }, - version: ".", - recaptchaType: 0, - recaptchaPublicKey: "", - debugInfo: false, - tenantStatus: 0, - tenantAlias: "localhost", - forumLink: "https://forum.onlyoffice.com", - legalTerms: - "https://help.onlyoffice.co/products/files/doceditor.aspx?fileid=5048502&doc=SXhWMEVzSEYxNlVVaXJJeUVtS0kyYk14YWdXTEFUQmRWL250NllHNUFGbz0_IjUwNDg1MDIi0", - cookieSettingsEnabled: false, - limitedAccessSpace: false, - userNameRegex: "^[\\p{L}\\p{M}' \\-]+$", - maxImageUploadSize: 0, - }, - count: 1, - links: [ - { - href: "http://192.168.50.219/api/2.0/settings?withPassword=true", - action: "GET", - }, - ], - status: 0, - statusCode: 200, - ok: true, -}; - -export const settingsPasswordSuccess = { - response: { - minLength: 8, - upperCase: false, - digits: false, - specSymbols: false, - allowedCharactersRegexStr: "[\\x21-\\x7E]", - digitsRegexStr: "(?=.*\\d)", - upperCaseRegexStr: "(?=.*[A-Z])", - specSymbolsRegexStr: "(?=.*[\\x21-\\x2F\\x3A-\\x40\\x5B-\\x60\\x7B-\\x7E])", - }, - count: 1, - links: [ - { - href: "http://192.168.50.219/api/2.0/settings/security/password", - action: "GET", - }, - ], - status: 0, - statusCode: 200, - ok: true, -}; - -export const machineNameSuccess = { - response: "192.168.50.219", - count: 1, - links: [ - { - href: "http://192.168.50.219/api/2.0/settings/machine", - action: "GET", - }, - ], - status: 0, - statusCode: 200, - ok: true, -}; - -export const isLicenseRequiredSuccess = { - response: false, - count: 1, - links: [ - { - href: "http://192.168.50.219/api/2.0/settings/license/required", - action: "GET", - }, - ], - status: 0, - statusCode: 200, - ok: true, -}; - -export const portalTimeZonesSuccess = { - response: [ - { - id: "Pacific/Niue", - displayName: "(UTC-11:00) Niue Time", - }, - { - id: "Pacific/Midway", - displayName: "(UTC-11:00) Samoa Standard Time (Midway)", - }, - { - id: "Pacific/Pago_Pago", - displayName: "(UTC-11:00) Samoa Standard Time (Pago Pago)", - }, - { - id: "Pacific/Rarotonga", - displayName: "(UTC-10:00) Cook Islands Standard Time (Rarotonga)", - }, - { - id: "America/Adak", - displayName: "(UTC-10:00) Hawaii-Aleutian Time (Adak)", - }, - { - id: "Pacific/Honolulu", - displayName: "(UTC-10:00) Hawaii-Aleutian Time (Adak) (Honolulu)", - }, - { - id: "Pacific/Tahiti", - displayName: "(UTC-10:00) Tahiti Time", - }, - { - id: "Pacific/Marquesas", - displayName: "(UTC-09:30) Marquesas Time", - }, - { - id: "America/Anchorage", - displayName: "(UTC-09:00) Alaska Time (Anchorage)", - }, - { - id: "America/Juneau", - displayName: "(UTC-09:00) Alaska Time (Juneau)", - }, - ], - count: 10, - links: [ - { - href: "http://192.168.50.219/api/2.0/settings/timezones", - action: "GET", - }, - ], - status: 0, - statusCode: 200, - ok: true, -}; - -export const portalCulturesSuccess = { - response: [ - "az", - "cs", - "de", - "en-GB", - "en-US", - "es", - "fr", - "it", - "lv", - "nl", - "pl", - "pt-BR", - "pt", - "ro", - "sk", - "sl", - "fi", - "vi", - "tr", - "el-GR", - "bg", - "ru", - "sr-Cyrl-RS", - "sr-Latn-RS", - "uk-UA", - "hy-AM", - "ar-SA", - "si", - "lo-LA", - "zh-CN", - "ja-JP", - "ko-KR", - ], - count: 32, - links: [ - { - href: "http://192.168.50.219/api/2.0/settings/cultures", - action: "GET", - }, - ], - status: 0, - statusCode: 200, - ok: true, -}; - -export const colorThemeSuccess = { - response: { - themes: [ - { - id: 1, - name: "blue", - main: { - accent: "#4781D1", - buttons: "#5299E0", - }, - text: { - accent: "#FFFFFF", - buttons: "#FFFFFF", - }, - }, - { - id: 2, - name: "orange", - main: { - accent: "#F97A0B", - buttons: "#FF9933", - }, - text: { - accent: "#FFFFFF", - buttons: "#FFFFFF", - }, - }, - { - id: 3, - name: "green", - main: { - accent: "#2DB482", - buttons: "#22C386", - }, - text: { - accent: "#FFFFFF", - buttons: "#FFFFFF", - }, - }, - { - id: 4, - name: "red", - main: { - accent: "#F2675A", - buttons: "#F27564", - }, - text: { - accent: "#FFFFFF", - buttons: "#FFFFFF", - }, - }, - { - id: 5, - name: "purple", - main: { - accent: "#6D4EC2", - buttons: "#8570BD", - }, - text: { - accent: "#FFFFFF", - buttons: "#FFFFFF", - }, - }, - { - id: 6, - name: "light-blue", - main: { - accent: "#11A4D4", - buttons: "#13B7EC", - }, - text: { - accent: "#FFFFFF", - buttons: "#FFFFFF", - }, - }, - ], - selected: 1, - limit: 9, - }, - count: 1, - links: [ - { - href: "http://192.168.50.219/api/2.0/settings/colortheme", - action: "GET", - }, - ], - status: 0, - ok: true, -}; - -export const settingsForbidden = new Response(null, { status: 403 }); - -export const settingsNotFound = new Response(null, { status: 404 }); - -export const settingsError = new Response(null, { status: 500 }); - -const getMockSettingsResponse = (withPassword: boolean): Response => { - if (!withPassword) return settingsSuccessNoAuth; - - return settingsSuccessNoAuth; -}; - -export const getMockResponse = (response: any): Response => { - return new Response(JSON.stringify(response), { - status: 200, - }); -}; - -export default getMockSettingsResponse; diff --git a/packages/shared/__mocks__/e2e/utils.ts b/packages/shared/__mocks__/e2e/utils.ts new file mode 100644 index 0000000000..56611f812c --- /dev/null +++ b/packages/shared/__mocks__/e2e/utils.ts @@ -0,0 +1,3 @@ +export const BASE_URL = "https://api.example.com"; + +export const API_PREFIX = "api/2.0"; diff --git a/packages/shared/package.json b/packages/shared/package.json index 431dd79049..fa56bd4081 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -117,7 +117,7 @@ "@types/jest": "^29.5.10", "@types/lodash": "^4.14.202", "@types/luxon": "^3.3.1", - "@types/node": "^20.9.4", + "@types/node": "^22.5.1", "@types/react": "^18.2.53", "@types/react-avatar-editor": "^13.0.2", "@types/react-transition-group": "^4.4.9", @@ -155,6 +155,7 @@ "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0", "jest-styled-components": "^7.2.0", + "msw": "^2.0.14", "postcss": "^7.0.39", "prettier": "^3.1.0", "react-docgen-typescript-plugin": "^1.0.5", diff --git a/packages/shared/utils/common.ts b/packages/shared/utils/common.ts index 4397fec8b6..96ea171e4e 100644 --- a/packages/shared/utils/common.ts +++ b/packages/shared/utils/common.ts @@ -1144,6 +1144,7 @@ export function getLogoUrl( def: boolean = false, culture?: string, ) { + return ""; return `/logo.ashx?logotype=${logoType}&dark=${dark}&default=${def}${culture ? `&culture=${culture}` : ""}`; } diff --git a/packages/shared/utils/next-ssr-helper.ts b/packages/shared/utils/next-ssr-helper.ts index 241978b096..cddf056f3e 100644 --- a/packages/shared/utils/next-ssr-helper.ts +++ b/packages/shared/utils/next-ssr-helper.ts @@ -1,3 +1,5 @@ +/* eslint-disable @typescript-eslint/no-var-requires */ +/* eslint-disable global-require */ // (c) Copyright Ascensio System SIA 2009-2024 // // This program is a free software product. diff --git a/yarn.lock b/yarn.lock index c210b6e1f4..95d0f289d4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2186,6 +2186,34 @@ __metadata: languageName: node linkType: hard +"@bundled-es-modules/cookie@npm:^2.0.0": + version: 2.0.0 + resolution: "@bundled-es-modules/cookie@npm:2.0.0" + dependencies: + cookie: "npm:^0.5.0" + checksum: 10/c8ef02aa5d3f6c786cfa407e1c93b4af29c600eb09990973f47a7a49e4771c1bec37c8f8e567638bb9cbc41f4e38d065ff1d8eaf9bf91f0c3613a6d60bc82c8c + languageName: node + linkType: hard + +"@bundled-es-modules/statuses@npm:^1.0.1": + version: 1.0.1 + resolution: "@bundled-es-modules/statuses@npm:1.0.1" + dependencies: + statuses: "npm:^2.0.1" + checksum: 10/9bf6a2bcf040a66fb805da0e1446041fd9def7468bb5da29c5ce02adf121a3f7cec123664308059a62a46fcaee666add83094b76df6dce72e5cafa8e6bebe60d + languageName: node + linkType: hard + +"@bundled-es-modules/tough-cookie@npm:^0.1.6": + version: 0.1.6 + resolution: "@bundled-es-modules/tough-cookie@npm:0.1.6" + dependencies: + "@types/tough-cookie": "npm:^4.0.5" + tough-cookie: "npm:^4.1.4" + checksum: 10/4f24a820f02c08c3ca0ff21272317357152093f76f9c8cc182517f61fa426ae53dadc4d68a3d6da5078e8d73f0ff8c0907a9f994c0be756162ba9c7358533e57 + languageName: node + linkType: hard + "@codemirror/autocomplete@npm:^0.19.0": version: 0.19.15 resolution: "@codemirror/autocomplete@npm:0.19.15" @@ -2879,7 +2907,7 @@ __metadata: "@types/jest": "npm:^29.5.10" "@types/lodash": "npm:^4.14.202" "@types/luxon": "npm:^3.3.1" - "@types/node": "npm:^20.9.4" + "@types/node": "npm:^22.5.1" "@types/react": "npm:^18.2.53" "@types/react-avatar-editor": "npm:^13.0.2" "@types/react-transition-group": "npm:^4.4.9" @@ -2936,6 +2964,7 @@ __metadata: mobx-react: "npm:^7.6.0" moment: "npm:^2.29.4" moment-timezone: "npm:^0.5.43" + msw: "npm:^2.0.14" postcss: "npm:^7.0.39" prettier: "npm:^3.1.0" prop-types: "npm:^15.8.1" @@ -4124,6 +4153,53 @@ __metadata: languageName: node linkType: hard +"@inquirer/confirm@npm:^3.0.0": + version: 3.1.22 + resolution: "@inquirer/confirm@npm:3.1.22" + dependencies: + "@inquirer/core": "npm:^9.0.10" + "@inquirer/type": "npm:^1.5.2" + checksum: 10/14e547ae3194c6447d41bb87135c03aa5598fd340fced19e4e8bae1be4ae54a9ad3cf335a9c3c6dc54e2ffb7928319e0f4b428531b8ce720cd23d2444292ca36 + languageName: node + linkType: hard + +"@inquirer/core@npm:^9.0.10": + version: 9.0.10 + resolution: "@inquirer/core@npm:9.0.10" + dependencies: + "@inquirer/figures": "npm:^1.0.5" + "@inquirer/type": "npm:^1.5.2" + "@types/mute-stream": "npm:^0.0.4" + "@types/node": "npm:^22.1.0" + "@types/wrap-ansi": "npm:^3.0.0" + ansi-escapes: "npm:^4.3.2" + cli-spinners: "npm:^2.9.2" + cli-width: "npm:^4.1.0" + mute-stream: "npm:^1.0.0" + signal-exit: "npm:^4.1.0" + strip-ansi: "npm:^6.0.1" + wrap-ansi: "npm:^6.2.0" + yoctocolors-cjs: "npm:^2.1.2" + checksum: 10/1bcb1deb7393d78f2dac5b8774d10692ad50b70e3ebc24684d13259d0c6c863dd1bce8ab4d4a806a6e90d5a2517aa8f9981993b1a256c9be68d9ef5e748481c6 + languageName: node + linkType: hard + +"@inquirer/figures@npm:^1.0.5": + version: 1.0.5 + resolution: "@inquirer/figures@npm:1.0.5" + checksum: 10/60a51b2cdef03c89be25071c23d8c4ae427c56d8ac1b00bf054ca7be446674adc4edd66c15465fe6a81ff0726b024bf37f8a2903a8387ef968d33058da3e7a15 + languageName: node + linkType: hard + +"@inquirer/type@npm:^1.5.2": + version: 1.5.2 + resolution: "@inquirer/type@npm:1.5.2" + dependencies: + mute-stream: "npm:^1.0.0" + checksum: 10/90d9203b5d7da8530e210c5421630b577f24554c8b683a4b45ea0f5c6a89c451771170aa34f2b62ca57e4be4de41d6761c941475e25c54c82b527c05644f181f + languageName: node + linkType: hard + "@isaacs/cliui@npm:^8.0.2": version: 8.0.2 resolution: "@isaacs/cliui@npm:8.0.2" @@ -4579,6 +4655,20 @@ __metadata: languageName: node linkType: hard +"@mswjs/interceptors@npm:^0.29.0": + version: 0.29.1 + resolution: "@mswjs/interceptors@npm:0.29.1" + dependencies: + "@open-draft/deferred-promise": "npm:^2.2.0" + "@open-draft/logger": "npm:^0.3.0" + "@open-draft/until": "npm:^2.0.0" + is-node-process: "npm:^1.2.0" + outvariant: "npm:^1.2.1" + strict-event-emitter: "npm:^0.5.1" + checksum: 10/6a6ee6eb3db0fed60bbeb710288f8c1e2cac84f08254756b684dbd553b04449dfe4cce1261fcc83772ee114be2043d9777e2ee6d72bc8d14fd394f961827e528 + languageName: node + linkType: hard + "@ndelangen/get-tarball@npm:^3.0.7": version: 3.0.9 resolution: "@ndelangen/get-tarball@npm:3.0.9" @@ -4766,6 +4856,30 @@ __metadata: languageName: node linkType: hard +"@open-draft/deferred-promise@npm:^2.2.0": + version: 2.2.0 + resolution: "@open-draft/deferred-promise@npm:2.2.0" + checksum: 10/bc3bb1668a555bb87b33383cafcf207d9561e17d2ca0d9e61b7ce88e82b66e36a333d3676c1d39eb5848022c03c8145331fcdc828ba297f88cb1de9c5cef6c19 + languageName: node + linkType: hard + +"@open-draft/logger@npm:^0.3.0": + version: 0.3.0 + resolution: "@open-draft/logger@npm:0.3.0" + dependencies: + is-node-process: "npm:^1.2.0" + outvariant: "npm:^1.4.0" + checksum: 10/7a280f170bcd4e91d3eedbefe628efd10c3bd06dd2461d06a7fdbced89ef457a38785847f88cc630fb4fd7dfa176d6f77aed17e5a9b08000baff647433b5ff78 + languageName: node + linkType: hard + +"@open-draft/until@npm:^2.0.0, @open-draft/until@npm:^2.1.0": + version: 2.1.0 + resolution: "@open-draft/until@npm:2.1.0" + checksum: 10/622be42950afc8e89715d0fd6d56cbdcd13e36625e23b174bd3d9f06f80e25f9adf75d6698af93bca1e1bf465b9ce00ec05214a12189b671fb9da0f58215b6f4 + languageName: node + linkType: hard + "@pkgjs/parseargs@npm:^0.11.0": version: 0.11.0 resolution: "@pkgjs/parseargs@npm:0.11.0" @@ -7685,6 +7799,13 @@ __metadata: languageName: node linkType: hard +"@types/cookie@npm:^0.6.0": + version: 0.6.0 + resolution: "@types/cookie@npm:0.6.0" + checksum: 10/b883348d5bf88695fbc2c2276b1c49859267a55cae3cf11ea1dccc1b3be15b466e637ce3242109ba27d616c77c6aa4efe521e3d557110b4fdd9bc332a12445c2 + languageName: node + linkType: hard + "@types/cross-spawn@npm:^6.0.2": version: 6.0.6 resolution: "@types/cross-spawn@npm:6.0.6" @@ -8081,6 +8202,15 @@ __metadata: languageName: node linkType: hard +"@types/mute-stream@npm:^0.0.4": + version: 0.0.4 + resolution: "@types/mute-stream@npm:0.0.4" + dependencies: + "@types/node": "npm:*" + checksum: 10/af8d83ad7b68ea05d9357985daf81b6c9b73af4feacb2f5c2693c7fd3e13e5135ef1bd083ce8d5bdc8e97acd28563b61bb32dec4e4508a8067fcd31b8a098632 + languageName: node + linkType: hard + "@types/node-fetch@npm:^2.6.4": version: 2.6.11 resolution: "@types/node-fetch@npm:2.6.11" @@ -8100,7 +8230,7 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:*, @types/node@npm:>=12.12.47, @types/node@npm:>=13.7.0, @types/node@npm:^20.9.4": +"@types/node@npm:*, @types/node@npm:>=12.12.47, @types/node@npm:>=13.7.0": version: 20.11.5 resolution: "@types/node@npm:20.11.5" dependencies: @@ -8127,6 +8257,15 @@ __metadata: languageName: node linkType: hard +"@types/node@npm:^22.1.0, @types/node@npm:^22.5.1": + version: 22.5.1 + resolution: "@types/node@npm:22.5.1" + dependencies: + undici-types: "npm:~6.19.2" + checksum: 10/adcec0e8a9ec9112a8cc9529b7d633356c2377fe69ca6e6de4ee39cacb8c86a18a9b7ba658e2456f8ad90d5b76767b268f517b0336c6db787cb056dcdfed107a + languageName: node + linkType: hard + "@types/normalize-package-data@npm:^2.4.0": version: 2.4.4 resolution: "@types/normalize-package-data@npm:2.4.4" @@ -8378,6 +8517,13 @@ __metadata: languageName: node linkType: hard +"@types/statuses@npm:^2.0.4": + version: 2.0.5 + resolution: "@types/statuses@npm:2.0.5" + checksum: 10/3f2609f660b45a878c6782f2fb2cef9f08bbd4e89194bf7512e747b8a73b056839be1ad6f64b1353765528cd8a5e93adeffc471cde24d0d9f7b528264e7154e5 + languageName: node + linkType: hard + "@types/styled-components@npm:^5.1.25": version: 5.1.34 resolution: "@types/styled-components@npm:5.1.34" @@ -8389,7 +8535,7 @@ __metadata: languageName: node linkType: hard -"@types/tough-cookie@npm:*": +"@types/tough-cookie@npm:*, @types/tough-cookie@npm:^4.0.5": version: 4.0.5 resolution: "@types/tough-cookie@npm:4.0.5" checksum: 10/01fd82efc8202670865928629697b62fe9bf0c0dcbc5b1c115831caeb073a2c0abb871ff393d7df1ae94ea41e256cb87d2a5a91fd03cdb1b0b4384e08d4ee482 @@ -8456,6 +8602,13 @@ __metadata: languageName: node linkType: hard +"@types/wrap-ansi@npm:^3.0.0": + version: 3.0.0 + resolution: "@types/wrap-ansi@npm:3.0.0" + checksum: 10/8aa644946ca4e859668c36b8e2bcf2ac4bdee59dac760414730ea57be8a93ae9166ebd40a088f2ab714843aaea2a2a67f0e6e6ec11cfc9c8701b2466ca1c4089 + languageName: node + linkType: hard + "@types/ws@npm:^8.5.1": version: 8.5.10 resolution: "@types/ws@npm:8.5.10" @@ -9573,7 +9726,7 @@ __metadata: languageName: node linkType: hard -"ansi-escapes@npm:^4.2.1": +"ansi-escapes@npm:^4.2.1, ansi-escapes@npm:^4.3.2": version: 4.3.2 resolution: "ansi-escapes@npm:4.3.2" dependencies: @@ -11311,7 +11464,7 @@ __metadata: languageName: node linkType: hard -"cli-spinners@npm:^2.5.0": +"cli-spinners@npm:^2.5.0, cli-spinners@npm:^2.9.2": version: 2.9.2 resolution: "cli-spinners@npm:2.9.2" checksum: 10/a0a863f442df35ed7294424f5491fa1756bd8d2e4ff0c8736531d886cec0ece4d85e8663b77a5afaf1d296e3cbbebff92e2e99f52bbea89b667cbe789b994794 @@ -11331,6 +11484,13 @@ __metadata: languageName: node linkType: hard +"cli-width@npm:^4.1.0": + version: 4.1.0 + resolution: "cli-width@npm:4.1.0" + checksum: 10/b58876fbf0310a8a35c79b72ecfcf579b354e18ad04e6b20588724ea2b522799a758507a37dfe132fafaf93a9922cafd9514d9e1598e6b2cd46694853aed099f + languageName: node + linkType: hard + "client-only@npm:0.0.1": version: 0.0.1 resolution: "client-only@npm:0.0.1" @@ -11890,7 +12050,7 @@ __metadata: languageName: node linkType: hard -"cookie@npm:0.5.0": +"cookie@npm:0.5.0, cookie@npm:^0.5.0": version: 0.5.0 resolution: "cookie@npm:0.5.0" checksum: 10/aae7911ddc5f444a9025fbd979ad1b5d60191011339bce48e555cb83343d0f98b865ff5c4d71fecdfb8555a5cafdc65632f6fce172f32aaf6936830a883a0380 @@ -15912,6 +16072,13 @@ __metadata: languageName: node linkType: hard +"graphql@npm:^16.8.1": + version: 16.9.0 + resolution: "graphql@npm:16.9.0" + checksum: 10/5833f82bb6c31bec120bbf9cd400eda873e1bb7ef5c17974fa262cd82dc68728fda5d4cb859dc8aaa4c4fe4f6fe1103a9c47efc01a12c02ae5cb581d8e4029e2 + languageName: node + linkType: hard + "growl@npm:1.10.5": version: 1.10.5 resolution: "growl@npm:1.10.5" @@ -16160,6 +16327,13 @@ __metadata: languageName: node linkType: hard +"headers-polyfill@npm:^4.0.2": + version: 4.0.3 + resolution: "headers-polyfill@npm:4.0.3" + checksum: 10/3a008aa2ef71591e2077706efb48db1b2729b90cf646cc217f9b69744e35cca4ba463f39debb6000904aa7de4fada2e5cc682463025d26bcc469c1d99fa5af27 + languageName: node + linkType: hard + "hex-color-regex@npm:^1.1.0": version: 1.1.0 resolution: "hex-color-regex@npm:1.1.0" @@ -17307,6 +17481,13 @@ __metadata: languageName: node linkType: hard +"is-node-process@npm:^1.2.0": + version: 1.2.0 + resolution: "is-node-process@npm:1.2.0" + checksum: 10/930765cdc6d81ab8f1bbecbea4a8d35c7c6d88a3ff61f3630e0fc7f22d624d7661c1df05c58547d0eb6a639dfa9304682c8e342c4113a6ed51472b704cee2928 + languageName: node + linkType: hard + "is-number-object@npm:^1.0.4": version: 1.0.7 resolution: "is-number-object@npm:1.0.7" @@ -21299,6 +21480,38 @@ __metadata: languageName: node linkType: hard +"msw@npm:^2.0.14": + version: 2.3.5 + resolution: "msw@npm:2.3.5" + dependencies: + "@bundled-es-modules/cookie": "npm:^2.0.0" + "@bundled-es-modules/statuses": "npm:^1.0.1" + "@bundled-es-modules/tough-cookie": "npm:^0.1.6" + "@inquirer/confirm": "npm:^3.0.0" + "@mswjs/interceptors": "npm:^0.29.0" + "@open-draft/until": "npm:^2.1.0" + "@types/cookie": "npm:^0.6.0" + "@types/statuses": "npm:^2.0.4" + chalk: "npm:^4.1.2" + graphql: "npm:^16.8.1" + headers-polyfill: "npm:^4.0.2" + is-node-process: "npm:^1.2.0" + outvariant: "npm:^1.4.2" + path-to-regexp: "npm:^6.2.0" + strict-event-emitter: "npm:^0.5.1" + type-fest: "npm:^4.9.0" + yargs: "npm:^17.7.2" + peerDependencies: + typescript: ">= 4.7.x" + peerDependenciesMeta: + typescript: + optional: true + bin: + msw: cli/index.js + checksum: 10/c7c14f517bf4011de4d8758212f84b355433ac8087840f94a605690a1f41ea8f4a4b6e07161f734f823b2563ba0a8ea168036f59a6ccdfc895817db6eed64418 + languageName: node + linkType: hard + "multicast-dns-service-types@npm:^1.1.0": version: 1.1.0 resolution: "multicast-dns-service-types@npm:1.1.0" @@ -21330,6 +21543,13 @@ __metadata: languageName: node linkType: hard +"mute-stream@npm:^1.0.0": + version: 1.0.0 + resolution: "mute-stream@npm:1.0.0" + checksum: 10/36fc968b0e9c9c63029d4f9dc63911950a3bdf55c9a87f58d3a266289b67180201cade911e7699f8b2fa596b34c9db43dad37649e3f7fdd13c3bb9edb0017ee7 + languageName: node + linkType: hard + "mz@npm:^2.1.0": version: 2.7.0 resolution: "mz@npm:2.7.0" @@ -22043,6 +22263,13 @@ __metadata: languageName: node linkType: hard +"outvariant@npm:^1.2.1, outvariant@npm:^1.4.0, outvariant@npm:^1.4.2": + version: 1.4.3 + resolution: "outvariant@npm:1.4.3" + checksum: 10/3a7582745850cb344d49641867a4c080858c54f4091afd91b9c0765ba6e471c2bc841348f0fff344845ddd0a4db42fd5d68c6f7ebaf32d4b676a3a9987b2488a + languageName: node + linkType: hard + "p-event@npm:^4.2.0": version: 4.2.0 resolution: "p-event@npm:4.2.0" @@ -22409,6 +22636,13 @@ __metadata: languageName: node linkType: hard +"path-to-regexp@npm:^6.2.0": + version: 6.2.2 + resolution: "path-to-regexp@npm:6.2.2" + checksum: 10/f7d11c1a9e02576ce0294f4efdc523c11b73894947afdf7b23a0d0f7c6465d7a7772166e770ddf1495a8017cc0ee99e3e8a15ed7302b6b948b89a6dd4eea895e + languageName: node + linkType: hard + "path-type@npm:^3.0.0": version: 3.0.0 resolution: "path-type@npm:3.0.0" @@ -26057,7 +26291,7 @@ __metadata: languageName: node linkType: hard -"statuses@npm:2.0.1": +"statuses@npm:2.0.1, statuses@npm:^2.0.1": version: 2.0.1 resolution: "statuses@npm:2.0.1" checksum: 10/18c7623fdb8f646fb213ca4051be4df7efb3484d4ab662937ca6fbef7ced9b9e12842709872eb3020cc3504b93bde88935c9f6417489627a7786f24f8031cbcb @@ -26209,6 +26443,13 @@ __metadata: languageName: node linkType: hard +"strict-event-emitter@npm:^0.5.1": + version: 0.5.1 + resolution: "strict-event-emitter@npm:0.5.1" + checksum: 10/25c84d88be85940d3547db665b871bfecea4ea0bedfeb22aae8db48126820cfb2b0bc2fba695392592a09b1aa36b686d6eede499e1ecd151593c03fe5a50d512 + languageName: node + linkType: hard + "strict-uri-encode@npm:^2.0.0": version: 2.0.0 resolution: "strict-uri-encode@npm:2.0.0" @@ -27125,6 +27366,18 @@ __metadata: languageName: node linkType: hard +"tough-cookie@npm:^4.1.4": + version: 4.1.4 + resolution: "tough-cookie@npm:4.1.4" + dependencies: + psl: "npm:^1.1.33" + punycode: "npm:^2.1.1" + universalify: "npm:^0.2.0" + url-parse: "npm:^1.5.3" + checksum: 10/75663f4e2cd085f16af0b217e4218772adf0617fb3227171102618a54ce0187a164e505d61f773ed7d65988f8ff8a8f935d381f87da981752c1171b076b4afac + languageName: node + linkType: hard + "tr46@npm:^3.0.0": version: 3.0.0 resolution: "tr46@npm:3.0.0" @@ -27386,6 +27639,13 @@ __metadata: languageName: node linkType: hard +"type-fest@npm:^4.9.0": + version: 4.25.0 + resolution: "type-fest@npm:4.25.0" + checksum: 10/16ddf51dbfeef45e6f0a139c16f06d6cd05b61be76b048c41e79997f150a66422219d7ec10a2717ab926505402d59b1ddc8560f5f6c245e1b8a35971c2f1b754 + languageName: node + linkType: hard + "type-is@npm:^1.6.16, type-is@npm:^1.6.18, type-is@npm:~1.6.18": version: 1.6.18 resolution: "type-is@npm:1.6.18" @@ -27606,6 +27866,13 @@ __metadata: languageName: node linkType: hard +"undici-types@npm:~6.19.2": + version: 6.19.8 + resolution: "undici-types@npm:6.19.8" + checksum: 10/cf0b48ed4fc99baf56584afa91aaffa5010c268b8842f62e02f752df209e3dea138b372a60a963b3b2576ed932f32329ce7ddb9cb5f27a6c83040d8cd74b7a70 + languageName: node + linkType: hard + "undici@npm:5.28.3": version: 5.28.3 resolution: "undici@npm:5.28.3" @@ -29279,6 +29546,13 @@ __metadata: languageName: node linkType: hard +"yoctocolors-cjs@npm:^2.1.2": + version: 2.1.2 + resolution: "yoctocolors-cjs@npm:2.1.2" + checksum: 10/d731e3ba776a0ee19021d909787942933a6c2eafb2bbe85541f0c59aa5c7d475ce86fcb860d5803105e32244c3dd5ba875b87c4c6bf2d6f297da416aa54e556f + languageName: node + linkType: hard + "zoom-level@npm:^2.5.0": version: 2.5.0 resolution: "zoom-level@npm:2.5.0"