@driveflux/pdf 1.2.29 → 1.3.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.
@@ -1 +1 @@
1
- {"version":3,"file":"quotation.d.ts","sourceRoot":"","sources":["../../src/__mocks__/quotation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE9C,eAAO,MAAM,SAAS,EAAE,SA4DvB,CAAA"}
1
+ {"version":3,"file":"quotation.d.ts","sourceRoot":"","sources":["../../src/__mocks__/quotation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,eAAO,MAAM,SAAS,EAAE,SAoIvB,CAAA"}
@@ -1,60 +1,124 @@
1
1
  export var quotation = {
2
- id: 'QUO_XZJLVSM8',
3
- vehicleId: 'VBEXLQR',
2
+ id: 'QCRR5ZJN3',
3
+ vehicleId: 'V5JP2VS',
4
4
  plan: 'plan36',
5
5
  mileagePackage: 'lite',
6
- cycleFluxCoefficient: 'flux25',
7
- customerName: 'Bubu Ahmad',
8
- vehicleName: 'Volkswagen Polo 1.6 Sedan 2011',
6
+ cycleFluxCoefficient: 'flux15',
7
+ customerName: 'af',
8
+ vehicleName: 'Perodua Myvi 1.5 AV 2018',
9
9
  createdById: 'U2R88JRVL',
10
- createdAt: new Date('2024-05-27T02:26:36.070Z'),
11
- updatedAt: new Date('2024-05-27T02:26:36.070Z'),
10
+ createdAt: new Date('2024-10-17T12:04:44.420Z'),
11
+ updatedAt: new Date('2024-10-17T12:04:44.700Z'),
12
12
  metadata: {},
13
13
  customer: {
14
14
  type: 'user',
15
- name: 'Bubu Ahmad',
16
- email: 'bubu@gmail.com',
17
- address: {
18
- street1: '15-2 Jalan Solaris',
19
- city: 'Kuala Lumpur',
20
- state: 'Johor',
21
- postalCode: '12323',
22
- country: 'MY'
23
- }
15
+ name: 'af',
16
+ email: '',
17
+ address: {}
24
18
  },
25
19
  fees: {
26
- subscriptionFee: 800,
27
- reservationFee: 0,
28
- startFee: 498,
29
- deposit: 1600,
20
+ subscriptionFee: 1080,
21
+ reservationFee: 45.371,
22
+ startFee: 686.4,
23
+ deposit: 2160,
30
24
  depositMonths: 2,
31
- extraCharges: [
32
- {
33
- type: 'upfront',
34
- description: 'Spare Tyre',
35
- amount: 2500.2
36
- },
37
- {
38
- type: 'upfront',
39
- description: 'Spare Tyre No 2',
40
- amount: 3000.2
41
- },
42
- {
43
- type: 'monthly',
44
- description: 'Commitment ',
45
- amount: 2
46
- }
47
- ],
48
- amountBeforeTax: 8400.4,
49
- taxAmount: 672.03,
50
- amountAfterTax: 9072.43,
51
- gfv: 0,
52
- cycle: null,
53
- couponCode: null,
54
- discountAmount: null,
55
- appliedDiscountId: null,
25
+ extraCharges: [],
26
+ discountAmount: 0,
27
+ appliedDiscountId: '',
28
+ couponCode: '',
56
29
  couponType: '',
57
- excessMileageFee: 3.8
30
+ amountBeforeTax: 3971.771,
31
+ taxAmount: 317.74,
32
+ amountAfterTax: 4289.511,
33
+ excessMileageFee: 0.65,
34
+ cycle: null,
35
+ gfv: null
58
36
  },
59
- quotationPdf: null
37
+ images: [
38
+ {
39
+ default: 'https://s3.ap-southeast-1.amazonaws.com/flux-site-files/static%2Fraw%2FV5JP2VS%2FNefMGTxvxdFmaZvy9An7T-1-edited.jpg',
40
+ blurBase64: null,
41
+ thumbnail: null,
42
+ small: null,
43
+ medium: null,
44
+ large: null,
45
+ description: null,
46
+ inspection: true,
47
+ inspectionType: 'exterior',
48
+ notActualPhoto: false
49
+ },
50
+ {
51
+ default: 'https://s3.ap-southeast-1.amazonaws.com/flux-site-files/static%2Fraw%2FV5JP2VS%2Fjeb6Okl1rXSDfeSeBY4-D-2-edited.jpg',
52
+ blurBase64: null,
53
+ thumbnail: null,
54
+ small: null,
55
+ medium: null,
56
+ large: null,
57
+ description: null,
58
+ inspection: false,
59
+ inspectionType: null,
60
+ notActualPhoto: false
61
+ },
62
+ {
63
+ default: 'https://s3.ap-southeast-1.amazonaws.com/flux-site-files/static%2Fraw%2FV5JP2VS%2F4a21uc2_H_Y3yfBGuLeR9-5.JPG',
64
+ blurBase64: null,
65
+ thumbnail: null,
66
+ small: null,
67
+ medium: null,
68
+ large: null,
69
+ description: null,
70
+ inspection: true,
71
+ inspectionType: 'frame',
72
+ notActualPhoto: false
73
+ },
74
+ {
75
+ default: 'https://s3.ap-southeast-1.amazonaws.com/flux-site-files/static%2Fraw%2FV5JP2VS%2FGAQS5MFE_wy9HURTui6vd-9.JPG',
76
+ blurBase64: null,
77
+ thumbnail: null,
78
+ small: null,
79
+ medium: null,
80
+ large: null,
81
+ description: null,
82
+ inspection: true,
83
+ inspectionType: 'interior',
84
+ notActualPhoto: false
85
+ },
86
+ {
87
+ default: 'https://s3.ap-southeast-1.amazonaws.com/flux-site-files/static%2Fraw%2FV5JP2VS%2FeRxfs0-i7CS3HzT0y5nFo-10.JPG',
88
+ blurBase64: null,
89
+ thumbnail: null,
90
+ small: null,
91
+ medium: null,
92
+ large: null,
93
+ description: null,
94
+ inspection: false,
95
+ inspectionType: null,
96
+ notActualPhoto: false
97
+ },
98
+ {
99
+ default: 'https://s3.ap-southeast-1.amazonaws.com/flux-site-files/static%2Fraw%2FV5JP2VS%2Fb6J6P0hDNuVGjDhQvf7_w-11.JPG',
100
+ blurBase64: null,
101
+ thumbnail: null,
102
+ small: null,
103
+ medium: null,
104
+ large: null,
105
+ description: null,
106
+ inspection: false,
107
+ inspectionType: null,
108
+ notActualPhoto: false
109
+ },
110
+ {
111
+ default: 'https://s3.ap-southeast-1.amazonaws.com/flux-site-files/static%2Fraw%2FV5JP2VS%2Fk9myRzc4U4JxyQ-IQfKGS-15.JPG',
112
+ blurBase64: null,
113
+ thumbnail: null,
114
+ small: null,
115
+ medium: null,
116
+ large: null,
117
+ description: null,
118
+ inspection: true,
119
+ inspectionType: 'engine',
120
+ notActualPhoto: false
121
+ }
122
+ ],
123
+ quotationPdf: 'https://dev-flux-admin.s3.ap-southeast-1.amazonaws.com/quotations/QCRR5ZJN3.pdf'
60
124
  };
@@ -0,0 +1,66 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Image, Text, View } from '@react-pdf/renderer';
3
+ import { colors } from '../../theme/colors.js';
4
+ import { getInspectionTypeTranslation } from './utils.js';
5
+ var VehiclePhotos = function(param) {
6
+ var quotation = param.quotation, t = param.t;
7
+ var images = quotation.images;
8
+ return /*#__PURE__*/ _jsxs(View, {
9
+ style: {
10
+ border: "1px solid ".concat(colors.primary2),
11
+ padding: 16
12
+ },
13
+ children: [
14
+ /*#__PURE__*/ _jsx(Text, {
15
+ style: {
16
+ textTransform: 'uppercase',
17
+ fontSize: 12,
18
+ fontWeight: 'bold',
19
+ marginBottom: 16
20
+ },
21
+ children: t === null || t === void 0 ? void 0 : t.title
22
+ }),
23
+ /*#__PURE__*/ _jsx(View, {
24
+ style: {
25
+ display: 'flex',
26
+ flexDirection: 'row',
27
+ flexWrap: 'wrap',
28
+ gap: 15
29
+ },
30
+ children: images.map(function(image) {
31
+ return /*#__PURE__*/ _jsx(_Fragment, {
32
+ children: /*#__PURE__*/ _jsxs(View, {
33
+ style: {
34
+ overflow: 'hidden',
35
+ alignItems: 'center',
36
+ gap: 4
37
+ },
38
+ children: [
39
+ /*#__PURE__*/ _jsx(View, {
40
+ children: /*#__PURE__*/ _jsx(Image, {
41
+ // @ts-ignore
42
+ source: image.default,
43
+ style: {
44
+ objectFit: 'cover',
45
+ height: 90,
46
+ width: 150
47
+ }
48
+ })
49
+ }),
50
+ image.inspectionType && /*#__PURE__*/ _jsx(Text, {
51
+ style: {
52
+ color: colors.black,
53
+ fontSize: 10,
54
+ textAlign: 'center'
55
+ },
56
+ children: getInspectionTypeTranslation(image.inspectionType)
57
+ })
58
+ ]
59
+ }, image.default)
60
+ });
61
+ })
62
+ })
63
+ ]
64
+ });
65
+ };
66
+ export default VehiclePhotos;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/QuotationPdf/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAG9C,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAA;AAclE,KAAK,OAAO,GAAG;IACd,MAAM,CAAC,EAAE,4BAA4B,CAAA;IACrC,SAAS,EAAE,SAAS,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,oBAAoB,0BACF,OAAO,aAC1B,MAAM,oBAMjB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/QuotationPdf/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAG9C,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAA;AAelE,KAAK,OAAO,GAAG;IACd,MAAM,CAAC,EAAE,4BAA4B,CAAA;IACrC,SAAS,EAAE,SAAS,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,oBAAoB,0BACF,OAAO,aAC1B,MAAM,oBAMjB,CAAA"}
@@ -131,6 +131,7 @@ import GFV from './GFV.js';
131
131
  import Pricing from './Pricing.js';
132
132
  import QuotationPdfPage from './QuotationPdfPage.js';
133
133
  import TermsSection from './TermsSection.js';
134
+ import VehiclePhotos from './VehiclePhotos.js';
134
135
  import { useTranslations } from './translations.js';
135
136
  export var generateQuotationPdf = /*#__PURE__*/ function() {
136
137
  var _ref = _async_to_generator(function(param, fileName) {
@@ -188,6 +189,10 @@ var QuotationPDF = function(param) {
188
189
  quotation: quotation,
189
190
  t: t.pricing
190
191
  }),
192
+ /*#__PURE__*/ _jsx(VehiclePhotos, {
193
+ quotation: quotation,
194
+ t: t.vehiclePhotos
195
+ }),
191
196
  /*#__PURE__*/ _jsx(TermsSection, {
192
197
  t: t.terms
193
198
  })
@@ -56,6 +56,9 @@ declare const enTranslation: {
56
56
  title: string;
57
57
  content: string[];
58
58
  };
59
+ vehiclePhotos: {
60
+ title: string;
61
+ };
59
62
  };
60
63
  export type QuotationPdfTranslation = typeof enTranslation;
61
64
  export declare const useTranslations: (locale: "en") => QuotationPdfTranslation;
@@ -1 +1 @@
1
- {"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/templates/QuotationPdf/translations.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;yCA+Ba,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+CrC,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG,OAAO,aAAa,CAAA;AAE1D,eAAO,MAAM,eAAe,WAAY,IAAI,KAAG,uBAK9C,CAAA"}
1
+ {"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/templates/QuotationPdf/translations.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;yCA+Ba,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkDrC,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG,OAAO,aAAa,CAAA;AAE1D,eAAO,MAAM,eAAe,WAAY,IAAI,KAAG,uBAK9C,CAAA"}
@@ -89,6 +89,9 @@ var enTranslation = {
89
89
  'All monthly recurring fees are billed on the same date as the delivery of the vehicle.',
90
90
  'Scheduling delivery will only commence Grand Total is fully paid, 7 - 30+ days after payment and subject to vehicle availability.'
91
91
  ]
92
+ },
93
+ vehiclePhotos: {
94
+ title: 'Vehicle Photos'
92
95
  }
93
96
  };
