@bindu-dashing/dam-solution-v2 5.8.146 → 5.8.148

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.
@@ -8,9 +8,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
11
- import { Form, Modal, Button, Upload, Select, Input, Radio, Typography, Tooltip, } from "antd";
11
+ import { Form, Modal, Button, Upload, Select, Input, Radio, Typography, Tooltip, Checkbox, Popover, } from "antd";
12
12
  import { useEffect, useMemo, useState } from "react";
13
- import { UploadOutlined, InfoCircleOutlined } from "@ant-design/icons";
13
+ import { UploadOutlined, InfoCircleOutlined, QuestionCircleOutlined } from "@ant-design/icons";
14
14
  import { useDamConfig } from "../hocs/DamConfigContext";
15
15
  import { createApiClient } from "../hocs/configureAxios";
16
16
  import { BULK_UPLOAD_URL, FETCH_ASSETS_URL, FILE_UPLOAD_URL, GENERATE_THUMBNAILS_URL, SAMPLE_FILE_DOWNLOAD_URL, } from "../utilities/constants/apiUrls";
@@ -113,7 +113,7 @@ const BulkUploadModal = ({ toggleUpload, userEmail, folderId, thumbnailsOnly, })
113
113
  else {
114
114
  const formData = new FormData();
115
115
  formData.append("assetId", values === null || values === void 0 ? void 0 : values.asset_type_id);
116
- formData.append("rejectInvalidMetaFile", "true");
116
+ formData.append("rejectInvalidMetaFile", (values === null || values === void 0 ? void 0 : values.reject_invalid_meta_file) ? "true" : "false");
117
117
  formData.append("zipFileUrl", values === null || values === void 0 ? void 0 : values.zip_file_url);
118
118
  formData.append("file", metaFile);
119
119
  formData.append("folderId", folderId);
@@ -206,7 +206,7 @@ const BulkUploadModal = ({ toggleUpload, userEmail, folderId, thumbnailsOnly, })
206
206
  }, disabled: !assetTypeId, onRemove: () => {
207
207
  setMetaFile(null);
208
208
  setFileError("Meta File is required");
209
- }, accept: ".csv,.xlsx,.xls", maxCount: 1, children: _jsx(Button, { icon: _jsx(UploadOutlined, {}), disabled: !assetTypeId, children: "Upload" }) }) }), fileError && (_jsx(Typography.Text, { style: { color: "red" }, children: fileError }))] })), _jsx(Form.Item, { label: "Upload your DAM Files (must be zipped)", name: "assets_source_type", children: _jsxs(Radio.Group, { onChange: (e) => setAssetsSourceType(e.target.value), value: assetsSourceType, disabled: thumbnailsOnly ? false : !assetTypeId, children: [_jsx(Radio, { value: "zip", children: "Zip file" }), _jsx(Radio, { value: "zipUrl", children: "Zip file url" })] }) }), assetsSourceType == "zip" ? (_jsxs(_Fragment, { children: [_jsx(Form.Item, { label: "Assets zip file", name: "assets_zip_file", rules: [
209
+ }, accept: ".csv,.xlsx,.xls", maxCount: 1, children: _jsx(Button, { icon: _jsx(UploadOutlined, {}), disabled: !assetTypeId, children: "Upload" }) }) }), fileError && (_jsx(Typography.Text, { style: { color: "red" }, children: fileError })), _jsx(Form.Item, { name: "reject_invalid_meta_file", valuePropName: "checked", children: _jsxs(Checkbox, { name: "reject_invalid_meta_file", children: ["Reject invalid meta file", _jsx(Popover, { content: _jsxs("span", { style: { color: "grey", padding: "5px" }, children: ["When this option is selected the uploaded metadata", _jsx("br", {}), " file will be rejected if it contains invalid values"] }), children: _jsx(QuestionCircleOutlined, { style: { marginLeft: "5px", color: "silver" } }) })] }) })] })), _jsx(Form.Item, { label: "Upload your DAM Files (must be zipped)", name: "assets_source_type", children: _jsxs(Radio.Group, { onChange: (e) => setAssetsSourceType(e.target.value), value: assetsSourceType, disabled: thumbnailsOnly ? false : !assetTypeId, children: [_jsx(Radio, { value: "zip", children: "Zip file" }), _jsx(Radio, { value: "zipUrl", children: "Zip file url" })] }) }), assetsSourceType == "zip" ? (_jsxs(_Fragment, { children: [_jsx(Form.Item, { label: "Assets zip file", name: "assets_zip_file", rules: [
210
210
  {
211
211
  required: true,
212
212
  message: "Asset zip file is required",
@@ -13,7 +13,7 @@ import _, { filter, first, flatMap, get, includes, isEmpty, merge, } from "lodas
13
13
  import FolderListView from "./FolderListView";
14
14
  import FolderGridView from "./FolderGridView";
15
15
  import TypeAndDateFilters from "../common/folders/TypeAndDateFilters";
16
- import { Button, Input, Upload } from "antd";
16
+ import { Button, Upload } from "antd";
17
17
  import { addQueryParams, getDateRangeFromKey } from "../hocs/helpers";
18
18
  import { useFolders } from "../react-query/services/folder-services";
19
19
  import { DEFAULT_PAGE } from "../hocs/appConstants";
@@ -33,10 +33,8 @@ import ImagePickerBreadCrumbList from "./ImagePickerBreadCrumbList";
33
33
  import { FETCH_ASSETS_URL, FETCH_IMAGE_PCIKER_THUMBNAIL_URL, UPLOAD_IMAGE_PICKER_LOCAL_FILE_URL, } from "../utilities/constants/apiUrls";
34
34
  import { showNotification } from "../common/notifications";
35
35
  import useAppParams from "../utilities/useAppParams";
36
- import { IoIosSearch } from "react-icons/io";
37
36
  import { RefetchFoldersProvider } from "../utilities/FoldersContext";
38
37
  const BsUploadIcon = BsUpload;
39
- const IoIosSearchIcon = IoIosSearch;
40
38
  function DriveContainer({ parentFolderId, setSelectedFile, setParentFolderId, pickerFolderId, selectedPickerFile, imagePicker, globalSearch, setGlobalSearch, setSelectedKeys, }) {
41
39
  const damConfig = useDamConfig();
42
40
  const { rootFolderId, brand, isAdmin } = damConfig;
@@ -59,7 +57,6 @@ function DriveContainer({ parentFolderId, setSelectedFile, setParentFolderId, pi
59
57
  folderSearch: "",
60
58
  });
61
59
  const { selectedType, selectedDateKey, showGrid, loadingType, selectedItems, assets, sortBy, sortOrder, searchKey, searchValue, metadataKey, metadataValue, folderSearch, } = state;
62
- const nameSearchRef = useRef();
63
60
  const getSearchParams = () => {
64
61
  const params = {};
65
62
  if (searchKey === "name") {
@@ -234,23 +231,12 @@ function DriveContainer({ parentFolderId, setSelectedFile, setParentFolderId, pi
234
231
  onSelectNewFile(file);
235
232
  }, showUploadList: false, accept: "image/*", children: _jsx(CustomButton, { loading: loadingType === "NEW_FILE_UPLOAD", label: "Select File", icon: _jsx(BsUploadIcon, {}) }) }))] }) })), _jsxs("div", { className: `md-lib-px-4 md-lib-border-borderColor dark:md-lib-border-darkBorderColor md-lib-flex ${!includes([DriveModes.FOLDERS, DriveModes.FILE], type)
236
233
  ? "md-lib-justify-between"
237
- : "md-lib-justify-end md-lib-my-4"}`, children: [_jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-gap-4 md-lib-mb-4", children: [_jsx(Input, { placeholder: "Search files (min. 2 characters required)", ref: nameSearchRef, prefix: _jsx(IoIosSearchIcon, {}), onPressEnter: () => {
238
- var _a;
239
- const currentObj = nameSearchRef.current;
240
- if (currentObj) {
241
- const value = ((_a = currentObj === null || currentObj === void 0 ? void 0 : currentObj.input) === null || _a === void 0 ? void 0 : _a.value) || "";
242
- if (value.length >= 2 || !value) {
243
- setState((prevState) => {
244
- return Object.assign(Object.assign({}, prevState), { folderSearch: value });
245
- });
246
- }
247
- }
248
- } }), !includes([DriveModes.FOLDERS, DriveModes.FILE], type) && (_jsx(TypeAndDateFilters, { selectedDateKey: selectedDateKey, selectedType: selectedType, onDateMenuClick: onDateMenuClick, onTypeMenuClick: onTypeMenuClick, onChangeDates: (dates) => {
249
- if (dates) {
250
- const [start, end] = dates;
251
- setState((prev) => (Object.assign(Object.assign({}, prev), { customDateRange: dates, selectedDateKey: "custom" })));
252
- }
253
- }, loading: isFetching, loadingType: loadingType }))] }), _jsx(ToggleView, { showGrid: showGrid, toggleView: (value) => setState((prevState) => (Object.assign(Object.assign({}, prevState), { showGrid: value }))) })] }), _jsx("div", { className: "md-lib-border-b md-lib-border-borderColor md-lib-mb-4" }), isLoading ? (_jsx(Loader, {})) : isEmpty(folders) ? (_jsxs("div", { className: "md-lib-flex md-lib-flex-col md-lib-items-center md-lib-justify-center", children: [_jsx("img", { src: NOT_FOUND_IMAGE_URL, alt: "Not Found", width: 300, height: 300 }), _jsx("p", { className: "md-lib-mt-3 md-lib-text-sm md-lib-font-semibold", children: error
234
+ : "md-lib-justify-end md-lib-my-4"}`, children: [!includes([DriveModes.FOLDERS, DriveModes.FILE], type) && (_jsx("div", { className: "md-lib-flex md-lib-items-center md-lib-gap-4 md-lib-mb-4", children: _jsx(TypeAndDateFilters, { selectedDateKey: selectedDateKey, selectedType: selectedType, onDateMenuClick: onDateMenuClick, onTypeMenuClick: onTypeMenuClick, onChangeDates: (dates) => {
235
+ if (dates) {
236
+ const [start, end] = dates;
237
+ setState((prev) => (Object.assign(Object.assign({}, prev), { customDateRange: dates, selectedDateKey: "custom" })));
238
+ }
239
+ }, loading: isFetching, loadingType: loadingType }) })), _jsx(ToggleView, { showGrid: showGrid, toggleView: (value) => setState((prevState) => (Object.assign(Object.assign({}, prevState), { showGrid: value }))) })] }), _jsx("div", { className: "md-lib-border-b md-lib-border-borderColor md-lib-mb-4" }), isLoading ? (_jsx(Loader, {})) : isEmpty(folders) ? (_jsxs("div", { className: "md-lib-flex md-lib-flex-col md-lib-items-center md-lib-justify-center", children: [_jsx("img", { src: NOT_FOUND_IMAGE_URL, alt: "Not Found", width: 300, height: 300 }), _jsx("p", { className: "md-lib-mt-3 md-lib-text-sm md-lib-font-semibold", children: error
254
240
  ? get(error, "message", SOMETHING_WENT_WRONG)
255
241
  : includes(Object.values(DriveModes), type)
256
242
  ? "No data found"
@@ -96,17 +96,13 @@ export const DamConfigProvider = ({ children, config }) => {
96
96
  const fullUrl = teamsApiBaseUrl + teamsEndpoint;
97
97
  console.log("Fetching teams from:", fullUrl);
98
98
  console.log("TeamID from token:", teamID);
99
- // Call the new API endpoint using Teams API base URL
100
99
  const response = yield axios.get(fullUrl, {
101
100
  headers: {
102
101
  Authorization: authorizationHeader,
103
102
  },
104
103
  });
105
104
  console.log("Teams API response:", response === null || response === void 0 ? void 0 : response.data);
106
- // Set teams from the API response
107
- // Assuming the response structure is { data: [...] } or similar
108
105
  const teamsData = ((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.data) || (response === null || response === void 0 ? void 0 : response.data) || [];
109
- console.log("Parsed teams data:", teamsData);
110
106
  setTeams(Array.isArray(teamsData) ? teamsData : []);
111
107
  }
112
108
  catch (err) {
@@ -117,7 +113,6 @@ export const DamConfigProvider = ({ children, config }) => {
117
113
  status: (_c = err === null || err === void 0 ? void 0 : err.response) === null || _c === void 0 ? void 0 : _c.status,
118
114
  url: (_d = err === null || err === void 0 ? void 0 : err.config) === null || _d === void 0 ? void 0 : _d.url,
119
115
  });
120
- // Set empty array on error to prevent stale data
121
116
  setTeams([]);
122
117
  }
123
118
  });
@@ -131,12 +126,10 @@ export const DamConfigProvider = ({ children, config }) => {
131
126
  }
132
127
  }
133
128
  }, [damAccessKey, secretKey, subdomain]);
134
- // Fetch teams after token is available
135
129
  useEffect(() => {
136
130
  if (accessToken) {
137
131
  getTeams(accessToken);
138
132
  }
139
- // eslint-disable-next-line react-hooks/exhaustive-deps
140
133
  }, [accessToken]);
141
134
  return (_jsx(DamConfigContext.Provider, { value: {
142
135
  damAccessKey,
@@ -9,12 +9,6 @@ export declare const getDateRangeFromKey: (key: string) => {
9
9
  endDate?: string;
10
10
  };
11
11
  export declare const getBaseUrl: (appType: string) => string;
12
- /**
13
- * Encodes a string to Base64 in a cross-platform way
14
- * Works in both browser and Node.js environments
15
- * @param str - The string to encode
16
- * @returns Base64 encoded string
17
- */
18
12
  export declare const encodeBase64: (str: string) => string;
19
13
  export declare const getRelativeTime: (timestamp: string) => string;
20
14
  export declare const getReadableFileType: (file: FileEntity) => string;
@@ -102,26 +102,16 @@ export const getBaseUrl = (appType) => {
102
102
  return process.env.REACT_APP_MIXDRIVE_API_URL || "";
103
103
  }
104
104
  };
105
- /**
106
- * Encodes a string to Base64 in a cross-platform way
107
- * Works in both browser and Node.js environments
108
- * @param str - The string to encode
109
- * @returns Base64 encoded string
110
- */
111
105
  export const encodeBase64 = (str) => {
112
- // Use Buffer if available (Node.js environment)
113
106
  if (typeof Buffer !== "undefined") {
114
107
  return Buffer.from(str, "utf-8").toString("base64");
115
108
  }
116
- // Fallback to btoa for browser environments
117
- // Note: btoa only works with Latin-1 characters, so we encode URI component first
118
109
  try {
119
110
  return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (match, p1) => {
120
111
  return String.fromCharCode(parseInt(p1, 16));
121
112
  }));
122
113
  }
123
114
  catch (e) {
124
- // If btoa fails, throw a more descriptive error
125
115
  throw new Error("Failed to encode string to Base64");
126
116
  }
127
117
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bindu-dashing/dam-solution-v2",
3
- "version": "5.8.146",
3
+ "version": "5.8.148",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.0.1",
6
6
  "@emoji-mart/data": "^1.2.1",