@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.
@@ -32571,6 +32571,7 @@ class PageBlobClient extends BlobClient {
32571
32571
 
32572
32572
  class EzpPrintService {
32573
32573
  constructor(redirectURI, clientID) {
32574
+ this.abortController = null;
32574
32575
  this.getPrintStatus = () => {
32575
32576
  return fetch(`https://${this.printingApi}/sfapi/Status/?id=${encodeURIComponent(printStore.state.jobID)}`, {
32576
32577
  headers: {
@@ -32659,6 +32660,7 @@ class EzpPrintService {
32659
32660
  });
32660
32661
  }
32661
32662
  printFileByUrl(accessToken, fileUrl, fileType, printerID, properties, filename, printAndDelete) {
32663
+ this.abortController = new AbortController();
32662
32664
  return fetch(`https://${this.printingApi}/sfapi/Print/`, {
32663
32665
  method: 'POST',
32664
32666
  headers: {
@@ -32666,8 +32668,15 @@ class EzpPrintService {
32666
32668
  'Content-Type': 'application/json',
32667
32669
  },
32668
32670
  body: JSON.stringify(Object.assign(Object.assign(Object.assign({ fileurl: fileUrl, type: fileType, printerid: printerID }, (filename && { alias: filename })), (printAndDelete && { printanddelete: printAndDelete })), { properties })),
32671
+ signal: this.abortController.signal
32669
32672
  });
32670
32673
  }
32674
+ abortPrint() {
32675
+ if (this.abortController) {
32676
+ this.abortController.abort();
32677
+ this.abortController = null;
32678
+ }
32679
+ }
32671
32680
  printByFileID(accessToken, fileID, fileType, printerID, properties, filename, printAndDelete) {
32672
32681
  return fetch(`https://${this.printingApi}/sfapi/Print/`, {
32673
32682
  method: 'POST',
@@ -32963,6 +32972,8 @@ let EzpPrinterSelection = class {
32963
32972
  if (event.detail === 'print-processing') {
32964
32973
  this.printStopped = true;
32965
32974
  this.printProcessing = false;
32975
+ // Abort the print request
32976
+ this.printService.abortPrint();
32966
32977
  }
32967
32978
  }
32968
32979
  listenStatusClose(event) {
@@ -33031,37 +33042,47 @@ let EzpPrinterSelection = class {
33031
33042
  await this.printService
33032
33043
  .getPrinterProperties(authStore.state.accessToken, this.selectedPrinter.id)
33033
33044
  .then((data) => {
33045
+ var _a, _b, _c, _d, _e, _f, _g;
33034
33046
  this.selectedPrinterConfig = Object.assign(Object.assign({}, this.selectedPrinterConfig), data[0]);
33047
+ this.selectedProperties.color = ((_a = this.selectedPrinterConfig.Default) === null || _a === void 0 ? void 0 : _a.Color) == "color" ? true : false;
33048
+ this.selectedProperties.orientation = (_b = this.selectedPrinterConfig.Default) === null || _b === void 0 ? void 0 : _b.Orientation;
33049
+ this.selectedProperties.resolution = (_c = this.selectedPrinterConfig.Default) === null || _c === void 0 ? void 0 : _c.Resolution;
33050
+ let defaultPaper = (_d = this.selectedPrinterConfig.PaperFormats) === null || _d === void 0 ? void 0 : _d.find(obj => obj.Default === true);
33051
+ this.selectedProperties.paper = defaultPaper === null || defaultPaper === void 0 ? void 0 : defaultPaper.Name;
33052
+ this.selectedProperties.paperid = defaultPaper === null || defaultPaper === void 0 ? void 0 : defaultPaper.Id;
33053
+ let defaultSource = (_e = this.selectedPrinterConfig.Trays) === null || _e === void 0 ? void 0 : _e.find(obj => obj.Default === true);
33054
+ if (this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 1 && this.selectedPrinterConfig.Trays[0] != null) {
33055
+ this.selectedProperties.trayname = defaultSource === null || defaultSource === void 0 ? void 0 : defaultSource.Name;
33056
+ this.selectedProperties.defaultSource = defaultSource === null || defaultSource === void 0 ? void 0 : defaultSource.Index;
33057
+ }
33058
+ if (this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 0 && this.selectedPrinterConfig.Trays[0] == null) {
33059
+ delete this.selectedProperties.trayname;
33060
+ delete this.selectedProperties.defaultSource;
33061
+ }
33062
+ this.selectedProperties.duplex = (_f = this.selectedPrinterConfig) === null || _f === void 0 ? void 0 : _f.DuplexSupported;
33063
+ this.selectedProperties.duplexmode = (_g = this.selectedPrinterConfig) === null || _g === void 0 ? void 0 : _g.DuplexMode;
33064
+ delete this.selectedProperties.PageRanges;
33035
33065
  });
33036
33066
  // this.setDefaultPaperFormat()
33037
33067
  break;
33038
33068
  case 'color':
33039
- this.selectedProperties.color = !!eventDetails.id;
33040
- // console.log('color selected:')
33041
- // console.log(this.selectedProperties.color)
33069
+ this.selectedProperties.color = eventDetails.title == i18next.t('printer_selection.color_color') ? true : false;
33042
33070
  break;
33043
33071
  case 'orientation':
33044
33072
  this.selectedProperties.orientation = eventDetails.id;
33045
- // console.log('orientation selected:')
33046
- // console.log(this.selectedProperties.orientation)
33047
33073
  break;
33048
33074
  case 'format':
33049
33075
  this.selectedProperties.paper = eventDetails.title;
33050
33076
  this.selectedProperties.paperid = eventDetails.id;
33051
- // console.log('paper selected:')
33052
33077
  break;
33053
33078
  case 'quality':
33054
33079
  this.selectedProperties.resolution = eventDetails.title;
33055
- // console.log('quality selected:')
33056
- // console.log(this.selectedProperties.resolution)
33057
33080
  break;
33058
33081
  case 'length':
33059
33082
  this.selectedProperties.paperlength = eventDetails.value;
33060
- // console.log(this.selectedProperties)
33061
33083
  break;
33062
33084
  case 'width':
33063
33085
  this.selectedProperties.paperwidth = eventDetails.value;
33064
- // console.log(this.selectedProperties)
33065
33086
  break;
33066
33087
  case 'tray':
33067
33088
  if (this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 0 && this.selectedPrinterConfig.Trays[0] == null) {
@@ -33076,22 +33097,19 @@ let EzpPrinterSelection = class {
33076
33097
  case 'paper_ranges':
33077
33098
  this.selectedProperties.PageRanges = eventDetails.value;
33078
33099
  this.pageRangeInvalid = !validatePageRange(this.selectedProperties.PageRanges);
33079
- localStorage.setItem('pageRanges', JSON.stringify(this.selectedProperties.PageRanges));
33080
- // console.log(this.selectedProperties.PageRanges)
33081
33100
  break;
33082
33101
  case 'duplex':
33083
- if (eventDetails.title === 'None') {
33084
- this.selectedProperties.duplex = false;
33102
+ if (eventDetails.title == i18next.t('printer_selection.duplex_none')
33103
+ || eventDetails.title == i18next.t('printer_selection.duplex_long')
33104
+ || eventDetails.title == i18next.t('printer_selection.duplex_short')) {
33105
+ this.selectedProperties.duplex = true;
33085
33106
  }
33086
33107
  else {
33087
- this.selectedProperties.duplex = true;
33108
+ this.selectedProperties.duplex = false;
33088
33109
  }
33089
33110
  this.selectedProperties.duplexmode = eventDetails.id;
33090
- // console.log('duplex selected:')
33091
- // console.log(this.selectedProperties.duplexmode)
33092
33111
  break;
33093
33112
  }
33094
- // setting paper id here to updated the prop for input.
33095
33113
  this.setPaperid();
33096
33114
  }
33097
33115
  async handleFiles(file, printPorperties) {
@@ -33194,7 +33212,28 @@ let EzpPrinterSelection = class {
33194
33212
  if (this.selectedPrinter.id != '') {
33195
33213
  await this.printService
33196
33214
  .getPrinterProperties(authStore.state.accessToken, this.selectedPrinter.id)
33197
- .then((data) => (this.selectedPrinterConfig = data[0]));
33215
+ .then((data) => {
33216
+ var _a, _b, _c, _d, _e, _f, _g;
33217
+ this.selectedPrinterConfig = data[0];
33218
+ this.selectedProperties.color = ((_a = this.selectedPrinterConfig.Default) === null || _a === void 0 ? void 0 : _a.Color) == "color" ? true : false;
33219
+ this.selectedProperties.orientation = (_b = this.selectedPrinterConfig.Default) === null || _b === void 0 ? void 0 : _b.Orientation;
33220
+ this.selectedProperties.resolution = (_c = this.selectedPrinterConfig.Default) === null || _c === void 0 ? void 0 : _c.Resolution;
33221
+ let defaultPaper = (_d = this.selectedPrinterConfig.PaperFormats) === null || _d === void 0 ? void 0 : _d.find(obj => obj.Default === true);
33222
+ this.selectedProperties.paper = defaultPaper === null || defaultPaper === void 0 ? void 0 : defaultPaper.Name;
33223
+ this.selectedProperties.paperid = defaultPaper === null || defaultPaper === void 0 ? void 0 : defaultPaper.Id;
33224
+ let defaultSource = (_e = this.selectedPrinterConfig.Trays) === null || _e === void 0 ? void 0 : _e.find(obj => obj.Default === true);
33225
+ if (this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 1 && this.selectedPrinterConfig.Trays[0] != null) {
33226
+ this.selectedProperties.trayname = defaultSource === null || defaultSource === void 0 ? void 0 : defaultSource.Name;
33227
+ this.selectedProperties.defaultSource = defaultSource === null || defaultSource === void 0 ? void 0 : defaultSource.Index;
33228
+ }
33229
+ if (this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 0 && this.selectedPrinterConfig.Trays[0] == null) {
33230
+ delete this.selectedProperties.trayname;
33231
+ delete this.selectedProperties.defaultSource;
33232
+ }
33233
+ this.selectedProperties.duplex = (_f = this.selectedPrinterConfig) === null || _f === void 0 ? void 0 : _f.DuplexSupported;
33234
+ this.selectedProperties.duplexmode = (_g = this.selectedPrinterConfig) === null || _g === void 0 ? void 0 : _g.DuplexMode;
33235
+ delete this.selectedProperties.PageRanges;
33236
+ });
33198
33237
  if (this.selectedProperties.paper === '') {
33199
33238
  this.setDefaultPaperFormat();
33200
33239
  }
@@ -33280,7 +33319,7 @@ let EzpPrinterSelection = class {
33280
33319
  type: 'tray',
33281
33320
  })), preSelected: this.selectedPrinter.id && ((_o = this.selectedPrinterConfig.Trays) === null || _o === void 0 ? void 0 : _o.find((el) => el.Name.includes(this.selectedPrinterConfig.Default.Tray)))
33282
33321
  ? this.selectedPrinterConfig.Default.Tray
33283
- : null })) : null, index.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') })), index.h("ezp-stepper", { label: i18next.t('printer_selection.copies'), max: 10, icon: "copies" })), index.h("div", { id: "footer" }, index.h("ezp-text-button", { type: "button", level: "secondary", onClick: this.handleCancel, label: i18next.t('button_actions.cancel'), class: "action", id: "cancel" }), index.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 && index.h("ezp-user-menu", { open: this.userMenuOpen, name: this.userName }))));
33322
+ : null })) : null, index.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') })), index.h("ezp-stepper", { label: i18next.t('printer_selection.copies'), max: 10, icon: "copies" })), index.h("div", { id: "footer" }, index.h("ezp-text-button", { type: "button", level: "secondary", onClick: this.handleCancel, label: i18next.t('button_actions.cancel'), class: "action", id: "cancel" }), index.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 && index.h("ezp-user-menu", { open: this.userMenuOpen, name: this.userName }))));
33284
33323
  }
33285
33324
  };
33286
33325
  EzpPrinterSelection.style = ezpPrinterSelectionCss;
@@ -33866,7 +33905,6 @@ let EzpUpload = class {
33866
33905
  this.handleInput = () => {
33867
33906
  this.filename = this.input.files[0].name;
33868
33907
  this.uploadFile.emit(this.input.files);
33869
- localStorage.removeItem('pageRanges');
33870
33908
  };
33871
33909
  }
33872
33910
  /**
@@ -209,6 +209,8 @@ export class EzpPrinterSelection {
209
209
  if (event.detail === 'print-processing') {
210
210
  this.printStopped = true;
211
211
  this.printProcessing = false;
212
+ // Abort the print request
213
+ this.printService.abortPrint();
212
214
  }
213
215
  }
214
216
  listenStatusClose(event) {
@@ -277,37 +279,47 @@ export class EzpPrinterSelection {
277
279
  await this.printService
278
280
  .getPrinterProperties(authStore.state.accessToken, this.selectedPrinter.id)
279
281
  .then((data) => {
282
+ var _a, _b, _c, _d, _e, _f, _g;
280
283
  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;
285
+ this.selectedProperties.orientation = (_b = this.selectedPrinterConfig.Default) === null || _b === void 0 ? void 0 : _b.Orientation;
286
+ 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);
288
+ this.selectedProperties.paper = defaultPaper === null || defaultPaper === void 0 ? void 0 : defaultPaper.Name;
289
+ 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) {
292
+ this.selectedProperties.trayname = defaultSource === null || defaultSource === void 0 ? void 0 : defaultSource.Name;
293
+ this.selectedProperties.defaultSource = defaultSource === null || defaultSource === void 0 ? void 0 : defaultSource.Index;
294
+ }
295
+ if (this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 0 && this.selectedPrinterConfig.Trays[0] == null) {
296
+ delete this.selectedProperties.trayname;
297
+ delete this.selectedProperties.defaultSource;
298
+ }
299
+ this.selectedProperties.duplex = (_f = this.selectedPrinterConfig) === null || _f === void 0 ? void 0 : _f.DuplexSupported;
300
+ this.selectedProperties.duplexmode = (_g = this.selectedPrinterConfig) === null || _g === void 0 ? void 0 : _g.DuplexMode;
301
+ delete this.selectedProperties.PageRanges;
281
302
  });
282
303
  // this.setDefaultPaperFormat()
283
304
  break;
284
305
  case 'color':
285
- this.selectedProperties.color = !!eventDetails.id;
286
- // console.log('color selected:')
287
- // console.log(this.selectedProperties.color)
306
+ this.selectedProperties.color = eventDetails.title == i18next.t('printer_selection.color_color') ? true : false;
288
307
  break;
289
308
  case 'orientation':
290
309
  this.selectedProperties.orientation = eventDetails.id;
291
- // console.log('orientation selected:')
292
- // console.log(this.selectedProperties.orientation)
293
310
  break;
294
311
  case 'format':
295
312
  this.selectedProperties.paper = eventDetails.title;
296
313
  this.selectedProperties.paperid = eventDetails.id;
297
- // console.log('paper selected:')
298
314
  break;
299
315
  case 'quality':
300
316
  this.selectedProperties.resolution = eventDetails.title;
301
- // console.log('quality selected:')
302
- // console.log(this.selectedProperties.resolution)
303
317
  break;
304
318
  case 'length':
305
319
  this.selectedProperties.paperlength = eventDetails.value;
306
- // console.log(this.selectedProperties)
307
320
  break;
308
321
  case 'width':
309
322
  this.selectedProperties.paperwidth = eventDetails.value;
310
- // console.log(this.selectedProperties)
311
323
  break;
312
324
  case 'tray':
313
325
  if (this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 0 && this.selectedPrinterConfig.Trays[0] == null) {
@@ -322,24 +334,21 @@ export class EzpPrinterSelection {
322
334
  case 'paper_ranges':
323
335
  this.selectedProperties.PageRanges = eventDetails.value;
324
336
  this.pageRangeInvalid = !validatePageRange(this.selectedProperties.PageRanges);
325
- localStorage.setItem('pageRanges', JSON.stringify(this.selectedProperties.PageRanges));
326
- // console.log(this.selectedProperties.PageRanges)
327
337
  break;
328
338
  case 'duplex':
329
- if (eventDetails.title === 'None') {
330
- this.selectedProperties.duplex = false;
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')) {
342
+ this.selectedProperties.duplex = true;
331
343
  }
332
344
  else {
333
- this.selectedProperties.duplex = true;
345
+ this.selectedProperties.duplex = false;
334
346
  }
335
347
  this.selectedProperties.duplexmode = eventDetails.id;
336
- // console.log('duplex selected:')
337
- // console.log(this.selectedProperties.duplexmode)
338
348
  break;
339
349
  default:
340
350
  break;
341
351
  }
342
- // setting paper id here to updated the prop for input.
343
352
  this.setPaperid();
344
353
  }
345
354
  async handleFiles(file, printPorperties) {
@@ -442,7 +451,28 @@ export class EzpPrinterSelection {
442
451
  if (this.selectedPrinter.id != '') {
443
452
  await this.printService
444
453
  .getPrinterProperties(authStore.state.accessToken, this.selectedPrinter.id)
445
- .then((data) => (this.selectedPrinterConfig = data[0]));
454
+ .then((data) => {
455
+ var _a, _b, _c, _d, _e, _f, _g;
456
+ this.selectedPrinterConfig = data[0];
457
+ this.selectedProperties.color = ((_a = this.selectedPrinterConfig.Default) === null || _a === void 0 ? void 0 : _a.Color) == "color" ? true : false;
458
+ this.selectedProperties.orientation = (_b = this.selectedPrinterConfig.Default) === null || _b === void 0 ? void 0 : _b.Orientation;
459
+ 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);
461
+ this.selectedProperties.paper = defaultPaper === null || defaultPaper === void 0 ? void 0 : defaultPaper.Name;
462
+ 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) {
465
+ this.selectedProperties.trayname = defaultSource === null || defaultSource === void 0 ? void 0 : defaultSource.Name;
466
+ this.selectedProperties.defaultSource = defaultSource === null || defaultSource === void 0 ? void 0 : defaultSource.Index;
467
+ }
468
+ if (this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 0 && this.selectedPrinterConfig.Trays[0] == null) {
469
+ delete this.selectedProperties.trayname;
470
+ delete this.selectedProperties.defaultSource;
471
+ }
472
+ this.selectedProperties.duplex = (_f = this.selectedPrinterConfig) === null || _f === void 0 ? void 0 : _f.DuplexSupported;
473
+ this.selectedProperties.duplexmode = (_g = this.selectedPrinterConfig) === null || _g === void 0 ? void 0 : _g.DuplexMode;
474
+ delete this.selectedProperties.PageRanges;
475
+ });
446
476
  if (this.selectedProperties.paper === '') {
447
477
  this.setDefaultPaperFormat();
448
478
  }
@@ -548,7 +578,7 @@ export class EzpPrinterSelection {
548
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)))
549
579
  ? this.selectedPrinterConfig.Default.Tray
550
580
  : null })) : null,
551
- 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') })),
581
+ 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') })),
552
582
  h("ezp-stepper", { label: i18next.t('printer_selection.copies'), max: 10, icon: "copies" })),
553
583
  h("div", { id: "footer" },
554
584
  h("ezp-text-button", { type: "button", level: "secondary", onClick: this.handleCancel, label: i18next.t('button_actions.cancel'), class: "action", id: "cancel" }),
@@ -17,7 +17,6 @@ export class EzpUpload {
17
17
  this.handleInput = () => {
18
18
  this.filename = this.input.files[0].name;
19
19
  this.uploadFile.emit(this.input.files);
20
- localStorage.removeItem('pageRanges');
21
20
  };
22
21
  }
23
22
  /**
@@ -4,6 +4,7 @@ import fetchIntercept from 'fetch-intercept';
4
4
  import { AnonymousCredential, BlockBlobClient, newPipeline } from '@azure/storage-blob';
5
5
  export class EzpPrintService {
6
6
  constructor(redirectURI, clientID) {
7
+ this.abortController = null;
7
8
  this.getPrintStatus = () => {
8
9
  return fetch(`https://${this.printingApi}/sfapi/Status/?id=${encodeURIComponent(printStore.state.jobID)}`, {
9
10
  headers: {
@@ -92,6 +93,7 @@ export class EzpPrintService {
92
93
  });
93
94
  }
94
95
  printFileByUrl(accessToken, fileUrl, fileType, printerID, properties, filename, printAndDelete) {
96
+ this.abortController = new AbortController();
95
97
  return fetch(`https://${this.printingApi}/sfapi/Print/`, {
96
98
  method: 'POST',
97
99
  headers: {
@@ -99,8 +101,15 @@ export class EzpPrintService {
99
101
  'Content-Type': 'application/json',
100
102
  },
101
103
  body: JSON.stringify(Object.assign(Object.assign(Object.assign({ fileurl: fileUrl, type: fileType, printerid: printerID }, (filename && { alias: filename })), (printAndDelete && { printanddelete: printAndDelete })), { properties })),
104
+ signal: this.abortController.signal
102
105
  });
103
106
  }
107
+ abortPrint() {
108
+ if (this.abortController) {
109
+ this.abortController.abort();
110
+ this.abortController = null;
111
+ }
112
+ }
104
113
  printByFileID(accessToken, fileID, fileType, printerID, properties, filename, printAndDelete) {
105
114
  return fetch(`https://${this.printingApi}/sfapi/Print/`, {
106
115
  method: 'POST',
@@ -32594,6 +32594,7 @@ class PageBlobClient extends BlobClient {
32594
32594
 
32595
32595
  class EzpPrintService {
32596
32596
  constructor(redirectURI, clientID) {
32597
+ this.abortController = null;
32597
32598
  this.getPrintStatus = () => {
32598
32599
  return fetch(`https://${this.printingApi}/sfapi/Status/?id=${encodeURIComponent(printStore.state.jobID)}`, {
32599
32600
  headers: {
@@ -32682,6 +32683,7 @@ class EzpPrintService {
32682
32683
  });
32683
32684
  }
32684
32685
  printFileByUrl(accessToken, fileUrl, fileType, printerID, properties, filename, printAndDelete) {
32686
+ this.abortController = new AbortController();
32685
32687
  return fetch(`https://${this.printingApi}/sfapi/Print/`, {
32686
32688
  method: 'POST',
32687
32689
  headers: {
@@ -32689,8 +32691,15 @@ class EzpPrintService {
32689
32691
  'Content-Type': 'application/json',
32690
32692
  },
32691
32693
  body: JSON.stringify(Object.assign(Object.assign(Object.assign({ fileurl: fileUrl, type: fileType, printerid: printerID }, (filename && { alias: filename })), (printAndDelete && { printanddelete: printAndDelete })), { properties })),
32694
+ signal: this.abortController.signal
32692
32695
  });
32693
32696
  }
32697
+ abortPrint() {
32698
+ if (this.abortController) {
32699
+ this.abortController.abort();
32700
+ this.abortController = null;
32701
+ }
32702
+ }
32694
32703
  printByFileID(accessToken, fileID, fileType, printerID, properties, filename, printAndDelete) {
32695
32704
  return fetch(`https://${this.printingApi}/sfapi/Print/`, {
32696
32705
  method: 'POST',
@@ -32988,6 +32997,8 @@ let EzpPrinterSelection$1 = class extends HTMLElement {
32988
32997
  if (event.detail === 'print-processing') {
32989
32998
  this.printStopped = true;
32990
32999
  this.printProcessing = false;
33000
+ // Abort the print request
33001
+ this.printService.abortPrint();
32991
33002
  }
32992
33003
  }
32993
33004
  listenStatusClose(event) {
@@ -33056,37 +33067,47 @@ let EzpPrinterSelection$1 = class extends HTMLElement {
33056
33067
  await this.printService
33057
33068
  .getPrinterProperties(authStore.state.accessToken, this.selectedPrinter.id)
33058
33069
  .then((data) => {
33070
+ var _a, _b, _c, _d, _e, _f, _g;
33059
33071
  this.selectedPrinterConfig = Object.assign(Object.assign({}, this.selectedPrinterConfig), data[0]);
33072
+ this.selectedProperties.color = ((_a = this.selectedPrinterConfig.Default) === null || _a === void 0 ? void 0 : _a.Color) == "color" ? true : false;
33073
+ this.selectedProperties.orientation = (_b = this.selectedPrinterConfig.Default) === null || _b === void 0 ? void 0 : _b.Orientation;
33074
+ this.selectedProperties.resolution = (_c = this.selectedPrinterConfig.Default) === null || _c === void 0 ? void 0 : _c.Resolution;
33075
+ let defaultPaper = (_d = this.selectedPrinterConfig.PaperFormats) === null || _d === void 0 ? void 0 : _d.find(obj => obj.Default === true);
33076
+ this.selectedProperties.paper = defaultPaper === null || defaultPaper === void 0 ? void 0 : defaultPaper.Name;
33077
+ this.selectedProperties.paperid = defaultPaper === null || defaultPaper === void 0 ? void 0 : defaultPaper.Id;
33078
+ let defaultSource = (_e = this.selectedPrinterConfig.Trays) === null || _e === void 0 ? void 0 : _e.find(obj => obj.Default === true);
33079
+ if (this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 1 && this.selectedPrinterConfig.Trays[0] != null) {
33080
+ this.selectedProperties.trayname = defaultSource === null || defaultSource === void 0 ? void 0 : defaultSource.Name;
33081
+ this.selectedProperties.defaultSource = defaultSource === null || defaultSource === void 0 ? void 0 : defaultSource.Index;
33082
+ }
33083
+ if (this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 0 && this.selectedPrinterConfig.Trays[0] == null) {
33084
+ delete this.selectedProperties.trayname;
33085
+ delete this.selectedProperties.defaultSource;
33086
+ }
33087
+ this.selectedProperties.duplex = (_f = this.selectedPrinterConfig) === null || _f === void 0 ? void 0 : _f.DuplexSupported;
33088
+ this.selectedProperties.duplexmode = (_g = this.selectedPrinterConfig) === null || _g === void 0 ? void 0 : _g.DuplexMode;
33089
+ delete this.selectedProperties.PageRanges;
33060
33090
  });
33061
33091
  // this.setDefaultPaperFormat()
33062
33092
  break;
33063
33093
  case 'color':
33064
- this.selectedProperties.color = !!eventDetails.id;
33065
- // console.log('color selected:')
33066
- // console.log(this.selectedProperties.color)
33094
+ this.selectedProperties.color = eventDetails.title == i18next.t('printer_selection.color_color') ? true : false;
33067
33095
  break;
33068
33096
  case 'orientation':
33069
33097
  this.selectedProperties.orientation = eventDetails.id;
33070
- // console.log('orientation selected:')
33071
- // console.log(this.selectedProperties.orientation)
33072
33098
  break;
33073
33099
  case 'format':
33074
33100
  this.selectedProperties.paper = eventDetails.title;
33075
33101
  this.selectedProperties.paperid = eventDetails.id;
33076
- // console.log('paper selected:')
33077
33102
  break;
33078
33103
  case 'quality':
33079
33104
  this.selectedProperties.resolution = eventDetails.title;
33080
- // console.log('quality selected:')
33081
- // console.log(this.selectedProperties.resolution)
33082
33105
  break;
33083
33106
  case 'length':
33084
33107
  this.selectedProperties.paperlength = eventDetails.value;
33085
- // console.log(this.selectedProperties)
33086
33108
  break;
33087
33109
  case 'width':
33088
33110
  this.selectedProperties.paperwidth = eventDetails.value;
33089
- // console.log(this.selectedProperties)
33090
33111
  break;
33091
33112
  case 'tray':
33092
33113
  if (this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 0 && this.selectedPrinterConfig.Trays[0] == null) {
@@ -33101,22 +33122,19 @@ let EzpPrinterSelection$1 = class extends HTMLElement {
33101
33122
  case 'paper_ranges':
33102
33123
  this.selectedProperties.PageRanges = eventDetails.value;
33103
33124
  this.pageRangeInvalid = !validatePageRange(this.selectedProperties.PageRanges);
33104
- localStorage.setItem('pageRanges', JSON.stringify(this.selectedProperties.PageRanges));
33105
- // console.log(this.selectedProperties.PageRanges)
33106
33125
  break;
33107
33126
  case 'duplex':
33108
- if (eventDetails.title === 'None') {
33109
- this.selectedProperties.duplex = false;
33127
+ if (eventDetails.title == i18next.t('printer_selection.duplex_none')
33128
+ || eventDetails.title == i18next.t('printer_selection.duplex_long')
33129
+ || eventDetails.title == i18next.t('printer_selection.duplex_short')) {
33130
+ this.selectedProperties.duplex = true;
33110
33131
  }
33111
33132
  else {
33112
- this.selectedProperties.duplex = true;
33133
+ this.selectedProperties.duplex = false;
33113
33134
  }
33114
33135
  this.selectedProperties.duplexmode = eventDetails.id;
33115
- // console.log('duplex selected:')
33116
- // console.log(this.selectedProperties.duplexmode)
33117
33136
  break;
33118
33137
  }
33119
- // setting paper id here to updated the prop for input.
33120
33138
  this.setPaperid();
33121
33139
  }
33122
33140
  async handleFiles(file, printPorperties) {
@@ -33219,7 +33237,28 @@ let EzpPrinterSelection$1 = class extends HTMLElement {
33219
33237
  if (this.selectedPrinter.id != '') {
33220
33238
  await this.printService
33221
33239
  .getPrinterProperties(authStore.state.accessToken, this.selectedPrinter.id)
33222
- .then((data) => (this.selectedPrinterConfig = data[0]));
33240
+ .then((data) => {
33241
+ var _a, _b, _c, _d, _e, _f, _g;
33242
+ this.selectedPrinterConfig = data[0];
33243
+ this.selectedProperties.color = ((_a = this.selectedPrinterConfig.Default) === null || _a === void 0 ? void 0 : _a.Color) == "color" ? true : false;
33244
+ this.selectedProperties.orientation = (_b = this.selectedPrinterConfig.Default) === null || _b === void 0 ? void 0 : _b.Orientation;
33245
+ this.selectedProperties.resolution = (_c = this.selectedPrinterConfig.Default) === null || _c === void 0 ? void 0 : _c.Resolution;
33246
+ let defaultPaper = (_d = this.selectedPrinterConfig.PaperFormats) === null || _d === void 0 ? void 0 : _d.find(obj => obj.Default === true);
33247
+ this.selectedProperties.paper = defaultPaper === null || defaultPaper === void 0 ? void 0 : defaultPaper.Name;
33248
+ this.selectedProperties.paperid = defaultPaper === null || defaultPaper === void 0 ? void 0 : defaultPaper.Id;
33249
+ let defaultSource = (_e = this.selectedPrinterConfig.Trays) === null || _e === void 0 ? void 0 : _e.find(obj => obj.Default === true);
33250
+ if (this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 1 && this.selectedPrinterConfig.Trays[0] != null) {
33251
+ this.selectedProperties.trayname = defaultSource === null || defaultSource === void 0 ? void 0 : defaultSource.Name;
33252
+ this.selectedProperties.defaultSource = defaultSource === null || defaultSource === void 0 ? void 0 : defaultSource.Index;
33253
+ }
33254
+ if (this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 0 && this.selectedPrinterConfig.Trays[0] == null) {
33255
+ delete this.selectedProperties.trayname;
33256
+ delete this.selectedProperties.defaultSource;
33257
+ }
33258
+ this.selectedProperties.duplex = (_f = this.selectedPrinterConfig) === null || _f === void 0 ? void 0 : _f.DuplexSupported;
33259
+ this.selectedProperties.duplexmode = (_g = this.selectedPrinterConfig) === null || _g === void 0 ? void 0 : _g.DuplexMode;
33260
+ delete this.selectedProperties.PageRanges;
33261
+ });
33223
33262
  if (this.selectedProperties.paper === '') {
33224
33263
  this.setDefaultPaperFormat();
33225
33264
  }
@@ -33305,7 +33344,7 @@ let EzpPrinterSelection$1 = class extends HTMLElement {
33305
33344
  type: 'tray',
33306
33345
  })), preSelected: this.selectedPrinter.id && ((_o = this.selectedPrinterConfig.Trays) === null || _o === void 0 ? void 0 : _o.find((el) => el.Name.includes(this.selectedPrinterConfig.Default.Tray)))
33307
33346
  ? this.selectedPrinterConfig.Default.Tray
33308
- : 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 }))));
33347
+ : 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 }))));
33309
33348
  }
33310
33349
  static get style() { return ezpPrinterSelectionCss; }
33311
33350
  };
@@ -33903,7 +33942,6 @@ let EzpUpload$1 = class extends HTMLElement {
33903
33942
  this.handleInput = () => {
33904
33943
  this.filename = this.input.files[0].name;
33905
33944
  this.uploadFile.emit(this.input.files);
33906
- localStorage.removeItem('pageRanges');
33907
33945
  };
33908
33946
  }
33909
33947
  /**