94
97
  export var useTranslations = function(locale) {
@@ -1,7 +1,9 @@
1
- import type { MileagePackage, PlanType } from '@driveflux/db';
1
+ import type { MileagePackage, PlanType, VehicleType } from '@driveflux/db';
2
+ import type { INSPECTION_TYPES } from '@driveflux/db/models/vehicle';
2
3
  import type { Address } from '@driveflux/db/types';
3
4
  export declare const formatAddress: (originalAddress: Address) => string;
4
5
  export declare const getSimplifiedPlanTranslation: (plan: PlanType) => "60 Months" | "36 Months" | "24 Months" | "12 Months" | "Monthly" | "Weekly" | "Unknown Plan";
5
6
  export declare const getMileagePackageTranslation: (mileagePackage?: MileagePackage) => "Lite" | "Standard" | "Plus" | "Unlimited" | "Unknown Mileage Package";
6
7
  export declare const getFullMileagePackageTranslation: (plan?: MileagePackage | null) => "Unlimited" | "Unknown Mileage Package" | "Lite - 1,250KM" | "Standard - 2,000KM" | "Plus - 2,750KM";
8
+ export declare const getInspectionTypeTranslation: (inspectionType?: (typeof INSPECTION_TYPES)[VehicleType][number]) => "Exterior" | "Interior" | "Engine" | "Frame" | "Dashboard" | undefined;
7
9
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/templates/QuotationPdf/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAC7D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAElD,eAAO,MAAM,aAAa,oBAAqB,OAAO,WAMrD,CAAA;AAED,eAAO,MAAM,4BAA4B,SAAU,QAAQ,kGAiB1D,CAAA;AAED,eAAO,MAAM,4BAA4B,oBACvB,cAAc,2EAc/B,CAAA;AAED,eAAO,MAAM,gCAAgC,UACrC,cAAc,GAAG,IAAI,yGAc5B,CAAA"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/templates/QuotationPdf/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC1E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAElD,eAAO,MAAM,aAAa,oBAAqB,OAAO,WAMrD,CAAA;AAED,eAAO,MAAM,4BAA4B,SAAU,QAAQ,kGAiB1D,CAAA;AAED,eAAO,MAAM,4BAA4B,oBACvB,cAAc,2EAc/B,CAAA;AAED,eAAO,MAAM,gCAAgC,UACrC,cAAc,GAAG,IAAI,yGAc5B,CAAA;AAED,eAAO,MAAM,4BAA4B,oBACvB,CAAC,OAAO,gBAAgB,EAAE,WAAW,CAAC,CAAC,MAAM,CAAC,2EAgB/D,CAAA"}
@@ -82,3 +82,19 @@ export var getFullMileagePackageTranslation = function(plan) {
82
82
  return 'Unknown Mileage Package';
83
83
  }
