@ezeep/ezeep-js 1.0.234 → 1.0.237

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.
@@ -32567,6 +32567,7 @@ class PageBlobClient extends BlobClient {
32567
32567
 
32568
32568
  class EzpPrintService {
32569
32569
  constructor(redirectURI, clientID) {
32570
+ this.abortController = null;
32570
32571
  this.getPrintStatus = () => {
32571
32572
  return fetch(`https://${this.printingApi}/sfapi/Status/?id=${encodeURIComponent(printStore.state.jobID)}`, {
32572
32573
  headers: {
@@ -32655,6 +32656,7 @@ class EzpPrintService {
32655
32656
  });
32656
32657
  }
32657
32658
  printFileByUrl(accessToken, fileUrl, fileType, printerID, properties, filename, printAndDelete) {
32659
+ this.abortController = new AbortController();
32658
32660
  return fetch(`https://${this.printingApi}/sfapi/Print/`, {
32659
32661
  method: 'POST',
32660
32662
  headers: {
@@ -32662,8 +32664,15 @@ class EzpPrintService {
32662
32664
  'Content-Type': 'application/json',
32663
32665
  },
32664
32666
  body: JSON.stringify(Object.assign(Object.assign(Object.assign({ fileurl: fileUrl, type: fileType, printerid: printerID }, (filename && { alias: filename })), (printAndDelete && { printanddelete: printAndDelete })), { properties })),
32667
+ signal: this.abortController.signal
32665
32668
  });
32666
32669
  }
32670
+ abortPrint() {
32671
+ if (this.abortController) {
32672
+ this.abortController.abort();
32673
+ this.abortController = null;
32674
+ }
32675
+ }
32667
32676
  printByFileID(accessToken, fileID, fileType, printerID, properties, filename, printAndDelete) {
32668
32677
  return fetch(`https://${this.printingApi}/sfapi/Print/`, {
32669
32678
  method: 'POST',
@@ -32959,6 +32968,8 @@ let EzpPrinterSelection = class {
32959
32968
  if (event.detail === 'print-processing') {
32960
32969
  this.printStopped = true;
32961
32970
  this.printProcessing = false;
32971
+ // Abort the print request
32972
+ this.printService.abortPrint();
32962
32973
  }
32963
32974
  }
32964
32975
  listenStatusClose(event) {
@@ -33027,37 +33038,47 @@ let EzpPrinterSelection = class {
33027
33038
  await this.printService
33028
33039
  .getPrinterProperties(authStore.state.accessToken, this.selectedPrinter.id)
33029
33040
  .then((data) => {
33041
+ var _a, _b, _c, _d, _e, _f, _g;
33030
33042
  this.selectedPrinterConfig = Object.assign(Object.assign({}, this.selectedPrinterConfig), data[0]);
33043
+ this.selectedProperties.color = ((_a = this.selectedPrinterConfig.Default) === null || _a === void 0 ? void 0 : _a.Color) == "color" ? true : false;
33044
+ this.selectedProperties.orientation = (_b = this.selectedPrinterConfig.Default) === null || _b === void 0 ? void 0 : _b.Orientation;
33045
+ this.selectedProperties.resolution = (_c = this.selectedPrinterConfig.Default) === null || _c === void 0 ? void 0 : _c.Resolution;
33046
+ let defaultPaper = (_d = this.selectedPrinterConfig.PaperFormats) === null || _d === void 0 ? void 0 : _d.find(obj => obj.Default === true);
33047
+ this.selectedProperties.paper = defaultPaper === null || defaultPaper === void 0 ? void 0 : defaultPaper.Name;
33048
+ this.selectedProperties.paperid = defaultPaper === null || defaultPaper === void 0 ? void 0 : defaultPaper.Id;
33049
+ let defaultSource = (_e = this.selectedPrinterConfig.Trays) === null || _e === void 0 ? void 0 : _e.find(obj => obj.Default === true);
33050
+ if (this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 1 && this.selectedPrinterConfig.Trays[0] != null) {
33051
+ this.selectedProperties.trayname = defaultSource === null || defaultSource === void 0 ? void 0 : defaultSource.Name;
33052
+ this.selectedProperties.defaultSource = defaultSource === null || defaultSource === void 0 ? void 0 : defaultSource.Index;
33053
+ }
33054
+ if (this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 0 && this.selectedPrinterConfig.Trays[0] == null) {
33055
+ delete this.selectedProperties.trayname;
33056
+ delete this.selectedProperties.defaultSource;
33057
+ }
33058
+ this.selectedProperties.duplex = (_f = this.selectedPrinterConfig) === null || _f === void 0 ? void 0 : _f.DuplexSupported;
33059
+ this.selectedProperties.duplexmode = (_g = this.selectedPrinterConfig) === null || _g === void 0 ? void 0 : _g.DuplexMode;
33060
+ delete this.selectedProperties.PageRanges;
33031
33061
  });
33032
33062
  // this.setDefaultPaperFormat()
33033
33063
  break;
33034
33064
  case 'color':
33035
- this.selectedProperties.color = !!eventDetails.id;
33036
- // console.log('color selected:')
33037
- // console.log(this.selectedProperties.color)
33065
+ this.selectedProperties.color = eventDetails.title == i18next.t('printer_selection.color_color') ? true : false;
33038
33066
  break;
33039
33067
  case 'orientation':
33040
33068
  this.selectedProperties.orientation = eventDetails.id;
33041
- // console.log('orientation selected:')
33042
- // console.log(this.selectedProperties.orientation)
33043
33069
  break;
33044
33070
  case 'format':
33045
33071
  this.selectedProperties.paper = eventDetails.title;
33046
33072
  this.selectedProperties.paperid = eventDetails.id;
33047
- // console.log('paper selected:')
33048
33073
  break;
33049
33074
  case 'quality':
33050
33075
  this.selectedProperties.resolution = eventDetails.title;
33051
- // console.log('quality selected:')
33052
- // console.log(this.selectedProperties.resolution)
33053
33076
  break;
33054
33077
  case 'length':
33055
33078
  this.selectedProperties.paperlength = eventDetails.value;
33056
- // console.log(this.selectedProperties)
33057
33079
  break;
33058
33080
  case 'width':
33059
33081
  this.selectedProperties.paperwidth = eventDetails.value;
33060
- // console.log(this.selectedProperties)
33061
33082
  break;
33062
33083
  case 'tray':
33063
33084
  if (this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 0 && this.selectedPrinterConfig.Trays[0] == null) {
@@ -33072,22 +33093,19 @@ let EzpPrinterSelection = class {
33072
33093
  case 'paper_ranges':
33073
33094
  this.selectedProperties.PageRanges = eventDetails.value;
33074
33095
  this.pageRangeInvalid = !validatePageRange(this.selectedProperties.PageRanges);
33075
- localStorage.setItem('pageRanges', JSON.stringify(this.selectedProperties.PageRanges));
33076
- // console.log(this.selectedProperties.PageRanges)
33077
33096
  break;
33078
33097
  case 'duplex':
33079
- if (eventDetails.title === 'None') {
33080
- this.selectedProperties.duplex = false;
33098
+ if (eventDetails.title == i18next.t('printer_selection.duplex_none')
33099
+ || eventDetails.title == i18next.t('printer_selection.duplex_long')
33100
+ || eventDetails.title == i18next.t('printer_selection.duplex_short')) {
33101
+ this.selectedProperties.duplex = true;
33081
33102
  }
33082
33103
  else {
33083
- this.selectedProperties.duplex = true;
33104
+ this.selectedProperties.duplex = false;
33084
33105
  }
33085
33106
  this.selectedProperties.duplexmode = eventDetails.id;
33086
- // console.log('duplex selected:')
33087
- // console.log(this.selectedProperties.duplexmode)
33088
33107
  break;
33089
33108
  }
33090
- // setting paper id here to updated the prop for input.
33091
33109
  this.setPaperid();
33092
33110
  }
33093
33111
  async handleFiles(file, printPorperties) {
@@ -33190,7 +33208,28 @@ let EzpPrinterSelection = class {
33190
33208
  if (this.selectedPrinter.id != '') {
33191
33209
  await this.printService
33192
33210
  .getPrinterProperties(authStore.state.accessToken, this.selectedPrinter.id)
33193
- .then((data) => (this.selectedPrinterConfig = data[0]));
33211
+ .then((data) => {
33212
+ var _a, _b, _c, _d, _e, _f, _g;
33213
+ this.selectedPrinterConfig = data[0];
33214
+ this.selectedProperties.color = ((_a = this.selectedPrinterConfig.Default) === null || _a === void 0 ? void 0 : _a.Color) == "color" ? true : false;
33215
+ this.selectedProperties.orientation = (_b = this.selectedPrinterConfig.Default) === null || _b === void 0 ? void 0 : _b.Orientation;
33216
+ this.selectedProperties.resolution = (_c = this.selectedPrinterConfig.Default) === null || _c === void 0 ? void 0 : _c.Resolution;
33217
+ let defaultPaper = (_d = this.selectedPrinterConfig.PaperFormats) === null || _d === void 0 ? void 0 : _d.find(obj => obj.Default === true);
33218
+ this.selectedProperties.paper = defaultPaper === null || defaultPaper === void 0 ? void 0 : defaultPaper.Name;
33219
+ this.selectedProperties.paperid = defaultPaper === null || defaultPaper === void 0 ? void 0 : defaultPaper.Id;
33220
+ let defaultSource = (_e = this.selectedPrinterConfig.Trays) === null || _e === void 0 ? void 0 : _e.find(obj => obj.Default === true);
33221
+ if (this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 1 && this.selectedPrinterConfig.Trays[0] != null) {
33222
+ this.selectedProperties.trayname = defaultSource === null || defaultSource === void 0 ? void 0 : defaultSource.Name;
33223
+ this.selectedProperties.defaultSource = defaultSource === null || defaultSource === void 0 ? void 0 : defaultSource.Index;
33224
+ }
33225
+ if (this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 0 && this.selectedPrinterConfig.Trays[0] == null) {
33226
+ delete this.selectedProperties.trayname;
33227
+ delete this.selectedProperties.defaultSource;
33228
+ }
33229
+ this.selectedProperties.duplex = (_f = this.selectedPrinterConfig) === null || _f === void 0 ? void 0 : _f.DuplexSupported;
33230
+ this.selectedProperties.duplexmode = (_g = this.selectedPrinterConfig) === null || _g === void 0 ? void 0 : _g.DuplexMode;
33231
+ delete this.selectedProperties.PageRanges;
33232
+ });
33194
33233
  if (this.selectedProperties.paper === '') {
33195
33234
  this.setDefaultPaperFormat();
33196
33235
  }
@@ -33276,7 +33315,7 @@ let EzpPrinterSelection = class {
33276
33315
  type: 'tray',
33277
33316
  })), preSelected: this.selectedPrinter.id && ((_o = this.selectedPrinterConfig.Trays) === null || _o === void 0 ? void 0 : _o.find((el) => el.Name.includes(this.selectedPrinterConfig.Default.Tray)))
33278
33317
  ? this.selectedPrinterConfig.Default.Tray
33279
- : null })) : null, h("ezp-input", { icon: "paper_range", suffix: "", placeholder: "1-2,4-5,8", value: localStorage.getItem('pageRanges') ? this.selectedProperties.PageRanges : '', eventType: "paper_ranges", type: "text", label: i18next.t('printer_selection.page_ranges') })), h("ezp-stepper", { label: i18next.t('printer_selection.copies'), max: 10, 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 }))));
33318
+ : 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'), max: 10, 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 }))));
33280
33319
  }
33281
33320
  };
33282
33321
  EzpPrinterSelection.style = ezpPrinterSelectionCss;
@@ -33862,7 +33901,6 @@ let EzpUpload = class {
33862
33901
  this.handleInput = () => {
33863
33902
  this.filename = this.input.files[0].name;
33864
33903
  this.uploadFile.emit(this.input.files);
33865
- localStorage.removeItem('pageRanges');
33866
33904
  };
33867
33905
  }
33868
33906
  /**