@freteclick/quasar-financial-ui 1.0.107 → 1.0.109

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@freteclick/quasar-financial-ui",
3
- "version": "1.0.107",
3
+ "version": "1.0.109",
4
4
  "author": "FreteClick",
5
5
  "description": "FreteClick financial Quasar UI Component",
6
6
  "license": "MIT",
@@ -39,7 +39,7 @@
39
39
 
40
40
  <script>
41
41
  import { mapActions, mapGetters } from 'vuex';
42
- import { ENTRYPOINT } from '@freteclick/../../src/config/entrypoint';
42
+ import { fetch } from '@freteclick/../../src/boot/myapi';
43
43
 
44
44
  export default {
45
45
  props: {
@@ -140,7 +140,7 @@ export default {
140
140
  getBankPerInvoiceId: 'receiveInvoice/getBankPerInvoiceId',
141
141
  }),
142
142
 
143
- // Ver boleto ou baixar
143
+ // Ver boleto via blob (busca PDF autenticado do backend)
144
144
  clickDownloadBilletSicred() {
145
145
  if (this.isLoadingDownload) {
146
146
  return null;
@@ -148,11 +148,26 @@ export default {
148
148
 
149
149
  this.isLoadingDownload = true;
150
150
 
151
- const viewerUrl = ENTRYPOINT + `/vendor/pdf.js/web/viewer.html?file=/finance/${this.invoiceId}/bank/sicred/download?timestamp=${new Date().getTime()}`;
152
- this.invoiceUrlSicred = viewerUrl;
153
- this.showBilletSicred = true;
154
-
155
- this.isLoadingDownload = false;
151
+ const endpoint = `finance/${this.invoiceId}/bank/sicred/download?timestamp=${new Date().getTime()}`;
152
+
153
+ fetch(endpoint)
154
+ .then(response => response.blob())
155
+ .then(blob => {
156
+ const blobUrl = URL.createObjectURL(blob);
157
+ this.invoiceUrlSicred = blobUrl;
158
+ this.showBilletSicred = true;
159
+ })
160
+ .catch(error => {
161
+ console.error('Erro ao baixar boleto:', error);
162
+ this.$q.notify({
163
+ message: 'Erro ao carregar o boleto',
164
+ type: 'negative',
165
+ position: 'bottom',
166
+ });
167
+ })
168
+ .finally(() => {
169
+ this.isLoadingDownload = false;
170
+ });
156
171
  },
157
172
 
158
173
  // Consulta informações do banco
@@ -158,7 +158,7 @@ export default {
158
158
  getBankPerInvoiceId: 'receiveInvoice/getBankPerInvoiceId',
159
159
  }),
160
160
 
161
- // Ver boleto ou baixar
161
+ // Ver boleto via blob (busca PDF autenticado do backend)
162
162
  clickDownloadBilletSicred() {
163
163
  if (this.isLoadingDownload) {
164
164
  return null;
@@ -166,11 +166,26 @@ export default {
166
166
 
167
167
  this.isLoadingDownload = true;
168
168
 
169
- const viewerUrl = ENTRYPOINT + `/vendor/pdf.js/web/viewer.html?file=/finance/${this.invoiceId}/bank/sicred/download?timestamp=${new Date().getTime()}`;
170
- this.invoiceUrlSicred = viewerUrl;
171
- this.showBilletSicred = true;
172
-
173
- this.isLoadingDownload = false;
169
+ const url = ENTRYPOINT + `finance/${this.invoiceId}/bank/sicred/download?timestamp=${new Date().getTime()}`;
170
+
171
+ axios.get(url, { responseType: 'blob' })
172
+ .then(response => {
173
+ const blob = new Blob([response.data], { type: 'application/pdf' });
174
+ const blobUrl = URL.createObjectURL(blob);
175
+ this.invoiceUrlSicred = blobUrl;
176
+ this.showBilletSicred = true;
177
+ })
178
+ .catch(error => {
179
+ console.error('Erro ao baixar boleto:', error);
180
+ this.$q.notify({
181
+ message: 'Erro ao carregar o boleto',
182
+ type: 'negative',
183
+ position: 'bottom',
184
+ });
185
+ })
186
+ .finally(() => {
187
+ this.isLoadingDownload = false;
188
+ });
174
189
  },
175
190
 
176
191
  // Consulta informações do banco