eleven-solutions-common-website-unique-web 21.0.35 → 21.0.37

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.
@@ -59,6 +59,7 @@ const TaxonomyForm = ({ url }) => {
59
59
  }
60
60
  catch (error) {
61
61
  console.error("Error deleting Taxonomy:", error);
62
+ alert("Error deleting Taxonomy: " + error.message);
62
63
  }
63
64
  });
64
65
  const [editTaxonomyItem, setEditTaxonomyItem] = useState(null);
@@ -107,24 +108,6 @@ const TaxonomyForm = ({ url }) => {
107
108
  setIsSimilarTaxonomyOpen(true);
108
109
  }
109
110
  }, []);
110
- // const handleSubmit = async (event: React.MouseEvent<HTMLButtonElement>) => {
111
- // event.preventDefault();
112
- // try {
113
- // if (isEditMode) {
114
- // await addMultipleTaxonomiesApi(url, tempTaxonomy);
115
- // setTempTaxonomy([]);
116
- // alert("Taxonomies saved successfully");
117
- // } else {
118
- // await addTaxonomyApi(url, inputType, Number(code), value);
119
- // alert("Taxonomy added successfully");
120
- // }
121
- // window.history.pushState({}, "", "/admin/taxinomies");
122
- // window.dispatchEvent(new PopStateEvent("popstate"));
123
- // } catch (error) {
124
- // console.error("Error adding/updating Taxonomy:", error);
125
- // alert("Failed to add/update Taxonomy");
126
- // }
127
- // };
128
111
  const handleCancelClick = () => {
129
112
  setType("");
130
113
  setCode("");
@@ -168,7 +151,6 @@ const TaxonomyForm = ({ url }) => {
168
151
  setIsAddingSubType(true);
169
152
  };
170
153
  const handleSubTypeSubmitClick = () => __awaiter(void 0, void 0, void 0, function* () {
171
- var _a;
172
154
  if (!subCode || !subValue) {
173
155
  alert("Please fill out both Code and Value fields before proceeding.");
174
156
  return;
@@ -188,67 +170,13 @@ const TaxonomyForm = ({ url }) => {
188
170
  }
189
171
  }
190
172
  catch (error) {
191
- // Extract additional details if available
192
- const errorMessage = error.message || "An unknown error occurred";
193
- const innerException = error.innerException || ((_a = error.response) === null || _a === void 0 ? void 0 : _a.data) || error.details || "";
194
- // Combine the main message with additional details
195
- const detailedMessage = innerException
196
- ? `${errorMessage}\n\nDetails: ${JSON.stringify(innerException, null, 2)}`
197
- : errorMessage;
198
- // Display the detailed error message in an alert
199
- alert("Error while adding SubType: " + detailedMessage);
200
- console.error("Error details:", error); // Log full error for debugging
173
+ console.error(`Error ${editTaxonomyItem ? "editing" : "adding"} SubType:`, error);
174
+ alert("Error while adding SubType: " + error.message);
201
175
  }
202
176
  setIsModalOpen(false);
203
177
  setSubCode("");
204
178
  setSubValue("");
205
179
  });
206
- // const handleSubTypeAddClick = async () => {
207
- // if (!subCode || !subValue) {
208
- // alert("Please fill out both Code and Value fields before adding.");
209
- // return;
210
- // }
211
- // try {
212
- // await addSubTypeApi(
213
- // url,
214
- // selectedTaxonomyId,
215
- // type,
216
- // Number(subCode),
217
- // subValue
218
- // );
219
- // alert("SubType added successfully");
220
- // const fetchedTaxonomies = await fetchTaxonomiessApi(url);
221
- // if (fetchedTaxonomies && Array.isArray(fetchedTaxonomies)) {
222
- // setAllTaxonomies(fetchedTaxonomies);
223
- // }
224
- // } catch (error) {
225
- // console.error("Error adding SubType:", error);
226
- // }
227
- // setIsModalOpen(false);
228
- // setSubCode("");
229
- // setSubValue("");
230
- // };
231
- // const handleSubTypeEditClick = async () => {
232
- // try {
233
- // await updateTaxonomyApi(
234
- // url,
235
- // selectedTaxonomyId,
236
- // type,
237
- // Number(subCode),
238
- // subValue
239
- // );
240
- // alert("SubType edited successfully");
241
- // const fetchedTaxonomies = await fetchTaxonomiessApi(url);
242
- // if (fetchedTaxonomies && Array.isArray(fetchedTaxonomies)) {
243
- // setAllTaxonomies(fetchedTaxonomies);
244
- // }
245
- // } catch (error) {
246
- // console.error("Error editing SubType:", error);
247
- // }
248
- // setIsModalOpen(false);
249
- // setSubCode("");
250
- // setSubValue("");
251
- // };
252
180
  const handleSubEdit = (child) => {
253
181
  setSelectedTaxonomyId(child.id);
254
182
  setEditTaxonomyItem(child);
@@ -257,48 +185,6 @@ const TaxonomyForm = ({ url }) => {
257
185
  setIsModalOpen(true);
258
186
  setIsAddingSubType(true);
259
187
  };
260
- // const handleEditTaxClick = async () => {
261
- // try {
262
- // await updateTaxonomyApi(
263
- // url,
264
- // selectedTaxonomyId,
265
- // type,
266
- // Number(newCode),
267
- // newValue
268
- // );
269
- // alert("Taxonomy updated successfully");
270
- // } catch (error) {
271
- // console.error("Error updating Taxonomy:", error);
272
- // }
273
- // setIsModalOpen(false);
274
- // setNewCode("");
275
- // setNewValue("");
276
- // const response = await fetchTaxonomiessApi(url);
277
- // const filteredTaxonomies = (response as { type: string }[]).filter(
278
- // (taxonomy: { type: string }) => taxonomy.type === type
279
- // );
280
- // setSimilarTaxonomies(filteredTaxonomies);
281
- // };
282
- // const addTaxonomyClick = async () => {
283
- // if (!newCode || !newValue) {
284
- // alert("Please fill out both Code and Value fields before adding.");
285
- // return;
286
- // }
287
- // try {
288
- // await addTaxonomyApi(url, type, Number(newCode), newValue);
289
- // alert("Value added successfully");
290
- // const response = await fetchTaxonomiessApi(url);
291
- // const filteredTaxonomies = (response as { type: string }[]).filter(
292
- // (taxonomy: { type: string }) => taxonomy.type === type
293
- // );
294
- // setSimilarTaxonomies(filteredTaxonomies);
295
- // } catch (error) {
296
- // console.error("Error adding value:", error);
297
- // }
298
- // setIsModalOpen(false);
299
- // setNewCode("");
300
- // setNewValue("");
301
- // };
302
188
  const handleSubmitClick = () => __awaiter(void 0, void 0, void 0, function* () {
303
189
  if (!newCode || !newValue) {
304
190
  alert("Please fill out both Code and Value fields before submitting.");
@@ -306,16 +192,13 @@ const TaxonomyForm = ({ url }) => {
306
192
  }
307
193
  try {
308
194
  if (editTaxonomyItem || editTempTaxonomyItem) {
309
- // Edit taxonomy logic
310
195
  yield updateTaxonomyApi(url, selectedTaxonomyId, type, Number(newCode), newValue);
311
196
  alert("Taxonomy updated successfully");
312
197
  }
313
198
  else {
314
- // Add taxonomy logic
315
199
  yield addTaxonomyApi(url, type, Number(newCode), newValue);
316
200
  alert("Value added successfully");
317
201
  }
318
- // Fetch and update similar taxonomies
319
202
  const response = yield fetchTaxonomiessApi(url);
320
203
  const filteredTaxonomies = response.filter((taxonomy) => taxonomy.type === type);
321
204
  setSimilarTaxonomies(filteredTaxonomies);
@@ -324,8 +207,10 @@ const TaxonomyForm = ({ url }) => {
324
207
  console.error(editTaxonomyItem || editTempTaxonomyItem
325
208
  ? "Error updating Taxonomy:"
326
209
  : "Error adding value:", error);
210
+ alert(editTaxonomyItem
211
+ ? "Error updating Taxonomy: "
212
+ : "Error adding value: " + error.message);
327
213
  }
328
- // Reset modal and input fields
329
214
  setIsModalOpen(false);
330
215
  setNewCode("");
331
216
  setNewValue("");
@@ -353,10 +238,6 @@ const TaxonomyForm = ({ url }) => {
353
238
  : "Add SubType"
354
239
  : editTaxonomyItem
355
240
  ? "Edit Values"
356
- : "Add Values" }), _jsx("button", { onClick: handleCloseModal, className: "text-xl text-gray-600 dark:text-gray-400 h-6 w-6", children: "\u00D7" })] }), isAddingSubType ? (_jsxs(_Fragment, { children: [_jsx("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: "Code" }), _jsx("input", { type: "number", value: subCode, onChange: (e) => setSubCode(e.target.value), placeholder: "Enter Code", className: "w-full px-4 py-2 mt-2 mb-4 border border-gray-300 rounded-md" }), _jsx("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: "Value" }), _jsx("input", { type: "text", value: subValue, onChange: (e) => setSubValue(e.target.value), placeholder: "Enter Value", className: "w-full px-4 py-2 mt-2 mb-4 border border-gray-300 rounded-md" }), _jsxs("div", { className: "flex space-x-4 justify-end", children: [_jsx("button", { onClick: handleSubTypeSubmitClick, className: "px-8 py-2.5 leading-5 text-white transition-colors duration-300 transform bg-blue-600 rounded-md hover:bg-blue-500 focus:outline-none focus:bg-gray-600", children: editTaxonomyItem ? "Edit" : "Add" }), _jsx("button", { onClick: handleCloseModal, className: "px-8 py-2.5 leading-5 bg-gray-300 rounded-md", children: "Cancel" })] })] })) : (_jsxs(_Fragment, { children: [_jsx("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: "Code" }), _jsx("input", { type: "number", value: newCode, onChange: (e) => setNewCode(e.target.value), placeholder: "Enter Code", className: "w-full px-4 py-2 mt-2 mb-4 border border-gray-300 rounded-md" }), _jsx("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: "Value" }), _jsx("input", { type: "text", value: newValue, onChange: (e) => setNewValue(e.target.value), placeholder: "Enter Value", className: "w-full px-4 py-2 mt-2 mb-4 border border-gray-300 rounded-md" }), _jsxs("div", { className: "flex space-x-4 justify-end", children: [_jsx("button", {
357
- // onClick={
358
- // editTaxonomyItem ? handleEditTaxClick : addTaxonomyClick
359
- // }
360
- onClick: handleSubmitClick, className: "px-8 py-2.5 leading-5 text-white transition-colors duration-300 transform bg-blue-600 rounded-md hover:bg-blue-500 focus:outline-none focus:bg-gray-600", children: editTaxonomyItem || editTempTaxonomyItem ? "Edit" : "Add" }), _jsx("button", { onClick: handleCloseModal, className: "px-8 py-2.5 leading-5 bg-gray-300 rounded-md", children: "Cancel" })] })] }))] }) })] }));
241
+ : "Add Values" }), _jsx("button", { onClick: handleCloseModal, className: "text-xl text-gray-600 dark:text-gray-400 h-6 w-6", children: "\u00D7" })] }), isAddingSubType ? (_jsxs(_Fragment, { children: [_jsx("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: "Code" }), _jsx("input", { type: "number", value: subCode, onChange: (e) => setSubCode(e.target.value), placeholder: "Enter Code", className: "w-full px-4 py-2 mt-2 mb-4 border border-gray-300 rounded-md" }), _jsx("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: "Value" }), _jsx("input", { type: "text", value: subValue, onChange: (e) => setSubValue(e.target.value), placeholder: "Enter Value", className: "w-full px-4 py-2 mt-2 mb-4 border border-gray-300 rounded-md" }), _jsxs("div", { className: "flex space-x-4 justify-end", children: [_jsx("button", { onClick: handleSubTypeSubmitClick, className: "px-8 py-2.5 leading-5 text-white transition-colors duration-300 transform bg-blue-600 rounded-md hover:bg-blue-500 focus:outline-none focus:bg-gray-600", children: editTaxonomyItem ? "Edit" : "Add" }), _jsx("button", { onClick: handleCloseModal, className: "px-8 py-2.5 leading-5 bg-gray-300 rounded-md", children: "Cancel" })] })] })) : (_jsxs(_Fragment, { children: [_jsx("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: "Code" }), _jsx("input", { type: "number", value: newCode, onChange: (e) => setNewCode(e.target.value), placeholder: "Enter Code", className: "w-full px-4 py-2 mt-2 mb-4 border border-gray-300 rounded-md" }), _jsx("label", { className: "text-gray-900 dark:text-gray-200 font-semibold", children: "Value" }), _jsx("input", { type: "text", value: newValue, onChange: (e) => setNewValue(e.target.value), placeholder: "Enter Value", className: "w-full px-4 py-2 mt-2 mb-4 border border-gray-300 rounded-md" }), _jsxs("div", { className: "flex space-x-4 justify-end", children: [_jsx("button", { onClick: handleSubmitClick, className: "px-8 py-2.5 leading-5 text-white transition-colors duration-300 transform bg-blue-600 rounded-md hover:bg-blue-500 focus:outline-none focus:bg-gray-600", children: editTaxonomyItem || editTempTaxonomyItem ? "Edit" : "Add" }), _jsx("button", { onClick: handleCloseModal, className: "px-8 py-2.5 leading-5 bg-gray-300 rounded-md", children: "Cancel" })] })] }))] }) })] }));
361
242
  };
362
243
  export default TaxonomyForm;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eleven-solutions-common-website-unique-web",
3
- "version": "21.0.35",
3
+ "version": "21.0.37",
4
4
  "main": "./dist/index.js",
5
5
  "scripts": {
6
6
  "build": "tsc",
@@ -73,6 +73,7 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
73
73
  }
74
74
  } catch (error) {
75
75
  console.error("Error deleting Taxonomy:", error);
76
+ alert("Error deleting Taxonomy: " + error.message);
76
77
  }
77
78
  };
78
79
 
@@ -144,26 +145,6 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
144
145
  }
145
146
  }, []);
