eleven-solutions-common-website-unique-web 2.0.15 → 2.0.18

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.
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
11
11
  import { useState, useEffect } from "react";
12
- import { addTaxonomyApi, fetchTaxonomyByIdApi, updateTaxonomyApi, fetchTaxonomiessApi, addMultipleTaxonomiesApi, deleteTaxonomyApi, isMultipleApi, } from "../api/taxonomy";
12
+ import { addTaxonomyApi, fetchTaxonomyByIdApi, updateTaxonomyApi, fetchTaxonomiessApi, addMultipleTaxonomiesApi, deleteTaxonomyApi, } from "../api/taxonomy";
13
13
  import { FaPlus } from "react-icons/fa";
14
14
  const TaxonomyForm = () => {
15
15
  const [type, setType] = useState("");
@@ -33,100 +33,6 @@ const TaxonomyForm = () => {
33
33
  }
34
34
  return true;
35
35
  };
36
- // const location = useLocation();
37
- // const navigate = useNavigate();
38
- // const { id } = location.state || {};
39
- // useEffect(() => {
40
- // if (id) {
41
- // const fetchTaxonomyData = async () => {
42
- // try {
43
- // const fetchedTaxonomy = await fetchTaxonomyByIdApi(id);
44
- // if (fetchedTaxonomy) {
45
- // const taxonomy = fetchedTaxonomy as {
46
- // type: string;
47
- // code: string | number;
48
- // value: string;
49
- // };
50
- // setIsEditMode(true);
51
- // setType(taxonomy.type);
52
- // setCode(taxonomy.code);
53
- // setValue(taxonomy.value);
54
- // }
55
- // } catch (error) {
56
- // console.error("Unable to fetch taxonomy data", error);
57
- // }
58
- // };
59
- // fetchTaxonomyData();
60
- // }
61
- // }, [id]);
62
- // useEffect(() => {
63
- // const handleFetchSimilarTaxonomies = async () => {
64
- // try {
65
- // const response = await fetchTaxonomiessApi();
66
- // // const filteredTaxonomies = response.filter(
67
- // const filteredTaxonomies = (response as { type: string }[]).filter(
68
- // (taxonomy: { type: string }) => taxonomy.type === type
69
- // );
70
- // setSimilarTaxonomies(filteredTaxonomies);
71
- // } catch (error) {
72
- // console.error("Error fetching similar taxonomies", error);
73
- // }
74
- // };
75
- // if (type) {
76
- // handleFetchSimilarTaxonomies();
77
- // }
78
- // }, [type]);
79
- // useEffect(() => {
80
- // if (location.pathname === "/taxonomy/taxonomyform") {
81
- // setIsSimilarTaxonomyOpen(true);
82
- // }
83
- // }, [location.pathname]);
84
- // const handleSubmit = async (event: React.MouseEvent<HTMLButtonElement>) => {
85
- // event.preventDefault();
86
- // if (!validateForm()) return;
87
- // try {
88
- // if (isEditMode) {
89
- // await addMultipleTaxonomiesApi(tempTaxonomy);
90
- // setTempTaxonomy([]);
91
- // alert("taxonomies added successfully");
92
- // } else {
93
- // await addTaxonomyApi(type, Number(code), value);
94
- // alert("Taxonomy added successfully");
95
- // }
96
- // navigate("/admin/taxonomy");
97
- // } catch (error) {
98
- // console.error("Error adding/updating Taxonomy:", error);
99
- // alert("Failed to add/update Taxonomy");
100
- // }
101
- // };
102
- // const handleSave = async (event: React.MouseEvent<HTMLButtonElement>) => {
103
- // event.preventDefault();
104
- // if (!validateForm()) return;
105
- // try {
106
- // if (isEditMode) {
107
- // await updateTaxonomyApi(id, type, Number(code), value);
108
- // alert("Taxonomy updated successfully");
109
- // } else {
110
- // await addTaxonomyApi(type, Number(code), value);
111
- // alert("Taxonomy added successfully");
112
- // }
113
- // navigate("/admin/taxonomy");
114
- // } catch (error) {
115
- // console.error("Error adding/updating Taxonomy:", error);
116
- // alert("Failed to add/update Taxonomy");
117
- // }
118
- // };
119
- // useEffect(() => {
120
- // const fetchIsMultiple = async () => {
121
- // try {
122
- // const result = await isMultipleApi(type);
123
- // setIsMultiple(typeof result === "boolean");
124
- // } catch (error) {
125
- // console.error("Error checking if taxonomy is multiple:", error);
126
- // }
127
- // };
128
- // fetchIsMultiple();
129
- // }, [location.pathname, type]);
130
36
  const queryParams = new URLSearchParams(window.location.search);
