@anji-dashing/dam-solution-v2 5.8.173

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 +10 -0
  3. package/build/AssetType/AddFieldProperties.js +359 -0
  4. package/build/AssetType/AssetTemplatesTable.d.ts +10 -0
  5. package/build/AssetType/AssetTemplatesTable.js +172 -0
  6. package/build/AssetType/CreateAssetTemplate.d.ts +3 -0
  7. package/build/AssetType/CreateAssetTemplate.js +70 -0
  8. package/build/AssetType/CreateOrEditAssetTemplate.d.ts +1 -0
  9. package/build/AssetType/CreateOrEditAssetTemplate.js +100 -0
  10. package/build/AssetType/DraggedField.d.ts +14 -0
  11. package/build/AssetType/DraggedField.js +58 -0
  12. package/build/AssetType/EditAssetTemplate.d.ts +5 -0
  13. package/build/AssetType/EditAssetTemplate.js +257 -0
  14. package/build/AssetType/FieldsSection.d.ts +14 -0
  15. package/build/AssetType/FieldsSection.js +268 -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 +25 -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 +14 -0
  41. package/build/CreateClient/CreateClientBtn.js +54 -0
  42. package/build/CreateClient/CreateClientForm.d.ts +15 -0
  43. package/build/CreateClient/CreateClientForm.js +347 -0
  44. package/build/CreateClient/index.d.ts +20 -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 +72 -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 +8 -0
  63. package/build/MyDrive/ActionBar.js +190 -0
  64. package/build/MyDrive/AddDrive.d.ts +5 -0
  65. package/build/MyDrive/AddDrive.js +189 -0
  66. package/build/MyDrive/AddFolder.d.ts +11 -0
  67. package/build/MyDrive/AddFolder.js +165 -0
  68. package/build/MyDrive/BreadCrumbList.d.ts +10 -0
  69. package/build/MyDrive/BreadCrumbList.js +81 -0
  70. package/build/MyDrive/BulkUploadModal.d.ts +2 -0
  71. package/build/MyDrive/BulkUploadModal.js +324 -0
  72. package/build/MyDrive/DriveContainer.d.ts +14 -0
  73. package/build/MyDrive/DriveContainer.js +343 -0
  74. package/build/MyDrive/FileDownloadHistory.d.ts +7 -0
  75. package/build/MyDrive/FileDownloadHistory.js +107 -0
  76. package/build/MyDrive/FileMenuOptions.d.ts +11 -0
  77. package/build/MyDrive/FileMenuOptions.js +450 -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 +20 -0
  81. package/build/MyDrive/FolderGridView.js +95 -0
  82. package/build/MyDrive/FolderListView.d.ts +26 -0
  83. package/build/MyDrive/FolderListView.js +226 -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 +479 -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 +6 -0
  99. package/build/MyDrive/MyDriveMainContainer.js +63 -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 +52 -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 +11 -0
  121. package/build/MyDrive/fileDetails/FileDetails.js +125 -0
  122. package/build/MyDrive/fileDetails/FileHeader.d.ts +7 -0
  123. package/build/MyDrive/fileDetails/FileHeader.js +27 -0
  124. package/build/MyDrive/fileDetails/FileViewer.d.ts +10 -0
  125. package/build/MyDrive/fileDetails/FileViewer.js +17 -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 +6 -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 +199 -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 +10 -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 +90 -0
  148. package/build/MyDrive/files/MapFile.d.ts +9 -0
  149. package/build/MyDrive/files/MapFile.js +239 -0
  150. package/build/MyDrive/files/MoveToAnotherFolder.d.ts +9 -0
  151. package/build/MyDrive/files/MoveToAnotherFolder.js +67 -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 +16 -0
  155. package/build/MyDrive/index.js +50 -0
  156. package/build/MyDrive/routes.d.ts +10 -0
  157. package/build/MyDrive/routes.js +12 -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 +13 -0
  187. package/build/common/folders/TypeAndDateFilters.js +66 -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 +153 -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 +17 -0
  211. package/build/hocs/helpers.js +201 -0
  212. package/build/index.d.ts +12 -0
  213. package/build/index.js +12 -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 +4 -0
  219. package/build/react-query/services/brand-services.js +41 -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 +46 -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 +47 -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 +16 -0
  238. package/build/utilities/FoldersContext.js +15 -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 +97 -0
  242. package/build/utilities/constants/apiUrls.js +117 -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 +55 -0
  248. package/build/utilities/constants/messages.js +55 -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 +35 -0
  257. package/build/utilities/useAppParams.d.ts +8 -0
  258. package/build/utilities/useAppParams.js +72 -0
  259. package/package.json +93 -0
