@driveflux/pdf 4.0.76 → 4.0.78

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 (36) hide show
  1. package/dist/components/FluxLogo.js +3 -62
  2. package/dist/components/StandardPage.js +10 -99
  3. package/dist/index.js +1 -0
  4. package/dist/templates/QuotationPdf/CustomerSubscriptionSection.js +27 -145
  5. package/dist/templates/QuotationPdf/GFV.js +12 -49
  6. package/dist/templates/QuotationPdf/Header.js +5 -63
  7. package/dist/templates/QuotationPdf/Pricing.js +191 -573
  8. package/dist/templates/QuotationPdf/Pricing.js.map +1 -1
  9. package/dist/templates/QuotationPdf/QuotationPdfPage.js +3 -23
  10. package/dist/templates/QuotationPdf/SectionBoxNew.js +4 -34
  11. package/dist/templates/QuotationPdf/TermsSection.js +5 -42
  12. package/dist/templates/QuotationPdf/VehiclePhotos.js +24 -54
  13. package/dist/templates/QuotationPdf/index.js +10 -189
  14. package/dist/templates/QuotationPdf/translations.js +22 -34
  15. package/dist/templates/QuotationPdf/utils.js +49 -83
  16. package/dist/templates/SubscriptionAgreement/Confirmation.js +10 -65
  17. package/dist/templates/SubscriptionAgreement/CoverPage.js +10 -93
  18. package/dist/templates/SubscriptionAgreement/CoverPageSection.js +5 -16
  19. package/dist/templates/SubscriptionAgreement/Details.js +59 -139
  20. package/dist/templates/SubscriptionAgreement/Footer.js +6 -48
  21. package/dist/templates/SubscriptionAgreement/Header.js +5 -35
  22. package/dist/templates/SubscriptionAgreement/LabelValue.js +3 -25
  23. package/dist/templates/SubscriptionAgreement/SubscriptionAgreementPage.js +3 -26
  24. package/dist/templates/SubscriptionAgreement/TermsOfUse.js +8 -94
  25. package/dist/templates/SubscriptionAgreement/TermsOfUseSubSection.js +11 -97
  26. package/dist/templates/SubscriptionAgreement/index.js +15 -245
  27. package/dist/templates/SubscriptionAgreement/translations.js +194 -195
  28. package/dist/templates/SubscriptionAgreement/types.js +2 -1
  29. package/dist/templates/SubscriptionAgreement/utils.js +11 -16
  30. package/dist/templates/index.js +1 -0
  31. package/dist/theme/colors.js +63 -44
  32. package/dist/theme/index.js +1 -0
  33. package/dist/types.js +2 -1
  34. package/dist/utils.js +16 -159
  35. package/dist/watch.js +4 -3
  36. package/package.json +18 -18
@@ -1,43 +1,13 @@
1
- function _object_without_properties(source, excluded) {
2
- if (source == null) return {};
3
- var target = _object_without_properties_loose(source, excluded);
4
- var key, i;
5
- if (Object.getOwnPropertySymbols) {
6
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
7
- for(i = 0; i < sourceSymbolKeys.length; i++){
8
- key = sourceSymbolKeys[i];
9
- if (excluded.indexOf(key) >= 0) continue;
10
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
11
- target[key] = source[key];
12
- }
13
- }
14
- return target;
15
- }
16
- function _object_without_properties_loose(source, excluded) {
17
- if (source == null) return {};
18
- var target = {};
19
- var sourceKeys = Object.keys(source);
20
- var key, i;
21
- for(i = 0; i < sourceKeys.length; i++){
22
- key = sourceKeys[i];
23
- if (excluded.indexOf(key) >= 0) continue;
24
- target[key] = source[key];
25
- }
26
- return target;
27
- }
28
1
  import { formatMoney } from '@driveflux/format-money';
