@bindu-dashing/dam-solution-v2 5.8.148 → 5.8.151
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 +6 -1
- package/build/CreateClient/CreateClientBtn.js +3 -2
- package/build/CreateClient/CreateClientForm.d.ts +6 -1
- package/build/CreateClient/CreateClientForm.js +18 -14
- package/build/CreateClient/index.d.ts +5 -0
- package/build/CreateClient/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
declare const CreateClient: ({ onSuccess, clientSubdomain, teamsApi, username, password, }: {
|
|
1
|
+
declare const CreateClient: ({ onSuccess, clientSubdomain, teamsApi, username, password, existingClientData, }: {
|
|
2
2
|
onSuccess: (data: any) => void;
|
|
3
3
|
clientSubdomain: string;
|
|
4
4
|
teamsApi: string;
|
|
5
5
|
username: string;
|
|
6
6
|
password: string;
|
|
7
|
+
existingClientData?: {
|
|
8
|
+
accessKey: string;
|
|
9
|
+
secretKey: string;
|
|
10
|
+
subdomain: string;
|
|
11
|
+
} | null;
|
|
7
12
|
}) => JSX.Element;
|
|
8
13
|
export default CreateClient;
|
|
@@ -2,11 +2,12 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import { Button } from "antd";
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import CreateClientForm from "./CreateClientForm";
|
|
5
|
-
const CreateClient = ({ onSuccess, clientSubdomain, teamsApi, username, password, }) => {
|
|
5
|
+
const CreateClient = ({ onSuccess, clientSubdomain, teamsApi, username, password, existingClientData, }) => {
|
|
6
6
|
const [showForm, setShowForm] = useState(false);
|
|
7
|
+
const isEditMode = !!existingClientData;
|
|
7
8
|
const toggleShow = () => {
|
|
8
9
|
setShowForm(!showForm);
|
|
9
10
|
};
|
|
10
|
-
return (_jsxs(_Fragment, { children: [_jsx(Button, { type: "primary", onClick: toggleShow, children: "Create Client" }), showForm && (_jsx(CreateClientForm, { toggleShow: toggleShow, onSuccess: onSuccess, clientSubdomain: clientSubdomain, teamsApi: teamsApi, username: username, password: password }))] }));
|
|
11
|
+
return (_jsxs(_Fragment, { children: [_jsx(Button, { type: "primary", onClick: toggleShow, children: isEditMode ? "Edit Client" : "Create Client" }), showForm && (_jsx(CreateClientForm, { toggleShow: toggleShow, onSuccess: onSuccess, clientSubdomain: clientSubdomain, teamsApi: teamsApi, username: username, password: password, existingClientData: existingClientData }))] }));
|
|
11
12
|
};
|
|
12
13
|
export default CreateClient;
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
declare const CreateClientForm: ({ teamsApi, username, password, toggleShow, onSuccess, clientSubdomain, }: {
|
|
1
|
+
declare const CreateClientForm: ({ teamsApi, username, password, toggleShow, onSuccess, clientSubdomain, existingClientData, }: {
|
|
2
2
|
teamsApi: string;
|
|
3
3
|
username: string;
|
|
4
4
|
password: string;
|
|
5
5
|
toggleShow: () => void;
|
|
6
6
|
onSuccess: (data: any) => void;
|
|
7
7
|
clientSubdomain: string;
|
|
8
|
+
existingClientData?: {
|
|
9
|
+
accessKey: string;
|
|
10
|
+
secretKey: string;
|
|
11
|
+
subdomain: string;
|
|
12
|
+
} | null;
|
|
8
13
|
}) => JSX.Element;
|
|
9
14
|
export default CreateClientForm;
|
|
@@ -8,7 +8,7 @@ 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 { Button, Drawer, Form, Input, Select, Typography } from "antd";
|
|
11
|
+
import { Button, Checkbox, Drawer, Form, Input, Select, Typography } from "antd";
|
|
12
12
|
import { useEffect, useMemo, useState } from "react";
|
|
13
13
|
import { ACCESS_TYPES, DAM_LOCATION_TYPES } from "../hocs/appConstants";
|
|
14
14
|
import { useDamConfig } from "../hocs/DamConfigContext";
|
|
@@ -19,7 +19,7 @@ import { CREATE_SUCCESS, SOMETHING_WENT_WRONG, } from "../utilities/constants/me
|
|
|
19
19
|
import { NotificationStatus } from "../utilities/constants/interface";
|
|
20
20
|
import { showNotification } from "../common/notifications";
|
|
21
21
|
import { get } from "lodash";
|
|
22
|
-
const CreateClientForm = ({ teamsApi, username, password, toggleShow, onSuccess, clientSubdomain, }) => {
|
|
22
|
+
const CreateClientForm = ({ teamsApi, username, password, toggleShow, onSuccess, clientSubdomain, existingClientData, }) => {
|
|
23
23
|
const damConfig = useDamConfig();
|
|
24
24
|
const { appType } = damConfig;
|
|
25
25
|
const [loading, setLoading] = useState(false);
|
|
@@ -27,6 +27,7 @@ const CreateClientForm = ({ teamsApi, username, password, toggleShow, onSuccess,
|
|
|
27
27
|
const [filteredTeams, setFilteredTeams] = useState([]);
|
|
28
28
|
const api = useMemo(() => createApiClient(damConfig), [damConfig]);
|
|
29
29
|
const [form] = Form.useForm();
|
|
30
|
+
const isEditMode = !!existingClientData;
|
|
30
31
|
const onChangeDamLocationType = (e) => {
|
|
31
32
|
setDamLocationType(e);
|
|
32
33
|
form.setFieldValue("dam_location_details", { type: e });
|
|
@@ -35,11 +36,14 @@ const CreateClientForm = ({ teamsApi, username, password, toggleShow, onSuccess,
|
|
|
35
36
|
if (clientSubdomain) {
|
|
36
37
|
form.setFieldValue("subdomain", clientSubdomain);
|
|
37
38
|
}
|
|
38
|
-
|
|
39
|
+
if (existingClientData === null || existingClientData === void 0 ? void 0 : existingClientData.subdomain) {
|
|
40
|
+
form.setFieldValue("subdomain", existingClientData.subdomain);
|
|
41
|
+
}
|
|
42
|
+
}, [existingClientData]);
|
|
39
43
|
const onFinish = (data) => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
44
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
41
45
|
try {
|
|
42
|
-
const values = Object.assign(Object.assign({}, data), { accessKey: appType == "reactJs"
|
|
46
|
+
const values = Object.assign(Object.assign({}, data), { showFilePreview: (_a = data.showFilePreview) !== null && _a !== void 0 ? _a : false, accessKey: appType == "reactJs"
|
|
43
47
|
? process.env.REACT_APP_MIXDRIVE_CLIENT_PARENT_ACCESS_KEY
|
|
44
48
|
: process.env.NEXT_PUBLIC_MIXDRIVE_CLIENT_PARENT_ACCESS_KEY, secretKey: appType == "reactJs"
|
|
45
49
|
? process.env.REACT_APP_MIXDRIVE_CLIENT_PARENT_SECRET_KEY
|
|
@@ -51,13 +55,13 @@ const CreateClientForm = ({ teamsApi, username, password, toggleShow, onSuccess,
|
|
|
51
55
|
password: password,
|
|
52
56
|
}, damLocationDetails: damLocationType === "external"
|
|
53
57
|
? {
|
|
54
|
-
bucket: (
|
|
58
|
+
bucket: (_b = data === null || data === void 0 ? void 0 : data.damLocationDetails) === null || _b === void 0 ? void 0 : _b.bucket,
|
|
55
59
|
locationType: damLocationType === "external" ? "EXTERNAL" : "INTERNAL",
|
|
56
|
-
rootPath: (
|
|
57
|
-
accessKeyId: (
|
|
58
|
-
secretAccessKey: (
|
|
59
|
-
url: (
|
|
60
|
-
region: (
|
|
60
|
+
rootPath: (_c = data === null || data === void 0 ? void 0 : data.damLocationDetails) === null || _c === void 0 ? void 0 : _c.rootPath,
|
|
61
|
+
accessKeyId: (_d = data === null || data === void 0 ? void 0 : data.damLocationDetails) === null || _d === void 0 ? void 0 : _d.accessKeyId,
|
|
62
|
+
secretAccessKey: (_e = data === null || data === void 0 ? void 0 : data.damLocationDetails) === null || _e === void 0 ? void 0 : _e.secretAccessKey,
|
|
63
|
+
url: (_f = data === null || data === void 0 ? void 0 : data.damLocationDetails) === null || _f === void 0 ? void 0 : _f.url,
|
|
64
|
+
region: (_g = data === null || data === void 0 ? void 0 : data.damLocationDetails) === null || _g === void 0 ? void 0 : _g.region,
|
|
61
65
|
}
|
|
62
66
|
: {
|
|
63
67
|
locationType: damLocationType === "external" ? "EXTERNAL" : "INTERNAL",
|
|
@@ -65,7 +69,7 @@ const CreateClientForm = ({ teamsApi, username, password, toggleShow, onSuccess,
|
|
|
65
69
|
setLoading(true);
|
|
66
70
|
const response = yield api.post(CREATE_SUB_BRAND, values);
|
|
67
71
|
setLoading(false);
|
|
68
|
-
showNotification((
|
|
72
|
+
showNotification((_h = response === null || response === void 0 ? void 0 : response.message) !== null && _h !== void 0 ? _h : (get(response, "message") || CREATE_SUCCESS), NotificationStatus.SUCCESS);
|
|
69
73
|
toggleShow();
|
|
70
74
|
if (onSuccess) {
|
|
71
75
|
onSuccess(response === null || response === void 0 ? void 0 : response.data);
|
|
@@ -103,7 +107,7 @@ const CreateClientForm = ({ teamsApi, username, password, toggleShow, onSuccess,
|
|
|
103
107
|
console.log("Error while fetching external teams", err);
|
|
104
108
|
}
|
|
105
109
|
});
|
|
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: [
|
|
110
|
+
return (_jsx(Drawer, { open: true, title: isEditMode ? "Edit Client" : "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
111
|
{
|
|
108
112
|
required: true,
|
|
109
113
|
message: "Name is required",
|
|
@@ -160,6 +164,6 @@ const CreateClientForm = ({ teamsApi, username, password, toggleShow, onSuccess,
|
|
|
160
164
|
required: true,
|
|
161
165
|
message: "Subdomain is required",
|
|
162
166
|
},
|
|
163
|
-
], children: _jsx(Input, { placeholder: "Subdomain" }) }), _jsx(Form.Item, { children: _jsx(Button, { htmlType: "submit", type: "primary", block: true, loading: loading, children: "Submit" }) })] }) }));
|
|
167
|
+
], children: _jsx(Input, { placeholder: "Subdomain" }) }), _jsx(Form.Item, { name: "showFilePreview", valuePropName: "checked", initialValue: false, children: _jsx(Checkbox, { children: "Show File Preview" }) }), _jsx(Form.Item, { children: _jsx(Button, { htmlType: "submit", type: "primary", block: true, loading: loading, children: "Submit" }) })] }) }));
|
|
164
168
|
};
|
|
165
169
|
export default CreateClientForm;
|
|
@@ -10,5 +10,10 @@ declare function App(props: {
|
|
|
10
10
|
teamIds: string[] | number[];
|
|
11
11
|
styles: Record<string, any>;
|
|
12
12
|
appType: string;
|
|
13
|
+
existingClientData?: {
|
|
14
|
+
accessKey: string;
|
|
15
|
+
secretKey: string;
|
|
16
|
+
subdomain: string;
|
|
17
|
+
} | null;
|
|
13
18
|
}): JSX.Element;
|
|
14
19
|
export default App;
|
|
@@ -13,6 +13,6 @@ function App(props) {
|
|
|
13
13
|
styles: props === null || props === void 0 ? void 0 : props.styles,
|
|
14
14
|
appType: props === null || props === void 0 ? void 0 : props.appType,
|
|
15
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, {})] }) }));
|
|
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, existingClientData: props === null || props === void 0 ? void 0 : props.existingClientData }), _jsx(ToastProvider, {})] }) }));
|
|
17
17
|
}
|
|
18
18
|
export default App;
|