@emailmaker/filemanager 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/app/themeProvider/ThemeProvider.d.ts +7 -0
  2. package/app/themeProvider/index.d.ts +1 -0
  3. package/components/CloseButton/CloseButton.d.ts +10 -0
  4. package/components/EmIcons/EmIcons.d.ts +14 -0
  5. package/components/FileContent/FileContent.d.ts +30 -0
  6. package/components/FileContent/GridView.d.ts +11 -0
  7. package/components/FileManagerApp/ActionsHeader.d.ts +14 -0
  8. package/components/FileManagerApp/FileManagerApp.d.ts +29 -0
  9. package/components/FileModals/FileModals.d.ts +37 -0
  10. package/components/FolderSidebar/FolderSidebar.d.ts +20 -0
  11. package/components/ImageAI/ImageAI.d.ts +4 -0
  12. package/components/ImageAI/SlideShowForImageAI/SlideShowForImageAI.d.ts +7 -0
  13. package/components/ImageAI/useImageAIGeneration/useImageAIGeneration.d.ts +2 -0
  14. package/components/ImageGif/ImageGif.d.ts +4 -0
  15. package/components/ImageStock/ImageStock.d.ts +4 -0
  16. package/components/LimitsCounter/LimitsCounter.d.ts +10 -0
  17. package/components/PixieEditor/PixieEditorIframe.d.ts +10 -0
  18. package/components/PixieEditor/index.d.ts +1 -0
  19. package/components/SearchInput/SearchInput.d.ts +8 -0
  20. package/components/SearchInput/index.d.ts +1 -0
  21. package/components/Tag/index.d.ts +11 -0
  22. package/components/UploadProgress/UploadProgress.d.ts +20 -0
  23. package/components/UploadProgress/index.d.ts +2 -0
  24. package/components/ViewModeToggle/ViewModeToggle.d.ts +9 -0
  25. package/components/index.d.ts +5 -0
  26. package/config/config.d.ts +5 -0
  27. package/config/usersConfigs/index.d.ts +26 -0
  28. package/constants/index.d.ts +11 -0
  29. package/debug-script.js +1 -0
  30. package/dev/index.d.ts +4 -0
  31. package/file-manager.css +1 -0
  32. package/file-manager.d.ts +46 -0
  33. package/file-manager.esm.js +2 -0
  34. package/file-manager.esm.js.map +1 -0
  35. package/file-manager.js +2 -0
  36. package/file-manager.js.LICENSE.txt +110 -0
  37. package/helpers/gtm.d.ts +16 -0
  38. package/hooks/core/context.d.ts +15 -0
  39. package/hooks/core/files/index.d.ts +4 -0
  40. package/hooks/core/files/useFilesAPI.d.ts +16 -0
  41. package/hooks/core/files/useFilesAPIHelpers.d.ts +18 -0
  42. package/hooks/core/files/useFilesModals.d.ts +20 -0
  43. package/hooks/core/files/useFilesSelection.d.ts +10 -0
  44. package/hooks/core/index.d.ts +11 -0
  45. package/hooks/core/temp/context.d.ts +0 -0
  46. package/hooks/core/types.d.ts +160 -0
  47. package/hooks/core/useFiles.d.ts +37 -0
  48. package/hooks/core/useFolderModals.d.ts +13 -0
  49. package/hooks/core/useFolders.d.ts +19 -0
  50. package/hooks/core/useModals.d.ts +17 -0
  51. package/hooks/core/useNavigation.d.ts +15 -0
  52. package/hooks/core/usePagination.d.ts +12 -0
  53. package/hooks/core/useSortAndFilter.d.ts +20 -0
  54. package/hooks/index.d.ts +5 -0
  55. package/hooks/useCustomIcons.d.ts +17 -0
  56. package/hooks/useFileActions.d.ts +21 -0
  57. package/hooks/useFileUpload.d.ts +16 -0
  58. package/hooks/useLastDirectory.d.ts +18 -0
  59. package/hooks/usePixieEditor.d.ts +15 -0
  60. package/hooks/useSidebarResize.d.ts +9 -0
  61. package/hooks/useViewMode.d.ts +7 -0
  62. package/i18n.d.ts +3 -0
  63. package/index.d.ts +13 -0
  64. package/index.html +141 -0
  65. package/loacal_module/pixie/dist/images/empty-canvas-bg.png +0 -0
  66. package/loacal_module/pixie/dist/pixie.es.js +2 -0
  67. package/loacal_module/pixie/dist/pixie.es.js.LICENSE.txt +86 -0
  68. package/loacal_module/pixie/dist/pixie.es.js.map +1 -0
  69. package/loacal_module/pixie/dist/pixie.umd.js +2 -0
  70. package/loacal_module/pixie/dist/pixie.umd.js.LICENSE.txt +116 -0
  71. package/loacal_module/pixie/dist/pixie.umd.js.map +1 -0
  72. package/mockServiceWorker.js +1 -0
  73. package/package.json +30 -0
  74. package/pixie-editor.html +187 -0
  75. package/shared/config.d.ts +13 -0
  76. package/shared/helpers/getParendFolderPath.d.ts +1 -0
  77. package/shared/helpers/index.d.ts +1 -0
  78. package/suppress-resize-observer-errors.js +1 -0
  79. package/test-pixie-loading.html +108 -0
  80. package/types.d.ts +379 -0
  81. package/utils/fileValidation.d.ts +34 -0
  82. package/utils/resizeObserverHandler.d.ts +6 -0
  83. package/utils/themeUtils.d.ts +17 -0
  84. package/widgets/layout/errorBoundary/errorBoundary.d.ts +19 -0
