@xapp/stentor-service-boberdoo 1.80.4 → 1.81.2
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/lib/BoberdooIntegration.d.ts +56 -6
- package/lib/BoberdooIntegration.js +175 -97
- package/lib/BoberdooIntegration.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +3 -1
- package/lib/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,19 +1,54 @@
|
|
|
1
|
-
import { CrmResponse, ExternalLead } from "stentor-models";
|
|
1
|
+
import { CrmResponse, CrmService, CrmServiceAvailability, CrmServiceAvailabilityOptions, CrmServiceJobType, DateTimeRange, ExternalLead } from "stentor-models";
|
|
2
2
|
import { BoberdooExtras, BoberdooLeadPayload, BoberdooResponse, BoberdooServiceProps } from "./models";
|
|
3
3
|
/**
|
|
4
4
|
* Posting endpoint for PCM Growth's LeadPortal/Boberdoo install. Exported
|
|
5
5
|
* so callers can opt in explicitly via `BoberdooServiceProps.apiEndpoint`.
|
|
6
6
|
*/
|
|
7
7
|
export declare const PCM_GROWTH_LEADPORTAL_ENDPOINT = "https://pcmgrowth.leadportal.com/apiJSON.php";
|
|
8
|
+
/**
|
|
9
|
+
* Describes the HTTP request that should be posted to the partner.
|
|
10
|
+
* Stateless callers (e.g. stentor-api's chain runner) execute the
|
|
11
|
+
* request themselves so they can capture it for audit logging.
|
|
12
|
+
*
|
|
13
|
+
* SECURITY: `body.Request.Key` is the partner API credential. Callers
|
|
14
|
+
* that audit-log this descriptor must redact `Request.Key` before
|
|
15
|
+
* persisting the body.
|
|
16
|
+
*/
|
|
17
|
+
export interface BoberdooRequestDescriptor {
|
|
18
|
+
url: string;
|
|
19
|
+
method: "POST";
|
|
20
|
+
headers: Record<string, string>;
|
|
21
|
+
body: {
|
|
22
|
+
Request: BoberdooLeadPayload;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Builds the JSON request that should be POSTed to the partner.
|
|
27
|
+
*
|
|
28
|
+
* Stateless and side-effect free — callers can execute the request
|
|
29
|
+
* themselves (e.g. through a chain runner that performs audit logging)
|
|
30
|
+
* and pass the response body to `parseBoberdooResponse`.
|
|
31
|
+
*/
|
|
32
|
+
export declare function buildBoberdooRequest(props: BoberdooServiceProps, externalLead: ExternalLead, extras?: BoberdooExtras): BoberdooRequestDescriptor;
|
|
33
|
+
/**
|
|
34
|
+
* Parses a response body returned by the partner into a structured
|
|
35
|
+
* `BoberdooResponse`. Stateless — callers that execute the HTTP request
|
|
36
|
+
* themselves pass the raw response body here.
|
|
37
|
+
*/
|
|
38
|
+
export declare function parseBoberdooResponse(responseBody: unknown): BoberdooResponse;
|
|
8
39
|
/**
|
|
9
40
|
* BoberdooIntegration posts leads to a LeadPortal/Boberdoo lead distribution
|
|
10
41
|
* platform using the `pingPostLead` action in full mode.
|
|
11
42
|
*
|
|
43
|
+
* Boberdoo is a lead-distribution service rather than a true CRM, so the
|
|
44
|
+
* `getAvailability` and `getJobType` methods are stubbed: availability is
|
|
45
|
+
* always unlimited and job type matching is not performed. The interface
|
|
46
|
+
* is implemented so consumers can treat it uniformly with other CRMs.
|
|
47
|
+
*
|
|
12
48
|
* @see https://pcmgrowth.leadportal.com/new_api/index.php?action=detail&func=pingPostLead&TYPE=33
|
|
13
49
|
*/
|
|
14
|
-
export declare class BoberdooIntegration {
|
|
50
|
+
export declare class BoberdooIntegration implements CrmService {
|
|
15
51
|
private props;
|
|
16
|
-
private apiEndpoint;
|
|
17
52
|
constructor(props: BoberdooServiceProps);
|
|
18
53
|
/**
|
|
19
54
|
* Posts a lead to the partner.
|
|
@@ -32,8 +67,23 @@ export declare class BoberdooIntegration {
|
|
|
32
67
|
*/
|
|
33
68
|
send(externalLead: ExternalLead, extras?: BoberdooExtras): Promise<CrmResponse>;
|
|
34
69
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
70
|
+
* Boberdoo is a lead-distribution platform with no concept of
|
|
71
|
+
* appointment availability, so this stub returns full availability
|
|
72
|
+
* for the requested range — matching the convention used by other
|
|
73
|
+
* stentor CRM services that don't expose a scheduling API.
|
|
74
|
+
*/
|
|
75
|
+
getAvailability(range: DateTimeRange, options?: CrmServiceAvailabilityOptions): Promise<CrmServiceAvailability>;
|
|
76
|
+
/**
|
|
77
|
+
* Boberdoo does not surface job-type classification on the lead;
|
|
78
|
+
* the partner's matching system handles that on their side.
|
|
79
|
+
*/
|
|
80
|
+
getJobType(message: string, externalLead?: ExternalLead): Promise<CrmServiceJobType>;
|
|
81
|
+
/**
|
|
82
|
+
* Builds the descriptor, executes it via axios, and parses the body.
|
|
83
|
+
* Kept protected so subclasses can override the transport, but most
|
|
84
|
+
* consumers should use the exported `buildBoberdooRequest` /
|
|
85
|
+
* `parseBoberdooResponse` helpers directly to plug into their own
|
|
86
|
+
* transport / audit pipeline.
|
|
37
87
|
*/
|
|
38
|
-
protected post(
|
|
88
|
+
protected post(externalLead: ExternalLead, extras?: BoberdooExtras): Promise<BoberdooResponse>;
|
|
39
89
|
}
|
|
@@ -13,6 +13,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.BoberdooIntegration = exports.PCM_GROWTH_LEADPORTAL_ENDPOINT = void 0;
|
|
16
|
+
exports.buildBoberdooRequest = buildBoberdooRequest;
|
|
17
|
+
exports.parseBoberdooResponse = parseBoberdooResponse;
|
|
16
18
|
/*! Copyright (c) 2026, XAPP AI */
|
|
17
19
|
const stentor_logger_1 = require("stentor-logger");
|
|
18
20
|
const axios_1 = __importDefault(require("axios"));
|
|
@@ -24,16 +26,139 @@ exports.PCM_GROWTH_LEADPORTAL_ENDPOINT = "https://pcmgrowth.leadportal.com/apiJS
|
|
|
24
26
|
// Partner-provided zip that routes the lead to a test partner so test
|
|
25
27
|
// posts come back Matched without billing a real buyer.
|
|
26
28
|
const TEST_ZIP = "99999";
|
|
29
|
+
/**
|
|
30
|
+
* Splits a `FULL_NAME` value into first and last names. Uses the
|
|
31
|
+
* "first token is the first name, everything else is the last name"
|
|
32
|
+
* convention — e.g. `"Mary Jane Watson"` → `first="Mary"`, `last="Jane Watson"`.
|
|
33
|
+
*
|
|
34
|
+
* Kept inline so each service can call it without a cross-package
|
|
35
|
+
* dependency; mirror this same function in any sibling service so a
|
|
36
|
+
* single lead always produces the same wire name across CRMs.
|
|
37
|
+
*/
|
|
38
|
+
function splitFullName(fullName) {
|
|
39
|
+
const parts = fullName.trim().split(/\s+/);
|
|
40
|
+
return {
|
|
41
|
+
firstName: parts[0],
|
|
42
|
+
lastName: parts.slice(1).join(" ") || undefined
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Builds the JSON request that should be POSTed to the partner.
|
|
47
|
+
*
|
|
48
|
+
* Stateless and side-effect free — callers can execute the request
|
|
49
|
+
* themselves (e.g. through a chain runner that performs audit logging)
|
|
50
|
+
* and pass the response body to `parseBoberdooResponse`.
|
|
51
|
+
*/
|
|
52
|
+
function buildBoberdooRequest(props, externalLead, extras) {
|
|
53
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
54
|
+
const firstName = (_a = externalLead.fields.find((f) => f.name === "FIRST_NAME")) === null || _a === void 0 ? void 0 : _a.value;
|
|
55
|
+
const lastName = (_b = externalLead.fields.find((f) => f.name === "LAST_NAME")) === null || _b === void 0 ? void 0 : _b.value;
|
|
56
|
+
const fullName = (_c = externalLead.fields.find((f) => f.name === "FULL_NAME")) === null || _c === void 0 ? void 0 : _c.value;
|
|
57
|
+
const phone = (_d = externalLead.fields.find((f) => f.name === "PHONE")) === null || _d === void 0 ? void 0 : _d.value;
|
|
58
|
+
const email = (_e = externalLead.fields.find((f) => f.name === "EMAIL")) === null || _e === void 0 ? void 0 : _e.value;
|
|
59
|
+
const address = (_f = externalLead.fields.find((f) => f.name === "ADDRESS")) === null || _f === void 0 ? void 0 : _f.value;
|
|
60
|
+
const city = (_g = externalLead.fields.find((f) => f.name === "CITY")) === null || _g === void 0 ? void 0 : _g.value;
|
|
61
|
+
const state = (_h = externalLead.fields.find((f) => f.name === "STATE")) === null || _h === void 0 ? void 0 : _h.value;
|
|
62
|
+
const zip = (_j = externalLead.fields.find((f) => f.name === "ZIP")) === null || _j === void 0 ? void 0 : _j.value;
|
|
63
|
+
let resolvedFirstName = firstName;
|
|
64
|
+
let resolvedLastName = lastName;
|
|
65
|
+
if (!resolvedFirstName && fullName) {
|
|
66
|
+
const split = splitFullName(fullName);
|
|
67
|
+
resolvedFirstName = split.firstName;
|
|
68
|
+
resolvedLastName = split.lastName;
|
|
69
|
+
}
|
|
70
|
+
const payload = {
|
|
71
|
+
Format: "JSON",
|
|
72
|
+
Key: props.apiKey,
|
|
73
|
+
API_Action: "pingPostLead",
|
|
74
|
+
Mode: "full",
|
|
75
|
+
TYPE: props.leadType,
|
|
76
|
+
SRC: props.src,
|
|
77
|
+
Landing_Page: props.landingPage
|
|
78
|
+
};
|
|
79
|
+
if (resolvedFirstName)
|
|
80
|
+
payload.First_Name = resolvedFirstName;
|
|
81
|
+
if (resolvedLastName)
|
|
82
|
+
payload.Last_Name = resolvedLastName;
|
|
83
|
+
if (phone)
|
|
84
|
+
payload.Primary_Phone = phone;
|
|
85
|
+
if (email)
|
|
86
|
+
payload.Email = email;
|
|
87
|
+
if (address)
|
|
88
|
+
payload.Address = address;
|
|
89
|
+
if (city)
|
|
90
|
+
payload.City = city;
|
|
91
|
+
if (state)
|
|
92
|
+
payload.State = state;
|
|
93
|
+
if (zip)
|
|
94
|
+
payload.Zip = zip;
|
|
95
|
+
if (extras === null || extras === void 0 ? void 0 : extras.xxTrustedFormCertUrl)
|
|
96
|
+
payload.Trusted_Form_URL = extras.xxTrustedFormCertUrl;
|
|
97
|
+
if (extras === null || extras === void 0 ? void 0 : extras.utm_source)
|
|
98
|
+
payload.utm_source = extras.utm_source;
|
|
99
|
+
if (extras === null || extras === void 0 ? void 0 : extras.utm_campaign)
|
|
100
|
+
payload.utm_campaign = extras.utm_campaign;
|
|
101
|
+
if (extras === null || extras === void 0 ? void 0 : extras.utm_medium)
|
|
102
|
+
payload.utm_medium = extras.utm_medium;
|
|
103
|
+
if (extras === null || extras === void 0 ? void 0 : extras.utm_content)
|
|
104
|
+
payload.utm_content = extras.utm_content;
|
|
105
|
+
if (extras === null || extras === void 0 ? void 0 : extras.utm_term)
|
|
106
|
+
payload.utm_term = extras.utm_term;
|
|
107
|
+
if (props.testMode) {
|
|
108
|
+
payload.Test_Lead = "1";
|
|
109
|
+
// Support directive: in test mode override the zip to TEST_ZIP
|
|
110
|
+
// so the lead is guaranteed to route to the partner's test
|
|
111
|
+
// buyer and come back Matched.
|
|
112
|
+
payload.Zip = TEST_ZIP;
|
|
113
|
+
}
|
|
114
|
+
return {
|
|
115
|
+
url: props.apiEndpoint,
|
|
116
|
+
method: "POST",
|
|
117
|
+
headers: { "Content-Type": "application/json" },
|
|
118
|
+
body: { Request: payload }
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Parses a response body returned by the partner into a structured
|
|
123
|
+
* `BoberdooResponse`. Stateless — callers that execute the HTTP request
|
|
124
|
+
* themselves pass the raw response body here.
|
|
125
|
+
*/
|
|
126
|
+
function parseBoberdooResponse(responseBody) {
|
|
127
|
+
const result = { status: "Failure" };
|
|
128
|
+
const inner = responseBody === null || responseBody === void 0 ? void 0 : responseBody.response;
|
|
129
|
+
const rawStatus = inner === null || inner === void 0 ? void 0 : inner.status;
|
|
130
|
+
if (rawStatus === "Matched" || rawStatus === "Unmatched") {
|
|
131
|
+
result.status = "Success";
|
|
132
|
+
result.rawStatus = rawStatus;
|
|
133
|
+
result.leadId = inner === null || inner === void 0 ? void 0 : inner.lead_id;
|
|
134
|
+
result.price = inner === null || inner === void 0 ? void 0 : inner.price;
|
|
135
|
+
result.data = responseBody;
|
|
136
|
+
}
|
|
137
|
+
else if (rawStatus === "Error") {
|
|
138
|
+
result.rawStatus = "Error";
|
|
139
|
+
result.error = (inner === null || inner === void 0 ? void 0 : inner.error) || "Boberdoo returned Error status";
|
|
140
|
+
result.data = responseBody;
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
result.error = (inner === null || inner === void 0 ? void 0 : inner.error) || `Unexpected response from Boberdoo: ${JSON.stringify(responseBody)}`;
|
|
144
|
+
result.data = responseBody;
|
|
145
|
+
}
|
|
146
|
+
return result;
|
|
147
|
+
}
|
|
27
148
|
/**
|
|
28
149
|
* BoberdooIntegration posts leads to a LeadPortal/Boberdoo lead distribution
|
|
29
150
|
* platform using the `pingPostLead` action in full mode.
|
|
30
151
|
*
|
|
152
|
+
* Boberdoo is a lead-distribution service rather than a true CRM, so the
|
|
153
|
+
* `getAvailability` and `getJobType` methods are stubbed: availability is
|
|
154
|
+
* always unlimited and job type matching is not performed. The interface
|
|
155
|
+
* is implemented so consumers can treat it uniformly with other CRMs.
|
|
156
|
+
*
|
|
31
157
|
* @see https://pcmgrowth.leadportal.com/new_api/index.php?action=detail&func=pingPostLead&TYPE=33
|
|
32
158
|
*/
|
|
33
159
|
class BoberdooIntegration {
|
|
34
160
|
constructor(props) {
|
|
35
161
|
this.props = props;
|
|
36
|
-
this.apiEndpoint = props.apiEndpoint;
|
|
37
162
|
}
|
|
38
163
|
/**
|
|
39
164
|
* Posts a lead to the partner.
|
|
@@ -52,74 +177,12 @@ class BoberdooIntegration {
|
|
|
52
177
|
*/
|
|
53
178
|
send(externalLead, extras) {
|
|
54
179
|
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
56
180
|
const crmResponse = {
|
|
57
181
|
status: "Failure",
|
|
58
182
|
message: ""
|
|
59
183
|
};
|
|
60
184
|
try {
|
|
61
|
-
const
|
|
62
|
-
const lastName = (_b = externalLead.fields.find((f) => f.name === "LAST_NAME")) === null || _b === void 0 ? void 0 : _b.value;
|
|
63
|
-
const fullName = (_c = externalLead.fields.find((f) => f.name === "FULL_NAME")) === null || _c === void 0 ? void 0 : _c.value;
|
|
64
|
-
const phone = (_d = externalLead.fields.find((f) => f.name === "PHONE")) === null || _d === void 0 ? void 0 : _d.value;
|
|
65
|
-
const email = (_e = externalLead.fields.find((f) => f.name === "EMAIL")) === null || _e === void 0 ? void 0 : _e.value;
|
|
66
|
-
const address = (_f = externalLead.fields.find((f) => f.name === "ADDRESS")) === null || _f === void 0 ? void 0 : _f.value;
|
|
67
|
-
const city = (_g = externalLead.fields.find((f) => f.name === "CITY")) === null || _g === void 0 ? void 0 : _g.value;
|
|
68
|
-
const state = (_h = externalLead.fields.find((f) => f.name === "STATE")) === null || _h === void 0 ? void 0 : _h.value;
|
|
69
|
-
const zip = (_j = externalLead.fields.find((f) => f.name === "ZIP")) === null || _j === void 0 ? void 0 : _j.value;
|
|
70
|
-
let resolvedFirstName = firstName;
|
|
71
|
-
let resolvedLastName = lastName;
|
|
72
|
-
if (!resolvedFirstName && fullName) {
|
|
73
|
-
const parts = fullName.trim().split(/\s+/);
|
|
74
|
-
resolvedFirstName = parts[0];
|
|
75
|
-
resolvedLastName = parts.slice(1).join(" ") || undefined;
|
|
76
|
-
}
|
|
77
|
-
const payload = {
|
|
78
|
-
Format: "JSON",
|
|
79
|
-
Key: this.props.apiKey,
|
|
80
|
-
API_Action: "pingPostLead",
|
|
81
|
-
Mode: "full",
|
|
82
|
-
TYPE: this.props.leadType,
|
|
83
|
-
SRC: this.props.src,
|
|
84
|
-
Landing_Page: this.props.landingPage
|
|
85
|
-
};
|
|
86
|
-
if (resolvedFirstName)
|
|
87
|
-
payload.First_Name = resolvedFirstName;
|
|
88
|
-
if (resolvedLastName)
|
|
89
|
-
payload.Last_Name = resolvedLastName;
|
|
90
|
-
if (phone)
|
|
91
|
-
payload.Primary_Phone = phone;
|
|
92
|
-
if (email)
|
|
93
|
-
payload.Email = email;
|
|
94
|
-
if (address)
|
|
95
|
-
payload.Address = address;
|
|
96
|
-
if (city)
|
|
97
|
-
payload.City = city;
|
|
98
|
-
if (state)
|
|
99
|
-
payload.State = state;
|
|
100
|
-
if (zip)
|
|
101
|
-
payload.Zip = zip;
|
|
102
|
-
if (extras === null || extras === void 0 ? void 0 : extras.xxTrustedFormCertUrl) {
|
|
103
|
-
payload.Trusted_Form_URL = extras.xxTrustedFormCertUrl;
|
|
104
|
-
}
|
|
105
|
-
if (extras === null || extras === void 0 ? void 0 : extras.utm_source)
|
|
106
|
-
payload.utm_source = extras.utm_source;
|
|
107
|
-
if (extras === null || extras === void 0 ? void 0 : extras.utm_campaign)
|
|
108
|
-
payload.utm_campaign = extras.utm_campaign;
|
|
109
|
-
if (extras === null || extras === void 0 ? void 0 : extras.utm_medium)
|
|
110
|
-
payload.utm_medium = extras.utm_medium;
|
|
111
|
-
if (extras === null || extras === void 0 ? void 0 : extras.utm_content)
|
|
112
|
-
payload.utm_content = extras.utm_content;
|
|
113
|
-
if (extras === null || extras === void 0 ? void 0 : extras.utm_term)
|
|
114
|
-
payload.utm_term = extras.utm_term;
|
|
115
|
-
if (this.props.testMode) {
|
|
116
|
-
payload.Test_Lead = "1";
|
|
117
|
-
// Support directive: in test mode override the zip to TEST_ZIP
|
|
118
|
-
// so the lead is guaranteed to route to the partner's test
|
|
119
|
-
// buyer and come back Matched.
|
|
120
|
-
payload.Zip = TEST_ZIP;
|
|
121
|
-
}
|
|
122
|
-
const boberdooResponse = yield this.post(payload);
|
|
185
|
+
const boberdooResponse = yield this.post(externalLead, extras);
|
|
123
186
|
if (boberdooResponse.status === "Success") {
|
|
124
187
|
crmResponse.status = "Success";
|
|
125
188
|
if (boberdooResponse.rawStatus) {
|
|
@@ -141,47 +204,62 @@ class BoberdooIntegration {
|
|
|
141
204
|
});
|
|
142
205
|
}
|
|
143
206
|
/**
|
|
144
|
-
*
|
|
145
|
-
*
|
|
207
|
+
* Boberdoo is a lead-distribution platform with no concept of
|
|
208
|
+
* appointment availability, so this stub returns full availability
|
|
209
|
+
* for the requested range — matching the convention used by other
|
|
210
|
+
* stentor CRM services that don't expose a scheduling API.
|
|
146
211
|
*/
|
|
147
|
-
|
|
212
|
+
getAvailability(range,
|
|
213
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
214
|
+
options) {
|
|
148
215
|
return __awaiter(this, void 0, void 0, function* () {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
method: "post",
|
|
154
|
-
url: this.apiEndpoint,
|
|
155
|
-
headers: {
|
|
156
|
-
"Content-Type": "application/json"
|
|
157
|
-
},
|
|
158
|
-
data: { Request: payload }
|
|
216
|
+
(0, stentor_logger_1.log)().debug(`${this.constructor.name} getAvailability not implemented, returning full availability.`);
|
|
217
|
+
return {
|
|
218
|
+
range,
|
|
219
|
+
unavailabilities: []
|
|
159
220
|
};
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Boberdoo does not surface job-type classification on the lead;
|
|
225
|
+
* the partner's matching system handles that on their side.
|
|
226
|
+
*/
|
|
227
|
+
getJobType(
|
|
228
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
229
|
+
message,
|
|
230
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
231
|
+
externalLead) {
|
|
232
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
233
|
+
(0, stentor_logger_1.log)().debug(`${this.constructor.name} getJobType not implemented, returning no match`);
|
|
234
|
+
return;
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Builds the descriptor, executes it via axios, and parses the body.
|
|
239
|
+
* Kept protected so subclasses can override the transport, but most
|
|
240
|
+
* consumers should use the exported `buildBoberdooRequest` /
|
|
241
|
+
* `parseBoberdooResponse` helpers directly to plug into their own
|
|
242
|
+
* transport / audit pipeline.
|
|
243
|
+
*/
|
|
244
|
+
post(externalLead, extras) {
|
|
245
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
246
|
+
const descriptor = buildBoberdooRequest(this.props, externalLead, extras);
|
|
160
247
|
try {
|
|
161
|
-
const response = yield (0, axios_1.default)(
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
boberdooResponse.rawStatus = rawStatus;
|
|
169
|
-
boberdooResponse.leadId = inner === null || inner === void 0 ? void 0 : inner.lead_id;
|
|
170
|
-
boberdooResponse.price = inner === null || inner === void 0 ? void 0 : inner.price;
|
|
171
|
-
}
|
|
172
|
-
else if (rawStatus === "Error") {
|
|
173
|
-
boberdooResponse.rawStatus = "Error";
|
|
174
|
-
boberdooResponse.error = (inner === null || inner === void 0 ? void 0 : inner.error) || "Boberdoo returned Error status";
|
|
175
|
-
}
|
|
176
|
-
else {
|
|
177
|
-
boberdooResponse.error = (inner === null || inner === void 0 ? void 0 : inner.error) || `Unexpected response from Boberdoo: ${JSON.stringify(response.data)}`;
|
|
178
|
-
}
|
|
248
|
+
const response = yield (0, axios_1.default)({
|
|
249
|
+
method: descriptor.method,
|
|
250
|
+
url: descriptor.url,
|
|
251
|
+
headers: descriptor.headers,
|
|
252
|
+
data: descriptor.body
|
|
253
|
+
});
|
|
254
|
+
return parseBoberdooResponse(response.data);
|
|
179
255
|
}
|
|
180
256
|
catch (err) {
|
|
181
257
|
(0, stentor_logger_1.log)().error(`Boberdoo: Error posting lead ${err}`);
|
|
182
|
-
|
|
258
|
+
return {
|
|
259
|
+
status: "Failure",
|
|
260
|
+
error: err instanceof Error ? err.message : String(err)
|
|
261
|
+
};
|
|
183
262
|
}
|
|
184
|
-
return boberdooResponse;
|
|
185
263
|
});
|
|
186
264
|
}
|
|
187
265
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BoberdooIntegration.js","sourceRoot":"","sources":["../src/BoberdooIntegration.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"BoberdooIntegration.js","sour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nD,OAAO;oBACH,MAAM,EAAE,SAAS;oBACjB,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;iBAC1D,CAAC;YACN,CAAC;QACL,CAAC;KAAA;CACJ;AA5GD,kDA4GC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright (c) 2026, XAPP AI */
|
|
2
|
-
export { BoberdooIntegration, PCM_GROWTH_LEADPORTAL_ENDPOINT } from "./BoberdooIntegration";
|
|
2
|
+
export { BoberdooIntegration, BoberdooRequestDescriptor, PCM_GROWTH_LEADPORTAL_ENDPOINT, buildBoberdooRequest, parseBoberdooResponse } from "./BoberdooIntegration";
|
|
3
3
|
export * from "./models";
|
package/lib/index.js
CHANGED
|
@@ -14,10 +14,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.PCM_GROWTH_LEADPORTAL_ENDPOINT = exports.BoberdooIntegration = void 0;
|
|
17
|
+
exports.parseBoberdooResponse = exports.buildBoberdooRequest = exports.PCM_GROWTH_LEADPORTAL_ENDPOINT = exports.BoberdooIntegration = void 0;
|
|
18
18
|
/*! Copyright (c) 2026, XAPP AI */
|
|
19
19
|
var BoberdooIntegration_1 = require("./BoberdooIntegration");
|
|
20
20
|
Object.defineProperty(exports, "BoberdooIntegration", { enumerable: true, get: function () { return BoberdooIntegration_1.BoberdooIntegration; } });
|
|
21
21
|
Object.defineProperty(exports, "PCM_GROWTH_LEADPORTAL_ENDPOINT", { enumerable: true, get: function () { return BoberdooIntegration_1.PCM_GROWTH_LEADPORTAL_ENDPOINT; } });
|
|
22
|
+
Object.defineProperty(exports, "buildBoberdooRequest", { enumerable: true, get: function () { return BoberdooIntegration_1.buildBoberdooRequest; } });
|
|
23
|
+
Object.defineProperty(exports, "parseBoberdooResponse", { enumerable: true, get: function () { return BoberdooIntegration_1.parseBoberdooResponse; } });
|
|
22
24
|
__exportStar(require("./models"), exports);
|
|
23
25
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kCAAkC;AAClC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kCAAkC;AAClC,6DAM+B;AAL3B,0HAAA,mBAAmB,OAAA;AAEnB,qIAAA,8BAA8B,OAAA;AAC9B,2HAAA,oBAAoB,OAAA;AACpB,4HAAA,qBAAqB,OAAA;AAEzB,2CAAyB"}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "1.
|
|
7
|
+
"version": "1.81.2",
|
|
8
8
|
"description": "Service to integrate with Boberdoo lead distribution",
|
|
9
9
|
"types": "lib/index",
|
|
10
10
|
"main": "lib/index",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"test:f": "mocha --recursive --timeout 30000 -r ts-node/register \"./src/**/*.ftest.ts\""
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"axios": "1.16.
|
|
42
|
+
"axios": "1.16.1"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "e3df23c89efad4f4918138e18477d18dc9fc2507"
|
|
45
45
|
}
|