@driveflux/api-functions 1.0.77-next.1 → 1.0.77
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.d.ts +5 -2
- package/dist/auth/confirm.d.ts.map +1 -1
- package/dist/auth/confirm.js +52 -36
- package/dist/auth/confirm.js.map +1 -1
- package/dist/auth/consent.d.ts +17 -0
- package/dist/auth/consent.d.ts.map +1 -0
- package/dist/auth/consent.js +58 -0
- package/dist/auth/consent.js.map +1 -0
- package/dist/auth/emails.js +13 -12
- package/dist/auth/formatter.js +5 -5
- package/dist/auth/otp.js +51 -67
- package/dist/auth/otp.js.map +1 -1
- package/dist/auth/register.d.ts +10 -5
- package/dist/auth/register.d.ts.map +1 -1
- package/dist/auth/register.js +77 -74
- package/dist/auth/register.js.map +1 -1
- package/dist/auth/tokens.js +55 -58
- package/dist/auth/verifications.js +52 -53
- package/dist/constants.js +1 -0
- package/dist/create-logger.js +2 -1
- package/dist/mailjet/calls/manage-contacts-in-list.js +6 -5
- package/dist/mailjet/calls/manage-subscription-status.js +5 -4
- package/dist/mailjet/calls/request-service.js +6 -7
- package/dist/mailjet/refresh-email-preferences.js +12 -11
- package/dist/mailjet/set-contact.js +12 -11
- package/dist/mailjet/types.js +2 -1
- package/dist/mailjet/utils/convert-to-array.js +6 -8
- 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.js +15 -16
- package/dist/notion/client.js +19 -22
- 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.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.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 +2 -308
- package/dist/reservation/agree.d.ts.map +1 -1
- package/dist/reservation/agree.js +23 -21
- package/dist/reservation/agree.js.map +1 -1
- package/dist/reservation/checks.js +4 -3
- package/dist/reservation/display-vehicle.d.ts +36 -36
- package/dist/reservation/display-vehicle.js +83 -73
- package/dist/reservation/display-vehicle.js.map +1 -1
- package/dist/reservation/ensure-user-billing-address.js +11 -9
- 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 +56 -51
- package/dist/reservation/fetch-or-create.js.map +1 -1
- package/dist/reservation/invoice.js +88 -77
- package/dist/reservation/payer.js +6 -5
- package/dist/reservation/payment-intent-sync.js +6 -4
- package/dist/reservation/reserve.d.ts.map +1 -1
- package/dist/reservation/reserve.js +9 -5
- package/dist/reservation/reserve.js.map +1 -1
- package/dist/reservation/types.d.ts +9 -1
- package/dist/reservation/types.d.ts.map +1 -1
- package/dist/reservation/types.js +2 -1
- package/dist/reservation/vehicle.js +16 -13
- package/dist/slack.js +29 -24
- package/dist/validation.js +79 -77
- package/dist/vehicle/vehicle-pricing/constants.js +19 -22
- package/dist/vehicle/vehicle-pricing/index.js +42 -28
- package/dist/vehicle/vehicle-pricing/types.js +2 -1
- package/package.json +10 -10
|
@@ -1,310 +1,4 @@
|
|
|
1
|
+
import { type PromisedResult } from '@driveflux/result';
|
|
1
2
|
import type { ReserveVehicleParams } from './types.js';
|
|
2
|
-
export declare const handleAgreeToTerms: ({ agreedToTerms, subscribingUser,
|
|
3
|
-
object: import("@driveflux/db").UserObject;
|
|
4
|
-
phoneNumber: string | null;
|
|
5
|
-
id: string;
|
|
6
|
-
metadata: PrismaJson.SimpleMetadata | null;
|
|
7
|
-
createdAt: Date;
|
|
8
|
-
updatedAt: Date;
|
|
9
|
-
firstName: string | null;
|
|
10
|
-
lastName: string | null;
|
|
11
|
-
jobTitle: string | null;
|
|
12
|
-
email: string;
|
|
13
|
-
businessId: string | null;
|
|
14
|
-
emailVerified: boolean;
|
|
15
|
-
password: string;
|
|
16
|
-
mustResetPassword: boolean;
|
|
17
|
-
phoneNumberVerified: boolean;
|
|
18
|
-
dateOfBirth: Date | null;
|
|
19
|
-
nationality: string | null;
|
|
20
|
-
consented: boolean;
|
|
21
|
-
stripeCustomerId: string | null;
|
|
22
|
-
status: import("@driveflux/db").UserStatus;
|
|
23
|
-
race: import("@driveflux/db").Race | null;
|
|
24
|
-
maritalStatus: import("@driveflux/db").MaritalStatus | null;
|
|
25
|
-
emergencyContactName: string | null;
|
|
26
|
-
emergencyPhoneNumber: string | null;
|
|
27
|
-
companyName: string | null;
|
|
28
|
-
ethnicity: import("@driveflux/db").Ethnicity | null;
|
|
29
|
-
geoRegion: string | null;
|
|
30
|
-
industry: string | null;
|
|
31
|
-
gender: import("@driveflux/db").Gender | null;
|
|
32
|
-
estimatedSalary: number | null;
|
|
33
|
-
department: string | null;
|
|
34
|
-
groups: string[];
|
|
35
|
-
permissions: PrismaJson.any;
|
|
36
|
-
banned: boolean;
|
|
37
|
-
banReason: string | null;
|
|
38
|
-
preferredCurrency: string | null;
|
|
39
|
-
preferredLocale: string | null;
|
|
40
|
-
temporary: boolean;
|
|
41
|
-
temporaryEmail: string | null;
|
|
42
|
-
timezone: string | null;
|
|
43
|
-
slackUserId: string | null;
|
|
44
|
-
notionUserId: string | null;
|
|
45
|
-
referredByUserId: string | null;
|
|
46
|
-
createdOffPlatformTransactionIds: string[];
|
|
47
|
-
approvedOffPlatformTransactionIds: string[];
|
|
48
|
-
registrationComplete: boolean;
|
|
49
|
-
asDriverToSubscriptionIds: string[];
|
|
50
|
-
identification: {
|
|
51
|
-
type: import("@driveflux/db").UserIdentificationType;
|
|
52
|
-
number: string | null;
|
|
53
|
-
expiryDate: Date | null;
|
|
54
|
-
issuedAt: Date | null;
|
|
55
|
-
issuedBy: string | null;
|
|
56
|
-
visaNumber: string | null;
|
|
57
|
-
entryDate: Date | null;
|
|
58
|
-
visaExpiry: Date | null;
|
|
59
|
-
visaValidityMonths: number | null;
|
|
60
|
-
verified: boolean;
|
|
61
|
-
} | null;
|
|
62
|
-
documents: {
|
|
63
|
-
passport: {
|
|
64
|
-
name: string | null;
|
|
65
|
-
description: string | null;
|
|
66
|
-
url: string;
|
|
67
|
-
fileType: string | null;
|
|
68
|
-
mimeType: string | null;
|
|
69
|
-
uploaded: boolean;
|
|
70
|
-
createdAt: Date | null;
|
|
71
|
-
updatedAt: Date | null;
|
|
72
|
-
metadata: PrismaJson.AnyMetadata | null;
|
|
73
|
-
} | null;
|
|
74
|
-
visa: {
|
|
75
|
-
name: string | null;
|
|
76
|
-
description: string | null;
|
|
77
|
-
url: string;
|
|
78
|
-
fileType: string | null;
|
|
79
|
-
mimeType: string | null;
|
|
80
|
-
uploaded: boolean;
|
|
81
|
-
createdAt: Date | null;
|
|
82
|
-
updatedAt: Date | null;
|
|
83
|
-
metadata: PrismaJson.AnyMetadata | null;
|
|
84
|
-
} | null;
|
|
85
|
-
idFront: {
|
|
86
|
-
name: string | null;
|
|
87
|
-
description: string | null;
|
|
88
|
-
url: string;
|
|
89
|
-
fileType: string | null;
|
|
90
|
-
mimeType: string | null;
|
|
91
|
-
uploaded: boolean;
|
|
92
|
-
createdAt: Date | null;
|
|
93
|
-
updatedAt: Date | null;
|
|
94
|
-
metadata: PrismaJson.AnyMetadata | null;
|
|
95
|
-
} | null;
|
|
96
|
-
idBack: {
|
|
97
|
-
name: string | null;
|
|
98
|
-
description: string | null;
|
|
99
|
-
url: string;
|
|
100
|
-
fileType: string | null;
|
|
101
|
-
mimeType: string | null;
|
|
102
|
-
uploaded: boolean;
|
|
103
|
-
createdAt: Date | null;
|
|
104
|
-
updatedAt: Date | null;
|
|
105
|
-
metadata: PrismaJson.AnyMetadata | null;
|
|
106
|
-
} | null;
|
|
107
|
-
drivingLicense: {
|
|
108
|
-
name: string | null;
|
|
109
|
-
description: string | null;
|
|
110
|
-
url: string;
|
|
111
|
-
fileType: string | null;
|
|
112
|
-
mimeType: string | null;
|
|
113
|
-
uploaded: boolean;
|
|
114
|
-
createdAt: Date | null;
|
|
115
|
-
updatedAt: Date | null;
|
|
116
|
-
metadata: PrismaJson.AnyMetadata | null;
|
|
117
|
-
} | null;
|
|
118
|
-
experianReport: {
|
|
119
|
-
name: string | null;
|
|
120
|
-
description: string | null;
|
|
121
|
-
url: string;
|
|
122
|
-
fileType: string | null;
|
|
123
|
-
mimeType: string | null;
|
|
124
|
-
uploaded: boolean;
|
|
125
|
-
createdAt: Date | null;
|
|
126
|
-
updatedAt: Date | null;
|
|
127
|
-
metadata: PrismaJson.AnyMetadata | null;
|
|
128
|
-
} | null;
|
|
129
|
-
pdrm: {
|
|
130
|
-
name: string | null;
|
|
131
|
-
description: string | null;
|
|
132
|
-
url: string;
|
|
133
|
-
fileType: string | null;
|
|
134
|
-
mimeType: string | null;
|
|
135
|
-
uploaded: boolean;
|
|
136
|
-
createdAt: Date | null;
|
|
137
|
-
updatedAt: Date | null;
|
|
138
|
-
metadata: PrismaJson.AnyMetadata | null;
|
|
139
|
-
} | null;
|
|
140
|
-
jpj: {
|
|
141
|
-
name: string | null;
|
|
142
|
-
description: string | null;
|
|
143
|
-
url: string;
|
|
144
|
-
fileType: string | null;
|
|
145
|
-
mimeType: string | null;
|
|
146
|
-
uploaded: boolean;
|
|
147
|
-
createdAt: Date | null;
|
|
148
|
-
updatedAt: Date | null;
|
|
149
|
-
metadata: PrismaJson.AnyMetadata | null;
|
|
150
|
-
} | null;
|
|
151
|
-
bgs: {
|
|
152
|
-
name: string | null;
|
|
153
|
-
description: string | null;
|
|
154
|
-
url: string;
|
|
155
|
-
fileType: string | null;
|
|
156
|
-
mimeType: string | null;
|
|
157
|
-
uploaded: boolean;
|
|
158
|
-
createdAt: Date | null;
|
|
159
|
-
updatedAt: Date | null;
|
|
160
|
-
metadata: PrismaJson.AnyMetadata | null;
|
|
161
|
-
} | null;
|
|
162
|
-
bankStatement: {
|
|
163
|
-
name: string | null;
|
|
164
|
-
description: string | null;
|
|
165
|
-
url: string;
|
|
166
|
-
fileType: string | null;
|
|
167
|
-
mimeType: string | null;
|
|
168
|
-
uploaded: boolean;
|
|
169
|
-
createdAt: Date | null;
|
|
170
|
-
updatedAt: Date | null;
|
|
171
|
-
metadata: PrismaJson.AnyMetadata | null;
|
|
172
|
-
} | null;
|
|
173
|
-
bankStatement2: {
|
|
174
|
-
name: string | null;
|
|
175
|
-
description: string | null;
|
|
176
|
-
url: string;
|
|
177
|
-
fileType: string | null;
|
|
178
|
-
mimeType: string | null;
|
|
179
|
-
uploaded: boolean;
|
|
180
|
-
createdAt: Date | null;
|
|
181
|
-
updatedAt: Date | null;
|
|
182
|
-
metadata: PrismaJson.AnyMetadata | null;
|
|
183
|
-
} | null;
|
|
184
|
-
bankStatement3: {
|
|
185
|
-
name: string | null;
|
|
186
|
-
description: string | null;
|
|
187
|
-
url: string;
|
|
188
|
-
fileType: string | null;
|
|
189
|
-
mimeType: string | null;
|
|
190
|
-
uploaded: boolean;
|
|
191
|
-
createdAt: Date | null;
|
|
192
|
-
updatedAt: Date | null;
|
|
193
|
-
metadata: PrismaJson.AnyMetadata | null;
|
|
194
|
-
} | null;
|
|
195
|
-
epfStatement: {
|
|
196
|
-
name: string | null;
|
|
197
|
-
description: string | null;
|
|
198
|
-
url: string;
|
|
199
|
-
fileType: string | null;
|
|
200
|
-
mimeType: string | null;
|
|
201
|
-
uploaded: boolean;
|
|
202
|
-
createdAt: Date | null;
|
|
203
|
-
updatedAt: Date | null;
|
|
204
|
-
metadata: PrismaJson.AnyMetadata | null;
|
|
205
|
-
} | null;
|
|
206
|
-
offerLetter: {
|
|
207
|
-
name: string | null;
|
|
208
|
-
description: string | null;
|
|
209
|
-
url: string;
|
|
210
|
-
fileType: string | null;
|
|
211
|
-
mimeType: string | null;
|
|
212
|
-
uploaded: boolean;
|
|
213
|
-
createdAt: Date | null;
|
|
214
|
-
updatedAt: Date | null;
|
|
215
|
-
metadata: PrismaJson.AnyMetadata | null;
|
|
216
|
-
} | null;
|
|
217
|
-
} | null;
|
|
218
|
-
paymentMethods: ({
|
|
219
|
-
id: string;
|
|
220
|
-
object: import("@driveflux/db").PaymentMethodObject;
|
|
221
|
-
provider: string;
|
|
222
|
-
chargingMethod: import("@driveflux/db").ChargingMethod;
|
|
223
|
-
type: string;
|
|
224
|
-
providerPaymentMethodId: string | null;
|
|
225
|
-
isDefault: boolean;
|
|
226
|
-
stripeCustomerId: string | null;
|
|
227
|
-
stripeSetupIntentId: string | null;
|
|
228
|
-
payexMandateId: string | null;
|
|
229
|
-
accountType: import("@driveflux/db").PaymentMethodAccountType;
|
|
230
|
-
status: import("@driveflux/db").PaymentMethodStatus;
|
|
231
|
-
statusText: string | null;
|
|
232
|
-
ownerId: string;
|
|
233
|
-
metadata: PrismaJson.SimpleMetadata | null;
|
|
234
|
-
} & {
|
|
235
|
-
payexDetails: {
|
|
236
|
-
bankName: string | null;
|
|
237
|
-
bankLast4: string | null;
|
|
238
|
-
bankAccountType: import("@driveflux/db").BankAccountType | null;
|
|
239
|
-
accountHolderName: string | null;
|
|
240
|
-
} | null;
|
|
241
|
-
card: {
|
|
242
|
-
brand: string | null;
|
|
243
|
-
last4: string | null;
|
|
244
|
-
expMonth: number | null;
|
|
245
|
-
expYear: number | null;
|
|
246
|
-
funding: string | null;
|
|
247
|
-
country: string | null;
|
|
248
|
-
cardholderName: string | null;
|
|
249
|
-
} | null;
|
|
250
|
-
})[];
|
|
251
|
-
addresses: {
|
|
252
|
-
home: {
|
|
253
|
-
name: string | null;
|
|
254
|
-
street1: string;
|
|
255
|
-
street2: string | null;
|
|
256
|
-
city: string;
|
|
257
|
-
state: string;
|
|
258
|
-
country: string;
|
|
259
|
-
postalCode: string;
|
|
260
|
-
} & {
|
|
261
|
-
coordinates: {
|
|
262
|
-
lat: number;
|
|
263
|
-
lng: number;
|
|
264
|
-
} | null;
|
|
265
|
-
};
|
|
266
|
-
billing: {
|
|
267
|
-
name: string | null;
|
|
268
|
-
street1: string;
|
|
269
|
-
street2: string | null;
|
|
270
|
-
city: string;
|
|
271
|
-
state: string;
|
|
272
|
-
country: string;
|
|
273
|
-
postalCode: string;
|
|
274
|
-
};
|
|
275
|
-
} | null;
|
|
276
|
-
verifications: {
|
|
277
|
-
nameMatch: boolean;
|
|
278
|
-
addressMatch: boolean;
|
|
279
|
-
drivingLicense: import("@driveflux/db").DrivingLicense | null;
|
|
280
|
-
iScore: number | null;
|
|
281
|
-
pastBankruptcy: boolean;
|
|
282
|
-
pdrmSummons: number | null;
|
|
283
|
-
jpjSummons: number | null;
|
|
284
|
-
specialAttentionAccounts: number | null;
|
|
285
|
-
legalSuits: number | null;
|
|
286
|
-
badTrade: number | null;
|
|
287
|
-
paymentDefaults: number | null;
|
|
288
|
-
jpjBlacklist: boolean;
|
|
289
|
-
visaEvidence: boolean;
|
|
290
|
-
creditLimit: number | null;
|
|
291
|
-
avgThreeMonthsAccountBalance: number | null;
|
|
292
|
-
monthlyIncome: number | null;
|
|
293
|
-
creditUtilization: number | null;
|
|
294
|
-
onlinePresence: PrismaJson.StringMetadata | null;
|
|
295
|
-
onlineVerifications: PrismaJson.SimpleMetadata | null;
|
|
296
|
-
} | null;
|
|
297
|
-
emailPreferences: {
|
|
298
|
-
generalMarketing: boolean | null;
|
|
299
|
-
noActiveSubs: boolean | null;
|
|
300
|
-
signUpOnly: boolean | null;
|
|
301
|
-
signUpPaymentAdded: boolean | null;
|
|
302
|
-
activeSub: boolean | null;
|
|
303
|
-
expiredSub: boolean | null;
|
|
304
|
-
} | null;
|
|
305
|
-
signupParams: {
|
|
306
|
-
source: string | null;
|
|
307
|
-
method: string | null;
|
|
308
|
-
} | null;
|
|
309
|
-
}>;
|
|
3
|
+
export declare const handleAgreeToTerms: ({ agreedToTerms, subscribingUser, consentData, }: Pick<ReserveVehicleParams, "agreedToTerms" | "subscribingUser" | "consentData">) => PromisedResult<ReserveVehicleParams["subscribingUser"]>;
|
|
310
4
|
//# sourceMappingURL=agree.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agree.d.ts","sourceRoot":"","sources":["../../src/reservation/agree.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"agree.d.ts","sourceRoot":"","sources":["../../src/reservation/agree.ts"],"names":[],"mappings":"AACA,OAAO,EAAW,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAEhE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAEtD,eAAO,MAAM,kBAAkB,GAAU,kDAItC,IAAI,CACN,oBAAoB,EACpB,eAAe,GAAG,iBAAiB,GAAG,aAAa,CACnD,KAAG,cAAc,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CA6BzD,CAAA"}
|
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
consented: true,
|
|
11
|
-
consents: {
|
|
12
|
-
create: {
|
|
13
|
-
id: generateId('UserConsent'),
|
|
14
|
-
ipAddress,
|
|
15
|
-
consentType: 'terms',
|
|
16
|
-
email: subscribingUser.email
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
});
|
|
1
|
+
import { makeProblem, PROBLEM_INVALID_DATA } from '@driveflux/problem';
|
|
2
|
+
import { Err, Ok } from '@driveflux/result';
|
|
3
|
+
import { checkUserConsent, createConsent } from '../auth/consent.js';
|
|
4
|
+
export const handleAgreeToTerms = async ({ agreedToTerms, subscribingUser, consentData, }) => {
|
|
5
|
+
// Get consent first
|
|
6
|
+
const didConsent = await checkUserConsent(subscribingUser.id);
|
|
7
|
+
// All good, user has consented
|
|
8
|
+
if (didConsent) {
|
|
9
|
+
return new Ok(subscribingUser);
|
|
21
10
|
}
|
|
22
|
-
|
|
11
|
+
if (!agreedToTerms || !consentData) {
|
|
12
|
+
return new Err(makeProblem(PROBLEM_INVALID_DATA, 'You must agree to the terms and conditions to reserve a vehicle'));
|
|
13
|
+
}
|
|
14
|
+
await createConsent({
|
|
15
|
+
user: subscribingUser,
|
|
16
|
+
fingerprint: consentData.fingerprint,
|
|
17
|
+
termsVersion: consentData.termsVersion || 'universal',
|
|
18
|
+
ipAddress: consentData.ipAddress,
|
|
19
|
+
userAgent: consentData.userAgent,
|
|
20
|
+
sessionToken: consentData.sessionToken,
|
|
21
|
+
consentType: 'terms',
|
|
22
|
+
});
|
|
23
|
+
return new Ok(subscribingUser);
|
|
23
24
|
};
|
|
25
|
+
//# sourceMappingURL=agree.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agree.js","sourceRoot":"","sources":["../../src/reservation/agree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"agree.js","sourceRoot":"","sources":["../../src/reservation/agree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AACtE,OAAO,EAAE,GAAG,EAAE,EAAE,EAAuB,MAAM,mBAAmB,CAAA;AAChE,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAGpE,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,EAAE,EACxC,aAAa,EACb,eAAe,EACf,WAAW,GAIX,EAA2D,EAAE;IAC7D,oBAAoB;IACpB,MAAM,UAAU,GAAG,MAAM,gBAAgB,CAAC,eAAe,CAAC,EAAE,CAAC,CAAA;IAE7D,+BAA+B;IAC/B,IAAI,UAAU,EAAE,CAAC;QAChB,OAAO,IAAI,EAAE,CAAC,eAAe,CAAC,CAAA;IAC/B,CAAC;IAED,IAAI,CAAC,aAAa,IAAI,CAAC,WAAW,EAAE,CAAC;QACpC,OAAO,IAAI,GAAG,CACb,WAAW,CACV,oBAAoB,EACpB,iEAAiE,CACjE,CACD,CAAA;IACF,CAAC;IAED,MAAM,aAAa,CAAC;QACnB,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE,WAAW,CAAC,WAAW;QACpC,YAAY,EAAE,WAAW,CAAC,YAAY,IAAI,WAAW;QACrD,SAAS,EAAE,WAAW,CAAC,SAAS;QAChC,SAAS,EAAE,WAAW,CAAC,SAAS;QAChC,YAAY,EAAE,WAAW,CAAC,YAAY;QACtC,WAAW,EAAE,OAAO;KACpB,CAAC,CAAA;IAEF,OAAO,IAAI,EAAE,CAAC,eAAe,CAAC,CAAA;AAC/B,CAAC,CAAA"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { buildOrDefineAbility } from '@driveflux/auth/authorization';
|
|
2
|
-
import { makeProblem, PROBLEM_CONDITION_FAILED, PROBLEM_RESOURCE_BUSY } from '@driveflux/problem';
|
|
2
|
+
import { makeProblem, PROBLEM_CONDITION_FAILED, PROBLEM_RESOURCE_BUSY, } from '@driveflux/problem';
|
|
3
3
|
import { Err, Ok } from '@driveflux/result';
|
|
4
|
-
export const getUserAbility = async ({ requestUser })=>{
|
|
4
|
+
export const getUserAbility = async ({ requestUser, }) => {
|
|
5
5
|
// Check if the user can reserve
|
|
6
6
|
const requestUserAbility = await buildOrDefineAbility(requestUser);
|
|
7
7
|
return requestUserAbility;
|
|
8
8
|
};
|
|
9
|
-
export const checkIfVehicleIsAvailableForReservation = async (vehicle, plan, allowDelisted)=>{
|
|
9
|
+
export const checkIfVehicleIsAvailableForReservation = async (vehicle, plan, allowDelisted) => {
|
|
10
10
|
if (!vehicle.pricing) {
|
|
11
11
|
return new Err(makeProblem(PROBLEM_RESOURCE_BUSY, 'This vehicle is not available for reservation'));
|
|
12
12
|
}
|
|
@@ -22,3 +22,4 @@ export const checkIfVehicleIsAvailableForReservation = async (vehicle, plan, all
|
|
|
22
22
|
}
|
|
23
23
|
return new Ok(vehicle);
|
|
24
24
|
};
|
|
25
|
+
//# sourceMappingURL=checks.js.map
|
|
@@ -1,21 +1,21 @@
|
|
|
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
|
-
id: string;
|
|
5
4
|
type: VehicleType;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
id: string;
|
|
6
|
+
createdAt: Date;
|
|
7
|
+
updatedAt: Date;
|
|
8
|
+
fullBooking: boolean | null;
|
|
10
9
|
make: string;
|
|
11
10
|
vehicleModel: string;
|
|
12
11
|
variant: string;
|
|
13
12
|
year: number;
|
|
14
|
-
|
|
13
|
+
brandSlug: string;
|
|
14
|
+
brandId: string;
|
|
15
|
+
defaultHostId: string;
|
|
16
|
+
vehicleSlug: string;
|
|
15
17
|
availableStock: number | null;
|
|
16
18
|
saveValue: number | null;
|
|
17
|
-
createdAt: Date;
|
|
18
|
-
updatedAt: Date;
|
|
19
19
|
details: ({
|
|
20
20
|
features: string[];
|
|
21
21
|
range: number | null;
|
|
@@ -196,26 +196,26 @@ export declare const fetchDisplayVehicle: (displayVehicle: DisplayVehicle | stri
|
|
|
196
196
|
export declare const createVehicleFromDisplayVehicle: (displayVehicle: DisplayVehicle | string, selectedColor?: string) => Promise<({
|
|
197
197
|
host: {
|
|
198
198
|
object: import("@driveflux/db").HostObject;
|
|
199
|
-
|
|
200
|
-
id: string;
|
|
199
|
+
phoneNumber: string | null;
|
|
201
200
|
type: import("@driveflux/db").HostType | null;
|
|
201
|
+
id: string;
|
|
202
|
+
metadata: PrismaJson.AnyMetadata | null;
|
|
203
|
+
name: string;
|
|
202
204
|
createdAt: Date;
|
|
203
205
|
updatedAt: Date;
|
|
204
|
-
registrationNumber: string | null;
|
|
205
|
-
metadata: PrismaJson.AnyMetadata | null;
|
|
206
|
-
active: boolean;
|
|
207
|
-
commencementDate: Date | null;
|
|
208
206
|
email: string | null;
|
|
209
|
-
|
|
207
|
+
race: import("@driveflux/db").Race | null;
|
|
210
208
|
emergencyContactName: string | null;
|
|
211
209
|
emergencyPhoneNumber: string | null;
|
|
210
|
+
active: boolean;
|
|
211
|
+
commencementDate: Date | null;
|
|
212
|
+
registrationNumber: string | null;
|
|
212
213
|
stripeAccountId: string | null;
|
|
213
214
|
isStripeConnected: boolean;
|
|
214
215
|
serviceCenterIds: string[];
|
|
215
216
|
enablePrepayments: boolean;
|
|
216
217
|
prepaymentRatio: number | null;
|
|
217
218
|
accountManagerId: string | null;
|
|
218
|
-
race: import("@driveflux/db").Race | null;
|
|
219
219
|
isInternal: boolean | null;
|
|
220
220
|
address: ({
|
|
221
221
|
name: string | null;
|
|
@@ -267,20 +267,24 @@ export declare const createVehicleFromDisplayVehicle: (displayVehicle: DisplayVe
|
|
|
267
267
|
};
|
|
268
268
|
} & {
|
|
269
269
|
object: import("@driveflux/db").VehicleObject;
|
|
270
|
-
id: string;
|
|
271
270
|
type: VehicleType;
|
|
271
|
+
id: string;
|
|
272
|
+
metadata: PrismaJson.AnyMetadata | null;
|
|
273
|
+
createdAt: Date;
|
|
274
|
+
updatedAt: Date;
|
|
275
|
+
status: import("@driveflux/db").VehicleStatus;
|
|
276
|
+
temporary: boolean;
|
|
277
|
+
registrationNumber: string | null;
|
|
278
|
+
hostId: string;
|
|
272
279
|
make: string;
|
|
273
280
|
vehicleModel: string;
|
|
274
281
|
variant: string;
|
|
275
282
|
year: number;
|
|
276
|
-
createdAt: Date;
|
|
277
|
-
updatedAt: Date;
|
|
278
283
|
featured: boolean;
|
|
279
284
|
searchRankScore: number;
|
|
280
285
|
compositeSearchScore: number;
|
|
281
286
|
registrationDate: Date | null;
|
|
282
287
|
mileage: number | null;
|
|
283
|
-
registrationNumber: string | null;
|
|
284
288
|
vin: string | null;
|
|
285
289
|
engineNumber: string | null;
|
|
286
290
|
availability: import("@driveflux/db").VehicleAvailablity | null;
|
|
@@ -291,11 +295,12 @@ export declare const createVehicleFromDisplayVehicle: (displayVehicle: DisplayVe
|
|
|
291
295
|
basePricePlan24: number;
|
|
292
296
|
basePricePlan36: number;
|
|
293
297
|
basePricePlan60: number;
|
|
294
|
-
status: import("@driveflux/db").VehicleStatus;
|
|
295
298
|
listedAt: Date | null;
|
|
296
299
|
delistedAt: Date | null;
|
|
297
300
|
imagesNotActual: boolean;
|
|
298
301
|
imagesNotActualMessage: string | null;
|
|
302
|
+
allowedServiceCenterIds: string[];
|
|
303
|
+
displayVehicleId: string | null;
|
|
299
304
|
isHostConfirmed: boolean | null;
|
|
300
305
|
niceName: string;
|
|
301
306
|
niceNameShort: string;
|
|
@@ -306,12 +311,7 @@ export declare const createVehicleFromDisplayVehicle: (displayVehicle: DisplayVe
|
|
|
306
311
|
featureOnLandingPage: boolean;
|
|
307
312
|
lastMileageRecordedAt: Date | null;
|
|
308
313
|
locationAvailability: string[];
|
|
309
|
-
temporary: boolean;
|
|
310
314
|
hotDeal: boolean | null;
|
|
311
|
-
metadata: PrismaJson.AnyMetadata | null;
|
|
312
|
-
hostId: string;
|
|
313
|
-
allowedServiceCenterIds: string[];
|
|
314
|
-
displayVehicleId: string | null;
|
|
315
315
|
activeSubscriptionId: string | null;
|
|
316
316
|
addresses: {
|
|
317
317
|
return: {
|
|
@@ -694,20 +694,24 @@ export declare const createVehicleFromDisplayVehicle: (displayVehicle: DisplayVe
|
|
|
694
694
|
}) | undefined>;
|
|
695
695
|
export declare const transfromVehicleDisplayToVehicle: (displayVehicle: DisplayVehicle | string, selectedColor: string) => Promise<({
|
|
696
696
|
object: import("@driveflux/db").VehicleObject;
|
|
697
|
-
id: string;
|
|
698
697
|
type: VehicleType;
|
|
698
|
+
id: string;
|
|
699
|
+
metadata: PrismaJson.AnyMetadata | null;
|
|
700
|
+
createdAt: Date;
|
|
701
|
+
updatedAt: Date;
|
|
702
|
+
status: import("@driveflux/db").VehicleStatus;
|
|
703
|
+
temporary: boolean;
|
|
704
|
+
registrationNumber: string | null;
|
|
705
|
+
hostId: string;
|
|
699
706
|
make: string;
|
|
700
707
|
vehicleModel: string;
|
|
701
708
|
variant: string;
|
|
702
709
|
year: number;
|
|
703
|
-
createdAt: Date;
|
|
704
|
-
updatedAt: Date;
|
|
705
710
|
featured: boolean;
|
|
706
711
|
searchRankScore: number;
|
|
707
712
|
compositeSearchScore: number;
|
|
708
713
|
registrationDate: Date | null;
|
|
709
714
|
mileage: number | null;
|
|
710
|
-
registrationNumber: string | null;
|
|
711
715
|
vin: string | null;
|
|
712
716
|
engineNumber: string | null;
|
|
713
717
|
availability: import("@driveflux/db").VehicleAvailablity | null;
|
|
@@ -718,11 +722,12 @@ export declare const transfromVehicleDisplayToVehicle: (displayVehicle: DisplayV
|
|
|
718
722
|
basePricePlan24: number;
|
|
719
723
|
basePricePlan36: number;
|
|
720
724
|
basePricePlan60: number;
|
|
721
|
-
status: import("@driveflux/db").VehicleStatus;
|
|
722
725
|
listedAt: Date | null;
|
|
723
726
|
delistedAt: Date | null;
|
|
724
727
|
imagesNotActual: boolean;
|
|
725
728
|
imagesNotActualMessage: string | null;
|
|
729
|
+
allowedServiceCenterIds: string[];
|
|
730
|
+
displayVehicleId: string | null;
|
|
726
731
|
isHostConfirmed: boolean | null;
|
|
727
732
|
niceName: string;
|
|
728
733
|
niceNameShort: string;
|
|
@@ -733,12 +738,7 @@ export declare const transfromVehicleDisplayToVehicle: (displayVehicle: DisplayV
|
|
|
733
738
|
featureOnLandingPage: boolean;
|
|
734
739
|
lastMileageRecordedAt: Date | null;
|
|
735
740
|
locationAvailability: string[];
|
|
736
|
-
temporary: boolean;
|
|
737
741
|
hotDeal: boolean | null;
|
|
738
|
-
metadata: PrismaJson.AnyMetadata | null;
|
|
739
|
-
hostId: string;
|
|
740
|
-
allowedServiceCenterIds: string[];
|
|
741
|
-
displayVehicleId: string | null;
|
|
742
742
|
activeSubscriptionId: string | null;
|
|
743
743
|
addresses: {
|
|
744
744
|
return: {
|