@xapp/stentor-service-contractor-appointments 1.71.0
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/LICENSE.md +176 -0
- package/README.md +10 -0
- package/lib/AI/ai.d.ts +12 -0
- package/lib/AI/ai.js +69 -0
- package/lib/AI/ai.js.map +1 -0
- package/lib/ContractorAppointmentsService.d.ts +28 -0
- package/lib/ContractorAppointmentsService.js +180 -0
- package/lib/ContractorAppointmentsService.js.map +1 -0
- package/lib/Data/trades.d.ts +2 -0
- package/lib/Data/trades.js +104 -0
- package/lib/Data/trades.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +19 -0
- package/lib/index.js.map +1 -0
- package/lib/models.d.ts +93 -0
- package/lib/models.js +5 -0
- package/lib/models.js.map +1 -0
- package/lib/util.d.ts +17 -0
- package/lib/util.js +188 -0
- package/lib/util.js.map +1 -0
- package/package.json +45 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
package/README.md
ADDED
package/lib/AI/ai.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface AIProperties {
|
|
2
|
+
apiKey?: string;
|
|
3
|
+
}
|
|
4
|
+
export declare class AIService {
|
|
5
|
+
props: AIProperties;
|
|
6
|
+
/**
|
|
7
|
+
* Process a description into a label and summary for a job
|
|
8
|
+
*/
|
|
9
|
+
constructor(props: AIProperties);
|
|
10
|
+
labelJob(description: string): Promise<string>;
|
|
11
|
+
processResponse(response: any): string;
|
|
12
|
+
}
|
package/lib/AI/ai.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.AIService = void 0;
|
|
16
|
+
/*! Copyright (c) 2024, XAPP AI */
|
|
17
|
+
const stentor_logger_1 = require("stentor-logger");
|
|
18
|
+
const openai_1 = __importDefault(require("openai"));
|
|
19
|
+
const trades_1 = require("../Data/trades");
|
|
20
|
+
const model = "gpt-4-turbo";
|
|
21
|
+
class AIService {
|
|
22
|
+
/**
|
|
23
|
+
* Process a description into a label and summary for a job
|
|
24
|
+
*/
|
|
25
|
+
constructor(props) {
|
|
26
|
+
this.props = props;
|
|
27
|
+
}
|
|
28
|
+
labelJob(description) {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
const system_prompt = "You are a helpful assistant for a Home Services company. Match a customer description to the following array of trades: \n";
|
|
31
|
+
const openai = new openai_1.default({
|
|
32
|
+
apiKey: this.props.apiKey
|
|
33
|
+
});
|
|
34
|
+
const messages = [
|
|
35
|
+
{
|
|
36
|
+
role: "system",
|
|
37
|
+
content: system_prompt + JSON.stringify(trades_1.trades) + "\n Return the response as a JSON object"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
role: "user",
|
|
41
|
+
content: description
|
|
42
|
+
}
|
|
43
|
+
];
|
|
44
|
+
try {
|
|
45
|
+
const response = yield openai.chat.completions.create({
|
|
46
|
+
messages: messages,
|
|
47
|
+
model
|
|
48
|
+
});
|
|
49
|
+
return this.processResponse(response);
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
(0, stentor_logger_1.log)().error(`Error labelling trade ${err}`);
|
|
53
|
+
return "";
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
processResponse(response) {
|
|
58
|
+
try {
|
|
59
|
+
const result = response.choices[0].message.content;
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
catch (err) {
|
|
63
|
+
(0, stentor_logger_1.log)().error(`Error processing OpenAI response: ${err}`);
|
|
64
|
+
return "";
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.AIService = AIService;
|
|
69
|
+
//# sourceMappingURL=ai.js.map
|
package/lib/AI/ai.js.map
ADDED
|
@@ -0,0 +1 @@
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AO,MAAM,CAAC;QAClB,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAChB,IAAA,oBAAG,GAAE,CAAC,KAAK,CAAC,qCAAqC,GAAG,EAAE,CAAC,CAAC;YACxD,OAAO,EAAE,CAAC;QACd,CAAC;IACL,CAAC;CAEJ;AAzDD,8BAyDC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*! Copyright (c) 2025, XAPP AI */
|
|
2
|
+
import { FetchService } from "stentor-service-fetch";
|
|
3
|
+
import { BaseService, CrmResponse, CrmService, CrmServiceAvailability, CrmServiceAvailabilityOptions, CrmServiceAvailabilitySettings, CrmServiceJobType, DateTimeRange, ExternalLead } from "stentor-models";
|
|
4
|
+
import { ContractorAppointmentsCustomer, ContractorAppointmentsResponse, ContractorAppointmentsExternalLeadExtras } from "./models";
|
|
5
|
+
export interface ContractorAppointmentsAuthenticator {
|
|
6
|
+
(): Promise<{
|
|
7
|
+
campaignId: string;
|
|
8
|
+
campaignKey: string;
|
|
9
|
+
}>;
|
|
10
|
+
}
|
|
11
|
+
export interface ContractorAppointmentsServiceProps extends BaseService, CrmServiceAvailabilitySettings {
|
|
12
|
+
appId: string;
|
|
13
|
+
channel?: string;
|
|
14
|
+
openAI: {
|
|
15
|
+
apiKey: string;
|
|
16
|
+
};
|
|
17
|
+
defaultTrade?: string;
|
|
18
|
+
authenticate: ContractorAppointmentsAuthenticator;
|
|
19
|
+
}
|
|
20
|
+
export declare class ContractorAppointmentsService extends FetchService implements CrmService {
|
|
21
|
+
private props;
|
|
22
|
+
constructor(props: ContractorAppointmentsServiceProps);
|
|
23
|
+
getAvailability(range: DateTimeRange, options?: CrmServiceAvailabilityOptions): Promise<CrmServiceAvailability>;
|
|
24
|
+
getJobType(message: string, externalLead?: ExternalLead): Promise<CrmServiceJobType>;
|
|
25
|
+
send(externalLead: ExternalLead, extras?: ContractorAppointmentsExternalLeadExtras): Promise<CrmResponse>;
|
|
26
|
+
addPing(): Promise<any>;
|
|
27
|
+
addLead(customer: ContractorAppointmentsCustomer): Promise<ContractorAppointmentsResponse>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.ContractorAppointmentsService = void 0;
|
|
16
|
+
/*! Copyright (c) 2025, XAPP AI */
|
|
17
|
+
const stentor_service_fetch_1 = require("stentor-service-fetch");
|
|
18
|
+
const stentor_logger_1 = require("stentor-logger");
|
|
19
|
+
const axios_1 = __importDefault(require("axios"));
|
|
20
|
+
const ai_1 = require("./AI/ai");
|
|
21
|
+
const base_url = "https://track.costguide.com/post.do";
|
|
22
|
+
const ping_url = "https://track.costguide.com/ping.do";
|
|
23
|
+
const util_1 = require("./util");
|
|
24
|
+
class ContractorAppointmentsService extends stentor_service_fetch_1.FetchService {
|
|
25
|
+
constructor(props) {
|
|
26
|
+
super(props);
|
|
27
|
+
this.props = Object.assign({}, props);
|
|
28
|
+
if (!this.props.channel) {
|
|
29
|
+
this.props.channel = "Form";
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
getAvailability(range, options) {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
const availability = {
|
|
35
|
+
range,
|
|
36
|
+
unavailabilities: []
|
|
37
|
+
};
|
|
38
|
+
if (!options) {
|
|
39
|
+
options = {
|
|
40
|
+
blockedDays: []
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
return Promise.resolve(availability);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
getJobType(message, externalLead) {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
const jobType = {
|
|
49
|
+
id: "",
|
|
50
|
+
name: ""
|
|
51
|
+
};
|
|
52
|
+
try {
|
|
53
|
+
const aiService = new ai_1.AIService({
|
|
54
|
+
apiKey: this.props.openAI.apiKey
|
|
55
|
+
});
|
|
56
|
+
const response = yield aiService.labelJob(message);
|
|
57
|
+
jobType.id = response;
|
|
58
|
+
jobType.name = response;
|
|
59
|
+
return jobType;
|
|
60
|
+
}
|
|
61
|
+
catch (err) {
|
|
62
|
+
(0, stentor_logger_1.log)().error(`Contractor Appointments: Error getting job type ${err}`);
|
|
63
|
+
return jobType;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
// Send the lead or scheduling request
|
|
68
|
+
send(externalLead, extras) {
|
|
69
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
71
|
+
const crmResponse = {
|
|
72
|
+
status: "Failure",
|
|
73
|
+
message: ""
|
|
74
|
+
};
|
|
75
|
+
try {
|
|
76
|
+
let transcript = "";
|
|
77
|
+
(_a = externalLead.transcript) === null || _a === void 0 ? void 0 : _a.forEach((x) => (transcript += `${x.from.id != this.props.appId && x.from.id != "bot" ? "user: " : this.props.appId + ": "} ${x.message} \n`));
|
|
78
|
+
// Parse first/last name
|
|
79
|
+
const names = (0, util_1.getName)(externalLead);
|
|
80
|
+
const address = (_b = externalLead.fields.find((x) => x.name == "ADDRESS")) === null || _b === void 0 ? void 0 : _b.value;
|
|
81
|
+
const phone = (_c = externalLead.fields.find((x) => x.name == "PHONE")) === null || _c === void 0 ? void 0 : _c.value;
|
|
82
|
+
const email = (_d = externalLead.fields.find((x) => x.name == "EMAIL")) === null || _d === void 0 ? void 0 : _d.value;
|
|
83
|
+
const message = (_e = externalLead.fields.find((x) => x.name == "MESSAGE")) === null || _e === void 0 ? void 0 : _e.value;
|
|
84
|
+
const dateTime = (_f = externalLead.fields.find((x) => x.name == "DATETIME")) === null || _f === void 0 ? void 0 : _f.value;
|
|
85
|
+
const zip = (_g = externalLead.fields.find((x) => x.name == "ZIP")) === null || _g === void 0 ? void 0 : _g.value;
|
|
86
|
+
const preferredTime = (_h = externalLead.fields.find((x) => x.name == "PREFERRED_TIME")) === null || _h === void 0 ? void 0 : _h.value;
|
|
87
|
+
// const consentApproval = externalLead.fields.find((x) => x.name == "CONSENT_APPROVAL")?.value;
|
|
88
|
+
// look at fields on Jobber, figure out some way to standardize these across the FSM Services.
|
|
89
|
+
let parsedAddress;
|
|
90
|
+
try {
|
|
91
|
+
// TODO: POTENTIAL ISSUE HERE AS ADDRESS CAN SOMETIMES BE JUST STREET NUMBER AND STREET NAME, WHICH CAUSES PARSE ADDRESS TO THROW AN ERROR
|
|
92
|
+
parsedAddress = yield (0, util_1.parseAddress)(address);
|
|
93
|
+
}
|
|
94
|
+
catch (err) {
|
|
95
|
+
(0, stentor_logger_1.log)().error(`Contractor Appointments: Invalid address "${address}"`);
|
|
96
|
+
}
|
|
97
|
+
const { campaignId, campaignKey } = yield this.props.authenticate();
|
|
98
|
+
const jobType = yield this.getJobType(message);
|
|
99
|
+
const crmRequest = {
|
|
100
|
+
lp_campaign_id: campaignId,
|
|
101
|
+
lp_campaign_key: campaignKey,
|
|
102
|
+
lp_response: "json",
|
|
103
|
+
lp_ping_id: "",
|
|
104
|
+
source_type: "Other",
|
|
105
|
+
first_name: names.firstName,
|
|
106
|
+
last_name: names.lastName,
|
|
107
|
+
zip_code: zip,
|
|
108
|
+
phone_home: phone,
|
|
109
|
+
email_address: email,
|
|
110
|
+
ip_address: "",
|
|
111
|
+
Trade: jobType.name,
|
|
112
|
+
Project_Description: message,
|
|
113
|
+
lp_s1: dateTime,
|
|
114
|
+
lp_s2: preferredTime
|
|
115
|
+
};
|
|
116
|
+
if (parsedAddress) {
|
|
117
|
+
crmRequest.address = parsedAddress.addressLine1;
|
|
118
|
+
crmRequest.city = parsedAddress.placeName;
|
|
119
|
+
crmRequest.state = parsedAddress.stateAbbreviation;
|
|
120
|
+
crmRequest.zip_code = parsedAddress.zipCode;
|
|
121
|
+
}
|
|
122
|
+
yield this.addLead(crmRequest);
|
|
123
|
+
crmResponse.status = "Success";
|
|
124
|
+
}
|
|
125
|
+
catch (err) {
|
|
126
|
+
(0, stentor_logger_1.log)().error(`Contractor Appointments error send(): ${err}`);
|
|
127
|
+
crmResponse.message = err.message || String(err);
|
|
128
|
+
}
|
|
129
|
+
return crmResponse;
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
addPing() {
|
|
133
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
134
|
+
const { campaignId, campaignKey } = yield this.props.authenticate();
|
|
135
|
+
const config = {
|
|
136
|
+
method: "post",
|
|
137
|
+
url: `${ping_url}`,
|
|
138
|
+
headers: {
|
|
139
|
+
Accept: "application/json",
|
|
140
|
+
"Content-Type": "application/json"
|
|
141
|
+
},
|
|
142
|
+
data: {
|
|
143
|
+
lp_campaign_id: campaignId,
|
|
144
|
+
lp_campaign_key: campaignKey
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
const response = yield (0, axios_1.default)(config);
|
|
148
|
+
return response.data;
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
addLead(customer) {
|
|
152
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
153
|
+
const ContractorAppointmentsResponse = {
|
|
154
|
+
status: "Failure"
|
|
155
|
+
};
|
|
156
|
+
try {
|
|
157
|
+
const config = {
|
|
158
|
+
method: "post",
|
|
159
|
+
url: `${base_url}`,
|
|
160
|
+
headers: {
|
|
161
|
+
Accept: "application/json",
|
|
162
|
+
// Authorization: `Token ${(await this.props.authenticate()).accessToken}`,
|
|
163
|
+
"Content-Type": "application/json"
|
|
164
|
+
},
|
|
165
|
+
data: JSON.stringify(customer)
|
|
166
|
+
};
|
|
167
|
+
const response = yield (0, axios_1.default)(config);
|
|
168
|
+
ContractorAppointmentsResponse.status = "Success";
|
|
169
|
+
ContractorAppointmentsResponse.data = response.data;
|
|
170
|
+
}
|
|
171
|
+
catch (err) {
|
|
172
|
+
(0, stentor_logger_1.log)().error(`ContractorAppointments: Error adding lead ${err}`);
|
|
173
|
+
ContractorAppointmentsResponse.error = err;
|
|
174
|
+
}
|
|
175
|
+
return ContractorAppointmentsResponse;
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
exports.ContractorAppointmentsService = ContractorAppointmentsService;
|
|
180
|
+
//# sourceMappingURL=ContractorAppointmentsService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContractorAppointmentsService.js","sourceRoot":"","sources":["../src/ContractorAppointmentsService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kCAAkC;AAClC,iEAAqD;AAYrD,mDAAqC;AACrC,kDAAkD;AAClD,gCAAoC;AAQpC,MAAM,QAAQ,GAAG,qCAAqC,CAAC;AACvD,MAAM,QAAQ,GAAG,qCAAqC,CAAC;AAEvD,iCAA+C;AAiB/C,MAAa,6BAA8B,SAAQ,oCAAY;IAG3D,YAAY,KAAyC;QACjD,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,KAAK,qBACH,KAAK,CACX,CAAC;QAEF,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YACtB,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;QAChC,CAAC;IACL,CAAC;IAEY,eAAe,CACx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,EAAE,kBAAkB;qBACrC;oBACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;iBACjC,CAAC;gBAEF,MAAM,QAAQ,GAAG,MAAM,IAAA,eAAK,EAAC,MAAM,CAAC,CAAC;gBAErC,8BAA8B,CAAC,MAAM,GAAG,SAAS,CAAC;gBAClD,8BAA8B,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC;YACxD,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACX,IAAA,oBAAG,GAAE,CAAC,KAAK,CAAC,6CAA6C,GAAG,EAAE,CAAC,CAAC;gBAChE,8BAA8B,CAAC,KAAK,GAAG,GAAG,CAAC;YAC/C,CAAC;YAED,OAAO,8BAA8B,CAAC;QAC1C,CAAC;KAAA;CACJ;AAtLD,sEAsLC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.trades = void 0;
|
|
4
|
+
/*! Copyright (c) 2025, XAPP AI */
|
|
5
|
+
exports.trades = [
|
|
6
|
+
"Bathroom - Bathtub Liner or Shower Enclosure",
|
|
7
|
+
"Bathroom - Bathtub or Shower Updates",
|
|
8
|
+
"Bathroom - Bathtub to Shower Conversion",
|
|
9
|
+
"Bathroom - Remodel",
|
|
10
|
+
"Bathroom - Walk-in Tub",
|
|
11
|
+
"Doors - Exterior Door Install or Replace",
|
|
12
|
+
"Doors - Interior Door Install or Replace",
|
|
13
|
+
"Gutter - Cover",
|
|
14
|
+
"Gutters - Install or Replace",
|
|
15
|
+
"Gutters Repair - Service Call",
|
|
16
|
+
"Roofing - Asphalt Install or Replace",
|
|
17
|
+
"Roofing - Clay Tile Install or Replace",
|
|
18
|
+
"Roofing - Commercial Install or Replace",
|
|
19
|
+
"Roofing - Commercial Repair",
|
|
20
|
+
"Roofing - Flat Install or Replace",
|
|
21
|
+
"Roofing - Inspection",
|
|
22
|
+
"Roofing - Metal Install or Replace",
|
|
23
|
+
"Roofing - Repair",
|
|
24
|
+
"Roofing - Wood Shingles Install or Replace",
|
|
25
|
+
"Siding - Brick or Stone Install or Replace",
|
|
26
|
+
"Siding - Cement Install or Replace",
|
|
27
|
+
"Siding - Metal Install or Replace",
|
|
28
|
+
"Siding - Repair",
|
|
29
|
+
"Siding - Stucco Install or Replace",
|
|
30
|
+
"Siding - Vinyl Install or Replace",
|
|
31
|
+
"Siding - Wood Install or Replace",
|
|
32
|
+
"Windows - Glass Repair",
|
|
33
|
+
"Windows - Replace 1 Window",
|
|
34
|
+
"Windows - Replace 10+ Windows",
|
|
35
|
+
"Windows - Replace 2 Windows",
|
|
36
|
+
"Windows - Replace 3-5 Windows",
|
|
37
|
+
"Windows - Replace 6-9 Windows",
|
|
38
|
+
"Windows - Replace Storm Windows",
|
|
39
|
+
"Windows Repair - Service Call",
|
|
40
|
+
"Alarm or Security System - Install",
|
|
41
|
+
"Home Automation System - Install or Service",
|
|
42
|
+
"Alarm or Security System - Repair",
|
|
43
|
+
"Exterior Home or Structure - Paint or Stain",
|
|
44
|
+
"Concrete Floor Coating-Apply",
|
|
45
|
+
"Sunroom or Patio Enclosure - Build",
|
|
46
|
+
"Arbor Pergola or Trellis - Build Custom",
|
|
47
|
+
"Gazebo or Freestanding Porch - Build or Install",
|
|
48
|
+
"Pool Enclosure - Build",
|
|
49
|
+
"Basement - Remodel",
|
|
50
|
+
"Stone Slab Countertops - Install (Granite, Marble, Quartz, etc)",
|
|
51
|
+
"Cabinets - Reface",
|
|
52
|
+
"Cabinets - Install",
|
|
53
|
+
"Custom Cabinets - Build",
|
|
54
|
+
"Pre-Made Cabinets - Install",
|
|
55
|
+
"Solar - Installation",
|
|
56
|
+
"Cabinets - Refinish",
|
|
57
|
+
"Laminate Countertops - Install",
|
|
58
|
+
"Solid Surface Countertops - Install (Concrete, Stainless Steel, etc)",
|
|
59
|
+
"Cabinets - Repair",
|
|
60
|
+
"Stone Slab Countertops - Repair (Granite, Marble, Quartz, etc)",
|
|
61
|
+
"Solid Surface Countertops - Repair (Concrete, Stainless Steel, etc)",
|
|
62
|
+
"Laminate Countertops - Repair",
|
|
63
|
+
"Wood Fence - Repair",
|
|
64
|
+
"Vinyl or PVC Fence - Install",
|
|
65
|
+
"Aluminum or Steel Fence - Install",
|
|
66
|
+
"Wrought Iron Fence - Install",
|
|
67
|
+
"Gate for Driveway or Security - Install or Replace",
|
|
68
|
+
"Wood Fence - Repair - For Business",
|
|
69
|
+
"Chain Link Fence - Install",
|
|
70
|
+
"Chain Link Fence - Repair or Alter",
|
|
71
|
+
"Wrought Iron Fence - Repair or Weld",
|
|
72
|
+
"Vinyl or PVC Fence - Repair",
|
|
73
|
+
"Aluminum or Steel Fence - Repair",
|
|
74
|
+
"Barbed Wire Fence - Install",
|
|
75
|
+
"Barbed Wire Fence - Repair",
|
|
76
|
+
"Wood Flooring - Install or Replace",
|
|
77
|
+
"Tile or Stone Flooring - Install or Replace",
|
|
78
|
+
"Laminate Flooring - Install or Replace",
|
|
79
|
+
"Vinyl or Linoleum Floor - Install or Replace",
|
|
80
|
+
"Carpet - Install or Replace",
|
|
81
|
+
"Wood Flooring - Refinish",
|
|
82
|
+
"Flooring - Repair",
|
|
83
|
+
"Handyman for Multiple Small Projects",
|
|
84
|
+
"Home Warranty Program",
|
|
85
|
+
"Home Maintenance Contract or Warranty Program",
|
|
86
|
+
"Central A/C - Install",
|
|
87
|
+
"Gas Furnace / Forced Air Heating System - Install",
|
|
88
|
+
"Heat Pump - Install or Replace",
|
|
89
|
+
"Electric Furnace / Forced Air Heating System - Install",
|
|
90
|
+
"Oil Furnace / Forced Air Heating System - Install",
|
|
91
|
+
"Furnace / Forced Air Heating System - Install or Replace",
|
|
92
|
+
"Central A/C - Service or Repair",
|
|
93
|
+
"Gas Furnace / Forced Air Heating System - Repair",
|
|
94
|
+
"Heat Pump - Repair or Service",
|
|
95
|
+
"Electric Furnace / Forced Air Heating System - Repair",
|
|
96
|
+
"Oil Furnace / Forced Air Heating System - Repair",
|
|
97
|
+
"Swamp Cooler - Service or Repair",
|
|
98
|
+
"Swamp Cooler - Install or Replace",
|
|
99
|
+
"Radiant Floor Heating System - Install",
|
|
100
|
+
"Furnace / Forced Air Heating System - Repair or Service",
|
|
101
|
+
"Boiler or Radiator Heating System - Repair or Service",
|
|
102
|
+
"Kitchen - Remodel"
|
|
103
|
+
];
|
|
104
|
+
//# sourceMappingURL=trades.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trades.js","sourceRoot":"","sources":["../../src/Data/trades.ts"],"names":[],"mappings":";;;AAAA,kCAAkC;AACrB,QAAA,MAAM,GAAG;IAClB,8CAA8C;IAC9C,sCAAsC;IACtC,yCAAyC;IACzC,oBAAoB;IACpB,wBAAwB;IACxB,0CAA0C;IAC1C,0CAA0C;IAC1C,gBAAgB;IAChB,8BAA8B;IAC9B,+BAA+B;IAC/B,sCAAsC;IACtC,wCAAwC;IACxC,yCAAyC;IACzC,6BAA6B;IAC7B,mCAAmC;IACnC,sBAAsB;IACtB,oCAAoC;IACpC,kBAAkB;IAClB,4CAA4C;IAC5C,4CAA4C;IAC5C,oCAAoC;IACpC,mCAAmC;IACnC,iBAAiB;IACjB,oCAAoC;IACpC,mCAAmC;IACnC,kCAAkC;IAClC,wBAAwB;IACxB,4BAA4B;IAC5B,+BAA+B;IAC/B,6BAA6B;IAC7B,+BAA+B;IAC/B,+BAA+B;IAC/B,iCAAiC;IACjC,+BAA+B;IAC/B,oCAAoC;IACpC,6CAA6C;IAC7C,mCAAmC;IACnC,6CAA6C;IAC7C,8BAA8B;IAC9B,oCAAoC;IACpC,yCAAyC;IACzC,iDAAiD;IACjD,wBAAwB;IACxB,oBAAoB;IACpB,iEAAiE;IACjE,mBAAmB;IACnB,oBAAoB;IACpB,yBAAyB;IACzB,6BAA6B;IAC7B,sBAAsB;IACtB,qBAAqB;IACrB,gCAAgC;IAChC,sEAAsE;IACtE,mBAAmB;IACnB,gEAAgE;IAChE,qEAAqE;IACrE,+BAA+B;IAC/B,qBAAqB;IACrB,8BAA8B;IAC9B,mCAAmC;IACnC,8BAA8B;IAC9B,oDAAoD;IACpD,oCAAoC;IACpC,4BAA4B;IAC5B,oCAAoC;IACpC,qCAAqC;IACrC,6BAA6B;IAC7B,kCAAkC;IAClC,6BAA6B;IAC7B,4BAA4B;IAC5B,oCAAoC;IACpC,6CAA6C;IAC7C,wCAAwC;IACxC,8CAA8C;IAC9C,6BAA6B;IAC7B,0BAA0B;IAC1B,mBAAmB;IACnB,sCAAsC;IACtC,uBAAuB;IACvB,+CAA+C;IAC/C,uBAAuB;IACvB,mDAAmD;IACnD,gCAAgC;IAChC,wDAAwD;IACxD,mDAAmD;IACnD,0DAA0D;IAC1D,iCAAiC;IACjC,kDAAkD;IAClD,+BAA+B;IAC/B,uDAAuD;IACvD,kDAAkD;IAClD,kCAAkC;IAClC,mCAAmC;IACnC,wCAAwC;IACxC,yDAAyD;IACzD,uDAAuD;IACvD,mBAAmB;CACpB,CAAC"}
|
package/lib/index.d.ts
ADDED
package/lib/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
/*! Copyright (c) 2024, XAPP AI */
|
|
18
|
+
__exportStar(require("./ContractorAppointmentsService"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kCAAkC;AAClC,kEAAgD"}
|
package/lib/models.d.ts
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/*! Copyright (c) 2024, XAPP AI */
|
|
2
|
+
export interface ContractorAppointmentsExternalLeadExtras {
|
|
3
|
+
/**
|
|
4
|
+
* Typically aligned with the session ID to allow the same customer to have multiple conversations and create multiple leads.
|
|
5
|
+
*/
|
|
6
|
+
externalId?: string;
|
|
7
|
+
/**
|
|
8
|
+
* The URL of the website the lead is on when the lead capture is complete
|
|
9
|
+
*/
|
|
10
|
+
source?: string;
|
|
11
|
+
/**
|
|
12
|
+
* ID of the bot. Pass this in if you aren't using 'bot' or the STUDIO_APP_ID
|
|
13
|
+
*/
|
|
14
|
+
botId?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Was the session abandoned i.e. widget was closed (= no more data)?
|
|
17
|
+
*/
|
|
18
|
+
isAbandoned?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface ContractorAppointmentsLeadTranscript {
|
|
21
|
+
/**
|
|
22
|
+
* What the end user asked
|
|
23
|
+
*/
|
|
24
|
+
question: string;
|
|
25
|
+
/**
|
|
26
|
+
* How the bot responded
|
|
27
|
+
*/
|
|
28
|
+
answer: string;
|
|
29
|
+
}
|
|
30
|
+
export interface ContractorAppointmentsLead extends ContractorAppointmentsExternalLeadExtras {
|
|
31
|
+
/**
|
|
32
|
+
* A transcript of the conversation that lead to the lead
|
|
33
|
+
*/
|
|
34
|
+
transcript: ContractorAppointmentsLeadTranscript[];
|
|
35
|
+
/**
|
|
36
|
+
* The fields and their value for the lead.
|
|
37
|
+
*/
|
|
38
|
+
fields: {
|
|
39
|
+
name: string;
|
|
40
|
+
value: string;
|
|
41
|
+
}[];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Address
|
|
45
|
+
*/
|
|
46
|
+
export interface ContractorAppointmentsAddress {
|
|
47
|
+
id?: string;
|
|
48
|
+
street: string;
|
|
49
|
+
street_line_2?: string;
|
|
50
|
+
city: string;
|
|
51
|
+
state: string;
|
|
52
|
+
zip: string;
|
|
53
|
+
country: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Description of a lead
|
|
57
|
+
*
|
|
58
|
+
* @export
|
|
59
|
+
* @interface ContractorAppointmentsLead
|
|
60
|
+
*/
|
|
61
|
+
export interface ContractorAppointmentsCustomer {
|
|
62
|
+
lp_campaign_id: string;
|
|
63
|
+
lp_campaign_key: string;
|
|
64
|
+
lp_response: "json";
|
|
65
|
+
lp_ping_id: string;
|
|
66
|
+
lp_test?: string;
|
|
67
|
+
first_name: string;
|
|
68
|
+
last_name: string;
|
|
69
|
+
phone_home: string;
|
|
70
|
+
address?: string;
|
|
71
|
+
city?: string;
|
|
72
|
+
state?: string;
|
|
73
|
+
zip_code?: string;
|
|
74
|
+
email_address?: string;
|
|
75
|
+
ip_address: string;
|
|
76
|
+
source_type: "Other";
|
|
77
|
+
Trade: string;
|
|
78
|
+
Project_Description: string;
|
|
79
|
+
lp_s1: string;
|
|
80
|
+
lp_s2: string;
|
|
81
|
+
}
|
|
82
|
+
export interface ContractorAppointmentsPagination<Data = unknown> {
|
|
83
|
+
page: number;
|
|
84
|
+
page_size: number;
|
|
85
|
+
total_pages: number;
|
|
86
|
+
total_items: number;
|
|
87
|
+
data: Data[];
|
|
88
|
+
}
|
|
89
|
+
export interface ContractorAppointmentsResponse<Data = any> {
|
|
90
|
+
status: "Success" | "Failure";
|
|
91
|
+
error?: string;
|
|
92
|
+
data?: Data;
|
|
93
|
+
}
|
package/lib/models.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":";AAAA,kCAAkC;AAClC,8CAA8C"}
|
package/lib/util.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Message, ExternalLead, DateTime } from "stentor-models";
|
|
2
|
+
import { ContractorAppointmentsLeadTranscript } from "./models";
|
|
3
|
+
import addresser from "addresser";
|
|
4
|
+
export declare function transformTranscript(transcript: Message[], botId?: string): ContractorAppointmentsLeadTranscript[];
|
|
5
|
+
export declare function parseAddress(addressString: string): Promise<addresser.IParsedAddress>;
|
|
6
|
+
export declare function queryfy(obj: {
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
}, excludeKeys?: string[]): URLSearchParams;
|
|
9
|
+
export declare function getUTCOffset(dateString: string): number;
|
|
10
|
+
export declare function getName(lead: ExternalLead): any;
|
|
11
|
+
/**
|
|
12
|
+
* Array of DateTime objects for the next n days from today
|
|
13
|
+
*
|
|
14
|
+
* @param n
|
|
15
|
+
* @returns
|
|
16
|
+
*/
|
|
17
|
+
export declare function getNextDays(n: number): DateTime[];
|
package/lib/util.js
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.transformTranscript = transformTranscript;
|
|
16
|
+
exports.parseAddress = parseAddress;
|
|
17
|
+
exports.queryfy = queryfy;
|
|
18
|
+
exports.getUTCOffset = getUTCOffset;
|
|
19
|
+
exports.getName = getName;
|
|
20
|
+
exports.getNextDays = getNextDays;
|
|
21
|
+
/*! Copyright (c) 2024, XAPP AI */
|
|
22
|
+
const stentor_logger_1 = require("stentor-logger");
|
|
23
|
+
const addresser_1 = __importDefault(require("addresser"));
|
|
24
|
+
const axios_1 = __importDefault(require("axios"));
|
|
25
|
+
function transformTranscript(transcript, botId) {
|
|
26
|
+
const HousecallProTranscript = [];
|
|
27
|
+
const current = {
|
|
28
|
+
question: "",
|
|
29
|
+
answer: ""
|
|
30
|
+
};
|
|
31
|
+
// This is very fragile at the moment
|
|
32
|
+
transcript.forEach((value, index) => {
|
|
33
|
+
const message = value.message;
|
|
34
|
+
let isFromBot = false;
|
|
35
|
+
if (value.from && value.from.id) {
|
|
36
|
+
isFromBot =
|
|
37
|
+
value.from.id === botId || value.from.id === "bot" || value.from.id === process.env["STUDIO_APP_ID"];
|
|
38
|
+
}
|
|
39
|
+
// Either what they passed in, the app_id, or "bot" which is another possible default
|
|
40
|
+
if (isFromBot) {
|
|
41
|
+
// From the bot, the answer
|
|
42
|
+
current.answer = message;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
current.question = message;
|
|
46
|
+
}
|
|
47
|
+
if (index % 2) {
|
|
48
|
+
// push if we are on the add number
|
|
49
|
+
HousecallProTranscript.push(Object.assign({}, current));
|
|
50
|
+
// clean it
|
|
51
|
+
current.answer = "";
|
|
52
|
+
current.question = "";
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
// If we are at the end and not on a odd number
|
|
56
|
+
if (index === transcript.length - 1) {
|
|
57
|
+
HousecallProTranscript.push(Object.assign({}, current));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
return HousecallProTranscript;
|
|
62
|
+
}
|
|
63
|
+
function parseAddress(addressString) {
|
|
64
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
65
|
+
let parsedAddress;
|
|
66
|
+
if (!addressString) {
|
|
67
|
+
(0, stentor_logger_1.log)().info("No Address passed...");
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
try {
|
|
71
|
+
addresser_1.default.parseAddress(addressString);
|
|
72
|
+
}
|
|
73
|
+
catch (err) {
|
|
74
|
+
(0, stentor_logger_1.log)().error(`Invalid address, go through Google ${addressString}: ${err}`);
|
|
75
|
+
const addrDetails = yield getAddressDetails(addressString);
|
|
76
|
+
return addrDetails;
|
|
77
|
+
}
|
|
78
|
+
try {
|
|
79
|
+
parsedAddress = addresser_1.default.parseAddress(addressString);
|
|
80
|
+
// Service Titan Requires Zip Code. Get it from Google
|
|
81
|
+
if ((parsedAddress === null || parsedAddress === void 0 ? void 0 : parsedAddress.addressLine1) && !(parsedAddress === null || parsedAddress === void 0 ? void 0 : parsedAddress.zipCode)) {
|
|
82
|
+
const addressDetails = yield getAddressDetails(addressString);
|
|
83
|
+
return addressDetails;
|
|
84
|
+
}
|
|
85
|
+
return parsedAddress;
|
|
86
|
+
}
|
|
87
|
+
catch (e) {
|
|
88
|
+
(0, stentor_logger_1.log)().error(`Invalid address ${addressString}: ${e}`);
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
function getAddressDetails(addressString) {
|
|
94
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
95
|
+
const predictions = yield axios_1.default.request({
|
|
96
|
+
method: "get",
|
|
97
|
+
url: `https://places.xapp.ai/maps/api/place/autocomplete/json?input=${addressString}`
|
|
98
|
+
});
|
|
99
|
+
// Match found: Get Details
|
|
100
|
+
if (predictions.data.predictions.length > 0) {
|
|
101
|
+
const details = yield axios_1.default.request({
|
|
102
|
+
method: "get",
|
|
103
|
+
url: `https://places.xapp.ai/maps/api/place/details/json?place_id=${predictions.data.predictions[0].place_id}`
|
|
104
|
+
});
|
|
105
|
+
return addresser_1.default.parseAddress(details.data.result.formatted_address);
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
function queryfy(obj, excludeKeys) {
|
|
113
|
+
const params = new URLSearchParams();
|
|
114
|
+
Object.keys(obj).forEach((key) => {
|
|
115
|
+
if (excludeKeys && excludeKeys.includes(key)) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const value = obj[key];
|
|
119
|
+
if (value !== undefined) {
|
|
120
|
+
if (Array.isArray(value)) {
|
|
121
|
+
params.append(key, value.join(",")); // %2C
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
params.append(key, value.toString());
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
return params;
|
|
129
|
+
}
|
|
130
|
+
function getUTCOffset(dateString) {
|
|
131
|
+
const date = new Date(dateString);
|
|
132
|
+
const utcOffsetMinutes = date.getTimezoneOffset();
|
|
133
|
+
const utcOffsetHours = utcOffsetMinutes / 60;
|
|
134
|
+
return -utcOffsetHours; // Return negative because getTimezoneOffset returns positive for timezones ahead of UTC
|
|
135
|
+
}
|
|
136
|
+
function getName(lead) {
|
|
137
|
+
// Try to find a field with the name "FULL_NAME" in the lead.fields array
|
|
138
|
+
const fullNameField = lead.fields.find((field) => field.name === "FULL_NAME");
|
|
139
|
+
// If a "FULL_NAME" field is found, return its value
|
|
140
|
+
if (fullNameField) {
|
|
141
|
+
const nameParts = fullNameField.value.trim().split(/\s+/);
|
|
142
|
+
const lastName = nameParts.pop();
|
|
143
|
+
const firstName = nameParts.join(" ");
|
|
144
|
+
return {
|
|
145
|
+
firstName,
|
|
146
|
+
lastName
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
// If no "FULL_NAME" field is found, try to find "FIRST_NAME" and "LAST_NAME" fields
|
|
150
|
+
const firstNameField = lead.fields.find((field) => field.name === "FIRST_NAME");
|
|
151
|
+
const lastNameField = lead.fields.find((field) => field.name === "LAST_NAME");
|
|
152
|
+
// If both "FIRST_NAME" and "LAST_NAME" fields are found, concatenate their values with a space in between
|
|
153
|
+
if (firstNameField && lastNameField)
|
|
154
|
+
return {
|
|
155
|
+
firstName: firstNameField,
|
|
156
|
+
lastName: lastNameField
|
|
157
|
+
};
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Array of DateTime objects for the next n days from today
|
|
162
|
+
*
|
|
163
|
+
* @param n
|
|
164
|
+
* @returns
|
|
165
|
+
*/
|
|
166
|
+
function getNextDays(n) {
|
|
167
|
+
const dates = [];
|
|
168
|
+
let today = new Date();
|
|
169
|
+
const serverOffset = today.getTimezoneOffset();
|
|
170
|
+
today = moveBackByMinutes(today, 240 - serverOffset); // TODO: visitor (browser) or service location address
|
|
171
|
+
for (let i = 1; i <= n; i++) {
|
|
172
|
+
const nextDay = new Date(today);
|
|
173
|
+
nextDay.setDate(today.getDate() + i);
|
|
174
|
+
const year = nextDay.getFullYear();
|
|
175
|
+
const month = (nextDay.getMonth() + 1).toString().padStart(2, "0");
|
|
176
|
+
const day = nextDay.getDate().toString().padStart(2, "0");
|
|
177
|
+
dates.push({ date: `${year}-${month}-${day}` });
|
|
178
|
+
}
|
|
179
|
+
return dates;
|
|
180
|
+
}
|
|
181
|
+
function moveBackByMinutes(d, minutes) {
|
|
182
|
+
if (minutes !== 0) {
|
|
183
|
+
d.setMinutes(d.getMinutes() - minutes);
|
|
184
|
+
}
|
|
185
|
+
(0, stentor_logger_1.log)().info(`Jobber: Moved back ${minutes} minutes: ${d}`);
|
|
186
|
+
return d;
|
|
187
|
+
}
|
|
188
|
+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AC;QAChB,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,EAAE,GAAG,OAAO,CAAC,CAAC;IAC3C,CAAC;IACD,IAAA,oBAAG,GAAE,CAAC,IAAI,CAAC,sBAAsB,OAAO,aAAa,CAAC,EAAE,CAAC,CAAC;IAC1D,OAAO,CAAC,CAAC;AACb,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@xapp/stentor-service-contractor-appointments",
|
|
3
|
+
"license": "Apache-2.0",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
7
|
+
"version": "1.71.0",
|
|
8
|
+
"description": "Service to integrate with Contractor Appointments",
|
|
9
|
+
"types": "lib/index",
|
|
10
|
+
"main": "lib/index",
|
|
11
|
+
"files": [
|
|
12
|
+
"lib"
|
|
13
|
+
],
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": "^10 || ^12 || ^14 || ^16 || ^18 || ^20 || ^22"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@types/chai": "5.2.2",
|
|
19
|
+
"@xapp/config": "0.2.3",
|
|
20
|
+
"chai": "4.5.0",
|
|
21
|
+
"dotenv": "17.2.3",
|
|
22
|
+
"mocha": "11.7.4",
|
|
23
|
+
"stentor-logger": "1.66.0",
|
|
24
|
+
"stentor-models": "1.66.0",
|
|
25
|
+
"stentor-service-fetch": "1.66.0",
|
|
26
|
+
"ts-node": "10.9.2",
|
|
27
|
+
"typescript": "5.9.3"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"stentor-logger": "1.x",
|
|
31
|
+
"stentor-models": "1.x",
|
|
32
|
+
"stentor-service-fetch": "1.x"
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "tsc -d true -p .",
|
|
36
|
+
"clean": "rm -rf ./lib/*",
|
|
37
|
+
"test": "exit 0",
|
|
38
|
+
"local": "mocha --recursive --timeout 9000 -r ts-node/register \"./src/**/*.test.ts\""
|
|
39
|
+
},
|
|
40
|
+
"gitHead": "1a6d144f3e0c4573aebe92ffddf10c8a11a1ee60",
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"addresser": "1.1.20",
|
|
43
|
+
"openai": "5.23.1"
|
|
44
|
+
}
|
|
45
|
+
}
|