@hitsoft/e-donusum 1.0.73 → 1.0.75

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.
@@ -9309,15 +9309,14 @@ class HitSharedService {
9309
9309
  constructor() {
9310
9310
  this.apiName = 'eDonusum';
9311
9311
  this.previewFile = (base64) => {
9312
- const byteCharacters = atob(base64);
9313
- const byteNumbers = new Array(byteCharacters.length);
9314
- for (let i = 0; i < byteCharacters.length; i++) {
9315
- byteNumbers[i] = byteCharacters.charCodeAt(i);
9316
- }
9317
- const byteArray = new Uint8Array(byteNumbers);
9318
- const blob = new Blob([byteArray], { type: 'application/pdf' });
9312
+ const cleanBase64 = base64.includes(',') ? base64.split(',')[1] : base64;
9313
+ const bytes = Uint8Array.from(atob(cleanBase64), c => c.charCodeAt(0));
9314
+ const blob = new Blob([bytes], { type: 'application/pdf' });
9319
9315
  const url = URL.createObjectURL(blob);
9320
- window.open(url);
9316
+ // Yeni tab (preview)
9317
+ window.open(url, '_blank', 'noopener');
9318
+ // İstersen kısa süre sonra URL'i serbest bırak (preview açıldıktan sonra)
9319
+ setTimeout(() => URL.revokeObjectURL(url), 60000);
9321
9320
  };
9322
9321
  }
9323
9322
  }
@@ -9510,10 +9509,10 @@ class HitInvoiceComponent {
9510
9509
  this.invoiceService.getInvoiceView(record.uuId).subscribe(item => {
9511
9510
  const source = `data:${item.mimeType};base64,${item.content}`;
9512
9511
  this.hitSharedService.previewFile(item.content);
9513
- const link = document.createElement('a');
9512
+ /*const link = document.createElement('a');
9514
9513
  link.href = source;
9515
9514
  link.download = `${item.filename}`;
9516
- link.click();
9515
+ link.click();*/
9517
9516
  });
9518
9517
  }
9519
9518
  showAllFiles(record) {
@@ -11281,11 +11280,10 @@ class HitDespatchComponent {
11281
11280
  debugger;
11282
11281
  this.service.getDespatchPreview(record.id, record.resourceDocType).subscribe(fatura => {
11283
11282
  const source = `data:text/html;base64,${fatura.previewHTML}`;
11284
- this.hitSharedService.previewFile(fatura.previewHTML);
11285
- /*const newTab = window.open();
11286
- newTab.document.title = record.id
11283
+ //this.hitSharedService.previewFile(btoa(unescape(encodeURIComponent(fatura.previewHTML))));
11284
+ const newTab = window.open();
11285
+ newTab.document.title = record.id;
11287
11286
  newTab.document.body.innerHTML = `<iframe src="${source}" width="100%" height="100%" style="border:none;"></iframe>`;
11288
- */
11289
11287
  });
11290
11288
  }
11291
11289
  getDespatchXML(record) {
@@ -11320,7 +11318,10 @@ class HitDespatchComponent {
11320
11318
  getDespatchView(record) {
11321
11319
  this.service.getDespatchView(record.uuId).subscribe(item => {
11322
11320
  const source = `data:${item.mimeType};base64,${item.content}`;
11323
- this.hitSharedService.previewFile(item.content);
11321
+ const newTab = window.open();
11322
+ newTab.document.title = record.id;
11323
+ newTab.document.body.innerHTML = `<iframe src="${source}" width="100%" height="100%" style="border:none;"></iframe>`;
11324
+ //this.hitSharedService.previewFile(item.content);
11324
11325
  /*const link = document.createElement('a');
11325
11326
  link.href = source;
11326
11327
  link.download = `${item.filename}`;
@@ -11396,11 +11397,10 @@ class HitDespatchComponent {
11396
11397
  debugger;
11397
11398
  this.service.getReceiptAdvicePreview(record.id).subscribe(despatch => {
11398
11399
  const source = `data:text/html;base64,${despatch.previewHTML}`;
11399
- this.hitSharedService.previewFile(despatch.previewHTML);
11400
- /* const newTab = window.open();
11401
- newTab.document.title = record.id
11402
- newTab.document.body.innerHTML = `<iframe src="${source}" width="100%" height="100%" style="border:none;"></iframe>`;
11403
- */
11400
+ //this.hitSharedService.previewFile(despatch.previewHTML);
11401
+ const newTab = window.open();
11402
+ newTab.document.title = record.id;
11403
+ newTab.document.body.innerHTML = `<iframe src="${source}" width="100%" height="100%" style="border:none;"></iframe>`;
11404
11404
  });
11405
11405
  }
11406
11406
  }