@mydoormot/app-types 1.7.37 → 1.7.39
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 +93 -0
- package/dist/index.d.cts +145 -1
- package/dist/index.d.ts +145 -1
- package/dist/index.js +85 -0
- package/package.json +3 -2
- package/src/business.ts +80 -1
- package/src/errand.ts +23 -0
- package/src/index.ts +1 -0
- package/src/whatsapp.ts +108 -0
- package/tsconfig.json +1 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @mydoormot/app-types@1.7.
|
|
2
|
+
> @mydoormot/app-types@1.7.38 build /Users/chuksben/Desktop/projects/microservices/mydoormot/packages/app-types
|
|
3
3
|
> tsup src/index.ts --format esm,cjs --dts
|
|
4
4
|
|
|
5
5
|
CLI Building entry: src/index.ts
|
|
@@ -8,11 +8,11 @@ CLI tsup v7.3.0
|
|
|
8
8
|
CLI Target: es2021
|
|
9
9
|
ESM Build start
|
|
10
10
|
CJS Build start
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
CJS dist/index.cjs 13.20 KB
|
|
12
|
+
CJS ⚡️ Build success in 66ms
|
|
13
|
+
ESM dist/index.js 10.83 KB
|
|
14
|
+
ESM ⚡️ Build success in 67ms
|
|
15
15
|
DTS Build start
|
|
16
|
-
DTS ⚡️ Build success in
|
|
17
|
-
DTS dist/index.d.ts
|
|
18
|
-
DTS dist/index.d.cts
|
|
16
|
+
DTS ⚡️ Build success in 694ms
|
|
17
|
+
DTS dist/index.d.ts 33.77 KB
|
|
18
|
+
DTS dist/index.d.cts 33.77 KB
|
package/CHANGELOG.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -25,6 +25,8 @@ __export(src_exports, {
|
|
|
25
25
|
BusinessCapability: () => BusinessCapability,
|
|
26
26
|
BusinessRole: () => BusinessRole,
|
|
27
27
|
BusinessStatus: () => BusinessStatus,
|
|
28
|
+
DEFAULT_BUSINESS_MODULES: () => DEFAULT_BUSINESS_MODULES,
|
|
29
|
+
DEFAULT_BUSINESS_SETTINGS: () => DEFAULT_BUSINESS_SETTINGS,
|
|
28
30
|
DeliveryStatus: () => DeliveryStatus,
|
|
29
31
|
DraftErrandStatus: () => DraftErrandStatus,
|
|
30
32
|
EnterpriseType: () => EnterpriseType,
|
|
@@ -44,6 +46,12 @@ __export(src_exports, {
|
|
|
44
46
|
TraccarDeviceStatus: () => TraccarDeviceStatus,
|
|
45
47
|
VehicleLogType: () => VehicleLogType,
|
|
46
48
|
VehicleType: () => VehicleType,
|
|
49
|
+
WhatsappButtonType: () => WhatsappButtonType,
|
|
50
|
+
WhatsappComponentType: () => WhatsappComponentType,
|
|
51
|
+
WhatsappEvent: () => WhatsappEvent,
|
|
52
|
+
WhatsappRecipient: () => WhatsappRecipient,
|
|
53
|
+
WhatsappTemplateMetaStatus: () => WhatsappTemplateMetaStatus,
|
|
54
|
+
WhatsappTemplateParamSource: () => WhatsappTemplateParamSource,
|
|
47
55
|
errandTimeline: () => errandTimeline
|
|
48
56
|
});
|
|
49
57
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -232,6 +240,39 @@ var MembershipStatus = /* @__PURE__ */ ((MembershipStatus2) => {
|
|
|
232
240
|
MembershipStatus2["SUSPENDED"] = "SUSPENDED";
|
|
233
241
|
return MembershipStatus2;
|
|
234
242
|
})(MembershipStatus || {});
|
|
243
|
+
var DEFAULT_BUSINESS_MODULES = {
|
|
244
|
+
draftErrands: true,
|
|
245
|
+
team: true,
|
|
246
|
+
maintenance: true,
|
|
247
|
+
fuelLogs: true,
|
|
248
|
+
invoices: true,
|
|
249
|
+
remittances: true
|
|
250
|
+
};
|
|
251
|
+
var DEFAULT_BUSINESS_SETTINGS = {
|
|
252
|
+
whatsapp_notification_enabled: true,
|
|
253
|
+
whatsapp: {
|
|
254
|
+
enabled: false,
|
|
255
|
+
templates: {}
|
|
256
|
+
},
|
|
257
|
+
is_online: true,
|
|
258
|
+
opening_hours: {
|
|
259
|
+
monday: { open: "09:00", close: "17:00" },
|
|
260
|
+
tuesday: { open: "09:00", close: "17:00" },
|
|
261
|
+
wednesday: { open: "09:00", close: "17:00" },
|
|
262
|
+
thursday: { open: "09:00", close: "17:00" },
|
|
263
|
+
friday: { open: "09:00", close: "17:00" },
|
|
264
|
+
saturday: null,
|
|
265
|
+
sunday: null
|
|
266
|
+
},
|
|
267
|
+
social_links: {
|
|
268
|
+
instagram: null,
|
|
269
|
+
facebook: null,
|
|
270
|
+
twitter: null,
|
|
271
|
+
tiktok: null,
|
|
272
|
+
website: null
|
|
273
|
+
},
|
|
274
|
+
modules: DEFAULT_BUSINESS_MODULES
|
|
275
|
+
};
|
|
235
276
|
|
|
236
277
|
// src/tracker.ts
|
|
237
278
|
var TraccarDeviceStatus = /* @__PURE__ */ ((TraccarDeviceStatus2) => {
|
|
@@ -241,6 +282,50 @@ var TraccarDeviceStatus = /* @__PURE__ */ ((TraccarDeviceStatus2) => {
|
|
|
241
282
|
return TraccarDeviceStatus2;
|
|
242
283
|
})(TraccarDeviceStatus || {});
|
|
243
284
|
|
|
285
|
+
// src/whatsapp.ts
|
|
286
|
+
var WhatsappEvent = /* @__PURE__ */ ((WhatsappEvent2) => {
|
|
287
|
+
WhatsappEvent2["ERRAND_CREATED"] = "errand.created";
|
|
288
|
+
WhatsappEvent2["ERRAND_RIDER_ASSIGNED"] = "errand.rider.assigned";
|
|
289
|
+
WhatsappEvent2["ERRAND_PICKED_UP"] = "errand.picked.up";
|
|
290
|
+
WhatsappEvent2["ERRAND_DELIVERED"] = "errand.delivered";
|
|
291
|
+
WhatsappEvent2["ERRAND_CANCELLED"] = "errand.cancelled";
|
|
292
|
+
return WhatsappEvent2;
|
|
293
|
+
})(WhatsappEvent || {});
|
|
294
|
+
var WhatsappRecipient = /* @__PURE__ */ ((WhatsappRecipient2) => {
|
|
295
|
+
WhatsappRecipient2["BUSINESS"] = "business";
|
|
296
|
+
WhatsappRecipient2["CUSTOMER"] = "customer";
|
|
297
|
+
return WhatsappRecipient2;
|
|
298
|
+
})(WhatsappRecipient || {});
|
|
299
|
+
var WhatsappTemplateMetaStatus = /* @__PURE__ */ ((WhatsappTemplateMetaStatus2) => {
|
|
300
|
+
WhatsappTemplateMetaStatus2["APPROVED"] = "APPROVED";
|
|
301
|
+
WhatsappTemplateMetaStatus2["PENDING"] = "PENDING";
|
|
302
|
+
WhatsappTemplateMetaStatus2["REJECTED"] = "REJECTED";
|
|
303
|
+
WhatsappTemplateMetaStatus2["PAUSED"] = "PAUSED";
|
|
304
|
+
WhatsappTemplateMetaStatus2["DISABLED"] = "DISABLED";
|
|
305
|
+
return WhatsappTemplateMetaStatus2;
|
|
306
|
+
})(WhatsappTemplateMetaStatus || {});
|
|
307
|
+
var WhatsappComponentType = /* @__PURE__ */ ((WhatsappComponentType2) => {
|
|
308
|
+
WhatsappComponentType2["BODY"] = "BODY";
|
|
309
|
+
WhatsappComponentType2["HEADER"] = "HEADER";
|
|
310
|
+
WhatsappComponentType2["FOOTER"] = "FOOTER";
|
|
311
|
+
WhatsappComponentType2["BUTTONS"] = "BUTTONS";
|
|
312
|
+
return WhatsappComponentType2;
|
|
313
|
+
})(WhatsappComponentType || {});
|
|
314
|
+
var WhatsappButtonType = /* @__PURE__ */ ((WhatsappButtonType2) => {
|
|
315
|
+
WhatsappButtonType2["URL"] = "URL";
|
|
316
|
+
WhatsappButtonType2["QUICK_REPLY"] = "QUICK_REPLY";
|
|
317
|
+
WhatsappButtonType2["PHONE_NUMBER"] = "PHONE_NUMBER";
|
|
318
|
+
return WhatsappButtonType2;
|
|
319
|
+
})(WhatsappButtonType || {});
|
|
320
|
+
var WhatsappTemplateParamSource = /* @__PURE__ */ ((WhatsappTemplateParamSource2) => {
|
|
321
|
+
WhatsappTemplateParamSource2["ERRAND_ALIAS_ID"] = "errand.aliasId";
|
|
322
|
+
WhatsappTemplateParamSource2["ERRAND_PICKUP_NAME"] = "errand.pickupDetails.fullName";
|
|
323
|
+
WhatsappTemplateParamSource2["ERRAND_DELIVERY_NAME"] = "errand.deliveryDetails.fullName";
|
|
324
|
+
WhatsappTemplateParamSource2["BUSINESS_NAME"] = "business.name";
|
|
325
|
+
WhatsappTemplateParamSource2["COURIER_BUSINESS_NAME"] = "courierBusiness.name";
|
|
326
|
+
return WhatsappTemplateParamSource2;
|
|
327
|
+
})(WhatsappTemplateParamSource || {});
|
|
328
|
+
|
|
244
329
|
// src/index.ts
|
|
245
330
|
var LinkDestination = /* @__PURE__ */ ((LinkDestination2) => {
|
|
246
331
|
LinkDestination2["Website"] = "web";
|
|
@@ -255,6 +340,8 @@ var LinkDestination = /* @__PURE__ */ ((LinkDestination2) => {
|
|
|
255
340
|
BusinessCapability,
|
|
256
341
|
BusinessRole,
|
|
257
342
|
BusinessStatus,
|
|
343
|
+
DEFAULT_BUSINESS_MODULES,
|
|
344
|
+
DEFAULT_BUSINESS_SETTINGS,
|
|
258
345
|
DeliveryStatus,
|
|
259
346
|
DraftErrandStatus,
|
|
260
347
|
EnterpriseType,
|
|
@@ -274,5 +361,11 @@ var LinkDestination = /* @__PURE__ */ ((LinkDestination2) => {
|
|
|
274
361
|
TraccarDeviceStatus,
|
|
275
362
|
VehicleLogType,
|
|
276
363
|
VehicleType,
|
|
364
|
+
WhatsappButtonType,
|
|
365
|
+
WhatsappComponentType,
|
|
366
|
+
WhatsappEvent,
|
|
367
|
+
WhatsappRecipient,
|
|
368
|
+
WhatsappTemplateMetaStatus,
|
|
369
|
+
WhatsappTemplateParamSource,
|
|
277
370
|
errandTimeline
|
|
278
371
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -223,6 +223,7 @@ interface Business {
|
|
|
223
223
|
disabledAt: string | NullOrUndefined | Date;
|
|
224
224
|
disabledBy: string | NullOrUndefined;
|
|
225
225
|
disabledReason: string | NullOrUndefined;
|
|
226
|
+
settings: BusinessSettings | NullOrUndefined;
|
|
226
227
|
}
|
|
227
228
|
interface BusinessPg extends Business {
|
|
228
229
|
pgId: any;
|
|
@@ -253,6 +254,47 @@ declare enum MembershipStatus {
|
|
|
253
254
|
PENDING_ACTIVATION = "PENDING_ACTIVATION",
|
|
254
255
|
SUSPENDED = "SUSPENDED"
|
|
255
256
|
}
|
|
257
|
+
interface OpeningHours {
|
|
258
|
+
open: string;
|
|
259
|
+
close: string;
|
|
260
|
+
}
|
|
261
|
+
interface BusinessModules {
|
|
262
|
+
draftErrands: boolean;
|
|
263
|
+
team: boolean;
|
|
264
|
+
maintenance: boolean;
|
|
265
|
+
fuelLogs: boolean;
|
|
266
|
+
invoices: boolean;
|
|
267
|
+
remittances: boolean;
|
|
268
|
+
}
|
|
269
|
+
interface BusinessSettings {
|
|
270
|
+
whatsapp_notification_enabled: boolean;
|
|
271
|
+
whatsapp: BusinessWhatsappConfig;
|
|
272
|
+
is_online: boolean;
|
|
273
|
+
opening_hours: {
|
|
274
|
+
monday: OpeningHours | null;
|
|
275
|
+
tuesday: OpeningHours | null;
|
|
276
|
+
wednesday: OpeningHours | null;
|
|
277
|
+
thursday: OpeningHours | null;
|
|
278
|
+
friday: OpeningHours | null;
|
|
279
|
+
saturday: OpeningHours | null;
|
|
280
|
+
sunday: OpeningHours | null;
|
|
281
|
+
};
|
|
282
|
+
social_links: {
|
|
283
|
+
instagram: string | null;
|
|
284
|
+
facebook: string | null;
|
|
285
|
+
twitter: string | null;
|
|
286
|
+
tiktok: string | null;
|
|
287
|
+
website: string | null;
|
|
288
|
+
};
|
|
289
|
+
limits?: {
|
|
290
|
+
maxRiders: number | null;
|
|
291
|
+
maxVehicles: number | null;
|
|
292
|
+
maxErrands: number | null;
|
|
293
|
+
};
|
|
294
|
+
modules: BusinessModules;
|
|
295
|
+
}
|
|
296
|
+
declare const DEFAULT_BUSINESS_MODULES: BusinessModules;
|
|
297
|
+
declare const DEFAULT_BUSINESS_SETTINGS: BusinessSettings;
|
|
256
298
|
interface BusinessMember {
|
|
257
299
|
id: string;
|
|
258
300
|
userId: string;
|
|
@@ -532,6 +574,21 @@ interface Errand {
|
|
|
532
574
|
businessDetails?: Business;
|
|
533
575
|
userDetails?: User;
|
|
534
576
|
courierBusinessDetails?: Business;
|
|
577
|
+
scheduleDate?: Date;
|
|
578
|
+
scheduleTime?: Date;
|
|
579
|
+
businessCustomerId?: string;
|
|
580
|
+
notify?: boolean | null;
|
|
581
|
+
riderAssignmentNotificationSent?: boolean;
|
|
582
|
+
isDelayed?: boolean;
|
|
583
|
+
delayedAt?: Date;
|
|
584
|
+
wasDeliveredBy?: 'rider' | 'admin' | 'system' | 'business';
|
|
585
|
+
paymentMethod?: 'cash_on_delivery' | 'prepaid_online' | 'prepaid_transfer' | 'business_invoice';
|
|
586
|
+
additionalFees?: Array<{
|
|
587
|
+
description: string;
|
|
588
|
+
amount: number;
|
|
589
|
+
createdAt?: Date;
|
|
590
|
+
createdBy?: string;
|
|
591
|
+
}>;
|
|
535
592
|
riderDetails?: Rider;
|
|
536
593
|
vehicleDetails?: Vehicle;
|
|
537
594
|
}
|
|
@@ -1114,6 +1171,93 @@ interface MaintenanceStats {
|
|
|
1114
1171
|
};
|
|
1115
1172
|
}
|
|
1116
1173
|
|
|
1174
|
+
declare enum WhatsappEvent {
|
|
1175
|
+
ERRAND_CREATED = "errand.created",
|
|
1176
|
+
ERRAND_RIDER_ASSIGNED = "errand.rider.assigned",
|
|
1177
|
+
ERRAND_PICKED_UP = "errand.picked.up",
|
|
1178
|
+
ERRAND_DELIVERED = "errand.delivered",
|
|
1179
|
+
ERRAND_CANCELLED = "errand.cancelled"
|
|
1180
|
+
}
|
|
1181
|
+
declare enum WhatsappRecipient {
|
|
1182
|
+
BUSINESS = "business",
|
|
1183
|
+
CUSTOMER = "customer"
|
|
1184
|
+
}
|
|
1185
|
+
declare enum WhatsappTemplateMetaStatus {
|
|
1186
|
+
APPROVED = "APPROVED",
|
|
1187
|
+
PENDING = "PENDING",
|
|
1188
|
+
REJECTED = "REJECTED",
|
|
1189
|
+
PAUSED = "PAUSED",
|
|
1190
|
+
DISABLED = "DISABLED"
|
|
1191
|
+
}
|
|
1192
|
+
declare enum WhatsappComponentType {
|
|
1193
|
+
BODY = "BODY",
|
|
1194
|
+
HEADER = "HEADER",
|
|
1195
|
+
FOOTER = "FOOTER",
|
|
1196
|
+
BUTTONS = "BUTTONS"
|
|
1197
|
+
}
|
|
1198
|
+
declare enum WhatsappButtonType {
|
|
1199
|
+
URL = "URL",
|
|
1200
|
+
QUICK_REPLY = "QUICK_REPLY",
|
|
1201
|
+
PHONE_NUMBER = "PHONE_NUMBER"
|
|
1202
|
+
}
|
|
1203
|
+
declare enum WhatsappTemplateParamSource {
|
|
1204
|
+
ERRAND_ALIAS_ID = "errand.aliasId",
|
|
1205
|
+
ERRAND_PICKUP_NAME = "errand.pickupDetails.fullName",
|
|
1206
|
+
ERRAND_DELIVERY_NAME = "errand.deliveryDetails.fullName",
|
|
1207
|
+
BUSINESS_NAME = "business.name",
|
|
1208
|
+
COURIER_BUSINESS_NAME = "courierBusiness.name"
|
|
1209
|
+
}
|
|
1210
|
+
interface WhatsappTemplateSource {
|
|
1211
|
+
position: number;
|
|
1212
|
+
value: WhatsappTemplateParamSource | null;
|
|
1213
|
+
example: string | null;
|
|
1214
|
+
}
|
|
1215
|
+
interface WhatsappTemplateButton {
|
|
1216
|
+
type: WhatsappButtonType | string;
|
|
1217
|
+
text?: string;
|
|
1218
|
+
url?: string;
|
|
1219
|
+
sources: WhatsappTemplateSource[];
|
|
1220
|
+
}
|
|
1221
|
+
interface WhatsappTemplateComponent {
|
|
1222
|
+
type: WhatsappComponentType | string;
|
|
1223
|
+
text?: string;
|
|
1224
|
+
buttons?: WhatsappTemplateButton[];
|
|
1225
|
+
sources: WhatsappTemplateSource[];
|
|
1226
|
+
}
|
|
1227
|
+
interface WhatsappTemplate {
|
|
1228
|
+
id: string;
|
|
1229
|
+
metaTemplateId: string;
|
|
1230
|
+
name: string;
|
|
1231
|
+
languageCode: string;
|
|
1232
|
+
metaStatus: WhatsappTemplateMetaStatus;
|
|
1233
|
+
components: WhatsappTemplateComponent[];
|
|
1234
|
+
lastSyncedAt: string | Date | NullOrUndefined;
|
|
1235
|
+
event: WhatsappEvent | null;
|
|
1236
|
+
recipient: WhatsappRecipient | null;
|
|
1237
|
+
isReady: boolean;
|
|
1238
|
+
description: string | NullOrUndefined;
|
|
1239
|
+
createdAt: string | Date;
|
|
1240
|
+
updatedAt: string | Date | NullOrUndefined;
|
|
1241
|
+
}
|
|
1242
|
+
interface BusinessWhatsappConfig {
|
|
1243
|
+
enabled: boolean;
|
|
1244
|
+
templates: Partial<Record<WhatsappEvent, string>>;
|
|
1245
|
+
billSelfForCourierSends?: boolean;
|
|
1246
|
+
}
|
|
1247
|
+
interface WhatsappSendLog {
|
|
1248
|
+
id: string;
|
|
1249
|
+
businessId: string;
|
|
1250
|
+
event: WhatsappEvent;
|
|
1251
|
+
templateId: string;
|
|
1252
|
+
templateName: string;
|
|
1253
|
+
recipient: WhatsappRecipient;
|
|
1254
|
+
toNumber: string;
|
|
1255
|
+
errandId: string | NullOrUndefined;
|
|
1256
|
+
status: 'sent' | 'failed' | 'skipped';
|
|
1257
|
+
error: string | NullOrUndefined;
|
|
1258
|
+
sentAt: string | Date;
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1117
1261
|
interface PaginateResult<T> {
|
|
1118
1262
|
docs: T[];
|
|
1119
1263
|
totalDocs: number;
|
|
@@ -1136,4 +1280,4 @@ declare enum LinkDestination {
|
|
|
1136
1280
|
}
|
|
1137
1281
|
type NullOrUndefined = null | undefined;
|
|
1138
1282
|
|
|
1139
|
-
export { type AddonGroup, type AddonGroupItem, type AddressDetails, AddressTypes, type AggregatedErrand, AuthType, type Business, BusinessCapability, type BusinessCategory, type BusinessMember, type BusinessPg, BusinessRole, BusinessStatus, type City, type Collection, type Coupon, type Customer, type CustomerTransactionStats, DeliveryStatus, type DraftErrand, DraftErrandStatus, type Enterprise, type EnterpriseCategoryDoc, type EnterpriseSubCategoryDoc, EnterpriseType, type Errand, type ErrandDeliveryTiming, type ErrandPackagingQuality, type ErrandRating, type ErrandReview, type ErrandReviewLink, type ErrandRiderBehavior, ErrandStatus, type ErrandTimeline, GlobalRoles, type Invoice, InvoiceGenerationType, type InvoiceItem, InvoiceItemType, InvoiceStatus, type LatLng, LinkDestination, type MaintenanceItem, type MaintenancePartUsage, type MaintenanceRecord, type MaintenanceStats, type MaintenanceStatsSummary, type MaintenanceTopItem, MembershipStatus, type Notification, type NotificationData, NotificationType, type NullOrUndefined, type PaginateResult, ParcelSize, PaymentOptions, type PendingErrand, type Product, type ProductCategory, type ProductImage, type ProductOption, type ProductOptionValue, type ProductStatus, type ProductTag, type ProductVariant, type ProductVariantPrice, RemittanceStatus, type Rider, type RiderPerformanceItem, type RiderPerformanceStats, type RiderPerformanceSummary, type RiderPerformanceTimeSeries, type RiderSettlement, type RiderWithUserDetails, RoleType, SettlementType, type State, type TraccarDevice, TraccarDeviceStatus, type TraccarPosition, type TrackerDevice, type Transaction, type TransactionCategory, type TransactionItem, type TransactionType, type TransactionWithCategory, type TransactionWithJoin, type User, type UserAddress, type Vehicle, type VehicleErrandStats, type VehicleFuelStats, type VehicleLog, type VehicleLogStatsSummary, VehicleLogType, type VehicleLogWithErrands, type VehicleMaintenanceStats, type VehiclePerformanceData, type VehiclePerformanceFilters, type VehiclePerformanceItem, type VehiclePerformanceTotals, VehicleType, type VehicleWithRider, type Vendor, errandTimeline };
|
|
1283
|
+
export { type AddonGroup, type AddonGroupItem, type AddressDetails, AddressTypes, type AggregatedErrand, AuthType, type Business, BusinessCapability, type BusinessCategory, type BusinessMember, type BusinessModules, type BusinessPg, BusinessRole, type BusinessSettings, BusinessStatus, type BusinessWhatsappConfig, type City, type Collection, type Coupon, type Customer, type CustomerTransactionStats, DEFAULT_BUSINESS_MODULES, DEFAULT_BUSINESS_SETTINGS, DeliveryStatus, type DraftErrand, DraftErrandStatus, type Enterprise, type EnterpriseCategoryDoc, type EnterpriseSubCategoryDoc, EnterpriseType, type Errand, type ErrandDeliveryTiming, type ErrandPackagingQuality, type ErrandRating, type ErrandReview, type ErrandReviewLink, type ErrandRiderBehavior, ErrandStatus, type ErrandTimeline, GlobalRoles, type Invoice, InvoiceGenerationType, type InvoiceItem, InvoiceItemType, InvoiceStatus, type LatLng, LinkDestination, type MaintenanceItem, type MaintenancePartUsage, type MaintenanceRecord, type MaintenanceStats, type MaintenanceStatsSummary, type MaintenanceTopItem, MembershipStatus, type Notification, type NotificationData, NotificationType, type NullOrUndefined, type OpeningHours, type PaginateResult, ParcelSize, PaymentOptions, type PendingErrand, type Product, type ProductCategory, type ProductImage, type ProductOption, type ProductOptionValue, type ProductStatus, type ProductTag, type ProductVariant, type ProductVariantPrice, RemittanceStatus, type Rider, type RiderPerformanceItem, type RiderPerformanceStats, type RiderPerformanceSummary, type RiderPerformanceTimeSeries, type RiderSettlement, type RiderWithUserDetails, RoleType, SettlementType, type State, type TraccarDevice, TraccarDeviceStatus, type TraccarPosition, type TrackerDevice, type Transaction, type TransactionCategory, type TransactionItem, type TransactionType, type TransactionWithCategory, type TransactionWithJoin, type User, type UserAddress, type Vehicle, type VehicleErrandStats, type VehicleFuelStats, type VehicleLog, type VehicleLogStatsSummary, VehicleLogType, type VehicleLogWithErrands, type VehicleMaintenanceStats, type VehiclePerformanceData, type VehiclePerformanceFilters, type VehiclePerformanceItem, type VehiclePerformanceTotals, VehicleType, type VehicleWithRider, type Vendor, WhatsappButtonType, WhatsappComponentType, WhatsappEvent, WhatsappRecipient, type WhatsappSendLog, type WhatsappTemplate, type WhatsappTemplateButton, type WhatsappTemplateComponent, WhatsappTemplateMetaStatus, WhatsappTemplateParamSource, type WhatsappTemplateSource, errandTimeline };
|
package/dist/index.d.ts
CHANGED
|
@@ -223,6 +223,7 @@ interface Business {
|
|
|
223
223
|
disabledAt: string | NullOrUndefined | Date;
|
|
224
224
|
disabledBy: string | NullOrUndefined;
|
|
225
225
|
disabledReason: string | NullOrUndefined;
|
|
226
|
+
settings: BusinessSettings | NullOrUndefined;
|
|
226
227
|
}
|
|
227
228
|
interface BusinessPg extends Business {
|
|
228
229
|
pgId: any;
|
|
@@ -253,6 +254,47 @@ declare enum MembershipStatus {
|
|
|
253
254
|
PENDING_ACTIVATION = "PENDING_ACTIVATION",
|
|
254
255
|
SUSPENDED = "SUSPENDED"
|
|
255
256
|
}
|
|
257
|
+
interface OpeningHours {
|
|
258
|
+
open: string;
|
|
259
|
+
close: string;
|
|
260
|
+
}
|
|
261
|
+
interface BusinessModules {
|
|
262
|
+
draftErrands: boolean;
|
|
263
|
+
team: boolean;
|
|
264
|
+
maintenance: boolean;
|
|
265
|
+
fuelLogs: boolean;
|
|
266
|
+
invoices: boolean;
|
|
267
|
+
remittances: boolean;
|
|
268
|
+
}
|
|
269
|
+
interface BusinessSettings {
|
|
270
|
+
whatsapp_notification_enabled: boolean;
|
|
271
|
+
whatsapp: BusinessWhatsappConfig;
|
|
272
|
+
is_online: boolean;
|
|
273
|
+
opening_hours: {
|
|
274
|
+
monday: OpeningHours | null;
|
|
275
|
+
tuesday: OpeningHours | null;
|
|
276
|
+
wednesday: OpeningHours | null;
|
|
277
|
+
thursday: OpeningHours | null;
|
|
278
|
+
friday: OpeningHours | null;
|
|
279
|
+
saturday: OpeningHours | null;
|
|
280
|
+
sunday: OpeningHours | null;
|
|
281
|
+
};
|
|
282
|
+
social_links: {
|
|
283
|
+
instagram: string | null;
|
|
284
|
+
facebook: string | null;
|
|
285
|
+
twitter: string | null;
|
|
286
|
+
tiktok: string | null;
|
|
287
|
+
website: string | null;
|
|
288
|
+
};
|
|
289
|
+
limits?: {
|
|
290
|
+
maxRiders: number | null;
|
|
291
|
+
maxVehicles: number | null;
|
|
292
|
+
maxErrands: number | null;
|
|
293
|
+
};
|
|
294
|
+
modules: BusinessModules;
|
|
295
|
+
}
|
|
296
|
+
declare const DEFAULT_BUSINESS_MODULES: BusinessModules;
|
|
297
|
+
declare const DEFAULT_BUSINESS_SETTINGS: BusinessSettings;
|
|
256
298
|
interface BusinessMember {
|
|
257
299
|
id: string;
|
|
258
300
|
userId: string;
|
|
@@ -532,6 +574,21 @@ interface Errand {
|
|
|
532
574
|
businessDetails?: Business;
|
|
533
575
|
userDetails?: User;
|
|
534
576
|
courierBusinessDetails?: Business;
|
|
577
|
+
scheduleDate?: Date;
|
|
578
|
+
scheduleTime?: Date;
|
|
579
|
+
businessCustomerId?: string;
|
|
580
|
+
notify?: boolean | null;
|
|
581
|
+
riderAssignmentNotificationSent?: boolean;
|
|
582
|
+
isDelayed?: boolean;
|
|
583
|
+
delayedAt?: Date;
|
|
584
|
+
wasDeliveredBy?: 'rider' | 'admin' | 'system' | 'business';
|
|
585
|
+
paymentMethod?: 'cash_on_delivery' | 'prepaid_online' | 'prepaid_transfer' | 'business_invoice';
|
|
586
|
+
additionalFees?: Array<{
|
|
587
|
+
description: string;
|
|
588
|
+
amount: number;
|
|
589
|
+
createdAt?: Date;
|
|
590
|
+
createdBy?: string;
|
|
591
|
+
}>;
|
|
535
592
|
riderDetails?: Rider;
|
|
536
593
|
vehicleDetails?: Vehicle;
|
|
537
594
|
}
|
|
@@ -1114,6 +1171,93 @@ interface MaintenanceStats {
|
|
|
1114
1171
|
};
|
|
1115
1172
|
}
|
|
1116
1173
|
|
|
1174
|
+
declare enum WhatsappEvent {
|
|
1175
|
+
ERRAND_CREATED = "errand.created",
|
|
1176
|
+
ERRAND_RIDER_ASSIGNED = "errand.rider.assigned",
|
|
1177
|
+
ERRAND_PICKED_UP = "errand.picked.up",
|
|
1178
|
+
ERRAND_DELIVERED = "errand.delivered",
|
|
1179
|
+
ERRAND_CANCELLED = "errand.cancelled"
|
|
1180
|
+
}
|
|
1181
|
+
declare enum WhatsappRecipient {
|
|
1182
|
+
BUSINESS = "business",
|
|
1183
|
+
CUSTOMER = "customer"
|
|
1184
|
+
}
|
|
1185
|
+
declare enum WhatsappTemplateMetaStatus {
|
|
1186
|
+
APPROVED = "APPROVED",
|
|
1187
|
+
PENDING = "PENDING",
|
|
1188
|
+
REJECTED = "REJECTED",
|
|
1189
|
+
PAUSED = "PAUSED",
|
|
1190
|
+
DISABLED = "DISABLED"
|
|
1191
|
+
}
|
|
1192
|
+
declare enum WhatsappComponentType {
|
|
1193
|
+
BODY = "BODY",
|
|
1194
|
+
HEADER = "HEADER",
|
|
1195
|
+
FOOTER = "FOOTER",
|
|
1196
|
+
BUTTONS = "BUTTONS"
|
|
1197
|
+
}
|
|
1198
|
+
declare enum WhatsappButtonType {
|
|
1199
|
+
URL = "URL",
|
|
1200
|
+
QUICK_REPLY = "QUICK_REPLY",
|
|
1201
|
+
PHONE_NUMBER = "PHONE_NUMBER"
|
|
1202
|
+
}
|
|
1203
|
+
declare enum WhatsappTemplateParamSource {
|
|
1204
|
+
ERRAND_ALIAS_ID = "errand.aliasId",
|
|
1205
|
+
ERRAND_PICKUP_NAME = "errand.pickupDetails.fullName",
|
|
1206
|
+
ERRAND_DELIVERY_NAME = "errand.deliveryDetails.fullName",
|
|
1207
|
+
BUSINESS_NAME = "business.name",
|
|
1208
|
+
COURIER_BUSINESS_NAME = "courierBusiness.name"
|
|
1209
|
+
}
|
|
1210
|
+
interface WhatsappTemplateSource {
|
|
1211
|
+
position: number;
|
|
1212
|
+
value: WhatsappTemplateParamSource | null;
|
|
1213
|
+
example: string | null;
|
|
1214
|
+
}
|
|
1215
|
+
interface WhatsappTemplateButton {
|
|
1216
|
+
type: WhatsappButtonType | string;
|
|
1217
|
+
text?: string;
|
|
1218
|
+
url?: string;
|
|
1219
|
+
sources: WhatsappTemplateSource[];
|
|
1220
|
+
}
|
|
1221
|
+
interface WhatsappTemplateComponent {
|
|
1222
|
+
type: WhatsappComponentType | string;
|
|
1223
|
+
text?: string;
|
|
1224
|
+
buttons?: WhatsappTemplateButton[];
|
|
1225
|
+
sources: WhatsappTemplateSource[];
|
|
1226
|
+
}
|
|
1227
|
+
interface WhatsappTemplate {
|
|
1228
|
+
id: string;
|
|
1229
|
+
metaTemplateId: string;
|
|
1230
|
+
name: string;
|
|
1231
|
+
languageCode: string;
|
|
1232
|
+
metaStatus: WhatsappTemplateMetaStatus;
|
|
1233
|
+
components: WhatsappTemplateComponent[];
|
|
1234
|
+
lastSyncedAt: string | Date | NullOrUndefined;
|
|
1235
|
+
event: WhatsappEvent | null;
|
|
1236
|
+
recipient: WhatsappRecipient | null;
|
|
1237
|
+
isReady: boolean;
|
|
1238
|
+
description: string | NullOrUndefined;
|
|
1239
|
+
createdAt: string | Date;
|
|
1240
|
+
updatedAt: string | Date | NullOrUndefined;
|
|
1241
|
+
}
|
|
1242
|
+
interface BusinessWhatsappConfig {
|
|
1243
|
+
enabled: boolean;
|
|
1244
|
+
templates: Partial<Record<WhatsappEvent, string>>;
|
|
1245
|
+
billSelfForCourierSends?: boolean;
|
|
1246
|
+
}
|
|
1247
|
+
interface WhatsappSendLog {
|
|
1248
|
+
id: string;
|
|
1249
|
+
businessId: string;
|
|
1250
|
+
event: WhatsappEvent;
|
|
1251
|
+
templateId: string;
|
|
1252
|
+
templateName: string;
|
|
1253
|
+
recipient: WhatsappRecipient;
|
|
1254
|
+
toNumber: string;
|
|
1255
|
+
errandId: string | NullOrUndefined;
|
|
1256
|
+
status: 'sent' | 'failed' | 'skipped';
|
|
1257
|
+
error: string | NullOrUndefined;
|
|
1258
|
+
sentAt: string | Date;
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1117
1261
|
interface PaginateResult<T> {
|
|
1118
1262
|
docs: T[];
|
|
1119
1263
|
totalDocs: number;
|
|
@@ -1136,4 +1280,4 @@ declare enum LinkDestination {
|
|
|
1136
1280
|
}
|
|
1137
1281
|
type NullOrUndefined = null | undefined;
|
|
1138
1282
|
|
|
1139
|
-
export { type AddonGroup, type AddonGroupItem, type AddressDetails, AddressTypes, type AggregatedErrand, AuthType, type Business, BusinessCapability, type BusinessCategory, type BusinessMember, type BusinessPg, BusinessRole, BusinessStatus, type City, type Collection, type Coupon, type Customer, type CustomerTransactionStats, DeliveryStatus, type DraftErrand, DraftErrandStatus, type Enterprise, type EnterpriseCategoryDoc, type EnterpriseSubCategoryDoc, EnterpriseType, type Errand, type ErrandDeliveryTiming, type ErrandPackagingQuality, type ErrandRating, type ErrandReview, type ErrandReviewLink, type ErrandRiderBehavior, ErrandStatus, type ErrandTimeline, GlobalRoles, type Invoice, InvoiceGenerationType, type InvoiceItem, InvoiceItemType, InvoiceStatus, type LatLng, LinkDestination, type MaintenanceItem, type MaintenancePartUsage, type MaintenanceRecord, type MaintenanceStats, type MaintenanceStatsSummary, type MaintenanceTopItem, MembershipStatus, type Notification, type NotificationData, NotificationType, type NullOrUndefined, type PaginateResult, ParcelSize, PaymentOptions, type PendingErrand, type Product, type ProductCategory, type ProductImage, type ProductOption, type ProductOptionValue, type ProductStatus, type ProductTag, type ProductVariant, type ProductVariantPrice, RemittanceStatus, type Rider, type RiderPerformanceItem, type RiderPerformanceStats, type RiderPerformanceSummary, type RiderPerformanceTimeSeries, type RiderSettlement, type RiderWithUserDetails, RoleType, SettlementType, type State, type TraccarDevice, TraccarDeviceStatus, type TraccarPosition, type TrackerDevice, type Transaction, type TransactionCategory, type TransactionItem, type TransactionType, type TransactionWithCategory, type TransactionWithJoin, type User, type UserAddress, type Vehicle, type VehicleErrandStats, type VehicleFuelStats, type VehicleLog, type VehicleLogStatsSummary, VehicleLogType, type VehicleLogWithErrands, type VehicleMaintenanceStats, type VehiclePerformanceData, type VehiclePerformanceFilters, type VehiclePerformanceItem, type VehiclePerformanceTotals, VehicleType, type VehicleWithRider, type Vendor, errandTimeline };
|
|
1283
|
+
export { type AddonGroup, type AddonGroupItem, type AddressDetails, AddressTypes, type AggregatedErrand, AuthType, type Business, BusinessCapability, type BusinessCategory, type BusinessMember, type BusinessModules, type BusinessPg, BusinessRole, type BusinessSettings, BusinessStatus, type BusinessWhatsappConfig, type City, type Collection, type Coupon, type Customer, type CustomerTransactionStats, DEFAULT_BUSINESS_MODULES, DEFAULT_BUSINESS_SETTINGS, DeliveryStatus, type DraftErrand, DraftErrandStatus, type Enterprise, type EnterpriseCategoryDoc, type EnterpriseSubCategoryDoc, EnterpriseType, type Errand, type ErrandDeliveryTiming, type ErrandPackagingQuality, type ErrandRating, type ErrandReview, type ErrandReviewLink, type ErrandRiderBehavior, ErrandStatus, type ErrandTimeline, GlobalRoles, type Invoice, InvoiceGenerationType, type InvoiceItem, InvoiceItemType, InvoiceStatus, type LatLng, LinkDestination, type MaintenanceItem, type MaintenancePartUsage, type MaintenanceRecord, type MaintenanceStats, type MaintenanceStatsSummary, type MaintenanceTopItem, MembershipStatus, type Notification, type NotificationData, NotificationType, type NullOrUndefined, type OpeningHours, type PaginateResult, ParcelSize, PaymentOptions, type PendingErrand, type Product, type ProductCategory, type ProductImage, type ProductOption, type ProductOptionValue, type ProductStatus, type ProductTag, type ProductVariant, type ProductVariantPrice, RemittanceStatus, type Rider, type RiderPerformanceItem, type RiderPerformanceStats, type RiderPerformanceSummary, type RiderPerformanceTimeSeries, type RiderSettlement, type RiderWithUserDetails, RoleType, SettlementType, type State, type TraccarDevice, TraccarDeviceStatus, type TraccarPosition, type TrackerDevice, type Transaction, type TransactionCategory, type TransactionItem, type TransactionType, type TransactionWithCategory, type TransactionWithJoin, type User, type UserAddress, type Vehicle, type VehicleErrandStats, type VehicleFuelStats, type VehicleLog, type VehicleLogStatsSummary, VehicleLogType, type VehicleLogWithErrands, type VehicleMaintenanceStats, type VehiclePerformanceData, type VehiclePerformanceFilters, type VehiclePerformanceItem, type VehiclePerformanceTotals, VehicleType, type VehicleWithRider, type Vendor, WhatsappButtonType, WhatsappComponentType, WhatsappEvent, WhatsappRecipient, type WhatsappSendLog, type WhatsappTemplate, type WhatsappTemplateButton, type WhatsappTemplateComponent, WhatsappTemplateMetaStatus, WhatsappTemplateParamSource, type WhatsappTemplateSource, errandTimeline };
|
package/dist/index.js
CHANGED
|
@@ -182,6 +182,39 @@ var MembershipStatus = /* @__PURE__ */ ((MembershipStatus2) => {
|
|
|
182
182
|
MembershipStatus2["SUSPENDED"] = "SUSPENDED";
|
|
183
183
|
return MembershipStatus2;
|
|
184
184
|
})(MembershipStatus || {});
|
|
185
|
+
var DEFAULT_BUSINESS_MODULES = {
|
|
186
|
+
draftErrands: true,
|
|
187
|
+
team: true,
|
|
188
|
+
maintenance: true,
|
|
189
|
+
fuelLogs: true,
|
|
190
|
+
invoices: true,
|
|
191
|
+
remittances: true
|
|
192
|
+
};
|
|
193
|
+
var DEFAULT_BUSINESS_SETTINGS = {
|
|
194
|
+
whatsapp_notification_enabled: true,
|
|
195
|
+
whatsapp: {
|
|
196
|
+
enabled: false,
|
|
197
|
+
templates: {}
|
|
198
|
+
},
|
|
199
|
+
is_online: true,
|
|
200
|
+
opening_hours: {
|
|
201
|
+
monday: { open: "09:00", close: "17:00" },
|
|
202
|
+
tuesday: { open: "09:00", close: "17:00" },
|
|
203
|
+
wednesday: { open: "09:00", close: "17:00" },
|
|
204
|
+
thursday: { open: "09:00", close: "17:00" },
|
|
205
|
+
friday: { open: "09:00", close: "17:00" },
|
|
206
|
+
saturday: null,
|
|
207
|
+
sunday: null
|
|
208
|
+
},
|
|
209
|
+
social_links: {
|
|
210
|
+
instagram: null,
|
|
211
|
+
facebook: null,
|
|
212
|
+
twitter: null,
|
|
213
|
+
tiktok: null,
|
|
214
|
+
website: null
|
|
215
|
+
},
|
|
216
|
+
modules: DEFAULT_BUSINESS_MODULES
|
|
217
|
+
};
|
|
185
218
|
|
|
186
219
|
// src/tracker.ts
|
|
187
220
|
var TraccarDeviceStatus = /* @__PURE__ */ ((TraccarDeviceStatus2) => {
|
|
@@ -191,6 +224,50 @@ var TraccarDeviceStatus = /* @__PURE__ */ ((TraccarDeviceStatus2) => {
|
|
|
191
224
|
return TraccarDeviceStatus2;
|
|
192
225
|
})(TraccarDeviceStatus || {});
|
|
193
226
|
|
|
227
|
+
// src/whatsapp.ts
|
|
228
|
+
var WhatsappEvent = /* @__PURE__ */ ((WhatsappEvent2) => {
|
|
229
|
+
WhatsappEvent2["ERRAND_CREATED"] = "errand.created";
|
|
230
|
+
WhatsappEvent2["ERRAND_RIDER_ASSIGNED"] = "errand.rider.assigned";
|
|
231
|
+
WhatsappEvent2["ERRAND_PICKED_UP"] = "errand.picked.up";
|
|
232
|
+
WhatsappEvent2["ERRAND_DELIVERED"] = "errand.delivered";
|
|
233
|
+
WhatsappEvent2["ERRAND_CANCELLED"] = "errand.cancelled";
|
|
234
|
+
return WhatsappEvent2;
|
|
235
|
+
})(WhatsappEvent || {});
|
|
236
|
+
var WhatsappRecipient = /* @__PURE__ */ ((WhatsappRecipient2) => {
|
|
237
|
+
WhatsappRecipient2["BUSINESS"] = "business";
|
|
238
|
+
WhatsappRecipient2["CUSTOMER"] = "customer";
|
|
239
|
+
return WhatsappRecipient2;
|
|
240
|
+
})(WhatsappRecipient || {});
|
|
241
|
+
var WhatsappTemplateMetaStatus = /* @__PURE__ */ ((WhatsappTemplateMetaStatus2) => {
|
|
242
|
+
WhatsappTemplateMetaStatus2["APPROVED"] = "APPROVED";
|
|
243
|
+
WhatsappTemplateMetaStatus2["PENDING"] = "PENDING";
|
|
244
|
+
WhatsappTemplateMetaStatus2["REJECTED"] = "REJECTED";
|
|
245
|
+
WhatsappTemplateMetaStatus2["PAUSED"] = "PAUSED";
|
|
246
|
+
WhatsappTemplateMetaStatus2["DISABLED"] = "DISABLED";
|
|
247
|
+
return WhatsappTemplateMetaStatus2;
|
|
248
|
+
})(WhatsappTemplateMetaStatus || {});
|
|
249
|
+
var WhatsappComponentType = /* @__PURE__ */ ((WhatsappComponentType2) => {
|
|
250
|
+
WhatsappComponentType2["BODY"] = "BODY";
|
|
251
|
+
WhatsappComponentType2["HEADER"] = "HEADER";
|
|
252
|
+
WhatsappComponentType2["FOOTER"] = "FOOTER";
|
|
253
|
+
WhatsappComponentType2["BUTTONS"] = "BUTTONS";
|
|
254
|
+
return WhatsappComponentType2;
|
|
255
|
+
})(WhatsappComponentType || {});
|
|
256
|
+
var WhatsappButtonType = /* @__PURE__ */ ((WhatsappButtonType2) => {
|
|
257
|
+
WhatsappButtonType2["URL"] = "URL";
|
|
258
|
+
WhatsappButtonType2["QUICK_REPLY"] = "QUICK_REPLY";
|
|
259
|
+
WhatsappButtonType2["PHONE_NUMBER"] = "PHONE_NUMBER";
|
|
260
|
+
return WhatsappButtonType2;
|
|
261
|
+
})(WhatsappButtonType || {});
|
|
262
|
+
var WhatsappTemplateParamSource = /* @__PURE__ */ ((WhatsappTemplateParamSource2) => {
|
|
263
|
+
WhatsappTemplateParamSource2["ERRAND_ALIAS_ID"] = "errand.aliasId";
|
|
264
|
+
WhatsappTemplateParamSource2["ERRAND_PICKUP_NAME"] = "errand.pickupDetails.fullName";
|
|
265
|
+
WhatsappTemplateParamSource2["ERRAND_DELIVERY_NAME"] = "errand.deliveryDetails.fullName";
|
|
266
|
+
WhatsappTemplateParamSource2["BUSINESS_NAME"] = "business.name";
|
|
267
|
+
WhatsappTemplateParamSource2["COURIER_BUSINESS_NAME"] = "courierBusiness.name";
|
|
268
|
+
return WhatsappTemplateParamSource2;
|
|
269
|
+
})(WhatsappTemplateParamSource || {});
|
|
270
|
+
|
|
194
271
|
// src/index.ts
|
|
195
272
|
var LinkDestination = /* @__PURE__ */ ((LinkDestination2) => {
|
|
196
273
|
LinkDestination2["Website"] = "web";
|
|
@@ -204,6 +281,8 @@ export {
|
|
|
204
281
|
BusinessCapability,
|
|
205
282
|
BusinessRole,
|
|
206
283
|
BusinessStatus,
|
|
284
|
+
DEFAULT_BUSINESS_MODULES,
|
|
285
|
+
DEFAULT_BUSINESS_SETTINGS,
|
|
207
286
|
DeliveryStatus,
|
|
208
287
|
DraftErrandStatus,
|
|
209
288
|
EnterpriseType,
|
|
@@ -223,5 +302,11 @@ export {
|
|
|
223
302
|
TraccarDeviceStatus,
|
|
224
303
|
VehicleLogType,
|
|
225
304
|
VehicleType,
|
|
305
|
+
WhatsappButtonType,
|
|
306
|
+
WhatsappComponentType,
|
|
307
|
+
WhatsappEvent,
|
|
308
|
+
WhatsappRecipient,
|
|
309
|
+
WhatsappTemplateMetaStatus,
|
|
310
|
+
WhatsappTemplateParamSource,
|
|
226
311
|
errandTimeline
|
|
227
312
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mydoormot/app-types",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.39",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"type": "module",
|
|
23
23
|
"scripts": {
|
|
24
24
|
"clean": "del ./dist/*",
|
|
25
|
-
"build": "tsup src/index.ts --format esm,cjs --dts"
|
|
25
|
+
"build": "tsup src/index.ts --format esm,cjs --dts",
|
|
26
|
+
"dev": "tsup src/index.ts --format esm,cjs --dts --watch"
|
|
26
27
|
}
|
|
27
28
|
}
|
package/src/business.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NullOrUndefined, User } from '.';
|
|
1
|
+
import { BusinessWhatsappConfig, NullOrUndefined, User } from '.';
|
|
2
2
|
|
|
3
3
|
export enum BusinessCapability {
|
|
4
4
|
SELF_FULFILLMENT = 'self_fulfillment',
|
|
@@ -52,6 +52,8 @@ export interface Business {
|
|
|
52
52
|
disabledAt: string | NullOrUndefined | Date;
|
|
53
53
|
disabledBy: string | NullOrUndefined;
|
|
54
54
|
disabledReason: string | NullOrUndefined;
|
|
55
|
+
|
|
56
|
+
settings: BusinessSettings | NullOrUndefined;
|
|
55
57
|
}
|
|
56
58
|
|
|
57
59
|
export interface BusinessPg extends Business {
|
|
@@ -90,6 +92,83 @@ export enum MembershipStatus {
|
|
|
90
92
|
SUSPENDED = 'SUSPENDED',
|
|
91
93
|
}
|
|
92
94
|
|
|
95
|
+
export interface OpeningHours {
|
|
96
|
+
open: string;
|
|
97
|
+
close: string;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface BusinessModules {
|
|
101
|
+
draftErrands: boolean;
|
|
102
|
+
team: boolean;
|
|
103
|
+
maintenance: boolean;
|
|
104
|
+
fuelLogs: boolean;
|
|
105
|
+
invoices: boolean;
|
|
106
|
+
remittances: boolean;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export interface BusinessSettings {
|
|
110
|
+
whatsapp_notification_enabled: boolean;
|
|
111
|
+
whatsapp: BusinessWhatsappConfig;
|
|
112
|
+
is_online: boolean;
|
|
113
|
+
opening_hours: {
|
|
114
|
+
monday: OpeningHours | null;
|
|
115
|
+
tuesday: OpeningHours | null;
|
|
116
|
+
wednesday: OpeningHours | null;
|
|
117
|
+
thursday: OpeningHours | null;
|
|
118
|
+
friday: OpeningHours | null;
|
|
119
|
+
saturday: OpeningHours | null;
|
|
120
|
+
sunday: OpeningHours | null;
|
|
121
|
+
};
|
|
122
|
+
social_links: {
|
|
123
|
+
instagram: string | null;
|
|
124
|
+
facebook: string | null;
|
|
125
|
+
twitter: string | null;
|
|
126
|
+
tiktok: string | null;
|
|
127
|
+
website: string | null;
|
|
128
|
+
};
|
|
129
|
+
limits?: {
|
|
130
|
+
maxRiders: number | null;
|
|
131
|
+
maxVehicles: number | null;
|
|
132
|
+
maxErrands: number | null;
|
|
133
|
+
};
|
|
134
|
+
modules: BusinessModules;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export const DEFAULT_BUSINESS_MODULES: BusinessModules = {
|
|
138
|
+
draftErrands: true,
|
|
139
|
+
team: true,
|
|
140
|
+
maintenance: true,
|
|
141
|
+
fuelLogs: true,
|
|
142
|
+
invoices: true,
|
|
143
|
+
remittances: true,
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export const DEFAULT_BUSINESS_SETTINGS: BusinessSettings = {
|
|
147
|
+
whatsapp_notification_enabled: true,
|
|
148
|
+
whatsapp: {
|
|
149
|
+
enabled: false,
|
|
150
|
+
templates: {},
|
|
151
|
+
},
|
|
152
|
+
is_online: true,
|
|
153
|
+
opening_hours: {
|
|
154
|
+
monday: { open: '09:00', close: '17:00' },
|
|
155
|
+
tuesday: { open: '09:00', close: '17:00' },
|
|
156
|
+
wednesday: { open: '09:00', close: '17:00' },
|
|
157
|
+
thursday: { open: '09:00', close: '17:00' },
|
|
158
|
+
friday: { open: '09:00', close: '17:00' },
|
|
159
|
+
saturday: null,
|
|
160
|
+
sunday: null,
|
|
161
|
+
},
|
|
162
|
+
social_links: {
|
|
163
|
+
instagram: null,
|
|
164
|
+
facebook: null,
|
|
165
|
+
twitter: null,
|
|
166
|
+
tiktok: null,
|
|
167
|
+
website: null,
|
|
168
|
+
},
|
|
169
|
+
modules: DEFAULT_BUSINESS_MODULES,
|
|
170
|
+
};
|
|
171
|
+
|
|
93
172
|
export interface BusinessMember {
|
|
94
173
|
id: string;
|
|
95
174
|
userId: string;
|
package/src/errand.ts
CHANGED
|
@@ -162,6 +162,29 @@ export interface Errand {
|
|
|
162
162
|
userDetails?: User;
|
|
163
163
|
courierBusinessDetails?: Business;
|
|
164
164
|
|
|
165
|
+
// Schema fields previously missing from this interface.
|
|
166
|
+
scheduleDate?: Date;
|
|
167
|
+
scheduleTime?: Date;
|
|
168
|
+
businessCustomerId?: string;
|
|
169
|
+
// Tri-state: explicit true/false set by the booker, or null when no
|
|
170
|
+
// opinion. WhatsApp gate suppresses only on explicit `false`.
|
|
171
|
+
notify?: boolean | null;
|
|
172
|
+
riderAssignmentNotificationSent?: boolean;
|
|
173
|
+
isDelayed?: boolean;
|
|
174
|
+
delayedAt?: Date;
|
|
175
|
+
wasDeliveredBy?: 'rider' | 'admin' | 'system' | 'business';
|
|
176
|
+
paymentMethod?:
|
|
177
|
+
| 'cash_on_delivery'
|
|
178
|
+
| 'prepaid_online'
|
|
179
|
+
| 'prepaid_transfer'
|
|
180
|
+
| 'business_invoice';
|
|
181
|
+
additionalFees?: Array<{
|
|
182
|
+
description: string;
|
|
183
|
+
amount: number;
|
|
184
|
+
createdAt?: Date;
|
|
185
|
+
createdBy?: string;
|
|
186
|
+
}>;
|
|
187
|
+
|
|
165
188
|
// new fields
|
|
166
189
|
riderDetails?: Rider;
|
|
167
190
|
vehicleDetails?: Vehicle;
|
package/src/index.ts
CHANGED
package/src/whatsapp.ts
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { NullOrUndefined } from '.';
|
|
2
|
+
|
|
3
|
+
export enum WhatsappEvent {
|
|
4
|
+
ERRAND_CREATED = 'errand.created',
|
|
5
|
+
ERRAND_RIDER_ASSIGNED = 'errand.rider.assigned',
|
|
6
|
+
ERRAND_PICKED_UP = 'errand.picked.up',
|
|
7
|
+
ERRAND_DELIVERED = 'errand.delivered',
|
|
8
|
+
ERRAND_CANCELLED = 'errand.cancelled',
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export enum WhatsappRecipient {
|
|
12
|
+
BUSINESS = 'business',
|
|
13
|
+
CUSTOMER = 'customer',
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export enum WhatsappTemplateMetaStatus {
|
|
17
|
+
APPROVED = 'APPROVED',
|
|
18
|
+
PENDING = 'PENDING',
|
|
19
|
+
REJECTED = 'REJECTED',
|
|
20
|
+
PAUSED = 'PAUSED',
|
|
21
|
+
DISABLED = 'DISABLED',
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export enum WhatsappComponentType {
|
|
25
|
+
BODY = 'BODY',
|
|
26
|
+
HEADER = 'HEADER',
|
|
27
|
+
FOOTER = 'FOOTER',
|
|
28
|
+
BUTTONS = 'BUTTONS',
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export enum WhatsappButtonType {
|
|
32
|
+
URL = 'URL',
|
|
33
|
+
QUICK_REPLY = 'QUICK_REPLY',
|
|
34
|
+
PHONE_NUMBER = 'PHONE_NUMBER',
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export enum WhatsappTemplateParamSource {
|
|
38
|
+
ERRAND_ALIAS_ID = 'errand.aliasId',
|
|
39
|
+
ERRAND_PICKUP_NAME = 'errand.pickupDetails.fullName',
|
|
40
|
+
ERRAND_DELIVERY_NAME = 'errand.deliveryDetails.fullName',
|
|
41
|
+
BUSINESS_NAME = 'business.name',
|
|
42
|
+
COURIER_BUSINESS_NAME = 'courierBusiness.name',
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface WhatsappTemplateSource {
|
|
46
|
+
position: number;
|
|
47
|
+
value: WhatsappTemplateParamSource | null;
|
|
48
|
+
example: string | null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface WhatsappTemplateButton {
|
|
52
|
+
type: WhatsappButtonType | string;
|
|
53
|
+
text?: string;
|
|
54
|
+
url?: string;
|
|
55
|
+
sources: WhatsappTemplateSource[];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface WhatsappTemplateComponent {
|
|
59
|
+
type: WhatsappComponentType | string;
|
|
60
|
+
text?: string;
|
|
61
|
+
buttons?: WhatsappTemplateButton[];
|
|
62
|
+
sources: WhatsappTemplateSource[];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface WhatsappTemplate {
|
|
66
|
+
id: string;
|
|
67
|
+
|
|
68
|
+
// Meta-sourced
|
|
69
|
+
metaTemplateId: string;
|
|
70
|
+
name: string;
|
|
71
|
+
languageCode: string;
|
|
72
|
+
metaStatus: WhatsappTemplateMetaStatus;
|
|
73
|
+
components: WhatsappTemplateComponent[];
|
|
74
|
+
lastSyncedAt: string | Date | NullOrUndefined;
|
|
75
|
+
|
|
76
|
+
// Admin-sourced
|
|
77
|
+
event: WhatsappEvent | null;
|
|
78
|
+
recipient: WhatsappRecipient | null;
|
|
79
|
+
isReady: boolean;
|
|
80
|
+
description: string | NullOrUndefined;
|
|
81
|
+
|
|
82
|
+
createdAt: string | Date;
|
|
83
|
+
updatedAt: string | Date | NullOrUndefined;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface BusinessWhatsappConfig {
|
|
87
|
+
enabled: boolean;
|
|
88
|
+
templates: Partial<Record<WhatsappEvent, string>>;
|
|
89
|
+
// Billing override. When true, sends that would otherwise have been billed
|
|
90
|
+
// to a courier handling this business's errands are dropped on the courier
|
|
91
|
+
// side — this business takes over notification responsibility (and cost)
|
|
92
|
+
// via its own templates. Default: false.
|
|
93
|
+
billSelfForCourierSends?: boolean;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface WhatsappSendLog {
|
|
97
|
+
id: string;
|
|
98
|
+
businessId: string;
|
|
99
|
+
event: WhatsappEvent;
|
|
100
|
+
templateId: string;
|
|
101
|
+
templateName: string;
|
|
102
|
+
recipient: WhatsappRecipient;
|
|
103
|
+
toNumber: string;
|
|
104
|
+
errandId: string | NullOrUndefined;
|
|
105
|
+
status: 'sent' | 'failed' | 'skipped';
|
|
106
|
+
error: string | NullOrUndefined;
|
|
107
|
+
sentAt: string | Date;
|
|
108
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"module": "CommonJS" /* Specify what module code is generated. */,
|
|
31
31
|
// "rootDir": "./", /* Specify the root folder within your source files. */
|
|
32
32
|
"moduleResolution": "node" /* Specify how TypeScript looks up a file from a given module specifier. */,
|
|
33
|
+
"ignoreDeprecations": "5.0",
|
|
33
34
|
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
34
35
|
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
35
36
|
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|