package/types.d.ts ADDED
@@ -0,0 +1,379 @@
1
+ import React, { ReactNode, RefObject } from 'react';
2
+ import { FormInstance } from 'antd/es/form';
3
+ import { MY_FILES, GIF, STOCK_IMAGES, AI, EDITOR } from './constants';
4
+ import type { InputRef } from 'antd';
5
+ export interface Folder {
6
+ id: string;
7
+ name: string;
8
+ parentId?: string | null;
9
+ }
10
+ export interface ThumbnailFile {
11
+ thumbnail: string;
12
+ name?: string;
13
+ id?: string;
14
+ }
15
+ export interface File {
16
+ id: string;
17
+ name: string;
18
+ size: string;
19
+ date: string;
20
+ folderId: string;
21
+ type?: string;
22
+ thumbnail?: string;
23
+ dimensions?: string;
24
+ aspectRatio?: string;
25
+ extension?: string;
26
+ selected?: boolean;
27
+ isFolder?: boolean;
28
+ lastEdited?: string;
29
+ }
30
+ export interface PathItem {
31
+ id: string;
32
+ name: string;
33
+ }
34
+ export interface PaginationState {
35
+ current: number;
36
+ pageSize: number;
37
+ total: number;
38
+ }
39
+ export interface FilesQueryParams {
40
+ folderId?: string;
41
+ search?: string;
42
+ page?: number;
43
+ limit?: number;
44
+ sortBy?: 'name' | 'size' | 'date' | 'type';
45
+ sortOrder?: 'asc' | 'desc';
46
+ }
47
+ export interface ApiPaginationResponse {
48
+ page: number;
49
+ limit: number;
50
+ total: number;
51
+ totalPages: number;
52
+ hasNext: boolean;
53
+ hasPrev: boolean;
54
+ }
55
+ export interface FilesApiResponse {
56
+ data: File[];
57
+ pagination: ApiPaginationResponse;
58
+ }
59
+ export interface SortState {
60
+ sortBy: 'name' | 'size' | 'date' | 'type';
61
+ sortOrder: 'asc' | 'desc';
62
+ }
63
+ export interface MenuItem {
64
+ key: string;
65
+ label: string | ReactNode;
66
+ icon?: ReactNode;
67
+ children?: MenuItem[];
68
+ }
69
+ export interface ApiEndpoints {
70
+ getFolders?: string;
71
+ getFiles?: string;
72
+ createFolder?: string;
73
+ deleteFolder?: string;
74
+ addFile?: string;
75
+ deleteFile?: string;
76
+ renameFile?: string;
77
+ moveFile?: string;
78
+ updateFile?: string;
79
+ }
80
+ export interface IconProps {
81
+ style?: React.CSSProperties;
82
+ className?: string;
83
+ onClick?: React.MouseEventHandler<HTMLElement>;
84
+ [key: string]: unknown;
85
+ }
86
+ export interface CustomIcons {
87
+ rootFolder?: React.ComponentType<IconProps>;
88
+ folder?: React.ComponentType<IconProps>;
89
+ folderOpen?: React.ComponentType<IconProps>;
90
+ addFolder?: React.ComponentType<IconProps>;
91
+ file?: React.ComponentType<IconProps>;
92
+ upload?: React.ComponentType<IconProps>;
93
+ uploadByUrl?: React.ComponentType<IconProps>;
94
+ expandArrow?: React.ComponentType<IconProps>;
95
+ collapseArrow?: React.ComponentType<IconProps>;
96
+ gridView?: React.ComponentType<IconProps>;
97
+ listView?: React.ComponentType<IconProps>;
98
+ folderPreview?: React.ComponentType<IconProps>;
99
+ }
100
+ export interface FileManagerOptions {
101
+ apiEndpoints?: {
102
+ getFolders?: string;
103
+ getFiles?: string;
104
+ addFile?: string;
105
+ deleteFile?: string;
106
+ createFolder?: string;
107
+ deleteFolder?: string;
108
+ renameFile?: string;
109
+ moveFile?: string;
110
+ updateFile?: string;
111
+ };
112
+ dataProviders?: FileManagerDataProviders;
113
+ searchQuery?: string;
114
+ sortBySize?: string;
115
+ onPathChange?: (path: string[]) => void;
116
+ onChangeSelection?: (files: File[]) => void;
117
+ config?: Config;
118
+ publicPath?: string;
119
+ customIcons?: CustomIcons;
120
+ dragDropIcon?: string;
121
+ }
122
+ export interface FileManagerDataProviders {
123
+ getFile: (fileId: string) => Promise<Blob>;
124
+ getFolders: () => Promise<Folder[]>;
125
+ getFiles: (options: {
126
+ folderId?: string;
127
+ search?: string;
128
+ }) => Promise<File[]>;
129
+ createFolder: (data: {
130
+ name: string;
131
+ parentId?: string | null;
132
+ }) => Promise<Folder>;
133
+ deleteFolder?: (folderId: string) => Promise<boolean>;
134
+ uploadFile: (file: {
135
+ name: string;
136
+ size: string;
137
+ type: string;
138
+ folderId?: string | null;
139
+ data: Blob | string;
140
+ thumbnail?: string;
141
+ dimensions?: string;
142
+ aspectRatio?: string;
143
+ extension?: string;
144
+ }) => Promise<File>;
145
+ uploadFileByUrl?: (data: {
146
+ url: string;
147
+ folderId?: string | null;
148
+ }) => Promise<File>;
149
+ deleteFile: (fileId: string) => Promise<boolean>;
150
+ renameFile?: (fileId: string, newName: string) => Promise<File>;
151
+ moveItem?: (options: {
152
+ itemId: string;
153
+ targetFolderId: string;
154
+ isFolder: boolean;
155
+ }) => Promise<boolean>;
156
+ }
157
+ export interface FileManagerHookReturn {
158
+ folders: Folder[];
159
+ files: File[];
160
+ filteredItems: File[];
161
+ paginatedItems: File[];
162
+ pagination: PaginationState;
163
+ selectedFolder: string | null;
164
+ searchTerm: string;
165
+ sortField: string;
166
+ pathHistory: PathItem[];
167
+ selectedFiles: Set<string>;
168
+ loading: boolean;
169
+ isModalVisible: boolean;
170
+ isUrlModalVisible: boolean;
171
+ isRenameModalVisible: boolean;
172
+ isMoveModalVisible: boolean;
173
+ form: FormInstance;
174
+ urlForm: FormInstance;
175
+ renameForm: FormInstance;
176
+ moveForm: FormInstance;
177
+ fileToRename: string | null;
178
+ fetchFolders: () => Promise<void>;
179
+ fetchFiles: (folderId?: string) => Promise<void>;
180
+ handleCreateFolder: () => void;
181
+ handleModalOk: () => Promise<void>;
182
+ handleModalCancel: () => void;
183
+ handleDeleteFile: (fileId: string) => Promise<void>;
184
+ handleAddFile: () => void;
185
+ handleFolderSelect: (folderId: string) => void;
186
+ toggleFileSelection: (fileId: string) => void;
187
+ handleBreadcrumbClick: (index: number) => void;
188
+ handleItemClick: (record: File) => void;
189
+ handleAddFileByUrl: (url?: string | null) => Promise<void>;
190
+ setIsUrlModalVisible: (visible: boolean) => void;
191
+ setSearchTerm: (term: string) => void;
192
+ setSortField: (field: string) => void;
193
+ setPagination: (pagination: Partial<PaginationState>) => void;
194
+ generateMenuItems: () => MenuItem[];
195
+ setPathHistory: (history: PathItem[]) => void;
196
+ showRenameModal: (fileId: string) => void;
197
+ handleRenameCancel: () => void;
198
+ handleRenameOk: () => Promise<void>;
199
+ handleDroppedFiles: (droppedFiles: globalThis.File[]) => Promise<void>;
200
+ showMoveModal: () => void;
201
+ handleMoveCancel: () => void;
202
+ handleMoveOk: () => Promise<void>;
203
+ }
204
+ interface Counters {
205
+ optimization_counter: number;
206
+ ai_counter: number;
207
+ ai_img_counter: number;
208
+ ai_generator_limit: number;
209
+ }
210
+ interface Limits {
211
+ optimization_limit?: number;
212
+ ai_limit?: number;
213
+ ai_img_limit?: number;
214
+ ai_generator_limit?: number;
215
+ }
216
+ export interface Config {
217
+ theme?: 'light' | 'dark';
218
+ disableMockServer?: boolean;
219
+ activeTab?: string;
220
+ showDefaultNotification?: boolean;
221
+ apiEndpoints?: ApiEndpoints;
222
+ REACT_APP_GIPHY_KEY?: string;
223
+ locale?: string;
224
+ mode?: 'fileManager' | 'imageCenter' | 'plugin';
225
+ enabledTabs?: string[];
226
+ customTheme?: {
227
+ colors?: {
228
+ primary?: string;
229
+ secondary?: string;
230
+ success?: string;
231
+ warning?: string;
232
+ error?: string;
233
+ info?: string;
234
+ textPrimary?: string;
235
+ textSecondary?: string;
236
+ textTertiary?: string;
237
+ bgPrimary?: string;
238
+ bgSecondary?: string;
239
+ bgTertiary?: string;
240
+ borderPrimary?: string;
241
+ borderSecondary?: string;
242
+ };
243
+ borderRadius?: {
244
+ none?: string;
245
+ xs?: string;
246
+ sm?: string;
247
+ md?: string;
248
+ lg?: string;
249
+ xl?: string;
250
+ full?: string;
251
+ };
252
+ };
253
+ UNSPLASH_KEY?: string;
254
+ APP_NAME_UNSPLASH?: string;
255
+ pushToGTM?: boolean;
256
+ projectId?: string;
257
+ elementId?: string;
258
+ baseUrl?: string;
259
+ /** Counters and limits */
260
+ counters?: Counters;
261
+ limits?: Limits;
262
+ /** billing page url */
263
+ billingPageUrl?: string;
264
+ notification?: void;
265
+ sendAIImageRequest?: any;
266
+ sseQuery?: () => Promise<void>;
267
+ customLocale?: object;
268
+ activeLibraryItem?: LibraryMenuKey;
269
+ fileForEdit?: string;
270
+ }
271
+ export type LibraryMenuKey = typeof MY_FILES | typeof GIF | typeof STOCK_IMAGES | typeof AI | typeof EDITOR;
272
+ export interface GifItem {
273
+ id: string;
274
+ title: string;
275
+ images: {
276
+ downsized: {
277
+ url: string;
278
+ };
279
+ };
280
+ }
281
+ export interface CurrentReqGif {
282
+ keywords: string;
283
+ }
284
+ export interface ImageGifProps {
285
+ setImageGifList: React.Dispatch<React.SetStateAction<GifItem[]>>;
286
+ imageGifList: GifItem[];
287
+ currentReqGif: CurrentReqGif;
288
+ setCurrentReqGif: React.Dispatch<React.SetStateAction<CurrentReqGif>>;
289
+ inputRef: React.RefObject<InputRef>;
290
+ customRequest: (data: string) => void;
291
+ }
292
+ export interface UnsplashImage {
293
+ id: string;
294
+ description: string;
295
+ urls: {
296
+ raw: string;
297
+ };
298
+ links: {
299
+ download_location: string;
300
+ };
301
+ user: {
302
+ name: string;
303
+ links: {
304
+ html: string;
305
+ };
306
+ };
307
+ }
308
+ export interface CurrentReqStock {
309
+ keywords: string;
310
+ color: string;
311
+ orientation: string;
312
+ }
313
+ export interface ImageStockProps {
314
+ imageStockList: UnsplashImage[];
315
+ setImageStockList: React.Dispatch<React.SetStateAction<UnsplashImage[]>>;
316
+ currentReq: CurrentReqStock;
317
+ setCurrentReq: React.Dispatch<React.SetStateAction<CurrentReqStock>>;
318
+ inputRef: React.RefObject<InputRef>;
319
+ customRequest: (data: string) => void;
320
+ }
321
+ export interface ImageAIProps {
322
+ setModalHeight: React.Dispatch<React.SetStateAction<string | number>>;
323
+ customRequest: (args: {
324
+ file: File;
325
+ }) => void;
326
+ aiTabRef: RefObject<HTMLElement>;
327
+ inputAiRef: RefObject<any>;
328
+ isImageUploaded: boolean;
329
+ setIsImageUploaded: (val: boolean) => void;
330
+ aiImageRequest: string;
331
+ setAiImageRequest: React.Dispatch<React.SetStateAction<string>>;
332
+ imageAiList: string[];
333
+ setImageAiList: React.Dispatch<React.SetStateAction<string[]>>;
334
+ isLoadingAi: boolean;
335
+ setIsLoadingAi: React.Dispatch<React.SetStateAction<boolean>>;
336
+ }
337
+ export interface ArrowProps {
338
+ className?: string;
339
+ onClick?: () => void;
340
+ }
341
+ export interface UseImageAIGenerationProps {
342
+ setModalHeight: React.Dispatch<React.SetStateAction<string | number>>;
343
+ customRequest: (args: {
344
+ file: File;
345
+ }) => void;
346
+ aiTabRef: React.RefObject<HTMLElement>;
347
+ isImageUploaded: boolean;
348
+ setIsImageUploaded: (val: boolean) => void;
349
+ aiImageRequest: string;
350
+ imageAiList: string[];
351
+ setImageAiList: React.Dispatch<React.SetStateAction<string[]>>;
352
+ isLoadingAi: boolean;
353
+ setIsLoadingAi: React.Dispatch<React.SetStateAction<boolean>>;
354
+ }
355
+ export interface UseImageAIGenerationReturn {
356
+ aiImageCounter: number;
357
+ setAiImageCounter: React.Dispatch<React.SetStateAction<number>>;
358
+ currentAiImgLimits: number;
359
+ isFieldsDisabled: boolean;
360
+ canGenerateImage: boolean;
361
+ aiImageRequest: string;
362
+ imageAiList: string[];
363
+ setImageAiList: React.Dispatch<React.SetStateAction<string[]>>;
364
+ isLoadingAi: boolean;
365
+ setIsLoadingAi: React.Dispatch<React.SetStateAction<boolean>>;
366
+ loadingDuringGeneration: boolean;
367
+ setLoadingDuringGeneration: React.Dispatch<React.SetStateAction<boolean>>;
368
+ requestStatus: string;
369
+ setRequestStatus: React.Dispatch<React.SetStateAction<string>>;
370
+ handleGenerate: () => void;
371
+ handleLimitAiImgCount: () => void;
372
+ convertBase64ToFile: (base64String: string) => void;
373
+ isShiftPressed: boolean;
374
+ setIsShiftPressed: React.Dispatch<React.SetStateAction<boolean>>;
375
+ currentReqId: string | null;
376
+ setCurrentReqId: React.Dispatch<React.SetStateAction<string | null>>;
377
+ limitsInPlugin: boolean;
378
+ }
379
+ export {};
@@ -0,0 +1,34 @@
1
+ export declare const MAX_FILE_SIZE: number;
2
+ export declare const MIN_FILE_SIZE = 1;
3
+ export declare const ALLOWED_FILE_TYPES: {
4
+ images: string[];
5
+ documents: string[];
6
+ archives: string[];
7
+ videos: string[];
8
+ audio: string[];
9
+ };
10
+ export declare const ALL_ALLOWED_TYPES: string[];
11
+ export interface FileValidationResult {
12
+ isValid: boolean;
13
+ errors: string[];
14
+ warnings?: string[];
15
+ }
16
+ export interface FileValidationOptions {
17
+ maxSize?: number;
18
+ minSize?: number;
19
+ allowedTypes?: string[];
20
+ allowAllTypes?: boolean;
21
+ maxFileNameLength?: number;
22
+ }
23
+ export declare const validateFile: (file: File, options?: FileValidationOptions) => FileValidationResult;
24
+ export declare const validateFiles: (files: File[], options?: FileValidationOptions) => {
25
+ valid: File[];
26
+ invalid: {
27
+ file: File;
28
+ result: FileValidationResult;
29
+ }[];
30
+ };
31
+ export declare const validateFileUrl: (url: string) => Promise<FileValidationResult>;
32
+ export declare const getFileCategory: (file: File) => string;
33
+ export declare const formatFileSize: (bytes: number) => string;
34
+ export declare const sanitizeFileName: (fileName: string) => string;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Утилита для подавления ошибок ResizeObserver
3
+ * Эти ошибки часто возникают при работе с модальными окнами и динамическими компонентами
4
+ */
5
+ export declare const installResizeObserverErrorHandler: () => void;
6
+ export declare const uninstallResizeObserverErrorHandler: () => void;
@@ -0,0 +1,17 @@
1
+ import { Config } from '../types';
2
+ /**
3
+ * Применяет кастомную тему к CSS переменным
4
+ */
5
+ export declare const applyCustomTheme: (config?: Config) => void;
6
+ /**
7
+ * Сбрасывает кастомную тему к значениям по умолчанию
8
+ */
9
+ export declare const resetCustomTheme: () => void;
10
+ /**
11
+ * Устанавливает тему (светлая/темная)
12
+ */
13
+ export declare const setTheme: (theme: "light" | "dark") => void;
14
+ /**
15
+ * Получает текущую тему
16
+ */
17
+ export declare const getCurrentTheme: () => "light" | "dark";
@@ -0,0 +1,19 @@
1
+ import React, { Component, ReactNode } from 'react';
2
+ import './errorBoundary.scss';
3
+ interface ErrorBoundaryProps {
4
+ children: ReactNode;
5
+ }
6
+ interface ErrorBoundaryState {
7
+ hasError: boolean;
8
+ error: Error | null;
9
+ }
10
+ export declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
11
+ constructor(props: ErrorBoundaryProps);
12
+ static getDerivedStateFromError(error: Error): {
13
+ hasError: boolean;
14
+ error: Error;
15
+ };
16
+ componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void;
17
+ render(): string | number | boolean | Iterable<React.ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
18
+ }
19
+ export {};