29
- export var formatAddress = function(originalAddress) {
30
- var coordinates = originalAddress.coordinates, address = _object_without_properties(originalAddress, [
31
- "coordinates"
32
- ]);
33
- return Object.keys(address).filter(function(key) {
34
- return key !== 'name' && !!address[key];
35
- }).map(function(a) {
36
- return address[a];
37
- }).join(', ');
2
+ export const formatAddress = (originalAddress) => {
3
+ const { coordinates, ...address } = originalAddress;
4
+ return Object.keys(address)
5
+ .filter((key) => key !== 'name' && !!address[key])
6
+ .map((a) => address[a])
7
+ .join(', ');
38
8
  };
39
- export var getSimplifiedPlanTranslation = function(plan) {
40
- switch(plan){
9
+ export const getSimplifiedPlanTranslation = (plan) => {
10
+ switch (plan) {
41
11
  case 'plan60':
42
12
  return '60 Months';
43
13
  case 'plan36':
@@ -50,18 +20,17 @@ export var getSimplifiedPlanTranslation = function(plan) {
50
20
  return 'Monthly';
51
21
  case 'planWeekly':
52
22
  return 'Weekly';
53
- default:
54
- {
55
- var _exhaustiveCheck = plan;
56
- return 'Unknown Plan';
57
- }
23
+ default: {
24
+ const _exhaustiveCheck = plan;
25
+ return 'Unknown Plan';
26
+ }
58
27
  }
59
28
  };
60
- export var getMileagePackageTranslation = function(mileagePackage) {
29
+ export const getMileagePackageTranslation = (mileagePackage) => {
61
30
  if (!mileagePackage) {
62
31
  return 'Unknown Mileage Package';
63
32
  }
64
- switch(mileagePackage){
33
+ switch (mileagePackage) {
65
34
  case 'lite':
66
35
  return 'Lite';
67
36
  case 'standard':
@@ -70,18 +39,17 @@ export var getMileagePackageTranslation = function(mileagePackage) {
70
39
  return 'Plus';
71
40
  case 'unlimited':
72
41
  return 'Unlimited';
73
- default:
74
- {
75
- var _exhaustiveCheck = mileagePackage;
76
- return 'Unknown Mileage Package';
77
- }
42
+ default: {
43
+ const _exhaustiveCheck = mileagePackage;
44
+ return 'Unknown Mileage Package';
45
+ }
78
46
  }
79
47
  };
80
- export var getFullMileagePackageTranslation = function(plan) {
48
+ export const getFullMileagePackageTranslation = (plan) => {
81
49
  if (!plan) {
82
50
  return 'Unknown Mileage Package';
83
51
  }
84
- switch(plan){
52
+ switch (plan) {
85
53
  case 'lite':
86
54
  return 'Lite - 1,250KM';
87
55
  case 'standard':
@@ -90,40 +58,38 @@ export var getFullMileagePackageTranslation = function(plan) {
90
58
  return 'Plus - 2,750KM';
91
59
  case 'unlimited':
92
60
  return 'Unlimited';
93
- default:
94
- {
95
- var _exhaustiveCheck = plan;
96
- return 'Unknown Mileage Package';
97
- }
61
+ default: {
62
+ const _exhaustiveCheck = plan;
63
+ return 'Unknown Mileage Package';
64
+ }
98
65
  }
99
66
  };
100
- export var getPromoNotes = function(amount, discount) {
101
- var discountType = discount.discountType, discountValue = discount.discountValue, maxRedemptions = discount.maxRedemptions;
102
- switch(discountType){
67
+ export const getPromoNotes = (amount, discount) => {
68
+ const { discountType, discountValue, maxRedemptions } = discount;
69
+ switch (discountType) {
103
70
  case 'percentage':
104
- return "Enjoy ".concat(discountValue * 100, "% off for ").concat(maxRedemptions, " month(s) for this vehicle.");
105
- case 'fixed':
106
- {
107
- var money = formatMoney(discountValue);
108
- return amount <= 0 ? "Enjoy free for ".concat(maxRedemptions, " month(s).") : "Enjoy ".concat(money, " off for the first ").concat(maxRedemptions, " month(s), then your subscription will switch to the regular price.");
109
- }
110
- case 'forceAmount':
111
- {
112
- var money1 = formatMoney(Math.min(amount, discountValue));
113
- return "Enjoy only ".concat(money1, " for ").concat(maxRedemptions, " month(s), then your subscription will switch to the regular price.");
114
- }
115
- default:
116
- {
117
- var _exhaustiveCheck = discountType;
118
- return 'Unknown Discount Type';
119
- }
71
+ return `Enjoy ${discountValue * 100}% off for ${maxRedemptions} month(s) for this vehicle.`;
72
+ case 'fixed': {
73
+ const money = formatMoney(discountValue);
74
+ return amount <= 0
75
+ ? `Enjoy free for ${maxRedemptions} month(s).`
76
+ : `Enjoy ${money} off for the first ${maxRedemptions} month(s), then your subscription will switch to the regular price.`;
77
+ }
78
+ case 'forceAmount': {
79
+ const money = formatMoney(Math.min(amount, discountValue));
80
+ return `Enjoy only ${money} for ${maxRedemptions} month(s), then your subscription will switch to the regular price.`;
81
+ }
82
+ default: {
83
+ const _exhaustiveCheck = discountType;
84
+ return 'Unknown Discount Type';
85
+ }
120
86
  }
121
87
  };
122
- export var getInspectionTypeTranslation = function(inspectionType) {
88
+ export const getInspectionTypeTranslation = (inspectionType) => {
123
89
  if (!inspectionType) {
124
90
  return 'Unknown Inspection Type';
125
91
  }
126
- switch(inspectionType){
92
+ switch (inspectionType) {
127
93
  case 'exterior':
128
94
  return 'Exterior';
129
95
  case 'interior':
@@ -134,10 +100,10 @@ export var getInspectionTypeTranslation = function(inspectionType) {
134
100
  return 'Frame';
135
101
  case 'dashboard':
136
102
  return 'Dashboard';
137
- default:
138
- {
139
- var _exhaustiveCheck = inspectionType;
140
- return inspectionType;
141
- }
103
+ default: {
104
+ const _exhaustiveCheck = inspectionType;
105
+ return inspectionType;
106
+ }
142
107
  }
143
108
  };
109
+ //# sourceMappingURL=utils.js.map
@@ -4,77 +4,22 @@ import { Image, Text, View } from '@react-pdf/renderer';
4
4
  import { format } from 'date-fns';
5
5
  import { colors } from '../../theme/index.js';
6
6
  import LabelValue from './LabelValue.js';
7
- var Confirmation = function(param) {
8
- var tConfirmation = param.tConfirmation, subscription = param.subscription, signature = param.signature;
9
- var _subscription_user_identification;
7
+ const Confirmation = ({ tConfirmation, subscription, signature, }) => {
10
8
  if (!signature.signature) {
11
9
  throw new Error('Missing signature');
12
10
  }
13
- var border = "1px solid ".concat(colors.primary2);
14
- return /*#__PURE__*/ _jsxs(View, {
15
- style: {
16
- borderLeft: border,
17
- borderRight: border,
18
- borderBottom: border
19
- },
20
- children: [
21
- /*#__PURE__*/ _jsx(View, {
22
- style: {
11
+ const border = `1px solid ${colors.primary2}`;
12
+ return (_jsxs(View, { style: { borderLeft: border, borderRight: border, borderBottom: border }, children: [_jsx(View, { style: {
23
13
  backgroundColor: colors.primary1,
24
14
  borderTop: border,
25
- padding: 8
26
- },
27
- children: /*#__PURE__*/ _jsx(Text, {
28
- style: {
15
+ padding: 8,
16
+ }, children: _jsx(Text, { style: {
29
17
  fontWeight: 'bold',
30
18
  textTransform: 'uppercase',
31
- letterSpacing: 1
32
- },
33
- children: tConfirmation.title
34
- })
35
- }),
36
- /*#__PURE__*/ _jsxs(View, {
37
- style: {
38
- padding: 8,
39
- paddingBottom: 16,
40
- rowGap: 8,
41
- borderTop: border
42
- },
43
- children: [
44
- /*#__PURE__*/ _jsx(Text, {
45
- children: tConfirmation.agreementText(subscription.businessId ? 'business' : 'member')
46
- }),
47
- /*#__PURE__*/ _jsx(View, {
48
- style: {
49
- height: 160,
50
- alignItems: 'flex-start'
51
- },
52
- children: /*#__PURE__*/ _jsx(Image, {
53
- src: signature.signature || ''
54
- })
55
- }),
56
- /*#__PURE__*/ _jsxs(View, {
57
- style: {
58
- rowGap: 8
59
- },
60
- children: [
61
- /*#__PURE__*/ _jsx(LabelValue, {
62
- label: tConfirmation.name,
63
- value: userName(subscription.user)
64
- }),
65
- /*#__PURE__*/ _jsx(LabelValue, {
66
- label: tConfirmation.idOrPassportNo,
67
- value: (_subscription_user_identification = subscription.user.identification) === null || _subscription_user_identification === void 0 ? void 0 : _subscription_user_identification.number
68
- }),
69
- /*#__PURE__*/ _jsx(LabelValue, {
70
- label: tConfirmation.date,
71
- value: signature.signedAt ? format(signature.signedAt, 'dd-MM-yyyy hh:mm a') : undefined
72
- })
73
- ]
74
- })
75
- ]
76
- })
77
- ]
78
- });
19
+ letterSpacing: 1,
20
+ }, children: tConfirmation.title }) }), _jsxs(View, { style: { padding: 8, paddingBottom: 16, rowGap: 8, borderTop: border }, children: [_jsx(Text, { children: tConfirmation.agreementText(subscription.businessId ? 'business' : 'member') }), _jsx(View, { style: { height: 160, alignItems: 'flex-start' }, children: _jsx(Image, { src: signature.signature || '' }) }), _jsxs(View, { style: { rowGap: 8 }, children: [_jsx(LabelValue, { label: tConfirmation.name, value: userName(subscription.user) }), _jsx(LabelValue, { label: tConfirmation.idOrPassportNo, value: subscription.user.identification?.number }), _jsx(LabelValue, { label: tConfirmation.date, value: signature.signedAt
21
+ ? format(signature.signedAt, 'dd-MM-yyyy hh:mm a')
22
+ : undefined })] })] })] }));
79
23
  };
80
24
  export default Confirmation;
25
+ //# sourceMappingURL=Confirmation.js.map
@@ -5,107 +5,24 @@ import { format } from 'date-fns';
5
5
  import { colors } from '../../theme/colors.js';
6
6
  import CoverPageSection from './CoverPageSection.js';
7
7
  import LabelValue from './LabelValue.js';
8
- var CoverPage = function(param) {
9
- var tTitle = param.tTitle, tCover = param.tCover, signedAt = param.signedAt, user = param.user, payerType = param.payerType, business = param.business;
10
- var _user_identification;
11
- return /*#__PURE__*/ _jsxs(View, {
12
- style: {
13
- flex: 1,
14
- paddingVertical: 80,
15
- justifyContent: 'space-between'
16
- },
17
- children: [
18
- /*#__PURE__*/ _jsx(Text, {
19
- style: {
8
+ const CoverPage = ({ tTitle, tCover, signedAt, user, payerType, business, }) => {
9
+ return (_jsxs(View, { style: { flex: 1, paddingVertical: 80, justifyContent: 'space-between' }, children: [_jsx(Text, { style: {
20
10
  fontWeight: 'bold',
21
11
  fontSize: 40,
22
12
  textTransform: 'uppercase',
23
- flex: 1
24
- },
25
- children: tTitle
26
- }),
27
- /*#__PURE__*/ _jsxs(View, {
28
- style: {
13
+ flex: 1,
14
+ }, children: tTitle }), _jsxs(View, { style: {
29
15
  padding: 16,
30
16
  rowGap: 32,
31
- border: "1px solid ".concat(colors.primary2),
32
- fontSize: 10
33
- },
34
- children: [
35
- /*#__PURE__*/ _jsx(CoverPageSection, {
36
- title: tCover.effectiveDate,
37
- children: /*#__PURE__*/ _jsxs(View, {
38
- style: {
39
- flexDirection: 'row',
40
- columnGap: 4
41
- },
42
- children: [
43
- /*#__PURE__*/ _jsx(Text, {
44
- style: {
45
- textDecoration: 'underline'
46
- },
47
- children: format(signedAt, 'do')
48
- }),
49
- /*#__PURE__*/ _jsx(Text, {
50
- children: tCover.of
51
- }),
52
- /*#__PURE__*/ _jsx(Text, {
53
- style: {
54
- textDecoration: 'underline'
55
- },
56
- children: format(signedAt, 'MMM')
57
- }),
58
- /*#__PURE__*/ _jsx(Text, {
59
- children: format(signedAt, 'yyyy')
60
- })
61
- ]
62
- })
63
- }),
64
- /*#__PURE__*/ _jsxs(CoverPageSection, {
65
- title: tCover.agreementBetween,
66
- children: [
67
- payerType === 'business' && /*#__PURE__*/ _jsxs(_Fragment, {
68
- children: [
69
- /*#__PURE__*/ _jsx(LabelValue, {
70
- label: tCover.companyName,
71
- value: business === null || business === void 0 ? void 0 : business.name
72
- }),
73
- /*#__PURE__*/ _jsx(LabelValue, {
74
- label: tCover.companyNo,
75
- value: business === null || business === void 0 ? void 0 : business.registrationNumber
76
- })
77
- ]
78
- }),
79
- payerType === 'user' && /*#__PURE__*/ _jsxs(_Fragment, {
80
- children: [
81
- /*#__PURE__*/ _jsx(LabelValue, {
82
- label: tCover.name,
83
- value: userName(user)
84
- }),
85
- /*#__PURE__*/ _jsx(LabelValue, {
86
- label: tCover.idOrPassportNo,
87
- value: (_user_identification = user.identification) === null || _user_identification === void 0 ? void 0 : _user_identification.number
88
- })
89
- ]
90
- })
91
- ]
92
- }),
93
- /*#__PURE__*/ _jsx(Text, {
94
- style: {
17
+ border: `1px solid ${colors.primary2}`,
18
+ fontSize: 10,
19
+ }, children: [_jsx(CoverPageSection, { title: tCover.effectiveDate, children: _jsxs(View, { style: { flexDirection: 'row', columnGap: 4 }, children: [_jsx(Text, { style: { textDecoration: 'underline' }, children: format(signedAt, 'do') }), _jsx(Text, { children: tCover.of }), _jsx(Text, { style: { textDecoration: 'underline' }, children: format(signedAt, 'MMM') }), _jsx(Text, { children: format(signedAt, 'yyyy') })] }) }), _jsxs(CoverPageSection, { title: tCover.agreementBetween, children: [payerType === 'business' && (_jsxs(_Fragment, { children: [_jsx(LabelValue, { label: tCover.companyName, value: business?.name }), _jsx(LabelValue, { label: tCover.companyNo, value: business?.registrationNumber })] })), payerType === 'user' && (_jsxs(_Fragment, { children: [_jsx(LabelValue, { label: tCover.name, value: userName(user) }), _jsx(LabelValue, { label: tCover.idOrPassportNo, value: user.identification?.number })] }))] }), _jsx(Text, { style: {
95
20
  fontSize: 8,
96
21
  fontWeight: 'bold',
97
22
  color: colors.primary3,
98
23
  textTransform: 'uppercase',
99
- letterSpacing: 1
100
- },
101
- children: tCover.and
102
- }),
103
- /*#__PURE__*/ _jsx(Text, {
104
- children: "FLUX Sdn Bhd (1264766-H)"
105
- })
106
- ]
107
- })
108
- ]
109
- });
24
+ letterSpacing: 1,
25
+ }, children: tCover.and }), _jsx(Text, { children: "FLUX Sdn Bhd (1264766-H)" })] })] }));
110
26
  };
111
27
  export default CoverPage;
28
+ //# sourceMappingURL=CoverPage.js.map
@@ -1,25 +1,14 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Text, View } from '@react-pdf/renderer';
3
3
  import { colors } from '../../theme/colors.js';
4
- var CoverPageSection = function(param) {
5
- var title = param.title, children = param.children;
6
- return /*#__PURE__*/ _jsxs(View, {
7
- style: {
8
- rowGap: 16
9
- },
10
- children: [
11
- /*#__PURE__*/ _jsx(Text, {
12
- style: {
4
+ const CoverPageSection = ({ title, children, }) => {
5
+ return (_jsxs(View, { style: { rowGap: 16 }, children: [_jsx(Text, { style: {
13
6
  fontSize: 8,
14
7
  fontWeight: 'bold',
15
8
  color: colors.primary3,
16
9
  textTransform: 'uppercase',
17
- letterSpacing: 1
18
- },
19
- children: "".concat(title, ":")
20
- }),
21
- children
22
- ]
23
- });
10
+ letterSpacing: 1,
11
+ }, children: `${title}:` }), children] }));
24
12
  };
25
13
  export default CoverPageSection;
14
+ //# sourceMappingURL=CoverPageSection.js.map