@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.
- package/README.md +53 -0
- package/build/AssetType/AddFieldProperties.d.ts +10 -0
- package/build/AssetType/AddFieldProperties.js +359 -0
- package/build/AssetType/AssetTemplatesTable.d.ts +10 -0
- package/build/AssetType/AssetTemplatesTable.js +172 -0
- package/build/AssetType/CreateAssetTemplate.d.ts +3 -0
- package/build/AssetType/CreateAssetTemplate.js +70 -0
- package/build/AssetType/CreateOrEditAssetTemplate.d.ts +1 -0
- package/build/AssetType/CreateOrEditAssetTemplate.js +100 -0
- package/build/AssetType/DraggedField.d.ts +14 -0
- package/build/AssetType/DraggedField.js +58 -0
- package/build/AssetType/EditAssetTemplate.d.ts +5 -0
- package/build/AssetType/EditAssetTemplate.js +257 -0
- package/build/AssetType/FieldsSection.d.ts +14 -0
- package/build/AssetType/FieldsSection.js +268 -0
- package/build/AssetType/assetTemplatesContainer.d.ts +2 -0
- package/build/AssetType/assetTemplatesContainer.js +71 -0
- package/build/AssetType/fieldProperties/DateField.d.ts +5 -0
- package/build/AssetType/fieldProperties/DateField.js +23 -0
- package/build/AssetType/fieldProperties/NumberField.d.ts +5 -0
- package/build/AssetType/fieldProperties/NumberField.js +91 -0
- package/build/AssetType/fieldProperties/OptionsField.d.ts +6 -0
- package/build/AssetType/fieldProperties/OptionsField.js +55 -0
- package/build/AssetType/fieldProperties/TextField.d.ts +5 -0
- package/build/AssetType/fieldProperties/TextField.js +92 -0
- package/build/AssetType/index.d.ts +11 -0
- package/build/AssetType/index.js +25 -0
- package/build/AssetType/routes.d.ts +3 -0
- package/build/AssetType/routes.js +17 -0
- package/build/BookView/ProductDescription.d.ts +4 -0
- package/build/BookView/ProductDescription.js +20 -0
- package/build/BookView/bookDetail.d.ts +4 -0
- package/build/BookView/bookDetail.js +106 -0
- package/build/BookView/bookInfo.d.ts +4 -0
- package/build/BookView/bookInfo.js +17 -0
- package/build/BookView/description.d.ts +4 -0
- package/build/BookView/description.js +5 -0
- package/build/BookView/index.d.ts +10 -0
- package/build/BookView/index.js +23 -0
- package/build/CreateClient/CreateClientBtn.d.ts +14 -0
- package/build/CreateClient/CreateClientBtn.js +54 -0
- package/build/CreateClient/CreateClientForm.d.ts +15 -0
- package/build/CreateClient/CreateClientForm.js +347 -0
- package/build/CreateClient/index.d.ts +20 -0
- package/build/CreateClient/index.js +18 -0
- package/build/ImagePicker/MetaFieldOptions.d.ts +14 -0
- package/build/ImagePicker/MetaFieldOptions.js +75 -0
- package/build/ImagePicker/TestImagePickerModal.d.ts +8 -0
- package/build/ImagePicker/TestImagePickerModal.js +72 -0
- package/build/ImagePicker/TestImgFromMetaData.d.ts +7 -0
- package/build/ImagePicker/TestImgFromMetaData.js +82 -0
- package/build/ImagePicker/imagePickerComponent.d.ts +6 -0
- package/build/ImagePicker/imagePickerComponent.js +63 -0
- package/build/ImagePicker/index.d.ts +13 -0
- package/build/ImagePicker/index.js +24 -0
- package/build/ImagePicker/routes.d.ts +6 -0
- package/build/ImagePicker/routes.js +17 -0
- package/build/ImagePickerFilters/ImagePickerFiltersComponent.d.ts +8 -0
- package/build/ImagePickerFilters/ImagePickerFiltersComponent.js +223 -0
- package/build/ImagePickerFilters/index.d.ts +12 -0
- package/build/ImagePickerFilters/index.js +19 -0
- package/build/MyDrive/ActionBar.d.ts +8 -0
- package/build/MyDrive/ActionBar.js +190 -0
- package/build/MyDrive/AddDrive.d.ts +5 -0
- package/build/MyDrive/AddDrive.js +189 -0
- package/build/MyDrive/AddFolder.d.ts +11 -0
- package/build/MyDrive/AddFolder.js +165 -0
- package/build/MyDrive/BreadCrumbList.d.ts +10 -0
- package/build/MyDrive/BreadCrumbList.js +81 -0
- package/build/MyDrive/BulkUploadModal.d.ts +2 -0
- package/build/MyDrive/BulkUploadModal.js +324 -0
- package/build/MyDrive/DriveContainer.d.ts +14 -0
- package/build/MyDrive/DriveContainer.js +343 -0
- package/build/MyDrive/FileDownloadHistory.d.ts +7 -0
- package/build/MyDrive/FileDownloadHistory.js +107 -0
- package/build/MyDrive/FileMenuOptions.d.ts +11 -0
- package/build/MyDrive/FileMenuOptions.js +450 -0
- package/build/MyDrive/FilesGridView.d.ts +9 -0
- package/build/MyDrive/FilesGridView.js +25 -0
- package/build/MyDrive/FolderGridView.d.ts +20 -0
- package/build/MyDrive/FolderGridView.js +95 -0
- package/build/MyDrive/FolderListView.d.ts +26 -0
- package/build/MyDrive/FolderListView.js +226 -0
- package/build/MyDrive/FolderMenuOptions.d.ts +5 -0
- package/build/MyDrive/FolderMenuOptions.js +350 -0
- package/build/MyDrive/FolderTree.d.ts +8 -0
- package/build/MyDrive/FolderTree.js +479 -0
- package/build/MyDrive/ImageEditor/EditImage.d.ts +6 -0
- package/build/MyDrive/ImageEditor/EditImage.js +97 -0
- package/build/MyDrive/ImageEditor/EditImageModal.d.ts +8 -0
- package/build/MyDrive/ImageEditor/EditImageModal.js +30 -0
- package/build/MyDrive/ImageEditor/TuiImageEditor.d.ts +10 -0
- package/build/MyDrive/ImageEditor/TuiImageEditor.js +99 -0
- package/build/MyDrive/ImagePickerBreadCrumbList.d.ts +8 -0
- package/build/MyDrive/ImagePickerBreadCrumbList.js +35 -0
- package/build/MyDrive/ImagePickerDrive.d.ts +1 -0
- package/build/MyDrive/ImagePickerDrive.js +41 -0
- package/build/MyDrive/MyDriveMainContainer.d.ts +6 -0
- package/build/MyDrive/MyDriveMainContainer.js +63 -0
- package/build/MyDrive/SearchFilter.d.ts +8 -0
- package/build/MyDrive/SearchFilter.js +73 -0
- package/build/MyDrive/ShareBtn.d.ts +5 -0
- package/build/MyDrive/ShareBtn.js +19 -0
- package/build/MyDrive/ToggleView.d.ts +4 -0
- package/build/MyDrive/ToggleView.js +12 -0
- package/build/MyDrive/UploadStatusModal.d.ts +12 -0
- package/build/MyDrive/UploadStatusModal.js +52 -0
- package/build/MyDrive/fileDetails/CommentEntity.d.ts +8 -0
- package/build/MyDrive/fileDetails/CommentEntity.js +102 -0
- package/build/MyDrive/fileDetails/Comments.d.ts +6 -0
- package/build/MyDrive/fileDetails/Comments.js +65 -0
- package/build/MyDrive/fileDetails/Compliance.d.ts +2 -0
- package/build/MyDrive/fileDetails/Compliance.js +18 -0
- package/build/MyDrive/fileDetails/CreateComment.d.ts +7 -0
- package/build/MyDrive/fileDetails/CreateComment.js +48 -0
- package/build/MyDrive/fileDetails/Editor.d.ts +6 -0
- package/build/MyDrive/fileDetails/Editor.js +55 -0
- package/build/MyDrive/fileDetails/EmojiPicker.d.ts +5 -0
- package/build/MyDrive/fileDetails/EmojiPicker.js +6 -0
- package/build/MyDrive/fileDetails/FileDetails.d.ts +11 -0
- package/build/MyDrive/fileDetails/FileDetails.js +125 -0
- package/build/MyDrive/fileDetails/FileHeader.d.ts +7 -0
- package/build/MyDrive/fileDetails/FileHeader.js +27 -0
- package/build/MyDrive/fileDetails/FileViewer.d.ts +10 -0
- package/build/MyDrive/fileDetails/FileViewer.js +17 -0
- package/build/MyDrive/fileDetails/ImageOptions.d.ts +2 -0
- package/build/MyDrive/fileDetails/ImageOptions.js +44 -0
- package/build/MyDrive/fileDetails/ImageViewer.d.ts +6 -0
- package/build/MyDrive/fileDetails/ImageViewer.js +16 -0
- package/build/MyDrive/fileDetails/ManageFile.d.ts +7 -0
- package/build/MyDrive/fileDetails/ManageFile.js +34 -0
- package/build/MyDrive/fileDetails/MetaForm.d.ts +15 -0
- package/build/MyDrive/fileDetails/MetaForm.js +199 -0
- package/build/MyDrive/fileDetails/Metadata.d.ts +8 -0
- package/build/MyDrive/fileDetails/Metadata.js +52 -0
- package/build/MyDrive/fileDetails/PdfOptions.d.ts +9 -0
- package/build/MyDrive/fileDetails/PdfOptions.js +35 -0
- package/build/MyDrive/fileDetails/PdfViewer.d.ts +8 -0
- package/build/MyDrive/fileDetails/PdfViewer.js +18 -0
- package/build/MyDrive/fileDetails/Previewdetails.d.ts +10 -0
- package/build/MyDrive/fileDetails/Previewdetails.js +53 -0
- package/build/MyDrive/fileDetails/VideoPlayer.d.ts +4 -0
- package/build/MyDrive/fileDetails/VideoPlayer.js +21 -0
- package/build/MyDrive/files/AssetSelectionFormItem.d.ts +7 -0
- package/build/MyDrive/files/AssetSelectionFormItem.js +14 -0
- package/build/MyDrive/files/FolderTabs.d.ts +6 -0
- package/build/MyDrive/files/FolderTabs.js +90 -0
- package/build/MyDrive/files/MapFile.d.ts +9 -0
- package/build/MyDrive/files/MapFile.js +239 -0
- package/build/MyDrive/files/MoveToAnotherFolder.d.ts +9 -0
- package/build/MyDrive/files/MoveToAnotherFolder.js +67 -0
- package/build/MyDrive/filesListView.d.ts +2 -0
- package/build/MyDrive/filesListView.js +57 -0
- package/build/MyDrive/index.d.ts +16 -0
- package/build/MyDrive/index.js +50 -0
- package/build/MyDrive/routes.d.ts +10 -0
- package/build/MyDrive/routes.js +12 -0
- package/build/PenView/PenDetails.d.ts +4 -0
- package/build/PenView/PenDetails.js +114 -0
- package/build/PenView/ProductDescription.d.ts +5 -0
- package/build/PenView/ProductDescription.js +51 -0
- package/build/PenView/index.d.ts +10 -0
- package/build/PenView/index.js +23 -0
- package/build/RefreshKey/RefreshKeyBtn.d.ts +1 -0
- package/build/RefreshKey/RefreshKeyBtn.js +42 -0
- package/build/RefreshKey/index.d.ts +9 -0
- package/build/RefreshKey/index.js +23 -0
- package/build/ShoesView/ProductDescription.d.ts +4 -0
- package/build/ShoesView/ProductDescription.js +25 -0
- package/build/ShoesView/ShoeDetails.d.ts +4 -0
- package/build/ShoesView/ShoeDetails.js +96 -0
- package/build/ShoesView/index.d.ts +10 -0
- package/build/ShoesView/index.js +23 -0
- package/build/common/Button.d.ts +2 -0
- package/build/common/Button.js +18 -0
- package/build/common/CustomElements.d.ts +98 -0
- package/build/common/CustomElements.js +77 -0
- package/build/common/LoadMoreItems.d.ts +7 -0
- package/build/common/LoadMoreItems.js +33 -0
- package/build/common/RenderFormItem.d.ts +42 -0
- package/build/common/RenderFormItem.js +98 -0
- package/build/common/RenderThumnail.d.ts +7 -0
- package/build/common/RenderThumnail.js +6 -0
- package/build/common/deleteModal.d.ts +1 -0
- package/build/common/deleteModal.js +12 -0
- package/build/common/folders/TypeAndDateFilters.d.ts +13 -0
- package/build/common/folders/TypeAndDateFilters.js +66 -0
- package/build/common/folders/getFolderOrFileIcon.d.ts +2 -0
- package/build/common/folders/getFolderOrFileIcon.js +41 -0
- package/build/common/loader/CustomLoader.d.ts +7 -0
- package/build/common/loader/CustomLoader.js +8 -0
- package/build/common/loader/loader.d.ts +1 -0
- package/build/common/loader/loader.js +6 -0
- package/build/common/notifications.d.ts +2 -0
- package/build/common/notifications.js +30 -0
- package/build/common/steps.d.ts +4 -0
- package/build/common/steps.js +7 -0
- package/build/hocs/AppProvider.d.ts +3 -0
- package/build/hocs/AppProvider.js +11 -0
- package/build/hocs/DamConfigContext.d.ts +2 -0
- package/build/hocs/DamConfigContext.js +153 -0
- package/build/hocs/ThemeContext.d.ts +15 -0
- package/build/hocs/ThemeContext.js +131 -0
- package/build/hocs/ToastProvider.d.ts +2 -0
- package/build/hocs/ToastProvider.js +6 -0
- package/build/hocs/appConstants.d.ts +124 -0
- package/build/hocs/appConstants.js +211 -0
- package/build/hocs/configureAxios.d.ts +2 -0
- package/build/hocs/configureAxios.js +65 -0
- package/build/hocs/helpers.d.ts +17 -0
- package/build/hocs/helpers.js +201 -0
- package/build/index.d.ts +12 -0
- package/build/index.js +12 -0
- package/build/react-query/hooks/brand-hooks.d.ts +3 -0
- package/build/react-query/hooks/brand-hooks.js +10 -0
- package/build/react-query/hooks/folder-hooks.d.ts +7 -0
- package/build/react-query/hooks/folder-hooks.js +119 -0
- package/build/react-query/services/brand-services.d.ts +4 -0
- package/build/react-query/services/brand-services.js +41 -0
- package/build/react-query/services/file-services.d.ts +43 -0
- package/build/react-query/services/file-services.js +69 -0
- package/build/react-query/services/folder-services.d.ts +46 -0
- package/build/react-query/services/folder-services.js +87 -0
- package/build/react-query/services/image-picker-services.d.ts +5 -0
- package/build/react-query/services/image-picker-services.js +47 -0
- package/build/settings/InviteTeamModal.d.ts +12 -0
- package/build/settings/InviteTeamModal.js +174 -0
- package/build/settings/UpdateInvitationAccessType.d.ts +9 -0
- package/build/settings/UpdateInvitationAccessType.js +96 -0
- package/build/settings/getUserAvatar.d.ts +7 -0
- package/build/settings/getUserAvatar.js +11 -0
- package/build/style.css +1 -0
- package/build/types/assetType.d.ts +8 -0
- package/build/types/assetType.js +1 -0
- package/build/ui/pageTitle.d.ts +3 -0
- package/build/ui/pageTitle.js +4 -0
- package/build/utilities/FoldersContext.d.ts +16 -0
- package/build/utilities/FoldersContext.js +15 -0
- package/build/utilities/NavigatorProvider.d.ts +2 -0
- package/build/utilities/NavigatorProvider.js +10 -0
- package/build/utilities/constants/apiUrls.d.ts +97 -0
- package/build/utilities/constants/apiUrls.js +117 -0
- package/build/utilities/constants/imageUrls.d.ts +6 -0
- package/build/utilities/constants/imageUrls.js +6 -0
- package/build/utilities/constants/interface.d.ts +371 -0
- package/build/utilities/constants/interface.js +142 -0
- package/build/utilities/constants/messages.d.ts +55 -0
- package/build/utilities/constants/messages.js +55 -0
- package/build/utilities/constants/queryKeys.d.ts +16 -0
- package/build/utilities/constants/queryKeys.js +33 -0
- package/build/utilities/constants/routes.d.ts +22 -0
- package/build/utilities/constants/routes.js +22 -0
- package/build/utilities/helpers/validators.d.ts +12 -0
- package/build/utilities/helpers/validators.js +89 -0
- package/build/utilities/useAppNavigate.d.ts +2 -0
- package/build/utilities/useAppNavigate.js +35 -0
- package/build/utilities/useAppParams.d.ts +8 -0
- package/build/utilities/useAppParams.js +72 -0
- package/package.json +93 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface CustomFormItemProps {
|
|
3
|
+
name: any;
|
|
4
|
+
label: string;
|
|
5
|
+
rules?: any[];
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
inputClassName?: string;
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
}
|
|
10
|
+
interface CustomCheckboxProps extends CustomFormItemProps {
|
|
11
|
+
showLabel?: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface CustomRadioGroupProps extends CustomFormItemProps {
|
|
14
|
+
options: {
|
|
15
|
+
label: string;
|
|
16
|
+
value: string | number;
|
|
17
|
+
}[];
|
|
18
|
+
}
|
|
19
|
+
interface CustomCheckboxGroupProps extends CustomFormItemProps {
|
|
20
|
+
options: {
|
|
21
|
+
label: string;
|
|
22
|
+
value: string | number;
|
|
23
|
+
}[];
|
|
24
|
+
}
|
|
25
|
+
interface CustomSelectProps extends CustomFormItemProps {
|
|
26
|
+
options: {
|
|
27
|
+
label: any;
|
|
28
|
+
value: string | number;
|
|
29
|
+
}[];
|
|
30
|
+
}
|
|
31
|
+
export declare const CustomInputFormItem: React.FC<CustomFormItemProps>;
|
|
32
|
+
export declare const CustomTextAreaFormItem: React.FC<CustomFormItemProps>;
|
|
33
|
+
export declare const CustomSwitchFormItem: React.FC<CustomFormItemProps>;
|
|
34
|
+
export declare const CustomPasswordFormItem: React.FC<CustomFormItemProps>;
|
|
35
|
+
export declare const CustomNumberFormItem: React.FC<CustomFormItemProps>;
|
|
36
|
+
export declare const CustomRadioGroupFormItem: React.FC<CustomRadioGroupProps>;
|
|
37
|
+
export declare const CustomCheckBoxGroupFormItem: React.FC<CustomCheckboxGroupProps>;
|
|
38
|
+
export declare const CustomCheckboxFormItem: React.FC<CustomCheckboxProps>;
|
|
39
|
+
export declare const CustomDatePickerFormItem: React.FC<CustomFormItemProps>;
|
|
40
|
+
export declare const CustomSelectFormItem: React.FC<CustomSelectProps>;
|
|
41
|
+
export declare const CustomColorPickerFormItem: React.FC<CustomFormItemProps>;
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { useState } from "react";
|
|
14
|
+
import { Input, Radio, DatePicker, Form, Select, InputNumber, Checkbox, ColorPicker, Switch, } from "antd";
|
|
15
|
+
import { map } from "lodash";
|
|
16
|
+
import dayjs from "dayjs";
|
|
17
|
+
const { TextArea } = Input;
|
|
18
|
+
// Custom Input Form Item
|
|
19
|
+
export const CustomInputFormItem = (_a) => {
|
|
20
|
+
var { name, label, rules, placeholder, inputClassName, disabled, onChange, size, showCount = false, hasLimit } = _a, rest = __rest(_a, ["name", "label", "rules", "placeholder", "inputClassName", "disabled", "onChange", "size", "showCount", "hasLimit"]);
|
|
21
|
+
return (_jsx(Form.Item, Object.assign({ name: name, label: label, rules: rules }, rest, { children: _jsx(Input, { placeholder: placeholder, className: `${inputClassName} md-lib-h-12`, disabled: disabled, onChange: onChange, size: "large", maxLength: hasLimit ? undefined : 255, showCount: showCount }) }), `field-${name}`));
|
|
22
|
+
};
|
|
23
|
+
// Custom TextArea Item
|
|
24
|
+
export const CustomTextAreaFormItem = (_a) => {
|
|
25
|
+
var { name, label, rules, placeholder, inputClassName, disabled, rows = 4 } = _a, rest = __rest(_a, ["name", "label", "rules", "placeholder", "inputClassName", "disabled", "rows"]);
|
|
26
|
+
return (_jsx(Form.Item, Object.assign({ name: name, label: label, rules: rules }, rest, { children: _jsx(TextArea, { placeholder: placeholder, className: inputClassName, disabled: disabled, rows: 3 }) }), `field-${name}`));
|
|
27
|
+
};
|
|
28
|
+
// Custom Toggle Item
|
|
29
|
+
export const CustomSwitchFormItem = (_a) => {
|
|
30
|
+
var { name, label, rules, placeholder, inputClassName, disabled, onChange } = _a, rest = __rest(_a, ["name", "label", "rules", "placeholder", "inputClassName", "disabled", "onChange"]);
|
|
31
|
+
return (_jsx(Form.Item, Object.assign({ name: name, label: label, rules: rules }, rest, { children: _jsx(Switch, { disabled: disabled, onChange: onChange }) }), `field-${name}`));
|
|
32
|
+
};
|
|
33
|
+
// Custom Password Input Form Item
|
|
34
|
+
export const CustomPasswordFormItem = (_a) => {
|
|
35
|
+
var { name, label, rules, placeholder, disabled } = _a, rest = __rest(_a, ["name", "label", "rules", "placeholder", "disabled"]);
|
|
36
|
+
return (_jsx(Form.Item, Object.assign({ name: name, label: label, rules: rules }, rest, { children: _jsx(Input.Password, { placeholder: placeholder, disabled: disabled, size: "large" }) }), `field-${name}`));
|
|
37
|
+
};
|
|
38
|
+
// Custom Number Input Form Item
|
|
39
|
+
export const CustomNumberFormItem = (_a) => {
|
|
40
|
+
var { name, label, rules, disabled, placeholder, min } = _a, rest = __rest(_a, ["name", "label", "rules", "disabled", "placeholder", "min"]);
|
|
41
|
+
return (_jsx(Form.Item, Object.assign({ name: name, label: label, rules: rules }, rest, { children: _jsx(InputNumber, { placeholder: placeholder, disabled: disabled, style: { width: "100%" }, min: min, size: "large" }) }), `field-${name}`));
|
|
42
|
+
};
|
|
43
|
+
// Custom Radio Group Form Item
|
|
44
|
+
export const CustomRadioGroupFormItem = (_a) => {
|
|
45
|
+
var { name, label, rules, options, disabled } = _a, rest = __rest(_a, ["name", "label", "rules", "options", "disabled"]);
|
|
46
|
+
return (_jsx(Form.Item, Object.assign({ name: name, label: label, rules: rules }, rest, { children: _jsx(Radio.Group, { disabled: disabled, children: options.map((option) => (_jsx(Radio, { value: option.value, children: option.label }, option.value))) }) }), `field-${name}`));
|
|
47
|
+
};
|
|
48
|
+
// Custom Checkbox group Form Item
|
|
49
|
+
export const CustomCheckBoxGroupFormItem = (_a) => {
|
|
50
|
+
var { name, label, rules, options, disabled } = _a, rest = __rest(_a, ["name", "label", "rules", "options", "disabled"]);
|
|
51
|
+
return (_jsx(Form.Item, Object.assign({ name: name, label: label, rules: rules }, rest, { children: _jsx(Checkbox.Group, { disabled: disabled, children: options.map((option) => (_jsx(Checkbox, { value: option.value, children: option.label }, option.value))) }) }), `field-${name}`));
|
|
52
|
+
};
|
|
53
|
+
// Custom Checkbox Form Item
|
|
54
|
+
export const CustomCheckboxFormItem = (_a) => {
|
|
55
|
+
var { name, label, rules, showLabel = false, disabled, options } = _a, rest = __rest(_a, ["name", "label", "rules", "showLabel", "disabled", "options"]);
|
|
56
|
+
return (_jsx(Form.Item, Object.assign({ name: name, label: showLabel ? label : "", rules: rules }, rest, { children: (options === null || options === void 0 ? void 0 : options.length) > 0 ? (_jsx(Checkbox.Group, { disabled: disabled, children: options.map((option, index) => {
|
|
57
|
+
return (_jsx(Checkbox, { value: option.value, children: option.label }, index));
|
|
58
|
+
}) })) : (_jsx(Checkbox, { children: label })) }), `field-${name}`));
|
|
59
|
+
};
|
|
60
|
+
// Custom Date Picker Form Item
|
|
61
|
+
export const CustomDatePickerFormItem = (_a) => {
|
|
62
|
+
var { name, label, rules, placeholder, disabled, showTime = false } = _a, rest = __rest(_a, ["name", "label", "rules", "placeholder", "disabled", "showTime"]);
|
|
63
|
+
return (_jsx(Form.Item, Object.assign({ name: name, label: label, rules: rules }, rest, { getValueFromEvent: (val) => {
|
|
64
|
+
// Ensure dayjs object is correctly formatted and returned
|
|
65
|
+
return val ? dayjs(val).format("YYYY-MM-DD") : undefined;
|
|
66
|
+
}, getValueProps: (val) => {
|
|
67
|
+
return {
|
|
68
|
+
value: dayjs(val),
|
|
69
|
+
};
|
|
70
|
+
}, children: _jsx(DatePicker, { disabled: disabled, placeholder: placeholder, showTime: showTime, size: "large" }) }), `field-${name}`));
|
|
71
|
+
};
|
|
72
|
+
// Custom Select Form Item
|
|
73
|
+
export const CustomSelectFormItem = (_a) => {
|
|
74
|
+
var { name, label, rules, options, placeholder, showSearch, filterOption, onChange, disabled, size, loading } = _a, rest = __rest(_a, ["name", "label", "rules", "options", "placeholder", "showSearch", "filterOption", "onChange", "disabled", "size", "loading"]);
|
|
75
|
+
const [open, setOpen] = useState(false);
|
|
76
|
+
return (_jsx(Form.Item, Object.assign({ name: name, label: label, rules: rules }, rest, { children: _jsx(Select, { placeholder: placeholder, showSearch: showSearch, filterOption: filterOption, open: open, size: size, onChange: (val) => {
|
|
77
|
+
setOpen(false);
|
|
78
|
+
onChange && onChange(val);
|
|
79
|
+
}, disabled: disabled, onBlur: () => {
|
|
80
|
+
setOpen(false);
|
|
81
|
+
}, onClick: () => setOpen(!open), loading: loading, children: map(options, (option) => (_jsx(Select.Option, { value: option.value, children: option.label }, option.value))) }) }), `field-${name}`));
|
|
82
|
+
};
|
|
83
|
+
// Custom Color Picker Form Item
|
|
84
|
+
export const CustomColorPickerFormItem = (_a) => {
|
|
85
|
+
var { name, label, rules, inputClassName, valuePropName = "value", disabled, form } = _a, rest = __rest(_a, ["name", "label", "rules", "inputClassName", "valuePropName", "disabled", "form"]);
|
|
86
|
+
const handleColorChange = (color, hex) => {
|
|
87
|
+
if (Array.isArray(name)) {
|
|
88
|
+
const [parent, child] = name;
|
|
89
|
+
form.setFieldsValue({ [parent]: { [child]: hex } });
|
|
90
|
+
form.validateFields([[parent, child]]);
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
form.setFieldsValue({ [name]: hex });
|
|
94
|
+
form.validateFields([name]);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
return (_jsx(Form.Item, Object.assign({ name: name, label: label, rules: rules }, rest, { children: _jsx("div", { className: inputClassName, children: _jsx(ColorPicker, { onChange: handleColorChange, disabled: disabled, value: rest === null || rest === void 0 ? void 0 : rest.value }) }) }), `field-${name}`));
|
|
98
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { FileImageOutlined } from "@ant-design/icons";
|
|
3
|
+
function RenderThumbnail({ url, alt, width = 20, height = 20, }) {
|
|
4
|
+
return (_jsx(_Fragment, { children: url ? (_jsx("img", { src: url, alt: alt, width: width, height: height, className: "md-lib-rounded md-lib-object-cover" })) : (_jsx(FileImageOutlined, { className: "md-lib-text-primaryColor md-lib-text-lg" })) }));
|
|
5
|
+
}
|
|
6
|
+
export default RenderThumbnail;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function DeleteModal({ title, open, setOpen, massage }: any): JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Button, Modal } from "antd";
|
|
3
|
+
export default function DeleteModal({ title, open, setOpen, massage }) {
|
|
4
|
+
const handleOk = (values) => {
|
|
5
|
+
// console.log(values);
|
|
6
|
+
setOpen(false);
|
|
7
|
+
};
|
|
8
|
+
const handleCancel = () => {
|
|
9
|
+
setOpen(false);
|
|
10
|
+
};
|
|
11
|
+
return (_jsx(_Fragment, { children: _jsxs(Modal, { title: title, open: open, onCancel: handleCancel, footer: null, width: 400, children: [_jsx("p", { className: "md-lib-text-sm md-lib-text-textColor md-lib-pb-7 md-lib-pt-4", children: massage }), _jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-justify-end md-lib-gap-2", children: [_jsx(Button, { size: "large", onClick: handleCancel, className: "md-lib-border-none md-lib-shadow-none", children: "Cancel" }), _jsx(Button, { size: "large", type: "primary", danger: true, onClick: handleOk, children: "Yes, Delete" })] })] }) }));
|
|
12
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Dayjs } from "dayjs";
|
|
2
|
+
declare function TypeAndDateFilters({ selectedType, onDateMenuClick, onTypeMenuClick, onChangeDates, onCancelCustomDate, loading, loadingType, selectedDateKey, customDateRange, }: {
|
|
3
|
+
selectedType: string;
|
|
4
|
+
onDateMenuClick: (params: any) => void;
|
|
5
|
+
onTypeMenuClick: (params: any) => void;
|
|
6
|
+
onChangeDates: (params: any) => void;
|
|
7
|
+
onCancelCustomDate?: () => void;
|
|
8
|
+
loading?: boolean;
|
|
9
|
+
loadingType?: string;
|
|
10
|
+
selectedDateKey: string;
|
|
11
|
+
customDateRange?: [Dayjs, Dayjs] | null;
|
|
12
|
+
}): JSX.Element;
|
|
13
|
+
export default TypeAndDateFilters;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { DatePicker, Dropdown, Menu } from "antd";
|
|
3
|
+
import CustomButton from "../Button";
|
|
4
|
+
import { capitalize } from "lodash";
|
|
5
|
+
import { MdClearAll, MdMoreHoriz } from "react-icons/md";
|
|
6
|
+
import { FileTypes } from "../../utilities/constants/interface";
|
|
7
|
+
import { DownOutlined, FileImageOutlined, FileTextOutlined, CustomerServiceOutlined, VideoCameraOutlined, } from "@ant-design/icons";
|
|
8
|
+
import { FILTER_DATE_FORMAT } from "../../hocs/appConstants";
|
|
9
|
+
import { IoFilter } from "react-icons/io5";
|
|
10
|
+
import { useEffect, useState } from "react";
|
|
11
|
+
const { RangePicker } = DatePicker;
|
|
12
|
+
const MdClearAllIcon = MdClearAll;
|
|
13
|
+
const MdMoreHorizIcon = MdMoreHoriz;
|
|
14
|
+
const IoFilterIcon = IoFilter;
|
|
15
|
+
const typeOptions = [
|
|
16
|
+
{ key: "", label: "All", icon: _jsx(MdClearAllIcon, {}) },
|
|
17
|
+
{ key: FileTypes.IMAGES, label: "Images", icon: _jsx(FileImageOutlined, {}) },
|
|
18
|
+
{ key: FileTypes.VIDEOS, label: "Videos", icon: _jsx(VideoCameraOutlined, {}) },
|
|
19
|
+
{ key: FileTypes.DOCUMENTS, label: "Documents", icon: _jsx(FileTextOutlined, {}) },
|
|
20
|
+
{ key: FileTypes.MUSIC, label: "Music", icon: _jsx(CustomerServiceOutlined, {}) },
|
|
21
|
+
{ key: FileTypes.OTHER, label: "Other", icon: _jsx(MdMoreHorizIcon, {}) },
|
|
22
|
+
];
|
|
23
|
+
function TypeAndDateFilters({ selectedType, onDateMenuClick, onTypeMenuClick, onChangeDates, onCancelCustomDate, loading, loadingType, selectedDateKey, customDateRange, }) {
|
|
24
|
+
const [dateDropdownOpen, setDateDropdownOpen] = useState(false);
|
|
25
|
+
const [tempDateRange, setTempDateRange] = useState(customDateRange || null);
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
setTempDateRange(customDateRange || null);
|
|
28
|
+
}, [customDateRange]);
|
|
29
|
+
const dateOptions = [
|
|
30
|
+
{ key: "", label: "All" },
|
|
31
|
+
{ key: "today", label: "Today" },
|
|
32
|
+
{ key: "last7", label: "Last 7 days" },
|
|
33
|
+
{ key: "last30", label: "Last 30 days" },
|
|
34
|
+
{ key: "thisYear", label: `This year (${new Date().getFullYear()})` },
|
|
35
|
+
{ key: "lastYear", label: `Last year (${new Date().getFullYear() - 1})` },
|
|
36
|
+
];
|
|
37
|
+
const handleCustomDateApply = () => {
|
|
38
|
+
if (tempDateRange && tempDateRange[0] && tempDateRange[1]) {
|
|
39
|
+
onChangeDates(tempDateRange);
|
|
40
|
+
setDateDropdownOpen(false);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const handleCustomDateCancel = () => {
|
|
44
|
+
setTempDateRange(customDateRange || null);
|
|
45
|
+
setDateDropdownOpen(false);
|
|
46
|
+
if (selectedDateKey === "custom" && onCancelCustomDate) {
|
|
47
|
+
onCancelCustomDate();
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const dateDropdownContent = (_jsxs("div", { className: "md-lib-min-w-[280px] md-lib-bg-white dark:md-lib-bg-darkPrimary md-lib-rounded-lg md-lib-shadow-lg md-lib-border md-lib-border-borderColor dark:md-lib-border-darkBorderColor md-lib-overflow-hidden", children: [_jsx(Menu, { items: dateOptions, onClick: ({ key }) => {
|
|
51
|
+
onDateMenuClick({ key });
|
|
52
|
+
if (key !== "custom") {
|
|
53
|
+
setDateDropdownOpen(false);
|
|
54
|
+
}
|
|
55
|
+
}, className: "md-lib-border-none" }), _jsxs("div", { className: "md-lib-p-4 md-lib-border-t md-lib-border-borderColor dark:md-lib-border-darkBorderColor", onClick: (e) => e.stopPropagation(), children: [_jsx("p", { className: "md-lib-text-sm md-lib-font-medium md-lib-text-textColor dark:md-lib-text-darkTextColor md-lib-mb-2", children: "Custom date range" }), _jsx(RangePicker, { format: FILTER_DATE_FORMAT, value: tempDateRange, onChange: (dates) => {
|
|
56
|
+
setTempDateRange(dates);
|
|
57
|
+
if (!dates) {
|
|
58
|
+
if (selectedDateKey === "custom" && onCancelCustomDate) {
|
|
59
|
+
onCancelCustomDate();
|
|
60
|
+
}
|
|
61
|
+
setDateDropdownOpen(false);
|
|
62
|
+
}
|
|
63
|
+
}, className: "md-lib-w-full md-lib-mb-3", allowClear: true }), _jsxs("div", { className: "md-lib-flex md-lib-justify-end md-lib-gap-2", children: [_jsx("button", { type: "button", className: "md-lib-px-3 md-lib-py-1.5 md-lib-text-sm md-lib-rounded md-lib-border md-lib-border-borderColor dark:md-lib-border-darkBorderColor md-lib-bg-transparent md-lib-cursor-pointer hover:md-lib-bg-secondaryHoverColor dark:hover:md-lib-bg-darkSecondaryColor", onClick: handleCustomDateCancel, children: "Cancel" }), _jsx("button", { type: "button", className: "md-lib-px-3 md-lib-py-1.5 md-lib-text-sm md-lib-rounded md-lib-border-none md-lib-bg-primaryColor md-lib-text-white md-lib-cursor-pointer hover:md-lib-opacity-90", onClick: handleCustomDateApply, disabled: !tempDateRange || !tempDateRange[0] || !tempDateRange[1], children: "Apply" })] })] })] }));
|
|
64
|
+
return (_jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-gap-4", children: [_jsx(Dropdown, { menu: { items: typeOptions, onClick: onTypeMenuClick }, trigger: ["click"], children: _jsx(CustomButton, { label: _jsxs(_Fragment, { children: [selectedType ? capitalize(selectedType) : "Type", " ", _jsx(DownOutlined, {})] }), loading: loading && loadingType === "type", type: !!selectedType ? "primary" : "default", icon: _jsx(IoFilterIcon, {}) }) }), _jsx(Dropdown, { dropdownRender: () => dateDropdownContent, trigger: ["click"], open: dateDropdownOpen, onOpenChange: setDateDropdownOpen, children: _jsx(CustomButton, { type: !!selectedDateKey ? "primary" : "default", label: _jsxs(_Fragment, { children: ["Modified ", _jsx(DownOutlined, {})] }), loading: loading && loadingType === "date", icon: _jsx(IoFilterIcon, {}) }) })] }));
|
|
65
|
+
}
|
|
66
|
+
export default TypeAndDateFilters;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { FaFolder, FaFileAlt, FaFilePdf, FaFileExcel, FaFileArchive, } from "react-icons/fa";
|
|
3
|
+
import { FileImageOutlined, VideoCameraOutlined, CustomerServiceOutlined, } from "@ant-design/icons";
|
|
4
|
+
import { EntityType } from "../../utilities/constants/interface";
|
|
5
|
+
const FaFolderIcon = FaFolder;
|
|
6
|
+
const FaFileAltIcon = FaFileAlt;
|
|
7
|
+
const FaFilePdfIcon = FaFilePdf;
|
|
8
|
+
const FaFileExcelIcon = FaFileExcel;
|
|
9
|
+
const FaFileArchiveIcon = FaFileArchive;
|
|
10
|
+
export function getFileOrFolderIcon(type, mimeType, size) {
|
|
11
|
+
const textSize = size || 15;
|
|
12
|
+
if (type === EntityType.FOLDER) {
|
|
13
|
+
return _jsx(FaFolderIcon, { className: "md-lib-text-primaryColor md-lib-text-[16px]" });
|
|
14
|
+
}
|
|
15
|
+
let icon = (_jsx(FaFileAltIcon, { className: "md-lib-text-[15px] md-lib-text-primaryColor" }));
|
|
16
|
+
if (!mimeType)
|
|
17
|
+
return icon;
|
|
18
|
+
if (mimeType.startsWith("image/")) {
|
|
19
|
+
icon = (_jsx(FileImageOutlined, { className: textSize ? "md-lib-text-[20px]" : "md-lib-text-imagesColor md-lib-text-[15px]" }));
|
|
20
|
+
}
|
|
21
|
+
else if (mimeType.startsWith("video/")) {
|
|
22
|
+
icon = (_jsx(VideoCameraOutlined, { className: textSize ? "md-lib-text-[20px]" : "md-lib-text-videosColor md-lib-text-[15px]" }));
|
|
23
|
+
}
|
|
24
|
+
else if (mimeType.startsWith("audio/")) {
|
|
25
|
+
icon = (_jsx(CustomerServiceOutlined, { className: textSize ? "md-lib-text-[20px]" : "md-lib-text-musicColor md-lib-text-[15px]" }));
|
|
26
|
+
}
|
|
27
|
+
else if (mimeType === "application/pdf") {
|
|
28
|
+
icon = (_jsx(FaFilePdfIcon, { className: textSize ? "md-lib-text-[20px]" : "md-lib-text-dangerColor md-lib-text-[15px]" }));
|
|
29
|
+
}
|
|
30
|
+
else if (mimeType === "application/vnd.ms-excel" ||
|
|
31
|
+
mimeType ===
|
|
32
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") {
|
|
33
|
+
icon = (_jsx(FaFileExcelIcon, { className: textSize ? "md-lib-text-[20px]" : "md-lib-text-videosColor md-lib-text-[15px]" }));
|
|
34
|
+
}
|
|
35
|
+
else if (mimeType === "application/zip" ||
|
|
36
|
+
mimeType === "application/x-7z-compressed" ||
|
|
37
|
+
mimeType === "application/x-rar-compressed") {
|
|
38
|
+
icon = (_jsx(FaFileArchiveIcon, { className: textSize ? "md-lib-text-[20px]" : "md-lib-text-otherColor md-lib-text-[15px]" }));
|
|
39
|
+
}
|
|
40
|
+
return icon;
|
|
41
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Spin } from "antd";
|
|
3
|
+
import { LoadingOutlined } from "@ant-design/icons";
|
|
4
|
+
import { SpinSizes } from "../../utilities/constants/interface";
|
|
5
|
+
function CustomLoader({ size, fontSize }) {
|
|
6
|
+
return (_jsx(Spin, { indicator: _jsx(LoadingOutlined, { spin: true, style: { fontSize: fontSize }, className: "color:primaryColor" }), size: size ? size : SpinSizes.LARGE }));
|
|
7
|
+
}
|
|
8
|
+
export default CustomLoader;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function Loader(): JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import CustomLoader from "./CustomLoader";
|
|
3
|
+
import { SpinSizes } from "../../utilities/constants/interface";
|
|
4
|
+
export default function Loader() {
|
|
5
|
+
return (_jsx("div", { className: "md-lib-flex md-lib-justify-center md-lib-items-center !md-lib-h-screen md-lib-bg-white dark:md-lib-bg-darkPrimary", children: _jsx(CustomLoader, { size: SpinSizes.LARGE }) }));
|
|
6
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { NotificationStatus } from "../utilities/constants/interface";
|
|
2
|
+
import { toast, Bounce } from "react-toastify";
|
|
3
|
+
export const showNotification = (message, status = NotificationStatus.INFO) => {
|
|
4
|
+
const baseOptions = {
|
|
5
|
+
position: "top-right",
|
|
6
|
+
autoClose: 3000,
|
|
7
|
+
hideProgressBar: false,
|
|
8
|
+
closeOnClick: false,
|
|
9
|
+
pauseOnHover: true,
|
|
10
|
+
draggable: true,
|
|
11
|
+
progress: undefined,
|
|
12
|
+
theme: "light",
|
|
13
|
+
transition: Bounce,
|
|
14
|
+
};
|
|
15
|
+
switch (status) {
|
|
16
|
+
case NotificationStatus.SUCCESS:
|
|
17
|
+
toast.success(message, baseOptions);
|
|
18
|
+
break;
|
|
19
|
+
case NotificationStatus.ERROR:
|
|
20
|
+
toast.error(message, baseOptions);
|
|
21
|
+
break;
|
|
22
|
+
case NotificationStatus.WARN:
|
|
23
|
+
toast.warn(message, baseOptions);
|
|
24
|
+
break;
|
|
25
|
+
case NotificationStatus.INFO:
|
|
26
|
+
default:
|
|
27
|
+
toast.info(message, baseOptions);
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Space } from "antd";
|
|
3
|
+
export default function Steps({ noOfSteps, activeStep, }) {
|
|
4
|
+
return (_jsx(Space, { className: "steps-container", size: 2, children: Array.from({ length: noOfSteps }, (_, step) => {
|
|
5
|
+
return (_jsx("div", { className: `step-item ${activeStep == step + 1 ? "active" : ""}` }, step));
|
|
6
|
+
}) }));
|
|
7
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { QueryClient, QueryClientProvider } from "react-query";
|
|
4
|
+
export default function AppProvider({ children, }) {
|
|
5
|
+
const [query] = useState(() => new QueryClient({
|
|
6
|
+
defaultOptions: {
|
|
7
|
+
queries: { retry: false },
|
|
8
|
+
},
|
|
9
|
+
}));
|
|
10
|
+
return _jsx(QueryClientProvider, { client: query, children: children });
|
|
11
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
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, Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
|
+
// contexts/DamAuthContext.js
|
|
12
|
+
import { createContext, useContext, useState, useEffect } from "react";
|
|
13
|
+
import { USER_LOGIN, FETCH_TEAMS_LIST, } from "../utilities/constants/apiUrls";
|
|
14
|
+
import axios from "axios";
|
|
15
|
+
import { getBaseUrl, encodeBase64 } from "./helpers";
|
|
16
|
+
import { get } from "lodash";
|
|
17
|
+
import Loader from "../common/loader/loader";
|
|
18
|
+
import { SUBSCRIPTION_EXPIRED_ERROR_MESSAGE } from "./appConstants";
|
|
19
|
+
const DamConfigContext = createContext(null);
|
|
20
|
+
export const DamConfigProvider = ({ children, config }) => {
|
|
21
|
+
// console.log(config);
|
|
22
|
+
const { damAccessKey, secretKey, subdomain, teamIds, appType, initialRootFolderId } = config;
|
|
23
|
+
const [accessToken, setAccessToken] = useState(null);
|
|
24
|
+
const [user, setDamUser] = useState(null);
|
|
25
|
+
const [brand, setBrand] = useState(null);
|
|
26
|
+
const [loading, setLoading] = useState(false);
|
|
27
|
+
const [rootFolderId, setRootFolderId] = useState(initialRootFolderId || null);
|
|
28
|
+
const [teams, setTeams] = useState([]);
|
|
29
|
+
const [isAdmin, setIsAdmin] = useState(false);
|
|
30
|
+
const [showPaymentErr, setShowPaymentErr] = useState(false);
|
|
31
|
+
const [teamID, setTeamID] = useState(null);
|
|
32
|
+
const getToken = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
33
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
34
|
+
setLoading(true);
|
|
35
|
+
try {
|
|
36
|
+
const response = yield axios.post(getBaseUrl(appType) + USER_LOGIN, {
|
|
37
|
+
accessKey: damAccessKey,
|
|
38
|
+
secretKey: secretKey,
|
|
39
|
+
subdomain,
|
|
40
|
+
teams: teamIds,
|
|
41
|
+
});
|
|
42
|
+
console.log("Token response:", response === null || response === void 0 ? void 0 : response.data);
|
|
43
|
+
const token = (_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.access_token;
|
|
44
|
+
const userData = (_d = (_c = response === null || response === void 0 ? void 0 : response.data) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.user;
|
|
45
|
+
const brandData = (_f = (_e = response === null || response === void 0 ? void 0 : response.data) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f.brand;
|
|
46
|
+
setAccessToken(token);
|
|
47
|
+
setDamUser(userData);
|
|
48
|
+
setLoading(false);
|
|
49
|
+
setBrand(brandData);
|
|
50
|
+
setTeamID((_k = (_j = (_h = (_g = response === null || response === void 0 ? void 0 : response.data) === null || _g === void 0 ? void 0 : _g.data) === null || _h === void 0 ? void 0 : _h.brand) === null || _j === void 0 ? void 0 : _j.adminTeams) === null || _k === void 0 ? void 0 : _k[0]);
|
|
51
|
+
// Use initialRootFolderId if provided, otherwise use rootFolderId from API
|
|
52
|
+
const apiRootFolderId = get(response, "data.data.rootFolderId");
|
|
53
|
+
setRootFolderId(initialRootFolderId || apiRootFolderId);
|
|
54
|
+
const adminTeamIds = get(response, "data.data.brand.adminTeams", []);
|
|
55
|
+
// console.log(adminTeamIds);
|
|
56
|
+
setIsAdmin(teamIds.reduce((acc, curr) => {
|
|
57
|
+
return acc || adminTeamIds.includes(curr.toString());
|
|
58
|
+
}, false));
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
console.error("Error fetching token:", error);
|
|
62
|
+
if (((_l = error === null || error === void 0 ? void 0 : error.response) === null || _l === void 0 ? void 0 : _l.status) === 402) {
|
|
63
|
+
setShowPaymentErr(true);
|
|
64
|
+
}
|
|
65
|
+
setLoading(false);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
const getTeams = (token) => __awaiter(void 0, void 0, void 0, function* () {
|
|
69
|
+
var _a, _b, _c, _d;
|
|
70
|
+
if (!token) {
|
|
71
|
+
console.log("No token available to fetch teams");
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
try {
|
|
75
|
+
if (!teamID) {
|
|
76
|
+
console.log("Could not extract teamID from token");
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
// Get the Teams API base URL from environment variable
|
|
80
|
+
const teamsApiBaseUrl = process.env.REACT_APP_CORE_API_URL || "";
|
|
81
|
+
if (!teamsApiBaseUrl) {
|
|
82
|
+
console.error("REACT_APP_CORE_API_URL is not defined in environment variables");
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
// Get Basic Auth credentials from environment variables
|
|
86
|
+
const username = process.env.REACT_APP_TEAMS_API_TOKEN_USERNAME || "";
|
|
87
|
+
const password = process.env.REACT_APP_TEAMS_API_TOKEN_PASSWORD || "";
|
|
88
|
+
if (!username || !password) {
|
|
89
|
+
console.error("REACT_APP_TEAMS_API_TOKEN_USERNAME or REACT_APP_TEAMS_API_TOKEN_PASSWORD is not defined in environment variables");
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
// Create Basic Auth header by encoding username:password to Base64
|
|
93
|
+
const basicAuthToken = encodeBase64(`${username}:${password}`);
|
|
94
|
+
const authorizationHeader = `Basic ${basicAuthToken}`;
|
|
95
|
+
const teamsEndpoint = FETCH_TEAMS_LIST.replace(":teamID", teamID);
|
|
96
|
+
const fullUrl = teamsApiBaseUrl + teamsEndpoint;
|
|
97
|
+
console.log("Fetching teams from:", fullUrl);
|
|
98
|
+
console.log("TeamID from token:", teamID);
|
|
99
|
+
const response = yield axios.get(fullUrl, {
|
|
100
|
+
headers: {
|
|
101
|
+
Authorization: authorizationHeader,
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
console.log("Teams API response:", response === null || response === void 0 ? void 0 : response.data);
|
|
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) || [];
|
|
106
|
+
setTeams(Array.isArray(teamsData) ? teamsData : []);
|
|
107
|
+
}
|
|
108
|
+
catch (err) {
|
|
109
|
+
console.error("Error fetching teams:", err);
|
|
110
|
+
console.error("Error details:", {
|
|
111
|
+
message: err === null || err === void 0 ? void 0 : err.message,
|
|
112
|
+
response: (_b = err === null || err === void 0 ? void 0 : err.response) === null || _b === void 0 ? void 0 : _b.data,
|
|
113
|
+
status: (_c = err === null || err === void 0 ? void 0 : err.response) === null || _c === void 0 ? void 0 : _c.status,
|
|
114
|
+
url: (_d = err === null || err === void 0 ? void 0 : err.config) === null || _d === void 0 ? void 0 : _d.url,
|
|
115
|
+
});
|
|
116
|
+
setTeams([]);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
useEffect(() => {
|
|
120
|
+
if (damAccessKey && secretKey && subdomain) {
|
|
121
|
+
try {
|
|
122
|
+
getToken();
|
|
123
|
+
}
|
|
124
|
+
catch (err) {
|
|
125
|
+
setLoading(false);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}, [damAccessKey, secretKey, subdomain]);
|
|
129
|
+
useEffect(() => {
|
|
130
|
+
if (accessToken) {
|
|
131
|
+
getTeams(accessToken);
|
|
132
|
+
}
|
|
133
|
+
}, [accessToken]);
|
|
134
|
+
return (_jsx(DamConfigContext.Provider, { value: {
|
|
135
|
+
damAccessKey,
|
|
136
|
+
secretKey,
|
|
137
|
+
subdomain,
|
|
138
|
+
teamIds,
|
|
139
|
+
accessToken,
|
|
140
|
+
user,
|
|
141
|
+
brand,
|
|
142
|
+
refreshToken: getToken,
|
|
143
|
+
loading,
|
|
144
|
+
setAccessToken,
|
|
145
|
+
setDamUser,
|
|
146
|
+
appType,
|
|
147
|
+
setRootFolderId,
|
|
148
|
+
rootFolderId,
|
|
149
|
+
teams,
|
|
150
|
+
isAdmin,
|
|
151
|
+
}, children: loading ? (_jsx(Loader, {})) : (_jsx(_Fragment, { children: showPaymentErr ? (_jsx("div", { className: "flex items-center justify-center h-[calc(100vh-200px)]", children: _jsx("p", { className: "text-sm font-medium text-textColor dark:text-darkTextColor", children: SUBSCRIPTION_EXPIRED_ERROR_MESSAGE }) })) : (children) })) }));
|
|
152
|
+
};
|
|
153
|
+
export const useDamConfig = () => useContext(DamConfigContext);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { ThemeModes } from "../utilities/constants/interface";
|
|
3
|
+
type ThemeContextType = {
|
|
4
|
+
themeMode: string;
|
|
5
|
+
toggleTheme: (value: ThemeModes) => void;
|
|
6
|
+
isDarkMode: boolean;
|
|
7
|
+
variables: Record<string, string>;
|
|
8
|
+
};
|
|
9
|
+
export declare function ThemeProvider({ children, sessionTheme, styles, }: {
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
sessionTheme: ThemeModes;
|
|
12
|
+
styles?: Record<string, string>;
|
|
13
|
+
}): JSX.Element | null;
|
|
14
|
+
export declare function useTheme(): ThemeContextType;
|
|
15
|
+
export {};
|