@ezeep/ezeep-js 1.0.272 → 1.0.277

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.
Files changed (120) hide show
  1. package/dist/cjs/{app-globals-D7ISNeUi.js → app-globals-L_3XPZxT.js} +7 -1
  2. package/dist/cjs/ezeep.cjs.js +4 -4
  3. package/dist/cjs/ezp-auth_15.cjs.entry.js +7240 -3678
  4. package/dist/cjs/{index-dv_gozsq.js → index-DM5v_sge.js} +3 -2
  5. package/dist/cjs/loader.cjs.js +3 -3
  6. package/dist/collection/collection-manifest.json +1 -1
  7. package/dist/collection/components/ezp-auth/ezp-auth.css +1 -1
  8. package/dist/collection/components/ezp-auth/ezp-auth.js +56 -15
  9. package/dist/collection/components/ezp-backdrop/ezp-backdrop.js +5 -5
  10. package/dist/collection/components/ezp-dialog/ezp-dialog.js +85 -13
  11. package/dist/collection/components/ezp-icon/ezp-icon.js +7 -2
  12. package/dist/collection/components/ezp-icon-button/ezp-icon-button.js +4 -1
  13. package/dist/collection/components/ezp-input/ezp-input.css +9 -12
  14. package/dist/collection/components/ezp-input/ezp-input.js +15 -13
  15. package/dist/collection/components/ezp-printer-selection/ezp-printer-selection.js +207 -323
  16. package/dist/collection/components/ezp-printing/ezp-printing.css +9 -9
  17. package/dist/collection/components/ezp-printing/ezp-printing.js +107 -35
  18. package/dist/collection/components/ezp-select/ezp-select.css +2 -2
  19. package/dist/collection/components/ezp-select/ezp-select.js +92 -13
  20. package/dist/collection/components/ezp-status/ezp-status.js +23 -13
  21. package/dist/collection/components/ezp-stepper/ezp-stepper.js +13 -6
  22. package/dist/collection/components/ezp-text-button/ezp-text-button.js +1 -1
  23. package/dist/collection/components/ezp-upload/ezp-upload.css +9 -9
  24. package/dist/collection/components/ezp-upload/ezp-upload.js +26 -8
  25. package/dist/collection/components/ezp-user-menu/ezp-user-menu.css +2 -1
  26. package/dist/collection/components/ezp-user-menu/ezp-user-menu.js +15 -15
  27. package/dist/collection/services/auth.js +37 -36
  28. package/dist/collection/services/http.js +11 -0
  29. package/dist/collection/services/print-job.js +72 -0
  30. package/dist/collection/services/print.js +21 -69
  31. package/dist/collection/services/user.js +2 -9
  32. package/dist/collection/shared/constants.js +55 -0
  33. package/dist/collection/shared/global.js +7 -1
  34. package/dist/collection/shared/storage.js +71 -0
  35. package/dist/collection/types/shared/types.d.ts +40 -9
  36. package/dist/collection/utils/printer.js +68 -0
  37. package/dist/collection/utils/utils.js +24 -9
  38. package/dist/components/auth.js +1 -1
  39. package/dist/components/ezp-auth2.js +1 -1
  40. package/dist/components/ezp-backdrop2.js +1 -1
  41. package/dist/components/ezp-dialog2.js +1 -1
  42. package/dist/components/ezp-icon-button2.js +1 -1
  43. package/dist/components/ezp-icon2.js +1 -1
  44. package/dist/components/ezp-input2.js +1 -1
  45. package/dist/components/ezp-printer-selection2.js +1 -1
  46. package/dist/components/ezp-printing.js +1 -1
  47. package/dist/components/ezp-select2.js +1 -1
  48. package/dist/components/ezp-status2.js +1 -1
  49. package/dist/components/ezp-stepper2.js +1 -1
  50. package/dist/components/ezp-text-button2.js +1 -1
  51. package/dist/components/ezp-upload2.js +1 -1
  52. package/dist/components/ezp-user-menu.js +1 -1
  53. package/dist/components/ezp-user-menu2.js +1 -1
  54. package/dist/components/index.js +1 -1
  55. package/dist/components/utils.js +1 -0
  56. package/dist/directives/proxies.ts +65 -42
  57. package/dist/esm/{app-globals-CpP67t2l.js → app-globals-C0WTlb31.js} +7 -1
  58. package/dist/esm/ezeep.js +5 -5
  59. package/dist/esm/ezp-auth_15.entry.js +7240 -3678
  60. package/dist/esm/{index-BTfWEHH9.js → index-BButrLnB.js} +3 -3
  61. package/dist/esm/loader.js +4 -4
  62. package/dist/esm-es5/{app-globals-CpP67t2l.js → app-globals-C0WTlb31.js} +1 -1
  63. package/dist/esm-es5/ezeep.js +1 -1
  64. package/dist/esm-es5/ezp-auth_15.entry.js +2 -2
  65. package/dist/esm-es5/{index-BTfWEHH9.js → index-BButrLnB.js} +3 -3
  66. package/dist/esm-es5/loader.js +1 -1
  67. package/dist/ezeep/ezeep.esm.js +1 -1
  68. package/dist/ezeep/ezeep.js +1 -1
  69. package/dist/ezeep/p-644e48a0.system.entry.js +7 -0
  70. package/dist/ezeep/{p-BTfWEHH9.js → p-BButrLnB.js} +2 -2
  71. package/dist/ezeep/{p-CpP67t2l.js → p-C0WTlb31.js} +1 -1
  72. package/{www/build/p-DhXN1yGM.system.js → dist/ezeep/p-CYpousxy.system.js} +2 -2
  73. package/dist/ezeep/{p-5ok9OZMg.system.js → p-D4aCr1OK.system.js} +1 -1
  74. package/dist/ezeep/{p-CfQRcOh8.system.js → p-DCznw2Ee.system.js} +1 -1
  75. package/dist/ezeep/p-ebd2beda.entry.js +1 -0
  76. package/dist/ezeep/types/shared/types.d.ts +40 -9
  77. package/dist/types/components/ezp-auth/ezp-auth.d.ts +8 -5
  78. package/dist/types/components/ezp-backdrop/ezp-backdrop.d.ts +2 -2
  79. package/dist/types/components/ezp-dialog/ezp-dialog.d.ts +14 -3
  80. package/dist/types/components/ezp-input/ezp-input.d.ts +17 -14
  81. package/dist/types/components/ezp-printer-selection/ezp-printer-selection.d.ts +23 -7
  82. package/dist/types/components/ezp-printing/ezp-printing.d.ts +25 -2
  83. package/dist/types/components/ezp-select/ezp-select.d.ts +10 -4
  84. package/dist/types/components/ezp-status/ezp-status.d.ts +6 -4
  85. package/dist/types/components/ezp-stepper/ezp-stepper.d.ts +1 -1
  86. package/dist/types/components/ezp-upload/ezp-upload.d.ts +4 -1
  87. package/dist/types/components/ezp-user-menu/ezp-user-menu.d.ts +5 -2
  88. package/dist/types/components.d.ts +38 -38
  89. package/dist/types/services/auth.d.ts +10 -0
  90. package/dist/types/services/http.d.ts +4 -0
  91. package/dist/types/services/print-job.d.ts +48 -0
  92. package/dist/types/services/print.d.ts +10 -9
  93. package/dist/types/services/user.d.ts +13 -2
  94. package/dist/types/shared/constants.d.ts +51 -0
  95. package/dist/types/shared/storage.d.ts +24 -0
  96. package/dist/types/shared/types.d.ts +40 -9
  97. package/dist/types/stencil-public-runtime.d.ts +1 -0
  98. package/dist/types/utils/printer.d.ts +22 -0
  99. package/dist/types/utils/utils.d.ts +22 -10
  100. package/package.json +30 -18
  101. package/readme.md +1 -0
  102. package/www/build/ezeep.esm.js +1 -1
  103. package/www/build/ezeep.js +1 -1
  104. package/www/build/p-644e48a0.system.entry.js +7 -0
  105. package/www/build/{p-BTfWEHH9.js → p-BButrLnB.js} +2 -2
  106. package/www/build/{p-CpP67t2l.js → p-C0WTlb31.js} +1 -1
  107. package/{dist/ezeep/p-DhXN1yGM.system.js → www/build/p-CYpousxy.system.js} +2 -2
  108. package/www/build/{p-5ok9OZMg.system.js → p-D4aCr1OK.system.js} +1 -1
  109. package/www/build/{p-CfQRcOh8.system.js → p-DCznw2Ee.system.js} +1 -1
  110. package/www/build/p-c7252f1c.js +1 -0
  111. package/www/build/p-ebd2beda.entry.js +1 -0
  112. package/www/data/locales/de.json +1 -0
  113. package/www/data/locales/en.json +1 -0
  114. package/www/index.html +2 -5
  115. package/dist/components/i18next.js +0 -1
  116. package/dist/ezeep/p-2177b8f4.system.entry.js +0 -7
  117. package/dist/ezeep/p-de8f6583.entry.js +0 -1
  118. package/www/build/p-2177b8f4.system.entry.js +0 -7
  119. package/www/build/p-256870db.js +0 -1
  120. package/www/build/p-de8f6583.entry.js +0 -1