131
37
  const id = queryParams.get("id");
132
38
  // Fetch taxonomy data if id exists
@@ -213,19 +119,17 @@ const TaxonomyForm = () => {
213
119
  alert("Failed to add/update Taxonomy");
214
120
  }
215
121
  });
216
- // Fetch "isMultiple" property based on the taxonomy type
217
- useEffect(() => {
218
- const fetchIsMultiple = () => __awaiter(void 0, void 0, void 0, function* () {
219
- try {
220
- const result = yield isMultipleApi(type);
221
- setIsMultiple(typeof result === "boolean");
222
- }
223
- catch (error) {
224
- console.error("Error checking if taxonomy is multiple:", error);
225
- }
226
- });
227
- fetchIsMultiple();
228
- }, [type]);
122
+ // useEffect(() => {
123
+ // const fetchIsMultiple = async () => {
124
+ // try {
125
+ // const result = await isMultipleApi(type);
126
+ // setIsMultiple(typeof result === "boolean");
127
+ // } catch (error) {
128
+ // console.error("Error checking if taxonomy is multiple:", error);
129
+ // }
130
+ // };
131
+ // fetchIsMultiple();
132
+ // }, [type]);
229
133
  const handleCancelClick = () => {
230
134
  setType("");
231
135
  setCode("");
@@ -25,9 +25,6 @@ const UserForm = () => {
25
25
  }
26
26
  return true;
27
27
  };
28
- // const location = useLocation();
29
- // // const navigate = useNavigate();
30
- // const { id } = location.state || {};
31
28
  const queryParams = new URLSearchParams(window.location.search);
32
29
  const id = queryParams.get("id");
