@ezeep/ezeep-js 1.0.241 → 1.0.243
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/cjs/ezp-auth_15.cjs.entry.js +92 -7
- package/dist/collection/components/ezp-printer-selection/ezp-printer-selection.js +92 -7
- package/dist/custom-elements/index.js +92 -7
- package/dist/esm/ezp-auth_15.entry.js +92 -7
- package/dist/esm-es5/ezp-auth_15.entry.js +1 -1
- package/dist/ezeep/ezeep.esm.js +1 -1
- package/dist/ezeep/{p-cf66aca1.entry.js → p-69f14876.entry.js} +1 -1
- package/dist/ezeep/p-84bd195a.system.js +1 -1
- package/dist/ezeep/{p-816cb3ae.system.entry.js → p-8a941755.system.entry.js} +1 -1
- package/dist/types/components/ezp-printer-selection/ezp-printer-selection.d.ts +1 -0
- package/package.json +1 -1
- package/www/build/ezeep.esm.js +1 -1
- package/www/build/{p-cf66aca1.entry.js → p-69f14876.entry.js} +1 -1
- package/www/build/p-84bd195a.system.js +1 -1
- package/www/build/{p-816cb3ae.system.entry.js → p-8a941755.system.entry.js} +1 -1
|
@@ -32865,15 +32865,51 @@ let EzpPrinterSelection = class {
|
|
|
32865
32865
|
this.printCancel.emit();
|
|
32866
32866
|
};
|
|
32867
32867
|
this.validateData = (data) => {
|
|
32868
|
-
|
|
32869
|
-
|
|
32868
|
+
console.log('[validateData] Checking data:', data);
|
|
32869
|
+
const { jobstatus } = data;
|
|
32870
|
+
// Define status handlers
|
|
32871
|
+
const statusHandlers = {
|
|
32872
|
+
0: () => {
|
|
32873
|
+
// Success
|
|
32874
|
+
this.printSuccess = true;
|
|
32875
|
+
this.printProcessing = false;
|
|
32876
|
+
return true;
|
|
32877
|
+
},
|
|
32878
|
+
1246: () => false,
|
|
32879
|
+
129: () => false,
|
|
32880
|
+
3011: () => {
|
|
32881
|
+
// Failure
|
|
32882
|
+
this.printFailed = true;
|
|
32883
|
+
this.printProcessing = false;
|
|
32884
|
+
return true;
|
|
32885
|
+
},
|
|
32886
|
+
2: () => {
|
|
32887
|
+
// Failure
|
|
32888
|
+
this.printFailed = true;
|
|
32889
|
+
this.printProcessing = false;
|
|
32890
|
+
return true;
|
|
32891
|
+
},
|
|
32892
|
+
};
|
|
32893
|
+
// Check for hub printer driver errors
|
|
32894
|
+
const hubDriverErrorCodes = [412, 500, 503, 1048579];
|
|
32895
|
+
if (hubDriverErrorCodes.includes(jobstatus) && this.selectedPrinter.is_queue) {
|
|
32896
|
+
this.hubDriverError = true;
|
|
32870
32897
|
this.printProcessing = false;
|
|
32871
32898
|
return true;
|
|
32872
32899
|
}
|
|
32873
|
-
|
|
32900
|
+
// Use handler if exists, otherwise treat as failure
|
|
32901
|
+
const handler = statusHandlers[jobstatus];
|
|
32902
|
+
if (handler) {
|
|
32903
|
+
return handler();
|
|
32904
|
+
}
|
|
32905
|
+
// Unknown status, treat as failure for safety
|
|
32906
|
+
this.printFailed = true;
|
|
32907
|
+
this.printProcessing = false;
|
|
32908
|
+
return true;
|
|
32874
32909
|
};
|
|
32875
32910
|
this.POLL_INTERVAL = 2000;
|
|
32876
32911
|
this.MAX_POLL_ATTEMPTS = Infinity;
|
|
32912
|
+
this.HUB_TIMEOUT = 30000; // 30 seconds timeout for hub printers
|
|
32877
32913
|
/** Description... */
|
|
32878
32914
|
this.handlePrint = async () => {
|
|
32879
32915
|
this.printButton.blur();
|
|
@@ -32882,6 +32918,15 @@ let EzpPrinterSelection = class {
|
|
|
32882
32918
|
this.successfulFiles = [];
|
|
32883
32919
|
this.partialSuccess = false;
|
|
32884
32920
|
this.hubDriverError = false;
|
|
32921
|
+
// Set up timeout for hub printers to prevent infinite loading
|
|
32922
|
+
let hubTimeout;
|
|
32923
|
+
if (this.selectedPrinter.is_queue) {
|
|
32924
|
+
hubTimeout = setTimeout(() => {
|
|
32925
|
+
console.log('[handlePrint] Hub printer timeout reached, setting driver error');
|
|
32926
|
+
this.hubDriverError = true;
|
|
32927
|
+
this.printProcessing = false;
|
|
32928
|
+
}, this.HUB_TIMEOUT);
|
|
32929
|
+
}
|
|
32885
32930
|
// we have to initialse this obj with empty strings to display the select component
|
|
32886
32931
|
// but don't want to send any attributes with empty strings to the API
|
|
32887
32932
|
if (this.selectedPrinterConfig.Trays &&
|
|
@@ -32908,6 +32953,8 @@ let EzpPrinterSelection = class {
|
|
|
32908
32953
|
if (response.status === 200 && this.selectedPrinter.is_queue) {
|
|
32909
32954
|
this.printProcessing = false;
|
|
32910
32955
|
this.printSuccess = true;
|
|
32956
|
+
if (hubTimeout)
|
|
32957
|
+
clearTimeout(hubTimeout);
|
|
32911
32958
|
}
|
|
32912
32959
|
if (response.status === 412) {
|
|
32913
32960
|
response.json().then((data) => (this.fileid = data.fileid));
|
|
@@ -32921,12 +32968,17 @@ let EzpPrinterSelection = class {
|
|
|
32921
32968
|
if (data.code === 804) {
|
|
32922
32969
|
this.printFailed = true;
|
|
32923
32970
|
this.printProcessing = false;
|
|
32971
|
+
if (hubTimeout)
|
|
32972
|
+
clearTimeout(hubTimeout);
|
|
32924
32973
|
}
|
|
32925
32974
|
else if (this.selectedPrinter.is_queue &&
|
|
32926
|
-
(data.code === 412 || data.code === 500 || data.code === 503)) {
|
|
32975
|
+
(data.code === 412 || data.code === 500 || data.code === 503 || data.code === 1048579)) {
|
|
32927
32976
|
// Hub printer specific errors - likely driver not assigned
|
|
32977
|
+
console.log('[handlePrint] Hub printer driver error detected:', data);
|
|
32928
32978
|
this.hubDriverError = true;
|
|
32929
32979
|
this.printProcessing = false;
|
|
32980
|
+
if (hubTimeout)
|
|
32981
|
+
clearTimeout(hubTimeout);
|
|
32930
32982
|
}
|
|
32931
32983
|
else if (data.jobid) {
|
|
32932
32984
|
printStore.state.jobID = data.jobid;
|
|
@@ -32936,7 +32988,7 @@ let EzpPrinterSelection = class {
|
|
|
32936
32988
|
interval: this.POLL_INTERVAL,
|
|
32937
32989
|
maxAttempts: this.MAX_POLL_ATTEMPTS,
|
|
32938
32990
|
}).catch((err) => {
|
|
32939
|
-
console.warn(err);
|
|
32991
|
+
console.warn('[handlePrint] Polling error:', err);
|
|
32940
32992
|
// Check if this is a hub printer and the error might be driver-related
|
|
32941
32993
|
if (this.selectedPrinter.is_queue) {
|
|
32942
32994
|
this.hubDriverError = true;
|
|
@@ -32945,6 +32997,8 @@ let EzpPrinterSelection = class {
|
|
|
32945
32997
|
this.printFailed = true;
|
|
32946
32998
|
}
|
|
32947
32999
|
this.printProcessing = false;
|
|
33000
|
+
if (hubTimeout)
|
|
33001
|
+
clearTimeout(hubTimeout);
|
|
32948
33002
|
});
|
|
32949
33003
|
}
|
|
32950
33004
|
else {
|
|
@@ -32956,10 +33010,12 @@ let EzpPrinterSelection = class {
|
|
|
32956
33010
|
this.printFailed = true;
|
|
32957
33011
|
}
|
|
32958
33012
|
this.printProcessing = false;
|
|
33013
|
+
if (hubTimeout)
|
|
33014
|
+
clearTimeout(hubTimeout);
|
|
32959
33015
|
}
|
|
32960
33016
|
})
|
|
32961
33017
|
.catch((error) => {
|
|
32962
|
-
console.log(error);
|
|
33018
|
+
console.log('[handlePrint] Error caught:', error);
|
|
32963
33019
|
// Check if this is a hub printer and the error might be driver-related
|
|
32964
33020
|
if (this.selectedPrinter.is_queue) {
|
|
32965
33021
|
this.hubDriverError = true;
|
|
@@ -32968,13 +33024,42 @@ let EzpPrinterSelection = class {
|
|
|
32968
33024
|
this.printFailed = true;
|
|
32969
33025
|
}
|
|
32970
33026
|
this.printProcessing = false;
|
|
33027
|
+
if (hubTimeout)
|
|
33028
|
+
clearTimeout(hubTimeout);
|
|
32971
33029
|
});
|
|
32972
33030
|
}
|
|
32973
33031
|
else if (this.files && this.files.length > 1) {
|
|
32974
33032
|
await this.processMultipleFiles(this.files, cleanPrintProperties);
|
|
33033
|
+
if (hubTimeout)
|
|
33034
|
+
clearTimeout(hubTimeout);
|
|
32975
33035
|
}
|
|
32976
33036
|
else if (this.files && this.files.length === 1) {
|
|
32977
|
-
|
|
33037
|
+
// --- Begin: Consistent single file handling ---
|
|
33038
|
+
this.totalFiles = 1;
|
|
33039
|
+
this.currentFileIndex = 0;
|
|
33040
|
+
this.failedFiles = [];
|
|
33041
|
+
this.successfulFiles = [];
|
|
33042
|
+
try {
|
|
33043
|
+
await this.processSingleFile(this.files[0], cleanPrintProperties);
|
|
33044
|
+
this.successfulFiles.push(this.files[0].name);
|
|
33045
|
+
this.printSuccess = true;
|
|
33046
|
+
this.partialSuccess = false;
|
|
33047
|
+
this.printProcessing = false;
|
|
33048
|
+
}
|
|
33049
|
+
catch (error) {
|
|
33050
|
+
console.error(`Error processing file ${this.files[0].name}:`, error);
|
|
33051
|
+
this.failedFiles.push(this.files[0].name);
|
|
33052
|
+
this.printFailed = true;
|
|
33053
|
+
this.partialSuccess = false;
|
|
33054
|
+
this.printProcessing = false;
|
|
33055
|
+
// Check if this is a hub driver error
|
|
33056
|
+
if (error.message && error.message.includes('Hub printer driver error')) {
|
|
33057
|
+
this.hubDriverError = true;
|
|
33058
|
+
}
|
|
33059
|
+
}
|
|
33060
|
+
if (hubTimeout)
|
|
33061
|
+
clearTimeout(hubTimeout);
|
|
33062
|
+
// --- End: Consistent single file handling ---
|
|
32978
33063
|
}
|
|
32979
33064
|
localStorage.setItem('properties', JSON.stringify(this.selectedProperties));
|
|
32980
33065
|
localStorage.setItem('printer', JSON.stringify(this.selectedPrinter));
|