@driveflux/pdf 1.6.65 → 1.6.67

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.
Files changed (49) hide show
  1. package/dist/__mocks__/quotation.js +10 -11
  2. package/dist/__mocks__/subscription.js +381 -123
  3. package/dist/__mocks__/tou.js +9 -10
  4. package/dist/components/FluxLogo.js +62 -3
  5. package/dist/components/StandardPage.js +97 -8
  6. package/dist/debug.js +221 -29
  7. package/dist/index.js +0 -1
  8. package/dist/templates/QuotationPdf/CustomerSubscriptionSection.js +145 -27
  9. package/dist/templates/QuotationPdf/GFV.js +49 -12
  10. package/dist/templates/QuotationPdf/Header.js +63 -5
  11. package/dist/templates/QuotationPdf/Pricing.js +573 -201
  12. package/dist/templates/QuotationPdf/QuotationPdfPage.js +23 -3
  13. package/dist/templates/QuotationPdf/SectionBoxNew.js +34 -4
  14. package/dist/templates/QuotationPdf/TermsSection.js +42 -5
  15. package/dist/templates/QuotationPdf/VehiclePhotos.js +54 -24
  16. package/dist/templates/QuotationPdf/index.js +198 -11
  17. package/dist/templates/QuotationPdf/translations.js +34 -22
  18. package/dist/templates/QuotationPdf/utils.js +59 -29
  19. package/dist/templates/SubscriptionAgreement/Confirmation.js +65 -10
  20. package/dist/templates/SubscriptionAgreement/CoverPage.d.ts +3 -1
  21. package/dist/templates/SubscriptionAgreement/CoverPage.d.ts.map +1 -1
  22. package/dist/templates/SubscriptionAgreement/CoverPage.js +3 -3
  23. package/dist/templates/SubscriptionAgreement/CoverPage.js.map +1 -1
  24. package/dist/templates/SubscriptionAgreement/CoverPageSection.js +16 -5
  25. package/dist/templates/SubscriptionAgreement/Details.d.ts.map +1 -1
  26. package/dist/templates/SubscriptionAgreement/Details.js +19 -3
  27. package/dist/templates/SubscriptionAgreement/Details.js.map +1 -1
  28. package/dist/templates/SubscriptionAgreement/Footer.js +48 -6
  29. package/dist/templates/SubscriptionAgreement/Header.js +35 -5
  30. package/dist/templates/SubscriptionAgreement/LabelValue.js +25 -3
  31. package/dist/templates/SubscriptionAgreement/SubscriptionAgreementPage.js +26 -3
  32. package/dist/templates/SubscriptionAgreement/TermsOfUse.js +92 -10
  33. package/dist/templates/SubscriptionAgreement/TermsOfUseSubSection.js +97 -9
  34. package/dist/templates/SubscriptionAgreement/index.js +2 -1
  35. package/dist/templates/SubscriptionAgreement/index.js.map +1 -1
  36. package/dist/templates/SubscriptionAgreement/translations.d.ts +6 -0
  37. package/dist/templates/SubscriptionAgreement/translations.d.ts.map +1 -1
  38. package/dist/templates/SubscriptionAgreement/translations.js +6 -0
  39. package/dist/templates/SubscriptionAgreement/translations.js.map +1 -1
  40. package/dist/templates/SubscriptionAgreement/types.d.ts +2 -1
  41. package/dist/templates/SubscriptionAgreement/types.d.ts.map +1 -1
  42. package/dist/templates/SubscriptionAgreement/utils.js +3 -5
  43. package/dist/templates/index.js +0 -1
  44. package/dist/theme/colors.js +44 -63
  45. package/dist/theme/index.js +0 -1
  46. package/dist/types.js +1 -2
  47. package/dist/utils.js +166 -16
  48. package/dist/watch.js +3 -4
  49. package/package.json +2 -2