146
147
 
147
- // const handleSubmit = async (event: React.MouseEvent<HTMLButtonElement>) => {
148
- // event.preventDefault();
149
-
150
- // try {
151
- // if (isEditMode) {
152
- // await addMultipleTaxonomiesApi(url, tempTaxonomy);
153
- // setTempTaxonomy([]);
154
- // alert("Taxonomies saved successfully");
155
- // } else {
156
- // await addTaxonomyApi(url, inputType, Number(code), value);
157
- // alert("Taxonomy added successfully");
158
- // }
159
- // window.history.pushState({}, "", "/admin/taxinomies");
160
- // window.dispatchEvent(new PopStateEvent("popstate"));
161
- // } catch (error) {
162
- // console.error("Error adding/updating Taxonomy:", error);
163
- // alert("Failed to add/update Taxonomy");
164
- // }
165
- // };
166
-
167
148
  const handleCancelClick = () => {
168
149
  setType("");
169
150
  setCode("");
@@ -248,25 +229,12 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
248
229
  if (fetchedTaxonomies && Array.isArray(fetchedTaxonomies)) {
249
230
  setAllTaxonomies(fetchedTaxonomies);
250
231
  }
251
- } catch (error: any) {
252
- // Extract additional details if available
253
- const errorMessage = error.message || "An unknown error occurred";
254
- const innerException =
255
- error.innerException || error.response?.data || error.details || "";
256
-
257
- // Combine the main message with additional details
258
- const detailedMessage = innerException
259
- ? `${errorMessage}\n\nDetails: ${JSON.stringify(
260
- innerException,
261
- null,
262
- 2
263
- )}`
264
- : errorMessage;
265
-
266
- // Display the detailed error message in an alert
267
- alert("Error while adding SubType: " + detailedMessage);
268
-
269
- console.error("Error details:", error); // Log full error for debugging
232
+ } catch (error) {
233
+ console.error(
234
+ `Error ${editTaxonomyItem ? "editing" : "adding"} SubType:`,
235
+ error
236
+ );
237
+ alert("Error while adding SubType: " + error.message);
270
238
  }
