@bindu-dashing/dam-solution-v2 5.9.205 → 5.9.207
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.
- package/build/CreateClient/CreateClientBtn.d.ts +2 -1
- package/build/CreateClient/CreateClientBtn.js +9 -2
- package/build/CreateClient/index.d.ts +1 -0
- package/build/CreateClient/index.js +1 -1
- package/build/MyDrive/fileDetails/FileViewer.js +2 -2
- package/build/MyDrive/files/MapFile.d.ts +2 -1
- package/build/MyDrive/files/MapFile.js +2 -4
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
declare const CreateClient: ({ onSuccess, clientSubdomain, teamsApi, username, password, existingClientData, }: {
|
|
1
|
+
declare const CreateClient: ({ onSuccess, onRefreshSuccess, clientSubdomain, teamsApi, username, password, existingClientData, }: {
|
|
2
2
|
onSuccess: (data: any) => void;
|
|
3
|
+
onRefreshSuccess?: (data: any) => void;
|
|
3
4
|
clientSubdomain: string;
|
|
4
5
|
teamsApi: string;
|
|
5
6
|
username: string;
|
|
@@ -18,7 +18,7 @@ import { showNotification } from "../common/notifications";
|
|
|
18
18
|
import { NotificationStatus } from "../utilities/constants/interface";
|
|
19
19
|
import { SOMETHING_WENT_WRONG } from "../utilities/constants/messages";
|
|
20
20
|
import { get } from "lodash";
|
|
21
|
-
const CreateClient = ({ onSuccess, clientSubdomain, teamsApi, username, password, existingClientData, }) => {
|
|
21
|
+
const CreateClient = ({ onSuccess, onRefreshSuccess, clientSubdomain, teamsApi, username, password, existingClientData, }) => {
|
|
22
22
|
const [showForm, setShowForm] = useState(false);
|
|
23
23
|
const [refreshingKey, setRefreshingKey] = useState(false);
|
|
24
24
|
const isEditMode = !!existingClientData;
|
|
@@ -32,6 +32,10 @@ const CreateClient = ({ onSuccess, clientSubdomain, teamsApi, username, password
|
|
|
32
32
|
showNotification("Access key and secret key are required to refresh", NotificationStatus.ERROR);
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
|
+
if (!(damConfig === null || damConfig === void 0 ? void 0 : damConfig.accessToken)) {
|
|
36
|
+
showNotification("Authentication token is not available. Please wait for the page to load or try again.", NotificationStatus.ERROR);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
35
39
|
setRefreshingKey(true);
|
|
36
40
|
try {
|
|
37
41
|
const response = yield api.put(REFRESH_KEY_URL, {
|
|
@@ -40,7 +44,10 @@ const CreateClient = ({ onSuccess, clientSubdomain, teamsApi, username, password
|
|
|
40
44
|
});
|
|
41
45
|
setRefreshingKey(false);
|
|
42
46
|
showNotification(get(response, "data.message", "Key refreshed successfully"), NotificationStatus.SUCCESS);
|
|
43
|
-
if (
|
|
47
|
+
if (onRefreshSuccess) {
|
|
48
|
+
onRefreshSuccess(response === null || response === void 0 ? void 0 : response.data);
|
|
49
|
+
}
|
|
50
|
+
else if (onSuccess) {
|
|
44
51
|
onSuccess(response === null || response === void 0 ? void 0 : response.data);
|
|
45
52
|
}
|
|
46
53
|
}
|
|
@@ -15,6 +15,6 @@ function App(props) {
|
|
|
15
15
|
styles: props === null || props === void 0 ? void 0 : props.styles,
|
|
16
16
|
appType: props === null || props === void 0 ? void 0 : props.appType,
|
|
17
17
|
};
|
|
18
|
-
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, existingClientData: props === null || props === void 0 ? void 0 : props.existingClientData }), _jsx(ToastProvider, {})] }) }));
|
|
18
|
+
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, onRefreshSuccess: props === null || props === void 0 ? void 0 : props.onRefreshSuccess, existingClientData: props === null || props === void 0 ? void 0 : props.existingClientData }), _jsx(ToastProvider, {})] }) }));
|
|
19
19
|
}
|
|
20
20
|
export default App;
|
|
@@ -11,7 +11,7 @@ const FileViewer = ({ file, onNext, onPrev, hasNext, hasPrev, handleClose, }) =>
|
|
|
11
11
|
const damConfig = useDamConfig();
|
|
12
12
|
const brand = damConfig === null || damConfig === void 0 ? void 0 : damConfig.brand;
|
|
13
13
|
const showFilePreview = get(brand, "showFilePreview", false);
|
|
14
|
-
const [metadataOpen, setMetadataOpen] = useState(
|
|
15
|
-
return (_jsx(Layout, { className: "md-lib-h-full", children: _jsxs(Content, { className: "md-lib-flex md-lib-h-full md-lib-w-full", children: [_jsx("div", { className: `md-lib-flex md-lib-items-center md-lib-justify-center md-lib-relative md-lib-bg-textColorActive dark:md-lib-bg-darkSecondaryColor md-lib-min-h-full ${metadataOpen ? "md-lib-flex-1" : "md-lib-flex-1 md-lib-w-full"}`, children: _jsx(PreviewDetails, { file: file, hasNext: hasNext, hasPrev: hasPrev, onNext: onNext, onPrev: onPrev, showFilePreview: showFilePreview }) }),
|
|
14
|
+
const [metadataOpen, setMetadataOpen] = useState(true);
|
|
15
|
+
return (_jsx(Layout, { className: "md-lib-h-full", children: _jsxs(Content, { className: "md-lib-flex md-lib-h-full md-lib-w-full", children: [_jsx("div", { className: `md-lib-flex md-lib-items-center md-lib-justify-center md-lib-relative md-lib-bg-textColorActive dark:md-lib-bg-darkSecondaryColor md-lib-min-h-full ${metadataOpen ? "md-lib-flex-1" : "md-lib-flex-1 md-lib-w-full"}`, children: _jsx(PreviewDetails, { file: file, hasNext: hasNext, hasPrev: hasPrev, onNext: onNext, onPrev: onPrev, showFilePreview: showFilePreview }) }), _jsxs(_Fragment, { children: [_jsx(Button, { type: "text", className: "md-lib-shrink-0 md-lib-flex md-lib-items-center md-lib-justify-center md-lib-w-10 md-lib-h-10 md-lib-rounded-none md-lib-bg-black/50 hover:md-lib-bg-black/70 dark:md-lib-bg-white/20 dark:hover:md-lib-bg-white/30 md-lib-text-white md-lib-border-0 md-lib-self-start md-lib-mt-4", onClick: () => setMetadataOpen((prev) => !prev), "aria-label": metadataOpen ? "Hide Metadata" : "Show Metadata", children: metadataOpen ? (_jsx(RightOutlined, { className: "md-lib-text-lg" })) : (_jsx(LeftOutlined, { className: "md-lib-text-lg" })) }), metadataOpen && (_jsx("div", { className: "md-lib-w-[400px] md-lib-min-w-[320px] md-lib-shrink-0 md-lib-border-l md-lib-border-borderColor dark:md-lib-border-darkBorderColor md-lib-bg-backgroundColor dark:md-lib-bg-darkPrimary md-lib-overflow-y-auto", children: _jsx(MapFile, { fromUpload: false, filesList: file ? [file] : [], handleCancel: handleClose ? () => handleClose() : undefined, canEdit: showFilePreview }) }))] })] }) }));
|
|
16
16
|
};
|
|
17
17
|
export default FileViewer;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { FileEntity, ResponseFile } from "../../utilities/constants/interface";
|
|
2
|
-
declare function MapFile({ open, handleCancel, filesList, fromUpload, parentFolderId, }: {
|
|
2
|
+
declare function MapFile({ open, handleCancel, filesList, fromUpload, parentFolderId, canEdit, }: {
|
|
3
3
|
open?: boolean;
|
|
4
4
|
handleCancel?: (shouldDelete?: boolean) => void;
|
|
5
5
|
filesList: ResponseFile[] | FileEntity[];
|
|
6
6
|
fromUpload?: boolean;
|
|
7
7
|
parentFolderId?: string;
|
|
8
|
+
canEdit?: boolean;
|
|
8
9
|
}): JSX.Element;
|
|
9
10
|
export default MapFile;
|
|
@@ -27,7 +27,7 @@ import { DATE_FORMAT, DATE_WITH_TIME_FORMAT } from "../../hocs/appConstants";
|
|
|
27
27
|
import dayjs from "dayjs";
|
|
28
28
|
import useAppNavigate from "../../utilities/useAppNavigate";
|
|
29
29
|
import { addQueryParams } from "../../hocs/helpers";
|
|
30
|
-
function MapFile({ open, handleCancel, filesList, fromUpload, parentFolderId, }) {
|
|
30
|
+
function MapFile({ open, handleCancel, filesList, fromUpload, parentFolderId, canEdit = true, }) {
|
|
31
31
|
const { folderId, type } = useAppParams();
|
|
32
32
|
const damConfig = useDamConfig();
|
|
33
33
|
const externalTeams = (damConfig === null || damConfig === void 0 ? void 0 : damConfig.teams) || [];
|
|
@@ -239,9 +239,7 @@ function MapFile({ open, handleCancel, filesList, fromUpload, parentFolderId, })
|
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
241
|
};
|
|
242
|
-
const getMetadataForm = (_jsxs(Form, { layout: "vertical", form: form, scrollToFirstError: true, onFinish: fromUpload ? handleSubmit : handleUpdate, onKeyDown: preventEnterSubmit, className: "md-lib-m-2", children: [_jsx(AssetSelectionFormItem, { handleAssetTemplateChange: handleAssetTemplateChange, assetOptions: assetOptions, assetsLoading: assetsLoading }), selectedAssetTemplate && (_jsxs(_Fragment, { children: [_jsx(Form.Item, { name: "teamIds", label: "Teams", children: _jsx(Select, { options: teamOptions, placeholder: "Select teams", mode: "multiple", onChange: (val) => onChangeTeams(val), style: { width: "100%" }, showSearch: true, optionFilterProp: "key" }) }), _jsx(Form.Item, { name: "expiryDate", label: "Expiry Date", children: _jsx(DatePicker, { placeholder: "Expiry Date", style: { width: "100%" } }) }), _jsx(Metadata, { asset: selectedAssetTemplate, form: form, file: (filesList === null || filesList === void 0 ? void 0 : filesList[0]) || null })] })), _jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-justify-end md-lib-gap-3", children: [_jsx(Button, { onClick: handleCancelWithConfirmation, children: "Cancel" }), _jsx(Button, { disabled: !selectedAssetTemplate, type: "primary",
|
|
243
|
-
// onClick={handleSubmit}
|
|
244
|
-
loading: loading || updateFileMutation.isLoading, htmlType: "submit", children: "Save" })] })] }));
|
|
242
|
+
const getMetadataForm = (_jsxs(Form, { layout: "vertical", form: form, scrollToFirstError: true, onFinish: fromUpload ? handleSubmit : handleUpdate, onKeyDown: preventEnterSubmit, className: "md-lib-m-2", disabled: !canEdit, children: [_jsx(AssetSelectionFormItem, { handleAssetTemplateChange: handleAssetTemplateChange, assetOptions: assetOptions, assetsLoading: assetsLoading }), selectedAssetTemplate && (_jsxs(_Fragment, { children: [_jsx(Form.Item, { name: "teamIds", label: "Teams", children: _jsx(Select, { options: teamOptions, placeholder: "Select teams", mode: "multiple", onChange: (val) => onChangeTeams(val), style: { width: "100%" }, showSearch: true, optionFilterProp: "key" }) }), _jsx(Form.Item, { name: "expiryDate", label: "Expiry Date", children: _jsx(DatePicker, { placeholder: "Expiry Date", style: { width: "100%" } }) }), _jsx(Metadata, { asset: selectedAssetTemplate, form: form, file: (filesList === null || filesList === void 0 ? void 0 : filesList[0]) || null })] })), _jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-justify-end md-lib-gap-3", children: [_jsx(Button, { onClick: handleCancelWithConfirmation, children: canEdit ? "Cancel" : "Close" }), canEdit && (_jsx(Button, { disabled: !selectedAssetTemplate, type: "primary", loading: loading || updateFileMutation.isLoading, htmlType: "submit", children: "Save" }))] })] }));
|
|
245
243
|
return (_jsx(_Fragment, { children: fromUpload ? (_jsx(Drawer, { title: "Metadata", open: open, onClose: handleCancelWithConfirmation, maskClosable: false, children: getMetadataForm })) : (_jsxs("div", { className: "md-lib-p-2 md-lib-overflow-y-scroll md-lib-max-h-[calc(100vh-65px)]", children: [_jsx("p", { className: "md-lib-text-lg md-lib-font-semibold", children: "Metadata" }), getMetadataForm] })) }));
|
|
246
244
|
}
|
|
247
245
|
export default MapFile;
|