package/dist/utils.js CHANGED
@@ -1,24 +1,174 @@
1
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
2
+ try {
3
+ var info = gen[key](arg);
4
+ var value = info.value;
5
+ } catch (error) {
6
+ reject(error);
7
+ return;
8
+ }
9
+ if (info.done) {
10
+ resolve(value);
11
+ } else {
12
+ Promise.resolve(value).then(_next, _throw);
13
+ }
14
+ }
15
+ function _async_to_generator(fn) {
16
+ return function() {
17
+ var self = this, args = arguments;
18
+ return new Promise(function(resolve, reject) {
19
+ var gen = fn.apply(self, args);
20
+ function _next(value) {
21
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
22
+ }
23
+ function _throw(err) {
24
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
25
+ }
26
+ _next(undefined);
27
+ });
28
+ };
29
+ }
30
+ function _ts_generator(thisArg, body) {
31
+ var f, y, t, g, _ = {
32
+ label: 0,
33
+ sent: function() {
34
+ if (t[0] & 1) throw t[1];
35
+ return t[1];
36
+ },
37
+ trys: [],
38
+ ops: []
39
+ };
40
+ return g = {
41
+ next: verb(0),
42
+ "throw": verb(1),
43
+ "return": verb(2)
44
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
45
+ return this;
46
+ }), g;
47
+ function verb(n) {
48
+ return function(v) {
49
+ return step([
50
+ n,
51
+ v
52
+ ]);
53
+ };
54
+ }
55
+ function step(op) {
56
+ if (f) throw new TypeError("Generator is already executing.");
57
+ while(_)try {
58
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
59
+ if (y = 0, t) op = [
60
+ op[0] & 2,
61
+ t.value
62
+ ];
63
+ switch(op[0]){
64
+ case 0:
65
+ case 1:
66
+ t = op;
67
+ break;
68
+ case 4:
69
+ _.label++;
70
+ return {
71
+ value: op[1],
72
+ done: false
73
+ };
74
+ case 5:
75
+ _.label++;
76
+ y = op[1];
77
+ op = [
78
+ 0
79
+ ];
80
+ continue;
81
+ case 7:
82
+ op = _.ops.pop();
83
+ _.trys.pop();
84
+ continue;
85
+ default:
86
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
87
+ _ = 0;
88
+ continue;
89
+ }
90
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
91
+ _.label = op[1];
92
+ break;
93
+ }
94
+ if (op[0] === 6 && _.label < t[1]) {
95
+ _.label = t[1];
96
+ t = op;
97
+ break;
98
+ }
99
+ if (t && _.label < t[2]) {
100
+ _.label = t[2];
101
+ _.ops.push(op);
102
+ break;
103
+ }
104
+ if (t[2]) _.ops.pop();
105
+ _.trys.pop();
106
+ continue;
107
+ }
108
+ op = body.call(thisArg, _);
109
+ } catch (e) {
110
+ op = [
111
+ 6,
112
+ e
113
+ ];
114
+ y = 0;
115
+ } finally{
116
+ f = t = 0;
117
+ }
118
+ if (op[0] & 5) throw op[1];
119
+ return {
120
+ value: op[0] ? op[1] : void 0,
121
+ done: true
122
+ };
123
+ }
124
+ }
1
125
  import ReactPDF from '@react-pdf/renderer';
2
126
  /**
3
127
  *
4
128
  * @param document React PDF Document element
5
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
6
130
  * @returns PDF Buffer
7
- */
8
- export const toPdf = async (document, fileName) => {
9
- if (fileName) {
10
- await ReactPDF.renderToFile(document, fileName);
11
- }
12
- const stream = await ReactPDF.renderToStream(document);
13
- return new Promise((resolve, reject) => {
14
- const buffers = [];
15
- stream.on('data', (data) => {
16
- buffers.push(data);
17
- });
18
- stream.on('end', () => {
19
- resolve(Buffer.concat(buffers));
131
+ */ export var toPdf = /*#__PURE__*/ function() {
132
+ var _ref = _async_to_generator(function(document, fileName) {
133
+ var stream;
134
+ return _ts_generator(this, function(_state) {
135
+ switch(_state.label){
136
+ case 0:
137
+ if (!fileName) return [
138
+ 3,
139
+ 2
140
+ ];
141
+ return [
142
+ 4,
143
+ ReactPDF.renderToFile(document, fileName)
144
+ ];
145
+ case 1:
146
+ _state.sent();
147
+ _state.label = 2;
148
+ case 2:
149
+ return [
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
+ })
167
+ ];
168
+ }
20
169
  });
21
- stream.on('error', reject);
22
170
  });
23
- };
24
- //# sourceMappingURL=utils.js.map
171
+ return function toPdf(document, fileName) {
172
+ return _ref.apply(this, arguments);
173
+ };
174
+ }();
package/dist/watch.js CHANGED
@@ -2,11 +2,10 @@ import { execSync } from 'node:child_process';
2
2
  import fs from 'node:fs';
3
3
  fs.watch('src', {
4
4
  persistent: true,
5
- recursive: true,
6
- }, () => {
5
+ recursive: true
6
+ }, function() {
7
7
  console.log('Reloading...');
8
8
  execSync('pnpm debug', {
9
- stdio: 'inherit',
9
+ stdio: 'inherit'
10
10
  });
11
11
  });
12
- //# sourceMappingURL=watch.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@driveflux/pdf",
3
- "version": "1.6.65",
3
+ "version": "1.6.67",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -12,7 +12,7 @@
12
12
  "dist"
13
13
  ],
14
14
  "dependencies": {
15
- "@driveflux/db": "2.2.48",
15
+ "@driveflux/db": "2.2.50",
16
16
  "@driveflux/env": "1.5.0",
17
17
  "@driveflux/format-money": "5.4.1",
18
18
  "@driveflux/time": "4.4.1",