@driveflux/pdf 4.0.78 → 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.
- package/dist/components/FluxLogo.js +62 -3
- package/dist/components/StandardPage.js +108 -10
- package/dist/index.js +0 -1
- package/dist/templates/QuotationPdf/CustomerSubscriptionSection.js +145 -27
- package/dist/templates/QuotationPdf/GFV.js +49 -12
- package/dist/templates/QuotationPdf/Header.js +63 -5
- package/dist/templates/QuotationPdf/Pricing.js +573 -191
- package/dist/templates/QuotationPdf/QuotationPdfPage.js +23 -3
- package/dist/templates/QuotationPdf/SectionBoxNew.js +34 -4
- package/dist/templates/QuotationPdf/TermsSection.js +42 -5
- package/dist/templates/QuotationPdf/VehiclePhotos.js +54 -24
- package/dist/templates/QuotationPdf/index.js +197 -10
- package/dist/templates/QuotationPdf/translations.js +34 -22
- package/dist/templates/QuotationPdf/utils.js +92 -49
- package/dist/templates/SubscriptionAgreement/Confirmation.js +65 -10
- package/dist/templates/SubscriptionAgreement/CoverPage.js +93 -10
- package/dist/templates/SubscriptionAgreement/CoverPageSection.js +16 -5
- package/dist/templates/SubscriptionAgreement/Details.js +139 -59
- package/dist/templates/SubscriptionAgreement/Footer.js +48 -6
- package/dist/templates/SubscriptionAgreement/Header.js +35 -5
- package/dist/templates/SubscriptionAgreement/LabelValue.js +25 -3
- package/dist/templates/SubscriptionAgreement/SubscriptionAgreementPage.js +26 -3
- package/dist/templates/SubscriptionAgreement/TermsOfUse.js +94 -8
- package/dist/templates/SubscriptionAgreement/TermsOfUseSubSection.js +97 -11
- package/dist/templates/SubscriptionAgreement/index.js +253 -15
- package/dist/templates/SubscriptionAgreement/translations.js +195 -194
- package/dist/templates/SubscriptionAgreement/types.js +1 -2
- package/dist/templates/SubscriptionAgreement/utils.js +16 -11
- package/dist/templates/index.js +0 -1
- package/dist/theme/colors.js +44 -63
- package/dist/theme/index.js +0 -1
- package/dist/types.js +1 -2
- package/dist/utils.js +167 -16
- package/dist/watch.js +3 -4
- package/package.json +10 -10
|
@@ -1,17 +1,103 @@
|
|
|
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
28
|
import { useMemo } from 'react';
|
|
4
29
|
import { renderMarkdown } from './utils.js';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
30
|
+
var TermsOfUseSubSection = function TermsOfUseSubSection1(param) {
|
|
31
|
+
var indices = param.indices, subSection = param.subSection;
|
|
32
|
+
var _useMemo = useMemo(function() {
|
|
33
|
+
return {
|
|
34
|
+
indicesString: indices.reduce(function(prev, curr, i) {
|
|
35
|
+
return "".concat(prev).concat(curr).concat(i === indices.length - 1 ? '' : '.');
|
|
36
|
+
}, ''),
|
|
37
|
+
paddingLeft: Math.max(indices.length - 2, 0) * 16
|
|
38
|
+
};
|
|
39
|
+
}, [
|
|
40
|
+
indices.length,
|
|
41
|
+
indices.reduce
|
|
42
|
+
]), indicesString = _useMemo.indicesString, paddingLeft = _useMemo.paddingLeft;
|
|
43
|
+
return typeof subSection === 'string' ? /*#__PURE__*/ _jsxs(View, {
|
|
44
|
+
style: {
|
|
45
|
+
flexDirection: 'row',
|
|
46
|
+
paddingLeft: paddingLeft,
|
|
47
|
+
columnGap: 16
|
|
48
|
+
},
|
|
49
|
+
children: [
|
|
50
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
51
|
+
style: {
|
|
52
|
+
fontWeight: 'bold'
|
|
53
|
+
},
|
|
54
|
+
children: indicesString
|
|
55
|
+
}),
|
|
56
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
57
|
+
style: {
|
|
58
|
+
textAlign: 'justify',
|
|
59
|
+
flex: 1
|
|
60
|
+
},
|
|
61
|
+
children: subSection
|
|
62
|
+
})
|
|
63
|
+
]
|
|
64
|
+
}, indicesString) : 'subSections' in subSection ? /*#__PURE__*/ _jsxs(View, {
|
|
65
|
+
style: {
|
|
66
|
+
gap: 16
|
|
67
|
+
},
|
|
68
|
+
children: [
|
|
69
|
+
/*#__PURE__*/ _jsxs(View, {
|
|
70
|
+
style: {
|
|
71
|
+
flexDirection: 'row',
|
|
72
|
+
paddingLeft: paddingLeft,
|
|
73
|
+
columnGap: 16
|
|
74
|
+
},
|
|
75
|
+
children: [
|
|
76
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
77
|
+
style: {
|
|
78
|
+
fontWeight: 'bold'
|
|
79
|
+
},
|
|
80
|
+
children: indicesString
|
|
81
|
+
}),
|
|
82
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
83
|
+
style: {
|
|
84
|
+
textAlign: 'justify',
|
|
85
|
+
flex: 1
|
|
86
|
+
},
|
|
87
|
+
children: typeof subSection === 'string' ? renderMarkdown(subSection) : renderMarkdown(subSection.paragraph)
|
|
88
|
+
})
|
|
89
|
+
]
|
|
90
|
+
}, indicesString),
|
|
91
|
+
subSection.subSections.map(function(subSection, i) {
|
|
92
|
+
return /*#__PURE__*/ _jsx(TermsOfUseSubSection, {
|
|
93
|
+
indices: _to_consumable_array(indices).concat([
|
|
94
|
+
i + 1
|
|
95
|
+
]),
|
|
96
|
+
subSection: subSection
|
|
97
|
+
}, "".// biome-ignore lint/suspicious/noArrayIndexKey: <explanation>
|
|
98
|
+
concat(indices, ".").concat(i));
|
|
99
|
+
})
|
|
100
|
+
]
|
|
101
|
+
}, indicesString) : null;
|
|
15
102
|
};
|
|
16
103
|
export default TermsOfUseSubSection;
|
|
17
|
-
//# sourceMappingURL=TermsOfUseSubSection.js.map
|
|
@@ -1,3 +1,183 @@
|
|
|
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 _define_property(obj, key, value) {
|
|
31
|
+
if (key in obj) {
|
|
32
|
+
Object.defineProperty(obj, key, {
|
|
33
|
+
value: value,
|
|
34
|
+
enumerable: true,
|
|
35
|
+
configurable: true,
|
|
36
|
+
writable: true
|
|
37
|
+
});
|
|
38
|
+
} else {
|
|
39
|
+
obj[key] = value;
|
|
40
|
+
}
|
|
41
|
+
return obj;
|
|
42
|
+
}
|
|
43
|
+
function _object_spread(target) {
|
|
44
|
+
for(var i = 1; i < arguments.length; i++){
|
|
45
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
46
|
+
var ownKeys = Object.keys(source);
|
|
47
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
48
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
49
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
52
|
+
ownKeys.forEach(function(key) {
|
|
53
|
+
_define_property(target, key, source[key]);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
return target;
|
|
57
|
+
}
|
|
58
|
+
function ownKeys(object, enumerableOnly) {
|
|
59
|
+
var keys = Object.keys(object);
|
|
60
|
+
if (Object.getOwnPropertySymbols) {
|
|
61
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
62
|
+
if (enumerableOnly) {
|
|
63
|
+
symbols = symbols.filter(function(sym) {
|
|
64
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
keys.push.apply(keys, symbols);
|
|
68
|
+
}
|
|
69
|
+
return keys;
|
|
70
|
+
}
|
|
71
|
+
function _object_spread_props(target, source) {
|
|
72
|
+
source = source != null ? source : {};
|
|
73
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
74
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
75
|
+
} else {
|
|
76
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
77
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
return target;
|
|
81
|
+
}
|
|
82
|
+
function _ts_generator(thisArg, body) {
|
|
83
|
+
var f, y, t, _ = {
|
|
84
|
+
label: 0,
|
|
85
|
+
sent: function() {
|
|
86
|
+
if (t[0] & 1) throw t[1];
|
|
87
|
+
return t[1];
|
|
88
|
+
},
|
|
89
|
+
trys: [],
|
|
90
|
+
ops: []
|
|
91
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
|
|
92
|
+
return d(g, "next", {
|
|
93
|
+
value: verb(0)
|
|
94
|
+
}), d(g, "throw", {
|
|
95
|
+
value: verb(1)
|
|
96
|
+
}), d(g, "return", {
|
|
97
|
+
value: verb(2)
|
|
98
|
+
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
99
|
+
value: function() {
|
|
100
|
+
return this;
|
|
101
|
+
}
|
|
102
|
+
}), g;
|
|
103
|
+
function verb(n) {
|
|
104
|
+
return function(v) {
|
|
105
|
+
return step([
|
|
106
|
+
n,
|
|
107
|
+
v
|
|
108
|
+
]);
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
function step(op) {
|
|
112
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
113
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
114
|
+
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;
|
|
115
|
+
if (y = 0, t) op = [
|
|
116
|
+
op[0] & 2,
|
|
117
|
+
t.value
|
|
118
|
+
];
|
|
119
|
+
switch(op[0]){
|
|
120
|
+
case 0:
|
|
121
|
+
case 1:
|
|
122
|
+
t = op;
|
|
123
|
+
break;
|
|
124
|
+
case 4:
|
|
125
|
+
_.label++;
|
|
126
|
+
return {
|
|
127
|
+
value: op[1],
|
|
128
|
+
done: false
|
|
129
|
+
};
|
|
130
|
+
case 5:
|
|
131
|
+
_.label++;
|
|
132
|
+
y = op[1];
|
|
133
|
+
op = [
|
|
134
|
+
0
|
|
135
|
+
];
|
|
136
|
+
continue;
|
|
137
|
+
case 7:
|
|
138
|
+
op = _.ops.pop();
|
|
139
|
+
_.trys.pop();
|
|
140
|
+
continue;
|
|
141
|
+
default:
|
|
142
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
143
|
+
_ = 0;
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
147
|
+
_.label = op[1];
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
151
|
+
_.label = t[1];
|
|
152
|
+
t = op;
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
if (t && _.label < t[2]) {
|
|
156
|
+
_.label = t[2];
|
|
157
|
+
_.ops.push(op);
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
if (t[2]) _.ops.pop();
|
|
161
|
+
_.trys.pop();
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
op = body.call(thisArg, _);
|
|
165
|
+
} catch (e) {
|
|
166
|
+
op = [
|
|
167
|
+
6,
|
|
168
|
+
e
|
|
169
|
+
];
|
|
170
|
+
y = 0;
|
|
171
|
+
} finally{
|
|
172
|
+
f = t = 0;
|
|
173
|
+
}
|
|
174
|
+
if (op[0] & 5) throw op[1];
|
|
175
|
+
return {
|
|
176
|
+
value: op[0] ? op[1] : void 0,
|
|
177
|
+
done: true
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
}
|
|
1
181
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
182
|
import { Document } from '@react-pdf/renderer';
|
|
3
183
|
import { useMemo } from 'react';
|
|
@@ -8,26 +188,84 @@ import Details from './Details.js';
|
|
|
8
188
|
import SubscriptionAgreementPage from './SubscriptionAgreementPage.js';
|
|
9
189
|
import TermsOfUse from './TermsOfUse.js';
|
|
10
190
|
import { useTranslations } from './translations.js';
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
191
|
+
export var generateSubscriptionAgreementPdf = function generateSubscriptionAgreementPdf(param, fileName) {
|
|
192
|
+
var _param_locale = param.locale, locale = _param_locale === void 0 ? 'en' : _param_locale, subscription = param.subscription, termsOfUse = param.termsOfUse, signature = param.signature;
|
|
193
|
+
return _async_to_generator(function() {
|
|
194
|
+
return _ts_generator(this, function(_state) {
|
|
195
|
+
switch(_state.label){
|
|
196
|
+
case 0:
|
|
197
|
+
if (!signature) {
|
|
198
|
+
throw new Error('Signature not found');
|
|
199
|
+
}
|
|
200
|
+
return [
|
|
201
|
+
4,
|
|
202
|
+
toPdf(/*#__PURE__*/ _jsx(SubscriptionAgreement, {
|
|
203
|
+
locale: locale,
|
|
204
|
+
signature: signature,
|
|
205
|
+
subscription: subscription,
|
|
206
|
+
termsOfUse: termsOfUse
|
|
207
|
+
}), fileName)
|
|
208
|
+
];
|
|
209
|
+
case 1:
|
|
210
|
+
return [
|
|
211
|
+
2,
|
|
212
|
+
_state.sent()
|
|
213
|
+
];
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
})();
|
|
16
217
|
};
|
|
17
|
-
|
|
218
|
+
var SubscriptionAgreement = function SubscriptionAgreement(param) {
|
|
219
|
+
var _param_locale = param.locale, locale = _param_locale === void 0 ? 'en' : _param_locale, signature = param.signature, subscription = param.subscription, termsOfUse = param.termsOfUse;
|
|
18
220
|
if (!signature.signedAt) {
|
|
19
|
-
throw new Error(
|
|
221
|
+
throw new Error("Missing 'signature.signedAt'");
|
|
20
222
|
}
|
|
21
|
-
|
|
22
|
-
|
|
223
|
+
var useT = useTranslations(locale);
|
|
224
|
+
var pageProps = useMemo(function() {
|
|
23
225
|
return {
|
|
24
226
|
t: useT,
|
|
25
227
|
userId: subscription.userId,
|
|
26
|
-
subscriptionId: subscription.id
|
|
228
|
+
subscriptionId: subscription.id
|
|
27
229
|
};
|
|
28
|
-
}, [
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
230
|
+
}, [
|
|
231
|
+
subscription.userId,
|
|
232
|
+
subscription.id,
|
|
233
|
+
useT
|
|
234
|
+
]);
|
|
235
|
+
var payerType = subscription.payerType;
|
|
236
|
+
var t = pageProps.t;
|
|
237
|
+
return /*#__PURE__*/ _jsxs(Document, {
|
|
238
|
+
title: t.title,
|
|
239
|
+
language: locale,
|
|
240
|
+
children: [
|
|
241
|
+
/*#__PURE__*/ _jsx(SubscriptionAgreementPage, _object_spread_props(_object_spread({}, pageProps), {
|
|
242
|
+
children: /*#__PURE__*/ _jsx(CoverPage, {
|
|
243
|
+
tTitle: t.title,
|
|
244
|
+
tCover: t.cover,
|
|
245
|
+
signedAt: signature.signedAt,
|
|
246
|
+
user: subscription.user,
|
|
247
|
+
business: subscription.business,
|
|
248
|
+
payerType: payerType
|
|
249
|
+
})
|
|
250
|
+
})),
|
|
251
|
+
/*#__PURE__*/ _jsx(SubscriptionAgreementPage, _object_spread_props(_object_spread({}, pageProps), {
|
|
252
|
+
children: /*#__PURE__*/ _jsx(TermsOfUse, {
|
|
253
|
+
termsOfUse: termsOfUse
|
|
254
|
+
})
|
|
255
|
+
})),
|
|
256
|
+
/*#__PURE__*/ _jsxs(SubscriptionAgreementPage, _object_spread_props(_object_spread({}, pageProps), {
|
|
257
|
+
children: [
|
|
258
|
+
/*#__PURE__*/ _jsx(Details, {
|
|
259
|
+
tDetails: t.details,
|
|
260
|
+
subscription: subscription
|
|
261
|
+
}),
|
|
262
|
+
/*#__PURE__*/ _jsx(Confirmation, {
|
|
263
|
+
tConfirmation: t.confirmation,
|
|
264
|
+
subscription: subscription,
|
|
265
|
+
signature: signature
|
|
266
|
+
})
|
|
267
|
+
]
|
|
268
|
+
}))
|
|
269
|
+
]
|
|
270
|
+
});
|
|
32
271
|
};
|
|
33
|
-
//# sourceMappingURL=index.js.map
|