@@ -3,8 +3,12 @@ import i18next from "i18next";
3
3
  import authStore from "../../services/auth";
4
4
  import printStore, { EzpPrintService } from "../../services/print";
5
5
  import userStore, { EzpUserService } from "../../services/user";
6
- import { managePaperDimensions, poll, removeEmptyStrings } from "../../utils/utils";
6
+ import { managePaperDimensions, poll, removeEmptyStrings, subscribeToLanguageChange } from "../../utils/utils";
7
7
  import { PAPER_ID, validatePageRange, formatPageRange } from "../../utils/utils";
8
+ import { applyPrinterDefaults, classifyJobStatus, hasTrays, hasNoTrays } from "../../utils/printer";
9
+ import { uploadAndPrintFile } from "../../services/print-job";
10
+ import { storage } from "../../shared/storage";
11
+ import { HUB_DRIVER_ERROR_CODES, PRINT_REJECTED_CODE, FILE_EXPIRED_STATUS, POLL_INTERVAL_MS, MAX_POLL_ATTEMPTS, HUB_TIMEOUT_MS, } from "../../shared/constants";
8
12
  export class EzpPrinterSelection {
9
13
  constructor() {
10
14
  this.fileExtension = '';
@@ -46,6 +50,7 @@ export class EzpPrinterSelection {
46
50
  this.preparingUpload = false;
47
51
  this.printSuccess = false;
48
52
  this.printFailed = false;
53
+ this.printTimedOut = false;
49
54
  this.notSupported = false;
50
55
  this.noPrinters = false;
51
56
  this.hubDriverError = false;
@@ -101,55 +106,31 @@ export class EzpPrinterSelection {
101
106
  this.hubDriverError = false;
102
107
  this.printCancel.emit();
103
108
  };
109
+ /** Poll `validate` callback: maps a job status to component state, returns `true` to stop polling. */
104
110
  this.validateData = (data) => {
105
- console.log('[validateData] Checking data:', data);
106
- const { jobstatus } = data;
107
- // Define status handlers
108
- const statusHandlers = {
109
- 0: () => {
110
- // Success
111
+ const outcome = classifyJobStatus(data.jobstatus, this.selectedPrinter.is_queue);
112
+ switch (outcome) {
113
+ case 'processing':
114
+ return false;
115
+ case 'success':
111
116
  this.printSuccess = true;
112
117
  this.printProcessing = false;
113
118
  return true;
114
- },
115
- 1246: () => false, // Still processing
116
- 129: () => false, // Still processing
117
- 3011: () => {
118
- // Failure
119
- this.printFailed = true;
119
+ case 'hub-error':
120
+ this.hubDriverError = true;
120
121
  this.printProcessing = false;
121
122
  return true;
122
- },
123
- 2: () => {
124
- // Failure
123
+ case 'failed':
124
+ default:
125
125
  this.printFailed = true;
126
126
  this.printProcessing = false;
127
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;
134
- this.printProcessing = false;
135
- return true;
136
128
  }
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;
146
129
  };
147
- this.POLL_INTERVAL = 2000;
148
- this.MAX_POLL_ATTEMPTS = Infinity;
149
- this.HUB_TIMEOUT = 30000; // 30 seconds timeout for hub printers
150
130
  /** Description... */
151
131
  this.handlePrint = async () => {
152
- this.printButton.blur();
132
+ var _a;
133
+ (_a = this.printButton) === null || _a === void 0 ? void 0 : _a.blur();
153
134
  this.printProcessing = true;
154
135
  this.failedFiles = [];
155
136
  this.successfulFiles = [];
@@ -159,16 +140,26 @@ export class EzpPrinterSelection {
159
140
  let hubTimeout;
160
141
  if (this.selectedPrinter.is_queue) {
161
142
  hubTimeout = setTimeout(() => {
162
- console.log('[handlePrint] Hub printer timeout reached, setting driver error');
163
143
  this.hubDriverError = true;
164
144
  this.printProcessing = false;
165
- }, this.HUB_TIMEOUT);
145
+ }, HUB_TIMEOUT_MS);
166
146
  }
147
+ // Resolve a print failure as either a hub-driver error or a generic failure,
148
+ // and stop the processing/timeout state. (Collapses three identical branches.)
149
+ const failByPrinterType = () => {
150
+ if (this.selectedPrinter.is_queue) {
151
+ this.hubDriverError = true;
152
+ }
153
+ else {
154
+ this.printFailed = true;
155
+ }
156
+ this.printProcessing = false;
157
+ if (hubTimeout)
158
+ clearTimeout(hubTimeout);
159
+ };
167
160
  // we have to initialse this obj with empty strings to display the select component
168
161
  // but don't want to send any attributes with empty strings to the API
169
- if (this.selectedPrinterConfig.Trays &&
170
- this.selectedPrinterConfig.Trays.length >= 0 &&
171
- this.selectedPrinterConfig.Trays[0] == null) {
162
+ if (hasNoTrays(this.selectedPrinterConfig)) {
172
163
  delete this.selectedProperties.trayname;
173
164
  delete this.selectedProperties.defaultSource;
174
165
  }
@@ -193,25 +184,30 @@ export class EzpPrinterSelection {
193
184
  if (hubTimeout)
194
185
  clearTimeout(hubTimeout);
195
186
  }
196
- if (response.status === 412) {
197
- response.json().then((data) => (this.fileid = data.fileid));
198
- this.printService.printByFileID(authStore.state.accessToken, this.fileid, this.filetype, this.selectedPrinter.id, cleanPrintProperties, this.filename);
187
+ if (response.status === FILE_EXPIRED_STATUS) {
188
+ // The file expired server-side. Parse the fresh fileid first, then
189
+ // reprint by fileID and RETURN that promise so the reprint's parsed
190
+ // PrintResponse (with its jobid) flows to the next `.then` and gets
191
+ // polled — otherwise the reprint is untracked and a successful
192
+ // reprint is reported as a failure.
193
+ return response.json().then((data) => {
194
+ this.fileid = data.fileid;
195
+ return this.printService.printByFileID(authStore.state.accessToken, this.fileid, this.filetype, this.selectedPrinter.id, cleanPrintProperties, this.filename);
196
+ });
199
197
  }
200
198
  else {
201
199
  return response.json();
202
200
  }
203
201
  })
204
202
  .then((data) => {
205
- if (data.code === 804) {
203
+ if (data.code === PRINT_REJECTED_CODE) {
206
204
  this.printFailed = true;
207
205
  this.printProcessing = false;
208
206
  if (hubTimeout)
209
207
  clearTimeout(hubTimeout);
210
208
  }
211
- else if (this.selectedPrinter.is_queue &&
212
- (data.code === 412 || data.code === 500 || data.code === 503 || data.code === 1048579)) {
209
+ else if (this.selectedPrinter.is_queue && HUB_DRIVER_ERROR_CODES.includes(data.code)) {
213
210
  // Hub printer specific errors - likely driver not assigned
214
- console.log('[handlePrint] Hub printer driver error detected:', data);
215
211
  this.hubDriverError = true;
216
212
  this.printProcessing = false;
217
213
  if (hubTimeout)
@@ -222,47 +218,27 @@ export class EzpPrinterSelection {
222
218
  poll({
223
219
  fn: this.printService.getPrintStatus,
224
220
  validate: this.validateData,
225
- interval: this.POLL_INTERVAL,
226
- maxAttempts: this.MAX_POLL_ATTEMPTS,
227
- }).catch((err) => {
228
- console.warn('[handlePrint] Polling error:', err);
229
- // Check if this is a hub printer and the error might be driver-related
230
- if (this.selectedPrinter.is_queue) {
231
- this.hubDriverError = true;
221
+ interval: POLL_INTERVAL_MS,
222
+ maxAttempts: MAX_POLL_ATTEMPTS,
223
+ }).catch((error) => {
224
+ if (this.isTimeoutError(error)) {
225
+ // Status poll timed out — the job may still finish on the printer.
226
+ this.printTimedOut = true;
227
+ this.printProcessing = false;
232
228
  }
233
229
  else {
234
- this.printFailed = true;
230
+ // Polling failed — for hub printers this usually means a driver issue.
231
+ failByPrinterType();
235
232
  }
236
- this.printProcessing = false;
237
- if (hubTimeout)
238
- clearTimeout(hubTimeout);
239
233
  });
240
234
  }
241
235
  else {
242
- // No job ID returned - check if it's a hub printer
243
- if (this.selectedPrinter.is_queue) {
244
- this.hubDriverError = true;
245
- }
246
- else {
247
- this.printFailed = true;
248
- }
249
- this.printProcessing = false;
250
- if (hubTimeout)
251
- clearTimeout(hubTimeout);
236
+ // No job ID returned — treat as a hub or generic failure.
237
+ failByPrinterType();
252
238
  }
253
239
  })
254
- .catch((error) => {
255
- console.log('[handlePrint] Error caught:', error);
256
- // Check if this is a hub printer and the error might be driver-related
257
- if (this.selectedPrinter.is_queue) {
258
- this.hubDriverError = true;
259
- }
260
- else {
261
- this.printFailed = true;
262
- }
263
- this.printProcessing = false;
264
- if (hubTimeout)
265
- clearTimeout(hubTimeout);
240
+ .catch(() => {
241
+ failByPrinterType();
266
242
  });
267
243
  }
268
244
  else if (this.files && this.files.length > 1) {
@@ -284,29 +260,34 @@ export class EzpPrinterSelection {
284
260
  this.printProcessing = false;
285
261
  }
286
262
  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
263
  this.partialSuccess = false;
291
264
  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;
265
+ if (this.isTimeoutError(error)) {
266
+ // The job may still be completing server-side — soften the message.
267
+ this.printTimedOut = true;
268
+ }
269
+ else {
270
+ this.failedFiles.push(this.files[0].name);
271
+ this.printFailed = true;
272
+ // Check if this is a hub driver error
273
+ if (error.message && error.message.includes('Hub printer driver error')) {
274
+ this.hubDriverError = true;
275
+ }
295
276
  }
296
277
  }
297
278
  if (hubTimeout)
298
279
  clearTimeout(hubTimeout);
299
- // --- End: Consistent single file handling ---
300
280
  }
301
- localStorage.setItem('properties', JSON.stringify(this.selectedProperties));
302
- localStorage.setItem('printer', JSON.stringify(this.selectedPrinter));
281
+ storage.setProperties(this.selectedProperties);
282
+ storage.setPrinter(this.selectedPrinter);
303
283
  this.printStopped = false;
304
284
  };
305
285
  this.handleUserMenu = () => {
306
286
  this.userMenuOpen = true;
307
287
  };
308
288
  this.validateFileType = async (name) => {
309
- const extension = name.split('.').pop();
289
+ var _a;
290
+ const extension = (_a = name.split('.').pop()) !== null && _a !== void 0 ? _a : '';
310
291
  this.fileExtension = extension.toLowerCase();
311
292
  return printStore.state.supportedFileExtensions.includes(`${this.fileExtension}`);
312
293
  };
@@ -352,6 +333,11 @@ export class EzpPrinterSelection {
352
333
  case 'print-failed':
353
334
  this.printFailed = false;
354
335
  break;
336
+ case 'print-timeout':
337
+ // The job may still be completing; closing just dismisses the flow.
338
+ this.printTimedOut = false;
339
+ this.printCancel.emit();
340
+ break;
355
341
  case 'hub-driver-error':
356
342
  this.hubDriverError = false;
357
343
  break;
@@ -374,6 +360,11 @@ export class EzpPrinterSelection {
374
360
  this.printProcessing = false;
375
361
  this.handlePrint();
376
362
  break;
363
+ case 'print-timeout':
364
+ this.printTimedOut = false;
365
+ this.printProcessing = false;
366
+ this.handlePrint();
367
+ break;
377
368
  case 'hub-driver-error':
378
369
  this.hubDriverError = false;
379
370
  this.printProcessing = false;
@@ -382,18 +373,18 @@ export class EzpPrinterSelection {
382
373
  }
383
374
  }
384
375
  getPropertiesFromLocalStorage() {
385
- if (localStorage.getItem('properties')) {
386
- this.selectedProperties = JSON.parse(localStorage.getItem('properties'));
376
+ const savedProperties = storage.getProperties();
377
+ if (savedProperties) {
378
+ this.selectedProperties = savedProperties;
387
379
  }
388
- if (localStorage.getItem('printer')) {
389
- const savedPrinter = JSON.parse(localStorage.getItem('printer'));
380
+ const savedPrinter = storage.getPrinter();
381
+ if (savedPrinter) {
390
382
  if (this.printers.some((printer) => printer.id === savedPrinter.id)) {
391
383
  this.selectedPrinter = savedPrinter;
392
384
  }
393
385
  else {
394
386
  this.selectedPrinter = { id: '', location: '', name: '', is_queue: false };
395
- localStorage.removeItem('printer');
396
- localStorage.removeItem('properties');
387
+ storage.clearSavedPrinter();
397
388
  }
398
389
  }
399
390
  else {
@@ -420,41 +411,9 @@ export class EzpPrinterSelection {
420
411
  await this.printService
421
412
  .getPrinterProperties(authStore.state.accessToken, this.selectedPrinter.id)
422
413
  .then((data) => {
423
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
424
414
  this.selectedPrinterConfig = Object.assign(Object.assign({}, this.selectedPrinterConfig), data[0]);
425
- this.selectedProperties.color =
426
- ((_a = this.selectedPrinterConfig.Default) === null || _a === void 0 ? void 0 : _a.Color) == 'color' ? true : false;
427
- const defaultOrientation = (_b = this.selectedPrinterConfig.Default) === null || _b === void 0 ? void 0 : _b.Orientation;
428
- const defaultOrientationIndex = (_c = this.selectedPrinterConfig.Default) === null || _c === void 0 ? void 0 : _c.OrientationIndex;
429
- let orientationFallback;
430
- if (defaultOrientation) {
431
- const idx = (_d = this.selectedPrinterConfig.OrientationsSupported) === null || _d === void 0 ? void 0 : _d.indexOf(defaultOrientation);
432
- if (typeof idx === 'number' && idx >= 0)
433
- orientationFallback = idx + 1;
434
- }
435
- this.selectedProperties.orientation = defaultOrientationIndex !== null && defaultOrientationIndex !== void 0 ? defaultOrientationIndex : orientationFallback;
436
- this.selectedProperties.resolution = (_e = this.selectedPrinterConfig.Default) === null || _e === void 0 ? void 0 : _e.Resolution;
437
- let defaultPaper = (_f = this.selectedPrinterConfig.PaperFormats) === null || _f === void 0 ? void 0 : _f.find((obj) => obj.Default === true);
438
- this.selectedProperties.paper = defaultPaper === null || defaultPaper === void 0 ? void 0 : defaultPaper.Name;
439
- this.selectedProperties.paperid = defaultPaper === null || defaultPaper === void 0 ? void 0 : defaultPaper.Id;
440
- let defaultSource = (_g = this.selectedPrinterConfig.Trays) === null || _g === void 0 ? void 0 : _g.find((obj) => obj.Default === true);
441
- if (this.selectedPrinterConfig.Trays &&
442
- this.selectedPrinterConfig.Trays.length >= 1 &&
443
- this.selectedPrinterConfig.Trays[0] != null) {
444
- this.selectedProperties.trayname = defaultSource === null || defaultSource === void 0 ? void 0 : defaultSource.Name;
445
- this.selectedProperties.defaultSource = defaultSource === null || defaultSource === void 0 ? void 0 : defaultSource.Index;
446
- }
447
- if (this.selectedPrinterConfig.Trays &&
448
- this.selectedPrinterConfig.Trays.length >= 0 &&
449
- this.selectedPrinterConfig.Trays[0] == null) {
450
- delete this.selectedProperties.trayname;
451
- delete this.selectedProperties.defaultSource;
452
- }
453
- this.selectedProperties.duplex = (_h = this.selectedPrinterConfig) === null || _h === void 0 ? void 0 : _h.DuplexSupported;
454
- this.selectedProperties.duplexmode = (_j = this.selectedPrinterConfig) === null || _j === void 0 ? void 0 : _j.DuplexMode;
455
- delete this.selectedProperties.PageRanges;
415
+ applyPrinterDefaults(this.selectedPrinterConfig, this.selectedProperties);
456
416
  });
457
- // this.setDefaultPaperFormat()
458
417
  break;
459
418
  case 'color':
460
419
  this.selectedProperties.color =
@@ -477,20 +436,17 @@ export class EzpPrinterSelection {
477
436
  this.selectedProperties.paperwidth = eventDetails.value;
478
437
  break;
479
438
  case 'tray':
480
- if (this.selectedPrinterConfig.Trays &&
481
- this.selectedPrinterConfig.Trays.length >= 0 &&
482
- this.selectedPrinterConfig.Trays[0] == null) {
439
+ if (hasNoTrays(this.selectedPrinterConfig)) {
483
440
  delete this.selectedProperties.trayname;
484
441
  delete this.selectedProperties.defaultSource;
485
442
  }
486
- if (this.selectedPrinterConfig.Trays &&
487
- this.selectedPrinterConfig.Trays.length >= 1 &&
488
- this.selectedPrinterConfig.Trays[0] != null) {
443
+ if (hasTrays(this.selectedPrinterConfig)) {
489
444
  this.selectedProperties.trayname = eventDetails.title;
490
445
  this.selectedProperties.defaultSource = eventDetails.id;
491
446
  }
492
447
  break;
493
448
  case 'paper_ranges':
449
+ // The page-range field is a text input, so the value is always a string.
494
450
  this.selectedProperties.PageRanges = eventDetails.value;
495
451
  this.pageRangeInvalid = !validatePageRange(this.selectedProperties.PageRanges);
496
452
  break;
@@ -510,127 +466,20 @@ export class EzpPrinterSelection {
510
466
  }
511
467
  this.setPaperid();
512
468
  }
513
- async handleFiles(files, printPorperties) {
514
- this.totalFiles = files.length;
515
- this.currentFileIndex = 0;
516
- this.failedFiles = [];
517
- this.successfulFiles = [];
518
- // Process each file individually
519
- for (let i = 0; i < files.length; i++) {
520
- this.currentFileIndex = i;
521
- const file = files[i];
522
- try {
523
- await this.processSingleFile(file, printPorperties);
524
- this.successfulFiles.push(file.name);
525
- }
526
- catch (error) {
527
- console.error(`Error processing file ${file.name}:`, error);
528
- this.failedFiles.push(file.name);
529
- // Check if this is a hub driver error
530
- if (error.message && error.message.includes('Hub printer driver error')) {
531
- this.hubDriverError = true;
532
- this.printProcessing = false;
533
- return; // Stop processing other files if it's a hub driver issue
534
- }
535
- // Continue with the next file
536
- }
537
- }
538
- // Determine final status based on results
539
- if (this.failedFiles.length === 0) {
540
- // All files processed successfully
541
- this.printSuccess = true;
542
- this.partialSuccess = false;
543
- this.printProcessing = false;
544
- }
545
- else if (this.successfulFiles.length === 0) {
546
- // All files failed
547
- this.printFailed = true;
548
- this.partialSuccess = false;
549
- this.printProcessing = false;
550
- }
551
- else {
552
- // Some files succeeded, some failed - show partial success
553
- this.printSuccess = true;
554
- this.partialSuccess = true;
555
- this.printProcessing = false;
556
- }
557
- }
469
+ /** Upload + print a single file, reflecting progress into component state. */
558
470
  async processSingleFile(file, printProperties) {
559
- this.preparingUpload = true;
560
- const response = await this.printService.prepareFileUpload(authStore.state.accessToken);
561
- this.preparingUpload = false;
562
- const fileid = response.fileid;
563
- const sasUri = response.sasUri;
564
- const filetype = this.getFileExtension(file.name);
565
- this.uploading = true;
566
- try {
567
- // Upload the file
568
- const res = await this.printService.uploadBlobFiles(sasUri, file);
569
- if (res._response.status === 201) {
570
- // Print the file
571
- const data = await this.printService.printByFileID(authStore.state.accessToken, fileid, filetype, this.selectedPrinter.id, printProperties, file.name);
572
- if (data.code === 804) {
573
- throw new Error(`Print failed for file: ${file.name}`);
574
- }
575
- // Check for hub printer driver errors
576
- if (this.selectedPrinter.is_queue &&
577
- (data.code === 412 || data.code === 500 || data.code === 503)) {
578
- throw new Error(`Hub printer driver error for file: ${file.name}`);
579
- }
580
- if (data.jobid) {
581
- printStore.state.jobID = data.jobid;
582
- // Wait for this print job to complete before processing the next file
583
- await this.waitForPrintCompletion();
584
- }
585
- else {
586
- throw new Error(`No job ID returned for file: ${file.name}`);
587
- }
588
- }
589
- else {
590
- throw new Error(`Upload failed for file: ${file.name}`);
591
- }
592
- }
593
- catch (error) {
594
- this.uploading = false;
595
- throw error;
596
- }
597
- this.uploading = false;
598
- }
599
- async waitForPrintCompletion() {
600
- while (true) {
601
- try {
602
- const data = await this.printService.getPrintStatus();
603
- console.log('[waitForPrintCompletion] Poll response:', data);
604
- if (data.jobstatus === 0) {
605
- // Success
606
- return;
607
- }
608
- else if (data.jobstatus === 1246 || data.jobstatus === 129) {
609
- // Still processing, wait before next poll
610
- await new Promise((resolve) => setTimeout(resolve, this.POLL_INTERVAL));
611
- }
612
- else if (data.jobstatus === 3011 || data.jobstatus === 2) {
613
- // Failure
614
- throw new Error('Print job failed: ' + (data.jobstatusstring || data.jobstatus));
615
- }
616
- else if (this.selectedPrinter.is_queue &&
617
- (data.jobstatus === 412 || data.jobstatus === 500 || data.jobstatus === 503)) {
618
- // Hub printer driver error
619
- throw new Error('Hub printer driver error: ' + (data.jobstatusstring || data.jobstatus));
620
- }
621
- else {
622
- // Unknown status, treat as failure for safety
623
- throw new Error('Unknown print job status: ' + data.jobstatus);
624
- }
625
- }
626
- catch (error) {
627
- throw error;
628
- }
629
- }
630
- }
631
- getFileExtension(filename) {
632
- const extension = filename.split('.').pop();
633
- return extension ? extension.toLowerCase() : '';
471
+ await uploadAndPrintFile({
472
+ service: this.printService,
473
+ accessToken: authStore.state.accessToken,
474
+ printerId: this.selectedPrinter.id,
475
+ isQueue: this.selectedPrinter.is_queue,
476
+ properties: printProperties,
477
+ pollIntervalMs: POLL_INTERVAL_MS,
478
+ }, file, {
479
+ onPreparing: (value) => (this.preparingUpload = value),
480
+ onUploading: (value) => (this.uploading = value),
481
+ onJobId: (jobId) => (printStore.state.jobID = jobId),
482
+ });
634
483
  }
635
484
  setDefaultPaperFormat() {
636
485
  var _a, _b, _c, _d, _e;
@@ -645,13 +494,14 @@ export class EzpPrinterSelection {
645
494
  else {
646
495
  format = 'A4';
647
496
  }
648
- if ((_a = this.selectedPrinterConfig.PaperFormats) === null || _a === void 0 ? void 0 : _a.find((el) => el.Name.includes(format))) {
649
- this.selectedProperties.paper = (_b = this.selectedPrinterConfig.PaperFormats) === null || _b === void 0 ? void 0 : _b.find((el) => el.Name.includes(format)).Name;
650
- this.selectedProperties.paperid = (_c = this.selectedPrinterConfig.PaperFormats) === null || _c === void 0 ? void 0 : _c.find((el) => el.Name.includes(format)).Id;
497
+ const matched = (_a = this.selectedPrinterConfig.PaperFormats) === null || _a === void 0 ? void 0 : _a.find((el) => el.Name.includes(format));
498
+ if (matched) {
499
+ this.selectedProperties.paper = matched.Name;
500
+ this.selectedProperties.paperid = matched.Id;
651
501
  }
652
502
  else {
653
- this.selectedProperties.paper = (_d = this.selectedPrinterConfig.PaperFormats[0]) === null || _d === void 0 ? void 0 : _d.Name;
654
- this.selectedProperties.paperid = (_e = this.selectedPrinterConfig.PaperFormats[0]) === null || _e === void 0 ? void 0 : _e.Id;
503
+ this.selectedProperties.paper = (_c = (_b = this.selectedPrinterConfig.PaperFormats) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.Name;
504
+ this.selectedProperties.paperid = (_e = (_d = this.selectedPrinterConfig.PaperFormats) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.Id;
655
505
  }
656
506
  this.setPaperid();
657
507
  }
@@ -667,8 +517,7 @@ export class EzpPrinterSelection {
667
517
  await this.processSingleFile(file, printProperties);
668
518
  this.successfulFiles.push(file.name);
669
519
  }
670
- catch (error) {
671
- console.error(`Error processing file ${file.name}:`, error);
520
+ catch (_a) {
672
521
  this.failedFiles.push(file.name);
673
522
  // Continue with the next file
674
523
  }
@@ -697,6 +546,7 @@ export class EzpPrinterSelection {
697
546
  */
698
547
  /** Description... */
699
548
  async connectedCallback() {
549
+ this.unsubscribeLanguage = subscribeToLanguageChange(this);
700
550
  this.printService = new EzpPrintService(this.redirectURI, this.clientID);
701
551
  this.printService.registerFetchInterceptor();
702
552
  await this.getUserInfo();
@@ -714,39 +564,8 @@ export class EzpPrinterSelection {
714
564
  await this.printService
715
565
  .getPrinterProperties(authStore.state.accessToken, this.selectedPrinter.id)
716
566
  .then((data) => {
717
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
718
567
  this.selectedPrinterConfig = data[0];
719
- this.selectedProperties.color =
720
- ((_a = this.selectedPrinterConfig.Default) === null || _a === void 0 ? void 0 : _a.Color) == 'color' ? true : false;
721
- const defaultOrientation = (_b = this.selectedPrinterConfig.Default) === null || _b === void 0 ? void 0 : _b.Orientation;
722
- const defaultOrientationIndex = (_c = this.selectedPrinterConfig.Default) === null || _c === void 0 ? void 0 : _c.OrientationIndex;
723
- let orientationFallback;
724
- if (defaultOrientation) {
725
- const idx = (_d = this.selectedPrinterConfig.OrientationsSupported) === null || _d === void 0 ? void 0 : _d.indexOf(defaultOrientation);
726
- if (typeof idx === 'number' && idx >= 0)
727
- orientationFallback = idx + 1;
728
- }
729
- this.selectedProperties.orientation = defaultOrientationIndex !== null && defaultOrientationIndex !== void 0 ? defaultOrientationIndex : orientationFallback;
730
- this.selectedProperties.resolution = (_e = this.selectedPrinterConfig.Default) === null || _e === void 0 ? void 0 : _e.Resolution;
731
- let defaultPaper = (_f = this.selectedPrinterConfig.PaperFormats) === null || _f === void 0 ? void 0 : _f.find((obj) => obj.Default === true);
732
- this.selectedProperties.paper = defaultPaper === null || defaultPaper === void 0 ? void 0 : defaultPaper.Name;
733
- this.selectedProperties.paperid = defaultPaper === null || defaultPaper === void 0 ? void 0 : defaultPaper.Id;
734
- let defaultSource = (_g = this.selectedPrinterConfig.Trays) === null || _g === void 0 ? void 0 : _g.find((obj) => obj.Default === true);
735
- if (this.selectedPrinterConfig.Trays &&
736
- this.selectedPrinterConfig.Trays.length >= 1 &&
737
- this.selectedPrinterConfig.Trays[0] != null) {
738
- this.selectedProperties.trayname = defaultSource === null || defaultSource === void 0 ? void 0 : defaultSource.Name;
739
- this.selectedProperties.defaultSource = defaultSource === null || defaultSource === void 0 ? void 0 : defaultSource.Index;
740
- }
741
- if (this.selectedPrinterConfig.Trays &&
742
- this.selectedPrinterConfig.Trays.length >= 0 &&
743
- this.selectedPrinterConfig.Trays[0] == null) {
744
- delete this.selectedProperties.trayname;
745
- delete this.selectedProperties.defaultSource;
746
- }
747
- this.selectedProperties.duplex = (_h = this.selectedPrinterConfig) === null || _h === void 0 ? void 0 : _h.DuplexSupported;
748
- this.selectedProperties.duplexmode = (_j = this.selectedPrinterConfig) === null || _j === void 0 ? void 0 : _j.DuplexMode;
749
- delete this.selectedProperties.PageRanges;
568
+ applyPrinterDefaults(this.selectedPrinterConfig, this.selectedProperties);
750
569
  });
751
570
  if (this.selectedProperties.paper === '') {
752
571
  this.setDefaultPaperFormat();
@@ -771,28 +590,92 @@ export class EzpPrinterSelection {
771
590
  }
772
591
  this.loading = false;
773
592
  }
593
+ disconnectedCallback() {
594
+ var _a;
595
+ (_a = this.unsubscribeLanguage) === null || _a === void 0 ? void 0 : _a.call(this);
596
+ }
774
597
  /**
775
598
  *
776
599
  * Render method
777
600
  *
778
601
  */
602
+ /** Description shown while a print job is in progress. */
603
+ processingDescription() {
604
+ if (this.preparingUpload)
605
+ return i18next.t('printer_selection.prepare_upload');
606
+ if (this.uploading) {
607
+ // Surface the live blob-upload progress (reactive via the print store).
608
+ const percent = Math.round(printStore.state.uploadProgress);
609
+ const detail = this.totalFiles > 1 ? `${this.currentFileIndex + 1}/${this.totalFiles} · ` : '';
610
+ return `${i18next.t('printer_selection.uploading')} (${detail}${percent}%)`;
611
+ }
612
+ if (this.totalFiles > 1) {
613
+ return `${i18next.t('printer_selection.print_processing')} (${this.currentFileIndex + 1}/${this.totalFiles})`;
614
+ }
615
+ return i18next.t('printer_selection.print_processing');
616
+ }
617
+ /** Description for a successful pull-print (hub/queue printer). */
618
+ pullPrintSuccessDescription() {
619
+ const base = i18next.t('printer_selection.pull_print_success');
620
+ if (this.totalFiles <= 1)
621
+ return base;
622
+ return this.failedFiles.length > 0
623
+ ? `${base} (${this.successfulFiles.length}/${this.totalFiles} files)`
624
+ : `${base} (${this.totalFiles} files)`;
625
+ }
626
+ /** Description for a successful (possibly partial) direct print. */
627
+ printSuccessDescription() {
628
+ const base = i18next.t('printer_selection.print_success');
629
+ const files = i18next.t('printer_selection.files');
630
+ if (this.totalFiles <= 1)
631
+ return base;
632
+ return this.partialSuccess
633
+ ? `${base} (${this.successfulFiles.length}/${this.totalFiles} ${files} - ${this.failedFiles.length} failed`
634
+ : `${base} (${this.totalFiles} ${files})`;
635
+ }
636
+ /**
637
+ * True when an error is a polling-budget timeout rather than an outright
638
+ * failure — the job may still be rendering/printing server-side (common for
639
+ * large documents on direct printers), so it warrants a softer message.
640
+ */
641
+ isTimeoutError(error) {
642
+ const message = error instanceof Error ? error.message : String(error);
643
+ return message.includes('Exceeded max attempts') || message.includes('timed out');
644
+ }
645
+ /**
646
+ * The single status card (if any) to show above the form. Replaces a deeply
647
+ * nested 9-branch ternary; the order of checks is preserved.
648
+ */
649
+ renderStatus() {
650
+ if (this.printProcessing) {
651
+ return (h("ezp-status", { processing: true, description: this.processingDescription(), instance: "print-processing", cancel: true }));
652
+ }
653
+ if (this.selectedPrinter.is_queue && this.printSuccess) {
654
+ return (h("ezp-status", { icon: "checkmark-alt", description: this.pullPrintSuccessDescription(), instance: "print-success", close: true }));
655
+ }
656
+ if (this.printSuccess) {
657
+ return (h("ezp-status", { icon: this.partialSuccess ? 'exclamation-mark' : 'checkmark-alt', description: this.printSuccessDescription(), instance: "print-success", close: true }));
658
+ }
659
+ if (this.printTimedOut) {
660
+ return (h("ezp-status", { icon: "exclamation-mark", description: i18next.t('printer_selection.print_timeout'), instance: "print-timeout", close: true, retry: true }));
661
+ }
662
+ if (this.printFailed) {
663
+ return (h("ezp-status", { icon: "exclamation-mark", description: i18next.t('printer_selection.print_failed'), instance: "print-failed", close: true, retry: true }));
664
+ }
665
+ if (this.notSupported) {
666
+ return (h("ezp-status", { icon: "exclamation-mark", description: i18next.t('printer_selection.not_supported'), instance: "not-supported", retry: true }));
667
+ }
668
+ if (this.hubDriverError) {
669
+ return (h("ezp-status", { icon: "exclamation-mark", description: i18next.t('printer_selection.print_failed'), instance: "hub-driver-error", close: true, retry: true }));
670
+ }
671
+ if (this.noPrinters) {
672
+ return (h("ezp-status", { icon: "exclamation-mark", description: i18next.t('printer_selection.no_printers'), instance: "no-printers", close: true }));
673
+ }
674
+ return null;
675
+ }
779
676
  render() {
780
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
781
- return this.loading ? (h("ezp-status", { processing: true, description: i18next.t('printer_selection.loading'), instance: "loading" })) : (h(Host, { class: { seamless: this.seamless } }, h("div", { id: "box", "data-backdrop-surface": true }, !this.printStopped && (h(Fragment, null, this.printProcessing ? (h("ezp-status", { processing: true, description: this.totalFiles > 1
782
- ? `${i18next.t('printer_selection.print_processing')} (${this.currentFileIndex + 1}/${this.totalFiles})`
783
- : this.preparingUpload
784
- ? i18next.t('printer_selection.prepare_upload')
785
- : this.uploading
786
- ? i18next.t('printer_selection.uploading')
787
- : i18next.t('printer_selection.print_processing'), instance: "print-processing", cancel: true })) : this.selectedPrinter.is_queue && this.printSuccess ? (h("ezp-status", { icon: "checkmark-alt", description: this.totalFiles > 1
788
- ? this.failedFiles.length > 0
789
- ? `${i18next.t('printer_selection.pull_print_success')} (${this.successfulFiles.length}/${this.totalFiles} files)`
790
- : `${i18next.t('printer_selection.pull_print_success')} (${this.totalFiles} files)`
791
- : i18next.t('printer_selection.pull_print_success'), instance: "print-success", close: true })) : this.printSuccess ? (h("ezp-status", { icon: this.partialSuccess ? 'exclamation-mark' : 'checkmark-alt', description: this.totalFiles > 1
792
- ? this.partialSuccess
793
- ? `${i18next.t('printer_selection.print_success')} (${this.successfulFiles.length}/${this.totalFiles} ${i18next.t('printer_selection.files')} - ${this.failedFiles.length} failed`
794
- : `${i18next.t('printer_selection.print_success')} (${this.totalFiles} ${i18next.t('printer_selection.files')})`
795
- : i18next.t('printer_selection.print_success'), instance: "print-success", close: true })) : this.printFailed ? (h("ezp-status", { icon: "exclamation-mark", description: i18next.t('printer_selection.print_failed'), instance: "print-failed", close: true, retry: true })) : this.notSupported ? (h("ezp-status", { icon: "exclamation-mark", description: i18next.t('printer_selection.not_supported'), instance: "not-supported", retry: true })) : this.hubDriverError ? (h("ezp-status", { icon: "exclamation-mark", description: i18next.t('printer_selection.print_failed'), instance: "hub-driver-error", close: true, retry: true })) : this.noPrinters ? (h("ezp-status", { icon: "exclamation-mark", description: i18next.t('printer_selection.no_printers'), instance: "no-printers", close: true })) : null)), !this.hideheader && (h("div", { id: "header" }, h("ezp-label", { weight: "heavy", text: i18next.t('printer_selection.print') + `${!this.notSupported ? ':' : ''}` }), h("ezp-label", { text: !this.notSupported
677
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
678
+ return this.loading ? (h("ezp-status", { processing: true, description: i18next.t('printer_selection.loading'), instance: "loading" })) : (h(Host, { class: { seamless: this.seamless } }, h("div", { id: "box", "data-backdrop-surface": true }, !this.printStopped && this.renderStatus(), !this.hideheader && (h("div", { id: "header" }, h("ezp-label", { weight: "heavy", text: i18next.t('printer_selection.print') + `${!this.notSupported ? ':' : ''}` }), h("ezp-label", { text: !this.notSupported
796
679
  ? this.files && this.files.length > 1
797
680
  ? i18next.t('printer_selection.files_selected', { count: this.files.length })
798
681
  : this.filename
@@ -832,31 +715,31 @@ export class EzpPrinterSelection {
832
715
  })), preSelected: this.selectedPrinter.id &&
833
716
  ((_g = this.selectedPrinterConfig.PaperFormats) === null || _g === void 0 ? void 0 : _g.find((el) => { var _a; return el.Name.includes((_a = this.selectedPrinterConfig.Default) === null || _a === void 0 ? void 0 : _a.Paper); }))
834
717
  ? (_h = this.selectedPrinterConfig.Default) === null || _h === void 0 ? void 0 : _h.Paper
835
- : null, disabled: !(((_j = this.selectedPrinterConfig.PaperFormats) === null || _j === void 0 ? void 0 : _j.length) > 0) }), this.paperid == PAPER_ID ? (h(Fragment, null, h("ezp-input", { icon: "width", suffix: "mm", value: this.selectedProperties.paperwidth, eventType: "width", type: "number", label: i18next.t('printer_selection.width') }), h("ezp-input", { icon: "height", suffix: "mm", value: this.selectedProperties.paperlength, eventType: "length", type: "number", label: i18next.t('printer_selection.length') }))) : null, h("ezp-select", { label: i18next.t('printer_selection.orientation'), icon: "orientation", placeholder: i18next.t('printer_selection.select_orientation'), toggleFlow: "horizontal", options: this.selectedPrinterConfig.OrientationsSupported.map((orientation, index) => ({
718
+ : null, disabled: !(((_k = (_j = this.selectedPrinterConfig.PaperFormats) === null || _j === void 0 ? void 0 : _j.length) !== null && _k !== void 0 ? _k : 0) > 0) }), this.paperid == PAPER_ID ? (h(Fragment, null, h("ezp-input", { icon: "width", suffix: "mm", value: this.selectedProperties.paperwidth, eventType: "width", type: "number", label: i18next.t('printer_selection.width') }), h("ezp-input", { icon: "height", suffix: "mm", value: this.selectedProperties.paperlength, eventType: "length", type: "number", label: i18next.t('printer_selection.length') }))) : null, h("ezp-select", { label: i18next.t('printer_selection.orientation'), icon: "orientation", placeholder: i18next.t('printer_selection.select_orientation'), toggleFlow: "horizontal", options: (_l = this.selectedPrinterConfig.OrientationsSupported) === null || _l === void 0 ? void 0 : _l.map((orientation, index) => ({
836
719
  id: index + 1,
837
720
  title: i18next.t(`printer_selection.orientation_${orientation}`),
838
721
  meta: '',
839
722
  type: 'orientation',
840
- })), preSelected: this.selectedPrinter.id ? this.selectedProperties.orientation : null, disabled: !(this.selectedPrinterConfig.OrientationsSupported.length > 0) }), h("ezp-select", { label: i18next.t('printer_selection.quality'), icon: "quality", placeholder: i18next.t('printer_selection.select_quality'), toggleFlow: "horizontal", options: (_k = this.selectedPrinterConfig.Resolutions) === null || _k === void 0 ? void 0 : _k.map((option, index) => ({
723
+ })), preSelected: this.selectedPrinter.id ? this.selectedProperties.orientation : null, disabled: !(((_o = (_m = this.selectedPrinterConfig.OrientationsSupported) === null || _m === void 0 ? void 0 : _m.length) !== null && _o !== void 0 ? _o : 0) > 0) }), h("ezp-select", { label: i18next.t('printer_selection.quality'), icon: "quality", placeholder: i18next.t('printer_selection.select_quality'), toggleFlow: "horizontal", options: (_p = this.selectedPrinterConfig.Resolutions) === null || _p === void 0 ? void 0 : _p.map((option, index) => ({
841
724
  id: index,
842
725
  title: option,
843
726
  meta: '',
844
727
  type: 'quality',
845
728
  })), preSelected: this.selectedPrinter.id &&
846
- ((_l = this.selectedPrinterConfig.Resolutions) === null || _l === void 0 ? void 0 : _l.includes(this.selectedPrinterConfig.Default.Resolution))
847
- ? this.selectedPrinterConfig.Default.Resolution
848
- : null, disabled: !(((_m = this.selectedPrinterConfig.Resolutions) === null || _m === void 0 ? void 0 : _m.length) > 0) }), this.selectedPrinterConfig.Trays &&
729
+ ((_q = this.selectedPrinterConfig.Resolutions) === null || _q === void 0 ? void 0 : _q.includes((_r = this.selectedPrinterConfig.Default) === null || _r === void 0 ? void 0 : _r.Resolution))
730
+ ? (_s = this.selectedPrinterConfig.Default) === null || _s === void 0 ? void 0 : _s.Resolution
731
+ : null, disabled: !(((_u = (_t = this.selectedPrinterConfig.Resolutions) === null || _t === void 0 ? void 0 : _t.length) !== null && _u !== void 0 ? _u : 0) > 0) }), this.selectedPrinterConfig.Trays &&
849
732
  this.selectedPrinterConfig.Trays.length >= 1 &&
850
- this.selectedPrinterConfig.Trays[0] != null ? (h("ezp-select", { label: i18next.t('printer_selection.trays'), icon: "trays", placeholder: i18next.t('printer_selection.select_trays'), toggleFlow: "horizontal", optionFlow: "horizontal", options: this.selectedPrinterConfig.Trays &&
851
- this.selectedPrinterConfig.Trays.length >= 1 &&
852
- this.selectedPrinterConfig.Trays.map((trays) => ({
733
+ this.selectedPrinterConfig.Trays[0] != null ? (h("ezp-select", { label: i18next.t('printer_selection.trays'), icon: "trays", placeholder: i18next.t('printer_selection.select_trays'), toggleFlow: "horizontal", optionFlow: "horizontal", options: this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 1
734
+ ? this.selectedPrinterConfig.Trays.map((trays) => ({
853
735
  title: trays.Name,
854
736
  id: trays.Index,
855
737
  meta: '',
856
738
  type: 'tray',
857
- })), preSelected: this.selectedPrinter.id &&
858
- ((_o = this.selectedPrinterConfig.Trays) === null || _o === void 0 ? void 0 : _o.find((el) => el.Name.includes(this.selectedPrinterConfig.Default.Tray)))
859
- ? this.selectedPrinterConfig.Default.Tray
739
+ }))
740
+ : undefined, preSelected: this.selectedPrinter.id &&
741
+ ((_v = this.selectedPrinterConfig.Trays) === null || _v === void 0 ? void 0 : _v.find((el) => { var _a; return el.Name.includes((_a = this.selectedPrinterConfig.Default) === null || _a === void 0 ? void 0 : _a.Tray); }))
742
+ ? (_w = this.selectedPrinterConfig.Default) === null || _w === void 0 ? void 0 : _w.Tray
860
743
  : null })) : null, h("ezp-input", { icon: "paper_range", suffix: "", placeholder: "1-2,4-5,8", value: this.selectedProperties.PageRanges, eventType: "paper_ranges", type: "text", label: i18next.t('printer_selection.page_ranges') })), h("ezp-stepper", { label: i18next.t('printer_selection.copies'), icon: "copies" })), h("div", { id: "footer" }, h("ezp-text-button", { type: "button", level: "secondary", onClick: this.handleCancel, label: i18next.t('button_actions.cancel'), class: "action", id: "cancel" }), h("ezp-text-button", { disabled: this.selectedPrinter.id === '' || this.printProcessing || this.pageRangeInvalid, type: "button", onClick: this.handlePrint, label: i18next.t('button_actions.print'), ref: (button) => (this.printButton = button), class: "action", id: "print" })), !this.hidemenu && h("ezp-user-menu", { open: this.userMenuOpen, name: this.userName }))));
861
744
  }
862
745
  static get is() { return "ezp-printer-selection"; }
@@ -1079,6 +962,7 @@ export class EzpPrinterSelection {
1079
962
  "preparingUpload": {},
1080
963
  "printSuccess": {},
1081
964
  "printFailed": {},
965
+ "printTimedOut": {},
1082
966
  "notSupported": {},
1083
967
  "noPrinters": {},
1084
968
  "hubDriverError": {},