stentor-models 1.59.48 → 1.59.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,78 @@
|
|
|
1
1
|
/*! Copyright (c) 2022, XAPPmedia */
|
|
2
2
|
import { CrmResponse, ExternalLead } from "../Crm";
|
|
3
|
+
import { DateTime, DateTimeRange } from "../DateTime";
|
|
4
|
+
export type DayOfWeek = "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday" | "sunday";
|
|
5
|
+
/**
|
|
6
|
+
* Settings for the availability of the CRM service.
|
|
7
|
+
*/
|
|
8
|
+
export interface CrmServiceAvailabilitySettings {
|
|
9
|
+
/**
|
|
10
|
+
* The days of the week they are available to schedule appointments through the scheduler.
|
|
11
|
+
*/
|
|
12
|
+
availableDays?: DayOfWeek[];
|
|
13
|
+
/**
|
|
14
|
+
* These are holidays or any other days specific to the business that they are not available for appointments.
|
|
15
|
+
*/
|
|
16
|
+
blockedDays?: DateTime[];
|
|
17
|
+
/**
|
|
18
|
+
* Maximum total number of appointments a day that can be scheduled through the scheduler.
|
|
19
|
+
*/
|
|
20
|
+
maxTotalDailyAppointments?: number;
|
|
21
|
+
}
|
|
22
|
+
export interface CrmServiceTimeAvailability {
|
|
23
|
+
/**
|
|
24
|
+
* The time slot
|
|
25
|
+
*/
|
|
26
|
+
range: DateTimeRange;
|
|
27
|
+
/**
|
|
28
|
+
* If the time slot is available.
|
|
29
|
+
*/
|
|
30
|
+
available: boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface CrmServiceDateAvailability {
|
|
33
|
+
/**
|
|
34
|
+
* The number of appointments available for the given range.
|
|
35
|
+
*
|
|
36
|
+
* Typically, just the date is used, tz and time are not needed.
|
|
37
|
+
*/
|
|
38
|
+
date: DateTime;
|
|
39
|
+
/**
|
|
40
|
+
* If the day has any availability for appointments.
|
|
41
|
+
*/
|
|
42
|
+
available: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* The number of remaining available appointments.
|
|
45
|
+
*/
|
|
46
|
+
remainingAppointments?: number;
|
|
47
|
+
/**
|
|
48
|
+
* Blocked time slots for the day.
|
|
49
|
+
*
|
|
50
|
+
* These are only blocked times during their normal business hours.
|
|
51
|
+
*
|
|
52
|
+
* @note - This is only for future consideration.
|
|
53
|
+
*/
|
|
54
|
+
blockedTimeSlots?: CrmServiceTimeAvailability[];
|
|
55
|
+
}
|
|
56
|
+
export interface CrmServiceAvailability {
|
|
57
|
+
/**
|
|
58
|
+
* The range
|
|
59
|
+
*/
|
|
60
|
+
range: DateTimeRange;
|
|
61
|
+
/**
|
|
62
|
+
* Availability for each date in the range.
|
|
63
|
+
*
|
|
64
|
+
* If the date is not included in the array, it is assumed to be available.
|
|
65
|
+
*/
|
|
66
|
+
unavailabilities: CrmServiceDateAvailability[];
|
|
67
|
+
}
|
|
68
|
+
export interface CrmServiceAvailabilityOptions extends CrmServiceAvailabilitySettings {
|
|
69
|
+
/**
|
|
70
|
+
* Job Type to filter availability by.
|
|
71
|
+
*
|
|
72
|
+
* This allows to display availability for a specific job type, which can be different.
|
|
73
|
+
*/
|
|
74
|
+
jobType?: string;
|
|
75
|
+
}
|
|
3
76
|
export interface CrmService {
|
|
4
77
|
/**
|
|
5
78
|
* Send information about a lead to the CRM.
|
|
@@ -17,8 +90,27 @@ export interface CrmService {
|
|
|
17
90
|
*
|
|
18
91
|
* It leverages the refId on the externalLead, which is originally provided in the CrmResponse to properly
|
|
19
92
|
*
|
|
93
|
+
* @deprecated Use send with a refId on the externalLead and call send() again. This will update.
|
|
94
|
+
*
|
|
20
95
|
* @param externalLead
|
|
21
96
|
* @param extras
|
|
22
97
|
*/
|
|
23
98
|
update?(externalLead: ExternalLead, extras?: Record<string, unknown>): Promise<CrmResponse>;
|
|
99
|
+
/**
|
|
100
|
+
* Returns availability for scheduling an appointment with the business.
|
|
101
|
+
*
|
|
102
|
+
* @param range
|
|
103
|
+
* @param options
|
|
104
|
+
*/
|
|
105
|
+
getAvailability(range: DateTimeRange, options?: CrmServiceAvailabilityOptions): Promise<CrmServiceAvailability>;
|
|
106
|
+
}
|
|
107
|
+
export type CrmServiceProps = CrmServiceAvailabilitySettings;
|
|
108
|
+
export declare class AbstractCrmService implements CrmService {
|
|
109
|
+
protected availableDays?: DayOfWeek[];
|
|
110
|
+
protected blockedDays?: DateTime[];
|
|
111
|
+
protected maxTotalDailyAppointments?: number | undefined;
|
|
112
|
+
constructor(props: CrmServiceProps);
|
|
113
|
+
send(externalLead: ExternalLead, extras?: Record<string, unknown>): Promise<CrmResponse>;
|
|
114
|
+
getAvailability(range: DateTimeRange, options?: CrmServiceAvailabilityOptions): Promise<CrmServiceAvailability>;
|
|
115
|
+
update?(externalLead: ExternalLead, extras?: Record<string, unknown>): Promise<CrmResponse>;
|
|
24
116
|
}
|
|
@@ -1,4 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*! Copyright (c) 2022, XAPPmedia */
|
|
3
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
7
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
8
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
9
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10
|
+
});
|
|
11
|
+
};
|
|
3
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.AbstractCrmService = void 0;
|
|
14
|
+
class AbstractCrmService {
|
|
15
|
+
constructor(props) {
|
|
16
|
+
if (props.availableDays) {
|
|
17
|
+
this.availableDays = props.availableDays;
|
|
18
|
+
}
|
|
19
|
+
if (props.blockedDays) {
|
|
20
|
+
this.blockedDays = props.blockedDays;
|
|
21
|
+
}
|
|
22
|
+
if (typeof props.maxTotalDailyAppointments === "number") {
|
|
23
|
+
this.maxTotalDailyAppointments = props.maxTotalDailyAppointments;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
27
|
+
send(externalLead, extras) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
throw new Error("Method not implemented.");
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
33
|
+
getAvailability(range, options) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
throw new Error("Method not implemented.");
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
39
|
+
update(externalLead, extras) {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
throw new Error("Method not implemented.");
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.AbstractCrmService = AbstractCrmService;
|
|
4
46
|
//# sourceMappingURL=CrmService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CrmService.js","sourceRoot":"","sources":["../../src/Services/CrmService.ts"],"names":[],"mappings":";AAAA,oCAAoC"}
|
|
1
|
+
{"version":3,"file":"CrmService.js","sourceRoot":"","sources":["../../src/Services/CrmService.ts"],"names":[],"mappings":";AAAA,oCAAoC;;;;;;;;;;;;AAqHpC,MAAa,kBAAkB;IAQ3B,YAAmB,KAAsB;QAErC,IAAI,KAAK,CAAC,aAAa,EAAE,CAAC;YACtB,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC;QAC7C,CAAC;QAED,IAAI,KAAK,CAAC,WAAW,EAAE,CAAC;YACpB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QACzC,CAAC;QAED,IAAI,OAAO,KAAK,CAAC,yBAAyB,KAAK,QAAQ,EAAE,CAAC;YACtD,IAAI,CAAC,yBAAyB,GAAG,KAAK,CAAC,yBAAyB,CAAC;QACrE,CAAC;IACL,CAAC;IAED,6DAA6D;IAChD,IAAI,CAAC,YAA0B,EAAE,MAAgC;;YAC1E,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;QAC/C,CAAC;KAAA;IAED,6DAA6D;IAChD,eAAe,CAAC,KAAoB,EAAE,OAAuC;;YACtF,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;QAC/C,CAAC;KAAA;IAED,6DAA6D;IAChD,MAAM,CAAE,YAA0B,EAAE,MAAgC;;YAC7E,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;QAC/C,CAAC;KAAA;CACJ;AArCD,gDAqCC"}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "1.59.
|
|
7
|
+
"version": "1.59.51",
|
|
8
8
|
"description": "Models for 📣 stentor",
|
|
9
9
|
"types": "lib/index",
|
|
10
10
|
"typings": "lib/index",
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@xapp/patterns": "2.0.2"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "3209e2f9b9aae5e7099c8076e84986aa7291cb42"
|
|
37
37
|
}
|