@driveflux/pdf 1.2.18 → 1.2.19
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/dist/__mocks__/subscription.d.ts.map +1 -1
- package/dist/__mocks__/subscription.js +0 -1
- package/dist/debug.js +3 -3
- package/dist/templates/QuotationPdf/index.d.ts +1 -1
- package/dist/templates/QuotationPdf/index.d.ts.map +1 -1
- package/dist/templates/QuotationPdf/index.js +1 -1
- package/dist/templates/SubscriptionAgreement/index.d.ts +1 -1
- package/dist/templates/SubscriptionAgreement/index.d.ts.map +1 -1
- package/dist/templates/SubscriptionAgreement/index.js +1 -1
- package/dist/utils.d.ts +7 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +31 -7
- package/package.json +14 -14
- package/dist/cjs/package.json +0 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscription.d.ts","sourceRoot":"","sources":["../../src/__mocks__/subscription.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAA;AAE5D,eAAO,MAAM,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"subscription.d.ts","sourceRoot":"","sources":["../../src/__mocks__/subscription.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAA;AAE5D,eAAO,MAAM,YAAY,EAAE,wBA+zB1B,CAAA"}
|
|
@@ -529,7 +529,6 @@ export var subscription = {
|
|
|
529
529
|
activeSubscriptionId: 'S5Y9TWWSK',
|
|
530
530
|
createdAt: new Date('2024-04-01T08:15:04.448Z'),
|
|
531
531
|
updatedAt: new Date('2024-05-21T07:17:58.621Z'),
|
|
532
|
-
listedAt: new Date('2024-06-21T07:17:58.621Z'),
|
|
533
532
|
metadata: {},
|
|
534
533
|
addresses: {
|
|
535
534
|
return: {
|
package/dist/debug.js
CHANGED
|
@@ -127,7 +127,7 @@ import { quotation } from './__mocks__/quotation.js';
|
|
|
127
127
|
import { subscription } from './__mocks__/subscription.js';
|
|
128
128
|
import { generateSubscriptionAgreementPdf } from './templates/SubscriptionAgreement/index.js';
|
|
129
129
|
import { generateQuotationPdf } from './templates/index.js';
|
|
130
|
-
var debugSubscriptionAgreement =
|
|
130
|
+
var debugSubscriptionAgreement = function() {
|
|
131
131
|
var _ref = _async_to_generator(function() {
|
|
132
132
|
return _ts_generator(this, function(_state) {
|
|
133
133
|
switch(_state.label){
|
|
@@ -156,7 +156,7 @@ var debugSubscriptionAgreement = /*#__PURE__*/ function() {
|
|
|
156
156
|
return _ref.apply(this, arguments);
|
|
157
157
|
};
|
|
158
158
|
}();
|
|
159
|
-
var debugQuotation =
|
|
159
|
+
var debugQuotation = function() {
|
|
160
160
|
var _ref = _async_to_generator(function() {
|
|
161
161
|
return _ts_generator(this, function(_state) {
|
|
162
162
|
switch(_state.label){
|
|
@@ -190,7 +190,7 @@ var debugCases = [
|
|
|
190
190
|
debugSubscriptionAgreement(),
|
|
191
191
|
debugQuotation()
|
|
192
192
|
];
|
|
193
|
-
var debug =
|
|
193
|
+
var debug = function() {
|
|
194
194
|
var _ref = _async_to_generator(function() {
|
|
195
195
|
var results;
|
|
196
196
|
return _ts_generator(this, function(_state) {
|
|
@@ -4,6 +4,6 @@ type Options = {
|
|
|
4
4
|
locale?: PdfTemplatesSupportedLocales;
|
|
5
5
|
quotation: Quotation;
|
|
6
6
|
};
|
|
7
|
-
export declare const generateQuotationPdf: ({ locale, quotation }: Options, fileName
|
|
7
|
+
export declare const generateQuotationPdf: ({ locale, quotation }: Options, fileName?: string) => Promise<Buffer>;
|
|
8
8
|
export {};
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/QuotationPdf/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAG9C,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAA;AAclE,KAAK,OAAO,GAAG;IACd,MAAM,CAAC,EAAE,4BAA4B,CAAA;IACrC,SAAS,EAAE,SAAS,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,oBAAoB,0BACF,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/QuotationPdf/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAG9C,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAA;AAclE,KAAK,OAAO,GAAG;IACd,MAAM,CAAC,EAAE,4BAA4B,CAAA;IACrC,SAAS,EAAE,SAAS,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,oBAAoB,0BACF,OAAO,aAC1B,MAAM,oBAMjB,CAAA"}
|
|
@@ -132,7 +132,7 @@ import Pricing from './Pricing.js';
|
|
|
132
132
|
import QuotationPdfPage from './QuotationPdfPage.js';
|
|
133
133
|
import TermsSection from './TermsSection.js';
|
|
134
134
|
import { useTranslations } from './translations.js';
|
|
135
|
-
export var generateQuotationPdf =
|
|
135
|
+
export var generateQuotationPdf = function() {
|
|
136
136
|
var _ref = _async_to_generator(function(param, fileName) {
|
|
137
137
|
var _param_locale, locale, quotation;
|
|
138
138
|
return _ts_generator(this, function(_state) {
|
|
@@ -9,6 +9,6 @@ type Options = {
|
|
|
9
9
|
locale?: PdfTemplatesSupportedLocales;
|
|
10
10
|
subscription: SubscriptionForAgreement;
|
|
11
11
|
};
|
|
12
|
-
export declare const generateSubscriptionAgreementPdf: ({ locale, subscription }: Options, fileName
|
|
12
|
+
export declare const generateSubscriptionAgreementPdf: ({ locale, subscription }: Options, fileName?: string) => Promise<Buffer>;
|
|
13
13
|
export {};
|
|
14
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/SubscriptionAgreement/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEX,YAAY,EACZ,oBAAoB,EACpB,IAAI,EACJ,OAAO,EACP,MAAM,eAAe,CAAA;AAGtB,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAA;AASlE,MAAM,MAAM,wBAAwB,GAAG,YAAY,GAAG;IACrD,IAAI,EAAE,IAAI,CAAA;IACV,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAA;CACtC,CAAA;AAED,KAAK,OAAO,GAAG;IACd,MAAM,CAAC,EAAE,4BAA4B,CAAA;IACrC,YAAY,EAAE,wBAAwB,CAAA;CACtC,CAAA;AACD,eAAO,MAAM,gCAAgC,6BACX,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/SubscriptionAgreement/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEX,YAAY,EACZ,oBAAoB,EACpB,IAAI,EACJ,OAAO,EACP,MAAM,eAAe,CAAA;AAGtB,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAA;AASlE,MAAM,MAAM,wBAAwB,GAAG,YAAY,GAAG;IACrD,IAAI,EAAE,IAAI,CAAA;IACV,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAA;CACtC,CAAA;AAED,KAAK,OAAO,GAAG;IACd,MAAM,CAAC,EAAE,4BAA4B,CAAA;IACrC,YAAY,EAAE,wBAAwB,CAAA;CACtC,CAAA;AACD,eAAO,MAAM,gCAAgC,6BACX,OAAO,aAC7B,MAAM,oBAajB,CAAA"}
|
|
@@ -184,7 +184,7 @@ import Details from './Details.js';
|
|
|
184
184
|
import SubscriptionAgreementPage from './SubscriptionAgreementPage.js';
|
|
185
185
|
import TermsOfUse from './TermsOfUse.js';
|
|
186
186
|
import { useTranslations } from './translations.js';
|
|
187
|
-
export var generateSubscriptionAgreementPdf =
|
|
187
|
+
export var generateSubscriptionAgreementPdf = function() {
|
|
188
188
|
var _ref = _async_to_generator(function(param, fileName) {
|
|
189
189
|
var _param_locale, locale, subscription;
|
|
190
190
|
return _ts_generator(this, function(_state) {
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type { DocumentProps } from '@react-pdf/renderer';
|
|
2
2
|
import type { ReactElement } from 'react';
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param document React PDF Document element
|
|
6
|
+
* @param fileName DO NOT USE THIS IN NEXT.JS APP, as Vercel does not allow us to amend files. This will generate a PDF file in the given fileName
|
|
7
|
+
* @returns PDF Buffer
|
|
8
|
+
*/
|
|
9
|
+
export declare const toPdf: (document: ReactElement<DocumentProps>, fileName?: string) => Promise<Buffer>;
|
|
4
10
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAExD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAEzC,eAAO,MAAM,KAAK,aACP,YAAY,CAAC,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAExD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAEzC;;;;;GAKG;AACH,eAAO,MAAM,KAAK,aACP,YAAY,CAAC,aAAa,CAAC,aAC1B,MAAM,KACf,OAAO,CAAC,MAAM,CAgBhB,CAAA"}
|
package/dist/utils.js
CHANGED
|
@@ -123,23 +123,47 @@ function _ts_generator(thisArg, body) {
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
import ReactPDF from '@react-pdf/renderer';
|
|
126
|
-
|
|
126
|
+
/**
|
|
127
|
+
*
|
|
128
|
+
* @param document React PDF Document element
|
|
129
|
+
* @param fileName DO NOT USE THIS IN NEXT.JS APP, as Vercel does not allow us to amend files. This will generate a PDF file in the given fileName
|
|
130
|
+
* @returns PDF Buffer
|
|
131
|
+
*/ export var toPdf = function() {
|
|
127
132
|
var _ref = _async_to_generator(function(document, fileName) {
|
|
128
|
-
var
|
|
133
|
+
var stream;
|
|
129
134
|
return _ts_generator(this, function(_state) {
|
|
130
135
|
switch(_state.label){
|
|
131
136
|
case 0:
|
|
137
|
+
if (!fileName) return [
|
|
138
|
+
3,
|
|
139
|
+
2
|
|
140
|
+
];
|
|
132
141
|
return [
|
|
133
142
|
4,
|
|
134
143
|
ReactPDF.renderToFile(document, fileName)
|
|
135
144
|
];
|
|
136
145
|
case 1:
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
});
|
|
146
|
+
_state.sent();
|
|
147
|
+
_state.label = 2;
|
|
148
|
+
case 2:
|
|
141
149
|
return [
|
|
142
|
-
|
|
150
|
+
4,
|
|
151
|
+
ReactPDF.renderToStream(document)
|
|
152
|
+
];
|
|
153
|
+
case 3:
|
|
154
|
+
stream = _state.sent();
|
|
155
|
+
return [
|
|
156
|
+
2,
|
|
157
|
+
new Promise(function(resolve, reject) {
|
|
158
|
+
var buffers = [];
|
|
159
|
+
stream.on('data', function(data) {
|
|
160
|
+
buffers.push(data);
|
|
161
|
+
});
|
|
162
|
+
stream.on('end', function() {
|
|
163
|
+
resolve(Buffer.concat(buffers));
|
|
164
|
+
});
|
|
165
|
+
stream.on('error', reject);
|
|
166
|
+
})
|
|
143
167
|
];
|
|
144
168
|
}
|
|
145
169
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@driveflux/pdf",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.19",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -12,26 +12,26 @@
|
|
|
12
12
|
"dist"
|
|
13
13
|
],
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@driveflux/db": "1.
|
|
16
|
-
"@driveflux/env": "1.2.
|
|
17
|
-
"@driveflux/format-money": "5.2.
|
|
18
|
-
"@driveflux/time": "4.2.
|
|
15
|
+
"@driveflux/db": "1.5.12",
|
|
16
|
+
"@driveflux/env": "1.2.0",
|
|
17
|
+
"@driveflux/format-money": "5.2.0",
|
|
18
|
+
"@driveflux/time": "4.2.0",
|
|
19
19
|
"@react-pdf/renderer": "^3.4.4",
|
|
20
20
|
"date-fns": "^3.6.0",
|
|
21
|
-
"nodemon": "^3.1.
|
|
21
|
+
"nodemon": "^3.1.4",
|
|
22
22
|
"react": "^18.3.1"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@babel/preset-env": "^7.
|
|
26
|
-
"@driveflux/fab": "2.2.
|
|
27
|
-
"@driveflux/tsconfig": "1.2.
|
|
28
|
-
"@swc/cli": "0.4.
|
|
29
|
-
"@swc/core": "1.7.
|
|
30
|
-
"@types/node": "^
|
|
31
|
-
"@types/react": "^18.3.
|
|
25
|
+
"@babel/preset-env": "^7.24.8",
|
|
26
|
+
"@driveflux/fab": "2.2.0",
|
|
27
|
+
"@driveflux/tsconfig": "1.2.0",
|
|
28
|
+
"@swc/cli": "^0.4.0",
|
|
29
|
+
"@swc/core": "1.7.2",
|
|
30
|
+
"@types/node": "^20.14.12",
|
|
31
|
+
"@types/react": "^18.3.3",
|
|
32
32
|
"del-cli": "^5.1.0",
|
|
33
33
|
"react": "^18.3.1",
|
|
34
|
-
"typescript": "^5.
|
|
34
|
+
"typescript": "^5.5.4"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"react": "^18.3.1"
|
package/dist/cjs/package.json
DELETED