@driveflux/pdf 1.7.0 → 1.7.1

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 (38) hide show
  1. package/dist/__mocks__/quotation.js +11 -10
  2. package/dist/__mocks__/subscription.js +122 -380
  3. package/dist/components/FluxLogo.js +3 -62
  4. package/dist/components/StandardPage.js +8 -97
  5. package/dist/debug.js +26 -203
  6. package/dist/index.js +1 -0
  7. package/dist/templates/QuotationPdf/CustomerSubscriptionSection.js +27 -145
  8. package/dist/templates/QuotationPdf/GFV.js +12 -49
  9. package/dist/templates/QuotationPdf/Header.js +5 -63
  10. package/dist/templates/QuotationPdf/Pricing.js +204 -574
  11. package/dist/templates/QuotationPdf/QuotationPdfPage.js +3 -23
  12. package/dist/templates/QuotationPdf/SectionBoxNew.js +4 -34
  13. package/dist/templates/QuotationPdf/TermsSection.js +5 -42
  14. package/dist/templates/QuotationPdf/VehiclePhotos.js +24 -54
  15. package/dist/templates/QuotationPdf/index.js +10 -189
  16. package/dist/templates/QuotationPdf/translations.js +23 -38
  17. package/dist/templates/QuotationPdf/utils.js +29 -59
  18. package/dist/templates/SubscriptionAgreement/Confirmation.js +11 -66
  19. package/dist/templates/SubscriptionAgreement/CoverPage.js +10 -77
  20. package/dist/templates/SubscriptionAgreement/CoverPageSection.js +5 -16
  21. package/dist/templates/SubscriptionAgreement/Details.js +43 -69
  22. package/dist/templates/SubscriptionAgreement/Footer.js +6 -48
  23. package/dist/templates/SubscriptionAgreement/Header.js +5 -35
  24. package/dist/templates/SubscriptionAgreement/LabelValue.js +3 -25
  25. package/dist/templates/SubscriptionAgreement/SubscriptionAgreementPage.js +3 -26
  26. package/dist/templates/SubscriptionAgreement/TermsOfUse.js +3 -52
  27. package/dist/templates/SubscriptionAgreement/TermsOfUseSubSection.js +9 -97
  28. package/dist/templates/SubscriptionAgreement/index.js +14 -240
  29. package/dist/templates/SubscriptionAgreement/translations.js +193 -194
  30. package/dist/templates/SubscriptionAgreement/types.js +2 -1
  31. package/dist/templates/SubscriptionAgreement/utils.js +5 -3
  32. package/dist/templates/index.js +1 -0
  33. package/dist/theme/colors.js +63 -44
  34. package/dist/theme/index.js +1 -0
  35. package/dist/types.js +2 -1
  36. package/dist/utils.js +16 -159
  37. package/dist/watch.js +4 -3
  38. 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).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;
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,642 +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
- children: /*#__PURE__*/ _jsx(Text, {
397
- 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: {
398
223
  color: colors.primary3,
399
224
  letterSpacing: 1,
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: {
225
+ fontSize: '9px',
226
+ }, children: t?.fees.upfront.depositDisclaimer }) }), _jsx(View, { style: { borderBottom: `1px solid ${colors.primary2}` } }), _jsx(Text, { style: {
412
227
  fontWeight: 'bold',
413
228
  color: colors.black,
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;
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;
423
233
  if (feeValue === '0.00') {
424
234
  return null;
425
235
  }
426
- return /*#__PURE__*/ _jsxs(View, {
427
- style: {
236
+ return (_jsxs(View, { style: {
428
237
  justifyContent: 'space-between',
429
238
  flexDirection: 'row',
430
- rowGap: 8
431
- },
432
- children: [
433
- /*#__PURE__*/ _jsx(Text, {
434
- style: {
239
+ rowGap: 8,
240
+ }, children: [_jsx(Text, { style: {
435
241
  paddingRight: 4,
436
242
  letterSpacing: 1,
437
- color: colors.primary3
438
- },
439
- children: fee.title
440
- }),
441
- hasDiscounts ? feeValue !== quotedFeeValue ? /*#__PURE__*/ _jsxs(View, {
442
- style: {
243
+ color: colors.primary3,
244
+ }, children: fee.title }), hasDiscounts ? (feeValue !== quotedFeeValue ? (_jsxs(View, { style: {
443
245
  justifyContent: 'flex-end',
444
- flexDirection: 'row'
445
- },
446
- children: [
447
- /*#__PURE__*/ _jsx(Text, {
448
- style: {
246
+ flexDirection: 'row',
247
+ }, children: [_jsx(Text, { style: {
449
248
  color: colors.primary2,
450
249
  letterSpacing: 1,
451
250
  textDecoration: 'line-through',
452
- marginRight: 4
453
- },
454
- children: feeValue !== null ? feeValue : ''
455
- }),
456
- /*#__PURE__*/ _jsx(Text, {
457
- style: {
251
+ marginRight: 4,
252
+ }, children: feeValue !== null ? feeValue : '' }), _jsx(Text, { style: {
458
253
  color: colors.primary3,
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: {
467
- color: colors.primary3,
468
- letterSpacing: 1
469
- },
470
- children: feeValue !== null ? feeValue : ''
471
- }) : /*#__PURE__*/ _jsx(Text, {
472
- style: {
254
+ letterSpacing: 1,
255
+ }, children: quotedFeeValue })] })) : (
256
+ // When values are the same, just show the single value
257
+ _jsx(Text, { style: {
473
258
  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: {
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: {
486
265
  justifyContent: 'space-between',
487
266
  flexDirection: 'row',
488
- rowGap: 8
489
- },
490
- children: [
491
- /*#__PURE__*/ _jsx(Text, {
492
- style: {
267
+ rowGap: 8,
268
+ }, children: [_jsx(Text, { style: {
493
269
  paddingRight: 4,
494
270
  letterSpacing: 1,
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);
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);
505
276
  // Only show strikethrough if amounts are different
506
- return originalAmount !== quotedAmount ? /*#__PURE__*/ _jsxs(View, {
507
- style: {
277
+ return originalAmount !== quotedAmount ? (_jsxs(View, { style: {
508
278
  justifyContent: 'flex-end',
509
- flexDirection: 'row'
510
- },
511
- children: [
512
- /*#__PURE__*/ _jsx(Text, {
513
- style: {
279
+ flexDirection: 'row',
280
+ }, children: [_jsx(Text, { style: {
514
281
  color: colors.primary2,
515
282
  letterSpacing: 1,
516
283
  textDecoration: 'line-through',
517
- marginRight: 4
518
- },
519
- children: originalAmount
520
- }),
521
- /*#__PURE__*/ _jsx(Text, {
522
- style: {
284
+ marginRight: 4,
285
+ }, children: originalAmount }), _jsx(Text, { style: {
523
286
  color: colors.primary3,
524
- letterSpacing: 1
525
- },
526
- children: quotedAmount
527
- })
528
- ]
529
- }) : // When amounts are the same, show single value
530
- /*#__PURE__*/ _jsx(Text, {
531
- style: {
287
+ letterSpacing: 1,
288
+ }, children: quotedAmount })] })) : (
289
+ // When amounts are the same, show single value
290
+ _jsx(Text, { style: {
532
291
  color: colors.primary3,
533
- letterSpacing: 1
534
- },
535
- children: originalAmount
536
- });
537
- }() : /*#__PURE__*/ _jsx(Text, {
538
- style: {
292
+ letterSpacing: 1,
293
+ }, children: originalAmount }));
294
+ })()) : (_jsx(Text, { style: {
539
295
  color: colors.primary3,
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: {
296
+ letterSpacing: 1,
297
+ }, children: charge.amount.toFixed(2) }))] }, charge.description))), quotation.couponCode !== null && couponType === 'monthly' && (_jsxs(View, { style: {
549
298
  justifyContent: 'space-between',
550
299
  flexDirection: 'row',
551
- rowGap: 8
552
- },
553
- children: [
554
- /*#__PURE__*/ _jsxs(Text, {
555
- style: {
300
+ rowGap: 8,
301
+ }, children: [_jsxs(Text, { style: {
556
302
  paddingRight: 4,
557
303
  letterSpacing: 1,
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: {
304
+ color: colors.primary3,
305
+ }, children: [t?.fees.promo, " - ", quotation.couponCode] }), _jsxs(Text, { style: {
568
306
  color: colors.success4,
569
307
  letterSpacing: 1,
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: {
308
+ fontWeight: 'bold',
309
+ }, children: ["- ", quotation.fees.discountAmount?.toFixed(2)] })] })), _jsxs(View, { style: {
581
310
  justifyContent: 'space-between',
582
311
  flexDirection: 'row',
583
- rowGap: 8
584
- },
585
- children: [
586
- /*#__PURE__*/ _jsx(Text, {
587
- style: {
312
+ rowGap: 8,
313
+ }, children: [_jsx(Text, { style: {
588
314
  color: colors.primary3,
589
315
  letterSpacing: 1,
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: {
316
+ paddingRight: 4,
317
+ }, children: `${t?.serviceFee} (${taxPercentage}%)` }), _jsx(Text, { style: { color: colors.primary3, letterSpacing: 1 }, children: serviceMonthlyFee.toFixed(2) })] }), _jsxs(View, { style: {
605
318
  backgroundColor: colors.primary1,
606
- borderTop: "1px solid ".concat(colors.primary1),
319
+ borderTop: `1px solid ${colors.primary1}`,
607
320
  justifyContent: 'space-between',
608
321
  flexDirection: 'row',
609
- padding: 4
610
- },
611
- children: [
612
- /*#__PURE__*/ _jsx(Text, {
613
- style: {
322
+ padding: 4,
323
+ }, children: [_jsx(Text, { style: {
614
324
  letterSpacing: 1,
615
325
  paddingRight: 4,
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: {
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: {
638
328
  textTransform: 'uppercase',
639
329
  fontSize: 12,
640
330
  fontWeight: 'bold',
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: {
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: {
654
333
  justifyContent: 'space-between',
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: {
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: {
676
338
  justifyContent: 'space-between',
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: {
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: {
698
343
  backgroundColor: colors.primary1,
699
- borderTop: "1px solid ".concat(colors.primary1),
344
+ borderTop: `1px solid ${colors.primary1}`,
700
345
  justifyContent: 'space-between',
701
346
  flexDirection: 'row',
702
- padding: 4
703
- },
704
- children: [
705
- /*#__PURE__*/ _jsx(Text, {
706
- style: {
347
+ padding: 4,
348
+ }, children: [_jsx(Text, { style: {
707
349
  letterSpacing: 1,
708
350
  paddingRight: 4,
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
- });
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) })] })] }) }) }));
726
355
  };
727
356
  export default Pricing;
357
+ //# sourceMappingURL=Pricing.js.map