eleven-solutions-common-website-unique-web 21.0.42 → 21.0.44
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.
| @@ -63,7 +63,6 @@ const TaxonomyForm = ({ url }) => { | |
| 63 63 | 
             
                    }
         | 
| 64 64 | 
             
                });
         | 
| 65 65 | 
             
                const [editTaxonomyItem, setEditTaxonomyItem] = useState(null);
         | 
| 66 | 
            -
                const [editTempTaxonomyItem, setEditTempTaxonomyItem] = useState(null);
         | 
| 67 66 | 
             
                const [selectedTaxonomyId, setSelectedTaxonomyId] = useState("");
         | 
| 68 67 | 
             
                const queryParams = new URLSearchParams(window.location.search);
         | 
| 69 68 | 
             
                const id = queryParams.get("id");
         | 
| @@ -117,7 +116,7 @@ const TaxonomyForm = ({ url }) => { | |
| 117 116 | 
             
                };
         | 
| 118 117 | 
             
                const handleOpenModal = () => {
         | 
| 119 118 | 
             
                    setEditTaxonomyItem(null);
         | 
| 120 | 
            -
                    setEditTempTaxonomyItem(null);
         | 
| 119 | 
            +
                    // setEditTempTaxonomyItem(null);
         | 
| 121 120 | 
             
                    setIsModalOpen(true);
         | 
| 122 121 | 
             
                    setIsAddingSubType(false);
         | 
| 123 122 | 
             
                };
         | 
| @@ -174,6 +173,9 @@ const TaxonomyForm = ({ url }) => { | |
| 174 173 | 
             
                        console.error(`Error ${editTaxonomyItem ? "editing" : "adding"} SubType:`, error);
         | 
| 175 174 | 
             
                        const errorMessage = ((_a = error.response) === null || _a === void 0 ? void 0 : _a.data) || ((_b = error.response) === null || _b === void 0 ? void 0 : _b.statusText) || error.message;
         | 
| 176 175 | 
             
                        alert(`Error while ${editTaxonomyItem ? "editing" : "adding"} SubType: ${errorMessage}`);
         | 
| 176 | 
            +
                        setIsModalOpen(false);
         | 
| 177 | 
            +
                        setNewCode("");
         | 
| 178 | 
            +
                        setNewValue("");
         | 
| 177 179 | 
             
                    }
         | 
| 178 180 | 
             
                    setIsModalOpen(false);
         | 
| 179 181 | 
             
                    setSubCode("");
         | 
| @@ -194,7 +196,7 @@ const TaxonomyForm = ({ url }) => { | |
| 194 196 | 
             
                        return;
         | 
| 195 197 | 
             
                    }
         | 
