@ezeep/ezeep-js 1.0.238 → 1.0.240

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.
@@ -2879,7 +2879,9 @@ const printer_selection$1 = {
2879
2879
  trays: "Papierfach",
2880
2880
  select_trays: "Wähle Papierfach",
2881
2881
  page_ranges: "Druckbereich",
2882
- paper_ranges: "Papier-Ranges"
2882
+ paper_ranges: "Papier-Ranges",
2883
+ files_selected: "{{count}} Dateien ausgewählt",
2884
+ files: "Dateien"
2883
2885
  };
2884
2886
  const button_actions$1 = {
2885
2887
  login: "Anmelden",
@@ -2962,7 +2964,9 @@ const printer_selection = {
2962
2964
  trays: "Tray",
2963
2965
  select_trays: "Select Tray",
2964
2966
  page_ranges: "Page Ranges",
2965
- paper_ranges: "Paper Ranges"
2967
+ paper_ranges: "Paper Ranges",
2968
+ files_selected: "{{count}} files selected",
2969
+ files: "files"
2966
2970
  };
2967
2971
  const button_actions = {
2968
2972
  login: "Sign In",
@@ -32943,8 +32947,11 @@ let EzpPrinterSelection = class {
32943
32947
  this.printProcessing = false;
32944
32948
  });
32945
32949
  }
