@driveflux/pdf 1.0.1 → 1.0.3
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/.turbo/turbo-build.log +3 -3
- package/CHANGELOG.md +16 -0
- package/dist/__mocks__/quotation.d.ts +3 -0
- package/dist/__mocks__/quotation.d.ts.map +1 -0
- package/dist/__mocks__/quotation.js +59 -0
- package/dist/cjs/__mocks__/quotation.js +69 -0
- package/dist/cjs/debug.js +33 -1
- package/dist/cjs/templates/QuotationPdf/CustomerSubscriptionSection.js +147 -0
- package/dist/cjs/templates/QuotationPdf/GFV.js +57 -0
- package/dist/cjs/templates/QuotationPdf/Header.js +86 -0
- package/dist/cjs/templates/QuotationPdf/Pricing.js +430 -0
- package/dist/cjs/templates/QuotationPdf/QuotationPdfPage.js +45 -0
- package/dist/cjs/templates/QuotationPdf/SectionBoxNew.js +43 -0
- package/dist/cjs/templates/QuotationPdf/TermsSection.js +60 -0
- package/dist/cjs/templates/QuotationPdf/index.js +208 -0
- package/dist/cjs/templates/QuotationPdf/translations.js +103 -0
- package/dist/cjs/templates/QuotationPdf/utils.js +91 -0
- package/dist/cjs/templates/SubscriptionAgreement/LabelValue.js +1 -1
- package/dist/cjs/templates/index.js +1 -0
- package/dist/debug.js +33 -1
- package/dist/templates/QuotationPdf/CustomerSubscriptionSection.d.ts +10 -0
- package/dist/templates/QuotationPdf/CustomerSubscriptionSection.d.ts.map +1 -0
- package/dist/templates/QuotationPdf/CustomerSubscriptionSection.js +132 -0
- package/dist/templates/QuotationPdf/GFV.d.ts +10 -0
- package/dist/templates/QuotationPdf/GFV.d.ts.map +1 -0
- package/dist/templates/QuotationPdf/GFV.js +47 -0
- package/dist/templates/QuotationPdf/Header.d.ts +9 -0
- package/dist/templates/QuotationPdf/Header.d.ts.map +1 -0
- package/dist/templates/QuotationPdf/Header.js +71 -0
- package/dist/templates/QuotationPdf/Pricing.d.ts +10 -0
- package/dist/templates/QuotationPdf/Pricing.d.ts.map +1 -0
- package/dist/templates/QuotationPdf/Pricing.js +415 -0
- package/dist/templates/QuotationPdf/QuotationPdfPage.d.ts +8 -0
- package/dist/templates/QuotationPdf/QuotationPdfPage.d.ts.map +1 -0
- package/dist/templates/QuotationPdf/QuotationPdfPage.js +30 -0
- package/dist/templates/QuotationPdf/SectionBoxNew.d.ts +8 -0
- package/dist/templates/QuotationPdf/SectionBoxNew.d.ts.map +1 -0
- package/dist/templates/QuotationPdf/SectionBoxNew.js +33 -0
- package/dist/templates/QuotationPdf/TermsSection.d.ts +8 -0
- package/dist/templates/QuotationPdf/TermsSection.d.ts.map +1 -0
- package/dist/templates/QuotationPdf/TermsSection.js +50 -0
- package/dist/templates/QuotationPdf/index.d.ts +9 -0
- package/dist/templates/QuotationPdf/index.d.ts.map +1 -0
- package/dist/templates/QuotationPdf/index.js +193 -0
- package/dist/templates/QuotationPdf/translations.d.ts +59 -0
- package/dist/templates/QuotationPdf/translations.d.ts.map +1 -0
- package/dist/templates/QuotationPdf/translations.js +93 -0
- package/dist/templates/QuotationPdf/utils.d.ts +6 -0
- package/dist/templates/QuotationPdf/utils.d.ts.map +1 -0
- package/dist/templates/QuotationPdf/utils.js +70 -0
- package/dist/templates/SubscriptionAgreement/LabelValue.js +1 -1
- package/dist/templates/index.d.ts +1 -0
- package/dist/templates/index.d.ts.map +1 -1
- package/dist/templates/index.js +1 -0
- package/package.json +2 -2
- package/src/__mocks__/quotation.ts +62 -0
- package/src/debug.ts +12 -3
- package/src/templates/QuotationPdf/CustomerSubscriptionSection.tsx +65 -0
- package/src/templates/QuotationPdf/GFV.tsx +29 -0
- package/src/templates/QuotationPdf/Header.tsx +31 -0
- package/src/templates/QuotationPdf/Pricing.tsx +214 -0
- package/src/templates/QuotationPdf/QuotationPdfPage.tsx +25 -0
- package/src/templates/QuotationPdf/SectionBoxNew.tsx +20 -0
- package/src/templates/QuotationPdf/TermsSection.tsx +28 -0
- package/src/templates/QuotationPdf/index.tsx +46 -0
- package/src/templates/QuotationPdf/translations.ts +82 -0
- package/src/templates/QuotationPdf/utils.ts +44 -0
- package/src/templates/SubscriptionAgreement/LabelValue.tsx +1 -1
- package/src/templates/index.ts +1 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "generateQuotationPdf", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return generateQuotationPdf;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var _jsxruntime = require("react/jsx-runtime");
|
|
12
|
+
var _renderer = require("@react-pdf/renderer");
|
|
13
|
+
var _react = require("react");
|
|
14
|
+
var _utils = require("../../utils.js");
|
|
15
|
+
var _CustomerSubscriptionSection = /*#__PURE__*/ _interop_require_default(require("./CustomerSubscriptionSection.js"));
|
|
16
|
+
var _GFV = /*#__PURE__*/ _interop_require_default(require("./GFV.js"));
|
|
17
|
+
var _Pricing = /*#__PURE__*/ _interop_require_default(require("./Pricing.js"));
|
|
18
|
+
var _QuotationPdfPage = /*#__PURE__*/ _interop_require_default(require("./QuotationPdfPage.js"));
|
|
19
|
+
var _TermsSection = /*#__PURE__*/ _interop_require_default(require("./TermsSection.js"));
|
|
20
|
+
var _translations = require("./translations.js");
|
|
21
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
22
|
+
try {
|
|
23
|
+
var info = gen[key](arg);
|
|
24
|
+
var value = info.value;
|
|
25
|
+
} catch (error) {
|
|
26
|
+
reject(error);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
if (info.done) {
|
|
30
|
+
resolve(value);
|
|
31
|
+
} else {
|
|
32
|
+
Promise.resolve(value).then(_next, _throw);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function _async_to_generator(fn) {
|
|
36
|
+
return function() {
|
|
37
|
+
var self = this, args = arguments;
|
|
38
|
+
return new Promise(function(resolve, reject) {
|
|
39
|
+
var gen = fn.apply(self, args);
|
|
40
|
+
function _next(value) {
|
|
41
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
42
|
+
}
|
|
43
|
+
function _throw(err) {
|
|
44
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
45
|
+
}
|
|
46
|
+
_next(undefined);
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function _interop_require_default(obj) {
|
|
51
|
+
return obj && obj.__esModule ? obj : {
|
|
52
|
+
default: obj
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function _ts_generator(thisArg, body) {
|
|
56
|
+
var f, y, t, g, _ = {
|
|
57
|
+
label: 0,
|
|
58
|
+
sent: function() {
|
|
59
|
+
if (t[0] & 1) throw t[1];
|
|
60
|
+
return t[1];
|
|
61
|
+
},
|
|
62
|
+
trys: [],
|
|
63
|
+
ops: []
|
|
64
|
+
};
|
|
65
|
+
return g = {
|
|
66
|
+
next: verb(0),
|
|
67
|
+
"throw": verb(1),
|
|
68
|
+
"return": verb(2)
|
|
69
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
70
|
+
return this;
|
|
71
|
+
}), g;
|
|
72
|
+
function verb(n) {
|
|
73
|
+
return function(v) {
|
|
74
|
+
return step([
|
|
75
|
+
n,
|
|
76
|
+
v
|
|
77
|
+
]);
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function step(op) {
|
|
81
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
82
|
+
while(_)try {
|
|
83
|
+
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;
|
|
84
|
+
if (y = 0, t) op = [
|
|
85
|
+
op[0] & 2,
|
|
86
|
+
t.value
|
|
87
|
+
];
|
|
88
|
+
switch(op[0]){
|
|
89
|
+
case 0:
|
|
90
|
+
case 1:
|
|
91
|
+
t = op;
|
|
92
|
+
break;
|
|
93
|
+
case 4:
|
|
94
|
+
_.label++;
|
|
95
|
+
return {
|
|
96
|
+
value: op[1],
|
|
97
|
+
done: false
|
|
98
|
+
};
|
|
99
|
+
case 5:
|
|
100
|
+
_.label++;
|
|
101
|
+
y = op[1];
|
|
102
|
+
op = [
|
|
103
|
+
0
|
|
104
|
+
];
|
|
105
|
+
continue;
|
|
106
|
+
case 7:
|
|
107
|
+
op = _.ops.pop();
|
|
108
|
+
_.trys.pop();
|
|
109
|
+
continue;
|
|
110
|
+
default:
|
|
111
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
112
|
+
_ = 0;
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
116
|
+
_.label = op[1];
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
120
|
+
_.label = t[1];
|
|
121
|
+
t = op;
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
if (t && _.label < t[2]) {
|
|
125
|
+
_.label = t[2];
|
|
126
|
+
_.ops.push(op);
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
if (t[2]) _.ops.pop();
|
|
130
|
+
_.trys.pop();
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
op = body.call(thisArg, _);
|
|
134
|
+
} catch (e) {
|
|
135
|
+
op = [
|
|
136
|
+
6,
|
|
137
|
+
e
|
|
138
|
+
];
|
|
139
|
+
y = 0;
|
|
140
|
+
} finally{
|
|
141
|
+
f = t = 0;
|
|
142
|
+
}
|
|
143
|
+
if (op[0] & 5) throw op[1];
|
|
144
|
+
return {
|
|
145
|
+
value: op[0] ? op[1] : void 0,
|
|
146
|
+
done: true
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
var generateQuotationPdf = function() {
|
|
151
|
+
var _ref = _async_to_generator(function(param, fileName) {
|
|
152
|
+
var _param_locale, locale, quotation;
|
|
153
|
+
return _ts_generator(this, function(_state) {
|
|
154
|
+
switch(_state.label){
|
|
155
|
+
case 0:
|
|
156
|
+
_param_locale = param.locale, locale = _param_locale === void 0 ? 'en' : _param_locale, quotation = param.quotation;
|
|
157
|
+
return [
|
|
158
|
+
4,
|
|
159
|
+
(0, _utils.toPdf)(/*#__PURE__*/ (0, _jsxruntime.jsx)(QuotationPDF, {
|
|
160
|
+
locale: locale,
|
|
161
|
+
quotation: quotation
|
|
162
|
+
}), fileName)
|
|
163
|
+
];
|
|
164
|
+
case 1:
|
|
165
|
+
return [
|
|
166
|
+
2,
|
|
167
|
+
_state.sent()
|
|
168
|
+
];
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
return function generateQuotationPdf(_, fileName) {
|
|
173
|
+
return _ref.apply(this, arguments);
|
|
174
|
+
};
|
|
175
|
+
}();
|
|
176
|
+
var QuotationPDF = function(param) {
|
|
177
|
+
var _param_locale = param.locale, locale = _param_locale === void 0 ? 'en' : _param_locale, quotation = param.quotation;
|
|
178
|
+
var pageProps = (0, _react.useMemo)(function() {
|
|
179
|
+
return {
|
|
180
|
+
t: (0, _translations.useTranslations)(locale),
|
|
181
|
+
quotation: quotation
|
|
182
|
+
};
|
|
183
|
+
}, []);
|
|
184
|
+
var t = pageProps.t;
|
|
185
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_renderer.Document, {
|
|
186
|
+
language: locale,
|
|
187
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_QuotationPdfPage.default, {
|
|
188
|
+
quotation: quotation,
|
|
189
|
+
children: [
|
|
190
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_CustomerSubscriptionSection.default, {
|
|
191
|
+
quotation: quotation,
|
|
192
|
+
t: t
|
|
193
|
+
}),
|
|
194
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_Pricing.default, {
|
|
195
|
+
quotation: quotation,
|
|
196
|
+
t: t.pricing
|
|
197
|
+
}),
|
|
198
|
+
quotation.fees.gfv && /*#__PURE__*/ (0, _jsxruntime.jsx)(_GFV.default, {
|
|
199
|
+
quotation: quotation,
|
|
200
|
+
t: t.pricing
|
|
201
|
+
}),
|
|
202
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_TermsSection.default, {
|
|
203
|
+
t: t.terms
|
|
204
|
+
})
|
|
205
|
+
]
|
|
206
|
+
})
|
|
207
|
+
});
|
|
208
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "useTranslations", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return useTranslations;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var enTranslation = {
|
|
12
|
+
quotation: "Quotation",
|
|
13
|
+
date: 'Date',
|
|
14
|
+
customer: {
|
|
15
|
+
title: "Customer",
|
|
16
|
+
name: "Name",
|
|
17
|
+
email: "Email",
|
|
18
|
+
address: "Address"
|
|
19
|
+
},
|
|
20
|
+
subscription: {
|
|
21
|
+
title: "Subscription",
|
|
22
|
+
vehicleName: "Vehicle",
|
|
23
|
+
plan: "Subscription Plan",
|
|
24
|
+
mileagePackage: "Mileage Package"
|
|
25
|
+
},
|
|
26
|
+
subIncludes: {
|
|
27
|
+
title: "What's Included:",
|
|
28
|
+
content: [
|
|
29
|
+
"Comprehensive insurance",
|
|
30
|
+
"Road tax",
|
|
31
|
+
"Regularly scheduled maintenance",
|
|
32
|
+
"Selective wear & tear",
|
|
33
|
+
"Ability to swap vehicles",
|
|
34
|
+
"Doorstep delivery",
|
|
35
|
+
"24/7 nationwide roadside assistance",
|
|
36
|
+
"Theft recovery services",
|
|
37
|
+
"Independently rated vehicle inspection",
|
|
38
|
+
"Option to purchase the vehicle at the end of the subscription"
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
pricing: {
|
|
42
|
+
title: "Pricing",
|
|
43
|
+
fees: {
|
|
44
|
+
upfront: {
|
|
45
|
+
title: "Upfront Fees",
|
|
46
|
+
content: [
|
|
47
|
+
{
|
|
48
|
+
title: "Booking Fee",
|
|
49
|
+
key: 'reservationFee'
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
title: "Activation Fee",
|
|
53
|
+
key: 'startFee'
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
title: "Refundable Deposit",
|
|
57
|
+
key: 'deposit'
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
},
|
|
61
|
+
monthly: {
|
|
62
|
+
title: "Monthly Fees",
|
|
63
|
+
content: [
|
|
64
|
+
{
|
|
65
|
+
title: "Subscription Fee",
|
|
66
|
+
key: 'subscriptionFee'
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
dueToday: {
|
|
71
|
+
title: "Due Today",
|
|
72
|
+
description: "Grand Total is due before your subscription start. Monthly fee is due on the first day of every cycle period.",
|
|
73
|
+
subTotal: "Upfront Fees + Monthly Fee",
|
|
74
|
+
serviceFee: "Service Fee (8%)",
|
|
75
|
+
grandTotal: "Grand Total"
|
|
76
|
+
},
|
|
77
|
+
extraCharge: "Extra Charge",
|
|
78
|
+
promo: "Promo",
|
|
79
|
+
gfv: {
|
|
80
|
+
title: "Guaranteed Future Value (GFV)"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
terms: {
|
|
85
|
+
title: "Terms",
|
|
86
|
+
content: [
|
|
87
|
+
"This quotation is valid for 7 days.",
|
|
88
|
+
"All vehicles proposed are unique and are available to our customers on a first come first served basis.",
|
|
89
|
+
"The Mileage Package is the monthly mileage cap for the vehicle. If you exceed this cap for any given month, excess mileage charges will be incurred.",
|
|
90
|
+
"Initial payment to be made within 7 days of the invoice date.",
|
|
91
|
+
"Subscription starts on the date of the car delivery.",
|
|
92
|
+
"The upfront fees are billed one-time per subscription, before the subscription starts.",
|
|
93
|
+
"All monthly recurring fees are billed on the same date as the delivery of the vehicle.",
|
|
94
|
+
"Scheduling delivery will only commence Grand Total is fully paid, 7 - 30+ days after payment and subject to vehicle availability."
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
var useTranslations = function(locale) {
|
|
99
|
+
var translation = {
|
|
100
|
+
en: enTranslation
|
|
101
|
+
};
|
|
102
|
+
return translation[locale];
|
|
103
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
formatAddress: function() {
|
|
13
|
+
return formatAddress;
|
|
14
|
+
},
|
|
15
|
+
getMileagePackageTranslation: function() {
|
|
16
|
+
return getMileagePackageTranslation;
|
|
17
|
+
},
|
|
18
|
+
getSimplifiedPlanTranslation: function() {
|
|
19
|
+
return getSimplifiedPlanTranslation;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
function _object_without_properties(source, excluded) {
|
|
23
|
+
if (source == null) return {};
|
|
24
|
+
var target = _object_without_properties_loose(source, excluded);
|
|
25
|
+
var key, i;
|
|
26
|
+
if (Object.getOwnPropertySymbols) {
|
|
27
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
28
|
+
for(i = 0; i < sourceSymbolKeys.length; i++){
|
|
29
|
+
key = sourceSymbolKeys[i];
|
|
30
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
31
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
32
|
+
target[key] = source[key];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return target;
|
|
36
|
+
}
|
|
37
|
+
function _object_without_properties_loose(source, excluded) {
|
|
38
|
+
if (source == null) return {};
|
|
39
|
+
var target = {};
|
|
40
|
+
var sourceKeys = Object.keys(source);
|
|
41
|
+
var key, i;
|
|
42
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
43
|
+
key = sourceKeys[i];
|
|
44
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
45
|
+
target[key] = source[key];
|
|
46
|
+
}
|
|
47
|
+
return target;
|
|
48
|
+
}
|
|
49
|
+
var formatAddress = function(originalAddress) {
|
|
50
|
+
var coordinates = originalAddress.coordinates, metadata = originalAddress.metadata, address = _object_without_properties(originalAddress, [
|
|
51
|
+
"coordinates",
|
|
52
|
+
"metadata"
|
|
53
|
+
]);
|
|
54
|
+
return Object.keys(address).filter(function(key) {
|
|
55
|
+
return key !== 'name' && !!address[key];
|
|
56
|
+
}).map(function(a) {
|
|
57
|
+
return address[a];
|
|
58
|
+
}).join(', ');
|
|
59
|
+
};
|
|
60
|
+
var getSimplifiedPlanTranslation = function(plan) {
|
|
61
|
+
switch(plan){
|
|
62
|
+
case 'plan60':
|
|
63
|
+
return "60 Months";
|
|
64
|
+
case 'plan36':
|
|
65
|
+
return "36 Months";
|
|
66
|
+
case 'plan24':
|
|
67
|
+
return "24 Months";
|
|
68
|
+
case 'plan12':
|
|
69
|
+
return "12 Months";
|
|
70
|
+
case 'plan1':
|
|
71
|
+
return "Monthly";
|
|
72
|
+
case 'planWeekly':
|
|
73
|
+
return "Weekly";
|
|
74
|
+
default:
|
|
75
|
+
return "Unknown Plan";
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
var getMileagePackageTranslation = function(mileagePackage) {
|
|
79
|
+
switch(mileagePackage){
|
|
80
|
+
case 'lite':
|
|
81
|
+
return "Lite";
|
|
82
|
+
case 'standard':
|
|
83
|
+
return "Standard";
|
|
84
|
+
case 'plus':
|
|
85
|
+
return "Plus";
|
|
86
|
+
case 'unlimited':
|
|
87
|
+
return "Unlimited";
|
|
88
|
+
default:
|
|
89
|
+
return "Unknown Mileage Package";
|
|
90
|
+
}
|
|
91
|
+
};
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
+
_export_star(require("./QuotationPdf/index.js"), exports);
|
|
5
6
|
_export_star(require("./SubscriptionAgreement/index.js"), exports);
|
|
6
7
|
function _export_star(from, to) {
|
|
7
8
|
Object.keys(from).forEach(function(k) {
|
package/dist/debug.js
CHANGED
|
@@ -123,8 +123,10 @@ function _ts_generator(thisArg, body) {
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
import { loadAllEnv } from '@driveflux/env';
|
|
126
|
+
import { quotation } from './__mocks__/quotation.js';
|
|
126
127
|
import { subscription } from './__mocks__/subscription.js';
|
|
127
128
|
import { generateSubscriptionAgreementPdf } from './templates/SubscriptionAgreement/index.js';
|
|
129
|
+
import { generateQuotationPdf } from './templates/index.js';
|
|
128
130
|
var debugSubscriptionAgreement = function() {
|
|
129
131
|
var _ref = _async_to_generator(function() {
|
|
130
132
|
return _ts_generator(this, function(_state) {
|
|
@@ -154,9 +156,39 @@ var debugSubscriptionAgreement = function() {
|
|
|
154
156
|
return _ref.apply(this, arguments);
|
|
155
157
|
};
|
|
156
158
|
}();
|
|
159
|
+
var debugQuotation = function() {
|
|
160
|
+
var _ref = _async_to_generator(function() {
|
|
161
|
+
return _ts_generator(this, function(_state) {
|
|
162
|
+
switch(_state.label){
|
|
163
|
+
case 0:
|
|
164
|
+
if (!quotation) {
|
|
165
|
+
console.error('no such quotation');
|
|
166
|
+
return [
|
|
167
|
+
2
|
|
168
|
+
];
|
|
169
|
+
}
|
|
170
|
+
return [
|
|
171
|
+
4,
|
|
172
|
+
generateQuotationPdf({
|
|
173
|
+
quotation: quotation
|
|
174
|
+
}, "".concat(process.cwd(), "/output/quotation.pdf"))
|
|
175
|
+
];
|
|
176
|
+
case 1:
|
|
177
|
+
_state.sent();
|
|
178
|
+
return [
|
|
179
|
+
2
|
|
180
|
+
];
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
return function debugQuotation() {
|
|
185
|
+
return _ref.apply(this, arguments);
|
|
186
|
+
};
|
|
187
|
+
}();
|
|
157
188
|
//! put all the debugging functions here
|
|
158
189
|
var debugCases = [
|
|
159
|
-
debugSubscriptionAgreement()
|
|
190
|
+
debugSubscriptionAgreement(),
|
|
191
|
+
debugQuotation()
|
|
160
192
|
];
|
|
161
193
|
var debug = function() {
|
|
162
194
|
var _ref = _async_to_generator(function() {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Quotation } from '@driveflux/db';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
import { QuotationPdfTranslation } from './translations.js';
|
|
4
|
+
type Props = {
|
|
5
|
+
quotation: Quotation;
|
|
6
|
+
t: QuotationPdfTranslation;
|
|
7
|
+
};
|
|
8
|
+
declare const CustomerSubscriptionSection: FC<Props>;
|
|
9
|
+
export default CustomerSubscriptionSection;
|
|
10
|
+
//# sourceMappingURL=CustomerSubscriptionSection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CustomerSubscriptionSection.d.ts","sourceRoot":"","sources":["../../../src/templates/QuotationPdf/CustomerSubscriptionSection.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAGzC,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAG1B,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAG3D,KAAK,KAAK,GAAG;IACX,SAAS,EAAE,SAAS,CAAA;IACpB,CAAC,EAAE,uBAAuB,CAAA;CAC3B,CAAA;AAED,QAAA,MAAM,2BAA2B,EAAE,EAAE,CAAC,KAAK,CAgD1C,CAAA;AAED,eAAe,2BAA2B,CAAA"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Text, View } from '@react-pdf/renderer';
|
|
3
|
+
import { colors } from '../../theme/colors.js';
|
|
4
|
+
import SectionBoxNew from './SectionBoxNew.js';
|
|
5
|
+
import { formatAddress, getMileagePackageTranslation, getSimplifiedPlanTranslation } from './utils.js';
|
|
6
|
+
var CustomerSubscriptionSection = function(param) {
|
|
7
|
+
var quotation = param.quotation, t = param.t;
|
|
8
|
+
var displayContent = function(label, value) {
|
|
9
|
+
var labelColor = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : colors.black, valueColor = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : colors.primary3;
|
|
10
|
+
return /*#__PURE__*/ _jsxs(View, {
|
|
11
|
+
style: {
|
|
12
|
+
gap: 4
|
|
13
|
+
},
|
|
14
|
+
children: [
|
|
15
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
16
|
+
style: {
|
|
17
|
+
color: labelColor,
|
|
18
|
+
letterSpacing: 1
|
|
19
|
+
},
|
|
20
|
+
children: label
|
|
21
|
+
}),
|
|
22
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
23
|
+
style: {
|
|
24
|
+
color: valueColor,
|
|
25
|
+
letterSpacing: 1
|
|
26
|
+
},
|
|
27
|
+
children: value
|
|
28
|
+
})
|
|
29
|
+
]
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
return /*#__PURE__*/ _jsx(View, {
|
|
33
|
+
children: /*#__PURE__*/ _jsx(SectionBoxNew, {
|
|
34
|
+
topContent: /*#__PURE__*/ _jsxs(_Fragment, {
|
|
35
|
+
children: [
|
|
36
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
37
|
+
style: {
|
|
38
|
+
textTransform: 'uppercase',
|
|
39
|
+
fontSize: 12,
|
|
40
|
+
fontWeight: 'bold'
|
|
41
|
+
},
|
|
42
|
+
children: t.customer.title
|
|
43
|
+
}),
|
|
44
|
+
/*#__PURE__*/ _jsxs(View, {
|
|
45
|
+
style: {
|
|
46
|
+
flexDirection: 'row',
|
|
47
|
+
justifyContent: 'space-between'
|
|
48
|
+
},
|
|
49
|
+
children: [
|
|
50
|
+
displayContent(t.customer.name, quotation.customerName),
|
|
51
|
+
quotation.customer.email && displayContent(t.customer.email, quotation.customer.email)
|
|
52
|
+
]
|
|
53
|
+
}),
|
|
54
|
+
quotation.customer.address && displayContent(t.customer.address, formatAddress(quotation.customer.address))
|
|
55
|
+
]
|
|
56
|
+
}),
|
|
57
|
+
bottomContent: /*#__PURE__*/ _jsxs(_Fragment, {
|
|
58
|
+
children: [
|
|
59
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
60
|
+
style: {
|
|
61
|
+
textTransform: 'uppercase',
|
|
62
|
+
fontSize: 12,
|
|
63
|
+
fontWeight: 'bold'
|
|
64
|
+
},
|
|
65
|
+
children: t.subscription.title
|
|
66
|
+
}),
|
|
67
|
+
/*#__PURE__*/ _jsxs(View, {
|
|
68
|
+
style: {
|
|
69
|
+
flexDirection: 'row',
|
|
70
|
+
justifyContent: 'space-between',
|
|
71
|
+
gap: 4
|
|
72
|
+
},
|
|
73
|
+
children: [
|
|
74
|
+
displayContent(t.subscription.vehicleName, quotation.vehicleName),
|
|
75
|
+
/*#__PURE__*/ _jsxs(View, {
|
|
76
|
+
style: {
|
|
77
|
+
justifyContent: 'space-between',
|
|
78
|
+
flexDirection: 'row',
|
|
79
|
+
gap: 16
|
|
80
|
+
},
|
|
81
|
+
children: [
|
|
82
|
+
displayContent(t.subscription.plan, getSimplifiedPlanTranslation(quotation.plan)),
|
|
83
|
+
displayContent(t.subscription.mileagePackage, getMileagePackageTranslation(quotation.mileagePackage))
|
|
84
|
+
]
|
|
85
|
+
})
|
|
86
|
+
]
|
|
87
|
+
}),
|
|
88
|
+
/*#__PURE__*/ _jsxs(View, {
|
|
89
|
+
style: {
|
|
90
|
+
rowGap: 8
|
|
91
|
+
},
|
|
92
|
+
children: [
|
|
93
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
94
|
+
style: {
|
|
95
|
+
color: colors.primary3,
|
|
96
|
+
fontWeight: 'bold',
|
|
97
|
+
letterSpacing: 1
|
|
98
|
+
},
|
|
99
|
+
children: t.subIncludes.title
|
|
100
|
+
}),
|
|
101
|
+
t.subIncludes.content.map(function(line, i) {
|
|
102
|
+
return /*#__PURE__*/ _jsxs(View, {
|
|
103
|
+
style: {
|
|
104
|
+
flexDirection: 'row',
|
|
105
|
+
alignItems: 'flex-start',
|
|
106
|
+
rowGap: 8
|
|
107
|
+
},
|
|
108
|
+
children: [
|
|
109
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
110
|
+
style: {
|
|
111
|
+
marginRight: 4
|
|
112
|
+
},
|
|
113
|
+
children: "•"
|
|
114
|
+
}),
|
|
115
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
116
|
+
style: {
|
|
117
|
+
color: colors.primary3,
|
|
118
|
+
letterSpacing: 1
|
|
119
|
+
},
|
|
120
|
+
children: line
|
|
121
|
+
})
|
|
122
|
+
]
|
|
123
|
+
}, i);
|
|
124
|
+
})
|
|
125
|
+
]
|
|
126
|
+
})
|
|
127
|
+
]
|
|
128
|
+
})
|
|
129
|
+
})
|
|
130
|
+
});
|
|
131
|
+
};
|
|
132
|
+
export default CustomerSubscriptionSection;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Quotation } from '@driveflux/db';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
import { QuotationPdfTranslation } from './translations';
|
|
4
|
+
type Props = {
|
|
5
|
+
quotation: Quotation;
|
|
6
|
+
t?: QuotationPdfTranslation['pricing'];
|
|
7
|
+
};
|
|
8
|
+
declare const GFV: FC<Props>;
|
|
9
|
+
export default GFV;
|
|
10
|
+
//# sourceMappingURL=GFV.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GFV.d.ts","sourceRoot":"","sources":["../../../src/templates/QuotationPdf/GFV.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAGzC,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAE1B,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAA;AAExD,KAAK,KAAK,GAAG;IACX,SAAS,EAAE,SAAS,CAAA;IACpB,CAAC,CAAC,EAAE,uBAAuB,CAAC,SAAS,CAAC,CAAA;CACvC,CAAA;AAED,QAAA,MAAM,GAAG,EAAE,EAAE,CAAC,KAAK,CAclB,CAAA;AAED,eAAe,GAAG,CAAA"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { formatMoney } from '@driveflux/format-money';
|
|
3
|
+
import { Text, View } from '@react-pdf/renderer';
|
|
4
|
+
import { colors } from '../../theme/colors.js';
|
|
5
|
+
var GFV = function(param) {
|
|
6
|
+
var quotation = param.quotation, t = param.t;
|
|
7
|
+
if (!quotation.fees.gfv) return;
|
|
8
|
+
return /*#__PURE__*/ _jsxs(View, {
|
|
9
|
+
style: {
|
|
10
|
+
border: "1px solid ".concat(colors.primary2),
|
|
11
|
+
padding: 16,
|
|
12
|
+
rowGap: 16
|
|
13
|
+
},
|
|
14
|
+
children: [
|
|
15
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
16
|
+
style: {
|
|
17
|
+
color: colors.primary3,
|
|
18
|
+
fontWeight: 'bold',
|
|
19
|
+
letterSpacing: 1,
|
|
20
|
+
textTransform: 'uppercase'
|
|
21
|
+
},
|
|
22
|
+
children: t === null || t === void 0 ? void 0 : t.fees.gfv.title
|
|
23
|
+
}),
|
|
24
|
+
/*#__PURE__*/ _jsxs(Text, {
|
|
25
|
+
style: {
|
|
26
|
+
color: colors.primary3,
|
|
27
|
+
letterSpacing: 1
|
|
28
|
+
},
|
|
29
|
+
children: [
|
|
30
|
+
"You have the option to purchase this vehicle with GFV amount of",
|
|
31
|
+
/*#__PURE__*/ _jsxs(Text, {
|
|
32
|
+
style: {
|
|
33
|
+
fontWeight: 'bold'
|
|
34
|
+
},
|
|
35
|
+
children: [
|
|
36
|
+
" ",
|
|
37
|
+
formatMoney(quotation.fees.gfv),
|
|
38
|
+
" "
|
|
39
|
+
]
|
|
40
|
+
}),
|
|
41
|
+
"at the end of your subscription."
|
|
42
|
+
]
|
|
43
|
+
})
|
|
44
|
+
]
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
export default GFV;
|