Merge branch 'develop' into feature/oauth2-client
This commit is contained in:
commit
ea5dd21226
15
packages/client/.eslintrc.cjs
Normal file
15
packages/client/.eslintrc.cjs
Normal file
@ -0,0 +1,15 @@
|
||||
module.exports = {
|
||||
extends: "../shared/.eslintrc.cjs",
|
||||
parserOptions: {
|
||||
project: "tsconfig.eslint.json",
|
||||
tsconfigRootDir: __dirname,
|
||||
sourceType: "module",
|
||||
},
|
||||
|
||||
ignorePatterns: [
|
||||
"./tsconfig.json",
|
||||
"coverage/**",
|
||||
"storybook-static/**",
|
||||
"*.js",
|
||||
],
|
||||
};
|
3
packages/client/.prettierrc.json
Normal file
3
packages/client/.prettierrc.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "../shared/.prettierrc.json"
|
||||
}
|
2
packages/client/index.d.ts
vendored
2
packages/client/index.d.ts
vendored
@ -1,5 +1,5 @@
|
||||
interface Window {
|
||||
zESettings?: any;
|
||||
zESettings?: unknown;
|
||||
zE?: {
|
||||
apply: Function;
|
||||
};
|
||||
|
@ -60,6 +60,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.21.3",
|
||||
"@babel/eslint-parser": "^7.21.8",
|
||||
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
||||
"@babel/plugin-proposal-export-default-from": "^7.18.10",
|
||||
"@babel/plugin-transform-runtime": "^7.21.0",
|
||||
@ -68,16 +69,30 @@
|
||||
"@babel/preset-typescript": "^7.21.0",
|
||||
"@svgr/webpack": "^5.5.0",
|
||||
"@types/crypto-js": "^4.2.1",
|
||||
"@types/eslint": "^8.44.7",
|
||||
"@typescript-eslint/eslint-plugin": "^6.12.0",
|
||||
"@typescript-eslint/parser": "^6.12.0",
|
||||
"babel-loader": "^8.3.0",
|
||||
"clean-webpack-plugin": "^4.0.0",
|
||||
"copy-webpack-plugin": "^9.1.0",
|
||||
"css-loader": "^6.7.3",
|
||||
"eslint": "^8.54.0",
|
||||
"eslint-config-airbnb": "^19.0.4",
|
||||
"eslint-config-airbnb-typescript": "^17.1.0",
|
||||
"eslint-config-prettier": "^9.0.0",
|
||||
"eslint-plugin-import": "^2.29.0",
|
||||
"eslint-plugin-jsx-a11y": "^6.8.0",
|
||||
"eslint-plugin-prettier": "^5.0.1",
|
||||
"eslint-plugin-react": "^7.33.2",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"eslint-plugin-storybook": "^0.6.15",
|
||||
"external-remotes-plugin": "^1.0.0",
|
||||
"file-loader": "^6.2.0",
|
||||
"html-loader": "^4.2.0",
|
||||
"html-webpack-plugin": "5.5.0",
|
||||
"json-loader": "^0.5.7",
|
||||
"playwright": "^1.32.0",
|
||||
"prettier": "^3.1.0",
|
||||
"sass": "^1.59.3",
|
||||
"sass-loader": "^12.6.0",
|
||||
"serve": "14.2.0",
|
||||
|
@ -162,8 +162,8 @@ const FilesSelector = ({
|
||||
} = useLoadersHelper({ items });
|
||||
|
||||
useEffect(() => {
|
||||
setIsDataReady && setIsDataReady(!showLoader);
|
||||
}, [showLoader]);
|
||||
setIsDataReady?.(!showLoader);
|
||||
}, [showLoader, setIsDataReady]);
|
||||
|
||||
const { isRoot, setIsRoot, getRootData } = useRootHelper({
|
||||
setIsBreadCrumbsLoading,
|
||||
@ -312,7 +312,7 @@ const FilesSelector = ({
|
||||
setItems(null);
|
||||
|
||||
const idx = breadCrumbs.findIndex(
|
||||
(value) => value.id.toString() === item.id.toString()
|
||||
(value) => value.id.toString() === item.id.toString(),
|
||||
);
|
||||
|
||||
const maxLength = breadCrumbs.length - 1;
|
||||
@ -321,7 +321,7 @@ const FilesSelector = ({
|
||||
const newBreadCrumbs = breadCrumbs.map((item, index) => {
|
||||
if (!foundParentId) {
|
||||
currentFolderIndex = disabledItems.findIndex(
|
||||
(id) => id === item?.id
|
||||
(id) => id === item?.id,
|
||||
);
|
||||
}
|
||||
|
||||
@ -405,7 +405,7 @@ const FilesSelector = ({
|
||||
items: any,
|
||||
accessRights: any,
|
||||
fileName: string,
|
||||
isChecked: boolean
|
||||
isChecked: boolean,
|
||||
) => {
|
||||
const isPublic =
|
||||
breadCrumbs.findIndex((f: any) => f.roomType === RoomsType.PublicRoom) >
|
||||
@ -502,7 +502,7 @@ const FilesSelector = ({
|
||||
isMove,
|
||||
isSelect,
|
||||
filterParam,
|
||||
isRestore
|
||||
isRestore,
|
||||
);
|
||||
|
||||
const acceptButtonLabel = getAcceptButtonLabel(
|
||||
@ -513,7 +513,7 @@ const FilesSelector = ({
|
||||
isMove,
|
||||
isSelect,
|
||||
filterParam,
|
||||
isRestore
|
||||
isRestore,
|
||||
);
|
||||
|
||||
const isDisabled = getIsDisabled(
|
||||
@ -530,7 +530,7 @@ const FilesSelector = ({
|
||||
filterParam,
|
||||
!!selectedFileInfo,
|
||||
includeFolder,
|
||||
isRestore
|
||||
isRestore,
|
||||
);
|
||||
|
||||
const SelectorBody = (
|
||||
@ -644,7 +644,7 @@ export default inject(
|
||||
filesStore,
|
||||
infoPanelStore,
|
||||
}: any,
|
||||
{ isCopy, isRestoreAll, isMove, isRestore, isPanelVisible, id }: any
|
||||
{ isCopy, isRestoreAll, isMove, isRestore, isPanelVisible, id }: any,
|
||||
) => {
|
||||
const { id: selectedId, parentId, rootFolderType } = selectedFolderStore;
|
||||
|
||||
@ -770,5 +770,5 @@ export default inject(
|
||||
|
||||
roomsFolderId,
|
||||
};
|
||||
}
|
||||
},
|
||||
)(observer(FilesSelector));
|
||||
|
@ -123,9 +123,9 @@ const ContactContainer = (props) => {
|
||||
);
|
||||
};
|
||||
|
||||
export default inject(({ authStore, settingsStore, payments }) => {
|
||||
export default inject(({ authStore, settingsStore, paymentStore }) => {
|
||||
const { isCommunity } = authStore;
|
||||
const { helpUrl, salesEmail } = payments;
|
||||
const { helpUrl, salesEmail } = paymentStore;
|
||||
const { theme } = settingsStore;
|
||||
return { helpUrl, salesEmail, theme, isCommunity };
|
||||
})(observer(ContactContainer));
|
||||
|
@ -106,8 +106,8 @@ ChangePricingPlanDialog.propTypes = {
|
||||
onClose: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
export default inject(({ payments, currentQuotaStore }) => {
|
||||
const { managersCount, allowedStorageSizeByQuota } = payments;
|
||||
export default inject(({ paymentStore, currentQuotaStore }) => {
|
||||
const { managersCount, allowedStorageSizeByQuota } = paymentStore;
|
||||
|
||||
const { addedManagersCount, usedTotalStorageSizeCount } = currentQuotaStore;
|
||||
return {
|
||||
|
@ -7,7 +7,7 @@ import { Portal } from "@docspace/shared/components/portal";
|
||||
import { Base } from "@docspace/shared/themes";
|
||||
|
||||
import WrappedComponent from "SRC_DIR/helpers/plugins/WrappedComponent";
|
||||
import { PluginComponents } from "SRC_DIR/helpers/plugins/constants";
|
||||
import { PluginComponents } from "SRC_DIR/helpers/plugins/enums";
|
||||
import { messageActions } from "SRC_DIR/helpers/plugins/utils";
|
||||
|
||||
const StyledFullScreen = styled.div`
|
||||
@ -83,7 +83,7 @@ const PluginDialog = ({
|
||||
updateMainButtonItems,
|
||||
updateProfileMenuItems,
|
||||
updateEventListenerItems,
|
||||
updateFileItems
|
||||
updateFileItems,
|
||||
);
|
||||
};
|
||||
|
||||
@ -111,7 +111,7 @@ const PluginDialog = ({
|
||||
updateMainButtonItems,
|
||||
updateProfileMenuItems,
|
||||
updateEventListenerItems,
|
||||
updateFileItems
|
||||
updateFileItems,
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -198,8 +198,8 @@ SalesDepartmentRequestDialog.propTypes = {
|
||||
onClose: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
export default inject(({ payments }) => {
|
||||
const { sendPaymentRequest } = payments;
|
||||
export default inject(({ paymentStore }) => {
|
||||
const { sendPaymentRequest } = paymentStore;
|
||||
|
||||
return {
|
||||
sendPaymentRequest,
|
||||
|
@ -5,7 +5,7 @@ import { useTranslation } from "react-i18next";
|
||||
import { Button } from "@docspace/shared/components/button";
|
||||
import { ModalDialog } from "@docspace/shared/components/modal-dialog";
|
||||
|
||||
import { PluginComponents } from "SRC_DIR/helpers/plugins/constants";
|
||||
import { PluginComponents } from "SRC_DIR/helpers/plugins/enums";
|
||||
import WrappedComponent from "SRC_DIR/helpers/plugins/WrappedComponent";
|
||||
|
||||
import Header from "./sub-components/Header";
|
||||
|
@ -7,7 +7,7 @@ import { Text } from "@docspace/shared/components/text";
|
||||
import { Link } from "@docspace/shared/components/link";
|
||||
import { getCorrectDate, getCookie } from "@docspace/shared/utils";
|
||||
|
||||
import { PluginStatus } from "SRC_DIR/helpers/plugins/constants";
|
||||
import { PluginStatus } from "SRC_DIR/helpers/plugins/enums";
|
||||
import { Base } from "@docspace/shared/themes";
|
||||
|
||||
const StyledContainer = styled.div`
|
||||
@ -121,7 +121,7 @@ const Info = ({ t, plugin, withDelete, withSeparator }) => {
|
||||
lineHeight={"20px"}
|
||||
noSelect
|
||||
>
|
||||
{plugin.createBy}
|
||||
{plugin.createBy.displayName}
|
||||
</Text>
|
||||
</>
|
||||
)}
|
||||
|
@ -93,7 +93,7 @@ const ConfirmRoute = ({
|
||||
window.location.href = combineUrl(
|
||||
window.DocSpaceConfig?.proxy?.url,
|
||||
path,
|
||||
"/error"
|
||||
"/error",
|
||||
);
|
||||
break;
|
||||
case ValidationResult.Expired:
|
||||
@ -104,7 +104,7 @@ const ConfirmRoute = ({
|
||||
window.location.href = combineUrl(
|
||||
window.DocSpaceConfig?.proxy?.url,
|
||||
path,
|
||||
"/error"
|
||||
"/error",
|
||||
);
|
||||
break;
|
||||
case ValidationResult.TariffLimit:
|
||||
@ -115,7 +115,7 @@ const ConfirmRoute = ({
|
||||
window.location.href = combineUrl(
|
||||
window.DocSpaceConfig?.proxy?.url,
|
||||
path,
|
||||
"/error?messageKey=20"
|
||||
"/error?messageKey=20",
|
||||
);
|
||||
break;
|
||||
default:
|
||||
@ -126,7 +126,7 @@ const ConfirmRoute = ({
|
||||
window.location.href = combineUrl(
|
||||
window.DocSpaceConfig?.proxy?.url,
|
||||
path,
|
||||
"/error"
|
||||
"/error",
|
||||
);
|
||||
break;
|
||||
}
|
||||
@ -145,7 +145,7 @@ const ConfirmRoute = ({
|
||||
window.location.href = combineUrl(
|
||||
window.DocSpaceConfig?.proxy?.url,
|
||||
path,
|
||||
"/error"
|
||||
"/error",
|
||||
);
|
||||
});
|
||||
}, [getData, doAuthenticated, isAuthenticated, storeIsLoaded, logout]);
|
||||
|
@ -13,7 +13,7 @@ import { Button } from "@docspace/shared/components/button";
|
||||
import { ToggleButton } from "@docspace/shared/components/toggle-button";
|
||||
import { ComboBox } from "@docspace/shared/components/combobox";
|
||||
|
||||
import { PluginComponents } from "./constants";
|
||||
import { PluginComponents } from "./enums";
|
||||
|
||||
import { messageActions } from "./utils";
|
||||
|
||||
@ -74,7 +74,7 @@ const ComponentPure = ({
|
||||
component={item}
|
||||
pluginName={pluginName}
|
||||
/>
|
||||
)
|
||||
),
|
||||
);
|
||||
|
||||
return <Box {...elementProps}>{childrenComponents}</Box>;
|
||||
@ -110,7 +110,7 @@ const ComponentPure = ({
|
||||
updateMainButtonItems,
|
||||
updateProfileMenuItems,
|
||||
updateEventListenerItems,
|
||||
updateFileItems
|
||||
updateFileItems,
|
||||
);
|
||||
};
|
||||
|
||||
@ -139,7 +139,7 @@ const ComponentPure = ({
|
||||
updateMainButtonItems,
|
||||
updateProfileMenuItems,
|
||||
updateEventListenerItems,
|
||||
updateFileItems
|
||||
updateFileItems,
|
||||
);
|
||||
};
|
||||
|
||||
@ -168,11 +168,11 @@ const ComponentPure = ({
|
||||
updateMainButtonItems,
|
||||
updateProfileMenuItems,
|
||||
updateEventListenerItems,
|
||||
updateFileItems
|
||||
updateFileItems,
|
||||
);
|
||||
};
|
||||
|
||||
return <TextArea {...elementProps} onChange={onChangeAction} />;
|
||||
return <Textarea {...elementProps} onChange={onChangeAction} />;
|
||||
}
|
||||
|
||||
case PluginComponents.input: {
|
||||
@ -197,7 +197,7 @@ const ComponentPure = ({
|
||||
updateMainButtonItems,
|
||||
updateProfileMenuItems,
|
||||
updateEventListenerItems,
|
||||
updateFileItems
|
||||
updateFileItems,
|
||||
);
|
||||
};
|
||||
|
||||
@ -247,7 +247,7 @@ const ComponentPure = ({
|
||||
updateEventListenerItems,
|
||||
updateFileItems,
|
||||
|
||||
updatePlugin
|
||||
updatePlugin,
|
||||
);
|
||||
|
||||
setIsRequestRunning && setIsRequestRunning(false);
|
||||
@ -306,7 +306,7 @@ const ComponentPure = ({
|
||||
updateMainButtonItems,
|
||||
updateProfileMenuItems,
|
||||
updateEventListenerItems,
|
||||
updateFileItems
|
||||
updateFileItems,
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -5,7 +5,7 @@ import PluginHeader from "./PluginHeader";
|
||||
import PluginInfo from "./PluginInfo";
|
||||
import PluginSettings from "./PluginSettings";
|
||||
|
||||
import { PluginScopes } from "../constants";
|
||||
import { PluginScopes } from "../enums";
|
||||
|
||||
const StyledPlugin = styled.div`
|
||||
display: flex;
|
||||
@ -79,7 +79,7 @@ const Plugin = ({
|
||||
author={author}
|
||||
status={status}
|
||||
description={description}
|
||||
createBy={createBy}
|
||||
createBy={createBy.displayName}
|
||||
createOn={createOn}
|
||||
homePage={homePage}
|
||||
url={url}
|
||||
|
@ -4,7 +4,7 @@ import styled from "styled-components";
|
||||
import { Text } from "@docspace/shared/components/text";
|
||||
import { getCorrectDate } from "@docspace/shared/utils";
|
||||
|
||||
import { PluginStatus } from "SRC_DIR/helpers/plugins/constants";
|
||||
import { PluginStatus } from "SRC_DIR/helpers/plugins/enums";
|
||||
import { Link } from "@docspace/shared/components/link";
|
||||
|
||||
import { getPluginUrl } from "../utils";
|
||||
|
@ -3,7 +3,7 @@ import styled from "styled-components";
|
||||
|
||||
import WrappedComponent from "../WrappedComponent";
|
||||
|
||||
import { PluginComponents } from "../constants";
|
||||
import { PluginComponents } from "../enums";
|
||||
|
||||
const StyledPluginSettings = styled.div`
|
||||
.settings-header {
|
||||
|
@ -1,87 +0,0 @@
|
||||
export const PluginFileType = Object.freeze({
|
||||
Files: "file",
|
||||
Folders: "folder",
|
||||
Rooms: "room",
|
||||
Image: "image",
|
||||
Video: "video",
|
||||
});
|
||||
|
||||
export const PluginScopes = Object.freeze({
|
||||
API: "API",
|
||||
Settings: "Settings",
|
||||
ContextMenu: "ContextMenu",
|
||||
InfoPanel: "InfoPanel",
|
||||
MainButton: "MainButton",
|
||||
ProfileMenu: "ProfileMenu",
|
||||
EventListener: "EventListener",
|
||||
File: "File",
|
||||
});
|
||||
|
||||
export const PluginStatus = Object.freeze({
|
||||
active: "active",
|
||||
hide: "hide",
|
||||
});
|
||||
|
||||
export const PluginActions = Object.freeze({
|
||||
updateProps: "update-props",
|
||||
updateContext: "update-context",
|
||||
|
||||
updateStatus: "update-status",
|
||||
|
||||
showToast: "show-toast",
|
||||
|
||||
// showSettingsModal: "show-settings-modal",
|
||||
// closeSettingsModal: "close-settings-modal",
|
||||
|
||||
showCreateDialogModal: "show-create-dialog-modal",
|
||||
|
||||
showModal: "show-modal",
|
||||
closeModal: "close-modal",
|
||||
|
||||
updateContextMenuItems: "update-context-menu-items",
|
||||
updateInfoPanelItems: "update-info-panel-items",
|
||||
updateMainButtonItems: "update-main-button-items",
|
||||
updateProfileMenuItems: "update-profile-menu-items",
|
||||
updateFileItems: "update-file-items",
|
||||
updateEventListenerItems: "update-event-listener-items",
|
||||
|
||||
sendPostMessage: "send-post-message",
|
||||
|
||||
saveSettings: "save-settings",
|
||||
});
|
||||
|
||||
export const PluginToastType = Object.freeze({
|
||||
success: "success",
|
||||
error: "error",
|
||||
warning: "warning",
|
||||
info: "info",
|
||||
});
|
||||
|
||||
export const PluginComponents = Object.freeze({
|
||||
box: "box",
|
||||
button: "button",
|
||||
checkbox: "checkbox",
|
||||
input: "input",
|
||||
label: "label",
|
||||
text: "text",
|
||||
textArea: "textArea",
|
||||
toggleButton: "toggleButton",
|
||||
img: "img",
|
||||
iFrame: "iFrame",
|
||||
comboBox: "comboBox",
|
||||
skeleton: "skeleton",
|
||||
});
|
||||
|
||||
export const PluginUsersType = Object.freeze({
|
||||
owner: "Owner",
|
||||
docSpaceAdmin: "DocSpaceAdmin",
|
||||
roomAdmin: "RoomAdmin",
|
||||
collaborator: "Collaborator",
|
||||
user: "User",
|
||||
});
|
||||
|
||||
export const PluginDevices = Object.freeze({
|
||||
mobile: "mobile",
|
||||
tablet: "tablet",
|
||||
desktop: "desktop",
|
||||
});
|
97
packages/client/src/helpers/plugins/enums.ts
Normal file
97
packages/client/src/helpers/plugins/enums.ts
Normal file
@ -0,0 +1,97 @@
|
||||
export const enum PluginFileType {
|
||||
Files = "file",
|
||||
Folders = "folder",
|
||||
Rooms = "room",
|
||||
Image = "image",
|
||||
Video = "video",
|
||||
}
|
||||
|
||||
export const enum PluginEvents {
|
||||
CREATE = "create",
|
||||
RENAME = "rename",
|
||||
ROOM_CREATE = "create_room",
|
||||
ROOM_EDIT = "edit_room",
|
||||
CHANGE_COLUMN = "change_column",
|
||||
CHANGE_USER_TYPE = "change_user_type",
|
||||
CREATE_PLUGIN_FILE = "create_plugin_file",
|
||||
}
|
||||
|
||||
export const enum PluginScopes {
|
||||
API = "API",
|
||||
Settings = "Settings",
|
||||
ContextMenu = "ContextMenu",
|
||||
InfoPanel = "InfoPanel",
|
||||
MainButton = "MainButton",
|
||||
ProfileMenu = "ProfileMenu",
|
||||
EventListener = "EventListener",
|
||||
File = "File",
|
||||
}
|
||||
|
||||
export const enum PluginStatus {
|
||||
active = "active",
|
||||
hide = "hide",
|
||||
}
|
||||
|
||||
export const enum PluginActions {
|
||||
updateProps = "update-props",
|
||||
updateContext = "update-context",
|
||||
|
||||
updateStatus = "update-status",
|
||||
|
||||
showToast = "show-toast",
|
||||
|
||||
// showSettingsModal= "show-settings-modal",
|
||||
// closeSettingsModal= "close-settings-modal",
|
||||
|
||||
showCreateDialogModal = "show-create-dialog-modal",
|
||||
|
||||
showModal = "show-modal",
|
||||
closeModal = "close-modal",
|
||||
|
||||
updateContextMenuItems = "update-context-menu-items",
|
||||
updateInfoPanelItems = "update-info-panel-items",
|
||||
updateMainButtonItems = "update-main-button-items",
|
||||
updateProfileMenuItems = "update-profile-menu-items",
|
||||
updateFileItems = "update-file-items",
|
||||
updateEventListenerItems = "update-event-listener-items",
|
||||
|
||||
sendPostMessage = "send-post-message",
|
||||
|
||||
saveSettings = "save-settings",
|
||||
}
|
||||
|
||||
export const enum PluginToastType {
|
||||
success = "success",
|
||||
error = "error",
|
||||
warning = "warning",
|
||||
info = "info",
|
||||
}
|
||||
|
||||
export const enum PluginComponents {
|
||||
box = "box",
|
||||
button = "button",
|
||||
checkbox = "checkbox",
|
||||
input = "input",
|
||||
label = "label",
|
||||
text = "text",
|
||||
textArea = "textArea",
|
||||
toggleButton = "toggleButton",
|
||||
img = "img",
|
||||
iFrame = "iFrame",
|
||||
comboBox = "comboBox",
|
||||
skeleton = "skeleton",
|
||||
}
|
||||
|
||||
export const enum PluginUsersType {
|
||||
owner = "Owner",
|
||||
docSpaceAdmin = "DocSpaceAdmin",
|
||||
roomAdmin = "RoomAdmin",
|
||||
collaborator = "Collaborator",
|
||||
user = "User",
|
||||
}
|
||||
|
||||
export const enum PluginDevices {
|
||||
mobile = "mobile",
|
||||
tablet = "tablet",
|
||||
desktop = "desktop",
|
||||
}
|
275
packages/client/src/helpers/plugins/types.ts
Normal file
275
packages/client/src/helpers/plugins/types.ts
Normal file
@ -0,0 +1,275 @@
|
||||
import { TCreatedBy } from "@docspace/shared/types";
|
||||
import { ButtonProps } from "@docspace/shared/components/button/Button.types";
|
||||
import { BoxProps } from "@docspace/shared/components/box/Box.types";
|
||||
import { TextInputProps } from "@docspace/shared/components/text-input";
|
||||
import { CheckboxProps } from "@docspace/shared/components/checkbox/Checkbox.types";
|
||||
import { ToggleButtonProps } from "@docspace/shared/components/toggle-button/ToggleButton.types";
|
||||
import { TextareaProps } from "@docspace/shared/components/textarea/Textarea.types";
|
||||
import {
|
||||
ComboboxProps,
|
||||
TOption,
|
||||
} from "@docspace/shared/components/combobox/Combobox.types";
|
||||
import { ToastProps } from "@docspace/shared/components/toast/Toast.type";
|
||||
import { ModalDialogProps } from "@docspace/shared/components/modal-dialog/ModalDialog.types";
|
||||
import { TextProps } from "@docspace/shared/components/text/Text.types";
|
||||
import { RectangleSkeletonProps } from "@docspace/shared/skeletons";
|
||||
import { LabelProps } from "@docspace/shared/components/label/Label.types";
|
||||
import {
|
||||
TFile,
|
||||
TFileSecurity,
|
||||
TFolderSecurity,
|
||||
} from "@docspace/shared/api/files/types";
|
||||
import { TRoomSecurity } from "@docspace/shared/api/rooms/types";
|
||||
|
||||
import {
|
||||
PluginActions,
|
||||
PluginComponents,
|
||||
PluginDevices,
|
||||
PluginEvents,
|
||||
PluginFileType,
|
||||
PluginStatus,
|
||||
PluginUsersType,
|
||||
} from "./enums";
|
||||
|
||||
export interface IPostMessage {
|
||||
frameId: string;
|
||||
message: { [key: string]: unknown };
|
||||
}
|
||||
|
||||
export interface IFrame {
|
||||
src: string;
|
||||
width?: string;
|
||||
height?: string;
|
||||
name?: string;
|
||||
sandbox?: string;
|
||||
id?: string;
|
||||
style?: { [key: string]: string };
|
||||
}
|
||||
|
||||
export interface ICreateDialog {
|
||||
title: string;
|
||||
startValue: string;
|
||||
visible: boolean;
|
||||
options?: TOption[];
|
||||
selectedOption?: TOption;
|
||||
onSelect?: (option: TOption) => IMessage | void;
|
||||
onSave?: (
|
||||
e: unknown,
|
||||
value: string,
|
||||
) => Promise<IMessage> | Promise<void> | IMessage | void;
|
||||
onCancel?: (e: unknown) => void;
|
||||
onClose?: (e: unknown) => void;
|
||||
isCreateDialog: boolean;
|
||||
extension?: string;
|
||||
}
|
||||
|
||||
export interface IImage {
|
||||
src: string;
|
||||
alt: string;
|
||||
width?: string;
|
||||
height?: string;
|
||||
name?: string;
|
||||
id?: string;
|
||||
style?: { [key: string]: string };
|
||||
}
|
||||
|
||||
export interface IMessage {
|
||||
actions?: PluginActions[];
|
||||
newProps?:
|
||||
| TextInputProps
|
||||
| CheckboxProps
|
||||
| ToggleButtonProps
|
||||
| ButtonProps
|
||||
| TextareaProps
|
||||
| ComboboxProps;
|
||||
toastProps?: ToastProps[];
|
||||
contextProps?: {
|
||||
name: string;
|
||||
props:
|
||||
| BoxProps
|
||||
| ButtonProps
|
||||
| CheckboxProps
|
||||
| ComboboxProps
|
||||
| IFrame
|
||||
| IImage
|
||||
| TextInputProps
|
||||
| LabelProps
|
||||
| RectangleSkeletonProps
|
||||
| TextProps
|
||||
| TextareaProps
|
||||
| ToggleButtonProps;
|
||||
}[];
|
||||
createDialogProps?: ICreateDialog;
|
||||
modalDialogProps?: ModalDialogProps;
|
||||
postMessage?: IPostMessage;
|
||||
settings?: string;
|
||||
}
|
||||
|
||||
type TButtonGroup = {
|
||||
component: PluginComponents.button;
|
||||
props: ButtonProps;
|
||||
contextName?: string;
|
||||
};
|
||||
|
||||
export interface ISettings {
|
||||
settings: BoxProps;
|
||||
saveButton: TButtonGroup;
|
||||
isLoading?: boolean;
|
||||
onLoad?: () => Promise<{ settings: BoxProps; saveButton?: TButtonGroup }>;
|
||||
}
|
||||
|
||||
export interface IContextMenuItem {
|
||||
key: string;
|
||||
label: string;
|
||||
icon: string;
|
||||
onClick: (id: number) => Promise<IMessage> | Promise<void> | IMessage | void;
|
||||
withActiveItem?: boolean;
|
||||
fileExt?: string[];
|
||||
fileType?: PluginFileType[];
|
||||
usersTypes?: PluginUsersType[];
|
||||
devices?: PluginDevices[];
|
||||
security?: (
|
||||
| keyof TRoomSecurity
|
||||
| keyof TFileSecurity
|
||||
| keyof TFolderSecurity
|
||||
)[];
|
||||
pluginName?: string;
|
||||
}
|
||||
|
||||
export interface IEventListenerItem {
|
||||
key: string;
|
||||
eventType: PluginEvents;
|
||||
eventHandler: () => Promise<IMessage> | Promise<void> | IMessage | void;
|
||||
usersTypes?: PluginUsersType[];
|
||||
devices?: PluginDevices[];
|
||||
pluginName?: string;
|
||||
}
|
||||
|
||||
export interface IFileItem {
|
||||
extension: string;
|
||||
onClick: (item: TFile) => Promise<IMessage> | Promise<void> | IMessage | void;
|
||||
usersType?: PluginUsersType[];
|
||||
devices?: PluginDevices[];
|
||||
fileTypeName?: string;
|
||||
fileRowIcon?: string;
|
||||
fileTileIcon?: string;
|
||||
fileIcon?: string;
|
||||
fileIconTile?: string;
|
||||
pluginName?: string;
|
||||
}
|
||||
|
||||
export interface IInfoPanelSubMenu {
|
||||
name: string;
|
||||
onClick?: (id: number) => Promise<IMessage> | Promise<void> | IMessage | void;
|
||||
}
|
||||
|
||||
export interface IInfoPanelItem {
|
||||
key: string;
|
||||
subMenu: IInfoPanelSubMenu;
|
||||
body: BoxProps;
|
||||
onLoad: () => Promise<{ body: BoxProps }>;
|
||||
filesType?: PluginFileType[];
|
||||
filesExsts?: string[];
|
||||
usersTypes?: PluginUsersType[];
|
||||
devices?: PluginDevices[];
|
||||
pluginName?: string;
|
||||
}
|
||||
|
||||
export interface IMainButtonItem {
|
||||
key: string;
|
||||
label: string;
|
||||
icon: string;
|
||||
onClick?: (
|
||||
id: number | string,
|
||||
) => Promise<IMessage> | Promise<void> | IMessage | void;
|
||||
usersType?: PluginUsersType[];
|
||||
items?: IMainButtonItem[] | null;
|
||||
devices?: PluginDevices[];
|
||||
pluginName?: string;
|
||||
}
|
||||
|
||||
export interface IProfileMenuItem {
|
||||
key: string;
|
||||
label: string;
|
||||
icon: string;
|
||||
onClick: () => Promise<IMessage> | Promise<void> | IMessage | void;
|
||||
usersType?: PluginUsersType[];
|
||||
devices?: PluginDevices[];
|
||||
pluginName?: string;
|
||||
}
|
||||
|
||||
export interface IframeWindow extends Window {
|
||||
Plugins: { [key: string]: TPlugin };
|
||||
}
|
||||
|
||||
export type TPlugin = {
|
||||
name: string;
|
||||
version: string;
|
||||
description: string;
|
||||
license: string;
|
||||
author: string;
|
||||
homePage: string;
|
||||
pluginName: string;
|
||||
scopes: string | string[];
|
||||
image: string;
|
||||
createBy: TCreatedBy;
|
||||
createOn: Date;
|
||||
enabled: boolean;
|
||||
system: boolean;
|
||||
url: string;
|
||||
settings: string;
|
||||
iconUrl: string;
|
||||
|
||||
status: PluginStatus;
|
||||
onLoadCallback: () => Promise<void>;
|
||||
updateStatus: (status: PluginStatus) => void;
|
||||
getStatus: () => PluginStatus;
|
||||
setOnLoadCallback: (callback: () => Promise<void>) => void;
|
||||
|
||||
adminPluginSettings?: ISettings | null;
|
||||
setAdminPluginSettings?: (settings: ISettings | null) => void;
|
||||
setAdminPluginSettingsValue?: (settings: string | null) => void;
|
||||
getAdminPluginSettings?: () => ISettings | null;
|
||||
|
||||
origin?: string;
|
||||
proxy?: string;
|
||||
prefix?: string;
|
||||
setOrigin?: (origin: string) => void;
|
||||
setProxy?: (proxy: string) => void;
|
||||
setPrefix?: (prefix: string) => void;
|
||||
getOrigin?: () => string;
|
||||
getProxy?: () => string;
|
||||
getPrefix?: () => string;
|
||||
setAPI?: (origin: string, proxy: string, prefix: string) => void;
|
||||
getAPI?: () => { origin: string; proxy: string; prefix: string };
|
||||
|
||||
contextMenuItems: Map<string, IContextMenuItem>;
|
||||
addContextMenuItem(item: IContextMenuItem): void;
|
||||
getContextMenuItems(): Map<string, IContextMenuItem>;
|
||||
getContextMenuItemsKeys(): string[];
|
||||
updateContextMenuItem(item: IContextMenuItem): void;
|
||||
|
||||
eventListenerItems?: Map<string, IEventListenerItem>;
|
||||
addEventListenerItem?: (item: IEventListenerItem) => void;
|
||||
getEventListenerItems?: () => Map<string, IEventListenerItem>;
|
||||
|
||||
fileItems?: Map<string, IFileItem>;
|
||||
addFileItem?: (item: IFileItem) => void;
|
||||
getFileItems?: () => Map<string, IFileItem>;
|
||||
updateFileItem?: (item: IFileItem) => void;
|
||||
|
||||
infoPanelItems?: Map<string, IInfoPanelItem>;
|
||||
addInfoPanelItem?: (item: IInfoPanelItem) => void;
|
||||
getInfoPanelItems?: () => Map<string, IInfoPanelItem>;
|
||||
updateInfoPanelItem?: (item: IInfoPanelItem) => void;
|
||||
|
||||
mainButtonItems?: Map<string, IMainButtonItem>;
|
||||
addMainButtonItem?: (item: IMainButtonItem) => void;
|
||||
getMainButtonItems?: () => Map<string, IMainButtonItem>;
|
||||
updateMainButtonItem?: (item: IMainButtonItem) => void;
|
||||
|
||||
profileMenuItems?: Map<string, IProfileMenuItem>;
|
||||
addProfileMenuItem?: (item: IProfileMenuItem) => void;
|
||||
getProfileMenuItems?: () => Map<string, IProfileMenuItem>;
|
||||
updateProfileMenuItem?: (item: IProfileMenuItem) => void;
|
||||
};
|
@ -3,7 +3,7 @@ import { toastr } from "@docspace/shared/components/toast";
|
||||
|
||||
import config from "PACKAGE_FILE";
|
||||
|
||||
import { PluginActions, PluginToastType } from "./constants";
|
||||
import { PluginActions, PluginToastType } from "./enums";
|
||||
import { Events } from "@docspace/shared/enums";
|
||||
|
||||
export const messageActions = (
|
||||
@ -26,7 +26,7 @@ export const messageActions = (
|
||||
updateEventListenerItems,
|
||||
updateFileItems,
|
||||
|
||||
updatePlugin
|
||||
updatePlugin,
|
||||
) => {
|
||||
if (!message || !message.actions || message.actions.length === 0) return;
|
||||
|
||||
@ -152,7 +152,7 @@ export const messageActions = (
|
||||
if (frame) {
|
||||
frame.contentWindow.postMessage(
|
||||
JSON.stringify(postMessage.message),
|
||||
"*"
|
||||
"*",
|
||||
);
|
||||
}
|
||||
|
||||
@ -177,6 +177,6 @@ export const getPluginUrl = (url, file) => {
|
||||
window.DocSpaceConfig?.proxy?.url,
|
||||
config.homepage,
|
||||
path,
|
||||
file
|
||||
file,
|
||||
);
|
||||
};
|
||||
|
@ -7,7 +7,7 @@ import { FolderType, ShareAccessRights } from "@docspace/shared/enums";
|
||||
import { translations } from "./autoGeneratedTranslations";
|
||||
// import router from "SRC_DIR/router";
|
||||
|
||||
export const setDocumentTitle = (subTitle = null) => {
|
||||
export const setDocumentTitle = (subTitle = "") => {
|
||||
const { isAuthenticated, product: currentModule } = authStore;
|
||||
const { organizationName } = settingsStore;
|
||||
|
||||
|
@ -32,8 +32,8 @@ const Bonus = ({ standaloneInit, isInitPaymentPage }) => {
|
||||
);
|
||||
};
|
||||
|
||||
export default inject(({ payments }) => {
|
||||
const { standaloneInit, isInitPaymentPage } = payments;
|
||||
export default inject(({ paymentStore }) => {
|
||||
const { standaloneInit, isInitPaymentPage } = paymentStore;
|
||||
|
||||
return {
|
||||
standaloneInit,
|
||||
|
@ -2,7 +2,7 @@ import React from "react";
|
||||
import { inject, observer } from "mobx-react";
|
||||
|
||||
import WrappedComponent from "SRC_DIR/helpers/plugins/WrappedComponent";
|
||||
import { PluginComponents } from "SRC_DIR/helpers/plugins/constants";
|
||||
import { PluginComponents } from "SRC_DIR/helpers/plugins/enums";
|
||||
|
||||
const Plugin = ({ boxProps, pluginName }) => {
|
||||
return (
|
||||
|
@ -15,7 +15,7 @@ import {
|
||||
|
||||
import { StyledInfoPanelHeader } from "./styles/common";
|
||||
|
||||
import { PluginFileType } from "SRC_DIR/helpers/plugins/constants";
|
||||
import { PluginFileType } from "SRC_DIR/helpers/plugins/enums";
|
||||
|
||||
const InfoPanelHeaderContent = (props) => {
|
||||
const {
|
||||
@ -245,12 +245,12 @@ export default inject(
|
||||
|
||||
enablePlugins,
|
||||
};
|
||||
}
|
||||
},
|
||||
)(
|
||||
withTranslation(["Common", "InfoPanel"])(
|
||||
InfoPanelHeaderContent
|
||||
InfoPanelHeaderContent,
|
||||
// withLoader(observer(InfoPanelHeaderContent))(
|
||||
// <Loaders.InfoPanelHeaderLoader />
|
||||
// )
|
||||
)
|
||||
),
|
||||
);
|
||||
|
@ -4,7 +4,7 @@ import { withTranslation } from "react-i18next";
|
||||
import { useNavigate, useLocation } from "react-router-dom";
|
||||
import queryString from "query-string";
|
||||
|
||||
import { PluginFileType } from "SRC_DIR/helpers/plugins/constants";
|
||||
import { PluginFileType } from "SRC_DIR/helpers/plugins/enums";
|
||||
import { MEDIA_VIEW_URL } from "@docspace/shared/constants";
|
||||
import { combineUrl } from "@docspace/shared/utils/combineUrl";
|
||||
|
||||
@ -118,7 +118,7 @@ const FilesMediaViewer = (props) => {
|
||||
setCurrentId(id);
|
||||
navigate(url);
|
||||
},
|
||||
[setCurrentId, navigate]
|
||||
[setCurrentId, navigate],
|
||||
);
|
||||
|
||||
const resetSelection = () => {
|
||||
@ -159,7 +159,7 @@ const FilesMediaViewer = (props) => {
|
||||
// try to fix with one check later (see deleteAction)
|
||||
const isActiveFile = activeFiles.find((elem) => elem.id === file.id);
|
||||
const isActiveFolder = activeFolders.find(
|
||||
(elem) => elem.id === file.id
|
||||
(elem) => elem.id === file.id,
|
||||
);
|
||||
|
||||
if (isActiveFile || isActiveFolder) return;
|
||||
@ -169,7 +169,14 @@ const FilesMediaViewer = (props) => {
|
||||
}
|
||||
}
|
||||
},
|
||||
[files, t, activeFiles, activeFolders, setRemoveMediaItem, deleteItemAction]
|
||||
[
|
||||
files,
|
||||
t,
|
||||
activeFiles,
|
||||
activeFolders,
|
||||
setRemoveMediaItem,
|
||||
deleteItemAction,
|
||||
],
|
||||
);
|
||||
|
||||
const onDownloadMediaFile = useCallback(
|
||||
@ -179,7 +186,7 @@ const FilesMediaViewer = (props) => {
|
||||
return window.open(viewUrlFile, "_self");
|
||||
}
|
||||
},
|
||||
[playlist]
|
||||
[playlist],
|
||||
);
|
||||
|
||||
const onMediaViewerClose = useCallback(
|
||||
@ -227,7 +234,7 @@ const FilesMediaViewer = (props) => {
|
||||
setToPreviewFile,
|
||||
setMediaViewerData,
|
||||
setBufferSelection,
|
||||
]
|
||||
],
|
||||
);
|
||||
useEffect(() => {
|
||||
if (playlist.length === 0 && isOpenMediaViewer) onMediaViewerClose();
|
||||
@ -422,5 +429,5 @@ export default inject(
|
||||
pluginContextMenuItems,
|
||||
currentDeviceType,
|
||||
};
|
||||
}
|
||||
},
|
||||
)(withTranslation(["Files", "Translations"])(observer(FilesMediaViewer)));
|
||||
|
@ -283,7 +283,7 @@ const AdditionalResources = (props) => {
|
||||
);
|
||||
};
|
||||
|
||||
export default inject(({ filesSettingsStore, common, currentQuotaStore }) => {
|
||||
export default inject(({ settingsStore, common, currentQuotaStore }) => {
|
||||
const { setIsLoadedAdditionalResources, isLoadedAdditionalResources } =
|
||||
common;
|
||||
|
||||
@ -292,7 +292,7 @@ export default inject(({ filesSettingsStore, common, currentQuotaStore }) => {
|
||||
|
||||
additionalResourcesData,
|
||||
additionalResourcesIsDefault,
|
||||
} = filesSettingsStore;
|
||||
} = settingsStore;
|
||||
|
||||
const { isBrandingAndCustomizationAvailable } = currentQuotaStore;
|
||||
|
||||
|
@ -148,7 +148,7 @@ const WhiteLabel = (props) => {
|
||||
|
||||
const onRestoreDefault = async () => {
|
||||
try {
|
||||
await restoreWhiteLabelSettings(true);
|
||||
await restoreWhiteLabelSettings();
|
||||
await onResetCompanyName();
|
||||
toastr.success(t("Settings:SuccessfullySaveSettingsMessage"));
|
||||
} catch (error) {
|
||||
|
@ -23,6 +23,7 @@ const SubmenuCommon = (props) => {
|
||||
isLoadedSubmenu,
|
||||
getWhiteLabelLogoUrls,
|
||||
currentDeviceType,
|
||||
isMobileView,
|
||||
} = props;
|
||||
const navigate = useNavigate();
|
||||
|
||||
@ -41,7 +42,10 @@ const SubmenuCommon = (props) => {
|
||||
}, [tReady, isLoadedSubmenu]);
|
||||
|
||||
const load = async () => {
|
||||
await loadBaseInfo();
|
||||
const currentTab = getCurrentTab();
|
||||
await loadBaseInfo(
|
||||
!isMobileView ? (currentTab === 0 ? "general" : "branding") : ""
|
||||
);
|
||||
};
|
||||
|
||||
const data = [
|
||||
@ -111,13 +115,14 @@ export default inject(({ settingsStore, common }) => {
|
||||
|
||||
const isMobileView = currentDeviceType === DeviceType.mobile;
|
||||
return {
|
||||
loadBaseInfo: async () => {
|
||||
await initSettings(!isMobileView ? "general" : "");
|
||||
loadBaseInfo: async (page) => {
|
||||
await initSettings(page);
|
||||
},
|
||||
isLoaded,
|
||||
setIsLoadedSubmenu,
|
||||
isLoadedSubmenu,
|
||||
getWhiteLabelLogoUrls,
|
||||
currentDeviceType,
|
||||
isMobileView,
|
||||
};
|
||||
})(withLoading(withTranslation("Settings")(observer(SubmenuCommon))));
|
||||
|
@ -60,7 +60,7 @@ const TableView = ({
|
||||
if (columns != tagCount) setTagCount(columns);
|
||||
}
|
||||
},
|
||||
[tagCount]
|
||||
[tagCount],
|
||||
);
|
||||
|
||||
const onSetTagRef = React.useCallback((node: HTMLDivElement) => {
|
||||
@ -85,7 +85,7 @@ const TableView = ({
|
||||
|
||||
setSelection && setSelection("");
|
||||
},
|
||||
[setSelection]
|
||||
[setSelection],
|
||||
);
|
||||
|
||||
React.useEffect(() => {
|
||||
@ -102,7 +102,7 @@ const TableView = ({
|
||||
async ({ startIndex }: { startIndex: number; stopIndex: number }) => {
|
||||
await fetchNextClients?.(startIndex);
|
||||
},
|
||||
[]
|
||||
[],
|
||||
);
|
||||
|
||||
return (
|
||||
@ -177,5 +177,5 @@ export default inject(
|
||||
itemCount,
|
||||
fetchNextClients,
|
||||
};
|
||||
}
|
||||
},
|
||||
)(observer(TableView));
|
||||
|
@ -8,7 +8,7 @@ import PluginSettingsIconUrl from "PUBLIC_DIR/images/plugin.settings.react.svg?u
|
||||
import PluginDefaultLogoUrl from "PUBLIC_DIR/images/plugin.default-logo.png";
|
||||
|
||||
import { getPluginUrl } from "SRC_DIR/helpers/plugins/utils";
|
||||
import { PluginScopes } from "SRC_DIR/helpers/plugins/constants";
|
||||
import { PluginScopes } from "SRC_DIR/helpers/plugins/enums";
|
||||
|
||||
import { StyledPluginItem, StyledPluginHeader } from "../StyledPlugins";
|
||||
|
||||
|
@ -41,8 +41,8 @@ const ContactContainer = ({ t, salesEmail }) => {
|
||||
);
|
||||
};
|
||||
|
||||
export default inject(({ payments, settingsStore }) => {
|
||||
const { salesEmail } = payments;
|
||||
export default inject(({ paymentStore, settingsStore }) => {
|
||||
const { salesEmail } = paymentStore;
|
||||
return {
|
||||
salesEmail,
|
||||
theme: settingsStore.theme,
|
||||
|
@ -233,8 +233,8 @@ const PayerInformationContainer = ({
|
||||
};
|
||||
|
||||
export default inject(
|
||||
({ settingsStore, payments, userStore, currentTariffStatusStore }) => {
|
||||
const { accountLink, isStripePortalAvailable } = payments;
|
||||
({ settingsStore, paymentStore, userStore, currentTariffStatusStore }) => {
|
||||
const { accountLink, isStripePortalAvailable } = paymentStore;
|
||||
const { theme } = settingsStore;
|
||||
const { customerId, isGracePeriod, isNotPaidPeriod, payerInfo } =
|
||||
currentTariffStatusStore;
|
||||
@ -250,5 +250,5 @@ export default inject(
|
||||
isGracePeriod,
|
||||
isNotPaidPeriod,
|
||||
};
|
||||
}
|
||||
},
|
||||
)(observer(PayerInformationContainer));
|
||||
|
@ -339,7 +339,7 @@ export default inject(
|
||||
({
|
||||
settingsStore,
|
||||
currentQuotaStore,
|
||||
payments,
|
||||
paymentStore,
|
||||
paymentQuotasStore,
|
||||
currentTariffStatusStore,
|
||||
}) => {
|
||||
@ -363,7 +363,7 @@ export default inject(
|
||||
const { planCost, tariffPlanTitle, portalPaymentQuotas } =
|
||||
paymentQuotasStore;
|
||||
|
||||
const { isAlreadyPaid } = payments;
|
||||
const { isAlreadyPaid } = paymentStore;
|
||||
|
||||
return {
|
||||
paymentDate,
|
||||
@ -390,5 +390,5 @@ export default inject(
|
||||
isNonProfit,
|
||||
isPaymentDateValid,
|
||||
};
|
||||
}
|
||||
},
|
||||
)(observer(PaymentContainer));
|
||||
|
@ -179,7 +179,7 @@ const PriceCalculation = ({
|
||||
export default inject(
|
||||
({
|
||||
settingsStore,
|
||||
payments,
|
||||
paymentStore,
|
||||
paymentQuotasStore,
|
||||
currentTariffStatusStore,
|
||||
}) => {
|
||||
@ -193,7 +193,7 @@ export default inject(
|
||||
isAlreadyPaid,
|
||||
getPaymentLink,
|
||||
canUpdateTariff,
|
||||
} = payments;
|
||||
} = paymentStore;
|
||||
const { theme } = settingsStore;
|
||||
|
||||
const { planCost } = paymentQuotasStore;
|
||||
@ -217,5 +217,5 @@ export default inject(
|
||||
currencySymbol: planCost.currencySymbol,
|
||||
getPaymentLink,
|
||||
};
|
||||
}
|
||||
},
|
||||
)(observer(PriceCalculation));
|
||||
|
@ -42,7 +42,7 @@ const SaaSPage = ({
|
||||
setEncryptionKeys,
|
||||
false,
|
||||
null,
|
||||
t
|
||||
t,
|
||||
);
|
||||
}
|
||||
return () => resetTariffContainerToBasic();
|
||||
@ -72,7 +72,7 @@ export default inject(
|
||||
({
|
||||
authStore,
|
||||
settingsStore,
|
||||
payments,
|
||||
paymentStore,
|
||||
userStore,
|
||||
currentQuotaStore,
|
||||
currentTariffStatusStore,
|
||||
@ -90,7 +90,7 @@ export default inject(
|
||||
init,
|
||||
isUpdatingBasicSettings,
|
||||
resetTariffContainerToBasic,
|
||||
} = payments;
|
||||
} = paymentStore;
|
||||
const {
|
||||
isEncryptionSupport,
|
||||
setEncryptionKeys,
|
||||
@ -116,5 +116,5 @@ export default inject(
|
||||
isLoadedCurrentQuota,
|
||||
isUpdatingBasicSettings,
|
||||
};
|
||||
}
|
||||
},
|
||||
)(observer(SaaSPage));
|
||||
|
@ -49,8 +49,8 @@ const ButtonContainer = ({
|
||||
);
|
||||
};
|
||||
|
||||
export default inject(({ currentTariffStatusStore, payments }) => {
|
||||
const { isNeedRequest, isLoading, accountLink } = payments;
|
||||
export default inject(({ currentTariffStatusStore, paymentStore }) => {
|
||||
const { isNeedRequest, isLoading, accountLink } = paymentStore;
|
||||
const { isNotPaidPeriod, isGracePeriod } = currentTariffStatusStore;
|
||||
|
||||
return {
|
||||
|
@ -59,7 +59,7 @@ const DowngradePlanButtonContainer = ({
|
||||
);
|
||||
};
|
||||
|
||||
export default inject(({ payments }) => {
|
||||
export default inject(({ paymentStore }) => {
|
||||
const {
|
||||
isLoading,
|
||||
isLessCountThanAcceptable,
|
||||
@ -67,7 +67,7 @@ export default inject(({ payments }) => {
|
||||
canPayTariff,
|
||||
|
||||
isAlreadyPaid,
|
||||
} = payments;
|
||||
} = paymentStore;
|
||||
|
||||
return {
|
||||
isLoading,
|
||||
|
@ -44,8 +44,8 @@ const RequestButtonContainer = ({ isDisabled, isLoading }) => {
|
||||
);
|
||||
};
|
||||
|
||||
export default inject(({ payments }) => {
|
||||
const { isLoading } = payments;
|
||||
export default inject(({ paymentStore }) => {
|
||||
const { isLoading } = paymentStore;
|
||||
|
||||
return {
|
||||
isLoading,
|
||||
|
@ -43,10 +43,10 @@ const SelectTotalSizeContainer = ({
|
||||
);
|
||||
};
|
||||
|
||||
export default inject(({ settingsStore, paymentQuotasStore, payments }) => {
|
||||
export default inject(({ settingsStore, paymentQuotasStore, paymentStore }) => {
|
||||
const { usedTotalStorageSizeTitle } = paymentQuotasStore;
|
||||
const { theme } = settingsStore;
|
||||
const { allowedStorageSizeByQuota } = payments;
|
||||
const { allowedStorageSizeByQuota } = paymentStore;
|
||||
|
||||
return {
|
||||
theme,
|
||||
|
@ -313,7 +313,7 @@ const SelectUsersCountContainer = ({
|
||||
);
|
||||
};
|
||||
|
||||
export default inject(({ paymentQuotasStore, payments }) => {
|
||||
export default inject(({ paymentQuotasStore, paymentStore }) => {
|
||||
const {
|
||||
isLoading,
|
||||
minAvailableManagersValue,
|
||||
@ -324,7 +324,7 @@ export default inject(({ paymentQuotasStore, payments }) => {
|
||||
isLessCountThanAcceptable,
|
||||
stepByQuotaForManager,
|
||||
isAlreadyPaid,
|
||||
} = payments;
|
||||
} = paymentStore;
|
||||
const { addedManagersCountTitle } = paymentQuotasStore;
|
||||
|
||||
const step = stepByQuotaForManager;
|
||||
|
@ -123,10 +123,10 @@ const TotalTariffContainer = ({
|
||||
);
|
||||
};
|
||||
|
||||
export default inject(({ settingsStore, payments, paymentQuotasStore }) => {
|
||||
export default inject(({ settingsStore, paymentStore, paymentQuotasStore }) => {
|
||||
const { theme } = settingsStore;
|
||||
const { isLoading, totalPrice, isNeedRequest, maxAvailableManagersCount } =
|
||||
payments;
|
||||
paymentStore;
|
||||
|
||||
const { planCost } = paymentQuotasStore;
|
||||
return {
|
||||
|
@ -63,7 +63,7 @@ const UpdatePlanButtonContainer = ({
|
||||
const resetIntervalSuccess = () => {
|
||||
intervalId &&
|
||||
toastr.success(
|
||||
t("BusinessUpdated", { planName: currentTariffPlanTitle })
|
||||
t("BusinessUpdated", { planName: currentTariffPlanTitle }),
|
||||
);
|
||||
clearInterval(intervalId);
|
||||
intervalId = null;
|
||||
@ -187,7 +187,7 @@ const UpdatePlanButtonContainer = ({
|
||||
};
|
||||
|
||||
export default inject(
|
||||
({ currentQuotaStore, payments, currentTariffStatusStore }) => {
|
||||
({ currentQuotaStore, paymentStore, currentTariffStatusStore }) => {
|
||||
const {
|
||||
maxCountManagersByQuota,
|
||||
setPortalQuotaValue,
|
||||
@ -206,7 +206,7 @@ export default inject(
|
||||
accountLink,
|
||||
isAlreadyPaid,
|
||||
canPayTariff,
|
||||
} = payments;
|
||||
} = paymentStore;
|
||||
|
||||
return {
|
||||
canPayTariff,
|
||||
@ -224,5 +224,5 @@ export default inject(
|
||||
setPortalQuotaValue,
|
||||
currentTariffPlanTitle,
|
||||
};
|
||||
}
|
||||
},
|
||||
)(observer(UpdatePlanButtonContainer));
|
||||
|
@ -51,8 +51,8 @@ const EnterpriseContainer = (props) => {
|
||||
);
|
||||
};
|
||||
|
||||
export default inject(({ payments, currentTariffStatusStore }) => {
|
||||
const { buyUrl, salesEmail } = payments;
|
||||
export default inject(({ paymentStore, currentTariffStatusStore }) => {
|
||||
const { buyUrl, salesEmail } = paymentStore;
|
||||
|
||||
const { isLicenseDateExpired } = currentTariffStatusStore;
|
||||
return { buyUrl, salesEmail, isLicenseDateExpired };
|
||||
|
@ -89,14 +89,14 @@ const LicenseContainer = (props) => {
|
||||
);
|
||||
};
|
||||
|
||||
export default inject(({ payments }) => {
|
||||
export default inject(({ paymentStore }) => {
|
||||
const {
|
||||
setPaymentsLicense,
|
||||
acceptPaymentsLicense,
|
||||
isLicenseCorrect,
|
||||
setIsLoading,
|
||||
isLoading,
|
||||
} = payments;
|
||||
} = paymentStore;
|
||||
|
||||
return {
|
||||
setPaymentsLicense,
|
||||
|
@ -51,9 +51,10 @@ const StandalonePage = (props) => {
|
||||
};
|
||||
|
||||
export default inject(
|
||||
({ currentQuotaStore, payments, currentTariffStatusStore }) => {
|
||||
({ currentQuotaStore, paymentStore, currentTariffStatusStore }) => {
|
||||
|
||||
const { standaloneInit, isInitPaymentPage, isUpdatingBasicSettings } =
|
||||
payments;
|
||||
paymentStore;
|
||||
const { isLoaded: isLoadedCurrentQuota, isTrial } = currentQuotaStore;
|
||||
const { isLoaded: isLoadedTariffStatus } = currentTariffStatusStore;
|
||||
|
||||
@ -65,5 +66,5 @@ export default inject(
|
||||
isLoadedCurrentQuota,
|
||||
isUpdatingBasicSettings,
|
||||
};
|
||||
}
|
||||
},
|
||||
)(observer(StandalonePage));
|
||||
|
@ -21,8 +21,8 @@ const ButtonContainer = ({ t, buyUrl }) => {
|
||||
);
|
||||
};
|
||||
|
||||
export default inject(({ payments }) => {
|
||||
const { buyUrl } = payments;
|
||||
export default inject(({ paymentStore }) => {
|
||||
const { buyUrl } = paymentStore;
|
||||
|
||||
return {
|
||||
buyUrl,
|
||||
|
@ -3,7 +3,7 @@ import axios from "axios";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { inject, observer } from "mobx-react";
|
||||
|
||||
import api from "@docspace/shared/api";
|
||||
import { Text } from "@docspace/shared/components/text";
|
||||
import { FormWrapper } from "@docspace/shared/components/form-wrapper";
|
||||
import { EmailInput } from "@docspace/shared/components/email-input";
|
||||
@ -70,7 +70,7 @@ const Wizard = (props) => {
|
||||
cultureNames,
|
||||
culture,
|
||||
hashSettings,
|
||||
setPortalOwner,
|
||||
|
||||
setWizardComplete,
|
||||
isLicenseRequired,
|
||||
setLicense,
|
||||
@ -133,7 +133,7 @@ const Wizard = (props) => {
|
||||
])
|
||||
.then(() => {
|
||||
const select = cultureNames.filter(
|
||||
(lang) => lang.key === convertedCulture
|
||||
(lang) => lang.key === convertedCulture,
|
||||
);
|
||||
|
||||
if (select.length === 0) {
|
||||
@ -255,13 +255,13 @@ const Wizard = (props) => {
|
||||
const hash = createPasswordHash(password, hashSettings);
|
||||
|
||||
try {
|
||||
await setPortalOwner(
|
||||
await api.settings.setPortalOwner(
|
||||
emailTrim,
|
||||
hash,
|
||||
selectedLanguage.key,
|
||||
selectedTimezone.key,
|
||||
wizardToken,
|
||||
analytics
|
||||
analytics,
|
||||
);
|
||||
|
||||
setCookie(LANGUAGE, selectedLanguage.key, {
|
||||
@ -500,7 +500,7 @@ const Wizard = (props) => {
|
||||
);
|
||||
};
|
||||
|
||||
export default inject(({ authStore, settingsStore, wizard }) => {
|
||||
export default inject(({ authStore, settingsStore, wizardStore }) => {
|
||||
const {
|
||||
passwordSettings,
|
||||
wizardToken,
|
||||
@ -522,10 +522,10 @@ export default inject(({ authStore, settingsStore, wizard }) => {
|
||||
setIsWizardLoaded,
|
||||
getMachineName,
|
||||
getIsRequiredLicense,
|
||||
setPortalOwner,
|
||||
|
||||
setLicense,
|
||||
resetLicenseUploaded,
|
||||
} = wizard;
|
||||
} = wizardStore;
|
||||
|
||||
return {
|
||||
theme,
|
||||
@ -546,7 +546,7 @@ export default inject(({ authStore, settingsStore, wizard }) => {
|
||||
setIsWizardLoaded,
|
||||
getMachineName,
|
||||
getIsRequiredLicense,
|
||||
setPortalOwner,
|
||||
|
||||
setLicense,
|
||||
resetLicenseUploaded,
|
||||
};
|
||||
|
@ -1,48 +0,0 @@
|
||||
import { action, makeObservable, observable } from "mobx";
|
||||
|
||||
class AvatarEditorStore {
|
||||
visible = false;
|
||||
avatarMax = null;
|
||||
createdAvatar = {
|
||||
tmpFile: "",
|
||||
image: null,
|
||||
defaultWidth: 0,
|
||||
defaultHeight: 0,
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 0,
|
||||
height: 0,
|
||||
};
|
||||
croppedAvatar = null;
|
||||
|
||||
constructor() {
|
||||
makeObservable(this, {
|
||||
visible: observable,
|
||||
avatarMax: observable,
|
||||
createdAvatar: observable,
|
||||
croppedAvatar: observable,
|
||||
toggleAvatarEditor: action,
|
||||
setAvatarMax: action,
|
||||
setCreatedAvatar: action,
|
||||
setCroppedAvatar: action,
|
||||
});
|
||||
}
|
||||
|
||||
toggleAvatarEditor = (isVisible) => {
|
||||
return (this.visible = isVisible);
|
||||
};
|
||||
|
||||
setAvatarMax = (avatarMax) => {
|
||||
return (this.avatarMax = avatarMax);
|
||||
};
|
||||
|
||||
setCreatedAvatar = (avatar) => {
|
||||
return (this.createdAvatar = avatar);
|
||||
};
|
||||
|
||||
setCroppedAvatar = (croppedAvatar) => {
|
||||
return (this.croppedAvatar = croppedAvatar);
|
||||
};
|
||||
}
|
||||
|
||||
export default AvatarEditorStore;
|
@ -156,10 +156,10 @@ class CommonStore {
|
||||
this.enableRestoreButton = enableRestoreButton;
|
||||
};
|
||||
|
||||
restoreWhiteLabelSettings = async (isDefault) => {
|
||||
restoreWhiteLabelSettings = async () => {
|
||||
const { getWhiteLabelLogoUrls } = this.settingsStore;
|
||||
|
||||
await api.settings.restoreWhiteLabelSettings(isDefault, isManagement());
|
||||
await api.settings.restoreWhiteLabelSettings(isManagement());
|
||||
await getWhiteLabelLogoUrls();
|
||||
this.getWhiteLabelLogoUrls();
|
||||
this.getIsDefaultWhiteLabel();
|
||||
|
@ -30,7 +30,7 @@ import {
|
||||
} from "SRC_DIR/helpers/utils";
|
||||
import { isDesktop, isMobile } from "@docspace/shared/utils";
|
||||
|
||||
import { PluginFileType } from "SRC_DIR/helpers/plugins/constants";
|
||||
import { PluginFileType } from "SRC_DIR/helpers/plugins/enums";
|
||||
|
||||
import { CategoryType } from "SRC_DIR/helpers/constants";
|
||||
import debounce from "lodash.debounce";
|
||||
@ -161,7 +161,7 @@ class FilesStore {
|
||||
infoPanelStore,
|
||||
userStore,
|
||||
currentTariffStatusStore,
|
||||
settingsStore
|
||||
settingsStore,
|
||||
) {
|
||||
const pathname = window.location.pathname.toLowerCase();
|
||||
this.isEditor = pathname.indexOf("doceditor") !== -1;
|
||||
@ -292,7 +292,7 @@ class FilesStore {
|
||||
foundIndex,
|
||||
count > 0
|
||||
? this.files[foundIndex].fileStatus | FileStatus.IsNew
|
||||
: this.files[foundIndex].fileStatus & ~FileStatus.IsNew
|
||||
: this.files[foundIndex].fileStatus & ~FileStatus.IsNew,
|
||||
);
|
||||
});
|
||||
|
||||
@ -311,12 +311,12 @@ class FilesStore {
|
||||
this.updateSelectionStatus(
|
||||
id,
|
||||
this.files[foundIndex].fileStatus | FileStatus.IsEditing,
|
||||
true
|
||||
true,
|
||||
);
|
||||
|
||||
this.updateFileStatus(
|
||||
foundIndex,
|
||||
this.files[foundIndex].fileStatus | FileStatus.IsEditing
|
||||
this.files[foundIndex].fileStatus | FileStatus.IsEditing,
|
||||
);
|
||||
});
|
||||
|
||||
@ -334,12 +334,12 @@ class FilesStore {
|
||||
this.updateSelectionStatus(
|
||||
id,
|
||||
this.files[foundIndex].fileStatus & ~FileStatus.IsEditing,
|
||||
false
|
||||
false,
|
||||
);
|
||||
|
||||
this.updateFileStatus(
|
||||
foundIndex,
|
||||
this.files[foundIndex].fileStatus & ~FileStatus.IsEditing
|
||||
this.files[foundIndex].fileStatus & ~FileStatus.IsEditing,
|
||||
);
|
||||
|
||||
this.getFileInfo(id);
|
||||
@ -512,7 +512,7 @@ class FilesStore {
|
||||
|
||||
if (this.bufferSelection) {
|
||||
const foundIndex = [this.bufferSelection].findIndex(
|
||||
(x) => x.id === folder.id
|
||||
(x) => x.id === folder.id,
|
||||
);
|
||||
if (foundIndex > -1) {
|
||||
runInAction(() => {
|
||||
@ -535,7 +535,7 @@ class FilesStore {
|
||||
console.log(
|
||||
"[WS] delete file",
|
||||
this.files[foundIndex].id,
|
||||
this.files[foundIndex].title
|
||||
this.files[foundIndex].title,
|
||||
);
|
||||
|
||||
// this.setFiles(
|
||||
@ -549,7 +549,7 @@ class FilesStore {
|
||||
// this.setFilter(newFilter);
|
||||
|
||||
const tempActionFilesIds = JSON.parse(
|
||||
JSON.stringify(this.tempActionFilesIds)
|
||||
JSON.stringify(this.tempActionFilesIds),
|
||||
);
|
||||
tempActionFilesIds.push(this.files[foundIndex].id);
|
||||
|
||||
@ -578,11 +578,11 @@ class FilesStore {
|
||||
console.log(
|
||||
"[WS] delete folder",
|
||||
this.folders[foundIndex].id,
|
||||
this.folders[foundIndex].title
|
||||
this.folders[foundIndex].title,
|
||||
);
|
||||
|
||||
const tempActionFoldersIds = JSON.parse(
|
||||
JSON.stringify(this.tempActionFoldersIds)
|
||||
JSON.stringify(this.tempActionFoldersIds),
|
||||
);
|
||||
tempActionFoldersIds.push(this.folders[foundIndex].id);
|
||||
|
||||
@ -669,7 +669,7 @@ class FilesStore {
|
||||
|
||||
if (this.bufferSelection) {
|
||||
const foundIndex = [this.bufferSelection].findIndex(
|
||||
(x) => x.id === file.id
|
||||
(x) => x.id === file.id,
|
||||
);
|
||||
if (foundIndex > -1) {
|
||||
runInAction(() => {
|
||||
@ -694,7 +694,7 @@ class FilesStore {
|
||||
this.setActiveFolders(folders, destFolderId);
|
||||
} else {
|
||||
folders.map((item) =>
|
||||
this.activeFolders.push({ id: item, destFolderId })
|
||||
this.activeFolders.push({ id: item, destFolderId }),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -726,7 +726,7 @@ class FilesStore {
|
||||
: {
|
||||
id: item,
|
||||
destFolderId,
|
||||
}
|
||||
},
|
||||
);
|
||||
return arrayFormation;
|
||||
};
|
||||
@ -763,7 +763,7 @@ class FilesStore {
|
||||
|
||||
setStartDrag = (startDrag) => {
|
||||
this.selection = this.selection.filter(
|
||||
(x) => !x.providerKey || x.id !== x.rootFolderId
|
||||
(x) => !x.providerKey || x.id !== x.rootFolderId,
|
||||
); // removed root thirdparty folders
|
||||
this.startDrag = startDrag;
|
||||
};
|
||||
@ -837,7 +837,7 @@ class FilesStore {
|
||||
if (!treeFolders || !treeFolders.length) return;
|
||||
|
||||
const trashFolder = treeFolders.find(
|
||||
(f) => f.rootFolderType == FolderType.TRASH
|
||||
(f) => f.rootFolderType == FolderType.TRASH,
|
||||
);
|
||||
|
||||
if (!trashFolder) return;
|
||||
@ -845,7 +845,7 @@ class FilesStore {
|
||||
const isEmpty = !trashFolder.foldersCount && !trashFolder.filesCount;
|
||||
|
||||
this.setTrashIsEmpty(isEmpty);
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
if (isDesktopClient) {
|
||||
@ -971,10 +971,10 @@ class FilesStore {
|
||||
|
||||
updateSelection = (id) => {
|
||||
const indexFileList = this.filesList.findIndex(
|
||||
(filelist) => filelist.id === id
|
||||
(filelist) => filelist.id === id,
|
||||
);
|
||||
const indexSelectedRoom = this.selection.findIndex(
|
||||
(room) => room.id === id
|
||||
(room) => room.id === id,
|
||||
);
|
||||
|
||||
if (~indexFileList && ~indexSelectedRoom) {
|
||||
@ -982,7 +982,7 @@ class FilesStore {
|
||||
}
|
||||
if (this.bufferSelection) {
|
||||
this.bufferSelection = this.filesList.find(
|
||||
(file) => file.id === this.bufferSelection.id
|
||||
(file) => file.id === this.bufferSelection.id,
|
||||
);
|
||||
}
|
||||
};
|
||||
@ -1117,12 +1117,12 @@ class FilesStore {
|
||||
if (fileType === "file") {
|
||||
if (this.activeFiles.findIndex((f) => f.id == id) === -1) {
|
||||
newSelections.push(
|
||||
this.filesList.find((f) => f.id == id && !f.isFolder)
|
||||
this.filesList.find((f) => f.id == id && !f.isFolder),
|
||||
);
|
||||
}
|
||||
} else if (this.activeFolders.findIndex((f) => f.id == id) === -1) {
|
||||
const selectableFolder = this.filesList.find(
|
||||
(f) => f.id == id && f.isFolder
|
||||
(f) => f.id == id && f.isFolder,
|
||||
);
|
||||
|
||||
if (selectableFolder) {
|
||||
@ -1153,12 +1153,12 @@ class FilesStore {
|
||||
if (fileType === "file") {
|
||||
if (this.activeFiles.findIndex((f) => f.id == id) === -1) {
|
||||
newSelections = newSelections.filter(
|
||||
(f) => !(f.id == id && !f.isFolder)
|
||||
(f) => !(f.id == id && !f.isFolder),
|
||||
);
|
||||
}
|
||||
} else if (this.activeFolders.findIndex((f) => f.id == id) === -1) {
|
||||
newSelections = newSelections.filter(
|
||||
(f) => !(f.id == id && f.isFolder)
|
||||
(f) => !(f.id == id && f.isFolder),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1167,7 +1167,7 @@ class FilesStore {
|
||||
return items.filter(
|
||||
(x, index, self) =>
|
||||
index ===
|
||||
self.findIndex((i) => i.id === x.id && i.isFolder === x.isFolder)
|
||||
self.findIndex((i) => i.id === x.id && i.isFolder === x.isFolder),
|
||||
);
|
||||
};
|
||||
|
||||
@ -1258,7 +1258,7 @@ class FilesStore {
|
||||
const newUrl = combineUrl(
|
||||
window.DocSpaceConfig?.proxy?.url,
|
||||
config.homepage,
|
||||
pathname
|
||||
pathname,
|
||||
);
|
||||
|
||||
if (newUrl === currentUrl) return;
|
||||
@ -1315,7 +1315,7 @@ class FilesStore {
|
||||
filter,
|
||||
clearFilter = true,
|
||||
withSubfolders = false,
|
||||
clearSelection = true
|
||||
clearSelection = true,
|
||||
) => {
|
||||
const { setSelectedNode } = this.treeFoldersStore;
|
||||
if (this.clientLoadingStore.isLoading) {
|
||||
@ -1329,7 +1329,7 @@ class FilesStore {
|
||||
if (folderId === "@my" && this.userStore.user.isVisitor) {
|
||||
const url = getCategoryUrl(CategoryType.Shared);
|
||||
return window.DocSpace.navigate(
|
||||
`${url}?${RoomsFilter.getDefault().toUrlParams()}`
|
||||
`${url}?${RoomsFilter.getDefault().toUrlParams()}`,
|
||||
);
|
||||
}
|
||||
|
||||
@ -1389,7 +1389,7 @@ class FilesStore {
|
||||
folderId,
|
||||
filterData,
|
||||
clearFilter,
|
||||
withSubfolders
|
||||
withSubfolders,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1398,7 +1398,7 @@ class FilesStore {
|
||||
if (!this.publicRoomStore.isPublicRoom) {
|
||||
this.categoryType = getCategoryTypeByFolderType(
|
||||
data.current.rootFolderType,
|
||||
data.current.parentId
|
||||
data.current.parentId,
|
||||
);
|
||||
}
|
||||
});
|
||||
@ -1449,12 +1449,12 @@ class FilesStore {
|
||||
if (clearSelection) {
|
||||
// Find not processed
|
||||
const tempSelection = this.selection.filter(
|
||||
(f) => !this.activeFiles.find((elem) => elem.id === f.id)
|
||||
(f) => !this.activeFiles.find((elem) => elem.id === f.id),
|
||||
);
|
||||
const tempBuffer =
|
||||
this.bufferSelection &&
|
||||
this.activeFiles.find(
|
||||
(elem) => elem.id === this.bufferSelection.id
|
||||
(elem) => elem.id === this.bufferSelection.id,
|
||||
) == null
|
||||
? this.bufferSelection
|
||||
: null;
|
||||
@ -1531,7 +1531,7 @@ class FilesStore {
|
||||
shared,
|
||||
canCopyPublicLink,
|
||||
};
|
||||
})
|
||||
}),
|
||||
).then((res) => {
|
||||
return res
|
||||
.filter((item, index) => {
|
||||
@ -1558,7 +1558,7 @@ class FilesStore {
|
||||
|
||||
if (this.createdItem) {
|
||||
const newItem = this.filesList.find(
|
||||
(item) => item.id === this.createdItem.id
|
||||
(item) => item.id === this.createdItem.id,
|
||||
);
|
||||
|
||||
if (newItem) {
|
||||
@ -1622,7 +1622,7 @@ class FilesStore {
|
||||
clearFilter = true,
|
||||
withSubfolders = false,
|
||||
clearSelection = true,
|
||||
withFilterLocalStorage = false
|
||||
withFilterLocalStorage = false,
|
||||
) => {
|
||||
const { setSelectedNode, roomsFolderId } = this.treeFoldersStore;
|
||||
|
||||
@ -1634,7 +1634,7 @@ class FilesStore {
|
||||
const filterData = !!filter ? filter.clone() : RoomsFilter.getDefault();
|
||||
|
||||
const filterStorageItem = localStorage.getItem(
|
||||
`UserRoomsFilter=${this.userStore.user?.id}`
|
||||
`UserRoomsFilter=${this.userStore.user?.id}`,
|
||||
);
|
||||
|
||||
if (filterStorageItem && (!filter || withFilterLocalStorage)) {
|
||||
@ -1672,7 +1672,7 @@ class FilesStore {
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
true
|
||||
true,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1680,7 +1680,7 @@ class FilesStore {
|
||||
runInAction(() => {
|
||||
this.categoryType = getCategoryTypeByFolderType(
|
||||
data.current.rootFolderType,
|
||||
data.current.parentId
|
||||
data.current.parentId,
|
||||
);
|
||||
});
|
||||
|
||||
@ -1744,7 +1744,7 @@ class FilesStore {
|
||||
|
||||
if (this.createdItem) {
|
||||
const newItem = this.filesList.find(
|
||||
(item) => item.id === this.createdItem.id
|
||||
(item) => item.id === this.createdItem.id,
|
||||
);
|
||||
|
||||
if (newItem) {
|
||||
@ -1780,7 +1780,7 @@ class FilesStore {
|
||||
|
||||
isFileSelected = (fileId, parentId) => {
|
||||
const item = this.selection.find(
|
||||
(x) => x.id === fileId && x.parentId === parentId
|
||||
(x) => x.id === fileId && x.parentId === parentId,
|
||||
);
|
||||
|
||||
return item !== undefined;
|
||||
@ -1797,12 +1797,12 @@ class FilesStore {
|
||||
const isFileSelected = this.isFileSelected(id, parentId);
|
||||
if (isFileSelected) {
|
||||
let selectionIndex = this.selection.findIndex(
|
||||
(x) => x.parentId === parentId && x.id === id
|
||||
(x) => x.parentId === parentId && x.id === id,
|
||||
);
|
||||
|
||||
if (selectionIndex !== -1) {
|
||||
this.selection = this.selection.filter(
|
||||
(x, index) => index !== selectionIndex
|
||||
(x, index) => index !== selectionIndex,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -2090,7 +2090,7 @@ class FilesStore {
|
||||
const pluginFilesKeys = this.pluginStore.getContextMenuKeysByType(
|
||||
PluginFileType.Files,
|
||||
item.fileExst,
|
||||
security
|
||||
security,
|
||||
);
|
||||
|
||||
pluginAllKeys &&
|
||||
@ -2106,7 +2106,7 @@ class FilesStore {
|
||||
const pluginFilesKeys = this.pluginStore.getContextMenuKeysByType(
|
||||
PluginFileType.Image,
|
||||
item.fileExst,
|
||||
security
|
||||
security,
|
||||
);
|
||||
|
||||
pluginAllKeys &&
|
||||
@ -2122,7 +2122,7 @@ class FilesStore {
|
||||
const pluginFilesKeys = this.pluginStore.getContextMenuKeysByType(
|
||||
PluginFileType.Video,
|
||||
item.fileExst,
|
||||
security
|
||||
security,
|
||||
);
|
||||
|
||||
pluginAllKeys &&
|
||||
@ -2284,7 +2284,7 @@ class FilesStore {
|
||||
const pluginRoomsKeys = this.pluginStore.getContextMenuKeysByType(
|
||||
PluginFileType.Rooms,
|
||||
null,
|
||||
security
|
||||
security,
|
||||
);
|
||||
|
||||
pluginAllKeys &&
|
||||
@ -2384,7 +2384,7 @@ class FilesStore {
|
||||
const pluginFoldersKeys = this.pluginStore.getContextMenuKeysByType(
|
||||
PluginFileType.Folders,
|
||||
null,
|
||||
security
|
||||
security,
|
||||
);
|
||||
|
||||
pluginAllKeys &&
|
||||
@ -2697,10 +2697,10 @@ class FilesStore {
|
||||
|
||||
const hotkeysClipboard = fileIds
|
||||
? this.hotkeysClipboard.filter(
|
||||
(f) => !fileIds.includes(f.id) && !f.isFolder
|
||||
(f) => !fileIds.includes(f.id) && !f.isFolder,
|
||||
)
|
||||
: this.hotkeysClipboard.filter(
|
||||
(f) => !folderIds.includes(f.id) && f.isFolder
|
||||
(f) => !folderIds.includes(f.id) && f.isFolder,
|
||||
);
|
||||
|
||||
newFilter.total -= deleteCount;
|
||||
@ -2867,7 +2867,7 @@ class FilesStore {
|
||||
return getIcon(
|
||||
24,
|
||||
this.selection[0].fileExst,
|
||||
this.selection[0].providerKey
|
||||
this.selection[0].providerKey,
|
||||
);
|
||||
}
|
||||
return null;
|
||||
@ -2978,7 +2978,7 @@ class FilesStore {
|
||||
const url = combineUrl(
|
||||
proxyURL,
|
||||
config.homepage,
|
||||
`/doceditor?fileId=${id}${needConvert ? "&action=view" : ""}`
|
||||
`/doceditor?fileId=${id}${needConvert ? "&action=view" : ""}`,
|
||||
);
|
||||
|
||||
return url;
|
||||
@ -3063,7 +3063,7 @@ class FilesStore {
|
||||
|
||||
const thirdPartyIcon = this.thirdPartyStore.getThirdPartyIcon(
|
||||
item.providerKey,
|
||||
"small"
|
||||
"small",
|
||||
);
|
||||
|
||||
const providerType =
|
||||
@ -3119,7 +3119,7 @@ class FilesStore {
|
||||
contentLength,
|
||||
roomType,
|
||||
isArchive,
|
||||
type
|
||||
type,
|
||||
);
|
||||
|
||||
const defaultRoomIcon = isRoom
|
||||
@ -3130,7 +3130,7 @@ class FilesStore {
|
||||
contentLength,
|
||||
roomType,
|
||||
isArchive,
|
||||
type
|
||||
type,
|
||||
)
|
||||
: undefined;
|
||||
|
||||
@ -3271,7 +3271,7 @@ class FilesStore {
|
||||
elem !== `room-${RoomsType.ReviewRoom}` &&
|
||||
elem !== `room-${RoomsType.FormRoom}` &&
|
||||
elem !== `room-${RoomsType.ReadOnlyRoom}` &&
|
||||
elem !== `room-${RoomsType.PublicRoom}`
|
||||
elem !== `room-${RoomsType.PublicRoom}`,
|
||||
);
|
||||
|
||||
if (hasFiles) cbMenu.push(FilterType.FilesOnly);
|
||||
@ -3498,14 +3498,14 @@ class FilesStore {
|
||||
|
||||
get hasNew() {
|
||||
const newFiles = [...this.files, ...this.folders].filter(
|
||||
(item) => (item.fileStatus & FileStatus.IsNew) === FileStatus.IsNew
|
||||
(item) => (item.fileStatus & FileStatus.IsNew) === FileStatus.IsNew,
|
||||
);
|
||||
return newFiles.length > 0;
|
||||
}
|
||||
|
||||
get allFilesIsEditing() {
|
||||
const hasFolders = this.selection.find(
|
||||
(x) => !x.fileExst || !x.contentLength
|
||||
(x) => !x.fileExst || !x.contentLength,
|
||||
);
|
||||
if (!hasFolders) {
|
||||
return this.selection.every((x) => x.isEditing);
|
||||
@ -3529,15 +3529,15 @@ class FilesStore {
|
||||
const webReview = selection.find((x) => x.viewAccessibility?.WebReview);
|
||||
|
||||
const formFillingDocs = selection.find(
|
||||
(x) => x.viewAccessibility?.WebRestrictedEditing
|
||||
(x) => x.viewAccessibility?.WebRestrictedEditing,
|
||||
);
|
||||
|
||||
const webFilter = selection.find(
|
||||
(x) => x.viewAccessibility?.WebCustomFilterEditing
|
||||
(x) => x.viewAccessibility?.WebCustomFilterEditing,
|
||||
);
|
||||
|
||||
const webNeedConvert = selection.find(
|
||||
(x) => x.viewAccessibility?.MustConvert
|
||||
(x) => x.viewAccessibility?.MustConvert,
|
||||
);
|
||||
|
||||
if ((webEdit && !webNeedConvert) || !externalAccess)
|
||||
@ -3642,7 +3642,7 @@ class FilesStore {
|
||||
tab = null,
|
||||
url = null,
|
||||
preview = false,
|
||||
shareKey = null
|
||||
shareKey = null,
|
||||
) => {
|
||||
const foundIndex = this.files.findIndex((x) => x.id === id);
|
||||
const file = foundIndex !== -1 ? this.files[foundIndex] : undefined;
|
||||
@ -3854,7 +3854,7 @@ class FilesStore {
|
||||
this.setHotkeyCaretStart(item);
|
||||
|
||||
const fileIndex = this.selection.findIndex(
|
||||
(f) => f.id === item.id && f.isFolder === item.isFolder
|
||||
(f) => f.id === item.id && f.isFolder === item.isFolder,
|
||||
);
|
||||
if (fileIndex === -1) {
|
||||
this.setSelection([...this.selection, item]);
|
||||
@ -3872,15 +3872,15 @@ class FilesStore {
|
||||
if (!caret || !caretStart) return;
|
||||
|
||||
const startCaretIndex = this.filesList.findIndex(
|
||||
(f) => f.id === caretStart.id && f.isFolder === caretStart.isFolder
|
||||
(f) => f.id === caretStart.id && f.isFolder === caretStart.isFolder,
|
||||
);
|
||||
|
||||
const caretIndex = this.filesList.findIndex(
|
||||
(f) => f.id === caret.id && f.isFolder === caret.isFolder
|
||||
(f) => f.id === caret.id && f.isFolder === caret.isFolder,
|
||||
);
|
||||
|
||||
const itemIndex = this.filesList.findIndex(
|
||||
(f) => f.id === item.id && f.isFolder === item.isFolder
|
||||
(f) => f.id === item.id && f.isFolder === item.isFolder,
|
||||
);
|
||||
|
||||
const isMoveDown = caretIndex < itemIndex;
|
||||
@ -3893,13 +3893,13 @@ class FilesStore {
|
||||
const filesItem = this.filesList[index];
|
||||
|
||||
const selectionIndex = newSelection.findIndex(
|
||||
(f) => f.id === filesItem.id && f.isFolder === filesItem.isFolder
|
||||
(f) => f.id === filesItem.id && f.isFolder === filesItem.isFolder,
|
||||
);
|
||||
if (selectionIndex === -1) {
|
||||
newSelection.push(filesItem);
|
||||
} else {
|
||||
newSelection = newSelection.filter(
|
||||
(_, fIndex) => selectionIndex !== fIndex
|
||||
(_, fIndex) => selectionIndex !== fIndex,
|
||||
);
|
||||
newSelection.push(filesItem);
|
||||
}
|
||||
@ -3914,12 +3914,12 @@ class FilesStore {
|
||||
const lastSelection = this.selection[this.selection.length - 1];
|
||||
const indexOfLast = this.filesList.findIndex(
|
||||
(f) =>
|
||||
f.id === lastSelection?.id && f.isFolder === lastSelection?.isFolder
|
||||
f.id === lastSelection?.id && f.isFolder === lastSelection?.isFolder,
|
||||
);
|
||||
|
||||
newSelection = newSelection.filter((f) => {
|
||||
const listIndex = this.filesList.findIndex(
|
||||
(x) => x.id === f.id && x.isFolder === f.isFolder
|
||||
(x) => x.id === f.id && x.isFolder === f.isFolder,
|
||||
);
|
||||
|
||||
if (isMoveDown) {
|
||||
|
@ -1,52 +1,79 @@
|
||||
/* eslint-disable class-methods-use-this */
|
||||
/* eslint-disable no-console */
|
||||
import axios from "axios";
|
||||
import { makeAutoObservable } from "mobx";
|
||||
|
||||
import {
|
||||
getPaymentSettings,
|
||||
setLicense,
|
||||
acceptLicense,
|
||||
} from "@docspace/shared/api/settings";
|
||||
import { makeAutoObservable } from "mobx";
|
||||
import { getPaymentLink } from "@docspace/shared/api/portal";
|
||||
import api from "@docspace/shared/api";
|
||||
import { toastr } from "@docspace/shared/components/toast";
|
||||
import { authStore } from "@docspace/shared/store";
|
||||
import { getPaymentLink } from "@docspace/shared/api/portal";
|
||||
import axios from "axios";
|
||||
import { combineUrl } from "@docspace/shared/utils/combineUrl";
|
||||
import { UserStore } from "@docspace/shared/store/UserStore";
|
||||
import { CurrentTariffStatusStore } from "@docspace/shared/store/CurrentTariffStatusStore";
|
||||
import { CurrentQuotasStore } from "@docspace/shared/store/CurrentQuotaStore";
|
||||
import { PaymentQuotasStore } from "@docspace/shared/store/PaymentQuotasStore";
|
||||
import { TTranslation } from "@docspace/shared/types";
|
||||
import { TData } from "@docspace/shared/components/toast/Toast.type";
|
||||
|
||||
class PaymentStore {
|
||||
userStore = null;
|
||||
currentTariffStatusStore = null;
|
||||
currentQuotaStore = null;
|
||||
paymentQuotasStore = null;
|
||||
userStore: UserStore | null = null;
|
||||
|
||||
currentTariffStatusStore: CurrentTariffStatusStore | null = null;
|
||||
|
||||
currentQuotaStore: CurrentQuotasStore | null = null;
|
||||
|
||||
paymentQuotasStore: PaymentQuotasStore | null = null;
|
||||
|
||||
salesEmail = "";
|
||||
|
||||
helpUrl = "https://helpdesk.onlyoffice.com";
|
||||
|
||||
buyUrl =
|
||||
"https://www.onlyoffice.com/enterprise-edition.aspx?type=buyenterprise";
|
||||
|
||||
standaloneMode = true;
|
||||
|
||||
currentLicense = {
|
||||
expiresDate: new Date(),
|
||||
trialMode: true,
|
||||
};
|
||||
|
||||
paymentLink = null;
|
||||
accountLink = null;
|
||||
paymentLink = "";
|
||||
|
||||
accountLink = "";
|
||||
|
||||
isLoading = false;
|
||||
|
||||
isUpdatingBasicSettings = false;
|
||||
|
||||
totalPrice = 30;
|
||||
|
||||
managersCount = 1;
|
||||
|
||||
maxAvailableManagersCount = 999;
|
||||
|
||||
stepByQuotaForManager = 1;
|
||||
|
||||
minAvailableManagersValue = 1;
|
||||
|
||||
stepByQuotaForTotalSize = 107374182400;
|
||||
|
||||
minAvailableTotalSizeValue = 107374182400;
|
||||
|
||||
isInitPaymentPage = false;
|
||||
|
||||
isLicenseCorrect = false;
|
||||
|
||||
constructor(
|
||||
userStore,
|
||||
currentTariffStatusStore,
|
||||
currentQuotaStore,
|
||||
paymentQuotasStore
|
||||
userStore: UserStore,
|
||||
currentTariffStatusStore: CurrentTariffStatusStore,
|
||||
currentQuotaStore: CurrentQuotasStore,
|
||||
paymentQuotasStore: PaymentQuotasStore,
|
||||
) {
|
||||
this.userStore = userStore;
|
||||
this.currentTariffStatusStore = currentTariffStatusStore;
|
||||
@ -57,20 +84,23 @@ class PaymentStore {
|
||||
}
|
||||
|
||||
get isAlreadyPaid() {
|
||||
const { customerId } = this.currentTariffStatusStore;
|
||||
const { isFreeTariff } = this.currentQuotaStore;
|
||||
const customerId = this.currentTariffStatusStore?.customerId;
|
||||
const isFreeTariff = this.currentQuotaStore?.isFreeTariff;
|
||||
|
||||
return customerId?.length !== 0 || !isFreeTariff;
|
||||
}
|
||||
|
||||
setIsInitPaymentPage = (value) => {
|
||||
setIsInitPaymentPage = (value: boolean) => {
|
||||
this.isInitPaymentPage = value;
|
||||
};
|
||||
|
||||
setIsUpdatingBasicSettings = (isUpdatingBasicSettings) => {
|
||||
setIsUpdatingBasicSettings = (isUpdatingBasicSettings: boolean) => {
|
||||
this.isUpdatingBasicSettings = isUpdatingBasicSettings;
|
||||
};
|
||||
|
||||
basicSettings = async () => {
|
||||
if (!this.currentTariffStatusStore || !this.currentQuotaStore) return;
|
||||
|
||||
const { setPortalTariff, setPayerInfo } = this.currentTariffStatusStore;
|
||||
const { addedManagersCount } = this.currentQuotaStore;
|
||||
|
||||
@ -78,15 +108,14 @@ class PaymentStore {
|
||||
|
||||
const requests = [setPortalTariff()];
|
||||
|
||||
this.isAlreadyPaid
|
||||
? requests.push(this.setPaymentAccount())
|
||||
: requests.push(this.getBasicPaymentLink(addedManagersCount));
|
||||
if (this.isAlreadyPaid) requests.push(this.setPaymentAccount());
|
||||
else requests.push(this.getBasicPaymentLink(addedManagersCount));
|
||||
|
||||
try {
|
||||
await Promise.all(requests);
|
||||
this.setBasicTariffContainer();
|
||||
} catch (error) {
|
||||
toastr.error(t("Common:UnexpectedError"));
|
||||
// toastr.error(t("Common:UnexpectedError"));
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
@ -95,22 +124,28 @@ class PaymentStore {
|
||||
this.setIsUpdatingBasicSettings(false);
|
||||
};
|
||||
|
||||
init = async (t) => {
|
||||
init = async (t: TTranslation) => {
|
||||
if (this.isInitPaymentPage) {
|
||||
this.basicSettings();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
!this.currentTariffStatusStore ||
|
||||
!this.currentQuotaStore ||
|
||||
!this.paymentQuotasStore
|
||||
)
|
||||
return;
|
||||
|
||||
const { setPayerInfo } = this.currentTariffStatusStore;
|
||||
const { addedManagersCount } = this.currentQuotaStore;
|
||||
const { setPortalPaymentQuotas } = this.paymentQuotasStore;
|
||||
|
||||
const requests = [this.getSettingsPayment(), setPortalPaymentQuotas()];
|
||||
|
||||
this.isAlreadyPaid
|
||||
? requests.push(this.setPaymentAccount())
|
||||
: requests.push(this.getBasicPaymentLink(addedManagersCount));
|
||||
if (this.isAlreadyPaid) requests.push(this.setPaymentAccount());
|
||||
else requests.push(this.getBasicPaymentLink(addedManagersCount));
|
||||
|
||||
try {
|
||||
await Promise.all(requests);
|
||||
@ -129,10 +164,10 @@ class PaymentStore {
|
||||
this.setIsInitPaymentPage(true);
|
||||
};
|
||||
|
||||
getBasicPaymentLink = async (managersCount) => {
|
||||
getBasicPaymentLink = async (managersCount: number) => {
|
||||
const backUrl = combineUrl(
|
||||
window.location.origin,
|
||||
"/portal-settings/payments/portal-payments?complete=true"
|
||||
"/portal-settings/payments/portal-payments?complete=true",
|
||||
);
|
||||
|
||||
try {
|
||||
@ -144,14 +179,15 @@ class PaymentStore {
|
||||
console.error(err);
|
||||
}
|
||||
};
|
||||
|
||||
getPaymentLink = async (token = undefined) => {
|
||||
const backUrl = combineUrl(
|
||||
window.location.origin,
|
||||
"/portal-settings/payments/portal-payments?complete=true"
|
||||
"/portal-settings/payments/portal-payments?complete=true",
|
||||
);
|
||||
|
||||
await getPaymentLink(this.managersCount, backUrl, token)
|
||||
.then((link) => {
|
||||
?.then((link) => {
|
||||
if (!link) return;
|
||||
this.setPaymentLink(link);
|
||||
})
|
||||
@ -163,12 +199,12 @@ class PaymentStore {
|
||||
if (err?.response?.status === 402) {
|
||||
return;
|
||||
}
|
||||
this.isInitPaymentPage && toastr.error(err);
|
||||
if (this.isInitPaymentPage) toastr.error(err);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
standaloneBasicSettings = async (t) => {
|
||||
standaloneBasicSettings = async (t: TTranslation) => {
|
||||
const { getTenantExtra } = authStore;
|
||||
|
||||
this.setIsUpdatingBasicSettings(true);
|
||||
@ -184,7 +220,7 @@ class PaymentStore {
|
||||
this.setIsUpdatingBasicSettings(false);
|
||||
};
|
||||
|
||||
standaloneInit = async (t) => {
|
||||
standaloneInit = async (t: TTranslation) => {
|
||||
const { getTenantExtra } = authStore;
|
||||
|
||||
if (this.isInitPaymentPage) {
|
||||
@ -203,6 +239,7 @@ class PaymentStore {
|
||||
|
||||
this.isInitPaymentPage = true;
|
||||
};
|
||||
|
||||
getSettingsPayment = async () => {
|
||||
try {
|
||||
const newSettings = await getPaymentSettings();
|
||||
@ -236,22 +273,23 @@ class PaymentStore {
|
||||
}
|
||||
};
|
||||
|
||||
setIsLicenseCorrect = (isLicenseCorrect) => {
|
||||
setIsLicenseCorrect = (isLicenseCorrect: boolean) => {
|
||||
this.isLicenseCorrect = isLicenseCorrect;
|
||||
};
|
||||
setPaymentsLicense = async (confirmKey, data) => {
|
||||
|
||||
setPaymentsLicense = async (confirmKey: string, data: FormData) => {
|
||||
try {
|
||||
const message = await setLicense(confirmKey, data);
|
||||
this.setIsLicenseCorrect(true);
|
||||
|
||||
toastr.success(message);
|
||||
} catch (e) {
|
||||
toastr.error(e);
|
||||
toastr.error(e as TData);
|
||||
this.setIsLicenseCorrect(false);
|
||||
}
|
||||
};
|
||||
|
||||
acceptPaymentsLicense = async (t) => {
|
||||
acceptPaymentsLicense = async (t: TTranslation) => {
|
||||
try {
|
||||
const { getTenantExtra } = authStore;
|
||||
|
||||
@ -262,7 +300,7 @@ class PaymentStore {
|
||||
|
||||
await getTenantExtra();
|
||||
} catch (e) {
|
||||
toastr.error(e);
|
||||
toastr.error(e as TData);
|
||||
}
|
||||
};
|
||||
|
||||
@ -278,17 +316,17 @@ class PaymentStore {
|
||||
}
|
||||
};
|
||||
|
||||
setPaymentLink = async (link) => {
|
||||
setPaymentLink = async (link: string) => {
|
||||
this.paymentLink = link;
|
||||
};
|
||||
|
||||
setIsLoading = (isLoading) => {
|
||||
setIsLoading = (isLoading: boolean) => {
|
||||
this.isLoading = isLoading;
|
||||
};
|
||||
|
||||
getTotalCostByFormula = (value) => {
|
||||
const costValuePerManager = this.paymentQuotasStore.planCost.value;
|
||||
return value * costValuePerManager;
|
||||
getTotalCostByFormula = (value: number) => {
|
||||
const costValuePerManager = this.paymentQuotasStore?.planCost.value;
|
||||
if (costValuePerManager) return value * +costValuePerManager;
|
||||
};
|
||||
|
||||
get allowedStorageSizeByQuota() {
|
||||
@ -301,7 +339,10 @@ class PaymentStore {
|
||||
resetTariffContainerToBasic = () => {
|
||||
this.setBasicTariffContainer();
|
||||
};
|
||||
|
||||
setBasicTariffContainer = () => {
|
||||
if (!this.currentQuotaStore) return;
|
||||
|
||||
const { currentPlanCost, maxCountManagersByQuota, addedManagersCount } =
|
||||
this.currentQuotaStore;
|
||||
const currentTotalPrice = currentPlanCost.value;
|
||||
@ -314,21 +355,23 @@ class PaymentStore {
|
||||
? this.maxAvailableManagersCount + 1
|
||||
: maxCountManagersByQuota;
|
||||
|
||||
this.totalPrice = currentTotalPrice;
|
||||
this.totalPrice = +currentTotalPrice;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
this.managersCount = addedManagersCount;
|
||||
this.totalPrice = this.getTotalCostByFormula(addedManagersCount);
|
||||
const totalPrice = this.getTotalCostByFormula(addedManagersCount);
|
||||
|
||||
if (totalPrice) this.totalPrice = totalPrice;
|
||||
};
|
||||
|
||||
setTotalPrice = (value) => {
|
||||
setTotalPrice = (value: number) => {
|
||||
const price = this.getTotalCostByFormula(value);
|
||||
if (price !== this.totalPrice) this.totalPrice = price;
|
||||
if (price !== this.totalPrice && price) this.totalPrice = price;
|
||||
};
|
||||
|
||||
setManagersCount = (managers) => {
|
||||
setManagersCount = (managers: number) => {
|
||||
if (managers > this.maxAvailableManagersCount)
|
||||
this.managersCount = this.maxAvailableManagersCount + 1;
|
||||
else this.managersCount = managers;
|
||||
@ -343,6 +386,7 @@ class PaymentStore {
|
||||
}
|
||||
|
||||
get isPayer() {
|
||||
if (!this.userStore || !this.currentTariffStatusStore) return;
|
||||
const { user } = this.userStore;
|
||||
|
||||
const { payerInfo } = this.currentTariffStatusStore;
|
||||
@ -353,6 +397,7 @@ class PaymentStore {
|
||||
}
|
||||
|
||||
get isStripePortalAvailable() {
|
||||
if (!this.userStore) return;
|
||||
const { user } = this.userStore;
|
||||
|
||||
if (!user) return false;
|
||||
@ -361,6 +406,7 @@ class PaymentStore {
|
||||
}
|
||||
|
||||
get canUpdateTariff() {
|
||||
if (!this.userStore || !this.currentQuotaStore) return;
|
||||
const { user } = this.userStore;
|
||||
const { isFreeTariff } = this.currentQuotaStore;
|
||||
|
||||
@ -372,6 +418,7 @@ class PaymentStore {
|
||||
}
|
||||
|
||||
get canPayTariff() {
|
||||
if (!this.currentQuotaStore) return;
|
||||
const { addedManagersCount } = this.currentQuotaStore;
|
||||
|
||||
if (this.managersCount >= addedManagersCount) return true;
|
||||
@ -380,6 +427,7 @@ class PaymentStore {
|
||||
}
|
||||
|
||||
get canDowngradeTariff() {
|
||||
if (!this.currentQuotaStore) return;
|
||||
const { addedManagersCount, usedTotalStorageSizeCount } =
|
||||
this.currentQuotaStore;
|
||||
|
||||
@ -391,22 +439,30 @@ class PaymentStore {
|
||||
}
|
||||
|
||||
setRangeStepByQuota = () => {
|
||||
if (!this.paymentQuotasStore) return;
|
||||
|
||||
const { stepAddingQuotaManagers, stepAddingQuotaTotalSize } =
|
||||
this.paymentQuotasStore;
|
||||
|
||||
if (stepAddingQuotaManagers)
|
||||
this.stepByQuotaForManager = stepAddingQuotaManagers;
|
||||
this.minAvailableManagersValue = this.stepByQuotaForManager;
|
||||
|
||||
if (stepAddingQuotaTotalSize)
|
||||
this.stepByQuotaForTotalSize = stepAddingQuotaTotalSize;
|
||||
this.minAvailableTotalSizeValue = this.stepByQuotaForManager;
|
||||
};
|
||||
|
||||
sendPaymentRequest = async (email, userName, message) => {
|
||||
sendPaymentRequest = async (
|
||||
email: string,
|
||||
userName: string,
|
||||
message: string,
|
||||
) => {
|
||||
try {
|
||||
await api.portal.sendPaymentRequest(email, userName, message);
|
||||
toastr.success(t("SuccessfullySentMessage"));
|
||||
// toastr.success(t("SuccessfullySentMessage"));
|
||||
} catch (e) {
|
||||
toastr.error(e);
|
||||
toastr.error(e as TData);
|
||||
}
|
||||
};
|
||||
}
|
@ -13,7 +13,7 @@ import EditingFormStore from "./EditingFormStore";
|
||||
import FilterStore from "./FilterStore";
|
||||
import SelectionStore from "./SelectionPeopleStore";
|
||||
import HeaderMenuStore from "./HeaderMenuStore";
|
||||
import AvatarEditorStore from "./AvatarEditorStore";
|
||||
|
||||
import InviteLinksStore from "./InviteLinksStore";
|
||||
import DialogStore from "./DialogStore";
|
||||
|
||||
@ -36,7 +36,7 @@ class PeopleStore {
|
||||
filterStore = null;
|
||||
selectionStore = null;
|
||||
headerMenuStore = null;
|
||||
avatarEditorStore = null;
|
||||
|
||||
inviteLinksStore = null;
|
||||
dialogStore = null;
|
||||
setupStore = null;
|
||||
@ -74,7 +74,6 @@ class PeopleStore {
|
||||
this.filterStore = new FilterStore();
|
||||
this.selectionStore = new SelectionStore(this);
|
||||
this.headerMenuStore = new HeaderMenuStore(this);
|
||||
this.avatarEditorStore = new AvatarEditorStore(this);
|
||||
this.inviteLinksStore = new InviteLinksStore(this);
|
||||
this.dialogStore = new DialogStore();
|
||||
this.userStore = userStore;
|
||||
|
@ -1,23 +1,47 @@
|
||||
/* eslint-disable no-console */
|
||||
import { makeAutoObservable, runInAction } from "mobx";
|
||||
import { cloneDeep } from "lodash";
|
||||
|
||||
import api from "@docspace/shared/api";
|
||||
|
||||
import { SettingsStore } from "@docspace/shared/store/SettingsStore";
|
||||
import { UserStore } from "@docspace/shared/store/UserStore";
|
||||
import { toastr } from "@docspace/shared/components/toast";
|
||||
|
||||
import defaultConfig from "PUBLIC_DIR/scripts/config.json";
|
||||
|
||||
import {
|
||||
IContextMenuItem,
|
||||
IEventListenerItem,
|
||||
IFileItem,
|
||||
IInfoPanelItem,
|
||||
IMainButtonItem,
|
||||
IProfileMenuItem,
|
||||
IframeWindow,
|
||||
TPlugin,
|
||||
} from "SRC_DIR/helpers/plugins/types";
|
||||
import { TRoomSecurity } from "@docspace/shared/api/rooms/types";
|
||||
import {
|
||||
TFile,
|
||||
TFileSecurity,
|
||||
TFolderSecurity,
|
||||
} from "@docspace/shared/api/files/types";
|
||||
import { TAPIPlugin } from "@docspace/shared/api/plugins/types";
|
||||
import { ModalDialogProps } from "@docspace/shared/components/modal-dialog/ModalDialog.types";
|
||||
|
||||
import { getPluginUrl, messageActions } from "../helpers/plugins/utils";
|
||||
import {
|
||||
PluginFileType,
|
||||
PluginScopes,
|
||||
PluginUsersType,
|
||||
PluginStatus,
|
||||
} from "SRC_DIR/helpers/plugins/constants";
|
||||
import { getPluginUrl, messageActions } from "SRC_DIR/helpers/plugins/utils";
|
||||
PluginDevices,
|
||||
} from "../helpers/plugins/enums";
|
||||
|
||||
let { api: apiConf, proxy: proxyConf } = defaultConfig;
|
||||
let { orign: apiOrigin, prefix: apiPrefix } = apiConf;
|
||||
let { url: proxyURL } = proxyConf;
|
||||
import SelectedFolderStore from "./SelectedFolderStore";
|
||||
|
||||
const { api: apiConf, proxy: proxyConf } = defaultConfig;
|
||||
const { origin: apiOrigin, prefix: apiPrefix } = apiConf;
|
||||
const { url: proxyURL } = proxyConf;
|
||||
|
||||
const origin =
|
||||
window.DocSpaceConfig?.api?.origin || apiOrigin || window.location.origin;
|
||||
@ -25,95 +49,101 @@ const proxy = window.DocSpaceConfig?.proxy?.url || proxyURL;
|
||||
const prefix = window.DocSpaceConfig?.api?.prefix || apiPrefix;
|
||||
|
||||
class PluginStore {
|
||||
settingsStore = null;
|
||||
selectedFolderStore = null;
|
||||
userStore = null;
|
||||
private settingsStore: SettingsStore = {} as SettingsStore;
|
||||
|
||||
plugins = null;
|
||||
private selectedFolderStore: SelectedFolderStore = {} as SelectedFolderStore;
|
||||
|
||||
contextMenuItems = null;
|
||||
infoPanelItems = null;
|
||||
mainButtonItems = null;
|
||||
profileMenuItems = null;
|
||||
eventListenerItems = null;
|
||||
fileItems = null;
|
||||
private userStore: UserStore = {} as UserStore;
|
||||
|
||||
pluginFrame = null;
|
||||
plugins: TPlugin[] = [];
|
||||
|
||||
contextMenuItems: Map<string, IContextMenuItem> = new Map();
|
||||
|
||||
infoPanelItems: Map<string, IInfoPanelItem> = new Map();
|
||||
|
||||
mainButtonItems: Map<string, IMainButtonItem> = new Map();
|
||||
|
||||
profileMenuItems: Map<string, IProfileMenuItem> = new Map();
|
||||
|
||||
eventListenerItems: Map<string, IEventListenerItem> = new Map();
|
||||
|
||||
fileItems: Map<string, IFileItem> = new Map();
|
||||
|
||||
pluginFrame: HTMLIFrameElement | null = null;
|
||||
|
||||
isInit = false;
|
||||
|
||||
settingsPluginDialogVisible = false;
|
||||
currentSettingsDialogPlugin = null;
|
||||
|
||||
currentSettingsDialogPlugin: null | { pluginName: string } = null;
|
||||
|
||||
pluginDialogVisible = false;
|
||||
pluginDialogProps = null;
|
||||
|
||||
pluginDialogProps: null | ModalDialogProps = null;
|
||||
|
||||
deletePluginDialogVisible = false;
|
||||
deletePluginDialogProps = null;
|
||||
|
||||
deletePluginDialogProps: null | { pluginName: string } = null;
|
||||
|
||||
isLoading = true;
|
||||
|
||||
isEmptyList = false;
|
||||
|
||||
constructor(settingsStore, selectedFolderStore, userStore) {
|
||||
constructor(
|
||||
settingsStore: SettingsStore,
|
||||
selectedFolderStore: SelectedFolderStore,
|
||||
userStore: UserStore,
|
||||
) {
|
||||
this.settingsStore = settingsStore;
|
||||
this.selectedFolderStore = selectedFolderStore;
|
||||
this.userStore = userStore;
|
||||
|
||||
this.plugins = [];
|
||||
|
||||
this.contextMenuItems = new Map();
|
||||
this.infoPanelItems = new Map();
|
||||
this.mainButtonItems = new Map();
|
||||
this.profileMenuItems = new Map();
|
||||
this.eventListenerItems = new Map();
|
||||
this.fileItems = new Map();
|
||||
|
||||
makeAutoObservable(this);
|
||||
}
|
||||
|
||||
setIsLoading = (value) => {
|
||||
setIsLoading = (value: boolean) => {
|
||||
this.isLoading = value;
|
||||
};
|
||||
|
||||
setIsEmptyList = (value) => {
|
||||
setIsEmptyList = (value: boolean) => {
|
||||
this.isEmptyList = value;
|
||||
};
|
||||
|
||||
setCurrentSettingsDialogPlugin = (value) => {
|
||||
setCurrentSettingsDialogPlugin = (value: null | { pluginName: string }) => {
|
||||
this.currentSettingsDialogPlugin = value;
|
||||
};
|
||||
|
||||
setSettingsPluginDialogVisible = (value) => {
|
||||
setSettingsPluginDialogVisible = (value: boolean) => {
|
||||
this.settingsPluginDialogVisible = value;
|
||||
};
|
||||
|
||||
setPluginDialogVisible = (value) => {
|
||||
setPluginDialogVisible = (value: boolean) => {
|
||||
this.pluginDialogVisible = value;
|
||||
};
|
||||
|
||||
setPluginDialogProps = (value) => {
|
||||
setPluginDialogProps = (value: null | ModalDialogProps) => {
|
||||
this.pluginDialogProps = value;
|
||||
};
|
||||
|
||||
setDeletePluginDialogVisible = (value) => {
|
||||
setDeletePluginDialogVisible = (value: boolean) => {
|
||||
this.deletePluginDialogVisible = value;
|
||||
};
|
||||
|
||||
setDeletePluginDialogProps = (value) => {
|
||||
setDeletePluginDialogProps = (value: null | { pluginName: string }) => {
|
||||
this.deletePluginDialogProps = value;
|
||||
};
|
||||
|
||||
updatePluginStatus = (name) => {
|
||||
updatePluginStatus = (name: string) => {
|
||||
const plugin = this.plugins.find((p) => p.name === name);
|
||||
|
||||
const newStatus = plugin.getStatus();
|
||||
const newStatus = plugin?.getStatus();
|
||||
|
||||
const pluginIdx = this.plugins.findIndex((p) => p.name === name);
|
||||
|
||||
if (pluginIdx !== -1) {
|
||||
if (this.plugins[pluginIdx].status === newStatus) return;
|
||||
|
||||
this.plugins[pluginIdx].status = newStatus;
|
||||
this.plugins[pluginIdx].status = newStatus || PluginStatus.active;
|
||||
|
||||
if (
|
||||
newStatus === PluginStatus.active &&
|
||||
@ -148,23 +178,25 @@ class PluginStore {
|
||||
}
|
||||
};
|
||||
|
||||
setPluginFrame = (frame) => {
|
||||
setPluginFrame = (frame: HTMLIFrameElement) => {
|
||||
this.pluginFrame = frame;
|
||||
|
||||
this.pluginFrame.contentWindow.Plugins = {};
|
||||
const iWindow = this.pluginFrame?.contentWindow as IframeWindow;
|
||||
|
||||
if (this.pluginFrame && iWindow) iWindow.Plugins = {};
|
||||
};
|
||||
|
||||
setIsInit = (isInit) => {
|
||||
setIsInit = (isInit: boolean) => {
|
||||
this.isInit = isInit;
|
||||
};
|
||||
|
||||
initPlugins = async () => {
|
||||
const frame = document.createElement("iframe");
|
||||
frame.id = "plugin-iframe";
|
||||
frame.width = 0;
|
||||
frame.height = 0;
|
||||
frame.width = "0px";
|
||||
frame.height = "0px";
|
||||
frame.style.display = "none";
|
||||
frame.sandbox = "allow-same-origin allow-scripts";
|
||||
// frame.sandbox = "allow-same-origin allow-scripts";
|
||||
|
||||
document.body.appendChild(frame);
|
||||
|
||||
@ -176,14 +208,17 @@ class PluginStore {
|
||||
};
|
||||
|
||||
updatePlugins = async () => {
|
||||
if (!this.userStore || !this.userStore.user) return;
|
||||
|
||||
const { isAdmin, isOwner } = this.userStore.user;
|
||||
|
||||
this.setIsLoading(true);
|
||||
|
||||
try {
|
||||
this.plugins = [];
|
||||
|
||||
const plugins = await api.plugins.getPlugins(
|
||||
!isAdmin && !isOwner ? true : null
|
||||
!isAdmin && !isOwner ? true : null,
|
||||
);
|
||||
|
||||
this.setIsEmptyList(plugins.length === 0);
|
||||
@ -197,19 +232,19 @@ class PluginStore {
|
||||
}
|
||||
};
|
||||
|
||||
addPlugin = async (data) => {
|
||||
addPlugin = async (data: FormData) => {
|
||||
try {
|
||||
const plugin = await api.plugins.addPlugin(data);
|
||||
|
||||
this.initPlugin(plugin);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
const err = e as { response: { data: { error: { message: string } } } };
|
||||
|
||||
toastr.error(e.response.data.error.message);
|
||||
toastr.error(err.response.data.error.message as string);
|
||||
}
|
||||
};
|
||||
|
||||
uninstallPlugin = async (name) => {
|
||||
uninstallPlugin = async (name: string) => {
|
||||
const pluginIdx = this.plugins.findIndex((p) => p.name === name);
|
||||
|
||||
try {
|
||||
@ -229,31 +264,38 @@ class PluginStore {
|
||||
}
|
||||
};
|
||||
|
||||
initPlugin = (plugin, callback) => {
|
||||
initPlugin = (plugin: TAPIPlugin, callback?: (plugin: TPlugin) => void) => {
|
||||
const onLoad = async () => {
|
||||
const iWindow = this.pluginFrame?.contentWindow as IframeWindow;
|
||||
|
||||
const newPlugin = cloneDeep({
|
||||
...plugin,
|
||||
...this.pluginFrame.contentWindow.Plugins[plugin.pluginName],
|
||||
...iWindow?.Plugins?.[plugin.pluginName],
|
||||
});
|
||||
|
||||
newPlugin.createBy = newPlugin.createBy.displayName;
|
||||
newPlugin.scopes = newPlugin.scopes.split(",");
|
||||
newPlugin.scopes =
|
||||
typeof newPlugin.scopes === "string"
|
||||
? newPlugin.scopes.split(",")
|
||||
: newPlugin.scopes;
|
||||
|
||||
newPlugin.iconUrl = getPluginUrl(newPlugin.url, "");
|
||||
|
||||
this.installPlugin(newPlugin);
|
||||
|
||||
if (newPlugin.scopes.includes(PluginScopes.Settings)) {
|
||||
newPlugin.setAdminPluginSettingsValue(plugin.settings || null);
|
||||
newPlugin.setAdminPluginSettingsValue?.(plugin.settings || null);
|
||||
}
|
||||
|
||||
callback && callback(newPlugin);
|
||||
callback?.(newPlugin);
|
||||
};
|
||||
|
||||
const onError = () => {};
|
||||
|
||||
const frameDoc = this.pluginFrame.contentDocument;
|
||||
const frameDoc = this.pluginFrame?.contentDocument;
|
||||
|
||||
const script = frameDoc.createElement("script");
|
||||
const script = frameDoc?.createElement("script");
|
||||
|
||||
if (script) {
|
||||
script.setAttribute("type", "text/javascript");
|
||||
script.setAttribute("id", `${plugin.name}`);
|
||||
|
||||
@ -263,10 +305,11 @@ class PluginStore {
|
||||
script.src = plugin.url;
|
||||
script.async = true;
|
||||
|
||||
frameDoc.body.appendChild(script);
|
||||
frameDoc?.body.appendChild(script);
|
||||
}
|
||||
};
|
||||
|
||||
installPlugin = async (plugin, addToList = true) => {
|
||||
installPlugin = async (plugin: TPlugin, addToList = true) => {
|
||||
if (addToList) {
|
||||
const idx = this.plugins.findIndex((p) => p.name === plugin.name);
|
||||
|
||||
@ -284,7 +327,7 @@ class PluginStore {
|
||||
if (!plugin || !plugin.enabled) return;
|
||||
|
||||
if (plugin.scopes.includes(PluginScopes.API)) {
|
||||
plugin.setAPI && plugin.setAPI(origin, proxy, prefix);
|
||||
plugin.setAPI?.(origin, proxy, prefix);
|
||||
}
|
||||
|
||||
const { name } = plugin;
|
||||
@ -322,21 +365,22 @@ class PluginStore {
|
||||
}
|
||||
};
|
||||
|
||||
updatePlugin = async (name, status, settings) => {
|
||||
updatePlugin = async (name: string, status: boolean, settings: string) => {
|
||||
try {
|
||||
let currentSettings = settings;
|
||||
let currentStatus = status;
|
||||
|
||||
const oldPlugin = this.pluginList.find((p) => p.name === name);
|
||||
|
||||
if (!currentSettings) currentSettings = oldPlugin.settings || "";
|
||||
if (!currentSettings) currentSettings = oldPlugin?.settings || "";
|
||||
|
||||
if (typeof status !== "boolean") currentStatus = oldPlugin.enabled;
|
||||
if (typeof status !== "boolean")
|
||||
currentStatus = oldPlugin?.enabled || false;
|
||||
|
||||
const plugin = await api.plugins.updatePlugin(
|
||||
name,
|
||||
currentStatus,
|
||||
currentSettings
|
||||
currentSettings,
|
||||
);
|
||||
|
||||
if (typeof status !== "boolean") return plugin;
|
||||
@ -353,7 +397,7 @@ class PluginStore {
|
||||
}
|
||||
};
|
||||
|
||||
activatePlugin = async (name) => {
|
||||
activatePlugin = async (name: string) => {
|
||||
const plugin = this.plugins.find((p) => p.name === name);
|
||||
|
||||
if (!plugin) return;
|
||||
@ -363,7 +407,7 @@ class PluginStore {
|
||||
this.installPlugin(plugin, false);
|
||||
};
|
||||
|
||||
deactivatePlugin = async (name) => {
|
||||
deactivatePlugin = async (name: string) => {
|
||||
const plugin = this.plugins.find((p) => p.name === name);
|
||||
|
||||
if (!plugin) return;
|
||||
@ -416,23 +460,29 @@ class PluginStore {
|
||||
};
|
||||
|
||||
getCurrentDevice = () => {
|
||||
const { currentDeviceType } = this.settingsStore;
|
||||
const currentDeviceType = this.settingsStore.currentDeviceType as unknown;
|
||||
|
||||
return currentDeviceType;
|
||||
return currentDeviceType as PluginDevices;
|
||||
};
|
||||
|
||||
getContextMenuKeysByType = (type, fileExst, security) => {
|
||||
getContextMenuKeysByType = (
|
||||
type: PluginFileType,
|
||||
fileExst: string,
|
||||
security: TRoomSecurity | TFileSecurity | TFolderSecurity,
|
||||
) => {
|
||||
if (!this.contextMenuItems) return;
|
||||
|
||||
const userRole = this.getUserRole();
|
||||
const device = this.getCurrentDevice();
|
||||
|
||||
const itemsMap = Array.from(this.contextMenuItems);
|
||||
const keys = [];
|
||||
const keys: string[] = [];
|
||||
|
||||
switch (type) {
|
||||
case PluginFileType.Files:
|
||||
itemsMap.forEach(([key, item]) => {
|
||||
itemsMap.forEach((val) => {
|
||||
const item = val[1];
|
||||
|
||||
if (!item.fileType) return;
|
||||
|
||||
if (item.fileType.includes(PluginFileType.Files)) {
|
||||
@ -440,8 +490,8 @@ class PluginStore {
|
||||
? item.fileExt.includes(fileExst)
|
||||
: true;
|
||||
|
||||
const correctUserType = item.usersType
|
||||
? item.usersType.includes(userRole)
|
||||
const correctUserType = item.usersTypes
|
||||
? item.usersTypes.includes(userRole)
|
||||
: true;
|
||||
|
||||
const correctDevice = item.devices
|
||||
@ -449,7 +499,8 @@ class PluginStore {
|
||||
: true;
|
||||
|
||||
const correctSecurity = item.security
|
||||
? item.security.every((key) => security?.[key])
|
||||
? // @ts-expect-error its valid key
|
||||
item.security.every((key) => security?.[key])
|
||||
: true;
|
||||
|
||||
if (
|
||||
@ -463,12 +514,12 @@ class PluginStore {
|
||||
});
|
||||
break;
|
||||
case PluginFileType.Folders:
|
||||
itemsMap.forEach(([key, item]) => {
|
||||
if (!item.fileType) return;
|
||||
itemsMap.forEach((val) => {
|
||||
const item = val[1];
|
||||
|
||||
if (item.fileType.includes(PluginFileType.Folders)) {
|
||||
const correctUserType = item.usersType
|
||||
? item.usersType.includes(userRole)
|
||||
if (item.fileType?.includes(PluginFileType.Folders)) {
|
||||
const correctUserType = item.usersTypes
|
||||
? item.usersTypes.includes(userRole)
|
||||
: true;
|
||||
|
||||
const correctDevice = item.devices
|
||||
@ -476,7 +527,8 @@ class PluginStore {
|
||||
: true;
|
||||
|
||||
const correctSecurity = item.security
|
||||
? item?.security?.every((key) => security?.[key])
|
||||
? // @ts-expect-error its valid key
|
||||
item.security.every((key) => security?.[key])
|
||||
: true;
|
||||
|
||||
if (correctUserType && correctDevice && correctSecurity)
|
||||
@ -485,12 +537,12 @@ class PluginStore {
|
||||
});
|
||||
break;
|
||||
case PluginFileType.Rooms:
|
||||
itemsMap.forEach(([key, item]) => {
|
||||
if (!item.fileType) return;
|
||||
itemsMap.forEach((val) => {
|
||||
const item = val[1];
|
||||
|
||||
if (item.fileType.includes(PluginFileType.Rooms)) {
|
||||
const correctUserType = item.usersType
|
||||
? item.usersType.includes(userRole)
|
||||
if (item.fileType?.includes(PluginFileType.Rooms)) {
|
||||
const correctUserType = item.usersTypes
|
||||
? item.usersTypes.includes(userRole)
|
||||
: true;
|
||||
|
||||
const correctDevice = item.devices
|
||||
@ -498,7 +550,8 @@ class PluginStore {
|
||||
: true;
|
||||
|
||||
const correctSecurity = item.security
|
||||
? item.security.every((key) => security?.[key])
|
||||
? // @ts-expect-error its valid key
|
||||
item.security.every((key) => security?.[key])
|
||||
: true;
|
||||
|
||||
if (correctUserType && correctDevice && correctSecurity)
|
||||
@ -507,16 +560,16 @@ class PluginStore {
|
||||
});
|
||||
break;
|
||||
case PluginFileType.Image:
|
||||
itemsMap.forEach(([key, item]) => {
|
||||
if (!item.fileType) return;
|
||||
itemsMap.forEach((val) => {
|
||||
const item = val[1];
|
||||
|
||||
if (item.fileType.includes(PluginFileType.Image)) {
|
||||
if (item.fileType?.includes(PluginFileType.Image)) {
|
||||
const correctFileExt = item.fileExt
|
||||
? item.fileExt.includes(fileExst)
|
||||
: true;
|
||||
|
||||
const correctUserType = item.usersType
|
||||
? item.usersType.includes(userRole)
|
||||
const correctUserType = item.usersTypes
|
||||
? item.usersTypes.includes(userRole)
|
||||
: true;
|
||||
|
||||
const correctDevice = item.devices
|
||||
@ -524,7 +577,8 @@ class PluginStore {
|
||||
: true;
|
||||
|
||||
const correctSecurity = item.security
|
||||
? item.security.every((key) => security?.[key])
|
||||
? // @ts-expect-error its valid key
|
||||
item.security.every((key) => security?.[key])
|
||||
: true;
|
||||
|
||||
if (
|
||||
@ -538,12 +592,12 @@ class PluginStore {
|
||||
});
|
||||
break;
|
||||
case PluginFileType.Video:
|
||||
itemsMap.forEach(([key, item]) => {
|
||||
if (!item.fileType) return;
|
||||
itemsMap.forEach((val) => {
|
||||
const item = val[1];
|
||||
|
||||
if (item.fileType.includes(PluginFileType.Video)) {
|
||||
const correctUserType = item.usersType
|
||||
? item.usersType.includes(userRole)
|
||||
if (item.fileType?.includes(PluginFileType.Video)) {
|
||||
const correctUserType = item.usersTypes
|
||||
? item.usersTypes.includes(userRole)
|
||||
: true;
|
||||
|
||||
const correctDevice = item.devices
|
||||
@ -551,7 +605,8 @@ class PluginStore {
|
||||
: true;
|
||||
|
||||
const correctSecurity = item.security
|
||||
? item.security.every((key) => security?.[key])
|
||||
? // @ts-expect-error its valid key
|
||||
item.security.every((key) => security?.[key])
|
||||
: true;
|
||||
|
||||
if (correctUserType && correctDevice && correctSecurity)
|
||||
@ -560,11 +615,12 @@ class PluginStore {
|
||||
});
|
||||
break;
|
||||
default:
|
||||
itemsMap.forEach(([key, item]) => {
|
||||
itemsMap.forEach((val) => {
|
||||
const item = val[1];
|
||||
if (item.fileType) return;
|
||||
|
||||
const correctUserType = item.usersType
|
||||
? item.usersType.includes(userRole)
|
||||
const correctUserType = item.usersTypes
|
||||
? item.usersTypes.includes(userRole)
|
||||
: true;
|
||||
|
||||
const correctDevice = item.devices
|
||||
@ -572,7 +628,8 @@ class PluginStore {
|
||||
: true;
|
||||
|
||||
const correctSecurity = item.security
|
||||
? item.security.every((key) => security?.[key])
|
||||
? // @ts-expect-error its valid key
|
||||
item.security.every((key) => security?.[key])
|
||||
: true;
|
||||
|
||||
if (correctUserType && correctDevice && correctSecurity)
|
||||
@ -585,7 +642,7 @@ class PluginStore {
|
||||
return keys;
|
||||
};
|
||||
|
||||
updateContextMenuItems = (name) => {
|
||||
updateContextMenuItems = (name: string) => {
|
||||
const plugin = this.plugins.find((p) => p.name === name);
|
||||
|
||||
if (!plugin || !plugin.enabled) return;
|
||||
@ -594,8 +651,8 @@ class PluginStore {
|
||||
|
||||
if (!items) return;
|
||||
|
||||
Array.from(items).map(([key, value]) => {
|
||||
const onClick = async (fileId) => {
|
||||
Array.from(items).forEach(([key, value]) => {
|
||||
const onClick = async (fileId: number) => {
|
||||
if (!value.onClick) return;
|
||||
|
||||
const message = await value.onClick(fileId);
|
||||
@ -618,7 +675,7 @@ class PluginStore {
|
||||
this.updateMainButtonItems,
|
||||
this.updateProfileMenuItems,
|
||||
this.updateEventListenerItems,
|
||||
this.updateFileItems
|
||||
this.updateFileItems,
|
||||
);
|
||||
};
|
||||
|
||||
@ -633,19 +690,19 @@ class PluginStore {
|
||||
});
|
||||
};
|
||||
|
||||
deactivateContextMenuItems = (plugin) => {
|
||||
deactivateContextMenuItems = (plugin: TPlugin) => {
|
||||
if (!plugin) return;
|
||||
|
||||
const items = plugin.getContextMenuItems && plugin.getContextMenuItems();
|
||||
const items = plugin.getContextMenuItems?.();
|
||||
|
||||
if (!items) return;
|
||||
|
||||
Array.from(items).map(([key, value]) => {
|
||||
Array.from(items).forEach(([key]) => {
|
||||
this.contextMenuItems.delete(key);
|
||||
});
|
||||
};
|
||||
|
||||
updateInfoPanelItems = (name) => {
|
||||
updateInfoPanelItems = (name: string) => {
|
||||
const plugin = this.plugins.find((p) => p.name === name);
|
||||
|
||||
if (!plugin || !plugin.enabled) return;
|
||||
@ -657,9 +714,9 @@ class PluginStore {
|
||||
const userRole = this.getUserRole();
|
||||
const device = this.getCurrentDevice();
|
||||
|
||||
Array.from(items).map(([key, value]) => {
|
||||
const correctUserType = value.usersType
|
||||
? value.usersType.includes(userRole)
|
||||
Array.from(items).forEach(([key, value]) => {
|
||||
const correctUserType = value.usersTypes
|
||||
? value.usersTypes.includes(userRole)
|
||||
: true;
|
||||
|
||||
const correctDevice = value.devices
|
||||
@ -671,8 +728,8 @@ class PluginStore {
|
||||
const submenu = { ...value.subMenu };
|
||||
|
||||
if (value.subMenu.onClick) {
|
||||
const onClick = async () => {
|
||||
const message = await value.subMenu.onClick();
|
||||
const onClick = async (id: number) => {
|
||||
const message = await value?.subMenu?.onClick?.(id);
|
||||
|
||||
messageActions(
|
||||
message,
|
||||
@ -692,7 +749,7 @@ class PluginStore {
|
||||
this.updateMainButtonItems,
|
||||
this.updateProfileMenuItems,
|
||||
this.updateEventListenerItems,
|
||||
this.updateFileItems
|
||||
this.updateFileItems,
|
||||
);
|
||||
};
|
||||
|
||||
@ -708,31 +765,31 @@ class PluginStore {
|
||||
});
|
||||
};
|
||||
|
||||
deactivateInfoPanelItems = (plugin) => {
|
||||
deactivateInfoPanelItems = (plugin: TPlugin) => {
|
||||
if (!plugin) return;
|
||||
|
||||
const items = plugin.getInfoPanelItems && plugin.getInfoPanelItems();
|
||||
|
||||
if (!items) return;
|
||||
|
||||
Array.from(items).map(([key, value]) => {
|
||||
Array.from(items).forEach(([key]) => {
|
||||
this.infoPanelItems.delete(key);
|
||||
});
|
||||
};
|
||||
|
||||
updateMainButtonItems = (name) => {
|
||||
updateMainButtonItems = (name: string) => {
|
||||
const plugin = this.plugins.find((p) => p.name === name);
|
||||
|
||||
if (!plugin || !plugin.enabled) return;
|
||||
|
||||
const items = plugin.getMainButtonItems && plugin.getMainButtonItems();
|
||||
const items = plugin.getMainButtonItems?.();
|
||||
|
||||
if (!items) return;
|
||||
|
||||
const userRole = this.getUserRole();
|
||||
const device = this.getCurrentDevice();
|
||||
|
||||
Array.from(items).map(([key, value]) => {
|
||||
Array.from(items).forEach(([key, value]) => {
|
||||
const correctUserType = value.usersType
|
||||
? value.usersType.includes(userRole)
|
||||
: true;
|
||||
@ -743,11 +800,12 @@ class PluginStore {
|
||||
|
||||
if (!correctUserType || !correctDevice) return;
|
||||
|
||||
const newItems = [];
|
||||
if (value.items) {
|
||||
const newItems: IMainButtonItem[] = [];
|
||||
const storeId = this.selectedFolderStore.id;
|
||||
if (value.items && storeId) {
|
||||
value.items.forEach((i) => {
|
||||
const onClick = async () => {
|
||||
const message = await i.onClick(this.selectedFolderStore.id);
|
||||
const message = await i?.onClick?.(storeId);
|
||||
|
||||
messageActions(
|
||||
message,
|
||||
@ -767,7 +825,7 @@ class PluginStore {
|
||||
this.updateMainButtonItems,
|
||||
this.updateProfileMenuItems,
|
||||
this.updateEventListenerItems,
|
||||
this.updateFileItems
|
||||
this.updateFileItems,
|
||||
);
|
||||
};
|
||||
|
||||
@ -781,8 +839,9 @@ class PluginStore {
|
||||
|
||||
const onClick = async () => {
|
||||
if (!value.onClick) return;
|
||||
if (!storeId) return;
|
||||
|
||||
const message = await value.onClick(this.selectedFolderStore.id);
|
||||
const message = await value.onClick(storeId);
|
||||
|
||||
messageActions(
|
||||
message,
|
||||
@ -802,7 +861,7 @@ class PluginStore {
|
||||
this.updateMainButtonItems,
|
||||
this.updateProfileMenuItems,
|
||||
this.updateEventListenerItems,
|
||||
this.updateFileItems
|
||||
this.updateFileItems,
|
||||
);
|
||||
};
|
||||
|
||||
@ -818,19 +877,19 @@ class PluginStore {
|
||||
});
|
||||
};
|
||||
|
||||
deactivateMainButtonItems = (plugin) => {
|
||||
deactivateMainButtonItems = (plugin: TPlugin) => {
|
||||
if (!plugin) return;
|
||||
|
||||
const items = plugin.getMainButtonItems && plugin.getMainButtonItems();
|
||||
|
||||
if (!items) return;
|
||||
|
||||
Array.from(items).map(([key, value]) => {
|
||||
Array.from(items).forEach(([key]) => {
|
||||
this.mainButtonItems.delete(key);
|
||||
});
|
||||
};
|
||||
|
||||
updateProfileMenuItems = (name) => {
|
||||
updateProfileMenuItems = (name: string) => {
|
||||
const plugin = this.plugins.find((p) => p.name === name);
|
||||
|
||||
if (!plugin || !plugin.enabled) return;
|
||||
@ -842,7 +901,7 @@ class PluginStore {
|
||||
const userRole = this.getUserRole();
|
||||
const device = this.getCurrentDevice();
|
||||
|
||||
Array.from(items).map(([key, value]) => {
|
||||
Array.from(items).forEach(([key, value]) => {
|
||||
const correctUserType = value.usersType
|
||||
? value.usersType.includes(userRole)
|
||||
: true;
|
||||
@ -876,7 +935,7 @@ class PluginStore {
|
||||
this.updateMainButtonItems,
|
||||
this.updateProfileMenuItems,
|
||||
this.updateEventListenerItems,
|
||||
this.updateFileItems
|
||||
this.updateFileItems,
|
||||
);
|
||||
};
|
||||
|
||||
@ -891,19 +950,19 @@ class PluginStore {
|
||||
});
|
||||
};
|
||||
|
||||
deactivateProfileMenuItems = (plugin) => {
|
||||
deactivateProfileMenuItems = (plugin: TPlugin) => {
|
||||
if (!plugin) return;
|
||||
|
||||
const items = plugin.getProfileMenuItems && plugin.getProfileMenuItems();
|
||||
|
||||
if (!items) return;
|
||||
|
||||
Array.from(items).map(([key, value]) => {
|
||||
Array.from(items).forEach(([key]) => {
|
||||
this.profileMenuItems.delete(key);
|
||||
});
|
||||
};
|
||||
|
||||
updateEventListenerItems = (name) => {
|
||||
updateEventListenerItems = (name: string) => {
|
||||
const plugin = this.plugins.find((p) => p.name === name);
|
||||
|
||||
if (!plugin || !plugin.enabled) return;
|
||||
@ -916,9 +975,9 @@ class PluginStore {
|
||||
const userRole = this.getUserRole();
|
||||
const device = this.getCurrentDevice();
|
||||
|
||||
Array.from(items).map(([key, value]) => {
|
||||
const correctUserType = value.usersType
|
||||
? value.usersType.includes(userRole)
|
||||
Array.from(items).forEach(([key, value]) => {
|
||||
const correctUserType = value.usersTypes
|
||||
? value.usersTypes.includes(userRole)
|
||||
: true;
|
||||
|
||||
const correctDevice = value.devices
|
||||
@ -926,10 +985,10 @@ class PluginStore {
|
||||
: true;
|
||||
|
||||
if (!correctUserType || !correctDevice) return;
|
||||
const eventHandler = async (e) => {
|
||||
const eventHandler = async () => {
|
||||
if (!value.eventHandler) return;
|
||||
|
||||
const message = await value.eventHandler(e);
|
||||
const message = await value.eventHandler();
|
||||
|
||||
messageActions(
|
||||
message,
|
||||
@ -949,7 +1008,7 @@ class PluginStore {
|
||||
this.updateMainButtonItems,
|
||||
this.updateProfileMenuItems,
|
||||
this.updateEventListenerItems,
|
||||
this.updateFileItems
|
||||
this.updateFileItems,
|
||||
);
|
||||
};
|
||||
|
||||
@ -962,7 +1021,7 @@ class PluginStore {
|
||||
});
|
||||
};
|
||||
|
||||
deactivateEventListenerItems = (plugin) => {
|
||||
deactivateEventListenerItems = (plugin: TPlugin) => {
|
||||
if (!plugin) return;
|
||||
|
||||
const items =
|
||||
@ -970,12 +1029,12 @@ class PluginStore {
|
||||
|
||||
if (!items) return;
|
||||
|
||||
Array.from(items).map(([key, value]) => {
|
||||
Array.from(items).forEach(([key]) => {
|
||||
this.eventListenerItems.delete(key);
|
||||
});
|
||||
};
|
||||
|
||||
updateFileItems = (name) => {
|
||||
updateFileItems = (name: string) => {
|
||||
const plugin = this.plugins.find((p) => p.name === name);
|
||||
|
||||
if (!plugin || !plugin.enabled) return;
|
||||
@ -986,7 +1045,7 @@ class PluginStore {
|
||||
|
||||
const userRole = this.getUserRole();
|
||||
|
||||
Array.from(items).map(([key, value]) => {
|
||||
Array.from(items).forEach(([key, value]) => {
|
||||
const correctUserType = value.usersType
|
||||
? value.usersType.includes(userRole)
|
||||
: true;
|
||||
@ -996,7 +1055,7 @@ class PluginStore {
|
||||
const fileIcon = `${plugin.iconUrl}/assets/${value.fileRowIcon}`;
|
||||
const fileIconTile = `${plugin.iconUrl}/assets/${value.fileTileIcon}`;
|
||||
|
||||
const onClick = async (item) => {
|
||||
const onClick = async (item: TFile) => {
|
||||
const device = this.getCurrentDevice();
|
||||
const correctDevice = value.devices
|
||||
? value.devices.includes(device)
|
||||
@ -1023,7 +1082,7 @@ class PluginStore {
|
||||
this.updateMainButtonItems,
|
||||
this.updateProfileMenuItems,
|
||||
this.updateEventListenerItems,
|
||||
this.updateFileItems
|
||||
this.updateFileItems,
|
||||
);
|
||||
};
|
||||
|
||||
@ -1038,14 +1097,14 @@ class PluginStore {
|
||||
});
|
||||
};
|
||||
|
||||
deactivateFileItems = (plugin) => {
|
||||
deactivateFileItems = (plugin: TPlugin) => {
|
||||
if (!plugin) return;
|
||||
|
||||
const items = plugin.getFileItems && plugin.getFileItems();
|
||||
|
||||
if (!items) return;
|
||||
|
||||
Array.from(items).map(([key, value]) => {
|
||||
Array.from(items).forEach(([key]) => {
|
||||
this.fileItems.delete(key);
|
||||
});
|
||||
};
|
||||
@ -1063,14 +1122,15 @@ class PluginStore {
|
||||
}
|
||||
|
||||
get contextMenuItemsList() {
|
||||
const items = [];
|
||||
|
||||
Array.from(this.contextMenuItems, ([key, value]) => {
|
||||
items.push({ key, value: { ...value } });
|
||||
});
|
||||
const items: { key: string; value: IContextMenuItem }[] = Array.from(
|
||||
this.contextMenuItems,
|
||||
([key, value]) => {
|
||||
return { key, value: { ...value } };
|
||||
},
|
||||
);
|
||||
|
||||
if (items.length > 0) {
|
||||
items.sort((a, b) => a.value.position < b.value.position);
|
||||
// items.sort((a, b) => a.value.position < b.value.position);
|
||||
|
||||
return items;
|
||||
}
|
||||
@ -1079,29 +1139,25 @@ class PluginStore {
|
||||
}
|
||||
|
||||
get infoPanelItemsList() {
|
||||
const items = [];
|
||||
|
||||
Array.from(this.infoPanelItems, ([key, value]) => {
|
||||
items.push({ key, value: { ...value } });
|
||||
const items = Array.from(this.infoPanelItems, ([key, value]) => {
|
||||
return { key, value: { ...value } };
|
||||
});
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
get profileMenuItemsList() {
|
||||
const items = [];
|
||||
|
||||
Array.from(this.profileMenuItems, ([key, value]) => {
|
||||
items.push({
|
||||
const items = Array.from(this.profileMenuItems, ([key, value]) => {
|
||||
return {
|
||||
key,
|
||||
value: {
|
||||
...value,
|
||||
},
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
if (items.length > 0) {
|
||||
items.sort((a, b) => a.value.position < b.value.position);
|
||||
// items.sort((a, b) => a.value.position < b.value.position);
|
||||
|
||||
return items;
|
||||
}
|
||||
@ -1110,19 +1166,17 @@ class PluginStore {
|
||||
}
|
||||
|
||||
get mainButtonItemsList() {
|
||||
const items = [];
|
||||
|
||||
Array.from(this.mainButtonItems, ([key, value]) => {
|
||||
items.push({
|
||||
const items = Array.from(this.mainButtonItems, ([key, value]) => {
|
||||
return {
|
||||
key,
|
||||
value: {
|
||||
...value,
|
||||
},
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
if (items.length > 0) {
|
||||
items.sort((a, b) => a.value.position < b.value.position);
|
||||
// items.sort((a, b) => a.value.position < b.value.position);
|
||||
|
||||
return items;
|
||||
}
|
||||
@ -1131,15 +1185,13 @@ class PluginStore {
|
||||
}
|
||||
|
||||
get eventListenerItemsList() {
|
||||
const items = [];
|
||||
|
||||
Array.from(this.eventListenerItems, ([key, value]) => {
|
||||
items.push({
|
||||
const items = Array.from(this.eventListenerItems, ([key, value]) => {
|
||||
return {
|
||||
key,
|
||||
value: {
|
||||
...value,
|
||||
},
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
if (items.length > 0) {
|
||||
@ -1150,15 +1202,13 @@ class PluginStore {
|
||||
}
|
||||
|
||||
get fileItemsList() {
|
||||
const items = [];
|
||||
|
||||
Array.from(this.fileItems, ([key, value]) => {
|
||||
items.push({
|
||||
const items = Array.from(this.fileItems, ([key, value]) => {
|
||||
return {
|
||||
key,
|
||||
value: {
|
||||
...value,
|
||||
},
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
if (items.length > 0) {
|
@ -1,219 +0,0 @@
|
||||
import { ShareAccessRights } from "@docspace/shared/enums";
|
||||
import { makeAutoObservable } from "mobx";
|
||||
import { setDocumentTitle } from "SRC_DIR/helpers/utils";
|
||||
|
||||
class SelectedFolderStore {
|
||||
folders = null;
|
||||
parentId = null;
|
||||
filesCount = null;
|
||||
foldersCount = null;
|
||||
isShareable = null;
|
||||
new = null;
|
||||
id = null;
|
||||
title = null;
|
||||
access = null;
|
||||
shared = null;
|
||||
created = null;
|
||||
createdBy = null;
|
||||
updated = null;
|
||||
updatedBy = null;
|
||||
rootFolderType = null;
|
||||
pathParts = null;
|
||||
navigationPath = null;
|
||||
providerItem = null;
|
||||
providerKey = null;
|
||||
providerId = null;
|
||||
roomType = null;
|
||||
pinned = null;
|
||||
isRoom = null;
|
||||
isArchive = null;
|
||||
logo = null;
|
||||
tags = null;
|
||||
rootFolderId = null;
|
||||
settingsStore = null;
|
||||
security = null;
|
||||
type = null;
|
||||
inRoom = false;
|
||||
isFolder = true;
|
||||
|
||||
constructor(settingsStore) {
|
||||
makeAutoObservable(this);
|
||||
this.settingsStore = settingsStore;
|
||||
}
|
||||
|
||||
getSelectedFolder = () => {
|
||||
return {
|
||||
folders: this.folders,
|
||||
parentId: this.parentId,
|
||||
filesCount: this.filesCount,
|
||||
foldersCount: this.foldersCount,
|
||||
isShareable: this.isShareable,
|
||||
new: this.new,
|
||||
id: this.id,
|
||||
title: this.title,
|
||||
access: this.access,
|
||||
shared: this.shared,
|
||||
created: this.created,
|
||||
createdBy: this.createdBy,
|
||||
updated: this.updated,
|
||||
updatedBy: this.updatedBy,
|
||||
rootFolderType: this.rootFolderType,
|
||||
pathParts: this.pathParts,
|
||||
navigationPath: this.navigationPath,
|
||||
providerItem: this.providerItem,
|
||||
providerKey: this.providerKey,
|
||||
providerId: this.providerId,
|
||||
roomType: this.roomType,
|
||||
pinned: this.pinned,
|
||||
isRoom: this.isRoom,
|
||||
logo: this.logo,
|
||||
tags: this.tags,
|
||||
rootFolderId: this.rootFolderId,
|
||||
security: this.security,
|
||||
inRoom: this.inRoom,
|
||||
isFolder: this.isFolder,
|
||||
};
|
||||
};
|
||||
|
||||
get isRootFolder() {
|
||||
return this.pathParts && this.pathParts.length <= 1;
|
||||
}
|
||||
|
||||
get canCopyPublicLink() {
|
||||
return (
|
||||
this.access === ShareAccessRights.RoomManager ||
|
||||
this.access === ShareAccessRights.None
|
||||
);
|
||||
}
|
||||
|
||||
toDefault = () => {
|
||||
this.folders = null;
|
||||
this.parentId = null;
|
||||
this.filesCount = null;
|
||||
this.foldersCount = null;
|
||||
this.isShareable = null;
|
||||
this.new = null;
|
||||
this.id = null;
|
||||
this.title = null;
|
||||
this.access = null;
|
||||
this.shared = null;
|
||||
this.created = null;
|
||||
this.createdBy = null;
|
||||
this.updated = null;
|
||||
this.updatedBy = null;
|
||||
this.rootFolderType = null;
|
||||
this.pathParts = null;
|
||||
this.navigationPath = null;
|
||||
this.providerItem = null;
|
||||
this.providerKey = null;
|
||||
this.providerId = null;
|
||||
this.roomType = null;
|
||||
this.pinned = null;
|
||||
this.isRoom = null;
|
||||
this.logo = null;
|
||||
this.tags = null;
|
||||
this.rootFolderId = null;
|
||||
this.security = null;
|
||||
this.type = null;
|
||||
this.inRoom = false;
|
||||
};
|
||||
|
||||
setParentId = (parentId) => {
|
||||
this.parentId = parentId;
|
||||
};
|
||||
|
||||
setRoomType = (roomType) => {
|
||||
this.roomType = roomType;
|
||||
};
|
||||
|
||||
setCreatedBy = (createdBy) => {
|
||||
this.createdBy = createdBy;
|
||||
};
|
||||
|
||||
setNavigationPath = (navigationPath) => {
|
||||
this.navigationPath = navigationPath;
|
||||
};
|
||||
|
||||
setShared = (shared) => {
|
||||
this.shared = shared;
|
||||
};
|
||||
|
||||
updateEditedSelectedRoom = (title = this.title, tags = this.tags) => {
|
||||
this.title = title;
|
||||
this.tags = tags;
|
||||
};
|
||||
|
||||
setInRoom = (inRoom) => {
|
||||
this.inRoom = inRoom;
|
||||
};
|
||||
|
||||
addDefaultLogoPaths = () => {
|
||||
const cachebreaker = new Date().getTime();
|
||||
this.logo = {
|
||||
small: `/storage/room_logos/root/${this.id}_small.png?` + cachebreaker,
|
||||
medium: `/storage/room_logos/root/${this.id}_medium.png?` + cachebreaker,
|
||||
large: `/storage/room_logos/root/${this.id}_large.png?` + cachebreaker,
|
||||
original:
|
||||
`/storage/room_logos/root/${this.id}_original.png?` + cachebreaker,
|
||||
};
|
||||
};
|
||||
|
||||
removeLogoPaths = () => {
|
||||
this.logo = {
|
||||
small: "",
|
||||
medium: "",
|
||||
large: "",
|
||||
original: "",
|
||||
};
|
||||
};
|
||||
|
||||
updateLogoPathsCacheBreaker = () => {
|
||||
if (!this.logo.original) return;
|
||||
|
||||
const cachebreaker = new Date().getTime();
|
||||
this.logo = {
|
||||
small: this.logo.small.split("?")[0] + "?" + cachebreaker,
|
||||
medium: this.logo.medium.split("?")[0] + "?" + cachebreaker,
|
||||
large: this.logo.large.split("?")[0] + "?" + cachebreaker,
|
||||
original: this.logo.original.split("?")[0] + "?" + cachebreaker,
|
||||
};
|
||||
};
|
||||
|
||||
setSelectedFolder = (selectedFolder) => {
|
||||
const { socketHelper } = this.settingsStore;
|
||||
|
||||
if (this.id !== null) {
|
||||
socketHelper.emit({
|
||||
command: "unsubscribe",
|
||||
data: { roomParts: `DIR-${this.id}`, individual: true },
|
||||
});
|
||||
}
|
||||
|
||||
if (selectedFolder) {
|
||||
socketHelper.emit({
|
||||
command: "subscribe",
|
||||
data: { roomParts: `DIR-${selectedFolder.id}`, individual: true },
|
||||
});
|
||||
}
|
||||
|
||||
if (!selectedFolder) {
|
||||
this.toDefault();
|
||||
} else {
|
||||
const selectedFolderItems = Object.keys(selectedFolder);
|
||||
|
||||
if (!selectedFolderItems.includes("roomType")) this.roomType = null;
|
||||
|
||||
setDocumentTitle(selectedFolder.title);
|
||||
|
||||
if (!selectedFolder.hasOwnProperty("type")) this.type = null;
|
||||
|
||||
for (let key of selectedFolderItems) {
|
||||
if (key in this) {
|
||||
this[key] = selectedFolder[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export default SelectedFolderStore;
|
304
packages/client/src/store/SelectedFolderStore.ts
Normal file
304
packages/client/src/store/SelectedFolderStore.ts
Normal file
@ -0,0 +1,304 @@
|
||||
import { makeAutoObservable } from "mobx";
|
||||
|
||||
import { SettingsStore } from "@docspace/shared/store/SettingsStore";
|
||||
import {
|
||||
FolderType,
|
||||
RoomsType,
|
||||
ShareAccessRights,
|
||||
} from "@docspace/shared/enums";
|
||||
import {
|
||||
NonFunctionProperties,
|
||||
NonFunctionPropertyNames,
|
||||
TCreatedBy,
|
||||
TPathParts,
|
||||
} from "@docspace/shared/types";
|
||||
import { TFolder, TFolderSecurity } from "@docspace/shared/api/files/types";
|
||||
import { TLogo, TRoomSecurity } from "@docspace/shared/api/rooms/types";
|
||||
|
||||
import { setDocumentTitle } from "../helpers/utils";
|
||||
|
||||
export type TNavigationPath = {
|
||||
id: number;
|
||||
title: string;
|
||||
isRoom: boolean;
|
||||
roomType: RoomsType;
|
||||
isRootRoom: boolean;
|
||||
shared: boolean;
|
||||
canCopyPublicLink: boolean;
|
||||
};
|
||||
|
||||
type ExcludeTypes = SettingsStore | Function;
|
||||
|
||||
export type TSelectedFolder = NonFunctionProperties<
|
||||
SelectedFolderStore,
|
||||
ExcludeTypes
|
||||
>;
|
||||
|
||||
export type TSetSelectedFolder = {
|
||||
[key in NonFunctionPropertyNames<
|
||||
SelectedFolderStore,
|
||||
ExcludeTypes
|
||||
>]?: TSelectedFolder[key];
|
||||
};
|
||||
|
||||
class SelectedFolderStore {
|
||||
folders: TFolder[] | null = null;
|
||||
|
||||
parentId = 0;
|
||||
|
||||
filesCount = 0;
|
||||
|
||||
foldersCount = 0;
|
||||
|
||||
isShareable = false;
|
||||
|
||||
new = 0;
|
||||
|
||||
id: number | string | null = null;
|
||||
|
||||
title: string = "";
|
||||
|
||||
access: ShareAccessRights | null = null;
|
||||
|
||||
shared = false;
|
||||
|
||||
created: Date | null = null;
|
||||
|
||||
createdBy: TCreatedBy | null = null;
|
||||
|
||||
updated: Date | null = null;
|
||||
|
||||
updatedBy: TCreatedBy | null = null;
|
||||
|
||||
rootFolderType: FolderType | null = null;
|
||||
|
||||
pathParts: TPathParts[] = [];
|
||||
|
||||
navigationPath: TNavigationPath[] = [];
|
||||
|
||||
providerItem = null;
|
||||
|
||||
providerKey = null;
|
||||
|
||||
providerId = null;
|
||||
|
||||
roomType: RoomsType | null = null;
|
||||
|
||||
pinned = false;
|
||||
|
||||
isRoom = false;
|
||||
|
||||
isArchive = false;
|
||||
|
||||
logo: TLogo | null = null;
|
||||
|
||||
tags: string[] = [];
|
||||
|
||||
rootFolderId: number = 0;
|
||||
|
||||
private settingsStore: SettingsStore = {} as SettingsStore;
|
||||
|
||||
security: TFolderSecurity | TRoomSecurity | null = null;
|
||||
|
||||
type = null;
|
||||
|
||||
inRoom = false;
|
||||
|
||||
isFolder = true;
|
||||
|
||||
mute = false;
|
||||
|
||||
private = false;
|
||||
|
||||
canShare = false;
|
||||
|
||||
constructor(settingsStore: SettingsStore) {
|
||||
makeAutoObservable(this);
|
||||
this.settingsStore = settingsStore;
|
||||
}
|
||||
|
||||
getSelectedFolder: () => TSelectedFolder = () => {
|
||||
return {
|
||||
folders: this.folders,
|
||||
parentId: this.parentId,
|
||||
filesCount: this.filesCount,
|
||||
foldersCount: this.foldersCount,
|
||||
isShareable: this.isShareable,
|
||||
new: this.new,
|
||||
id: this.id,
|
||||
title: this.title,
|
||||
access: this.access,
|
||||
shared: this.shared,
|
||||
created: this.created,
|
||||
createdBy: this.createdBy,
|
||||
updated: this.updated,
|
||||
updatedBy: this.updatedBy,
|
||||
rootFolderType: this.rootFolderType,
|
||||
pathParts: this.pathParts,
|
||||
navigationPath: this.navigationPath,
|
||||
providerItem: this.providerItem,
|
||||
providerKey: this.providerKey,
|
||||
providerId: this.providerId,
|
||||
roomType: this.roomType,
|
||||
pinned: this.pinned,
|
||||
isRoom: this.isRoom,
|
||||
logo: this.logo,
|
||||
tags: this.tags,
|
||||
rootFolderId: this.rootFolderId,
|
||||
security: this.security,
|
||||
inRoom: this.inRoom,
|
||||
isFolder: this.isFolder,
|
||||
mute: this.mute,
|
||||
private: this.private,
|
||||
canShare: this.canShare,
|
||||
isArchive: this.isArchive,
|
||||
canCopyPublicLink: this.canCopyPublicLink,
|
||||
type: this.type,
|
||||
isRootFolder: this.isRootFolder,
|
||||
};
|
||||
};
|
||||
|
||||
get isRootFolder() {
|
||||
return this.pathParts && this.pathParts.length <= 1;
|
||||
}
|
||||
|
||||
get canCopyPublicLink() {
|
||||
return (
|
||||
this.access === ShareAccessRights.RoomManager ||
|
||||
this.access === ShareAccessRights.None
|
||||
);
|
||||
}
|
||||
|
||||
toDefault = () => {
|
||||
this.folders = null;
|
||||
this.parentId = 0;
|
||||
this.filesCount = 0;
|
||||
this.foldersCount = 0;
|
||||
this.isShareable = false;
|
||||
this.new = 0;
|
||||
this.id = 0;
|
||||
this.title = "";
|
||||
this.access = null;
|
||||
this.shared = false;
|
||||
this.created = null;
|
||||
this.createdBy = null;
|
||||
this.updated = null;
|
||||
this.updatedBy = null;
|
||||
this.rootFolderType = null;
|
||||
this.pathParts = [];
|
||||
this.navigationPath = [];
|
||||
this.providerItem = null;
|
||||
this.providerKey = null;
|
||||
this.providerId = null;
|
||||
this.roomType = null;
|
||||
this.pinned = false;
|
||||
this.isRoom = false;
|
||||
this.logo = null;
|
||||
this.tags = [];
|
||||
this.rootFolderId = 0;
|
||||
this.security = null;
|
||||
this.type = null;
|
||||
this.inRoom = false;
|
||||
};
|
||||
|
||||
setParentId = (parentId: number) => {
|
||||
this.parentId = parentId;
|
||||
};
|
||||
|
||||
setRoomType = (roomType: RoomsType) => {
|
||||
this.roomType = roomType;
|
||||
};
|
||||
|
||||
setCreatedBy = (createdBy: TCreatedBy) => {
|
||||
this.createdBy = createdBy;
|
||||
};
|
||||
|
||||
setNavigationPath = (navigationPath: TNavigationPath[]) => {
|
||||
this.navigationPath = navigationPath;
|
||||
};
|
||||
|
||||
setShared = (shared: boolean) => {
|
||||
this.shared = shared;
|
||||
};
|
||||
|
||||
updateEditedSelectedRoom = (title = this.title, tags = this.tags) => {
|
||||
this.title = title;
|
||||
this.tags = tags;
|
||||
};
|
||||
|
||||
setInRoom = (inRoom: boolean) => {
|
||||
this.inRoom = inRoom;
|
||||
};
|
||||
|
||||
addDefaultLogoPaths = () => {
|
||||
const cachebreaker = new Date().getTime();
|
||||
this.logo = {
|
||||
small: `/storage/room_logos/root/${this.id}_small.png?${cachebreaker}`,
|
||||
medium: `/storage/room_logos/root/${this.id}_medium.png?${cachebreaker}`,
|
||||
large: `/storage/room_logos/root/${this.id}_large.png?${cachebreaker}`,
|
||||
original: `/storage/room_logos/root/${this.id}_original.png?${cachebreaker}`,
|
||||
};
|
||||
};
|
||||
|
||||
removeLogoPaths = () => {
|
||||
this.logo = {
|
||||
small: "",
|
||||
medium: "",
|
||||
large: "",
|
||||
original: "",
|
||||
};
|
||||
};
|
||||
|
||||
updateLogoPathsCacheBreaker = () => {
|
||||
if (!this.logo?.original) return;
|
||||
|
||||
const cachebreaker = new Date().getTime();
|
||||
this.logo = {
|
||||
small: `${this.logo.small.split("?")[0]}?${cachebreaker}`,
|
||||
medium: `${this.logo.medium.split("?")[0]}?${cachebreaker}`,
|
||||
large: `${this.logo.large.split("?")[0]}?${cachebreaker}`,
|
||||
original: `${this.logo.original.split("?")[0]}?${cachebreaker}`,
|
||||
};
|
||||
};
|
||||
|
||||
setSelectedFolder: (selectedFolder: TSetSelectedFolder | null) => void = (
|
||||
selectedFolder,
|
||||
) => {
|
||||
const socketHelper = this.settingsStore?.socketHelper;
|
||||
|
||||
if (this.id !== null && socketHelper) {
|
||||
socketHelper.emit({
|
||||
command: "unsubscribe",
|
||||
data: { roomParts: `DIR-${this.id}`, individual: true },
|
||||
});
|
||||
}
|
||||
|
||||
if (selectedFolder && socketHelper) {
|
||||
socketHelper.emit({
|
||||
command: "subscribe",
|
||||
data: { roomParts: `DIR-${selectedFolder.id}`, individual: true },
|
||||
});
|
||||
}
|
||||
|
||||
if (!selectedFolder) {
|
||||
this.toDefault();
|
||||
} else {
|
||||
const selectedFolderItems = Object.keys(selectedFolder);
|
||||
|
||||
if (!selectedFolderItems.includes("roomType")) this.roomType = null;
|
||||
|
||||
setDocumentTitle(selectedFolder.title);
|
||||
|
||||
if (!("type" in selectedFolder)) this.type = null;
|
||||
|
||||
Object.entries(selectedFolder).forEach(([key, item]) => {
|
||||
if (key in this) {
|
||||
// @ts-expect-error its always be good
|
||||
this[key] = item;
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export default SelectedFolderStore;
|
@ -1,34 +1,37 @@
|
||||
import { makeAutoObservable } from "mobx";
|
||||
|
||||
import {
|
||||
getMachineName,
|
||||
setPortalOwner,
|
||||
getIsLicenseRequired,
|
||||
setLicense,
|
||||
} from "@docspace/shared/api/settings";
|
||||
import { makeAutoObservable } from "mobx";
|
||||
|
||||
class WizardStore {
|
||||
isWizardLoaded = false;
|
||||
|
||||
isLicenseRequired = false;
|
||||
|
||||
machineName = "unknown";
|
||||
licenseUpload = null;
|
||||
|
||||
licenseUpload: null | string = null;
|
||||
|
||||
constructor() {
|
||||
makeAutoObservable(this);
|
||||
}
|
||||
|
||||
setIsWizardLoaded = (isWizardLoaded) => {
|
||||
setIsWizardLoaded = (isWizardLoaded: boolean) => {
|
||||
this.isWizardLoaded = isWizardLoaded;
|
||||
};
|
||||
|
||||
setMachineName = (machineName) => {
|
||||
setMachineName = (machineName: string) => {
|
||||
this.machineName = machineName;
|
||||
};
|
||||
|
||||
setIsRequiredLicense = (isRequired) => {
|
||||
setIsRequiredLicense = (isRequired: boolean) => {
|
||||
this.isLicenseRequired = isRequired;
|
||||
};
|
||||
|
||||
setLicenseUpload = (message) => {
|
||||
setLicenseUpload = (message: null | string) => {
|
||||
this.licenseUpload = message;
|
||||
};
|
||||
|
||||
@ -36,40 +39,18 @@ class WizardStore {
|
||||
this.setLicenseUpload(null);
|
||||
};
|
||||
|
||||
getMachineName = async (token) => {
|
||||
getMachineName = async (token: string) => {
|
||||
const machineName = await getMachineName(token);
|
||||
this.machineName = machineName;
|
||||
};
|
||||
|
||||
setPortalOwner = async (
|
||||
email,
|
||||
hash,
|
||||
lng,
|
||||
timeZone,
|
||||
confirmKey,
|
||||
analytics
|
||||
) => {
|
||||
const response = await setPortalOwner(
|
||||
email,
|
||||
hash,
|
||||
lng,
|
||||
timeZone,
|
||||
confirmKey,
|
||||
analytics
|
||||
);
|
||||
|
||||
console.log("setPortalOwner", response);
|
||||
|
||||
return Promise.resolve(response);
|
||||
};
|
||||
|
||||
getIsRequiredLicense = async () => {
|
||||
const isRequired = await getIsLicenseRequired();
|
||||
|
||||
this.setIsRequiredLicense(isRequired);
|
||||
};
|
||||
|
||||
setLicense = async (confirmKey, data) => {
|
||||
setLicense = async (confirmKey: string, data: FormData) => {
|
||||
const message = await setLicense(confirmKey, data);
|
||||
|
||||
this.setLicenseUpload(message);
|
@ -60,14 +60,14 @@ const selectedFolderStore = new SelectedFolderStore(settingsStore);
|
||||
const pluginStore = new PluginStore(
|
||||
settingsStore,
|
||||
selectedFolderStore,
|
||||
userStore
|
||||
userStore,
|
||||
);
|
||||
|
||||
const paymentStore = new PaymentStore(
|
||||
userStore,
|
||||
currentTariffStatusStore,
|
||||
currentQuotaStore,
|
||||
paymentQuotasStore
|
||||
paymentQuotasStore,
|
||||
);
|
||||
const wizardStore = new WizardStore();
|
||||
const setupStore = new SettingsSetupStore(tfaStore, authStore, settingsStore);
|
||||
@ -86,7 +86,7 @@ const infoPanelStore = new InfoPanelStore(userStore);
|
||||
const treeFoldersStore = new TreeFoldersStore(
|
||||
selectedFolderStore,
|
||||
settingsStore,
|
||||
publicRoomStore
|
||||
publicRoomStore,
|
||||
);
|
||||
|
||||
const clientLoadingStore = new ClientLoadingStore();
|
||||
@ -97,13 +97,13 @@ const filesSettingsStore = new FilesSettingsStore(
|
||||
publicRoomStore,
|
||||
pluginStore,
|
||||
authStore,
|
||||
settingsStore
|
||||
settingsStore,
|
||||
);
|
||||
|
||||
const accessRightsStore = new AccessRightsStore(
|
||||
authStore,
|
||||
selectedFolderStore,
|
||||
userStore
|
||||
userStore,
|
||||
);
|
||||
|
||||
const filesStore = new FilesStore(
|
||||
@ -119,12 +119,12 @@ const filesStore = new FilesStore(
|
||||
infoPanelStore,
|
||||
userStore,
|
||||
currentTariffStatusStore,
|
||||
settingsStore
|
||||
settingsStore,
|
||||
);
|
||||
|
||||
const mediaViewerDataStore = new MediaViewerDataStore(
|
||||
filesStore,
|
||||
publicRoomStore
|
||||
publicRoomStore,
|
||||
);
|
||||
|
||||
const oformsStore = new OformsStore(settingsStore, infoPanelStore, userStore);
|
||||
@ -139,7 +139,7 @@ const dialogsStore = new DialogsStore(
|
||||
filesStore,
|
||||
selectedFolderStore,
|
||||
versionHistoryStore,
|
||||
infoPanelStore
|
||||
infoPanelStore,
|
||||
);
|
||||
|
||||
const peopleStore = new PeopleStore(
|
||||
@ -150,7 +150,7 @@ const peopleStore = new PeopleStore(
|
||||
infoPanelStore,
|
||||
userStore,
|
||||
tfaStore,
|
||||
settingsStore
|
||||
settingsStore,
|
||||
);
|
||||
|
||||
const uploadDataStore = new UploadDataStore(
|
||||
@ -161,7 +161,7 @@ const uploadDataStore = new UploadDataStore(
|
||||
secondaryProgressDataStore,
|
||||
primaryProgressDataStore,
|
||||
dialogsStore,
|
||||
filesSettingsStore
|
||||
filesSettingsStore,
|
||||
);
|
||||
|
||||
const filesActionsStore = new FilesActionsStore(
|
||||
@ -179,7 +179,7 @@ const filesActionsStore = new FilesActionsStore(
|
||||
pluginStore,
|
||||
infoPanelStore,
|
||||
userStore,
|
||||
currentTariffStatusStore
|
||||
currentTariffStatusStore,
|
||||
);
|
||||
|
||||
const contextOptionsStore = new ContextOptionsStore(
|
||||
@ -198,7 +198,7 @@ const contextOptionsStore = new ContextOptionsStore(
|
||||
pluginStore,
|
||||
infoPanelStore,
|
||||
currentTariffStatusStore,
|
||||
userStore
|
||||
userStore,
|
||||
);
|
||||
|
||||
const hotkeyStore = new HotkeyStore(
|
||||
@ -208,7 +208,7 @@ const hotkeyStore = new HotkeyStore(
|
||||
filesActionsStore,
|
||||
treeFoldersStore,
|
||||
uploadDataStore,
|
||||
selectedFolderStore
|
||||
selectedFolderStore,
|
||||
);
|
||||
|
||||
const profileActionsStore = new ProfileActionsStore(
|
||||
@ -219,7 +219,7 @@ const profileActionsStore = new ProfileActionsStore(
|
||||
selectedFolderStore,
|
||||
pluginStore,
|
||||
userStore,
|
||||
settingsStore
|
||||
settingsStore,
|
||||
);
|
||||
|
||||
peopleStore.profileActionsStore = profileActionsStore;
|
||||
@ -247,7 +247,7 @@ const createEditRoomStore = new CreateEditRoomStore(
|
||||
settingsStore,
|
||||
infoPanelStore,
|
||||
currentQuotaStore,
|
||||
clientLoadingStore
|
||||
clientLoadingStore,
|
||||
);
|
||||
|
||||
const webhooksStore = new WebhooksStore(settingsStore);
|
||||
@ -262,8 +262,8 @@ const store = {
|
||||
paymentQuotasStore,
|
||||
settingsStore,
|
||||
|
||||
payments: paymentStore,
|
||||
wizard: wizardStore,
|
||||
paymentStore,
|
||||
wizardStore,
|
||||
setup: setupStore,
|
||||
confirm: confirmStore,
|
||||
backup: backupStore,
|
||||
|
17
packages/client/tsconfig.eslint.json
Normal file
17
packages/client/tsconfig.eslint.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"include": [
|
||||
// 👇️ add all the directories and files
|
||||
// that you want to lint here
|
||||
"src",
|
||||
// add all files in which you see
|
||||
// the "parserOptions.project" error
|
||||
".eslintrc.cjs",
|
||||
"__mocks__",
|
||||
"jest.config.ts",
|
||||
".storybook",
|
||||
"babel.config.ts",
|
||||
"index.d.ts",
|
||||
"tsconfig.eslint.json"
|
||||
]
|
||||
}
|
@ -1,21 +1,11 @@
|
||||
{
|
||||
"extends": "../shared/tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist/",
|
||||
"target": "es2016",
|
||||
"jsx": "react-jsx",
|
||||
"module": "ESNext",
|
||||
"rootDir": "./",
|
||||
"baseUrl": "./",
|
||||
"moduleResolution": "node",
|
||||
|
||||
"strict": true,
|
||||
"resolveJsonModule": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"allowJs": true,
|
||||
"paths": {
|
||||
"PUBLIC_DIR": ["../../public"],
|
||||
"COMMON_DIR": ["../common"],
|
||||
"SRC_DIR": ["./src"]
|
||||
}
|
||||
}
|
||||
"PUBLIC_DIR/*": ["../../public/*"],
|
||||
"SRC_DIR/*": ["./src/*"],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"date": "202427_10120",
|
||||
"date": "202428_125939",
|
||||
"checksums": {
|
||||
"api.js": "cdccad9c117fa172ed7ea7f392a6c702",
|
||||
"api.poly.js": "586ce6831fa68f6bc33486e2cebc856e",
|
||||
|
@ -1,32 +1,41 @@
|
||||
import { request } from "../client";
|
||||
import { TAPIPlugin } from "./types";
|
||||
|
||||
export const getPlugins = async (enabled) => {
|
||||
export const getPlugins = async (enabled: null | boolean) => {
|
||||
const url = enabled
|
||||
? `/settings/webplugins?enabled=${enabled}`
|
||||
: `/settings/webplugins`;
|
||||
|
||||
return request({
|
||||
const res = (await request({
|
||||
method: "GET",
|
||||
url,
|
||||
});
|
||||
})) as TAPIPlugin[];
|
||||
|
||||
return res;
|
||||
};
|
||||
|
||||
export const addPlugin = async (data) => {
|
||||
return request({
|
||||
export const addPlugin = async (data: FormData) => {
|
||||
const res = (await request({
|
||||
method: "POST",
|
||||
url: `/settings/webplugins`,
|
||||
data,
|
||||
});
|
||||
})) as TAPIPlugin;
|
||||
|
||||
return res;
|
||||
};
|
||||
|
||||
export const getPlugin = async (name) => {
|
||||
export const getPlugin = async (name: string) => {
|
||||
return request({
|
||||
method: "GET",
|
||||
url: `/settings/webplugins/${name}`,
|
||||
});
|
||||
};
|
||||
|
||||
export const updatePlugin = async (name, enabled, settings = "") => {
|
||||
export const updatePlugin = async (
|
||||
name: string,
|
||||
enabled: boolean,
|
||||
settings: unknown = "",
|
||||
) => {
|
||||
return request({
|
||||
method: "PUT",
|
||||
url: `/settings/webplugins/${name}`,
|
||||
@ -34,7 +43,7 @@ export const updatePlugin = async (name, enabled, settings = "") => {
|
||||
});
|
||||
};
|
||||
|
||||
export const deletePlugin = async (name) => {
|
||||
export const deletePlugin = async (name: string) => {
|
||||
request({
|
||||
method: "DELETE",
|
||||
url: `/settings/webplugins/${name}`,
|
19
packages/shared/api/plugins/types.ts
Normal file
19
packages/shared/api/plugins/types.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import { TCreatedBy } from "../../types";
|
||||
|
||||
export type TAPIPlugin = {
|
||||
name: string;
|
||||
version: string;
|
||||
description: string;
|
||||
license: string;
|
||||
author: string;
|
||||
homePage: string;
|
||||
pluginName: string;
|
||||
scopes: string;
|
||||
image: string;
|
||||
createBy: TCreatedBy;
|
||||
createOn: Date;
|
||||
enabled: boolean;
|
||||
system: boolean;
|
||||
url: string;
|
||||
settings: string;
|
||||
};
|
@ -253,12 +253,21 @@ export async function getPortalTariff(refresh = false) {
|
||||
return res;
|
||||
}
|
||||
|
||||
export function getPaymentAccount() {
|
||||
return request({ method: "get", url: "/portal/payment/account" });
|
||||
export async function getPaymentAccount() {
|
||||
const res = (await request({
|
||||
method: "get",
|
||||
url: "/portal/payment/account",
|
||||
})) as string;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
export function getPaymentLink(adminCount, backUrl, signal) {
|
||||
return request({
|
||||
export async function getPaymentLink(
|
||||
adminCount: number,
|
||||
backUrl: string,
|
||||
signal?: AbortSignal,
|
||||
) {
|
||||
const res = (await request({
|
||||
method: "put",
|
||||
url: `/portal/payment/url`,
|
||||
data: {
|
||||
@ -266,7 +275,9 @@ export function getPaymentLink(adminCount, backUrl, signal) {
|
||||
backUrl,
|
||||
},
|
||||
signal,
|
||||
});
|
||||
})) as string;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
export function updatePayment(adminCount) {
|
||||
|
@ -18,6 +18,7 @@ import {
|
||||
TLoginSettings,
|
||||
TCapabilities,
|
||||
TThirdPartyProvider,
|
||||
TPaymentSettings,
|
||||
} from "./types";
|
||||
|
||||
export async function getSettings(withPassword = false, headers = null) {
|
||||
@ -316,13 +317,12 @@ export function getIsDefaultWhiteLabel() {
|
||||
});
|
||||
}
|
||||
|
||||
export function restoreWhiteLabelSettings(isDefault, isManagement) {
|
||||
export function restoreWhiteLabelSettings(isManagement) {
|
||||
const url = "/settings/whitelabel/restore";
|
||||
|
||||
return request({
|
||||
method: "put",
|
||||
url: isManagement ? `${url}?isDefault=true` : url,
|
||||
data: { isDefault },
|
||||
});
|
||||
}
|
||||
|
||||
@ -514,15 +514,17 @@ export function ownerChange(ownerId, confirmKey = null) {
|
||||
return request(options);
|
||||
}
|
||||
|
||||
export function getMachineName(confirmKey = null) {
|
||||
const options = {
|
||||
export async function getMachineName(confirmKey: string = "") {
|
||||
const options: AxiosRequestConfig = {
|
||||
method: "get",
|
||||
url: "/settings/machine",
|
||||
};
|
||||
|
||||
if (confirmKey) options.headers = { confirm: confirmKey };
|
||||
|
||||
return request(options);
|
||||
const res = (await request(options)) as string;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
export function setPortalOwner(
|
||||
@ -551,15 +553,17 @@ export function setPortalOwner(
|
||||
return request(options);
|
||||
}
|
||||
|
||||
export function getIsLicenseRequired() {
|
||||
return request({
|
||||
export async function getIsLicenseRequired() {
|
||||
const res = (await request({
|
||||
method: "get",
|
||||
url: "/settings/license/required",
|
||||
});
|
||||
})) as boolean;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
export function setLicense(confirmKey, data) {
|
||||
const options = {
|
||||
export async function setLicense(confirmKey: string, data: FormData) {
|
||||
const options: AxiosRequestConfig = {
|
||||
method: "post",
|
||||
url: `/settings/license`,
|
||||
data,
|
||||
@ -569,14 +573,18 @@ export function setLicense(confirmKey, data) {
|
||||
options.headers = { confirm: confirmKey };
|
||||
}
|
||||
|
||||
return request(options);
|
||||
const res = (await request(options)) as string;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
export function getPaymentSettings() {
|
||||
return request({
|
||||
export async function getPaymentSettings() {
|
||||
const res = (await request({
|
||||
method: "get",
|
||||
url: `/settings/payment`,
|
||||
});
|
||||
})) as TPaymentSettings;
|
||||
|
||||
return res;
|
||||
}
|
||||
export function acceptLicense() {
|
||||
return request({
|
||||
|
@ -195,3 +195,15 @@ export type TThirdPartyProvider = {
|
||||
url: string;
|
||||
linked: boolean;
|
||||
};
|
||||
|
||||
export type TPaymentSettings = {
|
||||
salesEmail: string;
|
||||
feedbackAndSupportUrl: string;
|
||||
buyUrl: string;
|
||||
standalone: boolean;
|
||||
currentLicense: {
|
||||
trial: boolean;
|
||||
date: Date;
|
||||
};
|
||||
max: number;
|
||||
};
|
||||
|
@ -1,3 +1,5 @@
|
||||
import React from "react";
|
||||
|
||||
import styled, { css } from "styled-components";
|
||||
import { Base } from "../../themes";
|
||||
import { Text } from "../text";
|
||||
@ -9,6 +11,7 @@ const StyledIcon = styled.div<{
|
||||
radius: string;
|
||||
isArchive?: boolean;
|
||||
color: string;
|
||||
wrongImage: boolean;
|
||||
}>`
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
@ -37,7 +40,8 @@ const StyledIcon = styled.div<{
|
||||
font-size: ${(props) => props.theme.getCorrectFontSize("14px")};
|
||||
font-weight: 700;
|
||||
line-height: 16px;
|
||||
color: #ffffff;
|
||||
color: ${(props) =>
|
||||
props.wrongImage && props.theme.isBase ? "#333333" : "#ffffff"};
|
||||
position: relative;
|
||||
${(props) =>
|
||||
!props.theme.isBase &&
|
||||
@ -96,6 +100,8 @@ const RoomIcon = ({
|
||||
badgeUrl,
|
||||
onBadgeClick,
|
||||
}: RoomIconProps) => {
|
||||
const [correctImage, setCorrectImage] = React.useState(true);
|
||||
|
||||
const titleWithoutSpaces = title.replace(/\s+/g, " ").trim();
|
||||
const indexAfterLastSpace = titleWithoutSpaces.lastIndexOf(" ");
|
||||
const secondCharacter =
|
||||
@ -105,12 +111,28 @@ const RoomIcon = ({
|
||||
|
||||
const roomTitle = (title[0] + secondCharacter).toUpperCase();
|
||||
|
||||
return showDefault ? (
|
||||
const prefetchImage = React.useCallback(() => {
|
||||
if (!imgSrc) return;
|
||||
const img = new Image();
|
||||
|
||||
img.src = imgSrc;
|
||||
|
||||
img.onerror = () => {
|
||||
setCorrectImage(false);
|
||||
};
|
||||
}, [imgSrc]);
|
||||
|
||||
React.useEffect(() => {
|
||||
prefetchImage();
|
||||
}, [prefetchImage]);
|
||||
|
||||
return showDefault || !correctImage ? (
|
||||
<StyledIcon
|
||||
color={color}
|
||||
size={size}
|
||||
radius={radius}
|
||||
isArchive={isArchive}
|
||||
wrongImage={!correctImage}
|
||||
data-testid="room-icon"
|
||||
>
|
||||
<div className="room-background" />
|
||||
|
@ -170,9 +170,11 @@ const PeopleSelector = ({
|
||||
const data = response.items
|
||||
.filter((item) => {
|
||||
const excludeUser =
|
||||
withAbilityCreateRoomUsers &&
|
||||
((!item.isAdmin && !item.isOwner && !item.isRoomAdmin) ||
|
||||
item.status === EmployeeStatus.Disabled);
|
||||
(!!withAbilityCreateRoomUsers &&
|
||||
!item.isAdmin &&
|
||||
!item.isOwner &&
|
||||
!item.isRoomAdmin) ||
|
||||
item.status === EmployeeStatus.Disabled;
|
||||
|
||||
if (excludeItems.includes(item.id) || excludeUser) {
|
||||
totalDifferent += 1;
|
||||
|
@ -4,7 +4,7 @@ import { RoomsType } from "../../enums";
|
||||
|
||||
export interface RoomSelectorProps extends SelectorProps {
|
||||
excludeItems?: number[];
|
||||
setIsDataReady: (value: boolean) => void;
|
||||
setIsDataReady?: (value: boolean) => void;
|
||||
}
|
||||
|
||||
export type TItem = {
|
||||
@ -15,4 +15,3 @@ export type TItem = {
|
||||
logo: TLogo;
|
||||
roomType: RoomsType;
|
||||
};
|
||||
|
||||
|
@ -70,7 +70,7 @@ const RoomSelector = ({
|
||||
const [items, setItems] = React.useState<TSelectorItem[]>([]);
|
||||
|
||||
useEffect(() => {
|
||||
setIsDataReady(!isFirstLoad);
|
||||
setIsDataReady?.(!isFirstLoad);
|
||||
}, [isFirstLoad, setIsDataReady]);
|
||||
|
||||
const onSearchAction = React.useCallback(
|
||||
@ -120,22 +120,19 @@ const RoomSelector = ({
|
||||
|
||||
const rooms = convertToItems(folders);
|
||||
|
||||
const itemList = rooms.filter((x) => !excludeItems.includes(x.id));
|
||||
|
||||
setHasNextPage(count === PAGE_COUNT);
|
||||
|
||||
setItems((prevItems) => {
|
||||
const newItems = rooms.filter((x) => !excludeItems.includes(x.id));
|
||||
|
||||
if (isFirstLoad) {
|
||||
setTotal(totalCount);
|
||||
setItems(itemList);
|
||||
} else {
|
||||
setItems((value) => [...value, ...itemList]);
|
||||
setIsFirstLoad(false);
|
||||
return newItems;
|
||||
}
|
||||
|
||||
if (isFirstLoad) {
|
||||
setTimeout(() => {
|
||||
setIsFirstLoad(false);
|
||||
}, 500);
|
||||
}
|
||||
return [...prevItems, ...newItems];
|
||||
});
|
||||
|
||||
setIsNextPageLoading(false);
|
||||
},
|
||||
@ -144,7 +141,7 @@ const RoomSelector = ({
|
||||
|
||||
React.useEffect(() => {
|
||||
onLoadNextPage(0);
|
||||
}, [onLoadNextPage]);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Selector
|
||||
@ -207,3 +204,4 @@ const RoomSelector = ({
|
||||
};
|
||||
|
||||
export default RoomSelector;
|
||||
|
||||
|
@ -22,11 +22,11 @@ import { CurrentQuotasStore } from "./CurrentQuotaStore";
|
||||
import { SettingsStore } from "./SettingsStore";
|
||||
|
||||
class AuthStore {
|
||||
userStore: UserStore | null = null;
|
||||
private userStore: UserStore | null = null;
|
||||
|
||||
currentQuotaStore: CurrentQuotasStore | null = null;
|
||||
private currentQuotaStore: CurrentQuotasStore | null = null;
|
||||
|
||||
currentTariffStatusStore: CurrentTariffStatusStore | null = null;
|
||||
private currentTariffStatusStore: CurrentTariffStatusStore | null = null;
|
||||
|
||||
settingsStore: SettingsStore | null = null;
|
||||
|
||||
|
@ -331,7 +331,7 @@ export const getBaseTheme = () => {
|
||||
border: "none",
|
||||
text: {
|
||||
width: "100%",
|
||||
height: "16px",
|
||||
height: "18px",
|
||||
margin: "0 11px",
|
||||
fontWeight: "500",
|
||||
fontSize: "14px",
|
||||
|
@ -303,7 +303,7 @@ const Dark: TTheme = {
|
||||
border: "1px solid #474747",
|
||||
text: {
|
||||
width: "100%",
|
||||
height: "16px",
|
||||
height: "18px",
|
||||
margin: "0 11px",
|
||||
fontWeight: "500",
|
||||
fontSize: "14px",
|
||||
|
@ -15,6 +15,15 @@ export type TViewAs = "tile" | "table" | "row" | "settings" | "profile";
|
||||
|
||||
export type TTranslation = (key: string) => string;
|
||||
|
||||
export type NonFunctionPropertyNames<T, ExcludeTypes> = {
|
||||
[K in keyof T]: T[K] extends ExcludeTypes ? never : K;
|
||||
}[keyof T];
|
||||
|
||||
export type NonFunctionProperties<T, ExcludeTypes> = Pick<
|
||||
T,
|
||||
NonFunctionPropertyNames<T, ExcludeTypes>
|
||||
>;
|
||||
|
||||
export type TPathParts = {
|
||||
id: number;
|
||||
title: string;
|
||||
|
@ -15,7 +15,7 @@ const subscribers = new Set();
|
||||
|
||||
export type TEmit = {
|
||||
command: string;
|
||||
data: { roomParts: string | [] };
|
||||
data: { roomParts: string | []; individual?: boolean };
|
||||
room?: null | boolean;
|
||||
};
|
||||
|
||||
|
95
yarn.lock
95
yarn.lock
@ -3042,6 +3042,7 @@ __metadata:
|
||||
resolution: "@docspace/client@workspace:packages/client"
|
||||
dependencies:
|
||||
"@babel/core": "npm:^7.21.3"
|
||||
"@babel/eslint-parser": "npm:^7.21.8"
|
||||
"@babel/plugin-proposal-class-properties": "npm:^7.18.6"
|
||||
"@babel/plugin-proposal-export-default-from": "npm:^7.18.10"
|
||||
"@babel/plugin-transform-runtime": "npm:^7.21.0"
|
||||
@ -3050,6 +3051,9 @@ __metadata:
|
||||
"@babel/preset-typescript": "npm:^7.21.0"
|
||||
"@svgr/webpack": "npm:^5.5.0"
|
||||
"@types/crypto-js": "npm:^4.2.1"
|
||||
"@types/eslint": "npm:^8.44.7"
|
||||
"@typescript-eslint/eslint-plugin": "npm:^6.12.0"
|
||||
"@typescript-eslint/parser": "npm:^6.12.0"
|
||||
babel-loader: "npm:^8.3.0"
|
||||
clean-webpack-plugin: "npm:^4.0.0"
|
||||
copy-to-clipboard: "npm:^3.3.3"
|
||||
@ -3057,6 +3061,16 @@ __metadata:
|
||||
crypto-js: "npm:^4.2.0"
|
||||
css-loader: "npm:^6.7.3"
|
||||
element-resize-detector: "npm:^1.2.4"
|
||||
eslint: "npm:^8.54.0"
|
||||
eslint-config-airbnb: "npm:^19.0.4"
|
||||
eslint-config-airbnb-typescript: "npm:^17.1.0"
|
||||
eslint-config-prettier: "npm:^9.0.0"
|
||||
eslint-plugin-import: "npm:^2.29.0"
|
||||
eslint-plugin-jsx-a11y: "npm:^6.8.0"
|
||||
eslint-plugin-prettier: "npm:^5.0.1"
|
||||
eslint-plugin-react: "npm:^7.33.2"
|
||||
eslint-plugin-react-hooks: "npm:^4.6.0"
|
||||
eslint-plugin-storybook: "npm:^0.6.15"
|
||||
external-remotes-plugin: "npm:^1.0.0"
|
||||
file-loader: "npm:^6.2.0"
|
||||
file-saver: "npm:^2.0.5"
|
||||
@ -3066,6 +3080,7 @@ __metadata:
|
||||
html-webpack-plugin: "npm:5.5.0"
|
||||
json-loader: "npm:^0.5.7"
|
||||
playwright: "npm:^1.32.0"
|
||||
prettier: "npm:^3.1.0"
|
||||
queue-promise: "npm:2.2.1"
|
||||
react-avatar-editor: "npm:^13.0.0"
|
||||
react-colorful: "npm:^5.6.1"
|
||||
@ -11505,7 +11520,19 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"call-bind@npm:^1.0.0, call-bind@npm:^1.0.2, call-bind@npm:^1.0.4, call-bind@npm:^1.0.5":
|
||||
"call-bind@npm:^1.0.0, call-bind@npm:^1.0.2, call-bind@npm:^1.0.5":
|
||||
version: 1.0.6
|
||||
resolution: "call-bind@npm:1.0.6"
|
||||
dependencies:
|
||||
es-errors: "npm:^1.3.0"
|
||||
function-bind: "npm:^1.1.2"
|
||||
get-intrinsic: "npm:^1.2.3"
|
||||
set-function-length: "npm:^1.2.0"
|
||||
checksum: d99d92dc414d13a03b8b6f2307fc2f0d16a135b523a14d804a2ba7aaa8aae8223cb40d058703c1e66eed11acaff2dc1bcd6358395fa0eb151d84a42c21dedb19
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"call-bind@npm:^1.0.4":
|
||||
version: 1.0.5
|
||||
resolution: "call-bind@npm:1.0.5"
|
||||
dependencies:
|
||||
@ -11748,7 +11775,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"chokidar@npm:3.5.3, chokidar@npm:>=3.0.0 <4.0.0, chokidar@npm:^3.4.0, chokidar@npm:^3.5.1, chokidar@npm:^3.5.2, chokidar@npm:^3.5.3":
|
||||
"chokidar@npm:3.5.3":
|
||||
version: 3.5.3
|
||||
resolution: "chokidar@npm:3.5.3"
|
||||
dependencies:
|
||||
@ -11767,6 +11794,25 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"chokidar@npm:>=3.0.0 <4.0.0, chokidar@npm:^3.4.0, chokidar@npm:^3.5.1, chokidar@npm:^3.5.2, chokidar@npm:^3.5.3":
|
||||
version: 3.6.0
|
||||
resolution: "chokidar@npm:3.6.0"
|
||||
dependencies:
|
||||
anymatch: "npm:~3.1.2"
|
||||
braces: "npm:~3.0.2"
|
||||
fsevents: "npm:~2.3.2"
|
||||
glob-parent: "npm:~5.1.2"
|
||||
is-binary-path: "npm:~2.1.0"
|
||||
is-glob: "npm:~4.0.1"
|
||||
normalize-path: "npm:~3.0.0"
|
||||
readdirp: "npm:~3.6.0"
|
||||
dependenciesMeta:
|
||||
fsevents:
|
||||
optional: true
|
||||
checksum: c327fb07704443f8d15f7b4a7ce93b2f0bc0e6cea07ec28a7570aa22cd51fcf0379df589403976ea956c369f25aa82d84561947e227cd925902e1751371658df
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"chownr@npm:^1.1.1":
|
||||
version: 1.1.4
|
||||
resolution: "chownr@npm:1.1.4"
|
||||
@ -13283,7 +13329,19 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"define-data-property@npm:^1.0.1, define-data-property@npm:^1.1.1":
|
||||
"define-data-property@npm:^1.0.1, define-data-property@npm:^1.1.2":
|
||||
version: 1.1.2
|
||||
resolution: "define-data-property@npm:1.1.2"
|
||||
dependencies:
|
||||
es-errors: "npm:^1.3.0"
|
||||
get-intrinsic: "npm:^1.2.2"
|
||||
gopd: "npm:^1.0.1"
|
||||
has-property-descriptors: "npm:^1.0.1"
|
||||
checksum: 19336750149644b2eb53d281ba685c3561abf98d2b0d2a173ee065bb388b977350df2a08c2597b3401bf0e89f313fc69d7582f0373931cc74df0777fb5202cd0
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"define-data-property@npm:^1.1.1":
|
||||
version: 1.1.1
|
||||
resolution: "define-data-property@npm:1.1.1"
|
||||
dependencies:
|
||||
@ -14348,7 +14406,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"es-errors@npm:^1.0.0":
|
||||
"es-errors@npm:^1.0.0, es-errors@npm:^1.3.0":
|
||||
version: 1.3.0
|
||||
resolution: "es-errors@npm:1.3.0"
|
||||
checksum: 96e65d640156f91b707517e8cdc454dd7d47c32833aa3e85d79f24f9eb7ea85f39b63e36216ef0114996581969b59fe609a94e30316b08f5f4df1d44134cf8d5
|
||||
@ -16085,7 +16143,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"get-intrinsic@npm:^1.0.2, get-intrinsic@npm:^1.1.1, get-intrinsic@npm:^1.1.3, get-intrinsic@npm:^1.2.1, get-intrinsic@npm:^1.2.2":
|
||||
"get-intrinsic@npm:^1.0.2":
|
||||
version: 1.2.3
|
||||
resolution: "get-intrinsic@npm:1.2.3"
|
||||
dependencies:
|
||||
@ -16098,6 +16156,19 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"get-intrinsic@npm:^1.1.1, get-intrinsic@npm:^1.1.3, get-intrinsic@npm:^1.2.1, get-intrinsic@npm:^1.2.2, get-intrinsic@npm:^1.2.3":
|
||||
version: 1.2.4
|
||||
resolution: "get-intrinsic@npm:1.2.4"
|
||||
dependencies:
|
||||
es-errors: "npm:^1.3.0"
|
||||
function-bind: "npm:^1.1.2"
|
||||
has-proto: "npm:^1.0.1"
|
||||
has-symbols: "npm:^1.0.3"
|
||||
hasown: "npm:^2.0.0"
|
||||
checksum: 85bbf4b234c3940edf8a41f4ecbd4e25ce78e5e6ad4e24ca2f77037d983b9ef943fd72f00f3ee97a49ec622a506b67db49c36246150377efcda1c9eb03e5f06d
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"get-nonce@npm:^1.0.0":
|
||||
version: 1.0.1
|
||||
resolution: "get-nonce@npm:1.0.1"
|
||||
@ -26008,6 +26079,20 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"set-function-length@npm:^1.2.0":
|
||||
version: 1.2.1
|
||||
resolution: "set-function-length@npm:1.2.1"
|
||||
dependencies:
|
||||
define-data-property: "npm:^1.1.2"
|
||||
es-errors: "npm:^1.3.0"
|
||||
function-bind: "npm:^1.1.2"
|
||||
get-intrinsic: "npm:^1.2.3"
|
||||
gopd: "npm:^1.0.1"
|
||||
has-property-descriptors: "npm:^1.0.1"
|
||||
checksum: 9ab1d200149574ab27c1a7acae56d6235e02568fc68655fe8afe63e4e02ccad3c27665f55c32408bd1ff40705939dbb7539abfb9c3a07fda27ecad1ab9e449f5
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"set-function-name@npm:^2.0.0, set-function-name@npm:^2.0.1":
|
||||
version: 2.0.1
|
||||
resolution: "set-function-name@npm:2.0.1"
|
||||
|
Loading…
Reference in New Issue
Block a user