@bindu-dashing/dam-solution-v2 5.9.215 → 5.9.217
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.
|
@@ -231,7 +231,7 @@ export default function AddFieldProperties({ field, setCurrentFieldIndex, onUpda
|
|
|
231
231
|
var _a;
|
|
232
232
|
const formValues = allValues !== null && allValues !== void 0 ? allValues : form.getFieldsValue(true);
|
|
233
233
|
const defaultName = currentInputType === null || currentInputType === void 0 ? void 0 : currentInputType.defaultName;
|
|
234
|
-
//
|
|
234
|
+
// inputTypeSettings includes validation toggles (NUMERIC_VALUE, SPECIAL_CHARACTERS, etc.)
|
|
235
235
|
const settings = get(formValues, "inputTypeSettings", {});
|
|
236
236
|
const allowTime = !!get(settings, `${InputSupportedTypes.ALLOW_TIME}.allow`);
|
|
237
237
|
const allowTimeChanged = changedValues && get(changedValues, "inputTypeSettings");
|
|
@@ -386,7 +386,7 @@ export default function AddFieldProperties({ field, setCurrentFieldIndex, onUpda
|
|
|
386
386
|
required: true,
|
|
387
387
|
message: "Placeholder is required",
|
|
388
388
|
},
|
|
389
|
-
], children: _jsx(Input, { placeholder: "Enter Field Placeholder", className: "md-lib-h-12", maxLength: 255, showCount: true }) })), defaultValueInput && defaultValueInput, _jsxs("div", { children: [!!get(currentInputType, "supportedTypes.length") && (_jsx("h3", { className: "md-lib-text-md md-lib-font-semibold md-lib-mb-2", children: "Field Validations" })), _jsxs(
|
|
389
|
+
], children: _jsx(Input, { placeholder: "Enter Field Placeholder", className: "md-lib-h-12", maxLength: 255, showCount: true }) })), defaultValueInput && defaultValueInput, _jsxs("div", { children: [!!get(currentInputType, "supportedTypes.length") && (_jsx("h3", { className: "md-lib-text-md md-lib-font-semibold md-lib-mb-2", children: "Field Validations" })), _jsxs("div", { children: [includes([InputTypes.PARAGRAPH, InputTypes.TEXT, InputTypes.LINK], get(currentInputType, "defaultName")) && (_jsx(TextField, { field: field, supportedTypes: get(currentInputType, "supportedTypes", []) })), get(currentInputType, "defaultName") == InputTypes.NUMBERS && (_jsx(NumberField, { field: field, supportedTypes: get(currentInputType, "supportedTypes", []) })), (get(currentInputType, "defaultName") == InputTypes.DATE ||
|
|
390
390
|
get(currentInputType, "defaultName") ==
|
|
391
391
|
InputTypes.DATE_RANGE) && (_jsx(DateField, { field: field, supportedTypes: get(currentInputType, "supportedTypes", []) })), includes([
|
|
392
392
|
InputTypes.SELECT,
|
|
@@ -12,7 +12,7 @@ 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";
|
|
15
|
-
import { CREATE_SUB_BRAND, FETCH_BRAND_USING_SUBDOMAIN, USER_LOGIN } from "../utilities/constants/apiUrls";
|
|
15
|
+
import { CREATE_SUB_BRAND, FETCH_BRAND_USING_SUBDOMAIN, LEADS_VERIFY_URL, USER_LOGIN } from "../utilities/constants/apiUrls";
|
|
16
16
|
import axios from "axios";
|
|
17
17
|
import { createApiClient } from "../hocs/configureAxios";
|
|
18
18
|
import { getBaseUrl } from "../hocs/helpers";
|
|
@@ -31,6 +31,7 @@ const CreateClientForm = ({ teamsApi, username, password, toggleShow, onSuccess,
|
|
|
31
31
|
const [teamsFetched, setTeamsFetched] = useState(false);
|
|
32
32
|
const [authToken, setAuthToken] = useState(null);
|
|
33
33
|
const [brandIdForUpdate, setBrandIdForUpdate] = useState(null);
|
|
34
|
+
const [teamsFromVerifyPending, setTeamsFromVerifyPending] = useState(false);
|
|
34
35
|
const api = useMemo(() => createApiClient(damConfig), [damConfig]);
|
|
35
36
|
const [form] = Form.useForm();
|
|
36
37
|
const isEditMode = !!existingClientData;
|
|
@@ -170,6 +171,66 @@ const CreateClientForm = ({ teamsApi, username, password, toggleShow, onSuccess,
|
|
|
170
171
|
};
|
|
171
172
|
const accessTypesChanged = JSON.stringify([...(data.accessTypes || [])].sort()) !==
|
|
172
173
|
JSON.stringify([...(get(clientData, "accessTypes", []) || [])].sort());
|
|
174
|
+
const existingTeamsApiDetails = get(clientData, "teamsApiDetails", {});
|
|
175
|
+
const newTeamsApiDetails = data.teamsApiDetails || {};
|
|
176
|
+
const teamsApiDetailsChanged = newTeamsApiDetails.teamsApi !== get(existingTeamsApiDetails, "teamsApi") ||
|
|
177
|
+
newTeamsApiDetails.username !== get(existingTeamsApiDetails, "username") ||
|
|
178
|
+
newTeamsApiDetails.password !== get(existingTeamsApiDetails, "password");
|
|
179
|
+
// If teamsApiDetails changed, verify first before updating
|
|
180
|
+
if (teamsApiDetailsChanged) {
|
|
181
|
+
if (teamsFromVerifyPending) {
|
|
182
|
+
// User already verified - require admin team selection before saving
|
|
183
|
+
if (!adminTeamsAsStrings.length) {
|
|
184
|
+
setLoading(false);
|
|
185
|
+
showNotification("Please select at least one Admin Team from the updated list", NotificationStatus.ERROR);
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
setTeamsFromVerifyPending(false);
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
try {
|
|
192
|
+
const verifyPayload = {
|
|
193
|
+
teamsApi: newTeamsApiDetails.teamsApi || "",
|
|
194
|
+
username: newTeamsApiDetails.username || "",
|
|
195
|
+
password: newTeamsApiDetails.password || "",
|
|
196
|
+
};
|
|
197
|
+
const verifyResponse = yield axios.post(`${baseUrl}${LEADS_VERIFY_URL}`, verifyPayload, {
|
|
198
|
+
headers: {
|
|
199
|
+
"Content-Type": "application/json",
|
|
200
|
+
accept: "application/json, text/plain, */*",
|
|
201
|
+
},
|
|
202
|
+
});
|
|
203
|
+
const verifyData = get(verifyResponse, "data", {});
|
|
204
|
+
if (verifyData.status !== true && verifyData.code !== 200) {
|
|
205
|
+
setLoading(false);
|
|
206
|
+
showNotification(get(verifyData, "message", "Failed to authenticate with Teams API"), NotificationStatus.ERROR);
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
// Verify success - check if we have team data to render in Admin Teams
|
|
210
|
+
const teamsData = get(verifyData, "data", []);
|
|
211
|
+
if (Array.isArray(teamsData) && teamsData.length > 0) {
|
|
212
|
+
const teamOptions = teamsData.map((team) => ({
|
|
213
|
+
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) || "" })] })),
|
|
214
|
+
value: team === null || team === void 0 ? void 0 : team.id,
|
|
215
|
+
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) || ""}`,
|
|
216
|
+
}));
|
|
217
|
+
setFilteredTeams(teamOptions);
|
|
218
|
+
form.setFieldValue("adminTeams", []);
|
|
219
|
+
setTeamsFromVerifyPending(true);
|
|
220
|
+
setLoading(false);
|
|
221
|
+
showNotification("Teams updated. Please select at least one Admin Team and click Save again.", NotificationStatus.INFO);
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
catch (verifyError) {
|
|
226
|
+
setLoading(false);
|
|
227
|
+
const errorMessage = get(verifyError, "response.data.message") ||
|
|
228
|
+
get(verifyError, "message", "Failed to authenticate with Teams API");
|
|
229
|
+
showNotification(errorMessage, NotificationStatus.ERROR);
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
173
234
|
const payload = {};
|
|
174
235
|
if (data.name !== get(clientData, "name"))
|
|
175
236
|
payload.name = data.name;
|
|
@@ -179,6 +240,12 @@ const CreateClientForm = ({ teamsApi, username, password, toggleShow, onSuccess,
|
|
|
179
240
|
payload.adminTeams = adminTeamsAsStrings;
|
|
180
241
|
if (((_a = data.showFilePreview) !== null && _a !== void 0 ? _a : false) !== get(clientData, "showFilePreview", false))
|
|
181
242
|
payload.showFilePreview = (_b = data.showFilePreview) !== null && _b !== void 0 ? _b : false;
|
|
243
|
+
if (teamsApiDetailsChanged)
|
|
244
|
+
payload.teamsApiDetails = {
|
|
245
|
+
teamsApi: newTeamsApiDetails.teamsApi || "",
|
|
246
|
+
username: newTeamsApiDetails.username || "",
|
|
247
|
+
password: newTeamsApiDetails.password || "",
|
|
248
|
+
};
|
|
182
249
|
if (Object.keys(payload).length === 0) {
|
|
183
250
|
setLoading(false);
|
|
184
251
|
showNotification("No changes to save", NotificationStatus.INFO);
|
|
@@ -270,12 +337,18 @@ const CreateClientForm = ({ teamsApi, username, password, toggleShow, onSuccess,
|
|
|
270
337
|
return teamNum;
|
|
271
338
|
})
|
|
272
339
|
: [];
|
|
340
|
+
const teamsApiDetails = get(clientData, "teamsApiDetails", {});
|
|
273
341
|
form.setFieldsValue({
|
|
274
342
|
name: get(clientData, "name", ""),
|
|
275
343
|
subdomain: get(clientData, "subdomain", (existingClientData === null || existingClientData === void 0 ? void 0 : existingClientData.subdomain) || ""),
|
|
276
344
|
accessTypes: get(clientData, "accessTypes", []),
|
|
277
345
|
adminTeams: adminTeamsFormatted,
|
|
278
346
|
showFilePreview: get(clientData, "showFilePreview", false),
|
|
347
|
+
teamsApiDetails: {
|
|
348
|
+
teamsApi: get(teamsApiDetails, "teamsApi", ""),
|
|
349
|
+
username: get(teamsApiDetails, "username", ""),
|
|
350
|
+
password: get(teamsApiDetails, "password", ""),
|
|
351
|
+
},
|
|
279
352
|
damLocationDetails: {
|
|
280
353
|
type: locationType === "EXTERNAL" ? "external" : locationType === "INTERNAL" ? "internal" : "external",
|
|
281
354
|
bucket: get(damLocationDetails, "bucket", ""),
|
|
@@ -334,7 +407,7 @@ const CreateClientForm = ({ teamsApi, username, password, toggleShow, onSuccess,
|
|
|
334
407
|
required: true,
|
|
335
408
|
message: "Access type is required",
|
|
336
409
|
},
|
|
337
|
-
], children: _jsx(Select, { options: ACCESS_TYPES, mode: "multiple", placeholder: "Select Access Type" }) }), _jsx(Form.Item, { label: "Admin Teams", name: "adminTeams", rules: [
|
|
410
|
+
], children: _jsx(Select, { options: ACCESS_TYPES, mode: "multiple", placeholder: "Select Access Type" }) }), isEditMode && (_jsxs(_Fragment, { children: [_jsx(Form.Item, { label: "Teams API", name: ["teamsApiDetails", "teamsApi"], children: _jsx(Input, { placeholder: "Teams API URL" }) }), _jsx(Form.Item, { label: "Username", name: ["teamsApiDetails", "username"], children: _jsx(Input, { placeholder: "Username" }) }), _jsx(Form.Item, { label: "Password", name: ["teamsApiDetails", "password"], children: _jsx(Input.Password, { placeholder: "Password" }) })] })), isEditMode && teamsFromVerifyPending && (_jsx("div", { style: { marginBottom: 12 }, children: _jsx(Typography.Text, { type: "warning", children: "Please select at least one Admin Team from the updated list below, then click Save." }) })), _jsx(Form.Item, { label: "Admin Teams", name: "adminTeams", rules: [
|
|
338
411
|
{
|
|
339
412
|
required: true,
|
|
340
413
|
message: "Team Ids is required",
|
|
@@ -59,7 +59,7 @@ export const getFormItem = (item, fromDefaultValue, userOptions, teamOptions) =>
|
|
|
59
59
|
message: `${label} is required.`,
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
|
-
// NUMERIC_VALUE
|
|
62
|
+
// NUMERIC_VALUE: when toggle is OFF, numbers are not allowed
|
|
63
63
|
if (get(settings, "NUMERIC_VALUE", null) === false) {
|
|
64
64
|
rules.push({
|
|
65
65
|
pattern: /^[^0-9]*$/,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const CREATE_BRAND_REQUEST_URL = "/leads";
|
|
2
|
+
export declare const LEADS_VERIFY_URL = "/leads/verify";
|
|
2
3
|
export declare const RESEND_LEAD_REQUEST_OTP_URL = "/leads/resend/:leadId";
|
|
3
4
|
export declare const SIGNUP_VERIFICATION_URL = "/leads/verification/:leadId";
|
|
4
5
|
export declare const SUBMIT_LEAD_REQUEST_URL = "/leads/:leadId";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
//signup
|
|
2
2
|
export const CREATE_BRAND_REQUEST_URL = "/leads";
|
|
3
|
+
export const LEADS_VERIFY_URL = "/leads/verify";
|
|
3
4
|
export const RESEND_LEAD_REQUEST_OTP_URL = "/leads/resend/:leadId";
|
|
4
5
|
export const SIGNUP_VERIFICATION_URL = "/leads/verification/:leadId";
|
|
5
6
|
export const SUBMIT_LEAD_REQUEST_URL = "/leads/:leadId";
|