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",
|
"name": "docspace",
|
||||||
"version": "2.0.2",
|
"version": "2.0.3",
|
||||||
"private": true,
|
"private": true,
|
||||||
"workspaces": {
|
"workspaces": {
|
||||||
"packages": [
|
"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 {
|
interface Window {
|
||||||
zESettings?: any;
|
zESettings?: unknown;
|
||||||
zE?: {
|
zE?: {
|
||||||
apply: Function;
|
apply: Function;
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@docspace/client",
|
"name": "@docspace/client",
|
||||||
"version": "2.0.2",
|
"version": "2.0.3",
|
||||||
"private": true,
|
"private": true,
|
||||||
"homepage": "",
|
"homepage": "",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@ -59,6 +59,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.21.3",
|
"@babel/core": "^7.21.3",
|
||||||
|
"@babel/eslint-parser": "^7.21.8",
|
||||||
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
||||||
"@babel/plugin-proposal-export-default-from": "^7.18.10",
|
"@babel/plugin-proposal-export-default-from": "^7.18.10",
|
||||||
"@babel/plugin-transform-runtime": "^7.21.0",
|
"@babel/plugin-transform-runtime": "^7.21.0",
|
||||||
@ -66,16 +67,30 @@
|
|||||||
"@babel/preset-react": "^7.18.6",
|
"@babel/preset-react": "^7.18.6",
|
||||||
"@babel/preset-typescript": "^7.21.0",
|
"@babel/preset-typescript": "^7.21.0",
|
||||||
"@svgr/webpack": "^5.5.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",
|
"babel-loader": "^8.3.0",
|
||||||
"clean-webpack-plugin": "^4.0.0",
|
"clean-webpack-plugin": "^4.0.0",
|
||||||
"copy-webpack-plugin": "^9.1.0",
|
"copy-webpack-plugin": "^9.1.0",
|
||||||
"css-loader": "^6.7.3",
|
"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",
|
"external-remotes-plugin": "^1.0.0",
|
||||||
"file-loader": "^6.2.0",
|
"file-loader": "^6.2.0",
|
||||||
"html-loader": "^4.2.0",
|
"html-loader": "^4.2.0",
|
||||||
"html-webpack-plugin": "5.5.0",
|
"html-webpack-plugin": "5.5.0",
|
||||||
"json-loader": "^0.5.7",
|
"json-loader": "^0.5.7",
|
||||||
"playwright": "^1.32.0",
|
"playwright": "^1.32.0",
|
||||||
|
"prettier": "^3.1.0",
|
||||||
"sass": "^1.59.3",
|
"sass": "^1.59.3",
|
||||||
"sass-loader": "^12.6.0",
|
"sass-loader": "^12.6.0",
|
||||||
"serve": "14.2.0",
|
"serve": "14.2.0",
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
"MobileWin": "حمّل ONLYOFFICE Desktop Editors لنظام ويندوز",
|
"MobileWin": "حمّل ONLYOFFICE Desktop Editors لنظام ويندوز",
|
||||||
"MoveHere": "انقل إلى هنا",
|
"MoveHere": "انقل إلى هنا",
|
||||||
"MoveToOperation": "جارٍ النقل",
|
"MoveToOperation": "جارٍ النقل",
|
||||||
"NewForm": "قوالب جاهزة",
|
"NewForm": "نموذج PDF",
|
||||||
"Other": "آخر",
|
"Other": "آخر",
|
||||||
"OwnerChange": "تغيير المالك",
|
"OwnerChange": "تغيير المالك",
|
||||||
"Presentations": "العروض التقديمية",
|
"Presentations": "العروض التقديمية",
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
"MobileWin": "Windows üçün ONLYOFFICE Masaüstü Redaktorları endirin",
|
"MobileWin": "Windows üçün ONLYOFFICE Masaüstü Redaktorları endirin",
|
||||||
"MoveHere": "Bura köçürün",
|
"MoveHere": "Bura köçürün",
|
||||||
"MoveToOperation": "Yer dəyişdirmə",
|
"MoveToOperation": "Yer dəyişdirmə",
|
||||||
"NewForm": "Forma şablonu",
|
"NewForm": "PDF forma",
|
||||||
"Other": "Digər",
|
"Other": "Digər",
|
||||||
"OwnerChange": "Sahibi dəyiş",
|
"OwnerChange": "Sahibi dəyiş",
|
||||||
"Presentations": "Təqdimatlar",
|
"Presentations": "Təqdimatlar",
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
"MobileWin": "Изтеглете ONLYOFFICE настолни редактори за Windows",
|
"MobileWin": "Изтеглете ONLYOFFICE настолни редактори за Windows",
|
||||||
"MoveHere": "Премести се тук",
|
"MoveHere": "Премести се тук",
|
||||||
"MoveToOperation": "Преместване",
|
"MoveToOperation": "Преместване",
|
||||||
"NewForm": "Шаблон на формуляр",
|
"NewForm": "PDF формуляр",
|
||||||
"Other": "Друг",
|
"Other": "Друг",
|
||||||
"OwnerChange": "Смени собственик",
|
"OwnerChange": "Смени собственик",
|
||||||
"Presentations": "Презентации",
|
"Presentations": "Презентации",
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
"MobileWin": "Stáhnout ONLYOFFICE Desktop Editors pro Windows",
|
"MobileWin": "Stáhnout ONLYOFFICE Desktop Editors pro Windows",
|
||||||
"MoveHere": "Přesunout zde",
|
"MoveHere": "Přesunout zde",
|
||||||
"MoveToOperation": "Přesouvám",
|
"MoveToOperation": "Přesouvám",
|
||||||
"NewForm": "Šablona formuláře",
|
"NewForm": "PDF formulář",
|
||||||
"Other": "Jiný",
|
"Other": "Jiný",
|
||||||
"OwnerChange": "Změnit vlastníka",
|
"OwnerChange": "Změnit vlastníka",
|
||||||
"Presentations": "Prezentace",
|
"Presentations": "Prezentace",
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
"MobileWin": "Download ONLYOFFICE Desktop Editors für Windows",
|
"MobileWin": "Download ONLYOFFICE Desktop Editors für Windows",
|
||||||
"MoveHere": "Verschieben",
|
"MoveHere": "Verschieben",
|
||||||
"MoveToOperation": "Wird verschoben",
|
"MoveToOperation": "Wird verschoben",
|
||||||
"NewForm": "Formularvorlage",
|
"NewForm": "PDF-Formular",
|
||||||
"Other": "Sonstiges",
|
"Other": "Sonstiges",
|
||||||
"OwnerChange": "Besitzer ändern",
|
"OwnerChange": "Besitzer ändern",
|
||||||
"Presentations": "Präsentationen",
|
"Presentations": "Präsentationen",
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
"MobileWin": "Λήψη ONLYOFFICE Desktop Editors για Windows",
|
"MobileWin": "Λήψη ONLYOFFICE Desktop Editors για Windows",
|
||||||
"MoveHere": "Μετακίνηση εδώ",
|
"MoveHere": "Μετακίνηση εδώ",
|
||||||
"MoveToOperation": "Μετακίνηση",
|
"MoveToOperation": "Μετακίνηση",
|
||||||
"NewForm": "Πρότυπο φόρμας",
|
"NewForm": "Φόρμα PDF",
|
||||||
"Other": "Άλλο",
|
"Other": "Άλλο",
|
||||||
"OwnerChange": "Αλλαγή κατόχου",
|
"OwnerChange": "Αλλαγή κατόχου",
|
||||||
"Presentations": "Παρουσιάσεις",
|
"Presentations": "Παρουσιάσεις",
|
||||||
|
@ -14,9 +14,9 @@
|
|||||||
"ArchiveEmptyScreenUser": "Rooms that have been archived will appear here.",
|
"ArchiveEmptyScreenUser": "Rooms that have been archived will appear here.",
|
||||||
"Archives": "Archives",
|
"Archives": "Archives",
|
||||||
"AssignOwner": "Assign Owner",
|
"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",
|
"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",
|
"BadgeMyDraftTitle": "My draft",
|
||||||
"BackToParentFolderButton": "Back to parent folder",
|
|
||||||
"ByAuthor": "Author",
|
"ByAuthor": "Author",
|
||||||
"ByCreation": "Created",
|
"ByCreation": "Created",
|
||||||
"ByErasure": "Erasure",
|
"ByErasure": "Erasure",
|
||||||
@ -27,20 +27,20 @@
|
|||||||
"CollaborationRooms": "Collaboration",
|
"CollaborationRooms": "Collaboration",
|
||||||
"ContainsSpecCharacter": "The title can't contain any of the following characters: *+:\"<>?|/",
|
"ContainsSpecCharacter": "The title can't contain any of the following characters: *+:\"<>?|/",
|
||||||
"Convert": "Convert",
|
"Convert": "Convert",
|
||||||
"CopySharedLink": "Copy shared link",
|
|
||||||
"CopyItem": "<strong>{{title}}</strong> copied",
|
"CopyItem": "<strong>{{title}}</strong> copied",
|
||||||
"CopyItems": "<strong>{{qty}}</strong> elements copied",
|
"CopyItems": "<strong>{{qty}}</strong> elements copied",
|
||||||
"CopyLink": "Copy link",
|
"CopyLink": "Copy link",
|
||||||
"CopyLinkPassword": "Copy link password",
|
"CopyLinkPassword": "Copy link password",
|
||||||
"CopyPassword": "Copy password",
|
"CopyPassword": "Copy password",
|
||||||
|
"CopySharedLink": "Copy shared link",
|
||||||
"CreateAndCopy": "Create and copy",
|
"CreateAndCopy": "Create and copy",
|
||||||
"CreateNewLink": "Create new link",
|
"CreateNewLink": "Create new link",
|
||||||
"CreateRoom": "Create room",
|
"CreateRoom": "Create room",
|
||||||
"CustomRooms": "Custom",
|
"CustomRooms": "Custom",
|
||||||
"DaysRemaining": "Days remaining: {{daysRemaining}}",
|
"DaysRemaining": "Days remaining: {{daysRemaining}}",
|
||||||
"DeleteSharedLink": "The previous link will become unavailable. A new shared link will be created.",
|
|
||||||
"DeleteLink": "Delete link",
|
"DeleteLink": "Delete link",
|
||||||
"DeleteLinkNote": "The link will be deleted permanently. You will not be able to undo this action.",
|
"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",
|
"DisableDownload": "Restrict file content copy, file download and printing",
|
||||||
"DisableLink": "Disable link",
|
"DisableLink": "Disable link",
|
||||||
"DisableNotifications": "Disable notifications",
|
"DisableNotifications": "Disable notifications",
|
||||||
@ -48,9 +48,9 @@
|
|||||||
"DocumentEdited": "Cannot perform the action because the document is being edited.",
|
"DocumentEdited": "Cannot perform the action because the document is being edited.",
|
||||||
"DownloadAll": "Download all",
|
"DownloadAll": "Download all",
|
||||||
"EditAdditionalLink": "Edit additional link",
|
"EditAdditionalLink": "Edit additional link",
|
||||||
"EditSharedLink": "Edit shared link",
|
|
||||||
"EditLink": "Edit link",
|
"EditLink": "Edit link",
|
||||||
"EditRoom": "Edit room",
|
"EditRoom": "Edit room",
|
||||||
|
"EditSharedLink": "Edit shared link",
|
||||||
"EmbeddingSettings": "Embedding settings",
|
"EmbeddingSettings": "Embedding settings",
|
||||||
"EmptyFile": "Empty file",
|
"EmptyFile": "Empty file",
|
||||||
"EmptyFilterDescriptionText": "No files or folders match this filter. Try a different one or clear filter to view all files. ",
|
"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",
|
"EmptyFolderDecription": "Drop files here or create new ones",
|
||||||
"EmptyFolderDescriptionUser": "Files and folders uploaded by admins will appear here.",
|
"EmptyFolderDescriptionUser": "Files and folders uploaded by admins will appear here.",
|
||||||
"EmptyFolderHeader": "No files in this folder",
|
"EmptyFolderHeader": "No files in this folder",
|
||||||
"EmptyFormFolderDoneHeaderText": "No finished forms yet",
|
|
||||||
"EmptyFormFolderDoneDescriptionText": "This section will display all forms that are complete.",
|
"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.",
|
"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.",
|
"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. ",
|
"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",
|
"EmptyRecycleBin": "Empty Trash",
|
||||||
"EmptyRootRoomHeader": "Welcome to DocSpace",
|
"EmptyRootRoomHeader": "Welcome to DocSpace",
|
||||||
@ -73,8 +73,10 @@
|
|||||||
"ExcludeSubfolders": "Exclude subfolders",
|
"ExcludeSubfolders": "Exclude subfolders",
|
||||||
"FavoritesEmptyContainerDescription": "To mark files as favorites or remove them from this list, use the context menu.",
|
"FavoritesEmptyContainerDescription": "To mark files as favorites or remove them from this list, use the context menu.",
|
||||||
"FileContents": "File contents",
|
"FileContents": "File contents",
|
||||||
|
"FileDownloadingIsRestricted": "File downloading is restricted in this room.",
|
||||||
"FileRemoved": "File moved to Trash",
|
"FileRemoved": "File moved to Trash",
|
||||||
"FileRenamed": "The document '{{oldTitle}}' is renamed to '{{newTitle}}'",
|
"FileRenamed": "The document '{{oldTitle}}' is renamed to '{{newTitle}}'",
|
||||||
|
"FilesWillAppearHere": "Files and folders added to the room will appear here.",
|
||||||
"FillingFormRooms": "Filling form",
|
"FillingFormRooms": "Filling form",
|
||||||
"Filter": "Filter",
|
"Filter": "Filter",
|
||||||
"FinalizeVersion": "Finalize version",
|
"FinalizeVersion": "Finalize version",
|
||||||
@ -84,7 +86,6 @@
|
|||||||
"FormRoom": "Form room",
|
"FormRoom": "Form room",
|
||||||
"Forms": "Forms",
|
"Forms": "Forms",
|
||||||
"FormsTemplates": "Forms templates",
|
"FormsTemplates": "Forms templates",
|
||||||
"SharedLinks": "Shared links",
|
|
||||||
"GeneralLinkDeletedSuccessfully": "New general link created successfully",
|
"GeneralLinkDeletedSuccessfully": "New general link created successfully",
|
||||||
"GoToMyRooms": "Go to rooms",
|
"GoToMyRooms": "Go to rooms",
|
||||||
"GoToPersonal": "Go to My Documents",
|
"GoToPersonal": "Go to My Documents",
|
||||||
@ -99,6 +100,7 @@
|
|||||||
"LinkEditedSuccessfully": "Link successfully edited and copied",
|
"LinkEditedSuccessfully": "Link successfully edited and copied",
|
||||||
"LinkEnabledSuccessfully": "Link enabled successfully",
|
"LinkEnabledSuccessfully": "Link enabled successfully",
|
||||||
"LinkForPortalUsers": "Link for DocSpace users",
|
"LinkForPortalUsers": "Link for DocSpace users",
|
||||||
|
"LinkSettings": "Link settings",
|
||||||
"LinkSuccessfullyCopied": "Link successfully copied to clipboard",
|
"LinkSuccessfullyCopied": "Link successfully copied to clipboard",
|
||||||
"LinkSuccessfullyCreatedAndCopied": "Link successfully created and copied to clipboard",
|
"LinkSuccessfullyCreatedAndCopied": "Link successfully created and copied to clipboard",
|
||||||
"LinkValidUntil": "This link will be valid until",
|
"LinkValidUntil": "This link will be valid until",
|
||||||
@ -139,8 +141,8 @@
|
|||||||
"PrivateRoomHeader": "Welcome to ONLYOFFICE private room where every symbol you type is encrypted",
|
"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>",
|
"PrivateRoomSupport": "Work in Private Room is available via {{organizationName}} desktop app. <3>Instructions</3>",
|
||||||
"PublicRoom": "Public room",
|
"PublicRoom": "Public room",
|
||||||
"RecentlyAccessible": "Recently accessible via link",
|
|
||||||
"RecentEmptyContainerDescription": "Your last viewed or edited docs will be displayed in this section.",
|
"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.",
|
"RecentViaLinkEmptyContainerDescription": "Here you will find a list of the recently opened files shared with you via an external link.",
|
||||||
"RecycleBinAction": "Empty trash",
|
"RecycleBinAction": "Empty trash",
|
||||||
"RemovedFromFavorites": "Removed from favorites",
|
"RemovedFromFavorites": "Removed from favorites",
|
||||||
@ -150,6 +152,7 @@
|
|||||||
"RevokeLink": "Revoke link",
|
"RevokeLink": "Revoke link",
|
||||||
"RoomAvailableViaExternalLink": "Room available via external link",
|
"RoomAvailableViaExternalLink": "Room available via external link",
|
||||||
"RoomCreated": "Room created",
|
"RoomCreated": "Room created",
|
||||||
|
"RoomEmptyAtTheMoment": "This room is empty at the moment.",
|
||||||
"RoomEmptyContainerDescription": "Please create the first room.",
|
"RoomEmptyContainerDescription": "Please create the first room.",
|
||||||
"RoomEmptyContainerDescriptionUser": "Rooms shared with you will appear here.",
|
"RoomEmptyContainerDescriptionUser": "Rooms shared with you will appear here.",
|
||||||
"RoomNotificationsDisabled": "Room notifications disabled",
|
"RoomNotificationsDisabled": "Room notifications disabled",
|
||||||
@ -165,6 +168,7 @@
|
|||||||
"SelectorEmptyScreenHeader": "No files and folders here yet",
|
"SelectorEmptyScreenHeader": "No files and folders here yet",
|
||||||
"SendByEmail": "Send by email",
|
"SendByEmail": "Send by email",
|
||||||
"Share": "Share",
|
"Share": "Share",
|
||||||
|
"SharedLinks": "Shared links",
|
||||||
"ShareFolder": "Share folder",
|
"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.",
|
"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",
|
"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?",
|
"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?",
|
"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",
|
"WithSubfolders": "With subfolders",
|
||||||
"YouLeftTheRoom": "You have left the room",
|
"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."
|
|
||||||
}
|
}
|
||||||
|
@ -12,5 +12,6 @@
|
|||||||
"InviteViaLinkDescriptionRoom": "Create a universal link for self-authorization in the room",
|
"InviteViaLinkDescriptionRoom": "Create a universal link for self-authorization in the room",
|
||||||
"LinkCopySuccess": "Link has been copied",
|
"LinkCopySuccess": "Link has been copied",
|
||||||
"ResetChange": "Reset change",
|
"ResetChange": "Reset change",
|
||||||
"SendInvitation": "Send invitation"
|
"SendInvitation": "Send invitation",
|
||||||
|
"UsersAlreadyAdded": "Some users have already been added"
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"AddGroupsForSharingButton": "Add groups",
|
"AddGroupsForSharingButton": "Add groups",
|
||||||
"AddShareMessage": "Add message",
|
|
||||||
"AdditionalLinkRemove": "Additional link remove",
|
"AdditionalLinkRemove": "Additional link remove",
|
||||||
|
"AddShareMessage": "Add message",
|
||||||
"AnyoneWithLink": "Anyone with the link",
|
"AnyoneWithLink": "Anyone with the link",
|
||||||
"Comment": "Comment",
|
"Comment": "Comment",
|
||||||
"CopyExternalLink": "Copy external link",
|
"CopyExternalLink": "Copy external link",
|
||||||
@ -19,16 +19,16 @@
|
|||||||
"GeneralAccessLinkRemove": "General access link remove",
|
"GeneralAccessLinkRemove": "General access link remove",
|
||||||
"InternalLink": "Internal link",
|
"InternalLink": "Internal link",
|
||||||
"LinkAccessDenied": "Access to the link has been denied",
|
"LinkAccessDenied": "Access to the link has been denied",
|
||||||
"LinkName": "Link name",
|
|
||||||
"LinkExpireAfter": "The link will expire after <1>{{date}}</1>",
|
"LinkExpireAfter": "The link will expire after <1>{{date}}</1>",
|
||||||
"LinkExpired": "The link has expired.",
|
"LinkExpired": "The link has expired.",
|
||||||
"LinkIsValid": "The link is valid for <1>{{date}}</1>",
|
"LinkIsValid": "The link is valid for <1>{{date}}</1>",
|
||||||
|
"LinkName": "Link name",
|
||||||
"Notify users": "Notify users",
|
"Notify users": "Notify users",
|
||||||
"ReadOnly": "Read only",
|
"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",
|
"ShareDocument": "Share this document",
|
||||||
"ShareDocumentDescription": "Provide access to the document and set the permission levels.",
|
"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",
|
"ShareVia": "Share via",
|
||||||
"SharingSettingsTitle": "Sharing settings"
|
"SharingSettingsTitle": "Sharing settings"
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
"MobileWin": "Download ONLYOFFICE Desktop Editors for Windows",
|
"MobileWin": "Download ONLYOFFICE Desktop Editors for Windows",
|
||||||
"MoveHere": "Move here",
|
"MoveHere": "Move here",
|
||||||
"MoveToOperation": "Moving",
|
"MoveToOperation": "Moving",
|
||||||
"NewForm": "Form template",
|
"NewForm": "PDF Form",
|
||||||
"Other": "Other",
|
"Other": "Other",
|
||||||
"OwnerChange": "Change owner",
|
"OwnerChange": "Change owner",
|
||||||
"Presentations": "Presentations",
|
"Presentations": "Presentations",
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
"MobileWin": "Descargar los editores de escritorio ONLYOFFICE para Windows",
|
"MobileWin": "Descargar los editores de escritorio ONLYOFFICE para Windows",
|
||||||
"MoveHere": "Mover aquí",
|
"MoveHere": "Mover aquí",
|
||||||
"MoveToOperation": "Moviendo",
|
"MoveToOperation": "Moviendo",
|
||||||
"NewForm": "Plantilla de formulario",
|
"NewForm": "Formulario PDF",
|
||||||
"Other": "Otro",
|
"Other": "Otro",
|
||||||
"OwnerChange": "Cambiar propietario",
|
"OwnerChange": "Cambiar propietario",
|
||||||
"Presentations": "Presentaciones",
|
"Presentations": "Presentaciones",
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
"MobileWin": "Lataa ONLYOFFICE Desktop Editors Windowsille",
|
"MobileWin": "Lataa ONLYOFFICE Desktop Editors Windowsille",
|
||||||
"MoveHere": "Siirrä tänne",
|
"MoveHere": "Siirrä tänne",
|
||||||
"MoveToOperation": "Siirretään",
|
"MoveToOperation": "Siirretään",
|
||||||
"NewForm": "Lomakemalli",
|
"NewForm": "PDF-lomake",
|
||||||
"Other": "Muu",
|
"Other": "Muu",
|
||||||
"OwnerChange": "Vaihda omistaja",
|
"OwnerChange": "Vaihda omistaja",
|
||||||
"Presentations": "Esitykset",
|
"Presentations": "Esitykset",
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
"MobileWin": "Télécharger les applications de bureau ONLYOFFICE pour Windows",
|
"MobileWin": "Télécharger les applications de bureau ONLYOFFICE pour Windows",
|
||||||
"MoveHere": "Déplacer ici",
|
"MoveHere": "Déplacer ici",
|
||||||
"MoveToOperation": "Déplacement",
|
"MoveToOperation": "Déplacement",
|
||||||
"NewForm": "Modèle de formulaire",
|
"NewForm": "Formulaire PDF",
|
||||||
"Other": "Autre",
|
"Other": "Autre",
|
||||||
"OwnerChange": "Changer le propriétaire",
|
"OwnerChange": "Changer le propriétaire",
|
||||||
"Presentations": "Présentations",
|
"Presentations": "Présentations",
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
"MobileWin": "Ներբեռնել ONLYOFFICE Desktop Editors Windows-ի համար",
|
"MobileWin": "Ներբեռնել ONLYOFFICE Desktop Editors Windows-ի համար",
|
||||||
"MoveHere": "Տեղափոխել այստեղ",
|
"MoveHere": "Տեղափոխել այստեղ",
|
||||||
"MoveToOperation": "Տեղափոխություն",
|
"MoveToOperation": "Տեղափոխություն",
|
||||||
"NewForm": "Ձևանմուշ",
|
"NewForm": "PDF Ձև",
|
||||||
"Other": "Այլ",
|
"Other": "Այլ",
|
||||||
"OwnerChange": "Փոխել տնօրինողին",
|
"OwnerChange": "Փոխել տնօրինողին",
|
||||||
"Presentations": "Ներկայացումներ",
|
"Presentations": "Ներկայացումներ",
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
"MobileWin": "Scarica ONLYOFFICE Desktop Editors per Windows",
|
"MobileWin": "Scarica ONLYOFFICE Desktop Editors per Windows",
|
||||||
"MoveHere": "Sposta qui",
|
"MoveHere": "Sposta qui",
|
||||||
"MoveToOperation": "Sta spostando",
|
"MoveToOperation": "Sta spostando",
|
||||||
"NewForm": "Modello di modulo",
|
"NewForm": "Modulo PDF",
|
||||||
"Other": "Altro",
|
"Other": "Altro",
|
||||||
"OwnerChange": "Cambiare proprietario",
|
"OwnerChange": "Cambiare proprietario",
|
||||||
"Presentations": "Presentazioni",
|
"Presentations": "Presentazioni",
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
"MobileWin": "Windows用のONLYOFFICEデスクトップエディタをダウンロードする",
|
"MobileWin": "Windows用のONLYOFFICEデスクトップエディタをダウンロードする",
|
||||||
"MoveHere": "ここに移動",
|
"MoveHere": "ここに移動",
|
||||||
"MoveToOperation": "移動中",
|
"MoveToOperation": "移動中",
|
||||||
"NewForm": "フォーム テンプレート",
|
"NewForm": "PDFフォーム",
|
||||||
"Other": "その他",
|
"Other": "その他",
|
||||||
"OwnerChange": "オーナー変更",
|
"OwnerChange": "オーナー変更",
|
||||||
"Presentations": "プレゼンテーション",
|
"Presentations": "プレゼンテーション",
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
"MobileWin": "Windows용 ONLYOFFICE Desktop Editors를 다운로드 받으세요",
|
"MobileWin": "Windows용 ONLYOFFICE Desktop Editors를 다운로드 받으세요",
|
||||||
"MoveHere": "여기로 이동",
|
"MoveHere": "여기로 이동",
|
||||||
"MoveToOperation": "이동 중",
|
"MoveToOperation": "이동 중",
|
||||||
"NewForm": "양식 템플릿",
|
"NewForm": "PDF 양식",
|
||||||
"Other": "기타",
|
"Other": "기타",
|
||||||
"OwnerChange": "소유자 변경",
|
"OwnerChange": "소유자 변경",
|
||||||
"Presentations": "프레젠테이션",
|
"Presentations": "프레젠테이션",
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
"MobileWin": "ດາວໂຫລດ ONLYOFFICE Desktop Editors ສໍາລັບ Windows",
|
"MobileWin": "ດາວໂຫລດ ONLYOFFICE Desktop Editors ສໍາລັບ Windows",
|
||||||
"MoveHere": "ຍ້າຍ ນີ້",
|
"MoveHere": "ຍ້າຍ ນີ້",
|
||||||
"MoveToOperation": "ກຳລັງເຄື່ອນຍ້າຍ",
|
"MoveToOperation": "ກຳລັງເຄື່ອນຍ້າຍ",
|
||||||
"NewForm": "ແບບຟອມ",
|
"NewForm": "ແບບຟອມ PDF",
|
||||||
"Other": "ອື່ນໆ",
|
"Other": "ອື່ນໆ",
|
||||||
"OwnerChange": "ປ່ຽນເຈົ້າຂອງ",
|
"OwnerChange": "ປ່ຽນເຈົ້າຂອງ",
|
||||||
"Presentations": "ບົດສະເຫນີ",
|
"Presentations": "ບົດສະເຫນີ",
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
"MobileWin": "Lejupielādēt ONLYOFFICE darbvirsmas redaktorus operētājsistēmai Windows",
|
"MobileWin": "Lejupielādēt ONLYOFFICE darbvirsmas redaktorus operētājsistēmai Windows",
|
||||||
"MoveHere": "Pārvietoties šeit",
|
"MoveHere": "Pārvietoties šeit",
|
||||||
"MoveToOperation": "Pārvieto",
|
"MoveToOperation": "Pārvieto",
|
||||||
"NewForm": "Veidlapas veidne",
|
"NewForm": "PDF veidlapa",
|
||||||
"Other": "Cits",
|
"Other": "Cits",
|
||||||
"OwnerChange": "Mainīt īpašnieku",
|
"OwnerChange": "Mainīt īpašnieku",
|
||||||
"Presentations": "Prezentācijas",
|
"Presentations": "Prezentācijas",
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
"MobileWin": "Download ONLYOFFICE Desktop Editors voor Windows",
|
"MobileWin": "Download ONLYOFFICE Desktop Editors voor Windows",
|
||||||
"MoveHere": "Hierheen verplaatsen",
|
"MoveHere": "Hierheen verplaatsen",
|
||||||
"MoveToOperation": "Verplaatsen",
|
"MoveToOperation": "Verplaatsen",
|
||||||
"NewForm": "Formulier sjabloon",
|
"NewForm": "PDF-formulier",
|
||||||
"Other": "Overige",
|
"Other": "Overige",
|
||||||
"OwnerChange": "Wijzig eigenaar",
|
"OwnerChange": "Wijzig eigenaar",
|
||||||
"Presentations": "Presentaties",
|
"Presentations": "Presentaties",
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
"MobileWin": "Pobierz ONLYOFFICE Desktop Editors dla Windows",
|
"MobileWin": "Pobierz ONLYOFFICE Desktop Editors dla Windows",
|
||||||
"MoveHere": "Przenieś tutaj",
|
"MoveHere": "Przenieś tutaj",
|
||||||
"MoveToOperation": "Przenoszenie",
|
"MoveToOperation": "Przenoszenie",
|
||||||
"NewForm": "Szablon formularza",
|
"NewForm": "Formularz PDF",
|
||||||
"Other": "Inny",
|
"Other": "Inny",
|
||||||
"OwnerChange": "Zmień właściciela",
|
"OwnerChange": "Zmień właściciela",
|
||||||
"Presentations": "Prezentacje",
|
"Presentations": "Prezentacje",
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
"MobileWin": "Baixar ONLYOFFICE Desktop Editors para Windows",
|
"MobileWin": "Baixar ONLYOFFICE Desktop Editors para Windows",
|
||||||
"MoveHere": "Mover aqui",
|
"MoveHere": "Mover aqui",
|
||||||
"MoveToOperation": "Movendo",
|
"MoveToOperation": "Movendo",
|
||||||
"NewForm": "Modelo de formulário",
|
"NewForm": "Formulário PDF",
|
||||||
"Other": "Outro",
|
"Other": "Outro",
|
||||||
"OwnerChange": "Alterar proprietário",
|
"OwnerChange": "Alterar proprietário",
|
||||||
"Presentations": "Apresentações ",
|
"Presentations": "Apresentações ",
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
"MobileWin": "Faça o download do ONLYOFFICE Desktop Editors para Windows",
|
"MobileWin": "Faça o download do ONLYOFFICE Desktop Editors para Windows",
|
||||||
"MoveHere": "Mover para aqui",
|
"MoveHere": "Mover para aqui",
|
||||||
"MoveToOperation": "A mover",
|
"MoveToOperation": "A mover",
|
||||||
"NewForm": "Modelo de Formulário",
|
"NewForm": "Formulário PDF",
|
||||||
"Other": "Outros",
|
"Other": "Outros",
|
||||||
"OwnerChange": "Alterar dono",
|
"OwnerChange": "Alterar dono",
|
||||||
"Presentations": "Apresentações ",
|
"Presentations": "Apresentações ",
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
"MobileWin": "Descarcă ONLYOFFICE Desktop Editors pentru Windows",
|
"MobileWin": "Descarcă ONLYOFFICE Desktop Editors pentru Windows",
|
||||||
"MoveHere": "Mutare în acest loc",
|
"MoveHere": "Mutare în acest loc",
|
||||||
"MoveToOperation": "Mutare",
|
"MoveToOperation": "Mutare",
|
||||||
"NewForm": "Șablon formă,",
|
"NewForm": "Formular PDF",
|
||||||
"Other": "Altă",
|
"Other": "Altă",
|
||||||
"OwnerChange": "Schimbare proprietar",
|
"OwnerChange": "Schimbare proprietar",
|
||||||
"Presentations": "Prezentări",
|
"Presentations": "Prezentări",
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
"MobileWin": "Скачать десктопные редакторы ONLYOFFICE для Windows",
|
"MobileWin": "Скачать десктопные редакторы ONLYOFFICE для Windows",
|
||||||
"MoveHere": "Переместить сюда",
|
"MoveHere": "Переместить сюда",
|
||||||
"MoveToOperation": "Перемещение",
|
"MoveToOperation": "Перемещение",
|
||||||
"NewForm": "Шаблон формы",
|
"NewForm": "PDF-форма",
|
||||||
"Other": "Другой",
|
"Other": "Другой",
|
||||||
"OwnerChange": "Сменить владельца",
|
"OwnerChange": "Сменить владельца",
|
||||||
"Presentations": "Презентации",
|
"Presentations": "Презентации",
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
"MobileWin": "Stiahnite si ONLYOFFICE Desktop Editors pre Windows",
|
"MobileWin": "Stiahnite si ONLYOFFICE Desktop Editors pre Windows",
|
||||||
"MoveHere": "Posunúť sem",
|
"MoveHere": "Posunúť sem",
|
||||||
"MoveToOperation": "Presúva sa",
|
"MoveToOperation": "Presúva sa",
|
||||||
"NewForm": "Šablóna formulára",
|
"NewForm": "Formulár PDF",
|
||||||
"Other": "Iný",
|
"Other": "Iný",
|
||||||
"OwnerChange": "Zmeniť vlastníka",
|
"OwnerChange": "Zmeniť vlastníka",
|
||||||
"Presentations": "Prezentácie",
|
"Presentations": "Prezentácie",
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
"MobileWin": "Prenesi ONLYOFFICE namizne urejevalnike za Windows",
|
"MobileWin": "Prenesi ONLYOFFICE namizne urejevalnike za Windows",
|
||||||
"MoveHere": "Premakni sem",
|
"MoveHere": "Premakni sem",
|
||||||
"MoveToOperation": "Premikanje",
|
"MoveToOperation": "Premikanje",
|
||||||
"NewForm": "Predloga obrazca",
|
"NewForm": "PDF obrazec",
|
||||||
"Other": "Drugo",
|
"Other": "Drugo",
|
||||||
"OwnerChange": "Spremeni lastnika",
|
"OwnerChange": "Spremeni lastnika",
|
||||||
"Presentations": "Predstavitve",
|
"Presentations": "Predstavitve",
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
"MobileWin": "Windows için ONLYOFFICE Masaüstü Düzenleyicilerini İndirin",
|
"MobileWin": "Windows için ONLYOFFICE Masaüstü Düzenleyicilerini İndirin",
|
||||||
"MoveHere": "Buraya taşı",
|
"MoveHere": "Buraya taşı",
|
||||||
"MoveToOperation": "Taşınıyor",
|
"MoveToOperation": "Taşınıyor",
|
||||||
"NewForm": "Form şablonu",
|
"NewForm": "PDF formu",
|
||||||
"Other": "Diğer",
|
"Other": "Diğer",
|
||||||
"OwnerChange": "Sahibi değiştir",
|
"OwnerChange": "Sahibi değiştir",
|
||||||
"Presentations": "Sunumlar",
|
"Presentations": "Sunumlar",
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
"MobileWin": "Завантажити настільні редактори ONLYOFFICE для Windows",
|
"MobileWin": "Завантажити настільні редактори ONLYOFFICE для Windows",
|
||||||
"MoveHere": "Перемістити сюди",
|
"MoveHere": "Перемістити сюди",
|
||||||
"MoveToOperation": "Переміщення",
|
"MoveToOperation": "Переміщення",
|
||||||
"NewForm": "Шаблон форми",
|
"NewForm": "Форма PDF",
|
||||||
"Other": "Інше",
|
"Other": "Інше",
|
||||||
"OwnerChange": "Змінити власника",
|
"OwnerChange": "Змінити власника",
|
||||||
"Presentations": "Презентації",
|
"Presentations": "Презентації",
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
"MobileWin": "Tải xuống Trình chỉnh sửa ONLYOFFICE cho máy tính Windows",
|
"MobileWin": "Tải xuống Trình chỉnh sửa ONLYOFFICE cho máy tính Windows",
|
||||||
"MoveHere": "Chuyển vào đây",
|
"MoveHere": "Chuyển vào đây",
|
||||||
"MoveToOperation": "Đang di chuyển",
|
"MoveToOperation": "Đang di chuyển",
|
||||||
"NewForm": "Mẫu biểu mẫu",
|
"NewForm": "Mẫu PDF",
|
||||||
"Other": "Khác",
|
"Other": "Khác",
|
||||||
"OwnerChange": "Thay đổi chủ sở hữu",
|
"OwnerChange": "Thay đổi chủ sở hữu",
|
||||||
"Presentations": "Bản trình bày",
|
"Presentations": "Bản trình bày",
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
"MobileWin": "下载适用于Windows的ONLYOFFICE桌面编辑器",
|
"MobileWin": "下载适用于Windows的ONLYOFFICE桌面编辑器",
|
||||||
"MoveHere": "移到这里",
|
"MoveHere": "移到这里",
|
||||||
"MoveToOperation": "移动中",
|
"MoveToOperation": "移动中",
|
||||||
"NewForm": "表单模板",
|
"NewForm": "PDF表格",
|
||||||
"Other": "其他",
|
"Other": "其他",
|
||||||
"OwnerChange": "变更所有者",
|
"OwnerChange": "变更所有者",
|
||||||
"Presentations": "演示文稿",
|
"Presentations": "演示文稿",
|
||||||
|
@ -76,7 +76,7 @@ const FilesSelector = ({
|
|||||||
|
|
||||||
onSelectFolder,
|
onSelectFolder,
|
||||||
onSetBaseFolderPath,
|
onSetBaseFolderPath,
|
||||||
//onSetNewFolderPath,
|
// onSetNewFolderPath,
|
||||||
setIsDataReady,
|
setIsDataReady,
|
||||||
onSelectTreeNode,
|
onSelectTreeNode,
|
||||||
onSave,
|
onSave,
|
||||||
@ -162,8 +162,8 @@ const FilesSelector = ({
|
|||||||
} = useLoadersHelper({ items });
|
} = useLoadersHelper({ items });
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setIsDataReady && setIsDataReady(!showLoader);
|
setIsDataReady?.(!showLoader);
|
||||||
}, [showLoader]);
|
}, [showLoader, setIsDataReady]);
|
||||||
|
|
||||||
const { isRoot, setIsRoot, getRootData } = useRootHelper({
|
const { isRoot, setIsRoot, getRootData } = useRootHelper({
|
||||||
setIsBreadCrumbsLoading,
|
setIsBreadCrumbsLoading,
|
||||||
@ -312,7 +312,7 @@ const FilesSelector = ({
|
|||||||
setItems(null);
|
setItems(null);
|
||||||
|
|
||||||
const idx = breadCrumbs.findIndex(
|
const idx = breadCrumbs.findIndex(
|
||||||
(value) => value.id.toString() === item.id.toString()
|
(value) => value.id.toString() === item.id.toString(),
|
||||||
);
|
);
|
||||||
|
|
||||||
const maxLength = breadCrumbs.length - 1;
|
const maxLength = breadCrumbs.length - 1;
|
||||||
@ -321,7 +321,7 @@ const FilesSelector = ({
|
|||||||
const newBreadCrumbs = breadCrumbs.map((item, index) => {
|
const newBreadCrumbs = breadCrumbs.map((item, index) => {
|
||||||
if (!foundParentId) {
|
if (!foundParentId) {
|
||||||
currentFolderIndex = disabledItems.findIndex(
|
currentFolderIndex = disabledItems.findIndex(
|
||||||
(id) => id === item?.id
|
(id) => id === item?.id,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -405,7 +405,7 @@ const FilesSelector = ({
|
|||||||
items: any,
|
items: any,
|
||||||
accessRights: any,
|
accessRights: any,
|
||||||
fileName: string,
|
fileName: string,
|
||||||
isChecked: boolean
|
isChecked: boolean,
|
||||||
) => {
|
) => {
|
||||||
const isPublic =
|
const isPublic =
|
||||||
breadCrumbs.findIndex((f: any) => f.roomType === RoomsType.PublicRoom) >
|
breadCrumbs.findIndex((f: any) => f.roomType === RoomsType.PublicRoom) >
|
||||||
@ -502,7 +502,7 @@ const FilesSelector = ({
|
|||||||
isMove,
|
isMove,
|
||||||
isSelect,
|
isSelect,
|
||||||
filterParam,
|
filterParam,
|
||||||
isRestore
|
isRestore,
|
||||||
);
|
);
|
||||||
|
|
||||||
const acceptButtonLabel = getAcceptButtonLabel(
|
const acceptButtonLabel = getAcceptButtonLabel(
|
||||||
@ -513,7 +513,7 @@ const FilesSelector = ({
|
|||||||
isMove,
|
isMove,
|
||||||
isSelect,
|
isSelect,
|
||||||
filterParam,
|
filterParam,
|
||||||
isRestore
|
isRestore,
|
||||||
);
|
);
|
||||||
|
|
||||||
const isDisabled = getIsDisabled(
|
const isDisabled = getIsDisabled(
|
||||||
@ -530,7 +530,7 @@ const FilesSelector = ({
|
|||||||
filterParam,
|
filterParam,
|
||||||
!!selectedFileInfo,
|
!!selectedFileInfo,
|
||||||
includeFolder,
|
includeFolder,
|
||||||
isRestore
|
isRestore,
|
||||||
);
|
);
|
||||||
|
|
||||||
const SelectorBody = (
|
const SelectorBody = (
|
||||||
@ -644,7 +644,7 @@ export default inject(
|
|||||||
filesStore,
|
filesStore,
|
||||||
infoPanelStore,
|
infoPanelStore,
|
||||||
}: any,
|
}: any,
|
||||||
{ isCopy, isRestoreAll, isMove, isRestore, isPanelVisible, id }: any
|
{ isCopy, isRestoreAll, isMove, isRestore, isPanelVisible, id }: any,
|
||||||
) => {
|
) => {
|
||||||
const { id: selectedId, parentId, rootFolderType } = selectedFolderStore;
|
const { id: selectedId, parentId, rootFolderType } = selectedFolderStore;
|
||||||
|
|
||||||
@ -770,5 +770,5 @@ export default inject(
|
|||||||
|
|
||||||
roomsFolderId,
|
roomsFolderId,
|
||||||
};
|
};
|
||||||
}
|
},
|
||||||
)(observer(FilesSelector));
|
)(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 { isCommunity } = authStore;
|
||||||
const { helpUrl, salesEmail } = payments;
|
const { helpUrl, salesEmail } = paymentStore;
|
||||||
const { theme } = settingsStore;
|
const { theme } = settingsStore;
|
||||||
return { helpUrl, salesEmail, theme, isCommunity };
|
return { helpUrl, salesEmail, theme, isCommunity };
|
||||||
})(observer(ContactContainer));
|
})(observer(ContactContainer));
|
||||||
|
@ -43,7 +43,9 @@ const AvatarEditorDialog = (props) => {
|
|||||||
const { visible, onClose, profile, updateCreatedAvatar, setHasAvatar } =
|
const { visible, onClose, profile, updateCreatedAvatar, setHasAvatar } =
|
||||||
props;
|
props;
|
||||||
const [avatar, setAvatar] = useState({
|
const [avatar, setAvatar] = useState({
|
||||||
uploadedFile: profile.hasAvatar ? profile.avatarMax : DefaultUserAvatarMax,
|
uploadedFile: profile.hasAvatar
|
||||||
|
? profile.avatarOriginal
|
||||||
|
: DefaultUserAvatarMax,
|
||||||
x: 0.5,
|
x: 0.5,
|
||||||
y: 0.5,
|
y: 0.5,
|
||||||
zoom: 1,
|
zoom: 1,
|
||||||
@ -63,7 +65,6 @@ const AvatarEditorDialog = (props) => {
|
|||||||
onClose();
|
onClose();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const file = await dataUrlToFile(preview);
|
const file = await dataUrlToFile(preview);
|
||||||
|
|
||||||
const avatarData = new FormData();
|
const avatarData = new FormData();
|
||||||
|
@ -106,8 +106,8 @@ ChangePricingPlanDialog.propTypes = {
|
|||||||
onClose: PropTypes.func.isRequired,
|
onClose: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default inject(({ payments, currentQuotaStore }) => {
|
export default inject(({ paymentStore, currentQuotaStore }) => {
|
||||||
const { managersCount, allowedStorageSizeByQuota } = payments;
|
const { managersCount, allowedStorageSizeByQuota } = paymentStore;
|
||||||
|
|
||||||
const { addedManagersCount, usedTotalStorageSizeCount } = currentQuotaStore;
|
const { addedManagersCount, usedTotalStorageSizeCount } = currentQuotaStore;
|
||||||
return {
|
return {
|
||||||
|
@ -7,7 +7,7 @@ import { Portal } from "@docspace/shared/components/portal";
|
|||||||
import { Base } from "@docspace/shared/themes";
|
import { Base } from "@docspace/shared/themes";
|
||||||
|
|
||||||
import WrappedComponent from "SRC_DIR/helpers/plugins/WrappedComponent";
|
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";
|
import { messageActions } from "SRC_DIR/helpers/plugins/utils";
|
||||||
|
|
||||||
const StyledFullScreen = styled.div`
|
const StyledFullScreen = styled.div`
|
||||||
@ -83,7 +83,7 @@ const PluginDialog = ({
|
|||||||
updateMainButtonItems,
|
updateMainButtonItems,
|
||||||
updateProfileMenuItems,
|
updateProfileMenuItems,
|
||||||
updateEventListenerItems,
|
updateEventListenerItems,
|
||||||
updateFileItems
|
updateFileItems,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ const PluginDialog = ({
|
|||||||
updateMainButtonItems,
|
updateMainButtonItems,
|
||||||
updateProfileMenuItems,
|
updateProfileMenuItems,
|
||||||
updateEventListenerItems,
|
updateEventListenerItems,
|
||||||
updateFileItems
|
updateFileItems,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -198,8 +198,8 @@ SalesDepartmentRequestDialog.propTypes = {
|
|||||||
onClose: PropTypes.func.isRequired,
|
onClose: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default inject(({ payments }) => {
|
export default inject(({ paymentStore }) => {
|
||||||
const { sendPaymentRequest } = payments;
|
const { sendPaymentRequest } = paymentStore;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
sendPaymentRequest,
|
sendPaymentRequest,
|
||||||
|
@ -5,7 +5,7 @@ import { useTranslation } from "react-i18next";
|
|||||||
import { Button } from "@docspace/shared/components/button";
|
import { Button } from "@docspace/shared/components/button";
|
||||||
import { ModalDialog } from "@docspace/shared/components/modal-dialog";
|
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 WrappedComponent from "SRC_DIR/helpers/plugins/WrappedComponent";
|
||||||
|
|
||||||
import Header from "./sub-components/Header";
|
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 { Link } from "@docspace/shared/components/link";
|
||||||
import { getCorrectDate, getCookie } from "@docspace/shared/utils";
|
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";
|
import { Base } from "@docspace/shared/themes";
|
||||||
|
|
||||||
const StyledContainer = styled.div`
|
const StyledContainer = styled.div`
|
||||||
@ -121,7 +121,7 @@ const Info = ({ t, plugin, withDelete, withSeparator }) => {
|
|||||||
lineHeight={"20px"}
|
lineHeight={"20px"}
|
||||||
noSelect
|
noSelect
|
||||||
>
|
>
|
||||||
{plugin.createBy}
|
{plugin.createBy.displayName}
|
||||||
</Text>
|
</Text>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
@ -53,7 +53,7 @@ const AddUsersPanel = ({
|
|||||||
const onBackClick = () => onClose();
|
const onBackClick = () => onClose();
|
||||||
const getFilterWithOutDisabledUser = useCallback(
|
const getFilterWithOutDisabledUser = useCallback(
|
||||||
() => Filter.getFilterWithOutDisabledUser(),
|
() => Filter.getFilterWithOutDisabledUser(),
|
||||||
[]
|
[],
|
||||||
);
|
);
|
||||||
|
|
||||||
const onKeyPress = (e) => {
|
const onKeyPress = (e) => {
|
||||||
@ -88,6 +88,8 @@ const AddUsersPanel = ({
|
|||||||
avatar: item.avatar,
|
avatar: item.avatar,
|
||||||
isOwner: item.isOwner,
|
isOwner: item.isOwner,
|
||||||
isAdmin: item.isAdmin,
|
isAdmin: item.isAdmin,
|
||||||
|
isVisitor: item.isVisitor,
|
||||||
|
isCollaborator: item.isCollaborator,
|
||||||
};
|
};
|
||||||
items.push(newItem);
|
items.push(newItem);
|
||||||
}
|
}
|
||||||
@ -100,7 +102,7 @@ const AddUsersPanel = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const selectedAccess = accessOptions.filter(
|
const selectedAccess = accessOptions.filter(
|
||||||
(access) => access.access === accessRight
|
(access) => access.access === accessRight,
|
||||||
)[0];
|
)[0];
|
||||||
|
|
||||||
const [itemsList, setItemsList] = useState(null);
|
const [itemsList, setItemsList] = useState(null);
|
||||||
@ -110,11 +112,11 @@ const AddUsersPanel = ({
|
|||||||
const [total, setTotal] = useState(0);
|
const [total, setTotal] = useState(0);
|
||||||
const [isLoading, setIsLoading] = useLoadingWithTimeout(
|
const [isLoading, setIsLoading] = useLoadingWithTimeout(
|
||||||
LOADER_TIMEOUT,
|
LOADER_TIMEOUT,
|
||||||
false
|
false,
|
||||||
);
|
);
|
||||||
const [isLoadingSearch, setIsLoadingSearch] = useLoadingWithTimeout(
|
const [isLoadingSearch, setIsLoadingSearch] = useLoadingWithTimeout(
|
||||||
LOADER_TIMEOUT,
|
LOADER_TIMEOUT,
|
||||||
false
|
false,
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -321,7 +323,7 @@ export default inject(({ settingsStore }) => {
|
|||||||
})(
|
})(
|
||||||
observer(
|
observer(
|
||||||
withTranslation(["SharingPanel", "PeopleTranslations", "Common"])(
|
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;
|
text-overflow: ellipsis;
|
||||||
overflow: hidden;
|
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 { TextInput } from "@docspace/shared/components/text-input";
|
||||||
import { DropDownItem } from "@docspace/shared/components/drop-down-item";
|
import { DropDownItem } from "@docspace/shared/components/drop-down-item";
|
||||||
import { toastr } from "@docspace/shared/components/toast";
|
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 { ComboBox } from "@docspace/shared/components/combobox";
|
||||||
|
|
||||||
import Filter from "@docspace/shared/api/people/filter";
|
import Filter from "@docspace/shared/api/people/filter";
|
||||||
@ -34,6 +34,9 @@ import {
|
|||||||
ResetLink,
|
ResetLink,
|
||||||
} from "../StyledInvitePanel";
|
} 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 minSearchValue = 2;
|
||||||
|
|
||||||
const InviteInput = ({
|
const InviteInput = ({
|
||||||
@ -60,10 +63,10 @@ const InviteInput = ({
|
|||||||
const [inputValue, setInputValue] = useState("");
|
const [inputValue, setInputValue] = useState("");
|
||||||
const [usersList, setUsersList] = useState([]);
|
const [usersList, setUsersList] = useState([]);
|
||||||
const [isChangeLangMail, setIsChangeLangMail] = useState(false);
|
const [isChangeLangMail, setIsChangeLangMail] = useState(false);
|
||||||
const [searchPanelVisible, setSearchPanelVisible] = useState(false);
|
|
||||||
const [isAddEmailPanelBlocked, setIsAddEmailPanelBlocked] = useState(true);
|
const [isAddEmailPanelBlocked, setIsAddEmailPanelBlocked] = useState(true);
|
||||||
|
|
||||||
const [selectedAccess, setSelectedAccess] = useState(defaultAccess);
|
const [selectedAccess, setSelectedAccess] = useState(defaultAccess);
|
||||||
|
const [dropDownWidth, setDropDownWidth] = useState(0);
|
||||||
|
|
||||||
const searchRef = useRef();
|
const searchRef = useRef();
|
||||||
|
|
||||||
@ -74,6 +77,13 @@ const InviteInput = ({
|
|||||||
isBeta: isBetaLanguage(language),
|
isBeta: isBetaLanguage(language),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
const width = searchRef?.current?.offsetWidth ?? 0;
|
||||||
|
if (width !== dropDownWidth) setDropDownWidth(width);
|
||||||
|
}, 0);
|
||||||
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
!culture.key &&
|
!culture.key &&
|
||||||
setInviteLanguage({
|
setInviteLanguage({
|
||||||
@ -95,6 +105,7 @@ const InviteInput = ({
|
|||||||
access: selectedAccess,
|
access: selectedAccess,
|
||||||
displayName: address.email,
|
displayName: address.email,
|
||||||
errors: address.parseErrors,
|
errors: address.parseErrors,
|
||||||
|
isEmailInvite: true,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -105,32 +116,34 @@ const InviteInput = ({
|
|||||||
access: selectedAccess,
|
access: selectedAccess,
|
||||||
displayName: addresses[0].email,
|
displayName: addresses[0].email,
|
||||||
errors: addresses[0].parseErrors,
|
errors: addresses[0].parseErrors,
|
||||||
|
isEmailInvite: true,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const searchByQuery = async (value) => {
|
const searchByQuery = async (value) => {
|
||||||
const query = value.trim();
|
const query = value.trim();
|
||||||
|
|
||||||
if (query.length >= minSearchValue) {
|
if (query.length > minSearchValue) {
|
||||||
const filter = Filter.getFilterWithOutDisabledUser();
|
const filter = Filter.getFilterWithOutDisabledUser();
|
||||||
filter.search = query;
|
filter.search = query;
|
||||||
|
|
||||||
const users = await getMembersList(roomId, filter);
|
const users = await getMembersList(roomId, filter);
|
||||||
|
|
||||||
setUsersList(users.items);
|
setUsersList(users.items);
|
||||||
setIsAddEmailPanelBlocked(false);
|
|
||||||
|
if (users.total) setIsAddEmailPanelBlocked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!query) {
|
if (!query) {
|
||||||
closeInviteInputPanel();
|
|
||||||
setInputValue("");
|
setInputValue("");
|
||||||
setUsersList([]);
|
setUsersList([]);
|
||||||
|
setIsAddEmailPanelBlocked(true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const debouncedSearch = useCallback(
|
const debouncedSearch = useCallback(
|
||||||
debounce((value) => searchByQuery(value), 300),
|
debounce((value) => searchByQuery(value), 300),
|
||||||
[]
|
[],
|
||||||
);
|
);
|
||||||
|
|
||||||
const onChange = (e) => {
|
const onChange = (e) => {
|
||||||
@ -145,20 +158,22 @@ const InviteInput = ({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
|
||||||
(!!usersList.length || clearValue.length >= minSearchValue) &&
|
|
||||||
!searchPanelVisible
|
|
||||||
) {
|
|
||||||
openInviteInputPanel();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (roomId !== -1) {
|
if (roomId !== -1) {
|
||||||
debouncedSearch(clearValue);
|
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) => {
|
const removeExist = (items) => {
|
||||||
@ -167,8 +182,7 @@ const InviteInput = ({
|
|||||||
return unique;
|
return unique;
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
if (items.length > filtered.length)
|
if (items.length > filtered.length) toastr.warning(t("UsersAlreadyAdded"));
|
||||||
toastr.warning("Some users have already been added");
|
|
||||||
|
|
||||||
return filtered;
|
return filtered;
|
||||||
};
|
};
|
||||||
@ -179,22 +193,25 @@ const InviteInput = ({
|
|||||||
item.access = selectedAccess;
|
item.access = selectedAccess;
|
||||||
|
|
||||||
const addUser = () => {
|
const addUser = () => {
|
||||||
if (item.isOwner || item.isAdmin)
|
if (shared) {
|
||||||
item.access = ShareAccessRights.RoomManager;
|
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("");
|
setInputValue("");
|
||||||
setUsersList([]);
|
setUsersList([]);
|
||||||
|
setIsAddEmailPanelBlocked(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DropDownItem
|
<DropDownItem
|
||||||
key={id}
|
key={id}
|
||||||
onClick={addUser}
|
onClick={addUser}
|
||||||
disabled={shared}
|
|
||||||
height={48}
|
height={48}
|
||||||
heightTablet={48}
|
heightTablet={48}
|
||||||
className="list-item"
|
className="list-item"
|
||||||
@ -220,8 +237,8 @@ const InviteInput = ({
|
|||||||
const filtered = removeExist(newItems);
|
const filtered = removeExist(newItems);
|
||||||
|
|
||||||
setInviteItems(filtered);
|
setInviteItems(filtered);
|
||||||
closeInviteInputPanel();
|
|
||||||
setInputValue("");
|
setInputValue("");
|
||||||
|
setIsAddEmailPanelBlocked(true);
|
||||||
setUsersList([]);
|
setUsersList([]);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -231,7 +248,6 @@ const InviteInput = ({
|
|||||||
const filtered = removeExist(items);
|
const filtered = removeExist(items);
|
||||||
|
|
||||||
setInviteItems(filtered);
|
setInviteItems(filtered);
|
||||||
closeInviteInputPanel();
|
|
||||||
setInputValue("");
|
setInputValue("");
|
||||||
setUsersList([]);
|
setUsersList([]);
|
||||||
};
|
};
|
||||||
@ -241,33 +257,35 @@ const InviteInput = ({
|
|||||||
const openUsersPanel = () => {
|
const openUsersPanel = () => {
|
||||||
setInputValue("");
|
setInputValue("");
|
||||||
setAddUsersPanelVisible(true);
|
setAddUsersPanelVisible(true);
|
||||||
|
setIsAddEmailPanelBlocked(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
const closeUsersPanel = () => {
|
const closeUsersPanel = () => {
|
||||||
setAddUsersPanelVisible(false);
|
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 foundUsers = usersList.map((user) => getItemContent(user));
|
||||||
|
|
||||||
const addEmailPanel = (
|
const addEmailPanel = (
|
||||||
<DropDownItem
|
<DropDownItem
|
||||||
className="add-item"
|
className="list-item"
|
||||||
style={{ width: "inherit" }}
|
style={{ width: "inherit" }}
|
||||||
textOverflow
|
textOverflow
|
||||||
onClick={addEmail}
|
onClick={addEmail}
|
||||||
height={48}
|
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>
|
</DropDownItem>
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -278,7 +296,7 @@ const InviteInput = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onKeyPress = (e) => {
|
const onKeyPress = (e) => {
|
||||||
if (e.key === "Enter" && !!!usersList.length && inputValue.length > 2) {
|
if (e.key === "Enter") {
|
||||||
addEmail();
|
addEmail();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -401,28 +419,27 @@ const InviteInput = ({
|
|||||||
: t("InviteRoomSearchPlaceholder")
|
: t("InviteRoomSearchPlaceholder")
|
||||||
}
|
}
|
||||||
value={inputValue}
|
value={inputValue}
|
||||||
onFocus={openInviteInputPanel}
|
|
||||||
isAutoFocussed={true}
|
isAutoFocussed={true}
|
||||||
onKeyDown={onKeyDown}
|
onKeyDown={onKeyDown}
|
||||||
/>
|
/>
|
||||||
</StyledInviteInput>
|
</StyledInviteInput>
|
||||||
{inputValue.length >= minSearchValue &&
|
{isAddEmailPanelBlocked ? (
|
||||||
(isAddEmailPanelBlocked ? (
|
<></>
|
||||||
<></>
|
) : (
|
||||||
) : (
|
<StyledDropDown
|
||||||
<StyledDropDown
|
width={dropDownWidth}
|
||||||
width={searchRef?.current?.offsetWidth}
|
isDefaultMode={false}
|
||||||
isDefaultMode={false}
|
open
|
||||||
open={searchPanelVisible}
|
manualX="16px"
|
||||||
manualX="16px"
|
showDisabledItems
|
||||||
showDisabledItems
|
eventTypes="click"
|
||||||
clickOutsideAction={closeInviteInputPanel}
|
withBackdrop={false}
|
||||||
eventTypes="click"
|
zIndex={399}
|
||||||
{...dropDownMaxHeight}
|
{...dropDownMaxHeight}
|
||||||
>
|
>
|
||||||
{!!usersList.length ? foundUsers : addEmailPanel}
|
{!!usersList.length ? foundUsers : addEmailPanel}
|
||||||
</StyledDropDown>
|
</StyledDropDown>
|
||||||
))}
|
)}
|
||||||
|
|
||||||
<AccessSelector
|
<AccessSelector
|
||||||
className="add-manually-access"
|
className="add-manually-access"
|
||||||
|
@ -3,11 +3,10 @@ import AtReactSvgUrl from "PUBLIC_DIR/images/@.react.svg?url";
|
|||||||
import React, { useState, useEffect } from "react";
|
import React, { useState, useEffect } from "react";
|
||||||
import { Avatar } from "@docspace/shared/components/avatar";
|
import { Avatar } from "@docspace/shared/components/avatar";
|
||||||
import { Text } from "@docspace/shared/components/text";
|
import { Text } from "@docspace/shared/components/text";
|
||||||
import { capitalize } from "lodash";
|
|
||||||
|
|
||||||
import { parseAddresses } from "@docspace/shared/utils";
|
import { parseAddresses } from "@docspace/shared/utils";
|
||||||
import { getAccessOptions } from "../utils";
|
import { getAccessOptions } from "../utils";
|
||||||
import { getUserRole } from "@docspace/shared/utils/common";
|
import { getUserRole, getUserTypeLabel } from "@docspace/shared/utils/common";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
StyledEditInput,
|
StyledEditInput,
|
||||||
@ -33,25 +32,37 @@ const Item = ({
|
|||||||
inputsRef,
|
inputsRef,
|
||||||
setIsOpenItemAccess,
|
setIsOpenItemAccess,
|
||||||
isMobileView,
|
isMobileView,
|
||||||
|
standalone,
|
||||||
}) => {
|
}) => {
|
||||||
const { avatar, displayName, email, id, errors, access } = item;
|
const { avatar, displayName, email, id, errors, access } = item;
|
||||||
|
|
||||||
const name = !!avatar ? (displayName !== "" ? displayName : email) : email;
|
const name = !!avatar ? (displayName !== "" ? displayName : email) : email;
|
||||||
const source = !!avatar ? avatar : AtReactSvgUrl;
|
const source = !!avatar ? avatar : AtReactSvgUrl;
|
||||||
const role = getUserRole(item);
|
|
||||||
|
|
||||||
const [edit, setEdit] = useState(false);
|
const [edit, setEdit] = useState(false);
|
||||||
const [inputValue, setInputValue] = useState(name);
|
const [inputValue, setInputValue] = useState(name);
|
||||||
const [parseErrors, setParseErrors] = useState(errors);
|
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 filteredAccesses = filterUserRoleOptions(accesses, item, true);
|
||||||
|
|
||||||
const defaultAccess = filteredAccesses.find(
|
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 errorsInList = () => {
|
||||||
const hasErrors = inviteItems.some((item) => !!item.errors?.length);
|
const hasErrors = inviteItems.some((item) => !!item.errors?.length);
|
||||||
setHasErrors(hasErrors);
|
setHasErrors(hasErrors);
|
||||||
@ -133,7 +144,7 @@ const Item = ({
|
|||||||
color="#A3A9AE"
|
color="#A3A9AE"
|
||||||
truncate
|
truncate
|
||||||
>
|
>
|
||||||
{`${capitalize(role)} | ${email}`}
|
{item.userName ? `${typeLabel} | ${email}` : `${typeLabel}`}
|
||||||
</Text>
|
</Text>
|
||||||
</StyledInviteUserBody>
|
</StyledInviteUserBody>
|
||||||
|
|
||||||
@ -167,6 +178,7 @@ const Item = ({
|
|||||||
setIsOpenItemAccess={setIsOpenItemAccess}
|
setIsOpenItemAccess={setIsOpenItemAccess}
|
||||||
isMobileView={isMobileView}
|
isMobileView={isMobileView}
|
||||||
noBorder
|
noBorder
|
||||||
|
standalone={standalone}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
|
@ -22,6 +22,7 @@ const Row = memo(({ data, index, style }) => {
|
|||||||
inputsRef,
|
inputsRef,
|
||||||
setIsOpenItemAccess,
|
setIsOpenItemAccess,
|
||||||
isMobileView,
|
isMobileView,
|
||||||
|
standalone,
|
||||||
} = data;
|
} = data;
|
||||||
|
|
||||||
if (inviteItems === undefined) return;
|
if (inviteItems === undefined) return;
|
||||||
@ -42,6 +43,7 @@ const Row = memo(({ data, index, style }) => {
|
|||||||
inputsRef={inputsRef}
|
inputsRef={inputsRef}
|
||||||
setIsOpenItemAccess={setIsOpenItemAccess}
|
setIsOpenItemAccess={setIsOpenItemAccess}
|
||||||
isMobileView={isMobileView}
|
isMobileView={isMobileView}
|
||||||
|
standalone={standalone}
|
||||||
/>
|
/>
|
||||||
</StyledRow>
|
</StyledRow>
|
||||||
);
|
);
|
||||||
@ -60,6 +62,7 @@ const ItemsList = ({
|
|||||||
inputsRef,
|
inputsRef,
|
||||||
invitePanelBodyRef,
|
invitePanelBodyRef,
|
||||||
isMobileView,
|
isMobileView,
|
||||||
|
standalone,
|
||||||
}) => {
|
}) => {
|
||||||
const [bodyHeight, setBodyHeight] = useState(0);
|
const [bodyHeight, setBodyHeight] = useState(0);
|
||||||
const [offsetTop, setOffsetTop] = useState(0);
|
const [offsetTop, setOffsetTop] = useState(0);
|
||||||
@ -146,6 +149,7 @@ const ItemsList = ({
|
|||||||
setIsOpenItemAccess,
|
setIsOpenItemAccess,
|
||||||
isMobileView,
|
isMobileView,
|
||||||
t,
|
t,
|
||||||
|
standalone,
|
||||||
}}
|
}}
|
||||||
outerElementType={!scrollAllPanelContent && CustomScrollbarsVirtualList}
|
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 { setInviteItems, inviteItems, changeInviteItem } = dialogsStore;
|
||||||
const { isOwner } = userStore.user;
|
const { isOwner } = userStore.user;
|
||||||
|
const { standalone } = settingsStore;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
setInviteItems,
|
setInviteItems,
|
||||||
inviteItems,
|
inviteItems,
|
||||||
changeInviteItem,
|
changeInviteItem,
|
||||||
isOwner,
|
isOwner,
|
||||||
|
standalone,
|
||||||
};
|
};
|
||||||
})(observer(ItemsList));
|
})(observer(ItemsList));
|
||||||
|
@ -10,7 +10,7 @@ export const getAccessOptions = (
|
|||||||
withRemove = false,
|
withRemove = false,
|
||||||
withSeparator = false,
|
withSeparator = false,
|
||||||
isOwner = false,
|
isOwner = false,
|
||||||
standalone = false
|
standalone = false,
|
||||||
) => {
|
) => {
|
||||||
let options = [];
|
let options = [];
|
||||||
const accesses = {
|
const accesses = {
|
||||||
@ -22,6 +22,7 @@ export const getAccessOptions = (
|
|||||||
color: "#EDC409",
|
color: "#EDC409",
|
||||||
access:
|
access:
|
||||||
roomType === -1 ? EmployeeType.Admin : ShareAccessRights.FullAccess,
|
roomType === -1 ? EmployeeType.Admin : ShareAccessRights.FullAccess,
|
||||||
|
type: "admin",
|
||||||
},
|
},
|
||||||
roomAdmin: {
|
roomAdmin: {
|
||||||
key: "roomAdmin",
|
key: "roomAdmin",
|
||||||
@ -31,6 +32,7 @@ export const getAccessOptions = (
|
|||||||
color: "#EDC409",
|
color: "#EDC409",
|
||||||
access:
|
access:
|
||||||
roomType === -1 ? EmployeeType.User : ShareAccessRights.RoomManager,
|
roomType === -1 ? EmployeeType.User : ShareAccessRights.RoomManager,
|
||||||
|
type: "manager",
|
||||||
},
|
},
|
||||||
collaborator: {
|
collaborator: {
|
||||||
key: "collaborator",
|
key: "collaborator",
|
||||||
@ -42,42 +44,49 @@ export const getAccessOptions = (
|
|||||||
roomType === -1
|
roomType === -1
|
||||||
? EmployeeType.Collaborator
|
? EmployeeType.Collaborator
|
||||||
: ShareAccessRights.Collaborator,
|
: ShareAccessRights.Collaborator,
|
||||||
|
type: "collaborator",
|
||||||
},
|
},
|
||||||
user: {
|
user: {
|
||||||
key: "user",
|
key: "user",
|
||||||
label: t("Common:User"),
|
label: t("Common:User"),
|
||||||
description: t("Translations:RoleUserDescription"),
|
description: t("Translations:RoleUserDescription"),
|
||||||
access: EmployeeType.Guest,
|
access: EmployeeType.Guest,
|
||||||
|
type: "user",
|
||||||
},
|
},
|
||||||
editor: {
|
editor: {
|
||||||
key: "editor",
|
key: "editor",
|
||||||
label: t("Translations:RoleEditor"),
|
label: t("Translations:RoleEditor"),
|
||||||
description: t("Translations:RoleEditorDescription"),
|
description: t("Translations:RoleEditorDescription"),
|
||||||
access: ShareAccessRights.Editing,
|
access: ShareAccessRights.Editing,
|
||||||
|
type: "user",
|
||||||
},
|
},
|
||||||
formFiller: {
|
formFiller: {
|
||||||
key: "formFiller",
|
key: "formFiller",
|
||||||
label: t("Translations:RoleFormFiller"),
|
label: t("Translations:RoleFormFiller"),
|
||||||
description: t("Translations:RoleFormFillerDescription"),
|
description: t("Translations:RoleFormFillerDescription"),
|
||||||
access: ShareAccessRights.FormFilling,
|
access: ShareAccessRights.FormFilling,
|
||||||
|
type: "user",
|
||||||
},
|
},
|
||||||
reviewer: {
|
reviewer: {
|
||||||
key: "reviewer",
|
key: "reviewer",
|
||||||
label: t("Translations:RoleReviewer"),
|
label: t("Translations:RoleReviewer"),
|
||||||
description: t("Translations:RoleReviewerDescription"),
|
description: t("Translations:RoleReviewerDescription"),
|
||||||
access: ShareAccessRights.Review,
|
access: ShareAccessRights.Review,
|
||||||
|
type: "user",
|
||||||
},
|
},
|
||||||
commentator: {
|
commentator: {
|
||||||
key: "commentator",
|
key: "commentator",
|
||||||
label: t("Translations:RoleCommentator"),
|
label: t("Translations:RoleCommentator"),
|
||||||
description: t("Translations:RoleCommentatorDescription"),
|
description: t("Translations:RoleCommentatorDescription"),
|
||||||
access: ShareAccessRights.Comment,
|
access: ShareAccessRights.Comment,
|
||||||
|
type: "user",
|
||||||
},
|
},
|
||||||
viewer: {
|
viewer: {
|
||||||
key: "viewer",
|
key: "viewer",
|
||||||
label: t("Translations:RoleViewer"),
|
label: t("Translations:RoleViewer"),
|
||||||
description: t("Translations:RoleViewerDescription"),
|
description: t("Translations:RoleViewerDescription"),
|
||||||
access: ShareAccessRights.ReadOnly,
|
access: ShareAccessRights.ReadOnly,
|
||||||
|
type: "user",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ const ConfirmRoute = ({
|
|||||||
window.location.href = combineUrl(
|
window.location.href = combineUrl(
|
||||||
window.DocSpaceConfig?.proxy?.url,
|
window.DocSpaceConfig?.proxy?.url,
|
||||||
path,
|
path,
|
||||||
"/error"
|
"/error",
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case ValidationResult.Expired:
|
case ValidationResult.Expired:
|
||||||
@ -104,7 +104,7 @@ const ConfirmRoute = ({
|
|||||||
window.location.href = combineUrl(
|
window.location.href = combineUrl(
|
||||||
window.DocSpaceConfig?.proxy?.url,
|
window.DocSpaceConfig?.proxy?.url,
|
||||||
path,
|
path,
|
||||||
"/error"
|
"/error",
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case ValidationResult.TariffLimit:
|
case ValidationResult.TariffLimit:
|
||||||
@ -115,7 +115,7 @@ const ConfirmRoute = ({
|
|||||||
window.location.href = combineUrl(
|
window.location.href = combineUrl(
|
||||||
window.DocSpaceConfig?.proxy?.url,
|
window.DocSpaceConfig?.proxy?.url,
|
||||||
path,
|
path,
|
||||||
"/error?messageKey=20"
|
"/error?messageKey=20",
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -126,7 +126,7 @@ const ConfirmRoute = ({
|
|||||||
window.location.href = combineUrl(
|
window.location.href = combineUrl(
|
||||||
window.DocSpaceConfig?.proxy?.url,
|
window.DocSpaceConfig?.proxy?.url,
|
||||||
path,
|
path,
|
||||||
"/error"
|
"/error",
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -145,7 +145,7 @@ const ConfirmRoute = ({
|
|||||||
window.location.href = combineUrl(
|
window.location.href = combineUrl(
|
||||||
window.DocSpaceConfig?.proxy?.url,
|
window.DocSpaceConfig?.proxy?.url,
|
||||||
path,
|
path,
|
||||||
"/error"
|
"/error",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}, [getData, doAuthenticated, isAuthenticated, storeIsLoaded, logout]);
|
}, [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 { ToggleButton } from "@docspace/shared/components/toggle-button";
|
||||||
import { ComboBox } from "@docspace/shared/components/combobox";
|
import { ComboBox } from "@docspace/shared/components/combobox";
|
||||||
|
|
||||||
import { PluginComponents } from "./constants";
|
import { PluginComponents } from "./enums";
|
||||||
|
|
||||||
import { messageActions } from "./utils";
|
import { messageActions } from "./utils";
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ const ComponentPure = ({
|
|||||||
component={item}
|
component={item}
|
||||||
pluginName={pluginName}
|
pluginName={pluginName}
|
||||||
/>
|
/>
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
return <Box {...elementProps}>{childrenComponents}</Box>;
|
return <Box {...elementProps}>{childrenComponents}</Box>;
|
||||||
@ -110,7 +110,7 @@ const ComponentPure = ({
|
|||||||
updateMainButtonItems,
|
updateMainButtonItems,
|
||||||
updateProfileMenuItems,
|
updateProfileMenuItems,
|
||||||
updateEventListenerItems,
|
updateEventListenerItems,
|
||||||
updateFileItems
|
updateFileItems,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ const ComponentPure = ({
|
|||||||
updateMainButtonItems,
|
updateMainButtonItems,
|
||||||
updateProfileMenuItems,
|
updateProfileMenuItems,
|
||||||
updateEventListenerItems,
|
updateEventListenerItems,
|
||||||
updateFileItems
|
updateFileItems,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -168,11 +168,11 @@ const ComponentPure = ({
|
|||||||
updateMainButtonItems,
|
updateMainButtonItems,
|
||||||
updateProfileMenuItems,
|
updateProfileMenuItems,
|
||||||
updateEventListenerItems,
|
updateEventListenerItems,
|
||||||
updateFileItems
|
updateFileItems,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
return <TextArea {...elementProps} onChange={onChangeAction} />;
|
return <Textarea {...elementProps} onChange={onChangeAction} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
case PluginComponents.input: {
|
case PluginComponents.input: {
|
||||||
@ -197,7 +197,7 @@ const ComponentPure = ({
|
|||||||
updateMainButtonItems,
|
updateMainButtonItems,
|
||||||
updateProfileMenuItems,
|
updateProfileMenuItems,
|
||||||
updateEventListenerItems,
|
updateEventListenerItems,
|
||||||
updateFileItems
|
updateFileItems,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -247,7 +247,7 @@ const ComponentPure = ({
|
|||||||
updateEventListenerItems,
|
updateEventListenerItems,
|
||||||
updateFileItems,
|
updateFileItems,
|
||||||
|
|
||||||
updatePlugin
|
updatePlugin,
|
||||||
);
|
);
|
||||||
|
|
||||||
setIsRequestRunning && setIsRequestRunning(false);
|
setIsRequestRunning && setIsRequestRunning(false);
|
||||||
@ -306,7 +306,7 @@ const ComponentPure = ({
|
|||||||
updateMainButtonItems,
|
updateMainButtonItems,
|
||||||
updateProfileMenuItems,
|
updateProfileMenuItems,
|
||||||
updateEventListenerItems,
|
updateEventListenerItems,
|
||||||
updateFileItems
|
updateFileItems,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ import PluginHeader from "./PluginHeader";
|
|||||||
import PluginInfo from "./PluginInfo";
|
import PluginInfo from "./PluginInfo";
|
||||||
import PluginSettings from "./PluginSettings";
|
import PluginSettings from "./PluginSettings";
|
||||||
|
|
||||||
import { PluginScopes } from "../constants";
|
import { PluginScopes } from "../enums";
|
||||||
|
|
||||||
const StyledPlugin = styled.div`
|
const StyledPlugin = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -79,7 +79,7 @@ const Plugin = ({
|
|||||||
author={author}
|
author={author}
|
||||||
status={status}
|
status={status}
|
||||||
description={description}
|
description={description}
|
||||||
createBy={createBy}
|
createBy={createBy.displayName}
|
||||||
createOn={createOn}
|
createOn={createOn}
|
||||||
homePage={homePage}
|
homePage={homePage}
|
||||||
url={url}
|
url={url}
|
||||||
|
@ -4,7 +4,7 @@ import styled from "styled-components";
|
|||||||
import { Text } from "@docspace/shared/components/text";
|
import { Text } from "@docspace/shared/components/text";
|
||||||
import { getCorrectDate } from "@docspace/shared/utils";
|
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 { Link } from "@docspace/shared/components/link";
|
||||||
|
|
||||||
import { getPluginUrl } from "../utils";
|
import { getPluginUrl } from "../utils";
|
||||||
|
@ -3,7 +3,7 @@ import styled from "styled-components";
|
|||||||
|
|
||||||
import WrappedComponent from "../WrappedComponent";
|
import WrappedComponent from "../WrappedComponent";
|
||||||
|
|
||||||
import { PluginComponents } from "../constants";
|
import { PluginComponents } from "../enums";
|
||||||
|
|
||||||
const StyledPluginSettings = styled.div`
|
const StyledPluginSettings = styled.div`
|
||||||
.settings-header {
|
.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 config from "PACKAGE_FILE";
|
||||||
|
|
||||||
import { PluginActions, PluginToastType } from "./constants";
|
import { PluginActions, PluginToastType } from "./enums";
|
||||||
import { Events } from "@docspace/shared/enums";
|
import { Events } from "@docspace/shared/enums";
|
||||||
|
|
||||||
export const messageActions = (
|
export const messageActions = (
|
||||||
@ -26,7 +26,7 @@ export const messageActions = (
|
|||||||
updateEventListenerItems,
|
updateEventListenerItems,
|
||||||
updateFileItems,
|
updateFileItems,
|
||||||
|
|
||||||
updatePlugin
|
updatePlugin,
|
||||||
) => {
|
) => {
|
||||||
if (!message || !message.actions || message.actions.length === 0) return;
|
if (!message || !message.actions || message.actions.length === 0) return;
|
||||||
|
|
||||||
@ -152,7 +152,7 @@ export const messageActions = (
|
|||||||
if (frame) {
|
if (frame) {
|
||||||
frame.contentWindow.postMessage(
|
frame.contentWindow.postMessage(
|
||||||
JSON.stringify(postMessage.message),
|
JSON.stringify(postMessage.message),
|
||||||
"*"
|
"*",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,6 +177,6 @@ export const getPluginUrl = (url, file) => {
|
|||||||
window.DocSpaceConfig?.proxy?.url,
|
window.DocSpaceConfig?.proxy?.url,
|
||||||
config.homepage,
|
config.homepage,
|
||||||
path,
|
path,
|
||||||
file
|
file,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -7,7 +7,7 @@ import { FolderType, ShareAccessRights } from "@docspace/shared/enums";
|
|||||||
import { translations } from "./autoGeneratedTranslations";
|
import { translations } from "./autoGeneratedTranslations";
|
||||||
// import router from "SRC_DIR/router";
|
// import router from "SRC_DIR/router";
|
||||||
|
|
||||||
export const setDocumentTitle = (subTitle = null) => {
|
export const setDocumentTitle = (subTitle = "") => {
|
||||||
const { isAuthenticated, product: currentModule } = authStore;
|
const { isAuthenticated, product: currentModule } = authStore;
|
||||||
const { organizationName } = settingsStore;
|
const { organizationName } = settingsStore;
|
||||||
|
|
||||||
|
@ -32,8 +32,8 @@ const Bonus = ({ standaloneInit, isInitPaymentPage }) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default inject(({ payments }) => {
|
export default inject(({ paymentStore }) => {
|
||||||
const { standaloneInit, isInitPaymentPage } = payments;
|
const { standaloneInit, isInitPaymentPage } = paymentStore;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
standaloneInit,
|
standaloneInit,
|
||||||
|
@ -35,28 +35,26 @@ export default function withLoader(WrappedComponent) {
|
|||||||
type === "EmpInvite") &&
|
type === "EmpInvite") &&
|
||||||
!passwordSettings
|
!passwordSettings
|
||||||
) {
|
) {
|
||||||
axios
|
getPortalPasswordSettings(confirmHeader).catch((error) => {
|
||||||
.all([getSettings(), getPortalPasswordSettings(confirmHeader)])
|
let errorMessage = "";
|
||||||
.catch((error) => {
|
if (typeof error === "object") {
|
||||||
let errorMessage = "";
|
errorMessage =
|
||||||
if (typeof error === "object") {
|
error?.response?.data?.error?.message ||
|
||||||
errorMessage =
|
error?.statusText ||
|
||||||
error?.response?.data?.error?.message ||
|
error?.message ||
|
||||||
error?.statusText ||
|
"";
|
||||||
error?.message ||
|
} else {
|
||||||
"";
|
errorMessage = error;
|
||||||
} else {
|
}
|
||||||
errorMessage = error;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.error(errorMessage);
|
console.error(errorMessage);
|
||||||
navigate(
|
navigate(
|
||||||
combineUrl(
|
combineUrl(
|
||||||
window.DocSpaceConfig?.proxy?.url,
|
window.DocSpaceConfig?.proxy?.url,
|
||||||
`/login/error?message=${errorMessage}`
|
`/login/error?message=${errorMessage}`,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [passwordSettings]);
|
}, [passwordSettings]);
|
||||||
|
|
||||||
@ -77,8 +75,8 @@ export default function withLoader(WrappedComponent) {
|
|||||||
navigate(
|
navigate(
|
||||||
combineUrl(
|
combineUrl(
|
||||||
window.DocSpaceConfig?.proxy?.url,
|
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 { getUserStatus } from "SRC_DIR/helpers/people-helpers";
|
||||||
import { StyledAccountContent } from "../../styles/accounts";
|
import { StyledAccountContent } from "../../styles/accounts";
|
||||||
|
import { getUserTypeLabel } from "@docspace/shared/utils/common";
|
||||||
|
|
||||||
const Accounts = (props) => {
|
const Accounts = (props) => {
|
||||||
const {
|
const {
|
||||||
@ -46,21 +47,6 @@ const Accounts = (props) => {
|
|||||||
}
|
}
|
||||||
}, [infoPanelSelection]);
|
}, [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 getTypesOptions = React.useCallback(() => {
|
||||||
const options = [];
|
const options = [];
|
||||||
|
|
||||||
@ -128,10 +114,10 @@ const Accounts = (props) => {
|
|||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[infoPanelSelection, changeUserType, t]
|
[infoPanelSelection, changeUserType, t],
|
||||||
);
|
);
|
||||||
|
|
||||||
const typeLabel = getUserTypeLabel(role);
|
const typeLabel = React.useCallback(() => getUserTypeLabel(role, t), [])();
|
||||||
|
|
||||||
const renderTypeData = () => {
|
const renderTypeData = () => {
|
||||||
const typesOptions = getTypesOptions();
|
const typesOptions = getTypesOptions();
|
||||||
@ -248,7 +234,7 @@ export default inject(
|
|||||||
getPeopleListItem: usersStore.getPeopleListItem,
|
getPeopleListItem: usersStore.getPeopleListItem,
|
||||||
setInfoPanelSelection,
|
setInfoPanelSelection,
|
||||||
};
|
};
|
||||||
}
|
},
|
||||||
)(
|
)(
|
||||||
withTranslation([
|
withTranslation([
|
||||||
"People",
|
"People",
|
||||||
@ -263,7 +249,7 @@ export default inject(
|
|||||||
"Translations",
|
"Translations",
|
||||||
])(
|
])(
|
||||||
withLoader(observer(Accounts))(
|
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 { isMobileOnly, isMobile } from "react-device-detect";
|
||||||
import { decode } from "he";
|
import { decode } from "he";
|
||||||
import { filterUserRoleOptions } from "SRC_DIR/helpers";
|
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 { Text } from "@docspace/shared/components/text";
|
||||||
import EmailPlusReactSvgUrl from "PUBLIC_DIR/images/e-mail+.react.svg?url";
|
import EmailPlusReactSvgUrl from "PUBLIC_DIR/images/e-mail+.react.svg?url";
|
||||||
import { StyledUserTypeHeader } from "../../styles/members";
|
import { StyledUserTypeHeader } from "../../styles/members";
|
||||||
@ -48,7 +47,7 @@ const User = ({
|
|||||||
|
|
||||||
const fullRoomRoleOptions = membersHelper.getOptionsByRoomType(
|
const fullRoomRoleOptions = membersHelper.getOptionsByRoomType(
|
||||||
infoPanelSelection.roomType,
|
infoPanelSelection.roomType,
|
||||||
canChangeUserRole
|
canChangeUserRole,
|
||||||
);
|
);
|
||||||
|
|
||||||
const userRole = membersHelper.getOptionByUserAccess(user.access, user);
|
const userRole = membersHelper.getOptionByUserAccess(user.access, user);
|
||||||
@ -57,7 +56,7 @@ const User = ({
|
|||||||
const onRepeatInvitation = async () => {
|
const onRepeatInvitation = async () => {
|
||||||
resendEmailInvitations(infoPanelSelection.id, true)
|
resendEmailInvitations(infoPanelSelection.id, true)
|
||||||
.then(() =>
|
.then(() =>
|
||||||
toastr.success(t("PeopleTranslations:SuccessSentMultipleInvitatios"))
|
toastr.success(t("PeopleTranslations:SuccessSentMultipleInvitatios")),
|
||||||
)
|
)
|
||||||
.catch((err) => toastr.error(err));
|
.catch((err) => toastr.error(err));
|
||||||
};
|
};
|
||||||
@ -77,10 +76,10 @@ const User = ({
|
|||||||
const newMembers = {
|
const newMembers = {
|
||||||
users: infoPanelMembers.users?.filter((m) => m.id !== user.id),
|
users: infoPanelMembers.users?.filter((m) => m.id !== user.id),
|
||||||
administrators: infoPanelMembers.administrators?.filter(
|
administrators: infoPanelMembers.administrators?.filter(
|
||||||
(m) => m.id !== user.id
|
(m) => m.id !== user.id,
|
||||||
),
|
),
|
||||||
expected: infoPanelMembers.expected?.filter(
|
expected: infoPanelMembers.expected?.filter(
|
||||||
(m) => m.id !== user.id
|
(m) => m.id !== user.id,
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -129,13 +128,13 @@ const User = ({
|
|||||||
setInfoPanelMembers({
|
setInfoPanelMembers({
|
||||||
roomId: infoPanelSelection.id,
|
roomId: infoPanelSelection.id,
|
||||||
users: infoPanelMembers.users?.map((m) =>
|
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) =>
|
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) =>
|
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) => {
|
const onToggle = (e, isOpen) => {
|
||||||
// setIsScrollLocked(isOpen);
|
// setIsScrollLocked(isOpen);
|
||||||
};
|
};
|
||||||
|
const role = getUserRole(user);
|
||||||
|
const typeLabel = getUserTypeLabel(role, t);
|
||||||
|
|
||||||
const getTooltipContent = () => (
|
const getTooltipContent = () => (
|
||||||
<div>
|
<div>
|
||||||
@ -197,15 +198,13 @@ const User = ({
|
|||||||
color="#A3A9AE !important"
|
color="#A3A9AE !important"
|
||||||
dir="auto"
|
dir="auto"
|
||||||
>
|
>
|
||||||
{`${capitalize(role)} | ${user.email}`}
|
{`${typeLabel} | ${user.email}`}
|
||||||
</Text>
|
</Text>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
const userAvatar = user.hasAvatar ? user.avatar : DefaultUserPhotoUrl;
|
const userAvatar = user.hasAvatar ? user.avatar : DefaultUserPhotoUrl;
|
||||||
|
|
||||||
const role = getUserRole(user);
|
|
||||||
|
|
||||||
const withTooltip = user.isOwner || user.isAdmin;
|
const withTooltip = user.isOwner || user.isAdmin;
|
||||||
|
|
||||||
const uniqueTooltipId = `userTooltip_${Math.random()}`;
|
const uniqueTooltipId = `userTooltip_${Math.random()}`;
|
||||||
@ -269,7 +268,7 @@ const User = ({
|
|||||||
color="#A3A9AE"
|
color="#A3A9AE"
|
||||||
dir="auto"
|
dir="auto"
|
||||||
>
|
>
|
||||||
{`${capitalize(role)} | ${user.email}`}
|
{`${typeLabel} | ${user.email}`}
|
||||||
</Text>
|
</Text>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -2,7 +2,7 @@ import React from "react";
|
|||||||
import { inject, observer } from "mobx-react";
|
import { inject, observer } from "mobx-react";
|
||||||
|
|
||||||
import WrappedComponent from "SRC_DIR/helpers/plugins/WrappedComponent";
|
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 }) => {
|
const Plugin = ({ boxProps, pluginName }) => {
|
||||||
return (
|
return (
|
||||||
|
@ -15,7 +15,7 @@ import {
|
|||||||
|
|
||||||
import { StyledInfoPanelHeader } from "./styles/common";
|
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 InfoPanelHeaderContent = (props) => {
|
||||||
const {
|
const {
|
||||||
@ -245,12 +245,12 @@ export default inject(
|
|||||||
|
|
||||||
enablePlugins,
|
enablePlugins,
|
||||||
};
|
};
|
||||||
}
|
},
|
||||||
)(
|
)(
|
||||||
withTranslation(["Common", "InfoPanel"])(
|
withTranslation(["Common", "InfoPanel"])(
|
||||||
InfoPanelHeaderContent
|
InfoPanelHeaderContent,
|
||||||
// withLoader(observer(InfoPanelHeaderContent))(
|
// withLoader(observer(InfoPanelHeaderContent))(
|
||||||
// <Loaders.InfoPanelHeaderLoader />
|
// <Loaders.InfoPanelHeaderLoader />
|
||||||
// )
|
// )
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
|
@ -4,7 +4,7 @@ import { withTranslation } from "react-i18next";
|
|||||||
import { useNavigate, useLocation } from "react-router-dom";
|
import { useNavigate, useLocation } from "react-router-dom";
|
||||||
import queryString from "query-string";
|
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 { MEDIA_VIEW_URL } from "@docspace/shared/constants";
|
||||||
import { combineUrl } from "@docspace/shared/utils/combineUrl";
|
import { combineUrl } from "@docspace/shared/utils/combineUrl";
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ const FilesMediaViewer = (props) => {
|
|||||||
setCurrentId(id);
|
setCurrentId(id);
|
||||||
navigate(url);
|
navigate(url);
|
||||||
},
|
},
|
||||||
[setCurrentId, navigate]
|
[setCurrentId, navigate],
|
||||||
);
|
);
|
||||||
|
|
||||||
const resetSelection = () => {
|
const resetSelection = () => {
|
||||||
@ -159,7 +159,7 @@ const FilesMediaViewer = (props) => {
|
|||||||
// try to fix with one check later (see deleteAction)
|
// try to fix with one check later (see deleteAction)
|
||||||
const isActiveFile = activeFiles.find((elem) => elem.id === file.id);
|
const isActiveFile = activeFiles.find((elem) => elem.id === file.id);
|
||||||
const isActiveFolder = activeFolders.find(
|
const isActiveFolder = activeFolders.find(
|
||||||
(elem) => elem.id === file.id
|
(elem) => elem.id === file.id,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (isActiveFile || isActiveFolder) return;
|
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(
|
const onDownloadMediaFile = useCallback(
|
||||||
@ -179,7 +186,7 @@ const FilesMediaViewer = (props) => {
|
|||||||
return window.open(viewUrlFile, "_self");
|
return window.open(viewUrlFile, "_self");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[playlist]
|
[playlist],
|
||||||
);
|
);
|
||||||
|
|
||||||
const onMediaViewerClose = useCallback(
|
const onMediaViewerClose = useCallback(
|
||||||
@ -227,7 +234,7 @@ const FilesMediaViewer = (props) => {
|
|||||||
setToPreviewFile,
|
setToPreviewFile,
|
||||||
setMediaViewerData,
|
setMediaViewerData,
|
||||||
setBufferSelection,
|
setBufferSelection,
|
||||||
]
|
],
|
||||||
);
|
);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (playlist.length === 0 && isOpenMediaViewer) onMediaViewerClose();
|
if (playlist.length === 0 && isOpenMediaViewer) onMediaViewerClose();
|
||||||
@ -422,5 +429,5 @@ export default inject(
|
|||||||
pluginContextMenuItems,
|
pluginContextMenuItems,
|
||||||
currentDeviceType,
|
currentDeviceType,
|
||||||
};
|
};
|
||||||
}
|
},
|
||||||
)(withTranslation(["Files", "Translations"])(observer(FilesMediaViewer)));
|
)(withTranslation(["Files", "Translations"])(observer(FilesMediaViewer)));
|
||||||
|
@ -14,6 +14,7 @@ import withContent from "SRC_DIR/HOCs/withPeopleContent";
|
|||||||
|
|
||||||
import Badges from "../Badges";
|
import Badges from "../Badges";
|
||||||
import { Base } from "@docspace/shared/themes";
|
import { Base } from "@docspace/shared/themes";
|
||||||
|
import { getUserTypeLabel } from "@docspace/shared/utils/common";
|
||||||
|
|
||||||
const StyledWrapper = styled.div`
|
const StyledWrapper = styled.div`
|
||||||
display: contents;
|
display: contents;
|
||||||
@ -308,7 +309,7 @@ const PeopleTableRow = (props) => {
|
|||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[item, changeUserType]
|
[item, changeUserType],
|
||||||
);
|
);
|
||||||
|
|
||||||
// const getRoomsOptions = React.useCallback(() => {
|
// const getRoomsOptions = React.useCallback(() => {
|
||||||
@ -328,22 +329,7 @@ const PeopleTableRow = (props) => {
|
|||||||
// return <>{options.map((option) => option)}</>;
|
// return <>{options.map((option) => option)}</>;
|
||||||
// }, []);
|
// }, []);
|
||||||
|
|
||||||
const getUserTypeLabel = React.useCallback((role) => {
|
const typeLabel = React.useCallback(() => getUserTypeLabel(role, t), [])();
|
||||||
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 isChecked = checkedProps.checked;
|
const isChecked = checkedProps.checked;
|
||||||
|
|
||||||
@ -532,5 +518,5 @@ const PeopleTableRow = (props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default withTranslation(["People", "Common", "Settings"])(
|
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 } =
|
const { setIsLoadedAdditionalResources, isLoadedAdditionalResources } =
|
||||||
common;
|
common;
|
||||||
|
|
||||||
@ -292,7 +292,7 @@ export default inject(({ filesSettingsStore, common, currentQuotaStore }) => {
|
|||||||
|
|
||||||
additionalResourcesData,
|
additionalResourcesData,
|
||||||
additionalResourcesIsDefault,
|
additionalResourcesIsDefault,
|
||||||
} = filesSettingsStore;
|
} = settingsStore;
|
||||||
|
|
||||||
const { isBrandingAndCustomizationAvailable } = currentQuotaStore;
|
const { isBrandingAndCustomizationAvailable } = currentQuotaStore;
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ const WhiteLabel = (props) => {
|
|||||||
|
|
||||||
const onRestoreDefault = async () => {
|
const onRestoreDefault = async () => {
|
||||||
try {
|
try {
|
||||||
await restoreWhiteLabelSettings(true);
|
await restoreWhiteLabelSettings();
|
||||||
await onResetCompanyName();
|
await onResetCompanyName();
|
||||||
toastr.success(t("Settings:SuccessfullySaveSettingsMessage"));
|
toastr.success(t("Settings:SuccessfullySaveSettingsMessage"));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -23,6 +23,7 @@ const SubmenuCommon = (props) => {
|
|||||||
isLoadedSubmenu,
|
isLoadedSubmenu,
|
||||||
getWhiteLabelLogoUrls,
|
getWhiteLabelLogoUrls,
|
||||||
currentDeviceType,
|
currentDeviceType,
|
||||||
|
isMobileView,
|
||||||
} = props;
|
} = props;
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
@ -41,7 +42,10 @@ const SubmenuCommon = (props) => {
|
|||||||
}, [tReady, isLoadedSubmenu]);
|
}, [tReady, isLoadedSubmenu]);
|
||||||
|
|
||||||
const load = async () => {
|
const load = async () => {
|
||||||
await loadBaseInfo();
|
const currentTab = getCurrentTab();
|
||||||
|
await loadBaseInfo(
|
||||||
|
!isMobileView ? (currentTab === 0 ? "general" : "branding") : ""
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const data = [
|
const data = [
|
||||||
@ -111,13 +115,14 @@ export default inject(({ settingsStore, common }) => {
|
|||||||
|
|
||||||
const isMobileView = currentDeviceType === DeviceType.mobile;
|
const isMobileView = currentDeviceType === DeviceType.mobile;
|
||||||
return {
|
return {
|
||||||
loadBaseInfo: async () => {
|
loadBaseInfo: async (page) => {
|
||||||
await initSettings(!isMobileView ? "general" : "");
|
await initSettings(page);
|
||||||
},
|
},
|
||||||
isLoaded,
|
isLoaded,
|
||||||
setIsLoadedSubmenu,
|
setIsLoadedSubmenu,
|
||||||
isLoadedSubmenu,
|
isLoadedSubmenu,
|
||||||
getWhiteLabelLogoUrls,
|
getWhiteLabelLogoUrls,
|
||||||
currentDeviceType,
|
currentDeviceType,
|
||||||
|
isMobileView,
|
||||||
};
|
};
|
||||||
})(withLoading(withTranslation("Settings")(observer(SubmenuCommon))));
|
})(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 PluginDefaultLogoUrl from "PUBLIC_DIR/images/plugin.default-logo.png";
|
||||||
|
|
||||||
import { getPluginUrl } from "SRC_DIR/helpers/plugins/utils";
|
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";
|
import { StyledPluginItem, StyledPluginHeader } from "../StyledPlugins";
|
||||||
|
|
||||||
|
@ -22,8 +22,8 @@ const SsoComboBox = (props) => {
|
|||||||
const currentOption =
|
const currentOption =
|
||||||
options.find((option) => option.key === value) || options[0];
|
options.find((option) => option.key === value) || options[0];
|
||||||
|
|
||||||
const onSelect = () => {
|
const onSelect = (option) => {
|
||||||
setComboBox(currentOption, name);
|
setComboBox(option, name);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -41,8 +41,8 @@ const ContactContainer = ({ t, salesEmail }) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default inject(({ payments, settingsStore }) => {
|
export default inject(({ paymentStore, settingsStore }) => {
|
||||||
const { salesEmail } = payments;
|
const { salesEmail } = paymentStore;
|
||||||
return {
|
return {
|
||||||
salesEmail,
|
salesEmail,
|
||||||
theme: settingsStore.theme,
|
theme: settingsStore.theme,
|
||||||
|
@ -233,8 +233,8 @@ const PayerInformationContainer = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default inject(
|
export default inject(
|
||||||
({ settingsStore, payments, userStore, currentTariffStatusStore }) => {
|
({ settingsStore, paymentStore, userStore, currentTariffStatusStore }) => {
|
||||||
const { accountLink, isStripePortalAvailable } = payments;
|
const { accountLink, isStripePortalAvailable } = paymentStore;
|
||||||
const { theme } = settingsStore;
|
const { theme } = settingsStore;
|
||||||
const { customerId, isGracePeriod, isNotPaidPeriod, payerInfo } =
|
const { customerId, isGracePeriod, isNotPaidPeriod, payerInfo } =
|
||||||
currentTariffStatusStore;
|
currentTariffStatusStore;
|
||||||
@ -250,5 +250,5 @@ export default inject(
|
|||||||
isGracePeriod,
|
isGracePeriod,
|
||||||
isNotPaidPeriod,
|
isNotPaidPeriod,
|
||||||
};
|
};
|
||||||
}
|
},
|
||||||
)(observer(PayerInformationContainer));
|
)(observer(PayerInformationContainer));
|
||||||
|
@ -339,7 +339,7 @@ export default inject(
|
|||||||
({
|
({
|
||||||
settingsStore,
|
settingsStore,
|
||||||
currentQuotaStore,
|
currentQuotaStore,
|
||||||
payments,
|
paymentStore,
|
||||||
paymentQuotasStore,
|
paymentQuotasStore,
|
||||||
currentTariffStatusStore,
|
currentTariffStatusStore,
|
||||||
}) => {
|
}) => {
|
||||||
@ -363,7 +363,7 @@ export default inject(
|
|||||||
const { planCost, tariffPlanTitle, portalPaymentQuotas } =
|
const { planCost, tariffPlanTitle, portalPaymentQuotas } =
|
||||||
paymentQuotasStore;
|
paymentQuotasStore;
|
||||||
|
|
||||||
const { isAlreadyPaid } = payments;
|
const { isAlreadyPaid } = paymentStore;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
paymentDate,
|
paymentDate,
|
||||||
@ -390,5 +390,5 @@ export default inject(
|
|||||||
isNonProfit,
|
isNonProfit,
|
||||||
isPaymentDateValid,
|
isPaymentDateValid,
|
||||||
};
|
};
|
||||||
}
|
},
|
||||||
)(observer(PaymentContainer));
|
)(observer(PaymentContainer));
|
||||||
|
@ -179,7 +179,7 @@ const PriceCalculation = ({
|
|||||||
export default inject(
|
export default inject(
|
||||||
({
|
({
|
||||||
settingsStore,
|
settingsStore,
|
||||||
payments,
|
paymentStore,
|
||||||
paymentQuotasStore,
|
paymentQuotasStore,
|
||||||
currentTariffStatusStore,
|
currentTariffStatusStore,
|
||||||
}) => {
|
}) => {
|
||||||
@ -193,7 +193,7 @@ export default inject(
|
|||||||
isAlreadyPaid,
|
isAlreadyPaid,
|
||||||
getPaymentLink,
|
getPaymentLink,
|
||||||
canUpdateTariff,
|
canUpdateTariff,
|
||||||
} = payments;
|
} = paymentStore;
|
||||||
const { theme } = settingsStore;
|
const { theme } = settingsStore;
|
||||||
|
|
||||||
const { planCost } = paymentQuotasStore;
|
const { planCost } = paymentQuotasStore;
|
||||||
@ -217,5 +217,5 @@ export default inject(
|
|||||||
currencySymbol: planCost.currencySymbol,
|
currencySymbol: planCost.currencySymbol,
|
||||||
getPaymentLink,
|
getPaymentLink,
|
||||||
};
|
};
|
||||||
}
|
},
|
||||||
)(observer(PriceCalculation));
|
)(observer(PriceCalculation));
|
||||||
|
@ -42,7 +42,7 @@ const SaaSPage = ({
|
|||||||
setEncryptionKeys,
|
setEncryptionKeys,
|
||||||
false,
|
false,
|
||||||
null,
|
null,
|
||||||
t
|
t,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return () => resetTariffContainerToBasic();
|
return () => resetTariffContainerToBasic();
|
||||||
@ -72,7 +72,7 @@ export default inject(
|
|||||||
({
|
({
|
||||||
authStore,
|
authStore,
|
||||||
settingsStore,
|
settingsStore,
|
||||||
payments,
|
paymentStore,
|
||||||
userStore,
|
userStore,
|
||||||
currentQuotaStore,
|
currentQuotaStore,
|
||||||
currentTariffStatusStore,
|
currentTariffStatusStore,
|
||||||
@ -90,7 +90,7 @@ export default inject(
|
|||||||
init,
|
init,
|
||||||
isUpdatingBasicSettings,
|
isUpdatingBasicSettings,
|
||||||
resetTariffContainerToBasic,
|
resetTariffContainerToBasic,
|
||||||
} = payments;
|
} = paymentStore;
|
||||||
const {
|
const {
|
||||||
isEncryptionSupport,
|
isEncryptionSupport,
|
||||||
setEncryptionKeys,
|
setEncryptionKeys,
|
||||||
@ -116,5 +116,5 @@ export default inject(
|
|||||||
isLoadedCurrentQuota,
|
isLoadedCurrentQuota,
|
||||||
isUpdatingBasicSettings,
|
isUpdatingBasicSettings,
|
||||||
};
|
};
|
||||||
}
|
},
|
||||||
)(observer(SaaSPage));
|
)(observer(SaaSPage));
|
||||||
|
@ -49,8 +49,8 @@ const ButtonContainer = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default inject(({ currentTariffStatusStore, payments }) => {
|
export default inject(({ currentTariffStatusStore, paymentStore }) => {
|
||||||
const { isNeedRequest, isLoading, accountLink } = payments;
|
const { isNeedRequest, isLoading, accountLink } = paymentStore;
|
||||||
const { isNotPaidPeriod, isGracePeriod } = currentTariffStatusStore;
|
const { isNotPaidPeriod, isGracePeriod } = currentTariffStatusStore;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -59,7 +59,7 @@ const DowngradePlanButtonContainer = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default inject(({ payments }) => {
|
export default inject(({ paymentStore }) => {
|
||||||
const {
|
const {
|
||||||
isLoading,
|
isLoading,
|
||||||
isLessCountThanAcceptable,
|
isLessCountThanAcceptable,
|
||||||
@ -67,7 +67,7 @@ export default inject(({ payments }) => {
|
|||||||
canPayTariff,
|
canPayTariff,
|
||||||
|
|
||||||
isAlreadyPaid,
|
isAlreadyPaid,
|
||||||
} = payments;
|
} = paymentStore;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
isLoading,
|
isLoading,
|
||||||
|
@ -44,8 +44,8 @@ const RequestButtonContainer = ({ isDisabled, isLoading }) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default inject(({ payments }) => {
|
export default inject(({ paymentStore }) => {
|
||||||
const { isLoading } = payments;
|
const { isLoading } = paymentStore;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
isLoading,
|
isLoading,
|
||||||
|
@ -43,10 +43,10 @@ const SelectTotalSizeContainer = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default inject(({ settingsStore, paymentQuotasStore, payments }) => {
|
export default inject(({ settingsStore, paymentQuotasStore, paymentStore }) => {
|
||||||
const { usedTotalStorageSizeTitle } = paymentQuotasStore;
|
const { usedTotalStorageSizeTitle } = paymentQuotasStore;
|
||||||
const { theme } = settingsStore;
|
const { theme } = settingsStore;
|
||||||
const { allowedStorageSizeByQuota } = payments;
|
const { allowedStorageSizeByQuota } = paymentStore;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
theme,
|
theme,
|
||||||
|
@ -313,7 +313,7 @@ const SelectUsersCountContainer = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default inject(({ paymentQuotasStore, payments }) => {
|
export default inject(({ paymentQuotasStore, paymentStore }) => {
|
||||||
const {
|
const {
|
||||||
isLoading,
|
isLoading,
|
||||||
minAvailableManagersValue,
|
minAvailableManagersValue,
|
||||||
@ -324,7 +324,7 @@ export default inject(({ paymentQuotasStore, payments }) => {
|
|||||||
isLessCountThanAcceptable,
|
isLessCountThanAcceptable,
|
||||||
stepByQuotaForManager,
|
stepByQuotaForManager,
|
||||||
isAlreadyPaid,
|
isAlreadyPaid,
|
||||||
} = payments;
|
} = paymentStore;
|
||||||
const { addedManagersCountTitle } = paymentQuotasStore;
|
const { addedManagersCountTitle } = paymentQuotasStore;
|
||||||
|
|
||||||
const step = stepByQuotaForManager;
|
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 { theme } = settingsStore;
|
||||||
const { isLoading, totalPrice, isNeedRequest, maxAvailableManagersCount } =
|
const { isLoading, totalPrice, isNeedRequest, maxAvailableManagersCount } =
|
||||||
payments;
|
paymentStore;
|
||||||
|
|
||||||
const { planCost } = paymentQuotasStore;
|
const { planCost } = paymentQuotasStore;
|
||||||
return {
|
return {
|
||||||
|
@ -63,7 +63,7 @@ const UpdatePlanButtonContainer = ({
|
|||||||
const resetIntervalSuccess = () => {
|
const resetIntervalSuccess = () => {
|
||||||
intervalId &&
|
intervalId &&
|
||||||
toastr.success(
|
toastr.success(
|
||||||
t("BusinessUpdated", { planName: currentTariffPlanTitle })
|
t("BusinessUpdated", { planName: currentTariffPlanTitle }),
|
||||||
);
|
);
|
||||||
clearInterval(intervalId);
|
clearInterval(intervalId);
|
||||||
intervalId = null;
|
intervalId = null;
|
||||||
@ -187,7 +187,7 @@ const UpdatePlanButtonContainer = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default inject(
|
export default inject(
|
||||||
({ currentQuotaStore, payments, currentTariffStatusStore }) => {
|
({ currentQuotaStore, paymentStore, currentTariffStatusStore }) => {
|
||||||
const {
|
const {
|
||||||
maxCountManagersByQuota,
|
maxCountManagersByQuota,
|
||||||
setPortalQuotaValue,
|
setPortalQuotaValue,
|
||||||
@ -206,7 +206,7 @@ export default inject(
|
|||||||
accountLink,
|
accountLink,
|
||||||
isAlreadyPaid,
|
isAlreadyPaid,
|
||||||
canPayTariff,
|
canPayTariff,
|
||||||
} = payments;
|
} = paymentStore;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
canPayTariff,
|
canPayTariff,
|
||||||
@ -224,5 +224,5 @@ export default inject(
|
|||||||
setPortalQuotaValue,
|
setPortalQuotaValue,
|
||||||
currentTariffPlanTitle,
|
currentTariffPlanTitle,
|
||||||
};
|
};
|
||||||
}
|
},
|
||||||
)(observer(UpdatePlanButtonContainer));
|
)(observer(UpdatePlanButtonContainer));
|
||||||
|
@ -51,8 +51,8 @@ const EnterpriseContainer = (props) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default inject(({ payments, currentTariffStatusStore }) => {
|
export default inject(({ paymentStore, currentTariffStatusStore }) => {
|
||||||
const { buyUrl, salesEmail } = payments;
|
const { buyUrl, salesEmail } = paymentStore;
|
||||||
|
|
||||||
const { isLicenseDateExpired } = currentTariffStatusStore;
|
const { isLicenseDateExpired } = currentTariffStatusStore;
|
||||||
return { buyUrl, salesEmail, isLicenseDateExpired };
|
return { buyUrl, salesEmail, isLicenseDateExpired };
|
||||||
|
@ -89,14 +89,14 @@ const LicenseContainer = (props) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default inject(({ payments }) => {
|
export default inject(({ paymentStore }) => {
|
||||||
const {
|
const {
|
||||||
setPaymentsLicense,
|
setPaymentsLicense,
|
||||||
acceptPaymentsLicense,
|
acceptPaymentsLicense,
|
||||||
isLicenseCorrect,
|
isLicenseCorrect,
|
||||||
setIsLoading,
|
setIsLoading,
|
||||||
isLoading,
|
isLoading,
|
||||||
} = payments;
|
} = paymentStore;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
setPaymentsLicense,
|
setPaymentsLicense,
|
||||||
|
@ -51,9 +51,10 @@ const StandalonePage = (props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default inject(
|
export default inject(
|
||||||
({ currentQuotaStore, payments, currentTariffStatusStore }) => {
|
({ currentQuotaStore, paymentStore, currentTariffStatusStore }) => {
|
||||||
|
|
||||||
const { standaloneInit, isInitPaymentPage, isUpdatingBasicSettings } =
|
const { standaloneInit, isInitPaymentPage, isUpdatingBasicSettings } =
|
||||||
payments;
|
paymentStore;
|
||||||
const { isLoaded: isLoadedCurrentQuota, isTrial } = currentQuotaStore;
|
const { isLoaded: isLoadedCurrentQuota, isTrial } = currentQuotaStore;
|
||||||
const { isLoaded: isLoadedTariffStatus } = currentTariffStatusStore;
|
const { isLoaded: isLoadedTariffStatus } = currentTariffStatusStore;
|
||||||
|
|
||||||
@ -65,5 +66,5 @@ export default inject(
|
|||||||
isLoadedCurrentQuota,
|
isLoadedCurrentQuota,
|
||||||
isUpdatingBasicSettings,
|
isUpdatingBasicSettings,
|
||||||
};
|
};
|
||||||
}
|
},
|
||||||
)(observer(StandalonePage));
|
)(observer(StandalonePage));
|
||||||
|
@ -21,8 +21,8 @@ const ButtonContainer = ({ t, buyUrl }) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default inject(({ payments }) => {
|
export default inject(({ paymentStore }) => {
|
||||||
const { buyUrl } = payments;
|
const { buyUrl } = paymentStore;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
buyUrl,
|
buyUrl,
|
||||||
|
@ -145,6 +145,13 @@ const PreparationPortal = (props) => {
|
|||||||
returnToPortal();
|
returnToPortal();
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
const status = err?.response?.status;
|
||||||
|
const needCreationTableTime = status === 404;
|
||||||
|
|
||||||
|
if (needCreationTableTime) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
clearAllIntervals();
|
clearAllIntervals();
|
||||||
setErrorMessage(error);
|
setErrorMessage(error);
|
||||||
}
|
}
|
||||||
@ -249,7 +256,7 @@ const PreparationPortalWrapper = inject(({ backup }) => {
|
|||||||
multiplicationFactor,
|
multiplicationFactor,
|
||||||
};
|
};
|
||||||
})(
|
})(
|
||||||
withTranslation(["PreparationPortal", "Common"])(observer(PreparationPortal))
|
withTranslation(["PreparationPortal", "Common"])(observer(PreparationPortal)),
|
||||||
);
|
);
|
||||||
|
|
||||||
PreparationPortal.propTypes = {
|
PreparationPortal.propTypes = {
|
||||||
|
@ -3,7 +3,7 @@ import axios from "axios";
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { inject, observer } from "mobx-react";
|
import { inject, observer } from "mobx-react";
|
||||||
|
import api from "@docspace/shared/api";
|
||||||
import { Text } from "@docspace/shared/components/text";
|
import { Text } from "@docspace/shared/components/text";
|
||||||
import { FormWrapper } from "@docspace/shared/components/form-wrapper";
|
import { FormWrapper } from "@docspace/shared/components/form-wrapper";
|
||||||
import { EmailInput } from "@docspace/shared/components/email-input";
|
import { EmailInput } from "@docspace/shared/components/email-input";
|
||||||
@ -70,7 +70,7 @@ const Wizard = (props) => {
|
|||||||
cultureNames,
|
cultureNames,
|
||||||
culture,
|
culture,
|
||||||
hashSettings,
|
hashSettings,
|
||||||
setPortalOwner,
|
|
||||||
setWizardComplete,
|
setWizardComplete,
|
||||||
isLicenseRequired,
|
isLicenseRequired,
|
||||||
setLicense,
|
setLicense,
|
||||||
@ -133,7 +133,7 @@ const Wizard = (props) => {
|
|||||||
])
|
])
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const select = cultureNames.filter(
|
const select = cultureNames.filter(
|
||||||
(lang) => lang.key === convertedCulture
|
(lang) => lang.key === convertedCulture,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (select.length === 0) {
|
if (select.length === 0) {
|
||||||
@ -255,13 +255,13 @@ const Wizard = (props) => {
|
|||||||
const hash = createPasswordHash(password, hashSettings);
|
const hash = createPasswordHash(password, hashSettings);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await setPortalOwner(
|
await api.settings.setPortalOwner(
|
||||||
emailTrim,
|
emailTrim,
|
||||||
hash,
|
hash,
|
||||||
selectedLanguage.key,
|
selectedLanguage.key,
|
||||||
selectedTimezone.key,
|
selectedTimezone.key,
|
||||||
wizardToken,
|
wizardToken,
|
||||||
analytics
|
analytics,
|
||||||
);
|
);
|
||||||
|
|
||||||
setCookie(LANGUAGE, selectedLanguage.key, {
|
setCookie(LANGUAGE, selectedLanguage.key, {
|
||||||
@ -500,7 +500,7 @@ const Wizard = (props) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default inject(({ authStore, settingsStore, wizard }) => {
|
export default inject(({ authStore, settingsStore, wizardStore }) => {
|
||||||
const {
|
const {
|
||||||
passwordSettings,
|
passwordSettings,
|
||||||
wizardToken,
|
wizardToken,
|
||||||
@ -522,10 +522,10 @@ export default inject(({ authStore, settingsStore, wizard }) => {
|
|||||||
setIsWizardLoaded,
|
setIsWizardLoaded,
|
||||||
getMachineName,
|
getMachineName,
|
||||||
getIsRequiredLicense,
|
getIsRequiredLicense,
|
||||||
setPortalOwner,
|
|
||||||
setLicense,
|
setLicense,
|
||||||
resetLicenseUploaded,
|
resetLicenseUploaded,
|
||||||
} = wizard;
|
} = wizardStore;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
theme,
|
theme,
|
||||||
@ -546,7 +546,7 @@ export default inject(({ authStore, settingsStore, wizard }) => {
|
|||||||
setIsWizardLoaded,
|
setIsWizardLoaded,
|
||||||
getMachineName,
|
getMachineName,
|
||||||
getIsRequiredLicense,
|
getIsRequiredLicense,
|
||||||
setPortalOwner,
|
|
||||||
setLicense,
|
setLicense,
|
||||||
resetLicenseUploaded,
|
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;
|
this.enableRestoreButton = enableRestoreButton;
|
||||||
};
|
};
|
||||||
|
|
||||||
restoreWhiteLabelSettings = async (isDefault) => {
|
restoreWhiteLabelSettings = async () => {
|
||||||
const { getWhiteLabelLogoUrls } = this.settingsStore;
|
const { getWhiteLabelLogoUrls } = this.settingsStore;
|
||||||
|
|
||||||
await api.settings.restoreWhiteLabelSettings(isDefault, isManagement());
|
await api.settings.restoreWhiteLabelSettings(isManagement());
|
||||||
await getWhiteLabelLogoUrls();
|
await getWhiteLabelLogoUrls();
|
||||||
this.getWhiteLabelLogoUrls();
|
this.getWhiteLabelLogoUrls();
|
||||||
this.getIsDefaultWhiteLabel();
|
this.getIsDefaultWhiteLabel();
|
||||||
|
@ -30,7 +30,7 @@ import {
|
|||||||
} from "SRC_DIR/helpers/utils";
|
} from "SRC_DIR/helpers/utils";
|
||||||
import { isDesktop, isMobile } from "@docspace/shared/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 { CategoryType } from "SRC_DIR/helpers/constants";
|
||||||
import debounce from "lodash.debounce";
|
import debounce from "lodash.debounce";
|
||||||
@ -161,7 +161,7 @@ class FilesStore {
|
|||||||
infoPanelStore,
|
infoPanelStore,
|
||||||
userStore,
|
userStore,
|
||||||
currentTariffStatusStore,
|
currentTariffStatusStore,
|
||||||
settingsStore
|
settingsStore,
|
||||||
) {
|
) {
|
||||||
const pathname = window.location.pathname.toLowerCase();
|
const pathname = window.location.pathname.toLowerCase();
|
||||||
this.isEditor = pathname.indexOf("doceditor") !== -1;
|
this.isEditor = pathname.indexOf("doceditor") !== -1;
|
||||||
@ -292,7 +292,7 @@ class FilesStore {
|
|||||||
foundIndex,
|
foundIndex,
|
||||||
count > 0
|
count > 0
|
||||||
? this.files[foundIndex].fileStatus | FileStatus.IsNew
|
? 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(
|
this.updateSelectionStatus(
|
||||||
id,
|
id,
|
||||||
this.files[foundIndex].fileStatus | FileStatus.IsEditing,
|
this.files[foundIndex].fileStatus | FileStatus.IsEditing,
|
||||||
true
|
true,
|
||||||
);
|
);
|
||||||
|
|
||||||
this.updateFileStatus(
|
this.updateFileStatus(
|
||||||
foundIndex,
|
foundIndex,
|
||||||
this.files[foundIndex].fileStatus | FileStatus.IsEditing
|
this.files[foundIndex].fileStatus | FileStatus.IsEditing,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -334,12 +334,12 @@ class FilesStore {
|
|||||||
this.updateSelectionStatus(
|
this.updateSelectionStatus(
|
||||||
id,
|
id,
|
||||||
this.files[foundIndex].fileStatus & ~FileStatus.IsEditing,
|
this.files[foundIndex].fileStatus & ~FileStatus.IsEditing,
|
||||||
false
|
false,
|
||||||
);
|
);
|
||||||
|
|
||||||
this.updateFileStatus(
|
this.updateFileStatus(
|
||||||
foundIndex,
|
foundIndex,
|
||||||
this.files[foundIndex].fileStatus & ~FileStatus.IsEditing
|
this.files[foundIndex].fileStatus & ~FileStatus.IsEditing,
|
||||||
);
|
);
|
||||||
|
|
||||||
this.getFileInfo(id);
|
this.getFileInfo(id);
|
||||||
@ -512,7 +512,7 @@ class FilesStore {
|
|||||||
|
|
||||||
if (this.bufferSelection) {
|
if (this.bufferSelection) {
|
||||||
const foundIndex = [this.bufferSelection].findIndex(
|
const foundIndex = [this.bufferSelection].findIndex(
|
||||||
(x) => x.id === folder.id
|
(x) => x.id === folder.id,
|
||||||
);
|
);
|
||||||
if (foundIndex > -1) {
|
if (foundIndex > -1) {
|
||||||
runInAction(() => {
|
runInAction(() => {
|
||||||
@ -535,7 +535,7 @@ class FilesStore {
|
|||||||
console.log(
|
console.log(
|
||||||
"[WS] delete file",
|
"[WS] delete file",
|
||||||
this.files[foundIndex].id,
|
this.files[foundIndex].id,
|
||||||
this.files[foundIndex].title
|
this.files[foundIndex].title,
|
||||||
);
|
);
|
||||||
|
|
||||||
// this.setFiles(
|
// this.setFiles(
|
||||||
@ -549,7 +549,7 @@ class FilesStore {
|
|||||||
// this.setFilter(newFilter);
|
// this.setFilter(newFilter);
|
||||||
|
|
||||||
const tempActionFilesIds = JSON.parse(
|
const tempActionFilesIds = JSON.parse(
|
||||||
JSON.stringify(this.tempActionFilesIds)
|
JSON.stringify(this.tempActionFilesIds),
|
||||||
);
|
);
|
||||||
tempActionFilesIds.push(this.files[foundIndex].id);
|
tempActionFilesIds.push(this.files[foundIndex].id);
|
||||||
|
|
||||||
@ -578,11 +578,11 @@ class FilesStore {
|
|||||||
console.log(
|
console.log(
|
||||||
"[WS] delete folder",
|
"[WS] delete folder",
|
||||||
this.folders[foundIndex].id,
|
this.folders[foundIndex].id,
|
||||||
this.folders[foundIndex].title
|
this.folders[foundIndex].title,
|
||||||
);
|
);
|
||||||
|
|
||||||
const tempActionFoldersIds = JSON.parse(
|
const tempActionFoldersIds = JSON.parse(
|
||||||
JSON.stringify(this.tempActionFoldersIds)
|
JSON.stringify(this.tempActionFoldersIds),
|
||||||
);
|
);
|
||||||
tempActionFoldersIds.push(this.folders[foundIndex].id);
|
tempActionFoldersIds.push(this.folders[foundIndex].id);
|
||||||
|
|
||||||
@ -669,7 +669,7 @@ class FilesStore {
|
|||||||
|
|
||||||
if (this.bufferSelection) {
|
if (this.bufferSelection) {
|
||||||
const foundIndex = [this.bufferSelection].findIndex(
|
const foundIndex = [this.bufferSelection].findIndex(
|
||||||
(x) => x.id === file.id
|
(x) => x.id === file.id,
|
||||||
);
|
);
|
||||||
if (foundIndex > -1) {
|
if (foundIndex > -1) {
|
||||||
runInAction(() => {
|
runInAction(() => {
|
||||||
@ -694,7 +694,7 @@ class FilesStore {
|
|||||||
this.setActiveFolders(folders, destFolderId);
|
this.setActiveFolders(folders, destFolderId);
|
||||||
} else {
|
} else {
|
||||||
folders.map((item) =>
|
folders.map((item) =>
|
||||||
this.activeFolders.push({ id: item, destFolderId })
|
this.activeFolders.push({ id: item, destFolderId }),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -726,7 +726,7 @@ class FilesStore {
|
|||||||
: {
|
: {
|
||||||
id: item,
|
id: item,
|
||||||
destFolderId,
|
destFolderId,
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
return arrayFormation;
|
return arrayFormation;
|
||||||
};
|
};
|
||||||
@ -763,7 +763,7 @@ class FilesStore {
|
|||||||
|
|
||||||
setStartDrag = (startDrag) => {
|
setStartDrag = (startDrag) => {
|
||||||
this.selection = this.selection.filter(
|
this.selection = this.selection.filter(
|
||||||
(x) => !x.providerKey || x.id !== x.rootFolderId
|
(x) => !x.providerKey || x.id !== x.rootFolderId,
|
||||||
); // removed root thirdparty folders
|
); // removed root thirdparty folders
|
||||||
this.startDrag = startDrag;
|
this.startDrag = startDrag;
|
||||||
};
|
};
|
||||||
@ -837,7 +837,7 @@ class FilesStore {
|
|||||||
if (!treeFolders || !treeFolders.length) return;
|
if (!treeFolders || !treeFolders.length) return;
|
||||||
|
|
||||||
const trashFolder = treeFolders.find(
|
const trashFolder = treeFolders.find(
|
||||||
(f) => f.rootFolderType == FolderType.TRASH
|
(f) => f.rootFolderType == FolderType.TRASH,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!trashFolder) return;
|
if (!trashFolder) return;
|
||||||
@ -845,7 +845,7 @@ class FilesStore {
|
|||||||
const isEmpty = !trashFolder.foldersCount && !trashFolder.filesCount;
|
const isEmpty = !trashFolder.foldersCount && !trashFolder.filesCount;
|
||||||
|
|
||||||
this.setTrashIsEmpty(isEmpty);
|
this.setTrashIsEmpty(isEmpty);
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (isDesktopClient) {
|
if (isDesktopClient) {
|
||||||
@ -971,10 +971,10 @@ class FilesStore {
|
|||||||
|
|
||||||
updateSelection = (id) => {
|
updateSelection = (id) => {
|
||||||
const indexFileList = this.filesList.findIndex(
|
const indexFileList = this.filesList.findIndex(
|
||||||
(filelist) => filelist.id === id
|
(filelist) => filelist.id === id,
|
||||||
);
|
);
|
||||||
const indexSelectedRoom = this.selection.findIndex(
|
const indexSelectedRoom = this.selection.findIndex(
|
||||||
(room) => room.id === id
|
(room) => room.id === id,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (~indexFileList && ~indexSelectedRoom) {
|
if (~indexFileList && ~indexSelectedRoom) {
|
||||||
@ -982,7 +982,7 @@ class FilesStore {
|
|||||||
}
|
}
|
||||||
if (this.bufferSelection) {
|
if (this.bufferSelection) {
|
||||||
this.bufferSelection = this.filesList.find(
|
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 (fileType === "file") {
|
||||||
if (this.activeFiles.findIndex((f) => f.id == id) === -1) {
|
if (this.activeFiles.findIndex((f) => f.id == id) === -1) {
|
||||||
newSelections.push(
|
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) {
|
} else if (this.activeFolders.findIndex((f) => f.id == id) === -1) {
|
||||||
const selectableFolder = this.filesList.find(
|
const selectableFolder = this.filesList.find(
|
||||||
(f) => f.id == id && f.isFolder
|
(f) => f.id == id && f.isFolder,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (selectableFolder) {
|
if (selectableFolder) {
|
||||||
@ -1153,12 +1153,12 @@ class FilesStore {
|
|||||||
if (fileType === "file") {
|
if (fileType === "file") {
|
||||||
if (this.activeFiles.findIndex((f) => f.id == id) === -1) {
|
if (this.activeFiles.findIndex((f) => f.id == id) === -1) {
|
||||||
newSelections = newSelections.filter(
|
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) {
|
} else if (this.activeFolders.findIndex((f) => f.id == id) === -1) {
|
||||||
newSelections = newSelections.filter(
|
newSelections = newSelections.filter(
|
||||||
(f) => !(f.id == id && f.isFolder)
|
(f) => !(f.id == id && f.isFolder),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1167,7 +1167,7 @@ class FilesStore {
|
|||||||
return items.filter(
|
return items.filter(
|
||||||
(x, index, self) =>
|
(x, index, self) =>
|
||||||
index ===
|
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(
|
const newUrl = combineUrl(
|
||||||
window.DocSpaceConfig?.proxy?.url,
|
window.DocSpaceConfig?.proxy?.url,
|
||||||
config.homepage,
|
config.homepage,
|
||||||
pathname
|
pathname,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (newUrl === currentUrl) return;
|
if (newUrl === currentUrl) return;
|
||||||
@ -1315,7 +1315,7 @@ class FilesStore {
|
|||||||
filter,
|
filter,
|
||||||
clearFilter = true,
|
clearFilter = true,
|
||||||
withSubfolders = false,
|
withSubfolders = false,
|
||||||
clearSelection = true
|
clearSelection = true,
|
||||||
) => {
|
) => {
|
||||||
const { setSelectedNode } = this.treeFoldersStore;
|
const { setSelectedNode } = this.treeFoldersStore;
|
||||||
if (this.clientLoadingStore.isLoading) {
|
if (this.clientLoadingStore.isLoading) {
|
||||||
@ -1329,7 +1329,7 @@ class FilesStore {
|
|||||||
if (folderId === "@my" && this.userStore.user.isVisitor) {
|
if (folderId === "@my" && this.userStore.user.isVisitor) {
|
||||||
const url = getCategoryUrl(CategoryType.Shared);
|
const url = getCategoryUrl(CategoryType.Shared);
|
||||||
return window.DocSpace.navigate(
|
return window.DocSpace.navigate(
|
||||||
`${url}?${RoomsFilter.getDefault().toUrlParams()}`
|
`${url}?${RoomsFilter.getDefault().toUrlParams()}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1389,7 +1389,7 @@ class FilesStore {
|
|||||||
folderId,
|
folderId,
|
||||||
filterData,
|
filterData,
|
||||||
clearFilter,
|
clearFilter,
|
||||||
withSubfolders
|
withSubfolders,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1398,7 +1398,7 @@ class FilesStore {
|
|||||||
if (!this.publicRoomStore.isPublicRoom) {
|
if (!this.publicRoomStore.isPublicRoom) {
|
||||||
this.categoryType = getCategoryTypeByFolderType(
|
this.categoryType = getCategoryTypeByFolderType(
|
||||||
data.current.rootFolderType,
|
data.current.rootFolderType,
|
||||||
data.current.parentId
|
data.current.parentId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -1449,12 +1449,12 @@ class FilesStore {
|
|||||||
if (clearSelection) {
|
if (clearSelection) {
|
||||||
// Find not processed
|
// Find not processed
|
||||||
const tempSelection = this.selection.filter(
|
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 =
|
const tempBuffer =
|
||||||
this.bufferSelection &&
|
this.bufferSelection &&
|
||||||
this.activeFiles.find(
|
this.activeFiles.find(
|
||||||
(elem) => elem.id === this.bufferSelection.id
|
(elem) => elem.id === this.bufferSelection.id,
|
||||||
) == null
|
) == null
|
||||||
? this.bufferSelection
|
? this.bufferSelection
|
||||||
: null;
|
: null;
|
||||||
@ -1531,7 +1531,7 @@ class FilesStore {
|
|||||||
shared,
|
shared,
|
||||||
canCopyPublicLink,
|
canCopyPublicLink,
|
||||||
};
|
};
|
||||||
})
|
}),
|
||||||
).then((res) => {
|
).then((res) => {
|
||||||
return res
|
return res
|
||||||
.filter((item, index) => {
|
.filter((item, index) => {
|
||||||
@ -1558,7 +1558,7 @@ class FilesStore {
|
|||||||
|
|
||||||
if (this.createdItem) {
|
if (this.createdItem) {
|
||||||
const newItem = this.filesList.find(
|
const newItem = this.filesList.find(
|
||||||
(item) => item.id === this.createdItem.id
|
(item) => item.id === this.createdItem.id,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (newItem) {
|
if (newItem) {
|
||||||
@ -1622,7 +1622,7 @@ class FilesStore {
|
|||||||
clearFilter = true,
|
clearFilter = true,
|
||||||
withSubfolders = false,
|
withSubfolders = false,
|
||||||
clearSelection = true,
|
clearSelection = true,
|
||||||
withFilterLocalStorage = false
|
withFilterLocalStorage = false,
|
||||||
) => {
|
) => {
|
||||||
const { setSelectedNode, roomsFolderId } = this.treeFoldersStore;
|
const { setSelectedNode, roomsFolderId } = this.treeFoldersStore;
|
||||||
|
|
||||||
@ -1634,7 +1634,7 @@ class FilesStore {
|
|||||||
const filterData = !!filter ? filter.clone() : RoomsFilter.getDefault();
|
const filterData = !!filter ? filter.clone() : RoomsFilter.getDefault();
|
||||||
|
|
||||||
const filterStorageItem = localStorage.getItem(
|
const filterStorageItem = localStorage.getItem(
|
||||||
`UserRoomsFilter=${this.userStore.user?.id}`
|
`UserRoomsFilter=${this.userStore.user?.id}`,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (filterStorageItem && (!filter || withFilterLocalStorage)) {
|
if (filterStorageItem && (!filter || withFilterLocalStorage)) {
|
||||||
@ -1672,7 +1672,7 @@ class FilesStore {
|
|||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
true
|
true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1680,7 +1680,7 @@ class FilesStore {
|
|||||||
runInAction(() => {
|
runInAction(() => {
|
||||||
this.categoryType = getCategoryTypeByFolderType(
|
this.categoryType = getCategoryTypeByFolderType(
|
||||||
data.current.rootFolderType,
|
data.current.rootFolderType,
|
||||||
data.current.parentId
|
data.current.parentId,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1744,7 +1744,7 @@ class FilesStore {
|
|||||||
|
|
||||||
if (this.createdItem) {
|
if (this.createdItem) {
|
||||||
const newItem = this.filesList.find(
|
const newItem = this.filesList.find(
|
||||||
(item) => item.id === this.createdItem.id
|
(item) => item.id === this.createdItem.id,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (newItem) {
|
if (newItem) {
|
||||||
@ -1780,7 +1780,7 @@ class FilesStore {
|
|||||||
|
|
||||||
isFileSelected = (fileId, parentId) => {
|
isFileSelected = (fileId, parentId) => {
|
||||||
const item = this.selection.find(
|
const item = this.selection.find(
|
||||||
(x) => x.id === fileId && x.parentId === parentId
|
(x) => x.id === fileId && x.parentId === parentId,
|
||||||
);
|
);
|
||||||
|
|
||||||
return item !== undefined;
|
return item !== undefined;
|
||||||
@ -1797,12 +1797,12 @@ class FilesStore {
|
|||||||
const isFileSelected = this.isFileSelected(id, parentId);
|
const isFileSelected = this.isFileSelected(id, parentId);
|
||||||
if (isFileSelected) {
|
if (isFileSelected) {
|
||||||
let selectionIndex = this.selection.findIndex(
|
let selectionIndex = this.selection.findIndex(
|
||||||
(x) => x.parentId === parentId && x.id === id
|
(x) => x.parentId === parentId && x.id === id,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (selectionIndex !== -1) {
|
if (selectionIndex !== -1) {
|
||||||
this.selection = this.selection.filter(
|
this.selection = this.selection.filter(
|
||||||
(x, index) => index !== selectionIndex
|
(x, index) => index !== selectionIndex,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2090,7 +2090,7 @@ class FilesStore {
|
|||||||
const pluginFilesKeys = this.pluginStore.getContextMenuKeysByType(
|
const pluginFilesKeys = this.pluginStore.getContextMenuKeysByType(
|
||||||
PluginFileType.Files,
|
PluginFileType.Files,
|
||||||
item.fileExst,
|
item.fileExst,
|
||||||
security
|
security,
|
||||||
);
|
);
|
||||||
|
|
||||||
pluginAllKeys &&
|
pluginAllKeys &&
|
||||||
@ -2106,7 +2106,7 @@ class FilesStore {
|
|||||||
const pluginFilesKeys = this.pluginStore.getContextMenuKeysByType(
|
const pluginFilesKeys = this.pluginStore.getContextMenuKeysByType(
|
||||||
PluginFileType.Image,
|
PluginFileType.Image,
|
||||||
item.fileExst,
|
item.fileExst,
|
||||||
security
|
security,
|
||||||
);
|
);
|
||||||
|
|
||||||
pluginAllKeys &&
|
pluginAllKeys &&
|
||||||
@ -2122,7 +2122,7 @@ class FilesStore {
|
|||||||
const pluginFilesKeys = this.pluginStore.getContextMenuKeysByType(
|
const pluginFilesKeys = this.pluginStore.getContextMenuKeysByType(
|
||||||
PluginFileType.Video,
|
PluginFileType.Video,
|
||||||
item.fileExst,
|
item.fileExst,
|
||||||
security
|
security,
|
||||||
);
|
);
|
||||||
|
|
||||||
pluginAllKeys &&
|
pluginAllKeys &&
|
||||||
@ -2284,7 +2284,7 @@ class FilesStore {
|
|||||||
const pluginRoomsKeys = this.pluginStore.getContextMenuKeysByType(
|
const pluginRoomsKeys = this.pluginStore.getContextMenuKeysByType(
|
||||||
PluginFileType.Rooms,
|
PluginFileType.Rooms,
|
||||||
null,
|
null,
|
||||||
security
|
security,
|
||||||
);
|
);
|
||||||
|
|
||||||
pluginAllKeys &&
|
pluginAllKeys &&
|
||||||
@ -2384,7 +2384,7 @@ class FilesStore {
|
|||||||
const pluginFoldersKeys = this.pluginStore.getContextMenuKeysByType(
|
const pluginFoldersKeys = this.pluginStore.getContextMenuKeysByType(
|
||||||
PluginFileType.Folders,
|
PluginFileType.Folders,
|
||||||
null,
|
null,
|
||||||
security
|
security,
|
||||||
);
|
);
|
||||||
|
|
||||||
pluginAllKeys &&
|
pluginAllKeys &&
|
||||||
@ -2697,10 +2697,10 @@ class FilesStore {
|
|||||||
|
|
||||||
const hotkeysClipboard = fileIds
|
const hotkeysClipboard = fileIds
|
||||||
? this.hotkeysClipboard.filter(
|
? this.hotkeysClipboard.filter(
|
||||||
(f) => !fileIds.includes(f.id) && !f.isFolder
|
(f) => !fileIds.includes(f.id) && !f.isFolder,
|
||||||
)
|
)
|
||||||
: this.hotkeysClipboard.filter(
|
: this.hotkeysClipboard.filter(
|
||||||
(f) => !folderIds.includes(f.id) && f.isFolder
|
(f) => !folderIds.includes(f.id) && f.isFolder,
|
||||||
);
|
);
|
||||||
|
|
||||||
newFilter.total -= deleteCount;
|
newFilter.total -= deleteCount;
|
||||||
@ -2867,7 +2867,7 @@ class FilesStore {
|
|||||||
return getIcon(
|
return getIcon(
|
||||||
24,
|
24,
|
||||||
this.selection[0].fileExst,
|
this.selection[0].fileExst,
|
||||||
this.selection[0].providerKey
|
this.selection[0].providerKey,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@ -2978,7 +2978,7 @@ class FilesStore {
|
|||||||
const url = combineUrl(
|
const url = combineUrl(
|
||||||
proxyURL,
|
proxyURL,
|
||||||
config.homepage,
|
config.homepage,
|
||||||
`/doceditor?fileId=${id}${needConvert ? "&action=view" : ""}`
|
`/doceditor?fileId=${id}${needConvert ? "&action=view" : ""}`,
|
||||||
);
|
);
|
||||||
|
|
||||||
return url;
|
return url;
|
||||||
@ -3063,7 +3063,7 @@ class FilesStore {
|
|||||||
|
|
||||||
const thirdPartyIcon = this.thirdPartyStore.getThirdPartyIcon(
|
const thirdPartyIcon = this.thirdPartyStore.getThirdPartyIcon(
|
||||||
item.providerKey,
|
item.providerKey,
|
||||||
"small"
|
"small",
|
||||||
);
|
);
|
||||||
|
|
||||||
const providerType =
|
const providerType =
|
||||||
@ -3119,7 +3119,7 @@ class FilesStore {
|
|||||||
contentLength,
|
contentLength,
|
||||||
roomType,
|
roomType,
|
||||||
isArchive,
|
isArchive,
|
||||||
type
|
type,
|
||||||
);
|
);
|
||||||
|
|
||||||
const defaultRoomIcon = isRoom
|
const defaultRoomIcon = isRoom
|
||||||
@ -3130,7 +3130,7 @@ class FilesStore {
|
|||||||
contentLength,
|
contentLength,
|
||||||
roomType,
|
roomType,
|
||||||
isArchive,
|
isArchive,
|
||||||
type
|
type,
|
||||||
)
|
)
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
@ -3271,7 +3271,7 @@ class FilesStore {
|
|||||||
elem !== `room-${RoomsType.ReviewRoom}` &&
|
elem !== `room-${RoomsType.ReviewRoom}` &&
|
||||||
elem !== `room-${RoomsType.FormRoom}` &&
|
elem !== `room-${RoomsType.FormRoom}` &&
|
||||||
elem !== `room-${RoomsType.ReadOnlyRoom}` &&
|
elem !== `room-${RoomsType.ReadOnlyRoom}` &&
|
||||||
elem !== `room-${RoomsType.PublicRoom}`
|
elem !== `room-${RoomsType.PublicRoom}`,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (hasFiles) cbMenu.push(FilterType.FilesOnly);
|
if (hasFiles) cbMenu.push(FilterType.FilesOnly);
|
||||||
@ -3498,14 +3498,14 @@ class FilesStore {
|
|||||||
|
|
||||||
get hasNew() {
|
get hasNew() {
|
||||||
const newFiles = [...this.files, ...this.folders].filter(
|
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;
|
return newFiles.length > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
get allFilesIsEditing() {
|
get allFilesIsEditing() {
|
||||||
const hasFolders = this.selection.find(
|
const hasFolders = this.selection.find(
|
||||||
(x) => !x.fileExst || !x.contentLength
|
(x) => !x.fileExst || !x.contentLength,
|
||||||
);
|
);
|
||||||
if (!hasFolders) {
|
if (!hasFolders) {
|
||||||
return this.selection.every((x) => x.isEditing);
|
return this.selection.every((x) => x.isEditing);
|
||||||
@ -3529,15 +3529,15 @@ class FilesStore {
|
|||||||
const webReview = selection.find((x) => x.viewAccessibility?.WebReview);
|
const webReview = selection.find((x) => x.viewAccessibility?.WebReview);
|
||||||
|
|
||||||
const formFillingDocs = selection.find(
|
const formFillingDocs = selection.find(
|
||||||
(x) => x.viewAccessibility?.WebRestrictedEditing
|
(x) => x.viewAccessibility?.WebRestrictedEditing,
|
||||||
);
|
);
|
||||||
|
|
||||||
const webFilter = selection.find(
|
const webFilter = selection.find(
|
||||||
(x) => x.viewAccessibility?.WebCustomFilterEditing
|
(x) => x.viewAccessibility?.WebCustomFilterEditing,
|
||||||
);
|
);
|
||||||
|
|
||||||
const webNeedConvert = selection.find(
|
const webNeedConvert = selection.find(
|
||||||
(x) => x.viewAccessibility?.MustConvert
|
(x) => x.viewAccessibility?.MustConvert,
|
||||||
);
|
);
|
||||||
|
|
||||||
if ((webEdit && !webNeedConvert) || !externalAccess)
|
if ((webEdit && !webNeedConvert) || !externalAccess)
|
||||||
@ -3642,7 +3642,7 @@ class FilesStore {
|
|||||||
tab = null,
|
tab = null,
|
||||||
url = null,
|
url = null,
|
||||||
preview = false,
|
preview = false,
|
||||||
shareKey = null
|
shareKey = null,
|
||||||
) => {
|
) => {
|
||||||
const foundIndex = this.files.findIndex((x) => x.id === id);
|
const foundIndex = this.files.findIndex((x) => x.id === id);
|
||||||
const file = foundIndex !== -1 ? this.files[foundIndex] : undefined;
|
const file = foundIndex !== -1 ? this.files[foundIndex] : undefined;
|
||||||
@ -3854,7 +3854,7 @@ class FilesStore {
|
|||||||
this.setHotkeyCaretStart(item);
|
this.setHotkeyCaretStart(item);
|
||||||
|
|
||||||
const fileIndex = this.selection.findIndex(
|
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) {
|
if (fileIndex === -1) {
|
||||||
this.setSelection([...this.selection, item]);
|
this.setSelection([...this.selection, item]);
|
||||||
@ -3872,15 +3872,15 @@ class FilesStore {
|
|||||||
if (!caret || !caretStart) return;
|
if (!caret || !caretStart) return;
|
||||||
|
|
||||||
const startCaretIndex = this.filesList.findIndex(
|
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(
|
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(
|
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;
|
const isMoveDown = caretIndex < itemIndex;
|
||||||
@ -3893,13 +3893,13 @@ class FilesStore {
|
|||||||
const filesItem = this.filesList[index];
|
const filesItem = this.filesList[index];
|
||||||
|
|
||||||
const selectionIndex = newSelection.findIndex(
|
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) {
|
if (selectionIndex === -1) {
|
||||||
newSelection.push(filesItem);
|
newSelection.push(filesItem);
|
||||||
} else {
|
} else {
|
||||||
newSelection = newSelection.filter(
|
newSelection = newSelection.filter(
|
||||||
(_, fIndex) => selectionIndex !== fIndex
|
(_, fIndex) => selectionIndex !== fIndex,
|
||||||
);
|
);
|
||||||
newSelection.push(filesItem);
|
newSelection.push(filesItem);
|
||||||
}
|
}
|
||||||
@ -3914,12 +3914,12 @@ class FilesStore {
|
|||||||
const lastSelection = this.selection[this.selection.length - 1];
|
const lastSelection = this.selection[this.selection.length - 1];
|
||||||
const indexOfLast = this.filesList.findIndex(
|
const indexOfLast = this.filesList.findIndex(
|
||||||
(f) =>
|
(f) =>
|
||||||
f.id === lastSelection?.id && f.isFolder === lastSelection?.isFolder
|
f.id === lastSelection?.id && f.isFolder === lastSelection?.isFolder,
|
||||||
);
|
);
|
||||||
|
|
||||||
newSelection = newSelection.filter((f) => {
|
newSelection = newSelection.filter((f) => {
|
||||||
const listIndex = this.filesList.findIndex(
|
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) {
|
if (isMoveDown) {
|
||||||
|
@ -6,7 +6,7 @@ import { checkDialogsOpen } from "@docspace/shared/utils/checkDialogsOpen";
|
|||||||
|
|
||||||
import { toastr } from "@docspace/shared/components/toast";
|
import { toastr } from "@docspace/shared/components/toast";
|
||||||
import { isDesktop, isMobile } from "@docspace/shared/utils";
|
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 config from "PACKAGE_FILE";
|
||||||
import { getCategoryUrl } from "SRC_DIR/helpers/utils";
|
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 {
|
import {
|
||||||
getPaymentSettings,
|
getPaymentSettings,
|
||||||
setLicense,
|
setLicense,
|
||||||
acceptLicense,
|
acceptLicense,
|
||||||
} from "@docspace/shared/api/settings";
|
} from "@docspace/shared/api/settings";
|
||||||
import { makeAutoObservable } from "mobx";
|
import { getPaymentLink } from "@docspace/shared/api/portal";
|
||||||
import api from "@docspace/shared/api";
|
import api from "@docspace/shared/api";
|
||||||
import { toastr } from "@docspace/shared/components/toast";
|
import { toastr } from "@docspace/shared/components/toast";
|
||||||
import { authStore } from "@docspace/shared/store";
|
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 { 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 {
|
class PaymentStore {
|
||||||
userStore = null;
|
userStore: UserStore | null = null;
|
||||||
currentTariffStatusStore = null;
|
|
||||||
currentQuotaStore = null;
|
currentTariffStatusStore: CurrentTariffStatusStore | null = null;
|
||||||
paymentQuotasStore = null;
|
|
||||||
|
currentQuotaStore: CurrentQuotasStore | null = null;
|
||||||
|
|
||||||
|
paymentQuotasStore: PaymentQuotasStore | null = null;
|
||||||
|
|
||||||
salesEmail = "";
|
salesEmail = "";
|
||||||
|
|
||||||
helpUrl = "https://helpdesk.onlyoffice.com";
|
helpUrl = "https://helpdesk.onlyoffice.com";
|
||||||
|
|
||||||
buyUrl =
|
buyUrl =
|
||||||
"https://www.onlyoffice.com/enterprise-edition.aspx?type=buyenterprise";
|
"https://www.onlyoffice.com/enterprise-edition.aspx?type=buyenterprise";
|
||||||
|
|
||||||
standaloneMode = true;
|
standaloneMode = true;
|
||||||
|
|
||||||
currentLicense = {
|
currentLicense = {
|
||||||
expiresDate: new Date(),
|
expiresDate: new Date(),
|
||||||
trialMode: true,
|
trialMode: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
paymentLink = null;
|
paymentLink = "";
|
||||||
accountLink = null;
|
|
||||||
|
accountLink = "";
|
||||||
|
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
|
|
||||||
isUpdatingBasicSettings = false;
|
isUpdatingBasicSettings = false;
|
||||||
|
|
||||||
totalPrice = 30;
|
totalPrice = 30;
|
||||||
|
|
||||||
managersCount = 1;
|
managersCount = 1;
|
||||||
|
|
||||||
maxAvailableManagersCount = 999;
|
maxAvailableManagersCount = 999;
|
||||||
|
|
||||||
stepByQuotaForManager = 1;
|
stepByQuotaForManager = 1;
|
||||||
|
|
||||||
minAvailableManagersValue = 1;
|
minAvailableManagersValue = 1;
|
||||||
|
|
||||||
stepByQuotaForTotalSize = 107374182400;
|
stepByQuotaForTotalSize = 107374182400;
|
||||||
|
|
||||||
minAvailableTotalSizeValue = 107374182400;
|
minAvailableTotalSizeValue = 107374182400;
|
||||||
|
|
||||||
isInitPaymentPage = false;
|
isInitPaymentPage = false;
|
||||||
|
|
||||||
isLicenseCorrect = false;
|
isLicenseCorrect = false;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
userStore,
|
userStore: UserStore,
|
||||||
currentTariffStatusStore,
|
currentTariffStatusStore: CurrentTariffStatusStore,
|
||||||
currentQuotaStore,
|
currentQuotaStore: CurrentQuotasStore,
|
||||||
paymentQuotasStore
|
paymentQuotasStore: PaymentQuotasStore,
|
||||||
) {
|
) {
|
||||||
this.userStore = userStore;
|
this.userStore = userStore;
|
||||||
this.currentTariffStatusStore = currentTariffStatusStore;
|
this.currentTariffStatusStore = currentTariffStatusStore;
|
||||||
@ -57,20 +84,23 @@ class PaymentStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get isAlreadyPaid() {
|
get isAlreadyPaid() {
|
||||||
const { customerId } = this.currentTariffStatusStore;
|
const customerId = this.currentTariffStatusStore?.customerId;
|
||||||
const { isFreeTariff } = this.currentQuotaStore;
|
const isFreeTariff = this.currentQuotaStore?.isFreeTariff;
|
||||||
|
|
||||||
return customerId?.length !== 0 || !isFreeTariff;
|
return customerId?.length !== 0 || !isFreeTariff;
|
||||||
}
|
}
|
||||||
|
|
||||||
setIsInitPaymentPage = (value) => {
|
setIsInitPaymentPage = (value: boolean) => {
|
||||||
this.isInitPaymentPage = value;
|
this.isInitPaymentPage = value;
|
||||||
};
|
};
|
||||||
|
|
||||||
setIsUpdatingBasicSettings = (isUpdatingBasicSettings) => {
|
setIsUpdatingBasicSettings = (isUpdatingBasicSettings: boolean) => {
|
||||||
this.isUpdatingBasicSettings = isUpdatingBasicSettings;
|
this.isUpdatingBasicSettings = isUpdatingBasicSettings;
|
||||||
};
|
};
|
||||||
|
|
||||||
basicSettings = async () => {
|
basicSettings = async () => {
|
||||||
|
if (!this.currentTariffStatusStore || !this.currentQuotaStore) return;
|
||||||
|
|
||||||
const { setPortalTariff, setPayerInfo } = this.currentTariffStatusStore;
|
const { setPortalTariff, setPayerInfo } = this.currentTariffStatusStore;
|
||||||
const { addedManagersCount } = this.currentQuotaStore;
|
const { addedManagersCount } = this.currentQuotaStore;
|
||||||
|
|
||||||
@ -78,15 +108,14 @@ class PaymentStore {
|
|||||||
|
|
||||||
const requests = [setPortalTariff()];
|
const requests = [setPortalTariff()];
|
||||||
|
|
||||||
this.isAlreadyPaid
|
if (this.isAlreadyPaid) requests.push(this.setPaymentAccount());
|
||||||
? requests.push(this.setPaymentAccount())
|
else requests.push(this.getBasicPaymentLink(addedManagersCount));
|
||||||
: requests.push(this.getBasicPaymentLink(addedManagersCount));
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await Promise.all(requests);
|
await Promise.all(requests);
|
||||||
this.setBasicTariffContainer();
|
this.setBasicTariffContainer();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toastr.error(t("Common:UnexpectedError"));
|
// toastr.error(t("Common:UnexpectedError"));
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,22 +124,28 @@ class PaymentStore {
|
|||||||
this.setIsUpdatingBasicSettings(false);
|
this.setIsUpdatingBasicSettings(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
init = async (t) => {
|
init = async (t: TTranslation) => {
|
||||||
if (this.isInitPaymentPage) {
|
if (this.isInitPaymentPage) {
|
||||||
this.basicSettings();
|
this.basicSettings();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
!this.currentTariffStatusStore ||
|
||||||
|
!this.currentQuotaStore ||
|
||||||
|
!this.paymentQuotasStore
|
||||||
|
)
|
||||||
|
return;
|
||||||
|
|
||||||
const { setPayerInfo } = this.currentTariffStatusStore;
|
const { setPayerInfo } = this.currentTariffStatusStore;
|
||||||
const { addedManagersCount } = this.currentQuotaStore;
|
const { addedManagersCount } = this.currentQuotaStore;
|
||||||
const { setPortalPaymentQuotas } = this.paymentQuotasStore;
|
const { setPortalPaymentQuotas } = this.paymentQuotasStore;
|
||||||
|
|
||||||
const requests = [this.getSettingsPayment(), setPortalPaymentQuotas()];
|
const requests = [this.getSettingsPayment(), setPortalPaymentQuotas()];
|
||||||
|
|
||||||
this.isAlreadyPaid
|
if (this.isAlreadyPaid) requests.push(this.setPaymentAccount());
|
||||||
? requests.push(this.setPaymentAccount())
|
else requests.push(this.getBasicPaymentLink(addedManagersCount));
|
||||||
: requests.push(this.getBasicPaymentLink(addedManagersCount));
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await Promise.all(requests);
|
await Promise.all(requests);
|
||||||
@ -129,10 +164,10 @@ class PaymentStore {
|
|||||||
this.setIsInitPaymentPage(true);
|
this.setIsInitPaymentPage(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
getBasicPaymentLink = async (managersCount) => {
|
getBasicPaymentLink = async (managersCount: number) => {
|
||||||
const backUrl = combineUrl(
|
const backUrl = combineUrl(
|
||||||
window.location.origin,
|
window.location.origin,
|
||||||
"/portal-settings/payments/portal-payments?complete=true"
|
"/portal-settings/payments/portal-payments?complete=true",
|
||||||
);
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -144,14 +179,15 @@ class PaymentStore {
|
|||||||
console.error(err);
|
console.error(err);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
getPaymentLink = async (token = undefined) => {
|
getPaymentLink = async (token = undefined) => {
|
||||||
const backUrl = combineUrl(
|
const backUrl = combineUrl(
|
||||||
window.location.origin,
|
window.location.origin,
|
||||||
"/portal-settings/payments/portal-payments?complete=true"
|
"/portal-settings/payments/portal-payments?complete=true",
|
||||||
);
|
);
|
||||||
|
|
||||||
await getPaymentLink(this.managersCount, backUrl, token)
|
await getPaymentLink(this.managersCount, backUrl, token)
|
||||||
.then((link) => {
|
?.then((link) => {
|
||||||
if (!link) return;
|
if (!link) return;
|
||||||
this.setPaymentLink(link);
|
this.setPaymentLink(link);
|
||||||
})
|
})
|
||||||
@ -163,12 +199,12 @@ class PaymentStore {
|
|||||||
if (err?.response?.status === 402) {
|
if (err?.response?.status === 402) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.isInitPaymentPage && toastr.error(err);
|
if (this.isInitPaymentPage) toastr.error(err);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
standaloneBasicSettings = async (t) => {
|
standaloneBasicSettings = async (t: TTranslation) => {
|
||||||
const { getTenantExtra } = authStore;
|
const { getTenantExtra } = authStore;
|
||||||
|
|
||||||
this.setIsUpdatingBasicSettings(true);
|
this.setIsUpdatingBasicSettings(true);
|
||||||
@ -184,7 +220,7 @@ class PaymentStore {
|
|||||||
this.setIsUpdatingBasicSettings(false);
|
this.setIsUpdatingBasicSettings(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
standaloneInit = async (t) => {
|
standaloneInit = async (t: TTranslation) => {
|
||||||
const { getTenantExtra } = authStore;
|
const { getTenantExtra } = authStore;
|
||||||
|
|
||||||
if (this.isInitPaymentPage) {
|
if (this.isInitPaymentPage) {
|
||||||
@ -203,6 +239,7 @@ class PaymentStore {
|
|||||||
|
|
||||||
this.isInitPaymentPage = true;
|
this.isInitPaymentPage = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
getSettingsPayment = async () => {
|
getSettingsPayment = async () => {
|
||||||
try {
|
try {
|
||||||
const newSettings = await getPaymentSettings();
|
const newSettings = await getPaymentSettings();
|
||||||
@ -236,22 +273,23 @@ class PaymentStore {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
setIsLicenseCorrect = (isLicenseCorrect) => {
|
setIsLicenseCorrect = (isLicenseCorrect: boolean) => {
|
||||||
this.isLicenseCorrect = isLicenseCorrect;
|
this.isLicenseCorrect = isLicenseCorrect;
|
||||||
};
|
};
|
||||||
setPaymentsLicense = async (confirmKey, data) => {
|
|
||||||
|
setPaymentsLicense = async (confirmKey: string, data: FormData) => {
|
||||||
try {
|
try {
|
||||||
const message = await setLicense(confirmKey, data);
|
const message = await setLicense(confirmKey, data);
|
||||||
this.setIsLicenseCorrect(true);
|
this.setIsLicenseCorrect(true);
|
||||||
|
|
||||||
toastr.success(message);
|
toastr.success(message);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
toastr.error(e);
|
toastr.error(e as TData);
|
||||||
this.setIsLicenseCorrect(false);
|
this.setIsLicenseCorrect(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
acceptPaymentsLicense = async (t) => {
|
acceptPaymentsLicense = async (t: TTranslation) => {
|
||||||
try {
|
try {
|
||||||
const { getTenantExtra } = authStore;
|
const { getTenantExtra } = authStore;
|
||||||
|
|
||||||
@ -262,7 +300,7 @@ class PaymentStore {
|
|||||||
|
|
||||||
await getTenantExtra();
|
await getTenantExtra();
|
||||||
} catch (e) {
|
} 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;
|
this.paymentLink = link;
|
||||||
};
|
};
|
||||||
|
|
||||||
setIsLoading = (isLoading) => {
|
setIsLoading = (isLoading: boolean) => {
|
||||||
this.isLoading = isLoading;
|
this.isLoading = isLoading;
|
||||||
};
|
};
|
||||||
|
|
||||||
getTotalCostByFormula = (value) => {
|
getTotalCostByFormula = (value: number) => {
|
||||||
const costValuePerManager = this.paymentQuotasStore.planCost.value;
|
const costValuePerManager = this.paymentQuotasStore?.planCost.value;
|
||||||
return value * costValuePerManager;
|
if (costValuePerManager) return value * +costValuePerManager;
|
||||||
};
|
};
|
||||||
|
|
||||||
get allowedStorageSizeByQuota() {
|
get allowedStorageSizeByQuota() {
|
||||||
@ -301,7 +339,10 @@ class PaymentStore {
|
|||||||
resetTariffContainerToBasic = () => {
|
resetTariffContainerToBasic = () => {
|
||||||
this.setBasicTariffContainer();
|
this.setBasicTariffContainer();
|
||||||
};
|
};
|
||||||
|
|
||||||
setBasicTariffContainer = () => {
|
setBasicTariffContainer = () => {
|
||||||
|
if (!this.currentQuotaStore) return;
|
||||||
|
|
||||||
const { currentPlanCost, maxCountManagersByQuota, addedManagersCount } =
|
const { currentPlanCost, maxCountManagersByQuota, addedManagersCount } =
|
||||||
this.currentQuotaStore;
|
this.currentQuotaStore;
|
||||||
const currentTotalPrice = currentPlanCost.value;
|
const currentTotalPrice = currentPlanCost.value;
|
||||||
@ -314,21 +355,23 @@ class PaymentStore {
|
|||||||
? this.maxAvailableManagersCount + 1
|
? this.maxAvailableManagersCount + 1
|
||||||
: maxCountManagersByQuota;
|
: maxCountManagersByQuota;
|
||||||
|
|
||||||
this.totalPrice = currentTotalPrice;
|
this.totalPrice = +currentTotalPrice;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.managersCount = addedManagersCount;
|
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);
|
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)
|
if (managers > this.maxAvailableManagersCount)
|
||||||
this.managersCount = this.maxAvailableManagersCount + 1;
|
this.managersCount = this.maxAvailableManagersCount + 1;
|
||||||
else this.managersCount = managers;
|
else this.managersCount = managers;
|
||||||
@ -343,6 +386,7 @@ class PaymentStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get isPayer() {
|
get isPayer() {
|
||||||
|
if (!this.userStore || !this.currentTariffStatusStore) return;
|
||||||
const { user } = this.userStore;
|
const { user } = this.userStore;
|
||||||
|
|
||||||
const { payerInfo } = this.currentTariffStatusStore;
|
const { payerInfo } = this.currentTariffStatusStore;
|
||||||
@ -353,6 +397,7 @@ class PaymentStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get isStripePortalAvailable() {
|
get isStripePortalAvailable() {
|
||||||
|
if (!this.userStore) return;
|
||||||
const { user } = this.userStore;
|
const { user } = this.userStore;
|
||||||
|
|
||||||
if (!user) return false;
|
if (!user) return false;
|
||||||
@ -361,6 +406,7 @@ class PaymentStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get canUpdateTariff() {
|
get canUpdateTariff() {
|
||||||
|
if (!this.userStore || !this.currentQuotaStore) return;
|
||||||
const { user } = this.userStore;
|
const { user } = this.userStore;
|
||||||
const { isFreeTariff } = this.currentQuotaStore;
|
const { isFreeTariff } = this.currentQuotaStore;
|
||||||
|
|
||||||
@ -372,6 +418,7 @@ class PaymentStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get canPayTariff() {
|
get canPayTariff() {
|
||||||
|
if (!this.currentQuotaStore) return;
|
||||||
const { addedManagersCount } = this.currentQuotaStore;
|
const { addedManagersCount } = this.currentQuotaStore;
|
||||||
|
|
||||||
if (this.managersCount >= addedManagersCount) return true;
|
if (this.managersCount >= addedManagersCount) return true;
|
||||||
@ -380,6 +427,7 @@ class PaymentStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get canDowngradeTariff() {
|
get canDowngradeTariff() {
|
||||||
|
if (!this.currentQuotaStore) return;
|
||||||
const { addedManagersCount, usedTotalStorageSizeCount } =
|
const { addedManagersCount, usedTotalStorageSizeCount } =
|
||||||
this.currentQuotaStore;
|
this.currentQuotaStore;
|
||||||
|
|
||||||
@ -391,22 +439,30 @@ class PaymentStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setRangeStepByQuota = () => {
|
setRangeStepByQuota = () => {
|
||||||
|
if (!this.paymentQuotasStore) return;
|
||||||
|
|
||||||
const { stepAddingQuotaManagers, stepAddingQuotaTotalSize } =
|
const { stepAddingQuotaManagers, stepAddingQuotaTotalSize } =
|
||||||
this.paymentQuotasStore;
|
this.paymentQuotasStore;
|
||||||
|
|
||||||
this.stepByQuotaForManager = stepAddingQuotaManagers;
|
if (stepAddingQuotaManagers)
|
||||||
|
this.stepByQuotaForManager = stepAddingQuotaManagers;
|
||||||
this.minAvailableManagersValue = this.stepByQuotaForManager;
|
this.minAvailableManagersValue = this.stepByQuotaForManager;
|
||||||
|
|
||||||
this.stepByQuotaForTotalSize = stepAddingQuotaTotalSize;
|
if (stepAddingQuotaTotalSize)
|
||||||
|
this.stepByQuotaForTotalSize = stepAddingQuotaTotalSize;
|
||||||
this.minAvailableTotalSizeValue = this.stepByQuotaForManager;
|
this.minAvailableTotalSizeValue = this.stepByQuotaForManager;
|
||||||
};
|
};
|
||||||
|
|
||||||
sendPaymentRequest = async (email, userName, message) => {
|
sendPaymentRequest = async (
|
||||||
|
email: string,
|
||||||
|
userName: string,
|
||||||
|
message: string,
|
||||||
|
) => {
|
||||||
try {
|
try {
|
||||||
await api.portal.sendPaymentRequest(email, userName, message);
|
await api.portal.sendPaymentRequest(email, userName, message);
|
||||||
toastr.success(t("SuccessfullySentMessage"));
|
// toastr.success(t("SuccessfullySentMessage"));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
toastr.error(e);
|
toastr.error(e as TData);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
@ -13,7 +13,7 @@ import EditingFormStore from "./EditingFormStore";
|
|||||||
import FilterStore from "./FilterStore";
|
import FilterStore from "./FilterStore";
|
||||||
import SelectionStore from "./SelectionPeopleStore";
|
import SelectionStore from "./SelectionPeopleStore";
|
||||||
import HeaderMenuStore from "./HeaderMenuStore";
|
import HeaderMenuStore from "./HeaderMenuStore";
|
||||||
import AvatarEditorStore from "./AvatarEditorStore";
|
|
||||||
import InviteLinksStore from "./InviteLinksStore";
|
import InviteLinksStore from "./InviteLinksStore";
|
||||||
import DialogStore from "./DialogStore";
|
import DialogStore from "./DialogStore";
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ class PeopleStore {
|
|||||||
filterStore = null;
|
filterStore = null;
|
||||||
selectionStore = null;
|
selectionStore = null;
|
||||||
headerMenuStore = null;
|
headerMenuStore = null;
|
||||||
avatarEditorStore = null;
|
|
||||||
inviteLinksStore = null;
|
inviteLinksStore = null;
|
||||||
dialogStore = null;
|
dialogStore = null;
|
||||||
setupStore = null;
|
setupStore = null;
|
||||||
@ -74,7 +74,6 @@ class PeopleStore {
|
|||||||
this.filterStore = new FilterStore();
|
this.filterStore = new FilterStore();
|
||||||
this.selectionStore = new SelectionStore(this);
|
this.selectionStore = new SelectionStore(this);
|
||||||
this.headerMenuStore = new HeaderMenuStore(this);
|
this.headerMenuStore = new HeaderMenuStore(this);
|
||||||
this.avatarEditorStore = new AvatarEditorStore(this);
|
|
||||||
this.inviteLinksStore = new InviteLinksStore(this);
|
this.inviteLinksStore = new InviteLinksStore(this);
|
||||||
this.dialogStore = new DialogStore();
|
this.dialogStore = new DialogStore();
|
||||||
this.userStore = userStore;
|
this.userStore = userStore;
|
||||||
|
@ -1,23 +1,47 @@
|
|||||||
|
/* eslint-disable no-console */
|
||||||
import { makeAutoObservable, runInAction } from "mobx";
|
import { makeAutoObservable, runInAction } from "mobx";
|
||||||
import { cloneDeep } from "lodash";
|
import { cloneDeep } from "lodash";
|
||||||
|
|
||||||
import api from "@docspace/shared/api";
|
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 { toastr } from "@docspace/shared/components/toast";
|
||||||
|
|
||||||
import defaultConfig from "PUBLIC_DIR/scripts/config.json";
|
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 {
|
import {
|
||||||
PluginFileType,
|
PluginFileType,
|
||||||
PluginScopes,
|
PluginScopes,
|
||||||
PluginUsersType,
|
PluginUsersType,
|
||||||
PluginStatus,
|
PluginStatus,
|
||||||
} from "SRC_DIR/helpers/plugins/constants";
|
PluginDevices,
|
||||||
import { getPluginUrl, messageActions } from "SRC_DIR/helpers/plugins/utils";
|
} from "../helpers/plugins/enums";
|
||||||
|
|
||||||
let { api: apiConf, proxy: proxyConf } = defaultConfig;
|
import SelectedFolderStore from "./SelectedFolderStore";
|
||||||
let { orign: apiOrigin, prefix: apiPrefix } = apiConf;
|
|
||||||
let { url: proxyURL } = proxyConf;
|
const { api: apiConf, proxy: proxyConf } = defaultConfig;
|
||||||
|
const { origin: apiOrigin, prefix: apiPrefix } = apiConf;
|
||||||
|
const { url: proxyURL } = proxyConf;
|
||||||
|
|
||||||
const origin =
|
const origin =
|
||||||
window.DocSpaceConfig?.api?.origin || apiOrigin || window.location.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;
|
const prefix = window.DocSpaceConfig?.api?.prefix || apiPrefix;
|
||||||
|
|
||||||
class PluginStore {
|
class PluginStore {
|
||||||
settingsStore = null;
|
private settingsStore: SettingsStore = {} as SettingsStore;
|
||||||
selectedFolderStore = null;
|
|
||||||
userStore = null;
|
|
||||||
|
|
||||||
plugins = null;
|
private selectedFolderStore: SelectedFolderStore = {} as SelectedFolderStore;
|
||||||
|
|
||||||
contextMenuItems = null;
|
private userStore: UserStore = {} as UserStore;
|
||||||
infoPanelItems = null;
|
|
||||||
mainButtonItems = null;
|
|
||||||
profileMenuItems = null;
|
|
||||||
eventListenerItems = null;
|
|
||||||
fileItems = null;
|
|
||||||
|
|
||||||
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;
|
isInit = false;
|
||||||
|
|
||||||
settingsPluginDialogVisible = false;
|
settingsPluginDialogVisible = false;
|
||||||
currentSettingsDialogPlugin = null;
|
|
||||||
|
currentSettingsDialogPlugin: null | { pluginName: string } = null;
|
||||||
|
|
||||||
pluginDialogVisible = false;
|
pluginDialogVisible = false;
|
||||||
pluginDialogProps = null;
|
|
||||||
|
pluginDialogProps: null | ModalDialogProps = null;
|
||||||
|
|
||||||
deletePluginDialogVisible = false;
|
deletePluginDialogVisible = false;
|
||||||
deletePluginDialogProps = null;
|
|
||||||
|
deletePluginDialogProps: null | { pluginName: string } = null;
|
||||||
|
|
||||||
isLoading = true;
|
isLoading = true;
|
||||||
|
|
||||||
isEmptyList = false;
|
isEmptyList = false;
|
||||||
|
|
||||||
constructor(settingsStore, selectedFolderStore, userStore) {
|
constructor(
|
||||||
|
settingsStore: SettingsStore,
|
||||||
|
selectedFolderStore: SelectedFolderStore,
|
||||||
|
userStore: UserStore,
|
||||||
|
) {
|
||||||
this.settingsStore = settingsStore;
|
this.settingsStore = settingsStore;
|
||||||
this.selectedFolderStore = selectedFolderStore;
|
this.selectedFolderStore = selectedFolderStore;
|
||||||
this.userStore = userStore;
|
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);
|
makeAutoObservable(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
setIsLoading = (value) => {
|
setIsLoading = (value: boolean) => {
|
||||||
this.isLoading = value;
|
this.isLoading = value;
|
||||||
};
|
};
|
||||||
|
|
||||||
setIsEmptyList = (value) => {
|
setIsEmptyList = (value: boolean) => {
|
||||||
this.isEmptyList = value;
|
this.isEmptyList = value;
|
||||||
};
|
};
|
||||||
|
|
||||||
setCurrentSettingsDialogPlugin = (value) => {
|
setCurrentSettingsDialogPlugin = (value: null | { pluginName: string }) => {
|
||||||
this.currentSettingsDialogPlugin = value;
|
this.currentSettingsDialogPlugin = value;
|
||||||
};
|
};
|
||||||
|
|
||||||
setSettingsPluginDialogVisible = (value) => {
|
setSettingsPluginDialogVisible = (value: boolean) => {
|
||||||
this.settingsPluginDialogVisible = value;
|
this.settingsPluginDialogVisible = value;
|
||||||
};
|
};
|
||||||
|
|
||||||
setPluginDialogVisible = (value) => {
|
setPluginDialogVisible = (value: boolean) => {
|
||||||
this.pluginDialogVisible = value;
|
this.pluginDialogVisible = value;
|
||||||
};
|
};
|
||||||
|
|
||||||
setPluginDialogProps = (value) => {
|
setPluginDialogProps = (value: null | ModalDialogProps) => {
|
||||||
this.pluginDialogProps = value;
|
this.pluginDialogProps = value;
|
||||||
};
|
};
|
||||||
|
|
||||||
setDeletePluginDialogVisible = (value) => {
|
setDeletePluginDialogVisible = (value: boolean) => {
|
||||||
this.deletePluginDialogVisible = value;
|
this.deletePluginDialogVisible = value;
|
||||||
};
|
};
|
||||||
|
|
||||||
setDeletePluginDialogProps = (value) => {
|
setDeletePluginDialogProps = (value: null | { pluginName: string }) => {
|
||||||
this.deletePluginDialogProps = value;
|
this.deletePluginDialogProps = value;
|
||||||
};
|
};
|
||||||
|
|
||||||
updatePluginStatus = (name) => {
|
updatePluginStatus = (name: string) => {
|
||||||
const plugin = this.plugins.find((p) => p.name === name);
|
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);
|
const pluginIdx = this.plugins.findIndex((p) => p.name === name);
|
||||||
|
|
||||||
if (pluginIdx !== -1) {
|
if (pluginIdx !== -1) {
|
||||||
if (this.plugins[pluginIdx].status === newStatus) return;
|
if (this.plugins[pluginIdx].status === newStatus) return;
|
||||||
|
|
||||||
this.plugins[pluginIdx].status = newStatus;
|
this.plugins[pluginIdx].status = newStatus || PluginStatus.active;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
newStatus === PluginStatus.active &&
|
newStatus === PluginStatus.active &&
|
||||||
@ -148,23 +178,25 @@ class PluginStore {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
setPluginFrame = (frame) => {
|
setPluginFrame = (frame: HTMLIFrameElement) => {
|
||||||
this.pluginFrame = frame;
|
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;
|
this.isInit = isInit;
|
||||||
};
|
};
|
||||||
|
|
||||||
initPlugins = async () => {
|
initPlugins = async () => {
|
||||||
const frame = document.createElement("iframe");
|
const frame = document.createElement("iframe");
|
||||||
frame.id = "plugin-iframe";
|
frame.id = "plugin-iframe";
|
||||||
frame.width = 0;
|
frame.width = "0px";
|
||||||
frame.height = 0;
|
frame.height = "0px";
|
||||||
frame.style.display = "none";
|
frame.style.display = "none";
|
||||||
frame.sandbox = "allow-same-origin allow-scripts";
|
// frame.sandbox = "allow-same-origin allow-scripts";
|
||||||
|
|
||||||
document.body.appendChild(frame);
|
document.body.appendChild(frame);
|
||||||
|
|
||||||
@ -176,14 +208,17 @@ class PluginStore {
|
|||||||
};
|
};
|
||||||
|
|
||||||
updatePlugins = async () => {
|
updatePlugins = async () => {
|
||||||
|
if (!this.userStore || !this.userStore.user) return;
|
||||||
|
|
||||||
const { isAdmin, isOwner } = this.userStore.user;
|
const { isAdmin, isOwner } = this.userStore.user;
|
||||||
|
|
||||||
this.setIsLoading(true);
|
this.setIsLoading(true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.plugins = [];
|
this.plugins = [];
|
||||||
|
|
||||||
const plugins = await api.plugins.getPlugins(
|
const plugins = await api.plugins.getPlugins(
|
||||||
!isAdmin && !isOwner ? true : null
|
!isAdmin && !isOwner ? true : null,
|
||||||
);
|
);
|
||||||
|
|
||||||
this.setIsEmptyList(plugins.length === 0);
|
this.setIsEmptyList(plugins.length === 0);
|
||||||
@ -197,19 +232,19 @@ class PluginStore {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
addPlugin = async (data) => {
|
addPlugin = async (data: FormData) => {
|
||||||
try {
|
try {
|
||||||
const plugin = await api.plugins.addPlugin(data);
|
const plugin = await api.plugins.addPlugin(data);
|
||||||
|
|
||||||
this.initPlugin(plugin);
|
this.initPlugin(plugin);
|
||||||
} catch (e) {
|
} 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);
|
const pluginIdx = this.plugins.findIndex((p) => p.name === name);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -229,44 +264,52 @@ class PluginStore {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
initPlugin = (plugin, callback) => {
|
initPlugin = (plugin: TAPIPlugin, callback?: (plugin: TPlugin) => void) => {
|
||||||
const onLoad = async () => {
|
const onLoad = async () => {
|
||||||
|
const iWindow = this.pluginFrame?.contentWindow as IframeWindow;
|
||||||
|
|
||||||
const newPlugin = cloneDeep({
|
const newPlugin = cloneDeep({
|
||||||
...plugin,
|
...plugin,
|
||||||
...this.pluginFrame.contentWindow.Plugins[plugin.pluginName],
|
...iWindow?.Plugins?.[plugin.pluginName],
|
||||||
});
|
});
|
||||||
|
|
||||||
newPlugin.createBy = newPlugin.createBy.displayName;
|
newPlugin.scopes =
|
||||||
newPlugin.scopes = newPlugin.scopes.split(",");
|
typeof newPlugin.scopes === "string"
|
||||||
|
? newPlugin.scopes.split(",")
|
||||||
|
: newPlugin.scopes;
|
||||||
|
|
||||||
newPlugin.iconUrl = getPluginUrl(newPlugin.url, "");
|
newPlugin.iconUrl = getPluginUrl(newPlugin.url, "");
|
||||||
|
|
||||||
this.installPlugin(newPlugin);
|
this.installPlugin(newPlugin);
|
||||||
|
|
||||||
if (newPlugin.scopes.includes(PluginScopes.Settings)) {
|
if (newPlugin.scopes.includes(PluginScopes.Settings)) {
|
||||||
newPlugin.setAdminPluginSettingsValue(plugin.settings || null);
|
newPlugin.setAdminPluginSettingsValue?.(plugin.settings || null);
|
||||||
}
|
}
|
||||||
|
|
||||||
callback && callback(newPlugin);
|
callback?.(newPlugin);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onError = () => {};
|
const onError = () => {};
|
||||||
|
|
||||||
const frameDoc = this.pluginFrame.contentDocument;
|
const frameDoc = this.pluginFrame?.contentDocument;
|
||||||
|
|
||||||
const script = frameDoc.createElement("script");
|
const script = frameDoc?.createElement("script");
|
||||||
script.setAttribute("type", "text/javascript");
|
|
||||||
script.setAttribute("id", `${plugin.name}`);
|
|
||||||
|
|
||||||
if (onLoad) script.onload = onLoad.bind(this);
|
if (script) {
|
||||||
if (onError) script.onerror = onError.bind(this);
|
script.setAttribute("type", "text/javascript");
|
||||||
|
script.setAttribute("id", `${plugin.name}`);
|
||||||
|
|
||||||
script.src = plugin.url;
|
if (onLoad) script.onload = onLoad.bind(this);
|
||||||
script.async = true;
|
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) {
|
if (addToList) {
|
||||||
const idx = this.plugins.findIndex((p) => p.name === plugin.name);
|
const idx = this.plugins.findIndex((p) => p.name === plugin.name);
|
||||||
|
|
||||||
@ -284,7 +327,7 @@ class PluginStore {
|
|||||||
if (!plugin || !plugin.enabled) return;
|
if (!plugin || !plugin.enabled) return;
|
||||||
|
|
||||||
if (plugin.scopes.includes(PluginScopes.API)) {
|
if (plugin.scopes.includes(PluginScopes.API)) {
|
||||||
plugin.setAPI && plugin.setAPI(origin, proxy, prefix);
|
plugin.setAPI?.(origin, proxy, prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
const { name } = plugin;
|
const { name } = plugin;
|
||||||
@ -322,21 +365,22 @@ class PluginStore {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
updatePlugin = async (name, status, settings) => {
|
updatePlugin = async (name: string, status: boolean, settings: string) => {
|
||||||
try {
|
try {
|
||||||
let currentSettings = settings;
|
let currentSettings = settings;
|
||||||
let currentStatus = status;
|
let currentStatus = status;
|
||||||
|
|
||||||
const oldPlugin = this.pluginList.find((p) => p.name === name);
|
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(
|
const plugin = await api.plugins.updatePlugin(
|
||||||
name,
|
name,
|
||||||
currentStatus,
|
currentStatus,
|
||||||
currentSettings
|
currentSettings,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (typeof status !== "boolean") return plugin;
|
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);
|
const plugin = this.plugins.find((p) => p.name === name);
|
||||||
|
|
||||||
if (!plugin) return;
|
if (!plugin) return;
|
||||||
@ -363,7 +407,7 @@ class PluginStore {
|
|||||||
this.installPlugin(plugin, false);
|
this.installPlugin(plugin, false);
|
||||||
};
|
};
|
||||||
|
|
||||||
deactivatePlugin = async (name) => {
|
deactivatePlugin = async (name: string) => {
|
||||||
const plugin = this.plugins.find((p) => p.name === name);
|
const plugin = this.plugins.find((p) => p.name === name);
|
||||||
|
|
||||||
if (!plugin) return;
|
if (!plugin) return;
|
||||||
@ -416,23 +460,29 @@ class PluginStore {
|
|||||||
};
|
};
|
||||||
|
|
||||||
getCurrentDevice = () => {
|
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;
|
if (!this.contextMenuItems) return;
|
||||||
|
|
||||||
const userRole = this.getUserRole();
|
const userRole = this.getUserRole();
|
||||||
const device = this.getCurrentDevice();
|
const device = this.getCurrentDevice();
|
||||||
|
|
||||||
const itemsMap = Array.from(this.contextMenuItems);
|
const itemsMap = Array.from(this.contextMenuItems);
|
||||||
const keys = [];
|
const keys: string[] = [];
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case PluginFileType.Files:
|
case PluginFileType.Files:
|
||||||
itemsMap.forEach(([key, item]) => {
|
itemsMap.forEach((val) => {
|
||||||
|
const item = val[1];
|
||||||
|
|
||||||
if (!item.fileType) return;
|
if (!item.fileType) return;
|
||||||
|
|
||||||
if (item.fileType.includes(PluginFileType.Files)) {
|
if (item.fileType.includes(PluginFileType.Files)) {
|
||||||
@ -440,8 +490,8 @@ class PluginStore {
|
|||||||
? item.fileExt.includes(fileExst)
|
? item.fileExt.includes(fileExst)
|
||||||
: true;
|
: true;
|
||||||
|
|
||||||
const correctUserType = item.usersType
|
const correctUserType = item.usersTypes
|
||||||
? item.usersType.includes(userRole)
|
? item.usersTypes.includes(userRole)
|
||||||
: true;
|
: true;
|
||||||
|
|
||||||
const correctDevice = item.devices
|
const correctDevice = item.devices
|
||||||
@ -449,7 +499,8 @@ class PluginStore {
|
|||||||
: true;
|
: true;
|
||||||
|
|
||||||
const correctSecurity = item.security
|
const correctSecurity = item.security
|
||||||
? item.security.every((key) => security?.[key])
|
? // @ts-expect-error its valid key
|
||||||
|
item.security.every((key) => security?.[key])
|
||||||
: true;
|
: true;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@ -463,12 +514,12 @@ class PluginStore {
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case PluginFileType.Folders:
|
case PluginFileType.Folders:
|
||||||
itemsMap.forEach(([key, item]) => {
|
itemsMap.forEach((val) => {
|
||||||
if (!item.fileType) return;
|
const item = val[1];
|
||||||
|
|
||||||
if (item.fileType.includes(PluginFileType.Folders)) {
|
if (item.fileType?.includes(PluginFileType.Folders)) {
|
||||||
const correctUserType = item.usersType
|
const correctUserType = item.usersTypes
|
||||||
? item.usersType.includes(userRole)
|
? item.usersTypes.includes(userRole)
|
||||||
: true;
|
: true;
|
||||||
|
|
||||||
const correctDevice = item.devices
|
const correctDevice = item.devices
|
||||||
@ -476,7 +527,8 @@ class PluginStore {
|
|||||||
: true;
|
: true;
|
||||||
|
|
||||||
const correctSecurity = item.security
|
const correctSecurity = item.security
|
||||||
? item?.security?.every((key) => security?.[key])
|
? // @ts-expect-error its valid key
|
||||||
|
item.security.every((key) => security?.[key])
|
||||||
: true;
|
: true;
|
||||||
|
|
||||||
if (correctUserType && correctDevice && correctSecurity)
|
if (correctUserType && correctDevice && correctSecurity)
|
||||||
@ -485,12 +537,12 @@ class PluginStore {
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case PluginFileType.Rooms:
|
case PluginFileType.Rooms:
|
||||||
itemsMap.forEach(([key, item]) => {
|
itemsMap.forEach((val) => {
|
||||||
if (!item.fileType) return;
|
const item = val[1];
|
||||||
|
|
||||||
if (item.fileType.includes(PluginFileType.Rooms)) {
|
if (item.fileType?.includes(PluginFileType.Rooms)) {
|
||||||
const correctUserType = item.usersType
|
const correctUserType = item.usersTypes
|
||||||
? item.usersType.includes(userRole)
|
? item.usersTypes.includes(userRole)
|
||||||
: true;
|
: true;
|
||||||
|
|
||||||
const correctDevice = item.devices
|
const correctDevice = item.devices
|
||||||
@ -498,7 +550,8 @@ class PluginStore {
|
|||||||
: true;
|
: true;
|
||||||
|
|
||||||
const correctSecurity = item.security
|
const correctSecurity = item.security
|
||||||
? item.security.every((key) => security?.[key])
|
? // @ts-expect-error its valid key
|
||||||
|
item.security.every((key) => security?.[key])
|
||||||
: true;
|
: true;
|
||||||
|
|
||||||
if (correctUserType && correctDevice && correctSecurity)
|
if (correctUserType && correctDevice && correctSecurity)
|
||||||
@ -507,16 +560,16 @@ class PluginStore {
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case PluginFileType.Image:
|
case PluginFileType.Image:
|
||||||
itemsMap.forEach(([key, item]) => {
|
itemsMap.forEach((val) => {
|
||||||
if (!item.fileType) return;
|
const item = val[1];
|
||||||
|
|
||||||
if (item.fileType.includes(PluginFileType.Image)) {
|
if (item.fileType?.includes(PluginFileType.Image)) {
|
||||||
const correctFileExt = item.fileExt
|
const correctFileExt = item.fileExt
|
||||||
? item.fileExt.includes(fileExst)
|
? item.fileExt.includes(fileExst)
|
||||||
: true;
|
: true;
|
||||||
|
|
||||||
const correctUserType = item.usersType
|
const correctUserType = item.usersTypes
|
||||||
? item.usersType.includes(userRole)
|
? item.usersTypes.includes(userRole)
|
||||||
: true;
|
: true;
|
||||||
|
|
||||||
const correctDevice = item.devices
|
const correctDevice = item.devices
|
||||||
@ -524,7 +577,8 @@ class PluginStore {
|
|||||||
: true;
|
: true;
|
||||||
|
|
||||||
const correctSecurity = item.security
|
const correctSecurity = item.security
|
||||||
? item.security.every((key) => security?.[key])
|
? // @ts-expect-error its valid key
|
||||||
|
item.security.every((key) => security?.[key])
|
||||||
: true;
|
: true;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@ -538,12 +592,12 @@ class PluginStore {
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case PluginFileType.Video:
|
case PluginFileType.Video:
|
||||||
itemsMap.forEach(([key, item]) => {
|
itemsMap.forEach((val) => {
|
||||||
if (!item.fileType) return;
|
const item = val[1];
|
||||||
|
|
||||||
if (item.fileType.includes(PluginFileType.Video)) {
|
if (item.fileType?.includes(PluginFileType.Video)) {
|
||||||
const correctUserType = item.usersType
|
const correctUserType = item.usersTypes
|
||||||
? item.usersType.includes(userRole)
|
? item.usersTypes.includes(userRole)
|
||||||
: true;
|
: true;
|
||||||
|
|
||||||
const correctDevice = item.devices
|
const correctDevice = item.devices
|
||||||
@ -551,7 +605,8 @@ class PluginStore {
|
|||||||
: true;
|
: true;
|
||||||
|
|
||||||
const correctSecurity = item.security
|
const correctSecurity = item.security
|
||||||
? item.security.every((key) => security?.[key])
|
? // @ts-expect-error its valid key
|
||||||
|
item.security.every((key) => security?.[key])
|
||||||
: true;
|
: true;
|
||||||
|
|
||||||
if (correctUserType && correctDevice && correctSecurity)
|
if (correctUserType && correctDevice && correctSecurity)
|
||||||
@ -560,11 +615,12 @@ class PluginStore {
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
itemsMap.forEach(([key, item]) => {
|
itemsMap.forEach((val) => {
|
||||||
|
const item = val[1];
|
||||||
if (item.fileType) return;
|
if (item.fileType) return;
|
||||||
|
|
||||||
const correctUserType = item.usersType
|
const correctUserType = item.usersTypes
|
||||||
? item.usersType.includes(userRole)
|
? item.usersTypes.includes(userRole)
|
||||||
: true;
|
: true;
|
||||||
|
|
||||||
const correctDevice = item.devices
|
const correctDevice = item.devices
|
||||||
@ -572,7 +628,8 @@ class PluginStore {
|
|||||||
: true;
|
: true;
|
||||||
|
|
||||||
const correctSecurity = item.security
|
const correctSecurity = item.security
|
||||||
? item.security.every((key) => security?.[key])
|
? // @ts-expect-error its valid key
|
||||||
|
item.security.every((key) => security?.[key])
|
||||||
: true;
|
: true;
|
||||||
|
|
||||||
if (correctUserType && correctDevice && correctSecurity)
|
if (correctUserType && correctDevice && correctSecurity)
|
||||||
@ -585,7 +642,7 @@ class PluginStore {
|
|||||||
return keys;
|
return keys;
|
||||||
};
|
};
|
||||||
|
|
||||||
updateContextMenuItems = (name) => {
|
updateContextMenuItems = (name: string) => {
|
||||||
const plugin = this.plugins.find((p) => p.name === name);
|
const plugin = this.plugins.find((p) => p.name === name);
|
||||||
|
|
||||||
if (!plugin || !plugin.enabled) return;
|
if (!plugin || !plugin.enabled) return;
|
||||||
@ -594,8 +651,8 @@ class PluginStore {
|
|||||||
|
|
||||||
if (!items) return;
|
if (!items) return;
|
||||||
|
|
||||||
Array.from(items).map(([key, value]) => {
|
Array.from(items).forEach(([key, value]) => {
|
||||||
const onClick = async (fileId) => {
|
const onClick = async (fileId: number) => {
|
||||||
if (!value.onClick) return;
|
if (!value.onClick) return;
|
||||||
|
|
||||||
const message = await value.onClick(fileId);
|
const message = await value.onClick(fileId);
|
||||||
@ -618,7 +675,7 @@ class PluginStore {
|
|||||||
this.updateMainButtonItems,
|
this.updateMainButtonItems,
|
||||||
this.updateProfileMenuItems,
|
this.updateProfileMenuItems,
|
||||||
this.updateEventListenerItems,
|
this.updateEventListenerItems,
|
||||||
this.updateFileItems
|
this.updateFileItems,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -633,19 +690,19 @@ class PluginStore {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
deactivateContextMenuItems = (plugin) => {
|
deactivateContextMenuItems = (plugin: TPlugin) => {
|
||||||
if (!plugin) return;
|
if (!plugin) return;
|
||||||
|
|
||||||
const items = plugin.getContextMenuItems && plugin.getContextMenuItems();
|
const items = plugin.getContextMenuItems?.();
|
||||||
|
|
||||||
if (!items) return;
|
if (!items) return;
|
||||||
|
|
||||||
Array.from(items).map(([key, value]) => {
|
Array.from(items).forEach(([key]) => {
|
||||||
this.contextMenuItems.delete(key);
|
this.contextMenuItems.delete(key);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
updateInfoPanelItems = (name) => {
|
updateInfoPanelItems = (name: string) => {
|
||||||
const plugin = this.plugins.find((p) => p.name === name);
|
const plugin = this.plugins.find((p) => p.name === name);
|
||||||
|
|
||||||
if (!plugin || !plugin.enabled) return;
|
if (!plugin || !plugin.enabled) return;
|
||||||
@ -657,9 +714,9 @@ class PluginStore {
|
|||||||
const userRole = this.getUserRole();
|
const userRole = this.getUserRole();
|
||||||
const device = this.getCurrentDevice();
|
const device = this.getCurrentDevice();
|
||||||
|
|
||||||
Array.from(items).map(([key, value]) => {
|
Array.from(items).forEach(([key, value]) => {
|
||||||
const correctUserType = value.usersType
|
const correctUserType = value.usersTypes
|
||||||
? value.usersType.includes(userRole)
|
? value.usersTypes.includes(userRole)
|
||||||
: true;
|
: true;
|
||||||
|
|
||||||
const correctDevice = value.devices
|
const correctDevice = value.devices
|
||||||
@ -671,8 +728,8 @@ class PluginStore {
|
|||||||
const submenu = { ...value.subMenu };
|
const submenu = { ...value.subMenu };
|
||||||
|
|
||||||
if (value.subMenu.onClick) {
|
if (value.subMenu.onClick) {
|
||||||
const onClick = async () => {
|
const onClick = async (id: number) => {
|
||||||
const message = await value.subMenu.onClick();
|
const message = await value?.subMenu?.onClick?.(id);
|
||||||
|
|
||||||
messageActions(
|
messageActions(
|
||||||
message,
|
message,
|
||||||
@ -692,7 +749,7 @@ class PluginStore {
|
|||||||
this.updateMainButtonItems,
|
this.updateMainButtonItems,
|
||||||
this.updateProfileMenuItems,
|
this.updateProfileMenuItems,
|
||||||
this.updateEventListenerItems,
|
this.updateEventListenerItems,
|
||||||
this.updateFileItems
|
this.updateFileItems,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -708,31 +765,31 @@ class PluginStore {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
deactivateInfoPanelItems = (plugin) => {
|
deactivateInfoPanelItems = (plugin: TPlugin) => {
|
||||||
if (!plugin) return;
|
if (!plugin) return;
|
||||||
|
|
||||||
const items = plugin.getInfoPanelItems && plugin.getInfoPanelItems();
|
const items = plugin.getInfoPanelItems && plugin.getInfoPanelItems();
|
||||||
|
|
||||||
if (!items) return;
|
if (!items) return;
|
||||||
|
|
||||||
Array.from(items).map(([key, value]) => {
|
Array.from(items).forEach(([key]) => {
|
||||||
this.infoPanelItems.delete(key);
|
this.infoPanelItems.delete(key);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
updateMainButtonItems = (name) => {
|
updateMainButtonItems = (name: string) => {
|
||||||
const plugin = this.plugins.find((p) => p.name === name);
|
const plugin = this.plugins.find((p) => p.name === name);
|
||||||
|
|
||||||
if (!plugin || !plugin.enabled) return;
|
if (!plugin || !plugin.enabled) return;
|
||||||
|
|
||||||
const items = plugin.getMainButtonItems && plugin.getMainButtonItems();
|
const items = plugin.getMainButtonItems?.();
|
||||||
|
|
||||||
if (!items) return;
|
if (!items) return;
|
||||||
|
|
||||||
const userRole = this.getUserRole();
|
const userRole = this.getUserRole();
|
||||||
const device = this.getCurrentDevice();
|
const device = this.getCurrentDevice();
|
||||||
|
|
||||||
Array.from(items).map(([key, value]) => {
|
Array.from(items).forEach(([key, value]) => {
|
||||||
const correctUserType = value.usersType
|
const correctUserType = value.usersType
|
||||||
? value.usersType.includes(userRole)
|
? value.usersType.includes(userRole)
|
||||||
: true;
|
: true;
|
||||||
@ -743,11 +800,12 @@ class PluginStore {
|
|||||||
|
|
||||||
if (!correctUserType || !correctDevice) return;
|
if (!correctUserType || !correctDevice) return;
|
||||||
|
|
||||||
const newItems = [];
|
const newItems: IMainButtonItem[] = [];
|
||||||
if (value.items) {
|
const storeId = this.selectedFolderStore.id;
|
||||||
|
if (value.items && storeId) {
|
||||||
value.items.forEach((i) => {
|
value.items.forEach((i) => {
|
||||||
const onClick = async () => {
|
const onClick = async () => {
|
||||||
const message = await i.onClick(this.selectedFolderStore.id);
|
const message = await i?.onClick?.(storeId);
|
||||||
|
|
||||||
messageActions(
|
messageActions(
|
||||||
message,
|
message,
|
||||||
@ -767,7 +825,7 @@ class PluginStore {
|
|||||||
this.updateMainButtonItems,
|
this.updateMainButtonItems,
|
||||||
this.updateProfileMenuItems,
|
this.updateProfileMenuItems,
|
||||||
this.updateEventListenerItems,
|
this.updateEventListenerItems,
|
||||||
this.updateFileItems
|
this.updateFileItems,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -781,8 +839,9 @@ class PluginStore {
|
|||||||
|
|
||||||
const onClick = async () => {
|
const onClick = async () => {
|
||||||
if (!value.onClick) return;
|
if (!value.onClick) return;
|
||||||
|
if (!storeId) return;
|
||||||
|
|
||||||
const message = await value.onClick(this.selectedFolderStore.id);
|
const message = await value.onClick(storeId);
|
||||||
|
|
||||||
messageActions(
|
messageActions(
|
||||||
message,
|
message,
|
||||||
@ -802,7 +861,7 @@ class PluginStore {
|
|||||||
this.updateMainButtonItems,
|
this.updateMainButtonItems,
|
||||||
this.updateProfileMenuItems,
|
this.updateProfileMenuItems,
|
||||||
this.updateEventListenerItems,
|
this.updateEventListenerItems,
|
||||||
this.updateFileItems
|
this.updateFileItems,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -818,19 +877,19 @@ class PluginStore {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
deactivateMainButtonItems = (plugin) => {
|
deactivateMainButtonItems = (plugin: TPlugin) => {
|
||||||
if (!plugin) return;
|
if (!plugin) return;
|
||||||
|
|
||||||
const items = plugin.getMainButtonItems && plugin.getMainButtonItems();
|
const items = plugin.getMainButtonItems && plugin.getMainButtonItems();
|
||||||
|
|
||||||
if (!items) return;
|
if (!items) return;
|
||||||
|
|
||||||
Array.from(items).map(([key, value]) => {
|
Array.from(items).forEach(([key]) => {
|
||||||
this.mainButtonItems.delete(key);
|
this.mainButtonItems.delete(key);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
updateProfileMenuItems = (name) => {
|
updateProfileMenuItems = (name: string) => {
|
||||||
const plugin = this.plugins.find((p) => p.name === name);
|
const plugin = this.plugins.find((p) => p.name === name);
|
||||||
|
|
||||||
if (!plugin || !plugin.enabled) return;
|
if (!plugin || !plugin.enabled) return;
|
||||||
@ -842,7 +901,7 @@ class PluginStore {
|
|||||||
const userRole = this.getUserRole();
|
const userRole = this.getUserRole();
|
||||||
const device = this.getCurrentDevice();
|
const device = this.getCurrentDevice();
|
||||||
|
|
||||||
Array.from(items).map(([key, value]) => {
|
Array.from(items).forEach(([key, value]) => {
|
||||||
const correctUserType = value.usersType
|
const correctUserType = value.usersType
|
||||||
? value.usersType.includes(userRole)
|
? value.usersType.includes(userRole)
|
||||||
: true;
|
: true;
|
||||||
@ -876,7 +935,7 @@ class PluginStore {
|
|||||||
this.updateMainButtonItems,
|
this.updateMainButtonItems,
|
||||||
this.updateProfileMenuItems,
|
this.updateProfileMenuItems,
|
||||||
this.updateEventListenerItems,
|
this.updateEventListenerItems,
|
||||||
this.updateFileItems
|
this.updateFileItems,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -891,19 +950,19 @@ class PluginStore {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
deactivateProfileMenuItems = (plugin) => {
|
deactivateProfileMenuItems = (plugin: TPlugin) => {
|
||||||
if (!plugin) return;
|
if (!plugin) return;
|
||||||
|
|
||||||
const items = plugin.getProfileMenuItems && plugin.getProfileMenuItems();
|
const items = plugin.getProfileMenuItems && plugin.getProfileMenuItems();
|
||||||
|
|
||||||
if (!items) return;
|
if (!items) return;
|
||||||
|
|
||||||
Array.from(items).map(([key, value]) => {
|
Array.from(items).forEach(([key]) => {
|
||||||
this.profileMenuItems.delete(key);
|
this.profileMenuItems.delete(key);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
updateEventListenerItems = (name) => {
|
updateEventListenerItems = (name: string) => {
|
||||||
const plugin = this.plugins.find((p) => p.name === name);
|
const plugin = this.plugins.find((p) => p.name === name);
|
||||||
|
|
||||||
if (!plugin || !plugin.enabled) return;
|
if (!plugin || !plugin.enabled) return;
|
||||||
@ -916,9 +975,9 @@ class PluginStore {
|
|||||||
const userRole = this.getUserRole();
|
const userRole = this.getUserRole();
|
||||||
const device = this.getCurrentDevice();
|
const device = this.getCurrentDevice();
|
||||||
|
|
||||||
Array.from(items).map(([key, value]) => {
|
Array.from(items).forEach(([key, value]) => {
|
||||||
const correctUserType = value.usersType
|
const correctUserType = value.usersTypes
|
||||||
? value.usersType.includes(userRole)
|
? value.usersTypes.includes(userRole)
|
||||||
: true;
|
: true;
|
||||||
|
|
||||||
const correctDevice = value.devices
|
const correctDevice = value.devices
|
||||||
@ -926,10 +985,10 @@ class PluginStore {
|
|||||||
: true;
|
: true;
|
||||||
|
|
||||||
if (!correctUserType || !correctDevice) return;
|
if (!correctUserType || !correctDevice) return;
|
||||||
const eventHandler = async (e) => {
|
const eventHandler = async () => {
|
||||||
if (!value.eventHandler) return;
|
if (!value.eventHandler) return;
|
||||||
|
|
||||||
const message = await value.eventHandler(e);
|
const message = await value.eventHandler();
|
||||||
|
|
||||||
messageActions(
|
messageActions(
|
||||||
message,
|
message,
|
||||||
@ -949,7 +1008,7 @@ class PluginStore {
|
|||||||
this.updateMainButtonItems,
|
this.updateMainButtonItems,
|
||||||
this.updateProfileMenuItems,
|
this.updateProfileMenuItems,
|
||||||
this.updateEventListenerItems,
|
this.updateEventListenerItems,
|
||||||
this.updateFileItems
|
this.updateFileItems,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -962,7 +1021,7 @@ class PluginStore {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
deactivateEventListenerItems = (plugin) => {
|
deactivateEventListenerItems = (plugin: TPlugin) => {
|
||||||
if (!plugin) return;
|
if (!plugin) return;
|
||||||
|
|
||||||
const items =
|
const items =
|
||||||
@ -970,12 +1029,12 @@ class PluginStore {
|
|||||||
|
|
||||||
if (!items) return;
|
if (!items) return;
|
||||||
|
|
||||||
Array.from(items).map(([key, value]) => {
|
Array.from(items).forEach(([key]) => {
|
||||||
this.eventListenerItems.delete(key);
|
this.eventListenerItems.delete(key);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
updateFileItems = (name) => {
|
updateFileItems = (name: string) => {
|
||||||
const plugin = this.plugins.find((p) => p.name === name);
|
const plugin = this.plugins.find((p) => p.name === name);
|
||||||
|
|
||||||
if (!plugin || !plugin.enabled) return;
|
if (!plugin || !plugin.enabled) return;
|
||||||
@ -986,7 +1045,7 @@ class PluginStore {
|
|||||||
|
|
||||||
const userRole = this.getUserRole();
|
const userRole = this.getUserRole();
|
||||||
|
|
||||||
Array.from(items).map(([key, value]) => {
|
Array.from(items).forEach(([key, value]) => {
|
||||||
const correctUserType = value.usersType
|
const correctUserType = value.usersType
|
||||||
? value.usersType.includes(userRole)
|
? value.usersType.includes(userRole)
|
||||||
: true;
|
: true;
|
||||||
@ -996,7 +1055,7 @@ class PluginStore {
|
|||||||
const fileIcon = `${plugin.iconUrl}/assets/${value.fileRowIcon}`;
|
const fileIcon = `${plugin.iconUrl}/assets/${value.fileRowIcon}`;
|
||||||
const fileIconTile = `${plugin.iconUrl}/assets/${value.fileTileIcon}`;
|
const fileIconTile = `${plugin.iconUrl}/assets/${value.fileTileIcon}`;
|
||||||
|
|
||||||
const onClick = async (item) => {
|
const onClick = async (item: TFile) => {
|
||||||
const device = this.getCurrentDevice();
|
const device = this.getCurrentDevice();
|
||||||
const correctDevice = value.devices
|
const correctDevice = value.devices
|
||||||
? value.devices.includes(device)
|
? value.devices.includes(device)
|
||||||
@ -1023,7 +1082,7 @@ class PluginStore {
|
|||||||
this.updateMainButtonItems,
|
this.updateMainButtonItems,
|
||||||
this.updateProfileMenuItems,
|
this.updateProfileMenuItems,
|
||||||
this.updateEventListenerItems,
|
this.updateEventListenerItems,
|
||||||
this.updateFileItems
|
this.updateFileItems,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1038,14 +1097,14 @@ class PluginStore {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
deactivateFileItems = (plugin) => {
|
deactivateFileItems = (plugin: TPlugin) => {
|
||||||
if (!plugin) return;
|
if (!plugin) return;
|
||||||
|
|
||||||
const items = plugin.getFileItems && plugin.getFileItems();
|
const items = plugin.getFileItems && plugin.getFileItems();
|
||||||
|
|
||||||
if (!items) return;
|
if (!items) return;
|
||||||
|
|
||||||
Array.from(items).map(([key, value]) => {
|
Array.from(items).forEach(([key]) => {
|
||||||
this.fileItems.delete(key);
|
this.fileItems.delete(key);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -1063,14 +1122,15 @@ class PluginStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get contextMenuItemsList() {
|
get contextMenuItemsList() {
|
||||||
const items = [];
|
const items: { key: string; value: IContextMenuItem }[] = Array.from(
|
||||||
|
this.contextMenuItems,
|
||||||
Array.from(this.contextMenuItems, ([key, value]) => {
|
([key, value]) => {
|
||||||
items.push({ key, value: { ...value } });
|
return { key, value: { ...value } };
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
|
||||||
if (items.length > 0) {
|
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;
|
return items;
|
||||||
}
|
}
|
||||||
@ -1079,29 +1139,25 @@ class PluginStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get infoPanelItemsList() {
|
get infoPanelItemsList() {
|
||||||
const items = [];
|
const items = Array.from(this.infoPanelItems, ([key, value]) => {
|
||||||
|
return { key, value: { ...value } };
|
||||||
Array.from(this.infoPanelItems, ([key, value]) => {
|
|
||||||
items.push({ key, value: { ...value } });
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
get profileMenuItemsList() {
|
get profileMenuItemsList() {
|
||||||
const items = [];
|
const items = Array.from(this.profileMenuItems, ([key, value]) => {
|
||||||
|
return {
|
||||||
Array.from(this.profileMenuItems, ([key, value]) => {
|
|
||||||
items.push({
|
|
||||||
key,
|
key,
|
||||||
value: {
|
value: {
|
||||||
...value,
|
...value,
|
||||||
},
|
},
|
||||||
});
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
if (items.length > 0) {
|
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;
|
return items;
|
||||||
}
|
}
|
||||||
@ -1110,19 +1166,17 @@ class PluginStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get mainButtonItemsList() {
|
get mainButtonItemsList() {
|
||||||
const items = [];
|
const items = Array.from(this.mainButtonItems, ([key, value]) => {
|
||||||
|
return {
|
||||||
Array.from(this.mainButtonItems, ([key, value]) => {
|
|
||||||
items.push({
|
|
||||||
key,
|
key,
|
||||||
value: {
|
value: {
|
||||||
...value,
|
...value,
|
||||||
},
|
},
|
||||||
});
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
if (items.length > 0) {
|
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;
|
return items;
|
||||||
}
|
}
|
||||||
@ -1131,15 +1185,13 @@ class PluginStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get eventListenerItemsList() {
|
get eventListenerItemsList() {
|
||||||
const items = [];
|
const items = Array.from(this.eventListenerItems, ([key, value]) => {
|
||||||
|
return {
|
||||||
Array.from(this.eventListenerItems, ([key, value]) => {
|
|
||||||
items.push({
|
|
||||||
key,
|
key,
|
||||||
value: {
|
value: {
|
||||||
...value,
|
...value,
|
||||||
},
|
},
|
||||||
});
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
if (items.length > 0) {
|
if (items.length > 0) {
|
||||||
@ -1150,15 +1202,13 @@ class PluginStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get fileItemsList() {
|
get fileItemsList() {
|
||||||
const items = [];
|
const items = Array.from(this.fileItems, ([key, value]) => {
|
||||||
|
return {
|
||||||
Array.from(this.fileItems, ([key, value]) => {
|
|
||||||
items.push({
|
|
||||||
key,
|
key,
|
||||||
value: {
|
value: {
|
||||||
...value,
|
...value,
|
||||||
},
|
},
|
||||||
});
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
if (items.length > 0) {
|
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