@driveflux/api-functions 0.0.7-next.42 → 0.0.7-next.5
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.
- package/dist/auth/confirm.js +29 -24
- package/dist/auth/emails.js +13 -12
- package/dist/auth/formatter.js +5 -5
- package/dist/auth/otp.js +50 -66
- package/dist/auth/register.d.ts +1 -1
- package/dist/auth/register.js +36 -44
- package/dist/auth/register.js.map +1 -1
- package/dist/auth/tokens.d.ts +3 -3
- package/dist/auth/tokens.js +55 -58
- package/dist/auth/verifications.js +52 -53
- package/dist/constants.js +1 -0
- package/dist/mailjet/calls/manage-contacts-in-list.d.ts +2 -2
- package/dist/mailjet/calls/manage-contacts-in-list.d.ts.map +1 -1
- package/dist/mailjet/calls/manage-contacts-in-list.js +8 -7
- package/dist/mailjet/calls/manage-contacts-in-list.js.map +1 -1
- package/dist/mailjet/calls/manage-subscription-status.d.ts +2 -2
- package/dist/mailjet/calls/manage-subscription-status.d.ts.map +1 -1
- package/dist/mailjet/calls/manage-subscription-status.js +7 -6
- package/dist/mailjet/calls/manage-subscription-status.js.map +1 -1
- package/dist/mailjet/calls/request-service.d.ts +1 -1
- package/dist/mailjet/calls/request-service.d.ts.map +1 -1
- package/dist/mailjet/calls/request-service.js +6 -7
- package/dist/mailjet/refresh-email-preferences.js +12 -11
- package/dist/mailjet/set-contact.d.ts +2 -2
- package/dist/mailjet/set-contact.d.ts.map +1 -1
- package/dist/mailjet/set-contact.js +15 -14
- package/dist/mailjet/set-contact.js.map +1 -1
- package/dist/mailjet/types.d.ts +2 -2
- package/dist/mailjet/types.d.ts.map +1 -1
- package/dist/mailjet/types.js +2 -1
- package/dist/mailjet/utils/convert-to-array.d.ts +1 -1
- package/dist/mailjet/utils/convert-to-array.d.ts.map +1 -1
- package/dist/mailjet/utils/convert-to-array.js +6 -8
- package/dist/mailjet/utils/extract-email-preferences.d.ts +1 -1
- package/dist/mailjet/utils/extract-email-preferences.d.ts.map +1 -1
- package/dist/mailjet/utils/extract-email-preferences.js +15 -14
- package/dist/mailjet/utils/lists.js +8 -7
- package/dist/mailjet/utils/update-email-references.d.ts +2 -2
- package/dist/mailjet/utils/update-email-references.d.ts.map +1 -1
- package/dist/mailjet/utils/update-email-references.js +15 -16
- package/dist/mailjet/utils/update-email-references.js.map +1 -1
- package/dist/notion/client.d.ts.map +1 -1
- package/dist/notion/client.js +20 -24
- package/dist/notion/client.js.map +1 -1
- package/dist/notion/helpful.js +9 -6
- package/dist/notion/schemas/block.js +48 -42
- package/dist/notion/schemas/common.js +14 -9
- package/dist/notion/schemas/database.d.ts +1 -1
- package/dist/notion/schemas/database.js +60 -62
- package/dist/notion/schemas/emoji.js +2 -1
- package/dist/notion/schemas/file.js +9 -9
- package/dist/notion/schemas/kb.js +6 -5
- package/dist/notion/schemas/page.d.ts +1 -1
- package/dist/notion/schemas/page.js +61 -72
- package/dist/notion/schemas/parent.js +5 -4
- package/dist/notion/schemas/user.js +19 -18
- package/dist/reservation/agree.d.ts +1 -1
- package/dist/reservation/agree.d.ts.map +1 -1
- package/dist/reservation/agree.js +7 -6
- package/dist/reservation/checks.d.ts +1 -1
- package/dist/reservation/checks.d.ts.map +1 -1
- package/dist/reservation/checks.js +4 -3
- package/dist/reservation/display-vehicle.d.ts +16 -16
- package/dist/reservation/display-vehicle.js +71 -65
- package/dist/reservation/display-vehicle.js.map +1 -1
- package/dist/reservation/fetch-or-create.d.ts +1 -1
- package/dist/reservation/fetch-or-create.d.ts.map +1 -1
- package/dist/reservation/fetch-or-create.js +55 -51
- package/dist/reservation/fetch-or-create.js.map +1 -1
- package/dist/reservation/invoice.d.ts +2 -3
- package/dist/reservation/invoice.d.ts.map +1 -1
- package/dist/reservation/invoice.js +76 -64
- package/dist/reservation/invoice.js.map +1 -1
- package/dist/reservation/payer.d.ts +1 -1
- package/dist/reservation/payer.d.ts.map +1 -1
- package/dist/reservation/payer.js +6 -5
- package/dist/reservation/reserve.d.ts +1 -1
- package/dist/reservation/reserve.d.ts.map +1 -1
- package/dist/reservation/reserve.js +9 -8
- package/dist/reservation/reserve.js.map +1 -1
- package/dist/reservation/types.js +2 -1
- package/dist/reservation/vehicle.d.ts +1 -1
- package/dist/reservation/vehicle.d.ts.map +1 -1
- package/dist/reservation/vehicle.js +18 -15
- package/dist/reservation/vehicle.js.map +1 -1
- package/dist/slack.d.ts +2 -2
- package/dist/slack.d.ts.map +1 -1
- package/dist/slack.js +29 -24
- package/dist/validation.d.ts +4 -4
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +71 -77
- package/dist/validation.js.map +1 -1
- package/dist/vehicle/vehicle-pricing/constants.d.ts +1 -1
- package/dist/vehicle/vehicle-pricing/constants.d.ts.map +1 -1
- package/dist/vehicle/vehicle-pricing/constants.js +19 -22
- package/dist/vehicle/vehicle-pricing/index.d.ts +1 -1
- package/dist/vehicle/vehicle-pricing/index.d.ts.map +1 -1
- package/dist/vehicle/vehicle-pricing/index.js +44 -30
- package/dist/vehicle/vehicle-pricing/index.js.map +1 -1
- package/dist/vehicle/vehicle-pricing/types.js +2 -1
- package/package.json +28 -28
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { ForbiddenError, subject } from '@casl/ability';
|
|
2
2
|
import { buildOrDefineAbility } from '@driveflux/auth/authorization';
|
|
3
|
-
import { makeProblem, PROBLEM_CONDITION_FAILED, PROBLEM_RESOURCE_BUSY } from '@driveflux/problem';
|
|
3
|
+
import { makeProblem, PROBLEM_CONDITION_FAILED, PROBLEM_RESOURCE_BUSY, } from '@driveflux/problem';
|
|
4
4
|
import { Err, Ok } from '@driveflux/result';
|
|
5
|
-
export const checkIfUserCanReserve = async ({ requestUser, subscribingUser })=>{
|
|
5
|
+
export const checkIfUserCanReserve = async ({ requestUser, subscribingUser, }) => {
|
|
6
6
|
// Check if the user can reserve
|
|
7
7
|
const requestUserAbility = await buildOrDefineAbility(requestUser);
|
|
8
8
|
// Check if user can reserve
|
|
9
9
|
ForbiddenError.from(requestUserAbility).throwUnlessCan('reserveVehicle', subject('User', subscribingUser));
|
|
10
10
|
return requestUserAbility;
|
|
11
11
|
};
|
|
12
|
-
export const checkIfVehicleIsAvailableForReservation = async (vehicle, plan, allowDelisted)=>{
|
|
12
|
+
export const checkIfVehicleIsAvailableForReservation = async (vehicle, plan, allowDelisted) => {
|
|
13
13
|
if (!vehicle.pricing) {
|
|
14
14
|
return new Err(makeProblem(PROBLEM_RESOURCE_BUSY, 'This vehicle is not available for reservation'));
|
|
15
15
|
}
|
|
@@ -25,3 +25,4 @@ export const checkIfVehicleIsAvailableForReservation = async (vehicle, plan, all
|
|
|
25
25
|
}
|
|
26
26
|
return new Ok(vehicle);
|
|
27
27
|
};
|
|
28
|
+
//# sourceMappingURL=checks.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type DisplayVehicle, type MileagePackage, type PlanType, type UltraTier, type Vehicle, type VehicleType } from '@driveflux/db';
|
|
2
2
|
export declare const fetchDisplayVehicle: (displayVehicle: DisplayVehicle | string) => Promise<{
|
|
3
3
|
object: import("@driveflux/db").DisplayVehicleObject;
|
|
4
|
+
type: VehicleType;
|
|
4
5
|
id: string;
|
|
5
6
|
createdAt: Date;
|
|
6
7
|
updatedAt: Date;
|
|
@@ -8,7 +9,6 @@ export declare const fetchDisplayVehicle: (displayVehicle: DisplayVehicle | stri
|
|
|
8
9
|
vehicleModel: string;
|
|
9
10
|
variant: string;
|
|
10
11
|
year: number;
|
|
11
|
-
type: VehicleType;
|
|
12
12
|
brandSlug: string;
|
|
13
13
|
brandId: string;
|
|
14
14
|
defaultHostId: string;
|
|
@@ -191,20 +191,20 @@ export declare const fetchDisplayVehicle: (displayVehicle: DisplayVehicle | stri
|
|
|
191
191
|
export declare const createVehicleFromDisplayVehicle: (displayVehicle: DisplayVehicle | string, selectedColor?: string) => Promise<({
|
|
192
192
|
host: {
|
|
193
193
|
object: import("@driveflux/db").HostObject;
|
|
194
|
-
|
|
194
|
+
phoneNumber: string | null;
|
|
195
|
+
type: import("@driveflux/db").HostType | null;
|
|
195
196
|
id: string;
|
|
196
197
|
metadata: PrismaJson.AnyMetadata | null;
|
|
198
|
+
name: string;
|
|
197
199
|
createdAt: Date;
|
|
198
200
|
updatedAt: Date;
|
|
199
|
-
registrationNumber: string | null;
|
|
200
|
-
type: import("@driveflux/db").HostType | null;
|
|
201
|
-
active: boolean;
|
|
202
201
|
email: string | null;
|
|
203
|
-
phoneNumber: string | null;
|
|
204
202
|
race: import("@driveflux/db").Race | null;
|
|
205
203
|
emergencyContactName: string | null;
|
|
206
204
|
emergencyPhoneNumber: string | null;
|
|
205
|
+
active: boolean;
|
|
207
206
|
commencementDate: Date | null;
|
|
207
|
+
registrationNumber: string | null;
|
|
208
208
|
stripeAccountId: string | null;
|
|
209
209
|
isStripeConnected: boolean;
|
|
210
210
|
serviceCenterIds: string[];
|
|
@@ -262,11 +262,15 @@ export declare const createVehicleFromDisplayVehicle: (displayVehicle: DisplayVe
|
|
|
262
262
|
};
|
|
263
263
|
} & {
|
|
264
264
|
object: import("@driveflux/db").VehicleObject;
|
|
265
|
+
type: VehicleType;
|
|
265
266
|
id: string;
|
|
266
|
-
status: import("@driveflux/db").VehicleStatus;
|
|
267
267
|
metadata: PrismaJson.AnyMetadata | null;
|
|
268
268
|
createdAt: Date;
|
|
269
269
|
updatedAt: Date;
|
|
270
|
+
status: import("@driveflux/db").VehicleStatus;
|
|
271
|
+
temporary: boolean;
|
|
272
|
+
registrationNumber: string | null;
|
|
273
|
+
hostId: string;
|
|
270
274
|
make: string;
|
|
271
275
|
vehicleModel: string;
|
|
272
276
|
variant: string;
|
|
@@ -276,7 +280,6 @@ export declare const createVehicleFromDisplayVehicle: (displayVehicle: DisplayVe
|
|
|
276
280
|
compositeSearchScore: number;
|
|
277
281
|
registrationDate: Date | null;
|
|
278
282
|
mileage: number | null;
|
|
279
|
-
registrationNumber: string | null;
|
|
280
283
|
vin: string | null;
|
|
281
284
|
engineNumber: string | null;
|
|
282
285
|
availability: import("@driveflux/db").VehicleAvailablity | null;
|
|
@@ -291,8 +294,6 @@ export declare const createVehicleFromDisplayVehicle: (displayVehicle: DisplayVe
|
|
|
291
294
|
delistedAt: Date | null;
|
|
292
295
|
imagesNotActual: boolean;
|
|
293
296
|
imagesNotActualMessage: string | null;
|
|
294
|
-
hostId: string;
|
|
295
|
-
type: VehicleType;
|
|
296
297
|
allowedServiceCenterIds: string[];
|
|
297
298
|
displayVehicleId: string | null;
|
|
298
299
|
isHostConfirmed: boolean | null;
|
|
@@ -305,7 +306,6 @@ export declare const createVehicleFromDisplayVehicle: (displayVehicle: DisplayVe
|
|
|
305
306
|
featureOnLandingPage: boolean;
|
|
306
307
|
lastMileageRecordedAt: Date | null;
|
|
307
308
|
locationAvailability: string[];
|
|
308
|
-
temporary: boolean;
|
|
309
309
|
hotDeal: boolean | null;
|
|
310
310
|
activeSubscriptionId: string | null;
|
|
311
311
|
addresses: {
|
|
@@ -689,11 +689,15 @@ export declare const createVehicleFromDisplayVehicle: (displayVehicle: DisplayVe
|
|
|
689
689
|
}) | undefined>;
|
|
690
690
|
export declare const transfromVehicleDisplayToVehicle: (displayVehicle: DisplayVehicle | string, selectedColor: string) => Promise<({
|
|
691
691
|
object: import("@driveflux/db").VehicleObject;
|
|
692
|
+
type: VehicleType;
|
|
692
693
|
id: string;
|
|
693
|
-
status: import("@driveflux/db").VehicleStatus;
|
|
694
694
|
metadata: PrismaJson.AnyMetadata | null;
|
|
695
695
|
createdAt: Date;
|
|
696
696
|
updatedAt: Date;
|
|
697
|
+
status: import("@driveflux/db").VehicleStatus;
|
|
698
|
+
temporary: boolean;
|
|
699
|
+
registrationNumber: string | null;
|
|
700
|
+
hostId: string;
|
|
697
701
|
make: string;
|
|
698
702
|
vehicleModel: string;
|
|
699
703
|
variant: string;
|
|
@@ -703,7 +707,6 @@ export declare const transfromVehicleDisplayToVehicle: (displayVehicle: DisplayV
|
|
|
703
707
|
compositeSearchScore: number;
|
|
704
708
|
registrationDate: Date | null;
|
|
705
709
|
mileage: number | null;
|
|
706
|
-
registrationNumber: string | null;
|
|
707
710
|
vin: string | null;
|
|
708
711
|
engineNumber: string | null;
|
|
709
712
|
availability: import("@driveflux/db").VehicleAvailablity | null;
|
|
@@ -718,8 +721,6 @@ export declare const transfromVehicleDisplayToVehicle: (displayVehicle: DisplayV
|
|
|
718
721
|
delistedAt: Date | null;
|
|
719
722
|
imagesNotActual: boolean;
|
|
720
723
|
imagesNotActualMessage: string | null;
|
|
721
|
-
hostId: string;
|
|
722
|
-
type: VehicleType;
|
|
723
724
|
allowedServiceCenterIds: string[];
|
|
724
725
|
displayVehicleId: string | null;
|
|
725
726
|
isHostConfirmed: boolean | null;
|
|
@@ -732,7 +733,6 @@ export declare const transfromVehicleDisplayToVehicle: (displayVehicle: DisplayV
|
|
|
732
733
|
featureOnLandingPage: boolean;
|
|
733
734
|
lastMileageRecordedAt: Date | null;
|
|
734
735
|
locationAvailability: string[];
|
|
735
|
-
temporary: boolean;
|
|
736
736
|
hotDeal: boolean | null;
|
|
737
737
|
activeSubscriptionId: string | null;
|
|
738
738
|
addresses: {
|
|
@@ -1,75 +1,73 @@
|
|
|
1
1
|
import { config } from '@driveflux/config/backend';
|
|
2
|
-
import { prisma } from '@driveflux/db';
|
|
2
|
+
import { prisma, } from '@driveflux/db';
|
|
3
3
|
import { generateId } from '@driveflux/db/id';
|
|
4
4
|
import { createPricingController } from '@driveflux/db/models/vehicle';
|
|
5
|
-
import { getFluxExcessMileage, getFluxPiceMatrix, getHostExcessMileage, getHostsMatrix, getRecommendedMotorcycleDeposit, getStartFeeMatrix } from '../vehicle/vehicle-pricing
|
|
6
|
-
export const fetchDisplayVehicle = async (displayVehicle)=>{
|
|
7
|
-
return typeof displayVehicle === 'string'
|
|
8
|
-
where: {
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
}) : displayVehicle;
|
|
5
|
+
import { getFluxExcessMileage, getFluxPiceMatrix, getHostExcessMileage, getHostsMatrix, getRecommendedMotorcycleDeposit, getStartFeeMatrix, } from '../vehicle/vehicle-pricing';
|
|
6
|
+
export const fetchDisplayVehicle = async (displayVehicle) => {
|
|
7
|
+
return typeof displayVehicle === 'string'
|
|
8
|
+
? await prisma.displayVehicle.findFirst({ where: { id: displayVehicle } })
|
|
9
|
+
: displayVehicle;
|
|
12
10
|
};
|
|
13
|
-
export const createVehicleFromDisplayVehicle = async (displayVehicle, selectedColor)=>{
|
|
11
|
+
export const createVehicleFromDisplayVehicle = async (displayVehicle, selectedColor) => {
|
|
14
12
|
const dv = await fetchDisplayVehicle(displayVehicle);
|
|
15
|
-
if (!dv || typeof dv !== 'object')
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
if (!dv || typeof dv !== 'object')
|
|
14
|
+
return;
|
|
15
|
+
if (!dv.details)
|
|
16
|
+
return;
|
|
17
|
+
const mainImage = dv.images.main.find((m) => m.variant === selectedColor)?.url;
|
|
18
18
|
const vehicleData = {
|
|
19
19
|
id: generateId('Vehicle'),
|
|
20
20
|
...transformBasicVehicleData(dv),
|
|
21
21
|
images: [
|
|
22
|
-
...mainImage ? [
|
|
23
|
-
|
|
24
|
-
] : [],
|
|
25
|
-
...transformImages(dv.images)
|
|
22
|
+
...(mainImage ? [transfromSingleImage(mainImage)] : []),
|
|
23
|
+
...transformImages(dv.images),
|
|
26
24
|
],
|
|
27
25
|
...transformBasePrices(dv.pricing),
|
|
28
26
|
pricing: transformPriceMatrix(dv.type, dv.pricing),
|
|
29
27
|
details: transformDetails(dv.details, selectedColor),
|
|
30
28
|
host: {
|
|
31
29
|
connect: {
|
|
32
|
-
id: dv.defaultHostId
|
|
33
|
-
}
|
|
30
|
+
id: dv.defaultHostId,
|
|
31
|
+
},
|
|
34
32
|
},
|
|
35
33
|
displayVehicle: {
|
|
36
34
|
connect: {
|
|
37
|
-
id: dv.id
|
|
38
|
-
}
|
|
39
|
-
}
|
|
35
|
+
id: dv.id,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
40
38
|
};
|
|
41
39
|
return await prisma.vehicle.create({
|
|
42
40
|
data: vehicleData,
|
|
43
41
|
include: {
|
|
44
|
-
host: true
|
|
45
|
-
}
|
|
42
|
+
host: true,
|
|
43
|
+
},
|
|
46
44
|
});
|
|
47
45
|
};
|
|
48
|
-
export const transfromVehicleDisplayToVehicle = async (displayVehicle, selectedColor)=>{
|
|
46
|
+
export const transfromVehicleDisplayToVehicle = async (displayVehicle, selectedColor) => {
|
|
49
47
|
const dv = await fetchDisplayVehicle(displayVehicle);
|
|
50
|
-
if (!dv || typeof dv !== 'object')
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
if (!dv || typeof dv !== 'object')
|
|
49
|
+
return;
|
|
50
|
+
if (!dv.details)
|
|
51
|
+
return;
|
|
52
|
+
const mainImage = dv.images.main.find((m) => m.variant === selectedColor)?.url;
|
|
53
53
|
return {
|
|
54
54
|
id: dv.id,
|
|
55
55
|
...transformBasicVehicleData(dv),
|
|
56
56
|
images: [
|
|
57
|
-
...mainImage ? [
|
|
58
|
-
|
|
59
|
-
] : [],
|
|
60
|
-
...transformImages(dv.images)
|
|
57
|
+
...(mainImage ? [transfromSingleImage(mainImage)] : []),
|
|
58
|
+
...transformImages(dv.images),
|
|
61
59
|
],
|
|
62
60
|
...transformBasePrices(dv.pricing),
|
|
63
61
|
pricing: transformPriceMatrix(dv.type, dv.pricing),
|
|
64
62
|
details: transformDetails(dv.details, selectedColor),
|
|
65
63
|
host: {
|
|
66
64
|
address: {
|
|
67
|
-
state: 'Kuala Lumpur'
|
|
68
|
-
}
|
|
69
|
-
}
|
|
65
|
+
state: 'Kuala Lumpur',
|
|
66
|
+
},
|
|
67
|
+
},
|
|
70
68
|
};
|
|
71
69
|
};
|
|
72
|
-
export const transformBasicVehicleData = (dv)=>{
|
|
70
|
+
export const transformBasicVehicleData = (dv) => {
|
|
73
71
|
return {
|
|
74
72
|
registrationNumber: null,
|
|
75
73
|
featured: false,
|
|
@@ -87,17 +85,17 @@ export const transformBasicVehicleData = (dv)=>{
|
|
|
87
85
|
type: dv.type,
|
|
88
86
|
niceName: `${dv.make} ${dv.vehicleModel} ${dv.variant} ${dv.year}`,
|
|
89
87
|
niceNameShort: `${dv.make} ${dv.vehicleModel}`,
|
|
90
|
-
appliedCoupon: dv.appliedCoupon
|
|
88
|
+
appliedCoupon: dv.appliedCoupon,
|
|
91
89
|
};
|
|
92
90
|
};
|
|
93
|
-
export const transformImages = (images)=>{
|
|
91
|
+
export const transformImages = (images) => {
|
|
94
92
|
return [
|
|
95
93
|
transfromSingleImage(images.exterior[0].url, 'exterior'),
|
|
96
94
|
transfromSingleImage(images.interior[0].url, 'interior'),
|
|
97
|
-
...images.gallery.map((i)=>transfromSingleImage(i.url))
|
|
95
|
+
...images.gallery.map((i) => transfromSingleImage(i.url)),
|
|
98
96
|
];
|
|
99
97
|
};
|
|
100
|
-
const transfromSingleImage = (imageUrl, inspectionType)=>{
|
|
98
|
+
const transfromSingleImage = (imageUrl, inspectionType) => {
|
|
101
99
|
return {
|
|
102
100
|
default: imageUrl,
|
|
103
101
|
blurBase64: null,
|
|
@@ -108,20 +106,20 @@ const transfromSingleImage = (imageUrl, inspectionType)=>{
|
|
|
108
106
|
description: null,
|
|
109
107
|
inspection: !!inspectionType,
|
|
110
108
|
inspectionType: inspectionType || null,
|
|
111
|
-
notActualPhoto: true
|
|
109
|
+
notActualPhoto: true,
|
|
112
110
|
};
|
|
113
111
|
};
|
|
114
|
-
const transformBasePrices = (pricing)=>{
|
|
112
|
+
const transformBasePrices = (pricing) => {
|
|
115
113
|
return {
|
|
116
114
|
basePrice: pricing.matrix.plan36.lite,
|
|
117
115
|
basePricePlan1: pricing.matrix.plan1.lite,
|
|
118
116
|
basePricePlan12: pricing.matrix.plan12.lite,
|
|
119
117
|
basePricePlan24: pricing.matrix.plan24.lite,
|
|
120
118
|
basePricePlan36: pricing.matrix.plan36.lite,
|
|
121
|
-
basePricePlan60: pricing.matrix.plan60.lite
|
|
119
|
+
basePricePlan60: pricing.matrix.plan60.lite,
|
|
122
120
|
};
|
|
123
121
|
};
|
|
124
|
-
const transformPriceMatrix = (vehicleType, pricing)=>{
|
|
122
|
+
const transformPriceMatrix = (vehicleType, pricing) => {
|
|
125
123
|
const baseline = pricing?.matrix.plan36.lite;
|
|
126
124
|
const ultraTier = 'tier1';
|
|
127
125
|
const fluxPriceCoefficient = 25;
|
|
@@ -134,14 +132,16 @@ const transformPriceMatrix = (vehicleType, pricing)=>{
|
|
|
134
132
|
const { availablePlans, availableMileagePackages } = getNonZeroKeys(priceMatrix);
|
|
135
133
|
const pricingController = createPricingController({
|
|
136
134
|
coefficient: fluxPriceCoefficient,
|
|
137
|
-
vehicleType
|
|
135
|
+
vehicleType,
|
|
138
136
|
});
|
|
139
137
|
const startFeeMatrix = excludeServiceFeesFrom(getStartFeeMatrix(pricingController, baseline, flatPricing));
|
|
140
138
|
const hostMatrix = excludeServiceFeesFrom(getHostsMatrix(pricingController, baseline, ultraTier, flatPricing));
|
|
141
139
|
const hostExcessMileage = getHostExcessMileage(pricingController, baseline);
|
|
142
140
|
const fluxPriceMatrix = excludeServiceFeesFrom(getFluxPiceMatrix(pricingController, vehicleType, baseline, hostMatrix, ultraTier, flatPricing));
|
|
143
141
|
const fluxExcessMileage = getFluxExcessMileage(pricingController, baseline);
|
|
144
|
-
const recommendedDeposit = pricing.refundableDeposit || vehicleType === 'motorcycle'
|
|
142
|
+
const recommendedDeposit = pricing.refundableDeposit || vehicleType === 'motorcycle'
|
|
143
|
+
? getRecommendedMotorcycleDeposit(baseline)
|
|
144
|
+
: null;
|
|
145
145
|
return {
|
|
146
146
|
tmv,
|
|
147
147
|
gfv,
|
|
@@ -160,31 +160,31 @@ const transformPriceMatrix = (vehicleType, pricing)=>{
|
|
|
160
160
|
excessMileage: fluxExcessMileage,
|
|
161
161
|
originalExcessMileage: fluxExcessMileage,
|
|
162
162
|
matrixComments: null,
|
|
163
|
-
add: null
|
|
163
|
+
add: null,
|
|
164
164
|
},
|
|
165
165
|
hostTake: {
|
|
166
166
|
matrix: hostMatrix,
|
|
167
167
|
originalMatrix: hostMatrix,
|
|
168
168
|
excessMileage: hostExcessMileage,
|
|
169
169
|
originalExcessMileage: hostExcessMileage,
|
|
170
|
-
matrixComments: null
|
|
170
|
+
matrixComments: null,
|
|
171
171
|
},
|
|
172
172
|
startFee: {
|
|
173
173
|
matrix: startFeeMatrix,
|
|
174
174
|
originalMatrix: startFeeMatrix,
|
|
175
|
-
matrixComments: null
|
|
176
|
-
}
|
|
175
|
+
matrixComments: null,
|
|
176
|
+
},
|
|
177
177
|
};
|
|
178
178
|
};
|
|
179
|
-
const getNonZeroKeys = (matrix)=>{
|
|
179
|
+
const getNonZeroKeys = (matrix) => {
|
|
180
180
|
const planKeys = new Set();
|
|
181
181
|
const mileageKeys = new Set();
|
|
182
|
-
for (const [plan, mileageMap] of Object.entries(matrix)){
|
|
182
|
+
for (const [plan, mileageMap] of Object.entries(matrix)) {
|
|
183
183
|
const entries = Object.entries(mileageMap ?? {});
|
|
184
|
-
const hasNonZero = entries.some(([_, value])=>(value ?? 0) > 0);
|
|
184
|
+
const hasNonZero = entries.some(([_, value]) => (value ?? 0) > 0);
|
|
185
185
|
if (hasNonZero) {
|
|
186
186
|
planKeys.add(plan);
|
|
187
|
-
for (const [mileage, value] of entries){
|
|
187
|
+
for (const [mileage, value] of entries) {
|
|
188
188
|
if ((value ?? 0) > 0) {
|
|
189
189
|
mileageKeys.add(mileage);
|
|
190
190
|
}
|
|
@@ -193,20 +193,20 @@ const getNonZeroKeys = (matrix)=>{
|
|
|
193
193
|
}
|
|
194
194
|
return {
|
|
195
195
|
availablePlans: Array.from(planKeys),
|
|
196
|
-
availableMileagePackages: Array.from(mileageKeys)
|
|
196
|
+
availableMileagePackages: Array.from(mileageKeys),
|
|
197
197
|
};
|
|
198
198
|
};
|
|
199
|
-
const _getInspection = ()=>{
|
|
199
|
+
const _getInspection = () => {
|
|
200
200
|
return {
|
|
201
201
|
exterior: 5,
|
|
202
202
|
interior: 5,
|
|
203
203
|
engine: 5,
|
|
204
204
|
frame: 5,
|
|
205
205
|
total: 5,
|
|
206
|
-
comment: 'COMMENT HERE'
|
|
206
|
+
comment: 'COMMENT HERE',
|
|
207
207
|
};
|
|
208
208
|
};
|
|
209
|
-
const transformDetails = (details, selectColor)=>{
|
|
209
|
+
const transformDetails = (details, selectColor) => {
|
|
210
210
|
const color = selectColor || details.colors[0].name || '';
|
|
211
211
|
return {
|
|
212
212
|
numberOfSeats: details.numberOfSeats,
|
|
@@ -214,25 +214,31 @@ const transformDetails = (details, selectColor)=>{
|
|
|
214
214
|
bodyType: details.bodyType,
|
|
215
215
|
transmission: details.transmission,
|
|
216
216
|
engineType: details.fuelType,
|
|
217
|
-
engineCapacity: details.fuelType === 'electric'
|
|
217
|
+
engineCapacity: details.fuelType === 'electric'
|
|
218
|
+
? details.batteryCapacity
|
|
219
|
+
: details.engineCapacity,
|
|
218
220
|
drivetrain: details.drivetrain,
|
|
219
221
|
accelerationTo100km: details.accelerationTo100km,
|
|
220
222
|
fuelConsumptionLitersPer100Km: details.fuelConsumptionLitersPer100Km,
|
|
221
223
|
color,
|
|
222
224
|
features: details.features,
|
|
223
|
-
condition: 'new'
|
|
225
|
+
condition: 'new',
|
|
224
226
|
};
|
|
225
227
|
};
|
|
226
|
-
const excludeServiceFeesFrom = (originalMatrix)=>{
|
|
228
|
+
const excludeServiceFeesFrom = (originalMatrix) => {
|
|
227
229
|
const matrix = {};
|
|
228
|
-
for (const [planKey, planValue] of Object.entries(originalMatrix)){
|
|
229
|
-
if (!planValue)
|
|
230
|
-
|
|
231
|
-
|
|
230
|
+
for (const [planKey, planValue] of Object.entries(originalMatrix)) {
|
|
231
|
+
if (!planValue)
|
|
232
|
+
continue;
|
|
233
|
+
if (!matrix[planKey])
|
|
234
|
+
matrix[planKey] = {};
|
|
235
|
+
for (const [mileageKey, price] of Object.entries(planValue)) {
|
|
232
236
|
if (typeof price === 'number') {
|
|
233
|
-
matrix[planKey][mileageKey] =
|
|
237
|
+
matrix[planKey][mileageKey] =
|
|
238
|
+
price / (1 + config.serviceRate);
|
|
234
239
|
}
|
|
235
240
|
}
|
|
236
241
|
}
|
|
237
242
|
return matrix;
|
|
238
243
|
};
|
|
244
|
+
//# sourceMappingURL=display-vehicle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"display-vehicle.js","sourceRoot":"","sources":["../../src/reservation/display-vehicle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAClD,OAAO,EAMN,MAAM,GAMN,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAA;AACtE,OAAO,EACN,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,cAAc,EACd,+BAA+B,EAC/B,iBAAiB,GACjB,MAAM,
|
|
1
|
+
{"version":3,"file":"display-vehicle.js","sourceRoot":"","sources":["../../src/reservation/display-vehicle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAClD,OAAO,EAMN,MAAM,GAMN,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAA;AACtE,OAAO,EACN,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,cAAc,EACd,+BAA+B,EAC/B,iBAAiB,GACjB,MAAM,4BAA4B,CAAA;AAEnC,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,EACvC,cAAuC,EACtC,EAAE;IACH,OAAO,OAAO,cAAc,KAAK,QAAQ;QACxC,CAAC,CAAC,MAAM,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,cAAc,EAAE,EAAE,CAAC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AClC,CAAC;QACF,CAAC;IACF,CAAC;IAED,OAAO,MAAM,CAAA;AACd,CAAC,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Business, type SubscriptionReservation, type User, type Vehicle } from '@driveflux/db';
|
|
2
2
|
import { type PromisedResult } from '@driveflux/result';
|
|
3
|
-
import type { ReserveVehicleParams } from './types
|
|
3
|
+
import type { ReserveVehicleParams } from './types';
|
|
4
4
|
type FetchOrCreateReservationParams = {
|
|
5
5
|
vehicle: Pick<Vehicle, 'id' | 'make' | 'vehicleModel' | 'variant' | 'year' | 'type'>;
|
|
6
6
|
payer: User | Business;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-or-create.d.ts","sourceRoot":"","sources":["../../src/reservation/fetch-or-create.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,QAAQ,EAGb,KAAK,uBAAuB,EAC5B,KAAK,IAAI,EACT,KAAK,OAAO,EACZ,MAAM,eAAe,CAAA;AAGtB,OAAO,EAAM,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAM3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"fetch-or-create.d.ts","sourceRoot":"","sources":["../../src/reservation/fetch-or-create.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,QAAQ,EAGb,KAAK,uBAAuB,EAC5B,KAAK,IAAI,EACT,KAAK,OAAO,EACZ,MAAM,eAAe,CAAA;AAGtB,OAAO,EAAM,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAM3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAEnD,KAAK,8BAA8B,GAAG;IACrC,OAAO,EAAE,IAAI,CACZ,OAAO,EACP,IAAI,GAAG,MAAM,GAAG,cAAc,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAC5D,CAAA;IACD,KAAK,EAAE,IAAI,GAAG,QAAQ,CAAA;IACtB,IAAI,EAAE,IAAI,CACT,oBAAoB,EAClB,iBAAiB,GACjB,MAAM,GACN,gBAAgB,GAChB,YAAY,GACZ,cAAc,GACd,YAAY,GACZ,QAAQ,GACR,iBAAiB,GACjB,WAAW,GACX,mBAAmB,GACnB,cAAc,GACd,aAAa,GACb,WAAW,GACX,iBAAiB,GACjB,uBAAuB,CACzB,CAAA;CACD,CAAA;AAED,eAAO,MAAM,wBAAwB,GAAU,2BAI5C,8BAA8B,KAAG,cAAc,CAAC,uBAAuB,CA+JzE,CAAA"}
|