@@ -0,0 +1,99 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ import { get } from "lodash";
12
+ import { useEffect, useRef, forwardRef, useImperativeHandle, useMemo, useState, } from "react";
13
+ import ImageEditor from "tui-image-editor";
14
+ import "tui-image-editor/dist/tui-image-editor.css";
15
+ import { useDamConfig } from "../../hocs/DamConfigContext";
16
+ import { createApiClient } from "../../hocs/configureAxios";
17
+ import { GET_BASE64_USING_PATH_URL } from "../../utilities/constants/apiUrls";
18
+ const TuiImageEditor = forwardRef(({ file, path }, ref) => {
19
+ const editorRef = useRef(null);
20
+ const editorInstance = useRef(null);
21
+ const damConfig = useDamConfig();
22
+ const api = useMemo(() => createApiClient(damConfig), [damConfig]);
23
+ const [base64, setBase64] = useState("");
24
+ useEffect(() => {
25
+ if (path) {
26
+ getBase64();
27
+ }
28
+ }, [path]);
29
+ const getBase64 = () => __awaiter(void 0, void 0, void 0, function* () {
30
+ try {
31
+ const response = yield api.get(`${GET_BASE64_USING_PATH_URL}?key=${path}`);
32
+ // console.log(response);
33
+ const base64 = get(response, "base64", "");
34
+ const mimeType = get(response, "contentType", "image/png");
35
+ setBase64(`data:${mimeType};base64,${base64}`);
36
+ }
37
+ catch (err) {
38
+ console.log("Error while fetching file base64", err);
39
+ }
40
+ });
41
+ useEffect(() => {
42
+ if (!editorRef.current)
43
+ return;
44
+ editorInstance.current = new ImageEditor(editorRef.current, {
45
+ includeUI: {
46
+ loadImage: {
47
+ path: base64,
48
+ name: get(file, "name", "N/A"),
49
+ },
50
+ theme: {
51
+ "loadButton.display": "none",
52
+ },
53
+ menu: [
54
+ "crop",
55
+ "flip",
56
+ "rotate",
57
+ "draw",
58
+ "shape",
59
+ "icon",
60
+ "text",
61
+ "mask",
62
+ "filter",
63
+ ],
64
+ initMenu: "filter",
65
+ uiSize: {
66
+ width: "100%",
67
+ height: "700px",
68
+ },
69
+ menuBarPosition: "bottom",
70
+ },
71
+ cssMaxWidth: 700,
72
+ cssMaxHeight: 500,
73
+ selectionStyle: {
74
+ cornerSize: 20,
75
+ rotatingPointOffset: 70,
76
+ },
77
+ });
78
+ return () => {
79
+ var _a, _b;
80
+ (_b = (_a = editorInstance.current) === null || _a === void 0 ? void 0 : _a.destroy) === null || _b === void 0 ? void 0 : _b.call(_a);
81
+ };
82
+ }, [base64]);
83
+ useImperativeHandle(ref, () => ({
84
+ getEditedFile() {
85
+ return __awaiter(this, void 0, void 0, function* () {
86
+ if (!editorInstance.current)
87
+ return null;
88
+ const dataURL = editorInstance.current.toDataURL();
89
+ const blob = yield (yield fetch(dataURL)).blob();
90
+ return new File([blob], get(file, "name", "edited-image.png"), {
91
+ type: get(file, "mimetype", blob.type),
92
+ });
93
+ });
94
+ },
95
+ }));
96
+ return (_jsx("div", { className: "md-lib-w-full", children: _jsx("div", { ref: editorRef, className: "mb-4" }) }));
97
+ });
98
+ TuiImageEditor.displayName = "TuiImageEditor";
99
+ export default TuiImageEditor;
@@ -0,0 +1,8 @@
1
+ import { FolderEntity } from "../utilities/constants/interface";
2
+ declare function ImagePickerBreadCrumbList({ folder, parentFolderId, setParentFolderId, pickerFolderId, }: {
3
+ folder: FolderEntity;
4
+ parentFolderId?: string;
5
+ setParentFolderId?: (id: string) => void;
6
+ pickerFolderId?: string;
7
+ }): JSX.Element;
8
+ export default ImagePickerBreadCrumbList;
@@ -0,0 +1,35 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Breadcrumb, Tooltip } from "antd";
3
+ import { findIndex, get, last, map, slice } from "lodash";
4
+ import { useMemo } from "react";
5
+ import { FaChevronRight } from "react-icons/fa";
6
+ import { useDamConfig } from "../hocs/DamConfigContext";
7
+ const FaChevronRightIcon = FaChevronRight;
8
+ function ImagePickerBreadCrumbList({ folder, parentFolderId, setParentFolderId, pickerFolderId, }) {
9
+ const damConfig = useDamConfig();
10
+ const { rootFolderId } = damConfig;
11
+ const tree = useMemo(() => {
12
+ const fullTree = get(folder, "tree", []);
13
+ if (pickerFolderId) {
14
+ const pickerIndex = findIndex(fullTree, (item) => get(item, "_id") === pickerFolderId);
15
+ const parentIndex = findIndex(fullTree, (item) => get(item, "_id") === parentFolderId);
16
+ if (pickerIndex !== -1) {
17
+ const end = parentIndex !== -1 ? parentIndex + 1 : get(fullTree, "length");
18
+ return slice(fullTree, pickerIndex, end);
19
+ }
20
+ }
21
+ return fullTree;
22
+ }, [folder, pickerFolderId, parentFolderId]);
23
+ return (_jsx(Breadcrumb, { className: "md-lib-font-semibold md-lib-text-[22px] md-lib-truncate", separator: _jsx(FaChevronRightIcon, { className: "md-lib-mt-2" }), children: map(tree, (item) => {
24
+ const treeId = get(item, "_id");
25
+ const name = get(item, "name", "N/A");
26
+ const isLast = treeId === get(last(tree), "_id");
27
+ const handleClick = () => {
28
+ if (pickerFolderId && setParentFolderId && !isLast) {
29
+ setParentFolderId(treeId);
30
+ }
31
+ };
32
+ return (_jsx(Breadcrumb.Item, { onClick: handleClick, className: "md-lib-h-auto md-lib-cursor-pointer", children: _jsx(Tooltip, { title: name, children: _jsx("p", { className: "md-lib-max-w-28 md-lib-truncate md-lib-font-semibold md-lib-text-[22px]", children: name }) }) }, treeId));
33
+ }) }));
34
+ }
35
+ export default ImagePickerBreadCrumbList;
@@ -0,0 +1 @@
1
+ export default function ImagePickerDrive(): JSX.Element;
@@ -0,0 +1,41 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
11
+ import { DriveModes } from "../utilities/constants/interface";
12
+ import { createApiClient } from "../hocs/configureAxios";
13
+ import { useEffect, useMemo } from "react";
14
+ import { FETCH_SHARED_FILE_URL } from "../utilities/constants/apiUrls";
15
+ import { get } from "lodash";
16
+ import useConfig from "antd/es/config-provider/hooks/useConfig";
17
+ import useAppParams from "../utilities/useAppParams";
18
+ export default function ImagePickerDrive() {
19
+ const params = useAppParams();
20
+ const damConfig = useConfig();
21
+ const api = useMemo(() => createApiClient(damConfig), [damConfig]);
22
+ useEffect(() => {
23
+ if (get(params, "type") === DriveModes.FILE) {
24
+ fetchFileData();
25
+ }
26
+ }, []);
27
+ const fetchFileData = () => __awaiter(this, void 0, void 0, function* () {
28
+ const response = yield api.get(FETCH_SHARED_FILE_URL.replace(":fileId", get(params, "id")));
29
+ });
30
+ // const renderContent = () => {
31
+ // switch (get(params, "type")) {
32
+ // case DriveModes.FILE:
33
+ // return <FileDetails open={true} file={get(fileData, "data")} />;
34
+ // case DriveModes.FOLDERS:
35
+ // return <DriveContainer />;
36
+ // default:
37
+ // redirect("/not-found");
38
+ // }
39
+ // };
40
+ return _jsx(_Fragment, {});
41
+ }
@@ -0,0 +1,6 @@
1
+ import { type FolderTypes } from "../utilities/FoldersContext";
2
+ export default function MyDriveMainContainer({ folders, setFolders, onFolderChange, }: {
3
+ folders: FolderTypes[];
4
+ setFolders: React.Dispatch<React.SetStateAction<FolderTypes[]>>;
5
+ onFolderChange?: (folderId: string) => void;
6
+ }): JSX.Element;
@@ -0,0 +1,63 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import FolderTree from "./FolderTree";
3
+ import { useEffect, useState, useRef } from "react";
4
+ import { useDamConfig } from "../hocs/DamConfigContext";
5
+ import { isArray, map } from "lodash";
6
+ import DriveContainer from "./DriveContainer";
7
+ import useAppParams from "../utilities/useAppParams";
8
+ import { FoldersProvider } from "../utilities/FoldersContext";
9
+ export default function MyDriveMainContainer({ folders, setFolders, onFolderChange, }) {
10
+ const damConfig = useDamConfig();
11
+ const { rootFolderId, brand, isAdmin } = damConfig;
12
+ const params = useAppParams();
13
+ console.log('## all params from useAppParams', params);
14
+ const [selectedKeys, setSelectedKeys] = useState([]);
15
+ const [expandedKeys, setExpandedKeys] = useState([]);
16
+ const [globalSearch, setGlobalSearch] = useState("");
17
+ // Track if we've initialized from params to prevent rootFolderId from overriding
18
+ const initializedFromParamsRef = useRef(false);
19
+ useEffect(() => {
20
+ // Priority: URL params > Props from ParamsProvider > rootFolderId from config
21
+ if (params === null || params === void 0 ? void 0 : params.folderId) {
22
+ console.log('## Setting selectedKeys from params.folderId:', params.folderId);
23
+ setSelectedKeys(params.folderId);
24
+ initializedFromParamsRef.current = true;
25
+ }
26
+ else if (!(params === null || params === void 0 ? void 0 : params.folderId) && rootFolderId && !selectedKeys && !initializedFromParamsRef.current) {
27
+ // Only set to rootFolderId if no params AND selectedKeys is empty AND we haven't initialized from params
28
+ console.log('## No params.folderId and no selectedKeys, using rootFolderId:', rootFolderId);
29
+ setSelectedKeys(rootFolderId);
30
+ }
31
+ }, [params === null || params === void 0 ? void 0 : params.folderId, params === null || params === void 0 ? void 0 : params.id, params === null || params === void 0 ? void 0 : params.parentId]);
32
+ // Priority: selectedKeys > params > rootFolderId
33
+ // Never fall back to rootFolderId if params.folderId is set
34
+ const currentRootId = isArray(selectedKeys)
35
+ ? selectedKeys.length
36
+ ? selectedKeys[selectedKeys.length - 1]
37
+ : ((params === null || params === void 0 ? void 0 : params.folderId) || (params === null || params === void 0 ? void 0 : params.id) || (params === null || params === void 0 ? void 0 : params.parentId) || rootFolderId)
38
+ : selectedKeys
39
+ ? selectedKeys
40
+ : ((params === null || params === void 0 ? void 0 : params.folderId) || (params === null || params === void 0 ? void 0 : params.id) || (params === null || params === void 0 ? void 0 : params.parentId) || rootFolderId);
41
+ // Get the currently selected folder ID for DriveContainer
42
+ const selectedFolderId = isArray(selectedKeys)
43
+ ? selectedKeys.length
44
+ ? selectedKeys[selectedKeys.length - 1]
45
+ : ((params === null || params === void 0 ? void 0 : params.folderId) || (params === null || params === void 0 ? void 0 : params.id) || (params === null || params === void 0 ? void 0 : params.parentId) || rootFolderId)
46
+ : selectedKeys
47
+ ? selectedKeys
48
+ : ((params === null || params === void 0 ? void 0 : params.folderId) || (params === null || params === void 0 ? void 0 : params.id) || (params === null || params === void 0 ? void 0 : params.parentId) || rootFolderId);
49
+ console.log('## MyDriveMainContainer - selectedKeys:', selectedKeys, 'currentRootId:', currentRootId, 'selectedFolderId:', selectedFolderId, 'rootFolderId:', rootFolderId);
50
+ const handleExpand = (keys) => {
51
+ setExpandedKeys(map(keys, (k) => k.toString()));
52
+ };
53
+ // Wrapper function to handle both string and string[] for setSelectedKeys
54
+ const handleSetSelectedKeys = (keys) => {
55
+ const next = typeof keys === "string" ? [keys] : keys;
56
+ setSelectedKeys(next);
57
+ const singleFolderId = Array.isArray(next) && next.length === 1 ? next[0] : null;
58
+ if (singleFolderId && onFolderChange) {
59
+ onFolderChange(singleFolderId);
60
+ }
61
+ };
62
+ return (_jsxs(FoldersProvider, { value: { setFolders, folders, globalSearch }, children: [_jsx(FolderTree, { currentRootId: currentRootId, handleExpand: handleExpand, setSelectedKeys: setSelectedKeys, expandedKeys: expandedKeys, selectedKeys: selectedKeys, folders: folders, setExpandedKeys: setExpandedKeys, setFolders: setFolders, setGlobalSearch: setGlobalSearch, globalSearch: globalSearch }), _jsx("div", { className: "md-lib-h-[inherit] md-lib-overflow-x-auto", children: _jsx(DriveContainer, { parentFolderId: selectedFolderId, globalSearch: globalSearch, setGlobalSearch: setGlobalSearch, setSelectedKeys: handleSetSelectedKeys }) })] }));
63
+ }
@@ -0,0 +1,8 @@
1
+ export default function SearchFilter({ type, onSearch, name, isMetadata, isSelected, searchValue, }: {
2
+ type: string;
3
+ onSearch: (filters: Record<string, any>) => void;
4
+ isMetadata: boolean;
5
+ name: string;
6
+ isSelected: boolean;
7
+ searchValue: string | [string | string] | null;
8
+ }): JSX.Element;
@@ -0,0 +1,73 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button, DatePicker, Input, Popover, Radio } from "antd";
3
+ import { CiSearch } from "react-icons/ci";
4
+ import { InputTypes } from "../utilities/constants/interface";
5
+ import { useEffect, useState } from "react";
6
+ import dayjs from "dayjs";
7
+ import { DATE_FORMAT, DATE_WITH_TIME_FORMAT } from "../hocs/appConstants";
8
+ const CiSearchIcon = CiSearch;
9
+ export default function SearchFilter({ type, onSearch, name, isMetadata, isSelected, searchValue, }) {
10
+ const [open, setOpen] = useState(false);
11
+ const [value, setValue] = useState(null);
12
+ const [withTime, setWithTime] = useState(false); // toggle mode
13
+ useEffect(() => {
14
+ if (type === InputTypes.DATE || type === InputTypes.DATE_RANGE) {
15
+ setValue(isSelected && typeof searchValue === "string"
16
+ ? dayjs(searchValue)
17
+ : null);
18
+ }
19
+ else {
20
+ setValue(isSelected ? searchValue : null);
21
+ }
22
+ }, [type, isSelected, searchValue]);
23
+ const getInputField = (type) => {
24
+ switch (type) {
25
+ case InputTypes.DATE_RANGE:
26
+ case InputTypes.DATE:
27
+ return (_jsxs("div", { className: "md-lib-flex md-lib-flex-col md-lib-gap-2", children: [_jsxs(Radio.Group, { value: withTime ? "withTime" : "dateOnly", onChange: (e) => setWithTime(e.target.value === "withTime"), children: [_jsx(Radio, { value: "dateOnly", children: "Date only" }), _jsx(Radio, { value: "withTime", children: "With time" })] }), _jsx(DatePicker, { style: { width: "100%" }, onChange: (val) => setValue(val), value: value, placeholder: withTime ? "Select date & time" : "Select date", showTime: withTime })] }));
28
+ default:
29
+ return (_jsx(Input, { value: value, onChange: (e) => setValue(e.target.value), placeholder: "Search (min. 2 characters required)" }));
30
+ }
31
+ };
32
+ const handleCancel = () => {
33
+ onSearch({
34
+ searchKey: "",
35
+ searchValue: "",
36
+ metadataKey: "",
37
+ metadataValue: "",
38
+ });
39
+ setValue(null);
40
+ setWithTime(false);
41
+ setOpen(false);
42
+ };
43
+ const handleSearch = () => {
44
+ let formattedValue = value;
45
+ if ((type === InputTypes.DATE || type === InputTypes.DATE_RANGE) && value) {
46
+ formattedValue = withTime
47
+ ? value.format(DATE_WITH_TIME_FORMAT) // includes time
48
+ : value.format(DATE_FORMAT); // date only
49
+ }
50
+ if (type === InputTypes.TEXT
51
+ ? formattedValue.length >= 2 || !formattedValue
52
+ : true) {
53
+ onSearch(isMetadata
54
+ ? {
55
+ searchKey: "",
56
+ searchValue: "",
57
+ metadataKey: name,
58
+ metadataValue: formattedValue,
59
+ searchData: true,
60
+ }
61
+ : {
62
+ searchKey: name,
63
+ searchValue: formattedValue,
64
+ metadataKey: "",
65
+ metadataValue: "",
66
+ searchData: true,
67
+ });
68
+ setOpen(false);
69
+ }
70
+ };
71
+ const content = (_jsxs("div", { children: [getInputField(type), _jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-justify-end md-lib-mt-2 md-lib-gap-2", children: [_jsx(Button, { onClick: handleCancel, children: "Reset" }), _jsx(Button, { onClick: handleSearch, type: "primary", children: "Search" })] })] }));
72
+ return (_jsx(Popover, { content: content, title: "Search", trigger: "click", placement: "bottom", open: open, onOpenChange: (newOpen) => setOpen(newOpen), children: _jsx(CiSearchIcon, { onClick: () => setOpen(!open), className: "md-lib-mt-1 md-lib-cursor-pointer md-lib-shrink-0 md-lib-text-textColor dark:md-lib-text-darkTextColor hover:md-lib-opacity-80", size: 18 }) }));
73
+ }
@@ -0,0 +1,5 @@
1
+ import { FileEntity } from "../utilities/constants/interface";
2
+ declare const Sharebtn: ({ file }: {
3
+ file: FileEntity;
4
+ }) => JSX.Element;
5
+ export default Sharebtn;
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { GoShareAndroid } from "react-icons/go";
4
+ import { DriveModes } from "../utilities/constants/interface";
5
+ import CustomButton from "../common/Button";
6
+ import InviteTeamModal from "../settings/InviteTeamModal";
7
+ import { get } from "lodash";
8
+ const GoShareAndroidIcon = GoShareAndroid;
9
+ const Sharebtn = ({ file }) => {
10
+ const [state, setState] = useState({
11
+ showShareModal: false,
12
+ });
13
+ const { showShareModal } = state;
14
+ const toggleShareModal = () => {
15
+ setState((prevState) => (Object.assign(Object.assign({}, prevState), { showShareModal: !prevState.showShareModal })));
16
+ };
17
+ return (_jsxs(_Fragment, { children: [_jsx(CustomButton, { icon: _jsx(GoShareAndroidIcon, { size: 16 }), type: "primary", size: "large", label: "Share", onClick: toggleShareModal }), showShareModal && (_jsx(InviteTeamModal, { open: showShareModal, onClose: toggleShareModal, onFetchInvitations: () => { }, shareModal: true, fileIds: [get(file, "_id")], folderIds: [], inviteType: DriveModes.FILE, file: file }))] }));
18
+ };
19
+ export default Sharebtn;
@@ -0,0 +1,4 @@
1
+ export default function ToggleView({ showGrid, toggleView, }: {
2
+ showGrid: boolean;
3
+ toggleView: (value: boolean) => void;
4
+ }): JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Radio } from "antd";
3
+ import { BsGrid, BsList } from "react-icons/bs";
4
+ const BsListIcon = BsList;
5
+ const BsGridIcon = BsGrid;
6
+ export default function ToggleView({ showGrid, toggleView, }) {
7
+ const options = [
8
+ { label: _jsx(BsListIcon, {}), value: false },
9
+ { label: _jsx(BsGridIcon, {}), value: true },
10
+ ];
11
+ return (_jsx(Radio.Group, { options: options, onChange: (e) => toggleView(e.target.value), optionType: "button", buttonStyle: "solid", value: showGrid, size: "large", className: "grid-radio-btns md-lib-hidden md:md-lib-block" }));
12
+ }
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ import { FileUploadStatus } from "../utilities/constants/interface";
3
+ interface Props {
4
+ open: boolean;
5
+ statusList: {
6
+ name: string;
7
+ status: FileUploadStatus;
8
+ }[];
9
+ onClose: () => void;
10
+ }
11
+ declare const UploadStatusModal: React.FC<Props>;
12
+ export default UploadStatusModal;
@@ -0,0 +1,52 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Drawer, Progress } from "antd";
3
+ import { CheckCircleOutlined, CloseCircleOutlined, LoadingOutlined, } from "@ant-design/icons";
4
+ import { FileUploadStatus } from "../utilities/constants/interface";
5
+ import { map } from "lodash";
6
+ var ThemeModes;
7
+ (function (ThemeModes) {
8
+ ThemeModes["SUCCESS"] = "#016A1C";
9
+ ThemeModes["ERROR"] = "#E42131";
10
+ ThemeModes["PENDING"] = "#FB8951";
11
+ })(ThemeModes || (ThemeModes = {}));
12
+ const getStatusProps = (status) => {
13
+ switch (status) {
14
+ case FileUploadStatus.PENDING:
15
+ return {
16
+ percent: 0, // Will show animated progress with status="active"
17
+ status: "active",
18
+ icon: _jsx(LoadingOutlined, { spin: true, className: "md-lib-text-imagesColor", style: { fontSize: '18px' } }),
19
+ };
20
+ case FileUploadStatus.SUCCESS:
21
+ return {
22
+ percent: 100,
23
+ status: "success",
24
+ icon: _jsx(CheckCircleOutlined, { className: "md-lib-text-themeGreen", style: { fontSize: '18px' } }),
25
+ };
26
+ case FileUploadStatus.ERROR:
27
+ return {
28
+ percent: 100,
29
+ status: "exception",
30
+ icon: _jsx(CloseCircleOutlined, { className: "md-lib-text-dangerColor", style: { fontSize: '18px' } }),
31
+ };
32
+ }
33
+ };
34
+ const UploadStatusModal = ({ open, statusList, onClose }) => {
35
+ return (_jsx(Drawer, { title: "Uploading File", open: open, onClose: onClose, placement: "right", width: 400, mask: false, maskClosable: true, closable: true, destroyOnClose: false, children: _jsx("div", { className: "md-lib-space-y-4 md-lib-max-h-[calc(100vh-100px)] md-lib-overflow-y-auto md-lib-pr-2", children: map(statusList, ({ name, status }) => {
36
+ const { percent, status: progressStatus, icon, } = getStatusProps(status);
37
+ return (_jsxs("div", { className: "md-lib-mb-4 md-lib-p-3 md-lib-border md-lib-border-gray-200 md-lib-rounded", children: [_jsxs("div", { className: "md-lib-flex md-lib-justify-between md-lib-items-center md-lib-mb-2", children: [_jsx("span", { className: "md-lib-truncate md-lib-w-4/5 md-lib-text-sm md-lib-font-medium", children: name }), icon] }), _jsx(Progress, { percent: status === FileUploadStatus.PENDING ? undefined : percent, status: progressStatus, showInfo: true, strokeColor: status === FileUploadStatus.PENDING
38
+ ? ThemeModes.PENDING
39
+ : status === FileUploadStatus.SUCCESS
40
+ ? ThemeModes.SUCCESS
41
+ : ThemeModes.ERROR, strokeWidth: 10, format: () => {
42
+ if (status === FileUploadStatus.PENDING) {
43
+ return _jsx("span", { className: "md-lib-text-orange-600 md-lib-font-medium", children: "Uploading..." });
44
+ }
45
+ if (status === FileUploadStatus.SUCCESS) {
46
+ return _jsx("span", { className: "md-lib-text-green-600 md-lib-font-medium", children: "Complete" });
47
+ }
48
+ return _jsx("span", { className: "md-lib-text-red-600 md-lib-font-medium", children: "Failed" });
49
+ } })] }, name));
50
+ }) }) }));
51
+ };
52
+ export default UploadStatusModal;
@@ -0,0 +1,8 @@
1
+ import { CommentEntityType, FileEntity } from "../../utilities/constants/interface";
2
+ declare function CommentEntity({ comment, refreshData, parentId, file, }: {
3
+ comment: CommentEntityType;
4
+ refreshData: (params: any) => void;
5
+ parentId?: string;
6
+ file: FileEntity;
7
+ }): JSX.Element;
8
+ export default CommentEntity;
@@ -0,0 +1,102 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
11
+ import { getProfile, getRelativeTime } from "../../hocs/helpers";
12
+ import { NotificationStatus, } from "../../utilities/constants/interface";
13
+ import { Avatar, Dropdown } from "antd";
14
+ import { filter, get, includes } from "lodash";
15
+ import { PiArrowBendDownRight, PiThumbsUp, PiThumbsUpFill, } from "react-icons/pi";
16
+ import CustomButton from "../../common/Button";
17
+ import { MoreOutlined } from "@ant-design/icons";
18
+ import { useMemo, useState } from "react";
19
+ import { DeleteConfirmationModal } from "../../common/CustomElements";
20
+ import { DELETE_CONFIRMATION_MESSAGE, DELETE_MESSAGE_DESCRIPTION, DELETE_OK_TEXT, DELETE_SUCCESS, SOMETHING_WENT_WRONG, UPDATE_SUCCESS, } from "../../utilities/constants/messages";
21
+ import { FETCH_COMMENT_URL } from "../../utilities/constants/apiUrls";
22
+ import { showNotification } from "../../common/notifications";
23
+ import Editor from "./Editor";
24
+ import Comments from "./Comments";
25
+ import { useDamConfig } from "../../hocs/DamConfigContext";
26
+ import { createApiClient } from "../../hocs/configureAxios";
27
+ const PiArrowBendDownRightIcon = PiArrowBendDownRight;
28
+ const PiThumbsUpFillIcon = PiThumbsUpFill;
29
+ const PiThumbsUpIcon = PiThumbsUp;
30
+ function CommentEntity({ comment, refreshData, parentId, file, }) {
31
+ const damConfig = useDamConfig();
32
+ const { user } = damConfig;
33
+ const userId = get(user, "_id");
34
+ const api = useMemo(() => createApiClient(damConfig), [damConfig]);
35
+ const [state, setState] = useState({
36
+ loadingType: "",
37
+ showConfimation: false,
38
+ showEdit: false,
39
+ editorState: get(comment, "text", ""),
40
+ commentData: comment,
41
+ showReplies: false,
42
+ });
43
+ const { loadingType, showConfimation, showEdit, editorState, commentData, showReplies, } = state;
44
+ const toggleShowEdit = () => {
45
+ setState((prevState) => (Object.assign(Object.assign({}, prevState), { showEdit: !prevState.showEdit, loadingType: "" })));
46
+ };
47
+ const toggleConfirmation = () => {
48
+ setState((prevState) => (Object.assign(Object.assign({}, prevState), { showConfimation: !prevState.showConfimation, loadingType: "" })));
49
+ };
50
+ const toggleShowReplies = () => {
51
+ setState((prevState) => (Object.assign(Object.assign({}, prevState), { showReplies: !prevState.showReplies })));
52
+ };
53
+ const name = useMemo(() => get(commentData, "createdBy.name", "Unknown User"), [commentData]);
54
+ const text = useMemo(() => get(commentData, "text", ""), [commentData]);
55
+ const createdAt = useMemo(() => get(commentData, "createdAt"), [commentData]);
56
+ const likes = useMemo(() => get(commentData, "likes.length", 0), [commentData]);
57
+ const likesArray = useMemo(() => get(commentData, "likes", []), [commentData]);
58
+ const items = [
59
+ {
60
+ key: "edit",
61
+ label: "Edit",
62
+ onClick: toggleShowEdit,
63
+ },
64
+ {
65
+ key: "delete",
66
+ label: "Delete",
67
+ danger: true,
68
+ onClick: toggleConfirmation,
69
+ },
70
+ ];
71
+ const onDeleteComment = () => __awaiter(this, void 0, void 0, function* () {
72
+ setState((prevState) => (Object.assign(Object.assign({}, prevState), { loadingType: "delete" })));
73
+ try {
74
+ const response = yield api.delete(FETCH_COMMENT_URL.replace(":commentId", get(commentData, "_id")));
75
+ refreshData({});
76
+ toggleConfirmation();
77
+ showNotification(get(response, "data.message", DELETE_SUCCESS), NotificationStatus.SUCCESS);
78
+ }
79
+ catch (error) {
80
+ setState((prevState) => (Object.assign(Object.assign({}, prevState), { loadingType: "" })));
81
+ showNotification(get(error, "message", SOMETHING_WENT_WRONG), NotificationStatus.ERROR);
82
+ }
83
+ });
84
+ const handleUpdateComment = (payload, loadingType) => __awaiter(this, void 0, void 0, function* () {
85
+ setState((prevState) => (Object.assign(Object.assign({}, prevState), { loadingType })));
86
+ try {
87
+ const response = yield api.put(FETCH_COMMENT_URL.replace(":commentId", get(commentData, "_id")), payload);
88
+ setState((prevState) => (Object.assign(Object.assign({}, prevState), { commentData: get(response, "data.comment", commentData), loadingType: "", editorState: get(response, "data.comment.text", ""), showEdit: false })));
89
+ showNotification(get(response, "data.message", UPDATE_SUCCESS), NotificationStatus.SUCCESS);
90
+ }
91
+ catch (error) {
92
+ setState((prevState) => (Object.assign(Object.assign({}, prevState), { loadingType: "" })));
93
+ showNotification(get(error, "message", SOMETHING_WENT_WRONG), NotificationStatus.ERROR);
94
+ }
95
+ });
96
+ return (_jsxs(_Fragment, { children: [showEdit ? (_jsxs("div", { className: "md-lib-flex md-lib-flex-col md-lib-gap-2 md-lib-transition-all md-lib-duration-300 md-lib-ease-in-out md-lib-opacity-100 md-lib-animate-fade-in", children: [_jsx(Editor, { setEditorState: (state) => setState((prevState) => (Object.assign(Object.assign({}, prevState), { editorState: state }))), editorState: editorState }), _jsxs("div", { className: "md-lib-flex md-lib-justify-end md-lib-pt-2 md-lib-gap-2", children: [_jsx(CustomButton, { label: "Cancel", onClick: toggleShowEdit }), _jsx(CustomButton, { type: "primary", label: "Update", onClick: () => handleUpdateComment({ text: editorState }, "text"), loading: loadingType === "text" })] })] }, get(commentData, "_id"))) : (_jsxs("div", { className: `md-lib-transition-all md-lib-duration-300 md-lib-ease-in-out md-lib-animate-fade-in ${parentId ? "md-lib-bg-borderColor md-lib-dark:bg-darkBorderColor" : ""}`, children: [_jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-justify-between", children: [_jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-gap-2", children: [_jsx(Avatar, { className: "md-lib-bg-secondaryTextColor dark:md-lib-bg-darkSecondaryTextColor md-lib-cursor-default", size: 36, children: getProfile(name) }), _jsx("p", { className: "md-lib-font-semibold md-lib-text-textColor dark:md-lib-text-darkTextColor md-lib-text-base", children: name })] }), _jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-gap-2", children: [_jsx("p", { className: "md-lib-text-xs md-lib-text-secondaryTextColor dark:md-lib-text-darkSecondaryTextColor", children: getRelativeTime(createdAt) }), userId === get(commentData, "createdBy._id") && (_jsx(Dropdown, { menu: { items }, trigger: ["click"], placement: "bottomRight", children: _jsx(MoreOutlined, {}) }))] })] }), _jsx("div", { className: "md-lib-py-4 md-lib-text-textColor dark:md-lib-text-darkTextColor md-lib-pr-[10px] md-lib-text-base", dangerouslySetInnerHTML: { __html: text } }), _jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-justify-between md-lib-pr-[10px]", children: [_jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-gap-2", children: [_jsxs("p", { className: "md-lib-p-2 md-lib-text-interactiveTextColor dark:md-lib-text-darkTextColor md-lib-text-base md-lib-font-medium", children: [likes, " ", likes === 1 ? "like" : "likes"] }), _jsx(CustomButton, { type: "text", icon: _jsx(PiArrowBendDownRightIcon, { size: 24 }), size: "large", className: "md-lib-text-interactiveTextColor dark:md-lib-text-darkTextColor md-lib-text-base md-lib-font-medium", label: "Reply", onClick: toggleShowReplies })] }), _jsx(CustomButton, { type: "text", loading: loadingType === "like", icon: loadingType === "like" ? (_jsx(_Fragment, {})) : includes(likesArray, userId) ? (_jsx(PiThumbsUpFillIcon, { size: 24 })) : (_jsx(PiThumbsUpIcon, { size: 24 })), size: "large", className: "md-lib-text-interactiveTextColor dark:md-lib-text-darkTextColor", label: "", onClick: () => handleUpdateComment({
97
+ likes: includes(likesArray, userId)
98
+ ? filter(likesArray, (id) => id !== userId)
99
+ : [...likesArray, userId],
100
+ }, "like") })] })] }, get(commentData, "_id"))), showConfimation && (_jsx(DeleteConfirmationModal, { showDeleteModal: showConfimation, toggleDeleteModal: toggleConfirmation, okText: DELETE_OK_TEXT, onOk: onDeleteComment, loading: loadingType === "delete", description: DELETE_CONFIRMATION_MESSAGE.replace(":action", "Delete").replace(" :entity", ""), subHeading: DELETE_MESSAGE_DESCRIPTION })), showReplies && (_jsxs("div", { className: "md-lib-mt-3 md-lib-ml-12 md-lib-flex md-lib-flex-col md-lib-gap-3 md-lib-animate-fade-in md-lib-transition-all md-lib-duration-300 md-lib-ease-in-out", children: [_jsx("p", { className: "md-lib-text-sm md-lib-text-secondaryTextColor dark:md-lib-text-darkSecondaryTextColor md-lib-font-semibold", children: "Replies" }), _jsx(Comments, { parentId: get(comment, "_id"), file: file })] }))] }));
101
+ }
102
+ export default CommentEntity;
@@ -0,0 +1,6 @@
1
+ import { FileEntity } from "../../utilities/constants/interface";
2
+ declare const Comments: ({ file, parentId, }: {
3
+ file?: FileEntity;
4
+ parentId?: string;
5
+ }) => JSX.Element;
6
+ export default Comments;