stentor-models 1.59.48 → 1.59.50
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,47 @@
|
|
|
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
|
+
export interface CrmServiceAvailabilityOptions {
|
|
6
|
+
/**
|
|
7
|
+
* The days of the week they are available to schedule appointments through the scheduler.
|
|
8
|
+
*/
|
|
9
|
+
availableDays?: DayOfWeek[];
|
|
10
|
+
/**
|
|
11
|
+
* These are holidays or any other days specific to the business that they are not available for appointments.
|
|
12
|
+
*/
|
|
13
|
+
blockedDays?: DateTime[];
|
|
14
|
+
/**
|
|
15
|
+
* Maximum total number of appointments a day that can be scheduled through the scheduler.
|
|
16
|
+
*/
|
|
17
|
+
maxTotalDailyAppointments?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface CrmServiceDateAvailability {
|
|
20
|
+
/**
|
|
21
|
+
* The number of appointments available for the given range.
|
|
22
|
+
*
|
|
23
|
+
* Typically, just the date is used, tz and time are not needed.
|
|
24
|
+
*/
|
|
25
|
+
date: DateTime;
|
|
26
|
+
/**
|
|
27
|
+
* If the day is available for appointments.
|
|
28
|
+
*/
|
|
29
|
+
available: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* The number of remaining available appointments.
|
|
32
|
+
*/
|
|
33
|
+
remainingAppointments?: number;
|
|
34
|
+
}
|
|
35
|
+
export interface CrmServiceAvailability {
|
|
36
|
+
/**
|
|
37
|
+
* The range
|
|
38
|
+
*/
|
|
39
|
+
range: DateTimeRange;
|
|
40
|
+
/**
|
|
41
|
+
* Availability for each date in the range.
|
|
42
|
+
*/
|
|
43
|
+
dateAvailabilities: CrmServiceDateAvailability[];
|
|
44
|
+
}
|
|
3
45
|
export interface CrmService {
|
|
4
46
|
/**
|
|
5
47
|
* Send information about a lead to the CRM.
|
|
@@ -17,8 +59,26 @@ export interface CrmService {
|
|
|
17
59
|
*
|
|
18
60
|
* It leverages the refId on the externalLead, which is originally provided in the CrmResponse to properly
|
|
19
61
|
*
|
|
62
|
+
* @deprecated Use send with a refId on the externalLead and call send() again. This will update.
|
|
63
|
+
*
|
|
20
64
|
* @param externalLead
|
|
21
65
|
* @param extras
|
|
22
66
|
*/
|
|
23
67
|
update?(externalLead: ExternalLead, extras?: Record<string, unknown>): Promise<CrmResponse>;
|
|
68
|
+
/**
|
|
69
|
+
* Returns availability for scheduling an appointment with the business.
|
|
70
|
+
*
|
|
71
|
+
* @param range
|
|
72
|
+
* @param options
|
|
73
|
+
*/
|
|
74
|
+
getAvailability(range: DateTimeRange, options?: CrmServiceAvailabilityOptions): Promise<CrmServiceAvailability>;
|
|
75
|
+
}
|
|
76
|
+
export type CrmServiceProps = CrmServiceAvailabilityOptions;
|
|
77
|
+
export declare class AbstractCrmService implements CrmService, CrmServiceAvailabilityOptions {
|
|
78
|
+
availableDays?: DayOfWeek[];
|
|
79
|
+
blockedDays?: DateTime[];
|
|
80
|
+
constructor(props: CrmServiceProps);
|
|
81
|
+
send(externalLead: ExternalLead, extras?: Record<string, unknown>): Promise<CrmResponse>;
|
|
82
|
+
getAvailability(range: DateTimeRange, options?: CrmServiceAvailabilityOptions): Promise<CrmServiceAvailability>;
|
|
83
|
+
update?(externalLead: ExternalLead, extras?: Record<string, unknown>): Promise<CrmResponse>;
|
|
24
84
|
}
|
|
@@ -1,4 +1,43 @@
|
|
|
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
|
+
}
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
24
|
+
send(externalLead, extras) {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
throw new Error("Method not implemented.");
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
30
|
+
getAvailability(range, options) {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
throw new Error("Method not implemented.");
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
36
|
+
update(externalLead, extras) {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
throw new Error("Method not implemented.");
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.AbstractCrmService = AbstractCrmService;
|
|
4
43
|
//# 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;;;;;;;;;;;;AAoFpC,MAAa,kBAAkB;IAM3B,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;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;AA/BD,gDA+BC"}
|
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.50",
|
|
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": "bff39e20edff1e7c552b6ef8156b43388aa79697"
|
|
37
37
|
}
|