sales-frontend-components 0.0.148 → 0.0.150
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.
- package/dist/index.cjs.js +14 -11
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +14 -11
- package/dist/index.esm.js.map +1 -1
- package/package.json +8 -8
package/dist/index.esm.js
CHANGED
|
@@ -1023,17 +1023,13 @@ const useCustomerSearch = (onSelect) => {
|
|
|
1023
1023
|
}
|
|
1024
1024
|
};
|
|
1025
1025
|
const onKeyUp = (e) => {
|
|
1026
|
-
|
|
1026
|
+
const currentValue = e.target.value;
|
|
1027
|
+
if (currentValue.length === 0 || currentValue.slice(-1).normalize("NFD").length > 1 && currentValue.length > 1) {
|
|
1027
1028
|
search();
|
|
1028
1029
|
}
|
|
1029
1030
|
};
|
|
1030
1031
|
const onSearchInputChange = (e) => {
|
|
1031
1032
|
setSearchInput(e.target.value);
|
|
1032
|
-
if (e.target.value.length < 2) {
|
|
1033
|
-
setCustomerList([]);
|
|
1034
|
-
setSearchKeyword("");
|
|
1035
|
-
setIsOpen(false);
|
|
1036
|
-
}
|
|
1037
1033
|
};
|
|
1038
1034
|
const onClear = () => {
|
|
1039
1035
|
setSearchInput("");
|
|
@@ -4425,12 +4421,19 @@ const useDownloader = () => {
|
|
|
4425
4421
|
const [isLoading, setIsLoading] = useState(false);
|
|
4426
4422
|
const downloadFile = async (url, fileName) => {
|
|
4427
4423
|
try {
|
|
4428
|
-
|
|
4429
|
-
if (
|
|
4430
|
-
|
|
4424
|
+
let downloadUrl = "";
|
|
4425
|
+
if (url.startsWith("http")) {
|
|
4426
|
+
const response = await fetch(url);
|
|
4427
|
+
if (!response.ok) {
|
|
4428
|
+
throw new Error(`Failed to download ${url}`);
|
|
4429
|
+
}
|
|
4430
|
+
const blob = await response.blob();
|
|
4431
|
+
downloadUrl = window.URL.createObjectURL(blob);
|
|
4432
|
+
} else if (url.startsWith("blob")) {
|
|
4433
|
+
downloadUrl = url;
|
|
4434
|
+
} else {
|
|
4435
|
+
throw new Error(`unknown type : ${url}`);
|
|
4431
4436
|
}
|
|
4432
|
-
const blob = await response.blob();
|
|
4433
|
-
const downloadUrl = window.URL.createObjectURL(blob);
|
|
4434
4437
|
const a = document.createElement("a");
|
|
4435
4438
|
a.href = downloadUrl;
|
|
4436
4439
|
a.download = fileName || url.split("/").pop() || "download";
|