@driveflux/pdf 1.6.2 → 1.6.4

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