@driveflux/pdf 4.0.79 → 4.0.80

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 (35) hide show
  1. package/dist/components/FluxLogo.js +62 -3
  2. package/dist/components/StandardPage.js +108 -10
  3. package/dist/index.js +0 -1
  4. package/dist/templates/QuotationPdf/CustomerSubscriptionSection.js +145 -27
  5. package/dist/templates/QuotationPdf/GFV.js +49 -12
  6. package/dist/templates/QuotationPdf/Header.js +63 -5
  7. package/dist/templates/QuotationPdf/Pricing.js +573 -191
  8. package/dist/templates/QuotationPdf/QuotationPdfPage.js +23 -3
  9. package/dist/templates/QuotationPdf/SectionBoxNew.js +34 -4
  10. package/dist/templates/QuotationPdf/TermsSection.js +42 -5
  11. package/dist/templates/QuotationPdf/VehiclePhotos.js +54 -24
  12. package/dist/templates/QuotationPdf/index.js +197 -10
  13. package/dist/templates/QuotationPdf/translations.js +34 -22
  14. package/dist/templates/QuotationPdf/utils.js +92 -49
  15. package/dist/templates/SubscriptionAgreement/Confirmation.js +65 -10
  16. package/dist/templates/SubscriptionAgreement/CoverPage.js +93 -10
  17. package/dist/templates/SubscriptionAgreement/CoverPageSection.js +16 -5
  18. package/dist/templates/SubscriptionAgreement/Details.js +139 -59
  19. package/dist/templates/SubscriptionAgreement/Footer.js +48 -6
  20. package/dist/templates/SubscriptionAgreement/Header.js +35 -5
  21. package/dist/templates/SubscriptionAgreement/LabelValue.js +25 -3
  22. package/dist/templates/SubscriptionAgreement/SubscriptionAgreementPage.js +26 -3
  23. package/dist/templates/SubscriptionAgreement/TermsOfUse.js +94 -8
  24. package/dist/templates/SubscriptionAgreement/TermsOfUseSubSection.js +97 -11
  25. package/dist/templates/SubscriptionAgreement/index.js +253 -15
  26. package/dist/templates/SubscriptionAgreement/translations.js +195 -194
  27. package/dist/templates/SubscriptionAgreement/types.js +1 -2
  28. package/dist/templates/SubscriptionAgreement/utils.js +16 -11
  29. package/dist/templates/index.js +0 -1
  30. package/dist/theme/colors.js +44 -63
  31. package/dist/theme/index.js +0 -1
  32. package/dist/types.js +1 -2
  33. package/dist/utils.js +167 -16
  34. package/dist/watch.js +3 -4
  35. package/package.json +2 -2
@@ -1,2 +1 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
1
+ export { };
@@ -1,32 +1,37 @@
1
1
  import { Text } from '@react-pdf/renderer';
2
2
  import React from 'react';
