UNPKG

@lautmaler/crm-connectors

Version:

Provides connectors to various CRM systems and calendar services.

43 lines 1.61 kB
import { CRMBackendFactory } from "./backends/Factory.js"; // Base CRM class export class CRMConnector { /* * The backend property is an instance of the CRMBackend interface. * It is created by calling the CRMBackendFactory function with the backendName parameter. * The backendName parameter is a string that specifies the name of the backend to use. * The CRMConnector class provides methods for interacting with the CRM system. */ backend; constructor(backendName) { this.backend = CRMBackendFactory(backendName); } async fetchAppointmentTypes() { return this.backend.fetchAppointmentTypes(); } async fetchAvailableSlots(timestamp, attendees) { return this.backend.fetchAvailableSlots(timestamp, attendees); } async bookAppointment(appointment) { if (process.env.APP_ENV === "test") { return "success"; } return this.backend.bookAppointment(appointment); } async modifyAppointment(id, updatedInfo) { return this.backend.modifyAppointment(id, updatedInfo); } async findAppointmentByContactName(name) { return this.backend.findAppointmentByContactName(name); } async findAppointmentByTimestamp(timestamp) { return this.backend.findAppointmentByTimestamp(timestamp); } async findAppointmentById(id) { return this.backend.findAppointmentById(id); } async createEventToSms(appointment) { return this.backend.createEventToSms(appointment); } } export default CRMConnector; //# sourceMappingURL=CRMConnector.js.map