@bindu-dashing/dam-solution-v2 5.8.6

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 (259) hide show
  1. package/README.md +53 -0
  2. package/build/AssetType/AddFieldProperties.d.ts +9 -0
  3. package/build/AssetType/AddFieldProperties.js +197 -0
  4. package/build/AssetType/AssetTemplatesTable.d.ts +10 -0
  5. package/build/AssetType/AssetTemplatesTable.js +153 -0
  6. package/build/AssetType/CreateAssetTemplate.d.ts +3 -0
  7. package/build/AssetType/CreateAssetTemplate.js +68 -0
  8. package/build/AssetType/CreateOrEditAssetTemplate.d.ts +1 -0
  9. package/build/AssetType/CreateOrEditAssetTemplate.js +77 -0
  10. package/build/AssetType/DraggedField.d.ts +14 -0
  11. package/build/AssetType/DraggedField.js +40 -0
  12. package/build/AssetType/EditAssetTemplate.d.ts +5 -0
  13. package/build/AssetType/EditAssetTemplate.js +179 -0
  14. package/build/AssetType/FieldsSection.d.ts +14 -0
  15. package/build/AssetType/FieldsSection.js +239 -0
  16. package/build/AssetType/assetTemplatesContainer.d.ts +2 -0
  17. package/build/AssetType/assetTemplatesContainer.js +71 -0
  18. package/build/AssetType/fieldProperties/DateField.d.ts +5 -0
  19. package/build/AssetType/fieldProperties/DateField.js +23 -0
  20. package/build/AssetType/fieldProperties/NumberField.d.ts +5 -0
  21. package/build/AssetType/fieldProperties/NumberField.js +91 -0
  22. package/build/AssetType/fieldProperties/OptionsField.d.ts +6 -0
  23. package/build/AssetType/fieldProperties/OptionsField.js +55 -0
  24. package/build/AssetType/fieldProperties/TextField.d.ts +5 -0
  25. package/build/AssetType/fieldProperties/TextField.js +92 -0
  26. package/build/AssetType/index.d.ts +11 -0
  27. package/build/AssetType/index.js +24 -0
  28. package/build/AssetType/routes.d.ts +3 -0
  29. package/build/AssetType/routes.js +17 -0
  30. package/build/BookView/ProductDescription.d.ts +4 -0
  31. package/build/BookView/ProductDescription.js +20 -0
  32. package/build/BookView/bookDetail.d.ts +4 -0
  33. package/build/BookView/bookDetail.js +106 -0
  34. package/build/BookView/bookInfo.d.ts +4 -0
  35. package/build/BookView/bookInfo.js +17 -0
  36. package/build/BookView/description.d.ts +4 -0
  37. package/build/BookView/description.js +5 -0
  38. package/build/BookView/index.d.ts +10 -0
  39. package/build/BookView/index.js +23 -0
  40. package/build/CreateClient/CreateClientBtn.d.ts +8 -0
  41. package/build/CreateClient/CreateClientBtn.js +12 -0
  42. package/build/CreateClient/CreateClientForm.d.ts +9 -0
  43. package/build/CreateClient/CreateClientForm.js +165 -0
  44. package/build/CreateClient/index.d.ts +14 -0
  45. package/build/CreateClient/index.js +18 -0
  46. package/build/ImagePicker/MetaFieldOptions.d.ts +14 -0
  47. package/build/ImagePicker/MetaFieldOptions.js +75 -0
  48. package/build/ImagePicker/TestImagePickerModal.d.ts +8 -0
  49. package/build/ImagePicker/TestImagePickerModal.js +61 -0
  50. package/build/ImagePicker/TestImgFromMetaData.d.ts +7 -0
  51. package/build/ImagePicker/TestImgFromMetaData.js +82 -0
  52. package/build/ImagePicker/imagePickerComponent.d.ts +6 -0
  53. package/build/ImagePicker/imagePickerComponent.js +63 -0
  54. package/build/ImagePicker/index.d.ts +13 -0
  55. package/build/ImagePicker/index.js +24 -0
  56. package/build/ImagePicker/routes.d.ts +6 -0
  57. package/build/ImagePicker/routes.js +17 -0
  58. package/build/ImagePickerFilters/ImagePickerFiltersComponent.d.ts +8 -0
  59. package/build/ImagePickerFilters/ImagePickerFiltersComponent.js +223 -0
  60. package/build/ImagePickerFilters/index.d.ts +12 -0
  61. package/build/ImagePickerFilters/index.js +19 -0
  62. package/build/MyDrive/ActionBar.d.ts +6 -0
  63. package/build/MyDrive/ActionBar.js +165 -0
  64. package/build/MyDrive/AddDrive.d.ts +3 -0
  65. package/build/MyDrive/AddDrive.js +169 -0
  66. package/build/MyDrive/AddFolder.d.ts +10 -0
  67. package/build/MyDrive/AddFolder.js +150 -0
  68. package/build/MyDrive/BreadCrumbList.d.ts +9 -0
  69. package/build/MyDrive/BreadCrumbList.js +86 -0
  70. package/build/MyDrive/BulkUploadModal.d.ts +2 -0
  71. package/build/MyDrive/BulkUploadModal.js +279 -0
  72. package/build/MyDrive/DriveContainer.d.ts +13 -0
  73. package/build/MyDrive/DriveContainer.js +276 -0
  74. package/build/MyDrive/FileDownloadHistory.d.ts +7 -0
  75. package/build/MyDrive/FileDownloadHistory.js +94 -0
  76. package/build/MyDrive/FileMenuOptions.d.ts +11 -0
  77. package/build/MyDrive/FileMenuOptions.js +397 -0
  78. package/build/MyDrive/FilesGridView.d.ts +9 -0
  79. package/build/MyDrive/FilesGridView.js +25 -0
  80. package/build/MyDrive/FolderGridView.d.ts +19 -0
  81. package/build/MyDrive/FolderGridView.js +91 -0
  82. package/build/MyDrive/FolderListView.d.ts +25 -0
  83. package/build/MyDrive/FolderListView.js +188 -0
  84. package/build/MyDrive/FolderMenuOptions.d.ts +5 -0
  85. package/build/MyDrive/FolderMenuOptions.js +350 -0
  86. package/build/MyDrive/FolderTree.d.ts +8 -0
  87. package/build/MyDrive/FolderTree.js +342 -0
  88. package/build/MyDrive/ImageEditor/EditImage.d.ts +6 -0
  89. package/build/MyDrive/ImageEditor/EditImage.js +97 -0
  90. package/build/MyDrive/ImageEditor/EditImageModal.d.ts +8 -0
  91. package/build/MyDrive/ImageEditor/EditImageModal.js +30 -0
  92. package/build/MyDrive/ImageEditor/TuiImageEditor.d.ts +10 -0
  93. package/build/MyDrive/ImageEditor/TuiImageEditor.js +99 -0
  94. package/build/MyDrive/ImagePickerBreadCrumbList.d.ts +8 -0
  95. package/build/MyDrive/ImagePickerBreadCrumbList.js +35 -0
  96. package/build/MyDrive/ImagePickerDrive.d.ts +1 -0
  97. package/build/MyDrive/ImagePickerDrive.js +41 -0
  98. package/build/MyDrive/MyDriveMainContainer.d.ts +1 -0
  99. package/build/MyDrive/MyDriveMainContainer.js +32 -0
  100. package/build/MyDrive/SearchFilter.d.ts +8 -0
  101. package/build/MyDrive/SearchFilter.js +73 -0
  102. package/build/MyDrive/ShareBtn.d.ts +5 -0
  103. package/build/MyDrive/ShareBtn.js +19 -0
  104. package/build/MyDrive/ToggleView.d.ts +4 -0
  105. package/build/MyDrive/ToggleView.js +12 -0
  106. package/build/MyDrive/UploadStatusModal.d.ts +12 -0
  107. package/build/MyDrive/UploadStatusModal.js +40 -0
  108. package/build/MyDrive/fileDetails/CommentEntity.d.ts +8 -0
  109. package/build/MyDrive/fileDetails/CommentEntity.js +102 -0
  110. package/build/MyDrive/fileDetails/Comments.d.ts +6 -0
  111. package/build/MyDrive/fileDetails/Comments.js +65 -0
  112. package/build/MyDrive/fileDetails/Compliance.d.ts +2 -0
  113. package/build/MyDrive/fileDetails/Compliance.js +18 -0
  114. package/build/MyDrive/fileDetails/CreateComment.d.ts +7 -0
  115. package/build/MyDrive/fileDetails/CreateComment.js +48 -0
  116. package/build/MyDrive/fileDetails/Editor.d.ts +6 -0
  117. package/build/MyDrive/fileDetails/Editor.js +55 -0
  118. package/build/MyDrive/fileDetails/EmojiPicker.d.ts +5 -0
  119. package/build/MyDrive/fileDetails/EmojiPicker.js +6 -0
  120. package/build/MyDrive/fileDetails/FileDetails.d.ts +10 -0
  121. package/build/MyDrive/fileDetails/FileDetails.js +78 -0
  122. package/build/MyDrive/fileDetails/FileHeader.d.ts +7 -0
  123. package/build/MyDrive/fileDetails/FileHeader.js +25 -0
  124. package/build/MyDrive/fileDetails/FileViewer.d.ts +10 -0
  125. package/build/MyDrive/fileDetails/FileViewer.js +31 -0
  126. package/build/MyDrive/fileDetails/ImageOptions.d.ts +2 -0
  127. package/build/MyDrive/fileDetails/ImageOptions.js +44 -0
  128. package/build/MyDrive/fileDetails/ImageViewer.d.ts +5 -0
  129. package/build/MyDrive/fileDetails/ImageViewer.js +16 -0
  130. package/build/MyDrive/fileDetails/ManageFile.d.ts +7 -0
  131. package/build/MyDrive/fileDetails/ManageFile.js +34 -0
  132. package/build/MyDrive/fileDetails/MetaForm.d.ts +15 -0
  133. package/build/MyDrive/fileDetails/MetaForm.js +195 -0
  134. package/build/MyDrive/fileDetails/Metadata.d.ts +8 -0
  135. package/build/MyDrive/fileDetails/Metadata.js +52 -0
  136. package/build/MyDrive/fileDetails/PdfOptions.d.ts +9 -0
  137. package/build/MyDrive/fileDetails/PdfOptions.js +35 -0
  138. package/build/MyDrive/fileDetails/PdfViewer.d.ts +8 -0
  139. package/build/MyDrive/fileDetails/PdfViewer.js +18 -0
  140. package/build/MyDrive/fileDetails/Previewdetails.d.ts +9 -0
  141. package/build/MyDrive/fileDetails/Previewdetails.js +53 -0
  142. package/build/MyDrive/fileDetails/VideoPlayer.d.ts +4 -0
  143. package/build/MyDrive/fileDetails/VideoPlayer.js +21 -0
  144. package/build/MyDrive/files/AssetSelectionFormItem.d.ts +7 -0
  145. package/build/MyDrive/files/AssetSelectionFormItem.js +14 -0
  146. package/build/MyDrive/files/FolderTabs.d.ts +6 -0
  147. package/build/MyDrive/files/FolderTabs.js +83 -0
  148. package/build/MyDrive/files/MapFile.d.ts +8 -0
  149. package/build/MyDrive/files/MapFile.js +217 -0
  150. package/build/MyDrive/files/MoveToAnotherFolder.d.ts +9 -0
  151. package/build/MyDrive/files/MoveToAnotherFolder.js +53 -0
  152. package/build/MyDrive/filesListView.d.ts +2 -0
  153. package/build/MyDrive/filesListView.js +57 -0
  154. package/build/MyDrive/index.d.ts +10 -0
  155. package/build/MyDrive/index.js +35 -0
  156. package/build/MyDrive/routes.d.ts +7 -0
  157. package/build/MyDrive/routes.js +17 -0
  158. package/build/PenView/PenDetails.d.ts +4 -0
  159. package/build/PenView/PenDetails.js +114 -0
  160. package/build/PenView/ProductDescription.d.ts +5 -0
  161. package/build/PenView/ProductDescription.js +51 -0
  162. package/build/PenView/index.d.ts +10 -0
  163. package/build/PenView/index.js +23 -0
  164. package/build/RefreshKey/RefreshKeyBtn.d.ts +1 -0
  165. package/build/RefreshKey/RefreshKeyBtn.js +42 -0
  166. package/build/RefreshKey/index.d.ts +9 -0
  167. package/build/RefreshKey/index.js +23 -0
  168. package/build/ShoesView/ProductDescription.d.ts +4 -0
  169. package/build/ShoesView/ProductDescription.js +25 -0
  170. package/build/ShoesView/ShoeDetails.d.ts +4 -0
  171. package/build/ShoesView/ShoeDetails.js +96 -0
  172. package/build/ShoesView/index.d.ts +10 -0
  173. package/build/ShoesView/index.js +23 -0
  174. package/build/common/Button.d.ts +2 -0
  175. package/build/common/Button.js +18 -0
  176. package/build/common/CustomElements.d.ts +98 -0
  177. package/build/common/CustomElements.js +77 -0
  178. package/build/common/LoadMoreItems.d.ts +7 -0
  179. package/build/common/LoadMoreItems.js +33 -0
  180. package/build/common/RenderFormItem.d.ts +42 -0
  181. package/build/common/RenderFormItem.js +98 -0
  182. package/build/common/RenderThumnail.d.ts +7 -0
  183. package/build/common/RenderThumnail.js +6 -0
  184. package/build/common/deleteModal.d.ts +1 -0
  185. package/build/common/deleteModal.js +12 -0
  186. package/build/common/folders/TypeAndDateFilters.d.ts +10 -0
  187. package/build/common/folders/TypeAndDateFilters.js +59 -0
  188. package/build/common/folders/getFolderOrFileIcon.d.ts +2 -0
  189. package/build/common/folders/getFolderOrFileIcon.js +41 -0
  190. package/build/common/loader/CustomLoader.d.ts +7 -0
  191. package/build/common/loader/CustomLoader.js +8 -0
  192. package/build/common/loader/loader.d.ts +1 -0
  193. package/build/common/loader/loader.js +6 -0
  194. package/build/common/notifications.d.ts +2 -0
  195. package/build/common/notifications.js +30 -0
  196. package/build/common/steps.d.ts +4 -0
  197. package/build/common/steps.js +7 -0
  198. package/build/hocs/AppProvider.d.ts +3 -0
  199. package/build/hocs/AppProvider.js +11 -0
  200. package/build/hocs/DamConfigContext.d.ts +2 -0
  201. package/build/hocs/DamConfigContext.js +108 -0
  202. package/build/hocs/ThemeContext.d.ts +15 -0
  203. package/build/hocs/ThemeContext.js +131 -0
  204. package/build/hocs/ToastProvider.d.ts +2 -0
  205. package/build/hocs/ToastProvider.js +6 -0
  206. package/build/hocs/appConstants.d.ts +124 -0
  207. package/build/hocs/appConstants.js +211 -0
  208. package/build/hocs/configureAxios.d.ts +2 -0
  209. package/build/hocs/configureAxios.js +65 -0
  210. package/build/hocs/helpers.d.ts +15 -0
  211. package/build/hocs/helpers.js +177 -0
  212. package/build/index.d.ts +11 -0
  213. package/build/index.js +11 -0
  214. package/build/react-query/hooks/brand-hooks.d.ts +3 -0
  215. package/build/react-query/hooks/brand-hooks.js +10 -0
  216. package/build/react-query/hooks/folder-hooks.d.ts +7 -0
  217. package/build/react-query/hooks/folder-hooks.js +119 -0
  218. package/build/react-query/services/brand-services.d.ts +3 -0
  219. package/build/react-query/services/brand-services.js +30 -0
  220. package/build/react-query/services/file-services.d.ts +43 -0
  221. package/build/react-query/services/file-services.js +69 -0
  222. package/build/react-query/services/folder-services.d.ts +44 -0
  223. package/build/react-query/services/folder-services.js +87 -0
  224. package/build/react-query/services/image-picker-services.d.ts +5 -0
  225. package/build/react-query/services/image-picker-services.js +48 -0
  226. package/build/settings/InviteTeamModal.d.ts +12 -0
  227. package/build/settings/InviteTeamModal.js +174 -0
  228. package/build/settings/UpdateInvitationAccessType.d.ts +9 -0
  229. package/build/settings/UpdateInvitationAccessType.js +96 -0
  230. package/build/settings/getUserAvatar.d.ts +7 -0
  231. package/build/settings/getUserAvatar.js +11 -0
  232. package/build/style.css +1 -0
  233. package/build/types/assetType.d.ts +8 -0
  234. package/build/types/assetType.js +1 -0
  235. package/build/ui/pageTitle.d.ts +3 -0
  236. package/build/ui/pageTitle.js +4 -0
  237. package/build/utilities/FoldersContext.d.ts +14 -0
  238. package/build/utilities/FoldersContext.js +10 -0
  239. package/build/utilities/NavigatorProvider.d.ts +2 -0
  240. package/build/utilities/NavigatorProvider.js +10 -0
  241. package/build/utilities/constants/apiUrls.d.ts +95 -0
  242. package/build/utilities/constants/apiUrls.js +115 -0
  243. package/build/utilities/constants/imageUrls.d.ts +6 -0
  244. package/build/utilities/constants/imageUrls.js +6 -0
  245. package/build/utilities/constants/interface.d.ts +371 -0
  246. package/build/utilities/constants/interface.js +142 -0
  247. package/build/utilities/constants/messages.d.ts +54 -0
  248. package/build/utilities/constants/messages.js +54 -0
  249. package/build/utilities/constants/queryKeys.d.ts +16 -0
  250. package/build/utilities/constants/queryKeys.js +33 -0
  251. package/build/utilities/constants/routes.d.ts +22 -0
  252. package/build/utilities/constants/routes.js +22 -0
  253. package/build/utilities/helpers/validators.d.ts +12 -0
  254. package/build/utilities/helpers/validators.js +89 -0
  255. package/build/utilities/useAppNavigate.d.ts +2 -0
  256. package/build/utilities/useAppNavigate.js +19 -0
  257. package/build/utilities/useAppParams.d.ts +6 -0
  258. package/build/utilities/useAppParams.js +27 -0
  259. package/package.json +93 -0
