@driveflux/pdf 2.0.12 → 3.0.0-next.0

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 (54) hide show
  1. package/dist/__mocks__/quotation.js +11 -10
  2. package/dist/__mocks__/subscription.d.ts.map +1 -1
  3. package/dist/__mocks__/subscription.js +143 -421
  4. package/dist/__mocks__/subscription.js.map +1 -1
  5. package/dist/__mocks__/tou.js +10 -9
  6. package/dist/components/FluxLogo.js +3 -62
  7. package/dist/components/StandardPage.js +10 -99
  8. package/dist/debug.js +27 -206
  9. package/dist/debug.js.map +1 -1
  10. package/dist/index.js +1 -0
  11. package/dist/templates/QuotationPdf/CustomerSubscriptionSection.d.ts.map +1 -1
  12. package/dist/templates/QuotationPdf/CustomerSubscriptionSection.js +27 -145
  13. package/dist/templates/QuotationPdf/CustomerSubscriptionSection.js.map +1 -1
  14. package/dist/templates/QuotationPdf/GFV.js +12 -49
  15. package/dist/templates/QuotationPdf/Header.js +5 -63
  16. package/dist/templates/QuotationPdf/Pricing.d.ts.map +1 -1
  17. package/dist/templates/QuotationPdf/Pricing.js +201 -573
  18. package/dist/templates/QuotationPdf/Pricing.js.map +1 -1
  19. package/dist/templates/QuotationPdf/QuotationPdfPage.js +3 -23
  20. package/dist/templates/QuotationPdf/SectionBoxNew.js +4 -34
  21. package/dist/templates/QuotationPdf/TermsSection.js +5 -42
  22. package/dist/templates/QuotationPdf/TermsSection.js.map +1 -1
  23. package/dist/templates/QuotationPdf/VehiclePhotos.js +24 -54
  24. package/dist/templates/QuotationPdf/VehiclePhotos.js.map +1 -1
  25. package/dist/templates/QuotationPdf/index.js +11 -190
  26. package/dist/templates/QuotationPdf/index.js.map +1 -1
  27. package/dist/templates/QuotationPdf/translations.js +22 -34
  28. package/dist/templates/QuotationPdf/utils.d.ts +2 -2
  29. package/dist/templates/QuotationPdf/utils.js +29 -59
  30. package/dist/templates/QuotationPdf/utils.js.map +1 -1
  31. package/dist/templates/SubscriptionAgreement/Confirmation.js +10 -65
  32. package/dist/templates/SubscriptionAgreement/CoverPage.js +10 -93
  33. package/dist/templates/SubscriptionAgreement/CoverPageSection.js +5 -16
  34. package/dist/templates/SubscriptionAgreement/Details.js +51 -129
  35. package/dist/templates/SubscriptionAgreement/Details.js.map +1 -1
  36. package/dist/templates/SubscriptionAgreement/Footer.js +6 -48
  37. package/dist/templates/SubscriptionAgreement/Header.js +5 -35
  38. package/dist/templates/SubscriptionAgreement/LabelValue.js +3 -25
  39. package/dist/templates/SubscriptionAgreement/SubscriptionAgreementPage.js +3 -26
  40. package/dist/templates/SubscriptionAgreement/TermsOfUse.js +8 -94
  41. package/dist/templates/SubscriptionAgreement/TermsOfUseSubSection.js +11 -97
  42. package/dist/templates/SubscriptionAgreement/index.js +15 -245
  43. package/dist/templates/SubscriptionAgreement/translations.js +194 -195
  44. package/dist/templates/SubscriptionAgreement/types.d.ts +1 -2
  45. package/dist/templates/SubscriptionAgreement/types.d.ts.map +1 -1
  46. package/dist/templates/SubscriptionAgreement/types.js +2 -1
  47. package/dist/templates/SubscriptionAgreement/utils.js +11 -16
  48. package/dist/templates/index.js +1 -0
  49. package/dist/theme/colors.js +63 -44
  50. package/dist/theme/index.js +1 -0
  51. package/dist/types.js +2 -1
  52. package/dist/utils.js +16 -159
  53. package/dist/watch.js +4 -3
  54. package/package.json +10 -10
@@ -3,8 +3,8 @@ import type { INSPECTION_TYPES } from '@driveflux/db/models/vehicle';
3
3
  import type { Address } from '@driveflux/db/types/helpers';
4
4
  export declare const formatAddress: (originalAddress: Address) => string;
