Merge branch 'develop' into feature/ads-banner
This commit is contained in:
commit
ed3ec48e2a
5760
i18next/client.babel
5760
i18next/client.babel
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "docspace",
|
||||
"version": "2.0.2",
|
||||
"version": "2.0.3",
|
||||
"private": true,
|
||||
"workspaces": {
|
||||
"packages": [
|
||||
|
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;
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@docspace/client",
|
||||
"version": "2.0.2",
|
||||
"version": "2.0.3",
|
||||
"private": true,
|
||||
"homepage": "",
|
||||
"scripts": {
|
||||
@ -59,6 +59,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",
|
||||
@ -66,16 +67,30 @@
|
||||
"@babel/preset-react": "^7.18.6",
|
||||
"@babel/preset-typescript": "^7.21.0",
|
||||
"@svgr/webpack": "^5.5.0",
|
||||
"@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",
|
||||
|
@ -35,7 +35,7 @@
|
||||
"MobileWin": "حمّل ONLYOFFICE Desktop Editors لنظام ويندوز",
|
||||
"MoveHere": "انقل إلى هنا",
|
||||
"MoveToOperation": "جارٍ النقل",
|
||||
"NewForm": "قوالب جاهزة",
|
||||
"NewForm": "نموذج PDF",
|
||||
"Other": "آخر",
|
||||
"OwnerChange": "تغيير المالك",
|
||||
"Presentations": "العروض التقديمية",
|
||||
|
@ -35,7 +35,7 @@
|
||||
"MobileWin": "Windows üçün ONLYOFFICE Masaüstü Redaktorları endirin",
|
||||
"MoveHere": "Bura köçürün",
|
||||
"MoveToOperation": "Yer dəyişdirmə",
|
||||
"NewForm": "Forma şablonu",
|
||||
"NewForm": "PDF forma",
|
||||
"Other": "Digər",
|
||||
"OwnerChange": "Sahibi dəyiş",
|
||||
"Presentations": "Təqdimatlar",
|
||||
|
@ -35,7 +35,7 @@
|
||||
"MobileWin": "Изтеглете ONLYOFFICE настолни редактори за Windows",
|
||||
"MoveHere": "Премести се тук",
|
||||
"MoveToOperation": "Преместване",
|
||||
"NewForm": "Шаблон на формуляр",
|
||||
"NewForm": "PDF формуляр",
|
||||
"Other": "Друг",
|
||||
"OwnerChange": "Смени собственик",
|
||||
"Presentations": "Презентации",
|
||||
|
@ -35,7 +35,7 @@
|
||||
"MobileWin": "Stáhnout ONLYOFFICE Desktop Editors pro Windows",
|
||||
"MoveHere": "Přesunout zde",
|
||||
"MoveToOperation": "Přesouvám",
|
||||
"NewForm": "Šablona formuláře",
|
||||
"NewForm": "PDF formulář",
|
||||
"Other": "Jiný",
|
||||
"OwnerChange": "Změnit vlastníka",
|
||||
"Presentations": "Prezentace",
|
||||
|
@ -35,7 +35,7 @@
|
||||
"MobileWin": "Download ONLYOFFICE Desktop Editors für Windows",
|
||||
"MoveHere": "Verschieben",
|
||||
"MoveToOperation": "Wird verschoben",
|
||||
"NewForm": "Formularvorlage",
|
||||
"NewForm": "PDF-Formular",
|
||||
"Other": "Sonstiges",
|
||||
"OwnerChange": "Besitzer ändern",
|
||||
"Presentations": "Präsentationen",
|
||||
|
@ -35,7 +35,7 @@
|
||||
"MobileWin": "Λήψη ONLYOFFICE Desktop Editors για Windows",
|
||||
"MoveHere": "Μετακίνηση εδώ",
|
||||
"MoveToOperation": "Μετακίνηση",
|
||||
"NewForm": "Πρότυπο φόρμας",
|
||||
"NewForm": "Φόρμα PDF",
|
||||
"Other": "Άλλο",
|
||||
"OwnerChange": "Αλλαγή κατόχου",
|
||||
"Presentations": "Παρουσιάσεις",
|
||||
|
@ -14,9 +14,9 @@
|
||||
"ArchiveEmptyScreenUser": "Rooms that have been archived will appear here.",
|
||||
"Archives": "Archives",
|
||||
"AssignOwner": "Assign Owner",
|
||||
"BackToParentFolderButton": "Back to parent folder",
|
||||
"BadgeAlertDescription": "Several roles are specified in this form. Forms with multiple roles are not available for filling in this type of room",
|
||||
"BadgeMyDraftTitle": "My draft",
|
||||
"BackToParentFolderButton": "Back to parent folder",
|
||||
"ByAuthor": "Author",
|
||||
"ByCreation": "Created",
|
||||
"ByErasure": "Erasure",
|
||||
@ -27,20 +27,20 @@
|
||||
"CollaborationRooms": "Collaboration",
|
||||
"ContainsSpecCharacter": "The title can't contain any of the following characters: *+:\"<>?|/",
|
||||
"Convert": "Convert",
|
||||
"CopySharedLink": "Copy shared link",
|
||||
"CopyItem": "<strong>{{title}}</strong> copied",
|
||||
"CopyItems": "<strong>{{qty}}</strong> elements copied",
|
||||
"CopyLink": "Copy link",
|
||||
"CopyLinkPassword": "Copy link password",
|
||||
"CopyPassword": "Copy password",
|
||||
"CopySharedLink": "Copy shared link",
|
||||
"CreateAndCopy": "Create and copy",
|
||||
"CreateNewLink": "Create new link",
|
||||
"CreateRoom": "Create room",
|
||||
"CustomRooms": "Custom",
|
||||
"DaysRemaining": "Days remaining: {{daysRemaining}}",
|
||||
"DeleteSharedLink": "The previous link will become unavailable. A new shared link will be created.",
|
||||
"DeleteLink": "Delete link",
|
||||
"DeleteLinkNote": "The link will be deleted permanently. You will not be able to undo this action.",
|
||||
"DeleteSharedLink": "The previous link will become unavailable. A new shared link will be created.",
|
||||
"DisableDownload": "Restrict file content copy, file download and printing",
|
||||
"DisableLink": "Disable link",
|
||||
"DisableNotifications": "Disable notifications",
|
||||
@ -48,9 +48,9 @@
|
||||
"DocumentEdited": "Cannot perform the action because the document is being edited.",
|
||||
"DownloadAll": "Download all",
|
||||
"EditAdditionalLink": "Edit additional link",
|
||||
"EditSharedLink": "Edit shared link",
|
||||
"EditLink": "Edit link",
|
||||
"EditRoom": "Edit room",
|
||||
"EditSharedLink": "Edit shared link",
|
||||
"EmbeddingSettings": "Embedding settings",
|
||||
"EmptyFile": "Empty file",
|
||||
"EmptyFilterDescriptionText": "No files or folders match this filter. Try a different one or clear filter to view all files. ",
|
||||
@ -58,12 +58,12 @@
|
||||
"EmptyFolderDecription": "Drop files here or create new ones",
|
||||
"EmptyFolderDescriptionUser": "Files and folders uploaded by admins will appear here.",
|
||||
"EmptyFolderHeader": "No files in this folder",
|
||||
"EmptyFormFolderDoneHeaderText": "No finished forms yet",
|
||||
"EmptyFormFolderDoneDescriptionText": "This section will display all forms that are complete.",
|
||||
"EmptyFormFolderProgressHeaderText": "Nothing here yet",
|
||||
"EmptyFormFolderDoneHeaderText": "No finished forms yet",
|
||||
"EmptyFormFolderProgressDescriptionText": "This section will display the forms in progress.",
|
||||
"EmptyFormSubFolderHeaderText": "No files in this folder yet",
|
||||
"EmptyFormFolderProgressHeaderText": "Nothing here yet",
|
||||
"EmptyFormSubFolderDoneDescriptionText": "Here you will find forms which have been completely filled out by other users.",
|
||||
"EmptyFormSubFolderHeaderText": "No files in this folder yet",
|
||||
"EmptyFormSubFolderProgressDescriptionText": "Here you will find forms in progress, i.e. forms which users have started to fill out but haven't completed. ",
|
||||
"EmptyRecycleBin": "Empty Trash",
|
||||
"EmptyRootRoomHeader": "Welcome to DocSpace",
|
||||
@ -73,8 +73,10 @@
|
||||
"ExcludeSubfolders": "Exclude subfolders",
|
||||
"FavoritesEmptyContainerDescription": "To mark files as favorites or remove them from this list, use the context menu.",
|
||||
"FileContents": "File contents",
|
||||
"FileDownloadingIsRestricted": "File downloading is restricted in this room.",
|
||||
"FileRemoved": "File moved to Trash",
|
||||
"FileRenamed": "The document '{{oldTitle}}' is renamed to '{{newTitle}}'",
|
||||
"FilesWillAppearHere": "Files and folders added to the room will appear here.",
|
||||
"FillingFormRooms": "Filling form",
|
||||
"Filter": "Filter",
|
||||
"FinalizeVersion": "Finalize version",
|
||||
@ -84,7 +86,6 @@
|
||||
"FormRoom": "Form room",
|
||||
"Forms": "Forms",
|
||||
"FormsTemplates": "Forms templates",
|
||||
"SharedLinks": "Shared links",
|
||||
"GeneralLinkDeletedSuccessfully": "New general link created successfully",
|
||||
"GoToMyRooms": "Go to rooms",
|
||||
"GoToPersonal": "Go to My Documents",
|
||||
@ -99,6 +100,7 @@
|
||||
"LinkEditedSuccessfully": "Link successfully edited and copied",
|
||||
"LinkEnabledSuccessfully": "Link enabled successfully",
|
||||
"LinkForPortalUsers": "Link for DocSpace users",
|
||||
"LinkSettings": "Link settings",
|
||||
"LinkSuccessfullyCopied": "Link successfully copied to clipboard",
|
||||
"LinkSuccessfullyCreatedAndCopied": "Link successfully created and copied to clipboard",
|
||||
"LinkValidUntil": "This link will be valid until",
|
||||
@ -139,8 +141,8 @@
|
||||
"PrivateRoomHeader": "Welcome to ONLYOFFICE private room where every symbol you type is encrypted",
|
||||
"PrivateRoomSupport": "Work in Private Room is available via {{organizationName}} desktop app. <3>Instructions</3>",
|
||||
"PublicRoom": "Public room",
|
||||
"RecentlyAccessible": "Recently accessible via link",
|
||||
"RecentEmptyContainerDescription": "Your last viewed or edited docs will be displayed in this section.",
|
||||
"RecentlyAccessible": "Recently accessible via link",
|
||||
"RecentViaLinkEmptyContainerDescription": "Here you will find a list of the recently opened files shared with you via an external link.",
|
||||
"RecycleBinAction": "Empty trash",
|
||||
"RemovedFromFavorites": "Removed from favorites",
|
||||
@ -150,6 +152,7 @@
|
||||
"RevokeLink": "Revoke link",
|
||||
"RoomAvailableViaExternalLink": "Room available via external link",
|
||||
"RoomCreated": "Room created",
|
||||
"RoomEmptyAtTheMoment": "This room is empty at the moment.",
|
||||
"RoomEmptyContainerDescription": "Please create the first room.",
|
||||
"RoomEmptyContainerDescriptionUser": "Rooms shared with you will appear here.",
|
||||
"RoomNotificationsDisabled": "Room notifications disabled",
|
||||
@ -165,6 +168,7 @@
|
||||
"SelectorEmptyScreenHeader": "No files and folders here yet",
|
||||
"SendByEmail": "Send by email",
|
||||
"Share": "Share",
|
||||
"SharedLinks": "Shared links",
|
||||
"ShareFolder": "Share folder",
|
||||
"ShareFolderDescription": "A new room will be created and all the contents of the selected folder will be copied there. Afterwards, you can invite other users to collaborate on the files within a room.",
|
||||
"ShareRoom": "Share room",
|
||||
@ -190,9 +194,5 @@
|
||||
"WantToRestoreTheRoom": "All shared links in this room will become active, and its contents will be available to everyone with the link. Do you want to restore the room?",
|
||||
"WantToRestoreTheRooms": "All shared links in restored rooms will become active, and their contents will be available to everyone with the room links. Do you want to restore the rooms?",
|
||||
"WithSubfolders": "With subfolders",
|
||||
"YouLeftTheRoom": "You have left the room",
|
||||
"LinkSettings": "Link settings",
|
||||
"FileDownloadingIsRestricted": "File downloading is restricted in this room.",
|
||||
"RoomEmptyAtTheMoment": "This room is empty at the moment.",
|
||||
"FilesWillAppearHere": "Files and folders added to the room will appear here."
|
||||
"YouLeftTheRoom": "You have left the room"
|
||||
}
|
||||
|
@ -12,5 +12,6 @@
|
||||
"InviteViaLinkDescriptionRoom": "Create a universal link for self-authorization in the room",
|
||||
"LinkCopySuccess": "Link has been copied",
|
||||
"ResetChange": "Reset change",
|
||||
"SendInvitation": "Send invitation"
|
||||
"SendInvitation": "Send invitation",
|
||||
"UsersAlreadyAdded": "Some users have already been added"
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"AddGroupsForSharingButton": "Add groups",
|
||||
"AddShareMessage": "Add message",
|
||||
"AdditionalLinkRemove": "Additional link remove",
|
||||
"AddShareMessage": "Add message",
|
||||
"AnyoneWithLink": "Anyone with the link",
|
||||
"Comment": "Comment",
|
||||
"CopyExternalLink": "Copy external link",
|
||||
@ -19,16 +19,16 @@
|
||||
"GeneralAccessLinkRemove": "General access link remove",
|
||||
"InternalLink": "Internal link",
|
||||
"LinkAccessDenied": "Access to the link has been denied",
|
||||
"LinkName": "Link name",
|
||||
"LinkExpireAfter": "The link will expire after <1>{{date}}</1>",
|
||||
"LinkExpired": "The link has expired.",
|
||||
"LinkIsValid": "The link is valid for <1>{{date}}</1>",
|
||||
"LinkName": "Link name",
|
||||
"Notify users": "Notify users",
|
||||
"ReadOnly": "Read only",
|
||||
"ShareEmailBody": "You have been granted access to the {{itemName}} document. Click the link below to open the document right now: {{shareLink}}.",
|
||||
"ShareEmailSubject": "You have been granted access to the {{itemName}} document",
|
||||
"ShareDocument": "Share this document",
|
||||
"ShareDocumentDescription": "Provide access to the document and set the permission levels.",
|
||||
"ShareEmailBody": "You have been granted access to the {{itemName}} document. Click the link below to open the document right now: {{shareLink}}.",
|
||||
"ShareEmailSubject": "You have been granted access to the {{itemName}} document",
|
||||
"ShareVia": "Share via",
|
||||
"SharingSettingsTitle": "Sharing settings"
|
||||
}
|
||||
|
@ -35,7 +35,7 @@
|
||||
"MobileWin": "Download ONLYOFFICE Desktop Editors for Windows",
|
||||
"MoveHere": "Move here",
|
||||
"MoveToOperation": "Moving",
|
||||
"NewForm": "Form template",
|
||||
"NewForm": "PDF Form",
|
||||
"Other": "Other",
|
||||
"OwnerChange": "Change owner",
|
||||
"Presentations": "Presentations",
|
||||
|
@ -35,7 +35,7 @@
|
||||
"MobileWin": "Descargar los editores de escritorio ONLYOFFICE para Windows",
|
||||
"MoveHere": "Mover aquí",
|
||||
"MoveToOperation": "Moviendo",
|
||||
"NewForm": "Plantilla de formulario",
|
||||
"NewForm": "Formulario PDF",
|
||||
"Other": "Otro",
|
||||
"OwnerChange": "Cambiar propietario",
|
||||
"Presentations": "Presentaciones",
|
||||
|
@ -35,7 +35,7 @@
|
||||
"MobileWin": "Lataa ONLYOFFICE Desktop Editors Windowsille",
|
||||
"MoveHere": "Siirrä tänne",
|
||||
"MoveToOperation": "Siirretään",
|
||||
"NewForm": "Lomakemalli",
|
||||
"NewForm": "PDF-lomake",
|
||||
"Other": "Muu",
|
||||
"OwnerChange": "Vaihda omistaja",
|
||||
"Presentations": "Esitykset",
|
||||
|
@ -35,7 +35,7 @@
|
||||
"MobileWin": "Télécharger les applications de bureau ONLYOFFICE pour Windows",
|
||||
"MoveHere": "Déplacer ici",
|
||||
"MoveToOperation": "Déplacement",
|
||||
"NewForm": "Modèle de formulaire",
|
||||
"NewForm": "Formulaire PDF",
|
||||
"Other": "Autre",
|
||||
"OwnerChange": "Changer le propriétaire",
|
||||
"Presentations": "Présentations",
|
||||
|
@ -35,7 +35,7 @@
|
||||
"MobileWin": "Ներբեռնել ONLYOFFICE Desktop Editors Windows-ի համար",
|
||||
"MoveHere": "Տեղափոխել այստեղ",
|
||||
"MoveToOperation": "Տեղափոխություն",
|
||||
"NewForm": "Ձևանմուշ",
|
||||
"NewForm": "PDF Ձև",
|
||||
"Other": "Այլ",
|
||||
"OwnerChange": "Փոխել տնօրինողին",
|
||||
"Presentations": "Ներկայացումներ",
|
||||
|
@ -35,7 +35,7 @@
|
||||
"MobileWin": "Scarica ONLYOFFICE Desktop Editors per Windows",
|
||||
"MoveHere": "Sposta qui",
|
||||
"MoveToOperation": "Sta spostando",
|
||||
"NewForm": "Modello di modulo",
|
||||
"NewForm": "Modulo PDF",
|
||||
"Other": "Altro",
|
||||
"OwnerChange": "Cambiare proprietario",
|
||||
"Presentations": "Presentazioni",
|
||||
|
@ -35,7 +35,7 @@
|
||||
"MobileWin": "Windows用のONLYOFFICEデスクトップエディタをダウンロードする",
|
||||
"MoveHere": "ここに移動",
|
||||
"MoveToOperation": "移動中",
|
||||
"NewForm": "フォーム テンプレート",
|
||||
"NewForm": "PDFフォーム",
|
||||
"Other": "その他",
|
||||
"OwnerChange": "オーナー変更",
|
||||
"Presentations": "プレゼンテーション",
|
||||
|
@ -35,7 +35,7 @@
|
||||
"MobileWin": "Windows용 ONLYOFFICE Desktop Editors를 다운로드 받으세요",
|
||||
"MoveHere": "여기로 이동",
|
||||
"MoveToOperation": "이동 중",
|
||||
"NewForm": "양식 템플릿",
|
||||
"NewForm": "PDF 양식",
|
||||
"Other": "기타",
|
||||
"OwnerChange": "소유자 변경",
|
||||
"Presentations": "프레젠테이션",
|
||||
|
@ -34,7 +34,7 @@
|
||||
"MobileWin": "ດາວໂຫລດ ONLYOFFICE Desktop Editors ສໍາລັບ Windows",
|
||||
"MoveHere": "ຍ້າຍ ນີ້",
|
||||
"MoveToOperation": "ກຳລັງເຄື່ອນຍ້າຍ",
|
||||
"NewForm": "ແບບຟອມ",
|
||||
"NewForm": "ແບບຟອມ PDF",
|
||||
"Other": "ອື່ນໆ",
|
||||
"OwnerChange": "ປ່ຽນເຈົ້າຂອງ",
|
||||
"Presentations": "ບົດສະເຫນີ",
|
||||
|
@ -35,7 +35,7 @@
|
||||
"MobileWin": "Lejupielādēt ONLYOFFICE darbvirsmas redaktorus operētājsistēmai Windows",
|
||||
"MoveHere": "Pārvietoties šeit",
|
||||
"MoveToOperation": "Pārvieto",
|
||||
"NewForm": "Veidlapas veidne",
|
||||
"NewForm": "PDF veidlapa",
|
||||
"Other": "Cits",
|
||||
"OwnerChange": "Mainīt īpašnieku",
|
||||
"Presentations": "Prezentācijas",
|
||||
|
@ -35,7 +35,7 @@
|
||||
"MobileWin": "Download ONLYOFFICE Desktop Editors voor Windows",
|
||||
"MoveHere": "Hierheen verplaatsen",
|
||||
"MoveToOperation": "Verplaatsen",
|
||||
"NewForm": "Formulier sjabloon",
|
||||
"NewForm": "PDF-formulier",
|
||||
"Other": "Overige",
|
||||
"OwnerChange": "Wijzig eigenaar",
|
||||
"Presentations": "Presentaties",
|
||||
|
@ -35,7 +35,7 @@
|
||||
"MobileWin": "Pobierz ONLYOFFICE Desktop Editors dla Windows",
|
||||
"MoveHere": "Przenieś tutaj",
|
||||
"MoveToOperation": "Przenoszenie",
|
||||
"NewForm": "Szablon formularza",
|
||||
"NewForm": "Formularz PDF",
|
||||
"Other": "Inny",
|
||||
"OwnerChange": "Zmień właściciela",
|
||||
"Presentations": "Prezentacje",
|
||||
|
@ -35,7 +35,7 @@
|
||||
"MobileWin": "Baixar ONLYOFFICE Desktop Editors para Windows",
|
||||
"MoveHere": "Mover aqui",
|
||||
"MoveToOperation": "Movendo",
|
||||
"NewForm": "Modelo de formulário",
|
||||
"NewForm": "Formulário PDF",
|
||||
"Other": "Outro",
|
||||
"OwnerChange": "Alterar proprietário",
|
||||
"Presentations": "Apresentações ",
|
||||
|
@ -35,7 +35,7 @@
|
||||
"MobileWin": "Faça o download do ONLYOFFICE Desktop Editors para Windows",
|
||||
"MoveHere": "Mover para aqui",
|
||||
"MoveToOperation": "A mover",
|
||||
"NewForm": "Modelo de Formulário",
|
||||
"NewForm": "Formulário PDF",
|
||||
"Other": "Outros",
|
||||
"OwnerChange": "Alterar dono",
|
||||
"Presentations": "Apresentações ",
|
||||
|
@ -35,7 +35,7 @@
|
||||
"MobileWin": "Descarcă ONLYOFFICE Desktop Editors pentru Windows",
|
||||
"MoveHere": "Mutare în acest loc",
|
||||
"MoveToOperation": "Mutare",
|
||||
"NewForm": "Șablon formă,",
|
||||
"NewForm": "Formular PDF",
|
||||
"Other": "Altă",
|
||||
"OwnerChange": "Schimbare proprietar",
|
||||
"Presentations": "Prezentări",
|
||||
|
@ -35,7 +35,7 @@
|
||||
"MobileWin": "Скачать десктопные редакторы ONLYOFFICE для Windows",
|
||||
"MoveHere": "Переместить сюда",
|
||||
"MoveToOperation": "Перемещение",
|
||||
"NewForm": "Шаблон формы",
|
||||
"NewForm": "PDF-форма",
|
||||
"Other": "Другой",
|
||||
"OwnerChange": "Сменить владельца",
|
||||
"Presentations": "Презентации",
|
||||
|
@ -35,7 +35,7 @@
|
||||
"MobileWin": "Stiahnite si ONLYOFFICE Desktop Editors pre Windows",
|
||||
"MoveHere": "Posunúť sem",
|
||||
"MoveToOperation": "Presúva sa",
|
||||
"NewForm": "Šablóna formulára",
|
||||
"NewForm": "Formulár PDF",
|
||||
"Other": "Iný",
|
||||
"OwnerChange": "Zmeniť vlastníka",
|
||||
"Presentations": "Prezentácie",
|
||||
|
@ -35,7 +35,7 @@
|
||||
"MobileWin": "Prenesi ONLYOFFICE namizne urejevalnike za Windows",
|
||||
"MoveHere": "Premakni sem",
|
||||
"MoveToOperation": "Premikanje",
|
||||
"NewForm": "Predloga obrazca",
|
||||
"NewForm": "PDF obrazec",
|
||||
"Other": "Drugo",
|
||||
"OwnerChange": "Spremeni lastnika",
|
||||
"Presentations": "Predstavitve",
|
||||
|
@ -35,7 +35,7 @@
|
||||
"MobileWin": "Windows için ONLYOFFICE Masaüstü Düzenleyicilerini İndirin",
|
||||
"MoveHere": "Buraya taşı",
|
||||
"MoveToOperation": "Taşınıyor",
|
||||
"NewForm": "Form şablonu",
|
||||
"NewForm": "PDF formu",
|
||||
"Other": "Diğer",
|
||||
"OwnerChange": "Sahibi değiştir",
|
||||
"Presentations": "Sunumlar",
|
||||
|
@ -35,7 +35,7 @@
|
||||
"MobileWin": "Завантажити настільні редактори ONLYOFFICE для Windows",
|
||||
"MoveHere": "Перемістити сюди",
|
||||
"MoveToOperation": "Переміщення",
|
||||
"NewForm": "Шаблон форми",
|
||||
"NewForm": "Форма PDF",
|
||||
"Other": "Інше",
|
||||
"OwnerChange": "Змінити власника",
|
||||
"Presentations": "Презентації",
|
||||
|
@ -35,7 +35,7 @@
|
||||
"MobileWin": "Tải xuống Trình chỉnh sửa ONLYOFFICE cho máy tính Windows",
|
||||
"MoveHere": "Chuyển vào đây",
|
||||
"MoveToOperation": "Đang di chuyển",
|
||||
"NewForm": "Mẫu biểu mẫu",
|
||||
"NewForm": "Mẫu PDF",
|
||||
"Other": "Khác",
|
||||
"OwnerChange": "Thay đổi chủ sở hữu",
|
||||
"Presentations": "Bản trình bày",
|
||||
|
@ -35,7 +35,7 @@
|
||||
"MobileWin": "下载适用于Windows的ONLYOFFICE桌面编辑器",
|
||||
"MoveHere": "移到这里",
|
||||
"MoveToOperation": "移动中",
|
||||
"NewForm": "表单模板",
|
||||
"NewForm": "PDF表格",
|
||||
"Other": "其他",
|
||||
"OwnerChange": "变更所有者",
|
||||
"Presentations": "演示文稿",
|
||||
|
@ -76,7 +76,7 @@ const FilesSelector = ({
|
||||
|
||||
onSelectFolder,
|
||||
onSetBaseFolderPath,
|
||||
//onSetNewFolderPath,
|
||||
// onSetNewFolderPath,
|
||||
setIsDataReady,
|
||||
onSelectTreeNode,
|
||||
onSave,
|
||||
@ -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));
|
||||
|
@ -43,7 +43,9 @@ const AvatarEditorDialog = (props) => {
|
||||
const { visible, onClose, profile, updateCreatedAvatar, setHasAvatar } =
|
||||
props;
|
||||
const [avatar, setAvatar] = useState({
|
||||
uploadedFile: profile.hasAvatar ? profile.avatarMax : DefaultUserAvatarMax,
|
||||
uploadedFile: profile.hasAvatar
|
||||
? profile.avatarOriginal
|
||||
: DefaultUserAvatarMax,
|
||||
x: 0.5,
|
||||
y: 0.5,
|
||||
zoom: 1,
|
||||
@ -63,7 +65,6 @@ const AvatarEditorDialog = (props) => {
|
||||
onClose();
|
||||
return;
|
||||
}
|
||||
|
||||
const file = await dataUrlToFile(preview);
|
||||
|
||||
const avatarData = new FormData();
|
||||
|
@ -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>
|
||||
</>
|
||||
)}
|
||||
|
@ -53,7 +53,7 @@ const AddUsersPanel = ({
|
||||
const onBackClick = () => onClose();
|
||||
const getFilterWithOutDisabledUser = useCallback(
|
||||
() => Filter.getFilterWithOutDisabledUser(),
|
||||
[]
|
||||
[],
|
||||
);
|
||||
|
||||
const onKeyPress = (e) => {
|
||||
@ -88,6 +88,8 @@ const AddUsersPanel = ({
|
||||
avatar: item.avatar,
|
||||
isOwner: item.isOwner,
|
||||
isAdmin: item.isAdmin,
|
||||
isVisitor: item.isVisitor,
|
||||
isCollaborator: item.isCollaborator,
|
||||
};
|
||||
items.push(newItem);
|
||||
}
|
||||
@ -100,7 +102,7 @@ const AddUsersPanel = ({
|
||||
};
|
||||
|
||||
const selectedAccess = accessOptions.filter(
|
||||
(access) => access.access === accessRight
|
||||
(access) => access.access === accessRight,
|
||||
)[0];
|
||||
|
||||
const [itemsList, setItemsList] = useState(null);
|
||||
@ -110,11 +112,11 @@ const AddUsersPanel = ({
|
||||
const [total, setTotal] = useState(0);
|
||||
const [isLoading, setIsLoading] = useLoadingWithTimeout(
|
||||
LOADER_TIMEOUT,
|
||||
false
|
||||
false,
|
||||
);
|
||||
const [isLoadingSearch, setIsLoadingSearch] = useLoadingWithTimeout(
|
||||
LOADER_TIMEOUT,
|
||||
false
|
||||
false,
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
@ -321,7 +323,7 @@ export default inject(({ settingsStore }) => {
|
||||
})(
|
||||
observer(
|
||||
withTranslation(["SharingPanel", "PeopleTranslations", "Common"])(
|
||||
withLoader(AddUsersPanel)(<Loaders.DialogAsideLoader isPanel />)
|
||||
)
|
||||
)
|
||||
withLoader(AddUsersPanel)(<Loaders.DialogAsideLoader isPanel />),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
@ -292,6 +292,28 @@ const StyledDropDown = styled(DropDown)`
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.email-list_avatar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.email-list_add-button {
|
||||
display: flex;
|
||||
margin-left: auto;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
|
||||
p {
|
||||
color: #4781d1;
|
||||
}
|
||||
|
||||
svg path {
|
||||
fill: #4781d1;
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
|
@ -8,7 +8,7 @@ import { Text } from "@docspace/shared/components/text";
|
||||
import { TextInput } from "@docspace/shared/components/text-input";
|
||||
import { DropDownItem } from "@docspace/shared/components/drop-down-item";
|
||||
import { toastr } from "@docspace/shared/components/toast";
|
||||
import { parseAddresses } from "@docspace/shared/utils";
|
||||
import { parseAddresses, getParts } from "@docspace/shared/utils";
|
||||
import { ComboBox } from "@docspace/shared/components/combobox";
|
||||
|
||||
import Filter from "@docspace/shared/api/people/filter";
|
||||
@ -34,6 +34,9 @@ import {
|
||||
ResetLink,
|
||||
} from "../StyledInvitePanel";
|
||||
|
||||
import AtReactSvgUrl from "PUBLIC_DIR/images/@.react.svg?url";
|
||||
import ArrowIcon from "PUBLIC_DIR/images/arrow.right.react.svg";
|
||||
|
||||
const minSearchValue = 2;
|
||||
|
||||
const InviteInput = ({
|
||||
@ -60,10 +63,10 @@ const InviteInput = ({
|
||||
const [inputValue, setInputValue] = useState("");
|
||||
const [usersList, setUsersList] = useState([]);
|
||||
const [isChangeLangMail, setIsChangeLangMail] = useState(false);
|
||||
const [searchPanelVisible, setSearchPanelVisible] = useState(false);
|
||||
const [isAddEmailPanelBlocked, setIsAddEmailPanelBlocked] = useState(true);
|
||||
|
||||
const [selectedAccess, setSelectedAccess] = useState(defaultAccess);
|
||||
const [dropDownWidth, setDropDownWidth] = useState(0);
|
||||
|
||||
const searchRef = useRef();
|
||||
|
||||
@ -74,6 +77,13 @@ const InviteInput = ({
|
||||
isBeta: isBetaLanguage(language),
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
setTimeout(() => {
|
||||
const width = searchRef?.current?.offsetWidth ?? 0;
|
||||
if (width !== dropDownWidth) setDropDownWidth(width);
|
||||
}, 0);
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
!culture.key &&
|
||||
setInviteLanguage({
|
||||
@ -95,6 +105,7 @@ const InviteInput = ({
|
||||
access: selectedAccess,
|
||||
displayName: address.email,
|
||||
errors: address.parseErrors,
|
||||
isEmailInvite: true,
|
||||
};
|
||||
});
|
||||
}
|
||||
@ -105,32 +116,34 @@ const InviteInput = ({
|
||||
access: selectedAccess,
|
||||
displayName: addresses[0].email,
|
||||
errors: addresses[0].parseErrors,
|
||||
isEmailInvite: true,
|
||||
};
|
||||
};
|
||||
|
||||
const searchByQuery = async (value) => {
|
||||
const query = value.trim();
|
||||
|
||||
if (query.length >= minSearchValue) {
|
||||
if (query.length > minSearchValue) {
|
||||
const filter = Filter.getFilterWithOutDisabledUser();
|
||||
filter.search = query;
|
||||
|
||||
const users = await getMembersList(roomId, filter);
|
||||
|
||||
setUsersList(users.items);
|
||||
setIsAddEmailPanelBlocked(false);
|
||||
|
||||
if (users.total) setIsAddEmailPanelBlocked(false);
|
||||
}
|
||||
|
||||
if (!query) {
|
||||
closeInviteInputPanel();
|
||||
setInputValue("");
|
||||
setUsersList([]);
|
||||
setIsAddEmailPanelBlocked(true);
|
||||
}
|
||||
};
|
||||
|
||||
const debouncedSearch = useCallback(
|
||||
debounce((value) => searchByQuery(value), 300),
|
||||
[]
|
||||
[],
|
||||
);
|
||||
|
||||
const onChange = (e) => {
|
||||
@ -145,20 +158,22 @@ const InviteInput = ({
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
(!!usersList.length || clearValue.length >= minSearchValue) &&
|
||||
!searchPanelVisible
|
||||
) {
|
||||
openInviteInputPanel();
|
||||
}
|
||||
|
||||
if (roomId !== -1) {
|
||||
debouncedSearch(clearValue);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
setIsAddEmailPanelBlocked(false);
|
||||
const regex =
|
||||
/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{0,}))$/g;
|
||||
|
||||
const parts = getParts(value);
|
||||
for (let i = 0; i < parts.length; i += 1) {
|
||||
if (regex.test(parts[i])) {
|
||||
setIsAddEmailPanelBlocked(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
setIsAddEmailPanelBlocked(true);
|
||||
};
|
||||
|
||||
const removeExist = (items) => {
|
||||
@ -167,8 +182,7 @@ const InviteInput = ({
|
||||
return unique;
|
||||
}, []);
|
||||
|
||||
if (items.length > filtered.length)
|
||||
toastr.warning("Some users have already been added");
|
||||
if (items.length > filtered.length) toastr.warning(t("UsersAlreadyAdded"));
|
||||
|
||||
return filtered;
|
||||
};
|
||||
@ -179,22 +193,25 @@ const InviteInput = ({
|
||||
item.access = selectedAccess;
|
||||
|
||||
const addUser = () => {
|
||||
if (item.isOwner || item.isAdmin)
|
||||
item.access = ShareAccessRights.RoomManager;
|
||||
if (shared) {
|
||||
toastr.warning(t("UsersAlreadyAdded"));
|
||||
} else {
|
||||
if (item.isOwner || item.isAdmin)
|
||||
item.access = ShareAccessRights.RoomManager;
|
||||
|
||||
const items = removeExist([item, ...inviteItems]);
|
||||
const items = removeExist([item, ...inviteItems]);
|
||||
setInviteItems(items);
|
||||
}
|
||||
|
||||
setInviteItems(items);
|
||||
closeInviteInputPanel();
|
||||
setInputValue("");
|
||||
setUsersList([]);
|
||||
setIsAddEmailPanelBlocked(true);
|
||||
};
|
||||
|
||||
return (
|
||||
<DropDownItem
|
||||
key={id}
|
||||
onClick={addUser}
|
||||
disabled={shared}
|
||||
height={48}
|
||||
heightTablet={48}
|
||||
className="list-item"
|
||||
@ -220,8 +237,8 @@ const InviteInput = ({
|
||||
const filtered = removeExist(newItems);
|
||||
|
||||
setInviteItems(filtered);
|
||||
closeInviteInputPanel();
|
||||
setInputValue("");
|
||||
setIsAddEmailPanelBlocked(true);
|
||||
setUsersList([]);
|
||||
};
|
||||
|
||||
@ -231,7 +248,6 @@ const InviteInput = ({
|
||||
const filtered = removeExist(items);
|
||||
|
||||
setInviteItems(filtered);
|
||||
closeInviteInputPanel();
|
||||
setInputValue("");
|
||||
setUsersList([]);
|
||||
};
|
||||
@ -241,33 +257,35 @@ const InviteInput = ({
|
||||
const openUsersPanel = () => {
|
||||
setInputValue("");
|
||||
setAddUsersPanelVisible(true);
|
||||
setIsAddEmailPanelBlocked(true);
|
||||
};
|
||||
|
||||
const closeUsersPanel = () => {
|
||||
setAddUsersPanelVisible(false);
|
||||
};
|
||||
|
||||
const openInviteInputPanel = (e) => {
|
||||
setSearchPanelVisible(true);
|
||||
};
|
||||
|
||||
const closeInviteInputPanel = (e) => {
|
||||
if (e?.target?.tagName?.toUpperCase() === "INPUT") return;
|
||||
|
||||
setSearchPanelVisible(false);
|
||||
};
|
||||
|
||||
const foundUsers = usersList.map((user) => getItemContent(user));
|
||||
|
||||
const addEmailPanel = (
|
||||
<DropDownItem
|
||||
className="add-item"
|
||||
className="list-item"
|
||||
style={{ width: "inherit" }}
|
||||
textOverflow
|
||||
onClick={addEmail}
|
||||
height={48}
|
||||
>
|
||||
{t("Common:AddButton")} «{inputValue}»
|
||||
<div className="email-list_avatar">
|
||||
<Avatar size="min" role="user" source={AtReactSvgUrl} />
|
||||
<Text truncate fontSize="14px" fontWeight={600}>
|
||||
{inputValue}
|
||||
</Text>
|
||||
</div>
|
||||
<div className="email-list_add-button">
|
||||
<Text fontSize="13px" fontWeight={600}>
|
||||
{t("Common:AddButton")}
|
||||
</Text>
|
||||
<ArrowIcon />
|
||||
</div>
|
||||
</DropDownItem>
|
||||
);
|
||||
|
||||
@ -278,7 +296,7 @@ const InviteInput = ({
|
||||
};
|
||||
|
||||
const onKeyPress = (e) => {
|
||||
if (e.key === "Enter" && !!!usersList.length && inputValue.length > 2) {
|
||||
if (e.key === "Enter") {
|
||||
addEmail();
|
||||
}
|
||||
};
|
||||
@ -401,28 +419,27 @@ const InviteInput = ({
|
||||
: t("InviteRoomSearchPlaceholder")
|
||||
}
|
||||
value={inputValue}
|
||||
onFocus={openInviteInputPanel}
|
||||
isAutoFocussed={true}
|
||||
onKeyDown={onKeyDown}
|
||||
/>
|
||||
</StyledInviteInput>
|
||||
{inputValue.length >= minSearchValue &&
|
||||
(isAddEmailPanelBlocked ? (
|
||||
<></>
|
||||
) : (
|
||||
<StyledDropDown
|
||||
width={searchRef?.current?.offsetWidth}
|
||||
isDefaultMode={false}
|
||||
open={searchPanelVisible}
|
||||
manualX="16px"
|
||||
showDisabledItems
|
||||
clickOutsideAction={closeInviteInputPanel}
|
||||
eventTypes="click"
|
||||
{...dropDownMaxHeight}
|
||||
>
|
||||
{!!usersList.length ? foundUsers : addEmailPanel}
|
||||
</StyledDropDown>
|
||||
))}
|
||||
{isAddEmailPanelBlocked ? (
|
||||
<></>
|
||||
) : (
|
||||
<StyledDropDown
|
||||
width={dropDownWidth}
|
||||
isDefaultMode={false}
|
||||
open
|
||||
manualX="16px"
|
||||
showDisabledItems
|
||||
eventTypes="click"
|
||||
withBackdrop={false}
|
||||
zIndex={399}
|
||||
{...dropDownMaxHeight}
|
||||
>
|
||||
{!!usersList.length ? foundUsers : addEmailPanel}
|
||||
</StyledDropDown>
|
||||
)}
|
||||
|
||||
<AccessSelector
|
||||
className="add-manually-access"
|
||||
|
@ -3,11 +3,10 @@ import AtReactSvgUrl from "PUBLIC_DIR/images/@.react.svg?url";
|
||||
import React, { useState, useEffect } from "react";
|
||||
import { Avatar } from "@docspace/shared/components/avatar";
|
||||
import { Text } from "@docspace/shared/components/text";
|
||||
import { capitalize } from "lodash";
|
||||
|
||||
import { parseAddresses } from "@docspace/shared/utils";
|
||||
import { getAccessOptions } from "../utils";
|
||||
import { getUserRole } from "@docspace/shared/utils/common";
|
||||
import { getUserRole, getUserTypeLabel } from "@docspace/shared/utils/common";
|
||||
|
||||
import {
|
||||
StyledEditInput,
|
||||
@ -33,25 +32,37 @@ const Item = ({
|
||||
inputsRef,
|
||||
setIsOpenItemAccess,
|
||||
isMobileView,
|
||||
standalone,
|
||||
}) => {
|
||||
const { avatar, displayName, email, id, errors, access } = item;
|
||||
|
||||
const name = !!avatar ? (displayName !== "" ? displayName : email) : email;
|
||||
const source = !!avatar ? avatar : AtReactSvgUrl;
|
||||
const role = getUserRole(item);
|
||||
|
||||
const [edit, setEdit] = useState(false);
|
||||
const [inputValue, setInputValue] = useState(name);
|
||||
const [parseErrors, setParseErrors] = useState(errors);
|
||||
|
||||
const accesses = getAccessOptions(t, roomType, true, true, isOwner);
|
||||
const accesses = getAccessOptions(
|
||||
t,
|
||||
roomType,
|
||||
true,
|
||||
true,
|
||||
isOwner,
|
||||
standalone,
|
||||
);
|
||||
|
||||
const filteredAccesses = filterUserRoleOptions(accesses, item, true);
|
||||
|
||||
const defaultAccess = filteredAccesses.find(
|
||||
(option) => option.access === +access
|
||||
(option) => option.access === +access,
|
||||
);
|
||||
|
||||
const role = getUserRole(item);
|
||||
const typeLabel = item?.isEmailInvite
|
||||
? getUserTypeLabel(defaultAccess.type, t)
|
||||
: getUserTypeLabel(role, t);
|
||||
|
||||
const errorsInList = () => {
|
||||
const hasErrors = inviteItems.some((item) => !!item.errors?.length);
|
||||
setHasErrors(hasErrors);
|
||||
@ -133,7 +144,7 @@ const Item = ({
|
||||
color="#A3A9AE"
|
||||
truncate
|
||||
>
|
||||
{`${capitalize(role)} | ${email}`}
|
||||
{item.userName ? `${typeLabel} | ${email}` : `${typeLabel}`}
|
||||
</Text>
|
||||
</StyledInviteUserBody>
|
||||
|
||||
@ -167,6 +178,7 @@ const Item = ({
|
||||
setIsOpenItemAccess={setIsOpenItemAccess}
|
||||
isMobileView={isMobileView}
|
||||
noBorder
|
||||
standalone={standalone}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
|
@ -22,6 +22,7 @@ const Row = memo(({ data, index, style }) => {
|
||||
inputsRef,
|
||||
setIsOpenItemAccess,
|
||||
isMobileView,
|
||||
standalone,
|
||||
} = data;
|
||||
|
||||
if (inviteItems === undefined) return;
|
||||
@ -42,6 +43,7 @@ const Row = memo(({ data, index, style }) => {
|
||||
inputsRef={inputsRef}
|
||||
setIsOpenItemAccess={setIsOpenItemAccess}
|
||||
isMobileView={isMobileView}
|
||||
standalone={standalone}
|
||||
/>
|
||||
</StyledRow>
|
||||
);
|
||||
@ -60,6 +62,7 @@ const ItemsList = ({
|
||||
inputsRef,
|
||||
invitePanelBodyRef,
|
||||
isMobileView,
|
||||
standalone,
|
||||
}) => {
|
||||
const [bodyHeight, setBodyHeight] = useState(0);
|
||||
const [offsetTop, setOffsetTop] = useState(0);
|
||||
@ -146,6 +149,7 @@ const ItemsList = ({
|
||||
setIsOpenItemAccess,
|
||||
isMobileView,
|
||||
t,
|
||||
standalone,
|
||||
}}
|
||||
outerElementType={!scrollAllPanelContent && CustomScrollbarsVirtualList}
|
||||
>
|
||||
@ -155,14 +159,16 @@ const ItemsList = ({
|
||||
);
|
||||
};
|
||||
|
||||
export default inject(({ userStore, dialogsStore }) => {
|
||||
export default inject(({ userStore, dialogsStore, settingsStore }) => {
|
||||
const { setInviteItems, inviteItems, changeInviteItem } = dialogsStore;
|
||||
const { isOwner } = userStore.user;
|
||||
const { standalone } = settingsStore;
|
||||
|
||||
return {
|
||||
setInviteItems,
|
||||
inviteItems,
|
||||
changeInviteItem,
|
||||
isOwner,
|
||||
standalone,
|
||||
};
|
||||
})(observer(ItemsList));
|
||||
|
@ -10,7 +10,7 @@ export const getAccessOptions = (
|
||||
withRemove = false,
|
||||
withSeparator = false,
|
||||
isOwner = false,
|
||||
standalone = false
|
||||
standalone = false,
|
||||
) => {
|
||||
let options = [];
|
||||
const accesses = {
|
||||
@ -22,6 +22,7 @@ export const getAccessOptions = (
|
||||
color: "#EDC409",
|
||||
access:
|
||||
roomType === -1 ? EmployeeType.Admin : ShareAccessRights.FullAccess,
|
||||
type: "admin",
|
||||
},
|
||||
roomAdmin: {
|
||||
key: "roomAdmin",
|
||||
@ -31,6 +32,7 @@ export const getAccessOptions = (
|
||||
color: "#EDC409",
|
||||
access:
|
||||
roomType === -1 ? EmployeeType.User : ShareAccessRights.RoomManager,
|
||||
type: "manager",
|
||||
},
|
||||
collaborator: {
|
||||
key: "collaborator",
|
||||
@ -42,42 +44,49 @@ export const getAccessOptions = (
|
||||
roomType === -1
|
||||
? EmployeeType.Collaborator
|
||||
: ShareAccessRights.Collaborator,
|
||||
type: "collaborator",
|
||||
},
|
||||
user: {
|
||||
key: "user",
|
||||
label: t("Common:User"),
|
||||
description: t("Translations:RoleUserDescription"),
|
||||
access: EmployeeType.Guest,
|
||||
type: "user",
|
||||
},
|
||||
editor: {
|
||||
key: "editor",
|
||||
label: t("Translations:RoleEditor"),
|
||||
description: t("Translations:RoleEditorDescription"),
|
||||
access: ShareAccessRights.Editing,
|
||||
type: "user",
|
||||
},
|
||||
formFiller: {
|
||||
key: "formFiller",
|
||||
label: t("Translations:RoleFormFiller"),
|
||||
description: t("Translations:RoleFormFillerDescription"),
|
||||
access: ShareAccessRights.FormFilling,
|
||||
type: "user",
|
||||
},
|
||||
reviewer: {
|
||||
key: "reviewer",
|
||||
label: t("Translations:RoleReviewer"),
|
||||
description: t("Translations:RoleReviewerDescription"),
|
||||
access: ShareAccessRights.Review,
|
||||
type: "user",
|
||||
},
|
||||
commentator: {
|
||||
key: "commentator",
|
||||
label: t("Translations:RoleCommentator"),
|
||||
description: t("Translations:RoleCommentatorDescription"),
|
||||
access: ShareAccessRights.Comment,
|
||||
type: "user",
|
||||
},
|
||||
viewer: {
|
||||
key: "viewer",
|
||||
label: t("Translations:RoleViewer"),
|
||||
description: t("Translations:RoleViewerDescription"),
|
||||
access: ShareAccessRights.ReadOnly,
|
||||
type: "user",
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -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,
|
||||
|
@ -35,28 +35,26 @@ export default function withLoader(WrappedComponent) {
|
||||
type === "EmpInvite") &&
|
||||
!passwordSettings
|
||||
) {
|
||||
axios
|
||||
.all([getSettings(), getPortalPasswordSettings(confirmHeader)])
|
||||
.catch((error) => {
|
||||
let errorMessage = "";
|
||||
if (typeof error === "object") {
|
||||
errorMessage =
|
||||
error?.response?.data?.error?.message ||
|
||||
error?.statusText ||
|
||||
error?.message ||
|
||||
"";
|
||||
} else {
|
||||
errorMessage = error;
|
||||
}
|
||||
getPortalPasswordSettings(confirmHeader).catch((error) => {
|
||||
let errorMessage = "";
|
||||
if (typeof error === "object") {
|
||||
errorMessage =
|
||||
error?.response?.data?.error?.message ||
|
||||
error?.statusText ||
|
||||
error?.message ||
|
||||
"";
|
||||
} else {
|
||||
errorMessage = error;
|
||||
}
|
||||
|
||||
console.error(errorMessage);
|
||||
navigate(
|
||||
combineUrl(
|
||||
window.DocSpaceConfig?.proxy?.url,
|
||||
`/login/error?message=${errorMessage}`
|
||||
)
|
||||
);
|
||||
});
|
||||
console.error(errorMessage);
|
||||
navigate(
|
||||
combineUrl(
|
||||
window.DocSpaceConfig?.proxy?.url,
|
||||
`/login/error?message=${errorMessage}`,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
}, [passwordSettings]);
|
||||
|
||||
@ -77,8 +75,8 @@ export default function withLoader(WrappedComponent) {
|
||||
navigate(
|
||||
combineUrl(
|
||||
window.DocSpaceConfig?.proxy?.url,
|
||||
`/login/error?message=${errorMessage}`
|
||||
)
|
||||
`/login/error?message=${errorMessage}`,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import { ComboBox } from "@docspace/shared/components/combobox";
|
||||
|
||||
import { getUserStatus } from "SRC_DIR/helpers/people-helpers";
|
||||
import { StyledAccountContent } from "../../styles/accounts";
|
||||
import { getUserTypeLabel } from "@docspace/shared/utils/common";
|
||||
|
||||
const Accounts = (props) => {
|
||||
const {
|
||||
@ -46,21 +47,6 @@ const Accounts = (props) => {
|
||||
}
|
||||
}, [infoPanelSelection]);
|
||||
|
||||
const getUserTypeLabel = React.useCallback((role) => {
|
||||
switch (role) {
|
||||
case "owner":
|
||||
return t("Common:Owner");
|
||||
case "admin":
|
||||
return t("Common:DocSpaceAdmin");
|
||||
case "manager":
|
||||
return t("Common:RoomAdmin");
|
||||
case "collaborator":
|
||||
return t("Common:PowerUser");
|
||||
case "user":
|
||||
return t("Common:User");
|
||||
}
|
||||
}, []);
|
||||
|
||||
const getTypesOptions = React.useCallback(() => {
|
||||
const options = [];
|
||||
|
||||
@ -128,10 +114,10 @@ const Accounts = (props) => {
|
||||
setIsLoading(false);
|
||||
}
|
||||
},
|
||||
[infoPanelSelection, changeUserType, t]
|
||||
[infoPanelSelection, changeUserType, t],
|
||||
);
|
||||
|
||||
const typeLabel = getUserTypeLabel(role);
|
||||
const typeLabel = React.useCallback(() => getUserTypeLabel(role, t), [])();
|
||||
|
||||
const renderTypeData = () => {
|
||||
const typesOptions = getTypesOptions();
|
||||
@ -248,7 +234,7 @@ export default inject(
|
||||
getPeopleListItem: usersStore.getPeopleListItem,
|
||||
setInfoPanelSelection,
|
||||
};
|
||||
}
|
||||
},
|
||||
)(
|
||||
withTranslation([
|
||||
"People",
|
||||
@ -263,7 +249,7 @@ export default inject(
|
||||
"Translations",
|
||||
])(
|
||||
withLoader(observer(Accounts))(
|
||||
<Loaders.InfoPanelViewLoader view="accounts" />
|
||||
)
|
||||
)
|
||||
<Loaders.InfoPanelViewLoader view="accounts" />,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
@ -9,9 +9,8 @@ import { toastr } from "@docspace/shared/components/toast";
|
||||
import { isMobileOnly, isMobile } from "react-device-detect";
|
||||
import { decode } from "he";
|
||||
import { filterUserRoleOptions } from "SRC_DIR/helpers";
|
||||
import { capitalize } from "lodash";
|
||||
|
||||
import { getUserRole } from "@docspace/shared/utils/common";
|
||||
import { getUserRole, getUserTypeLabel } from "@docspace/shared/utils/common";
|
||||
import { Text } from "@docspace/shared/components/text";
|
||||
import EmailPlusReactSvgUrl from "PUBLIC_DIR/images/e-mail+.react.svg?url";
|
||||
import { StyledUserTypeHeader } from "../../styles/members";
|
||||
@ -48,7 +47,7 @@ const User = ({
|
||||
|
||||
const fullRoomRoleOptions = membersHelper.getOptionsByRoomType(
|
||||
infoPanelSelection.roomType,
|
||||
canChangeUserRole
|
||||
canChangeUserRole,
|
||||
);
|
||||
|
||||
const userRole = membersHelper.getOptionByUserAccess(user.access, user);
|
||||
@ -57,7 +56,7 @@ const User = ({
|
||||
const onRepeatInvitation = async () => {
|
||||
resendEmailInvitations(infoPanelSelection.id, true)
|
||||
.then(() =>
|
||||
toastr.success(t("PeopleTranslations:SuccessSentMultipleInvitatios"))
|
||||
toastr.success(t("PeopleTranslations:SuccessSentMultipleInvitatios")),
|
||||
)
|
||||
.catch((err) => toastr.error(err));
|
||||
};
|
||||
@ -77,10 +76,10 @@ const User = ({
|
||||
const newMembers = {
|
||||
users: infoPanelMembers.users?.filter((m) => m.id !== user.id),
|
||||
administrators: infoPanelMembers.administrators?.filter(
|
||||
(m) => m.id !== user.id
|
||||
(m) => m.id !== user.id,
|
||||
),
|
||||
expected: infoPanelMembers.expected?.filter(
|
||||
(m) => m.id !== user.id
|
||||
(m) => m.id !== user.id,
|
||||
),
|
||||
};
|
||||
|
||||
@ -129,13 +128,13 @@ const User = ({
|
||||
setInfoPanelMembers({
|
||||
roomId: infoPanelSelection.id,
|
||||
users: infoPanelMembers.users?.map((m) =>
|
||||
m.id === user.id ? { ...m, access: option.access } : m
|
||||
m.id === user.id ? { ...m, access: option.access } : m,
|
||||
),
|
||||
administrators: infoPanelMembers.administrators?.map((m) =>
|
||||
m.id === user.id ? { ...m, access: option.access } : m
|
||||
m.id === user.id ? { ...m, access: option.access } : m,
|
||||
),
|
||||
expected: infoPanelMembers.expected?.map((m) =>
|
||||
m.id === user.id ? { ...m, access: option.access } : m
|
||||
m.id === user.id ? { ...m, access: option.access } : m,
|
||||
),
|
||||
});
|
||||
}
|
||||
@ -182,6 +181,8 @@ const User = ({
|
||||
const onToggle = (e, isOpen) => {
|
||||
// setIsScrollLocked(isOpen);
|
||||
};
|
||||
const role = getUserRole(user);
|
||||
const typeLabel = getUserTypeLabel(role, t);
|
||||
|
||||
const getTooltipContent = () => (
|
||||
<div>
|
||||
@ -197,15 +198,13 @@ const User = ({
|
||||
color="#A3A9AE !important"
|
||||
dir="auto"
|
||||
>
|
||||
{`${capitalize(role)} | ${user.email}`}
|
||||
{`${typeLabel} | ${user.email}`}
|
||||
</Text>
|
||||
</div>
|
||||
);
|
||||
|
||||
const userAvatar = user.hasAvatar ? user.avatar : DefaultUserPhotoUrl;
|
||||
|
||||
const role = getUserRole(user);
|
||||
|
||||
const withTooltip = user.isOwner || user.isAdmin;
|
||||
|
||||
const uniqueTooltipId = `userTooltip_${Math.random()}`;
|
||||
@ -269,7 +268,7 @@ const User = ({
|
||||
color="#A3A9AE"
|
||||
dir="auto"
|
||||
>
|
||||
{`${capitalize(role)} | ${user.email}`}
|
||||
{`${typeLabel} | ${user.email}`}
|
||||
</Text>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -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)));
|
||||
|
@ -14,6 +14,7 @@ import withContent from "SRC_DIR/HOCs/withPeopleContent";
|
||||
|
||||
import Badges from "../Badges";
|
||||
import { Base } from "@docspace/shared/themes";
|
||||
import { getUserTypeLabel } from "@docspace/shared/utils/common";
|
||||
|
||||
const StyledWrapper = styled.div`
|
||||
display: contents;
|
||||
@ -308,7 +309,7 @@ const PeopleTableRow = (props) => {
|
||||
setIsLoading(false);
|
||||
}
|
||||
},
|
||||
[item, changeUserType]
|
||||
[item, changeUserType],
|
||||
);
|
||||
|
||||
// const getRoomsOptions = React.useCallback(() => {
|
||||
@ -328,22 +329,7 @@ const PeopleTableRow = (props) => {
|
||||
// return <>{options.map((option) => option)}</>;
|
||||
// }, []);
|
||||
|
||||
const getUserTypeLabel = React.useCallback((role) => {
|
||||
switch (role) {
|
||||
case "owner":
|
||||
return t("Common:Owner");
|
||||
case "admin":
|
||||
return t("Common:DocSpaceAdmin");
|
||||
case "manager":
|
||||
return t("Common:RoomAdmin");
|
||||
case "collaborator":
|
||||
return t("Common:PowerUser");
|
||||
case "user":
|
||||
return t("Common:User");
|
||||
}
|
||||
}, []);
|
||||
|
||||
const typeLabel = getUserTypeLabel(role);
|
||||
const typeLabel = React.useCallback(() => getUserTypeLabel(role, t), [])();
|
||||
|
||||
const isChecked = checkedProps.checked;
|
||||
|
||||
@ -532,5 +518,5 @@ const PeopleTableRow = (props) => {
|
||||
};
|
||||
|
||||
export default withTranslation(["People", "Common", "Settings"])(
|
||||
withContent(PeopleTableRow)
|
||||
withContent(PeopleTableRow),
|
||||
);
|
||||
|
@ -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))));
|
||||
|
@ -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";
|
||||
|
||||
|
@ -22,8 +22,8 @@ const SsoComboBox = (props) => {
|
||||
const currentOption =
|
||||
options.find((option) => option.key === value) || options[0];
|
||||
|
||||
const onSelect = () => {
|
||||
setComboBox(currentOption, name);
|
||||
const onSelect = (option) => {
|
||||
setComboBox(option, name);
|
||||
};
|
||||
|
||||
return (
|
||||
|
@ -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,
|
||||
|
@ -145,6 +145,13 @@ const PreparationPortal = (props) => {
|
||||
returnToPortal();
|
||||
}
|
||||
} catch (error) {
|
||||
const status = err?.response?.status;
|
||||
const needCreationTableTime = status === 404;
|
||||
|
||||
if (needCreationTableTime) {
|
||||
return;
|
||||
}
|
||||
|
||||
clearAllIntervals();
|
||||
setErrorMessage(error);
|
||||
}
|
||||
@ -249,7 +256,7 @@ const PreparationPortalWrapper = inject(({ backup }) => {
|
||||
multiplicationFactor,
|
||||
};
|
||||
})(
|
||||
withTranslation(["PreparationPortal", "Common"])(observer(PreparationPortal))
|
||||
withTranslation(["PreparationPortal", "Common"])(observer(PreparationPortal)),
|
||||
);
|
||||
|
||||
PreparationPortal.propTypes = {
|
||||
|
@ -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) {
|
||||
|
@ -6,7 +6,7 @@ import { checkDialogsOpen } from "@docspace/shared/utils/checkDialogsOpen";
|
||||
|
||||
import { toastr } from "@docspace/shared/components/toast";
|
||||
import { isDesktop, isMobile } from "@docspace/shared/utils";
|
||||
import { getFilesFromEvent } from "@docspace/shared/components/drag-and-drop";
|
||||
import getFilesFromEvent from "@docspace/shared/components/drag-and-drop/get-files-from-event";
|
||||
|
||||
import config from "PACKAGE_FILE";
|
||||
import { getCategoryUrl } from "SRC_DIR/helpers/utils";
|
||||
|
@ -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;
|
||||
|
||||
this.stepByQuotaForManager = stepAddingQuotaManagers;
|
||||
if (stepAddingQuotaManagers)
|
||||
this.stepByQuotaForManager = stepAddingQuotaManagers;
|
||||
this.minAvailableManagersValue = this.stepByQuotaForManager;
|
||||
|
||||
this.stepByQuotaForTotalSize = stepAddingQuotaTotalSize;
|
||||
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,44 +264,52 @@ 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");
|
||||
script.setAttribute("type", "text/javascript");
|
||||
script.setAttribute("id", `${plugin.name}`);
|
||||
const script = frameDoc?.createElement("script");
|
||||
|
||||
if (onLoad) script.onload = onLoad.bind(this);
|
||||
if (onError) script.onerror = onError.bind(this);
|
||||
if (script) {
|
||||
script.setAttribute("type", "text/javascript");
|
||||
script.setAttribute("id", `${plugin.name}`);
|
||||
|
||||
script.src = plugin.url;
|
||||
script.async = true;
|
||||
if (onLoad) script.onload = onLoad.bind(this);
|
||||
if (onError) script.onerror = onError.bind(this);
|
||||
|
||||
frameDoc.body.appendChild(script);
|
||||
script.src = plugin.url;
|
||||
script.async = true;
|
||||
|
||||
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;
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user