@ezeep/ezeep-js 1.0.237 → 1.0.239

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 (29) hide show
  1. package/dist/cjs/ezeep.cjs.js +1 -1
  2. package/dist/cjs/ezp-auth_15.cjs.entry.js +265 -109
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/collection/components/ezp-printer-selection/ezp-printer-selection.js +249 -95
  5. package/dist/collection/components/ezp-printing/ezp-printing.js +6 -5
  6. package/dist/collection/components/ezp-upload/ezp-upload.js +13 -11
  7. package/dist/custom-elements/index.js +268 -112
  8. package/dist/directives/proxies.ts +2 -2
  9. package/dist/esm/ezeep.js +1 -1
  10. package/dist/esm/ezp-auth_15.entry.js +265 -109
  11. package/dist/esm/loader.js +1 -1
  12. package/dist/esm-es5/ezeep.js +1 -1
  13. package/dist/esm-es5/ezp-auth_15.entry.js +3 -3
  14. package/dist/esm-es5/loader.js +1 -1
  15. package/dist/ezeep/ezeep.esm.js +1 -1
  16. package/dist/ezeep/{p-62b9b554.system.entry.js → p-0afb1821.system.entry.js} +3 -3
  17. package/dist/ezeep/{p-7b589922.entry.js → p-69fc0c9c.entry.js} +2 -2
  18. package/dist/ezeep/p-84bd195a.system.js +1 -1
  19. package/dist/types/components/ezp-printer-selection/ezp-printer-selection.d.ts +11 -3
  20. package/dist/types/components/ezp-printing/ezp-printing.d.ts +1 -1
  21. package/dist/types/components/ezp-upload/ezp-upload.d.ts +1 -1
  22. package/dist/types/components.d.ts +2 -2
  23. package/package.json +1 -1
  24. package/www/build/ezeep.esm.js +1 -1
  25. package/www/build/{p-62b9b554.system.entry.js → p-0afb1821.system.entry.js} +3 -3
  26. package/www/build/{p-7b589922.entry.js → p-69fc0c9c.entry.js} +2 -2
  27. package/www/build/p-84bd195a.system.js +1 -1
  28. package/www/data/locales/de.json +8 -6
  29. package/www/data/locales/en.json +8 -6
