@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,165 @@
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 { Button, Drawer, Form, Input, Select, Typography } from "antd";
12
+ import { useEffect, useMemo, useState } from "react";
13
+ import { ACCESS_TYPES, DAM_LOCATION_TYPES } from "../hocs/appConstants";
14
+ import { useDamConfig } from "../hocs/DamConfigContext";
15
+ import { CREATE_SUB_BRAND } from "../utilities/constants/apiUrls";
16
+ import axios from "axios";
17
+ import { createApiClient } from "../hocs/configureAxios";
18
+ import { CREATE_SUCCESS, SOMETHING_WENT_WRONG, } from "../utilities/constants/messages";
19
+ import { NotificationStatus } from "../utilities/constants/interface";
20
+ import { showNotification } from "../common/notifications";
21
+ import { get } from "lodash";
22
+ const CreateClientForm = ({ teamsApi, username, password, toggleShow, onSuccess, clientSubdomain, }) => {
23
+ const damConfig = useDamConfig();
24
+ const { appType } = damConfig;
25
+ const [loading, setLoading] = useState(false);
26
+ const [damLocationType, setDamLocationType] = useState("external");
27
+ const [filteredTeams, setFilteredTeams] = useState([]);
28
+ const api = useMemo(() => createApiClient(damConfig), [damConfig]);
29
+ const [form] = Form.useForm();
30
+ const onChangeDamLocationType = (e) => {
31
+ setDamLocationType(e);
32
+ form.setFieldValue("dam_location_details", { type: e });
33
+ };
34
+ useEffect(() => {
35
+ if (clientSubdomain) {
36
+ form.setFieldValue("subdomain", clientSubdomain);
37
+ }
38
+ }, []);
39
+ const onFinish = (data) => __awaiter(void 0, void 0, void 0, function* () {
40
+ var _a, _b, _c, _d, _e, _f, _g;
41
+ try {
42
+ const values = Object.assign(Object.assign({}, data), { accessKey: appType == "reactJs"
43
+ ? process.env.REACT_APP_MIXDRIVE_CLIENT_PARENT_ACCESS_KEY
44
+ : process.env.NEXT_PUBLIC_MIXDRIVE_CLIENT_PARENT_ACCESS_KEY, secretKey: appType == "reactJs"
45
+ ? process.env.REACT_APP_MIXDRIVE_CLIENT_PARENT_SECRET_KEY
46
+ : process.env.NEXT_PUBLIC_MIXDRIVE_CLIENT_PARENT_SECRET_KEY, parentSubdomain: appType == "reactJs"
47
+ ? process.env.REACT_APP_MIXDRIVE_CLIENT_PARENT_SUBDOMAIN
48
+ : process.env.NEXT_PUBLIC_MIXDRIVE_CLIENT_PARENT_SUBDOMAIN, teamsApiDetails: {
49
+ teamsApi: teamsApi,
50
+ username: username,
51
+ password: password,
52
+ }, damLocationDetails: damLocationType === "external"
53
+ ? {
54
+ bucket: (_a = data === null || data === void 0 ? void 0 : data.damLocationDetails) === null || _a === void 0 ? void 0 : _a.bucket,
55
+ locationType: damLocationType === "external" ? "EXTERNAL" : "INTERNAL",
56
+ rootPath: (_b = data === null || data === void 0 ? void 0 : data.damLocationDetails) === null || _b === void 0 ? void 0 : _b.rootPath,
57
+ accessKeyId: (_c = data === null || data === void 0 ? void 0 : data.damLocationDetails) === null || _c === void 0 ? void 0 : _c.accessKeyId,
58
+ secretAccessKey: (_d = data === null || data === void 0 ? void 0 : data.damLocationDetails) === null || _d === void 0 ? void 0 : _d.secretAccessKey,
59
+ url: (_e = data === null || data === void 0 ? void 0 : data.damLocationDetails) === null || _e === void 0 ? void 0 : _e.url,
60
+ region: (_f = data === null || data === void 0 ? void 0 : data.damLocationDetails) === null || _f === void 0 ? void 0 : _f.region,
61
+ }
62
+ : {
63
+ locationType: damLocationType === "external" ? "EXTERNAL" : "INTERNAL",
64
+ } });
65
+ setLoading(true);
66
+ const response = yield api.post(CREATE_SUB_BRAND, values);
67
+ setLoading(false);
68
+ showNotification((_g = response === null || response === void 0 ? void 0 : response.message) !== null && _g !== void 0 ? _g : (get(response, "message") || CREATE_SUCCESS), NotificationStatus.SUCCESS);
69
+ toggleShow();
70
+ if (onSuccess) {
71
+ onSuccess(response === null || response === void 0 ? void 0 : response.data);
72
+ }
73
+ }
74
+ catch (error) {
75
+ // console.error("Error creating client:", error);
76
+ setLoading(false);
77
+ showNotification(get(error, "message", SOMETHING_WENT_WRONG), NotificationStatus.ERROR);
78
+ }
79
+ });
80
+ useEffect(() => {
81
+ if (teamsApi && username && password) {
82
+ fetchTeams();
83
+ }
84
+ }, [teamsApi, username, password]);
85
+ const fetchTeams = () => __awaiter(void 0, void 0, void 0, function* () {
86
+ var _a, _b;
87
+ try {
88
+ const response = yield axios.get(teamsApi, {
89
+ headers: {
90
+ Authorization: "Basic " + btoa(username + ":" + password),
91
+ },
92
+ });
93
+ const options = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.map((team) => {
94
+ return {
95
+ label: (_jsxs(Typography.Text, { style: { display: "flex" }, children: [team === null || team === void 0 ? void 0 : team.id, " ", team === null || team === void 0 ? void 0 : team.name, " ", _jsx("span", { style: { marginLeft: "auto" }, children: team === null || team === void 0 ? void 0 : team.type })] })),
96
+ value: team === null || team === void 0 ? void 0 : team.id,
97
+ key: `${team === null || team === void 0 ? void 0 : team.id} - ${team === null || team === void 0 ? void 0 : team.name} - ${team === null || team === void 0 ? void 0 : team.type}`,
98
+ };
99
+ });
100
+ setFilteredTeams(options);
101
+ }
102
+ catch (err) {
103
+ console.log("Error while fetching external teams", err);
104
+ }
105
+ });
106
+ return (_jsx(Drawer, { open: true, title: "Create Client", onClose: toggleShow, width: 500, maskClosable: false, children: _jsxs(Form, { layout: "vertical", form: form, onFinish: onFinish, children: [_jsx(Form.Item, { label: "Name", name: "name", rules: [
107
+ {
108
+ required: true,
109
+ message: "Name is required",
110
+ },
111
+ ], children: _jsx(Input, { placeholder: "Name" }) }), _jsx(Form.Item, { label: "Access Types", name: "accessTypes", rules: [
112
+ {
113
+ required: true,
114
+ message: "Access type is required",
115
+ },
116
+ ], children: _jsx(Select, { options: ACCESS_TYPES, mode: "multiple", placeholder: "Select Access Type" }) }), _jsx(Form.Item, { label: "Admin Teams", name: "adminTeams", rules: [
117
+ {
118
+ required: true,
119
+ message: "Team Ids is required",
120
+ },
121
+ ], children: _jsx(Select, { showSearch: true, mode: "multiple", placeholder: "Team Ids", options: filteredTeams, optionFilterProp: "key" }) }), _jsxs(Form.Item, { label: "DAM Location Details", name: "damLocationDetails", children: [_jsx(Form.Item, { label: "Type", name: ["damLocationDetails", "type"], rules: [
122
+ {
123
+ required: true,
124
+ message: "Type is required",
125
+ },
126
+ ], children: _jsx(Select, { options: DAM_LOCATION_TYPES, onChange: (e) => {
127
+ onChangeDamLocationType(e);
128
+ }, placeholder: "Type" }) }), damLocationType === "external" && (_jsxs(_Fragment, { children: [_jsx(Form.Item, { label: "Bucket", name: ["damLocationDetails", "bucket"], rules: [
129
+ {
130
+ required: true,
131
+ message: "Bucket is required",
132
+ },
133
+ ], children: _jsx(Input, { placeholder: "Bucket" }) }), _jsx(Form.Item, { label: "Root Path", name: ["damLocationDetails", "rootPath"], rules: [
134
+ {
135
+ required: true,
136
+ message: "Root path is required",
137
+ },
138
+ ], children: _jsx(Input, { placeholder: "Root path" }) }), _jsx(Form.Item, { label: "Access Key", name: ["damLocationDetails", "accessKeyId"], rules: [
139
+ {
140
+ required: true,
141
+ message: "Access key is required",
142
+ },
143
+ ], children: _jsx(Input, { placeholder: "Access Key" }) }), _jsx(Form.Item, { label: "Secret Access Key", name: ["damLocationDetails", "secretAccessKey"], rules: [
144
+ {
145
+ required: true,
146
+ message: "Secret Access Key is required",
147
+ },
148
+ ], children: _jsx(Input, { placeholder: "Secret Key" }) }), _jsx(Form.Item, { label: "Url", name: ["damLocationDetails", "url"], rules: [
149
+ {
150
+ required: true,
151
+ message: "Url is required",
152
+ },
153
+ ], children: _jsx(Input, { placeholder: "Url" }) }), _jsx(Form.Item, { label: "Region", name: ["damLocationDetails", "region"], rules: [
154
+ {
155
+ required: true,
156
+ message: "Region is required",
157
+ },
158
+ ], children: _jsx(Input, { placeholder: "Region" }) })] }))] }), _jsx(Form.Item, { label: "Subdomain", name: "subdomain", rules: [
159
+ {
160
+ required: true,
161
+ message: "Subdomain is required",
162
+ },
163
+ ], children: _jsx(Input, { placeholder: "Subdomain" }) }), _jsx(Form.Item, { children: _jsx(Button, { htmlType: "submit", type: "primary", block: true, loading: loading, children: "Submit" }) })] }) }));
164
+ };
165
+ export default CreateClientForm;
@@ -0,0 +1,14 @@
1
+ declare function App(props: {
2
+ accessKey: string;
3
+ secretKey: string;
4
+ subdomain: string;
5
+ clientSubdomain: string;
6
+ teamsApi: string;
7
+ username: string;
8
+ password: string;
9
+ onSuccess: (data: any) => void;
10
+ teamIds: string[] | number[];
11
+ styles: Record<string, any>;
12
+ appType: string;
13
+ }): JSX.Element;
14
+ export default App;
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { DamConfigProvider } from "../hocs/DamConfigContext";
3
+ import { ThemeProvider } from "../hocs/ThemeContext";
4
+ import { ThemeModes } from "../utilities/constants/interface";
5
+ import CreateClient from "./CreateClientBtn";
6
+ import ToastProvider from "../hocs/ToastProvider";
7
+ function App(props) {
8
+ const config = {
9
+ damAccessKey: props === null || props === void 0 ? void 0 : props.accessKey,
10
+ secretKey: props === null || props === void 0 ? void 0 : props.secretKey,
11
+ subdomain: props === null || props === void 0 ? void 0 : props.subdomain,
12
+ teamIds: props === null || props === void 0 ? void 0 : props.teamIds,
13
+ styles: props === null || props === void 0 ? void 0 : props.styles,
14
+ appType: props === null || props === void 0 ? void 0 : props.appType,
15
+ };
16
+ return (_jsx(DamConfigProvider, { config: config, children: _jsxs(ThemeProvider, { styles: props === null || props === void 0 ? void 0 : props.styles, sessionTheme: ThemeModes.LIGHT, children: [_jsx(CreateClient, { teamsApi: props === null || props === void 0 ? void 0 : props.teamsApi, username: props === null || props === void 0 ? void 0 : props.username, password: props === null || props === void 0 ? void 0 : props.password, clientSubdomain: props === null || props === void 0 ? void 0 : props.clientSubdomain, onSuccess: props === null || props === void 0 ? void 0 : props.onSuccess }), _jsx(ToastProvider, {})] }) }));
17
+ }
18
+ export default App;
@@ -0,0 +1,14 @@
1
+ import { FormInstance } from "antd";
2
+ import { MetaDataFieldEntity } from "../utilities/constants/interface";
3
+ declare function MetaFieldOptions({ meta, imagePickerId, form, previousMetaFields, index, totalFields, onMetaFieldChange, nextFieldId, allFieldIds, }: {
4
+ meta: MetaDataFieldEntity;
5
+ imagePickerId: string;
6
+ form: FormInstance;
7
+ previousMetaFields: MetaDataFieldEntity[];
8
+ index: number;
9
+ totalFields: number;
10
+ onMetaFieldChange?: (filters: Record<string, any>, index: number) => void;
11
+ nextFieldId?: string;
12
+ allFieldIds: string[];
13
+ }): JSX.Element;
14
+ export default MetaFieldOptions;
@@ -0,0 +1,75 @@
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 { Form } from "antd";
12
+ import { useEffect, useMemo, useState } from "react";
13
+ import { find, get, map, pick, slice } from "lodash";
14
+ import { FETCH_META_FIELD_OPTIONS_URL } from "../utilities/constants/apiUrls";
15
+ import { InputTypes, NotificationStatus, } from "../utilities/constants/interface";
16
+ import { CustomSelectFormItem } from "../common/RenderFormItem";
17
+ import { showNotification } from "../common/notifications";
18
+ import { SOMETHING_WENT_WRONG } from "../utilities/constants/messages";
19
+ import { useQueryClient } from "react-query";
20
+ import { getCurrentBrandUsers } from "../react-query/hooks/brand-hooks";
21
+ import { useDamConfig } from "../hocs/DamConfigContext";
22
+ import { createApiClient } from "../hocs/configureAxios";
23
+ function MetaFieldOptions({ meta, imagePickerId, form, previousMetaFields, index, totalFields, onMetaFieldChange, nextFieldId, allFieldIds, }) {
24
+ const allFormValues = Form.useWatch([], form);
25
+ const filters = pick(allFormValues, slice(allFieldIds, 0, index));
26
+ const damConfig = useDamConfig();
27
+ const { brand } = damConfig;
28
+ const brandId = get(brand, "_id");
29
+ const queryClient = useQueryClient();
30
+ const users = getCurrentBrandUsers(queryClient, brandId);
31
+ const [state, setState] = useState({
32
+ loading: false,
33
+ options: [],
34
+ });
35
+ const api = useMemo(() => createApiClient(damConfig), [damConfig]);
36
+ const { loading, options } = state;
37
+ const currentValue = Form.useWatch(get(meta, "_id"), form);
38
+ const allValues = Form.useWatch([], form);
39
+ const fetchOptions = (...args_1) => __awaiter(this, [...args_1], void 0, function* (filters = {}) {
40
+ setState((prevState) => (Object.assign(Object.assign({}, prevState), { loading: true })));
41
+ try {
42
+ const payload = {
43
+ distinctValuesKey: get(meta, "_id"),
44
+ filters,
45
+ };
46
+ const response = yield api.put(FETCH_META_FIELD_OPTIONS_URL.replace(":id", imagePickerId), payload);
47
+ setState((prevState) => (Object.assign(Object.assign({}, prevState), { loading: false, options: get(meta, "defaultValue") === InputTypes.PERSON
48
+ ? map(get(response, "data.values"), (id) => {
49
+ const user = find(users, (u) => get(u, "_id") === id);
50
+ return {
51
+ label: get(user, "name", "Unknown"),
52
+ value: get(user, "_id", id),
53
+ };
54
+ })
55
+ : map(get(response, "data.values"), (text) => ({
56
+ label: text,
57
+ value: text,
58
+ })) })));
59
+ }
60
+ catch (err) {
61
+ showNotification(get(err, "message", SOMETHING_WENT_WRONG), NotificationStatus.ERROR);
62
+ setState({ loading: false, options: [] });
63
+ }
64
+ });
65
+ useEffect(() => {
66
+ fetchOptions(filters);
67
+ }, [JSON.stringify(filters)]);
68
+ return (_jsx(CustomSelectFormItem, { name: get(meta, "_id"), label: get(meta, "name"), options: options, loading: loading, onChange: (value) => {
69
+ form.setFieldValue(get(meta, "_id"), value);
70
+ if (typeof onMetaFieldChange === "function") {
71
+ onMetaFieldChange(filters, index);
72
+ }
73
+ } }));
74
+ }
75
+ export default MetaFieldOptions;
@@ -0,0 +1,8 @@
1
+ import { ImagePickerEntity } from "../utilities/constants/interface";
2
+ declare function TestImagePickerModal({ imagePicker, open, toggleModal, setSelectedFile, }: {
3
+ imagePicker: ImagePickerEntity | {};
4
+ open: boolean;
5
+ toggleModal: () => void;
6
+ setSelectedFile: (thumbnailUrl: string, value: string) => void;
7
+ }): JSX.Element;
8
+ export default TestImagePickerModal;
@@ -0,0 +1,61 @@
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 { Modal } from "antd";
12
+ import { get } from "lodash";
13
+ import DriveContainer from "../MyDrive/DriveContainer";
14
+ import { useMemo, useState } from "react";
15
+ import CustomButton from "../common/Button";
16
+ import TestImageFromMetalData from "./TestImgFromMetaData";
17
+ import { getFormattedValue } from "../hocs/helpers";
18
+ import { createApiClient } from "../hocs/configureAxios";
19
+ import { useDamConfig } from "../hocs/DamConfigContext";
20
+ import { FETCH_ASSET_URL, FETCH_SHARED_FILE_URL, } from "../utilities/constants/apiUrls";
21
+ function TestImagePickerModal({ imagePicker, open, toggleModal, setSelectedFile, }) {
22
+ const [state, setState] = useState({
23
+ parentFolderId: get(imagePicker, "folderId"),
24
+ fileForConfirmation: {},
25
+ });
26
+ const damConfig = useDamConfig();
27
+ const api = useMemo(() => createApiClient(damConfig), [damConfig]);
28
+ const { parentFolderId, fileForConfirmation } = state;
29
+ const onSelectFile = () => __awaiter(this, void 0, void 0, function* () {
30
+ // console.log(fileForConfirmation);
31
+ const response = yield api.get(FETCH_SHARED_FILE_URL.replace(":fileId", get(fileForConfirmation, "_id")));
32
+ // console.log(response);
33
+ const fileData = get(response, "data");
34
+ const assetId = get(fileData, "assetId");
35
+ const assetTypeResponse = yield api.get(FETCH_ASSET_URL.replace(":assetId", assetId));
36
+ const imagePickerOutputFormat = get(assetTypeResponse, "data.imagePickerOutputFormat", []);
37
+ const metadataFields = get(assetTypeResponse, "data.metadataFields", []);
38
+ // console.log(imagePickerOutputFormat);
39
+ const formattedOutputFormat = imagePickerOutputFormat.map((field) => {
40
+ // console.log("field", field);
41
+ const metaField = metadataFields.find((item) => (item === null || item === void 0 ? void 0 : item.name) == (field === null || field === void 0 ? void 0 : field.name));
42
+ return Object.assign(Object.assign({}, field), { fieldId: get(metaField, "_id") });
43
+ });
44
+ // console.log(formattedOutputFormat);
45
+ const value = getFormattedValue(formattedOutputFormat, fileForConfirmation === null || fileForConfirmation === void 0 ? void 0 : fileForConfirmation.s3Url, get(fileData, "metadata", {}));
46
+ console.log(value);
47
+ setSelectedFile(fileForConfirmation === null || fileForConfirmation === void 0 ? void 0 : fileForConfirmation.thumbnailUrl, value);
48
+ });
49
+ return (_jsx(Modal, { title: `Test ${get(imagePicker, "name", "Image picker")}`, open: open, onCancel: toggleModal, okText: "Create", maskClosable: false, width: get(imagePicker, "assetId") ? 600 : 1000, footer: get(fileForConfirmation, "thumbnailUrl") ? (_jsx(CustomButton, { type: "primary", label: "Confirm", onClick: () => {
50
+ onSelectFile();
51
+ } }, "confirm")) : null, children: get(imagePicker, "assetId") ? (_jsx(TestImageFromMetalData, { imagePicker: imagePicker, selectedPickerFile: fileForConfirmation, setSelectedFile: (file) => {
52
+ setState((prevState) => (Object.assign(Object.assign({}, prevState), { fileForConfirmation: file })));
53
+ } })) : (_jsx(DriveContainer, { setSelectedFile: (file, localFile = false) => {
54
+ console.log("local file", file);
55
+ setState((prevState) => (Object.assign(Object.assign({}, prevState), { fileForConfirmation: file })));
56
+ if (localFile) {
57
+ setSelectedFile(get(file, "s3Url", ""), get(file, "thumbnailUrl", ""));
58
+ }
59
+ }, parentFolderId: parentFolderId, setParentFolderId: (id) => setState((prevState) => (Object.assign(Object.assign({}, prevState), { parentFolderId: id, fileForConfirmation: {} }))), pickerFolderId: get(imagePicker, "folderId"), selectedPickerFile: fileForConfirmation, imagePicker: imagePicker })) }));
60
+ }
61
+ export default TestImagePickerModal;
@@ -0,0 +1,7 @@
1
+ import { FileEntity, ImagePickerEntity } from "../utilities/constants/interface";
2
+ declare function TestImageFromMetalData({ imagePicker, selectedPickerFile, setSelectedFile, }: {
3
+ imagePicker: ImagePickerEntity;
4
+ selectedPickerFile: FileEntity;
5
+ setSelectedFile: (file: FileEntity) => void;
6
+ }): JSX.Element;
7
+ export default TestImageFromMetalData;
@@ -0,0 +1,82 @@
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 { FETCH_ASSET_URL, FETCH_META_FIELD_FILES_URL, } from "../utilities/constants/apiUrls";
12
+ import { NotificationStatus, } from "../utilities/constants/interface";
13
+ import { get, map, reduce, slice } from "lodash";
14
+ import { useEffect, useMemo, useState } from "react";
15
+ import { showNotification } from "../common/notifications";
16
+ import { SOMETHING_WENT_WRONG } from "../utilities/constants/messages";
17
+ import Loader from "../common/loader/loader";
18
+ import { Form } from "antd";
19
+ import PageTitle from "../ui/pageTitle";
20
+ import MetaFieldOptions from "./MetaFieldOptions";
21
+ import { FiImage } from "react-icons/fi";
22
+ import { createApiClient } from "../hocs/configureAxios";
23
+ import { useDamConfig } from "../hocs/DamConfigContext";
24
+ const FiImageIcon = FiImage;
25
+ function TestImageFromMetalData({ imagePicker, selectedPickerFile, setSelectedFile, }) {
26
+ const [form] = Form.useForm();
27
+ const [state, setState] = useState({
28
+ templateLoading: false,
29
+ assetTemplate: {},
30
+ loading: false,
31
+ files: [],
32
+ });
33
+ const damConfig = useDamConfig();
34
+ const api = useMemo(() => createApiClient(damConfig), [damConfig]);
35
+ const { templateLoading, assetTemplate, loading, files } = state;
36
+ const fetchTemplate = (assetId) => __awaiter(this, void 0, void 0, function* () {
37
+ setState((prevState) => (Object.assign(Object.assign({}, prevState), { templateLoading: true })));
38
+ try {
39
+ const response = yield api.get(`${FETCH_ASSET_URL.replace(":assetId", assetId)}`);
40
+ setState((prevState) => (Object.assign(Object.assign({}, prevState), { assetTemplate: get(response, "data", {}), templateLoading: false })));
41
+ }
42
+ catch (error) {
43
+ setState((prevState) => (Object.assign(Object.assign({}, prevState), { assetTemplate: {}, templateLoading: false })));
44
+ showNotification(get(error, "message", SOMETHING_WENT_WRONG), NotificationStatus.ERROR);
45
+ }
46
+ });
47
+ const handleFinalFilterSelect = (filters) => __awaiter(this, void 0, void 0, function* () {
48
+ setState((prevState) => (Object.assign(Object.assign({}, prevState), { loading: true })));
49
+ try {
50
+ const response = yield api.put(FETCH_META_FIELD_FILES_URL.replace(":id", get(imagePicker, "_id")), { filters });
51
+ setState((prevState) => (Object.assign(Object.assign({}, prevState), { loading: false, files: get(response, "data", []) })));
52
+ }
53
+ catch (err) {
54
+ showNotification(SOMETHING_WENT_WRONG, NotificationStatus.ERROR);
55
+ setState((prev) => (Object.assign(Object.assign({}, prev), { images: [], loading: false })));
56
+ }
57
+ });
58
+ useEffect(() => {
59
+ if (get(imagePicker, "assetId")) {
60
+ fetchTemplate(get(imagePicker, "assetId"));
61
+ }
62
+ }, [imagePicker]);
63
+ const handleMetaFieldChange = (...args_1) => __awaiter(this, [...args_1], void 0, function* (filters = {}, index) {
64
+ const allFieldIds = map(get(assetTemplate, "metadataFields", []), "_id");
65
+ const succeedingFieldIds = slice(allFieldIds, index + 1);
66
+ form.setFieldsValue(reduce(succeedingFieldIds, (acc, id) => {
67
+ acc[id] = undefined;
68
+ return acc;
69
+ }, {}));
70
+ handleFinalFilterSelect(filters);
71
+ });
72
+ return (_jsx("div", { children: templateLoading ? (_jsx(Loader, {})) : (_jsxs("div", { className: "md-lib-flex md-lib-flex-col md-lib-gap-3", children: [_jsx(PageTitle, { label: get(assetTemplate, "name", "Asset Template") }), _jsx(Form, { layout: "vertical", form: form, children: map(get(assetTemplate, "metadataFields", []), (meta, index) => {
73
+ const metadataFields = get(assetTemplate, "metadataFields", []);
74
+ const allFieldIds = map(metadataFields, "_id");
75
+ const nextField = metadataFields[index + 1];
76
+ const nextFieldId = get(nextField, "_id");
77
+ return (_jsx(MetaFieldOptions, { meta: meta, imagePickerId: get(imagePicker, "_id"), form: form, previousMetaFields: slice(metadataFields, 0, index), index: index, totalFields: metadataFields.length, onMetaFieldChange: handleMetaFieldChange, nextFieldId: nextFieldId, allFieldIds: allFieldIds }, index));
78
+ }) }), loading ? (_jsx(Loader, {})) : (_jsx(_Fragment, { children: get(files, "length") > 0 && (_jsx("div", { className: "md-lib-grid md-lib-grid-cols-1 sm:md-lib-grid-cols-2 md:md-lib-grid-cols-3 lg:md-lib-grid-cols-4 xl:md-lib-grid-cols-5 md-lib-gap-4 md-lib-p-4", children: map(files, (file) => (_jsxs("div", { onClick: () => setSelectedFile(file), className: `md-lib-flex md-lib-flex-col md-lib-items-center md-lib-border md-lib-border-borderColor dark:md-lib-border-darkBorderColor md-lib-rounded-md md-lib-p-3 dark:md-lib-bg-darkPrimaryBg ${get(file, "_id") === get(selectedPickerFile, "_id")
79
+ ? "md-lib-bg-borderColor dark:md-lib-bg-darkBorderColor"
80
+ : ""}`, children: [_jsx("div", { className: "md-lib-w-full md-lib-aspect-square md-lib-flex md-lib-items-center md-lib-justify-center md-lib-rounded md-lib-border md-lib-border-dashed md-lib-border-borderColor dark:md-lib-border-darkBorderColor md-lib-overflow-hidden", children: get(file, `${get(imagePicker, "_id")}.s3Url`) ? (_jsx("img", { src: get(file, `s3Url`), alt: get(file, `name`, "Unknown"), width: 200, height: 200, className: "md-lib-object-contain md-lib-w-full md-lib-h-full" })) : (_jsx(FiImageIcon, { className: "md-lib-text-4xl md-lib-text-borderColor dark:md-lib-text-darkBorderColor" })) }), _jsx("div", { className: "md-lib-font-medium md-lib-text-sm md-lib-mt-3 md-lib-text-center md-lib-text-textColor dark:md-lib-text-darkTextColor md-lib-truncate md-lib-w-[80px]", title: get(file, "name"), children: get(file, "name") })] }, get(file, "_id")))) })) }))] })) }));
81
+ }
82
+ export default TestImageFromMetalData;
@@ -0,0 +1,6 @@
1
+ declare function ImagePicker({ id, onSelect, url, }: {
2
+ id: string;
3
+ onSelect?: (url: string, value: any) => void;
4
+ url?: string;
5
+ }): JSX.Element;
6
+ export default ImagePicker;
@@ -0,0 +1,63 @@
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 { useEffect, useMemo, useState } from "react";
12
+ import { useDamConfig } from "../hocs/DamConfigContext";
13
+ import { createApiClient } from "../hocs/configureAxios";
14
+ import { FETCH_IMAGEPICKER_URL } from "../utilities/constants/apiUrls";
15
+ import { get } from "lodash";
16
+ import { FiImage } from "react-icons/fi";
17
+ import CustomButton from "../common/Button";
18
+ import TestImagePickerModal from "./TestImagePickerModal";
19
+ const FiImageIcon = FiImage;
20
+ function ImagePicker({ id, onSelect, url, }) {
21
+ const damConfig = useDamConfig();
22
+ const { brand } = damConfig;
23
+ const [picker, setPicker] = useState({});
24
+ const [imagePickerUrl, setImagePickerUrl] = useState("");
25
+ const [show, setShow] = useState(false);
26
+ const api = useMemo(() => createApiClient(damConfig), [damConfig]);
27
+ const [loading, setLoading] = useState(false);
28
+ useEffect(() => {
29
+ if (url) {
30
+ setImagePickerUrl(url);
31
+ }
32
+ }, [url]);
33
+ useEffect(() => {
34
+ if (brand) {
35
+ getImagePicker();
36
+ }
37
+ }, [brand]);
38
+ const getImagePicker = () => __awaiter(this, void 0, void 0, function* () {
39
+ try {
40
+ setLoading(true);
41
+ const response = yield api.get(FETCH_IMAGEPICKER_URL.replace(":id", id));
42
+ setPicker(get(response, "data", {}));
43
+ setLoading(false);
44
+ }
45
+ catch (err) {
46
+ console.log("Error while fetching image picker", err);
47
+ }
48
+ });
49
+ const onImageSelect = (url, value) => {
50
+ setImagePickerUrl(url);
51
+ toggleShow();
52
+ if (onSelect) {
53
+ onSelect(url, value);
54
+ }
55
+ };
56
+ const toggleShow = () => {
57
+ setShow(!show);
58
+ };
59
+ return (_jsxs(_Fragment, { children: [" ", _jsxs("div", { className: "md-lib-flex md-lib-flex-col md-lib-items-center md-lib-border md-lib-border-borderColor dark:md-lib-border-darkBorderColor md-lib-rounded-md md-lib-p-3 dark:md-lib-bg-darkPrimaryBg", children: [_jsx("div", { className: "md-lib-w-full md-lib-aspect-square md-lib-flex md-lib-items-center md-lib-justify-center md-lib-rounded md-lib-border md-lib-border-dashed md-lib-border-borderColor dark:md-lib-border-darkBorderColor md-lib-overflow-hidden", children: imagePickerUrl ? (_jsx("img", { src: imagePickerUrl, alt: get(picker, "name", "Unknown"), width: 200, height: 200, className: "md-lib-object-contain md-lib-w-full md-lib-h-full" })) : (_jsx(FiImageIcon, { className: "md-lib-text-4xl md-lib-text-borderColor dark:md-lib-text-darkBorderColor" })) }), _jsx("div", { className: "md-lib-font-medium md-lib-text-sm md-lib-mt-3 md-lib-text-center md-lib-text-textColor dark:md-lib-text-darkTextColor md-lib-truncate md-lib-w-[150px]", title: get(picker, "name"), children: get(picker, "name") }), _jsx("div", { className: "md-lib-flex md-lib-items-center md-lib-justify-between md-lib-w-full md-lib-mt-3", children: _jsx(CustomButton, { type: "primary", label: "Select", className: "md-lib-w-11/12", onClick: toggleShow }) })] }, get(picker, "_id")), show && (_jsx(TestImagePickerModal, { open: show, toggleModal: toggleShow, imagePicker: picker, setSelectedFile: (thumbnailUrl, value) => {
60
+ onImageSelect(thumbnailUrl, value);
61
+ } }))] }));
62
+ }
63
+ export default ImagePicker;
@@ -0,0 +1,13 @@
1
+ declare function App(props: {
2
+ accessKey?: string;
3
+ secretKey?: string;
4
+ subdomain?: string;
5
+ teamIds?: string[];
6
+ styles?: any;
7
+ appType?: string;
8
+ id: string;
9
+ onSelect?: (url: string, value: any) => void;
10
+ url?: string;
11
+ routerVersion: 4 | 5 | 6;
12
+ }): JSX.Element;
13
+ export default App;
@@ -0,0 +1,24 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { DamConfigProvider } from "../hocs/DamConfigContext";
3
+ import { ThemeProvider } from "../hocs/ThemeContext";
4
+ import { ThemeModes } from "../utilities/constants/interface";
5
+ import AppProvider from "../hocs/AppProvider";
6
+ import ToastProvider from "../hocs/ToastProvider";
7
+ import { MemoryRouter } from "react-router-dom";
8
+ import AppRoutes from "./routes";
9
+ import process from "process";
10
+ function App(props) {
11
+ const config = {
12
+ damAccessKey: props === null || props === void 0 ? void 0 : props.accessKey,
13
+ secretKey: props === null || props === void 0 ? void 0 : props.secretKey,
14
+ subdomain: props === null || props === void 0 ? void 0 : props.subdomain,
15
+ teamIds: props === null || props === void 0 ? void 0 : props.teamIds,
16
+ styles: props === null || props === void 0 ? void 0 : props.styles,
17
+ appType: props === null || props === void 0 ? void 0 : props.appType,
18
+ };
19
+ if (typeof window !== "undefined" && !window.process) {
20
+ window.process = process;
21
+ }
22
+ return (_jsx(DamConfigProvider, { config: config, children: _jsx(ThemeProvider, { styles: props === null || props === void 0 ? void 0 : props.styles, sessionTheme: ThemeModes.LIGHT, children: _jsxs(AppProvider, { children: [_jsx(MemoryRouter, { initialEntries: ["/"], children: _jsx(AppRoutes, { id: props.id, onSelect: props === null || props === void 0 ? void 0 : props.onSelect, url: props === null || props === void 0 ? void 0 : props.url, routerVersion: (props === null || props === void 0 ? void 0 : props.routerVersion) || 6 }) }), _jsx(ToastProvider, {})] }) }) }));
23
+ }
24
+ export default App;
@@ -0,0 +1,6 @@
1
+ export default function AppRoutes(props: {
2
+ id: string;
3
+ onSelect?: (url: string, value: any) => void;
4
+ url?: string;
5
+ routerVersion: 4 | 5 | 6;
6
+ }): JSX.Element;
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { IMAGE_PICKER_SCREEN } from "../utilities/constants/routes";
3
+ import ImagePicker from "./imagePickerComponent";
4
+ import { NavigatorProvider } from "../utilities/NavigatorProvider";
5
+ export default function AppRoutes(props) {
6
+ const { routerVersion } = props;
7
+ if (routerVersion === 6) {
8
+ // ✅ React Router v6
9
+ const { Routes, Route } = require("react-router-dom");
10
+ return (_jsx(Routes, { children: _jsx(Route, { path: IMAGE_PICKER_SCREEN, element: _jsx(ImagePicker, { id: props.id, onSelect: props === null || props === void 0 ? void 0 : props.onSelect, url: props === null || props === void 0 ? void 0 : props.url }) }, IMAGE_PICKER_SCREEN) }));
11
+ }
12
+ // ✅ React Router v4/v5
13
+ const { Switch, Route, withRouter } = require("react-router-dom");
14
+ const Wrapper = ({ history }) => (_jsx(NavigatorProvider, { history: history, children: _jsx(Switch, { children: _jsx(Route, { path: IMAGE_PICKER_SCREEN, render: (props) => (_jsx(ImagePicker, Object.assign({ id: props.id, onSelect: props === null || props === void 0 ? void 0 : props.onSelect, url: props === null || props === void 0 ? void 0 : props.url }, props))) }, IMAGE_PICKER_SCREEN) }) }));
15
+ const WithRouterWrapper = withRouter(Wrapper);
16
+ return _jsx(WithRouterWrapper, {});
17
+ }
@@ -0,0 +1,8 @@
1
+ declare function ImagePickerFiltersComponent({ id, onSelect, url, value, fileId, }: {
2
+ id: string;
3
+ onSelect?: (url: string, value: any) => void;
4
+ url?: string;
5
+ value?: any;
6
+ fileId?: string;
7
+ }): JSX.Element;
8
+ export default ImagePickerFiltersComponent;