andoncloud-sdk 1.7.23 → 1.7.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +14 -3
- package/dist/index.js +4012 -0
- package/dist/index.js.map +1 -0
- package/package.json +7 -20
- package/dist/andoncloud-sdk.css +0 -2
- package/dist/andoncloud-sdk.css.map +0 -1
- package/dist/andoncloud-sdk.js +0 -173
- package/dist/andoncloud-sdk.js.map +0 -1
- package/dist/app/__tests__/loginWithPassword.d.ts +0 -1
- package/dist/app/components/Header/Header.d.ts +0 -3
- package/dist/app/components/Header/Header.test.d.ts +0 -1
- package/dist/app/components/Header/index.d.ts +0 -1
- package/dist/app/components/Header/styles.d.ts +0 -11
- package/dist/app/components/Header/types.d.ts +0 -53
- package/dist/app/components/access/AccessBlocker.d.ts +0 -12
- package/dist/app/components/access/AccessBlocker.styles.d.ts +0 -34
- package/dist/app/components/access/AccessBlocker.test.d.ts +0 -1
- package/dist/app/components/access/AccessGuard.d.ts +0 -9
- package/dist/app/components/access/AccessGuard.test.d.ts +0 -1
- package/dist/app/components/access/AccessRequestModal.d.ts +0 -8
- package/dist/app/components/access/AccessRequestModal.styles.d.ts +0 -31
- package/dist/app/components/access/AccessRequestModal.test.d.ts +0 -1
- package/dist/app/components/access/CooldownModal.d.ts +0 -7
- package/dist/app/components/access/CooldownModal.styles.d.ts +0 -30
- package/dist/app/components/access/CooldownModal.test.d.ts +0 -1
- package/dist/app/components/access/InternalProcedureScreen.d.ts +0 -7
- package/dist/app/components/access/InternalProcedureScreen.styles.d.ts +0 -26
- package/dist/app/components/access/InternalProcedureScreen.test.d.ts +0 -1
- package/dist/app/components/access/index.d.ts +0 -3
- package/dist/app/components/access/withAccessGuard.d.ts +0 -6
- package/dist/app/components/access/withAccessGuard.test.d.ts +0 -1
- package/dist/app/components/app.d.ts +0 -3
- package/dist/app/components/authRedirect.d.ts +0 -3
- package/dist/app/components/container.d.ts +0 -44
- package/dist/app/components/container.styles.d.ts +0 -20
- package/dist/app/components/container.test.d.ts +0 -1
- package/dist/app/components/externalContent.d.ts +0 -5
- package/dist/app/components/footer.d.ts +0 -6
- package/dist/app/components/header.d.ts +0 -46
- package/dist/app/components/header.styles.d.ts +0 -50
- package/dist/app/components/header.test.d.ts +0 -1
- package/dist/app/components/iframeNavigation.d.ts +0 -2
- package/dist/app/components/loader.d.ts +0 -6
- package/dist/app/components/loginForm.d.ts +0 -29
- package/dist/app/components/loginForm.test.d.ts +0 -1
- package/dist/app/components/loginModal.d.ts +0 -31
- package/dist/app/components/loginModal.test.d.ts +0 -1
- package/dist/app/components/loginRedirect.d.ts +0 -3
- package/dist/app/components/messageNavigator.d.ts +0 -2
- package/dist/app/components/networkError.d.ts +0 -4
- package/dist/app/components/router.d.ts +0 -5
- package/dist/app/components/sidePanel.d.ts +0 -66
- package/dist/app/components/sidePanel.styles.d.ts +0 -15
- package/dist/app/components/sidebarMenu.d.ts +0 -32
- package/dist/app/components/sidebarMenu.styles.d.ts +0 -32
- package/dist/app/components/version.d.ts +0 -6
- package/dist/app/core/ui/Checkbox/Checkbox.d.ts +0 -7
- package/dist/app/core/ui/Checkbox/index.d.ts +0 -1
- package/dist/app/core/ui/Checkbox/styled.d.ts +0 -20
- package/dist/app/core/ui/Radio/Radio.d.ts +0 -7
- package/dist/app/core/ui/Radio/index.d.ts +0 -1
- package/dist/app/core/ui/Radio/styled.d.ts +0 -20
- package/dist/app/core/ui/RadioGroup/RadioGroup.d.ts +0 -7
- package/dist/app/core/ui/RadioGroup/index.d.ts +0 -1
- package/dist/app/core/ui/RadioGroup/styled.d.ts +0 -7
- package/dist/app/hooks/useAccess/accessState.d.ts +0 -7
- package/dist/app/hooks/useAccess/deriveButtons.d.ts +0 -5
- package/dist/app/hooks/useAccess/index.d.ts +0 -11
- package/dist/app/hooks/useAccess.d.ts +0 -10
- package/dist/app/hooks/useAccess.test.d.ts +0 -1
- package/dist/app/hooks/useFeatures.d.ts +0 -6
- package/dist/app/hooks/useFeatures.test.d.ts +0 -1
- package/dist/app/hooks/useFetch.d.ts +0 -2
- package/dist/app/hooks/useHeaderContentEvent.d.ts +0 -3
- package/dist/app/hooks/useHeaderContentEvent.test.d.ts +0 -1
- package/dist/app/hooks/useLogin.d.ts +0 -2
- package/dist/app/hooks/useLoginStatus.d.ts +0 -4
- package/dist/app/hooks/useModalHook/ModalContext.d.ts +0 -7
- package/dist/app/hooks/useModalHook/ModalProvider.d.ts +0 -5
- package/dist/app/hooks/useModalHook/index.d.ts +0 -3
- package/dist/app/hooks/useModalHook/useModal.d.ts +0 -8
- package/dist/app/hooks/usePackages.d.ts +0 -6
- package/dist/app/hooks/usePackages.test.d.ts +0 -1
- package/dist/app/hooks/usePermissions.d.ts +0 -13
- package/dist/app/hooks/usePermissions.test.d.ts +0 -1
- package/dist/app/hooks/useQueryParams.d.ts +0 -2
- package/dist/app/i18n.d.ts +0 -2
- package/dist/app/pages/ErrorPage.d.ts +0 -14
- package/dist/app/pages/ExternalPage.d.ts +0 -5
- package/dist/app/pages/LoaderPage.d.ts +0 -7
- package/dist/app/pages/LoginPage.d.ts +0 -15
- package/dist/app/providers/authConfig.d.ts +0 -6
- package/dist/app/providers/display.d.ts +0 -5
- package/dist/app/providers/displayMode.d.ts +0 -5
- package/dist/app/providers/metaInfo.d.ts +0 -6
- package/dist/app/providers/store.d.ts +0 -171
- package/dist/app/stores/appStore.d.ts +0 -10
- package/dist/app/stores/sessionStore.d.ts +0 -83
- package/dist/app/stores/userStore.d.ts +0 -14
- package/dist/app/testing/index.d.ts +0 -2
- package/dist/app/theme.d.ts +0 -2
- package/dist/app/utils/cookies-manager.d.ts +0 -7
- package/dist/app/utils/display.d.ts +0 -13
- package/dist/app/utils/fetch.d.ts +0 -9
- package/dist/app/utils/service-worker.d.ts +0 -1
- package/dist/app/utils/stores.d.ts +0 -22
- package/dist/app/utils/text.d.ts +0 -1
- package/dist/app/utils/window.d.ts +0 -1
- package/dist/assets/index.d.ts +0 -1
- package/dist/assets/logo.svg.d.ts +0 -2
- package/dist/cypress/support/component.d.ts +0 -9
- package/dist/cypress.config.d.ts +0 -2
- package/dist/locales/i18n.d.ts +0 -22
- package/dist/locales/index.d.ts +0 -2
- package/dist/serviceWorkerRegistration.d.ts +0 -2
- package/dist/setupTests.d.ts +0 -1
- package/dist/src/__tests__/loginWithPassword.cy.d.ts +0 -1
- package/dist/src/app/__tests__/loginWithPassword.cy.d.ts +0 -1
- package/dist/src/app/__tests__/loginWithPassword.d.ts +0 -1
- package/dist/src/app/components/Header/Header.cy.d.ts +0 -1
- package/dist/src/app/components/Header/Header.d.ts +0 -3
- package/dist/src/app/components/Header/Header.test.d.ts +0 -1
- package/dist/src/app/components/Header/index.d.ts +0 -1
- package/dist/src/app/components/Header/styles.d.ts +0 -11
- package/dist/src/app/components/Header/types.d.ts +0 -53
- package/dist/src/app/components/access/AccessBlocker.cy.d.ts +0 -1
- package/dist/src/app/components/access/AccessBlocker.d.ts +0 -12
- package/dist/src/app/components/access/AccessBlocker.styles.d.ts +0 -34
- package/dist/src/app/components/access/AccessBlocker.test.d.ts +0 -1
- package/dist/src/app/components/access/AccessGuard.cy.d.ts +0 -1
- package/dist/src/app/components/access/AccessGuard.d.ts +0 -9
- package/dist/src/app/components/access/AccessGuard.test.d.ts +0 -1
- package/dist/src/app/components/access/AccessRequestModal.cy.d.ts +0 -1
- package/dist/src/app/components/access/AccessRequestModal.d.ts +0 -8
- package/dist/src/app/components/access/AccessRequestModal.styles.d.ts +0 -31
- package/dist/src/app/components/access/AccessRequestModal.test.d.ts +0 -1
- package/dist/src/app/components/access/CooldownModal.cy.d.ts +0 -1
- package/dist/src/app/components/access/CooldownModal.d.ts +0 -7
- package/dist/src/app/components/access/CooldownModal.styles.d.ts +0 -30
- package/dist/src/app/components/access/CooldownModal.test.d.ts +0 -1
- package/dist/src/app/components/access/index.d.ts +0 -3
- package/dist/src/app/components/access/withAccessGuard.cy.d.ts +0 -1
- package/dist/src/app/components/access/withAccessGuard.d.ts +0 -6
- package/dist/src/app/components/access/withAccessGuard.test.d.ts +0 -1
- package/dist/src/app/components/app.d.ts +0 -3
- package/dist/src/app/components/authRedirect.d.ts +0 -3
- package/dist/src/app/components/container.cy.d.ts +0 -1
- package/dist/src/app/components/container.d.ts +0 -44
- package/dist/src/app/components/container.styles.d.ts +0 -20
- package/dist/src/app/components/container.test.d.ts +0 -1
- package/dist/src/app/components/externalContent.d.ts +0 -5
- package/dist/src/app/components/footer.d.ts +0 -6
- package/dist/src/app/components/iframeNavigation.d.ts +0 -2
- package/dist/src/app/components/loader.d.ts +0 -6
- package/dist/src/app/components/loginForm.cy.d.ts +0 -1
- package/dist/src/app/components/loginForm.d.ts +0 -29
- package/dist/src/app/components/loginForm.test.d.ts +0 -1
- package/dist/src/app/components/loginModal.cy.d.ts +0 -1
- package/dist/src/app/components/loginModal.d.ts +0 -31
- package/dist/src/app/components/loginModal.test.d.ts +0 -1
- package/dist/src/app/components/loginRedirect.d.ts +0 -3
- package/dist/src/app/components/networkError.d.ts +0 -4
- package/dist/src/app/components/router.d.ts +0 -5
- package/dist/src/app/components/sidePanel.d.ts +0 -66
- package/dist/src/app/components/sidePanel.styles.d.ts +0 -15
- package/dist/src/app/components/sidebarMenu.d.ts +0 -32
- package/dist/src/app/components/sidebarMenu.styles.d.ts +0 -32
- package/dist/src/app/core/ui/Checkbox/Checkbox.d.ts +0 -6
- package/dist/src/app/core/ui/Checkbox/index.d.ts +0 -1
- package/dist/src/app/core/ui/Checkbox/styled.d.ts +0 -7
- package/dist/src/app/core/ui/Radio/Radio.d.ts +0 -6
- package/dist/src/app/core/ui/Radio/index.d.ts +0 -1
- package/dist/src/app/core/ui/Radio/styled.d.ts +0 -7
- package/dist/src/app/core/ui/RadioGroup/RadioGroup.d.ts +0 -6
- package/dist/src/app/core/ui/RadioGroup/index.d.ts +0 -1
- package/dist/src/app/core/ui/RadioGroup/styled.d.ts +0 -4
- package/dist/src/app/hooks/useAccess/accessState.d.ts +0 -7
- package/dist/src/app/hooks/useAccess/deriveButtons.d.ts +0 -5
- package/dist/src/app/hooks/useAccess/index.d.ts +0 -11
- package/dist/src/app/hooks/useAccess.cy.d.ts +0 -1
- package/dist/src/app/hooks/useAccess.test.d.ts +0 -1
- package/dist/src/app/hooks/useFeatures.cy.d.ts +0 -1
- package/dist/src/app/hooks/useFeatures.d.ts +0 -6
- package/dist/src/app/hooks/useFeatures.test.d.ts +0 -1
- package/dist/src/app/hooks/useHeaderContentEvent.cy.d.ts +0 -1
- package/dist/src/app/hooks/useHeaderContentEvent.d.ts +0 -3
- package/dist/src/app/hooks/useHeaderContentEvent.test.d.ts +0 -1
- package/dist/src/app/hooks/useLogin.d.ts +0 -2
- package/dist/src/app/hooks/useLoginStatus.d.ts +0 -4
- package/dist/src/app/hooks/useModalHook/ModalContext.d.ts +0 -7
- package/dist/src/app/hooks/useModalHook/ModalProvider.d.ts +0 -5
- package/dist/src/app/hooks/useModalHook/index.d.ts +0 -3
- package/dist/src/app/hooks/useModalHook/useModal.d.ts +0 -8
- package/dist/src/app/hooks/usePermissions.cy.d.ts +0 -1
- package/dist/src/app/hooks/usePermissions.d.ts +0 -13
- package/dist/src/app/hooks/usePermissions.test.d.ts +0 -1
- package/dist/src/app/hooks/useQueryParams.d.ts +0 -2
- package/dist/src/app/i18n.d.ts +0 -3
- package/dist/src/app/pages/ErrorPage.d.ts +0 -14
- package/dist/src/app/pages/LoaderPage.d.ts +0 -7
- package/dist/src/app/pages/LoginPage.d.ts +0 -15
- package/dist/src/app/providers/authConfig.d.ts +0 -6
- package/dist/src/app/providers/display.d.ts +0 -5
- package/dist/src/app/providers/metaInfo.d.ts +0 -6
- package/dist/src/app/providers/store.d.ts +0 -171
- package/dist/src/app/stores/appStore.d.ts +0 -10
- package/dist/src/app/stores/sessionStore.d.ts +0 -83
- package/dist/src/app/stores/userStore.d.ts +0 -14
- package/dist/src/app/testing/index.d.ts +0 -2
- package/dist/src/app/theme.d.ts +0 -2
- package/dist/src/app/utils/cookies-manager.d.ts +0 -7
- package/dist/src/app/utils/display.d.ts +0 -13
- package/dist/src/app/utils/fetch.d.ts +0 -9
- package/dist/src/app/utils/service-worker.d.ts +0 -1
- package/dist/src/app/utils/stores.d.ts +0 -22
- package/dist/src/app/utils/text.d.ts +0 -1
- package/dist/src/assets/index.d.ts +0 -1
- package/dist/src/components/Header/Header.cy.d.ts +0 -1
- package/dist/src/components/Header/Header.d.ts +0 -3
- package/dist/src/components/Header/index.d.ts +0 -1
- package/dist/src/components/Header/styles.d.ts +0 -11
- package/dist/src/components/Header/types.d.ts +0 -52
- package/dist/src/components/access/AccessBlocker.cy.d.ts +0 -1
- package/dist/src/components/access/AccessBlocker.d.ts +0 -13
- package/dist/src/components/access/AccessBlocker.styles.d.ts +0 -43
- package/dist/src/components/access/AccessGuard.cy.d.ts +0 -1
- package/dist/src/components/access/AccessGuard.d.ts +0 -10
- package/dist/src/components/access/AccessRequestModal.cy.d.ts +0 -1
- package/dist/src/components/access/AccessRequestModal.d.ts +0 -8
- package/dist/src/components/access/AccessRequestModal.styles.d.ts +0 -31
- package/dist/src/components/access/CooldownModal.cy.d.ts +0 -1
- package/dist/src/components/access/CooldownModal.d.ts +0 -7
- package/dist/src/components/access/CooldownModal.styles.d.ts +0 -30
- package/dist/src/components/access/index.d.ts +0 -3
- package/dist/src/components/access/withAccessGuard.cy.d.ts +0 -1
- package/dist/src/components/access/withAccessGuard.d.ts +0 -6
- package/dist/src/components/app.d.ts +0 -3
- package/dist/src/components/authRedirect.cy.d.ts +0 -1
- package/dist/src/components/authRedirect.d.ts +0 -3
- package/dist/src/components/container.cy.d.ts +0 -1
- package/dist/src/components/container.d.ts +0 -44
- package/dist/src/components/container.styles.d.ts +0 -20
- package/dist/src/components/externalContent.d.ts +0 -5
- package/dist/src/components/footer.d.ts +0 -6
- package/dist/src/components/iframeNavigation.d.ts +0 -2
- package/dist/src/components/loader.d.ts +0 -6
- package/dist/src/components/loginForm.cy.d.ts +0 -1
- package/dist/src/components/loginForm.d.ts +0 -29
- package/dist/src/components/loginModal.cy.d.ts +0 -1
- package/dist/src/components/loginModal.d.ts +0 -16
- package/dist/src/components/loginRedirect.d.ts +0 -3
- package/dist/src/components/networkError.d.ts +0 -4
- package/dist/src/components/router.d.ts +0 -5
- package/dist/src/components/sidePanel.d.ts +0 -66
- package/dist/src/components/sidePanel.styles.d.ts +0 -15
- package/dist/src/components/sidebarMenu.d.ts +0 -32
- package/dist/src/components/sidebarMenu.styles.d.ts +0 -32
- package/dist/src/core/ui/Checkbox/Checkbox.d.ts +0 -6
- package/dist/src/core/ui/Checkbox/index.d.ts +0 -1
- package/dist/src/core/ui/Checkbox/styled.d.ts +0 -6
- package/dist/src/core/ui/Radio/Radio.d.ts +0 -6
- package/dist/src/core/ui/Radio/index.d.ts +0 -1
- package/dist/src/core/ui/Radio/styled.d.ts +0 -6
- package/dist/src/core/ui/RadioGroup/RadioGroup.d.ts +0 -6
- package/dist/src/core/ui/RadioGroup/index.d.ts +0 -1
- package/dist/src/core/ui/RadioGroup/styled.d.ts +0 -4
- package/dist/src/hooks/useAccess/accessState.d.ts +0 -7
- package/dist/src/hooks/useAccess/deriveButtons.d.ts +0 -5
- package/dist/src/hooks/useAccess/index.d.ts +0 -11
- package/dist/src/hooks/useAccess.cy.d.ts +0 -1
- package/dist/src/hooks/useFeatures.cy.d.ts +0 -1
- package/dist/src/hooks/useFeatures.d.ts +0 -6
- package/dist/src/hooks/useHeaderContentEvent.cy.d.ts +0 -1
- package/dist/src/hooks/useHeaderContentEvent.d.ts +0 -3
- package/dist/src/hooks/useLogin.d.ts +0 -2
- package/dist/src/hooks/useLoginStatus.d.ts +0 -3
- package/dist/src/hooks/useModalHook/ModalContext.d.ts +0 -7
- package/dist/src/hooks/useModalHook/ModalProvider.d.ts +0 -5
- package/dist/src/hooks/useModalHook/index.d.ts +0 -3
- package/dist/src/hooks/useModalHook/useModal.d.ts +0 -8
- package/dist/src/hooks/usePermissions.cy.d.ts +0 -1
- package/dist/src/hooks/usePermissions.d.ts +0 -13
- package/dist/src/hooks/useQueryParams.d.ts +0 -2
- package/dist/src/i18n.d.ts +0 -9
- package/dist/src/index.d.ts +0 -36
- package/dist/src/pages/ErrorPage.d.ts +0 -14
- package/dist/src/pages/LoaderPage.d.ts +0 -7
- package/dist/src/pages/LoginPage.d.ts +0 -15
- package/dist/src/providers/authConfig.d.ts +0 -6
- package/dist/src/providers/display.d.ts +0 -5
- package/dist/src/providers/metaInfo.d.ts +0 -6
- package/dist/src/providers/store.d.ts +0 -171
- package/dist/src/serviceWorkerRegistration.d.ts +0 -2
- package/dist/src/setupTests.d.ts +0 -1
- package/dist/src/stores/SessionStore/CookiesManager.cy.d.ts +0 -1
- package/dist/src/stores/SessionStore/CookiesManager.d.ts +0 -15
- package/dist/src/stores/SessionStore/SessionStore.cy.d.ts +0 -1
- package/dist/src/stores/SessionStore/SessionStore.d.ts +0 -92
- package/dist/src/stores/SessionStore/TokenCoordinator.cy.d.ts +0 -1
- package/dist/src/stores/SessionStore/TokenCoordinator.d.ts +0 -46
- package/dist/src/stores/SessionStore/index.d.ts +0 -3
- package/dist/src/stores/SessionStore/types.d.ts +0 -94
- package/dist/src/stores/appStore.d.ts +0 -10
- package/dist/src/stores/sessionStore.d.ts +0 -83
- package/dist/src/stores/userStore.d.ts +0 -14
- package/dist/src/theme.d.ts +0 -2
- package/dist/src/utils/authFetch.d.ts +0 -10
- package/dist/src/utils/cookies-manager.d.ts +0 -9
- package/dist/src/utils/display.d.ts +0 -14
- package/dist/src/utils/fetch.d.ts +0 -9
- package/dist/src/utils/service-worker.d.ts +0 -1
- package/dist/src/utils/stores.d.ts +0 -15
- package/dist/src/utils/text.d.ts +0 -1
- package/dist/src/utils/validateRedirect.cy.d.ts +0 -1
- package/dist/src/utils/validateRedirect.d.ts +0 -1
- package/dist/src/version.d.ts +0 -1
- package/dist/version.d.ts +0 -1
package/dist/index.js
ADDED
|
@@ -0,0 +1,4012 @@
|
|
|
1
|
+
import toast, { Toaster, default as toast$1 } from "react-hot-toast";
|
|
2
|
+
import * as Sentry from "@sentry/react";
|
|
3
|
+
import { captureException, captureException as captureException$1 } from "@sentry/react";
|
|
4
|
+
import React, { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
5
|
+
import { I18nextProvider, initReactI18next, useTranslation } from "react-i18next";
|
|
6
|
+
import HourglassEmptyIcon from "@mui/icons-material/HourglassEmpty";
|
|
7
|
+
import LockIcon from "@mui/icons-material/Lock";
|
|
8
|
+
import ShoppingCartIcon from "@mui/icons-material/ShoppingCart";
|
|
9
|
+
import { Alert, Box, Button, Card, CardContent, Checkbox as Checkbox$1, Collapse, Container as Container$1, Dialog, DialogContent, DialogTitle, Drawer, FormControl, IconButton, Link, List, ListItem, ListItemButton, ListItemIcon, ListItemText, Radio as Radio$1, RadioGroup as RadioGroup$1, Stack, Step, StepLabel, Stepper, TextField, Tooltip, Typography, styled, useScrollTrigger } from "@mui/material";
|
|
10
|
+
import { action, computed, flow, makeAutoObservable, makeObservable, observable, reaction, toJS } from "mobx";
|
|
11
|
+
import TagManager from "react-gtm-module";
|
|
12
|
+
import { BrowserRouter, Link as Link$1, Navigate, Route, Routes, createRoutesFromChildren, matchRoutes, useLocation, useNavigate, useNavigationType, useSearchParams } from "react-router-dom";
|
|
13
|
+
import CssBaseline from "@mui/material/CssBaseline";
|
|
14
|
+
import GlobalStyles from "@mui/material/GlobalStyles";
|
|
15
|
+
import { ThemeProvider, createTheme, responsiveFontSizes, styled as styled$1, useTheme } from "@mui/material/styles";
|
|
16
|
+
import { observer } from "mobx-react-lite";
|
|
17
|
+
import { PropTypes } from "prop-types";
|
|
18
|
+
import i18n from "i18next";
|
|
19
|
+
import Cookies from "js-cookie";
|
|
20
|
+
import LanguageDetector from "i18next-browser-languagedetector";
|
|
21
|
+
import HelpOutlineIcon from "@mui/icons-material/HelpOutline";
|
|
22
|
+
import { Box as Box$1, styled as styled$2 } from "@mui/system";
|
|
23
|
+
import "inter-ui/inter.css";
|
|
24
|
+
import Dialog$1 from "@mui/material/Dialog";
|
|
25
|
+
import DialogContent$1 from "@mui/material/DialogContent";
|
|
26
|
+
import { LoadingButton } from "@mui/lab";
|
|
27
|
+
import onScan from "onscan.js";
|
|
28
|
+
import Box$2 from "@mui/material/Box";
|
|
29
|
+
import Card$1 from "@mui/material/Card";
|
|
30
|
+
import CardContent$1 from "@mui/material/CardContent";
|
|
31
|
+
import BaseContainer from "@mui/material/Container";
|
|
32
|
+
import Iframe from "react-iframe";
|
|
33
|
+
import { ExpandLess, ExpandMore, ViewSidebarRounded } from "@mui/icons-material";
|
|
34
|
+
import AccessTimeIcon from "@mui/icons-material/AccessTime";
|
|
35
|
+
import MenuIcon from "@mui/icons-material/Menu";
|
|
36
|
+
import AppBar from "@mui/material/AppBar";
|
|
37
|
+
import Button$1 from "@mui/material/Button";
|
|
38
|
+
import IconButton$1 from "@mui/material/IconButton";
|
|
39
|
+
import Menu from "@mui/material/Menu";
|
|
40
|
+
import MenuItem from "@mui/material/MenuItem";
|
|
41
|
+
import Toolbar from "@mui/material/Toolbar";
|
|
42
|
+
import Typography$1 from "@mui/material/Typography";
|
|
43
|
+
import useMediaQuery from "@mui/material/useMediaQuery";
|
|
44
|
+
import { deepmerge } from "@mui/utils";
|
|
45
|
+
import CloseIcon from "@mui/icons-material/Close";
|
|
46
|
+
//#region src/utils/text.js
|
|
47
|
+
const toCamelCase = (str) => str.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase());
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region src/components/access/AccessBlocker.styles.js
|
|
50
|
+
const ACCESS_STATE_COLORS = {
|
|
51
|
+
no_permission: "primary.main",
|
|
52
|
+
expired: "error.main",
|
|
53
|
+
not_purchased: "primary.main"
|
|
54
|
+
};
|
|
55
|
+
const makeStyles$1 = (accessState) => {
|
|
56
|
+
const accentColor = ACCESS_STATE_COLORS[accessState] || "primary.main";
|
|
57
|
+
return {
|
|
58
|
+
container: {
|
|
59
|
+
position: "relative",
|
|
60
|
+
display: "flex",
|
|
61
|
+
flexDirection: "column",
|
|
62
|
+
alignItems: "center",
|
|
63
|
+
justifyContent: "center",
|
|
64
|
+
gap: 3,
|
|
65
|
+
width: "100%",
|
|
66
|
+
height: "100%",
|
|
67
|
+
padding: 4,
|
|
68
|
+
textAlign: "center",
|
|
69
|
+
background: (theme) => theme.palette.gradient.dark.main
|
|
70
|
+
},
|
|
71
|
+
backgroundImage: {
|
|
72
|
+
position: "absolute",
|
|
73
|
+
inset: 0,
|
|
74
|
+
opacity: .1,
|
|
75
|
+
backgroundSize: "cover",
|
|
76
|
+
backgroundPosition: "center",
|
|
77
|
+
backgroundRepeat: "no-repeat"
|
|
78
|
+
},
|
|
79
|
+
icon: {
|
|
80
|
+
fontSize: 48,
|
|
81
|
+
color: accentColor
|
|
82
|
+
},
|
|
83
|
+
buttonsContainer: {
|
|
84
|
+
display: "flex",
|
|
85
|
+
flexWrap: "wrap",
|
|
86
|
+
alignItems: "center",
|
|
87
|
+
justifyContent: "center",
|
|
88
|
+
gap: 2
|
|
89
|
+
},
|
|
90
|
+
primaryButton: { backgroundColor: accentColor },
|
|
91
|
+
secondaryButton: {},
|
|
92
|
+
linkButton: {
|
|
93
|
+
cursor: "pointer",
|
|
94
|
+
color: "primary.light"
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
//#endregion
|
|
99
|
+
//#region src/components/access/AccessRequestModal.styles.js
|
|
100
|
+
const styles$1 = {
|
|
101
|
+
dialog: { ".MuiPaper-root": { borderRadius: "6px" } },
|
|
102
|
+
dialogContent: { padding: 0 },
|
|
103
|
+
container: {
|
|
104
|
+
display: "flex",
|
|
105
|
+
flexDirection: "column",
|
|
106
|
+
alignItems: "center",
|
|
107
|
+
gap: 3,
|
|
108
|
+
padding: 4,
|
|
109
|
+
background: (theme) => theme.palette.gradient.dark.main
|
|
110
|
+
},
|
|
111
|
+
stepper: { width: "100%" },
|
|
112
|
+
disclaimer: {
|
|
113
|
+
marginTop: 2,
|
|
114
|
+
color: "warning.main"
|
|
115
|
+
},
|
|
116
|
+
actions: { marginTop: 2 }
|
|
117
|
+
};
|
|
118
|
+
//#endregion
|
|
119
|
+
//#region src/components/access/AccessRequestModal.js
|
|
120
|
+
const REQUEST_TYPE_CONFIG = {
|
|
121
|
+
feature_access: {
|
|
122
|
+
translationKey: "featureAccess",
|
|
123
|
+
steps: [
|
|
124
|
+
"step1",
|
|
125
|
+
"step2",
|
|
126
|
+
"step3"
|
|
127
|
+
],
|
|
128
|
+
showDisclaimer: true
|
|
129
|
+
},
|
|
130
|
+
trial_expired: {
|
|
131
|
+
translationKey: "trialExpired",
|
|
132
|
+
steps: [
|
|
133
|
+
"step1",
|
|
134
|
+
"step2",
|
|
135
|
+
"step3",
|
|
136
|
+
"step4"
|
|
137
|
+
],
|
|
138
|
+
showDisclaimer: true
|
|
139
|
+
},
|
|
140
|
+
purchase: {
|
|
141
|
+
translationKey: "purchase",
|
|
142
|
+
steps: [
|
|
143
|
+
"step1",
|
|
144
|
+
"step2",
|
|
145
|
+
"step3",
|
|
146
|
+
"step4"
|
|
147
|
+
],
|
|
148
|
+
showDisclaimer: true
|
|
149
|
+
},
|
|
150
|
+
wishlist: {
|
|
151
|
+
translationKey: "wishlist",
|
|
152
|
+
steps: [
|
|
153
|
+
"step1",
|
|
154
|
+
"step2",
|
|
155
|
+
"step3",
|
|
156
|
+
"step4"
|
|
157
|
+
],
|
|
158
|
+
showDisclaimer: true
|
|
159
|
+
},
|
|
160
|
+
start_trial: {
|
|
161
|
+
translationKey: "startTrial",
|
|
162
|
+
steps: [],
|
|
163
|
+
showDisclaimer: false
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
const AccessRequestModal = ({ open, requestType, onSubmitRequest, onClose }) => {
|
|
167
|
+
const { t } = useTranslation();
|
|
168
|
+
const { translationKey, steps, showDisclaimer } = REQUEST_TYPE_CONFIG[requestType] || REQUEST_TYPE_CONFIG.feature_access;
|
|
169
|
+
const renderStepper = () => {
|
|
170
|
+
if (steps.length === 0) return null;
|
|
171
|
+
return /* @__PURE__ */ React.createElement(Stepper, {
|
|
172
|
+
orientation: "vertical",
|
|
173
|
+
sx: styles$1.stepper
|
|
174
|
+
}, steps.map((step) => /* @__PURE__ */ React.createElement(Step, {
|
|
175
|
+
key: step,
|
|
176
|
+
active: true
|
|
177
|
+
}, /* @__PURE__ */ React.createElement(StepLabel, null, t(`access.modal.${translationKey}.${step}`)))));
|
|
178
|
+
};
|
|
179
|
+
const renderContent = () => {
|
|
180
|
+
if (requestType === "start_trial") return /* @__PURE__ */ React.createElement(Typography, {
|
|
181
|
+
variant: "body1",
|
|
182
|
+
sx: styles$1.content
|
|
183
|
+
}, t("access.modal.startTrial.content"));
|
|
184
|
+
return renderStepper();
|
|
185
|
+
};
|
|
186
|
+
return /* @__PURE__ */ React.createElement(Dialog, {
|
|
187
|
+
open,
|
|
188
|
+
onClose,
|
|
189
|
+
sx: styles$1.dialog,
|
|
190
|
+
"data-testid": "sdk.access-modal"
|
|
191
|
+
}, /* @__PURE__ */ React.createElement(DialogTitle, null, t(`access.modal.${translationKey}.header`)), /* @__PURE__ */ React.createElement(DialogContent, { sx: styles$1.dialogContent }, /* @__PURE__ */ React.createElement(Box, { sx: styles$1.container }, renderContent(), showDisclaimer && /* @__PURE__ */ React.createElement(Alert, {
|
|
192
|
+
severity: "warning",
|
|
193
|
+
variant: "outlined",
|
|
194
|
+
sx: styles$1.disclaimer
|
|
195
|
+
}, t("access.modal.disclaimer")), /* @__PURE__ */ React.createElement(Stack, {
|
|
196
|
+
direction: "row",
|
|
197
|
+
spacing: 2,
|
|
198
|
+
sx: styles$1.actions
|
|
199
|
+
}, /* @__PURE__ */ React.createElement(Button, {
|
|
200
|
+
variant: "contained",
|
|
201
|
+
onClick: onSubmitRequest,
|
|
202
|
+
"data-testid": "sdk.access-modal.action"
|
|
203
|
+
}, t(`access.modal.${translationKey}.button`)), /* @__PURE__ */ React.createElement(Button, {
|
|
204
|
+
variant: "outlined",
|
|
205
|
+
onClick: onClose,
|
|
206
|
+
"data-testid": "sdk.access-modal.cancel"
|
|
207
|
+
}, t("access.modal.cancel"))))));
|
|
208
|
+
};
|
|
209
|
+
//#endregion
|
|
210
|
+
//#region src/components/access/CooldownModal.styles.js
|
|
211
|
+
const styles = {
|
|
212
|
+
dialog: { ".MuiPaper-root": { borderRadius: "6px" } },
|
|
213
|
+
dialogContent: { padding: 0 },
|
|
214
|
+
container: {
|
|
215
|
+
display: "flex",
|
|
216
|
+
flexDirection: "column",
|
|
217
|
+
alignItems: "center",
|
|
218
|
+
gap: 3,
|
|
219
|
+
padding: 4,
|
|
220
|
+
background: (theme) => theme.palette.gradient.dark.main
|
|
221
|
+
},
|
|
222
|
+
content: {
|
|
223
|
+
marginTop: 1,
|
|
224
|
+
marginBottom: 3,
|
|
225
|
+
textAlign: "center"
|
|
226
|
+
},
|
|
227
|
+
actions: {
|
|
228
|
+
display: "flex",
|
|
229
|
+
justifyContent: "center"
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
//#endregion
|
|
233
|
+
//#region src/components/access/CooldownModal.js
|
|
234
|
+
const CooldownModal = ({ open, daysRemaining, onClose }) => {
|
|
235
|
+
const { t } = useTranslation();
|
|
236
|
+
return /* @__PURE__ */ React.createElement(Dialog, {
|
|
237
|
+
open,
|
|
238
|
+
onClose,
|
|
239
|
+
sx: styles.dialog
|
|
240
|
+
}, /* @__PURE__ */ React.createElement(DialogTitle, null, t("access.cooldown.header")), /* @__PURE__ */ React.createElement(DialogContent, { sx: styles.dialogContent }, /* @__PURE__ */ React.createElement(Box, { sx: styles.container }, /* @__PURE__ */ React.createElement(Typography, {
|
|
241
|
+
variant: "body1",
|
|
242
|
+
sx: styles.content
|
|
243
|
+
}, t("access.cooldown.message", { days: daysRemaining })), /* @__PURE__ */ React.createElement(Box, { sx: styles.actions }, /* @__PURE__ */ React.createElement(Button, {
|
|
244
|
+
variant: "contained",
|
|
245
|
+
onClick: onClose,
|
|
246
|
+
"data-testid": "sdk.access-cooldown.button"
|
|
247
|
+
}, t("access.cooldown.button"))))));
|
|
248
|
+
};
|
|
249
|
+
//#endregion
|
|
250
|
+
//#region src/components/access/AccessBlocker.js
|
|
251
|
+
const ICONS = {
|
|
252
|
+
no_permission: LockIcon,
|
|
253
|
+
expired: HourglassEmptyIcon,
|
|
254
|
+
not_purchased: ShoppingCartIcon
|
|
255
|
+
};
|
|
256
|
+
const AccessBlocker = ({ accessState, buttons = [], daysSinceExpiry, featureKey, workplaceId, cooldownInfo = {}, onTrialRequest, onFeatureRequest, backgroundImage }) => {
|
|
257
|
+
const { t } = useTranslation();
|
|
258
|
+
const [modalOpen, setModalOpen] = useState(false);
|
|
259
|
+
const [cooldownModalOpen, setCooldownModalOpen] = useState(false);
|
|
260
|
+
const [cooldownDays, setCooldownDays] = useState(0);
|
|
261
|
+
const [pendingAction, setPendingAction] = useState(null);
|
|
262
|
+
const styles = makeStyles$1(accessState);
|
|
263
|
+
const Icon = ICONS[accessState] || LockIcon;
|
|
264
|
+
const handleOpenModal = (button) => {
|
|
265
|
+
if (button.requestType && cooldownInfo[button.requestType]?.isInCooldown) {
|
|
266
|
+
setCooldownDays(cooldownInfo[button.requestType].daysRemaining);
|
|
267
|
+
setCooldownModalOpen(true);
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
setPendingAction(button);
|
|
271
|
+
setModalOpen(true);
|
|
272
|
+
};
|
|
273
|
+
const handleCloseModal = () => {
|
|
274
|
+
setModalOpen(false);
|
|
275
|
+
setPendingAction(null);
|
|
276
|
+
};
|
|
277
|
+
const handleCloseCooldownModal = () => {
|
|
278
|
+
setCooldownModalOpen(false);
|
|
279
|
+
};
|
|
280
|
+
const showToast = (requestType) => {
|
|
281
|
+
const toastKey = `access.toast.${toCamelCase(requestType)}`;
|
|
282
|
+
toast$1.success(t(toastKey));
|
|
283
|
+
};
|
|
284
|
+
const handleSubmitRequest = async () => {
|
|
285
|
+
setModalOpen(false);
|
|
286
|
+
let success = false;
|
|
287
|
+
if (pendingAction?.action === "start_trial") {
|
|
288
|
+
success = await onTrialRequest(featureKey);
|
|
289
|
+
if (success) showToast("start_trial");
|
|
290
|
+
} else if (pendingAction?.requestType) {
|
|
291
|
+
success = await onFeatureRequest({
|
|
292
|
+
featureKey,
|
|
293
|
+
requestType: pendingAction.requestType,
|
|
294
|
+
workplaceId
|
|
295
|
+
});
|
|
296
|
+
if (success) showToast(pendingAction.requestType);
|
|
297
|
+
}
|
|
298
|
+
setPendingAction(null);
|
|
299
|
+
};
|
|
300
|
+
const getMessage = () => {
|
|
301
|
+
switch (accessState) {
|
|
302
|
+
case "no_permission": return t("access.noPermission.message");
|
|
303
|
+
case "expired":
|
|
304
|
+
if (daysSinceExpiry != null && daysSinceExpiry < 90) return t("access.expired.message", { days: daysSinceExpiry });
|
|
305
|
+
else if (daysSinceExpiry != null && daysSinceExpiry >= 180) return t("access.expired.messageVeryOld");
|
|
306
|
+
return t("access.expired.messageOld");
|
|
307
|
+
case "not_purchased": return t("access.notPurchased.message");
|
|
308
|
+
default: return "";
|
|
309
|
+
}
|
|
310
|
+
};
|
|
311
|
+
const getTooltipText = () => {
|
|
312
|
+
switch (accessState) {
|
|
313
|
+
case "no_permission": return t("access.noPermission.tooltip");
|
|
314
|
+
case "expired": return t("access.expired.tooltip");
|
|
315
|
+
case "not_purchased": return t("access.notPurchased.tooltip");
|
|
316
|
+
default: return "";
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
const getButtonLabel = (action) => {
|
|
320
|
+
switch (action) {
|
|
321
|
+
case "start_trial": return t("access.notPurchased.button.try");
|
|
322
|
+
case "request_access": return t("access.noPermission.button.requestAccess");
|
|
323
|
+
case "renew": return t("access.expired.button.renewSubscription");
|
|
324
|
+
case "buy": return t("access.notPurchased.button.buy");
|
|
325
|
+
case "wishlist": return t("access.notPurchased.button.wishlist");
|
|
326
|
+
default: return "";
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
const renderButton = (button) => {
|
|
330
|
+
const label = getButtonLabel(button.action);
|
|
331
|
+
if (button.variant === "link") return /* @__PURE__ */ React.createElement(Link, {
|
|
332
|
+
key: button.action,
|
|
333
|
+
component: "button",
|
|
334
|
+
variant: "body2",
|
|
335
|
+
sx: styles.linkButton,
|
|
336
|
+
onClick: () => handleOpenModal(button),
|
|
337
|
+
"data-testid": `sdk.access-blocker.${button.action}`
|
|
338
|
+
}, label);
|
|
339
|
+
const isContained = button.variant === "primary";
|
|
340
|
+
return /* @__PURE__ */ React.createElement(Button, {
|
|
341
|
+
key: button.action,
|
|
342
|
+
variant: isContained ? "contained" : "outlined",
|
|
343
|
+
sx: isContained ? styles.primaryButton : styles.secondaryButton,
|
|
344
|
+
onClick: () => handleOpenModal(button),
|
|
345
|
+
"data-testid": `sdk.access-blocker.${button.action}`
|
|
346
|
+
}, label);
|
|
347
|
+
};
|
|
348
|
+
const renderButtons = () => {
|
|
349
|
+
if (buttons.length === 0) return null;
|
|
350
|
+
return /* @__PURE__ */ React.createElement(Box, { sx: styles.buttonsContainer }, buttons.map(renderButton));
|
|
351
|
+
};
|
|
352
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Box, { sx: styles.container }, backgroundImage && /* @__PURE__ */ React.createElement(Box, {
|
|
353
|
+
sx: styles.backgroundImage,
|
|
354
|
+
style: { backgroundImage: `url(${backgroundImage})` },
|
|
355
|
+
"data-testid": "sdk.access-blocker.background-image"
|
|
356
|
+
}), /* @__PURE__ */ React.createElement(Tooltip, { title: getTooltipText() }, /* @__PURE__ */ React.createElement(Icon, { sx: styles.icon })), /* @__PURE__ */ React.createElement(Typography, { variant: "body1" }, getMessage()), renderButtons()), /* @__PURE__ */ React.createElement(AccessRequestModal, {
|
|
357
|
+
open: modalOpen,
|
|
358
|
+
requestType: pendingAction?.action === "start_trial" ? "start_trial" : pendingAction?.requestType,
|
|
359
|
+
onSubmitRequest: handleSubmitRequest,
|
|
360
|
+
onClose: handleCloseModal
|
|
361
|
+
}), /* @__PURE__ */ React.createElement(CooldownModal, {
|
|
362
|
+
open: cooldownModalOpen,
|
|
363
|
+
daysRemaining: cooldownDays,
|
|
364
|
+
onClose: handleCloseCooldownModal
|
|
365
|
+
}));
|
|
366
|
+
};
|
|
367
|
+
//#endregion
|
|
368
|
+
//#region src/utils/stores.ts
|
|
369
|
+
const convertFeatureInfoToCamelCase = (featureInfo) => featureInfo ? {
|
|
370
|
+
status: featureInfo.status,
|
|
371
|
+
entitlementType: featureInfo.entitlement_type,
|
|
372
|
+
expiresAt: featureInfo.expires_at,
|
|
373
|
+
daysSinceExpiry: featureInfo.days_since_expiry,
|
|
374
|
+
permissions: featureInfo.permissions || []
|
|
375
|
+
} : null;
|
|
376
|
+
const convertFeaturesMapToCamelCase = (featuresMap) => featuresMap ? Object.fromEntries(Object.entries(featuresMap).map(([key, value]) => [key, convertFeatureInfoToCamelCase(value)])) : null;
|
|
377
|
+
const convertRequestInfoToCamelCase = (requestInfo) => requestInfo ? {
|
|
378
|
+
isInCooldown: requestInfo.days_remaining > 0,
|
|
379
|
+
daysRemaining: requestInfo.days_remaining
|
|
380
|
+
} : null;
|
|
381
|
+
const convertFeaturesRequestsMapToCamelCase = (featuresRequestsMap) => {
|
|
382
|
+
if (!featuresRequestsMap) return null;
|
|
383
|
+
const result = {};
|
|
384
|
+
for (const [workplaceKey, features] of Object.entries(featuresRequestsMap)) {
|
|
385
|
+
result[workplaceKey] = {};
|
|
386
|
+
for (const [featureKey, requestTypes] of Object.entries(features)) {
|
|
387
|
+
result[workplaceKey][featureKey] = {};
|
|
388
|
+
for (const [requestType, requestInfo] of Object.entries(requestTypes)) {
|
|
389
|
+
const converted = convertRequestInfoToCamelCase(requestInfo);
|
|
390
|
+
if (converted) result[workplaceKey][featureKey][requestType] = converted;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
return result;
|
|
395
|
+
};
|
|
396
|
+
const getCooldownStatus = (featuresRequestsMap, featureKey, requestType, workplaceId) => {
|
|
397
|
+
if (!featuresRequestsMap || !featureKey || !requestType) return {
|
|
398
|
+
isInCooldown: false,
|
|
399
|
+
daysRemaining: 0
|
|
400
|
+
};
|
|
401
|
+
const requestInfo = featuresRequestsMap[workplaceId || "company"]?.[featureKey]?.[requestType];
|
|
402
|
+
if (!requestInfo) return {
|
|
403
|
+
isInCooldown: false,
|
|
404
|
+
daysRemaining: 0
|
|
405
|
+
};
|
|
406
|
+
return {
|
|
407
|
+
isInCooldown: requestInfo.daysRemaining > 0,
|
|
408
|
+
daysRemaining: requestInfo.daysRemaining
|
|
409
|
+
};
|
|
410
|
+
};
|
|
411
|
+
const getCooldownInfo = (featuresRequestsMap, featureKey, buttons, workplaceId) => {
|
|
412
|
+
const cooldownInfo = {};
|
|
413
|
+
for (const button of buttons) if (button.requestType) cooldownInfo[button.requestType] = getCooldownStatus(featuresRequestsMap, featureKey, button.requestType, workplaceId);
|
|
414
|
+
return cooldownInfo;
|
|
415
|
+
};
|
|
416
|
+
//#endregion
|
|
417
|
+
//#region src/stores/userStore.js
|
|
418
|
+
var UserStore = class {
|
|
419
|
+
currentUser = null;
|
|
420
|
+
permissionsMap = null;
|
|
421
|
+
featuresMap = null;
|
|
422
|
+
featuresRequestsMap = null;
|
|
423
|
+
constructor() {
|
|
424
|
+
makeObservable(this, {
|
|
425
|
+
currentUser: observable.deep,
|
|
426
|
+
permissionsMap: observable.deep,
|
|
427
|
+
featuresMap: observable.deep,
|
|
428
|
+
featuresRequestsMap: observable.deep,
|
|
429
|
+
setCurrentUser: action,
|
|
430
|
+
removeCurrentUser: action,
|
|
431
|
+
setPermissionsMap: action,
|
|
432
|
+
setFeaturesMap: action,
|
|
433
|
+
setFeaturesRequestsMap: action,
|
|
434
|
+
getCurrentUserJS: computed
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
setCurrentUser(currentUser) {
|
|
438
|
+
this.currentUser = currentUser;
|
|
439
|
+
if (currentUser) {
|
|
440
|
+
this.setPermissionsMap(currentUser.permissionsMap);
|
|
441
|
+
this.setFeaturesMap(currentUser.featuresMap);
|
|
442
|
+
this.setFeaturesRequestsMap(currentUser.featuresRequestsMap);
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
removeCurrentUser() {
|
|
446
|
+
this.currentUser = null;
|
|
447
|
+
this.permissionsMap = null;
|
|
448
|
+
this.featuresMap = null;
|
|
449
|
+
this.featuresRequestsMap = null;
|
|
450
|
+
}
|
|
451
|
+
setPermissionsMap(permissionsMap) {
|
|
452
|
+
this.permissionsMap = permissionsMap;
|
|
453
|
+
}
|
|
454
|
+
setFeaturesMap(featuresMap) {
|
|
455
|
+
this.featuresMap = featuresMap;
|
|
456
|
+
}
|
|
457
|
+
setFeaturesRequestsMap(featuresRequestsMap) {
|
|
458
|
+
this.featuresRequestsMap = featuresRequestsMap;
|
|
459
|
+
}
|
|
460
|
+
get getCurrentUserJS() {
|
|
461
|
+
return toJS(this.currentUser);
|
|
462
|
+
}
|
|
463
|
+
};
|
|
464
|
+
var userStore_default = new UserStore();
|
|
465
|
+
//#endregion
|
|
466
|
+
//#region src/hooks/useFeatures.js
|
|
467
|
+
const useFeatures = () => {
|
|
468
|
+
const [featuresMap, setFeaturesMap] = useState(toJS(userStore_default.featuresMap));
|
|
469
|
+
useEffect(() => reaction(() => toJS(userStore_default.featuresMap), (newFeaturesMap) => {
|
|
470
|
+
setFeaturesMap(newFeaturesMap);
|
|
471
|
+
}), []);
|
|
472
|
+
const getFeature = useCallback((featureKey) => {
|
|
473
|
+
if (!featuresMap) return null;
|
|
474
|
+
return featuresMap[featureKey] || null;
|
|
475
|
+
}, [featuresMap]);
|
|
476
|
+
const getFeatures = useCallback((featureKeys) => featureKeys.reduce((acc, key) => {
|
|
477
|
+
acc[key] = getFeature(key);
|
|
478
|
+
return acc;
|
|
479
|
+
}, {}), [getFeature]);
|
|
480
|
+
return useMemo(() => ({
|
|
481
|
+
getFeature,
|
|
482
|
+
getFeatures,
|
|
483
|
+
featuresMap
|
|
484
|
+
}), [
|
|
485
|
+
getFeature,
|
|
486
|
+
getFeatures,
|
|
487
|
+
featuresMap
|
|
488
|
+
]);
|
|
489
|
+
};
|
|
490
|
+
//#endregion
|
|
491
|
+
//#region src/hooks/usePermissions.js
|
|
492
|
+
/**
|
|
493
|
+
* Parses permission value to extract deny reason
|
|
494
|
+
* @param {string} value - Permission value (e.g., "ALLOW", "DENY:MISSING_ROLE_PERMISSION")
|
|
495
|
+
* @returns {{ isAllowed: boolean, denyReason: string | null }}
|
|
496
|
+
*/
|
|
497
|
+
const parsePermissionValue = (value) => {
|
|
498
|
+
if (!value || value === "ALLOW") return {
|
|
499
|
+
isAllowed: true,
|
|
500
|
+
denyReason: null
|
|
501
|
+
};
|
|
502
|
+
return {
|
|
503
|
+
isAllowed: false,
|
|
504
|
+
denyReason: value.startsWith("DENY:") ? value.slice(5) : value
|
|
505
|
+
};
|
|
506
|
+
};
|
|
507
|
+
const usePermissions = () => {
|
|
508
|
+
const [permissionsMap, setPermissionsMap] = useState(toJS(userStore_default.permissionsMap));
|
|
509
|
+
useEffect(() => reaction(() => toJS(userStore_default.permissionsMap), (newPermissionsMap) => {
|
|
510
|
+
setPermissionsMap(newPermissionsMap);
|
|
511
|
+
}), []);
|
|
512
|
+
const checkPermission = useCallback((permissionKey) => {
|
|
513
|
+
if (!permissionsMap) return {
|
|
514
|
+
isAllowed: false,
|
|
515
|
+
denyReason: null
|
|
516
|
+
};
|
|
517
|
+
const value = permissionsMap[permissionKey];
|
|
518
|
+
return parsePermissionValue(value);
|
|
519
|
+
}, [permissionsMap]);
|
|
520
|
+
const checkPermissions = useCallback((permissionKeys) => {
|
|
521
|
+
const results = permissionKeys.reduce((acc, key) => {
|
|
522
|
+
acc[key] = checkPermission(key);
|
|
523
|
+
return acc;
|
|
524
|
+
}, {});
|
|
525
|
+
const deniedKeys = permissionKeys.filter((key) => !results[key].isAllowed);
|
|
526
|
+
return {
|
|
527
|
+
allAllowed: deniedKeys.length === 0,
|
|
528
|
+
results,
|
|
529
|
+
deniedKeys
|
|
530
|
+
};
|
|
531
|
+
}, [checkPermission]);
|
|
532
|
+
return useMemo(() => ({
|
|
533
|
+
checkPermission,
|
|
534
|
+
checkPermissions,
|
|
535
|
+
permissionsMap
|
|
536
|
+
}), [
|
|
537
|
+
checkPermission,
|
|
538
|
+
checkPermissions,
|
|
539
|
+
permissionsMap
|
|
540
|
+
]);
|
|
541
|
+
};
|
|
542
|
+
//#endregion
|
|
543
|
+
//#region src/hooks/useAccess/accessState.js
|
|
544
|
+
/**
|
|
545
|
+
* Maps feature status to AccessState
|
|
546
|
+
* @param {string} status - Feature status from API
|
|
547
|
+
* @returns {'accessible' | 'no_permission' | 'expired' | 'not_purchased'}
|
|
548
|
+
*/
|
|
549
|
+
const getAccessState = (status) => {
|
|
550
|
+
switch (status) {
|
|
551
|
+
case "accessible": return "accessible";
|
|
552
|
+
case "no_permission": return "no_permission";
|
|
553
|
+
case "trial_expired_recent":
|
|
554
|
+
case "trial_expired_old": return "expired";
|
|
555
|
+
default: return "not_purchased";
|
|
556
|
+
}
|
|
557
|
+
};
|
|
558
|
+
/**
|
|
559
|
+
* Priority order for aggregating access states
|
|
560
|
+
* no_permission > expired > not_purchased > accessible
|
|
561
|
+
*/
|
|
562
|
+
const ACCESS_STATE_PRIORITY = {
|
|
563
|
+
no_permission: 1,
|
|
564
|
+
expired: 2,
|
|
565
|
+
not_purchased: 3,
|
|
566
|
+
accessible: 4
|
|
567
|
+
};
|
|
568
|
+
//#endregion
|
|
569
|
+
//#region src/hooks/useAccess/deriveButtons.js
|
|
570
|
+
/**
|
|
571
|
+
* Derives available buttons based on status and daysSinceExpiry
|
|
572
|
+
* @param {string} status - Feature status from API
|
|
573
|
+
* @param {number|null} daysSinceExpiry - Days since expiry
|
|
574
|
+
* @returns {Array<{action: string, requestType: string|null, variant: 'primary'|'secondary'|'link'}>}
|
|
575
|
+
*/
|
|
576
|
+
const deriveButtons = (status, daysSinceExpiry) => {
|
|
577
|
+
switch (status) {
|
|
578
|
+
case "accessible": return [];
|
|
579
|
+
case "no_permission": return [{
|
|
580
|
+
action: "request_access",
|
|
581
|
+
requestType: "feature_access",
|
|
582
|
+
variant: "primary"
|
|
583
|
+
}];
|
|
584
|
+
case "trial_expired_recent": return [{
|
|
585
|
+
action: "renew",
|
|
586
|
+
requestType: "trial_expired",
|
|
587
|
+
variant: "primary"
|
|
588
|
+
}, {
|
|
589
|
+
action: "wishlist",
|
|
590
|
+
requestType: "wishlist",
|
|
591
|
+
variant: "link"
|
|
592
|
+
}];
|
|
593
|
+
case "trial_expired_old":
|
|
594
|
+
if (daysSinceExpiry >= 180) return [
|
|
595
|
+
{
|
|
596
|
+
action: "start_trial",
|
|
597
|
+
requestType: null,
|
|
598
|
+
variant: "primary"
|
|
599
|
+
},
|
|
600
|
+
{
|
|
601
|
+
action: "buy",
|
|
602
|
+
requestType: "purchase",
|
|
603
|
+
variant: "secondary"
|
|
604
|
+
},
|
|
605
|
+
{
|
|
606
|
+
action: "wishlist",
|
|
607
|
+
requestType: "wishlist",
|
|
608
|
+
variant: "link"
|
|
609
|
+
}
|
|
610
|
+
];
|
|
611
|
+
return [{
|
|
612
|
+
action: "renew",
|
|
613
|
+
requestType: "trial_expired",
|
|
614
|
+
variant: "primary"
|
|
615
|
+
}, {
|
|
616
|
+
action: "wishlist",
|
|
617
|
+
requestType: "wishlist",
|
|
618
|
+
variant: "link"
|
|
619
|
+
}];
|
|
620
|
+
default: return [
|
|
621
|
+
{
|
|
622
|
+
action: "start_trial",
|
|
623
|
+
requestType: null,
|
|
624
|
+
variant: "primary"
|
|
625
|
+
},
|
|
626
|
+
{
|
|
627
|
+
action: "buy",
|
|
628
|
+
requestType: "purchase",
|
|
629
|
+
variant: "secondary"
|
|
630
|
+
},
|
|
631
|
+
{
|
|
632
|
+
action: "wishlist",
|
|
633
|
+
requestType: "wishlist",
|
|
634
|
+
variant: "link"
|
|
635
|
+
}
|
|
636
|
+
];
|
|
637
|
+
}
|
|
638
|
+
};
|
|
639
|
+
//#endregion
|
|
640
|
+
//#region src/hooks/useAccess/index.js
|
|
641
|
+
/**
|
|
642
|
+
* Hook for checking feature access based on features and permissions
|
|
643
|
+
* @param {string[]} features - Array of feature keys to check
|
|
644
|
+
* @param {{ extraPermissions?: string[], workplaceId?: string }} options - Additional options
|
|
645
|
+
* @returns {UseAccessResult}
|
|
646
|
+
*/
|
|
647
|
+
const useAccess = (features = [], options = {}) => {
|
|
648
|
+
const { extraPermissions = [], workplaceId } = options;
|
|
649
|
+
const { getFeature } = useFeatures();
|
|
650
|
+
const { checkPermissions } = usePermissions();
|
|
651
|
+
const [featuresRequestsMap, setFeaturesRequestsMap] = useState(toJS(userStore_default.featuresRequestsMap));
|
|
652
|
+
useEffect(() => reaction(() => toJS(userStore_default.featuresRequestsMap), (newFeaturesRequestsMap) => {
|
|
653
|
+
setFeaturesRequestsMap(newFeaturesRequestsMap);
|
|
654
|
+
}), []);
|
|
655
|
+
return useMemo(() => {
|
|
656
|
+
const featureResults = features.map((featureKey) => {
|
|
657
|
+
const featureInfo = getFeature(featureKey);
|
|
658
|
+
if (!featureInfo) return {
|
|
659
|
+
featureKey,
|
|
660
|
+
hasAccess: false,
|
|
661
|
+
accessState: "not_purchased",
|
|
662
|
+
daysSinceExpiry: null,
|
|
663
|
+
buttons: deriveButtons("not_purchased", null)
|
|
664
|
+
};
|
|
665
|
+
const accessState = getAccessState(featureInfo.status);
|
|
666
|
+
return {
|
|
667
|
+
featureKey,
|
|
668
|
+
hasAccess: accessState === "accessible",
|
|
669
|
+
accessState,
|
|
670
|
+
daysSinceExpiry: featureInfo.daysSinceExpiry,
|
|
671
|
+
buttons: deriveButtons(featureInfo.status, featureInfo.daysSinceExpiry)
|
|
672
|
+
};
|
|
673
|
+
});
|
|
674
|
+
const aggregatedState = featureResults.reduce((acc, feat) => ACCESS_STATE_PRIORITY[feat.accessState] < ACCESS_STATE_PRIORITY[acc] ? feat.accessState : acc, "accessible");
|
|
675
|
+
const extraPermissionsResult = checkPermissions(extraPermissions);
|
|
676
|
+
const allPermissionsResult = checkPermissions([...features.flatMap((key) => {
|
|
677
|
+
return getFeature(key)?.permissions || [];
|
|
678
|
+
}), ...extraPermissions]);
|
|
679
|
+
const hasAccess = aggregatedState === "accessible" && extraPermissionsResult.allAllowed;
|
|
680
|
+
const mostRestrictiveFeature = featureResults.reduce((acc, feat) => ACCESS_STATE_PRIORITY[feat.accessState] < ACCESS_STATE_PRIORITY[acc?.accessState || "accessible"] ? feat : acc, featureResults[0]);
|
|
681
|
+
const buttons = mostRestrictiveFeature?.buttons || [];
|
|
682
|
+
const cooldownInfo = getCooldownInfo(featuresRequestsMap, mostRestrictiveFeature?.featureKey, buttons, workplaceId);
|
|
683
|
+
return {
|
|
684
|
+
hasAccess,
|
|
685
|
+
accessState: hasAccess ? "accessible" : aggregatedState,
|
|
686
|
+
features: featureResults,
|
|
687
|
+
buttons,
|
|
688
|
+
cooldownInfo,
|
|
689
|
+
missingPermissions: allPermissionsResult.deniedKeys
|
|
690
|
+
};
|
|
691
|
+
}, [
|
|
692
|
+
features,
|
|
693
|
+
extraPermissions,
|
|
694
|
+
workplaceId,
|
|
695
|
+
getFeature,
|
|
696
|
+
checkPermissions,
|
|
697
|
+
featuresRequestsMap
|
|
698
|
+
]);
|
|
699
|
+
};
|
|
700
|
+
//#endregion
|
|
701
|
+
//#region src/components/access/AccessGuard.js
|
|
702
|
+
const AccessGuard = ({ features: featuresProp = [], extraPermissions = [], workplaceId, onTrialRequest, onFeatureRequest, backgroundImage, children }) => {
|
|
703
|
+
const { hasAccess, accessState, buttons, cooldownInfo, features } = useAccess(featuresProp, {
|
|
704
|
+
extraPermissions,
|
|
705
|
+
workplaceId
|
|
706
|
+
});
|
|
707
|
+
if (hasAccess) return children;
|
|
708
|
+
const mostRestrictiveFeature = features.find((feat) => feat.accessState === accessState);
|
|
709
|
+
const daysSinceExpiry = mostRestrictiveFeature?.daysSinceExpiry || null;
|
|
710
|
+
const featureKey = mostRestrictiveFeature?.featureKey || featuresProp[0];
|
|
711
|
+
return /* @__PURE__ */ React.createElement(AccessBlocker, {
|
|
712
|
+
accessState,
|
|
713
|
+
buttons,
|
|
714
|
+
daysSinceExpiry,
|
|
715
|
+
featureKey,
|
|
716
|
+
workplaceId,
|
|
717
|
+
cooldownInfo,
|
|
718
|
+
onTrialRequest,
|
|
719
|
+
onFeatureRequest,
|
|
720
|
+
backgroundImage
|
|
721
|
+
});
|
|
722
|
+
};
|
|
723
|
+
//#endregion
|
|
724
|
+
//#region src/components/access/withAccessGuard.js
|
|
725
|
+
const withAccessGuard = (featuresProp = [], options = {}) => {
|
|
726
|
+
const { extraPermissions = [], workplaceId } = options;
|
|
727
|
+
return (WrappedComponent) => {
|
|
728
|
+
const WithAccessGuard = (props) => {
|
|
729
|
+
const { onTrialRequest, onFeatureRequest, ...restProps } = props;
|
|
730
|
+
const { hasAccess, accessState, buttons, cooldownInfo, features, missingPermissions } = useAccess(featuresProp, {
|
|
731
|
+
extraPermissions,
|
|
732
|
+
workplaceId
|
|
733
|
+
});
|
|
734
|
+
const mostRestrictiveFeature = features.find((feat) => feat.accessState === accessState);
|
|
735
|
+
const daysSinceExpiry = mostRestrictiveFeature?.daysSinceExpiry || null;
|
|
736
|
+
const featureKey = mostRestrictiveFeature?.featureKey || featuresProp[0];
|
|
737
|
+
if (hasAccess) return /* @__PURE__ */ React.createElement(WrappedComponent, {
|
|
738
|
+
...restProps,
|
|
739
|
+
accessState,
|
|
740
|
+
hasAccess,
|
|
741
|
+
missingPermissions
|
|
742
|
+
});
|
|
743
|
+
return /* @__PURE__ */ React.createElement(AccessBlocker, {
|
|
744
|
+
accessState,
|
|
745
|
+
buttons,
|
|
746
|
+
daysSinceExpiry,
|
|
747
|
+
featureKey,
|
|
748
|
+
workplaceId,
|
|
749
|
+
cooldownInfo,
|
|
750
|
+
onTrialRequest,
|
|
751
|
+
onFeatureRequest
|
|
752
|
+
});
|
|
753
|
+
};
|
|
754
|
+
WithAccessGuard.displayName = `withAccessGuard(${WrappedComponent.displayName || WrappedComponent.name || "Component"})`;
|
|
755
|
+
return WithAccessGuard;
|
|
756
|
+
};
|
|
757
|
+
};
|
|
758
|
+
//#endregion
|
|
759
|
+
//#region src/stores/SessionStore/CookiesManager.ts
|
|
760
|
+
const COOKIE_EXPIRES_DAYS = 3650;
|
|
761
|
+
const AUTH_COOKIE_BASE = "authHeaders";
|
|
762
|
+
const extractEnvironment = (hostname) => {
|
|
763
|
+
if (hostname.endsWith(".andoncloud.com") || !hostname.endsWith(".andoncloud.net")) return null;
|
|
764
|
+
const parts = hostname.slice(0, -15).split(".");
|
|
765
|
+
if (parts.length >= 2) return parts.slice(1).join(".");
|
|
766
|
+
const dashIndex = parts[0].indexOf("-");
|
|
767
|
+
if (dashIndex === -1) return null;
|
|
768
|
+
return parts[0].slice(dashIndex + 1);
|
|
769
|
+
};
|
|
770
|
+
const resolveAuthCookieName = (hostname) => {
|
|
771
|
+
const env = extractEnvironment(hostname);
|
|
772
|
+
return env ? `${AUTH_COOKIE_BASE}_${env}` : AUTH_COOKIE_BASE;
|
|
773
|
+
};
|
|
774
|
+
var CookiesManager = class {
|
|
775
|
+
static recognizeRootDomain() {
|
|
776
|
+
if (!this.rootDomain) {
|
|
777
|
+
const host = window.location.hostname;
|
|
778
|
+
if (window.location.port.length === 0) {
|
|
779
|
+
const [, ...parts] = host.split(".");
|
|
780
|
+
this.rootDomain = parts.join(".");
|
|
781
|
+
} else this.rootDomain = host;
|
|
782
|
+
}
|
|
783
|
+
return this.rootDomain;
|
|
784
|
+
}
|
|
785
|
+
static getAuthCookieName() {
|
|
786
|
+
if (!this.authCookieName) this.authCookieName = resolveAuthCookieName(window.location.hostname);
|
|
787
|
+
return this.authCookieName;
|
|
788
|
+
}
|
|
789
|
+
static get(key) {
|
|
790
|
+
return Cookies.get(key);
|
|
791
|
+
}
|
|
792
|
+
static set(key, value) {
|
|
793
|
+
const domain = this.recognizeRootDomain();
|
|
794
|
+
Cookies.set(key, value, {
|
|
795
|
+
domain,
|
|
796
|
+
secure: window.location.protocol === "https:",
|
|
797
|
+
sameSite: "lax",
|
|
798
|
+
expires: COOKIE_EXPIRES_DAYS
|
|
799
|
+
});
|
|
800
|
+
}
|
|
801
|
+
static remove(key) {
|
|
802
|
+
const domain = this.recognizeRootDomain();
|
|
803
|
+
Cookies.remove(key, {
|
|
804
|
+
domain,
|
|
805
|
+
secure: window.location.protocol === "https:",
|
|
806
|
+
sameSite: "lax"
|
|
807
|
+
});
|
|
808
|
+
}
|
|
809
|
+
static getAuthData() {
|
|
810
|
+
const raw = this.get(this.getAuthCookieName());
|
|
811
|
+
if (!raw) return null;
|
|
812
|
+
try {
|
|
813
|
+
return JSON.parse(raw);
|
|
814
|
+
} catch {
|
|
815
|
+
return null;
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
static setAuthData(data) {
|
|
819
|
+
this.set(this.getAuthCookieName(), JSON.stringify(data));
|
|
820
|
+
}
|
|
821
|
+
static removeAuthData() {
|
|
822
|
+
this.remove(this.getAuthCookieName());
|
|
823
|
+
}
|
|
824
|
+
};
|
|
825
|
+
//#endregion
|
|
826
|
+
//#region src/stores/SessionStore/TokenCoordinator.ts
|
|
827
|
+
const REFRESH_TIMEOUT_MS = 15e3;
|
|
828
|
+
const LOCK_KEY = "auth-token-refresh";
|
|
829
|
+
const CHANNEL_NAME = "auth-events";
|
|
830
|
+
const PROACTIVE_REFRESH_RATIO = .8;
|
|
831
|
+
const MAX_RETRIES = 3;
|
|
832
|
+
const BACKOFF_BASE_MS = 1e3;
|
|
833
|
+
var TokenCoordinator = class {
|
|
834
|
+
constructor() {
|
|
835
|
+
this.refreshPromise = null;
|
|
836
|
+
this.refreshTimer = null;
|
|
837
|
+
this.broadcastChannel = null;
|
|
838
|
+
this.store = null;
|
|
839
|
+
this.onLogout = null;
|
|
840
|
+
this.requestQueue = [];
|
|
841
|
+
this.authFetchFn = null;
|
|
842
|
+
}
|
|
843
|
+
init(store, onLogout) {
|
|
844
|
+
this.store = store;
|
|
845
|
+
this.onLogout = onLogout;
|
|
846
|
+
this.initBroadcastChannel();
|
|
847
|
+
this.initVisibilityListener();
|
|
848
|
+
}
|
|
849
|
+
setAuthFetch(fn) {
|
|
850
|
+
this.authFetchFn = fn;
|
|
851
|
+
}
|
|
852
|
+
initBroadcastChannel() {
|
|
853
|
+
if (typeof BroadcastChannel === "undefined") return;
|
|
854
|
+
this.broadcastChannel = new BroadcastChannel(CHANNEL_NAME);
|
|
855
|
+
this.broadcastChannel.onmessage = (event) => {
|
|
856
|
+
this.handleBroadcast(event.data);
|
|
857
|
+
};
|
|
858
|
+
}
|
|
859
|
+
handleBroadcast(event) {
|
|
860
|
+
if (!this.store) return;
|
|
861
|
+
switch (event.type) {
|
|
862
|
+
case "TOKEN_REFRESHED":
|
|
863
|
+
this.handleTokenRefreshedBroadcast();
|
|
864
|
+
break;
|
|
865
|
+
case "LOGOUT":
|
|
866
|
+
this.handleLogoutBroadcast();
|
|
867
|
+
break;
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
handleTokenRefreshedBroadcast() {
|
|
871
|
+
if (!this.store) return;
|
|
872
|
+
const cookieData = CookiesManager.getAuthData();
|
|
873
|
+
if (!cookieData) return;
|
|
874
|
+
if (this.store.session) {
|
|
875
|
+
this.store.session.accessToken = cookieData["access-token"];
|
|
876
|
+
this.store.session.refreshToken = cookieData["refresh-token"];
|
|
877
|
+
this.store.session.tokenType = cookieData["token-type"];
|
|
878
|
+
this.store.session.createdAt = cookieData["created-at"];
|
|
879
|
+
this.store.session.expiresIn = cookieData["expires-in"];
|
|
880
|
+
this.store.setConnectedLoginStatus();
|
|
881
|
+
this.scheduleProactiveRefresh();
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
handleLogoutBroadcast() {
|
|
885
|
+
this.clearRefreshTimer();
|
|
886
|
+
this.refreshPromise = null;
|
|
887
|
+
if (this.onLogout) this.onLogout();
|
|
888
|
+
}
|
|
889
|
+
initVisibilityListener() {
|
|
890
|
+
document.addEventListener("visibilitychange", () => {
|
|
891
|
+
if (document.visibilityState !== "visible") return;
|
|
892
|
+
if (!this.store?.session) return;
|
|
893
|
+
const { createdAt, expiresIn } = this.store.session;
|
|
894
|
+
const now = Math.round(Date.now() / 1e3);
|
|
895
|
+
if (createdAt + expiresIn < now) this.refresh();
|
|
896
|
+
});
|
|
897
|
+
}
|
|
898
|
+
refresh() {
|
|
899
|
+
if (this.refreshPromise) return this.refreshPromise;
|
|
900
|
+
this.refreshPromise = this.doRefresh().finally(() => {
|
|
901
|
+
this.refreshPromise = null;
|
|
902
|
+
});
|
|
903
|
+
return this.refreshPromise;
|
|
904
|
+
}
|
|
905
|
+
isRefreshing() {
|
|
906
|
+
return this.refreshPromise !== null;
|
|
907
|
+
}
|
|
908
|
+
async doRefresh() {
|
|
909
|
+
if (!this.store?.session) return null;
|
|
910
|
+
if (typeof navigator !== "undefined" && "locks" in navigator) return this.refreshWithLock();
|
|
911
|
+
return this.executeRefresh();
|
|
912
|
+
}
|
|
913
|
+
async refreshWithLock() {
|
|
914
|
+
return navigator.locks.request(LOCK_KEY, async () => {
|
|
915
|
+
const cookieData = CookiesManager.getAuthData();
|
|
916
|
+
if (cookieData && this.store?.session) {
|
|
917
|
+
const cookieCreatedAt = cookieData["created-at"];
|
|
918
|
+
const cookieExpiresIn = cookieData["expires-in"];
|
|
919
|
+
const now = Math.round(Date.now() / 1e3);
|
|
920
|
+
if (cookieCreatedAt + cookieExpiresIn > now && cookieCreatedAt > this.store.session.createdAt) {
|
|
921
|
+
this.store.session.accessToken = cookieData["access-token"];
|
|
922
|
+
this.store.session.refreshToken = cookieData["refresh-token"];
|
|
923
|
+
this.store.session.tokenType = cookieData["token-type"];
|
|
924
|
+
this.store.session.createdAt = cookieCreatedAt;
|
|
925
|
+
this.store.session.expiresIn = cookieExpiresIn;
|
|
926
|
+
this.store.setConnectedLoginStatus();
|
|
927
|
+
this.scheduleProactiveRefresh();
|
|
928
|
+
return this.store.session;
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
return this.executeRefresh();
|
|
932
|
+
});
|
|
933
|
+
}
|
|
934
|
+
async executeRefresh() {
|
|
935
|
+
return this.refreshWithRetry(0);
|
|
936
|
+
}
|
|
937
|
+
async refreshWithRetry(attempt) {
|
|
938
|
+
if (!this.store?.session) return null;
|
|
939
|
+
const controller = new AbortController();
|
|
940
|
+
const timeout = setTimeout(() => controller.abort(), REFRESH_TIMEOUT_MS);
|
|
941
|
+
try {
|
|
942
|
+
const session = await this.store.api.authorize({
|
|
943
|
+
refresh: this.store.session.refreshToken,
|
|
944
|
+
signal: controller.signal
|
|
945
|
+
});
|
|
946
|
+
clearTimeout(timeout);
|
|
947
|
+
if (session) {
|
|
948
|
+
this.store.session = {
|
|
949
|
+
...this.store.session,
|
|
950
|
+
...session,
|
|
951
|
+
user: this.store.session.user
|
|
952
|
+
};
|
|
953
|
+
this.store.storeSession();
|
|
954
|
+
this.store.setConnectedLoginStatus();
|
|
955
|
+
this.broadcast("TOKEN_REFRESHED");
|
|
956
|
+
this.scheduleProactiveRefresh();
|
|
957
|
+
this.replayQueue();
|
|
958
|
+
return this.store.session;
|
|
959
|
+
}
|
|
960
|
+
this.rejectQueue(/* @__PURE__ */ new Error("Token refresh failed"));
|
|
961
|
+
this.triggerLogout();
|
|
962
|
+
return null;
|
|
963
|
+
} catch (error) {
|
|
964
|
+
clearTimeout(timeout);
|
|
965
|
+
if (attempt < MAX_RETRIES) {
|
|
966
|
+
const delay = BACKOFF_BASE_MS * Math.pow(2, attempt);
|
|
967
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
968
|
+
return this.refreshWithRetry(attempt + 1);
|
|
969
|
+
}
|
|
970
|
+
captureException$1(error instanceof Error ? error : /* @__PURE__ */ new Error("Token refresh failed"), { extra: {
|
|
971
|
+
retryCount: attempt,
|
|
972
|
+
grantType: "refresh_token"
|
|
973
|
+
} });
|
|
974
|
+
this.rejectQueue(/* @__PURE__ */ new Error("Token refresh failed after retries"));
|
|
975
|
+
this.triggerLogout();
|
|
976
|
+
return null;
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
async handleUnauthorized(url, options) {
|
|
980
|
+
if (this.refreshPromise) return this.enqueue(url, options);
|
|
981
|
+
const refreshResult = this.refresh();
|
|
982
|
+
const queuePromise = this.enqueue(url, options);
|
|
983
|
+
await refreshResult;
|
|
984
|
+
return queuePromise;
|
|
985
|
+
}
|
|
986
|
+
enqueue(url, options) {
|
|
987
|
+
return new Promise((resolve, reject) => {
|
|
988
|
+
this.requestQueue.push({
|
|
989
|
+
resolve,
|
|
990
|
+
reject,
|
|
991
|
+
url,
|
|
992
|
+
options
|
|
993
|
+
});
|
|
994
|
+
});
|
|
995
|
+
}
|
|
996
|
+
replayQueue() {
|
|
997
|
+
const queue = this.requestQueue.splice(0);
|
|
998
|
+
for (const request of queue) {
|
|
999
|
+
if (!this.authFetchFn) {
|
|
1000
|
+
request.reject(/* @__PURE__ */ new Error("authFetch not initialized"));
|
|
1001
|
+
continue;
|
|
1002
|
+
}
|
|
1003
|
+
this.authFetchFn(request.url, request.options).then(request.resolve, request.reject);
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
rejectQueue(error) {
|
|
1007
|
+
const queue = this.requestQueue.splice(0);
|
|
1008
|
+
for (const request of queue) request.reject(error);
|
|
1009
|
+
}
|
|
1010
|
+
scheduleProactiveRefresh() {
|
|
1011
|
+
this.clearRefreshTimer();
|
|
1012
|
+
if (!this.store?.session) return;
|
|
1013
|
+
const { expiresIn } = this.store.session;
|
|
1014
|
+
const delayMs = expiresIn * PROACTIVE_REFRESH_RATIO * 1e3;
|
|
1015
|
+
this.refreshTimer = setTimeout(() => {
|
|
1016
|
+
if (!this.refreshPromise) this.refresh();
|
|
1017
|
+
}, delayMs);
|
|
1018
|
+
}
|
|
1019
|
+
clearRefreshTimer() {
|
|
1020
|
+
if (this.refreshTimer) {
|
|
1021
|
+
clearTimeout(this.refreshTimer);
|
|
1022
|
+
this.refreshTimer = null;
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
broadcast(type) {
|
|
1026
|
+
if (!this.broadcastChannel) return;
|
|
1027
|
+
this.broadcastChannel.postMessage({ type });
|
|
1028
|
+
}
|
|
1029
|
+
broadcastLogout() {
|
|
1030
|
+
this.broadcast("LOGOUT");
|
|
1031
|
+
}
|
|
1032
|
+
triggerLogout() {
|
|
1033
|
+
this.clearRefreshTimer();
|
|
1034
|
+
if (this.store) {
|
|
1035
|
+
this.store.removeSession();
|
|
1036
|
+
this.store.removeCurrentUser();
|
|
1037
|
+
this.store.setNotAuthorizedLoginStatus();
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
dispose() {
|
|
1041
|
+
this.clearRefreshTimer();
|
|
1042
|
+
if (this.broadcastChannel) {
|
|
1043
|
+
this.broadcastChannel.close();
|
|
1044
|
+
this.broadcastChannel = null;
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
};
|
|
1048
|
+
const tokenCoordinator = new TokenCoordinator();
|
|
1049
|
+
//#endregion
|
|
1050
|
+
//#region src/stores/SessionStore/SessionStore.ts
|
|
1051
|
+
function createSessionAPI() {
|
|
1052
|
+
let baseUrl = "";
|
|
1053
|
+
let clientId = "";
|
|
1054
|
+
let redirectUri = "";
|
|
1055
|
+
return {
|
|
1056
|
+
setAuthConfig(config) {
|
|
1057
|
+
baseUrl = config.baseUrl;
|
|
1058
|
+
clientId = config.clientId;
|
|
1059
|
+
redirectUri = config.redirectUri;
|
|
1060
|
+
},
|
|
1061
|
+
async authorize(credentials) {
|
|
1062
|
+
const formData = new FormData();
|
|
1063
|
+
const { scope, refresh, code, username, password } = credentials;
|
|
1064
|
+
formData.append("client_id", clientId);
|
|
1065
|
+
if (scope) formData.append("scope", scope);
|
|
1066
|
+
if (refresh) {
|
|
1067
|
+
formData.append("grant_type", "refresh_token");
|
|
1068
|
+
formData.append("refresh_token", refresh);
|
|
1069
|
+
formData.append("redirect_uri", redirectUri);
|
|
1070
|
+
} else if (code) {
|
|
1071
|
+
formData.append("grant_type", "authorization_code");
|
|
1072
|
+
formData.append("code", code);
|
|
1073
|
+
formData.append("redirect_uri", redirectUri);
|
|
1074
|
+
} else {
|
|
1075
|
+
formData.append("grant_type", "password");
|
|
1076
|
+
formData.append("username", username ?? "");
|
|
1077
|
+
formData.append("password", password ?? "");
|
|
1078
|
+
}
|
|
1079
|
+
const fetchParams = {
|
|
1080
|
+
method: "POST",
|
|
1081
|
+
body: formData,
|
|
1082
|
+
signal: credentials.signal
|
|
1083
|
+
};
|
|
1084
|
+
let session = null;
|
|
1085
|
+
await globalThis.fetch(`${baseUrl}/v2/oauth2/token`, fetchParams).then(async (response) => {
|
|
1086
|
+
let data;
|
|
1087
|
+
try {
|
|
1088
|
+
data = await response.json();
|
|
1089
|
+
if (!response.ok || response.status !== 200) {
|
|
1090
|
+
toast$1.error(data.error_description ?? "");
|
|
1091
|
+
return;
|
|
1092
|
+
}
|
|
1093
|
+
} catch {
|
|
1094
|
+
toast$1.error(i18n.t("somethingWentWrongMessage"));
|
|
1095
|
+
return;
|
|
1096
|
+
}
|
|
1097
|
+
session = {
|
|
1098
|
+
user: null,
|
|
1099
|
+
accessToken: data.access_token,
|
|
1100
|
+
refreshToken: data.refresh_token,
|
|
1101
|
+
tokenType: data.token_type,
|
|
1102
|
+
createdAt: data.created_at,
|
|
1103
|
+
expiresIn: data.expires_in
|
|
1104
|
+
};
|
|
1105
|
+
if (!refresh) session.user = await this.getUserData({
|
|
1106
|
+
token_type: data.token_type,
|
|
1107
|
+
access_token: data.access_token
|
|
1108
|
+
});
|
|
1109
|
+
}).catch((e) => {
|
|
1110
|
+
toast$1.error(e.message);
|
|
1111
|
+
});
|
|
1112
|
+
return session;
|
|
1113
|
+
},
|
|
1114
|
+
async getUserData(authData) {
|
|
1115
|
+
const fetchParams = { method: "GET" };
|
|
1116
|
+
if (authData) fetchParams.headers = { Authorization: `${authData.token_type} ${authData.access_token}` };
|
|
1117
|
+
const response = await globalThis.fetch(`${baseUrl}/v2/me`, fetchParams);
|
|
1118
|
+
if (!response?.ok) return null;
|
|
1119
|
+
const { user } = await response.json();
|
|
1120
|
+
return {
|
|
1121
|
+
id: user.id,
|
|
1122
|
+
companyId: user.company_id,
|
|
1123
|
+
roleId: user.role_id,
|
|
1124
|
+
username: user.username,
|
|
1125
|
+
email: user.email,
|
|
1126
|
+
name: user.name,
|
|
1127
|
+
permissionsMap: user.permissions_map ?? null,
|
|
1128
|
+
featuresMap: convertFeaturesMapToCamelCase(user.features_map),
|
|
1129
|
+
featuresRequestsMap: convertFeaturesRequestsMapToCamelCase(user.features_requests_map)
|
|
1130
|
+
};
|
|
1131
|
+
},
|
|
1132
|
+
async signOut(token) {
|
|
1133
|
+
const formData = new FormData();
|
|
1134
|
+
formData.append("client_id", clientId);
|
|
1135
|
+
formData.append("token", token);
|
|
1136
|
+
const fetchParams = {
|
|
1137
|
+
method: "POST",
|
|
1138
|
+
body: formData
|
|
1139
|
+
};
|
|
1140
|
+
await globalThis.fetch(`${baseUrl}/v2/oauth2/revoke`, fetchParams);
|
|
1141
|
+
}
|
|
1142
|
+
};
|
|
1143
|
+
}
|
|
1144
|
+
function createSessionStore() {
|
|
1145
|
+
const api = createSessionAPI();
|
|
1146
|
+
const store = makeAutoObservable({
|
|
1147
|
+
loading: false,
|
|
1148
|
+
loginStatus: { status: "unknown" },
|
|
1149
|
+
session: null,
|
|
1150
|
+
networkError: null,
|
|
1151
|
+
refreshTokenPromise: null,
|
|
1152
|
+
api,
|
|
1153
|
+
get isLoggedIn() {
|
|
1154
|
+
return Boolean(this.session);
|
|
1155
|
+
},
|
|
1156
|
+
get requestHeaders() {
|
|
1157
|
+
const headers = { "Accept-Language": i18n.language };
|
|
1158
|
+
if (this.session) headers.Authorization = `${this.session.tokenType} ${this.session.accessToken}`;
|
|
1159
|
+
return headers;
|
|
1160
|
+
},
|
|
1161
|
+
setLoading(value) {
|
|
1162
|
+
this.loading = value;
|
|
1163
|
+
},
|
|
1164
|
+
setAuthConfig(config) {
|
|
1165
|
+
api.setAuthConfig(config);
|
|
1166
|
+
},
|
|
1167
|
+
setConnectedLoginStatus() {
|
|
1168
|
+
if (!this.session?.user) return;
|
|
1169
|
+
this.loginStatus = {
|
|
1170
|
+
status: "connected",
|
|
1171
|
+
authResponse: {
|
|
1172
|
+
user: this.session.user,
|
|
1173
|
+
accessToken: this.session.accessToken,
|
|
1174
|
+
tokenType: this.session.tokenType
|
|
1175
|
+
}
|
|
1176
|
+
};
|
|
1177
|
+
},
|
|
1178
|
+
setNotAuthorizedLoginStatus() {
|
|
1179
|
+
this.loginStatus = { status: "not_authorized" };
|
|
1180
|
+
},
|
|
1181
|
+
setNetworkError(value) {
|
|
1182
|
+
this.networkError = value;
|
|
1183
|
+
},
|
|
1184
|
+
storeSession() {
|
|
1185
|
+
if (!this.session) return;
|
|
1186
|
+
CookiesManager.setAuthData({
|
|
1187
|
+
"access-token": this.session.accessToken,
|
|
1188
|
+
"refresh-token": this.session.refreshToken,
|
|
1189
|
+
"token-type": this.session.tokenType,
|
|
1190
|
+
"created-at": this.session.createdAt,
|
|
1191
|
+
"expires-in": this.session.expiresIn
|
|
1192
|
+
});
|
|
1193
|
+
},
|
|
1194
|
+
removeSession() {
|
|
1195
|
+
CookiesManager.removeAuthData();
|
|
1196
|
+
this.session = null;
|
|
1197
|
+
},
|
|
1198
|
+
setCurrentUser(user) {
|
|
1199
|
+
userStore_default.setCurrentUser(user);
|
|
1200
|
+
},
|
|
1201
|
+
removeCurrentUser() {
|
|
1202
|
+
userStore_default.removeCurrentUser();
|
|
1203
|
+
},
|
|
1204
|
+
authorize: flow(function* (credentials, storeSession = true) {
|
|
1205
|
+
this.loading = true;
|
|
1206
|
+
const session = yield api.authorize(credentials);
|
|
1207
|
+
this.loading = false;
|
|
1208
|
+
if (!session) return null;
|
|
1209
|
+
if (storeSession) {
|
|
1210
|
+
this.session = session;
|
|
1211
|
+
this.storeSession();
|
|
1212
|
+
this.setCurrentUser(session.user);
|
|
1213
|
+
this.setConnectedLoginStatus();
|
|
1214
|
+
tokenCoordinator.scheduleProactiveRefresh();
|
|
1215
|
+
}
|
|
1216
|
+
return session;
|
|
1217
|
+
}),
|
|
1218
|
+
refresh: flow(function* () {
|
|
1219
|
+
this.refreshTokenPromise = tokenCoordinator.refresh();
|
|
1220
|
+
const result = yield this.refreshTokenPromise;
|
|
1221
|
+
this.refreshTokenPromise = null;
|
|
1222
|
+
return result;
|
|
1223
|
+
}),
|
|
1224
|
+
recover: flow(function* () {
|
|
1225
|
+
if (this.session) return;
|
|
1226
|
+
const cookieData = CookiesManager.getAuthData();
|
|
1227
|
+
if (!cookieData) {
|
|
1228
|
+
this.loginStatus = { status: "not_authorized" };
|
|
1229
|
+
return;
|
|
1230
|
+
}
|
|
1231
|
+
this.session = {
|
|
1232
|
+
user: null,
|
|
1233
|
+
accessToken: cookieData["access-token"],
|
|
1234
|
+
refreshToken: cookieData["refresh-token"],
|
|
1235
|
+
tokenType: cookieData["token-type"],
|
|
1236
|
+
createdAt: cookieData["created-at"],
|
|
1237
|
+
expiresIn: cookieData["expires-in"]
|
|
1238
|
+
};
|
|
1239
|
+
const { createdAt, expiresIn } = this.session;
|
|
1240
|
+
const now = Math.round(Date.now() / 1e3);
|
|
1241
|
+
if (createdAt + expiresIn < now) {
|
|
1242
|
+
if (!(yield tokenCoordinator.refresh())) {
|
|
1243
|
+
this.removeSession();
|
|
1244
|
+
this.setNotAuthorizedLoginStatus();
|
|
1245
|
+
return;
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
const session = this.session;
|
|
1249
|
+
if (!session) return;
|
|
1250
|
+
const { tokenType, accessToken } = session;
|
|
1251
|
+
let user;
|
|
1252
|
+
try {
|
|
1253
|
+
user = yield api.getUserData({
|
|
1254
|
+
token_type: tokenType,
|
|
1255
|
+
access_token: accessToken
|
|
1256
|
+
});
|
|
1257
|
+
} catch (e) {
|
|
1258
|
+
captureException$1(e);
|
|
1259
|
+
this.networkError = {
|
|
1260
|
+
title: i18n.t("networkErrorHeader"),
|
|
1261
|
+
details: e.message
|
|
1262
|
+
};
|
|
1263
|
+
return;
|
|
1264
|
+
}
|
|
1265
|
+
if (!user) {
|
|
1266
|
+
this.removeSession();
|
|
1267
|
+
this.setNotAuthorizedLoginStatus();
|
|
1268
|
+
return;
|
|
1269
|
+
}
|
|
1270
|
+
session.user = user;
|
|
1271
|
+
this.setCurrentUser(user);
|
|
1272
|
+
this.setConnectedLoginStatus();
|
|
1273
|
+
tokenCoordinator.scheduleProactiveRefresh();
|
|
1274
|
+
}),
|
|
1275
|
+
logout: flow(function* () {
|
|
1276
|
+
if (!this.session) return;
|
|
1277
|
+
const { accessToken, refreshToken } = this.session;
|
|
1278
|
+
yield api.signOut(accessToken);
|
|
1279
|
+
yield api.signOut(refreshToken);
|
|
1280
|
+
this.removeSession();
|
|
1281
|
+
this.removeCurrentUser();
|
|
1282
|
+
this.setNotAuthorizedLoginStatus();
|
|
1283
|
+
tokenCoordinator.broadcastLogout();
|
|
1284
|
+
}),
|
|
1285
|
+
refreshUserData: flow(function* () {
|
|
1286
|
+
if (!this.session) return null;
|
|
1287
|
+
const session = this.session;
|
|
1288
|
+
const user = yield api.getUserData({
|
|
1289
|
+
token_type: session.tokenType,
|
|
1290
|
+
access_token: session.accessToken
|
|
1291
|
+
});
|
|
1292
|
+
if (user) {
|
|
1293
|
+
session.user = user;
|
|
1294
|
+
this.setCurrentUser(user);
|
|
1295
|
+
}
|
|
1296
|
+
return user;
|
|
1297
|
+
})
|
|
1298
|
+
}, { api: false });
|
|
1299
|
+
tokenCoordinator.init(store, () => {
|
|
1300
|
+
store.removeSession();
|
|
1301
|
+
store.removeCurrentUser();
|
|
1302
|
+
store.setNotAuthorizedLoginStatus();
|
|
1303
|
+
});
|
|
1304
|
+
return store;
|
|
1305
|
+
}
|
|
1306
|
+
const sessionStore = createSessionStore();
|
|
1307
|
+
//#endregion
|
|
1308
|
+
//#region src/hooks/useLoginStatus.ts
|
|
1309
|
+
const useLoginStatus = () => {
|
|
1310
|
+
const [loginStatus, setLoginStatus] = useState(sessionStore.loginStatus);
|
|
1311
|
+
useEffect(() => {
|
|
1312
|
+
return reaction(() => toJS(sessionStore.loginStatus), () => {
|
|
1313
|
+
setLoginStatus(sessionStore.loginStatus);
|
|
1314
|
+
});
|
|
1315
|
+
}, []);
|
|
1316
|
+
return loginStatus;
|
|
1317
|
+
};
|
|
1318
|
+
//#endregion
|
|
1319
|
+
//#region src/hooks/useModalHook/ModalContext.js
|
|
1320
|
+
const ModalContext = React.createContext({
|
|
1321
|
+
showModal: null,
|
|
1322
|
+
hideModal: null,
|
|
1323
|
+
isOpenedModal: false
|
|
1324
|
+
});
|
|
1325
|
+
//#endregion
|
|
1326
|
+
//#region src/hooks/useModalHook/ModalProvider.jsx
|
|
1327
|
+
const ModalProvider = ({ children }) => {
|
|
1328
|
+
const [modalsConfig, setConfig] = useState({});
|
|
1329
|
+
const hideModal = useCallback((modalKey, onClose) => {
|
|
1330
|
+
setConfig((prevConfig) => ({
|
|
1331
|
+
...prevConfig,
|
|
1332
|
+
[modalKey]: {
|
|
1333
|
+
...prevConfig[modalKey],
|
|
1334
|
+
isOpen: false
|
|
1335
|
+
}
|
|
1336
|
+
}));
|
|
1337
|
+
if (onClose) onClose();
|
|
1338
|
+
}, [setConfig]);
|
|
1339
|
+
const showModal = useCallback((modalKey, component, modalData) => {
|
|
1340
|
+
setConfig((prevConfig) => ({
|
|
1341
|
+
...prevConfig,
|
|
1342
|
+
[modalKey]: {
|
|
1343
|
+
isOpen: true,
|
|
1344
|
+
component,
|
|
1345
|
+
data: modalData
|
|
1346
|
+
}
|
|
1347
|
+
}));
|
|
1348
|
+
}, [setConfig]);
|
|
1349
|
+
const contextValue = useMemo(() => ({
|
|
1350
|
+
showModal,
|
|
1351
|
+
hideModal,
|
|
1352
|
+
isOpenedModal: Object.values(modalsConfig).some(({ isOpen }) => isOpen)
|
|
1353
|
+
}), [
|
|
1354
|
+
hideModal,
|
|
1355
|
+
showModal,
|
|
1356
|
+
modalsConfig
|
|
1357
|
+
]);
|
|
1358
|
+
return /* @__PURE__ */ React.createElement(ModalContext.Provider, { value: contextValue }, children, Object.keys(modalsConfig).map((modalKey) => {
|
|
1359
|
+
const { component: Component, isOpen, data } = modalsConfig[modalKey];
|
|
1360
|
+
return isOpen && /* @__PURE__ */ React.createElement(Component, {
|
|
1361
|
+
onClose: () => hideModal(modalKey),
|
|
1362
|
+
key: modalKey,
|
|
1363
|
+
isOpen,
|
|
1364
|
+
...data
|
|
1365
|
+
});
|
|
1366
|
+
}));
|
|
1367
|
+
};
|
|
1368
|
+
//#endregion
|
|
1369
|
+
//#region src/hooks/useModalHook/useModal.js
|
|
1370
|
+
const generateModalKey = (() => {
|
|
1371
|
+
let count = 0;
|
|
1372
|
+
return () => `${++count}`;
|
|
1373
|
+
})();
|
|
1374
|
+
function useModal(component, data, onClose) {
|
|
1375
|
+
const key = useMemo(generateModalKey, []);
|
|
1376
|
+
const context = useContext(ModalContext);
|
|
1377
|
+
return [useCallback((modalData) => context.showModal(key, component, modalData instanceof Event ? data : {
|
|
1378
|
+
...data,
|
|
1379
|
+
...modalData
|
|
1380
|
+
}), [data, context.showModal]), useCallback(() => context.hideModal(key, onClose), [
|
|
1381
|
+
context.hideModal,
|
|
1382
|
+
onClose,
|
|
1383
|
+
key
|
|
1384
|
+
])];
|
|
1385
|
+
}
|
|
1386
|
+
useModal.ModalContext = ModalContext;
|
|
1387
|
+
useModal.ModalProvider = ModalProvider;
|
|
1388
|
+
i18n.use(LanguageDetector).use(initReactI18next).init({
|
|
1389
|
+
detection: { convertDetectedLanguage: (lng) => lng.split("-")[0] },
|
|
1390
|
+
resources: {
|
|
1391
|
+
en: { translation: {
|
|
1392
|
+
release: "Release",
|
|
1393
|
+
forbiddenErrorMessage: "You are not authorized to perform this operation",
|
|
1394
|
+
somethingWentWrongMessage: "Oops... something went wrong",
|
|
1395
|
+
changeLanguageText: "Change language to Polish",
|
|
1396
|
+
headerLoginButton: "Sign in",
|
|
1397
|
+
headerLogoutButton: "Sign out",
|
|
1398
|
+
loginCardTitle: "Sign in",
|
|
1399
|
+
loginFormText: "Fill both fields in order to log in to the system",
|
|
1400
|
+
loginCardCancelButton: "Cancel",
|
|
1401
|
+
loginCardSubmitButton: "Sign in",
|
|
1402
|
+
loginCardUsernameHint: "Username",
|
|
1403
|
+
loginCardPasswordHint: "Password",
|
|
1404
|
+
networkErrorHeader: "Connection issue detected",
|
|
1405
|
+
networkErrorButtonText: "Reload the page",
|
|
1406
|
+
newVersionAvailable: "New version available, the application will refresh in few seconds...",
|
|
1407
|
+
sdk: {
|
|
1408
|
+
"login": {
|
|
1409
|
+
"usernameRequired": "Username is required.",
|
|
1410
|
+
"passwordRequired": "Password is required."
|
|
1411
|
+
},
|
|
1412
|
+
"session": { "expired": "Your session has expired." }
|
|
1413
|
+
},
|
|
1414
|
+
access: {
|
|
1415
|
+
"noPermission": {
|
|
1416
|
+
"message": "This feature is available for your company, but you don't have permissions to use it",
|
|
1417
|
+
"tooltip": "No permissions",
|
|
1418
|
+
"button": { "requestAccess": "Request access" }
|
|
1419
|
+
},
|
|
1420
|
+
"expired": {
|
|
1421
|
+
"message": "Access to this feature expired {{days}} days ago, you can request renewal",
|
|
1422
|
+
"messageOld": "Access to this feature has expired, you can request renewal",
|
|
1423
|
+
"messageVeryOld": "Access to this feature has expired, if you need it, you can request a purchase or start a trial",
|
|
1424
|
+
"tooltip": "Subscription expired",
|
|
1425
|
+
"button": {
|
|
1426
|
+
"renewSubscription": "Renew subscription",
|
|
1427
|
+
"buy": "Buy",
|
|
1428
|
+
"wishlist": "Add to wishlist"
|
|
1429
|
+
}
|
|
1430
|
+
},
|
|
1431
|
+
"notPurchased": {
|
|
1432
|
+
"message": "This feature has not been purchased by your company, you can request a purchase or start a trial",
|
|
1433
|
+
"tooltip": "Feature not purchased",
|
|
1434
|
+
"button": {
|
|
1435
|
+
"try": "Try",
|
|
1436
|
+
"buy": "Buy",
|
|
1437
|
+
"wishlist": "Add to wishlist"
|
|
1438
|
+
}
|
|
1439
|
+
},
|
|
1440
|
+
"modal": {
|
|
1441
|
+
"featureAccess": {
|
|
1442
|
+
"header": "Request access",
|
|
1443
|
+
"step1": "Report access need - click the button below to submit your request",
|
|
1444
|
+
"step2": "Manager will review - your request will be sent to your supervisor for evaluation",
|
|
1445
|
+
"step3": "Permissions granted - your supervisor or administrator will assign you appropriate permissions",
|
|
1446
|
+
"button": "Submit request"
|
|
1447
|
+
},
|
|
1448
|
+
"trialExpired": {
|
|
1449
|
+
"header": "Renew subscription",
|
|
1450
|
+
"step1": "Report renewal need - click the button below to submit your request",
|
|
1451
|
+
"step2": "Manager will review - your request will be sent to your supervisor for business evaluation",
|
|
1452
|
+
"step3": "Request goes to AndonCloud - after manager approval, AndonCloud team will check renewal options",
|
|
1453
|
+
"step4": "Feature activation - AndonCloud will renew the subscription for your organization",
|
|
1454
|
+
"button": "Submit request"
|
|
1455
|
+
},
|
|
1456
|
+
"purchase": {
|
|
1457
|
+
"header": "Purchase feature",
|
|
1458
|
+
"step1": "Report purchase need - click the button below to submit your request",
|
|
1459
|
+
"step2": "Manager will review - your request will be sent to your supervisor for business evaluation",
|
|
1460
|
+
"step3": "Request goes to AndonCloud - after manager approval, AndonCloud team will check activation options",
|
|
1461
|
+
"step4": "Feature activation - AndonCloud will enable the feature for your organization",
|
|
1462
|
+
"button": "Submit request"
|
|
1463
|
+
},
|
|
1464
|
+
"startTrial": {
|
|
1465
|
+
"header": "Start trial period",
|
|
1466
|
+
"content": "By clicking the button below, we will start a 30-day trial period for your entire organization. During this time, all users will have full access to this feature.",
|
|
1467
|
+
"button": "Start trial"
|
|
1468
|
+
},
|
|
1469
|
+
"wishlist": {
|
|
1470
|
+
"header": "Add to wishlist",
|
|
1471
|
+
"step1": "Report need - click the button below to submit your request",
|
|
1472
|
+
"step2": "Manager will review - your request will be sent to your supervisor for business evaluation",
|
|
1473
|
+
"step3": "Request goes to AndonCloud - after manager approval, AndonCloud team will check activation options",
|
|
1474
|
+
"step4": "Feature activation - AndonCloud will enable the feature for your organization",
|
|
1475
|
+
"button": "Submit request"
|
|
1476
|
+
},
|
|
1477
|
+
"disclaimer": "This is a request, not an immediate purchase. Your supervisor will assess the business justification and make a decision.",
|
|
1478
|
+
"cancel": "Cancel"
|
|
1479
|
+
},
|
|
1480
|
+
"cooldown": {
|
|
1481
|
+
"header": "Request already sent",
|
|
1482
|
+
"message": "Your request has already been sent and is awaiting review. You can send another request in {{days}} days.",
|
|
1483
|
+
"button": "I understand"
|
|
1484
|
+
},
|
|
1485
|
+
"toast": {
|
|
1486
|
+
"featureAccess": "Your access request has been sent to your supervisor.",
|
|
1487
|
+
"trialExpired": "Thank you for your request. Your subscription renewal request has been sent to your supervisor.",
|
|
1488
|
+
"purchase": "Thank you for your request. Your purchase request has been sent to your supervisor.",
|
|
1489
|
+
"wishlist": "Thank you for your request. Your request has been sent to your supervisor.",
|
|
1490
|
+
"startTrial": "Thank you for starting the trial period. For the next 30 days, you can use all features for free. We will inform you about available options when it ends."
|
|
1491
|
+
}
|
|
1492
|
+
}
|
|
1493
|
+
} },
|
|
1494
|
+
pl: { translation: {
|
|
1495
|
+
release: "Wydanie",
|
|
1496
|
+
forbiddenErrorMessage: "Nie masz uprawnień do wykonania tej operacji",
|
|
1497
|
+
somethingWentWrongMessage: "Ups... coś poszło nie tak",
|
|
1498
|
+
changeLanguageText: "Zmiana języka na Angielski",
|
|
1499
|
+
headerLoginButton: "Zaloguj się",
|
|
1500
|
+
headerLogoutButton: "Wyloguj",
|
|
1501
|
+
loginCardTitle: "Logowanie",
|
|
1502
|
+
loginFormText: "Wypełnij oba pola w celu zalogowania do systemu",
|
|
1503
|
+
loginCardCancelButton: "Anuluj",
|
|
1504
|
+
loginCardSubmitButton: "Zaloguj",
|
|
1505
|
+
loginCardUsernameHint: "Użytkownik",
|
|
1506
|
+
loginCardPasswordHint: "Hasło",
|
|
1507
|
+
networkErrorHeader: "Błąd połączenia",
|
|
1508
|
+
networkErrorButtonText: "Odśwież stronę",
|
|
1509
|
+
newVersionAvailable: "Dostępna jest nowa wersja, za kilka sekund nastąpi odświeżenie aplikacji...",
|
|
1510
|
+
sdk: {
|
|
1511
|
+
"login": {
|
|
1512
|
+
"usernameRequired": "Nazwa użytkownika jest wymagana.",
|
|
1513
|
+
"passwordRequired": "Hasło jest wymagane."
|
|
1514
|
+
},
|
|
1515
|
+
"session": { "expired": "Twoja sesja wygasła." }
|
|
1516
|
+
},
|
|
1517
|
+
access: {
|
|
1518
|
+
"noPermission": {
|
|
1519
|
+
"message": "Ta funkcja jest dostępna dla Twojej firmy, niestety nie masz uprawnień aby z niej korzystać",
|
|
1520
|
+
"tooltip": "Brak uprawnień",
|
|
1521
|
+
"button": { "requestAccess": "Poproś o przyznanie uprawnień" }
|
|
1522
|
+
},
|
|
1523
|
+
"expired": {
|
|
1524
|
+
"message": "Dostęp do tej funkcji wygasł {{days}} dni temu, możesz poprosić o odnowienie",
|
|
1525
|
+
"messageOld": "Dostęp do tej funkcji wygasł, możesz poprosić o odnowienie",
|
|
1526
|
+
"messageVeryOld": "Dostęp do tej funkcji wygasł, jeśli jej potrzebujesz, możesz poprosić o zakup lub uruchomić okres próbny",
|
|
1527
|
+
"tooltip": "Subskrypcja wygasła",
|
|
1528
|
+
"button": {
|
|
1529
|
+
"renewSubscription": "Subskrybuj ponownie",
|
|
1530
|
+
"buy": "Kup",
|
|
1531
|
+
"wishlist": "Dodaj do listy życzeń"
|
|
1532
|
+
}
|
|
1533
|
+
},
|
|
1534
|
+
"notPurchased": {
|
|
1535
|
+
"message": "Ta funkcja nie została wykupiona w Twojej firmie, możesz poprosić o zakup lub uruchomić okres próbny",
|
|
1536
|
+
"tooltip": "Funkcja nie została wykupiona",
|
|
1537
|
+
"button": {
|
|
1538
|
+
"try": "Wypróbuj",
|
|
1539
|
+
"buy": "Kup",
|
|
1540
|
+
"wishlist": "Dodaj do listy życzeń"
|
|
1541
|
+
}
|
|
1542
|
+
},
|
|
1543
|
+
"modal": {
|
|
1544
|
+
"featureAccess": {
|
|
1545
|
+
"header": "Poproś o dostęp",
|
|
1546
|
+
"step1": "Zgłoś potrzebę dostępu - kliknij przycisk poniżej, aby zgłosić potrzebę",
|
|
1547
|
+
"step2": "Manager to sprawdzi - zgłoszenie trafi do przełożonego, który oceni zasadność",
|
|
1548
|
+
"step3": "Przyznanie uprawnień - przełożony lub administrator przydzieli Ci odpowiednie uprawnienia",
|
|
1549
|
+
"button": "Zgłoś potrzebę"
|
|
1550
|
+
},
|
|
1551
|
+
"trialExpired": {
|
|
1552
|
+
"header": "Odnów subskrypcję",
|
|
1553
|
+
"step1": "Zgłoś potrzebę odnowienia - kliknij przycisk poniżej, aby zgłosić potrzebę",
|
|
1554
|
+
"step2": "Manager to sprawdzi - zgłoszenie trafi do przełożonego, który oceni zasadność biznesową",
|
|
1555
|
+
"step3": "Zgłoszenie trafia do AndonCloud - po potwierdzeniu przez managera, zespół AndonCloud sprawdzi możliwość odnowienia",
|
|
1556
|
+
"step4": "Uruchomienie funkcji - AndonCloud odnowi subskrypcję dla Twojej organizacji",
|
|
1557
|
+
"button": "Zgłoś potrzebę"
|
|
1558
|
+
},
|
|
1559
|
+
"purchase": {
|
|
1560
|
+
"header": "Zakup funkcji",
|
|
1561
|
+
"step1": "Zgłoś potrzebę zakupu - kliknij przycisk poniżej, aby zgłosić potrzebę",
|
|
1562
|
+
"step2": "Manager to sprawdzi - zgłoszenie trafi do przełożonego, który oceni zasadność biznesową",
|
|
1563
|
+
"step3": "Zgłoszenie trafia do AndonCloud - po potwierdzeniu przez managera, zespół AndonCloud sprawdzi możliwość uruchomienia",
|
|
1564
|
+
"step4": "Uruchomienie funkcji - AndonCloud włączy funkcję dla Twojej organizacji",
|
|
1565
|
+
"button": "Zgłoś potrzebę"
|
|
1566
|
+
},
|
|
1567
|
+
"startTrial": {
|
|
1568
|
+
"header": "Rozpocznij okres próbny",
|
|
1569
|
+
"content": "Po kliknięciu przycisku poniżej uruchomimy 30-dniowy okres próbny dla całej Twojej organizacji. Przez ten czas wszyscy użytkownicy będą mieli pełny dostęp do tej funkcji.",
|
|
1570
|
+
"button": "Rozpocznij okres próbny"
|
|
1571
|
+
},
|
|
1572
|
+
"wishlist": {
|
|
1573
|
+
"header": "Dodaj do listy życzeń",
|
|
1574
|
+
"step1": "Zgłoś potrzebę - kliknij przycisk poniżej, aby zgłosić potrzebę",
|
|
1575
|
+
"step2": "Manager to sprawdzi - zgłoszenie trafi do przełożonego, który oceni zasadność biznesową",
|
|
1576
|
+
"step3": "Zgłoszenie trafia do AndonCloud - po potwierdzeniu przez managera, zespół AndonCloud sprawdzi możliwość uruchomienia",
|
|
1577
|
+
"step4": "Uruchomienie funkcji - AndonCloud włączy funkcję dla Twojej organizacji",
|
|
1578
|
+
"button": "Zgłoś potrzebę"
|
|
1579
|
+
},
|
|
1580
|
+
"disclaimer": "To jest zgłoszenie potrzeby, nie natychmiastowy zakup. Twój przełożony oceni zasadność biznesową i podejmie decyzję.",
|
|
1581
|
+
"cancel": "Anuluj"
|
|
1582
|
+
},
|
|
1583
|
+
"cooldown": {
|
|
1584
|
+
"header": "Prośba została już wysłana",
|
|
1585
|
+
"message": "Twoja prośba została już wysłana i czeka na rozpatrzenie. Kolejną prośbę będziesz mógł wysłać za {{days}} dni.",
|
|
1586
|
+
"button": "Rozumiem"
|
|
1587
|
+
},
|
|
1588
|
+
"toast": {
|
|
1589
|
+
"featureAccess": "Prośba o dostęp została przekazana do przełożonego.",
|
|
1590
|
+
"trialExpired": "Dziękujemy za zgłoszenie. Twoja prośba o odnowienie subskrypcji została przekazana do przełożonego.",
|
|
1591
|
+
"purchase": "Dziękujemy za zgłoszenie. Twoja prośba o zakup została przekazana do przełożonego.",
|
|
1592
|
+
"wishlist": "Dziękujemy za zgłoszenie. Twoja prośba została przekazana do przełożonego.",
|
|
1593
|
+
"startTrial": "Dziękujemy za uruchomienie okresu próbnego. Przez kolejne 30 dni możesz korzystać ze wszystkich funkcji bezpłatnie. Po jego zakończeniu poinformujemy Cię o dostępnych opcjach."
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
} }
|
|
1597
|
+
},
|
|
1598
|
+
interpolation: { escapeValue: false },
|
|
1599
|
+
react: { bindI18nStore: "added" },
|
|
1600
|
+
returnNull: false
|
|
1601
|
+
});
|
|
1602
|
+
const registeredSets = /* @__PURE__ */ new WeakSet();
|
|
1603
|
+
const registerTranslations = (locales) => {
|
|
1604
|
+
if (registeredSets.has(locales)) return;
|
|
1605
|
+
if (!i18n?.store?.data) return;
|
|
1606
|
+
const ns = "translation";
|
|
1607
|
+
for (const [lang, trans] of Object.entries(locales)) if (trans[ns]) i18n.addResourceBundle(lang, ns, trans[ns], true, true);
|
|
1608
|
+
registeredSets.add(locales);
|
|
1609
|
+
};
|
|
1610
|
+
var i18n_default = i18n;
|
|
1611
|
+
//#endregion
|
|
1612
|
+
//#region src/components/container.styles.js
|
|
1613
|
+
const makeStyles = ({ isEmbeddedMode }) => ({
|
|
1614
|
+
root: {
|
|
1615
|
+
height: isEmbeddedMode ? "100vh" : "calc(100vh - 22px)",
|
|
1616
|
+
paddingTop: isEmbeddedMode ? 0 : "70px",
|
|
1617
|
+
mixBlendMode: isEmbeddedMode ? "normal" : "color",
|
|
1618
|
+
background: isEmbeddedMode ? "transparent" : "#1B2027"
|
|
1619
|
+
},
|
|
1620
|
+
overlay: {
|
|
1621
|
+
position: "absolute",
|
|
1622
|
+
top: 0,
|
|
1623
|
+
left: 0,
|
|
1624
|
+
width: "100%",
|
|
1625
|
+
height: "100%",
|
|
1626
|
+
zIndex: -1,
|
|
1627
|
+
background: "repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1) 12px, transparent 12px, transparent 24px);"
|
|
1628
|
+
}
|
|
1629
|
+
});
|
|
1630
|
+
//#endregion
|
|
1631
|
+
//#region src/utils/display.js
|
|
1632
|
+
const isTrustedOrigin = (origin) => {
|
|
1633
|
+
if (typeof origin !== "string") return false;
|
|
1634
|
+
if (origin === window.location.origin) return true;
|
|
1635
|
+
if (/^http:\/\/localhost(:\d+)?$/.test(origin)) return true;
|
|
1636
|
+
try {
|
|
1637
|
+
const originUrl = new URL(origin);
|
|
1638
|
+
if (originUrl.protocol !== "https:") return false;
|
|
1639
|
+
const host = originUrl.hostname;
|
|
1640
|
+
return host === "andoncloud.net" || host.endsWith(".andoncloud.net") || host === "andoncloud.com" || host.endsWith(".andoncloud.com");
|
|
1641
|
+
} catch {
|
|
1642
|
+
return false;
|
|
1643
|
+
}
|
|
1644
|
+
};
|
|
1645
|
+
const getDisplayMode = () => {
|
|
1646
|
+
try {
|
|
1647
|
+
if (window.self !== window.top) return "iframe";
|
|
1648
|
+
if (new URLSearchParams(window.location.search).get("displayMode") === "iframe") return "iframe";
|
|
1649
|
+
return "standalone";
|
|
1650
|
+
} catch (e) {
|
|
1651
|
+
return "iframe";
|
|
1652
|
+
}
|
|
1653
|
+
};
|
|
1654
|
+
const getParentOrigin = () => {
|
|
1655
|
+
try {
|
|
1656
|
+
const referrer = document.referrer;
|
|
1657
|
+
if (!referrer) return null;
|
|
1658
|
+
const origin = new URL(referrer).origin;
|
|
1659
|
+
return isTrustedOrigin(origin) ? origin : null;
|
|
1660
|
+
} catch {
|
|
1661
|
+
return null;
|
|
1662
|
+
}
|
|
1663
|
+
};
|
|
1664
|
+
const postToParent = (message) => {
|
|
1665
|
+
const origin = getParentOrigin();
|
|
1666
|
+
if (!origin) return;
|
|
1667
|
+
window.parent?.postMessage(message, origin);
|
|
1668
|
+
};
|
|
1669
|
+
const updateParentHeaderLeadingText = (text) => {
|
|
1670
|
+
if (getDisplayMode() !== "iframe") return;
|
|
1671
|
+
postToParent({
|
|
1672
|
+
type: "SET_HEADER_LEADING_TEXT",
|
|
1673
|
+
text
|
|
1674
|
+
});
|
|
1675
|
+
};
|
|
1676
|
+
const resetParentHeaderLeadingText = () => {
|
|
1677
|
+
if (getDisplayMode() !== "iframe") return;
|
|
1678
|
+
postToParent({ type: "RESET_HEADER_LEADING_TEXT" });
|
|
1679
|
+
};
|
|
1680
|
+
const updateParentHeaderTitle = (title) => {
|
|
1681
|
+
if (getDisplayMode() !== "iframe") return;
|
|
1682
|
+
postToParent({
|
|
1683
|
+
type: "SET_HEADER_TITLE",
|
|
1684
|
+
title
|
|
1685
|
+
});
|
|
1686
|
+
};
|
|
1687
|
+
const resetParentHeaderTitle = () => {
|
|
1688
|
+
if (getDisplayMode() !== "iframe") return;
|
|
1689
|
+
postToParent({ type: "RESET_HEADER_TITLE" });
|
|
1690
|
+
};
|
|
1691
|
+
const updateParentHeaderStyles = ({ target, styles }) => {
|
|
1692
|
+
if (getDisplayMode() !== "iframe") return;
|
|
1693
|
+
postToParent({
|
|
1694
|
+
type: "SET_HEADER_STYLES",
|
|
1695
|
+
target,
|
|
1696
|
+
styles
|
|
1697
|
+
});
|
|
1698
|
+
};
|
|
1699
|
+
const resetParentHeaderStyles = (target) => {
|
|
1700
|
+
if (getDisplayMode() !== "iframe") return;
|
|
1701
|
+
postToParent({
|
|
1702
|
+
type: "RESET_HEADER_STYLES",
|
|
1703
|
+
target
|
|
1704
|
+
});
|
|
1705
|
+
};
|
|
1706
|
+
const updateParentHeaderContent = (descriptor) => {
|
|
1707
|
+
if (getDisplayMode() !== "iframe") return;
|
|
1708
|
+
postToParent({
|
|
1709
|
+
type: "SET_HEADER_CONTENT",
|
|
1710
|
+
...descriptor
|
|
1711
|
+
});
|
|
1712
|
+
};
|
|
1713
|
+
const resetParentHeaderContent = () => {
|
|
1714
|
+
if (getDisplayMode() !== "iframe") return;
|
|
1715
|
+
postToParent({ type: "RESET_HEADER_CONTENT" });
|
|
1716
|
+
};
|
|
1717
|
+
//#endregion
|
|
1718
|
+
//#region src/components/footer.js
|
|
1719
|
+
const Overlay = styled$2(Box$1)({
|
|
1720
|
+
position: "absolute",
|
|
1721
|
+
left: 0,
|
|
1722
|
+
bottom: 0,
|
|
1723
|
+
width: "100%",
|
|
1724
|
+
height: "22px",
|
|
1725
|
+
padding: "0.15em 0.5em",
|
|
1726
|
+
fontSize: "70%",
|
|
1727
|
+
fontWeight: 600,
|
|
1728
|
+
color: "rgba(255, 255, 255, 0.75)",
|
|
1729
|
+
borderTop: "1px solid rgba(255, 255, 255, 0.2)",
|
|
1730
|
+
"& > span": {
|
|
1731
|
+
marginLeft: "0.5em",
|
|
1732
|
+
color: "rgba(255, 255, 255, 0.4)"
|
|
1733
|
+
},
|
|
1734
|
+
background: "#11151B"
|
|
1735
|
+
});
|
|
1736
|
+
const Footer = ({ appVersion, apiVersion }) => {
|
|
1737
|
+
const { t } = useTranslation();
|
|
1738
|
+
if (getDisplayMode() === "iframe") return null;
|
|
1739
|
+
const renderAppVersion = () => {
|
|
1740
|
+
if (appVersion) {
|
|
1741
|
+
const versionText = appVersion.startsWith("v") ? appVersion : `v${appVersion}`;
|
|
1742
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("span", null, t("Version")), " ", versionText);
|
|
1743
|
+
}
|
|
1744
|
+
};
|
|
1745
|
+
const renderApiVersion = () => {
|
|
1746
|
+
if (apiVersion) {
|
|
1747
|
+
const versionText = apiVersion.startsWith("v") ? apiVersion : `v${apiVersion}`;
|
|
1748
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("span", null, "API"), " ", versionText);
|
|
1749
|
+
}
|
|
1750
|
+
};
|
|
1751
|
+
return /* @__PURE__ */ React.createElement(Overlay, null, renderAppVersion(), renderApiVersion());
|
|
1752
|
+
};
|
|
1753
|
+
//#endregion
|
|
1754
|
+
//#region src/pages/ErrorPage.js
|
|
1755
|
+
const ErrorPage = ({ error, appVersion, apiVersion }) => {
|
|
1756
|
+
const { t } = useTranslation();
|
|
1757
|
+
const containerStyles = makeStyles({ isEmbeddedMode: getDisplayMode() === "iframe" });
|
|
1758
|
+
return /* @__PURE__ */ React.createElement(Container$1, {
|
|
1759
|
+
maxWidth: false,
|
|
1760
|
+
disableGutters: true,
|
|
1761
|
+
sx: containerStyles.root
|
|
1762
|
+
}, /* @__PURE__ */ React.createElement(Card, { style: {
|
|
1763
|
+
background: "linear-gradient(180deg, #393939 0%, #4A4A4A 100%)",
|
|
1764
|
+
maxWidth: "650px",
|
|
1765
|
+
margin: "200px auto",
|
|
1766
|
+
borderRadius: "20px"
|
|
1767
|
+
} }, /* @__PURE__ */ React.createElement(CardContent, { style: { minHeight: "unset" } }, /* @__PURE__ */ React.createElement(Box, {
|
|
1768
|
+
display: "flex",
|
|
1769
|
+
flexDirection: "column",
|
|
1770
|
+
alignItems: "center",
|
|
1771
|
+
justifyContent: "center",
|
|
1772
|
+
m: "125px 80px"
|
|
1773
|
+
}, /* @__PURE__ */ React.createElement(Typography, {
|
|
1774
|
+
variant: "h4",
|
|
1775
|
+
sx: {
|
|
1776
|
+
display: "flex",
|
|
1777
|
+
alignItems: "center",
|
|
1778
|
+
marginBottom: "40px",
|
|
1779
|
+
color: "rgba(255, 255, 255, 0.6)"
|
|
1780
|
+
}
|
|
1781
|
+
}, t("somethingWentWrongMessage"), /* @__PURE__ */ React.createElement(Tooltip, {
|
|
1782
|
+
title: error.toString(),
|
|
1783
|
+
arrow: true
|
|
1784
|
+
}, /* @__PURE__ */ React.createElement(HelpOutlineIcon, { sx: {
|
|
1785
|
+
marginLeft: "1em",
|
|
1786
|
+
fontSize: "inherit"
|
|
1787
|
+
} }))), /* @__PURE__ */ React.createElement(Button, { onClick: () => window.location.reload() }, t("networkErrorButtonText"))))), /* @__PURE__ */ React.createElement(Box, { sx: containerStyles.overlay }), /* @__PURE__ */ React.createElement(Footer, {
|
|
1788
|
+
appVersion,
|
|
1789
|
+
apiVersion
|
|
1790
|
+
}));
|
|
1791
|
+
};
|
|
1792
|
+
ErrorPage.propTypes = {
|
|
1793
|
+
error: PropTypes.any,
|
|
1794
|
+
componentStack: PropTypes.any
|
|
1795
|
+
};
|
|
1796
|
+
ErrorPage.defaultProps = {};
|
|
1797
|
+
//#endregion
|
|
1798
|
+
//#region src/assets/loader.svg
|
|
1799
|
+
var loader_default = "data:image/svg+xml,<?xml version=\"1.0\" encoding=\"utf-8\"?>%0A<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" style=\"margin: auto; background: none; display: block; shape-rendering: auto;\" width=\"200px\" height=\"200px\" viewBox=\"0 0 100 100\" preserveAspectRatio=\"xMidYMid\">%0A<g transform=\"rotate(0 50 50)\">%0A <rect x=\"47\" y=\"24\" rx=\"3\" ry=\"6\" width=\"6\" height=\"12\" fill=\"%23969696\">%0A <animate attributeName=\"opacity\" values=\"1;0\" keyTimes=\"0;1\" dur=\"1s\" begin=\"-0.9166666666666666s\" repeatCount=\"indefinite\"></animate>%0A </rect>%0A</g><g transform=\"rotate(30 50 50)\">%0A <rect x=\"47\" y=\"24\" rx=\"3\" ry=\"6\" width=\"6\" height=\"12\" fill=\"%23969696\">%0A <animate attributeName=\"opacity\" values=\"1;0\" keyTimes=\"0;1\" dur=\"1s\" begin=\"-0.8333333333333334s\" repeatCount=\"indefinite\"></animate>%0A </rect>%0A</g><g transform=\"rotate(60 50 50)\">%0A <rect x=\"47\" y=\"24\" rx=\"3\" ry=\"6\" width=\"6\" height=\"12\" fill=\"%23969696\">%0A <animate attributeName=\"opacity\" values=\"1;0\" keyTimes=\"0;1\" dur=\"1s\" begin=\"-0.75s\" repeatCount=\"indefinite\"></animate>%0A </rect>%0A</g><g transform=\"rotate(90 50 50)\">%0A <rect x=\"47\" y=\"24\" rx=\"3\" ry=\"6\" width=\"6\" height=\"12\" fill=\"%23969696\">%0A <animate attributeName=\"opacity\" values=\"1;0\" keyTimes=\"0;1\" dur=\"1s\" begin=\"-0.6666666666666666s\" repeatCount=\"indefinite\"></animate>%0A </rect>%0A</g><g transform=\"rotate(120 50 50)\">%0A <rect x=\"47\" y=\"24\" rx=\"3\" ry=\"6\" width=\"6\" height=\"12\" fill=\"%23969696\">%0A <animate attributeName=\"opacity\" values=\"1;0\" keyTimes=\"0;1\" dur=\"1s\" begin=\"-0.5833333333333334s\" repeatCount=\"indefinite\"></animate>%0A </rect>%0A</g><g transform=\"rotate(150 50 50)\">%0A <rect x=\"47\" y=\"24\" rx=\"3\" ry=\"6\" width=\"6\" height=\"12\" fill=\"%23969696\">%0A <animate attributeName=\"opacity\" values=\"1;0\" keyTimes=\"0;1\" dur=\"1s\" begin=\"-0.5s\" repeatCount=\"indefinite\"></animate>%0A </rect>%0A</g><g transform=\"rotate(180 50 50)\">%0A <rect x=\"47\" y=\"24\" rx=\"3\" ry=\"6\" width=\"6\" height=\"12\" fill=\"%23969696\">%0A <animate attributeName=\"opacity\" values=\"1;0\" keyTimes=\"0;1\" dur=\"1s\" begin=\"-0.4166666666666667s\" repeatCount=\"indefinite\"></animate>%0A </rect>%0A</g><g transform=\"rotate(210 50 50)\">%0A <rect x=\"47\" y=\"24\" rx=\"3\" ry=\"6\" width=\"6\" height=\"12\" fill=\"%23969696\">%0A <animate attributeName=\"opacity\" values=\"1;0\" keyTimes=\"0;1\" dur=\"1s\" begin=\"-0.3333333333333333s\" repeatCount=\"indefinite\"></animate>%0A </rect>%0A</g><g transform=\"rotate(240 50 50)\">%0A <rect x=\"47\" y=\"24\" rx=\"3\" ry=\"6\" width=\"6\" height=\"12\" fill=\"%23969696\">%0A <animate attributeName=\"opacity\" values=\"1;0\" keyTimes=\"0;1\" dur=\"1s\" begin=\"-0.25s\" repeatCount=\"indefinite\"></animate>%0A </rect>%0A</g><g transform=\"rotate(270 50 50)\">%0A <rect x=\"47\" y=\"24\" rx=\"3\" ry=\"6\" width=\"6\" height=\"12\" fill=\"%23969696\">%0A <animate attributeName=\"opacity\" values=\"1;0\" keyTimes=\"0;1\" dur=\"1s\" begin=\"-0.16666666666666666s\" repeatCount=\"indefinite\"></animate>%0A </rect>%0A</g><g transform=\"rotate(300 50 50)\">%0A <rect x=\"47\" y=\"24\" rx=\"3\" ry=\"6\" width=\"6\" height=\"12\" fill=\"%23969696\">%0A <animate attributeName=\"opacity\" values=\"1;0\" keyTimes=\"0;1\" dur=\"1s\" begin=\"-0.08333333333333333s\" repeatCount=\"indefinite\"></animate>%0A </rect>%0A</g><g transform=\"rotate(330 50 50)\">%0A <rect x=\"47\" y=\"24\" rx=\"3\" ry=\"6\" width=\"6\" height=\"12\" fill=\"%23969696\">%0A <animate attributeName=\"opacity\" values=\"1;0\" keyTimes=\"0;1\" dur=\"1s\" begin=\"0s\" repeatCount=\"indefinite\"></animate>%0A </rect>%0A</g>%0A<!-- [ldio] generated by https://loading.io/ --></svg>";
|
|
1800
|
+
//#endregion
|
|
1801
|
+
//#region src/components/loader.js
|
|
1802
|
+
const Loader = ({ width, "data-testid": dataTestId }) => {
|
|
1803
|
+
return /* @__PURE__ */ React.createElement(Box, {
|
|
1804
|
+
display: "flex",
|
|
1805
|
+
alignItems: "center",
|
|
1806
|
+
justifyContent: "center",
|
|
1807
|
+
width: "100%",
|
|
1808
|
+
height: "100%"
|
|
1809
|
+
}, /* @__PURE__ */ React.createElement("img", {
|
|
1810
|
+
"data-testid": dataTestId,
|
|
1811
|
+
alt: "loader",
|
|
1812
|
+
width,
|
|
1813
|
+
src: loader_default
|
|
1814
|
+
}));
|
|
1815
|
+
};
|
|
1816
|
+
//#endregion
|
|
1817
|
+
//#region src/providers/display.js
|
|
1818
|
+
const DisplayContext = createContext();
|
|
1819
|
+
const DisplayProvider = ({ children }) => {
|
|
1820
|
+
const [iframeMounted, setIframeMounted] = useState(false);
|
|
1821
|
+
const [iframeNavigationItems, setIframeNavigationItems] = useState([]);
|
|
1822
|
+
const mode = getDisplayMode();
|
|
1823
|
+
return /* @__PURE__ */ React.createElement(DisplayContext.Provider, { value: {
|
|
1824
|
+
mode,
|
|
1825
|
+
isEmbeddedMode: mode === "iframe",
|
|
1826
|
+
iframeMounted,
|
|
1827
|
+
setIframeMounted,
|
|
1828
|
+
iframeNavigationItems,
|
|
1829
|
+
setIframeNavigationItems
|
|
1830
|
+
} }, children);
|
|
1831
|
+
};
|
|
1832
|
+
const useDisplay = () => {
|
|
1833
|
+
return useContext(DisplayContext);
|
|
1834
|
+
};
|
|
1835
|
+
//#endregion
|
|
1836
|
+
//#region src/pages/LoaderPage.js
|
|
1837
|
+
const LoaderPage = () => {
|
|
1838
|
+
const { isEmbeddedMode } = useDisplay();
|
|
1839
|
+
const containerStyles = makeStyles({ isEmbeddedMode });
|
|
1840
|
+
return /* @__PURE__ */ React.createElement(Container$1, {
|
|
1841
|
+
maxWidth: false,
|
|
1842
|
+
disableGutters: true,
|
|
1843
|
+
sx: containerStyles.root
|
|
1844
|
+
}, /* @__PURE__ */ React.createElement(Loader, {
|
|
1845
|
+
"data-testid": "sdk.app-loading",
|
|
1846
|
+
width: "500px"
|
|
1847
|
+
}), /* @__PURE__ */ React.createElement(Box, { sx: containerStyles.overlay }));
|
|
1848
|
+
};
|
|
1849
|
+
LoaderPage.propTypes = {};
|
|
1850
|
+
LoaderPage.defaultProps = {};
|
|
1851
|
+
//#endregion
|
|
1852
|
+
//#region src/providers/authConfig.js
|
|
1853
|
+
const AuthConfigContext = createContext();
|
|
1854
|
+
const AuthConfigProvider = ({ children, config }) => {
|
|
1855
|
+
return /* @__PURE__ */ React.createElement(AuthConfigContext.Provider, { value: config }, children);
|
|
1856
|
+
};
|
|
1857
|
+
const useAuthConfig = () => {
|
|
1858
|
+
return useContext(AuthConfigContext);
|
|
1859
|
+
};
|
|
1860
|
+
//#endregion
|
|
1861
|
+
//#region src/providers/metaInfo.js
|
|
1862
|
+
const MetaInfoContext = createContext();
|
|
1863
|
+
const MetaInfoProvider = ({ children, info }) => {
|
|
1864
|
+
return /* @__PURE__ */ React.createElement(MetaInfoContext.Provider, { value: info }, children);
|
|
1865
|
+
};
|
|
1866
|
+
const useMetaInfo = () => {
|
|
1867
|
+
return useContext(MetaInfoContext);
|
|
1868
|
+
};
|
|
1869
|
+
//#endregion
|
|
1870
|
+
//#region src/providers/store.js
|
|
1871
|
+
const rootStore = { sessionStore };
|
|
1872
|
+
const StoreContext = createContext(rootStore);
|
|
1873
|
+
const StoreProvider = observer(({ children }) => {
|
|
1874
|
+
return /* @__PURE__ */ React.createElement(StoreContext.Provider, { value: rootStore }, children);
|
|
1875
|
+
});
|
|
1876
|
+
const useStore = () => {
|
|
1877
|
+
return useContext(StoreContext);
|
|
1878
|
+
};
|
|
1879
|
+
//#endregion
|
|
1880
|
+
//#region src/stores/appStore.js
|
|
1881
|
+
var AppStore = class {
|
|
1882
|
+
appReady = false;
|
|
1883
|
+
gtmReady = false;
|
|
1884
|
+
sentryReady = false;
|
|
1885
|
+
constructor() {
|
|
1886
|
+
makeAutoObservable(this);
|
|
1887
|
+
}
|
|
1888
|
+
setAppReady() {
|
|
1889
|
+
this.appReady = true;
|
|
1890
|
+
}
|
|
1891
|
+
setGtmReady() {
|
|
1892
|
+
this.gtmReady = true;
|
|
1893
|
+
}
|
|
1894
|
+
setSentryReady() {
|
|
1895
|
+
this.sentryReady = true;
|
|
1896
|
+
}
|
|
1897
|
+
};
|
|
1898
|
+
var appStore_default = new AppStore();
|
|
1899
|
+
//#endregion
|
|
1900
|
+
//#region src/theme.js
|
|
1901
|
+
const { palette, typography } = createTheme();
|
|
1902
|
+
const baseTheme = responsiveFontSizes(createTheme({
|
|
1903
|
+
components: { MuiCssBaseline: { styleOverrides: `
|
|
1904
|
+
body {
|
|
1905
|
+
font-family: "Inter", "system-ui";
|
|
1906
|
+
}
|
|
1907
|
+
@supports (font-variation-settings: normal) {
|
|
1908
|
+
body { font-family: "Inter var", "system-ui"; }
|
|
1909
|
+
}
|
|
1910
|
+
` } },
|
|
1911
|
+
palette: {
|
|
1912
|
+
background: "#090B0E",
|
|
1913
|
+
primary: {
|
|
1914
|
+
main: "#0366EB",
|
|
1915
|
+
light: "#71A9F4"
|
|
1916
|
+
},
|
|
1917
|
+
secondary: { main: "#E0E0E0" },
|
|
1918
|
+
success: { main: "#11BD4C" },
|
|
1919
|
+
error: { main: "#FD2121" },
|
|
1920
|
+
text: { primary: "#A7ADB6" },
|
|
1921
|
+
gray: palette.augmentColor({ color: {
|
|
1922
|
+
main: "#090B0E",
|
|
1923
|
+
light: "#47484A"
|
|
1924
|
+
} }),
|
|
1925
|
+
stroke: palette.augmentColor({ color: {
|
|
1926
|
+
main: "#D8DDE3",
|
|
1927
|
+
dark: "rgba(255, 255, 255, 0.15)"
|
|
1928
|
+
} }),
|
|
1929
|
+
gradient: {
|
|
1930
|
+
blue: { main: "linear-gradient(0deg, #0353BD 3.06%, #0366EB 93%)" },
|
|
1931
|
+
dark: { main: "linear-gradient(180deg, #292C34 0%, #1C1F25 100%)" }
|
|
1932
|
+
}
|
|
1933
|
+
},
|
|
1934
|
+
typography: {
|
|
1935
|
+
fontFamily: "'Inter', system-ui",
|
|
1936
|
+
button: { textTransform: "none" }
|
|
1937
|
+
}
|
|
1938
|
+
}), {
|
|
1939
|
+
breakpoints: [
|
|
1940
|
+
"xs",
|
|
1941
|
+
"sm",
|
|
1942
|
+
"md",
|
|
1943
|
+
"lg",
|
|
1944
|
+
"xl"
|
|
1945
|
+
],
|
|
1946
|
+
disableAlign: true,
|
|
1947
|
+
factor: 2.5
|
|
1948
|
+
});
|
|
1949
|
+
var theme_default = createTheme(baseTheme, { components: {
|
|
1950
|
+
MuiBackdrop: { styleOverrides: { root: { marginTop: 70 } } },
|
|
1951
|
+
MuiButton: {
|
|
1952
|
+
styleOverrides: { root: {
|
|
1953
|
+
fontSize: "1rem",
|
|
1954
|
+
fontWeight: 400,
|
|
1955
|
+
color: baseTheme.palette.common.white,
|
|
1956
|
+
padding: baseTheme.spacing(1.5, 3),
|
|
1957
|
+
border: `1px solid ${baseTheme.palette.stroke.dark}`,
|
|
1958
|
+
borderRadius: "6px",
|
|
1959
|
+
"&:disabled": {
|
|
1960
|
+
color: baseTheme.palette.gray.light,
|
|
1961
|
+
background: "transparent"
|
|
1962
|
+
}
|
|
1963
|
+
} },
|
|
1964
|
+
variants: [{
|
|
1965
|
+
props: { variant: "contained" },
|
|
1966
|
+
style: {
|
|
1967
|
+
background: baseTheme.palette.gradient.blue.main,
|
|
1968
|
+
"&:focus": { boxShadow: "0px 0px 0px 4px rgba(3, 102, 235, 0.25)" },
|
|
1969
|
+
"&:hover": { opacity: .8 }
|
|
1970
|
+
}
|
|
1971
|
+
}, {
|
|
1972
|
+
props: { variant: "outlined" },
|
|
1973
|
+
style: {
|
|
1974
|
+
background: baseTheme.palette.gradient.dark.main,
|
|
1975
|
+
"&:focus": { boxShadow: "0 0 0 4px rgba(255, 255, 255, 0.10)" },
|
|
1976
|
+
"&:hover": { opacity: .8 }
|
|
1977
|
+
}
|
|
1978
|
+
}]
|
|
1979
|
+
},
|
|
1980
|
+
MuiCard: { styleOverrides: { root: {
|
|
1981
|
+
borderRadius: "4px",
|
|
1982
|
+
boxShadow: "0px 4px 8px rgba(0, 0, 0, 0.25)"
|
|
1983
|
+
} } },
|
|
1984
|
+
MuiCardHeader: { styleOverrides: {
|
|
1985
|
+
root: {
|
|
1986
|
+
color: "rgba(255,255,255,0.85)",
|
|
1987
|
+
background: "linear-gradient(180deg,#252A32,#30353D)"
|
|
1988
|
+
},
|
|
1989
|
+
subheader: {
|
|
1990
|
+
marginTop: "0.5em",
|
|
1991
|
+
color: "rgba(255,255,255,0.5)"
|
|
1992
|
+
}
|
|
1993
|
+
} },
|
|
1994
|
+
MuiCardContent: { styleOverrides: { root: {
|
|
1995
|
+
background: "#252A32",
|
|
1996
|
+
"&:last-child": { paddingBottom: 16 }
|
|
1997
|
+
} } },
|
|
1998
|
+
MuiDayCalendar: { styleOverrides: { weekDayLabel: { color: "#E0E0E0" } } },
|
|
1999
|
+
MuiDialogTitle: { styleOverrides: { root: {
|
|
2000
|
+
textAlign: "center",
|
|
2001
|
+
color: "white",
|
|
2002
|
+
background: "linear-gradient(180deg,#252A32,#30353D)"
|
|
2003
|
+
} } },
|
|
2004
|
+
MuiDialogContent: { styleOverrides: { root: {
|
|
2005
|
+
minWidth: 550,
|
|
2006
|
+
padding: "16px 24px",
|
|
2007
|
+
background: "#252A32"
|
|
2008
|
+
} } },
|
|
2009
|
+
MuiDialogContentText: { styleOverrides: { root: {
|
|
2010
|
+
textAlign: "center",
|
|
2011
|
+
color: "white"
|
|
2012
|
+
} } },
|
|
2013
|
+
MuiCheckbox: { styleOverrides: { root: {
|
|
2014
|
+
color: baseTheme.palette.primary.main,
|
|
2015
|
+
"&:hover": { opacity: .8 }
|
|
2016
|
+
} } },
|
|
2017
|
+
MuiFormLabel: { styleOverrides: { root: {
|
|
2018
|
+
lineHeight: "1.4375em !important",
|
|
2019
|
+
fontSize: `${typography.pxToRem(16)} !important`,
|
|
2020
|
+
"&:not(.Mui-error)": { color: `${baseTheme.palette.text.primary} !important` }
|
|
2021
|
+
} } },
|
|
2022
|
+
MuiFormControl: { styleOverrides: { root: { ".MuiInputLabel-root": {
|
|
2023
|
+
color: "#E0E0E0",
|
|
2024
|
+
transform: "translate(16px, 14px) scale(1)",
|
|
2025
|
+
"&.MuiInputLabel-shrink": {
|
|
2026
|
+
color: "#A7ADB6",
|
|
2027
|
+
transform: "translate(16px, 5px) scale(0.75)"
|
|
2028
|
+
}
|
|
2029
|
+
} } } },
|
|
2030
|
+
MuiFormControlLabel: { styleOverrides: { root: {
|
|
2031
|
+
alignItems: "center",
|
|
2032
|
+
color: baseTheme.palette.text.primary,
|
|
2033
|
+
".MuiFormControlLabel-label.Mui-disabled": { color: "#A7ADB6" }
|
|
2034
|
+
} } },
|
|
2035
|
+
MuiInputBase: { styleOverrides: { root: {
|
|
2036
|
+
display: "flex",
|
|
2037
|
+
padding: baseTheme.spacing(1.5, 3),
|
|
2038
|
+
fontSize: "1rem",
|
|
2039
|
+
fontWeight: 400,
|
|
2040
|
+
color: "#E0E0E0",
|
|
2041
|
+
borderRadius: "6px",
|
|
2042
|
+
background: "#1C1F25",
|
|
2043
|
+
"> input": {
|
|
2044
|
+
padding: 0,
|
|
2045
|
+
"&[type=number]": { MozAppearance: "textfield" },
|
|
2046
|
+
"&[type=number]::-webkit-outer-spin-button": {
|
|
2047
|
+
WebkitAppearance: "none",
|
|
2048
|
+
margin: 0
|
|
2049
|
+
},
|
|
2050
|
+
"&[type=number]::-webkit-inner-spin-button": {
|
|
2051
|
+
WebkitAppearance: "none",
|
|
2052
|
+
margin: 0
|
|
2053
|
+
},
|
|
2054
|
+
"&:-webkit-autofill": { transition: "all 5000s ease-in-out 0s" },
|
|
2055
|
+
"&:-webkit-autofill:focus": { transition: "all 5000s ease-in-out 0s" },
|
|
2056
|
+
"&:-webkit-autofill:hover": { transition: "all 5000s ease-in-out 0s" },
|
|
2057
|
+
"&:-webkit-autofill:active": { transition: "all 5000s ease-in-out 0s" }
|
|
2058
|
+
}
|
|
2059
|
+
} } },
|
|
2060
|
+
MuiInputAdornment: { styleOverrides: { root: { ".MuiTypography-root": { color: "#4E5A67" } } } },
|
|
2061
|
+
MuiMenu: { styleOverrides: {
|
|
2062
|
+
root: {
|
|
2063
|
+
transform: `translateY(${baseTheme.spacing(1)})`,
|
|
2064
|
+
".MuiPaper-root": { background: "none" }
|
|
2065
|
+
},
|
|
2066
|
+
list: {
|
|
2067
|
+
border: `1px solid #4E5A67`,
|
|
2068
|
+
borderRadius: "6px",
|
|
2069
|
+
background: "#1C1F25",
|
|
2070
|
+
boxShadow: "0px 4px 10.4px 0px rgba(255, 255, 255, 0.05)"
|
|
2071
|
+
}
|
|
2072
|
+
} },
|
|
2073
|
+
MuiMenuItem: { styleOverrides: { root: {
|
|
2074
|
+
gap: baseTheme.spacing(.5),
|
|
2075
|
+
fontSize: typography.pxToRem(16),
|
|
2076
|
+
color: "#E0E0E0",
|
|
2077
|
+
"&.Mui-selected": { background: baseTheme.palette.gray.main },
|
|
2078
|
+
"&.Mui-selected:hover": { background: baseTheme.palette.gray.main },
|
|
2079
|
+
"&:hover": { background: baseTheme.palette.gray.main }
|
|
2080
|
+
} } },
|
|
2081
|
+
MuiOutlinedInput: { styleOverrides: {
|
|
2082
|
+
root: {
|
|
2083
|
+
padding: baseTheme.spacing(2.5, 2, .5, 2),
|
|
2084
|
+
"&:hover .MuiOutlinedInput-notchedOutline": {
|
|
2085
|
+
borderWidth: "1px",
|
|
2086
|
+
borderColor: "#4E5A67"
|
|
2087
|
+
},
|
|
2088
|
+
"&.Mui-focused .MuiOutlinedInput-notchedOutline": {
|
|
2089
|
+
borderWidth: "1px",
|
|
2090
|
+
borderColor: "#4E5A67"
|
|
2091
|
+
}
|
|
2092
|
+
},
|
|
2093
|
+
notchedOutline: {
|
|
2094
|
+
border: `1px solid ${baseTheme.palette.stroke.dark}`,
|
|
2095
|
+
"> legend": { width: 0 }
|
|
2096
|
+
}
|
|
2097
|
+
} },
|
|
2098
|
+
MuiPickersArrowSwitcher: { styleOverrides: { root: {
|
|
2099
|
+
".MuiPickersArrowSwitcher-previousIconButton": { color: "#E0E0E0" },
|
|
2100
|
+
".MuiPickersArrowSwitcher-nextIconButton": { color: "#E0E0E0" }
|
|
2101
|
+
} } },
|
|
2102
|
+
MuiPickersCalendarHeader: { styleOverrides: { switchViewButton: { color: "#E0E0E0" } } },
|
|
2103
|
+
MuiPickersInputBase: { styleOverrides: { root: {
|
|
2104
|
+
display: "flex",
|
|
2105
|
+
fontSize: "1rem",
|
|
2106
|
+
fontWeight: 400,
|
|
2107
|
+
color: "#E0E0E0",
|
|
2108
|
+
borderRadius: "6px",
|
|
2109
|
+
background: "#1C1F25",
|
|
2110
|
+
".MuiPickersSectionList-root": { padding: baseTheme.spacing(1, 0, .625, 0) },
|
|
2111
|
+
".MuiInputAdornment-root": { marginTop: baseTheme.spacing(-1.5) },
|
|
2112
|
+
".MuiIconButton-root": { color: "#E0E0E0" },
|
|
2113
|
+
"> input": { padding: 0 }
|
|
2114
|
+
} } },
|
|
2115
|
+
MuiPickersOutlinedInput: { styleOverrides: {
|
|
2116
|
+
root: {
|
|
2117
|
+
padding: baseTheme.spacing(1.75, 2, 0, 2),
|
|
2118
|
+
"&:hover .MuiPickersOutlinedInput-notchedOutline": {
|
|
2119
|
+
borderWidth: "1px",
|
|
2120
|
+
borderColor: "#4E5A67"
|
|
2121
|
+
},
|
|
2122
|
+
"&.Mui-focused:not(.Mui-error) .MuiPickersOutlinedInput-notchedOutline": {
|
|
2123
|
+
borderWidth: "1px",
|
|
2124
|
+
borderColor: "#4E5A67"
|
|
2125
|
+
}
|
|
2126
|
+
},
|
|
2127
|
+
notchedOutline: {
|
|
2128
|
+
border: `1px solid ${baseTheme.palette.stroke.dark}`,
|
|
2129
|
+
"> legend": { width: 0 }
|
|
2130
|
+
}
|
|
2131
|
+
} },
|
|
2132
|
+
MuiPickersTextField: { variants: [{
|
|
2133
|
+
props: { error: true },
|
|
2134
|
+
style: {
|
|
2135
|
+
".MuiInputLabel-root": {
|
|
2136
|
+
color: baseTheme.palette.error.main,
|
|
2137
|
+
"&.MuiInputLabel-shrink": { color: baseTheme.palette.error.main }
|
|
2138
|
+
},
|
|
2139
|
+
"&:hover .MuiOutlinedInput-notchedOutline": { borderColor: baseTheme.palette.error.main },
|
|
2140
|
+
".Mui-focused .MuiOutlinedInput-notchedOutline": { borderColor: baseTheme.palette.error.main }
|
|
2141
|
+
}
|
|
2142
|
+
}] },
|
|
2143
|
+
MuiPickersLayout: { styleOverrides: { root: { background: "#1C1F25" } } },
|
|
2144
|
+
MuiRadio: { styleOverrides: { root: {
|
|
2145
|
+
color: baseTheme.palette.primary.main,
|
|
2146
|
+
"&:hover": { opacity: .8 }
|
|
2147
|
+
} } },
|
|
2148
|
+
MuiRadioGroup: { styleOverrides: { root: { color: baseTheme.palette.primary.main } } },
|
|
2149
|
+
MuiSelect: { styleOverrides: { root: {
|
|
2150
|
+
".MuiSelect-select": {
|
|
2151
|
+
display: "flex",
|
|
2152
|
+
alignItems: "center",
|
|
2153
|
+
gap: baseTheme.spacing(.5),
|
|
2154
|
+
padding: 0,
|
|
2155
|
+
lineHeight: 1.625,
|
|
2156
|
+
color: "E0E0E0"
|
|
2157
|
+
},
|
|
2158
|
+
".MuiSelect-icon": {
|
|
2159
|
+
top: "calc(50% - 10px)",
|
|
2160
|
+
right: baseTheme.spacing(2),
|
|
2161
|
+
color: "#E0E0E0"
|
|
2162
|
+
},
|
|
2163
|
+
"&:hover": { borderColor: "#4E5A67" }
|
|
2164
|
+
} } },
|
|
2165
|
+
MuiTabs: { styleOverrides: { root: { borderBottom: `1px solid ${baseTheme.palette.stroke.dark}` } } },
|
|
2166
|
+
MuiTab: { styleOverrides: { root: {
|
|
2167
|
+
color: baseTheme.palette.text.primary,
|
|
2168
|
+
"&.Mui-selected": { color: "#E0E0E0" }
|
|
2169
|
+
} } },
|
|
2170
|
+
MuiTabList: { styleOverrides: { root: { borderBottom: `1px solid ${baseTheme.palette.stroke.dark}` } } },
|
|
2171
|
+
MuiTabPanel: { styleOverrides: { root: { padding: baseTheme.spacing(2, 0) } } },
|
|
2172
|
+
MuiTextField: { variants: [{
|
|
2173
|
+
props: { error: true },
|
|
2174
|
+
style: {
|
|
2175
|
+
".MuiInputLabel-root": {
|
|
2176
|
+
color: baseTheme.palette.error.main,
|
|
2177
|
+
"&.MuiInputLabel-shrink": { color: baseTheme.palette.error.main }
|
|
2178
|
+
},
|
|
2179
|
+
"&:hover .MuiOutlinedInput-notchedOutline": { borderColor: baseTheme.palette.error.main },
|
|
2180
|
+
".Mui-focused .MuiOutlinedInput-notchedOutline": { borderColor: baseTheme.palette.error.main }
|
|
2181
|
+
}
|
|
2182
|
+
}] },
|
|
2183
|
+
MuiTypography: { styleOverrides: { root: { "& > span.important": {
|
|
2184
|
+
fontWeight: 600,
|
|
2185
|
+
color: baseTheme.palette.secondary.main
|
|
2186
|
+
} } } }
|
|
2187
|
+
} });
|
|
2188
|
+
//#endregion
|
|
2189
|
+
//#region src/components/networkError.js
|
|
2190
|
+
const NetworkError = ({ error }) => {
|
|
2191
|
+
const { isEmbeddedMode } = useDisplay();
|
|
2192
|
+
const { t } = useTranslation();
|
|
2193
|
+
const containerStyles = makeStyles({ isEmbeddedMode });
|
|
2194
|
+
return /* @__PURE__ */ React.createElement(Container$1, {
|
|
2195
|
+
maxWidth: false,
|
|
2196
|
+
disableGutters: true,
|
|
2197
|
+
sx: containerStyles.root
|
|
2198
|
+
}, /* @__PURE__ */ React.createElement(Card, { style: {
|
|
2199
|
+
background: "linear-gradient(180deg, #393939 0%, #4A4A4A 100%)",
|
|
2200
|
+
maxWidth: "600px",
|
|
2201
|
+
margin: "200px auto",
|
|
2202
|
+
borderRadius: "20px"
|
|
2203
|
+
} }, /* @__PURE__ */ React.createElement(CardContent, { style: { minHeight: "unset" } }, /* @__PURE__ */ React.createElement(Box, {
|
|
2204
|
+
display: "flex",
|
|
2205
|
+
flexDirection: "column",
|
|
2206
|
+
alignItems: "center",
|
|
2207
|
+
justifyContent: "center",
|
|
2208
|
+
m: "125px 80px"
|
|
2209
|
+
}, /* @__PURE__ */ React.createElement("h1", { style: {
|
|
2210
|
+
textAlign: "center",
|
|
2211
|
+
color: "rgba(255, 255, 255, 0.6)"
|
|
2212
|
+
} }, t("networkErrorHeader")), /* @__PURE__ */ React.createElement("p", { style: {
|
|
2213
|
+
display: "inline-flex",
|
|
2214
|
+
textAlign: "center",
|
|
2215
|
+
color: "rgba(255, 255, 255, 0.6)"
|
|
2216
|
+
} }, /* @__PURE__ */ React.createElement(Typography, { mr: 2 }, error.title), /* @__PURE__ */ React.createElement(Tooltip, {
|
|
2217
|
+
title: error.details,
|
|
2218
|
+
arrow: true
|
|
2219
|
+
}, /* @__PURE__ */ React.createElement(HelpOutlineIcon, null))), /* @__PURE__ */ React.createElement(Button, {
|
|
2220
|
+
onClick: () => window.location.reload(),
|
|
2221
|
+
"data-testid": "sdk.network-error.reload"
|
|
2222
|
+
}, t("networkErrorButtonText"))))), /* @__PURE__ */ React.createElement(Box, { sx: containerStyles.overlay }));
|
|
2223
|
+
};
|
|
2224
|
+
//#endregion
|
|
2225
|
+
//#region src/hooks/useQueryParams.js
|
|
2226
|
+
const useQueryParams = () => {
|
|
2227
|
+
return new URLSearchParams(useLocation().search);
|
|
2228
|
+
};
|
|
2229
|
+
//#endregion
|
|
2230
|
+
//#region src/utils/validateRedirect.ts
|
|
2231
|
+
function validateRedirectUrl(url) {
|
|
2232
|
+
if (!url) return "/";
|
|
2233
|
+
if (url.startsWith("//")) return "/";
|
|
2234
|
+
if (url.startsWith("/")) return url;
|
|
2235
|
+
try {
|
|
2236
|
+
const parsed = new URL(url);
|
|
2237
|
+
if (parsed.origin === window.location.origin) return parsed.pathname + parsed.search + parsed.hash;
|
|
2238
|
+
} catch {}
|
|
2239
|
+
return "/";
|
|
2240
|
+
}
|
|
2241
|
+
//#endregion
|
|
2242
|
+
//#region src/components/authRedirect.js
|
|
2243
|
+
const OAUTH_STATE_KEY$1 = "oauth2_state";
|
|
2244
|
+
const AuthRedirect = () => {
|
|
2245
|
+
const queryParams = useQueryParams();
|
|
2246
|
+
const nextPath = validateRedirectUrl(queryParams.get("next") || "/");
|
|
2247
|
+
useEffect(() => {
|
|
2248
|
+
const code = queryParams.get("code");
|
|
2249
|
+
const returnedState = queryParams.get("state");
|
|
2250
|
+
const storedState = sessionStorage.getItem(OAUTH_STATE_KEY$1);
|
|
2251
|
+
if (code) {
|
|
2252
|
+
if (storedState && returnedState !== storedState) {
|
|
2253
|
+
sessionStorage.removeItem(OAUTH_STATE_KEY$1);
|
|
2254
|
+
return;
|
|
2255
|
+
}
|
|
2256
|
+
sessionStorage.removeItem(OAUTH_STATE_KEY$1);
|
|
2257
|
+
sessionStore.authorize({ code });
|
|
2258
|
+
}
|
|
2259
|
+
}, [queryParams]);
|
|
2260
|
+
if (sessionStore.isLoggedIn) return /* @__PURE__ */ React.createElement(Navigate, { to: nextPath });
|
|
2261
|
+
return null;
|
|
2262
|
+
};
|
|
2263
|
+
//#endregion
|
|
2264
|
+
//#region src/components/iframeNavigation.js
|
|
2265
|
+
const IframeNavigation = () => {
|
|
2266
|
+
const { isEmbeddedMode, iframeNavigationItems } = useDisplay();
|
|
2267
|
+
const navigate = useNavigate();
|
|
2268
|
+
const location = useLocation();
|
|
2269
|
+
useEffect(() => {
|
|
2270
|
+
if (!isEmbeddedMode) return;
|
|
2271
|
+
postToParent({
|
|
2272
|
+
type: "IFRAME_NAVIGATION_CURRENT",
|
|
2273
|
+
path: location.pathname
|
|
2274
|
+
});
|
|
2275
|
+
}, [isEmbeddedMode, location.pathname]);
|
|
2276
|
+
useEffect(() => {
|
|
2277
|
+
if (!isEmbeddedMode) return;
|
|
2278
|
+
postToParent({
|
|
2279
|
+
type: "IFRAME_NAVIGATION_ITEMS",
|
|
2280
|
+
items: iframeNavigationItems
|
|
2281
|
+
});
|
|
2282
|
+
}, [isEmbeddedMode, iframeNavigationItems]);
|
|
2283
|
+
useEffect(() => {
|
|
2284
|
+
if (!isEmbeddedMode) return;
|
|
2285
|
+
const onMessage = (event) => {
|
|
2286
|
+
if (!isTrustedOrigin(event.origin)) return;
|
|
2287
|
+
const data = event.data;
|
|
2288
|
+
if (!data || typeof data !== "object") return;
|
|
2289
|
+
switch (data.type) {
|
|
2290
|
+
case "NAVIGATE":
|
|
2291
|
+
if (typeof data.path === "string") navigate(data.path, {
|
|
2292
|
+
replace: !!data.replace,
|
|
2293
|
+
state: data.state
|
|
2294
|
+
});
|
|
2295
|
+
break;
|
|
2296
|
+
default: break;
|
|
2297
|
+
}
|
|
2298
|
+
};
|
|
2299
|
+
window.addEventListener("message", onMessage);
|
|
2300
|
+
postToParent({ type: "IFRAME_NAVIGATION_READY" });
|
|
2301
|
+
return () => {
|
|
2302
|
+
window.removeEventListener("message", onMessage);
|
|
2303
|
+
postToParent({ type: "IFRAME_NAVIGATION_DISPOSED" });
|
|
2304
|
+
};
|
|
2305
|
+
}, [isEmbeddedMode, navigate]);
|
|
2306
|
+
return null;
|
|
2307
|
+
};
|
|
2308
|
+
//#endregion
|
|
2309
|
+
//#region src/assets/info-icon.svg
|
|
2310
|
+
var info_icon_default = "data:image/svg+xml,<?xml version=\"1.0\" encoding=\"UTF-8\"?>%0A<svg enable-background=\"new 0 0 122.88 122.88\" version=\"1.1\" viewBox=\"0 0 122.88 122.88\" xml:space=\"preserve\" xmlns=\"http://www.w3.org/2000/svg\"><g fill=\"%23156bd1\"><path d=\"m61.44 9.23c-1.85 0-3.64 0.08-5.35 0.25s-3.44 0.42-5.17 0.77c-1.72 0.34-3.39 0.77-5 1.26-1.59 0.49-3.16 1.07-4.7 1.72l-0.1 0.05c-1.63 0.7-3.18 1.45-4.67 2.25-1.5 0.81-2.94 1.68-4.31 2.6-1.38 0.93-2.72 1.92-3.99 2.97s-2.5 2.16-3.68 3.35l-0.04 0.04c-1.18 1.18-2.29 2.4-3.33 3.66-1.05 1.28-2.04 2.61-2.97 3.99-0.92 1.36-1.78 2.8-2.59 4.3-0.8 1.49-1.56 3.05-2.26 4.67l-0.05 0.11-0.07 0.14c-0.63 1.5-1.19 3.04-1.67 4.61-0.49 1.59-0.9 3.23-1.24 4.93-0.35 1.73-0.6 3.45-0.77 5.17s-0.25 3.5-0.25 5.35 0.08 3.64 0.25 5.35 0.42 3.44 0.77 5.17c0.35 1.72 0.77 3.39 1.27 5 0.49 1.57 1.05 3.13 1.7 4.66 0.04 0.07 0.07 0.14 0.1 0.21 0.69 1.6 1.43 3.13 2.23 4.6 0.81 1.5 1.68 2.94 2.59 4.3 0.93 1.39 1.92 2.72 2.98 4 1.02 1.24 2.11 2.44 3.26 3.59 0.07 0.06 0.13 0.12 0.19 0.19 1.16 1.16 2.36 2.24 3.59 3.26 1.28 1.05 2.61 2.04 3.99 2.97 1.36 0.92 2.8 1.78 4.3 2.59 1.49 0.8 3.05 1.56 4.67 2.26l0.21 0.1c1.52 0.64 3.07 1.2 4.67 1.69 1.58 0.49 3.23 0.9 4.92 1.24 1.73 0.35 3.45 0.6 5.17 0.77s3.5 0.25 5.35 0.25 3.64-0.08 5.35-0.25 3.44-0.42 5.17-0.77c1.72-0.35 3.39-0.77 5-1.27 1.59-0.49 3.16-1.07 4.71-1.73l0.09-0.04v-0.01c1.63-0.7 3.18-1.45 4.67-2.25 1.5-0.81 2.94-1.68 4.31-2.6 1.38-0.93 2.72-1.92 3.99-2.97 1.25-1.03 2.45-2.12 3.62-3.29 0.06-0.06 0.11-0.12 0.18-0.18 1.15-1.15 2.23-2.35 3.25-3.58 1.05-1.28 2.05-2.61 2.98-4 0.92-1.36 1.78-2.8 2.59-4.3 0.8-1.49 1.56-3.04 2.26-4.67l0.1-0.22c0.64-1.51 1.2-3.06 1.69-4.65s0.9-3.23 1.24-4.93c0.35-1.73 0.6-3.45 0.77-5.17s0.25-3.5 0.25-5.35-0.08-3.64-0.25-5.35-0.42-3.44-0.77-5.17c-0.35-1.72-0.77-3.39-1.27-5-0.49-1.59-1.07-3.16-1.73-4.71l-0.04-0.09c-0.7-1.63-1.45-3.18-2.25-4.67-0.81-1.5-1.68-2.94-2.59-4.3-0.93-1.38-1.92-2.72-2.97-3.99-1.02-1.24-2.12-2.45-3.28-3.61-0.07-0.06-0.13-0.12-0.18-0.18-1.16-1.16-2.35-2.24-3.59-3.26-1.28-1.05-2.61-2.04-3.99-2.97-1.37-0.92-2.8-1.78-4.3-2.59-1.49-0.8-3.04-1.56-4.67-2.25l-0.19-0.09c-1.52-0.64-3.08-1.21-4.68-1.7-1.58-0.49-3.23-0.9-4.93-1.24-1.73-0.35-3.45-0.6-5.17-0.77-1.73-0.14-3.52-0.22-5.37-0.22zm1.9 21.94c2.19 0 3.91 0.63 5.16 1.88 1.24 1.25 1.87 2.96 1.87 5.17 0 2.24-1.07 4.22-3.21 5.97-2.16 1.74-4.66 2.62-7.52 2.62-2.14 0-3.85-0.6-5.16-1.8-1.31-1.22-1.96-2.79-1.96-4.75 0-2.47 1.07-4.59 3.19-6.4 2.11-1.8 4.66-2.69 7.63-2.69zm12.21 60.54h-28.22v-4.75h5.3v-29.01h-5.3v-3.78h13.19c3.33 0 6.61-0.4 9.85-1.22v34.01h5.18v4.75zm-26.43-90.51c1.96-0.39 3.99-0.69 6.08-0.89 2.09-0.21 4.17-0.31 6.24-0.31s4.15 0.1 6.24 0.31c2.09 0.2 4.12 0.5 6.08 0.89 1.94 0.39 3.88 0.88 5.82 1.48 1.88 0.58 3.74 1.26 5.58 2.04l0.19 0.07 0.06 0.02c1.85 0.8 3.65 1.67 5.38 2.61 1.71 0.93 3.4 1.95 5.07 3.07 1.63 1.1 3.21 2.27 4.73 3.52s2.97 2.56 4.34 3.95c1.38 1.38 2.7 2.83 3.95 4.34 1.25 1.52 2.42 3.09 3.52 4.73 1.09 1.63 2.11 3.32 3.06 5.06h0.01c0.94 1.74 1.82 3.54 2.61 5.39l0.06 0.15c0.78 1.83 1.46 3.7 2.05 5.6 0.61 1.96 1.11 3.92 1.5 5.89 0.39 1.96 0.69 3.99 0.89 6.08s0.3 4.17 0.3 6.24-0.1 4.15-0.31 6.24c-0.2 2.09-0.5 4.12-0.89 6.08-0.39 1.94-0.88 3.88-1.48 5.82-0.58 1.89-1.27 3.76-2.05 5.62l-0.04 0.09-0.05 0.11c-0.8 1.85-1.67 3.65-2.61 5.38-0.93 1.71-1.95 3.4-3.07 5.07-1.1 1.63-2.27 3.21-3.52 4.73s-2.56 2.96-3.95 4.34c-1.38 1.38-2.83 2.7-4.35 3.95s-3.09 2.42-4.72 3.51-3.32 2.11-5.06 3.06c-1.78 0.96-3.57 1.84-5.39 2.62-0.05 0.02-0.1 0.04-0.16 0.06-1.83 0.78-3.7 1.46-5.6 2.05-1.96 0.61-3.92 1.11-5.88 1.5s-3.99 0.69-6.08 0.89-4.17 0.3-6.24 0.3-4.15-0.1-6.24-0.3-4.12-0.5-6.08-0.89c-1.94-0.39-3.88-0.88-5.82-1.48-1.89-0.58-3.76-1.27-5.61-2.05l-0.2-0.08c-1.85-0.8-3.65-1.67-5.38-2.61-1.71-0.93-3.4-1.95-5.07-3.07-1.63-1.09-3.21-2.27-4.72-3.51-1.52-1.25-2.97-2.57-4.35-3.95s-2.7-2.83-3.95-4.34c-1.25-1.52-2.42-3.1-3.52-4.73-1.09-1.63-2.11-3.32-3.06-5.06-0.97-1.78-1.84-3.58-2.62-5.4l-0.06-0.15c-0.78-1.83-1.46-3.7-2.05-5.6-0.61-1.96-1.11-3.93-1.5-5.89s-0.69-3.99-0.89-6.08c-0.21-2.08-0.31-4.16-0.31-6.23s0.1-4.15 0.31-6.24c0.2-2.09 0.5-4.12 0.89-6.08 0.39-1.94 0.88-3.88 1.48-5.82 0.58-1.88 1.26-3.74 2.04-5.59l0.09-0.23c0.8-1.85 1.67-3.65 2.61-5.38 0.93-1.71 1.95-3.4 3.07-5.07 1.1-1.63 2.27-3.21 3.52-4.73s2.56-2.96 3.95-4.34c1.38-1.38 2.83-2.7 4.34-3.95 1.52-1.25 3.09-2.42 4.73-3.52 1.67-1.12 3.36-2.14 5.07-3.07l0.13-0.06c1.73-0.94 3.48-1.78 5.26-2.55l0.15-0.06c1.83-0.78 3.7-1.46 5.6-2.05 1.95-0.61 3.91-1.11 5.88-1.5z\" fill=\"%23156bd1\"/></g></svg>%0A";
|
|
2311
|
+
//#endregion
|
|
2312
|
+
//#region src/components/loginForm.js
|
|
2313
|
+
const LoginForm = ({ scope, redirectPath, onSuccess, onFailure, onCancel, storeSession, title, "data-testid": dataTestID }) => {
|
|
2314
|
+
const [username, setUsername] = useState("");
|
|
2315
|
+
const [password, setPassword] = useState("");
|
|
2316
|
+
const [usernameError, setUsernameError] = useState(null);
|
|
2317
|
+
const [passwordError, setPasswordError] = useState(null);
|
|
2318
|
+
const { releaseVersion, releasePageLink } = useMetaInfo();
|
|
2319
|
+
const navigate = useNavigate();
|
|
2320
|
+
const { t } = useTranslation();
|
|
2321
|
+
const authorizeUser = async (credentials) => {
|
|
2322
|
+
const session = await sessionStore.authorize({
|
|
2323
|
+
scope,
|
|
2324
|
+
...credentials
|
|
2325
|
+
}, storeSession);
|
|
2326
|
+
if (session) {
|
|
2327
|
+
if (onSuccess && typeof onSuccess === "function") onSuccess(session);
|
|
2328
|
+
setPassword("");
|
|
2329
|
+
navigate(redirectPath);
|
|
2330
|
+
} else if (onFailure && typeof onFailure === "function") onFailure();
|
|
2331
|
+
};
|
|
2332
|
+
useEffect(() => {
|
|
2333
|
+
onScan.attachTo(document, {
|
|
2334
|
+
suffixKeyCodes: [13],
|
|
2335
|
+
onScan: function(sCode) {
|
|
2336
|
+
setUsername("");
|
|
2337
|
+
setPassword("");
|
|
2338
|
+
authorizeUser({
|
|
2339
|
+
username: "code",
|
|
2340
|
+
password: sCode
|
|
2341
|
+
});
|
|
2342
|
+
}
|
|
2343
|
+
});
|
|
2344
|
+
return () => {
|
|
2345
|
+
onScan.detachFrom(document);
|
|
2346
|
+
};
|
|
2347
|
+
}, []);
|
|
2348
|
+
const handleCancel = (event) => {
|
|
2349
|
+
if (onCancel && typeof onCancel === "function") onCancel();
|
|
2350
|
+
else navigate("/");
|
|
2351
|
+
};
|
|
2352
|
+
const handleSubmit = async (event) => {
|
|
2353
|
+
event.preventDefault();
|
|
2354
|
+
const uError = username.trim() ? null : t("sdk.login.usernameRequired");
|
|
2355
|
+
const pError = password ? null : t("sdk.login.passwordRequired");
|
|
2356
|
+
setUsernameError(uError);
|
|
2357
|
+
setPasswordError(pError);
|
|
2358
|
+
if (uError || pError) return;
|
|
2359
|
+
authorizeUser({
|
|
2360
|
+
username,
|
|
2361
|
+
password
|
|
2362
|
+
});
|
|
2363
|
+
};
|
|
2364
|
+
const handleChangeForUsername = (event) => {
|
|
2365
|
+
setUsername(event.target.value);
|
|
2366
|
+
if (usernameError) setUsernameError(null);
|
|
2367
|
+
};
|
|
2368
|
+
const handleChangeForPassword = (event) => {
|
|
2369
|
+
setPassword(event.target.value);
|
|
2370
|
+
if (passwordError) setPasswordError(null);
|
|
2371
|
+
};
|
|
2372
|
+
return /* @__PURE__ */ React.createElement("form", {
|
|
2373
|
+
onSubmit: handleSubmit,
|
|
2374
|
+
"data-testid": dataTestID || "sdk.login-form"
|
|
2375
|
+
}, /* @__PURE__ */ React.createElement(Box, { m: "0 80px" }, /* @__PURE__ */ React.createElement(Box, {
|
|
2376
|
+
display: "flex",
|
|
2377
|
+
flexDirection: "column",
|
|
2378
|
+
alignItems: "center",
|
|
2379
|
+
justifyContent: "center",
|
|
2380
|
+
gap: 2,
|
|
2381
|
+
m: "100px 0"
|
|
2382
|
+
}, /* @__PURE__ */ React.createElement(AcLogoSVG, null), releaseVersion && /* @__PURE__ */ React.createElement(Link, {
|
|
2383
|
+
href: releasePageLink,
|
|
2384
|
+
target: "_blank",
|
|
2385
|
+
fontSize: "14px",
|
|
2386
|
+
sx: {
|
|
2387
|
+
display: "flex",
|
|
2388
|
+
alignItems: "center",
|
|
2389
|
+
gap: .5,
|
|
2390
|
+
textDecoration: "none",
|
|
2391
|
+
"&:hover": {
|
|
2392
|
+
cursor: "pointer",
|
|
2393
|
+
opacity: .8
|
|
2394
|
+
}
|
|
2395
|
+
}
|
|
2396
|
+
}, /* @__PURE__ */ React.createElement("img", {
|
|
2397
|
+
src: info_icon_default,
|
|
2398
|
+
alt: "info",
|
|
2399
|
+
width: "14px",
|
|
2400
|
+
height: "14px"
|
|
2401
|
+
}), t("release"), " ", releaseVersion)), /* @__PURE__ */ React.createElement(Box, {
|
|
2402
|
+
m: "0 0 30px 0",
|
|
2403
|
+
color: "rgba(255, 255, 255, 0.6)"
|
|
2404
|
+
}, /* @__PURE__ */ React.createElement(Typography, {
|
|
2405
|
+
align: "center",
|
|
2406
|
+
color: "inherit"
|
|
2407
|
+
}, title)), /* @__PURE__ */ React.createElement(Box, {
|
|
2408
|
+
m: "0",
|
|
2409
|
+
display: "grid",
|
|
2410
|
+
sx: { gridGap: "18px" },
|
|
2411
|
+
gridTemplateColumns: "1fr"
|
|
2412
|
+
}, /* @__PURE__ */ React.createElement(FormControl, { fullWidth: true }, /* @__PURE__ */ React.createElement(TextField, {
|
|
2413
|
+
autoFocus: true,
|
|
2414
|
+
fullWidth: true,
|
|
2415
|
+
variant: "outlined",
|
|
2416
|
+
label: t("loginCardUsernameHint"),
|
|
2417
|
+
onChange: handleChangeForUsername,
|
|
2418
|
+
value: username,
|
|
2419
|
+
error: Boolean(usernameError),
|
|
2420
|
+
helperText: usernameError,
|
|
2421
|
+
id: "login-input",
|
|
2422
|
+
inputProps: { "data-testid": "sdk.login-form-username-input" }
|
|
2423
|
+
})), /* @__PURE__ */ React.createElement(FormControl, { fullWidth: true }, /* @__PURE__ */ React.createElement(TextField, {
|
|
2424
|
+
fullWidth: true,
|
|
2425
|
+
variant: "outlined",
|
|
2426
|
+
label: t("loginCardPasswordHint"),
|
|
2427
|
+
onChange: handleChangeForPassword,
|
|
2428
|
+
value: password,
|
|
2429
|
+
error: Boolean(passwordError),
|
|
2430
|
+
helperText: passwordError,
|
|
2431
|
+
type: "password",
|
|
2432
|
+
id: "password-input",
|
|
2433
|
+
inputProps: { "data-testid": "sdk.login-form-password-input" }
|
|
2434
|
+
})), /* @__PURE__ */ React.createElement(LoadingButton, {
|
|
2435
|
+
id: "login-button",
|
|
2436
|
+
type: "submit",
|
|
2437
|
+
variant: "contained",
|
|
2438
|
+
size: "large",
|
|
2439
|
+
color: "primary",
|
|
2440
|
+
onClick: handleSubmit,
|
|
2441
|
+
loading: sessionStore.loading,
|
|
2442
|
+
"data-testid": "sdk.login-form-submit-button"
|
|
2443
|
+
}, t("loginCardSubmitButton")), /* @__PURE__ */ React.createElement(Button, {
|
|
2444
|
+
id: "cancel-button",
|
|
2445
|
+
type: "button",
|
|
2446
|
+
variant: "outlined",
|
|
2447
|
+
size: "large",
|
|
2448
|
+
color: "secondary",
|
|
2449
|
+
onClick: handleCancel,
|
|
2450
|
+
"data-testid": "sdk.login-form-cancel-button"
|
|
2451
|
+
}, t("loginCardCancelButton"))), /* @__PURE__ */ React.createElement(Box, {
|
|
2452
|
+
m: "30px 0 40px 0",
|
|
2453
|
+
color: "rgba(255, 255, 255, 0.6)"
|
|
2454
|
+
}, /* @__PURE__ */ React.createElement(Typography, {
|
|
2455
|
+
align: "center",
|
|
2456
|
+
color: "inherit"
|
|
2457
|
+
}, "or scan")), /* @__PURE__ */ React.createElement(Box, {
|
|
2458
|
+
display: "grid",
|
|
2459
|
+
gridTemplateColumns: "1fr 1fr 1fr",
|
|
2460
|
+
alignItems: "center",
|
|
2461
|
+
justifyItems: "center",
|
|
2462
|
+
marginBottom: "30px"
|
|
2463
|
+
}, /* @__PURE__ */ React.createElement(Box, { style: { filter: "brightness(0.5)" } }, /* @__PURE__ */ React.createElement(QRCodeSVG, null)), /* @__PURE__ */ React.createElement(BarcodeSVG, null), /* @__PURE__ */ React.createElement(Box, { style: { filter: "brightness(0.5)" } }, /* @__PURE__ */ React.createElement(RFIDCardSVG, null)))));
|
|
2464
|
+
};
|
|
2465
|
+
LoginForm.propTypes = {
|
|
2466
|
+
scope: PropTypes.string,
|
|
2467
|
+
redirectPath: PropTypes.string,
|
|
2468
|
+
onSuccess: PropTypes.func,
|
|
2469
|
+
onFailure: PropTypes.func,
|
|
2470
|
+
onCancel: PropTypes.func,
|
|
2471
|
+
storeSession: PropTypes.bool
|
|
2472
|
+
};
|
|
2473
|
+
LoginForm.defaultProps = {
|
|
2474
|
+
redirectPath: "/",
|
|
2475
|
+
storeSession: true
|
|
2476
|
+
};
|
|
2477
|
+
var loginForm_default = observer(LoginForm);
|
|
2478
|
+
const QRCodeSVG = () => {
|
|
2479
|
+
return /* @__PURE__ */ React.createElement("svg", {
|
|
2480
|
+
width: "51",
|
|
2481
|
+
height: "53",
|
|
2482
|
+
viewBox: "0 0 51 53",
|
|
2483
|
+
fill: "none",
|
|
2484
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
2485
|
+
}, /* @__PURE__ */ React.createElement("path", {
|
|
2486
|
+
d: "M8.66868 45.6365C8.66868 42.8453 6.99822 41.1535 4.7397 41.1535C2.47266 41.1535 0.806463 42.8453 0.806463 45.6365C0.806463 48.4234 2.47266 50.1194 4.7397 50.1194C5.3022 50.1194 5.82635 50.0172 6.2951 49.8169L7.04084 50.7842H8.38743L7.21129 49.2501C8.1147 48.4873 8.66868 47.243 8.66868 45.6365ZM4.29652 47.1706L5.53658 48.7984C5.28942 48.8794 5.02095 48.9177 4.7397 48.9177C3.23544 48.9177 2.1147 47.7629 2.1147 45.6365C2.1147 43.5101 3.23544 42.3552 4.7397 42.3552C6.2397 42.3552 7.3647 43.5101 7.3647 45.6365C7.3647 46.8297 7.01101 47.7203 6.43146 48.2657L5.59197 47.1706H4.29652ZM10.3104 50.0001H11.6271V46.6976H13.4169C13.4467 46.6976 13.4723 46.6976 13.5021 46.6976L15.2749 50.0001H16.7749L14.8402 46.4675C15.9098 46.0711 16.4425 45.1805 16.4425 44.0086C16.4425 42.4021 15.4453 41.2728 13.4212 41.2728H10.3104V50.0001ZM11.6271 45.564V42.4021H13.2805C14.5803 42.4021 15.1172 43.02 15.1172 44.0086C15.1172 44.993 14.5803 45.564 13.2976 45.564H11.6271ZM28.4691 44.1109C28.1708 42.2444 26.7092 41.1535 24.864 41.1535C22.6055 41.1535 20.9393 42.8453 20.9393 45.6365C20.9393 48.4277 22.5969 50.1194 24.864 50.1194C26.7816 50.1194 28.1836 48.9177 28.4691 47.1919L27.1396 47.1876C26.9137 48.3041 25.9762 48.9177 24.8725 48.9177C23.3768 48.9177 22.2475 47.7714 22.2475 45.6365C22.2475 43.5186 23.3725 42.3552 24.8768 42.3552C25.989 42.3552 26.9222 42.9817 27.1396 44.1109H28.4691ZM32.6996 50.1322C34.5447 50.1322 35.7507 48.7814 35.7507 46.7572C35.7507 44.7203 34.5447 43.3694 32.6996 43.3694C30.8544 43.3694 29.6484 44.7203 29.6484 46.7572C29.6484 48.7814 30.8544 50.1322 32.6996 50.1322ZM32.7038 49.0626C31.4979 49.0626 30.9354 48.0101 30.9354 46.753C30.9354 45.5001 31.4979 44.4348 32.7038 44.4348C33.9013 44.4348 34.4638 45.5001 34.4638 46.753C34.4638 48.0101 33.9013 49.0626 32.7038 49.0626ZM39.6232 50.128C40.8164 50.128 41.2852 49.3993 41.5153 48.9817H41.6218V50.0001H42.8661V41.2728H41.592V44.5157H41.5153C41.2852 44.1109 40.8505 43.3694 39.6317 43.3694C38.0508 43.3694 36.8874 44.618 36.8874 46.7402C36.8874 48.8581 38.0337 50.128 39.6232 50.128ZM39.9045 49.0413C38.7667 49.0413 38.1744 48.0399 38.1744 46.7274C38.1744 45.4277 38.7539 44.4518 39.9045 44.4518C41.0167 44.4518 41.6133 45.3595 41.6133 46.7274C41.6133 48.1038 41.0039 49.0413 39.9045 49.0413ZM47.5057 50.1322C48.9332 50.1322 49.9432 49.4291 50.233 48.3638L49.027 48.1464C48.7969 48.7643 48.2429 49.0797 47.5185 49.0797C46.4276 49.0797 45.6946 48.3723 45.6605 47.1109H50.3139V46.6592C50.3139 44.2942 48.8991 43.3694 47.4162 43.3694C45.5923 43.3694 44.3906 44.7586 44.3906 46.77C44.3906 48.8027 45.5753 50.1322 47.5057 50.1322ZM45.6648 46.1564C45.7159 45.2274 46.3892 44.422 47.4247 44.422C48.4134 44.422 49.0611 45.155 49.0653 46.1564H45.6648Z",
|
|
2487
|
+
fill: "white",
|
|
2488
|
+
fillOpacity: "0.35"
|
|
2489
|
+
}), /* @__PURE__ */ React.createElement("g", { clipPath: "url(#clip0_2183_35009)" }, /* @__PURE__ */ React.createElement("path", {
|
|
2490
|
+
d: "M22.3002 3.27948H14.25V11.3318H22.3002V3.27948ZM20.6609 9.66275H15.9186V4.91923H20.6609V9.66275Z",
|
|
2491
|
+
fill: "white",
|
|
2492
|
+
fillOpacity: "0.35"
|
|
2493
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2494
|
+
d: "M19.1081 6.47128H17.4688V8.11102H19.1081V6.47128Z",
|
|
2495
|
+
fill: "white",
|
|
2496
|
+
fillOpacity: "0.35"
|
|
2497
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2498
|
+
d: "M14.2773 24.7206H22.3275V16.7122H14.2773V24.7206ZM15.9166 18.3373H20.6589V23.0809H15.9166V18.3373Z",
|
|
2499
|
+
fill: "white",
|
|
2500
|
+
fillOpacity: "0.35"
|
|
2501
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2502
|
+
d: "M35.7147 17.5176H34.0754V23.081H32.4653V21.8366H30.826V23.0591H28.8281V24.6988H35.7147V17.5176Z",
|
|
2503
|
+
fill: "white",
|
|
2504
|
+
fillOpacity: "0.35"
|
|
2505
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2506
|
+
d: "M19.1081 19.8893H17.4688V21.529H19.1081V19.8893Z",
|
|
2507
|
+
fill: "white",
|
|
2508
|
+
fillOpacity: "0.35"
|
|
2509
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2510
|
+
d: "M35.7142 3.27948H27.6641V11.3318H35.7142V3.27948ZM34.0749 9.66275H29.318V4.91923H34.0603L34.0749 9.66275Z",
|
|
2511
|
+
fill: "white",
|
|
2512
|
+
fillOpacity: "0.35"
|
|
2513
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2514
|
+
d: "M32.5221 6.47128H30.8828V8.11102H32.5221V6.47128Z",
|
|
2515
|
+
fill: "white",
|
|
2516
|
+
fillOpacity: "0.35"
|
|
2517
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2518
|
+
d: "M22.3014 13.184H17.5664V14.8237H22.3014V13.184Z",
|
|
2519
|
+
fill: "white",
|
|
2520
|
+
fillOpacity: "0.35"
|
|
2521
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2522
|
+
d: "M15.9167 13.184H14.2773V14.8237H15.9167V13.184Z",
|
|
2523
|
+
fill: "white",
|
|
2524
|
+
fillOpacity: "0.35"
|
|
2525
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2526
|
+
d: "M30.041 13.184H23.9375V14.8237H30.041V13.184Z",
|
|
2527
|
+
fill: "white",
|
|
2528
|
+
fillOpacity: "0.35"
|
|
2529
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2530
|
+
d: "M35.7121 15.8778V13.1766H31.6797V14.8237H34.0728V15.8778H35.7121Z",
|
|
2531
|
+
fill: "white",
|
|
2532
|
+
fillOpacity: "0.35"
|
|
2533
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2534
|
+
d: "M25.819 6.56622H24.1797V11.3024H25.819V6.56622Z",
|
|
2535
|
+
fill: "white",
|
|
2536
|
+
fillOpacity: "0.35"
|
|
2537
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2538
|
+
d: "M25.819 3.27948H24.1797V4.91922H25.819V3.27948Z",
|
|
2539
|
+
fill: "white",
|
|
2540
|
+
fillOpacity: "0.35"
|
|
2541
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2542
|
+
d: "M25.82 21.4338H27.0348V19.7941H25.82V16.7122H24.1953V24.7645H27.1958V23.0809H25.8346L25.82 21.4338Z",
|
|
2543
|
+
fill: "white",
|
|
2544
|
+
fillOpacity: "0.35"
|
|
2545
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2546
|
+
d: "M29.1874 19.5598H30.8267V18.3373H32.1587V16.7122H27.8555V18.352H29.1874V19.5598Z",
|
|
2547
|
+
fill: "white",
|
|
2548
|
+
fillOpacity: "0.35"
|
|
2549
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2550
|
+
d: "M33.2539 6.42268e-05V1.6398H37.3668V5.73182H39.0061V-0.00726318L33.2539 6.42268e-05Z",
|
|
2551
|
+
fill: "white",
|
|
2552
|
+
fillOpacity: "0.35"
|
|
2553
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2554
|
+
d: "M12.6408 1.63985H16.7391V0.00012207H11.0234V5.73188H12.6627L12.6408 1.63985Z",
|
|
2555
|
+
fill: "white",
|
|
2556
|
+
fillOpacity: "0.35"
|
|
2557
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2558
|
+
d: "M37.3678 26.3603H33.2695V28.0001H39.0071V22.261H37.3678V26.3603Z",
|
|
2559
|
+
fill: "white",
|
|
2560
|
+
fillOpacity: "0.35"
|
|
2561
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2562
|
+
d: "M12.6408 22.261H11.0234V28.0001H16.761V26.3603H12.6627L12.6408 22.261Z",
|
|
2563
|
+
fill: "white",
|
|
2564
|
+
fillOpacity: "0.35"
|
|
2565
|
+
})), /* @__PURE__ */ React.createElement("defs", null, /* @__PURE__ */ React.createElement("clipPath", { id: "clip0_2183_35009" }, /* @__PURE__ */ React.createElement("rect", {
|
|
2566
|
+
width: "28",
|
|
2567
|
+
height: "28",
|
|
2568
|
+
fill: "white",
|
|
2569
|
+
transform: "translate(11 0.00012207)"
|
|
2570
|
+
}))));
|
|
2571
|
+
};
|
|
2572
|
+
const BarcodeSVG = () => {
|
|
2573
|
+
return /* @__PURE__ */ React.createElement("svg", {
|
|
2574
|
+
width: "52",
|
|
2575
|
+
height: "49",
|
|
2576
|
+
viewBox: "0 0 52 49",
|
|
2577
|
+
fill: "none",
|
|
2578
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
2579
|
+
}, /* @__PURE__ */ React.createElement("path", {
|
|
2580
|
+
d: "M1.42951 46.0001H4.77468C6.80309 46.0001 7.71928 44.9902 7.71928 43.6521C7.71928 42.3013 6.77326 41.5385 5.9082 41.4916V41.4064C6.70934 41.2018 7.37837 40.6564 7.37837 39.5655C7.37837 38.2743 6.48349 37.2728 4.62553 37.2728H1.42951V46.0001ZM2.74627 44.8709V42.0754H4.69371C5.75053 42.0754 6.41104 42.7572 6.41104 43.5882C6.41104 44.3211 5.91246 44.8709 4.64684 44.8709H2.74627ZM2.74627 41.0484V38.3936H4.54457C5.5886 38.3936 6.08718 38.9433 6.08718 39.6677C6.08718 40.5115 5.39684 41.0484 4.51048 41.0484H2.74627ZM11.0836 46.145C12.166 46.145 12.7754 45.5953 13.0183 45.1052H13.0694V46.0001H14.3137V41.6535C14.3137 39.7487 12.8137 39.3694 11.774 39.3694C10.5893 39.3694 9.4984 39.8467 9.07227 41.0399L10.2697 41.3126C10.4572 40.8481 10.9345 40.4007 11.791 40.4007C12.6135 40.4007 13.0353 40.8311 13.0353 41.5726V41.6024C13.0353 42.0669 12.5581 42.0584 11.3819 42.1947C10.1419 42.3396 8.87198 42.6635 8.87198 44.1507C8.87198 45.4376 9.83931 46.145 11.0836 46.145ZM11.3606 45.1223C10.6404 45.1223 10.1206 44.7984 10.1206 44.1677C10.1206 43.4859 10.7257 43.243 11.4629 43.145C11.8762 43.0896 12.8564 42.9788 13.0396 42.7956V43.6393C13.0396 44.4149 12.4217 45.1223 11.3606 45.1223ZM16.0108 46.0001H17.285V42.003C17.285 41.1464 17.9455 40.5285 18.8489 40.5285C19.1131 40.5285 19.4114 40.5754 19.5137 40.6052V39.3865C19.3858 39.3694 19.1344 39.3567 18.9725 39.3567C18.2054 39.3567 17.5492 39.7913 17.3105 40.4944H17.2424V39.4547H16.0108V46.0001ZM26.5492 46.1322C28.0961 46.1322 29.0975 45.2032 29.2381 43.9291H27.998C27.8361 44.6365 27.2864 45.0541 26.5577 45.0541C25.4796 45.0541 24.785 44.155 24.785 42.7274C24.785 41.3254 25.4924 40.4433 26.5577 40.4433C27.3674 40.4433 27.8617 40.9547 27.998 41.5683H29.2381C29.1017 40.2473 28.0236 39.3694 26.5364 39.3694C24.6912 39.3694 23.498 40.7586 23.498 42.7572C23.498 44.7302 24.6486 46.1322 26.5492 46.1322ZM33.3578 46.1322C35.2029 46.1322 36.4089 44.7814 36.4089 42.7572C36.4089 40.7203 35.2029 39.3694 33.3578 39.3694C31.5126 39.3694 30.3066 40.7203 30.3066 42.7572C30.3066 44.7814 31.5126 46.1322 33.3578 46.1322ZM33.362 45.0626C32.1561 45.0626 31.5936 44.0101 31.5936 42.753C31.5936 41.5001 32.1561 40.4348 33.362 40.4348C34.5595 40.4348 35.122 41.5001 35.122 42.753C35.122 44.0101 34.5595 45.0626 33.362 45.0626ZM40.2814 46.128C41.4746 46.128 41.9434 45.3993 42.1735 44.9817H42.28V46.0001H43.5243V37.2728H42.2502V40.5157H42.1735C41.9434 40.1109 41.5087 39.3694 40.29 39.3694C38.709 39.3694 37.5456 40.618 37.5456 42.7402C37.5456 44.8581 38.6919 46.128 40.2814 46.128ZM40.5627 45.0413C39.4249 45.0413 38.8326 44.0399 38.8326 42.7274C38.8326 41.4277 39.4121 40.4518 40.5627 40.4518C41.6749 40.4518 42.2715 41.3595 42.2715 42.7274C42.2715 44.1038 41.6621 45.0413 40.5627 45.0413ZM48.1639 46.1322C49.5914 46.1322 50.6014 45.4291 50.8912 44.3638L49.6852 44.1464C49.4551 44.7643 48.9011 45.0797 48.1767 45.0797C47.0858 45.0797 46.3528 44.3723 46.3187 43.1109H50.9721V42.6592C50.9721 40.2942 49.5574 39.3694 48.0744 39.3694C46.2505 39.3694 45.0488 40.7586 45.0488 42.77C45.0488 44.8027 46.2335 46.1322 48.1639 46.1322ZM46.323 42.1564C46.3741 41.2274 47.0474 40.422 48.0829 40.422C49.0716 40.422 49.7193 41.155 49.7235 42.1564H46.323Z",
|
|
2581
|
+
fill: "white",
|
|
2582
|
+
fillOpacity: "0.35"
|
|
2583
|
+
}), /* @__PURE__ */ React.createElement("g", { clipPath: "url(#clip0_2183_35008)" }, /* @__PURE__ */ React.createElement("path", {
|
|
2584
|
+
d: "M47 9.00012H7V10.0001H47V9.00012Z",
|
|
2585
|
+
fill: "white",
|
|
2586
|
+
fillOpacity: "0.35"
|
|
2587
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2588
|
+
d: "M43 0.00012207H42V7.00012H43V0.00012207Z",
|
|
2589
|
+
fill: "white",
|
|
2590
|
+
fillOpacity: "0.35"
|
|
2591
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2592
|
+
d: "M43 12.0001H42V19.0001H43V12.0001Z",
|
|
2593
|
+
fill: "white",
|
|
2594
|
+
fillOpacity: "0.35"
|
|
2595
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2596
|
+
d: "M41 12.0001H39V19.0001H41V12.0001Z",
|
|
2597
|
+
fill: "white",
|
|
2598
|
+
fillOpacity: "0.35"
|
|
2599
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2600
|
+
d: "M41 0.00012207H39V7.00012H41V0.00012207Z",
|
|
2601
|
+
fill: "white",
|
|
2602
|
+
fillOpacity: "0.35"
|
|
2603
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2604
|
+
d: "M38 0.00012207H35V7.00012H38V0.00012207Z",
|
|
2605
|
+
fill: "white",
|
|
2606
|
+
fillOpacity: "0.35"
|
|
2607
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2608
|
+
d: "M38 12.0001H35V19.0001H38V12.0001Z",
|
|
2609
|
+
fill: "white",
|
|
2610
|
+
fillOpacity: "0.35"
|
|
2611
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2612
|
+
d: "M33 12.0001H31V19.0001H33V12.0001Z",
|
|
2613
|
+
fill: "white",
|
|
2614
|
+
fillOpacity: "0.35"
|
|
2615
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2616
|
+
d: "M33 0.00012207H31V7.00012H33V0.00012207Z",
|
|
2617
|
+
fill: "white",
|
|
2618
|
+
fillOpacity: "0.35"
|
|
2619
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2620
|
+
d: "M30 0.00012207H28V7.00012H30V0.00012207Z",
|
|
2621
|
+
fill: "white",
|
|
2622
|
+
fillOpacity: "0.35"
|
|
2623
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2624
|
+
d: "M30 12.0001H28V19.0001H30V12.0001Z",
|
|
2625
|
+
fill: "white",
|
|
2626
|
+
fillOpacity: "0.35"
|
|
2627
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2628
|
+
d: "M27 0.00012207H26V7.00012H27V0.00012207Z",
|
|
2629
|
+
fill: "white",
|
|
2630
|
+
fillOpacity: "0.35"
|
|
2631
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2632
|
+
d: "M27 12.0001H26V19.0001H27V12.0001Z",
|
|
2633
|
+
fill: "white",
|
|
2634
|
+
fillOpacity: "0.35"
|
|
2635
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2636
|
+
d: "M25 0.00012207H24V7.00012H25V0.00012207Z",
|
|
2637
|
+
fill: "white",
|
|
2638
|
+
fillOpacity: "0.35"
|
|
2639
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2640
|
+
d: "M25 12.0001H24V19.0001H25V12.0001Z",
|
|
2641
|
+
fill: "white",
|
|
2642
|
+
fillOpacity: "0.35"
|
|
2643
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2644
|
+
d: "M23 0.00012207H20V7.00012H23V0.00012207Z",
|
|
2645
|
+
fill: "white",
|
|
2646
|
+
fillOpacity: "0.35"
|
|
2647
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2648
|
+
d: "M23 12.0001H20V19.0001H23V12.0001Z",
|
|
2649
|
+
fill: "white",
|
|
2650
|
+
fillOpacity: "0.35"
|
|
2651
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2652
|
+
d: "M18 0.00012207H16V7.00012H18V0.00012207Z",
|
|
2653
|
+
fill: "white",
|
|
2654
|
+
fillOpacity: "0.35"
|
|
2655
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2656
|
+
d: "M18 12.0001H16V19.0001H18V12.0001Z",
|
|
2657
|
+
fill: "white",
|
|
2658
|
+
fillOpacity: "0.35"
|
|
2659
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2660
|
+
d: "M15 12.0001H14V19.0001H15V12.0001Z",
|
|
2661
|
+
fill: "white",
|
|
2662
|
+
fillOpacity: "0.35"
|
|
2663
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2664
|
+
d: "M15 0.00012207H14V7.00012H15V0.00012207Z",
|
|
2665
|
+
fill: "white",
|
|
2666
|
+
fillOpacity: "0.35"
|
|
2667
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2668
|
+
d: "M13 0.00012207H10V7.00012H13V0.00012207Z",
|
|
2669
|
+
fill: "white",
|
|
2670
|
+
fillOpacity: "0.35"
|
|
2671
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2672
|
+
d: "M13 12.0001H10V19.0001H13V12.0001Z",
|
|
2673
|
+
fill: "white",
|
|
2674
|
+
fillOpacity: "0.35"
|
|
2675
|
+
})), /* @__PURE__ */ React.createElement("defs", null, /* @__PURE__ */ React.createElement("clipPath", { id: "clip0_2183_35008" }, /* @__PURE__ */ React.createElement("rect", {
|
|
2676
|
+
width: "40",
|
|
2677
|
+
height: "20",
|
|
2678
|
+
fill: "white",
|
|
2679
|
+
transform: "translate(7 0.00012207)"
|
|
2680
|
+
}))));
|
|
2681
|
+
};
|
|
2682
|
+
const RFIDCardSVG = () => {
|
|
2683
|
+
return /* @__PURE__ */ React.createElement("svg", {
|
|
2684
|
+
width: "58",
|
|
2685
|
+
height: "49",
|
|
2686
|
+
viewBox: "0 0 58 49",
|
|
2687
|
+
fill: "none",
|
|
2688
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
2689
|
+
}, /* @__PURE__ */ React.createElement("path", {
|
|
2690
|
+
d: "M1.27131 46.0001H2.58807V42.6976H4.37784C4.40767 42.6976 4.43324 42.6976 4.46307 42.6976L6.2358 46.0001H7.7358L5.80114 42.4675C6.87074 42.0711 7.40341 41.1805 7.40341 40.0086C7.40341 38.4021 6.40625 37.2728 4.3821 37.2728H1.27131V46.0001ZM2.58807 41.564V38.4021H4.24148C5.54119 38.4021 6.07812 39.02 6.07812 40.0086C6.07812 40.993 5.54119 41.564 4.25852 41.564H2.58807ZM10.3224 37.2728H9.00568V46.0001H10.3224V37.2728ZM12.2401 46.0001H13.5568V42.1947H17.2642V41.0655H13.5568V38.4064H17.652V37.2728H12.2401V46.0001ZM22.0966 46.0001C24.7557 46.0001 26.294 44.351 26.294 41.6237C26.294 38.9092 24.7557 37.2728 22.1861 37.2728H19.2713V46.0001H22.0966ZM20.5881 44.8496V38.4234H22.1051C24.0142 38.4234 24.9986 39.5655 24.9986 41.6237C24.9986 43.6905 24.0142 44.8496 22.0241 44.8496H20.5881ZM38.3558 40.1109C38.0575 38.2444 36.5959 37.1535 34.7507 37.1535C32.4922 37.1535 30.826 38.8453 30.826 41.6365C30.826 44.4277 32.4837 46.1194 34.7507 46.1194C36.6683 46.1194 38.0703 44.9177 38.3558 43.1919L37.0263 43.1876C36.8004 44.3041 35.8629 44.9177 34.7592 44.9177C33.2635 44.9177 32.1342 43.7714 32.1342 41.6365C32.1342 39.5186 33.2592 38.3552 34.7635 38.3552C35.8757 38.3552 36.8089 38.9817 37.0263 40.1109H38.3558ZM41.734 46.145C42.8164 46.145 43.4258 45.5953 43.6687 45.1052H43.7198V46.0001H44.9641V41.6535C44.9641 39.7487 43.4641 39.3694 42.4244 39.3694C41.2397 39.3694 40.1488 39.8467 39.7227 41.0399L40.9201 41.3126C41.1076 40.8481 41.5849 40.4007 42.4414 40.4007C43.2638 40.4007 43.6857 40.8311 43.6857 41.5726V41.6024C43.6857 42.0669 43.2085 42.0584 42.0323 42.1947C40.7923 42.3396 39.5224 42.6635 39.5224 44.1507C39.5224 45.4376 40.4897 46.145 41.734 46.145ZM42.011 45.1223C41.2908 45.1223 40.771 44.7984 40.771 44.1677C40.771 43.4859 41.3761 43.243 42.1133 43.145C42.5266 43.0896 43.5067 42.9788 43.69 42.7956V43.6393C43.69 44.4149 43.0721 45.1223 42.011 45.1223ZM46.6612 46.0001H47.9354V42.003C47.9354 41.1464 48.5959 40.5285 49.4993 40.5285C49.7635 40.5285 50.0618 40.5754 50.1641 40.6052V39.3865C50.0362 39.3694 49.7848 39.3567 49.6229 39.3567C48.8558 39.3567 48.1996 39.7913 47.9609 40.4944H47.8928V39.4547H46.6612V46.0001ZM53.4826 46.128C54.6758 46.128 55.1445 45.3993 55.3746 44.9817H55.4812V46.0001H56.7255V37.2728H55.4513V40.5157H55.3746C55.1445 40.1109 54.7099 39.3694 53.4911 39.3694C51.9102 39.3694 50.7468 40.618 50.7468 42.7402C50.7468 44.8581 51.8931 46.128 53.4826 46.128ZM53.7638 45.0413C52.6261 45.0413 52.0337 44.0399 52.0337 42.7274C52.0337 41.4277 52.6133 40.4518 53.7638 40.4518C54.8761 40.4518 55.4727 41.3595 55.4727 42.7274C55.4727 44.1038 54.8633 45.0413 53.7638 45.0413Z",
|
|
2691
|
+
fill: "white",
|
|
2692
|
+
fillOpacity: "0.35"
|
|
2693
|
+
}), /* @__PURE__ */ React.createElement("g", { clipPath: "url(#clip0_2183_35036)" }, /* @__PURE__ */ React.createElement("path", {
|
|
2694
|
+
d: "M19.5998 19.9927H38.3927C40.7673 19.9927 41.9924 18.8037 41.9924 16.5215V3.47133C41.9924 1.1892 40.7673 0.00012207 38.3927 0.00012207H19.5998C17.2251 0.00012207 16 1.17443 16 3.47133V16.5215C16 18.8037 17.2251 19.9927 19.5998 19.9927ZM19.7283 17.8953C19.5129 17.9222 19.294 17.9003 19.0886 17.8313C18.8832 17.7623 18.6969 17.648 18.544 17.4973C18.3911 17.3466 18.2759 17.1635 18.2072 16.9623C18.1385 16.761 18.1181 16.547 18.1478 16.3369V3.64857C18.1197 3.43872 18.1411 3.22539 18.2104 3.02486C18.2796 2.82432 18.3949 2.6419 18.5474 2.49154C18.6999 2.34118 18.8856 2.22684 19.0903 2.15729C19.295 2.08774 19.5132 2.06481 19.7283 2.09024H38.2641C38.4792 2.06481 38.6975 2.08774 38.9022 2.15729C39.1068 2.22684 39.2925 2.34118 39.445 2.49154C39.5975 2.6419 39.7128 2.82432 39.7821 3.02486C39.8513 3.22539 39.8728 3.43872 39.8447 3.64857V16.3369C39.8728 16.5468 39.8513 16.7601 39.7821 16.9606C39.7128 17.1612 39.5975 17.3436 39.445 17.494C39.2925 17.6443 39.1068 17.7586 38.9022 17.8282C38.6975 17.8977 38.4792 17.9207 38.2641 17.8953H19.7283ZM24.5759 9.93366C24.9027 9.92527 25.2245 9.85291 25.5221 9.72085C25.8197 9.58879 26.0872 9.39974 26.3086 9.16488C26.5301 8.93003 26.701 8.65415 26.8112 8.3536C26.9215 8.05305 26.9689 7.73395 26.9505 7.41519C26.9123 6.96482 26.7407 6.53505 26.4565 6.1784C26.1723 5.82175 25.7879 5.55367 25.3502 5.40689C24.9125 5.26012 24.4405 5.24101 23.9919 5.3519C23.5433 5.46279 23.1375 5.69889 22.8241 6.03133C22.5106 6.36378 22.3031 6.77819 22.2269 7.22393C22.1506 7.66967 22.2089 8.12746 22.3947 8.54135C22.5805 8.95524 22.8858 9.3073 23.2731 9.55456C23.6605 9.80182 24.1132 9.93355 24.5759 9.93366ZM31.6091 6.54371H37.3112C37.4038 6.54577 37.4958 6.52936 37.5817 6.49548C37.6676 6.46159 37.7455 6.41095 37.8106 6.34665C37.8757 6.28235 37.9268 6.20575 37.9605 6.12153C37.9943 6.03731 38.0101 5.94725 38.007 5.85686C38.008 5.76802 37.9907 5.67989 37.9559 5.5978C37.9211 5.51571 37.8697 5.44134 37.8047 5.37922C37.7396 5.31709 37.6624 5.2685 37.5776 5.23634C37.4927 5.20419 37.4021 5.18914 37.3112 5.19214H31.6469C31.556 5.18914 31.4654 5.20419 31.3806 5.23634C31.2958 5.2685 31.2185 5.31709 31.1535 5.37922C31.0885 5.44134 31.037 5.51571 31.0022 5.5978C30.9674 5.67989 30.9501 5.76802 30.9511 5.85686C30.948 5.94725 30.9638 6.03731 30.9976 6.12153C31.0313 6.20575 31.0824 6.28235 31.1475 6.34665C31.2126 6.41095 31.2905 6.46159 31.3764 6.49548C31.4623 6.52936 31.5543 6.54577 31.6469 6.54371H31.6091ZM31.6091 10.6796H37.3112C37.4957 10.6796 37.6727 10.608 37.8032 10.4806C37.9337 10.3532 38.007 10.1803 38.007 10.0001C38.007 9.81992 37.9337 9.64709 37.8032 9.51967C37.6727 9.39224 37.4957 9.32065 37.3112 9.32065H31.6469C31.4624 9.32065 31.2854 9.39224 31.1549 9.51967C31.0245 9.64709 30.9511 9.81992 30.9511 10.0001C30.9511 10.1803 31.0245 10.3532 31.1549 10.4806C31.2854 10.608 31.4624 10.6796 31.6469 10.6796H31.6091ZM20.4392 14.8081H28.7126C28.796 14.8129 28.8794 14.7998 28.9571 14.7699C29.0347 14.74 29.1048 14.6939 29.1624 14.6349C29.22 14.5758 29.2637 14.5052 29.2905 14.428C29.3173 14.3508 29.3265 14.2688 29.3176 14.1877C29.3176 13.1907 27.8051 10.6501 24.5759 10.6501C21.3467 10.6501 19.8494 13.1907 19.8494 14.1877C19.8394 14.2678 19.8473 14.3489 19.8728 14.4256C19.8983 14.5023 19.9406 14.5726 19.9967 14.6317C20.0529 14.6908 20.1216 14.7372 20.198 14.7677C20.2745 14.7981 20.3567 14.8119 20.4392 14.8081ZM31.6091 14.8081H37.3112C37.4021 14.8111 37.4927 14.7961 37.5776 14.7639C37.6624 14.7318 37.7396 14.6832 37.8047 14.621C37.8697 14.5589 37.9211 14.4846 37.9559 14.4025C37.9907 14.3204 38.008 14.2322 38.007 14.1434C38.009 14.0529 37.9925 13.963 37.9584 13.8789C37.9243 13.7947 37.8734 13.718 37.8086 13.6534C37.7438 13.5887 37.6664 13.5373 37.581 13.5023C37.4956 13.4672 37.4039 13.4492 37.3112 13.4492H31.6469C31.5542 13.4492 31.4625 13.4672 31.3771 13.5023C31.2917 13.5373 31.2143 13.5887 31.1495 13.6534C31.0847 13.718 31.0338 13.7947 30.9997 13.8789C30.9656 13.963 30.9491 14.0529 30.9511 14.1434C30.9501 14.2322 30.9674 14.3204 31.0022 14.4025C31.037 14.4846 31.0885 14.5589 31.1535 14.621C31.2185 14.6832 31.2958 14.7318 31.3806 14.7639C31.4654 14.7961 31.556 14.8111 31.6469 14.8081H31.6091Z",
|
|
2695
|
+
fill: "white",
|
|
2696
|
+
fillOpacity: "0.35"
|
|
2697
|
+
})), /* @__PURE__ */ React.createElement("defs", null, /* @__PURE__ */ React.createElement("clipPath", { id: "clip0_2183_35036" }, /* @__PURE__ */ React.createElement("rect", {
|
|
2698
|
+
width: "26",
|
|
2699
|
+
height: "20",
|
|
2700
|
+
fill: "white",
|
|
2701
|
+
transform: "translate(16 0.00012207)"
|
|
2702
|
+
}))));
|
|
2703
|
+
};
|
|
2704
|
+
const AcLogoSVG = () => {
|
|
2705
|
+
return /* @__PURE__ */ React.createElement("svg", {
|
|
2706
|
+
width: "98",
|
|
2707
|
+
height: "50",
|
|
2708
|
+
viewBox: "0 0 98 50",
|
|
2709
|
+
fill: "none",
|
|
2710
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
2711
|
+
}, /* @__PURE__ */ React.createElement("g", { opacity: "0.25" }, /* @__PURE__ */ React.createElement("path", {
|
|
2712
|
+
d: "M66.8428 0.85791C66.2106 2.00303 65.7681 3.21177 65.3888 4.48413C64.883 4.54775 64.4405 4.61136 63.998 4.67498C63.5555 4.80222 63.0497 4.92945 62.6072 5.05669C61.8486 4.0388 61.0267 3.08453 60.0784 2.19388C59.4463 2.51197 58.8141 2.83006 58.1819 3.27539C58.3716 4.54774 58.6876 5.8201 59.1302 7.09246C58.7509 7.41055 58.4348 7.72864 58.1187 8.11034C57.8026 8.49205 57.4865 8.81014 57.2336 9.25547C56.0325 8.87376 54.7681 8.55567 53.5038 8.42843C53.1245 9.06461 52.8716 9.76441 52.6187 10.4006C53.5038 11.3549 54.5153 12.1819 55.59 12.8817C55.3371 13.8359 55.2107 14.7902 55.2739 15.7445C54.0727 16.1262 52.8716 16.6351 51.7969 17.2713C51.8601 17.9711 51.9865 18.7345 52.2394 19.4343C53.5038 19.6888 54.8313 19.7524 56.0957 19.6888C56.2854 20.1341 56.475 20.5794 56.7279 20.9611C56.9808 21.4065 57.2336 21.7882 57.4865 22.1699C56.7279 23.1878 56.0957 24.3329 55.5267 25.478C56.0325 25.987 56.5382 26.4959 57.1072 26.9412C58.2451 26.3687 59.383 25.6689 60.3945 24.8418C60.7738 25.0963 61.2164 25.3508 61.6589 25.5416C62.1014 25.7325 62.544 25.9233 62.9865 26.0506C62.9865 27.3229 63.1129 28.5953 63.3658 29.8676C64.0612 29.9949 64.8198 30.1221 65.5152 30.1221C66.1474 28.977 66.5899 27.7683 66.9692 26.4959C67.475 26.4323 67.9175 26.3687 68.36 26.305C68.8026 26.1778 69.3083 26.0506 69.7508 25.9233C70.5094 26.9412 71.3313 27.8955 72.2796 28.7861C72.9117 28.4681 73.5439 28.15 74.1761 27.7046C73.9864 26.4323 73.6704 25.1599 73.2278 23.8876C73.6071 23.5695 73.9232 23.2514 74.2393 22.8697C74.5554 22.488 74.8715 22.1699 75.1244 21.7246C76.3255 22.1063 77.5899 22.4244 78.8543 22.5516C79.2336 21.9154 79.4864 21.2156 79.7393 20.5794C78.8542 19.6252 77.8428 18.7981 76.7681 18.0983C77.0209 17.1441 77.1474 16.1898 77.0841 15.2355C78.2853 14.8538 79.4864 14.3449 80.5611 13.7087C80.4979 13.0089 80.3715 12.2455 80.1186 11.5457C78.8543 11.2912 77.5267 11.2276 76.2623 11.2912C76.0727 10.8459 75.883 10.4006 75.6301 10.0189C75.3773 9.57355 75.1244 9.19185 74.8715 8.81014C75.6301 7.79225 76.2623 6.64713 76.8313 5.50201C76.3255 4.99307 75.8198 4.48413 75.2508 4.0388C74.1129 4.61136 72.975 5.31116 71.9635 6.13819C71.5842 5.88372 71.1416 5.62925 70.6991 5.4384C70.2566 5.24754 69.8141 5.05669 69.3715 4.92945C69.3715 3.6571 69.2451 2.38474 68.9922 1.11238C68.2336 0.985147 67.5382 0.85791 66.8428 0.85791ZM68.929 9.25547C72.3428 10.8459 73.7968 14.8538 72.2796 18.2256C71.3945 20.1977 69.6244 21.5973 67.5382 22.0427C66.1474 22.2971 64.6934 22.1699 63.429 21.5973C60.0152 20.0069 58.5612 15.999 60.0784 12.6272C60.9635 10.6551 62.7336 9.25546 64.8198 8.81014C66.2106 8.49205 67.6646 8.6829 68.929 9.25547Z",
|
|
2713
|
+
fill: "white"
|
|
2714
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2715
|
+
d: "M6.03298 22.8689L5.02149 29.2307H0.722656L5.4008 1.55695H11.0904L15.7054 29.2307H11.3433L10.395 22.8689H6.03298ZM8.1824 7.85511L6.66517 18.7974H9.76286L8.1824 7.85511Z",
|
|
2716
|
+
fill: "white"
|
|
2717
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2718
|
+
d: "M23.861 1.49487L29.361 20.0713V1.49487H33.5334V29.1686H29.1081L23.4185 11.4193V29.1686H19.2461V1.49487H23.861Z",
|
|
2719
|
+
fill: "white"
|
|
2720
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2721
|
+
d: "M50.2261 22.5524C50.2261 24.3337 49.5307 25.9878 48.3295 27.1965C47.1284 28.4688 45.4847 29.1686 43.7146 29.1686H37.2031V1.49487H43.7146C45.4847 1.49487 47.1284 2.19467 48.3295 3.46703C49.5939 4.67577 50.2261 6.39345 50.2261 8.11113V22.5524ZM41.3123 25.0971H43.7778C44.41 25.0971 45.0422 24.8426 45.4215 24.3973C45.864 23.952 46.1169 23.3158 46.1169 22.6796V8.17475C46.1169 7.53857 45.864 6.90239 45.4215 6.45707C44.979 6.01174 44.41 5.75727 43.7778 5.75727H41.3123V25.0971Z",
|
|
2722
|
+
fill: "white"
|
|
2723
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2724
|
+
d: "M4.83183 49.0815C2.55598 49.0815 0.722656 47.2366 0.722656 45.01C0.722656 45.01 0.722656 45.01 0.722656 44.9464V35.5309C0.722656 33.2407 2.49276 31.3958 4.76862 31.3322C7.04447 31.2685 8.8778 33.1135 8.94101 35.4037C8.94101 35.4673 8.94101 35.4673 8.94101 35.5309V37.5031H6.28585V35.4673C6.28585 34.6403 5.59045 33.9405 4.76862 33.9405C4.38931 33.9405 4.01 34.0677 3.69391 34.3858C3.44104 34.6403 3.25138 35.022 3.25138 35.4673V44.9464C3.25138 45.7734 3.88356 46.4096 4.7054 46.4096C5.08471 46.4096 5.46402 46.2824 5.78011 45.9643C6.0962 45.7098 6.22263 45.3281 6.22263 44.8828V42.5289H8.94101V44.9464C8.94101 47.2366 7.10769 49.0815 4.83183 49.0815Z",
|
|
2725
|
+
fill: "white"
|
|
2726
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2727
|
+
d: "M30.1227 48.8867H23.1055V31.6463H25.6974V46.342H30.1859L30.1227 48.8867Z",
|
|
2728
|
+
fill: "white"
|
|
2729
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2730
|
+
d: "M48.0115 31.4559C50.2874 31.4559 52.1207 33.3009 52.1207 35.5911V45.0065C52.1207 47.2968 50.2874 49.1417 48.0115 49.1417C46.9368 49.1417 45.8621 48.6964 45.1035 47.933C44.3449 47.1696 43.9023 46.088 43.9023 45.0065V35.5911C43.9023 33.3009 45.7357 31.4559 48.0115 31.4559ZM49.4023 35.5275C49.4023 34.7004 48.7701 34.0643 47.9483 34.0643C47.569 34.0643 47.1897 34.1915 46.8736 34.5096C46.5575 34.7641 46.4311 35.1458 46.4311 35.5911V45.0065C46.4311 45.3883 46.5575 45.77 46.8736 46.0244C47.1265 46.2789 47.5058 46.4698 47.9483 46.4698C48.7701 46.4698 49.4023 45.8336 49.4023 45.0065V35.5275Z",
|
|
2731
|
+
fill: "white"
|
|
2732
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2733
|
+
d: "M70.4451 49.0776C68.2325 49.0776 66.3992 47.2963 66.3359 45.0061V31.6463H68.8647V45.0061C68.8647 45.3878 68.9911 45.7695 69.3072 46.0876C69.5601 46.342 69.9394 46.5329 70.3819 46.5329C71.2037 46.5329 71.8359 45.8967 71.8359 45.0697V31.7099H74.5543V45.0697C74.5543 46.1512 74.1118 47.2327 73.3531 47.9961C72.5945 48.6959 71.583 49.1412 70.4451 49.0776Z",
|
|
2734
|
+
fill: "white"
|
|
2735
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2736
|
+
d: "M97.0021 44.7516C97.0021 45.8331 96.5595 46.9146 95.8009 47.678C95.0423 48.4414 94.0308 48.8867 92.9561 48.8867H88.9102V31.6463H92.9561C94.0308 31.6463 95.1055 32.0916 95.8009 32.855C96.5595 33.6185 97.0021 34.7 97.0021 35.7815V44.7516ZM91.5021 46.342H93.0826C93.4619 46.342 93.8412 46.2148 94.094 45.8967C94.3469 45.6422 94.5366 45.2605 94.5366 44.8152V35.7815C94.5366 35.3998 94.4101 35.018 94.094 34.7C93.8412 34.4455 93.4619 34.2546 93.0826 34.2546H91.5021V46.342Z",
|
|
2737
|
+
fill: "white"
|
|
2738
|
+
}), /* @__PURE__ */ React.createElement("path", {
|
|
2739
|
+
d: "M87.2555 1.49487L92.7555 20.0713V1.49487H96.9279V29.1686H92.5027L86.813 11.4193V29.1686H82.6406V1.49487H87.2555Z",
|
|
2740
|
+
fill: "white"
|
|
2741
|
+
})));
|
|
2742
|
+
};
|
|
2743
|
+
//#endregion
|
|
2744
|
+
//#region src/components/loginModal.tsx
|
|
2745
|
+
const LoginModal$1 = ({ open, subtitle, scope, redirectPath = "/", onSuccess, onFailure, onCancel, storeSession = false, "data-testid": dataTestID }) => {
|
|
2746
|
+
const { t } = useTranslation();
|
|
2747
|
+
const getTitle = () => {
|
|
2748
|
+
return subtitle !== void 0 ? subtitle : t("loginFormText");
|
|
2749
|
+
};
|
|
2750
|
+
return /* @__PURE__ */ React.createElement(Dialog$1, {
|
|
2751
|
+
open,
|
|
2752
|
+
onClose: onCancel,
|
|
2753
|
+
disableEscapeKeyDown: true,
|
|
2754
|
+
sx: { ".MuiPaper-root": { borderRadius: "20px" } },
|
|
2755
|
+
"data-testid": dataTestID || "sdk.login-modal"
|
|
2756
|
+
}, /* @__PURE__ */ React.createElement(DialogContent$1, null, /* @__PURE__ */ React.createElement(loginForm_default, {
|
|
2757
|
+
title: getTitle(),
|
|
2758
|
+
scope,
|
|
2759
|
+
redirectPath,
|
|
2760
|
+
onSuccess,
|
|
2761
|
+
onFailure,
|
|
2762
|
+
onCancel,
|
|
2763
|
+
storeSession,
|
|
2764
|
+
"data-testid": dataTestID || "sdk.login-form"
|
|
2765
|
+
})));
|
|
2766
|
+
};
|
|
2767
|
+
var loginModal_default = observer(LoginModal$1);
|
|
2768
|
+
//#endregion
|
|
2769
|
+
//#region src/hooks/useLogin.js
|
|
2770
|
+
const LoginModal = ({ isOpen, title, subtitle, scope, redirectPath, onSuccess, onFailure, onCancel, storeSession = true }) => {
|
|
2771
|
+
const [open, setOpen] = useState(isOpen);
|
|
2772
|
+
useEffect(() => {
|
|
2773
|
+
setOpen(isOpen);
|
|
2774
|
+
}, [isOpen]);
|
|
2775
|
+
const handleSuccess = (session) => {
|
|
2776
|
+
if (onSuccess && typeof onSuccess === "function") onSuccess(session);
|
|
2777
|
+
setOpen(false);
|
|
2778
|
+
};
|
|
2779
|
+
const handleCancel = () => {
|
|
2780
|
+
if (onCancel && typeof onCancel === "function") onCancel();
|
|
2781
|
+
setOpen(false);
|
|
2782
|
+
};
|
|
2783
|
+
return /* @__PURE__ */ React.createElement(loginModal_default, {
|
|
2784
|
+
open,
|
|
2785
|
+
title,
|
|
2786
|
+
subtitle,
|
|
2787
|
+
scope,
|
|
2788
|
+
redirectPath,
|
|
2789
|
+
onSuccess: handleSuccess,
|
|
2790
|
+
onFailure,
|
|
2791
|
+
onCancel: handleCancel,
|
|
2792
|
+
storeSession
|
|
2793
|
+
});
|
|
2794
|
+
};
|
|
2795
|
+
const OAUTH_STATE_KEY = "oauth2_state";
|
|
2796
|
+
const generateOAuthState = () => {
|
|
2797
|
+
const bytes = crypto.getRandomValues(new Uint8Array(16));
|
|
2798
|
+
return Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
|
|
2799
|
+
};
|
|
2800
|
+
const useLogin = (scope, loginProps = {}) => {
|
|
2801
|
+
const { loginUrl, clientId, grantType, redirectUri, redirectPath: defaultRedirectPath } = useAuthConfig();
|
|
2802
|
+
const [showModal] = useModal(LoginModal, {
|
|
2803
|
+
scope,
|
|
2804
|
+
...loginProps
|
|
2805
|
+
});
|
|
2806
|
+
const { redirectPath } = loginProps;
|
|
2807
|
+
const redirectUrl = encodeURIComponent(`${redirectUri}?next=${redirectPath || defaultRedirectPath}`);
|
|
2808
|
+
const buildLoginUrl = () => {
|
|
2809
|
+
const state = generateOAuthState();
|
|
2810
|
+
sessionStorage.setItem(OAUTH_STATE_KEY, state);
|
|
2811
|
+
return `${loginUrl}?response_type=code&client_id=${clientId}&redirect_uri=${redirectUrl}&scope=${scope}&state=${state}`;
|
|
2812
|
+
};
|
|
2813
|
+
if (grantType === "password") return () => {
|
|
2814
|
+
showModal({ key: (/* @__PURE__ */ new Date()).getTime() });
|
|
2815
|
+
};
|
|
2816
|
+
return () => {
|
|
2817
|
+
window.location.assign(buildLoginUrl());
|
|
2818
|
+
};
|
|
2819
|
+
};
|
|
2820
|
+
//#endregion
|
|
2821
|
+
//#region src/components/externalContent.js
|
|
2822
|
+
const ExternalContent = ({ src }) => {
|
|
2823
|
+
const { setIframeMounted } = useDisplay();
|
|
2824
|
+
useEffect(() => {
|
|
2825
|
+
setIframeMounted(true);
|
|
2826
|
+
return () => setIframeMounted(false);
|
|
2827
|
+
}, [setIframeMounted]);
|
|
2828
|
+
return /* @__PURE__ */ React.createElement(Iframe, {
|
|
2829
|
+
id: "external-content-iframe",
|
|
2830
|
+
src,
|
|
2831
|
+
width: "100%",
|
|
2832
|
+
frameBorder: "0",
|
|
2833
|
+
styles: {
|
|
2834
|
+
display: "block",
|
|
2835
|
+
height: "calc(100vh - 92px)"
|
|
2836
|
+
}
|
|
2837
|
+
});
|
|
2838
|
+
};
|
|
2839
|
+
//#endregion
|
|
2840
|
+
//#region src/assets/logo.svg
|
|
2841
|
+
var logo_default = "data:image/svg+xml,<svg width=\"99\" height=\"64\" viewBox=\"0 0 99 64\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">%0A<g id=\"Type=new\">%0A<g id=\"Vector\" filter=\"url(%23filter0_d_879_24616)\">%0A<path d=\"M94.2395 32.6164C94.2395 27.7041 91.1136 23.6555 84.1731 23.6555C84.178 23.5416 84.1924 23.4298 84.1924 23.3152C84.1924 18.2883 79.5582 14.2138 73.8398 14.2138C73.0728 14.2153 72.3078 14.2923 71.5559 14.4437C69.2221 8.02729 62.386 3.38086 54.315 3.38086C47.1037 3.38086 40.8788 7.08745 37.9681 12.4529C35.4863 11.0743 32.6916 10.357 29.8526 10.3699C21.5111 10.3699 14.7492 16.3146 14.7492 23.6489C14.7503 24.4457 14.8322 25.2405 14.9938 26.0208C6.9758 26.0208 4.01758 32.1077 4.01758 37.977C4.01758 44.732 10.2453 50.2075 17.9279 50.2075C19.9349 50.2124 21.9236 49.8266 23.7832 49.0716C25.8948 53.1245 30.5462 55.9426 35.9497 55.9426C39.0449 55.9656 42.0659 54.9948 44.5683 53.173C45.3887 54.0785 46.3926 54.7988 47.5131 55.286C48.6336 55.7733 49.845 56.0163 51.0668 55.9988C54.7412 55.9988 57.8518 53.8718 58.8929 50.9415C61.793 53.3626 65.4601 54.6724 69.2378 54.6362C77.4364 54.6362 84.0827 48.7925 84.0827 41.583C89.6955 41.5624 94.2395 37.5574 94.2395 32.6164Z\" fill=\"%23E0E0E0\"/>%0A</g>%0A<g id=\"Vector_2\" filter=\"url(%23filter1_d_879_24616)\">%0A<path d=\"M94.2395 29.2351C94.2395 24.3228 89.744 20.3374 84.1731 20.2742C84.178 20.1603 84.1924 20.0485 84.1924 19.9339C84.1924 14.907 79.5582 10.8325 73.8398 10.8325C73.0728 10.8339 72.3078 10.9109 71.5559 11.0623C69.2221 4.64594 62.386 -0.000488281 54.315 -0.000488281C47.1037 -0.000488281 40.8788 3.70611 37.9681 9.07157C35.4863 7.69294 32.6916 6.97565 29.8526 6.98856C21.5111 6.98856 14.7492 12.9333 14.7492 20.2675C14.7503 21.0644 14.8322 21.8591 14.9938 22.6395C8.72096 23.8242 4.01758 28.7264 4.01758 34.5957C4.01758 41.3506 10.2453 46.8262 17.9279 46.8262C19.9349 46.8311 21.9236 46.4453 23.7832 45.6903C25.8948 49.7431 30.5462 52.5613 35.9497 52.5613C39.0447 52.5845 42.0655 51.6141 44.5679 49.7927C45.3883 50.6982 46.3922 51.4185 47.5127 51.9058C48.6332 52.393 49.8447 52.636 51.0664 52.6185C54.7409 52.6185 57.8514 50.4915 58.8926 47.5613C61.7926 49.9823 65.4598 51.2921 69.2374 51.256C77.436 51.256 84.0823 45.4122 84.0823 38.2027C89.6955 38.181 94.2395 34.1764 94.2395 29.2351Z\" fill=\"%23E0E0E0\"/>%0A<path d=\"M83.6736 20.2527L83.6515 20.7683L84.1675 20.7741C89.5267 20.835 93.7395 24.655 93.7395 29.2351C93.7395 33.8425 89.4806 37.6819 84.0804 37.7027L83.5823 37.7046V38.2027C83.5823 45.0776 77.2222 50.756 69.2374 50.756L69.2326 50.756C65.5737 50.791 62.0219 49.5224 59.213 47.1774L58.6618 46.7173L58.4214 47.3938C57.46 50.0996 54.5572 52.1185 51.0664 52.1185L51.0593 52.1186C49.9085 52.135 48.7675 51.9062 47.7121 51.4472C46.6567 50.9883 45.7112 50.3098 44.9384 49.457L44.6368 49.1242L44.2737 49.3885C41.8577 51.1468 38.9414 52.0837 35.9534 52.0613H35.9497C30.7146 52.0613 26.2442 49.3315 24.2266 45.4593L24.0165 45.056L23.5951 45.227C21.7956 45.9576 19.8712 46.3309 17.9291 46.3262H17.9279C10.4591 46.3262 4.51758 41.016 4.51758 34.5957C4.51758 29.0145 8.99969 24.2804 15.0866 23.1308L15.5865 23.0364L15.4834 22.5381C15.3287 21.7909 15.2502 21.0299 15.2492 20.2669C15.2496 13.2676 21.7251 7.48856 29.8526 7.48857L29.8549 7.48855C32.6082 7.47603 35.3184 8.17167 37.7253 9.50866L38.1668 9.75389L38.4076 9.30999C41.223 4.12026 47.2699 0.499512 54.315 0.499512C62.2032 0.499512 68.833 5.03897 71.0861 11.2333L71.2331 11.6374L71.6546 11.5525C72.3742 11.4076 73.1063 11.3339 73.8403 11.3325C79.3447 11.3327 83.6924 15.2418 83.6924 19.9339C83.6924 19.9717 83.69 20.0129 83.686 20.0672C83.6853 20.0765 83.6845 20.0865 83.6837 20.097C83.6802 20.1424 83.6759 20.1981 83.6736 20.2527Z\" stroke=\"black\" stroke-opacity=\"0.1\"/>%0A</g>%0A<path id=\"Vector_3\" d=\"M58.7196 16.4697C58.383 17.1018 58.1155 17.7683 57.922 18.4577C57.6587 18.4776 57.3969 18.5126 57.1376 18.5625C56.879 18.6164 56.6244 18.6874 56.3753 18.7753C55.9644 18.2058 55.4995 17.6774 54.9868 17.1975C54.6241 17.3647 54.2738 17.5577 53.9387 17.775C54.0405 18.4857 54.2181 19.1834 54.4683 19.8563C54.2644 20.0241 54.0735 20.2073 53.8975 20.4041C53.719 20.5988 53.5519 20.8036 53.3971 21.0176C52.729 20.8022 52.0429 20.6475 51.347 20.5554C51.1547 20.9071 50.9873 21.272 50.8463 21.6472C51.3434 22.1634 51.896 22.6232 52.494 23.0182C52.3591 23.5297 52.2993 24.0582 52.3162 24.5869C51.6475 24.8016 51.0008 25.0795 50.3848 25.4167C50.4297 25.8152 50.5061 26.2094 50.6133 26.5959C51.3181 26.7189 52.0341 26.7668 52.749 26.7388C52.8517 26.9818 52.9684 27.2187 53.0984 27.4483C53.226 27.6797 53.3711 27.9009 53.5324 28.1101C53.1182 28.6772 52.7586 29.2822 52.4583 29.9171C52.7287 30.2113 53.0217 30.484 53.3346 30.7325C53.9805 30.42 54.5898 30.037 55.1514 29.5904C55.3746 29.7317 55.607 29.8578 55.847 29.9681C56.0885 30.0754 56.3359 30.1687 56.588 30.2476C56.5887 30.9498 56.6544 31.6504 56.7844 32.3404C57.1761 32.4184 57.5732 32.466 57.9723 32.4826C58.3089 31.8507 58.5764 31.1843 58.7699 30.495C59.0332 30.4751 59.2951 30.4401 59.5543 30.3901C59.8129 30.3364 60.0676 30.2653 60.3166 30.1774C60.7276 30.7469 61.1927 31.2753 61.7054 31.7552C62.0681 31.5879 62.4184 31.3949 62.7536 31.1777C62.6518 30.4669 62.4743 29.769 62.2239 29.096C62.4279 28.9282 62.6187 28.7451 62.7948 28.5482C62.9733 28.3536 63.1404 28.1487 63.2951 27.9347C63.9632 28.1502 64.6494 28.3049 65.3453 28.3969C65.5377 28.0452 65.705 27.6804 65.846 27.3051C65.3489 26.7889 64.7963 26.3291 64.1983 25.9341C64.3331 25.4226 64.393 24.8942 64.3761 24.3654C65.0448 24.1507 65.6915 23.8729 66.3075 23.5356C66.2625 23.1372 66.1861 22.7429 66.079 22.3565C65.3741 22.2334 64.6582 22.1855 63.9432 22.2136C63.8406 21.9705 63.7239 21.7336 63.5939 21.504C63.4663 21.2727 63.3212 21.0514 63.1599 20.8422C63.574 20.2751 63.9336 19.67 64.2339 19.0352C63.9636 18.7409 63.6706 18.4683 63.3577 18.2198C62.7118 18.5324 62.1025 18.9154 61.5409 19.3619C61.3177 19.2206 61.0853 19.0945 60.8453 18.9842C60.6038 18.8775 60.3564 18.7848 60.1042 18.7065C60.1036 18.0044 60.0378 17.3039 59.9079 16.614C59.5161 16.5353 59.1188 16.4871 58.7196 16.4697ZM59.8869 21.0865C60.6011 21.4133 61.1938 21.9574 61.5803 22.6412C61.9667 23.325 62.1272 24.1134 62.0388 24.8939C61.9504 25.6743 61.6175 26.4069 61.0879 26.9869C60.5582 27.5669 59.8588 27.9646 59.0896 28.1234C58.3188 28.2768 57.5194 28.1862 56.8026 27.8641C56.0883 27.5373 55.4957 26.9931 55.1092 26.3094C54.7227 25.6256 54.5623 24.8371 54.6507 24.0567C54.7391 23.2762 55.0719 22.5437 55.6016 21.9637C56.1312 21.3837 56.8306 20.9859 57.5999 20.8272C58.3706 20.6738 59.17 20.7644 59.8869 21.0865Z\" fill=\"%23090B0E\"/>%0A<path id=\"Vector_4\" d=\"M25.1222 28.5555L24.5632 32.0493H22.1797L24.7546 16.8477H27.9134L30.4552 32.0493H28.0549L27.5134 28.5555H25.1211H25.1222ZM26.3227 20.3296L25.4723 26.3218H27.1723L26.3227 20.3296Z\" fill=\"%23090B0E\"/>%0A<path id=\"Vector_5\" d=\"M34.9652 16.8457L37.9992 27.0553V16.8457H40.2912V32.0473H37.8364L34.6826 22.3128V32.0473H32.3906V16.8457H34.9656H34.9652Z\" fill=\"%23090B0E\"/>%0A<path id=\"Vector_6\" d=\"M49.5405 28.4137C49.5477 28.891 49.4576 29.3648 49.2756 29.8061C49.0937 30.2475 48.8237 30.6471 48.4822 30.9806C48.1545 31.3235 47.7597 31.5951 47.3224 31.7786C46.8851 31.9621 46.4146 32.0536 45.9404 32.0473H42.3418V16.8457H45.9404C46.4162 16.8377 46.8884 16.9284 47.3274 17.1119C47.7663 17.2955 48.1625 17.568 48.4909 17.9124C48.8298 18.2458 49.0976 18.6444 49.2781 19.0843C49.4586 19.5241 49.5481 19.9959 49.5412 20.4712V28.4137H49.5405ZM44.6317 29.7805H46.0107C46.1837 29.7839 46.3555 29.7503 46.5145 29.6821C46.6736 29.6138 46.8162 29.5124 46.933 29.3847C47.0533 29.2619 47.1483 29.1167 47.2124 28.9572C47.2766 28.7977 47.3086 28.6272 47.3069 28.4553V20.5058C47.3093 20.3331 47.2767 20.1617 47.211 20.002C47.1453 19.8422 47.0479 19.6975 46.9246 19.5765C46.8072 19.4524 46.6654 19.3539 46.5082 19.2872C46.3509 19.2205 46.1815 19.1871 46.0107 19.189H44.6334V29.7819L44.6317 29.7805Z\" fill=\"%23090B0E\"/>%0A<path id=\"Vector_7\" d=\"M24.4641 42.98C24.1667 42.9816 23.8719 42.9243 23.5968 42.8113C23.3217 42.6984 23.0716 42.5321 22.8611 42.3221C22.6505 42.112 22.4837 41.8624 22.3701 41.5875C22.2565 41.3126 22.1985 41.018 22.1994 40.7206V35.5316C22.1957 35.2321 22.2514 34.935 22.3634 34.6572C22.4755 34.3795 22.6415 34.1268 22.8519 33.9138C23.0623 33.7007 23.313 33.5315 23.5893 33.4161C23.8656 33.3006 24.162 33.2412 24.4615 33.2412C24.7609 33.2412 25.0574 33.3006 25.3337 33.4161C25.61 33.5315 25.8606 33.7007 26.071 33.9138C26.2815 34.1268 26.4475 34.3795 26.5595 34.6572C26.6715 34.935 26.7273 35.2321 26.7236 35.5316V36.6122H25.2443V35.5057C25.2444 35.3972 25.2231 35.2897 25.1817 35.1895C25.1402 35.0892 25.0794 34.9981 25.0027 34.9214C24.9259 34.8447 24.8348 34.7838 24.7346 34.7424C24.6343 34.7009 24.5268 34.6796 24.4183 34.6798C24.3108 34.6782 24.2041 34.6988 24.1049 34.7404C24.0057 34.7819 23.9161 34.8434 23.8418 34.9212C23.7645 34.9973 23.7034 35.0883 23.6623 35.1887C23.6212 35.2891 23.601 35.3969 23.6029 35.5053V40.7049C23.6022 40.8124 23.6228 40.919 23.6635 41.0185C23.7042 41.118 23.7642 41.2085 23.84 41.2848C23.9157 41.361 24.0058 41.4216 24.1051 41.4629C24.2044 41.5042 24.3108 41.5255 24.4183 41.5256C24.5269 41.5274 24.6347 41.5072 24.7351 41.4661C24.8356 41.4251 24.9267 41.364 25.0028 41.2866C25.0809 41.2115 25.1427 41.121 25.1843 41.0209C25.2258 40.9208 25.2462 40.8132 25.2443 40.7049V39.401H26.7242V40.7202C26.7247 41.0172 26.6666 41.3113 26.5532 41.5857C26.4398 41.8601 26.2733 42.1095 26.0634 42.3194C25.8534 42.5294 25.604 42.6958 25.3296 42.8091C25.0551 42.9225 24.761 42.9806 24.4641 42.98Z\" fill=\"%23090B0E\"/>%0A<path id=\"Vector_8\" d=\"M38.4366 42.8611H34.541V33.3862H35.97V41.443H38.4373V42.8611H38.4366Z\" fill=\"%23090B0E\"/>%0A<path id=\"Vector_9\" d=\"M48.3154 33.2725C48.6138 33.2717 48.9095 33.33 49.1853 33.4438C49.4612 33.5577 49.7118 33.725 49.9229 33.936C50.1339 34.147 50.3012 34.3977 50.415 34.6735C50.5289 34.9494 50.5871 35.245 50.5864 35.5435V40.7118C50.5872 41.0103 50.529 41.306 50.4151 41.5818C50.3013 41.8577 50.134 42.1084 49.923 42.3194C49.7119 42.5305 49.4613 42.6977 49.1854 42.8116C48.9095 42.9254 48.6139 42.9836 48.3154 42.9828C48.0178 42.9882 47.7223 42.932 47.4474 42.8177C47.1725 42.7035 46.9242 42.5337 46.718 42.319C46.5055 42.1099 46.3376 41.8598 46.2247 41.5839C46.1117 41.308 46.056 41.0121 46.0608 40.714V35.542C46.0598 34.9424 46.2965 34.3668 46.7192 33.9414C47.1418 33.516 47.7158 33.2754 48.3154 33.2725ZM49.0942 35.5155C49.0953 35.4081 49.0749 35.3017 49.0343 35.2023C48.9937 35.1029 48.9336 35.0126 48.8577 34.9367C48.7817 34.8608 48.6914 34.8009 48.592 34.7604C48.4926 34.7198 48.3861 34.6996 48.2787 34.7007C48.1712 34.6991 48.0645 34.7192 47.965 34.7598C47.8655 34.8004 47.7751 34.8606 47.6994 34.9369C47.6214 35.0114 47.5597 35.1013 47.5182 35.2009C47.4767 35.3005 47.4563 35.4076 47.4584 35.5155V40.7003C47.4568 40.8078 47.4773 40.9144 47.5188 41.0135C47.5603 41.1127 47.6218 41.2022 47.6994 41.2765C47.7747 41.3535 47.8649 41.4144 47.9645 41.4555C48.0641 41.4966 48.171 41.517 48.2787 41.5154C48.3859 41.516 48.4922 41.4953 48.5913 41.4545C48.6905 41.4138 48.7806 41.3537 48.8565 41.278C48.9323 41.2022 48.9923 41.1121 49.0331 41.0129C49.0739 40.9138 49.0947 40.8075 49.0942 40.7003V35.5155Z\" fill=\"%23090B0E\"/>%0A<path id=\"Vector_10\" d=\"M60.735 42.9803C60.439 42.9817 60.1456 42.9246 59.8718 42.8122C59.598 42.6998 59.3491 42.5343 59.1395 42.3252C58.9299 42.1161 58.7638 41.8677 58.6507 41.5941C58.5376 41.3205 58.4797 41.0273 58.4805 40.7313V33.3862H59.878V40.7156C59.8764 40.8231 59.897 40.9297 59.9385 41.0289C59.98 41.1281 60.0414 41.2177 60.1191 41.292C60.1944 41.3691 60.2846 41.43 60.3841 41.4711C60.4837 41.5122 60.5906 41.5326 60.6984 41.531C60.8056 41.5316 60.9119 41.5109 61.0111 41.4701C61.1103 41.4293 61.2004 41.3693 61.2762 41.2934C61.352 41.2176 61.4121 41.1275 61.4529 41.0283C61.4937 40.9291 61.5144 40.8228 61.5138 40.7156V33.3862H63.0046V40.731C63.0111 41.0291 62.9554 41.3253 62.8411 41.6007C62.7268 41.8762 62.5564 42.1248 62.3408 42.3308C62.1306 42.5414 61.88 42.7075 61.6041 42.8191C61.3282 42.9307 61.0326 42.9855 60.735 42.9803Z\" fill=\"%23090B0E\"/>%0A<path id=\"Vector_11\" d=\"M75.41 40.5955C75.4145 40.893 75.3582 41.1883 75.2448 41.4633C75.1313 41.7384 74.963 41.9874 74.75 42.1953C74.5457 42.4088 74.2996 42.5779 74.0271 42.6921C73.7546 42.8063 73.4614 42.8632 73.1659 42.8591H70.9219V33.3863H73.1659C73.4624 33.3812 73.7567 33.4376 74.0303 33.5518C74.3039 33.6661 74.5509 33.8357 74.7557 34.0501C74.9668 34.2579 75.1337 34.5063 75.2461 34.7804C75.3586 35.0545 75.4144 35.3485 75.41 35.6447V40.5955ZM72.3505 41.4473H73.21C73.3179 41.4494 73.425 41.4285 73.5241 41.3859C73.6233 41.3434 73.7122 41.2802 73.7851 41.2006C73.9364 41.046 74.0202 40.8376 74.0181 40.6213V35.6667C74.0196 35.5591 73.9993 35.4522 73.9583 35.3527C73.9173 35.2531 73.8566 35.1629 73.7798 35.0874C73.7066 35.0101 73.6182 34.9487 73.5201 34.9072C73.4221 34.8656 73.3165 34.8448 73.21 34.846H72.3505V41.4493V41.4473Z\" fill=\"%23090B0E\"/>%0A<path id=\"Vector_12\" d=\"M70.0295 16.8481L73.0628 27.0564V16.8481H75.3548V32.0463H72.8986L69.7451 22.3132V32.0463H67.4531V16.8481H70.0281H70.0295Z\" fill=\"%23090B0E\"/>%0A</g>%0A<defs>%0A<filter id=\"filter0_d_879_24616\" x=\"0.0175781\" y=\"3.38086\" width=\"98.2217\" height=\"60.6189\" filterUnits=\"userSpaceOnUse\" color-interpolation-filters=\"sRGB\">%0A<feFlood flood-opacity=\"0\" result=\"BackgroundImageFix\"/>%0A<feColorMatrix in=\"SourceAlpha\" type=\"matrix\" values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0\" result=\"hardAlpha\"/>%0A<feOffset dy=\"4\"/>%0A<feGaussianBlur stdDeviation=\"2\"/>%0A<feComposite in2=\"hardAlpha\" operator=\"out\"/>%0A<feColorMatrix type=\"matrix\" values=\"0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.15 0\"/>%0A<feBlend mode=\"normal\" in2=\"BackgroundImageFix\" result=\"effect1_dropShadow_879_24616\"/>%0A<feBlend mode=\"normal\" in=\"SourceGraphic\" in2=\"effect1_dropShadow_879_24616\" result=\"shape\"/>%0A</filter>%0A<filter id=\"filter1_d_879_24616\" x=\"2.51758\" y=\"-0.000488281\" width=\"93.2217\" height=\"56.1199\" filterUnits=\"userSpaceOnUse\" color-interpolation-filters=\"sRGB\">%0A<feFlood flood-opacity=\"0\" result=\"BackgroundImageFix\"/>%0A<feColorMatrix in=\"SourceAlpha\" type=\"matrix\" values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0\" result=\"hardAlpha\"/>%0A<feOffset dy=\"2\"/>%0A<feGaussianBlur stdDeviation=\"0.75\"/>%0A<feComposite in2=\"hardAlpha\" operator=\"out\"/>%0A<feColorMatrix type=\"matrix\" values=\"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0\"/>%0A<feBlend mode=\"normal\" in2=\"BackgroundImageFix\" result=\"effect1_dropShadow_879_24616\"/>%0A<feBlend mode=\"normal\" in=\"SourceGraphic\" in2=\"effect1_dropShadow_879_24616\" result=\"shape\"/>%0A</filter>%0A</defs>%0A</svg>%0A";
|
|
2842
|
+
//#endregion
|
|
2843
|
+
//#region src/components/Header/styles.ts
|
|
2844
|
+
const useStyles$2 = ({ styles, titleStyles, contentStyles, menuStyles, menuDropdownStyles }) => ({
|
|
2845
|
+
root: {
|
|
2846
|
+
padding: "10px 0",
|
|
2847
|
+
color: "rgba(255,255,255,0.85)",
|
|
2848
|
+
background: "transparent",
|
|
2849
|
+
zIndex: 1201,
|
|
2850
|
+
...styles
|
|
2851
|
+
},
|
|
2852
|
+
leadingText: {
|
|
2853
|
+
display: "-webkit-box",
|
|
2854
|
+
"-webkit-box-orient": "vertical",
|
|
2855
|
+
"-webkit-line-clamp": "2",
|
|
2856
|
+
maxHeight: "2em",
|
|
2857
|
+
marginRight: "8px",
|
|
2858
|
+
lineHeight: "1em",
|
|
2859
|
+
overflow: "hidden",
|
|
2860
|
+
textOverflow: "ellipsis"
|
|
2861
|
+
},
|
|
2862
|
+
title: {
|
|
2863
|
+
display: "-webkit-box",
|
|
2864
|
+
"-webkit-box-orient": "vertical",
|
|
2865
|
+
"-webkit-line-clamp": "2",
|
|
2866
|
+
maxHeight: "2em",
|
|
2867
|
+
marginRight: "8px",
|
|
2868
|
+
lineHeight: "1em",
|
|
2869
|
+
overflow: "hidden",
|
|
2870
|
+
textOverflow: "ellipsis",
|
|
2871
|
+
flexGrow: 1,
|
|
2872
|
+
...titleStyles
|
|
2873
|
+
},
|
|
2874
|
+
content: {
|
|
2875
|
+
display: "flex",
|
|
2876
|
+
flexGrow: 1,
|
|
2877
|
+
alignItems: "center",
|
|
2878
|
+
justifyContent: "center",
|
|
2879
|
+
marginRight: "8px",
|
|
2880
|
+
...contentStyles
|
|
2881
|
+
},
|
|
2882
|
+
nav: { marginRight: "10px" },
|
|
2883
|
+
user: {},
|
|
2884
|
+
userInfo: {
|
|
2885
|
+
marginLeft: "0.5em",
|
|
2886
|
+
color: "rgba(255,255,255,0.5)"
|
|
2887
|
+
},
|
|
2888
|
+
button: {
|
|
2889
|
+
height: "50px",
|
|
2890
|
+
marginRight: "10px",
|
|
2891
|
+
fontSize: "16px",
|
|
2892
|
+
fontWeight: 600,
|
|
2893
|
+
backgroundColor: "#1B2027",
|
|
2894
|
+
boxShadow: "0px 2px 5px rgba(0, 0, 0, 0.28)",
|
|
2895
|
+
borderRadius: "4px",
|
|
2896
|
+
"&:hover": {
|
|
2897
|
+
backgroundColor: "#252A32",
|
|
2898
|
+
filter: "brightness(1.1)"
|
|
2899
|
+
}
|
|
2900
|
+
},
|
|
2901
|
+
loginButton: { padding: "6px 18px" },
|
|
2902
|
+
logoutButton: { paddingRight: "18px" },
|
|
2903
|
+
menu: {
|
|
2904
|
+
marginTop: "62px",
|
|
2905
|
+
backgroundColor: "rgba(0,0,0,0.5)",
|
|
2906
|
+
...menuStyles,
|
|
2907
|
+
"& .MuiPaper-root": {
|
|
2908
|
+
minWidth: "20%",
|
|
2909
|
+
backgroundColor: "#2d2d2d",
|
|
2910
|
+
color: "#E0E0E0",
|
|
2911
|
+
...menuDropdownStyles
|
|
2912
|
+
}
|
|
2913
|
+
}
|
|
2914
|
+
});
|
|
2915
|
+
//#endregion
|
|
2916
|
+
//#region src/components/Header/Header.tsx
|
|
2917
|
+
const Header = observer(({ position, scrolled, showAcLogo, leadingText, title, titleStyles, content, contentComponents, contentStyles, navProps, userProps, menuProps, sidebarEnabled, sidebarOpen, onSidebarToggle, styles, "data-testid": dataTestID }) => {
|
|
2918
|
+
const { baseUrl } = useAuthConfig();
|
|
2919
|
+
const matchesMD = useMediaQuery(useTheme().breakpoints.up("md"));
|
|
2920
|
+
const [headerLeadingText, setHeaderLeadingText] = useState(leadingText);
|
|
2921
|
+
const [headerTitle, setHeaderTitle] = useState(title);
|
|
2922
|
+
const [iframeContent, setIframeContent] = useState(null);
|
|
2923
|
+
const iframeSourceRef = useRef(null);
|
|
2924
|
+
const { t } = useTranslation();
|
|
2925
|
+
const { items: navItems } = {
|
|
2926
|
+
items: [],
|
|
2927
|
+
...navProps
|
|
2928
|
+
};
|
|
2929
|
+
const { show: showUserSection, showCompanyLogo } = {
|
|
2930
|
+
show: true,
|
|
2931
|
+
showCompanyLogo: false,
|
|
2932
|
+
...userProps
|
|
2933
|
+
};
|
|
2934
|
+
const { items: menuItems, buttonColor: menuButtonColor, dropdownStyles: menuDropdownStyles, styles: menuStyles } = {
|
|
2935
|
+
items: [],
|
|
2936
|
+
buttonColor: "white",
|
|
2937
|
+
dropdownStyles: {},
|
|
2938
|
+
styles: {},
|
|
2939
|
+
...menuProps
|
|
2940
|
+
};
|
|
2941
|
+
const [currentTime, setCurrentTime] = useState(/* @__PURE__ */ new Date());
|
|
2942
|
+
const [menuAnchorEl, setMenuAnchorEl] = useState(null);
|
|
2943
|
+
const baseHeaderStyles = useStyles$2({
|
|
2944
|
+
styles,
|
|
2945
|
+
titleStyles,
|
|
2946
|
+
contentStyles,
|
|
2947
|
+
menuStyles,
|
|
2948
|
+
menuDropdownStyles
|
|
2949
|
+
});
|
|
2950
|
+
const [headerStylesOverrides, setHeaderStylesOverrides] = useState({});
|
|
2951
|
+
const headerStyles = useMemo(() => Object.keys(baseHeaderStyles).reduce((acc, key) => {
|
|
2952
|
+
acc[key] = deepmerge(baseHeaderStyles[key] || {}, headerStylesOverrides[key] || {});
|
|
2953
|
+
return acc;
|
|
2954
|
+
}, {}), [baseHeaderStyles, headerStylesOverrides]);
|
|
2955
|
+
const navigate = useNavigate();
|
|
2956
|
+
const onContentEvent = useCallback((event, payload) => {
|
|
2957
|
+
const source = iframeSourceRef.current;
|
|
2958
|
+
if (!source) return;
|
|
2959
|
+
source.source.postMessage({
|
|
2960
|
+
type: "HEADER_CONTENT_EVENT",
|
|
2961
|
+
component: iframeContent?.component,
|
|
2962
|
+
event,
|
|
2963
|
+
payload
|
|
2964
|
+
}, source.origin);
|
|
2965
|
+
}, [iframeContent?.component]);
|
|
2966
|
+
useEffect(() => {
|
|
2967
|
+
const interval = setInterval(() => {
|
|
2968
|
+
setCurrentTime(/* @__PURE__ */ new Date());
|
|
2969
|
+
}, 1e3);
|
|
2970
|
+
return () => clearInterval(interval);
|
|
2971
|
+
});
|
|
2972
|
+
useEffect(() => {
|
|
2973
|
+
setHeaderLeadingText(leadingText);
|
|
2974
|
+
}, [leadingText]);
|
|
2975
|
+
useEffect(() => {
|
|
2976
|
+
setHeaderTitle(title);
|
|
2977
|
+
}, [title]);
|
|
2978
|
+
useEffect(() => {
|
|
2979
|
+
const onMessage = (event) => {
|
|
2980
|
+
if (!isTrustedOrigin(event.origin)) return;
|
|
2981
|
+
const data = event.data;
|
|
2982
|
+
if (!data || typeof data !== "object") return;
|
|
2983
|
+
switch (data.type) {
|
|
2984
|
+
case "SET_HEADER_LEADING_TEXT":
|
|
2985
|
+
if (typeof data.text === "string") setHeaderLeadingText(data.text);
|
|
2986
|
+
break;
|
|
2987
|
+
case "RESET_HEADER_LEADING_TEXT":
|
|
2988
|
+
setHeaderLeadingText(leadingText);
|
|
2989
|
+
break;
|
|
2990
|
+
case "SET_HEADER_TITLE":
|
|
2991
|
+
if (typeof data.title === "string") setHeaderTitle(data.title);
|
|
2992
|
+
break;
|
|
2993
|
+
case "RESET_HEADER_TITLE":
|
|
2994
|
+
setHeaderTitle(title);
|
|
2995
|
+
break;
|
|
2996
|
+
case "SET_HEADER_STYLES": {
|
|
2997
|
+
const target = data.target || "root";
|
|
2998
|
+
if (typeof data.styles === "object") setHeaderStylesOverrides((current) => ({
|
|
2999
|
+
...current,
|
|
3000
|
+
[target]: deepmerge(current[target] || {}, data.styles)
|
|
3001
|
+
}));
|
|
3002
|
+
break;
|
|
3003
|
+
}
|
|
3004
|
+
case "RESET_HEADER_STYLES": {
|
|
3005
|
+
const resetTarget = data.target;
|
|
3006
|
+
setHeaderStylesOverrides((current) => {
|
|
3007
|
+
if (resetTarget) {
|
|
3008
|
+
const updated = { ...current };
|
|
3009
|
+
delete updated[resetTarget];
|
|
3010
|
+
return updated;
|
|
3011
|
+
}
|
|
3012
|
+
return {};
|
|
3013
|
+
});
|
|
3014
|
+
break;
|
|
3015
|
+
}
|
|
3016
|
+
case "SET_HEADER_CONTENT":
|
|
3017
|
+
if (typeof data.component === "string" && data.component) {
|
|
3018
|
+
setIframeContent({
|
|
3019
|
+
component: data.component,
|
|
3020
|
+
props: data.props || {}
|
|
3021
|
+
});
|
|
3022
|
+
if (event.source) iframeSourceRef.current = {
|
|
3023
|
+
source: event.source,
|
|
3024
|
+
origin: event.origin
|
|
3025
|
+
};
|
|
3026
|
+
} else {
|
|
3027
|
+
setIframeContent(null);
|
|
3028
|
+
iframeSourceRef.current = null;
|
|
3029
|
+
}
|
|
3030
|
+
break;
|
|
3031
|
+
case "RESET_HEADER_CONTENT":
|
|
3032
|
+
case "IFRAME_NAVIGATION_DISPOSED":
|
|
3033
|
+
setIframeContent(null);
|
|
3034
|
+
iframeSourceRef.current = null;
|
|
3035
|
+
break;
|
|
3036
|
+
default: break;
|
|
3037
|
+
}
|
|
3038
|
+
};
|
|
3039
|
+
window.addEventListener("message", onMessage);
|
|
3040
|
+
return () => window.removeEventListener("message", onMessage);
|
|
3041
|
+
}, [leadingText, title]);
|
|
3042
|
+
const handleMenuOpen = (event) => {
|
|
3043
|
+
setMenuAnchorEl(event.currentTarget);
|
|
3044
|
+
};
|
|
3045
|
+
const handleMenuClose = () => {
|
|
3046
|
+
setMenuAnchorEl(null);
|
|
3047
|
+
};
|
|
3048
|
+
const handleItemClick = (item) => {
|
|
3049
|
+
if (item.url) navigate(item.url);
|
|
3050
|
+
else if (item.action && typeof item.action === "function") item.action();
|
|
3051
|
+
handleMenuClose();
|
|
3052
|
+
};
|
|
3053
|
+
const renderUserCompanyLogo = () => {
|
|
3054
|
+
const logoUrl = companyLogoUrl();
|
|
3055
|
+
return /* @__PURE__ */ React.createElement("img", {
|
|
3056
|
+
src: logoUrl,
|
|
3057
|
+
alt: ""
|
|
3058
|
+
});
|
|
3059
|
+
};
|
|
3060
|
+
const companyLogoUrl = () => {
|
|
3061
|
+
const currentUser = userStore_default.getCurrentUserJS;
|
|
3062
|
+
if (!currentUser) return "";
|
|
3063
|
+
return `${baseUrl}/${currentUser.company.logo_url}`;
|
|
3064
|
+
};
|
|
3065
|
+
const handleLogout = async () => {
|
|
3066
|
+
await sessionStore.logout();
|
|
3067
|
+
navigate("/");
|
|
3068
|
+
};
|
|
3069
|
+
const renderUserAvatar = () => {
|
|
3070
|
+
const currentUser = userStore_default.currentUser;
|
|
3071
|
+
return /* @__PURE__ */ React.createElement(Box$2, {
|
|
3072
|
+
display: "inline-block",
|
|
3073
|
+
sx: headerStyles.userInfo
|
|
3074
|
+
}, currentUser && `(${currentUser.name})`);
|
|
3075
|
+
};
|
|
3076
|
+
const renderContent = () => {
|
|
3077
|
+
if (iframeContent && contentComponents) {
|
|
3078
|
+
const Component = contentComponents[iframeContent.component];
|
|
3079
|
+
if (Component) return /* @__PURE__ */ React.createElement(Box$2, { sx: headerStyles.content }, /* @__PURE__ */ React.createElement(Component, {
|
|
3080
|
+
...iframeContent.props,
|
|
3081
|
+
onContentEvent
|
|
3082
|
+
}));
|
|
3083
|
+
}
|
|
3084
|
+
if (content) return /* @__PURE__ */ React.createElement(Box$2, { sx: headerStyles.content }, content);
|
|
3085
|
+
return /* @__PURE__ */ React.createElement(Typography$1, {
|
|
3086
|
+
variant: "subtitle1",
|
|
3087
|
+
align: "center",
|
|
3088
|
+
sx: headerStyles.title
|
|
3089
|
+
}, headerTitle);
|
|
3090
|
+
};
|
|
3091
|
+
const renderNav = () => {
|
|
3092
|
+
return navItems && /* @__PURE__ */ React.createElement(Box$2, {
|
|
3093
|
+
display: "flex",
|
|
3094
|
+
sx: headerStyles.nav
|
|
3095
|
+
}, navItems.map((item) => /* @__PURE__ */ React.createElement(Button$1, {
|
|
3096
|
+
key: item.label,
|
|
3097
|
+
onClick: () => handleItemClick(item),
|
|
3098
|
+
endIcon: item.icon,
|
|
3099
|
+
sx: headerStyles.button
|
|
3100
|
+
}, item.label)));
|
|
3101
|
+
};
|
|
3102
|
+
const renderUser = () => {
|
|
3103
|
+
const currentUser = userStore_default.getCurrentUserJS;
|
|
3104
|
+
return /* @__PURE__ */ React.createElement(Box$2, {
|
|
3105
|
+
display: "flex",
|
|
3106
|
+
sx: headerStyles.user
|
|
3107
|
+
}, currentUser ? /* @__PURE__ */ React.createElement(Button$1, {
|
|
3108
|
+
id: "logout-button",
|
|
3109
|
+
onClick: handleLogout,
|
|
3110
|
+
sx: {
|
|
3111
|
+
...headerStyles.button,
|
|
3112
|
+
...headerStyles.logoutButton
|
|
3113
|
+
},
|
|
3114
|
+
"data-testid": "sdk.header-logout-button"
|
|
3115
|
+
}, t("headerLogoutButton"), showCompanyLogo && renderUserCompanyLogo(), renderUserAvatar()) : /* @__PURE__ */ React.createElement(Button$1, {
|
|
3116
|
+
id: "login-button",
|
|
3117
|
+
onClick: () => navigate("/login"),
|
|
3118
|
+
sx: {
|
|
3119
|
+
...headerStyles.button,
|
|
3120
|
+
...headerStyles.loginButton
|
|
3121
|
+
},
|
|
3122
|
+
"data-testid": "sdk.header-login-button"
|
|
3123
|
+
}, t("headerLoginButton")));
|
|
3124
|
+
};
|
|
3125
|
+
const renderAuthMenuItem = () => {
|
|
3126
|
+
if (!matchesMD) return userStore_default.getCurrentUserJS ? /* @__PURE__ */ React.createElement(MenuItem, { onClick: handleLogout }, t("headerLogoutButton")) : /* @__PURE__ */ React.createElement(MenuItem, { onClick: () => navigate("/login") }, t("headerLoginButton"));
|
|
3127
|
+
};
|
|
3128
|
+
const renderMenu = () => {
|
|
3129
|
+
return menuItems && /* @__PURE__ */ React.createElement(Box$2, null, /* @__PURE__ */ React.createElement(IconButton$1, {
|
|
3130
|
+
onClick: handleMenuOpen,
|
|
3131
|
+
"data-testid": "sdk.header.menu-toggle"
|
|
3132
|
+
}, /* @__PURE__ */ React.createElement(MenuIcon, { style: menuButtonColor ? { color: menuButtonColor } : {} })), /* @__PURE__ */ React.createElement(Menu, {
|
|
3133
|
+
id: "menu-appbar",
|
|
3134
|
+
marginThreshold: 0,
|
|
3135
|
+
anchorEl: menuAnchorEl,
|
|
3136
|
+
anchorOrigin: {
|
|
3137
|
+
vertical: "top",
|
|
3138
|
+
horizontal: "right"
|
|
3139
|
+
},
|
|
3140
|
+
keepMounted: true,
|
|
3141
|
+
transformOrigin: {
|
|
3142
|
+
vertical: "top",
|
|
3143
|
+
horizontal: "right"
|
|
3144
|
+
},
|
|
3145
|
+
open: Boolean(menuAnchorEl),
|
|
3146
|
+
onClose: handleMenuClose,
|
|
3147
|
+
sx: headerStyles.menu
|
|
3148
|
+
}, menuItems.map((item) => /* @__PURE__ */ React.createElement(MenuItem, {
|
|
3149
|
+
key: item.label,
|
|
3150
|
+
onClick: () => handleItemClick(item)
|
|
3151
|
+
}, item.label)), renderAuthMenuItem()));
|
|
3152
|
+
};
|
|
3153
|
+
const scrolledBackground = typeof styles?.background === "string" ? styles.background : typeof headerStylesOverrides.root?.background === "string" ? headerStylesOverrides.root.background : "#1B2027";
|
|
3154
|
+
return /* @__PURE__ */ React.createElement(AppBar, {
|
|
3155
|
+
position,
|
|
3156
|
+
elevation: 0,
|
|
3157
|
+
sx: {
|
|
3158
|
+
...headerStyles.root,
|
|
3159
|
+
...position === "static" ? { marginTop: "-70px" } : {},
|
|
3160
|
+
...scrolled || sidebarOpen ? { background: scrolledBackground } : {}
|
|
3161
|
+
},
|
|
3162
|
+
"data-testid": dataTestID || "sdk.header"
|
|
3163
|
+
}, /* @__PURE__ */ React.createElement(Toolbar, { variant: "dense" }, sidebarEnabled && /* @__PURE__ */ React.createElement(IconButton$1, {
|
|
3164
|
+
size: "large",
|
|
3165
|
+
sx: {
|
|
3166
|
+
color: "rgba(255,255,255,0.85)",
|
|
3167
|
+
borderRight: "1px solid rgba(255,255,255,0.5)",
|
|
3168
|
+
...sidebarOpen && {
|
|
3169
|
+
color: "rgba(255,255,255,0.5)",
|
|
3170
|
+
borderTop: "1px solid rgba(255,255,255,0.5)",
|
|
3171
|
+
borderRightColor: "transparent"
|
|
3172
|
+
},
|
|
3173
|
+
"> svg": { transform: "rotate(180deg)" }
|
|
3174
|
+
},
|
|
3175
|
+
onClick: onSidebarToggle,
|
|
3176
|
+
"data-testid": "sdk.header.sidebar-toggle"
|
|
3177
|
+
}, /* @__PURE__ */ React.createElement(ViewSidebarRounded, null)), showAcLogo && /* @__PURE__ */ React.createElement(Link$1, {
|
|
3178
|
+
to: "/",
|
|
3179
|
+
"data-testid": "sdk.header.logo"
|
|
3180
|
+
}, /* @__PURE__ */ React.createElement("img", {
|
|
3181
|
+
src: logo_default,
|
|
3182
|
+
alt: "AndonCloud",
|
|
3183
|
+
style: {
|
|
3184
|
+
display: "block",
|
|
3185
|
+
height: "50px",
|
|
3186
|
+
margin: "0 8px"
|
|
3187
|
+
}
|
|
3188
|
+
})), headerLeadingText && /* @__PURE__ */ React.createElement(Typography$1, {
|
|
3189
|
+
variant: "subtitle1",
|
|
3190
|
+
sx: headerStyles.leadingText
|
|
3191
|
+
}, headerLeadingText), renderContent(), renderNav(), showUserSection && matchesMD && renderUser(), /* @__PURE__ */ React.createElement(AccessTimeIcon, null), /* @__PURE__ */ React.createElement(Typography$1, {
|
|
3192
|
+
variant: "body1",
|
|
3193
|
+
align: "center",
|
|
3194
|
+
style: {
|
|
3195
|
+
width: "5rem",
|
|
3196
|
+
padding: "0 5px"
|
|
3197
|
+
}
|
|
3198
|
+
}, currentTime.toLocaleTimeString()), renderMenu()));
|
|
3199
|
+
});
|
|
3200
|
+
//#endregion
|
|
3201
|
+
//#region src/components/sidebarMenu.styles.js
|
|
3202
|
+
const useStyles$1 = ({ styles, listStyles, itemStyles, subitemStyles }) => ({
|
|
3203
|
+
root: {
|
|
3204
|
+
flexShrink: 0,
|
|
3205
|
+
"& .MuiDrawer-paper": {
|
|
3206
|
+
width: `${styles.width}px`,
|
|
3207
|
+
boxSizing: "border-box",
|
|
3208
|
+
marginTop: "70px",
|
|
3209
|
+
color: "rgba(255,255,255,0.85)",
|
|
3210
|
+
background: "rgba(255,255,255,0.025)"
|
|
3211
|
+
},
|
|
3212
|
+
...styles
|
|
3213
|
+
},
|
|
3214
|
+
list: {
|
|
3215
|
+
height: "90%",
|
|
3216
|
+
overflowY: "scroll",
|
|
3217
|
+
...listStyles
|
|
3218
|
+
},
|
|
3219
|
+
subList: {
|
|
3220
|
+
maxHeight: "50vh",
|
|
3221
|
+
overflowY: "auto"
|
|
3222
|
+
},
|
|
3223
|
+
item: { ...itemStyles },
|
|
3224
|
+
itemIcon: { color: "rgba(255,255,255,0.85)" },
|
|
3225
|
+
itemText: { "& > .MuiTypography-root": { fontWeight: 600 } },
|
|
3226
|
+
subitem: { ...subitemStyles },
|
|
3227
|
+
subitemText: { "& > span": { fontSize: "95%" } },
|
|
3228
|
+
subitemButton: { paddingLeft: 4 }
|
|
3229
|
+
});
|
|
3230
|
+
//#endregion
|
|
3231
|
+
//#region src/components/sidebarMenu.js
|
|
3232
|
+
const SidebarMenu = ({ open, items, width, styles, listStyles, itemStyles, subitemStyles }) => {
|
|
3233
|
+
const [openedItems, setOpenedItems] = useState([]);
|
|
3234
|
+
const sidebarMenuStyles = useStyles$1({
|
|
3235
|
+
styles: {
|
|
3236
|
+
...styles,
|
|
3237
|
+
width
|
|
3238
|
+
},
|
|
3239
|
+
listStyles,
|
|
3240
|
+
itemStyles,
|
|
3241
|
+
subitemStyles
|
|
3242
|
+
});
|
|
3243
|
+
const navigate = useNavigate();
|
|
3244
|
+
useEffect(() => {
|
|
3245
|
+
setOpenedItems(items.map((item) => !!item.defaultOpened));
|
|
3246
|
+
}, [items]);
|
|
3247
|
+
const handleItemClick = (action, url, redirect) => {
|
|
3248
|
+
if (action) action();
|
|
3249
|
+
else if (url) if (url.startsWith("/")) navigate(url);
|
|
3250
|
+
else if (!redirect) navigate(`?external=${url}`);
|
|
3251
|
+
else window.location.href = url;
|
|
3252
|
+
};
|
|
3253
|
+
const renderSubitems = (items) => {
|
|
3254
|
+
return /* @__PURE__ */ React.createElement(List, {
|
|
3255
|
+
component: "div",
|
|
3256
|
+
disablePadding: true,
|
|
3257
|
+
sx: sidebarMenuStyles.subList
|
|
3258
|
+
}, items.map(({ action, url, redirect, icon, label }) => /* @__PURE__ */ React.createElement(ListItem, {
|
|
3259
|
+
key: label,
|
|
3260
|
+
sx: sidebarMenuStyles.subitem,
|
|
3261
|
+
disablePadding: true
|
|
3262
|
+
}, /* @__PURE__ */ React.createElement(ListItemButton, {
|
|
3263
|
+
sx: sidebarMenuStyles.subitemButton,
|
|
3264
|
+
onClick: () => handleItemClick(action, url, redirect),
|
|
3265
|
+
"data-testid": `sdk.sidebar.subitem-${label}`
|
|
3266
|
+
}, icon && /* @__PURE__ */ React.createElement(ListItemIcon, { sx: sidebarMenuStyles.itemIcon }, icon), /* @__PURE__ */ React.createElement(ListItemText, {
|
|
3267
|
+
primary: label,
|
|
3268
|
+
sx: sidebarMenuStyles.subitemText
|
|
3269
|
+
})))));
|
|
3270
|
+
};
|
|
3271
|
+
const renderItems = () => {
|
|
3272
|
+
return items.map(({ action, url, redirect, icon, label, items }, i) => /* @__PURE__ */ React.createElement(React.Fragment, { key: label }, /* @__PURE__ */ React.createElement(ListItem, {
|
|
3273
|
+
sx: sidebarMenuStyles.item,
|
|
3274
|
+
disablePadding: true
|
|
3275
|
+
}, /* @__PURE__ */ React.createElement(ListItemButton, {
|
|
3276
|
+
onClick: () => {
|
|
3277
|
+
if (items?.length) setOpenedItems((current) => {
|
|
3278
|
+
current[i] = !current[i];
|
|
3279
|
+
return { ...current };
|
|
3280
|
+
});
|
|
3281
|
+
else handleItemClick(action, url, redirect);
|
|
3282
|
+
},
|
|
3283
|
+
"data-testid": `sdk.sidebar.item-${label}`
|
|
3284
|
+
}, icon && /* @__PURE__ */ React.createElement(ListItemIcon, { sx: sidebarMenuStyles.itemIcon }, icon), /* @__PURE__ */ React.createElement(ListItemText, {
|
|
3285
|
+
primary: label,
|
|
3286
|
+
sx: sidebarMenuStyles.itemText
|
|
3287
|
+
}), !!items?.length && (openedItems[i] ? /* @__PURE__ */ React.createElement(ExpandLess, null) : /* @__PURE__ */ React.createElement(ExpandMore, null)))), !!items?.length && /* @__PURE__ */ React.createElement(Collapse, {
|
|
3288
|
+
in: openedItems[i],
|
|
3289
|
+
timeout: "auto",
|
|
3290
|
+
unmountOnExit: true
|
|
3291
|
+
}, renderSubitems(items))));
|
|
3292
|
+
};
|
|
3293
|
+
return /* @__PURE__ */ React.createElement(Drawer, {
|
|
3294
|
+
sx: sidebarMenuStyles.root,
|
|
3295
|
+
variant: "persistent",
|
|
3296
|
+
anchor: "left",
|
|
3297
|
+
open,
|
|
3298
|
+
"data-testid": "sdk.sidebar.drawer"
|
|
3299
|
+
}, /* @__PURE__ */ React.createElement(List, { sx: sidebarMenuStyles.list }, renderItems()));
|
|
3300
|
+
};
|
|
3301
|
+
SidebarMenu.propTypes = {
|
|
3302
|
+
open: PropTypes.bool,
|
|
3303
|
+
items: PropTypes.any,
|
|
3304
|
+
width: PropTypes.number,
|
|
3305
|
+
styles: PropTypes.any,
|
|
3306
|
+
listStyles: PropTypes.any,
|
|
3307
|
+
itemStyles: PropTypes.any,
|
|
3308
|
+
subitemStyles: PropTypes.any
|
|
3309
|
+
};
|
|
3310
|
+
SidebarMenu.defaultProps = {
|
|
3311
|
+
styles: {},
|
|
3312
|
+
listStyles: {},
|
|
3313
|
+
itemStyles: {},
|
|
3314
|
+
subitemStyles: {}
|
|
3315
|
+
};
|
|
3316
|
+
//#endregion
|
|
3317
|
+
//#region src/components/sidePanel.styles.js
|
|
3318
|
+
const useStyles = ({ hasAsideContent, styles, headerStyles, contentWrapperStyles, mainContentStyles, asideContentStyles }) => ({
|
|
3319
|
+
root: {
|
|
3320
|
+
flexShrink: 0,
|
|
3321
|
+
"& .MuiDrawer-paper": {
|
|
3322
|
+
width: styles.width,
|
|
3323
|
+
boxSizing: "border-box",
|
|
3324
|
+
marginTop: "70px",
|
|
3325
|
+
color: "rgba(255,255,255,0.85)",
|
|
3326
|
+
borderTop: "1px solid rgba(255,255,255,0.1)",
|
|
3327
|
+
borderLeft: "1px solid rgba(255,255,255,0.1)",
|
|
3328
|
+
background: "#252A32",
|
|
3329
|
+
boxShadow: "-6px 0 10px rgba(0, 0, 0, 0.15), inset -6px 0 8px rgba(0, 0, 0, 0.1), inset 0 -6px 8px rgba(0, 0, 0, 0.1)"
|
|
3330
|
+
},
|
|
3331
|
+
...styles
|
|
3332
|
+
},
|
|
3333
|
+
header: {
|
|
3334
|
+
display: "flex",
|
|
3335
|
+
alignItems: "center",
|
|
3336
|
+
height: "60px",
|
|
3337
|
+
padding: "8px 16px",
|
|
3338
|
+
borderBottom: "1px solid rgba(255,255,255,0.1)",
|
|
3339
|
+
...headerStyles
|
|
3340
|
+
},
|
|
3341
|
+
contentWrapper: {
|
|
3342
|
+
display: "flex",
|
|
3343
|
+
flexDirection: "row",
|
|
3344
|
+
height: "calc(100% - 152px)",
|
|
3345
|
+
borderRight: "16px solid rgba(0,0,0,0.1)",
|
|
3346
|
+
...contentWrapperStyles
|
|
3347
|
+
},
|
|
3348
|
+
mainContent: {
|
|
3349
|
+
flexBasis: hasAsideContent ? styles.mainContentWidth : "100%",
|
|
3350
|
+
padding: "16px",
|
|
3351
|
+
overflowY: "auto",
|
|
3352
|
+
...mainContentStyles
|
|
3353
|
+
},
|
|
3354
|
+
asideContent: {
|
|
3355
|
+
flexBasis: styles.asideContentWidth,
|
|
3356
|
+
padding: " 16px 0",
|
|
3357
|
+
overflowY: "auto",
|
|
3358
|
+
background: "rgba(0,0,0,0.1)",
|
|
3359
|
+
...asideContentStyles
|
|
3360
|
+
}
|
|
3361
|
+
});
|
|
3362
|
+
//#endregion
|
|
3363
|
+
//#region src/components/sidePanel.js
|
|
3364
|
+
const SidePanel = ({ open, onClose, title, mainContent, asideContent, width, mainContentWidth, asideContentWidth, styles, headerStyles, contentWrapperStyles, mainContentStyles, asideContentStyles }) => {
|
|
3365
|
+
const sidePanelStyles = useStyles({
|
|
3366
|
+
hasAsideContent: Boolean(asideContent),
|
|
3367
|
+
styles: {
|
|
3368
|
+
...styles,
|
|
3369
|
+
width,
|
|
3370
|
+
mainContentWidth,
|
|
3371
|
+
asideContentWidth
|
|
3372
|
+
},
|
|
3373
|
+
headerStyles,
|
|
3374
|
+
contentWrapperStyles,
|
|
3375
|
+
mainContentStyles,
|
|
3376
|
+
asideContentStyles
|
|
3377
|
+
});
|
|
3378
|
+
return /* @__PURE__ */ React.createElement(Drawer, {
|
|
3379
|
+
sx: sidePanelStyles.root,
|
|
3380
|
+
variant: "persistent",
|
|
3381
|
+
anchor: "right",
|
|
3382
|
+
open,
|
|
3383
|
+
"data-testid": "sdk.side-panel"
|
|
3384
|
+
}, /* @__PURE__ */ React.createElement(Stack, {
|
|
3385
|
+
direction: "row",
|
|
3386
|
+
justifyContent: "space-between",
|
|
3387
|
+
alignItems: "center",
|
|
3388
|
+
sx: sidePanelStyles.header
|
|
3389
|
+
}, /* @__PURE__ */ React.createElement(Typography, {
|
|
3390
|
+
variant: "h6",
|
|
3391
|
+
fontSize: 18
|
|
3392
|
+
}, title), /* @__PURE__ */ React.createElement(IconButton, {
|
|
3393
|
+
color: "secondary",
|
|
3394
|
+
onClick: onClose,
|
|
3395
|
+
"data-testid": "sdk.side-panel.close"
|
|
3396
|
+
}, /* @__PURE__ */ React.createElement(CloseIcon, null))), /* @__PURE__ */ React.createElement(Box, { sx: sidePanelStyles.contentWrapper }, /* @__PURE__ */ React.createElement(Box, { sx: sidePanelStyles.mainContent }, mainContent), asideContent && /* @__PURE__ */ React.createElement(Box, { sx: sidePanelStyles.asideContent }, asideContent)));
|
|
3397
|
+
};
|
|
3398
|
+
SidePanel.propTypes = {
|
|
3399
|
+
enabled: PropTypes.bool,
|
|
3400
|
+
open: PropTypes.bool,
|
|
3401
|
+
onClose: PropTypes.func,
|
|
3402
|
+
title: PropTypes.string,
|
|
3403
|
+
mainContent: PropTypes.node,
|
|
3404
|
+
asideContent: PropTypes.node,
|
|
3405
|
+
width: PropTypes.string,
|
|
3406
|
+
mainContentWidth: PropTypes.string,
|
|
3407
|
+
asideContentWidth: PropTypes.string,
|
|
3408
|
+
styles: PropTypes.any,
|
|
3409
|
+
headerStyles: PropTypes.any,
|
|
3410
|
+
contentWrapperStyles: PropTypes.any,
|
|
3411
|
+
mainContentStyles: PropTypes.any,
|
|
3412
|
+
asideContentStyles: PropTypes.any
|
|
3413
|
+
};
|
|
3414
|
+
const sidePanelDefaultProps = {
|
|
3415
|
+
enabled: true,
|
|
3416
|
+
open: false,
|
|
3417
|
+
onClose: () => {},
|
|
3418
|
+
title: "",
|
|
3419
|
+
mainContent: null,
|
|
3420
|
+
asideContent: null,
|
|
3421
|
+
width: null,
|
|
3422
|
+
mainContentWidth: null,
|
|
3423
|
+
asideContentWidth: null,
|
|
3424
|
+
styles: {},
|
|
3425
|
+
headerStyles: {},
|
|
3426
|
+
contentWrapperStyles: {},
|
|
3427
|
+
mainContentStyles: {},
|
|
3428
|
+
asideContentStyles: {}
|
|
3429
|
+
};
|
|
3430
|
+
SidePanel.defaultProps = sidePanelDefaultProps;
|
|
3431
|
+
//#endregion
|
|
3432
|
+
//#region src/components/container.js
|
|
3433
|
+
const DEFAULT_SIDEBAR_MENU_WIDTH = 240;
|
|
3434
|
+
const DEFAULT_SIDE_PANEL_WIDTH = "45%";
|
|
3435
|
+
const DEFAULT_SIDE_PANEL_MAIN_CONTENT_WIDTH = "70%";
|
|
3436
|
+
const DEFAULT_SIDE_PANEL_ASIDE_CONTENT_WIDTH = "30%";
|
|
3437
|
+
const Main = styled("main", { shouldForwardProp: (prop) => !["open", "sidebarWidth"].includes(prop) })(({ theme, open, sidebarWidth }) => ({
|
|
3438
|
+
flexGrow: 1,
|
|
3439
|
+
transition: theme.transitions.create("margin", {
|
|
3440
|
+
easing: theme.transitions.easing.sharp,
|
|
3441
|
+
duration: theme.transitions.duration.leavingScreen
|
|
3442
|
+
}),
|
|
3443
|
+
marginLeft: 0,
|
|
3444
|
+
...open && {
|
|
3445
|
+
transition: theme.transitions.create("margin", {
|
|
3446
|
+
easing: theme.transitions.easing.easeOut,
|
|
3447
|
+
duration: theme.transitions.duration.enteringScreen
|
|
3448
|
+
}),
|
|
3449
|
+
marginLeft: `${sidebarWidth}px`
|
|
3450
|
+
}
|
|
3451
|
+
}));
|
|
3452
|
+
const Container = ({ children, headerProps, sidebarMenuProps, sidePanelProps, styles, "data-testid": dataTestID }) => {
|
|
3453
|
+
const { isEmbeddedMode } = useDisplay();
|
|
3454
|
+
const [searchParams] = useSearchParams();
|
|
3455
|
+
const [scrollTarget, setScrollTarget] = useState();
|
|
3456
|
+
const [sidebarOpen, setSidebarOpen] = useState(sidebarMenuProps?.open);
|
|
3457
|
+
const scrolled = useScrollTrigger({
|
|
3458
|
+
disableHysteresis: true,
|
|
3459
|
+
target: scrollTarget,
|
|
3460
|
+
threshold: 0
|
|
3461
|
+
});
|
|
3462
|
+
const externalUrl = searchParams.get("external");
|
|
3463
|
+
const sidebarWidth = sidebarMenuProps?.width || DEFAULT_SIDEBAR_MENU_WIDTH;
|
|
3464
|
+
const sidePanelWidth = sidePanelProps?.width || DEFAULT_SIDE_PANEL_WIDTH;
|
|
3465
|
+
const sidePanelMainContentWidth = sidePanelProps?.mainContentWidth || DEFAULT_SIDE_PANEL_MAIN_CONTENT_WIDTH;
|
|
3466
|
+
const sidePanelAsideContentWidth = sidePanelProps?.asideContentWidth || DEFAULT_SIDE_PANEL_ASIDE_CONTENT_WIDTH;
|
|
3467
|
+
const baseStyles = makeStyles({ isEmbeddedMode });
|
|
3468
|
+
useEffect(() => {
|
|
3469
|
+
if (isEmbeddedMode) return setSidebarOpen(false);
|
|
3470
|
+
const storedOpen = CookiesManager.get("sidebarMenuOpen");
|
|
3471
|
+
if (storedOpen !== void 0) setSidebarOpen(sidebarMenuProps?.enabled && storedOpen === "true");
|
|
3472
|
+
}, [
|
|
3473
|
+
isEmbeddedMode,
|
|
3474
|
+
sidebarMenuProps?.enabled,
|
|
3475
|
+
setSidebarOpen
|
|
3476
|
+
]);
|
|
3477
|
+
useEffect(() => {
|
|
3478
|
+
if (!isEmbeddedMode && sidebarMenuProps?.enabled) CookiesManager.set("sidebarMenuOpen", sidebarOpen);
|
|
3479
|
+
}, [
|
|
3480
|
+
isEmbeddedMode,
|
|
3481
|
+
sidebarMenuProps?.enabled,
|
|
3482
|
+
sidebarOpen
|
|
3483
|
+
]);
|
|
3484
|
+
return /* @__PURE__ */ React.createElement(BaseContainer, {
|
|
3485
|
+
ref: (node) => {
|
|
3486
|
+
if (node) setScrollTarget(node);
|
|
3487
|
+
},
|
|
3488
|
+
maxWidth: false,
|
|
3489
|
+
disableGutters: true,
|
|
3490
|
+
sx: {
|
|
3491
|
+
...baseStyles.root,
|
|
3492
|
+
...styles
|
|
3493
|
+
},
|
|
3494
|
+
"data-testid": dataTestID || "sdk.container"
|
|
3495
|
+
}, !isEmbeddedMode && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Header, {
|
|
3496
|
+
scrolled,
|
|
3497
|
+
showAcLogo: true,
|
|
3498
|
+
sidebarEnabled: sidebarMenuProps?.enabled,
|
|
3499
|
+
sidebarOpen,
|
|
3500
|
+
onSidebarToggle: () => setSidebarOpen((current) => !current),
|
|
3501
|
+
...headerProps
|
|
3502
|
+
}), sidebarMenuProps?.enabled && /* @__PURE__ */ React.createElement(SidebarMenu, {
|
|
3503
|
+
open: sidebarOpen,
|
|
3504
|
+
items: sidebarMenuProps.items,
|
|
3505
|
+
width: sidebarWidth
|
|
3506
|
+
})), /* @__PURE__ */ React.createElement(Main, {
|
|
3507
|
+
open: sidebarOpen,
|
|
3508
|
+
sidebarWidth
|
|
3509
|
+
}, externalUrl ? /* @__PURE__ */ React.createElement(ExternalContent, { src: externalUrl }) : children), sidePanelProps?.enabled && /* @__PURE__ */ React.createElement(SidePanel, {
|
|
3510
|
+
...sidePanelProps,
|
|
3511
|
+
width: sidePanelWidth,
|
|
3512
|
+
mainContentWidth: sidePanelMainContentWidth,
|
|
3513
|
+
asideContentWidth: sidePanelAsideContentWidth
|
|
3514
|
+
}), !isEmbeddedMode && /* @__PURE__ */ React.createElement(Box, { sx: baseStyles.overlay }));
|
|
3515
|
+
};
|
|
3516
|
+
Container.propTypes = {
|
|
3517
|
+
children: PropTypes.any,
|
|
3518
|
+
headerProps: PropTypes.shape({
|
|
3519
|
+
position: PropTypes.string,
|
|
3520
|
+
showAcLogo: PropTypes.bool,
|
|
3521
|
+
leadingText: PropTypes.string.isRequired,
|
|
3522
|
+
title: PropTypes.string,
|
|
3523
|
+
content: PropTypes.node,
|
|
3524
|
+
contentComponents: PropTypes.objectOf(PropTypes.elementType),
|
|
3525
|
+
contentStyles: PropTypes.any,
|
|
3526
|
+
navProps: PropTypes.shape({ items: PropTypes.any }),
|
|
3527
|
+
userProps: PropTypes.shape({
|
|
3528
|
+
show: PropTypes.bool,
|
|
3529
|
+
showCompanyLogo: PropTypes.bool
|
|
3530
|
+
}),
|
|
3531
|
+
menuProps: PropTypes.shape({
|
|
3532
|
+
items: PropTypes.any,
|
|
3533
|
+
buttonColor: PropTypes.string,
|
|
3534
|
+
dropdownStyles: PropTypes.any,
|
|
3535
|
+
styles: PropTypes.any
|
|
3536
|
+
}),
|
|
3537
|
+
styles: PropTypes.any
|
|
3538
|
+
}),
|
|
3539
|
+
sidebarMenuProps: PropTypes.shape({
|
|
3540
|
+
enabled: PropTypes.bool,
|
|
3541
|
+
open: PropTypes.bool,
|
|
3542
|
+
items: PropTypes.any,
|
|
3543
|
+
width: PropTypes.number
|
|
3544
|
+
}),
|
|
3545
|
+
sidePanelProps: PropTypes.shape({
|
|
3546
|
+
enabled: PropTypes.bool,
|
|
3547
|
+
open: PropTypes.bool,
|
|
3548
|
+
onClose: PropTypes.func,
|
|
3549
|
+
title: PropTypes.string,
|
|
3550
|
+
mainContent: PropTypes.node,
|
|
3551
|
+
asideContent: PropTypes.node,
|
|
3552
|
+
width: PropTypes.string
|
|
3553
|
+
}),
|
|
3554
|
+
styles: PropTypes.any
|
|
3555
|
+
};
|
|
3556
|
+
Container.defaultProps = {
|
|
3557
|
+
headerProps: {},
|
|
3558
|
+
sidebarMenuProps: {
|
|
3559
|
+
enabled: false,
|
|
3560
|
+
open: false,
|
|
3561
|
+
items: [],
|
|
3562
|
+
width: DEFAULT_SIDEBAR_MENU_WIDTH
|
|
3563
|
+
},
|
|
3564
|
+
sidePanelProps: {
|
|
3565
|
+
enabled: false,
|
|
3566
|
+
open: false,
|
|
3567
|
+
onClose: () => {},
|
|
3568
|
+
title: "",
|
|
3569
|
+
mainContent: null,
|
|
3570
|
+
asideContent: null,
|
|
3571
|
+
width: DEFAULT_SIDE_PANEL_WIDTH
|
|
3572
|
+
}
|
|
3573
|
+
};
|
|
3574
|
+
//#endregion
|
|
3575
|
+
//#region src/pages/LoginPage.js
|
|
3576
|
+
const LoginPage = ({ redirectPath }) => {
|
|
3577
|
+
const { i18n, t } = useTranslation();
|
|
3578
|
+
const toggleLocale = () => {
|
|
3579
|
+
i18n.changeLanguage(i18n.language === "pl" ? "en" : "pl");
|
|
3580
|
+
};
|
|
3581
|
+
return /* @__PURE__ */ React.createElement(Container, {
|
|
3582
|
+
headerProps: {
|
|
3583
|
+
position: "fixed",
|
|
3584
|
+
leadingText: "AndonCloud Software",
|
|
3585
|
+
userProps: { show: false },
|
|
3586
|
+
menuProps: {
|
|
3587
|
+
items: [{
|
|
3588
|
+
label: t("changeLanguageText"),
|
|
3589
|
+
action: toggleLocale
|
|
3590
|
+
}],
|
|
3591
|
+
buttonColor: "white"
|
|
3592
|
+
}
|
|
3593
|
+
},
|
|
3594
|
+
styles: { overflowY: "auto" }
|
|
3595
|
+
}, /* @__PURE__ */ React.createElement(Box$2, {
|
|
3596
|
+
display: "flex",
|
|
3597
|
+
height: "100%",
|
|
3598
|
+
alignItems: "center",
|
|
3599
|
+
justifyContent: "center"
|
|
3600
|
+
}, /* @__PURE__ */ React.createElement(Card$1, { sx: { borderRadius: "20px" } }, /* @__PURE__ */ React.createElement(CardContent$1, null, /* @__PURE__ */ React.createElement(loginForm_default, {
|
|
3601
|
+
title: t("loginFormText"),
|
|
3602
|
+
redirectPath
|
|
3603
|
+
})))));
|
|
3604
|
+
};
|
|
3605
|
+
LoginPage.propTypes = { redirectPath: PropTypes.string };
|
|
3606
|
+
LoginPage.defaultProps = { redirectPath: "/" };
|
|
3607
|
+
var LoginPage_default = observer(LoginPage);
|
|
3608
|
+
//#endregion
|
|
3609
|
+
//#region src/components/loginRedirect.tsx
|
|
3610
|
+
const LoginRedirect = () => {
|
|
3611
|
+
const { grantType, redirectPath } = useAuthConfig();
|
|
3612
|
+
const login = useLogin("read write");
|
|
3613
|
+
const navigate = useNavigate();
|
|
3614
|
+
if (grantType === "password") return /* @__PURE__ */ React.createElement(LoginPage_default, { redirectPath });
|
|
3615
|
+
navigate("/");
|
|
3616
|
+
login();
|
|
3617
|
+
return null;
|
|
3618
|
+
};
|
|
3619
|
+
//#endregion
|
|
3620
|
+
//#region src/components/router.js
|
|
3621
|
+
const SentryRoutes = Sentry.withSentryReactRouterV6Routing(Routes);
|
|
3622
|
+
const Router = ({ children }) => {
|
|
3623
|
+
return /* @__PURE__ */ React.createElement(BrowserRouter, null, /* @__PURE__ */ React.createElement(IframeNavigation, null), /* @__PURE__ */ React.createElement(SentryRoutes, null, children, /* @__PURE__ */ React.createElement(Route, {
|
|
3624
|
+
exact: true,
|
|
3625
|
+
path: "/login",
|
|
3626
|
+
element: /* @__PURE__ */ React.createElement(LoginRedirect, null)
|
|
3627
|
+
}), /* @__PURE__ */ React.createElement(Route, {
|
|
3628
|
+
path: "/oauth2/redirect",
|
|
3629
|
+
element: /* @__PURE__ */ React.createElement(AuthRedirect, null)
|
|
3630
|
+
})));
|
|
3631
|
+
};
|
|
3632
|
+
//#endregion
|
|
3633
|
+
//#region src/components/app.js
|
|
3634
|
+
const App = observer(({ children, baseUrl, authProps, gtmProps, i18nProps, sentryProps, metaProps, muiTheme }) => {
|
|
3635
|
+
const { status } = useLoginStatus();
|
|
3636
|
+
const { enabled: authEnabled, clientId, redirectUri } = {
|
|
3637
|
+
enabled: true,
|
|
3638
|
+
redirectPath: "/",
|
|
3639
|
+
...authProps
|
|
3640
|
+
};
|
|
3641
|
+
sessionStore.setAuthConfig({
|
|
3642
|
+
baseUrl,
|
|
3643
|
+
clientId,
|
|
3644
|
+
redirectUri
|
|
3645
|
+
});
|
|
3646
|
+
useEffect(() => {
|
|
3647
|
+
if (!appStore_default.gtmReady && gtmProps?.gtmId) {
|
|
3648
|
+
TagManager.initialize(gtmProps);
|
|
3649
|
+
appStore_default.setGtmReady();
|
|
3650
|
+
}
|
|
3651
|
+
}, [gtmProps]);
|
|
3652
|
+
useEffect(() => {
|
|
3653
|
+
if (!appStore_default.sentryReady && sentryProps) {
|
|
3654
|
+
Sentry.init({
|
|
3655
|
+
tracesSampleRate: 1,
|
|
3656
|
+
replaysSessionSampleRate: .1,
|
|
3657
|
+
replaysOnErrorSampleRate: 1,
|
|
3658
|
+
integrations: [Sentry.reactRouterV6BrowserTracingIntegration({
|
|
3659
|
+
useEffect,
|
|
3660
|
+
useLocation,
|
|
3661
|
+
useNavigationType,
|
|
3662
|
+
createRoutesFromChildren,
|
|
3663
|
+
matchRoutes
|
|
3664
|
+
}), Sentry.replayIntegration()],
|
|
3665
|
+
...sentryProps
|
|
3666
|
+
});
|
|
3667
|
+
appStore_default.setSentryReady();
|
|
3668
|
+
}
|
|
3669
|
+
}, [sentryProps]);
|
|
3670
|
+
useEffect(() => {
|
|
3671
|
+
const recoverSession = async () => {
|
|
3672
|
+
if (authEnabled) await sessionStore.recover();
|
|
3673
|
+
};
|
|
3674
|
+
if (authEnabled) recoverSession();
|
|
3675
|
+
else appStore_default.setAppReady();
|
|
3676
|
+
}, [authEnabled]);
|
|
3677
|
+
useEffect(() => {
|
|
3678
|
+
if (i18nProps?.locales) registerTranslations(i18nProps.locales);
|
|
3679
|
+
}, [i18nProps?.locales]);
|
|
3680
|
+
useEffect(() => {
|
|
3681
|
+
if (authEnabled && status !== "unknown") appStore_default.setAppReady();
|
|
3682
|
+
}, [authEnabled, status]);
|
|
3683
|
+
return /* @__PURE__ */ React.createElement(ThemeProvider, { theme: muiTheme }, /* @__PURE__ */ React.createElement(CssBaseline, null), /* @__PURE__ */ React.createElement(GlobalStyles, { styles: {
|
|
3684
|
+
"::-webkit-scrollbar": { width: "6px" },
|
|
3685
|
+
"::-webkit-scrollbar-track": { backgroundColor: "transparent" },
|
|
3686
|
+
"::-webkit-scrollbar-thumb": {
|
|
3687
|
+
borderRadius: "3px",
|
|
3688
|
+
backgroundColor: "rgba(255, 255, 255, 0.25)"
|
|
3689
|
+
}
|
|
3690
|
+
} }), /* @__PURE__ */ React.createElement(Sentry.ErrorBoundary, { fallback: (props) => /* @__PURE__ */ React.createElement(ErrorPage, {
|
|
3691
|
+
appVersion: metaProps.appVersion,
|
|
3692
|
+
apiVersion: metaProps.apiVersion,
|
|
3693
|
+
...props
|
|
3694
|
+
}) }, /* @__PURE__ */ React.createElement(Toaster, null), /* @__PURE__ */ React.createElement(AuthConfigProvider, { config: {
|
|
3695
|
+
baseUrl,
|
|
3696
|
+
...authProps
|
|
3697
|
+
} }, /* @__PURE__ */ React.createElement(StoreProvider, null, /* @__PURE__ */ React.createElement(I18nextProvider, { i18n: i18n_default }, /* @__PURE__ */ React.createElement(MetaInfoProvider, { info: metaProps }, /* @__PURE__ */ React.createElement(DisplayProvider, null, sessionStore.networkError ? /* @__PURE__ */ React.createElement(NetworkError, { error: sessionStore.networkError }) : appStore_default.appReady ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Router, null, /* @__PURE__ */ React.createElement(Route, {
|
|
3698
|
+
path: "*",
|
|
3699
|
+
element: /* @__PURE__ */ React.createElement(ModalProvider, null, children)
|
|
3700
|
+
}))) : /* @__PURE__ */ React.createElement(LoaderPage, null), /* @__PURE__ */ React.createElement(Footer, {
|
|
3701
|
+
appVersion: metaProps.appVersion,
|
|
3702
|
+
apiVersion: metaProps.apiVersion
|
|
3703
|
+
}))))))));
|
|
3704
|
+
});
|
|
3705
|
+
App.propTypes = {
|
|
3706
|
+
children: PropTypes.any.isRequired,
|
|
3707
|
+
baseUrl: PropTypes.string.isRequired,
|
|
3708
|
+
authProps: PropTypes.shape({
|
|
3709
|
+
enabled: PropTypes.bool,
|
|
3710
|
+
loginUrl: PropTypes.string,
|
|
3711
|
+
redirectUri: PropTypes.string,
|
|
3712
|
+
redirectPath: PropTypes.string,
|
|
3713
|
+
clientId: PropTypes.string.isRequired,
|
|
3714
|
+
grantType: PropTypes.string
|
|
3715
|
+
}),
|
|
3716
|
+
gtmProps: PropTypes.any,
|
|
3717
|
+
i18nProps: PropTypes.shape({ locales: PropTypes.any }),
|
|
3718
|
+
sentryProps: PropTypes.any,
|
|
3719
|
+
routerProps: PropTypes.shape({ iframeNavigationItems: PropTypes.any }),
|
|
3720
|
+
metaProps: PropTypes.shape({
|
|
3721
|
+
appVersion: PropTypes.string,
|
|
3722
|
+
apiVersion: PropTypes.string,
|
|
3723
|
+
releaseVersion: PropTypes.string,
|
|
3724
|
+
releasePageLink: PropTypes.string
|
|
3725
|
+
}),
|
|
3726
|
+
muiTheme: PropTypes.any
|
|
3727
|
+
};
|
|
3728
|
+
App.defaultProps = {
|
|
3729
|
+
authProps: {},
|
|
3730
|
+
gtmProps: {},
|
|
3731
|
+
i18nProps: {},
|
|
3732
|
+
sentryProps: {},
|
|
3733
|
+
metaProps: {},
|
|
3734
|
+
muiTheme: theme_default
|
|
3735
|
+
};
|
|
3736
|
+
var app_default = Sentry.withProfiler(App);
|
|
3737
|
+
//#endregion
|
|
3738
|
+
//#region src/assets/check.svg
|
|
3739
|
+
var check_default = "data:image/svg+xml,<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">%0A<g id=\"Check\">%0A<path id=\"Vector\" d=\"M17.6758 3.92578L6.875 14.7266L2.32422 10.1758L1.42578 11.0742L6.42578 16.0742L6.875 16.5039L7.32422 16.0742L18.5742 4.82422L17.6758 3.92578Z\" fill=\"white\"/>%0A</g>%0A</svg>%0A";
|
|
3740
|
+
//#endregion
|
|
3741
|
+
//#region src/core/ui/Checkbox/styled.ts
|
|
3742
|
+
const UncheckedIcon$1 = styled$1("span")(({ theme }) => ({
|
|
3743
|
+
width: "16px",
|
|
3744
|
+
height: "16px",
|
|
3745
|
+
border: `1px solid ${theme.palette.stroke.dark}`,
|
|
3746
|
+
borderRadius: "2px",
|
|
3747
|
+
"input:disabled ~ &": { backgroundColor: "#A7ADB6" },
|
|
3748
|
+
".Mui-error &": { border: `1px solid ${theme.palette.error.main}` }
|
|
3749
|
+
}));
|
|
3750
|
+
const CheckedIcon$1 = styled$1(UncheckedIcon$1)(({ theme }) => ({
|
|
3751
|
+
position: "relative",
|
|
3752
|
+
border: "none",
|
|
3753
|
+
background: theme.palette.primary.main,
|
|
3754
|
+
"&::after": {
|
|
3755
|
+
content: "\"\"",
|
|
3756
|
+
display: "block",
|
|
3757
|
+
position: "absolute",
|
|
3758
|
+
width: "16px",
|
|
3759
|
+
height: "16px",
|
|
3760
|
+
top: 0,
|
|
3761
|
+
left: 0,
|
|
3762
|
+
background: `url(${check_default}) no-repeat center`,
|
|
3763
|
+
backgroundSize: "80%"
|
|
3764
|
+
}
|
|
3765
|
+
}));
|
|
3766
|
+
const StyledCheckbox = styled$1(Checkbox$1)(({ theme }) => ({
|
|
3767
|
+
alignSelf: "flex-start",
|
|
3768
|
+
padding: theme.spacing(.5, 1, .5, 1.5),
|
|
3769
|
+
color: theme.palette.primary.main,
|
|
3770
|
+
"&:hover": { opacity: .8 }
|
|
3771
|
+
}));
|
|
3772
|
+
//#endregion
|
|
3773
|
+
//#region src/core/ui/Checkbox/Checkbox.tsx
|
|
3774
|
+
const Checkbox = (props) => {
|
|
3775
|
+
return /* @__PURE__ */ React.createElement(StyledCheckbox, {
|
|
3776
|
+
icon: /* @__PURE__ */ React.createElement(UncheckedIcon$1, null),
|
|
3777
|
+
checkedIcon: /* @__PURE__ */ React.createElement(CheckedIcon$1, null),
|
|
3778
|
+
...props
|
|
3779
|
+
});
|
|
3780
|
+
};
|
|
3781
|
+
//#endregion
|
|
3782
|
+
//#region src/core/ui/Radio/styled.ts
|
|
3783
|
+
const UncheckedIcon = styled$1("span")(({ theme }) => ({
|
|
3784
|
+
width: "16px",
|
|
3785
|
+
height: "16px",
|
|
3786
|
+
border: `1px solid ${theme.palette.stroke.dark}`,
|
|
3787
|
+
borderRadius: "50%",
|
|
3788
|
+
"input:disabled ~ &": { backgroundColor: "#A7ADB6" }
|
|
3789
|
+
}));
|
|
3790
|
+
const CheckedIcon = styled$1(UncheckedIcon)(({ theme }) => ({
|
|
3791
|
+
position: "relative",
|
|
3792
|
+
border: "none",
|
|
3793
|
+
background: theme.palette.primary.main,
|
|
3794
|
+
"&::after": {
|
|
3795
|
+
content: "\"\"",
|
|
3796
|
+
display: "block",
|
|
3797
|
+
position: "absolute",
|
|
3798
|
+
width: "8px",
|
|
3799
|
+
height: "8px",
|
|
3800
|
+
top: "calc(50% - 4px)",
|
|
3801
|
+
left: "calc(50% - 4px)",
|
|
3802
|
+
borderRadius: "50%",
|
|
3803
|
+
background: theme.palette.common.white
|
|
3804
|
+
}
|
|
3805
|
+
}));
|
|
3806
|
+
const StyledRadio = styled$1(Radio$1)(({ theme }) => ({
|
|
3807
|
+
padding: 0,
|
|
3808
|
+
color: theme.palette.primary.main
|
|
3809
|
+
}));
|
|
3810
|
+
//#endregion
|
|
3811
|
+
//#region src/core/ui/Radio/Radio.tsx
|
|
3812
|
+
const Radio = (props) => {
|
|
3813
|
+
return /* @__PURE__ */ React.createElement(StyledRadio, {
|
|
3814
|
+
icon: /* @__PURE__ */ React.createElement(UncheckedIcon, null),
|
|
3815
|
+
checkedIcon: /* @__PURE__ */ React.createElement(CheckedIcon, null),
|
|
3816
|
+
...props
|
|
3817
|
+
});
|
|
3818
|
+
};
|
|
3819
|
+
//#endregion
|
|
3820
|
+
//#region src/core/ui/RadioGroup/styled.ts
|
|
3821
|
+
const StyledRadioGroup = styled$1(RadioGroup$1)(({ theme }) => ({
|
|
3822
|
+
color: theme.palette.primary.main,
|
|
3823
|
+
".MuiFormControlLabel-root": {
|
|
3824
|
+
gap: theme.spacing(1),
|
|
3825
|
+
marginLeft: theme.spacing(1),
|
|
3826
|
+
"&:hover": { opacity: .8 }
|
|
3827
|
+
},
|
|
3828
|
+
".Mui-checked + .MuiFormControlLabel-label": { color: theme.palette.common.white }
|
|
3829
|
+
}));
|
|
3830
|
+
//#endregion
|
|
3831
|
+
//#region src/core/ui/RadioGroup/RadioGroup.tsx
|
|
3832
|
+
const RadioGroup = (props) => {
|
|
3833
|
+
return /* @__PURE__ */ React.createElement(StyledRadioGroup, props);
|
|
3834
|
+
};
|
|
3835
|
+
//#endregion
|
|
3836
|
+
//#region src/hooks/useHeaderContentEvent.ts
|
|
3837
|
+
const useHeaderContentEvent = (handler) => {
|
|
3838
|
+
useEffect(() => {
|
|
3839
|
+
const onMessage = (event) => {
|
|
3840
|
+
if (!isTrustedOrigin(event.origin)) return;
|
|
3841
|
+
const data = event.data;
|
|
3842
|
+
if (!data || typeof data !== "object") return;
|
|
3843
|
+
if (data.type !== "HEADER_CONTENT_EVENT") return;
|
|
3844
|
+
if (typeof data.event !== "string") return;
|
|
3845
|
+
handler(data.event, data.payload);
|
|
3846
|
+
};
|
|
3847
|
+
window.addEventListener("message", onMessage);
|
|
3848
|
+
return () => window.removeEventListener("message", onMessage);
|
|
3849
|
+
}, [handler]);
|
|
3850
|
+
};
|
|
3851
|
+
//#endregion
|
|
3852
|
+
//#region src/utils/authFetch.ts
|
|
3853
|
+
var AuthFetch = class {
|
|
3854
|
+
constructor() {
|
|
3855
|
+
this.callback = () => {};
|
|
3856
|
+
}
|
|
3857
|
+
setCallback(callback) {
|
|
3858
|
+
this.callback = callback;
|
|
3859
|
+
}
|
|
3860
|
+
removeCallback() {
|
|
3861
|
+
this.callback = () => {};
|
|
3862
|
+
}
|
|
3863
|
+
};
|
|
3864
|
+
new AuthFetch();
|
|
3865
|
+
tokenCoordinator.setAuthFetch((url, opts) => authFetch(url, opts));
|
|
3866
|
+
async function authFetch(url, options = {}) {
|
|
3867
|
+
if (sessionStore.isLoggedIn && sessionStore.session && !options.refresh) {
|
|
3868
|
+
const { createdAt, expiresIn } = sessionStore.session;
|
|
3869
|
+
if (createdAt + expiresIn - 5 < Math.round(+/* @__PURE__ */ new Date() / 1e3)) if (sessionStore.refreshTokenPromise) await sessionStore.refreshTokenPromise;
|
|
3870
|
+
else await sessionStore.refresh();
|
|
3871
|
+
}
|
|
3872
|
+
const headers = sessionStore.requestHeaders;
|
|
3873
|
+
if (headers !== null) options.headers = Object.assign({}, headers, options.headers);
|
|
3874
|
+
const response = await fetch(url, options).catch((e) => {
|
|
3875
|
+
captureException$1(e);
|
|
3876
|
+
sessionStore.setNetworkError({
|
|
3877
|
+
title: i18n_default.t("somethingWentWrongMessage"),
|
|
3878
|
+
details: e.message
|
|
3879
|
+
});
|
|
3880
|
+
});
|
|
3881
|
+
if (response) if (response.status === 401) return tokenCoordinator.handleUnauthorized(url, options);
|
|
3882
|
+
else {
|
|
3883
|
+
const textResponse = await response.clone().text();
|
|
3884
|
+
switch (response.status) {
|
|
3885
|
+
case 403:
|
|
3886
|
+
toast$1.error(i18n_default.t("forbiddenErrorMessage"));
|
|
3887
|
+
break;
|
|
3888
|
+
case 500:
|
|
3889
|
+
toast$1.error(React.createElement(React.Fragment, null, React.createElement(Typography, { mr: textResponse ? 2 : 0 }, i18n_default.t("somethingWentWrongMessage")), textResponse && React.createElement(Tooltip, {
|
|
3890
|
+
title: textResponse,
|
|
3891
|
+
arrow: true,
|
|
3892
|
+
children: React.createElement(HelpOutlineIcon)
|
|
3893
|
+
})));
|
|
3894
|
+
break;
|
|
3895
|
+
default: break;
|
|
3896
|
+
}
|
|
3897
|
+
}
|
|
3898
|
+
return response;
|
|
3899
|
+
}
|
|
3900
|
+
//#endregion
|
|
3901
|
+
//#region src/serviceWorkerRegistration.js
|
|
3902
|
+
const isLocalhost = Boolean(window.location.hostname === "localhost" || window.location.hostname === "[::1]" || window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));
|
|
3903
|
+
const register = (config) => {
|
|
3904
|
+
const { publicUrl, mode, autoUpdate, version: currentVersion, registrationConfig } = config;
|
|
3905
|
+
globalThis.version = currentVersion;
|
|
3906
|
+
if (mode === "production" && "serviceWorker" in navigator) {
|
|
3907
|
+
if (new URL(publicUrl, window.location.href).origin !== window.location.origin) return;
|
|
3908
|
+
window.addEventListener("load", () => {
|
|
3909
|
+
const swUrl = `${publicUrl}/service-worker.js`;
|
|
3910
|
+
if (isLocalhost) {
|
|
3911
|
+
checkValidServiceWorker(swUrl, registrationConfig);
|
|
3912
|
+
return navigator.serviceWorker.ready.then(() => {
|
|
3913
|
+
console.log("This web app is being served cache-first by a service worker. To learn more, visit https://cra.link/PWA");
|
|
3914
|
+
});
|
|
3915
|
+
} else registerValidSW(swUrl, registrationConfig, currentVersion, autoUpdate);
|
|
3916
|
+
});
|
|
3917
|
+
}
|
|
3918
|
+
};
|
|
3919
|
+
const registerValidSW = (swUrl, config, currentVersion, autoUpdate) => {
|
|
3920
|
+
navigator.serviceWorker.register(swUrl).then((registration) => {
|
|
3921
|
+
let newVersion = null;
|
|
3922
|
+
if (autoUpdate) setInterval(() => {
|
|
3923
|
+
fetch(`/manifest.json`).then(async (response) => {
|
|
3924
|
+
const { version } = await response.json();
|
|
3925
|
+
if (currentVersion !== version) {
|
|
3926
|
+
newVersion = version;
|
|
3927
|
+
registration.update();
|
|
3928
|
+
}
|
|
3929
|
+
}).catch(() => {});
|
|
3930
|
+
}, 3e4);
|
|
3931
|
+
registration.onupdatefound = () => {
|
|
3932
|
+
const installingWorker = registration.installing;
|
|
3933
|
+
if (installingWorker == null) return;
|
|
3934
|
+
installingWorker.onstatechange = () => {
|
|
3935
|
+
if (installingWorker.state === "installed") if (navigator.serviceWorker.controller) {
|
|
3936
|
+
console.log("New content is available and will be used when all tabs for this page are closed. See https://cra.link/PWA.");
|
|
3937
|
+
if (config && config.onUpdate) if (autoUpdate) config.onUpdate(registration, newVersion);
|
|
3938
|
+
else config.onUpdate(registration);
|
|
3939
|
+
} else {
|
|
3940
|
+
console.log("Content is cached for offline use.");
|
|
3941
|
+
if (config && config.onSuccess) config.onSuccess(registration);
|
|
3942
|
+
}
|
|
3943
|
+
};
|
|
3944
|
+
};
|
|
3945
|
+
}).catch((error) => {
|
|
3946
|
+
console.error("Error during service worker registration:", error);
|
|
3947
|
+
});
|
|
3948
|
+
};
|
|
3949
|
+
const checkValidServiceWorker = (swUrl, config) => {
|
|
3950
|
+
fetch(swUrl, { headers: { "Service-Worker": "script" } }).then((response) => {
|
|
3951
|
+
const contentType = response.headers.get("content-type");
|
|
3952
|
+
if (response.status === 404 || contentType != null && contentType.indexOf("javascript") === -1) return navigator.serviceWorker.ready.then((registration) => {
|
|
3953
|
+
return registration.unregister().then(() => {
|
|
3954
|
+
window.location.reload();
|
|
3955
|
+
});
|
|
3956
|
+
});
|
|
3957
|
+
else registerValidSW(swUrl, config);
|
|
3958
|
+
}).catch(() => {
|
|
3959
|
+
console.log("No internet connection found. App is running in offline mode.");
|
|
3960
|
+
});
|
|
3961
|
+
};
|
|
3962
|
+
//#endregion
|
|
3963
|
+
//#region src/utils/service-worker.js
|
|
3964
|
+
const registerServiceWorker = (config) => {
|
|
3965
|
+
const { version: currentVersion } = config;
|
|
3966
|
+
const processPageReload = (registration) => {
|
|
3967
|
+
const waitingServiceWorker = registration.waiting;
|
|
3968
|
+
if (waitingServiceWorker) {
|
|
3969
|
+
waitingServiceWorker.addEventListener("statechange", (e) => {
|
|
3970
|
+
if (e.target.state === "activated") window.location.reload();
|
|
3971
|
+
});
|
|
3972
|
+
waitingServiceWorker.postMessage({ type: "SKIP_WAITING" });
|
|
3973
|
+
}
|
|
3974
|
+
};
|
|
3975
|
+
const showNewVersionToast = () => toast$1(i18n_default.t("newVersionAvailable"), {
|
|
3976
|
+
duration: 5e3,
|
|
3977
|
+
position: "bottom-left",
|
|
3978
|
+
style: {
|
|
3979
|
+
color: "rgba(255,255,255,0.85)",
|
|
3980
|
+
background: "#3F3F3F",
|
|
3981
|
+
border: "1px solid #FFE72F"
|
|
3982
|
+
}
|
|
3983
|
+
});
|
|
3984
|
+
register({
|
|
3985
|
+
...config,
|
|
3986
|
+
registrationConfig: {
|
|
3987
|
+
...config?.registrationConfig || {},
|
|
3988
|
+
onUpdate: (registration, version) => {
|
|
3989
|
+
if (config.registrationConfig?.onUpdate) config.registrationConfig?.onUpdate(registration);
|
|
3990
|
+
if (version && currentVersion !== version) {
|
|
3991
|
+
showNewVersionToast();
|
|
3992
|
+
setTimeout(() => {
|
|
3993
|
+
processPageReload(registration);
|
|
3994
|
+
}, 5e3);
|
|
3995
|
+
} else {
|
|
3996
|
+
showNewVersionToast();
|
|
3997
|
+
processPageReload(registration);
|
|
3998
|
+
}
|
|
3999
|
+
}
|
|
4000
|
+
}
|
|
4001
|
+
});
|
|
4002
|
+
};
|
|
4003
|
+
//#endregion
|
|
4004
|
+
//#region src/index.js
|
|
4005
|
+
const setLocale = (locale) => i18n_default.changeLanguage(locale);
|
|
4006
|
+
const getLocale = () => i18n_default.language;
|
|
4007
|
+
const logout = () => sessionStore.logout();
|
|
4008
|
+
const refreshUserData = () => sessionStore.refreshUserData();
|
|
4009
|
+
//#endregion
|
|
4010
|
+
export { AccessBlocker, AccessGuard, app_default as App, Checkbox, Container, Radio, RadioGroup, captureException, authFetch as fetch, getDisplayMode, getLocale, logout, toast as notify, refreshUserData, registerServiceWorker, registerTranslations, resetParentHeaderContent, resetParentHeaderLeadingText, resetParentHeaderStyles, resetParentHeaderTitle, setLocale, sidePanelDefaultProps, updateParentHeaderContent, updateParentHeaderLeadingText, updateParentHeaderStyles, updateParentHeaderTitle, useAccess, useDisplay, useFeatures, useHeaderContentEvent, useLogin, useLoginStatus, usePermissions, useStore, withAccessGuard };
|
|
4011
|
+
|
|
4012
|
+
//# sourceMappingURL=index.js.map
|