@@ -16,7 +16,7 @@ const defineCustomElements = (win, options) => {
16
16
  if (typeof window === 'undefined') return Promise.resolve();
17
17
  return patchEsm().then(() => {
18
18
  appGlobals.globalScripts();
19
- return index.bootstrapLazy([["ezp-auth_15.cjs",[[1,"ezp-printing",{"clientid":[1],"redirecturi":[1],"filename":[1025],"fileurl":[1],"filetype":[1],"custom":[4],"hidelogin":[4],"hidemenu":[4],"hideheader":[4],"authapihosturl":[1],"printapihosturl":[1],"theme":[1],"fileid":[1],"appearance":[1],"trigger":[1],"language":[1],"code":[1],"filedata":[1],"seamless":[4],"printOpen":[32],"authOpen":[32],"onlyGetSasUri":[32],"noDocumentOpen":[32],"systemAppearance":[32],"file":[32],"open":[64],"logOut":[64],"getSasUri":[64],"getAuthUri":[64],"checkAuth":[64]},[[0,"printCancel","listenPrintCancel"],[0,"printSubmit","listenPrintSubmit"],[0,"authCancel","listenAuthCancel"],[0,"authSuccess","listenAuthSuccess"],[0,"uploadFile","listenUploadFile"],[0,"dialogClose","listenDialogClose"],[0,"dialogAction","listenDialogAction"],[0,"logout","listenLogout"]]],[1,"ezp-printer-selection",{"clientID":[1,"client-i-d"],"redirectURI":[1,"redirect-u-r-i"],"filename":[1025],"fileurl":[1],"filetype":[1025],"fileid":[1025],"file":[16],"hidemenu":[4],"hideheader":[4],"seamless":[4],"loading":[32],"printProcessing":[32],"pageRangeInvalid":[32],"uploading":[32],"preparingUpload":[32],"printSuccess":[32],"printFailed":[32],"notSupported":[32],"noPrinters":[32],"userMenuOpen":[32],"printStopped":[32],"userName":[32],"printers":[32],"selectedPrinter":[32],"printerConfig":[32],"selectedPrinterConfig":[32],"selectedProperties":[32],"paperid":[32]},[[0,"inputValueChanged","listenInputValueChanged"],[0,"selectSelection","listenSelectSelection"],[0,"stepperChanged","listenStepperChanged"],[0,"userMenuClosure","listenUserMenuClosure"],[0,"logoutEmitter","listenLogout"],[0,"statusCancel","listenStatusCancel"],[0,"statusClose","listenStatusClose"],[0,"statusRetry","listenStatusRetry"]]],[1,"ezp-auth",{"clientID":[1025,"client-i-d"],"redirectURI":[1025,"redirect-u-r-i"],"hidelogin":[4],"trigger":[1],"code":[1],"auth":[32],"authURI":[32],"accessToken":[32]},[[0,"dialogAction","listenDialogAction"],[0,"dialogClose","listenDialogClose"],[0,"statusCancel","listenStatusCancel"]]],[1,"ezp-upload",{"filename":[32],"dragging":[32]},[[1,"dragenter","handleDragEnter"],[0,"dragover","handleDragOver"],[1,"dragleave","handleDragLeave"],[0,"drop","handleDrop"],[4,"printCancel","listenPrintCancel"]]],[1,"ezp-dialog",{"heading":[1],"description":[1],"action":[1],"iconName":[1,"icon-name"],"iconSize":[1,"icon-size"],"iconFramed":[4,"icon-framed"],"instance":[1]}],[1,"ezp-user-menu",{"name":[1],"open":[1028]}],[1,"ezp-select",{"icon":[1],"label":[1],"optionFlow":[1,"option-flow"],"options":[16],"placeholder":[1],"preSelected":[8,"pre-selected"],"toggleFlow":[1,"toggle-flow"],"disabled":[4],"expanded":[32],"selected":[32]}],[1,"ezp-input",{"label":[1],"value":[1032],"type":[1],"icon":[1],"suffix":[513],"eventType":[1,"event-type"],"placeholder":[1],"focused":[32]}],[1,"ezp-stepper",{"icon":[1],"label":[1],"max":[2],"min":[2],"canDecrease":[32],"canIncrease":[32],"focused":[32],"value":[32]}],[1,"ezp-status",{"description":[1],"processing":[4],"instance":[1],"icon":[1],"cancel":[8],"close":[8],"retry":[8]}],[1,"ezp-backdrop",{"visible":[1028]},[[0,"animationend","listenAnimationEnd"]]],[1,"ezp-icon-button",{"blank":[4],"disabled":[4],"href":[1],"icon":[1],"level":[1],"type":[1]}],[1,"ezp-text-button",{"blank":[4],"disabled":[4],"href":[1],"level":[1],"label":[1],"type":[1],"small":[4]}],[1,"ezp-icon",{"name":[1],"size":[1],"framed":[4]}],[1,"ezp-label",{"ellipsis":[4],"level":[1],"noWrap":[4,"no-wrap"],"text":[1],"weight":[1]}]]]], options);
19
+ return index.bootstrapLazy([["ezp-auth_15.cjs",[[1,"ezp-printing",{"clientid":[1],"redirecturi":[1],"filename":[1025],"fileurl":[1],"filetype":[1],"custom":[4],"hidelogin":[4],"hidemenu":[4],"hideheader":[4],"authapihosturl":[1],"printapihosturl":[1],"theme":[1],"fileid":[1],"appearance":[1],"trigger":[1],"language":[1],"code":[1],"filedata":[1],"seamless":[4],"printOpen":[32],"authOpen":[32],"onlyGetSasUri":[32],"noDocumentOpen":[32],"systemAppearance":[32],"files":[32],"open":[64],"logOut":[64],"getSasUri":[64],"getAuthUri":[64],"checkAuth":[64]},[[0,"printCancel","listenPrintCancel"],[0,"printSubmit","listenPrintSubmit"],[0,"authCancel","listenAuthCancel"],[0,"authSuccess","listenAuthSuccess"],[0,"uploadFile","listenUploadFile"],[0,"dialogClose","listenDialogClose"],[0,"dialogAction","listenDialogAction"],[0,"logout","listenLogout"]]],[1,"ezp-printer-selection",{"clientID":[1,"client-i-d"],"redirectURI":[1,"redirect-u-r-i"],"filename":[1025],"fileurl":[1],"filetype":[1025],"fileid":[1025],"files":[16],"hidemenu":[4],"hideheader":[4],"seamless":[4],"loading":[32],"printProcessing":[32],"pageRangeInvalid":[32],"uploading":[32],"preparingUpload":[32],"printSuccess":[32],"printFailed":[32],"notSupported":[32],"noPrinters":[32],"userMenuOpen":[32],"printStopped":[32],"userName":[32],"printers":[32],"selectedPrinter":[32],"printerConfig":[32],"selectedPrinterConfig":[32],"selectedProperties":[32],"paperid":[32],"currentFileIndex":[32],"totalFiles":[32],"failedFiles":[32],"successfulFiles":[32],"partialSuccess":[32]},[[0,"inputValueChanged","listenInputValueChanged"],[0,"selectSelection","listenSelectSelection"],[0,"stepperChanged","listenStepperChanged"],[0,"userMenuClosure","listenUserMenuClosure"],[0,"logoutEmitter","listenLogout"],[0,"statusCancel","listenStatusCancel"],[0,"statusClose","listenStatusClose"],[0,"statusRetry","listenStatusRetry"]]],[1,"ezp-auth",{"clientID":[1025,"client-i-d"],"redirectURI":[1025,"redirect-u-r-i"],"hidelogin":[4],"trigger":[1],"code":[1],"auth":[32],"authURI":[32],"accessToken":[32]},[[0,"dialogAction","listenDialogAction"],[0,"dialogClose","listenDialogClose"],[0,"statusCancel","listenStatusCancel"]]],[1,"ezp-upload",{"selectedFiles":[32],"dragging":[32]},[[1,"dragenter","handleDragEnter"],[0,"dragover","handleDragOver"],[1,"dragleave","handleDragLeave"],[0,"drop","handleDrop"],[4,"printCancel","listenPrintCancel"]]],[1,"ezp-dialog",{"heading":[1],"description":[1],"action":[1],"iconName":[1,"icon-name"],"iconSize":[1,"icon-size"],"iconFramed":[4,"icon-framed"],"instance":[1]}],[1,"ezp-user-menu",{"name":[1],"open":[1028]}],[1,"ezp-select",{"icon":[1],"label":[1],"optionFlow":[1,"option-flow"],"options":[16],"placeholder":[1],"preSelected":[8,"pre-selected"],"toggleFlow":[1,"toggle-flow"],"disabled":[4],"expanded":[32],"selected":[32]}],[1,"ezp-input",{"label":[1],"value":[1032],"type":[1],"icon":[1],"suffix":[513],"eventType":[1,"event-type"],"placeholder":[1],"focused":[32]}],[1,"ezp-stepper",{"icon":[1],"label":[1],"max":[2],"min":[2],"canDecrease":[32],"canIncrease":[32],"focused":[32],"value":[32]}],[1,"ezp-status",{"description":[1],"processing":[4],"instance":[1],"icon":[1],"cancel":[8],"close":[8],"retry":[8]}],[1,"ezp-backdrop",{"visible":[1028]},[[0,"animationend","listenAnimationEnd"]]],[1,"ezp-icon-button",{"blank":[4],"disabled":[4],"href":[1],"icon":[1],"level":[1],"type":[1]}],[1,"ezp-text-button",{"blank":[4],"disabled":[4],"href":[1],"level":[1],"label":[1],"type":[1],"small":[4]}],[1,"ezp-icon",{"name":[1],"size":[1],"framed":[4]}],[1,"ezp-label",{"ellipsis":[4],"level":[1],"noWrap":[4,"no-wrap"],"text":[1],"weight":[1]}]]]], options);
20
20
  });
21
21
  };
