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