@driveflux/pdf 4.0.79 → 4.0.80

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