@bindu-dashing/dam-solution-v2 5.9.215 → 5.9.216

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
- // When "Allow time" is toggled OFF for DATE/DATE_RANGE, strip time from defaultValue
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(Form.Item, { name: "field_validations", 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 ||
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";
@@ -170,6 +170,40 @@ const CreateClientForm = ({ teamsApi, username, password, toggleShow, onSuccess,
170
170
  };
171
171
  const accessTypesChanged = JSON.stringify([...(data.accessTypes || [])].sort()) !==
172
172
  JSON.stringify([...(get(clientData, "accessTypes", []) || [])].sort());
173
+ const existingTeamsApiDetails = get(clientData, "teamsApiDetails", {});
174
+ const newTeamsApiDetails = data.teamsApiDetails || {};
175
+ const teamsApiDetailsChanged = newTeamsApiDetails.teamsApi !== get(existingTeamsApiDetails, "teamsApi") ||
176
+ newTeamsApiDetails.username !== get(existingTeamsApiDetails, "username") ||
177
+ newTeamsApiDetails.password !== get(existingTeamsApiDetails, "password");
178
+ // If teamsApiDetails changed, verify first before updating
179
+ if (teamsApiDetailsChanged) {
180
+ try {
181
+ const verifyPayload = {
182
+ teamsApi: newTeamsApiDetails.teamsApi || "",
183
+ username: newTeamsApiDetails.username || "",
184
+ password: newTeamsApiDetails.password || "",
185
+ };
186
+ const verifyResponse = yield axios.post(`${baseUrl}${LEADS_VERIFY_URL}`, verifyPayload, {
187
+ headers: {
188
+ "Content-Type": "application/json",
189
+ accept: "application/json, text/plain, */*",
190
+ },
191
+ });
192
+ const verifyData = get(verifyResponse, "data", {});
193
+ if (verifyData.status !== true && verifyData.code !== 200) {
194
+ setLoading(false);
195
+ showNotification(get(verifyData, "message", "Failed to authenticate with Teams API"), NotificationStatus.ERROR);
196
+ return;
197
+ }
198
+ }
199
+ catch (verifyError) {
200
+ setLoading(false);
201
+ const errorMessage = get(verifyError, "response.data.message") ||
202
+ get(verifyError, "message", "Failed to authenticate with Teams API");
203
+ showNotification(errorMessage, NotificationStatus.ERROR);
204
+ return;
205
+ }
206
+ }
173
207
  const payload = {};
174
208
  if (data.name !== get(clientData, "name"))
175
209
  payload.name = data.name;
@@ -179,6 +213,12 @@ const CreateClientForm = ({ teamsApi, username, password, toggleShow, onSuccess,
179
213
  payload.adminTeams = adminTeamsAsStrings;
180
214
  if (((_a = data.showFilePreview) !== null && _a !== void 0 ? _a : false) !== get(clientData, "showFilePreview", false))
181
215
  payload.showFilePreview = (_b = data.showFilePreview) !== null && _b !== void 0 ? _b : false;
216
+ if (teamsApiDetailsChanged)
217
+ payload.teamsApiDetails = {
218
+ teamsApi: newTeamsApiDetails.teamsApi || "",
219
+ username: newTeamsApiDetails.username || "",
220
+ password: newTeamsApiDetails.password || "",
221
+ };
182
222
  if (Object.keys(payload).length === 0) {
183
223
  setLoading(false);
184
224
  showNotification("No changes to save", NotificationStatus.INFO);
@@ -270,12 +310,18 @@ const CreateClientForm = ({ teamsApi, username, password, toggleShow, onSuccess,
270
310
  return teamNum;
271
311
  })
272
312
  : [];
313
+ const teamsApiDetails = get(clientData, "teamsApiDetails", {});
273
314
  form.setFieldsValue({
274
315
  name: get(clientData, "name", ""),
275
316
  subdomain: get(clientData, "subdomain", (existingClientData === null || existingClientData === void 0 ? void 0 : existingClientData.subdomain) || ""),
276
317
  accessTypes: get(clientData, "accessTypes", []),
277
318
  adminTeams: adminTeamsFormatted,
278
319
  showFilePreview: get(clientData, "showFilePreview", false),
320
+ teamsApiDetails: {
321
+ teamsApi: get(teamsApiDetails, "teamsApi", ""),
322
+ username: get(teamsApiDetails, "username", ""),
323
+ password: get(teamsApiDetails, "password", ""),
324
+ },
279
325
  damLocationDetails: {
280
326
  type: locationType === "EXTERNAL" ? "external" : locationType === "INTERNAL" ? "internal" : "external",
281
327
  bucket: get(damLocationDetails, "bucket", ""),
@@ -334,7 +380,7 @@ const CreateClientForm = ({ teamsApi, username, password, toggleShow, onSuccess,
334
380
  required: true,
335
381
  message: "Access type is required",
336
382
  },
337
- ], children: _jsx(Select, { options: ACCESS_TYPES, mode: "multiple", placeholder: "Select Access Type" }) }), _jsx(Form.Item, { label: "Admin Teams", name: "adminTeams", rules: [
383
+ ], 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" }) })] })), _jsx(Form.Item, { label: "Admin Teams", name: "adminTeams", rules: [
338
384
  {
339
385
  required: true,
340
386
  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";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bindu-dashing/dam-solution-v2",
3
- "version": "5.9.215",
3
+ "version": "5.9.216",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.0.1",
6
6
  "@emoji-mart/data": "^1.2.1",