@driveflux/pdf 1.7.1 → 1.7.2
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 +10 -11
- package/dist/__mocks__/subscription.js +380 -122
- package/dist/components/FluxLogo.js +62 -3
- package/dist/components/StandardPage.js +97 -8
- package/dist/debug.js +203 -26
- 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 +574 -204
- 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 +189 -10
- package/dist/templates/QuotationPdf/translations.js +38 -23
- package/dist/templates/QuotationPdf/utils.js +59 -29
- package/dist/templates/SubscriptionAgreement/Confirmation.js +66 -11
- package/dist/templates/SubscriptionAgreement/CoverPage.js +77 -10
- package/dist/templates/SubscriptionAgreement/CoverPageSection.js +16 -5
- package/dist/templates/SubscriptionAgreement/Details.js +69 -43
- 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 +52 -3
- package/dist/templates/SubscriptionAgreement/TermsOfUseSubSection.js +97 -9
- package/dist/templates/SubscriptionAgreement/index.js +240 -14
- package/dist/templates/SubscriptionAgreement/translations.js +194 -193
- package/dist/templates/SubscriptionAgreement/types.js +1 -2
- package/dist/templates/SubscriptionAgreement/utils.js +3 -5
- 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 +159 -16
- package/dist/watch.js +3 -4
- package/package.json +2 -2
|
@@ -3,51 +3,77 @@ import { formatMoney } from '@driveflux/format-money';
|
|
|
3
3
|
import { Text, View } from '@react-pdf/renderer';
|
|
4
4
|
import { colors } from '../../theme/colors.js';
|
|
5
5
|
import SectionBoxNew from './SectionBoxNew.js';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
: startFee + (reservationFee || 0) + deposit;
|
|
16
|
-
let totalMonthlyFee = hasDiscounts
|
|
17
|
-
? quotedPrices?.subscriptionFee || 0
|
|
18
|
-
: subscriptionFee;
|
|
6
|
+
var Pricing = function(param) {
|
|
7
|
+
var quotation = param.quotation, t = param.t;
|
|
8
|
+
var _quotation_fees_discountAmount, _quotation_fees_discountAmount1;
|
|
9
|
+
var _quotation_fees = quotation.fees, startFee = _quotation_fees.startFee, reservationFee = _quotation_fees.reservationFee, deposit = _quotation_fees.deposit, subscriptionFee = _quotation_fees.subscriptionFee, extraCharges = _quotation_fees.extraCharges, couponType = _quotation_fees.couponType, discountAmount = _quotation_fees.discountAmount, quotedPrices = _quotation_fees.quotedPrices;
|
|
10
|
+
var taxRate = quotation.fees.taxAmount / quotation.fees.amountBeforeTax;
|
|
11
|
+
var taxPercentage = (taxRate * 100).toFixed(0);
|
|
12
|
+
var hasDiscounts = quotedPrices !== null && quotedPrices !== undefined;
|
|
13
|
+
var totalUpfrontFee = hasDiscounts ? ((quotedPrices === null || quotedPrices === void 0 ? void 0 : quotedPrices.startFee) || 0) + (reservationFee || 0) + ((quotedPrices === null || quotedPrices === void 0 ? void 0 : quotedPrices.deposit) || 0) : startFee + (reservationFee || 0) + deposit;
|
|
14
|
+
var totalMonthlyFee = hasDiscounts ? (quotedPrices === null || quotedPrices === void 0 ? void 0 : quotedPrices.subscriptionFee) || 0 : subscriptionFee;
|
|
19
15
|
if (hasDiscounts) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
17
|
+
try {
|
|
18
|
+
for(var _iterator = quotedPrices.extraCharges[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
19
|
+
var charge = _step.value;
|
|
20
|
+
if (charge.type === 'upfront') {
|
|
21
|
+
totalUpfrontFee += charge.amount;
|
|
22
|
+
} else if (charge.type === 'monthly') {
|
|
23
|
+
totalMonthlyFee += charge.amount;
|
|
24
|
+
}
|
|
23
25
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
} catch (err) {
|
|
27
|
+
_didIteratorError = true;
|
|
28
|
+
_iteratorError = err;
|
|
29
|
+
} finally{
|
|
30
|
+
try {
|
|
31
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
32
|
+
_iterator.return();
|
|
33
|
+
}
|
|
34
|
+
} finally{
|
|
35
|
+
if (_didIteratorError) {
|
|
36
|
+
throw _iteratorError;
|
|
37
|
+
}
|
|
26
38
|
}
|
|
27
39
|
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
40
|
+
} else {
|
|
41
|
+
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
42
|
+
try {
|
|
43
|
+
for(var _iterator1 = extraCharges[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
44
|
+
var charge1 = _step1.value;
|
|
45
|
+
if (charge1.type === 'upfront') {
|
|
46
|
+
totalUpfrontFee += charge1.amount;
|
|
47
|
+
} else if (charge1.type === 'monthly') {
|
|
48
|
+
totalMonthlyFee += charge1.amount;
|
|
49
|
+
}
|
|
33
50
|
}
|
|
34
|
-
|
|
35
|
-
|
|
51
|
+
} catch (err) {
|
|
52
|
+
_didIteratorError1 = true;
|
|
53
|
+
_iteratorError1 = err;
|
|
54
|
+
} finally{
|
|
55
|
+
try {
|
|
56
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
57
|
+
_iterator1.return();
|
|
58
|
+
}
|
|
59
|
+
} finally{
|
|
60
|
+
if (_didIteratorError1) {
|
|
61
|
+
throw _iteratorError1;
|
|
62
|
+
}
|
|
36
63
|
}
|
|
37
64
|
}
|
|
38
65
|
}
|
|
39
66
|
if (quotation.couponCode) {
|
|
40
67
|
if (couponType === 'upfront') {
|
|
41
68
|
totalUpfrontFee -= discountAmount || 0;
|
|
42
|
-
}
|
|
43
|
-
else if (couponType === 'monthly') {
|
|
69
|
+
} else if (couponType === 'monthly') {
|
|
44
70
|
totalMonthlyFee -= discountAmount || 0;
|
|
45
71
|
}
|
|
46
72
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
switch
|
|
73
|
+
var serviceMonthlyFee = totalMonthlyFee * taxRate;
|
|
74
|
+
var serviceUpfrontFee = (totalUpfrontFee * taxRate).toFixed(2);
|
|
75
|
+
var getFeeValue = function(key) {
|
|
76
|
+
switch(key){
|
|
51
77
|
case 'startFee':
|
|
52
78
|
return startFee;
|
|
53
79
|
case 'reservationFee':
|
|
@@ -60,298 +86,642 @@ const Pricing = ({ quotation, t }) => {
|
|
|
60
86
|
return null;
|
|
61
87
|
}
|
|
62
88
|
};
|
|
63
|
-
|
|
64
|
-
switch
|
|
89
|
+
var getQuotedFeeValue = function(key) {
|
|
90
|
+
switch(key){
|
|
65
91
|
case 'startFee':
|
|
66
|
-
return quotedPrices
|
|
92
|
+
return quotedPrices === null || quotedPrices === void 0 ? void 0 : quotedPrices.startFee;
|
|
67
93
|
case 'deposit':
|
|
68
|
-
return quotedPrices
|
|
94
|
+
return quotedPrices === null || quotedPrices === void 0 ? void 0 : quotedPrices.deposit;
|
|
69
95
|
case 'subscriptionFee':
|
|
70
|
-
return quotedPrices
|
|
96
|
+
return quotedPrices === null || quotedPrices === void 0 ? void 0 : quotedPrices.subscriptionFee;
|
|
71
97
|
case 'reservationFee':
|
|
72
98
|
return reservationFee;
|
|
73
99
|
default:
|
|
74
100
|
return null;
|
|
75
101
|
}
|
|
76
102
|
};
|
|
77
|
-
|
|
103
|
+
var upfrontTotalDiscount = function() {
|
|
104
|
+
var _quotedPrices_extraCharges;
|
|
78
105
|
// Calculate base fees total (startFee + deposit)
|
|
79
|
-
|
|
80
|
-
|
|
106
|
+
var originalBaseTotal = startFee + deposit;
|
|
107
|
+
var quotedBaseTotal = ((quotedPrices === null || quotedPrices === void 0 ? void 0 : quotedPrices.startFee) || 0) + ((quotedPrices === null || quotedPrices === void 0 ? void 0 : quotedPrices.deposit) || 0);
|
|
81
108
|
// Calculate original upfront extra charges
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
109
|
+
var originalExtraCharges = extraCharges.filter(function(charge) {
|
|
110
|
+
return charge.type === 'upfront';
|
|
111
|
+
}).reduce(function(sum, charge) {
|
|
112
|
+
return sum + charge.amount;
|
|
113
|
+
}, 0);
|
|
85
114
|
// Calculate quoted upfront extra charges
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
115
|
+
var quotedExtraCharges = (quotedPrices === null || quotedPrices === void 0 ? void 0 : (_quotedPrices_extraCharges = quotedPrices.extraCharges) === null || _quotedPrices_extraCharges === void 0 ? void 0 : _quotedPrices_extraCharges.filter(function(charge) {
|
|
116
|
+
return charge.type === 'upfront';
|
|
117
|
+
}).reduce(function(sum, charge) {
|
|
118
|
+
return sum + charge.amount;
|
|
119
|
+
}, 0)) || originalExtraCharges;
|
|
120
|
+
var originalTotal = originalBaseTotal + originalExtraCharges;
|
|
121
|
+
var quotedTotal = quotedBaseTotal + quotedExtraCharges;
|
|
91
122
|
// Calculate total discount (original - quoted)
|
|
92
|
-
|
|
123
|
+
var totalDiscount = originalTotal - quotedTotal;
|
|
93
124
|
return totalDiscount;
|
|
94
125
|
};
|
|
95
|
-
return
|
|
126
|
+
return /*#__PURE__*/ _jsx(View, {
|
|
127
|
+
children: /*#__PURE__*/ _jsx(SectionBoxNew, {
|
|
128
|
+
topContent: /*#__PURE__*/ _jsxs(_Fragment, {
|
|
129
|
+
children: [
|
|
130
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
131
|
+
style: {
|
|
96
132
|
textTransform: 'uppercase',
|
|
97
133
|
fontSize: 12,
|
|
98
|
-
fontWeight: 'bold'
|
|
99
|
-
},
|
|
134
|
+
fontWeight: 'bold'
|
|
135
|
+
},
|
|
136
|
+
children: t === null || t === void 0 ? void 0 : t.title
|
|
137
|
+
}),
|
|
138
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
139
|
+
style: {
|
|
100
140
|
fontWeight: 'bold',
|
|
101
141
|
color: colors.black,
|
|
102
|
-
letterSpacing: 1
|
|
103
|
-
},
|
|
104
|
-
|
|
105
|
-
|
|
142
|
+
letterSpacing: 1
|
|
143
|
+
},
|
|
144
|
+
children: t === null || t === void 0 ? void 0 : t.fees.upfront.title
|
|
145
|
+
}),
|
|
146
|
+
t === null || t === void 0 ? void 0 : t.fees.upfront.content.map(function(fee) {
|
|
147
|
+
var _getFeeValue, _getQuotedFeeValue;
|
|
148
|
+
var feeValue = (_getFeeValue = getFeeValue(fee.key)) === null || _getFeeValue === void 0 ? void 0 : _getFeeValue.toFixed(2);
|
|
149
|
+
var _getQuotedFeeValue_toFixed;
|
|
150
|
+
var quotedFeeValue = (_getQuotedFeeValue_toFixed = (_getQuotedFeeValue = getQuotedFeeValue(fee.key)) === null || _getQuotedFeeValue === void 0 ? void 0 : _getQuotedFeeValue.toFixed(2)) !== null && _getQuotedFeeValue_toFixed !== void 0 ? _getQuotedFeeValue_toFixed : undefined;
|
|
106
151
|
if (feeValue === '0.00') {
|
|
107
152
|
return null;
|
|
108
153
|
}
|
|
109
|
-
return
|
|
154
|
+
return /*#__PURE__*/ _jsxs(View, {
|
|
155
|
+
style: {
|
|
110
156
|
justifyContent: 'space-between',
|
|
111
157
|
flexDirection: 'row',
|
|
112
|
-
rowGap: 8
|
|
113
|
-
},
|
|
158
|
+
rowGap: 8
|
|
159
|
+
},
|
|
160
|
+
children: [
|
|
161
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
162
|
+
style: {
|
|
114
163
|
paddingRight: 4,
|
|
115
164
|
letterSpacing: 1,
|
|
116
|
-
color: colors.primary3
|
|
117
|
-
},
|
|
118
|
-
|
|
119
|
-
|
|
165
|
+
color: colors.primary3
|
|
166
|
+
},
|
|
167
|
+
children: fee.title
|
|
168
|
+
}),
|
|
169
|
+
hasDiscounts && fee.key !== 'reservationFee' ? // Only show strikethrough if quoted value is different from original value
|
|
170
|
+
feeValue !== quotedFeeValue ? /*#__PURE__*/ _jsxs(View, {
|
|
171
|
+
style: {
|
|
120
172
|
justifyContent: 'flex-end',
|
|
121
|
-
flexDirection: 'row'
|
|
122
|
-
},
|
|
173
|
+
flexDirection: 'row'
|
|
174
|
+
},
|
|
175
|
+
children: [
|
|
176
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
177
|
+
style: {
|
|
123
178
|
color: colors.primary2,
|
|
124
179
|
letterSpacing: 1,
|
|
125
180
|
textDecoration: 'line-through',
|
|
126
|
-
marginRight: 4
|
|
127
|
-
},
|
|
181
|
+
marginRight: 4
|
|
182
|
+
},
|
|
183
|
+
children: feeValue !== null ? feeValue : ''
|
|
184
|
+
}),
|
|
185
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
186
|
+
style: {
|
|
128
187
|
color: colors.primary3,
|
|
129
|
-
letterSpacing: 1
|
|
130
|
-
},
|
|
131
|
-
|
|
132
|
-
|
|
188
|
+
letterSpacing: 1
|
|
189
|
+
},
|
|
190
|
+
children: quotedFeeValue
|
|
191
|
+
})
|
|
192
|
+
]
|
|
193
|
+
}) : // When values are the same, just show the single value
|
|
194
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
195
|
+
style: {
|
|
133
196
|
color: colors.primary3,
|
|
134
|
-
letterSpacing: 1
|
|
135
|
-
},
|
|
136
|
-
|
|
137
|
-
|
|
197
|
+
letterSpacing: 1
|
|
198
|
+
},
|
|
199
|
+
children: feeValue !== null ? feeValue : ''
|
|
200
|
+
}) : // When no discounts or it's a reservation fee
|
|
201
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
202
|
+
style: {
|
|
138
203
|
color: colors.primary3,
|
|
139
|
-
letterSpacing: 1
|
|
140
|
-
},
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
204
|
+
letterSpacing: 1
|
|
205
|
+
},
|
|
206
|
+
children: feeValue !== null ? feeValue : ''
|
|
207
|
+
})
|
|
208
|
+
]
|
|
209
|
+
}, fee.key);
|
|
210
|
+
}),
|
|
211
|
+
quotation.fees.extraCharges.length > 0 && quotation.fees.extraCharges.filter(function(charge) {
|
|
212
|
+
return charge.amount > 0;
|
|
213
|
+
}).filter(function(charge) {
|
|
214
|
+
return charge.type === 'upfront';
|
|
215
|
+
}).map(function(charge, i) {
|
|
216
|
+
return /*#__PURE__*/ _jsxs(View, {
|
|
217
|
+
style: {
|
|
148
218
|
justifyContent: 'space-between',
|
|
149
219
|
flexDirection: 'row',
|
|
150
|
-
rowGap: 8
|
|
151
|
-
},
|
|
220
|
+
rowGap: 8
|
|
221
|
+
},
|
|
222
|
+
children: [
|
|
223
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
224
|
+
style: {
|
|
152
225
|
paddingRight: 4,
|
|
153
226
|
letterSpacing: 1,
|
|
154
|
-
color: colors.primary3
|
|
155
|
-
},
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
227
|
+
color: colors.primary3
|
|
228
|
+
},
|
|
229
|
+
children: charge.description
|
|
230
|
+
}),
|
|
231
|
+
hasDiscounts ? function() {
|
|
232
|
+
var quotedCharge = quotedPrices.extraCharges.find(function(extraCharge) {
|
|
233
|
+
return extraCharge.description === charge.description;
|
|
234
|
+
});
|
|
235
|
+
var originalAmount = charge.amount.toFixed(2);
|
|
236
|
+
var quotedAmount = quotedCharge === null || quotedCharge === void 0 ? void 0 : quotedCharge.amount.toFixed(2);
|
|
159
237
|
// Only show strikethrough if amounts are different
|
|
160
|
-
return originalAmount !== quotedAmount ?
|
|
238
|
+
return originalAmount !== quotedAmount ? /*#__PURE__*/ _jsxs(View, {
|
|
239
|
+
style: {
|
|
161
240
|
justifyContent: 'flex-end',
|
|
162
|
-
flexDirection: 'row'
|
|
163
|
-
},
|
|
241
|
+
flexDirection: 'row'
|
|
242
|
+
},
|
|
243
|
+
children: [
|
|
244
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
245
|
+
style: {
|
|
164
246
|
color: colors.primary2,
|
|
165
247
|
letterSpacing: 1,
|
|
166
248
|
textDecoration: 'line-through',
|
|
167
|
-
marginRight: 4
|
|
168
|
-
},
|
|
249
|
+
marginRight: 4
|
|
250
|
+
},
|
|
251
|
+
children: originalAmount
|
|
252
|
+
}),
|
|
253
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
254
|
+
style: {
|
|
169
255
|
color: colors.primary3,
|
|
170
|
-
letterSpacing: 1
|
|
171
|
-
},
|
|
172
|
-
|
|
173
|
-
|
|
256
|
+
letterSpacing: 1
|
|
257
|
+
},
|
|
258
|
+
children: quotedAmount
|
|
259
|
+
})
|
|
260
|
+
]
|
|
261
|
+
}) : // When amounts are the same, show single value
|
|
262
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
263
|
+
style: {
|
|
174
264
|
color: colors.primary3,
|
|
175
|
-
letterSpacing: 1
|
|
176
|
-
},
|
|
177
|
-
|
|
265
|
+
letterSpacing: 1
|
|
266
|
+
},
|
|
267
|
+
children: originalAmount
|
|
268
|
+
});
|
|
269
|
+
}() : /*#__PURE__*/ _jsx(Text, {
|
|
270
|
+
style: {
|
|
178
271
|
color: colors.primary3,
|
|
179
|
-
letterSpacing: 1
|
|
180
|
-
},
|
|
272
|
+
letterSpacing: 1
|
|
273
|
+
},
|
|
274
|
+
children: charge.amount.toFixed(2)
|
|
275
|
+
})
|
|
276
|
+
]
|
|
277
|
+
}, i);
|
|
278
|
+
}),
|
|
279
|
+
quotation.couponCode !== null && couponType === 'upfront' && /*#__PURE__*/ _jsxs(View, {
|
|
280
|
+
style: {
|
|
181
281
|
justifyContent: 'space-between',
|
|
182
282
|
flexDirection: 'row',
|
|
183
|
-
rowGap: 8
|
|
184
|
-
},
|
|
283
|
+
rowGap: 8
|
|
284
|
+
},
|
|
285
|
+
children: [
|
|
286
|
+
/*#__PURE__*/ _jsxs(Text, {
|
|
287
|
+
style: {
|
|
185
288
|
paddingRight: 4,
|
|
186
289
|
letterSpacing: 1,
|
|
187
|
-
color: colors.primary3
|
|
188
|
-
},
|
|
290
|
+
color: colors.primary3
|
|
291
|
+
},
|
|
292
|
+
children: [
|
|
293
|
+
t === null || t === void 0 ? void 0 : t.fees.promo,
|
|
294
|
+
" - ",
|
|
295
|
+
quotation.couponCode
|
|
296
|
+
]
|
|
297
|
+
}),
|
|
298
|
+
/*#__PURE__*/ _jsxs(Text, {
|
|
299
|
+
style: {
|
|
189
300
|
color: colors.success4,
|
|
190
301
|
letterSpacing: 1,
|
|
191
|
-
fontWeight: 'bold'
|
|
192
|
-
},
|
|
302
|
+
fontWeight: 'bold'
|
|
303
|
+
},
|
|
304
|
+
children: [
|
|
305
|
+
"- ",
|
|
306
|
+
(_quotation_fees_discountAmount = quotation.fees.discountAmount) === null || _quotation_fees_discountAmount === void 0 ? void 0 : _quotation_fees_discountAmount.toFixed(2)
|
|
307
|
+
]
|
|
308
|
+
})
|
|
309
|
+
]
|
|
310
|
+
}),
|
|
311
|
+
hasDiscounts && /*#__PURE__*/ _jsxs(View, {
|
|
312
|
+
style: {
|
|
193
313
|
justifyContent: 'space-between',
|
|
194
314
|
flexDirection: 'row',
|
|
195
|
-
rowGap: 8
|
|
196
|
-
},
|
|
315
|
+
rowGap: 8
|
|
316
|
+
},
|
|
317
|
+
children: [
|
|
318
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
319
|
+
style: {
|
|
197
320
|
color: colors.primary3,
|
|
198
321
|
letterSpacing: 1,
|
|
199
|
-
paddingRight: 4
|
|
200
|
-
},
|
|
322
|
+
paddingRight: 4
|
|
323
|
+
},
|
|
324
|
+
children: t === null || t === void 0 ? void 0 : t.fees.totalDiscount
|
|
325
|
+
}),
|
|
326
|
+
/*#__PURE__*/ _jsxs(Text, {
|
|
327
|
+
style: {
|
|
201
328
|
color: colors.success4,
|
|
202
329
|
fontWeight: 'bold',
|
|
203
|
-
letterSpacing: 1
|
|
204
|
-
},
|
|
330
|
+
letterSpacing: 1
|
|
331
|
+
},
|
|
332
|
+
children: [
|
|
333
|
+
"- ",
|
|
334
|
+
upfrontTotalDiscount()
|
|
335
|
+
]
|
|
336
|
+
})
|
|
337
|
+
]
|
|
338
|
+
}),
|
|
339
|
+
/*#__PURE__*/ _jsxs(View, {
|
|
340
|
+
style: {
|
|
205
341
|
justifyContent: 'space-between',
|
|
206
342
|
flexDirection: 'row',
|
|
207
|
-
rowGap: 8
|
|
208
|
-
},
|
|
343
|
+
rowGap: 8
|
|
344
|
+
},
|
|
345
|
+
children: [
|
|
346
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
347
|
+
style: {
|
|
209
348
|
color: colors.primary3,
|
|
210
349
|
letterSpacing: 1,
|
|
211
|
-
paddingRight: 4
|
|
212
|
-
},
|
|
350
|
+
paddingRight: 4
|
|
351
|
+
},
|
|
352
|
+
children: "".concat(t === null || t === void 0 ? void 0 : t.serviceFee, " (").concat(taxPercentage, "%)")
|
|
353
|
+
}),
|
|
354
|
+
quotedPrices !== undefined ? /*#__PURE__*/ _jsx(Text, {
|
|
355
|
+
style: {
|
|
356
|
+
color: colors.primary3,
|
|
357
|
+
letterSpacing: 1
|
|
358
|
+
},
|
|
359
|
+
children: serviceUpfrontFee
|
|
360
|
+
}) : /*#__PURE__*/ _jsx(Text, {
|
|
361
|
+
style: {
|
|
362
|
+
color: colors.primary3,
|
|
363
|
+
letterSpacing: 1
|
|
364
|
+
},
|
|
365
|
+
children: serviceUpfrontFee
|
|
366
|
+
})
|
|
367
|
+
]
|
|
368
|
+
}),
|
|
369
|
+
/*#__PURE__*/ _jsxs(View, {
|
|
370
|
+
style: {
|
|
213
371
|
backgroundColor: colors.primary1,
|
|
214
|
-
borderTop:
|
|
372
|
+
borderTop: "1px solid ".concat(colors.primary1),
|
|
215
373
|
justifyContent: 'space-between',
|
|
216
374
|
flexDirection: 'row',
|
|
217
|
-
padding: 4
|
|
218
|
-
},
|
|
375
|
+
padding: 4
|
|
376
|
+
},
|
|
377
|
+
children: [
|
|
378
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
379
|
+
style: {
|
|
219
380
|
letterSpacing: 1,
|
|
220
381
|
paddingRight: 4,
|
|
221
|
-
fontWeight: 'bold'
|
|
222
|
-
},
|
|
382
|
+
fontWeight: 'bold'
|
|
383
|
+
},
|
|
384
|
+
children: "Total"
|
|
385
|
+
}),
|
|
386
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
387
|
+
style: {
|
|
388
|
+
letterSpacing: 1,
|
|
389
|
+
fontWeight: 'bold'
|
|
390
|
+
},
|
|
391
|
+
children: formatMoney(totalUpfrontFee + Number.parseFloat(serviceUpfrontFee))
|
|
392
|
+
})
|
|
393
|
+
]
|
|
394
|
+
}),
|
|
395
|
+
/*#__PURE__*/ _jsx(View, {
|
|
396
|
+
children: /*#__PURE__*/ _jsx(Text, {
|
|
397
|
+
style: {
|
|
223
398
|
color: colors.primary3,
|
|
224
399
|
letterSpacing: 1,
|
|
225
|
-
fontSize: '9px'
|
|
226
|
-
},
|
|
400
|
+
fontSize: '9px'
|
|
401
|
+
},
|
|
402
|
+
children: t === null || t === void 0 ? void 0 : t.fees.upfront.depositDisclaimer
|
|
403
|
+
})
|
|
404
|
+
}),
|
|
405
|
+
/*#__PURE__*/ _jsx(View, {
|
|
406
|
+
style: {
|
|
407
|
+
borderBottom: "1px solid ".concat(colors.primary2)
|
|
408
|
+
}
|
|
409
|
+
}),
|
|
410
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
411
|
+
style: {
|
|
227
412
|
fontWeight: 'bold',
|
|
228
413
|
color: colors.black,
|
|
229
|
-
letterSpacing: 1
|
|
230
|
-
},
|
|
231
|
-
|
|
232
|
-
|
|
414
|
+
letterSpacing: 1
|
|
415
|
+
},
|
|
416
|
+
children: t === null || t === void 0 ? void 0 : t.fees.monthly.title
|
|
417
|
+
}),
|
|
418
|
+
t === null || t === void 0 ? void 0 : t.fees.monthly.content.map(function(fee) {
|
|
419
|
+
var _getFeeValue, _getQuotedFeeValue;
|
|
420
|
+
var feeValue = (_getFeeValue = getFeeValue(fee.key)) === null || _getFeeValue === void 0 ? void 0 : _getFeeValue.toFixed(2);
|
|
421
|
+
var _getQuotedFeeValue_toFixed;
|
|
422
|
+
var quotedFeeValue = (_getQuotedFeeValue_toFixed = (_getQuotedFeeValue = getQuotedFeeValue(fee.key)) === null || _getQuotedFeeValue === void 0 ? void 0 : _getQuotedFeeValue.toFixed(2)) !== null && _getQuotedFeeValue_toFixed !== void 0 ? _getQuotedFeeValue_toFixed : undefined;
|
|
233
423
|
if (feeValue === '0.00') {
|
|
234
424
|
return null;
|
|
235
425
|
}
|
|
236
|
-
return
|
|
426
|
+
return /*#__PURE__*/ _jsxs(View, {
|
|
427
|
+
style: {
|
|
237
428
|
justifyContent: 'space-between',
|
|
238
429
|
flexDirection: 'row',
|
|
239
|
-
rowGap: 8
|
|
240
|
-
},
|
|
430
|
+
rowGap: 8
|
|
431
|
+
},
|
|
432
|
+
children: [
|
|
433
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
434
|
+
style: {
|
|
241
435
|
paddingRight: 4,
|
|
242
436
|
letterSpacing: 1,
|
|
243
|
-
color: colors.primary3
|
|
244
|
-
},
|
|
437
|
+
color: colors.primary3
|
|
438
|
+
},
|
|
439
|
+
children: fee.title
|
|
440
|
+
}),
|
|
441
|
+
hasDiscounts ? feeValue !== quotedFeeValue ? /*#__PURE__*/ _jsxs(View, {
|
|
442
|
+
style: {
|
|
245
443
|
justifyContent: 'flex-end',
|
|
246
|
-
flexDirection: 'row'
|
|
247
|
-
},
|
|
444
|
+
flexDirection: 'row'
|
|
445
|
+
},
|
|
446
|
+
children: [
|
|
447
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
448
|
+
style: {
|
|
248
449
|
color: colors.primary2,
|
|
249
450
|
letterSpacing: 1,
|
|
250
451
|
textDecoration: 'line-through',
|
|
251
|
-
marginRight: 4
|
|
252
|
-
},
|
|
452
|
+
marginRight: 4
|
|
453
|
+
},
|
|
454
|
+
children: feeValue !== null ? feeValue : ''
|
|
455
|
+
}),
|
|
456
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
457
|
+
style: {
|
|
253
458
|
color: colors.primary3,
|
|
254
|
-
letterSpacing: 1
|
|
255
|
-
},
|
|
256
|
-
|
|
257
|
-
|
|
459
|
+
letterSpacing: 1
|
|
460
|
+
},
|
|
461
|
+
children: quotedFeeValue
|
|
462
|
+
})
|
|
463
|
+
]
|
|
464
|
+
}) : // When values are the same, just show the single value
|
|
465
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
466
|
+
style: {
|
|
258
467
|
color: colors.primary3,
|
|
259
|
-
letterSpacing: 1
|
|
260
|
-
},
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
468
|
+
letterSpacing: 1
|
|
469
|
+
},
|
|
470
|
+
children: feeValue !== null ? feeValue : ''
|
|
471
|
+
}) : /*#__PURE__*/ _jsx(Text, {
|
|
472
|
+
style: {
|
|
473
|
+
color: colors.primary3,
|
|
474
|
+
letterSpacing: 1
|
|
475
|
+
},
|
|
476
|
+
children: feeValue !== null ? feeValue : ''
|
|
477
|
+
})
|
|
478
|
+
]
|
|
479
|
+
}, fee.key);
|
|
480
|
+
}),
|
|
481
|
+
quotation.fees.extraCharges.length > 0 && quotation.fees.extraCharges.filter(function(charge) {
|
|
482
|
+
return charge.type === 'monthly';
|
|
483
|
+
}).map(function(charge) {
|
|
484
|
+
return /*#__PURE__*/ _jsxs(View, {
|
|
485
|
+
style: {
|
|
265
486
|
justifyContent: 'space-between',
|
|
266
487
|
flexDirection: 'row',
|
|
267
|
-
rowGap: 8
|
|
268
|
-
},
|
|
488
|
+
rowGap: 8
|
|
489
|
+
},
|
|
490
|
+
children: [
|
|
491
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
492
|
+
style: {
|
|
269
493
|
paddingRight: 4,
|
|
270
494
|
letterSpacing: 1,
|
|
271
|
-
color: colors.primary3
|
|
272
|
-
},
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
495
|
+
color: colors.primary3
|
|
496
|
+
},
|
|
497
|
+
children: charge.description
|
|
498
|
+
}),
|
|
499
|
+
hasDiscounts ? function() {
|
|
500
|
+
var quotedCharge = quotedPrices.extraCharges.find(function(extraCharge) {
|
|
501
|
+
return extraCharge.description === charge.description;
|
|
502
|
+
});
|
|
503
|
+
var originalAmount = charge.amount.toFixed(2);
|
|
504
|
+
var quotedAmount = quotedCharge === null || quotedCharge === void 0 ? void 0 : quotedCharge.amount.toFixed(2);
|
|
276
505
|
// Only show strikethrough if amounts are different
|
|
277
|
-
return originalAmount !== quotedAmount ?
|
|
506
|
+
return originalAmount !== quotedAmount ? /*#__PURE__*/ _jsxs(View, {
|
|
507
|
+
style: {
|
|
278
508
|
justifyContent: 'flex-end',
|
|
279
|
-
flexDirection: 'row'
|
|
280
|
-
},
|
|
509
|
+
flexDirection: 'row'
|
|
510
|
+
},
|
|
511
|
+
children: [
|
|
512
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
513
|
+
style: {
|
|
281
514
|
color: colors.primary2,
|
|
282
515
|
letterSpacing: 1,
|
|
283
516
|
textDecoration: 'line-through',
|
|
284
|
-
marginRight: 4
|
|
285
|
-
},
|
|
517
|
+
marginRight: 4
|
|
518
|
+
},
|
|
519
|
+
children: originalAmount
|
|
520
|
+
}),
|
|
521
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
522
|
+
style: {
|
|
286
523
|
color: colors.primary3,
|
|
287
|
-
letterSpacing: 1
|
|
288
|
-
},
|
|
289
|
-
|
|
290
|
-
|
|
524
|
+
letterSpacing: 1
|
|
525
|
+
},
|
|
526
|
+
children: quotedAmount
|
|
527
|
+
})
|
|
528
|
+
]
|
|
529
|
+
}) : // When amounts are the same, show single value
|
|
530
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
531
|
+
style: {
|
|
291
532
|
color: colors.primary3,
|
|
292
|
-
letterSpacing: 1
|
|
293
|
-
},
|
|
294
|
-
|
|
533
|
+
letterSpacing: 1
|
|
534
|
+
},
|
|
535
|
+
children: originalAmount
|
|
536
|
+
});
|
|
537
|
+
}() : /*#__PURE__*/ _jsx(Text, {
|
|
538
|
+
style: {
|
|
295
539
|
color: colors.primary3,
|
|
296
|
-
letterSpacing: 1
|
|
297
|
-
},
|
|
540
|
+
letterSpacing: 1
|
|
541
|
+
},
|
|
542
|
+
children: charge.amount.toFixed(2)
|
|
543
|
+
})
|
|
544
|
+
]
|
|
545
|
+
}, charge.description);
|
|
546
|
+
}),
|
|
547
|
+
quotation.couponCode !== null && couponType === 'monthly' && /*#__PURE__*/ _jsxs(View, {
|
|
548
|
+
style: {
|
|
298
549
|
justifyContent: 'space-between',
|
|
299
550
|
flexDirection: 'row',
|
|
300
|
-
rowGap: 8
|
|
301
|
-
},
|
|
551
|
+
rowGap: 8
|
|
552
|
+
},
|
|
553
|
+
children: [
|
|
554
|
+
/*#__PURE__*/ _jsxs(Text, {
|
|
555
|
+
style: {
|
|
302
556
|
paddingRight: 4,
|
|
303
557
|
letterSpacing: 1,
|
|
304
|
-
color: colors.primary3
|
|
305
|
-
},
|
|
558
|
+
color: colors.primary3
|
|
559
|
+
},
|
|
560
|
+
children: [
|
|
561
|
+
t === null || t === void 0 ? void 0 : t.fees.promo,
|
|
562
|
+
" - ",
|
|
563
|
+
quotation.couponCode
|
|
564
|
+
]
|
|
565
|
+
}),
|
|
566
|
+
/*#__PURE__*/ _jsxs(Text, {
|
|
567
|
+
style: {
|
|
306
568
|
color: colors.success4,
|
|
307
569
|
letterSpacing: 1,
|
|
308
|
-
fontWeight: 'bold'
|
|
309
|
-
},
|
|
570
|
+
fontWeight: 'bold'
|
|
571
|
+
},
|
|
572
|
+
children: [
|
|
573
|
+
"- ",
|
|
574
|
+
(_quotation_fees_discountAmount1 = quotation.fees.discountAmount) === null || _quotation_fees_discountAmount1 === void 0 ? void 0 : _quotation_fees_discountAmount1.toFixed(2)
|
|
575
|
+
]
|
|
576
|
+
})
|
|
577
|
+
]
|
|
578
|
+
}),
|
|
579
|
+
/*#__PURE__*/ _jsxs(View, {
|
|
580
|
+
style: {
|
|
310
581
|
justifyContent: 'space-between',
|
|
311
582
|
flexDirection: 'row',
|
|
312
|
-
rowGap: 8
|
|
313
|
-
},
|
|
583
|
+
rowGap: 8
|
|
584
|
+
},
|
|
585
|
+
children: [
|
|
586
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
587
|
+
style: {
|
|
314
588
|
color: colors.primary3,
|
|
315
589
|
letterSpacing: 1,
|
|
316
|
-
paddingRight: 4
|
|
317
|
-
},
|
|
590
|
+
paddingRight: 4
|
|
591
|
+
},
|
|
592
|
+
children: "".concat(t === null || t === void 0 ? void 0 : t.serviceFee, " (").concat(taxPercentage, "%)")
|
|
593
|
+
}),
|
|
594
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
595
|
+
style: {
|
|
596
|
+
color: colors.primary3,
|
|
597
|
+
letterSpacing: 1
|
|
598
|
+
},
|
|
599
|
+
children: serviceMonthlyFee.toFixed(2)
|
|
600
|
+
})
|
|
601
|
+
]
|
|
602
|
+
}),
|
|
603
|
+
/*#__PURE__*/ _jsxs(View, {
|
|
604
|
+
style: {
|
|
318
605
|
backgroundColor: colors.primary1,
|
|
319
|
-
borderTop:
|
|
606
|
+
borderTop: "1px solid ".concat(colors.primary1),
|
|
320
607
|
justifyContent: 'space-between',
|
|
321
608
|
flexDirection: 'row',
|
|
322
|
-
padding: 4
|
|
323
|
-
},
|
|
609
|
+
padding: 4
|
|
610
|
+
},
|
|
611
|
+
children: [
|
|
612
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
613
|
+
style: {
|
|
324
614
|
letterSpacing: 1,
|
|
325
615
|
paddingRight: 4,
|
|
326
|
-
fontWeight: 'bold'
|
|
327
|
-
},
|
|
616
|
+
fontWeight: 'bold'
|
|
617
|
+
},
|
|
618
|
+
children: "Total"
|
|
619
|
+
}),
|
|
620
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
621
|
+
style: {
|
|
622
|
+
letterSpacing: 1,
|
|
623
|
+
fontWeight: 'bold'
|
|
624
|
+
},
|
|
625
|
+
children: formatMoney(totalMonthlyFee + serviceMonthlyFee)
|
|
626
|
+
})
|
|
627
|
+
]
|
|
628
|
+
})
|
|
629
|
+
]
|
|
630
|
+
}),
|
|
631
|
+
bottomContent: /*#__PURE__*/ _jsxs(View, {
|
|
632
|
+
style: {
|
|
633
|
+
rowGap: 16
|
|
634
|
+
},
|
|
635
|
+
children: [
|
|
636
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
637
|
+
style: {
|
|
328
638
|
textTransform: 'uppercase',
|
|
329
639
|
fontSize: 12,
|
|
330
640
|
fontWeight: 'bold',
|
|
331
|
-
letterSpacing: 1
|
|
332
|
-
},
|
|
641
|
+
letterSpacing: 1
|
|
642
|
+
},
|
|
643
|
+
children: t === null || t === void 0 ? void 0 : t.fees.dueToday.title
|
|
644
|
+
}),
|
|
645
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
646
|
+
style: {
|
|
647
|
+
color: colors.primary3,
|
|
648
|
+
letterSpacing: 1
|
|
649
|
+
},
|
|
650
|
+
children: t === null || t === void 0 ? void 0 : t.fees.dueToday.description
|
|
651
|
+
}),
|
|
652
|
+
/*#__PURE__*/ _jsxs(View, {
|
|
653
|
+
style: {
|
|
333
654
|
justifyContent: 'space-between',
|
|
334
|
-
flexDirection: 'row'
|
|
335
|
-
},
|
|
336
|
-
|
|
337
|
-
|
|
655
|
+
flexDirection: 'row'
|
|
656
|
+
},
|
|
657
|
+
children: [
|
|
658
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
659
|
+
style: {
|
|
660
|
+
letterSpacing: 1,
|
|
661
|
+
color: colors.primary3
|
|
662
|
+
},
|
|
663
|
+
children: t === null || t === void 0 ? void 0 : t.fees.dueToday.subTotal
|
|
664
|
+
}),
|
|
665
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
666
|
+
style: {
|
|
667
|
+
letterSpacing: 1,
|
|
668
|
+
color: colors.primary3
|
|
669
|
+
},
|
|
670
|
+
children: hasDiscounts ? quotedPrices === null || quotedPrices === void 0 ? void 0 : quotedPrices.amountBeforeTax.toFixed(2) : quotation.fees.amountBeforeTax.toFixed(2)
|
|
671
|
+
})
|
|
672
|
+
]
|
|
673
|
+
}),
|
|
674
|
+
/*#__PURE__*/ _jsxs(View, {
|
|
675
|
+
style: {
|
|
338
676
|
justifyContent: 'space-between',
|
|
339
|
-
flexDirection: 'row'
|
|
340
|
-
},
|
|
341
|
-
|
|
342
|
-
|
|
677
|
+
flexDirection: 'row'
|
|
678
|
+
},
|
|
679
|
+
children: [
|
|
680
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
681
|
+
style: {
|
|
682
|
+
letterSpacing: 1,
|
|
683
|
+
color: colors.primary3
|
|
684
|
+
},
|
|
685
|
+
children: "".concat(t === null || t === void 0 ? void 0 : t.serviceFee, " (").concat(taxPercentage, "%)")
|
|
686
|
+
}),
|
|
687
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
688
|
+
style: {
|
|
689
|
+
letterSpacing: 1,
|
|
690
|
+
color: colors.primary3
|
|
691
|
+
},
|
|
692
|
+
children: hasDiscounts ? quotedPrices === null || quotedPrices === void 0 ? void 0 : quotedPrices.taxAmount.toFixed(2) : quotation.fees.taxAmount.toFixed(2)
|
|
693
|
+
})
|
|
694
|
+
]
|
|
695
|
+
}),
|
|
696
|
+
/*#__PURE__*/ _jsxs(View, {
|
|
697
|
+
style: {
|
|
343
698
|
backgroundColor: colors.primary1,
|
|
344
|
-
borderTop:
|
|
699
|
+
borderTop: "1px solid ".concat(colors.primary1),
|
|
345
700
|
justifyContent: 'space-between',
|
|
346
701
|
flexDirection: 'row',
|
|
347
|
-
padding: 4
|
|
348
|
-
},
|
|
702
|
+
padding: 4
|
|
703
|
+
},
|
|
704
|
+
children: [
|
|
705
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
706
|
+
style: {
|
|
349
707
|
letterSpacing: 1,
|
|
350
708
|
paddingRight: 4,
|
|
351
|
-
fontWeight: 'bold'
|
|
352
|
-
},
|
|
353
|
-
|
|
354
|
-
|
|
709
|
+
fontWeight: 'bold'
|
|
710
|
+
},
|
|
711
|
+
children: t === null || t === void 0 ? void 0 : t.fees.dueToday.grandTotal
|
|
712
|
+
}),
|
|
713
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
714
|
+
style: {
|
|
715
|
+
letterSpacing: 1,
|
|
716
|
+
fontWeight: 'bold'
|
|
717
|
+
},
|
|
718
|
+
children: hasDiscounts ? quotedPrices === null || quotedPrices === void 0 ? void 0 : quotedPrices.amountAfterTax.toFixed(2) : quotation.fees.amountAfterTax.toFixed(2)
|
|
719
|
+
})
|
|
720
|
+
]
|
|
721
|
+
})
|
|
722
|
+
]
|
|
723
|
+
})
|
|
724
|
+
})
|
|
725
|
+
});
|
|
355
726
|
};
|
|
356
727
|
export default Pricing;
|
|
357
|
-
//# sourceMappingURL=Pricing.js.map
|