@driveflux/pdf 1.6.54 → 1.6.55
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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tou.js","sourceRoot":"","sources":["../../src/__mocks__/tou.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG;IAC7B,KAAK,EAAE;QACN;YACC,OAAO,EAAE,cAAc;YACvB,KAAK,EAAE;gBACN;oBACC,OAAO,EACN,2HAA2H;oBAC5H,KAAK,EAAE,EAAE;iBACT;aACD;SACD;QACD;YACC,OAAO,EAAE,cAAc;YACvB,KAAK,EAAE;gBACN;oBACC,OAAO,EACN,yGAAyG;oBAC1G,KAAK,EAAE,EAAE;iBACT;aACD;SACD;KACD;CACD,CAAA"}
|
package/dist/debug.js
CHANGED
|
@@ -125,6 +125,7 @@ function _ts_generator(thisArg, body) {
|
|
|
125
125
|
import { loadAllEnv } from '@driveflux/env';
|
|
126
126
|
import { quotation } from './__mocks__/quotation.js';
|
|
127
127
|
import { subscription } from './__mocks__/subscription.js';
|
|
128
|
+
import { mockTermsOfUse } from './__mocks__/tou.js';
|
|
128
129
|
import { generateSubscriptionAgreementPdf } from './templates/SubscriptionAgreement/index.js';
|
|
129
130
|
import { generateQuotationPdf } from './templates/index.js';
|
|
130
131
|
var debugSubscriptionAgreement = /*#__PURE__*/ function() {
|
|
@@ -141,7 +142,8 @@ var debugSubscriptionAgreement = /*#__PURE__*/ function() {
|
|
|
141
142
|
return [
|
|
142
143
|
4,
|
|
143
144
|
generateSubscriptionAgreementPdf({
|
|
144
|
-
subscription: subscription
|
|
145
|
+
subscription: subscription,
|
|
146
|
+
termsOfUse: mockTermsOfUse
|
|
145
147
|
}, "".concat(process.cwd(), "/output/subscription-agreement.pdf"))
|
|
146
148
|
];
|
|
147
149
|
case 1:
|
|
@@ -1,8 +1,78 @@
|
|
|
1
|
+
function _array_like_to_array(arr, len) {
|
|
2
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
3
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
|
+
return arr2;
|
|
5
|
+
}
|
|
6
|
+
function _array_without_holes(arr) {
|
|
7
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
8
|
+
}
|
|
9
|
+
function _iterable_to_array(iter) {
|
|
10
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
11
|
+
}
|
|
12
|
+
function _non_iterable_spread() {
|
|
13
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
14
|
+
}
|
|
15
|
+
function _to_consumable_array(arr) {
|
|
16
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
17
|
+
}
|
|
18
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
19
|
+
if (!o) return;
|
|
20
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
21
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
22
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
23
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
24
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
25
|
+
}
|
|
1
26
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
27
|
import { Text, View } from '@react-pdf/renderer';
|
|
3
|
-
import TermsOfUseSubSection from './TermsOfUseSubSection.js';
|
|
4
28
|
var TermsOfUse = function(param) {
|
|
5
|
-
var
|
|
29
|
+
var termsOfUse = param.termsOfUse;
|
|
30
|
+
var getTerms = function(items) {
|
|
31
|
+
var indices = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
|
|
32
|
+
return items.map(function(item, i) {
|
|
33
|
+
var _item_items;
|
|
34
|
+
var currentIndices = _to_consumable_array(indices).concat([
|
|
35
|
+
i + 1
|
|
36
|
+
]);
|
|
37
|
+
var indicesString = currentIndices.join('.');
|
|
38
|
+
return /*#__PURE__*/ _jsxs(View, {
|
|
39
|
+
style: {
|
|
40
|
+
rowGap: 16
|
|
41
|
+
},
|
|
42
|
+
children: [
|
|
43
|
+
item.content && /*#__PURE__*/ _jsxs(View, {
|
|
44
|
+
style: {
|
|
45
|
+
flexDirection: 'row',
|
|
46
|
+
columnGap: 16
|
|
47
|
+
},
|
|
48
|
+
children: [
|
|
49
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
50
|
+
style: {
|
|
51
|
+
fontWeight: 'bold'
|
|
52
|
+
},
|
|
53
|
+
children: indicesString
|
|
54
|
+
}),
|
|
55
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
56
|
+
style: {
|
|
57
|
+
textAlign: 'justify',
|
|
58
|
+
flex: 1
|
|
59
|
+
},
|
|
60
|
+
children: item.content
|
|
61
|
+
})
|
|
62
|
+
]
|
|
63
|
+
}),
|
|
64
|
+
((_item_items = item.items) === null || _item_items === void 0 ? void 0 : _item_items.length) > 0 && /*#__PURE__*/ _jsx(View, {
|
|
65
|
+
style: {
|
|
66
|
+
paddingLeft: 16,
|
|
67
|
+
rowGap: 16
|
|
68
|
+
},
|
|
69
|
+
children: getTerms(item.items, currentIndices)
|
|
70
|
+
})
|
|
71
|
+
]
|
|
72
|
+
}, "".// biome-ignore lint/suspicious/noArrayIndexKey: <explanation>
|
|
73
|
+
concat(indicesString, "-").concat(i));
|
|
74
|
+
});
|
|
75
|
+
};
|
|
6
76
|
return /*#__PURE__*/ _jsxs(View, {
|
|
7
77
|
style: {
|
|
8
78
|
rowGap: 16
|
|
@@ -13,43 +83,14 @@ var TermsOfUse = function(param) {
|
|
|
13
83
|
fontWeight: 'bold',
|
|
14
84
|
textTransform: 'uppercase'
|
|
15
85
|
},
|
|
16
|
-
children:
|
|
86
|
+
children: 'Terms of Use'
|
|
17
87
|
}),
|
|
18
88
|
/*#__PURE__*/ _jsx(View, {
|
|
19
89
|
style: {
|
|
20
90
|
rowGap: 16,
|
|
21
91
|
lineHeight: 1.4
|
|
22
92
|
},
|
|
23
|
-
children:
|
|
24
|
-
return /*#__PURE__*/ _jsxs(View, {
|
|
25
|
-
style: {
|
|
26
|
-
rowGap: 16
|
|
27
|
-
},
|
|
28
|
-
children: [
|
|
29
|
-
/*#__PURE__*/ _jsx(Text, {
|
|
30
|
-
style: {
|
|
31
|
-
fontWeight: 'bold'
|
|
32
|
-
},
|
|
33
|
-
children: "".concat(i + 1, " ").concat(section.title)
|
|
34
|
-
}),
|
|
35
|
-
/*#__PURE__*/ _jsx(View, {
|
|
36
|
-
style: {
|
|
37
|
-
rowGap: 16,
|
|
38
|
-
paddingLeft: 16
|
|
39
|
-
},
|
|
40
|
-
children: section.subSections.map(function(subSection, j) {
|
|
41
|
-
return /*#__PURE__*/ _jsx(TermsOfUseSubSection, {
|
|
42
|
-
indices: [
|
|
43
|
-
i + 1,
|
|
44
|
-
j + 1
|
|
45
|
-
],
|
|
46
|
-
subSection: subSection
|
|
47
|
-
}, "".concat(i + 1, ".").concat(j));
|
|
48
|
-
})
|
|
49
|
-
})
|
|
50
|
-
]
|
|
51
|
-
}, section.title);
|
|
52
|
-
})
|
|
93
|
+
children: getTerms(termsOfUse.items)
|
|
53
94
|
})
|
|
54
95
|
]
|
|
55
96
|
});
|
|
@@ -186,11 +186,11 @@ import TermsOfUse from './TermsOfUse.js';
|
|
|
186
186
|
import { useTranslations } from './translations.js';
|
|
187
187
|
export var generateSubscriptionAgreementPdf = /*#__PURE__*/ function() {
|
|
188
188
|
var _ref = _async_to_generator(function(param, fileName) {
|
|
189
|
-
var _param_locale, locale, subscription;
|
|
189
|
+
var _param_locale, locale, subscription, termsOfUse;
|
|
190
190
|
return _ts_generator(this, function(_state) {
|
|
191
191
|
switch(_state.label){
|
|
192
192
|
case 0:
|
|
193
|
-
_param_locale = param.locale, locale = _param_locale === void 0 ? 'en' : _param_locale, subscription = param.subscription;
|
|
193
|
+
_param_locale = param.locale, locale = _param_locale === void 0 ? 'en' : _param_locale, subscription = param.subscription, termsOfUse = param.termsOfUse;
|
|
194
194
|
if (!subscription.signature) {
|
|
195
195
|
throw new Error('Signature not found');
|
|
196
196
|
}
|
|
@@ -199,7 +199,8 @@ export var generateSubscriptionAgreementPdf = /*#__PURE__*/ function() {
|
|
|
199
199
|
toPdf(/*#__PURE__*/ _jsx(SubscriptionAgreement, {
|
|
200
200
|
locale: locale,
|
|
201
201
|
signature: subscription.signature,
|
|
202
|
-
subscription: subscription
|
|
202
|
+
subscription: subscription,
|
|
203
|
+
termsOfUse: termsOfUse
|
|
203
204
|
}), fileName)
|
|
204
205
|
];
|
|
205
206
|
case 1:
|
|
@@ -215,7 +216,7 @@ export var generateSubscriptionAgreementPdf = /*#__PURE__*/ function() {
|
|
|
215
216
|
};
|
|
216
217
|
}();
|
|
217
218
|
var SubscriptionAgreement = function(param) {
|
|
218
|
-
var _param_locale = param.locale, locale = _param_locale === void 0 ? 'en' : _param_locale, signature = param.signature, subscription = param.subscription;
|
|
219
|
+
var _param_locale = param.locale, locale = _param_locale === void 0 ? 'en' : _param_locale, signature = param.signature, subscription = param.subscription, termsOfUse = param.termsOfUse;
|
|
219
220
|
if (!signature.signedAt) {
|
|
220
221
|
throw new Error("Missing 'signature.signedAt'");
|
|
221
222
|
}
|
|
@@ -246,7 +247,7 @@ var SubscriptionAgreement = function(param) {
|
|
|
246
247
|
})),
|
|
247
248
|
/*#__PURE__*/ _jsx(SubscriptionAgreementPage, _object_spread_props(_object_spread({}, pageProps), {
|
|
248
249
|
children: /*#__PURE__*/ _jsx(TermsOfUse, {
|
|
249
|
-
|
|
250
|
+
termsOfUse: termsOfUse
|
|
250
251
|
})
|
|
251
252
|
})),
|
|
252
253
|
/*#__PURE__*/ _jsxs(SubscriptionAgreementPage, _object_spread_props(_object_spread({}, pageProps), {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@driveflux/pdf",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.55",
|
|
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.
|
|
15
|
+
"@driveflux/db": "2.2.39",
|
|
16
16
|
"@driveflux/env": "1.5.0",
|
|
17
17
|
"@driveflux/format-money": "5.4.1",
|
|
18
18
|
"@driveflux/time": "4.4.1",
|