5
5
  export declare const getSimplifiedPlanTranslation: (plan: PlanType) => "60 Months" | "36 Months" | "24 Months" | "12 Months" | "Monthly" | "Weekly" | "Unknown Plan";
6
- export declare const getMileagePackageTranslation: (mileagePackage?: MileagePackage) => "Lite" | "Standard" | "Plus" | "Unlimited" | "Unknown Mileage Package";
7
- export declare const getFullMileagePackageTranslation: (plan?: MileagePackage | null) => "Unlimited" | "Unknown Mileage Package" | "Lite - 1,250KM" | "Standard - 2,000KM" | "Plus - 2,750KM";
6
+ export declare const getMileagePackageTranslation: (mileagePackage?: MileagePackage) => "Unlimited" | "Unknown Mileage Package" | "Lite" | "Standard" | "Plus";
7
+ export declare const getFullMileagePackageTranslation: (plan?: MileagePackage | null) => "Lite - 1,250KM" | "Standard - 2,000KM" | "Plus - 2,750KM" | "Unlimited" | "Unknown Mileage Package";
8
8
  export declare const getPromoNotes: (amount: number, discount: {
9
9
  discountType: DiscountType;
10
10
  discountValue: number;
@@ -1,44 +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, metadata = originalAddress.metadata, address = _object_without_properties(originalAddress, [
31
- "coordinates",
32
- "metadata"
33
- ]);
34
- return Object.keys(address).filter(function(key) {
35
- return key !== 'name' && !!address[key];
36
- }).map(function(a) {
37
- return address[a];
38
- }).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(', ');
39
8
  };
40
- export var getSimplifiedPlanTranslation = function(plan) {
41
- switch(plan){
9
+ export const getSimplifiedPlanTranslation = (plan) => {
10
+ switch (plan) {
42
11
  case 'plan60':
43
12
  return '60 Months';
44
13
  case 'plan36':
@@ -55,8 +24,8 @@ export var getSimplifiedPlanTranslation = function(plan) {
55
24
  return 'Unknown Plan';
56
25
  }
57
26
  };
58
- export var getMileagePackageTranslation = function(mileagePackage) {
59
- switch(mileagePackage){
27
+ export const getMileagePackageTranslation = (mileagePackage) => {
28
+ switch (mileagePackage) {
60
29
  case 'lite':
61
30
  return 'Lite';
62
31
  case 'standard':
@@ -69,8 +38,8 @@ export var getMileagePackageTranslation = function(mileagePackage) {
69
38
  return 'Unknown Mileage Package';
70
39
  }
71
40
  };
72
- export var getFullMileagePackageTranslation = function(plan) {
73
- switch(plan){
41
+ export const getFullMileagePackageTranslation = (plan) => {
42
+ switch (plan) {
74
43
  case 'lite':
75
44
  return 'Lite - 1,250KM';
76
45
  case 'standard':
@@ -83,25 +52,25 @@ export var getFullMileagePackageTranslation = function(plan) {
83
52
  return 'Unknown Mileage Package';
84
53
  }
85
54
  };
86
- export var getPromoNotes = function(amount, discount) {
87
- var discountType = discount.discountType, discountValue = discount.discountValue, maxRedemptions = discount.maxRedemptions;
88
- switch(discountType){
55
+ export const getPromoNotes = (amount, discount) => {
56
+ const { discountType, discountValue, maxRedemptions } = discount;
57
+ switch (discountType) {
89
58
  case 'percentage':
90
- return "Enjoy ".concat(discountValue * 100, "% off for ").concat(maxRedemptions, " month(s) for this vehicle.");
91
- case 'fixed':
92
- {
93
- var money = formatMoney(discountValue);
94
- 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.");
95
- }
96
- case 'forceAmount':
97
- {
98
- var money1 = formatMoney(Math.min(amount, discountValue));
99
- return "Enjoy only ".concat(money1, " for ").concat(maxRedemptions, " month(s), then your subscription will switch to the regular price.");
100
- }
59
+ return `Enjoy ${discountValue * 100}% off for ${maxRedemptions} month(s) for this vehicle.`;
60
+ case 'fixed': {
61
+ const money = formatMoney(discountValue);
62
+ return amount <= 0
63
+ ? `Enjoy free for ${maxRedemptions} month(s).`
64
+ : `Enjoy ${money} off for the first ${maxRedemptions} month(s), then your subscription will switch to the regular price.`;
65
+ }
66
+ case 'forceAmount': {
67
+ const money = formatMoney(Math.min(amount, discountValue));
68
+ return `Enjoy only ${money} for ${maxRedemptions} month(s), then your subscription will switch to the regular price.`;
69
+ }
101
70
  }
102
71
  };
103
- export var getInspectionTypeTranslation = function(inspectionType) {
104
- switch(inspectionType){
72
+ export const getInspectionTypeTranslation = (inspectionType) => {
73
+ switch (inspectionType) {
105
74
  case 'exterior':
106
75
  return 'Exterior';
107
76
  case 'interior':
@@ -116,3 +85,4 @@ export var getInspectionTypeTranslation = function(inspectionType) {
116
85
  return inspectionType;
117
86
  }
118
87
  };
88
+ //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/templates/QuotationPdf/utils.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAErD,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,eAAwB,EAAE,EAAE;IACzD,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,OAAO,EAAE,GAAG,eAAe,CAAA;IAC7D,OAAQ,MAAM,CAAC,IAAI,CAAC,OAAO,CAAiC;SAC1D,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,KAAK,MAAM,IAAI,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;SACjD,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;SACtB,IAAI,CAAC,IAAI,CAAC,CAAA;AACb,CAAC,CAAA;AAED,MAAM,CAAC,MAA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F,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,aAAa,GAAG,CAC5B,MAAc,EACd,QAIC,EACA,EAAE;IACH,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,GAAG,QAAQ,CAAA;IAEhE,QAAQ,YAAY,EAAE,CAAC;QACtB,KAAK,YAAY;YAChB,OAAO,SAAS,aAAa,GAAG,GAAG,aAAa,cAAc,6BAA6B,CAAA;QAC5F,KAAK,OAAO,CAAC,CAAC,CAAC;YACd,MAAM,KAAK,GAAG,WAAW,CAAC,aAAa,CAAC,CAAA;YACxC,OAAO,MAAM,IAAI,CAAC;gBACjB,CAAC,CAAC,kBAAkB,cAAc,YAAY;gBAC9C,CAAC,CAAC,SAAS,KAAK,sBAAsB,cAAc,qEAAqE,CAAA;QAC3H,CAAC;QACD,KAAK,aAAa,CAAC,CAAC,CAAC;YACpB,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAA;YAC1D,OAAO,cAAc,KAAK,QAAQ,cAAc,qEAAqE,CAAA;QACtH,CAAC;IACF,CAAC;AACF,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAC3C,cAA+D,EAC9D,EAAE;IACH,QAAQ,cAAc,EAAE,CAAC;QACxB,KAAK,UAAU;YACd,OAAO,UAAU,CAAA;QAClB,KAAK,UAAU;YACd,OAAO,UAAU,CAAA;QAClB,KAAK,QAAQ;YACZ,OAAO,QAAQ,CAAA;QAChB,KAAK,OAAO;YACX,OAAO,OAAO,CAAA;QACf,KAAK,WAAW;YACf,OAAO,WAAW,CAAA;QACnB;YACC,OAAO,cAAc,CAAA;IACvB,CAAC;AACF,CAAC,CAAA"}
@@ -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
@@ -1,184 +1,105 @@
1
- function _define_property(obj, key, value) {
2
- if (key in obj) {
3
- Object.defineProperty(obj, key, {
4
- value: value,
5
- enumerable: true,
6
- configurable: true,
7
- writable: true
8
- });
9
- } else {
10
- obj[key] = value;
11
- }
12
- return obj;
13
- }
14
- function _object_spread(target) {
15
- for(var i = 1; i < arguments.length; i++){
16
- var source = arguments[i] != null ? arguments[i] : {};
17
- var ownKeys = Object.keys(source);
18
- if (typeof Object.getOwnPropertySymbols === "function") {
19
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
20
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
21
- }));
22
- }
23
- ownKeys.forEach(function(key) {
24
- _define_property(target, key, source[key]);
25
- });
26
- }
27
- return target;
28
- }
29
- function ownKeys(object, enumerableOnly) {
30
- var keys = Object.keys(object);
31
- if (Object.getOwnPropertySymbols) {
32
- var symbols = Object.getOwnPropertySymbols(object);
33
- if (enumerableOnly) {
34
- symbols = symbols.filter(function(sym) {
35
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
36
- });
37
- }
38
- keys.push.apply(keys, symbols);
39
- }
40
- return keys;
41
- }
42
- function _object_spread_props(target, source) {
43
- source = source != null ? source : {};
44
- if (Object.getOwnPropertyDescriptors) {
45
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
46
- } else {
47
- ownKeys(Object(source)).forEach(function(key) {
48
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
49
- });
50
- }
51
- return target;
52
- }
53
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
54
2
  import { userName } from '@driveflux/db/models/user';
55
3
  import { format } from '@driveflux/time';
56
4
  import { Text, View } from '@react-pdf/renderer';
57
5
  import { colors } from '../../theme/index.js';
58
6
  import LabelValue from './LabelValue.js';
59
- var Details = function(param) {
60
- var tDetails = param.tDetails, subscription = param.subscription;
61
- var _subscription_vehicle, _subscription_vehicle1, _subscription_vehicle2, _subscription_vehicle3, _subscription_vehicle4, _subscription_schedule, _subscription_schedule1;
62
- var details = {};
7
+ const Details = ({ tDetails, subscription }) => {
8
+ let details = {};
63
9
  if (subscription.payerType === 'business') {
64
- var _subscription_business;
65
10
  details.business = [
66
11
  {
67
12
  key: tDetails.business.name,
68
- value: subscription === null || subscription === void 0 ? void 0 : subscription.businessName
13
+ value: subscription?.businessName,
69
14
  },
70
15
  {
71
16
  key: tDetails.business.companyNo,
72
- value: subscription === null || subscription === void 0 ? void 0 : (_subscription_business = subscription.business) === null || _subscription_business === void 0 ? void 0 : _subscription_business.registrationNumber
73
- }
17
+ value: subscription?.business?.registrationNumber,
18
+ },
74
19
  ];
75
- } else {
76
- var _subscription_user_identification;
20
+ }
21
+ else {
77
22
  details.member = [
78
23
  {
79
24
  key: tDetails.member.name,
80
- value: userName(subscription.user)
25
+ value: userName(subscription.user),
81
26
  },
82
27
  {
83
28
  key: tDetails.member.idOrPassportNo,
84
- value: (_subscription_user_identification = subscription.user.identification) === null || _subscription_user_identification === void 0 ? void 0 : _subscription_user_identification.number
85
- }
29
+ value: subscription.user.identification?.number,
30
+ },
86
31
  ];
87
32
  }
88
- details = _object_spread_props(_object_spread({}, details), {
33
+ details = {
34
+ ...details,
89
35
  vehicle: [
90
36
  {
91
37
  key: tDetails.vehicle.make,
92
- value: (_subscription_vehicle = subscription.vehicle) === null || _subscription_vehicle === void 0 ? void 0 : _subscription_vehicle.make
38
+ value: subscription.vehicle?.make,
93
39
  },
94
40
  {
95
41
  key: tDetails.vehicle.model,
96
- value: "".concat((_subscription_vehicle1 = subscription.vehicle) === null || _subscription_vehicle1 === void 0 ? void 0 : _subscription_vehicle1.vehicleModel, " ").concat((_subscription_vehicle2 = subscription.vehicle) === null || _subscription_vehicle2 === void 0 ? void 0 : _subscription_vehicle2.variant)
42
+ value: `${subscription.vehicle?.vehicleModel} ${subscription.vehicle?.variant}`,
97
43
  },
98
44
  {
99
45
  key: tDetails.vehicle.year,
100
- value: (_subscription_vehicle3 = subscription.vehicle) === null || _subscription_vehicle3 === void 0 ? void 0 : _subscription_vehicle3.year
46
+ value: subscription.vehicle?.year,
101
47
  },
102
48
  {
103
49
  key: tDetails.vehicle.plateNo,
104
- value: (_subscription_vehicle4 = subscription.vehicle) === null || _subscription_vehicle4 === void 0 ? void 0 : _subscription_vehicle4.registrationNumber
105
- }
50
+ value: subscription.vehicle?.registrationNumber,
51
+ },
106
52
  ],
107
53
  subscription: [
108
54
  {
109
55
  key: tDetails.subscription.subscriptionPlan,
110
- value: getPlanTranslation(subscription.plan)
56
+ value: getPlanTranslation(subscription.plan),
111
57
  },
112
58
  {
113
59
  key: tDetails.subscription.mileagePackage,
114
- value: getFullMileagePackageTranslation(subscription.mileagePackage)
60
+ value: getFullMileagePackageTranslation(subscription.mileagePackage),
115
61
  },
116
62
  {
117
63
  key: tDetails.subscription.startDate,
118
- value: subscription.startedAt ? format(subscription.startedAt, 'dd-MM-yyyy') : undefined
64
+ value: subscription.startedAt
65
+ ? format(subscription.startedAt, 'dd-MM-yyyy')
66
+ : undefined,
119
67
  },
120
68
  {
121
69
  key: tDetails.subscription.endDate,
122
- value: subscription.endedAt ? format(subscription.endedAt, 'dd-MM-yyyy') : ((_subscription_schedule = subscription.schedule) === null || _subscription_schedule === void 0 ? void 0 : _subscription_schedule.endAt) ? format((_subscription_schedule1 = subscription.schedule) === null || _subscription_schedule1 === void 0 ? void 0 : _subscription_schedule1.endAt, 'dd-MM-yyyy') : undefined
123
- }
124
- ]
125
- });
126
- var border = "1px solid ".concat(colors.primary2);
127
- return /*#__PURE__*/ _jsxs(View, {
128
- style: {
129
- borderLeft: border,
130
- borderRight: border
131
- },
132
- children: [
133
- /*#__PURE__*/ _jsx(View, {
134
- style: {
70
+ value: subscription.endedAt
71
+ ? format(subscription.endedAt, 'dd-MM-yyyy')
72
+ : subscription.scheduledEndAt
73
+ ? format(subscription.scheduledEndAt, 'dd-MM-yyyy')
74
+ : undefined,
75
+ },
76
+ ],
77
+ };
78
+ const border = `1px solid ${colors.primary2}`;
79
+ return (_jsxs(View, { style: { borderLeft: border, borderRight: border }, children: [_jsx(View, { style: {
135
80
  backgroundColor: colors.primary1,
136
81
  borderTop: border,
137
- padding: 8
138
- },
139
- children: /*#__PURE__*/ _jsx(Text, {
140
- style: {
82
+ padding: 8,
83
+ }, children: _jsx(Text, { style: {
141
84
  fontWeight: 'bold',
142
85
  textTransform: 'uppercase',
143
- letterSpacing: 1
144
- },
145
- children: tDetails.agreement
146
- })
147
- }),
148
- Object.keys(details).map(function(key, i) {
149
- return /*#__PURE__*/ _jsxs(View, {
150
- style: {
151
- padding: 8,
152
- paddingBottom: 16,
153
- rowGap: 8,
154
- borderTop: border
155
- },
156
- children: [
157
- /*#__PURE__*/ _jsx(Text, {
158
- style: {
159
- textTransform: 'uppercase',
160
- color: colors.primary2,
161
- fontSize: 8,
162
- letterSpacing: 1
163
- },
164
- children: "".concat(key, " details")
165
- }),
166
- details[key].map(function(line) {
167
- return /*#__PURE__*/ _jsx(LabelValue, {
168
- label: line.key,
169
- value: line.value
170
- }, line.key);
171
- })
172
- ]
173
- }, key);
174
- })
175
- ]
176
- });
86
+ letterSpacing: 1,
87
+ }, children: tDetails.agreement }) }), Object.keys(details).map((key, _i) => (_jsxs(View, { style: {
88
+ padding: 8,
89
+ paddingBottom: 16,
90
+ rowGap: 8,
91
+ borderTop: border,
92
+ }, children: [_jsx(Text, { style: {
93
+ textTransform: 'uppercase',
94
+ color: colors.primary2,
95
+ fontSize: 8,
96
+ letterSpacing: 1,
97
+ }, children: `${key} details` }), details[key].map((line) => (_jsx(LabelValue, { label: line.key, value: line.value }, line.key)))] }, key)))] }));
177
98
  };
178
99
  export default Details;
179
100
  // TODO: replace this with dump's once the package is ready
180
- var getPlanTranslation = function(plan, vehicleType) {
181
- switch(plan){
101
+ const getPlanTranslation = (plan, vehicleType) => {
102
+ switch (plan) {
182
103
  case 'plan60':
183
104
  return vehicleType === 'motorcycle' ? '60 Months' : '60 Months (Basic)';
184
105
  case 'plan36':
@@ -195,8 +116,8 @@ var getPlanTranslation = function(plan, vehicleType) {
195
116
  return 'Unknown Plan';
196
117
  }
197
118
  };
198
- var getFullMileagePackageTranslation = function(plan) {
199
- switch(plan){
119
+ const getFullMileagePackageTranslation = (plan) => {
120
+ switch (plan) {
200
121
  case 'lite':
201
122
  return 'Lite - 1,250KM';
202
123
  case 'standard':
@@ -209,3 +130,4 @@ var getFullMileagePackageTranslation = function(plan) {
209
130
  return 'Unknown Mileage Package';
210
131
  }
211
132
  };
133
+ //# sourceMappingURL=Details.js.map