32946
- if (this.files && this.files.length > 0) {
32947
- await this.handleFiles(this.files, cleanPrintProperties);
32950
+ else if (this.files && this.files.length > 1) {
32951
+ await this.processMultipleFiles(this.files, cleanPrintProperties);
32952
+ }
32953
+ else if (this.files && this.files.length === 1) {
32954
+ await this.processSingleFile(this.files[0], cleanPrintProperties);
32948
32955
  }
32949
32956
  localStorage.setItem('properties', JSON.stringify(this.selectedProperties));
32950
32957
  localStorage.setItem('printer', JSON.stringify(this.selectedPrinter));
@@ -33215,27 +33222,31 @@ let EzpPrinterSelection = class {
33215
33222
  this.uploading = false;
33216
33223
  }
33217
33224
  async waitForPrintCompletion() {
33218
- return new Promise((resolve, reject) => {
33219
- const poll = async () => {
33220
- try {
33221
- const data = await this.printService.getPrintStatus();
33222
- if (data.jobstatus === 0) {
33223
- resolve();
33224
- }
33225
- else if (data.jobstatus === 1) {
33226
- // Still processing, continue polling
33227
- setTimeout(poll, this.POLL_INTERVAL);
33228
- }
33229
- else {
33230
- reject(new Error('Print job failed'));
33231
- }
33225
+ while (true) {
33226
+ try {
33227
+ const data = await this.printService.getPrintStatus();
33228
+ console.log('[waitForPrintCompletion] Poll response:', data);
33229
+ if (data.jobstatus === 0) {
33230
+ // Success
33231
+ return;
33232
33232
  }
33233
- catch (error) {
33234
- reject(error);
33233
+ else if (data.jobstatus === 1246 || data.jobstatus === 129) {
33234
+ // Still processing, wait before next poll
33235
+ await new Promise((resolve) => setTimeout(resolve, this.POLL_INTERVAL));
33235
33236
  }
33236
- };
33237
- poll();
33238
- });
33237
+ else if (data.jobstatus === 3011 || data.jobstatus === 2) {
33238
+ // Failure
33239
+ throw new Error('Print job failed: ' + (data.jobstatusstring || data.jobstatus));
33240
+ }
33241
+ else {
33242
+ // Unknown status, treat as failure for safety
33243
+ throw new Error('Unknown print job status: ' + data.jobstatus);
33244
+ }
33245
+ }
33246
+ catch (error) {
33247
+ throw error;
33248
+ }
33249
+ }
33239
33250
  }
33240
33251
  getFileExtension(filename) {
33241
33252
  const extension = filename.split('.').pop();
@@ -33264,6 +33275,41 @@ let EzpPrinterSelection = class {
33264
33275
  }
33265
33276
  this.setPaperid();
33266
33277
  }
33278
+ async processMultipleFiles(files, printProperties) {
33279
+ this.totalFiles = files.length;
33280
+ this.currentFileIndex = 0;
33281
+ this.failedFiles = [];
33282
+ this.successfulFiles = [];
33283
+ for (let i = 0; i < files.length; i++) {
33284
+ this.currentFileIndex = i;
33285
+ const file = files[i];
33286
+ try {
33287
+ await this.processSingleFile(file, printProperties);
33288
+ this.successfulFiles.push(file.name);
33289
+ }
33290
+ catch (error) {
33291
+ console.error(`Error processing file ${file.name}:`, error);
33292
+ this.failedFiles.push(file.name);
33293
+ // Continue with the next file
33294
+ }
33295
+ }
33296
+ // Set UI state
33297
+ if (this.failedFiles.length === 0) {
33298
+ this.printSuccess = true;
33299
+ this.partialSuccess = false;
33300
+ this.printProcessing = false;
33301
+ }
33302
+ else if (this.successfulFiles.length === 0) {
33303
+ this.printFailed = true;
33304
+ this.partialSuccess = false;
33305
+ this.printProcessing = false;
33306
+ }
33307
+ else {
33308
+ this.printSuccess = true;
33309
+ this.partialSuccess = true;
33310
+ this.printProcessing = false;
33311
+ }
33312
+ }
33267
33313
  /**
33268
33314
  *
33269
33315
  * Lifecycle methods
@@ -33356,11 +33402,11 @@ let EzpPrinterSelection = class {
33356
33402
  : `${i18next.t('printer_selection.pull_print_success')} (${this.totalFiles} files)`
33357
33403
  : i18next.t('printer_selection.pull_print_success'), instance: "print-success", close: true })) : this.printSuccess ? (index.h("ezp-status", { icon: this.partialSuccess ? 'exclamation-mark' : 'checkmark-alt', description: this.totalFiles > 1
33358
33404
  ? this.partialSuccess
33359
- ? `${i18next.t('printer_selection.print_success')} (${this.successfulFiles.length}/${this.totalFiles} files) - ${this.failedFiles.length} failed`
33360
- : `${i18next.t('printer_selection.print_success')} (${this.totalFiles} files)`
33405
+ ? `${i18next.t('printer_selection.print_success')} (${this.successfulFiles.length}/${this.totalFiles} ${i18next.t('printer_selection.files')} - ${this.failedFiles.length} failed`
33406
+ : `${i18next.t('printer_selection.print_success')} (${this.totalFiles} ${i18next.t('printer_selection.files')})`
33361
33407
  : i18next.t('printer_selection.print_success'), instance: "print-success", close: true })) : this.printFailed ? (index.h("ezp-status", { icon: "exclamation-mark", description: i18next.t('printer_selection.print_failed'), instance: "print-failed", close: true, retry: true })) : this.notSupported ? (index.h("ezp-status", { icon: "exclamation-mark", description: i18next.t('printer_selection.not_supported'), instance: "not-supported", retry: true })) : this.noPrinters ? (index.h("ezp-status", { icon: "exclamation-mark", description: i18next.t('printer_selection.no_printers'), instance: "no-printers", close: true })) : null)), !this.hideheader && (index.h("div", { id: "header" }, index.h("ezp-label", { weight: "heavy", text: i18next.t('printer_selection.print') + `${!this.notSupported ? ':' : ''}` }), index.h("ezp-label", { text: !this.notSupported
33362
33408
  ? this.files && this.files.length > 1
33363
- ? `${this.files.length} files selected`
33409
+ ? i18next.t('printer_selection.files_selected', { count: this.files.length })
33364
33410
  : this.filename
33365
33411
  : '', ellipsis: true }), !this.hidemenu && (index.h("ezp-icon-button", { level: "tertiary", icon: "menu", id: "toggle-menu", type: "button", onClick: this.handleUserMenu })))), index.h("div", { id: "body" }, index.h("div", { id: "printer" }, index.h("ezp-select", { label: i18next.t('printer_selection.printer'), icon: "printer", placeholder: this.printers.length > 0
33366
33412
  ? i18next.t('printer_selection.select_printer')
@@ -180,8 +180,11 @@ export class EzpPrinterSelection {
180
180
  this.printProcessing = false;
181
181
  });
182
182
  }
183
- if (this.files && this.files.length > 0) {
184
- await this.handleFiles(this.files, cleanPrintProperties);
183
+ else 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);
185
188
  }
186
189
  localStorage.setItem('properties', JSON.stringify(this.selectedProperties));
187
190
  localStorage.setItem('printer', JSON.stringify(this.selectedPrinter));
@@ -454,27 +457,31 @@ export class EzpPrinterSelection {
454
457
  this.uploading = false;
455
458
  }
456
459
  async waitForPrintCompletion() {
457
- return new Promise((resolve, reject) => {
458
- const poll = async () => {
459
- try {
460
- const data = await this.printService.getPrintStatus();
461
- if (data.jobstatus === 0) {
462
- resolve();
463
- }
464
- else if (data.jobstatus === 1) {
465
- // Still processing, continue polling
466
- setTimeout(poll, this.POLL_INTERVAL);
467
- }
468
- else {
469
- reject(new Error('Print job failed'));
470
- }
460
+ while (true) {
461
+ try {
462
+ const data = await this.printService.getPrintStatus();
463
+ console.log('[waitForPrintCompletion] Poll response:', data);
464
+ if (data.jobstatus === 0) {
465
+ // Success
466
+ return;
471
467
  }
472
- catch (error) {
473
- reject(error);
468
+ else if (data.jobstatus === 1246 || data.jobstatus === 129) {
469
+ // Still processing, wait before next poll
470
+ await new Promise((resolve) => setTimeout(resolve, this.POLL_INTERVAL));
474
471
  }
475
- };
476
- poll();
477
- });
472
+ else if (data.jobstatus === 3011 || data.jobstatus === 2) {
473
+ // Failure
474
+ throw new Error('Print job failed: ' + (data.jobstatusstring || data.jobstatus));
475
+ }
476
+ else {
477
+ // Unknown status, treat as failure for safety
478
+ throw new Error('Unknown print job status: ' + data.jobstatus);
479
+ }
480
+ }
481
+ catch (error) {
482
+ throw error;
483
+ }
484
+ }
478
485
  }
479
486
  getFileExtension(filename) {
480
487
  const extension = filename.split('.').pop();
@@ -503,6 +510,41 @@ export class EzpPrinterSelection {
503
510
  }
504
511
  this.setPaperid();
505
512
  }
513
+ async processMultipleFiles(files, printProperties) {
514
+ this.totalFiles = files.length;
515
+ this.currentFileIndex = 0;
516
+ this.failedFiles = [];
517
+ this.successfulFiles = [];
518
+ for (let i = 0; i < files.length; i++) {
519
+ this.currentFileIndex = i;
520
+ const file = files[i];
521
+ try {
522
+ await this.processSingleFile(file, printProperties);
523
+ this.successfulFiles.push(file.name);
524
+ }
525
+ catch (error) {
526
+ console.error(`Error processing file ${file.name}:`, error);
527
+ this.failedFiles.push(file.name);
528
+ // Continue with the next file
529
+ }
530
+ }
531
+ // Set UI state
532
+ if (this.failedFiles.length === 0) {
533
+ this.printSuccess = true;
534
+ this.partialSuccess = false;
535
+ this.printProcessing = false;
536
+ }
537
+ else if (this.successfulFiles.length === 0) {
538
+ this.printFailed = true;
539
+ this.partialSuccess = false;
540
+ this.printProcessing = false;
541
+ }
542
+ else {
543
+ this.printSuccess = true;
544
+ this.partialSuccess = true;
545
+ this.printProcessing = false;
546
+ }
547
+ }
506
548
  /**
507
549
  *
508
550
  * Lifecycle methods
@@ -597,14 +639,14 @@ export class EzpPrinterSelection {
597
639
  : `${i18next.t('printer_selection.pull_print_success')} (${this.totalFiles} files)`
598
640
  : 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
599
641
  ? this.partialSuccess
600
- ? `${i18next.t('printer_selection.print_success')} (${this.successfulFiles.length}/${this.totalFiles} files) - ${this.failedFiles.length} failed`
601
- : `${i18next.t('printer_selection.print_success')} (${this.totalFiles} files)`
642
+ ? `${i18next.t('printer_selection.print_success')} (${this.successfulFiles.length}/${this.totalFiles} ${i18next.t('printer_selection.files')} - ${this.failedFiles.length} failed`
643
+ : `${i18next.t('printer_selection.print_success')} (${this.totalFiles} ${i18next.t('printer_selection.files')})`
602
644
  : 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)),
603
645
  !this.hideheader && (h("div", { id: "header" },
604
646
  h("ezp-label", { weight: "heavy", text: i18next.t('printer_selection.print') + `${!this.notSupported ? ':' : ''}` }),
605
647
  h("ezp-label", { text: !this.notSupported
606
648
  ? this.files && this.files.length > 1
607
- ? `${this.files.length} files selected`
649
+ ? i18next.t('printer_selection.files_selected', { count: this.files.length })
608
650
  : this.filename
609
651
  : '', ellipsis: true }),
610
652
  !this.hidemenu && (h("ezp-icon-button", { level: "tertiary", icon: "menu", id: "toggle-menu", type: "button", onClick: this.handleUserMenu })))),
@@ -2888,7 +2888,9 @@ const printer_selection$1 = {
2888
2888
  trays: "Papierfach",
2889
2889
  select_trays: "Wähle Papierfach",
2890
2890
  page_ranges: "Druckbereich",
2891
- paper_ranges: "Papier-Ranges"
2891
+ paper_ranges: "Papier-Ranges",
2892
+ files_selected: "{{count}} Dateien ausgewählt",
2893
+ files: "Dateien"
2892
2894
  };
2893
2895
  const button_actions$1 = {
2894
2896
  login: "Anmelden",
@@ -2971,7 +2973,9 @@ const printer_selection = {
2971
2973
  trays: "Tray",
2972
2974
  select_trays: "Select Tray",
2973
2975
  page_ranges: "Page Ranges",
2974
- paper_ranges: "Paper Ranges"
2976
+ paper_ranges: "Paper Ranges",
2977
+ files_selected: "{{count}} files selected",
2978
+ files: "files"
2975
2979
  };
2976
2980
  const button_actions = {
2977
2981
  login: "Sign In",
@@ -32968,8 +32972,11 @@ let EzpPrinterSelection$1 = class extends HTMLElement {
32968
32972
  this.printProcessing = false;
32969
32973
  });
32970
32974
  }
32971
- if (this.files && this.files.length > 0) {
32972
- await this.handleFiles(this.files, cleanPrintProperties);
32975
+ else if (this.files && this.files.length > 1) {
32976
+ await this.processMultipleFiles(this.files, cleanPrintProperties);
32977
+ }
32978
+ else if (this.files && this.files.length === 1) {
32979
+ await this.processSingleFile(this.files[0], cleanPrintProperties);
32973
32980
  }
32974
32981
  localStorage.setItem('properties', JSON.stringify(this.selectedProperties));
32975
32982
  localStorage.setItem('printer', JSON.stringify(this.selectedPrinter));
@@ -33240,27 +33247,31 @@ let EzpPrinterSelection$1 = class extends HTMLElement {
33240
33247
  this.uploading = false;
33241
33248
  }
33242
33249
  async waitForPrintCompletion() {
33243
- return new Promise((resolve, reject) => {
33244
- const poll = async () => {
33245
- try {
33246
- const data = await this.printService.getPrintStatus();
33247
- if (data.jobstatus === 0) {
33248
- resolve();
33249
- }
33250
- else if (data.jobstatus === 1) {
33251
- // Still processing, continue polling
33252
- setTimeout(poll, this.POLL_INTERVAL);
33253
- }
33254
- else {
33255
- reject(new Error('Print job failed'));
33256
- }
33250
+ while (true) {
33251
+ try {
33252
+ const data = await this.printService.getPrintStatus();
33253
+ console.log('[waitForPrintCompletion] Poll response:', data);
33254
+ if (data.jobstatus === 0) {
33255
+ // Success
33256
+ return;
33257
33257
  }
33258
- catch (error) {
33259
- reject(error);
33258
+ else if (data.jobstatus === 1246 || data.jobstatus === 129) {
33259
+ // Still processing, wait before next poll
33260
+ await new Promise((resolve) => setTimeout(resolve, this.POLL_INTERVAL));
33260
33261
  }
33261
- };
33262
- poll();
33263
- });
33262
+ else if (data.jobstatus === 3011 || data.jobstatus === 2) {
33263
+ // Failure
33264
+ throw new Error('Print job failed: ' + (data.jobstatusstring || data.jobstatus));
33265
+ }
33266
+ else {
33267
+ // Unknown status, treat as failure for safety
33268
+ throw new Error('Unknown print job status: ' + data.jobstatus);
33269
+ }
33270
+ }
33271
+ catch (error) {
33272
+ throw error;
33273
+ }
33274
+ }
33264
33275
  }
33265
33276
  getFileExtension(filename) {
33266
33277
  const extension = filename.split('.').pop();
@@ -33289,6 +33300,41 @@ let EzpPrinterSelection$1 = class extends HTMLElement {
33289
33300
  }
33290
33301
  this.setPaperid();
33291
33302
  }
33303
+ async processMultipleFiles(files, printProperties) {
33304
+ this.totalFiles = files.length;
33305
+ this.currentFileIndex = 0;
33306
+ this.failedFiles = [];
33307
+ this.successfulFiles = [];
33308
+ for (let i = 0; i < files.length; i++) {
33309
+ this.currentFileIndex = i;
33310
+ const file = files[i];
33311
+ try {
33312
+ await this.processSingleFile(file, printProperties);
33313
+ this.successfulFiles.push(file.name);
33314
+ }
33315
+ catch (error) {
33316
+ console.error(`Error processing file ${file.name}:`, error);
33317
+ this.failedFiles.push(file.name);
33318
+ // Continue with the next file
33319
+ }
33320
+ }
33321
+ // Set UI state
33322
+ if (this.failedFiles.length === 0) {
33323
+ this.printSuccess = true;
33324
+ this.partialSuccess = false;
33325
+ this.printProcessing = false;
33326
+ }
33327
+ else if (this.successfulFiles.length === 0) {
33328
+ this.printFailed = true;
33329
+ this.partialSuccess = false;
33330
+ this.printProcessing = false;
33331
+ }
33332
+ else {
33333
+ this.printSuccess = true;
33334
+ this.partialSuccess = true;
33335
+ this.printProcessing = false;
33336
+ }
33337
+ }
33292
33338
  /**
33293
33339
  *
33294
33340
  * Lifecycle methods
@@ -33381,11 +33427,11 @@ let EzpPrinterSelection$1 = class extends HTMLElement {
33381
33427
  : `${i18next.t('printer_selection.pull_print_success')} (${this.totalFiles} files)`
33382
33428
  : 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
33383
33429
  ? this.partialSuccess
33384
- ? `${i18next.t('printer_selection.print_success')} (${this.successfulFiles.length}/${this.totalFiles} files) - ${this.failedFiles.length} failed`
33385
- : `${i18next.t('printer_selection.print_success')} (${this.totalFiles} files)`
33430
+ ? `${i18next.t('printer_selection.print_success')} (${this.successfulFiles.length}/${this.totalFiles} ${i18next.t('printer_selection.files')} - ${this.failedFiles.length} failed`
33431
+ : `${i18next.t('printer_selection.print_success')} (${this.totalFiles} ${i18next.t('printer_selection.files')})`
33386
33432
  : 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)), !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
33387
33433
  ? this.files && this.files.length > 1
33388
- ? `${this.files.length} files selected`
33434
+ ? i18next.t('printer_selection.files_selected', { count: this.files.length })
33389
33435
  : this.filename
33390
33436
  : '', ellipsis: true }), !this.hidemenu && (h("ezp-icon-button", { level: "tertiary", icon: "menu", id: "toggle-menu", type: "button", onClick: this.handleUserMenu })))), h("div", { id: "body" }, h("div", { id: "printer" }, h("ezp-select", { label: i18next.t('printer_selection.printer'), icon: "printer", placeholder: this.printers.length > 0
33391
33437
  ? i18next.t('printer_selection.select_printer')
@@ -2875,7 +2875,9 @@ const printer_selection$1 = {
2875
2875
  trays: "Papierfach",
2876
2876
  select_trays: "Wähle Papierfach",
2877
2877
  page_ranges: "Druckbereich",
2878
- paper_ranges: "Papier-Ranges"
2878
+ paper_ranges: "Papier-Ranges",
2879
+ files_selected: "{{count}} Dateien ausgewählt",
2880
+ files: "Dateien"
2879
2881
  };
2880
2882
  const button_actions$1 = {
2881
2883
  login: "Anmelden",
@@ -2958,7 +2960,9 @@ const printer_selection = {
2958
2960
  trays: "Tray",
2959
2961
  select_trays: "Select Tray",
2960
2962
  page_ranges: "Page Ranges",
2961
- paper_ranges: "Paper Ranges"
2963
+ paper_ranges: "Paper Ranges",
2964
+ files_selected: "{{count}} files selected",
2965
+ files: "files"
2962
2966
  };
2963
2967
  const button_actions = {
2964
2968
  login: "Sign In",
@@ -32939,8 +32943,11 @@ let EzpPrinterSelection = class {
32939
32943
  this.printProcessing = false;
32940
32944
  });
32941
32945
  }
32942
- if (this.files && this.files.length > 0) {
32943
- await this.handleFiles(this.files, cleanPrintProperties);
32946
+ else if (this.files && this.files.length > 1) {
32947
+ await this.processMultipleFiles(this.files, cleanPrintProperties);
32948
+ }
32949
+ else if (this.files && this.files.length === 1) {
32950
+ await this.processSingleFile(this.files[0], cleanPrintProperties);
32944
32951
  }
32945
32952
  localStorage.setItem('properties', JSON.stringify(this.selectedProperties));
32946
32953
  localStorage.setItem('printer', JSON.stringify(this.selectedPrinter));
@@ -33211,27 +33218,31 @@ let EzpPrinterSelection = class {
33211
33218
  this.uploading = false;
33212
33219
  }
33213
33220
  async waitForPrintCompletion() {
33214
- return new Promise((resolve, reject) => {
33215
- const poll = async () => {
33216
- try {
33217
- const data = await this.printService.getPrintStatus();
33218
- if (data.jobstatus === 0) {
33219
- resolve();
33220
- }
33221
- else if (data.jobstatus === 1) {
33222
- // Still processing, continue polling
33223
- setTimeout(poll, this.POLL_INTERVAL);
33224
- }
33225
- else {
33226
- reject(new Error('Print job failed'));
33227
- }
33221
+ while (true) {
33222
+ try {
33223
+ const data = await this.printService.getPrintStatus();
33224
+ console.log('[waitForPrintCompletion] Poll response:', data);
33225
+ if (data.jobstatus === 0) {
33226
+ // Success
33227
+ return;
33228
33228
  }
33229
- catch (error) {
33230
- reject(error);
33229
+ else if (data.jobstatus === 1246 || data.jobstatus === 129) {
33230
+ // Still processing, wait before next poll
33231
+ await new Promise((resolve) => setTimeout(resolve, this.POLL_INTERVAL));
33231
33232
  }
33232
- };
33233
- poll();
33234
- });
33233
+ else if (data.jobstatus === 3011 || data.jobstatus === 2) {
33234
+ // Failure
33235
+ throw new Error('Print job failed: ' + (data.jobstatusstring || data.jobstatus));
33236
+ }
33237
+ else {
33238
+ // Unknown status, treat as failure for safety
33239
+ throw new Error('Unknown print job status: ' + data.jobstatus);
33240
+ }
33241
+ }
33242
+ catch (error) {
33243
+ throw error;
33244
+ }
33245
+ }
33235
33246
  }
33236
33247
  getFileExtension(filename) {
33237
33248
  const extension = filename.split('.').pop();
@@ -33260,6 +33271,41 @@ let EzpPrinterSelection = class {
33260
33271
  }
33261
33272
  this.setPaperid();
33262
33273
  }
33274
+ async processMultipleFiles(files, printProperties) {
33275
+ this.totalFiles = files.length;
33276
+ this.currentFileIndex = 0;
33277
+ this.failedFiles = [];
33278
+ this.successfulFiles = [];
33279
+ for (let i = 0; i < files.length; i++) {
33280
+ this.currentFileIndex = i;
33281
+ const file = files[i];
33282
+ try {
33283
+ await this.processSingleFile(file, printProperties);
33284
+ this.successfulFiles.push(file.name);
33285
+ }
33286
+ catch (error) {
33287
+ console.error(`Error processing file ${file.name}:`, error);
33288
+ this.failedFiles.push(file.name);
33289
+ // Continue with the next file
33290
+ }
33291
+ }
33292
+ // Set UI state
33293
+ if (this.failedFiles.length === 0) {
33294
+ this.printSuccess = true;
33295
+ this.partialSuccess = false;
33296
+ this.printProcessing = false;
33297
+ }
33298
+ else if (this.successfulFiles.length === 0) {
33299
+ this.printFailed = true;
33300
+ this.partialSuccess = false;
33301
+ this.printProcessing = false;
33302
+ }
33303
+ else {
33304
+ this.printSuccess = true;
33305
+ this.partialSuccess = true;
33306
+ this.printProcessing = false;
33307
+ }
33308
+ }
33263
33309
  /**
33264
33310
  *
33265
33311
  * Lifecycle methods
@@ -33352,11 +33398,11 @@ let EzpPrinterSelection = class {
33352
33398
  : `${i18next.t('printer_selection.pull_print_success')} (${this.totalFiles} files)`
33353
33399
  : 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
33354
33400
  ? this.partialSuccess
33355
- ? `${i18next.t('printer_selection.print_success')} (${this.successfulFiles.length}/${this.totalFiles} files) - ${this.failedFiles.length} failed`
33356
- : `${i18next.t('printer_selection.print_success')} (${this.totalFiles} files)`
33401
+ ? `${i18next.t('printer_selection.print_success')} (${this.successfulFiles.length}/${this.totalFiles} ${i18next.t('printer_selection.files')} - ${this.failedFiles.length} failed`
33402
+ : `${i18next.t('printer_selection.print_success')} (${this.totalFiles} ${i18next.t('printer_selection.files')})`
33357
33403
  : 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)), !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
33358
33404
  ? this.files && this.files.length > 1
33359
- ? `${this.files.length} files selected`
33405
+ ? i18next.t('printer_selection.files_selected', { count: this.files.length })
33360
33406
  : this.filename
33361
33407
  : '', ellipsis: true }), !this.hidemenu && (h("ezp-icon-button", { level: "tertiary", icon: "menu", id: "toggle-menu", type: "button", onClick: this.handleUserMenu })))), h("div", { id: "body" }, h("div", { id: "printer" }, h("ezp-select", { label: i18next.t('printer_selection.printer'), icon: "printer", placeholder: this.printers.length > 0
33362
33408
  ? i18next.t('printer_selection.select_printer')