271
239
 
272
240
  setIsModalOpen(false);
@@ -274,55 +242,6 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
274
242
  setSubValue("");
275
243
  };
276
244
 
277
- // const handleSubTypeAddClick = async () => {
278
- // if (!subCode || !subValue) {
279
- // alert("Please fill out both Code and Value fields before adding.");
280
- // return;
281
- // }
282
- // try {
283
- // await addSubTypeApi(
284
- // url,
285
- // selectedTaxonomyId,
286
- // type,
287
- // Number(subCode),
288
- // subValue
289
- // );
290
- // alert("SubType added successfully");
291
- // const fetchedTaxonomies = await fetchTaxonomiessApi(url);
292
- // if (fetchedTaxonomies && Array.isArray(fetchedTaxonomies)) {
293
- // setAllTaxonomies(fetchedTaxonomies);
294
- // }
295
- // } catch (error) {
296
- // console.error("Error adding SubType:", error);
297
- // }
298
- // setIsModalOpen(false);
299
- // setSubCode("");
300
- // setSubValue("");
301
- // };
302
-
303
- // const handleSubTypeEditClick = async () => {
304
- // try {
305
- // await updateTaxonomyApi(
306
- // url,
307
- // selectedTaxonomyId,
308
- // type,
309
- // Number(subCode),
310
- // subValue
311
- // );
312
-
313
- // alert("SubType edited successfully");
314
- // const fetchedTaxonomies = await fetchTaxonomiessApi(url);
315
- // if (fetchedTaxonomies && Array.isArray(fetchedTaxonomies)) {
316
- // setAllTaxonomies(fetchedTaxonomies);
317
- // }
318
- // } catch (error) {
319
- // console.error("Error editing SubType:", error);
320
- // }
321
- // setIsModalOpen(false);
322
- // setSubCode("");
323
- // setSubValue("");
324
- // };
325
-
326
245
  const handleSubEdit = (child: {
327
246
  id: string;
328
247
  type: string;
@@ -337,51 +256,6 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
337
256
  setIsAddingSubType(true);
338
257
  };
339
258
 
340
- // const handleEditTaxClick = async () => {
341
- // try {
342
- // await updateTaxonomyApi(
343
- // url,
344
- // selectedTaxonomyId,
345
- // type,
346
- // Number(newCode),
347
- // newValue
348
- // );
349
- // alert("Taxonomy updated successfully");
350
- // } catch (error) {
351
- // console.error("Error updating Taxonomy:", error);
352
- // }
353
- // setIsModalOpen(false);
354
- // setNewCode("");
355
- // setNewValue("");
356
- // const response = await fetchTaxonomiessApi(url);
357
- // const filteredTaxonomies = (response as { type: string }[]).filter(
358
- // (taxonomy: { type: string }) => taxonomy.type === type
359
- // );
360
- // setSimilarTaxonomies(filteredTaxonomies);
361
- // };
362
-
363
- // const addTaxonomyClick = async () => {
364
- // if (!newCode || !newValue) {
365
- // alert("Please fill out both Code and Value fields before adding.");
366
- // return;
367
- // }
368
- // try {
369
- // await addTaxonomyApi(url, type, Number(newCode), newValue);
370
-
371
- // alert("Value added successfully");
372
- // const response = await fetchTaxonomiessApi(url);
373
- // const filteredTaxonomies = (response as { type: string }[]).filter(
374
- // (taxonomy: { type: string }) => taxonomy.type === type
375
- // );
376
- // setSimilarTaxonomies(filteredTaxonomies);
377
- // } catch (error) {
378
- // console.error("Error adding value:", error);
379
- // }
380
- // setIsModalOpen(false);
381
- // setNewCode("");
382
- // setNewValue("");
383
- // };
384
-
385
259
  const handleSubmitClick = async () => {
386
260
  if (!newCode || !newValue) {
387
261
  alert("Please fill out both Code and Value fields before submitting.");
@@ -390,7 +264,6 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
390
264
 
391
265
  try {
392
266
  if (editTaxonomyItem || editTempTaxonomyItem) {
393
- // Edit taxonomy logic
394
267
  await updateTaxonomyApi(
395
268
  url,
396
269
  selectedTaxonomyId,
@@ -400,12 +273,10 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
400
273
  );
401
274
  alert("Taxonomy updated successfully");
402
275
  } else {
403
- // Add taxonomy logic
404
276
  await addTaxonomyApi(url, type, Number(newCode), newValue);
405
277
  alert("Value added successfully");
406
278
  }
407
279
 
408
- // Fetch and update similar taxonomies
409
280
  const response = await fetchTaxonomiessApi(url);
410
281
  const filteredTaxonomies = (response as { type: string }[]).filter(
411
282
  (taxonomy: { type: string }) => taxonomy.type === type
@@ -418,9 +289,13 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
418
289
  : "Error adding value:",
419
290
  error
420
291
  );
292
+ alert(
293
+ editTaxonomyItem
294
+ ? "Error updating Taxonomy: "
295
+ : "Error adding value: " + error.message
296
+ );
421
297
  }
422
298
 
423
- // Reset modal and input fields
424
299
  setIsModalOpen(false);
425
300
  setNewCode("");
426
301
  setNewValue("");
@@ -841,9 +716,6 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => {
841
716
 
842
717
  <div className="flex space-x-4 justify-end">
843
718
  <button
844
- // onClick={
845
- // editTaxonomyItem ? handleEditTaxClick : addTaxonomyClick
846
- // }
847
719
  onClick={handleSubmitClick}
848
720
  className="px-8 py-2.5 leading-5 text-white transition-colors duration-300 transform bg-blue-600 rounded-md hover:bg-blue-500 focus:outline-none focus:bg-gray-600"
849
721
  >