@@ -0,0 +1,78 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useMemo, useRef, useState } from "react";
3
+ import ReactDOM from "react-dom";
4
+ import FileDetailsHeader from "./FileHeader";
5
+ import FileViewer from "./FileViewer";
6
+ import { get, nth } from "lodash";
7
+ import { useFile } from "../../react-query/services/file-services";
8
+ import Loader from "../../common/loader/loader";
9
+ import { createApiClient } from "../../hocs/configureAxios";
10
+ import { useDamConfig } from "../../hocs/DamConfigContext";
11
+ import useAppParams from "../../utilities/useAppParams";
12
+ const FileDetails = ({ open, handleClose, file, files, onCloseSelection, }) => {
13
+ const { id } = useAppParams();
14
+ const damConfig = useDamConfig();
15
+ const api = useMemo(() => createApiClient(damConfig), [damConfig]);
16
+ const [state, setState] = useState({
17
+ visible: false,
18
+ currentIndex: 0,
19
+ currentFileId: get(file, "_id"),
20
+ });
21
+ const { visible, currentIndex, currentFileId } = state;
22
+ const { data: fileData, isFetching, refetch } = useFile(api, currentFileId);
23
+ if (typeof window === "undefined" || typeof document === "undefined") {
24
+ return null;
25
+ }
26
+ const prevFileId = useRef();
27
+ useEffect(() => {
28
+ const prevFileState = prevFileId.current;
29
+ const shouldRefetch = prevFileState !== currentFileId;
30
+ if (shouldRefetch) {
31
+ refetch();
32
+ }
33
+ prevFileId.current = currentFileId;
34
+ }, [currentFileId]);
35
+ const currentFile = useMemo(() => {
36
+ if (id) {
37
+ return file;
38
+ }
39
+ else {
40
+ return file ? fileData : nth(files, currentIndex);
41
+ }
42
+ }, [files, currentIndex, file, fileData, isFetching, id]);
43
+ const handlePrevious = () => {
44
+ if (files && currentIndex > 0) {
45
+ setState((prevState) => (Object.assign(Object.assign({}, prevState), { currentIndex: prevState.currentIndex - 1 })));
46
+ }
47
+ else {
48
+ setState((prevState) => (Object.assign(Object.assign({}, prevState), { currentFileId: get(currentFile, "prevFileId") || "" })));
49
+ }
50
+ };
51
+ const handleNext = () => {
52
+ if (files && currentIndex < get(files, "length", 0) - 1) {
53
+ setState((prevState) => (Object.assign(Object.assign({}, prevState), { currentIndex: prevState.currentIndex + 1 })));
54
+ }
55
+ else {
56
+ setState((prevState) => (Object.assign(Object.assign({}, prevState), { currentFileId: get(currentFile, "nextFileId") || "" })));
57
+ }
58
+ };
59
+ useEffect(() => {
60
+ if (open) {
61
+ setTimeout(() => setState((prevState) => (Object.assign(Object.assign({}, prevState), { visible: true }))), 10);
62
+ }
63
+ else {
64
+ setState((prevState) => (Object.assign(Object.assign({}, prevState), { visible: false })));
65
+ }
66
+ }, [open]);
67
+ if (!open && !visible)
68
+ return null;
69
+ const modalContent = (_jsxs("div", { className: `md-lib-fixed md-lib-inset-0 md-lib-z-[1000] md-lib-w-screen md-lib-h-screen md-lib-bg-white dark:md-lib-bg-darkPrimary md-lib-text-black dark:md-lib-text-white md-lib-overflow-auto md-lib-transform md-lib-transition-all md-lib-duration-300 md-lib-ease-in-out ${open && visible
70
+ ? "md-lib-opacity-100 md-lib-translate-y-0"
71
+ : "md-lib-opacity-0 md-lib-translate-y-4"}`, onTransitionEnd: () => {
72
+ if (!open)
73
+ setState((prevState) => (Object.assign(Object.assign({}, prevState), { visible: false })));
74
+ }, children: [_jsx(FileDetailsHeader, { handleClose: handleClose, file: currentFile, onCloseSelection: onCloseSelection }), isFetching ? (_jsx(Loader, {})) : (_jsx(FileViewer, { file: currentFile, hasPrev: (!!files && currentIndex > 0) || !!get(currentFile, "prevFileId"), hasNext: (!!files && currentIndex < get(files, "length") - 1) ||
75
+ !!get(currentFile, "nextFileId"), onPrev: handlePrevious, onNext: handleNext, handleClose: handleClose }))] }));
76
+ return ReactDOM.createPortal(modalContent, document.body);
77
+ };
78
+ export default FileDetails;
@@ -0,0 +1,7 @@
1
+ import { FileEntity, FolderEntity } from "../../utilities/constants/interface";
2
+ declare const FileDetailsHeader: ({ handleClose, file, onCloseSelection, }: {
3
+ handleClose?: () => void;
4
+ file: FileEntity & FolderEntity;
5
+ onCloseSelection?: () => void;
6
+ }) => JSX.Element;
7
+ export default FileDetailsHeader;
@@ -0,0 +1,25 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button } from "antd";
3
+ import { IoIosClose } from "react-icons/io";
4
+ import { BsDownload } from "react-icons/bs";
5
+ import { DriveModes, NotificationStatus, } from "../../utilities/constants/interface";
6
+ import { get } from "lodash";
7
+ import { showNotification } from "../../common/notifications";
8
+ import { INVALID_URL } from "../../utilities/constants/messages";
9
+ import FileMenuOptions from "../FileMenuOptions";
10
+ import { useDamConfig } from "../../hocs/DamConfigContext";
11
+ import useAppParams from "../../utilities/useAppParams";
12
+ const IoIosCloseIcon = IoIosClose;
13
+ const BsDownloadIcon = BsDownload;
14
+ const FileDetailsHeader = ({ handleClose, file, onCloseSelection, }) => {
15
+ const damConfig = useDamConfig();
16
+ const { isAdmin } = damConfig;
17
+ const { id, type } = useAppParams();
18
+ return (_jsxs("div", { className: "md-lib-bg-white dark:md-lib-bg-darkPrimaryHoverColor md-lib-py-3 md-lib-px-5 md-lib-border-b md-lib-border-borderColor dark:md-lib-border-darkBorderColor md-lib-flex md-lib-justify-between md-lib-items-center", children: [_jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-gap-5", children: [!id && type !== DriveModes.FILE && (_jsx(IoIosCloseIcon, { className: "md-lib-text-textColor dark:md-lib-text-darkTextColor md-lib-cursor-pointer", size: 24, onClick: handleClose })), !!file && (_jsx("h4", { className: "md-lib-font-semibold md-lib-text-textColor dark:md-lib-text-darkTextColor md-lib-text-base md-lib-truncate md-lib-max-w-[calc(100vw-180px)]", title: get(file, "name", "N/A"), children: get(file, "name", "N/A") }))] }), !!file && (_jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-gap-4", children: [_jsx(FileMenuOptions, { file: file, onCloseSelection: onCloseSelection, fileModal: true }), _jsx(Button, { size: "large", className: "md-lib-bg-secondaryColor dark:md-lib-bg-darkSecondaryColor hover:md-lib-bg-secondaryHoverColor dark:hover:md-lib-bg-darkSecondaryColor md-lib-border-none", onClick: () => {
19
+ const url = get(file, "downloadUrl");
20
+ if (!url)
21
+ showNotification(INVALID_URL, NotificationStatus.ERROR);
22
+ window.open(url, "_blank");
23
+ }, children: _jsx(BsDownloadIcon, { className: "md-lib-text-textColor dark:md-lib-text-darkTextColor", size: 24 }) })] }))] }));
24
+ };
25
+ export default FileDetailsHeader;
@@ -0,0 +1,10 @@
1
+ import { FileEntity } from "../../utilities/constants/interface";
2
+ declare const FileViewer: ({ file, onNext, onPrev, hasNext, hasPrev, handleClose, }: {
3
+ file: FileEntity;
4
+ hasPrev: boolean;
5
+ hasNext: boolean;
6
+ onPrev: () => void;
7
+ onNext: () => void;
8
+ handleClose?: () => void;
9
+ }) => JSX.Element;
10
+ export default FileViewer;
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Layout } from "antd";
3
+ import { useState } from "react";
4
+ import { BsArrowLeftSquare, BsArrowRightSquare } from "react-icons/bs";
5
+ import PreviewDetails from "./Previewdetails";
6
+ import MapFile from "../files/MapFile";
7
+ const { Content, Sider } = Layout;
8
+ const BsArrowLeftSquareIcon = BsArrowLeftSquare;
9
+ const BsArrowRightSquareIcon = BsArrowRightSquare;
10
+ const FileViewer = ({ file, onNext, onPrev, hasNext, hasPrev, handleClose, }) => {
11
+ const [collapsed, setCollapsed] = useState(true);
12
+ const items = [
13
+ // {
14
+ // key: "1",
15
+ // label: "Comments",
16
+ // children: <Comments file={file} />,
17
+ // },
18
+ // {
19
+ // key: "2",
20
+ // label: "Metadata",
21
+ // children: <Metadata file={file} />,
22
+ // },
23
+ // {
24
+ // key: "3",
25
+ // label: "Compliance",
26
+ // children: <Compliance />,
27
+ // },
28
+ ];
29
+ return (_jsx(Layout, { children: _jsxs(Content, { className: "md-lib-grid md-lib-grid-cols-3 md-lib-gap-2", children: [_jsx("div", { className: "md-lib-col-span-1 md:md-lib-col-span-2 md-lib-imageBg md-lib-bg-cover md-lib-bg-center md-lib-min-h-full md-lib-flex md-lib-items-center md-lib-justify-center md-lib-relative md-lib-bg-textColorActive dark:md-lib-bg-darkSecondaryColor", children: _jsx(PreviewDetails, { file: file, hasNext: hasNext, hasPrev: hasPrev, onNext: onNext, onPrev: onPrev }) }), _jsx(MapFile, { fromUpload: false, filesList: file ? [file] : [], handleCancel: handleClose })] }) }));
30
+ };
31
+ export default FileViewer;
@@ -0,0 +1,2 @@
1
+ declare const ImageOptions: ({ zoom, setZoom, zoomOptions, file }: any) => JSX.Element;
2
+ export default ImageOptions;
@@ -0,0 +1,44 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { AiOutlineInfoCircle, AiOutlineZoomIn, AiOutlineZoomOut, AiOutlineEdit, } from "react-icons/ai";
3
+ import { FiChevronDown } from "react-icons/fi";
4
+ import { useState } from "react";
5
+ import { PiCameraRotate } from "react-icons/pi";
6
+ import { MdOutlineCrop } from "react-icons/md";
7
+ import { Dropdown, Popover, } from "antd";
8
+ import EditImageModal from "../ImageEditor/EditImageModal";
9
+ import ManageFile from "./ManageFile";
10
+ import { FileInfoContent } from "../../common/CustomElements";
11
+ const AiOutlineInfoCircleIcon = AiOutlineInfoCircle;
12
+ const AiOutlineZoomOutIcon = AiOutlineZoomOut;
13
+ const FiChevronDownIcon = FiChevronDown;
14
+ const AiOutlineZoomInIcon = AiOutlineZoomIn;
15
+ const PiCameraRotateIcon = PiCameraRotate;
16
+ const MdOutlineCropIcon = MdOutlineCrop;
17
+ const AiOutlineEditIcon = AiOutlineEdit;
18
+ const ImageOptions = ({ zoom, setZoom, zoomOptions, file }) => {
19
+ const [state, setState] = useState({
20
+ showEditModal: false,
21
+ showFileAccess: false,
22
+ });
23
+ const { showEditModal, showFileAccess } = state;
24
+ const toggleFileAccess = () => {
25
+ setState((prevState) => (Object.assign(Object.assign({}, prevState), { showFileAccess: !prevState.showFileAccess })));
26
+ };
27
+ const toggleEditModal = () => {
28
+ setState((prevState) => (Object.assign(Object.assign({}, prevState), { showEditModal: !prevState.showEditModal })));
29
+ };
30
+ const zoomMenuItems = zoomOptions.map((value) => ({
31
+ key: value,
32
+ label: value,
33
+ }));
34
+ const handleZoomChange = ({ key }) => {
35
+ setZoom(key);
36
+ };
37
+ return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "md-lib-bottom-10 md-lib-absolute md-lib-left-1/2 -md-lib-translate-x-1/2 md-lib-bg-white dark:md-lib-bg-darkPrimary md-lib-rounded-xl md-lib-shadow-md md-lib-px-4 md-lib-py-2 md-lib-flex md-lib-items-center md-lib-gap-4 md-lib-border md-lib-border-borderColor dark:md-lib-border-darkBorderColor md-lib-z-50", children: [_jsx(Popover, { content: _jsx(FileInfoContent, { file: file }), title: "File Info", placement: "top", children: _jsx("button", { className: "md-lib-p-2 hover:md-lib-bg-secondaryColor hover:dark:md-lib-bg-darkPrimaryHoverColor md-lib-rounded-lg", onClick: toggleFileAccess, children: _jsx(AiOutlineInfoCircleIcon, { className: "md-lib-text-[20px]" }) }) }), _jsx("div", { className: "md-lib-w-[1px] md-lib-h-5 md-lib-bg-borderColor dark:md-lib-bg-darkBorderColor" }), _jsx("button", { className: "md-lib-p-2 hover:md-lib-bg-secondaryColor hover:dark:md-lib-bg-darkPrimaryHoverColor md-lib-rounded-lg", onClick: () => setZoom((prev) => `${parseInt(prev) - 5}%`), disabled: zoom === "10%", children: _jsx(AiOutlineZoomOutIcon, { className: "md-lib-text-[20px]" }) }), _jsx(Dropdown, { menu: {
38
+ items: zoomMenuItems,
39
+ onClick: handleZoomChange,
40
+ selectable: true,
41
+ selectedKeys: [zoom],
42
+ }, trigger: ["click"], placement: "top", children: _jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-gap-1 md-lib-px-3 md-lib-py-1 md-lib-bg-secondaryColor dark:md-lib-bg-darkPrimaryHoverColor md-lib-rounded-md md-lib-cursor-pointer md-lib-text-sm md-lib-text-textColor dark:md-lib-text-darkTextColor", children: [zoom, _jsx(FiChevronDownIcon, { className: "md-lib-text-[16px]" })] }) }), _jsx("button", { className: "md-lib-p-2 hover:md-lib-bg-secondaryColor hover:dark:md-lib-bg-darkPrimaryHoverColor md-lib-rounded-lg", onClick: () => setZoom((prev) => `${parseInt(prev) + 5}%`), disabled: zoom === "150%", children: _jsx(AiOutlineZoomInIcon, { className: "md-lib-text-[20px]" }) }), _jsx("div", { className: "md-lib-w-[1px] md-lib-h-5 md-lib-bg-borderColor dark:md-lib-bg-darkBorderColor" }), _jsx("button", { className: "md-lib-p-2 hover:md-lib-bg-secondaryColor hover:dark:md-lib-bg-darkPrimaryHoverColor md-lib-rounded-lg md-lib-hidden md:md-lib-block", children: _jsx(PiCameraRotateIcon, { className: "md-lib-text-[20px]" }) }), _jsx("button", { className: "md-lib-p-2 hover:md-lib-bg-secondaryColor hover:dark:md-lib-bg-darkPrimaryHoverColor md-lib-rounded-lg md-lib-hidden md:md-lib-block", onClick: toggleEditModal, children: _jsx(MdOutlineCropIcon, { className: "md-lib-text-[20px]" }) }), _jsx("button", { className: "md-lib-p-2 hover:md-lib-bg-secondaryColor hover:dark:md-lib-bg-darkPrimaryHoverColor md-lib-rounded-lg md-lib-hidden md:md-lib-block", onClick: toggleEditModal, children: _jsx(AiOutlineEditIcon, { className: "md-lib-text-[20px]" }) })] }), showEditModal && (_jsx(EditImageModal, { open: showEditModal, handleClose: toggleEditModal, file: file })), showFileAccess && (_jsx(ManageFile, { open: showFileAccess, onClose: toggleFileAccess, file: file }))] }));
43
+ };
44
+ export default ImageOptions;
@@ -0,0 +1,5 @@
1
+ import { FileEntity } from "../../utilities/constants/interface";
2
+ declare const ImageViewer: ({ file }: {
3
+ file: FileEntity;
4
+ }) => JSX.Element;
5
+ export default ImageViewer;
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { get } from "lodash";
3
+ import ImageOptions from "./ImageOptions";
4
+ import { useState } from "react";
5
+ import { SAMPLE_IMAGE_URL } from "../../utilities/constants/imageUrls";
6
+ import { useDamConfig } from "../../hocs/DamConfigContext";
7
+ const ImageViewer = ({ file }) => {
8
+ const damConfig = useDamConfig();
9
+ const { isAdmin } = damConfig;
10
+ const [zoom, setZoom] = useState("100");
11
+ const zoomOptions = ["10", "25", "50", "75", "100"];
12
+ const imgWidth = 750 * (parseInt(zoom) / 100);
13
+ // const imgHeight = 333 * (parseInt(zoom) / 100);
14
+ return (_jsxs(_Fragment, { children: [_jsx("div", { className: "md-lib-relative md-lib-flex md-lib-justify-center md-lib-items-center md-lib-h-[calc(100vh-65px)] md-lib-w-full md-lib-overflow-x-auto", children: _jsx("img", { src: get(file, "s3Url", SAMPLE_IMAGE_URL), alt: "", width: imgWidth, height: "auto" }) }), isAdmin && (_jsx(ImageOptions, { zoom: zoom, setZoom: setZoom, zoomOptions: zoomOptions, file: file }))] }));
15
+ };
16
+ export default ImageViewer;
@@ -0,0 +1,7 @@
1
+ import { FileEntity, FolderEntity } from "../../utilities/constants/interface";
2
+ declare function ManageFile({ onClose, open, file, }: {
3
+ onClose: () => void;
4
+ open: boolean;
5
+ file: FileEntity & FolderEntity;
6
+ }): JSX.Element;
7
+ export default ManageFile;
@@ -0,0 +1,34 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Divider, Drawer } from "antd";
3
+ import { capitalize, get, slice } from "lodash";
4
+ import { DriveModes, EntityType, } from "../../utilities/constants/interface";
5
+ import { useMemo, useState } from "react";
6
+ import { getReadableFileType } from "../../hocs/helpers";
7
+ import moment from "moment-timezone";
8
+ import { APP_DATE_TIME_FORMAT, LOCAL_TIMEZONE } from "../../hocs/appConstants";
9
+ import { useDamConfig } from "../../hocs/DamConfigContext";
10
+ import InviteTeamModal from "../../settings/InviteTeamModal";
11
+ function ManageFile({ onClose, open, file, }) {
12
+ const [state, setState] = useState({ showShareFile: false });
13
+ const { showShareFile } = state;
14
+ const toggleShareFile = () => {
15
+ setState((prevState) => (Object.assign(Object.assign({}, prevState), { showShareFile: !prevState.showShareFile })));
16
+ };
17
+ const damConfig = useDamConfig();
18
+ const { user, isAdmin } = damConfig;
19
+ const userId = get(user, "_id");
20
+ const displayedUsers = useMemo(() => slice(get(file, "users", []), 0, 5), [file]);
21
+ const extraUsers = useMemo(() => get(file, "users.length") > 5 ? slice(get(file, "users", []), 5) : [], [file]);
22
+ return (_jsxs(_Fragment, { children: [_jsxs(Drawer, { title: `${capitalize(get(file, "type", EntityType.FOLDER))} Details`, onClose: onClose, open: open, width: 440, children: [_jsxs("div", { children: [_jsx("p", { className: "md-lib-text-xs md-lib-text-secondaryTextColor dark:md-lib-text-text-darkTextColor md-lib-mb-1", children: "Download Permission" }), _jsx("p", { className: "md-lib-py-3 md-lib-px-4 md-lib-text-base md-lib-rounded-lg md-lib-bg-secondaryColor dark:md-lib-bg-darkPrimaryHoverColor", children: "Viewers can download" })] }), _jsx(Divider, { className: "md-lib-border-secondaryHoverColor" }), _jsxs("h5", { className: "md-lib-text-base md-lib-font-semibold md-lib-text-textColor dark:md-lib-text-darkTextColor md-lib-mb-5", children: [capitalize(get(file, "type", EntityType.FOLDER)), " Details"] }), _jsxs("div", { className: "md-lib-mb-5", children: [_jsx("p", { className: "md-lib-text-xs md-lib-text-secondaryTextColor dark:md-lib-text-text-darkTextColor md-lib-mb-1", children: "Type" }), _jsx("p", { className: "md-lib-py-3 md-lib-px-4 md-lib-text-base md-lib-rounded-lg md-lib-bg-secondaryColor dark:md-lib-bg-darkPrimaryHoverColor", children: get(file, "type") === EntityType.FILE
23
+ ? getReadableFileType(file)
24
+ : capitalize(get(file, "type", EntityType.FOLDER)) })] }), _jsxs("div", { className: "md-lib-mb-5", children: [_jsx("p", { className: "md-lib-text-xs md-lib-text-secondaryTextColor dark:md-lib-text-text-darkTextColor md-lib-mb-1", children: "Id" }), _jsx("p", { className: "md-lib-py-3 md-lib-px-4 md-lib-text-base md-lib-rounded-lg md-lib-bg-secondaryColor dark:md-lib-bg-darkPrimaryHoverColor", children: get(file, "_id") })] }), _jsxs("div", { className: "md-lib-mb-5", children: [_jsx("p", { className: "md-lib-text-xs md-lib-text-secondaryTextColor dark:md-lib-text-text-darkTextColor md-lib-mb-1", children: "Owner" }), _jsx("p", { className: "md-lib-py-3 md-lib-px-4 md-lib-text-base md-lib-rounded-lg md-lib-bg-secondaryColor dark:md-lib-bg-darkPrimaryHoverColor md-lib-truncate", title: get(file, "createdBy.name", "Unknown"), children: get(file, "createdBy.name") })] }), _jsxs("div", { className: "md-lib-mb-5", children: [_jsx("p", { className: "md-lib-text-xs md-lib-text-secondaryTextColor dark:md-lib-text-text-darkTextColor md-lib-mb-1", children: "Modified" }), _jsx("p", { className: "md-lib-py-3 md-lib-px-4 md-lib-text-base md-lib-rounded-lg md-lib-bg-secondaryColor dark:md-lib-bg-darkPrimaryHoverColor", children: moment
25
+ .utc(get(file, "updatedAt"))
26
+ .tz(LOCAL_TIMEZONE)
27
+ .format(APP_DATE_TIME_FORMAT) })] }), _jsxs("div", { className: "md-lib-mb-5", children: [_jsx("p", { className: "md-lib-text-xs md-lib-text-secondaryTextColor dark:md-lib-text-text-darkTextColor md-lib-mb-1", children: "Opened" }), _jsxs("p", { className: "md-lib-py-3 md-lib-px-4 md-lib-text-base md-lib-rounded-lg md-lib-bg-secondaryColor dark:md-lib-bg-darkPrimaryHoverColor", children: [moment().format(APP_DATE_TIME_FORMAT), " by me"] })] }), _jsxs("div", { className: "md-lib-mb-5", children: [_jsx("p", { className: "md-lib-text-xs md-lib-text-secondaryTextColor dark:md-lib-text-text-darkTextColor md-lib-mb-1", children: "Created" }), _jsxs("p", { className: "md-lib-py-3 md-lib-px-4 md-lib-text-base md-lib-rounded-lg md-lib-bg-secondaryColor dark:md-lib-bg-darkPrimaryHoverColor md-lib-truncate", title: get(file, "createdBy.name", "Unknown"), children: [moment
28
+ .utc(get(file, "createdAt"))
29
+ .tz(LOCAL_TIMEZONE)
30
+ .format(APP_DATE_TIME_FORMAT), " ", "by", " ", get(file, "createdBy._id") === userId
31
+ ? "me"
32
+ : get(file, "createdBy.name")] })] })] }), showShareFile && (_jsx(InviteTeamModal, { open: showShareFile, onClose: toggleShareFile, onFetchInvitations: () => { }, shareModal: true, fileIds: get(file, "type") === EntityType.FILE ? [get(file, "_id")] : [], folderIds: get(file, "type") !== EntityType.FILE ? [get(file, "_id")] : [], inviteType: DriveModes.FILE, file: file }))] }));
33
+ }
34
+ export default ManageFile;
@@ -0,0 +1,15 @@
1
+ import type { FormInstance } from "antd";
2
+ import { BrandUserEntity, MetaDataFieldEntity } from "../../utilities/constants/interface";
3
+ export declare const buildInitialValues: (formData: Record<string, any>, metaFields: MetaDataFieldEntity[], isEditMode: boolean) => {
4
+ [x: string]: any;
5
+ };
6
+ export declare const getFormItem: (item: MetaDataFieldEntity, fromDefaultValue: boolean, userOptions?: BrandUserEntity[]) => JSX.Element | null;
7
+ declare const MetaForm: ({ metaFields, metaData, form, isEditMode, }: {
8
+ metaFields: MetaDataFieldEntity[];
9
+ metaData: {
10
+ [key: string]: any;
11
+ };
12
+ form: FormInstance;
13
+ isEditMode: boolean;
14
+ }) => JSX.Element;
15
+ export default MetaForm;
@@ -0,0 +1,195 @@
1
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useEffect, useMemo } from "react";
3
+ import { Form, Input, InputNumber, DatePicker, Select, Checkbox, Radio, } from "antd";
4
+ import { find, first, get, includes, isArray, isNumber, map, mapValues, nth, } from "lodash";
5
+ import dayjs from "dayjs";
6
+ import { InputSupportedTypes, InputTypes, } from "../../utilities/constants/interface";
7
+ import { INVALID_URL } from "../../utilities/constants/messages";
8
+ import { useQueryClient } from "react-query";
9
+ import { getCurrentBrandUsers } from "../../react-query/hooks/brand-hooks";
10
+ import { getUserAvatar } from "../../settings/getUserAvatar";
11
+ import { useDamConfig } from "../../hocs/DamConfigContext";
12
+ const { RangePicker } = DatePicker;
13
+ export const buildInitialValues = (formData, metaFields, isEditMode) => {
14
+ const dataWithDefaultValues = metaFields.reduce((acc, field) => {
15
+ const id = get(field, "_id");
16
+ const defaultValue = get(field, "defaultValue");
17
+ if (defaultValue) {
18
+ acc[id] = defaultValue;
19
+ }
20
+ return acc;
21
+ }, {});
22
+ return mapValues(isEditMode ? formData : dataWithDefaultValues, (value, key) => {
23
+ const field = find(metaFields, { _id: key });
24
+ if (!field)
25
+ return value;
26
+ const defaultName = get(field, "defaultName");
27
+ const inputTypeSettings = get(field, "inputTypeSettings", {});
28
+ const allowMultiple = get(inputTypeSettings, `${InputSupportedTypes.ALLOW_MULTIPLE}`, false);
29
+ switch (defaultName) {
30
+ case InputTypes.DATE:
31
+ return value ? dayjs(value) : undefined;
32
+ case InputTypes.DATE_RANGE:
33
+ return isArray(value) && get(value, "length") === 2
34
+ ? [dayjs(first(value)), dayjs(nth(value, 1))]
35
+ : undefined;
36
+ case InputTypes.SELECT:
37
+ return allowMultiple ? value || [] : value !== null && value !== void 0 ? value : undefined;
38
+ case InputTypes.CHECKBOX:
39
+ return value || [];
40
+ default:
41
+ return value;
42
+ }
43
+ });
44
+ };
45
+ export const getFormItem = (item, fromDefaultValue, userOptions) => {
46
+ const name = get(item, "_id");
47
+ const label = get(item, "name");
48
+ const placeholder = get(item, "placeholder", "");
49
+ const defaultName = get(item, "defaultName");
50
+ const settings = get(item, "inputTypeSettings", {});
51
+ const options = get(item, "options", []);
52
+ const itemName = fromDefaultValue ? name : ["metadata", name];
53
+ const rules = fromDefaultValue
54
+ ? [...get(item, "additionalRules", [])]
55
+ : [];
56
+ if (get(item, "isMandatory")) {
57
+ rules.push({
58
+ required: true,
59
+ message: `${label} is required.`,
60
+ });
61
+ }
62
+ // NUMERIC_VALUE
63
+ if (get(settings, "NUMERIC_VALUE", null) === false) {
64
+ rules.push({
65
+ pattern: /^[^0-9]*$/,
66
+ message: "Numbers are not allowed.",
67
+ });
68
+ }
69
+ // SPECIAL_CHARACTERS
70
+ if (get(settings, "SPECIAL_CHARACTERS", null) === false) {
71
+ rules.push({
72
+ pattern: /^[a-zA-Z0-9\s]*$/,
73
+ message: "Special characters are not allowed.",
74
+ });
75
+ }
76
+ // CHARACTER_LIMIT
77
+ if (get(settings, "CHARACTER_LIMIT.allow", null) === true) {
78
+ const min = get(settings, "CHARACTER_LIMIT.minValue");
79
+ const max = get(settings, "CHARACTER_LIMIT.maxValue");
80
+ let message = "";
81
+ const hasMin = isNumber(min);
82
+ const hasMax = isNumber(max);
83
+ if (hasMin && hasMax) {
84
+ message = `Must be between ${min} and ${max} characters.`;
85
+ }
86
+ else if (hasMin && !hasMax) {
87
+ message = `Minimum ${min} characters required.`;
88
+ }
89
+ else if (!hasMin && hasMax) {
90
+ message = `Maximum ${max} characters allowed.`;
91
+ }
92
+ rules.push(Object.assign(Object.assign(Object.assign({}, (hasMin ? { min } : {})), (hasMax ? { max } : {})), { message }));
93
+ }
94
+ // REGEX
95
+ if (get(settings, "REGEX.allow") && get(settings, "REGEX.value")) {
96
+ const rawRegex = get(settings, "REGEX.value", "/.*/");
97
+ try {
98
+ const regex = new RegExp(rawRegex.replace(/\//g, ""));
99
+ rules.push({
100
+ pattern: regex,
101
+ message: `Must match pattern ${rawRegex}`,
102
+ });
103
+ }
104
+ catch (err) {
105
+ console.warn("Invalid regex: ", rawRegex);
106
+ }
107
+ }
108
+ // VALUE_RANGE
109
+ if (defaultName === InputTypes.NUMBERS &&
110
+ get(settings, "VALUE_RANGE.allow")) {
111
+ const min = get(settings, "VALUE_RANGE.minValue");
112
+ const max = get(settings, "VALUE_RANGE.maxValue");
113
+ const hasMin = isNumber(min);
114
+ const hasMax = isNumber(max);
115
+ let message = "";
116
+ if (hasMin && hasMax) {
117
+ message = `Must be between ${min} and ${max}.`;
118
+ }
119
+ else if (hasMin && !hasMax) {
120
+ message = `Minimum value is ${min}.`;
121
+ }
122
+ else if (!hasMin && hasMax) {
123
+ message = `Maximum value is ${max}.`;
124
+ }
125
+ rules.push(Object.assign(Object.assign(Object.assign({ type: "number" }, (hasMin ? { min } : {})), (hasMax ? { max } : {})), { message }));
126
+ }
127
+ switch (defaultName) {
128
+ case InputTypes.TEXT:
129
+ return (_jsx(Form.Item, { name: itemName, label: label, rules: rules, children: _jsx(Input, { placeholder: placeholder }) }, name));
130
+ case InputTypes.PARAGRAPH:
131
+ return (_jsx(Form.Item, { name: itemName, label: label, rules: rules, children: _jsx(Input.TextArea, { rows: 4, placeholder: placeholder }) }, name));
132
+ case InputTypes.DATE_RANGE:
133
+ return (_jsx(Form.Item, { name: itemName, label: label, rules: rules, children: _jsx(RangePicker, { showTime: !!get(settings, `${InputSupportedTypes.ALLOW_TIME}.allow`), style: { width: "100%" }, placeholder: ["Start", "End"], placement: "bottomLeft" }) }, name));
134
+ case InputTypes.LINK:
135
+ rules.push({
136
+ type: "url",
137
+ message: INVALID_URL,
138
+ });
139
+ return (_jsx(Form.Item, { name: itemName, label: label, rules: rules, children: _jsx(Input, { placeholder: placeholder }) }, name));
140
+ case InputTypes.CHECKBOX:
141
+ return (_jsx(Form.Item, { name: itemName, label: label, children: _jsx(Checkbox.Group, { options: map(options, (opt) => ({
142
+ label: get(opt, "label"),
143
+ value: get(opt, "value"),
144
+ })) }) }, name));
145
+ case InputTypes.NUMBERS:
146
+ return (_jsx(Form.Item, { name: itemName, label: label, rules: rules, children: _jsx(InputNumber, { style: { width: "100%" }, placeholder: placeholder }) }, name));
147
+ case InputTypes.DATE:
148
+ return (_jsx(Form.Item, { name: itemName, label: label, rules: rules, children: _jsx(DatePicker, { showTime: !!get(settings, `${InputSupportedTypes.ALLOW_TIME}.allow`), style: { width: "100%" }, placeholder: placeholder }) }, name));
149
+ case InputTypes.PERSON:
150
+ return (_jsx(Form.Item, { name: itemName, label: label, rules: rules, children: _jsx(Select, { mode: get(settings, InputSupportedTypes.ALLOW_MULTIPLE)
151
+ ? "multiple"
152
+ : undefined, allowClear: !!get(settings, InputSupportedTypes.ALLOW_CLEAR), showSearch: !!get(settings, InputSupportedTypes.SEARCHABLE), filterOption: (inputValue, option) => {
153
+ const name = get(option, "name") || "";
154
+ const email = get(option, "email") || "";
155
+ if (includes(name.toLowerCase(), inputValue.toLowerCase()) ||
156
+ includes(email.toLowerCase(), inputValue.toLowerCase())) {
157
+ return true;
158
+ }
159
+ return false;
160
+ }, placeholder: placeholder, options: userOptions, optionFilterProp: "children" }) }, name));
161
+ case InputTypes.TEAM:
162
+ case InputTypes.SELECT:
163
+ return (_jsx(Form.Item, { name: itemName, label: label, rules: rules, children: _jsx(Select, { mode: get(settings, InputSupportedTypes.ALLOW_MULTIPLE)
164
+ ? "multiple"
165
+ : undefined, allowClear: !!get(settings, InputSupportedTypes.ALLOW_CLEAR), showSearch: !!get(settings, InputSupportedTypes.SEARCHABLE), filterOption: (input, option) => { var _a; return ((_a = option === null || option === void 0 ? void 0 : option.label) === null || _a === void 0 ? void 0 : _a.toLowerCase().indexOf(input.toLowerCase())) >= 0; }, placeholder: placeholder, options: map(options, (opt) => ({
166
+ label: get(opt, "label"),
167
+ value: get(opt, "value"),
168
+ })) }) }, name));
169
+ case InputTypes.RADIO:
170
+ return (_jsx(Form.Item, { name: itemName, label: label, children: _jsx(Radio.Group, { options: map(options, (opt) => ({
171
+ label: get(opt, "label"),
172
+ value: get(opt, "value"),
173
+ })) }) }, name));
174
+ default:
175
+ return null;
176
+ }
177
+ };
178
+ const MetaForm = ({ metaFields, metaData, form, isEditMode, }) => {
179
+ const damConfig = useDamConfig();
180
+ const { brand, teams } = damConfig;
181
+ const brandId = get(brand, "_id");
182
+ const queryClient = useQueryClient();
183
+ const brandUsers = getCurrentBrandUsers(queryClient, brandId);
184
+ useEffect(() => {
185
+ const formData = {
186
+ metadata: buildInitialValues(metaData, metaFields, isEditMode),
187
+ };
188
+ form.setFieldsValue(formData);
189
+ }, [metaData, metaFields]);
190
+ const userOptions = useMemo(() => {
191
+ return map(brandUsers, (user) => getUserAvatar(user));
192
+ }, [brandUsers, brandId]);
193
+ return (_jsx(_Fragment, { children: metaFields.map((item) => getFormItem(item, false, userOptions)) }));
194
+ };
195
+ export default MetaForm;
@@ -0,0 +1,8 @@
1
+ import { FormInstance } from "antd";
2
+ import { AssetTemplateEntity, FileEntity } from "../../utilities/constants/interface";
3
+ declare const Metadata: ({ file, asset, form, }: {
4
+ file?: FileEntity;
5
+ asset: AssetTemplateEntity;
6
+ form: FormInstance;
7
+ }) => JSX.Element;
8
+ export default Metadata;
@@ -0,0 +1,52 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useMemo, useState } from "react";
3
+ import { get, isEmpty } from "lodash";
4
+ import Loader from "../../common/loader/loader";
5
+ import MetaForm from "./MetaForm";
6
+ import { useDamConfig } from "../../hocs/DamConfigContext";
7
+ import { createApiClient } from "../../hocs/configureAxios";
8
+ import { META_DATA_EMPTY_URL } from "../../utilities/constants/imageUrls";
9
+ const Metadata = ({ file, asset, form, }) => {
10
+ const damConfig = useDamConfig();
11
+ const api = useMemo(() => createApiClient(damConfig), [damConfig]);
12
+ const [state, setState] = useState({
13
+ assetsLoading: false,
14
+ assets: [],
15
+ loading: false,
16
+ templateLoading: false,
17
+ });
18
+ const { templateLoading } = state;
19
+ // useEffect(() => {
20
+ // if (assetId) {
21
+ // fetchTemplate();
22
+ // }
23
+ // }, [assetId]);
24
+ // const fetchTemplate = async () => {
25
+ // setState((prevState) => ({ ...prevState, templateLoading: true }));
26
+ // try {
27
+ // const response = await api.get(
28
+ // `${FETCH_ASSET_URL.replace(":assetId", assetId)}`
29
+ // );
30
+ // setState((prevState) => ({
31
+ // ...prevState,
32
+ // assetTemplate: get(response, "data", {}),
33
+ // templateLoading: false,
34
+ // }));
35
+ // setMetaFields(get(response, "data.metadataFields", []));
36
+ // } catch (error) {
37
+ // setState((prevState) => ({
38
+ // ...prevState,
39
+ // assetTemplate: {},
40
+ // templateLoading: false,
41
+ // }));
42
+ // showNotification(
43
+ // get(error, "message", SOMETHING_WENT_WRONG),
44
+ // NotificationStatus.ERROR
45
+ // );
46
+ // }
47
+ // };
48
+ const metaFields = useMemo(() => get(asset, "metadataFields", []), [asset]);
49
+ const metaData = useMemo(() => get(file, "metadata", {}), [file]);
50
+ return (_jsx("div", { className: "", children: templateLoading ? (_jsx(Loader, {})) : (_jsx(_Fragment, { children: isEmpty(metaFields) ? (_jsxs("div", { className: `md-lib-flex md-lib-flex-col md-lib-items-center md-lib-justify-center md-lib-min-h-[calc(100vh-127px)]`, children: [_jsx("img", { src: META_DATA_EMPTY_URL, alt: "No comments", width: 182, height: 114 }), _jsx("p", { className: "md-lib-pt-3 md-lib-font-semibold md-lib-text-textColor dark:md-lib-text-darkTextColor", children: "No metadata has been added yet" })] })) : (_jsx(MetaForm, { metaFields: metaFields, metaData: metaData, form: form, isEditMode: (file === null || file === void 0 ? void 0 : file._id) ? true : false })) })) }));
51
+ };
52
+ export default Metadata;
@@ -0,0 +1,9 @@
1
+ import { FileEntity, FolderEntity } from "../../utilities/constants/interface";
2
+ declare const PdfOptions: ({ zoom, setZoom, currentPage, totalPages, file, }: {
3
+ zoom: number;
4
+ setZoom: (z: number) => void;
5
+ currentPage: number;
6
+ totalPages: number;
7
+ file: FileEntity & FolderEntity;
8
+ }) => JSX.Element;
9
+ export default PdfOptions;
@@ -0,0 +1,35 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { AiOutlineInfoCircle, AiOutlineZoomIn, AiOutlineZoomOut, } from "react-icons/ai";
4
+ import { FiChevronDown } from "react-icons/fi";
5
+ import { Dropdown, Popover } from "antd";
6
+ import { FileInfoContent } from "../../common/CustomElements";
7
+ import ManageFile from "./ManageFile";
8
+ const AiOutlineInfoCircleIcon = AiOutlineInfoCircle;
9
+ const AiOutlineZoomOutIcon = AiOutlineZoomOut;
10
+ const FiChevronDownIcon = FiChevronDown;
11
+ const AiOutlineZoomInIcon = AiOutlineZoomIn;
12
+ const zoomLevels = [0.1, 0.25, 0.5, 0.75, 1.0];
13
+ const PdfOptions = ({ zoom, setZoom, currentPage, totalPages, file, }) => {
14
+ const [state, setState] = useState({
15
+ showFileAccess: false,
16
+ });
17
+ const { showFileAccess } = state;
18
+ const handleZoomChange = ({ key }) => {
19
+ setZoom(parseFloat(key));
20
+ };
21
+ const items = zoomLevels.map((z) => ({
22
+ key: z.toString(),
23
+ label: `${Math.round(z * 100)}%`,
24
+ }));
25
+ const toggleFileAccess = () => {
26
+ setState((prevState) => (Object.assign(Object.assign({}, prevState), { showFileAccess: !prevState.showFileAccess })));
27
+ };
28
+ return (_jsxs("div", { className: "md-lib-fixed md-lib-bottom-10 md-lib-left-1/2 -md-lib-translate-x-1/2 md-lib-bg-white dark:md-lib-bg-darkPrimary md-lib-rounded-xl md-lib-shadow-md md-lib-px-4 md-lib-py-2 md-lib-flex md-lib-items-center md-lib-gap-4 md-lib-border md-lib-border-borderColor dark:md-lib-border-darkBorderColor md-lib-z-50", children: [_jsx(Popover, { content: _jsx(FileInfoContent, { file: file }), title: "File Info", placement: "top", children: _jsx("button", { className: "md-lib-p-2 hover:md-lib-bg-secondaryColor hover:dark:md-lib-bg-darkPrimaryHoverColor md-lib-rounded-lg", onClick: toggleFileAccess, children: _jsx(AiOutlineInfoCircleIcon, { className: "md-lib-text-[20px]" }) }) }), _jsx("p", { className: "md-lib-h-10 md-lib-w-10 md-lib-flex md-lib-items-center md-lib-justify-center md-lib-text-base md-lib-text-secondaryTextColor dark:md-lib-text-darkSecondaryTextColor md-lib-border-borderColor md-lib-border md-lib-rounded-lg", children: currentPage + 1 }), _jsx("p", { className: "md-lib-text-textColor dark:md-lib-text-darkTextColor", children: "/" }), _jsx("p", { className: "md-lib-h-10 md-lib-w-10 md-lib-flex md-lib-items-center md-lib-justify-center md-lib-bg-secondaryColor dark:md-lib-bg-darkPrimaryHoverColor md-lib-rounded-lg", children: totalPages }), _jsx("div", { className: "md-lib-w-[1px] md-lib-h-5 md-lib-bg-borderColor dark:md-lib-bg-darkBorderColor" }), _jsx("button", { className: "md-lib-h-10 md-lib-w-10 md-lib-flex md-lib-items-center md-lib-justify-center hover:md-lib-bg-secondaryColor hover:dark:md-lib-bg-darkPrimaryHoverColor md-lib-rounded-lg", onClick: () => setZoom(Math.max(0.5, zoom - 0.1)), disabled: zoom <= 0.1, children: _jsx(AiOutlineZoomOutIcon, { className: "md-lib-text-[20px]" }) }), _jsx(Dropdown, { menu: {
29
+ items: items,
30
+ onClick: handleZoomChange,
31
+ selectable: true,
32
+ selectedKeys: [`${Math.round(zoom * 100)}%`],
33
+ }, trigger: ["click"], placement: "top", children: _jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-gap-1 md-lib-px-3 md-lib-py-1 md-lib-bg-secondaryColor dark:md-lib-bg-darkPrimaryHoverColor md-lib-rounded-md md-lib-cursor-pointer md-lib-text-sm md-lib-text-textColor dark:md-lib-text-darkTextColor", children: [`${Math.round(zoom * 100)}%`, _jsx(FiChevronDownIcon, { className: "md-lib-text-[16px]" })] }) }), _jsx("button", { className: "md-lib-h-10 md-lib-w-10 md-lib-flex md-lib-items-center md-lib-justify-center hover:md-lib-bg-secondaryColor hover:dark:md-lib-bg-darkPrimaryHoverColor md-lib-rounded-lg", onClick: () => setZoom(Math.min(1.5, zoom + 0.1)), disabled: zoom >= 1.5, children: _jsx(AiOutlineZoomInIcon, { className: "md-lib-text-[20px]" }) }), showFileAccess && (_jsx(ManageFile, { file: file, onClose: toggleFileAccess, open: showFileAccess }))] }));
34
+ };
35
+ export default PdfOptions;
@@ -0,0 +1,8 @@
1
+ import "@react-pdf-viewer/core/lib/styles/index.css";
2
+ import "@react-pdf-viewer/zoom/lib/styles/index.css";
3
+ import { FileEntity } from "../../utilities/constants/interface";
4
+ declare const PDFViewer: ({ fileUrl, file, }: {
5
+ fileUrl: string;
6
+ file: FileEntity;
7
+ }) => JSX.Element;
8
+ export default PDFViewer;