@mydoormot/app-types 2.3.0 → 2.3.2
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/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +12 -0
- package/dist/index.cjs +48 -23
- package/dist/index.d.cts +399 -534
- package/dist/index.d.ts +399 -534
- package/dist/index.js +42 -19
- package/package.json +1 -1
- package/src/business.ts +0 -16
- package/src/customer.ts +2 -0
- package/src/errand.ts +12 -51
- package/src/index.ts +1 -2
- package/src/invoice.ts +5 -0
- package/src/rating.ts +73 -0
- package/src/vehicle.ts +0 -100
- package/src/whatsapp.ts +1 -0
- package/src/platform.ts +0 -17
- package/src/portal.ts +0 -46
package/dist/index.js
CHANGED
|
@@ -146,6 +146,7 @@ var InvoiceEventType = /* @__PURE__ */ ((InvoiceEventType2) => {
|
|
|
146
146
|
InvoiceEventType2["PaymentReversed"] = "payment_reversed";
|
|
147
147
|
InvoiceEventType2["PaymentUpdated"] = "payment_updated";
|
|
148
148
|
InvoiceEventType2["StatusChanged"] = "status_changed";
|
|
149
|
+
InvoiceEventType2["ErrandSettlementChanged"] = "errand_settlement_changed";
|
|
149
150
|
InvoiceEventType2["Viewed"] = "viewed";
|
|
150
151
|
return InvoiceEventType2;
|
|
151
152
|
})(InvoiceEventType || {});
|
|
@@ -176,11 +177,6 @@ var VehicleLogType = /* @__PURE__ */ ((VehicleLogType2) => {
|
|
|
176
177
|
VehicleLogType2["REFUEL"] = "REFUEL";
|
|
177
178
|
return VehicleLogType2;
|
|
178
179
|
})(VehicleLogType || {});
|
|
179
|
-
var FuelDueStatus = /* @__PURE__ */ ((FuelDueStatus2) => {
|
|
180
|
-
FuelDueStatus2["Due"] = "DUE";
|
|
181
|
-
FuelDueStatus2["Ok"] = "OK";
|
|
182
|
-
return FuelDueStatus2;
|
|
183
|
-
})(FuelDueStatus || {});
|
|
184
180
|
|
|
185
181
|
// src/rider.ts
|
|
186
182
|
var RemittanceStatus = /* @__PURE__ */ ((RemittanceStatus2) => {
|
|
@@ -260,9 +256,6 @@ var MembershipStatus = /* @__PURE__ */ ((MembershipStatus2) => {
|
|
|
260
256
|
MembershipStatus2["DISABLED"] = "DISABLED";
|
|
261
257
|
return MembershipStatus2;
|
|
262
258
|
})(MembershipStatus || {});
|
|
263
|
-
var DEFAULT_BUSINESS_FUEL_SETTINGS = {
|
|
264
|
-
revenuePercent: null
|
|
265
|
-
};
|
|
266
259
|
var DEFAULT_BUSINESS_RIDER_PAY_SETTINGS = {
|
|
267
260
|
defaultPercentage: null,
|
|
268
261
|
periodType: null
|
|
@@ -290,7 +283,6 @@ var DEFAULT_BUSINESS_SETTINGS = {
|
|
|
290
283
|
tiktok: null,
|
|
291
284
|
website: null
|
|
292
285
|
},
|
|
293
|
-
fuel: DEFAULT_BUSINESS_FUEL_SETTINGS,
|
|
294
286
|
riderPay: DEFAULT_BUSINESS_RIDER_PAY_SETTINGS
|
|
295
287
|
};
|
|
296
288
|
var BusinessCourierLinkStatus = /* @__PURE__ */ ((BusinessCourierLinkStatus2) => {
|
|
@@ -337,6 +329,7 @@ var WhatsappButtonType = /* @__PURE__ */ ((WhatsappButtonType2) => {
|
|
|
337
329
|
})(WhatsappButtonType || {});
|
|
338
330
|
var WhatsappTemplateParamSource = /* @__PURE__ */ ((WhatsappTemplateParamSource2) => {
|
|
339
331
|
WhatsappTemplateParamSource2["ERRAND_ALIAS_ID"] = "errand.aliasId";
|
|
332
|
+
WhatsappTemplateParamSource2["ERRAND_TRACKING_CODE"] = "errand.trackingCode";
|
|
340
333
|
WhatsappTemplateParamSource2["ERRAND_PICKUP_NAME"] = "errand.pickupDetails.fullName";
|
|
341
334
|
WhatsappTemplateParamSource2["ERRAND_DELIVERY_NAME"] = "errand.deliveryDetails.fullName";
|
|
342
335
|
WhatsappTemplateParamSource2["BUSINESS_NAME"] = "business.name";
|
|
@@ -347,12 +340,40 @@ var WhatsappTemplateParamSource = /* @__PURE__ */ ((WhatsappTemplateParamSource2
|
|
|
347
340
|
return WhatsappTemplateParamSource2;
|
|
348
341
|
})(WhatsappTemplateParamSource || {});
|
|
349
342
|
|
|
350
|
-
// src/
|
|
351
|
-
var
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
343
|
+
// src/rating.ts
|
|
344
|
+
var ErrandRatingTag = /* @__PURE__ */ ((ErrandRatingTag2) => {
|
|
345
|
+
ErrandRatingTag2["OnTime"] = "on-time";
|
|
346
|
+
ErrandRatingTag2["CalledBeforeArriving"] = "called-before-arriving";
|
|
347
|
+
ErrandRatingTag2["Polite"] = "polite";
|
|
348
|
+
ErrandRatingTag2["ItemInGoodShape"] = "item-in-good-shape";
|
|
349
|
+
ErrandRatingTag2["FollowedDirections"] = "followed-directions";
|
|
350
|
+
ErrandRatingTag2["Late"] = "late";
|
|
351
|
+
ErrandRatingTag2["DidNotCall"] = "did-not-call";
|
|
352
|
+
ErrandRatingTag2["Rude"] = "rude";
|
|
353
|
+
ErrandRatingTag2["ItemDamaged"] = "item-damaged";
|
|
354
|
+
ErrandRatingTag2["HardToFindMe"] = "hard-to-find-me";
|
|
355
|
+
return ErrandRatingTag2;
|
|
356
|
+
})(ErrandRatingTag || {});
|
|
357
|
+
var goodRatingTags = [
|
|
358
|
+
"on-time" /* OnTime */,
|
|
359
|
+
"called-before-arriving" /* CalledBeforeArriving */,
|
|
360
|
+
"polite" /* Polite */,
|
|
361
|
+
"item-in-good-shape" /* ItemInGoodShape */,
|
|
362
|
+
"followed-directions" /* FollowedDirections */
|
|
363
|
+
];
|
|
364
|
+
var badRatingTags = [
|
|
365
|
+
"late" /* Late */,
|
|
366
|
+
"did-not-call" /* DidNotCall */,
|
|
367
|
+
"rude" /* Rude */,
|
|
368
|
+
"item-damaged" /* ItemDamaged */,
|
|
369
|
+
"hard-to-find-me" /* HardToFindMe */
|
|
370
|
+
];
|
|
371
|
+
var ErrandRatingStatus = /* @__PURE__ */ ((ErrandRatingStatus2) => {
|
|
372
|
+
ErrandRatingStatus2["Visible"] = "visible";
|
|
373
|
+
ErrandRatingStatus2["Hidden"] = "hidden";
|
|
374
|
+
return ErrandRatingStatus2;
|
|
375
|
+
})(ErrandRatingStatus || {});
|
|
376
|
+
var minRatingsForAverage = 10;
|
|
356
377
|
|
|
357
378
|
// src/index.ts
|
|
358
379
|
var LinkDestination = /* @__PURE__ */ ((LinkDestination2) => {
|
|
@@ -370,7 +391,6 @@ export {
|
|
|
370
391
|
BusinessRole,
|
|
371
392
|
BusinessStatus,
|
|
372
393
|
BusinessType,
|
|
373
|
-
DEFAULT_BUSINESS_FUEL_SETTINGS,
|
|
374
394
|
DEFAULT_BUSINESS_RIDER_PAY_SETTINGS,
|
|
375
395
|
DEFAULT_BUSINESS_SETTINGS,
|
|
376
396
|
DeliveryStatus,
|
|
@@ -378,10 +398,11 @@ export {
|
|
|
378
398
|
EnterpriseType,
|
|
379
399
|
ErrandFulfilment,
|
|
380
400
|
ErrandInvoiceState,
|
|
401
|
+
ErrandRatingStatus,
|
|
402
|
+
ErrandRatingTag,
|
|
381
403
|
ErrandStatus,
|
|
382
404
|
FeePaymentStatus,
|
|
383
405
|
FeeSettlement,
|
|
384
|
-
FuelDueStatus,
|
|
385
406
|
GlobalRoles,
|
|
386
407
|
InvoiceEventType,
|
|
387
408
|
InvoiceGenerationType,
|
|
@@ -396,7 +417,6 @@ export {
|
|
|
396
417
|
PaymentOptions,
|
|
397
418
|
PayoutPeriodType,
|
|
398
419
|
PayoutRateSource,
|
|
399
|
-
PortalStatus,
|
|
400
420
|
RemittanceStatus,
|
|
401
421
|
RiderPayoutStatus,
|
|
402
422
|
RoleType,
|
|
@@ -409,5 +429,8 @@ export {
|
|
|
409
429
|
WhatsappRecipient,
|
|
410
430
|
WhatsappTemplateMetaStatus,
|
|
411
431
|
WhatsappTemplateParamSource,
|
|
412
|
-
|
|
432
|
+
badRatingTags,
|
|
433
|
+
errandTimeline,
|
|
434
|
+
goodRatingTags,
|
|
435
|
+
minRatingsForAverage
|
|
413
436
|
};
|
package/package.json
CHANGED
package/src/business.ts
CHANGED
|
@@ -279,16 +279,6 @@ export interface BusinessModules {
|
|
|
279
279
|
/** Every module key, so a plan map can be checked for completeness. */
|
|
280
280
|
export type BusinessModuleKey = keyof BusinessModules;
|
|
281
281
|
|
|
282
|
-
/**
|
|
283
|
-
* How a business funds fuel. `revenuePercent` is the share of errand revenue a
|
|
284
|
-
* vehicle sets aside for its own fuel — the single knob behind the fuel-owed
|
|
285
|
-
* balance. `null` (the default) means the business hasn't configured it and the
|
|
286
|
-
* balance is not computed at all.
|
|
287
|
-
*/
|
|
288
|
-
export interface BusinessFuelSettings {
|
|
289
|
-
revenuePercent: number | null;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
282
|
/**
|
|
293
283
|
* How a business pays its riders. `defaultPercentage` is the share of the
|
|
294
284
|
* errand fees a rider earned that the rider takes home, used for every rider
|
|
@@ -324,14 +314,9 @@ export interface BusinessSettings {
|
|
|
324
314
|
tiktok: string | null;
|
|
325
315
|
website: string | null;
|
|
326
316
|
};
|
|
327
|
-
fuel?: BusinessFuelSettings;
|
|
328
317
|
riderPay?: BusinessRiderPaySettings;
|
|
329
318
|
}
|
|
330
319
|
|
|
331
|
-
export const DEFAULT_BUSINESS_FUEL_SETTINGS: BusinessFuelSettings = {
|
|
332
|
-
revenuePercent: null,
|
|
333
|
-
};
|
|
334
|
-
|
|
335
320
|
export const DEFAULT_BUSINESS_RIDER_PAY_SETTINGS: BusinessRiderPaySettings = {
|
|
336
321
|
defaultPercentage: null,
|
|
337
322
|
periodType: null,
|
|
@@ -360,7 +345,6 @@ export const DEFAULT_BUSINESS_SETTINGS: BusinessSettings = {
|
|
|
360
345
|
tiktok: null,
|
|
361
346
|
website: null,
|
|
362
347
|
},
|
|
363
|
-
fuel: DEFAULT_BUSINESS_FUEL_SETTINGS,
|
|
364
348
|
riderPay: DEFAULT_BUSINESS_RIDER_PAY_SETTINGS,
|
|
365
349
|
};
|
|
366
350
|
|
package/src/customer.ts
CHANGED
package/src/errand.ts
CHANGED
|
@@ -177,7 +177,6 @@ export interface Errand {
|
|
|
177
177
|
aliasId: string;
|
|
178
178
|
updatedAt: Date;
|
|
179
179
|
createdAt: Date;
|
|
180
|
-
errandRating?: string | ErrandRating;
|
|
181
180
|
additionalData?: string;
|
|
182
181
|
deliveryDate?: Date;
|
|
183
182
|
cityId?: City;
|
|
@@ -258,11 +257,15 @@ type PublicBusiness = Pick<
|
|
|
258
257
|
Business,
|
|
259
258
|
'id' | 'name' | 'logoUrl' | 'officeNumber'
|
|
260
259
|
>;
|
|
261
|
-
type PublicPlace = Pick<
|
|
260
|
+
type PublicPlace = Pick<
|
|
261
|
+
AddressDetails,
|
|
262
|
+
'fullName' | 'address' | 'landmark' | 'location'
|
|
263
|
+
>;
|
|
262
264
|
|
|
263
265
|
/**
|
|
264
|
-
* `GET /errands/:alias/tracking`, which
|
|
265
|
-
* cut down to what a tracking page shows: same
|
|
266
|
+
* `GET /errands/:alias/tracking` and `GET /errands/track/:code`, which need no
|
|
267
|
+
* login. An `AggregatedErrand` cut down to what a tracking page shows: same
|
|
268
|
+
* field names, fewer fields.
|
|
266
269
|
*/
|
|
267
270
|
export type PublicTrackedErrand = Pick<
|
|
268
271
|
AggregatedErrand,
|
|
@@ -300,18 +303,6 @@ export interface ErrandTimeline {
|
|
|
300
303
|
createdAt: Date;
|
|
301
304
|
}
|
|
302
305
|
|
|
303
|
-
export interface ErrandRating {
|
|
304
|
-
createdAt: string;
|
|
305
|
-
errandId: string;
|
|
306
|
-
rating: number;
|
|
307
|
-
ratingText: string;
|
|
308
|
-
riderId: string;
|
|
309
|
-
updatedAt: string;
|
|
310
|
-
userId: string;
|
|
311
|
-
version: number;
|
|
312
|
-
_id: string;
|
|
313
|
-
}
|
|
314
|
-
|
|
315
306
|
export enum AddressTypes {
|
|
316
307
|
DeliveryAddress = 'deliveryAddress',
|
|
317
308
|
PickupAddress = 'pickupAddress',
|
|
@@ -343,27 +334,19 @@ export type AddressDetails = {
|
|
|
343
334
|
cityId: string;
|
|
344
335
|
address: string;
|
|
345
336
|
fullName: string;
|
|
346
|
-
|
|
337
|
+
/** GeoJSON point, `[longitude, latitude]`. Absent when the stop has no coordinates. */
|
|
338
|
+
location?: {
|
|
339
|
+
type: 'Point';
|
|
347
340
|
coordinates: number[];
|
|
348
341
|
};
|
|
349
342
|
mobileNumber?: string;
|
|
350
343
|
alternateMobileNumber?: string;
|
|
351
344
|
landmark?: string;
|
|
352
345
|
addressId?: string;
|
|
346
|
+
/** The saved customer this stop came from. */
|
|
347
|
+
customerId?: string;
|
|
353
348
|
};
|
|
354
349
|
|
|
355
|
-
export interface ErrandReviewLink {
|
|
356
|
-
id: string;
|
|
357
|
-
errandId: string;
|
|
358
|
-
phoneNumber: string;
|
|
359
|
-
token: string;
|
|
360
|
-
expiresAt: string;
|
|
361
|
-
isUsed: boolean;
|
|
362
|
-
usedAt: string;
|
|
363
|
-
createdBy: string;
|
|
364
|
-
createdAt: string;
|
|
365
|
-
}
|
|
366
|
-
|
|
367
350
|
export enum DraftErrandStatus {
|
|
368
351
|
Draft = 'draft',
|
|
369
352
|
RiderCompleted = 'rider_completed',
|
|
@@ -405,25 +388,3 @@ export interface DraftErrand {
|
|
|
405
388
|
riderDetails?: Rider;
|
|
406
389
|
riderUserDetails?: User | null;
|
|
407
390
|
}
|
|
408
|
-
|
|
409
|
-
export type ErrandDeliveryTiming = 'early' | 'on_time' | 'late';
|
|
410
|
-
export type ErrandPackagingQuality = 'excellent' | 'average' | 'poor';
|
|
411
|
-
export type ErrandRiderBehavior =
|
|
412
|
-
| 'outstanding'
|
|
413
|
-
| 'acceptable'
|
|
414
|
-
| 'unsatisfactory';
|
|
415
|
-
|
|
416
|
-
export interface ErrandReview {
|
|
417
|
-
id: string;
|
|
418
|
-
errandId: string;
|
|
419
|
-
riderId: string;
|
|
420
|
-
reviewText: string;
|
|
421
|
-
rating: number;
|
|
422
|
-
deliveryTiming: ErrandDeliveryTiming;
|
|
423
|
-
packagingQuality: ErrandPackagingQuality;
|
|
424
|
-
riderBehavior: ErrandRiderBehavior;
|
|
425
|
-
reviewerMobile: string;
|
|
426
|
-
reviewerType: 'creator' | 'recipient';
|
|
427
|
-
createdAt: string;
|
|
428
|
-
updatedAt: string;
|
|
429
|
-
}
|
package/src/index.ts
CHANGED
|
@@ -37,7 +37,6 @@ export * from './transaction';
|
|
|
37
37
|
export * from './stat';
|
|
38
38
|
export * from './maintenance';
|
|
39
39
|
export * from './whatsapp';
|
|
40
|
-
export * from './portal';
|
|
41
|
-
export * from './platform';
|
|
42
40
|
export * from './tracker';
|
|
43
41
|
export * from './integration';
|
|
42
|
+
export * from './rating';
|
package/src/invoice.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Business } from './business';
|
|
1
2
|
import { Customer } from './customer';
|
|
2
3
|
import { Errand } from './errand';
|
|
3
4
|
|
|
@@ -44,6 +45,7 @@ export enum InvoiceEventType {
|
|
|
44
45
|
PaymentReversed = 'payment_reversed',
|
|
45
46
|
PaymentUpdated = 'payment_updated',
|
|
46
47
|
StatusChanged = 'status_changed',
|
|
48
|
+
ErrandSettlementChanged = 'errand_settlement_changed',
|
|
47
49
|
Viewed = 'viewed',
|
|
48
50
|
}
|
|
49
51
|
|
|
@@ -64,6 +66,7 @@ export interface InvoicePayment {
|
|
|
64
66
|
method?: InvoicePaymentMethod | `${InvoicePaymentMethod}`;
|
|
65
67
|
reference?: string;
|
|
66
68
|
note?: string;
|
|
69
|
+
errandId?: string;
|
|
67
70
|
recordedBy: string;
|
|
68
71
|
reversedAt?: string;
|
|
69
72
|
reversedBy?: string;
|
|
@@ -132,6 +135,8 @@ export interface Invoice {
|
|
|
132
135
|
updatedAt: string;
|
|
133
136
|
|
|
134
137
|
customerDetails?: Customer;
|
|
138
|
+
/** The issuing courier, on the received list and on detail. */
|
|
139
|
+
courierBusiness?: Pick<Business, 'name' | 'logoUrl' | 'officeNumber'>;
|
|
135
140
|
paidErrandsCount?: number;
|
|
136
141
|
unpaidErrandsCount?: number;
|
|
137
142
|
}
|
package/src/rating.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { PublicTrackedErrand } from './errand';
|
|
2
|
+
|
|
3
|
+
export enum ErrandRatingTag {
|
|
4
|
+
OnTime = 'on-time',
|
|
5
|
+
CalledBeforeArriving = 'called-before-arriving',
|
|
6
|
+
Polite = 'polite',
|
|
7
|
+
ItemInGoodShape = 'item-in-good-shape',
|
|
8
|
+
FollowedDirections = 'followed-directions',
|
|
9
|
+
Late = 'late',
|
|
10
|
+
DidNotCall = 'did-not-call',
|
|
11
|
+
Rude = 'rude',
|
|
12
|
+
ItemDamaged = 'item-damaged',
|
|
13
|
+
HardToFindMe = 'hard-to-find-me',
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const goodRatingTags = [
|
|
17
|
+
ErrandRatingTag.OnTime,
|
|
18
|
+
ErrandRatingTag.CalledBeforeArriving,
|
|
19
|
+
ErrandRatingTag.Polite,
|
|
20
|
+
ErrandRatingTag.ItemInGoodShape,
|
|
21
|
+
ErrandRatingTag.FollowedDirections,
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
export const badRatingTags = [
|
|
25
|
+
ErrandRatingTag.Late,
|
|
26
|
+
ErrandRatingTag.DidNotCall,
|
|
27
|
+
ErrandRatingTag.Rude,
|
|
28
|
+
ErrandRatingTag.ItemDamaged,
|
|
29
|
+
ErrandRatingTag.HardToFindMe,
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
export enum ErrandRatingStatus {
|
|
33
|
+
Visible = 'visible',
|
|
34
|
+
Hidden = 'hidden',
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface PublicErrandRating {
|
|
38
|
+
stars: number;
|
|
39
|
+
tags: ErrandRatingTag[];
|
|
40
|
+
comment: string | null;
|
|
41
|
+
editableUntil: Date;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export type PublicTrackedErrandWithRating = PublicTrackedErrand & {
|
|
45
|
+
canRate: boolean;
|
|
46
|
+
rating: PublicErrandRating | null;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export interface ErrandRating {
|
|
50
|
+
id: string;
|
|
51
|
+
errandId: string;
|
|
52
|
+
errandDetails?: { aliasId: string };
|
|
53
|
+
businessId: string;
|
|
54
|
+
riderId: string | null;
|
|
55
|
+
stars: number;
|
|
56
|
+
tags: ErrandRatingTag[];
|
|
57
|
+
comment: string | null;
|
|
58
|
+
editCount: number;
|
|
59
|
+
status: ErrandRatingStatus;
|
|
60
|
+
hiddenAt?: Date;
|
|
61
|
+
hiddenBy?: string;
|
|
62
|
+
hiddenReason?: string;
|
|
63
|
+
createdAt: Date;
|
|
64
|
+
updatedAt: Date;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface RiderRatingSummary {
|
|
68
|
+
count: number;
|
|
69
|
+
average: number | null;
|
|
70
|
+
tags: Partial<Record<ErrandRatingTag, number>>;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export const minRatingsForAverage = 10;
|
package/src/vehicle.ts
CHANGED
|
@@ -109,103 +109,3 @@ export interface VehiclePerformanceData {
|
|
|
109
109
|
filters: VehiclePerformanceFilters;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
// Fuel Due Types
|
|
113
|
-
//
|
|
114
|
-
// These answer "which vehicles are due for fuel" without anyone counting
|
|
115
|
-
// errands by hand. Errands generate fuel money at the business's
|
|
116
|
-
// `settings.fuel.revenuePercent`; logged refuels spend it. The difference is
|
|
117
|
-
// `fuelDue`, and `fuelUsedPercent` reads it back as a fuel gauge — 0 freshly
|
|
118
|
-
// filled, 100 due, beyond that overdue.
|
|
119
|
-
|
|
120
|
-
export enum FuelDueStatus {
|
|
121
|
-
/** Worked through the fuel it was last given. Fuel this one. */
|
|
122
|
-
Due = 'DUE',
|
|
123
|
-
/** Still running on fuel already paid for. Leave it. */
|
|
124
|
-
Ok = 'OK',
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/** What the vehicle has done since the fuel it was last given. */
|
|
128
|
-
export interface FuelSinceLastRefuel {
|
|
129
|
-
revenue: number;
|
|
130
|
-
errandCount: number;
|
|
131
|
-
fuelEarned: number;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
export interface FuelDueItem {
|
|
135
|
-
vehicleId: string;
|
|
136
|
-
vehicleNumber: string;
|
|
137
|
-
shortName: string | null;
|
|
138
|
-
vehicleType: VehicleType | `${VehicleType}`;
|
|
139
|
-
/**
|
|
140
|
-
* The fuel gauge, and the field to lead a UI with: how much of the fuel this
|
|
141
|
-
* vehicle was last given it has worked through. 0 is freshly filled, 100 is
|
|
142
|
-
* due, past 100 is overdue. Null when it has never been fuelled.
|
|
143
|
-
*/
|
|
144
|
-
fuelUsedPercent: number | null;
|
|
145
|
-
/** `fuelEarned - fuelSpent`, in naira — how much to give, not whether to. */
|
|
146
|
-
fuelDue: number;
|
|
147
|
-
fuelEarned: number;
|
|
148
|
-
fuelSpent: number;
|
|
149
|
-
revenue: number;
|
|
150
|
-
errandCount: number;
|
|
151
|
-
refuelCount: number;
|
|
152
|
-
/** What this vehicle is typically fuelled with; null if never fuelled. */
|
|
153
|
-
averageRefuelCost: number | null;
|
|
154
|
-
/**
|
|
155
|
-
* The figure has drifted far past what this vehicle is ever fuelled with —
|
|
156
|
-
* the signature of a wrong `revenuePercent` compounding rather than a real
|
|
157
|
-
* fuel need. Prompt to check the percentage instead of showing the figure.
|
|
158
|
-
*/
|
|
159
|
-
needsCalibration: boolean;
|
|
160
|
-
lastRefuel: { at: string; cost: number } | null;
|
|
161
|
-
sinceLastRefuel: FuelSinceLastRefuel | null;
|
|
162
|
-
dueStatus: FuelDueStatus | `${FuelDueStatus}`;
|
|
163
|
-
/** Counting starts here when the prediction has been reset; null otherwise. */
|
|
164
|
-
countingFrom: string | null;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
export interface FuelDueTotals {
|
|
168
|
-
totalDue: number;
|
|
169
|
-
totalEarned: number;
|
|
170
|
-
totalSpent: number;
|
|
171
|
-
vehiclesDue: number;
|
|
172
|
-
vehiclesNeedingCalibration: number;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
export interface FuelDueData {
|
|
176
|
-
/** False when the business has not set `settings.fuel.revenuePercent`. */
|
|
177
|
-
configured: boolean;
|
|
178
|
-
revenuePercent: number | null;
|
|
179
|
-
/** Only when `configured` is false: what history says the percent should be. */
|
|
180
|
-
suggestedPercent?: number | null;
|
|
181
|
-
vehicles: FuelDueItem[];
|
|
182
|
-
totals: FuelDueTotals;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
export type FuelSuggestionConfidence = 'low' | 'medium' | 'high';
|
|
186
|
-
|
|
187
|
-
export interface FuelPercentSuggestion {
|
|
188
|
-
/**
|
|
189
|
-
* Fuel spend as a share of the revenue that earned it, to one decimal —
|
|
190
|
-
* the percentage this business has actually been running at. Null when
|
|
191
|
-
* there is too little history; `reason` says which.
|
|
192
|
-
*/
|
|
193
|
-
suggestedPercent: number | null;
|
|
194
|
-
/**
|
|
195
|
-
* Read off the number of refuels behind the suggestion, not the length of
|
|
196
|
-
* the window. Fuel bought near a window's edge is burnt outside it, so a
|
|
197
|
-
* thin refuel count gives a volatile ratio however many days were read.
|
|
198
|
-
*/
|
|
199
|
-
confidence: FuelSuggestionConfidence;
|
|
200
|
-
reason: string | null;
|
|
201
|
-
days: number;
|
|
202
|
-
basedOn: {
|
|
203
|
-
totalFuelCost: number;
|
|
204
|
-
totalRevenue: number;
|
|
205
|
-
refuelCount: number;
|
|
206
|
-
errandCount: number;
|
|
207
|
-
refuelledVehicles: number;
|
|
208
|
-
/** Refuels per vehicle — what says whether the ratio has settled. */
|
|
209
|
-
refuelsPerVehicle: number | null;
|
|
210
|
-
};
|
|
211
|
-
}
|
package/src/whatsapp.ts
CHANGED
|
@@ -36,6 +36,7 @@ export enum WhatsappButtonType {
|
|
|
36
36
|
|
|
37
37
|
export enum WhatsappTemplateParamSource {
|
|
38
38
|
ERRAND_ALIAS_ID = 'errand.aliasId',
|
|
39
|
+
ERRAND_TRACKING_CODE = 'errand.trackingCode',
|
|
39
40
|
ERRAND_PICKUP_NAME = 'errand.pickupDetails.fullName',
|
|
40
41
|
ERRAND_DELIVERY_NAME = 'errand.deliveryDetails.fullName',
|
|
41
42
|
BUSINESS_NAME = 'business.name',
|
package/src/platform.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Platform-wide suggestions for businesses that haven't set their own values.
|
|
3
|
-
* Prefill forms only — e.g. `business.settings.fuel?.revenuePercent ??
|
|
4
|
-
* platform.fuel.revenuePercent`. Never applied to a business's calculations.
|
|
5
|
-
*/
|
|
6
|
-
export interface PlatformSettings {
|
|
7
|
-
fuel: {
|
|
8
|
-
/** Current pump price per litre, for prefilling refuel logs. */
|
|
9
|
-
pumpPrice: number | null;
|
|
10
|
-
revenuePercent: number | null;
|
|
11
|
-
};
|
|
12
|
-
riderPay: {
|
|
13
|
-
defaultPercentage: number | null;
|
|
14
|
-
};
|
|
15
|
-
createdAt: string;
|
|
16
|
-
updatedAt: string;
|
|
17
|
-
}
|
package/src/portal.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
export enum PortalStatus {
|
|
2
|
-
Draft = 'draft',
|
|
3
|
-
Published = 'published',
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export interface BusinessPortal {
|
|
7
|
-
id: string;
|
|
8
|
-
businessId: string;
|
|
9
|
-
/** Compose the URL yourself, e.g. `https://mydoormot.io/b/${handle}`. */
|
|
10
|
-
handle: string;
|
|
11
|
-
previousHandles: string[];
|
|
12
|
-
status: PortalStatus;
|
|
13
|
-
publishedAt?: string;
|
|
14
|
-
createdAt: string;
|
|
15
|
-
updatedAt: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface PublicPortalBusiness {
|
|
19
|
-
name?: string;
|
|
20
|
-
description?: string;
|
|
21
|
-
officeNumber?: string;
|
|
22
|
-
address?: string;
|
|
23
|
-
logoUrl?: string;
|
|
24
|
-
logoBlurHash?: string;
|
|
25
|
-
coverImageUrl?: string;
|
|
26
|
-
coverImageBlurHash?: string;
|
|
27
|
-
isOnline?: boolean;
|
|
28
|
-
openingHours?: Record<string, unknown>;
|
|
29
|
-
socialLinks?: Record<string, unknown>;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/** `GET /api/v2/portals/:handle` — unauthenticated. */
|
|
33
|
-
export interface PublicPortal {
|
|
34
|
-
handle: string;
|
|
35
|
-
/** Set when the requested handle was retired — redirect to `handle`. */
|
|
36
|
-
redirectedFrom?: string;
|
|
37
|
-
business: PublicPortalBusiness;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/** `GET /api/v2/portals/handles/:handle` — unauthenticated. */
|
|
41
|
-
export interface PortalHandleAvailability {
|
|
42
|
-
/** Normalised — what you would actually be assigned. */
|
|
43
|
-
handle: string;
|
|
44
|
-
available: boolean;
|
|
45
|
-
reason?: string;
|
|
46
|
-
}
|