@driveflux/pdf 2.0.12 → 3.0.0-next.0
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__/quotation.js +11 -10
- package/dist/__mocks__/subscription.d.ts.map +1 -1
- package/dist/__mocks__/subscription.js +143 -421
- package/dist/__mocks__/subscription.js.map +1 -1
- package/dist/__mocks__/tou.js +10 -9
- package/dist/components/FluxLogo.js +3 -62
- package/dist/components/StandardPage.js +10 -99
- package/dist/debug.js +27 -206
- package/dist/debug.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/templates/QuotationPdf/CustomerSubscriptionSection.d.ts.map +1 -1
- package/dist/templates/QuotationPdf/CustomerSubscriptionSection.js +27 -145
- package/dist/templates/QuotationPdf/CustomerSubscriptionSection.js.map +1 -1
- package/dist/templates/QuotationPdf/GFV.js +12 -49
- package/dist/templates/QuotationPdf/Header.js +5 -63
- package/dist/templates/QuotationPdf/Pricing.d.ts.map +1 -1
- package/dist/templates/QuotationPdf/Pricing.js +201 -573
- package/dist/templates/QuotationPdf/Pricing.js.map +1 -1
- package/dist/templates/QuotationPdf/QuotationPdfPage.js +3 -23
- package/dist/templates/QuotationPdf/SectionBoxNew.js +4 -34
- package/dist/templates/QuotationPdf/TermsSection.js +5 -42
- package/dist/templates/QuotationPdf/TermsSection.js.map +1 -1
- package/dist/templates/QuotationPdf/VehiclePhotos.js +24 -54
- package/dist/templates/QuotationPdf/VehiclePhotos.js.map +1 -1
- package/dist/templates/QuotationPdf/index.js +11 -190
- package/dist/templates/QuotationPdf/index.js.map +1 -1
- package/dist/templates/QuotationPdf/translations.js +22 -34
- package/dist/templates/QuotationPdf/utils.d.ts +2 -2
- package/dist/templates/QuotationPdf/utils.js +29 -59
- package/dist/templates/QuotationPdf/utils.js.map +1 -1
- package/dist/templates/SubscriptionAgreement/Confirmation.js +10 -65
- package/dist/templates/SubscriptionAgreement/CoverPage.js +10 -93
- package/dist/templates/SubscriptionAgreement/CoverPageSection.js +5 -16
- package/dist/templates/SubscriptionAgreement/Details.js +51 -129
- package/dist/templates/SubscriptionAgreement/Details.js.map +1 -1
- package/dist/templates/SubscriptionAgreement/Footer.js +6 -48
- package/dist/templates/SubscriptionAgreement/Header.js +5 -35
- package/dist/templates/SubscriptionAgreement/LabelValue.js +3 -25
- package/dist/templates/SubscriptionAgreement/SubscriptionAgreementPage.js +3 -26
- package/dist/templates/SubscriptionAgreement/TermsOfUse.js +8 -94
- package/dist/templates/SubscriptionAgreement/TermsOfUseSubSection.js +11 -97
- package/dist/templates/SubscriptionAgreement/index.js +15 -245
- package/dist/templates/SubscriptionAgreement/translations.js +194 -195
- package/dist/templates/SubscriptionAgreement/types.d.ts +1 -2
- package/dist/templates/SubscriptionAgreement/types.d.ts.map +1 -1
- package/dist/templates/SubscriptionAgreement/types.js +2 -1
- package/dist/templates/SubscriptionAgreement/utils.js +11 -16
- package/dist/templates/index.js +1 -0
- package/dist/theme/colors.js +63 -44
- package/dist/theme/index.js +1 -0
- package/dist/types.js +2 -1
- package/dist/utils.js +16 -159
- package/dist/watch.js +4 -3
- package/package.json +10 -10
|
@@ -1,175 +1,3 @@
|
|
|
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);
|
|
92
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
93
|
-
return this;
|
|
94
|
-
}), g;
|
|
95
|
-
function verb(n) {
|
|
96
|
-
return function(v) {
|
|
97
|
-
return step([
|
|
98
|
-
n,
|
|
99
|
-
v
|
|
100
|
-
]);
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
function step(op) {
|
|
104
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
105
|
-
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
106
|
-
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;
|
|
107
|
-
if (y = 0, t) op = [
|
|
108
|
-
op[0] & 2,
|
|
109
|
-
t.value
|
|
110
|
-
];
|
|
111
|
-
switch(op[0]){
|
|
112
|
-
case 0:
|
|
113
|
-
case 1:
|
|
114
|
-
t = op;
|
|
115
|
-
break;
|
|
116
|
-
case 4:
|
|
117
|
-
_.label++;
|
|
118
|
-
return {
|
|
119
|
-
value: op[1],
|
|
120
|
-
done: false
|
|
121
|
-
};
|
|
122
|
-
case 5:
|
|
123
|
-
_.label++;
|
|
124
|
-
y = op[1];
|
|
125
|
-
op = [
|
|
126
|
-
0
|
|
127
|
-
];
|
|
128
|
-
continue;
|
|
129
|
-
case 7:
|
|
130
|
-
op = _.ops.pop();
|
|
131
|
-
_.trys.pop();
|
|
132
|
-
continue;
|
|
133
|
-
default:
|
|
134
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
135
|
-
_ = 0;
|
|
136
|
-
continue;
|
|
137
|
-
}
|
|
138
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
139
|
-
_.label = op[1];
|
|
140
|
-
break;
|
|
141
|
-
}
|
|
142
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
143
|
-
_.label = t[1];
|
|
144
|
-
t = op;
|
|
145
|
-
break;
|
|
146
|
-
}
|
|
147
|
-
if (t && _.label < t[2]) {
|
|
148
|
-
_.label = t[2];
|
|
149
|
-
_.ops.push(op);
|
|
150
|
-
break;
|
|
151
|
-
}
|
|
152
|
-
if (t[2]) _.ops.pop();
|
|
153
|
-
_.trys.pop();
|
|
154
|
-
continue;
|
|
155
|
-
}
|
|
156
|
-
op = body.call(thisArg, _);
|
|
157
|
-
} catch (e) {
|
|
158
|
-
op = [
|
|
159
|
-
6,
|
|
160
|
-
e
|
|
161
|
-
];
|
|
162
|
-
y = 0;
|
|
163
|
-
} finally{
|
|
164
|
-
f = t = 0;
|
|
165
|
-
}
|
|
166
|
-
if (op[0] & 5) throw op[1];
|
|
167
|
-
return {
|
|
168
|
-
value: op[0] ? op[1] : void 0,
|
|
169
|
-
done: true
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
174
2
|
import { Document } from '@react-pdf/renderer';
|
|
175
3
|
import { useMemo } from 'react';
|
|
@@ -180,84 +8,26 @@ import Details from './Details.js';
|
|
|
180
8
|
import SubscriptionAgreementPage from './SubscriptionAgreementPage.js';
|
|
181
9
|
import TermsOfUse from './TermsOfUse.js';
|
|
182
10
|
import { useTranslations } from './translations.js';
|
|
183
|
-
export
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
case 0:
|
|
189
|
-
if (!signature) {
|
|
190
|
-
throw new Error('Signature not found');
|
|
191
|
-
}
|
|
192
|
-
return [
|
|
193
|
-
4,
|
|
194
|
-
toPdf(/*#__PURE__*/ _jsx(SubscriptionAgreement, {
|
|
195
|
-
locale: locale,
|
|
196
|
-
signature: signature,
|
|
197
|
-
subscription: subscription,
|
|
198
|
-
termsOfUse: termsOfUse
|
|
199
|
-
}), fileName)
|
|
200
|
-
];
|
|
201
|
-
case 1:
|
|
202
|
-
return [
|
|
203
|
-
2,
|
|
204
|
-
_state.sent()
|
|
205
|
-
];
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
})();
|
|
11
|
+
export const generateSubscriptionAgreementPdf = async ({ locale = 'en', subscription, termsOfUse, signature }, fileName) => {
|
|
12
|
+
if (!signature) {
|
|
13
|
+
throw new Error('Signature not found');
|
|
14
|
+
}
|
|
15
|
+
return await toPdf(_jsx(SubscriptionAgreement, { locale: locale, signature: signature, subscription: subscription, termsOfUse: termsOfUse }), fileName);
|
|
209
16
|
};
|
|
210
|
-
|
|
211
|
-
var _param_locale = param.locale, locale = _param_locale === void 0 ? 'en' : _param_locale, signature = param.signature, subscription = param.subscription, termsOfUse = param.termsOfUse;
|
|
17
|
+
const SubscriptionAgreement = ({ locale = 'en', signature, subscription, termsOfUse, }) => {
|
|
212
18
|
if (!signature.signedAt) {
|
|
213
|
-
throw new Error(
|
|
19
|
+
throw new Error(`Missing 'signature.signedAt'`);
|
|
214
20
|
}
|
|
215
|
-
|
|
216
|
-
|
|
21
|
+
const useT = useTranslations(locale);
|
|
22
|
+
const pageProps = useMemo(() => {
|
|
217
23
|
return {
|
|
218
24
|
t: useT,
|
|
219
25
|
userId: subscription.userId,
|
|
220
|
-
subscriptionId: subscription.id
|
|
26
|
+
subscriptionId: subscription.id,
|
|
221
27
|
};
|
|
222
|
-
}, [
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
]);
|
|
227
|
-
var payerType = subscription.payerType;
|
|
228
|
-
var t = pageProps.t;
|
|
229
|
-
return /*#__PURE__*/ _jsxs(Document, {
|
|
230
|
-
title: t.title,
|
|
231
|
-
language: locale,
|
|
232
|
-
children: [
|
|
233
|
-
/*#__PURE__*/ _jsx(SubscriptionAgreementPage, _object_spread_props(_object_spread({}, pageProps), {
|
|
234
|
-
children: /*#__PURE__*/ _jsx(CoverPage, {
|
|
235
|
-
tTitle: t.title,
|
|
236
|
-
tCover: t.cover,
|
|
237
|
-
signedAt: signature.signedAt,
|
|
238
|
-
user: subscription.user,
|
|
239
|
-
business: subscription.business,
|
|
240
|
-
payerType: payerType
|
|
241
|
-
})
|
|
242
|
-
})),
|
|
243
|
-
/*#__PURE__*/ _jsx(SubscriptionAgreementPage, _object_spread_props(_object_spread({}, pageProps), {
|
|
244
|
-
children: /*#__PURE__*/ _jsx(TermsOfUse, {
|
|
245
|
-
termsOfUse: termsOfUse
|
|
246
|
-
})
|
|
247
|
-
})),
|
|
248
|
-
/*#__PURE__*/ _jsxs(SubscriptionAgreementPage, _object_spread_props(_object_spread({}, pageProps), {
|
|
249
|
-
children: [
|
|
250
|
-
/*#__PURE__*/ _jsx(Details, {
|
|
251
|
-
tDetails: t.details,
|
|
252
|
-
subscription: subscription
|
|
253
|
-
}),
|
|
254
|
-
/*#__PURE__*/ _jsx(Confirmation, {
|
|
255
|
-
tConfirmation: t.confirmation,
|
|
256
|
-
subscription: subscription,
|
|
257
|
-
signature: signature
|
|
258
|
-
})
|
|
259
|
-
]
|
|
260
|
-
}))
|
|
261
|
-
]
|
|
262
|
-
});
|
|
28
|
+
}, [subscription.userId, subscription.id, useT]);
|
|
29
|
+
const payerType = subscription.payerType;
|
|
30
|
+
const { t } = pageProps;
|
|
31
|
+
return (_jsxs(Document, { title: t.title, language: locale, children: [_jsx(SubscriptionAgreementPage, { ...pageProps, children: _jsx(CoverPage, { tTitle: t.title, tCover: t.cover, signedAt: signature.signedAt, user: subscription.user, business: subscription.business, payerType: payerType }) }), _jsx(SubscriptionAgreementPage, { ...pageProps, children: _jsx(TermsOfUse, { termsOfUse: termsOfUse }) }), _jsxs(SubscriptionAgreementPage, { ...pageProps, children: [_jsx(Details, { tDetails: t.details, subscription: subscription }), _jsx(Confirmation, { tConfirmation: t.confirmation, subscription: subscription, signature: signature })] })] }));
|
|
263
32
|
};
|
|
33
|
+
//# sourceMappingURL=index.js.map
|