33
30
  useEffect(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eleven-solutions-common-website-unique-web",
3
- "version": "2.0.15",
3
+ "version": "2.0.18",
4
4
  "main": "./dist/index.js",
5
5
  "scripts": {
6
6
  "build": "tsc",
@@ -54,112 +54,6 @@ const TaxonomyForm = () => {
54
54
  return true;
55
55
  };
56
56
 
57
- // const location = useLocation();
58
- // const navigate = useNavigate();
59
-
60
- // const { id } = location.state || {};
61
-
62
- // useEffect(() => {
63
- // if (id) {
64
- // const fetchTaxonomyData = async () => {
65
- // try {
66
- // const fetchedTaxonomy = await fetchTaxonomyByIdApi(id);
67
- // if (fetchedTaxonomy) {
68
- // const taxonomy = fetchedTaxonomy as {
69
- // type: string;
70
- // code: string | number;
71
- // value: string;
72
- // };
73
- // setIsEditMode(true);
74
- // setType(taxonomy.type);
75
- // setCode(taxonomy.code);
76
- // setValue(taxonomy.value);
77
- // }
78
- // } catch (error) {
79
- // console.error("Unable to fetch taxonomy data", error);
80
- // }
81
- // };
82
- // fetchTaxonomyData();
83
- // }
84
- // }, [id]);
85
-
86
- // useEffect(() => {
87
- // const handleFetchSimilarTaxonomies = async () => {
88
- // try {
89
- // const response = await fetchTaxonomiessApi();
90
- // // const filteredTaxonomies = response.filter(
91
- // const filteredTaxonomies = (response as { type: string }[]).filter(
92
- // (taxonomy: { type: string }) => taxonomy.type === type
93
- // );
94
- // setSimilarTaxonomies(filteredTaxonomies);
95
- // } catch (error) {
96
- // console.error("Error fetching similar taxonomies", error);
97
- // }
98
- // };
99
-
100
- // if (type) {
101
- // handleFetchSimilarTaxonomies();
102
- // }
103
- // }, [type]);
104
-
105
- // useEffect(() => {
106
- // if (location.pathname === "/taxonomy/taxonomyform") {
107
- // setIsSimilarTaxonomyOpen(true);
108
- // }
109
- // }, [location.pathname]);
110
-
111
- // const handleSubmit = async (event: React.MouseEvent<HTMLButtonElement>) => {
112
- // event.preventDefault();
113
- // if (!validateForm()) return;
114
-
115
- // try {
116
- // if (isEditMode) {
117
- // await addMultipleTaxonomiesApi(tempTaxonomy);
118
- // setTempTaxonomy([]);
119
- // alert("taxonomies added successfully");
120
- // } else {
121
- // await addTaxonomyApi(type, Number(code), value);
122
- // alert("Taxonomy added successfully");
123
- // }
124
- // navigate("/admin/taxonomy");
125
- // } catch (error) {
126
- // console.error("Error adding/updating Taxonomy:", error);
127
- // alert("Failed to add/update Taxonomy");
128
- // }
129
- // };
130
-
131
- // const handleSave = async (event: React.MouseEvent<HTMLButtonElement>) => {
132
- // event.preventDefault();
133
- // if (!validateForm()) return;
134
-
135
- // try {
136
- // if (isEditMode) {
137
- // await updateTaxonomyApi(id, type, Number(code), value);
138
- // alert("Taxonomy updated successfully");
139
- // } else {
140
- // await addTaxonomyApi(type, Number(code), value);
141
- // alert("Taxonomy added successfully");
142
- // }
143
- // navigate("/admin/taxonomy");
144
- // } catch (error) {
145
- // console.error("Error adding/updating Taxonomy:", error);
146
- // alert("Failed to add/update Taxonomy");
147
- // }
148
- // };
149
-
150
- // useEffect(() => {
151
- // const fetchIsMultiple = async () => {
152
- // try {
153
- // const result = await isMultipleApi(type);
154
- // setIsMultiple(typeof result === "boolean");
155
- // } catch (error) {
156
- // console.error("Error checking if taxonomy is multiple:", error);
157
- // }
158
- // };
159
-
160
- // fetchIsMultiple();
161
- // }, [location.pathname, type]);
162
-
163
57
  const queryParams = new URLSearchParams(window.location.search);
164
58
  const id = queryParams.get("id");
165
59
 
@@ -253,19 +147,18 @@ const TaxonomyForm = () => {
253
147
  }
254
148
  };
255
149
 
256
- // Fetch "isMultiple" property based on the taxonomy type
257
- useEffect(() => {
258
- const fetchIsMultiple = async () => {
259
- try {
260
- const result = await isMultipleApi(type);
261
- setIsMultiple(typeof result === "boolean");
262
- } catch (error) {
263
- console.error("Error checking if taxonomy is multiple:", error);
264
- }
265
- };
150
+ // useEffect(() => {
151
+ // const fetchIsMultiple = async () => {
152
+ // try {
153
+ // const result = await isMultipleApi(type);
154
+ // setIsMultiple(typeof result === "boolean");
155
+ // } catch (error) {
156
+ // console.error("Error checking if taxonomy is multiple:", error);
157
+ // }
158
+ // };
266
159
 
267
- fetchIsMultiple();
268
- }, [type]);
160
+ // fetchIsMultiple();
161
+ // }, [type]);
269
162
 
270
163
  const handleCancelClick = () => {
271
164
  setType("");
@@ -23,11 +23,6 @@ const UserForm = () => {
23
23
  return true;
24
24
  };
25
25
 
26
- // const location = useLocation();
27
- // // const navigate = useNavigate();
28
-
29
- // const { id } = location.state || {};
30
-
31
26
  const queryParams = new URLSearchParams(window.location.search);
32
27
  const id = queryParams.get("id");
33
28