3
- export const formatIdentification = (identification) => {
4
- return identification?.type === 'id'
5
- ? `${identification?.number?.slice(0, 6)}-${identification?.number?.slice(6, 8)}-${identification?.number?.slice(8)}`
6
- : identification?.number || '-';
3
+ export var formatIdentification = function formatIdentification(identification) {
4
+ var _identification_number, _identification_number1, _identification_number2;
5
+ return (identification === null || identification === void 0 ? void 0 : identification.type) === 'id' ? "".concat(identification === null || identification === void 0 ? void 0 : (_identification_number = identification.number) === null || _identification_number === void 0 ? void 0 : _identification_number.slice(0, 6), "-").concat(identification === null || identification === void 0 ? void 0 : (_identification_number1 = identification.number) === null || _identification_number1 === void 0 ? void 0 : _identification_number1.slice(6, 8), "-").concat(identification === null || identification === void 0 ? void 0 : (_identification_number2 = identification.number) === null || _identification_number2 === void 0 ? void 0 : _identification_number2.slice(8)) : (identification === null || identification === void 0 ? void 0 : identification.number) || '-';
7
6
  };
8
- export const renderMarkdown = (text) => {
9
- const parts = text.split(/(\*\*\*.*?\*\*\*|\*\*.*?\*\*|\*.*?\*)/g);
10
- return parts.map((part, index) => {
7
+ export var renderMarkdown = function renderMarkdown(text) {
8
+ var parts = text.split(/(\*\*\*.*?\*\*\*|\*\*.*?\*\*|\*.*?\*)/g);
9
+ return parts.map(function(part, index) {
11
10
  if (part.startsWith('***') && part.endsWith('***')) {
12
11
  return React.createElement(Text, {
13
12
  key: index,
14
- style: { fontWeight: 'bold', fontStyle: 'italic' },
13
+ style: {
14
+ fontWeight: 'bold',
15
+ fontStyle: 'italic'
16
+ }
15
17
  }, part.slice(3, -3));
16
18
  }
17
19
  if (part.startsWith('**') && part.endsWith('**')) {
18
20
  return React.createElement(Text, {
19
21
  key: index,
20
- style: { fontWeight: 'bold' },
22
+ style: {
23
+ fontWeight: 'bold'
24
+ }
21
25
  }, part.slice(2, -2));
22
26
  }
23
27
  if (part.startsWith('*') && part.endsWith('*')) {
24
28
  return React.createElement(Text, {
25
29
  key: index,
26
- style: { fontStyle: 'italic' },
30
+ style: {
31
+ fontStyle: 'italic'
32
+ }
27
33
  }, part.slice(1, -1));
28
34
  }
29
35
  return part;
30
36
  });
31
37
  };
32
- //# sourceMappingURL=utils.js.map
@@ -1,3 +1,2 @@
1
1
  export * from './QuotationPdf/index.js';
2
2
  export * from './SubscriptionAgreement/index.js';
3
- //# sourceMappingURL=index.js.map
@@ -1,79 +1,61 @@
1
1
  // TODO sync this with the one in dump
2
2
  // remove dump file version
3
3
  // update all instances using colors
4
- export const colors = {
4
+ export var colors = {
5
5
  /**
6
- * #EFEFF0 Light Gray
7
- */
8
- primary1: '#EFEFF0',
6
+ * #EFEFF0 Light Gray
7
+ */ primary1: '#EFEFF0',
9
8
  /**
10
- * #CACACA Gray
11
- */
12
- primary2: '#CACACA',
9
+ * #CACACA Gray
10
+ */ primary2: '#CACACA',
13
11
  /**
14
- * #585858 Dark Gray
15
- */
16
- primary3: '#585858',
12
+ * #585858 Dark Gray
13
+ */ primary3: '#585858',
17
14
  /**
18
- * #191919 Soft Black
19
- */
20
- primary4: '#191919',
15
+ * #191919 Soft Black
16
+ */ primary4: '#191919',
21
17
  /**
22
- * #E55867 Red
23
- */
24
- accent4: '#E55867',
18
+ * #E55867 Red
19
+ */ accent4: '#E55867',
25
20
  /**
26
- * #ADE0EE Light Blue
27
- */
28
- links2: '#ADE0EE',
21
+ * #ADE0EE Light Blue
22
+ */ links2: '#ADE0EE',
29
23
  /**
30
- * #50C8E8 Blue
31
- */
32
- links: '#50C8E8',
24
+ * #50C8E8 Blue
25
+ */ links: '#50C8E8',
33
26
  /**
34
- * #E24657 Red
35
- */
36
- alert4: '#E24657',
27
+ * #E24657 Red
28
+ */ alert4: '#E24657',
37
29
  /**
38
- * #E24657 Red
39
- */
40
- danger: '#E24657',
30
+ * #E24657 Red
31
+ */ danger: '#E24657',
41
32
  /**
42
- * #F4B25C Yellow
43
- */
44
- warning4: '#F4B25C',
33
+ * #F4B25C Yellow
34
+ */ warning4: '#F4B25C',
45
35
  /**
46
- * #4FD9C2 Green
47
- */
48
- success4: '#4FD9C2',
36
+ * #4FD9C2 Green
37
+ */ success4: '#4FD9C2',
49
38
  /**
50
- * #4FD9C2 Green
51
- */
52
- green: '#4FD9C2',
39
+ * #4FD9C2 Green
40
+ */ green: '#4FD9C2',
53
41
  /**
54
- * #3BD5BC Green
55
- */
56
- // green: '#3BD5BC',
42
+ * #3BD5BC Green
43
+ */ // green: '#3BD5BC',
57
44
  /**
58
- * #000000 Black
59
- */
60
- black: '#000000',
45
+ * #000000 Black
46
+ */ black: '#000000',
61
47
  /**
62
- * #ffffff White
63
- */
64
- white: '#ffffff',
48
+ * #ffffff White
49
+ */ white: '#ffffff',
65
50
  /**
66
- * #E6E6E6 Light Gray
67
- */
68
- whiteHover: '#E6E6E6',
51
+ * #E6E6E6 Light Gray
52
+ */ whiteHover: '#E6E6E6',
69
53
  /**
70
- * #F4F4F4 Light Gray
71
- */
72
- placeholder: '#F4F4F4',
54
+ * #F4F4F4 Light Gray
55
+ */ placeholder: '#F4F4F4',
73
56
  /**
74
- * #F9F7D7 Light Yellow
75
- */
76
- highlight: '#F9F7D7',
57
+ * #F9F7D7 Light Yellow
58
+ */ highlight: '#F9F7D7',
77
59
  primary: {
78
60
  25: '#fafafa',
79
61
  50: '#d6f5f0',
@@ -85,7 +67,7 @@ export const colors = {
85
67
  600: '#000000',
86
68
  700: '#000000',
87
69
  800: '#000000',
88
- 900: '#000000',
70
+ 900: '#000000'
89
71
  },
90
72
  // TODO add 25
91
73
  success: {
@@ -98,7 +80,7 @@ export const colors = {
98
80
  600: '#2EA692',
99
81
  700: '#00825c',
100
82
  800: '#00724d',
101
- 900: '#005530',
83
+ 900: '#005530'
102
84
  },
103
85
  // TODO add 25
104
86
  accent: {
@@ -111,7 +93,7 @@ export const colors = {
111
93
  600: '#d8253f',
112
94
  700: '#c61a38',
113
95
  800: '#b91231',
114
- 900: '#aa0026',
96
+ 900: '#aa0026'
115
97
  },
116
98
  // TODO add 25
117
99
  warning: {
@@ -124,7 +106,7 @@ export const colors = {
124
106
  600: '#BF7F2C',
125
107
  700: '#F4B25C',
126
108
  800: '#F4B25C',
127
- 900: '#F4B25C',
109
+ 900: '#F4B25C'
128
110
  },
129
111
  info: {
130
112
  25: '#50C8E81A',
@@ -137,7 +119,7 @@ export const colors = {
137
119
  600: '#3EA5C0',
138
120
  700: '#50C8E8',
139
121
  800: '#50C8E8',
140
- 900: '#50C8E8',
122
+ 900: '#50C8E8'
141
123
  },
142
124
  // TODO add 25
143
125
  alert: {
@@ -150,7 +132,6 @@ export const colors = {
150
132
  600: '#E24657',
151
133
  700: '#E24657',
152
134
  800: '#E24657',
153
- 900: '#E24657',
154
- },
135
+ 900: '#E24657'
136
+ }
155
137
  };
156
- //# sourceMappingURL=colors.js.map
@@ -1,2 +1 @@
1
1
  export * from './colors.js';
2
- //# sourceMappingURL=index.js.map
package/dist/types.js CHANGED
@@ -1,2 +1 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
1
+ export { };
package/dist/utils.js CHANGED
@@ -1,24 +1,175 @@
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, _ = {
32
+ label: 0,
33
+ sent: function() {
34
+ if (t[0] & 1) throw t[1];
35
+ return t[1];
36
+ },
37
+ trys: [],
38
+ ops: []
39
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
40
+ return d(g, "next", {
41
+ value: verb(0)
42
+ }), d(g, "throw", {
43
+ value: verb(1)
44
+ }), d(g, "return", {
45
+ value: verb(2)
46
+ }), typeof Symbol === "function" && d(g, Symbol.iterator, {
47
+ value: function() {
48
+ return this;
49
+ }
50
+ }), g;
51
+ function verb(n) {
52
+ return function(v) {
53
+ return step([
54
+ n,
55
+ v
56
+ ]);
57
+ };
58
+ }
59
+ function step(op) {
60
+ if (f) throw new TypeError("Generator is already executing.");
61
+ while(g && (g = 0, op[0] && (_ = 0)), _)try {
62
+ 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;
63
+ if (y = 0, t) op = [
64
+ op[0] & 2,
65
+ t.value
66
+ ];
67
+ switch(op[0]){
68
+ case 0:
69
+ case 1:
70
+ t = op;
71
+ break;
72
+ case 4:
73
+ _.label++;
74
+ return {
75
+ value: op[1],
76
+ done: false
77
+ };
78
+ case 5:
79
+ _.label++;
80
+ y = op[1];
81
+ op = [
82
+ 0
83
+ ];
84
+ continue;
85
+ case 7:
86
+ op = _.ops.pop();
87
+ _.trys.pop();
88
+ continue;
89
+ default:
90
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
91
+ _ = 0;
92
+ continue;
93
+ }
94
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
95
+ _.label = op[1];
96
+ break;
97
+ }
98
+ if (op[0] === 6 && _.label < t[1]) {
99
+ _.label = t[1];
100
+ t = op;
101
+ break;
102
+ }
103
+ if (t && _.label < t[2]) {
104
+ _.label = t[2];
105
+ _.ops.push(op);
106
+ break;
107
+ }
108
+ if (t[2]) _.ops.pop();
109
+ _.trys.pop();
110
+ continue;
111
+ }
112
+ op = body.call(thisArg, _);
113
+ } catch (e) {
114
+ op = [
115
+ 6,
116
+ e
117
+ ];
118
+ y = 0;
119
+ } finally{
120
+ f = t = 0;
121
+ }
122
+ if (op[0] & 5) throw op[1];
123
+ return {
124
+ value: op[0] ? op[1] : void 0,
125
+ done: true
126
+ };
127
+ }
128
+ }
1
129
  import ReactPDF from '@react-pdf/renderer';
2
130
  /**
3
131
  *
4
132
  * @param document React PDF Document element
5
133
  * @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
134
  * @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));
135
+ */ export var toPdf = function toPdf(document, fileName) {
136
+ return _async_to_generator(function() {
137
+ var stream;
138
+ return _ts_generator(this, function(_state) {
139
+ switch(_state.label){
140
+ case 0:
141
+ if (!fileName) return [
142
+ 3,
143
+ 2
144
+ ];
145
+ return [
146
+ 4,
147
+ ReactPDF.renderToFile(document, fileName)
148
+ ];
149
+ case 1:
150
+ _state.sent();
151
+ _state.label = 2;
152
+ case 2:
153
+ return [
154
+ 4,
155
+ ReactPDF.renderToStream(document)
156
+ ];
157
+ case 3:
158
+ stream = _state.sent();
159
+ return [
160
+ 2,
161
+ new Promise(function(resolve, reject) {
162
+ var buffers = [];
163
+ stream.on('data', function(data) {
164
+ buffers.push(data);
165
+ });
166
+ stream.on('end', function() {
167
+ resolve(Buffer.concat(buffers));
168
+ });
169
+ stream.on('error', reject);
170
+ })
171
+ ];
172
+ }
20
173
  });
21
- stream.on('error', reject);
22
- });
174
+ })();
23
175
  };
24
- //# sourceMappingURL=utils.js.map
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": "4.0.79",
3
+ "version": "4.0.80",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -12,7 +12,7 @@
12
12
  "dist"
13
13
  ],
14
14
  "dependencies": {
15
- "@driveflux/db": "4.1.20",
15
+ "@driveflux/db": "4.1.21",
16
16
  "@driveflux/env": "3.0.2",
17
17
  "@driveflux/format-money": "7.0.2",
18
18
  "@driveflux/time": "6.0.4",