22
22
 
@@ -7,7 +7,6 @@ import { managePaperDimensions, poll, removeEmptyStrings } from '../../utils/uti
7
7
  import { PAPER_ID, validatePageRange, formatPageRange } from '../../utils/utils';
8
8
  export class EzpPrinterSelection {
9
9
  constructor() {
10
- this.sasUri = '';
11
10
  this.fileExtension = '';
12
11
  this.duplexOptions = [
13
12
  {
@@ -31,7 +30,7 @@ export class EzpPrinterSelection {
31
30
  {
32
31
  id: 2,
33
32
  title: i18next.t('printer_selection.color_grayscale'),
34
- }
33
+ },
35
34
  ];
36
35
  this.hidemenu = false;
37
36
  this.hideheader = false;
@@ -58,14 +57,14 @@ export class EzpPrinterSelection {
58
57
  Paper: '',
59
58
  Orientation: '',
60
59
  Resolution: '',
61
- Tray: ''
60
+ Tray: '',
62
61
  },
63
62
  OrientationsSupported: [],
64
63
  PaperFormats: [],
65
64
  Resolutions: [],
66
65
  DuplexSupported: false,
67
66
  Color: false,
68
- Trays: []
67
+ Trays: [],
69
68
  };
70
69
  // needs to be initialised with empty strings
71
70
  this.selectedProperties = {
@@ -83,6 +82,11 @@ export class EzpPrinterSelection {
83
82
  trayname: '',
84
83
  PageRanges: '',
85
84
  };
85
+ this.currentFileIndex = 0;
86
+ this.totalFiles = 0;
87
+ this.failedFiles = [];
88
+ this.successfulFiles = [];
89
+ this.partialSuccess = false;
86
90
  /**
87
91
  *
88
92
  * Private methods
@@ -90,6 +94,9 @@ export class EzpPrinterSelection {
90
94
  */
91
95
  /** Description... */
92
96
  this.handleCancel = () => {
97
+ this.failedFiles = [];
98
+ this.successfulFiles = [];
99
+ this.partialSuccess = false;
93
100
  this.printCancel.emit();
94
101
  };
95
102
  this.validateData = (data) => {
@@ -106,9 +113,14 @@ export class EzpPrinterSelection {
106
113
  this.handlePrint = async () => {
107
114
  this.printButton.blur();
108
115
  this.printProcessing = true;
116
+ this.failedFiles = [];
117
+ this.successfulFiles = [];
118
+ this.partialSuccess = false;
109
119
  // we have to initialse this obj with empty strings to display the select component
110
120
  // but don't want to send any attributes with empty strings to the API
111
- if (this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 0 && this.selectedPrinterConfig.Trays[0] == null) {
121
+ if (this.selectedPrinterConfig.Trays &&
122
+ this.selectedPrinterConfig.Trays.length >= 0 &&
123
+ this.selectedPrinterConfig.Trays[0] == null) {
112
124
  delete this.selectedProperties.trayname;
113
125
  delete this.selectedProperties.defaultSource;
114
126
  }
@@ -168,8 +180,11 @@ export class EzpPrinterSelection {
168
180
  this.printProcessing = false;
169
181
  });
170
182
  }
171
- if (this.file) {
172
- await this.handleFiles(this.file, cleanPrintProperties);
183
+ if (this.files && this.files.length > 1) {
184
+ await this.processMultipleFiles(this.files, cleanPrintProperties);
185
+ }
186
+ else if (this.files && this.files.length === 1) {
187
+ await this.processSingleFile(this.files[0], cleanPrintProperties);
173
188
  }
174
189
  localStorage.setItem('properties', JSON.stringify(this.selectedProperties));
175
190
  localStorage.setItem('printer', JSON.stringify(this.selectedPrinter));
@@ -217,11 +232,16 @@ export class EzpPrinterSelection {
217
232
  switch (event.detail) {
218
233
  case 'print-success':
219
234
  this.printSuccess = false;
235
+ this.partialSuccess = false;
236
+ this.failedFiles = [];
237
+ this.successfulFiles = [];
220
238
  this.printCancel.emit();
221
239
  break;
222
240
  case 'print-failed':
223
241
  this.printProcessing = false;
224
242
  this.printFailed = false;
243
+ this.failedFiles = [];
244
+ this.successfulFiles = [];
225
245
  break;
226
246
  case 'no-printers':
227
247
  this.noPrinters = false;
@@ -281,18 +301,23 @@ export class EzpPrinterSelection {
281
301
  .then((data) => {
282
302
  var _a, _b, _c, _d, _e, _f, _g;
283
303
  this.selectedPrinterConfig = Object.assign(Object.assign({}, this.selectedPrinterConfig), data[0]);
284
- this.selectedProperties.color = ((_a = this.selectedPrinterConfig.Default) === null || _a === void 0 ? void 0 : _a.Color) == "color" ? true : false;
304
+ this.selectedProperties.color =
305
+ ((_a = this.selectedPrinterConfig.Default) === null || _a === void 0 ? void 0 : _a.Color) == 'color' ? true : false;
285
306
  this.selectedProperties.orientation = (_b = this.selectedPrinterConfig.Default) === null || _b === void 0 ? void 0 : _b.Orientation;
286
307
  this.selectedProperties.resolution = (_c = this.selectedPrinterConfig.Default) === null || _c === void 0 ? void 0 : _c.Resolution;
287
- let defaultPaper = (_d = this.selectedPrinterConfig.PaperFormats) === null || _d === void 0 ? void 0 : _d.find(obj => obj.Default === true);
308
+ let defaultPaper = (_d = this.selectedPrinterConfig.PaperFormats) === null || _d === void 0 ? void 0 : _d.find((obj) => obj.Default === true);
288
309
  this.selectedProperties.paper = defaultPaper === null || defaultPaper === void 0 ? void 0 : defaultPaper.Name;
289
310
  this.selectedProperties.paperid = defaultPaper === null || defaultPaper === void 0 ? void 0 : defaultPaper.Id;
290
- let defaultSource = (_e = this.selectedPrinterConfig.Trays) === null || _e === void 0 ? void 0 : _e.find(obj => obj.Default === true);
291
- if (this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 1 && this.selectedPrinterConfig.Trays[0] != null) {
311
+ let defaultSource = (_e = this.selectedPrinterConfig.Trays) === null || _e === void 0 ? void 0 : _e.find((obj) => obj.Default === true);
312
+ if (this.selectedPrinterConfig.Trays &&
313
+ this.selectedPrinterConfig.Trays.length >= 1 &&
314
+ this.selectedPrinterConfig.Trays[0] != null) {
292
315
  this.selectedProperties.trayname = defaultSource === null || defaultSource === void 0 ? void 0 : defaultSource.Name;
293
316
  this.selectedProperties.defaultSource = defaultSource === null || defaultSource === void 0 ? void 0 : defaultSource.Index;
294
317
  }
295
- if (this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 0 && this.selectedPrinterConfig.Trays[0] == null) {
318
+ if (this.selectedPrinterConfig.Trays &&
319
+ this.selectedPrinterConfig.Trays.length >= 0 &&
320
+ this.selectedPrinterConfig.Trays[0] == null) {
296
321
  delete this.selectedProperties.trayname;
297
322
  delete this.selectedProperties.defaultSource;
298
323
  }
@@ -303,7 +328,8 @@ export class EzpPrinterSelection {
303
328
  // this.setDefaultPaperFormat()
304
329
  break;
305
330
  case 'color':
306
- this.selectedProperties.color = eventDetails.title == i18next.t('printer_selection.color_color') ? true : false;
331
+ this.selectedProperties.color =
332
+ eventDetails.title == i18next.t('printer_selection.color_color') ? true : false;
307
333
  break;
308
334
  case 'orientation':
309
335
  this.selectedProperties.orientation = eventDetails.id;
@@ -322,11 +348,15 @@ export class EzpPrinterSelection {
322
348
  this.selectedProperties.paperwidth = eventDetails.value;
323
349
  break;
324
350
  case 'tray':
325
- if (this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 0 && this.selectedPrinterConfig.Trays[0] == null) {
351
+ if (this.selectedPrinterConfig.Trays &&
352
+ this.selectedPrinterConfig.Trays.length >= 0 &&
353
+ this.selectedPrinterConfig.Trays[0] == null) {
326
354
  delete this.selectedProperties.trayname;
327
355
  delete this.selectedProperties.defaultSource;
328
356
  }
329
- if (this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 1 && this.selectedPrinterConfig.Trays[0] != null) {
357
+ if (this.selectedPrinterConfig.Trays &&
358
+ this.selectedPrinterConfig.Trays.length >= 1 &&
359
+ this.selectedPrinterConfig.Trays[0] != null) {
330
360
  this.selectedProperties.trayname = eventDetails.title;
331
361
  this.selectedProperties.defaultSource = eventDetails.id;
332
362
  }
@@ -336,9 +366,9 @@ export class EzpPrinterSelection {
336
366
  this.pageRangeInvalid = !validatePageRange(this.selectedProperties.PageRanges);
337
367
  break;
338
368
  case 'duplex':
339
- if (eventDetails.title == i18next.t('printer_selection.duplex_none')
340
- || eventDetails.title == i18next.t('printer_selection.duplex_long')
341
- || eventDetails.title == i18next.t('printer_selection.duplex_short')) {
369
+ if (eventDetails.title == i18next.t('printer_selection.duplex_none') ||
370
+ eventDetails.title == i18next.t('printer_selection.duplex_long') ||
371
+ eventDetails.title == i18next.t('printer_selection.duplex_short')) {
342
372
  this.selectedProperties.duplex = true;
343
373
  }
344
374
  else {
@@ -351,59 +381,114 @@ export class EzpPrinterSelection {
351
381
  }
352
382
  this.setPaperid();
353
383
  }
354
- async handleFiles(file, printPorperties) {
384
+ async handleFiles(files, printPorperties) {
385
+ this.totalFiles = files.length;
386
+ this.currentFileIndex = 0;
387
+ this.failedFiles = [];
388
+ this.successfulFiles = [];
389
+ // Process each file individually
390
+ for (let i = 0; i < files.length; i++) {
391
+ this.currentFileIndex = i;
392
+ const file = files[i];
393
+ try {
394
+ await this.processSingleFile(file, printPorperties);
395
+ this.successfulFiles.push(file.name);
396
+ }
397
+ catch (error) {
398
+ console.error(`Error processing file ${file.name}:`, error);
399
+ this.failedFiles.push(file.name);
400
+ // Continue with the next file instead of stopping
401
+ }
402
+ }
403
+ // Determine final status based on results
404
+ if (this.failedFiles.length === 0) {
405
+ // All files processed successfully
406
+ this.printSuccess = true;
407
+ this.partialSuccess = false;
408
+ this.printProcessing = false;
409
+ }
410
+ else if (this.successfulFiles.length === 0) {
411
+ // All files failed
412
+ this.printFailed = true;
413
+ this.partialSuccess = false;
414
+ this.printProcessing = false;
415
+ }
416
+ else {
417
+ // Some files succeeded, some failed - show partial success
418
+ this.printSuccess = true;
419
+ this.partialSuccess = true;
420
+ this.printProcessing = false;
421
+ }
422
+ }
423
+ async processSingleFile(file, printProperties) {
355
424
  this.preparingUpload = true;
356
425
  const response = await this.printService.prepareFileUpload(authStore.state.accessToken);
357
426
  this.preparingUpload = false;
358
- this.fileid = response.fileid;
359
- this.sasUri = response.sasUri;
360
- this.filetype = this.fileExtension;
361
- let res;
427
+ const fileid = response.fileid;
428
+ const sasUri = response.sasUri;
429
+ const filetype = this.getFileExtension(file.name);
362
430
  this.uploading = true;
363
431
  try {
364
- res = await this.printService.uploadBlobFiles(this.sasUri, file);
365
- }
366
- catch (error) {
367
- this.printProcessing = false;
368
- this.printFailed = true;
369
- }
370
- this.uploading = false;
371
- if (res._response.status === 201) {
372
- this.printService
373
- .printByFileID(authStore.state.accessToken, this.fileid, this.filetype, this.selectedPrinter.id, printPorperties, this.filename)
374
- .then((data) => {
432
+ // Upload the file
433
+ const res = await this.printService.uploadBlobFiles(sasUri, file);
434
+ if (res._response.status === 201) {
435
+ // Print the file
436
+ const data = await this.printService.printByFileID(authStore.state.accessToken, fileid, filetype, this.selectedPrinter.id, printProperties, file.name);
375
437
  if (data.code === 804) {
376
- this.printFailed = true;
377
- this.printProcessing = false;
438
+ throw new Error(`Print failed for file: ${file.name}`);
378
439
  }
379
440
  if (data.jobid) {
380
441
  printStore.state.jobID = data.jobid;
381
- poll({
382
- fn: this.printService.getPrintStatus,
383
- validate: this.validateData,
384
- interval: this.POLL_INTERVAL,
385
- maxAttempts: this.MAX_POLL_ATTEMPTS,
386
- }).catch((err) => {
387
- console.log(err);
388
- this.printFailed = true;
389
- this.printProcessing = false;
390
- });
442
+ // Wait for this print job to complete before processing the next file
443
+ await this.waitForPrintCompletion();
391
444
  }
392
445
  else {
393
- this.printFailed = true;
394
- this.printProcessing = false;
446
+ throw new Error(`No job ID returned for file: ${file.name}`);
395
447
  }
396
- })
397
- .catch((error) => {
398
- console.log(error);
399
- this.printFailed = true;
400
- this.printProcessing = false;
401
- });
448
+ }
449
+ else {
450
+ throw new Error(`Upload failed for file: ${file.name}`);
451
+ }
402
452
  }
403
- else {
404
- this.printFailed = true;
405
- this.printProcessing = false;
453
+ catch (error) {
454
+ this.uploading = false;
455
+ throw error;
406
456
  }
457
+ this.uploading = false;
458
+ }
459
+ async waitForPrintCompletion() {
460
+ return new Promise((resolve, reject) => {
461
+ const poll = async () => {
462
+ try {
463
+ const data = await this.printService.getPrintStatus();
464
+ console.log('[waitForPrintCompletion] Poll response:', data);
465
+ if (data.jobstatus === 0) {
466
+ // Success
467
+ resolve();
468
+ }
469
+ else if (data.jobstatus === 1246 || data.jobstatus === 129) {
470
+ // Still processing, keep polling
471
+ setTimeout(poll, this.POLL_INTERVAL);
472
+ }
473
+ else if (data.jobstatus === 3011 || data.jobstatus === 2) {
474
+ // Failure
475
+ reject(new Error('Print job failed: ' + (data.jobstatusstring || data.jobstatus)));
476
+ }
477
+ else {
478
+ // Unknown status, treat as failure for safety
479
+ reject(new Error('Unknown print job status: ' + data.jobstatus));
480
+ }
481
+ }
482
+ catch (error) {
483
+ reject(error);
484
+ }
485
+ };
486
+ poll();
487
+ });
488
+ }
489
+ getFileExtension(filename) {
490
+ const extension = filename.split('.').pop();
491
+ return extension ? extension.toLowerCase() : '';
407
492
  }
408
493
  setDefaultPaperFormat() {
409
494
  var _a, _b, _c, _d, _e;
@@ -428,6 +513,41 @@ export class EzpPrinterSelection {
428
513
  }
429
514
  this.setPaperid();
430
515
  }
516
+ async processMultipleFiles(files, printProperties) {
517
+ this.totalFiles = files.length;
518
+ this.currentFileIndex = 0;
519
+ this.failedFiles = [];
520
+ this.successfulFiles = [];
521
+ for (let i = 0; i < files.length; i++) {
522
+ this.currentFileIndex = i;
523
+ const file = files[i];
524
+ try {
525
+ await this.processSingleFile(file, printProperties);
526
+ this.successfulFiles.push(file.name);
527
+ }
528
+ catch (error) {
529
+ console.error(`Error processing file ${file.name}:`, error);
530
+ this.failedFiles.push(file.name);
531
+ // Continue with the next file
532
+ }
533
+ }
534
+ // Set UI state
535
+ if (this.failedFiles.length === 0) {
536
+ this.printSuccess = true;
537
+ this.partialSuccess = false;
538
+ this.printProcessing = false;
539
+ }
540
+ else if (this.successfulFiles.length === 0) {
541
+ this.printFailed = true;
542
+ this.partialSuccess = false;
543
+ this.printProcessing = false;
544
+ }
545
+ else {
546
+ this.printSuccess = true;
547
+ this.partialSuccess = true;
548
+ this.printProcessing = false;
549
+ }
550
+ }
431
551
  /**
432
552
  *
433
553
  * Lifecycle methods
@@ -454,18 +574,23 @@ export class EzpPrinterSelection {
454
574
  .then((data) => {
455
575
  var _a, _b, _c, _d, _e, _f, _g;
456
576
  this.selectedPrinterConfig = data[0];
457
- this.selectedProperties.color = ((_a = this.selectedPrinterConfig.Default) === null || _a === void 0 ? void 0 : _a.Color) == "color" ? true : false;
577
+ this.selectedProperties.color =
578
+ ((_a = this.selectedPrinterConfig.Default) === null || _a === void 0 ? void 0 : _a.Color) == 'color' ? true : false;
458
579
  this.selectedProperties.orientation = (_b = this.selectedPrinterConfig.Default) === null || _b === void 0 ? void 0 : _b.Orientation;
459
580
  this.selectedProperties.resolution = (_c = this.selectedPrinterConfig.Default) === null || _c === void 0 ? void 0 : _c.Resolution;
460
- let defaultPaper = (_d = this.selectedPrinterConfig.PaperFormats) === null || _d === void 0 ? void 0 : _d.find(obj => obj.Default === true);
581
+ let defaultPaper = (_d = this.selectedPrinterConfig.PaperFormats) === null || _d === void 0 ? void 0 : _d.find((obj) => obj.Default === true);
461
582
  this.selectedProperties.paper = defaultPaper === null || defaultPaper === void 0 ? void 0 : defaultPaper.Name;
462
583
  this.selectedProperties.paperid = defaultPaper === null || defaultPaper === void 0 ? void 0 : defaultPaper.Id;
463
- let defaultSource = (_e = this.selectedPrinterConfig.Trays) === null || _e === void 0 ? void 0 : _e.find(obj => obj.Default === true);
464
- if (this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 1 && this.selectedPrinterConfig.Trays[0] != null) {
584
+ let defaultSource = (_e = this.selectedPrinterConfig.Trays) === null || _e === void 0 ? void 0 : _e.find((obj) => obj.Default === true);
585
+ if (this.selectedPrinterConfig.Trays &&
586
+ this.selectedPrinterConfig.Trays.length >= 1 &&
587
+ this.selectedPrinterConfig.Trays[0] != null) {
465
588
  this.selectedProperties.trayname = defaultSource === null || defaultSource === void 0 ? void 0 : defaultSource.Name;
466
589
  this.selectedProperties.defaultSource = defaultSource === null || defaultSource === void 0 ? void 0 : defaultSource.Index;
467
590
  }
468
- if (this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 0 && this.selectedPrinterConfig.Trays[0] == null) {
591
+ if (this.selectedPrinterConfig.Trays &&
592
+ this.selectedPrinterConfig.Trays.length >= 0 &&
593
+ this.selectedPrinterConfig.Trays[0] == null) {
469
594
  delete this.selectedProperties.trayname;
470
595
  delete this.selectedProperties.defaultSource;
471
596
  }
@@ -487,10 +612,12 @@ export class EzpPrinterSelection {
487
612
  .then((printerConfig) => {
488
613
  this.printerConfig = printerConfig;
489
614
  });
490
- if (this.file) {
491
- await this.validateFileType(this.filename).then((valid) => {
492
- this.notSupported = !valid ? true : false;
493
- });
615
+ if (this.files && this.files.length > 0) {
616
+ // Validate all files
617
+ const validationPromises = this.files.map((file) => this.validateFileType(file.name));
618
+ const validationResults = await Promise.all(validationPromises);
619
+ const allValid = validationResults.every((valid) => valid);
620
+ this.notSupported = !allValid;
494
621
  }
495
622
  this.loading = false;
496
623
  }
@@ -503,14 +630,28 @@ export class EzpPrinterSelection {
503
630
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
504
631
  return this.loading ? (h("ezp-status", { processing: true, description: i18next.t('printer_selection.loading'), instance: "loading" })) : (h(Host, { class: { seamless: this.seamless } },
505
632
  h("div", { id: "box", "data-backdrop-surface": true },
506
- !this.printStopped && (h(Fragment, null, this.printProcessing ? (h("ezp-status", { processing: true, description: this.preparingUpload
507
- ? i18next.t('printer_selection.prepare_upload')
508
- : this.uploading
509
- ? i18next.t('printer_selection.uploading')
510
- : i18next.t('printer_selection.print_processing'), instance: "print-processing", cancel: true })) : this.selectedPrinter.is_queue && this.printSuccess ? (h("ezp-status", { icon: "checkmark-alt", description: i18next.t('printer_selection.pull_print_success'), instance: "print-success", close: true })) : this.printSuccess ? (h("ezp-status", { icon: "checkmark-alt", description: 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.noPrinters ? (h("ezp-status", { icon: "exclamation-mark", description: i18next.t('printer_selection.no_printers'), instance: "no-printers", close: true })) : null)),
633
+ !this.printStopped && (h(Fragment, null, this.printProcessing ? (h("ezp-status", { processing: true, description: this.totalFiles > 1
634
+ ? `${i18next.t('printer_selection.print_processing')} (${this.currentFileIndex + 1}/${this.totalFiles})`
635
+ : this.preparingUpload
636
+ ? i18next.t('printer_selection.prepare_upload')
637
+ : this.uploading
638
+ ? i18next.t('printer_selection.uploading')
639
+ : 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
640
+ ? this.failedFiles.length > 0
641
+ ? `${i18next.t('printer_selection.pull_print_success')} (${this.successfulFiles.length}/${this.totalFiles} files)`
642
+ : `${i18next.t('printer_selection.pull_print_success')} (${this.totalFiles} files)`
643
+ : 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
644
+ ? this.partialSuccess
645
+ ? `${i18next.t('printer_selection.print_success')} (${this.successfulFiles.length}/${this.totalFiles} ${i18next.t('printer_selection.files')} - ${this.failedFiles.length} failed`
646
+ : `${i18next.t('printer_selection.print_success')} (${this.totalFiles} ${i18next.t('printer_selection.files')})`
647
+ : 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.noPrinters ? (h("ezp-status", { icon: "exclamation-mark", description: i18next.t('printer_selection.no_printers'), instance: "no-printers", close: true })) : null)),
511
648
  !this.hideheader && (h("div", { id: "header" },
512
649
  h("ezp-label", { weight: "heavy", text: i18next.t('printer_selection.print') + `${!this.notSupported ? ':' : ''}` }),
513
- h("ezp-label", { text: !this.notSupported ? this.filename : '', ellipsis: true }),
650
+ h("ezp-label", { text: !this.notSupported
651
+ ? this.files && this.files.length > 1
652
+ ? i18next.t('printer_selection.files_selected', { count: this.files.length })
653
+ : this.filename
654
+ : '', ellipsis: true }),
514
655
  !this.hidemenu && (h("ezp-icon-button", { level: "tertiary", icon: "menu", id: "toggle-menu", type: "button", onClick: this.handleUserMenu })))),
515
656
  h("div", { id: "body" },
516
657
  h("div", { id: "printer" },
@@ -528,9 +669,8 @@ export class EzpPrinterSelection {
528
669
  id: option.id,
529
670
  title: option.title,
530
671
  meta: '',
531
- type: 'color'
532
- })), preSelected: this.selectedPrinter.id
533
- && ((_b = this.selectedPrinterConfig.Default) === null || _b === void 0 ? void 0 : _b.Color) == "color"
672
+ type: 'color',
673
+ })), preSelected: this.selectedPrinter.id && ((_b = this.selectedPrinterConfig.Default) === null || _b === void 0 ? void 0 : _b.Color) == 'color'
534
674
  ? i18next.t('printer_selection.color_color')
535
675
  : i18next.t('printer_selection.color_grayscale'), disabled: !this.selectedPrinterConfig.ColorSupported }),
536
676
  h("ezp-select", { label: i18next.t('printer_selection.duplex'), icon: "duplex", placeholder: i18next.t('printer_selection.select_duplex'), toggleFlow: "horizontal", options: (_c = this.duplexOptions) === null || _c === void 0 ? void 0 : _c.map((option) => ({
@@ -538,19 +678,22 @@ export class EzpPrinterSelection {
538
678
  title: option.title,
539
679
  meta: '',
540
680
  type: 'duplex',
541
- })), preSelected: this.selectedPrinter.id && ((_d = this.selectedPrinterConfig.Default) === null || _d === void 0 ? void 0 : _d.Duplex) == "duplex_simplex"
681
+ })), preSelected: this.selectedPrinter.id &&
682
+ ((_d = this.selectedPrinterConfig.Default) === null || _d === void 0 ? void 0 : _d.Duplex) == 'duplex_simplex'
542
683
  ? i18next.t('printer_selection.duplex_none')
543
- : ((_e = this.selectedPrinterConfig.Default) === null || _e === void 0 ? void 0 : _e.Duplex) == "duplex_vertical"
684
+ : ((_e = this.selectedPrinterConfig.Default) === null || _e === void 0 ? void 0 : _e.Duplex) == 'duplex_vertical'
544
685
  ? i18next.t('printer_selection.duplex_long')
545
- : ((_f = this.selectedPrinterConfig.Default) === null || _f === void 0 ? void 0 : _f.Duplex) == "duplex_horizontal"
686
+ : ((_f = this.selectedPrinterConfig.Default) === null || _f === void 0 ? void 0 : _f.Duplex) == 'duplex_horizontal'
546
687
  ? i18next.t('printer_selection.duplex_short')
547
688
  : null, disabled: !this.selectedPrinterConfig.DuplexSupported }),
548
- h("ezp-select", { label: i18next.t('printer_selection.size'), icon: "size", placeholder: i18next.t('printer_selection.select_size'), toggleFlow: "horizontal", optionFlow: "horizontal", options: this.selectedPrinterConfig.PaperFormats && this.selectedPrinterConfig.PaperFormats.map((format) => ({
549
- id: format.Id,
550
- title: format.Name,
551
- meta: `${format.XRes} x ${format.YRes}`,
552
- type: 'format',
553
- })), preSelected: this.selectedPrinter.id && ((_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); }))
689
+ h("ezp-select", { label: i18next.t('printer_selection.size'), icon: "size", placeholder: i18next.t('printer_selection.select_size'), toggleFlow: "horizontal", optionFlow: "horizontal", options: this.selectedPrinterConfig.PaperFormats &&
690
+ this.selectedPrinterConfig.PaperFormats.map((format) => ({
691
+ id: format.Id,
692
+ title: format.Name,
693
+ meta: `${format.XRes} x ${format.YRes}`,
694
+ type: 'format',
695
+ })), preSelected: this.selectedPrinter.id &&
696
+ ((_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); }))
554
697
  ? (_h = this.selectedPrinterConfig.Default) === null || _h === void 0 ? void 0 : _h.Paper
555
698
  : null, disabled: !(((_j = this.selectedPrinterConfig.PaperFormats) === null || _j === void 0 ? void 0 : _j.length) > 0) }),
556
699
  this.paperid == PAPER_ID ? (h(Fragment, null,
@@ -567,15 +710,21 @@ export class EzpPrinterSelection {
567
710
  title: option,
568
711
  meta: '',
569
712
  type: 'quality',
570
- })), preSelected: this.selectedPrinter.id && ((_l = this.selectedPrinterConfig.Resolutions) === null || _l === void 0 ? void 0 : _l.includes(this.selectedPrinterConfig.Default.Resolution))
713
+ })), preSelected: this.selectedPrinter.id &&
714
+ ((_l = this.selectedPrinterConfig.Resolutions) === null || _l === void 0 ? void 0 : _l.includes(this.selectedPrinterConfig.Default.Resolution))
571
715
  ? this.selectedPrinterConfig.Default.Resolution
572
716
  : null, disabled: !(((_m = this.selectedPrinterConfig.Resolutions) === null || _m === void 0 ? void 0 : _m.length) > 0) }),
573
- this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 1 && 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 && this.selectedPrinterConfig.Trays.map((trays) => ({
574
- title: trays.Name,
575
- id: trays.Index,
576
- meta: '',
577
- type: 'tray',
578
- })), preSelected: this.selectedPrinter.id && ((_o = this.selectedPrinterConfig.Trays) === null || _o === void 0 ? void 0 : _o.find((el) => el.Name.includes(this.selectedPrinterConfig.Default.Tray)))
717
+ this.selectedPrinterConfig.Trays &&
718
+ this.selectedPrinterConfig.Trays.length >= 1 &&
719
+ 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 &&
720
+ this.selectedPrinterConfig.Trays.length >= 1 &&
721
+ this.selectedPrinterConfig.Trays.map((trays) => ({
722
+ title: trays.Name,
723
+ id: trays.Index,
724
+ meta: '',
725
+ type: 'tray',
726
+ })), preSelected: this.selectedPrinter.id &&
727
+ ((_o = this.selectedPrinterConfig.Trays) === null || _o === void 0 ? void 0 : _o.find((el) => el.Name.includes(this.selectedPrinterConfig.Default.Tray)))
579
728
  ? this.selectedPrinterConfig.Default.Tray
580
729
  : null })) : null,
581
730
  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') })),
@@ -696,12 +845,12 @@ export class EzpPrinterSelection {
696
845
  "attribute": "fileid",
697
846
  "reflect": false
698
847
  },
699
- "file": {
848
+ "files": {
700
849
  "type": "unknown",
701
850
  "mutable": false,
702
851
  "complexType": {
703
- "original": "File",
704
- "resolved": "File",
852
+ "original": "File[]",
853
+ "resolved": "File[]",
705
854
  "references": {
706
855
  "File": {
707
856
  "location": "global"
@@ -787,7 +936,12 @@ export class EzpPrinterSelection {
787
936
  "printerConfig": {},
788
937
  "selectedPrinterConfig": {},
789
938
  "selectedProperties": {},
790
- "paperid": {}
939
+ "paperid": {},
940
+ "currentFileIndex": {},
941
+ "totalFiles": {},
942
+ "failedFiles": {},
943
+ "successfulFiles": {},
944
+ "partialSuccess": {}
791
945
  }; }
792
946
  static get events() { return [{
793
947
  "method": "printCancel",
@@ -24,6 +24,7 @@ export class EzpPrinting {
24
24
  this.authOpen = false;
25
25
  this.onlyGetSasUri = false;
26
26
  this.noDocumentOpen = false;
27
+ this.files = [];
27
28
  }
28
29
  /** Watchers */
29
30
  watchFileData(newValue, oldValue) {
@@ -33,7 +34,7 @@ export class EzpPrinting {
33
34
  for (let i = 0; i < newValue.length; i++) {
34
35
  array[i] = newValue.charCodeAt(i);
35
36
  }
36
- this.file = new File([array], this.filename);
37
+ this.files = [new File([array], this.filename)];
37
38
  }
38
39
  }
39
40
  watchFilename(newValue, oldValue) {
@@ -85,8 +86,8 @@ export class EzpPrinting {
85
86
  }
86
87
  }
87
88
  listenUploadFile(event) {
88
- this.filename = event.detail[0].name;
89
- this.file = event.detail[0];
89
+ this.files = event.detail;
90
+ this.filename = this.files.length > 0 ? this.files[0].name : '';
90
91
  this.open();
91
92
  }
92
93
  listenDialogClose(event) {
@@ -219,7 +220,7 @@ export class EzpPrinting {
219
220
  ? this.systemAppearance
220
221
  : userStore.state.appearance} ${this.seamless ? 'seamless' : ''}` },
221
222
  this.trigger === 'custom' ? (h("slot", null)) : this.trigger === 'file' ? (h("ezp-upload", null)) : (this.trigger === 'button' && (h("ezp-icon-button", { id: "print-trigger", icon: "printer", slot: "trigger", type: "button", onClick: () => this.open() }))),
222
- this.authOpen ? (h("ezp-auth", { clientID: this.clientid, redirectURI: this.redirecturi, hidelogin: this.hidelogin, trigger: this.trigger, code: this.code })) : this.printOpen ? (h("ezp-printer-selection", { clientID: this.clientid, redirectURI: this.redirecturi, filename: this.filename, fileurl: this.fileurl, filetype: this.filetype, fileid: this.fileid, file: this.file, hidemenu: this.hidemenu, hideheader: this.hideheader, seamless: this.seamless })) : this.noDocumentOpen ? (h("ezp-dialog", { heading: i18next.t('no_document_dialog.heading'), description: i18next.t('no_document_dialog.description'), action: i18next.t('no_document_dialog.action'), iconName: "question-mark", instance: "no-document-selected" })) : null));
223
+ this.authOpen ? (h("ezp-auth", { clientID: this.clientid, redirectURI: this.redirecturi, hidelogin: this.hidelogin, trigger: this.trigger, code: this.code })) : this.printOpen ? (h("ezp-printer-selection", { clientID: this.clientid, redirectURI: this.redirecturi, filename: this.filename, fileurl: this.fileurl, filetype: this.filetype, fileid: this.fileid, files: this.files, hidemenu: this.hidemenu, hideheader: this.hideheader, seamless: this.seamless })) : this.noDocumentOpen ? (h("ezp-dialog", { heading: i18next.t('no_document_dialog.heading'), description: i18next.t('no_document_dialog.description'), action: i18next.t('no_document_dialog.action'), iconName: "question-mark", instance: "no-document-selected" })) : null));
223
224
  }
224
225
  static get is() { return "ezp-printing"; }
225
226
  static get encapsulation() { return "shadow"; }
@@ -582,7 +583,7 @@ export class EzpPrinting {
582
583
  "onlyGetSasUri": {},
583
584
  "noDocumentOpen": {},
584
585
  "systemAppearance": {},
585
- "file": {}
586
+ "files": {}
586
587
  }; }
587
588
  static get events() { return [{
588
589
  "method": "printFinished",