| 196 198 | 
             
                    try {
         | 
| 197 | 
            -
                        if (editTaxonomyItem | 
| 199 | 
            +
                        if (editTaxonomyItem) {
         | 
| 198 200 | 
             
                            yield updateTaxonomyApi(url, selectedTaxonomyId, type, Number(newCode), newValue);
         | 
| 199 201 | 
             
                            alert("Taxonomy updated successfully");
         | 
| 200 202 | 
             
                        }
         | 
| @@ -207,11 +209,12 @@ const TaxonomyForm = ({ url }) => { | |
| 207 209 | 
             
                        setSimilarTaxonomies(filteredTaxonomies);
         | 
| 208 210 | 
             
                    }
         | 
| 209 211 | 
             
                    catch (error) {
         | 
| 210 | 
            -
                        console.error(editTaxonomyItem  | 
| 211 | 
            -
                            ? "Error updating Taxonomy:"
         | 
| 212 | 
            -
                            : "Error adding value:", error);
         | 
| 212 | 
            +
                        console.error(editTaxonomyItem ? "Error updating Taxonomy:" : "Error adding value:", error);
         | 
| 213 213 | 
             
                        const errorMessage = ((_a = error.response) === null || _a === void 0 ? void 0 : _a.data) || ((_b = error.response) === null || _b === void 0 ? void 0 : _b.statusText) || error.message;
         | 
| 214 214 | 
             
                        alert(`Error while ${editTaxonomyItem ? "editing" : "adding"} SubType: ${errorMessage}`);
         | 
| 215 | 
            +
                        setIsModalOpen(false);
         | 
| 216 | 
            +
                        setNewCode("");
         | 
| 217 | 
            +
                        setNewValue("");
         | 
| 215 218 | 
             
                    }
         | 
| 216 219 | 
             
                    setIsModalOpen(false);
         | 
| 217 220 | 
             
                    setNewCode("");
         | 
| @@ -240,6 +243,6 @@ const TaxonomyForm = ({ url }) => { | |
| 240 243 | 
             
                                                        : "Add SubType"
         | 
| 241 244 | 
             
                                                    : editTaxonomyItem
         | 
| 242 245 | 
             
                                                        ? "Edit Values"
         | 
| 243 | 
            -
                                                        : "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  | 
| 246 | 
            +
                                                        : "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 ? "Edit" : "Add" }), _jsx("button", { onClick: handleCloseModal, className: "px-8 py-2.5 leading-5 bg-gray-300 rounded-md", children: "Cancel" })] })] }))] }) })] }));
         | 
| 244 247 | 
             
            };
         | 
| 245 248 | 
             
            export default TaxonomyForm;
         | 
    
        package/package.json
    CHANGED
    
    
| @@ -84,13 +84,6 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => { | |
| 84 84 | 
             
                value: string;
         | 
| 85 85 | 
             
              } | null>(null);
         | 
| 86 86 |  | 
| 87 | 
            -
              const [editTempTaxonomyItem, setEditTempTaxonomyItem] = useState<{
         | 
| 88 | 
            -
                id: string;
         | 
| 89 | 
            -
                type: string;
         | 
| 90 | 
            -
                code: string | number;
         | 
| 91 | 
            -
                value: string;
         | 
| 92 | 
            -
              } | null>(null);
         | 
| 93 | 
            -
             | 
| 94 87 | 
             
              const [selectedTaxonomyId, setSelectedTaxonomyId] = useState<string>("");
         | 
| 95 88 |  | 
| 96 89 | 
             
              const queryParams = new URLSearchParams(window.location.search);
         | 
| @@ -155,7 +148,7 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => { | |
| 155 148 |  | 
| 156 149 | 
             
              const handleOpenModal = () => {
         | 
| 157 150 | 
             
                setEditTaxonomyItem(null);
         | 
| 158 | 
            -
                setEditTempTaxonomyItem(null);
         | 
| 151 | 
            +
                // setEditTempTaxonomyItem(null);
         | 
| 159 152 | 
             
                setIsModalOpen(true);
         | 
| 160 153 |  | 
| 161 154 | 
             
                setIsAddingSubType(false);
         | 
| @@ -242,6 +235,9 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => { | |
| 242 235 | 
             
                      editTaxonomyItem ? "editing" : "adding"
         | 
| 243 236 | 
             
                    } SubType: ${errorMessage}`
         | 
| 244 237 | 
             
                  );
         | 
| 238 | 
            +
                  setIsModalOpen(false);
         | 
| 239 | 
            +
                  setNewCode("");
         | 
| 240 | 
            +
                  setNewValue("");
         | 
| 245 241 | 
             
                }
         | 
| 246 242 |  | 
| 247 243 | 
             
                setIsModalOpen(false);
         | 
| @@ -270,7 +266,7 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => { | |
| 270 266 | 
             
                }
         | 
| 271 267 |  | 
| 272 268 | 
             
                try {
         | 
| 273 | 
            -
                  if (editTaxonomyItem | 
| 269 | 
            +
                  if (editTaxonomyItem) {
         | 
| 274 270 | 
             
                    await updateTaxonomyApi(
         | 
| 275 271 | 
             
                      url,
         | 
| 276 272 | 
             
                      selectedTaxonomyId,
         | 
| @@ -291,9 +287,7 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => { | |
| 291 287 | 
             
                  setSimilarTaxonomies(filteredTaxonomies);
         | 
| 292 288 | 
             
                } catch (error) {
         | 
| 293 289 | 
             
                  console.error(
         | 
| 294 | 
            -
                    editTaxonomyItem  | 
| 295 | 
            -
                      ? "Error updating Taxonomy:"
         | 
| 296 | 
            -
                      : "Error adding value:",
         | 
| 290 | 
            +
                    editTaxonomyItem ? "Error updating Taxonomy:" : "Error adding value:",
         | 
| 297 291 | 
             
                    error
         | 
| 298 292 | 
             
                  );
         | 
| 299 293 | 
             
                  const errorMessage =
         | 
| @@ -304,6 +298,9 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => { | |
| 304 298 | 
             
                      editTaxonomyItem ? "editing" : "adding"
         | 
| 305 299 | 
             
                    } SubType: ${errorMessage}`
         | 
| 306 300 | 
             
                  );
         | 
| 301 | 
            +
                  setIsModalOpen(false);
         | 
| 302 | 
            +
                  setNewCode("");
         | 
| 303 | 
            +
                  setNewValue("");
         | 
| 307 304 | 
             
                }
         | 
| 308 305 |  | 
| 309 306 | 
             
                setIsModalOpen(false);
         | 
| @@ -729,7 +726,7 @@ const TaxonomyForm = ({ url }: TaxionomyFormProps) => { | |
| 729 726 | 
             
                              onClick={handleSubmitClick}
         | 
| 730 727 | 
             
                              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"
         | 
| 731 728 | 
             
                            >
         | 
| 732 | 
            -
                              {editTaxonomyItem  | 
| 729 | 
            +
                              {editTaxonomyItem ? "Edit" : "Add"}
         | 
| 733 730 | 
             
                            </button>
         | 
| 734 731 | 
             
                            <button
         | 
| 735 732 | 
             
                              onClick={handleCloseModal}
         |