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

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.
@@ -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;
@@ -177,31 +178,57 @@ const CreateClientForm = ({ teamsApi, username, password, toggleShow, onSuccess,
177
178
  newTeamsApiDetails.password !== get(existingTeamsApiDetails, "password");
178
179
  // If teamsApiDetails changed, verify first before updating
179
180
  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) {
181
+ if (teamsFromVerifyPending) {
182
+ // User already verified - require admin team selection before saving
183
+ if (!adminTeamsAsStrings.length) {
194
184
  setLoading(false);
195
- showNotification(get(verifyData, "message", "Failed to authenticate with Teams API"), NotificationStatus.ERROR);
185
+ showNotification("Please select at least one Admin Team from the updated list", NotificationStatus.ERROR);
196
186
  return;
197
187
  }
188
+ setTeamsFromVerifyPending(false);
198
189
  }
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;
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
+ }
205
232
  }
206
233
  }
207
234
  const payload = {};
@@ -380,7 +407,7 @@ const CreateClientForm = ({ teamsApi, username, password, toggleShow, onSuccess,
380
407
  required: true,
381
408
  message: "Access type is required",
382
409
  },
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: [
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: [
384
411
  {
385
412
  required: true,
386
413
  message: "Team Ids is required",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bindu-dashing/dam-solution-v2",
3
- "version": "5.9.216",
3
+ "version": "5.9.218",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.0.1",
6
6
  "@emoji-mart/data": "^1.2.1",