@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
|
@@ -32869,15 +32869,51 @@ let EzpPrinterSelection = class {
|
|
|
32869
32869
|
this.printCancel.emit();
|
|
32870
32870
|
};
|
|
32871
32871
|
this.validateData = (data) => {
|
|
32872
|
-
|
|
32873
|
-
|
|
32872
|
+
console.log('[validateData] Checking data:', data);
|
|
32873
|
+
const { jobstatus } = data;
|
|
32874
|
+
// Define status handlers
|
|
32875
|
+
const statusHandlers = {
|
|
32876
|
+
0: () => {
|
|
32877
|
+
// Success
|
|
32878
|
+
this.printSuccess = true;
|
|
32879
|
+
this.printProcessing = false;
|
|
32880
|
+
return true;
|
|
32881
|
+
},
|
|
32882
|
+
1246: () => false,
|
|
32883
|
+
129: () => false,
|
|
32884
|
+
3011: () => {
|
|
32885
|
+
// Failure
|
|
32886
|
+
this.printFailed = true;
|
|
32887
|
+
this.printProcessing = false;
|
|
32888
|
+
return true;
|
|
32889
|
+
},
|
|
32890
|
+
2: () => {
|
|
32891
|
+
// Failure
|
|
32892
|
+
this.printFailed = true;
|
|
32893
|
+
this.printProcessing = false;
|
|
32894
|
+
return true;
|
|
32895
|
+
},
|
|
32896
|
+
};
|
|
32897
|
+
// Check for hub printer driver errors
|
|
32898
|
+
const hubDriverErrorCodes = [412, 500, 503, 1048579];
|
|
32899
|
+
if (hubDriverErrorCodes.includes(jobstatus) && this.selectedPrinter.is_queue) {
|
|
32900
|
+
this.hubDriverError = true;
|
|
32874
32901
|
this.printProcessing = false;
|
|
32875
32902
|
return true;
|
|
32876
32903
|
}
|
|
32877
|
-
|
|
32904
|
+
// Use handler if exists, otherwise treat as failure
|
|
32905
|
+
const handler = statusHandlers[jobstatus];
|
|
32906
|
+
if (handler) {
|
|
32907
|
+
return handler();
|
|
32908
|
+
}
|
|
32909
|
+
// Unknown status, treat as failure for safety
|
|
32910
|
+
this.printFailed = true;
|
|
32911
|
+
this.printProcessing = false;
|
|
32912
|
+
return true;
|
|
32878
32913
|
};
|
|
32879
32914
|
this.POLL_INTERVAL = 2000;
|
|
32880
32915
|
this.MAX_POLL_ATTEMPTS = Infinity;
|
|
32916
|
+
this.HUB_TIMEOUT = 30000; // 30 seconds timeout for hub printers
|
|
32881
32917
|
/** Description... */
|
|
32882
32918
|
this.handlePrint = async () => {
|
|
32883
32919
|
this.printButton.blur();
|
|
@@ -32886,6 +32922,15 @@ let EzpPrinterSelection = class {
|
|
|
32886
32922
|
this.successfulFiles = [];
|
|
32887
32923
|
this.partialSuccess = false;
|
|
32888
32924
|
this.hubDriverError = false;
|
|
32925
|
+
// Set up timeout for hub printers to prevent infinite loading
|
|
32926
|
+
let hubTimeout;
|
|
32927
|
+
if (this.selectedPrinter.is_queue) {
|
|
32928
|
+
hubTimeout = setTimeout(() => {
|
|
32929
|
+
console.log('[handlePrint] Hub printer timeout reached, setting driver error');
|
|
32930
|
+
this.hubDriverError = true;
|
|
32931
|
+
this.printProcessing = false;
|
|
32932
|
+
}, this.HUB_TIMEOUT);
|
|
32933
|
+
}
|
|
32889
32934
|
// we have to initialse this obj with empty strings to display the select component
|
|
32890
32935
|
// but don't want to send any attributes with empty strings to the API
|
|
32891
32936
|
if (this.selectedPrinterConfig.Trays &&
|
|
@@ -32912,6 +32957,8 @@ let EzpPrinterSelection = class {
|
|
|
32912
32957
|
if (response.status === 200 && this.selectedPrinter.is_queue) {
|
|
32913
32958
|
this.printProcessing = false;
|
|
32914
32959
|
this.printSuccess = true;
|
|
32960
|
+
if (hubTimeout)
|
|
32961
|
+
clearTimeout(hubTimeout);
|
|
32915
32962
|
}
|
|
32916
32963
|
if (response.status === 412) {
|
|
32917
32964
|
response.json().then((data) => (this.fileid = data.fileid));
|
|
@@ -32925,12 +32972,17 @@ let EzpPrinterSelection = class {
|
|
|
32925
32972
|
if (data.code === 804) {
|
|
32926
32973
|
this.printFailed = true;
|
|
32927
32974
|
this.printProcessing = false;
|
|
32975
|
+
if (hubTimeout)
|
|
32976
|
+
clearTimeout(hubTimeout);
|
|
32928
32977
|
}
|
|
32929
32978
|
else if (this.selectedPrinter.is_queue &&
|
|
32930
|
-
(data.code === 412 || data.code === 500 || data.code === 503)) {
|
|
32979
|
+
(data.code === 412 || data.code === 500 || data.code === 503 || data.code === 1048579)) {
|
|
32931
32980
|
// Hub printer specific errors - likely driver not assigned
|
|
32981
|
+
console.log('[handlePrint] Hub printer driver error detected:', data);
|
|
32932
32982
|
this.hubDriverError = true;
|
|
32933
32983
|
this.printProcessing = false;
|
|
32984
|
+
if (hubTimeout)
|
|
32985
|
+
clearTimeout(hubTimeout);
|
|
32934
32986
|
}
|
|
32935
32987
|
else if (data.jobid) {
|
|
32936
32988
|
printStore.state.jobID = data.jobid;
|
|
@@ -32940,7 +32992,7 @@ let EzpPrinterSelection = class {
|
|
|
32940
32992
|
interval: this.POLL_INTERVAL,
|
|
32941
32993
|
maxAttempts: this.MAX_POLL_ATTEMPTS,
|
|
32942
32994
|
}).catch((err) => {
|
|
32943
|
-
console.warn(err);
|
|
32995
|
+
console.warn('[handlePrint] Polling error:', err);
|
|
32944
32996
|
// Check if this is a hub printer and the error might be driver-related
|
|
32945
32997
|
if (this.selectedPrinter.is_queue) {
|
|
32946
32998
|
this.hubDriverError = true;
|
|
@@ -32949,6 +33001,8 @@ let EzpPrinterSelection = class {
|
|
|
32949
33001
|
this.printFailed = true;
|
|
32950
33002
|
}
|
|
32951
33003
|
this.printProcessing = false;
|
|
33004
|
+
if (hubTimeout)
|
|
33005
|
+
clearTimeout(hubTimeout);
|
|
32952
33006
|
});
|
|
32953
33007
|
}
|
|
32954
33008
|
else {
|
|
@@ -32960,10 +33014,12 @@ let EzpPrinterSelection = class {
|
|
|
32960
33014
|
this.printFailed = true;
|
|
32961
33015
|
}
|
|
32962
33016
|
this.printProcessing = false;
|
|
33017
|
+
if (hubTimeout)
|
|
33018
|
+
clearTimeout(hubTimeout);
|
|
32963
33019
|
}
|
|
32964
33020
|
})
|
|
32965
33021
|
.catch((error) => {
|
|
32966
|
-
console.log(error);
|
|
33022
|
+
console.log('[handlePrint] Error caught:', error);
|
|
32967
33023
|
// Check if this is a hub printer and the error might be driver-related
|
|
32968
33024
|
if (this.selectedPrinter.is_queue) {
|
|
32969
33025
|
this.hubDriverError = true;
|
|
@@ -32972,13 +33028,42 @@ let EzpPrinterSelection = class {
|
|
|
32972
33028
|
this.printFailed = true;
|
|
32973
33029
|
}
|
|
32974
33030
|
this.printProcessing = false;
|
|
33031
|
+
if (hubTimeout)
|
|
33032
|
+
clearTimeout(hubTimeout);
|
|
32975
33033
|
});
|
|
32976
33034
|
}
|
|
32977
33035
|
else if (this.files && this.files.length > 1) {
|
|
32978
33036
|
await this.processMultipleFiles(this.files, cleanPrintProperties);
|
|
33037
|
+
if (hubTimeout)
|
|
33038
|
+
clearTimeout(hubTimeout);
|
|
32979
33039
|
}
|
|
32980
33040
|
else if (this.files && this.files.length === 1) {
|
|
32981
|
-
|
|
33041
|
+
// --- Begin: Consistent single file handling ---
|
|
33042
|
+
this.totalFiles = 1;
|
|
33043
|
+
this.currentFileIndex = 0;
|
|
33044
|
+
this.failedFiles = [];
|
|
33045
|
+
this.successfulFiles = [];
|
|
33046
|
+
try {
|
|
33047
|
+
await this.processSingleFile(this.files[0], cleanPrintProperties);
|
|
33048
|
+
this.successfulFiles.push(this.files[0].name);
|
|
33049
|
+
this.printSuccess = true;
|
|
33050
|
+
this.partialSuccess = false;
|
|
33051
|
+
this.printProcessing = false;
|
|
33052
|
+
}
|
|
33053
|
+
catch (error) {
|
|
33054
|
+
console.error(`Error processing file ${this.files[0].name}:`, error);
|
|
33055
|
+
this.failedFiles.push(this.files[0].name);
|
|
33056
|
+
this.printFailed = true;
|
|
33057
|
+
this.partialSuccess = false;
|
|
33058
|
+
this.printProcessing = false;
|
|
33059
|
+
// Check if this is a hub driver error
|
|
33060
|
+
if (error.message && error.message.includes('Hub printer driver error')) {
|
|
33061
|
+
this.hubDriverError = true;
|
|
33062
|
+
}
|
|
33063
|
+
}
|
|
33064
|
+
if (hubTimeout)
|
|
33065
|
+
clearTimeout(hubTimeout);
|
|
33066
|
+
// --- End: Consistent single file handling ---
|
|
32982
33067
|
}
|
|
32983
33068
|
localStorage.setItem('properties', JSON.stringify(this.selectedProperties));
|
|
32984
33069
|
localStorage.setItem('printer', JSON.stringify(this.selectedPrinter));
|
|
@@ -102,15 +102,51 @@ export class EzpPrinterSelection {
|
|
|
102
102
|
this.printCancel.emit();
|
|
103
103
|
};
|
|
104
104
|
this.validateData = (data) => {
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
console.log('[validateData] Checking data:', data);
|
|
106
|
+
const { jobstatus } = data;
|
|
107
|
+
// Define status handlers
|
|
108
|
+
const statusHandlers = {
|
|
109
|
+
0: () => {
|
|
110
|
+
// Success
|
|
111
|
+
this.printSuccess = true;
|
|
112
|
+
this.printProcessing = false;
|
|
113
|
+
return true;
|
|
114
|
+
},
|
|
115
|
+
1246: () => false,
|
|
116
|
+
129: () => false,
|
|
117
|
+
3011: () => {
|
|
118
|
+
// Failure
|
|
119
|
+
this.printFailed = true;
|
|
120
|
+
this.printProcessing = false;
|
|
121
|
+
return true;
|
|
122
|
+
},
|
|
123
|
+
2: () => {
|
|
124
|
+
// Failure
|
|
125
|
+
this.printFailed = true;
|
|
126
|
+
this.printProcessing = false;
|
|
127
|
+
return true;
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
// Check for hub printer driver errors
|
|
131
|
+
const hubDriverErrorCodes = [412, 500, 503, 1048579];
|
|
132
|
+
if (hubDriverErrorCodes.includes(jobstatus) && this.selectedPrinter.is_queue) {
|
|
133
|
+
this.hubDriverError = true;
|
|
107
134
|
this.printProcessing = false;
|
|
108
135
|
return true;
|
|
109
136
|
}
|
|
110
|
-
|
|
137
|
+
// Use handler if exists, otherwise treat as failure
|
|
138
|
+
const handler = statusHandlers[jobstatus];
|
|
139
|
+
if (handler) {
|
|
140
|
+
return handler();
|
|
141
|
+
}
|
|
142
|
+
// Unknown status, treat as failure for safety
|
|
143
|
+
this.printFailed = true;
|
|
144
|
+
this.printProcessing = false;
|
|
145
|
+
return true;
|
|
111
146
|
};
|
|
112
147
|
this.POLL_INTERVAL = 2000;
|
|
113
148
|
this.MAX_POLL_ATTEMPTS = Infinity;
|
|
149
|
+
this.HUB_TIMEOUT = 30000; // 30 seconds timeout for hub printers
|
|
114
150
|
/** Description... */
|
|
115
151
|
this.handlePrint = async () => {
|
|
116
152
|
this.printButton.blur();
|
|
@@ -119,6 +155,15 @@ export class EzpPrinterSelection {
|
|
|
119
155
|
this.successfulFiles = [];
|
|
120
156
|
this.partialSuccess = false;
|
|
121
157
|
this.hubDriverError = false;
|
|
158
|
+
// Set up timeout for hub printers to prevent infinite loading
|
|
159
|
+
let hubTimeout;
|
|
160
|
+
if (this.selectedPrinter.is_queue) {
|
|
161
|
+
hubTimeout = setTimeout(() => {
|
|
162
|
+
console.log('[handlePrint] Hub printer timeout reached, setting driver error');
|
|
163
|
+
this.hubDriverError = true;
|
|
164
|
+
this.printProcessing = false;
|
|
165
|
+
}, this.HUB_TIMEOUT);
|
|
166
|
+
}
|
|
122
167
|
// we have to initialse this obj with empty strings to display the select component
|
|
123
168
|
// but don't want to send any attributes with empty strings to the API
|
|
124
169
|
if (this.selectedPrinterConfig.Trays &&
|
|
@@ -145,6 +190,8 @@ export class EzpPrinterSelection {
|
|
|
145
190
|
if (response.status === 200 && this.selectedPrinter.is_queue) {
|
|
146
191
|
this.printProcessing = false;
|
|
147
192
|
this.printSuccess = true;
|
|
193
|
+
if (hubTimeout)
|
|
194
|
+
clearTimeout(hubTimeout);
|
|
148
195
|
}
|
|
149
196
|
if (response.status === 412) {
|
|
150
197
|
response.json().then((data) => (this.fileid = data.fileid));
|
|
@@ -158,12 +205,17 @@ export class EzpPrinterSelection {
|
|
|
158
205
|
if (data.code === 804) {
|
|
159
206
|
this.printFailed = true;
|
|
160
207
|
this.printProcessing = false;
|
|
208
|
+
if (hubTimeout)
|
|
209
|
+
clearTimeout(hubTimeout);
|
|
161
210
|
}
|
|
162
211
|
else if (this.selectedPrinter.is_queue &&
|
|
163
|
-
(data.code === 412 || data.code === 500 || data.code === 503)) {
|
|
212
|
+
(data.code === 412 || data.code === 500 || data.code === 503 || data.code === 1048579)) {
|
|
164
213
|
// Hub printer specific errors - likely driver not assigned
|
|
214
|
+
console.log('[handlePrint] Hub printer driver error detected:', data);
|
|
165
215
|
this.hubDriverError = true;
|
|
166
216
|
this.printProcessing = false;
|
|
217
|
+
if (hubTimeout)
|
|
218
|
+
clearTimeout(hubTimeout);
|
|
167
219
|
}
|
|
168
220
|
else if (data.jobid) {
|
|
169
221
|
printStore.state.jobID = data.jobid;
|
|
@@ -173,7 +225,7 @@ export class EzpPrinterSelection {
|
|
|
173
225
|
interval: this.POLL_INTERVAL,
|
|
174
226
|
maxAttempts: this.MAX_POLL_ATTEMPTS,
|
|
175
227
|
}).catch((err) => {
|
|
176
|
-
console.warn(err);
|
|
228
|
+
console.warn('[handlePrint] Polling error:', err);
|
|
177
229
|
// Check if this is a hub printer and the error might be driver-related
|
|
178
230
|
if (this.selectedPrinter.is_queue) {
|
|
179
231
|
this.hubDriverError = true;
|
|
@@ -182,6 +234,8 @@ export class EzpPrinterSelection {
|
|
|
182
234
|
this.printFailed = true;
|
|
183
235
|
}
|
|
184
236
|
this.printProcessing = false;
|
|
237
|
+
if (hubTimeout)
|
|
238
|
+
clearTimeout(hubTimeout);
|
|
185
239
|
});
|
|
186
240
|
}
|
|
187
241
|
else {
|
|
@@ -193,10 +247,12 @@ export class EzpPrinterSelection {
|
|
|
193
247
|
this.printFailed = true;
|
|
194
248
|
}
|
|
195
249
|
this.printProcessing = false;
|
|
250
|
+
if (hubTimeout)
|
|
251
|
+
clearTimeout(hubTimeout);
|
|
196
252
|
}
|
|
197
253
|
})
|
|
198
254
|
.catch((error) => {
|
|
199
|
-
console.log(error);
|
|
255
|
+
console.log('[handlePrint] Error caught:', error);
|
|
200
256
|
// Check if this is a hub printer and the error might be driver-related
|
|
201
257
|
if (this.selectedPrinter.is_queue) {
|
|
202
258
|
this.hubDriverError = true;
|
|
@@ -205,13 +261,42 @@ export class EzpPrinterSelection {
|
|
|
205
261
|
this.printFailed = true;
|
|
206
262
|
}
|
|
207
263
|
this.printProcessing = false;
|
|
264
|
+
if (hubTimeout)
|
|
265
|
+
clearTimeout(hubTimeout);
|
|
208
266
|
});
|
|
209
267
|
}
|
|
210
268
|
else if (this.files && this.files.length > 1) {
|
|
211
269
|
await this.processMultipleFiles(this.files, cleanPrintProperties);
|
|
270
|
+
if (hubTimeout)
|
|
271
|
+
clearTimeout(hubTimeout);
|
|
212
272
|
}
|
|
213
273
|
else if (this.files && this.files.length === 1) {
|
|
214
|
-
|
|
274
|
+
// --- Begin: Consistent single file handling ---
|
|
275
|
+
this.totalFiles = 1;
|
|
276
|
+
this.currentFileIndex = 0;
|
|
277
|
+
this.failedFiles = [];
|
|
278
|
+
this.successfulFiles = [];
|
|
279
|
+
try {
|
|
280
|
+
await this.processSingleFile(this.files[0], cleanPrintProperties);
|
|
281
|
+
this.successfulFiles.push(this.files[0].name);
|
|
282
|
+
this.printSuccess = true;
|
|
283
|
+
this.partialSuccess = false;
|
|
284
|
+
this.printProcessing = false;
|
|
285
|
+
}
|
|
286
|
+
catch (error) {
|
|
287
|
+
console.error(`Error processing file ${this.files[0].name}:`, error);
|
|
288
|
+
this.failedFiles.push(this.files[0].name);
|
|
289
|
+
this.printFailed = true;
|
|
290
|
+
this.partialSuccess = false;
|
|
291
|
+
this.printProcessing = false;
|
|
292
|
+
// Check if this is a hub driver error
|
|
293
|
+
if (error.message && error.message.includes('Hub printer driver error')) {
|
|
294
|
+
this.hubDriverError = true;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
if (hubTimeout)
|
|
298
|
+
clearTimeout(hubTimeout);
|
|
299
|
+
// --- End: Consistent single file handling ---
|
|
215
300
|
}
|
|
216
301
|
localStorage.setItem('properties', JSON.stringify(this.selectedProperties));
|
|
217
302
|
localStorage.setItem('printer', JSON.stringify(this.selectedPrinter));
|
|
@@ -32894,15 +32894,51 @@ let EzpPrinterSelection$1 = class extends HTMLElement {
|
|
|
32894
32894
|
this.printCancel.emit();
|
|
32895
32895
|
};
|
|
32896
32896
|
this.validateData = (data) => {
|
|
32897
|
-
|
|
32898
|
-
|
|
32897
|
+
console.log('[validateData] Checking data:', data);
|
|
32898
|
+
const { jobstatus } = data;
|
|
32899
|
+
// Define status handlers
|
|
32900
|
+
const statusHandlers = {
|
|
32901
|
+
0: () => {
|
|
32902
|
+
// Success
|
|
32903
|
+
this.printSuccess = true;
|
|
32904
|
+
this.printProcessing = false;
|
|
32905
|
+
return true;
|
|
32906
|
+
},
|
|
32907
|
+
1246: () => false,
|
|
32908
|
+
129: () => false,
|
|
32909
|
+
3011: () => {
|
|
32910
|
+
// Failure
|
|
32911
|
+
this.printFailed = true;
|
|
32912
|
+
this.printProcessing = false;
|
|
32913
|
+
return true;
|
|
32914
|
+
},
|
|
32915
|
+
2: () => {
|
|
32916
|
+
// Failure
|
|
32917
|
+
this.printFailed = true;
|
|
32918
|
+
this.printProcessing = false;
|
|
32919
|
+
return true;
|
|
32920
|
+
},
|
|
32921
|
+
};
|
|
32922
|
+
// Check for hub printer driver errors
|
|
32923
|
+
const hubDriverErrorCodes = [412, 500, 503, 1048579];
|
|
32924
|
+
if (hubDriverErrorCodes.includes(jobstatus) && this.selectedPrinter.is_queue) {
|
|
32925
|
+
this.hubDriverError = true;
|
|
32899
32926
|
this.printProcessing = false;
|
|
32900
32927
|
return true;
|
|
32901
32928
|
}
|
|
32902
|
-
|
|
32929
|
+
// Use handler if exists, otherwise treat as failure
|
|
32930
|
+
const handler = statusHandlers[jobstatus];
|
|
32931
|
+
if (handler) {
|
|
32932
|
+
return handler();
|
|
32933
|
+
}
|
|
32934
|
+
// Unknown status, treat as failure for safety
|
|
32935
|
+
this.printFailed = true;
|
|
32936
|
+
this.printProcessing = false;
|
|
32937
|
+
return true;
|
|
32903
32938
|
};
|
|
32904
32939
|
this.POLL_INTERVAL = 2000;
|
|
32905
32940
|
this.MAX_POLL_ATTEMPTS = Infinity;
|
|
32941
|
+
this.HUB_TIMEOUT = 30000; // 30 seconds timeout for hub printers
|
|
32906
32942
|
/** Description... */
|
|
32907
32943
|
this.handlePrint = async () => {
|
|
32908
32944
|
this.printButton.blur();
|
|
@@ -32911,6 +32947,15 @@ let EzpPrinterSelection$1 = class extends HTMLElement {
|
|
|
32911
32947
|
this.successfulFiles = [];
|
|
32912
32948
|
this.partialSuccess = false;
|
|
32913
32949
|
this.hubDriverError = false;
|
|
32950
|
+
// Set up timeout for hub printers to prevent infinite loading
|
|
32951
|
+
let hubTimeout;
|
|
32952
|
+
if (this.selectedPrinter.is_queue) {
|
|
32953
|
+
hubTimeout = setTimeout(() => {
|
|
32954
|
+
console.log('[handlePrint] Hub printer timeout reached, setting driver error');
|
|
32955
|
+
this.hubDriverError = true;
|
|
32956
|
+
this.printProcessing = false;
|
|
32957
|
+
}, this.HUB_TIMEOUT);
|
|
32958
|
+
}
|
|
32914
32959
|
// we have to initialse this obj with empty strings to display the select component
|
|
32915
32960
|
// but don't want to send any attributes with empty strings to the API
|
|
32916
32961
|
if (this.selectedPrinterConfig.Trays &&
|
|
@@ -32937,6 +32982,8 @@ let EzpPrinterSelection$1 = class extends HTMLElement {
|
|
|
32937
32982
|
if (response.status === 200 && this.selectedPrinter.is_queue) {
|
|
32938
32983
|
this.printProcessing = false;
|
|
32939
32984
|
this.printSuccess = true;
|
|
32985
|
+
if (hubTimeout)
|
|
32986
|
+
clearTimeout(hubTimeout);
|
|
32940
32987
|
}
|
|
32941
32988
|
if (response.status === 412) {
|
|
32942
32989
|
response.json().then((data) => (this.fileid = data.fileid));
|
|
@@ -32950,12 +32997,17 @@ let EzpPrinterSelection$1 = class extends HTMLElement {
|
|
|
32950
32997
|
if (data.code === 804) {
|
|
32951
32998
|
this.printFailed = true;
|
|
32952
32999
|
this.printProcessing = false;
|
|
33000
|
+
if (hubTimeout)
|
|
33001
|
+
clearTimeout(hubTimeout);
|
|
32953
33002
|
}
|
|
32954
33003
|
else if (this.selectedPrinter.is_queue &&
|
|
32955
|
-
(data.code === 412 || data.code === 500 || data.code === 503)) {
|
|
33004
|
+
(data.code === 412 || data.code === 500 || data.code === 503 || data.code === 1048579)) {
|
|
32956
33005
|
// Hub printer specific errors - likely driver not assigned
|
|
33006
|
+
console.log('[handlePrint] Hub printer driver error detected:', data);
|
|
32957
33007
|
this.hubDriverError = true;
|
|
32958
33008
|
this.printProcessing = false;
|
|
33009
|
+
if (hubTimeout)
|
|
33010
|
+
clearTimeout(hubTimeout);
|
|
32959
33011
|
}
|
|
32960
33012
|
else if (data.jobid) {
|
|
32961
33013
|
printStore.state.jobID = data.jobid;
|
|
@@ -32965,7 +33017,7 @@ let EzpPrinterSelection$1 = class extends HTMLElement {
|
|
|
32965
33017
|
interval: this.POLL_INTERVAL,
|
|
32966
33018
|
maxAttempts: this.MAX_POLL_ATTEMPTS,
|
|
32967
33019
|
}).catch((err) => {
|
|
32968
|
-
console.warn(err);
|
|
33020
|
+
console.warn('[handlePrint] Polling error:', err);
|
|
32969
33021
|
// Check if this is a hub printer and the error might be driver-related
|
|
32970
33022
|
if (this.selectedPrinter.is_queue) {
|
|
32971
33023
|
this.hubDriverError = true;
|
|
@@ -32974,6 +33026,8 @@ let EzpPrinterSelection$1 = class extends HTMLElement {
|
|
|
32974
33026
|
this.printFailed = true;
|
|
32975
33027
|
}
|
|
32976
33028
|
this.printProcessing = false;
|
|
33029
|
+
if (hubTimeout)
|
|
33030
|
+
clearTimeout(hubTimeout);
|
|
32977
33031
|
});
|
|
32978
33032
|
}
|
|
32979
33033
|
else {
|
|
@@ -32985,10 +33039,12 @@ let EzpPrinterSelection$1 = class extends HTMLElement {
|
|
|
32985
33039
|
this.printFailed = true;
|
|
32986
33040
|
}
|
|
32987
33041
|
this.printProcessing = false;
|
|
33042
|
+
if (hubTimeout)
|
|
33043
|
+
clearTimeout(hubTimeout);
|
|
32988
33044
|
}
|
|
32989
33045
|
})
|
|
32990
33046
|
.catch((error) => {
|
|
32991
|
-
console.log(error);
|
|
33047
|
+
console.log('[handlePrint] Error caught:', error);
|
|
32992
33048
|
// Check if this is a hub printer and the error might be driver-related
|
|
32993
33049
|
if (this.selectedPrinter.is_queue) {
|
|
32994
33050
|
this.hubDriverError = true;
|
|
@@ -32997,13 +33053,42 @@ let EzpPrinterSelection$1 = class extends HTMLElement {
|
|
|
32997
33053
|
this.printFailed = true;
|
|
32998
33054
|
}
|
|
32999
33055
|
this.printProcessing = false;
|
|
33056
|
+
if (hubTimeout)
|
|
33057
|
+
clearTimeout(hubTimeout);
|
|
33000
33058
|
});
|
|
33001
33059
|
}
|
|
33002
33060
|
else if (this.files && this.files.length > 1) {
|
|
33003
33061
|
await this.processMultipleFiles(this.files, cleanPrintProperties);
|
|
33062
|
+
if (hubTimeout)
|
|
33063
|
+
clearTimeout(hubTimeout);
|
|
33004
33064
|
}
|
|
33005
33065
|
else if (this.files && this.files.length === 1) {
|
|
33006
|
-
|
|
33066
|
+
// --- Begin: Consistent single file handling ---
|
|
33067
|
+
this.totalFiles = 1;
|
|
33068
|
+
this.currentFileIndex = 0;
|
|
33069
|
+
this.failedFiles = [];
|
|
33070
|
+
this.successfulFiles = [];
|
|
33071
|
+
try {
|
|
33072
|
+
await this.processSingleFile(this.files[0], cleanPrintProperties);
|
|
33073
|
+
this.successfulFiles.push(this.files[0].name);
|
|
33074
|
+
this.printSuccess = true;
|
|
33075
|
+
this.partialSuccess = false;
|
|
33076
|
+
this.printProcessing = false;
|
|
33077
|
+
}
|
|
33078
|
+
catch (error) {
|
|
33079
|
+
console.error(`Error processing file ${this.files[0].name}:`, error);
|
|
33080
|
+
this.failedFiles.push(this.files[0].name);
|
|
33081
|
+
this.printFailed = true;
|
|
33082
|
+
this.partialSuccess = false;
|
|
33083
|
+
this.printProcessing = false;
|
|
33084
|
+
// Check if this is a hub driver error
|
|
33085
|
+
if (error.message && error.message.includes('Hub printer driver error')) {
|
|
33086
|
+
this.hubDriverError = true;
|
|
33087
|
+
}
|
|
33088
|
+
}
|
|
33089
|
+
if (hubTimeout)
|
|
33090
|
+
clearTimeout(hubTimeout);
|
|
33091
|
+
// --- End: Consistent single file handling ---
|
|
33007
33092
|
}
|
|
33008
33093
|
localStorage.setItem('properties', JSON.stringify(this.selectedProperties));
|
|
33009
33094
|
localStorage.setItem('printer', JSON.stringify(this.selectedPrinter));
|