84
84
  };
85
+ export var getInspectionTypeTranslation = function(inspectionType) {
86
+ switch(inspectionType){
87
+ case 'exterior':
88
+ return 'Exterior';
89
+ case 'interior':
90
+ return 'Interior';
91
+ case 'engine':
92
+ return 'Engine';
93
+ case 'frame':
94
+ return 'Frame';
95
+ case 'dashboard':
96
+ return 'Dashboard';
97
+ default:
98
+ return inspectionType;
99
+ }
100
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@driveflux/pdf",
3
- "version": "1.2.29",
3
+ "version": "1.3.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -12,26 +12,26 @@
12
12
  "dist"
13
13
  ],
14
14
  "dependencies": {
15
- "@driveflux/db": "1.6.7",
16
- "@driveflux/env": "1.2.2",
17
- "@driveflux/format-money": "5.2.1",
18
- "@driveflux/time": "4.2.1",
19
- "@react-pdf/renderer": "^3.4.4",
15
+ "@driveflux/db": "1.8.1",
16
+ "@driveflux/env": "1.3.0",
17
+ "@driveflux/format-money": "5.3.0",
18
+ "@driveflux/time": "4.3.0",
19
+ "@react-pdf/renderer": "^4.0.0",
20
20
  "date-fns": "^3.6.0",
21
- "nodemon": "^3.1.6",
21
+ "nodemon": "^3.1.7",
22
22
  "react": "^18.3.1"
23
23
  },
24
24
  "devDependencies": {
25
- "@babel/preset-env": "^7.25.4",
26
- "@driveflux/fab": "2.2.1",
27
- "@driveflux/tsconfig": "1.2.1",
25
+ "@babel/preset-env": "^7.25.8",
26
+ "@driveflux/fab": "2.3.0",
27
+ "@driveflux/tsconfig": "1.3.0",
28
28
  "@swc/cli": "0.4.1-nightly.20240914",
29
- "@swc/core": "1.7.26",
30
- "@types/node": "^22.5.5",
31
- "@types/react": "^18.3.8",
32
- "del-cli": "^5.1.0",
29
+ "@swc/core": "1.7.39",
30
+ "@types/node": "^22.7.8",
31
+ "@types/react": "^18.3.11",
32
+ "del-cli": "^6.0.0",
33
33
  "react": "^18.3.1",
34
- "typescript": "^5.6.2"
34
+ "typescript": "^5.6.3"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "react": "^18.3.1"