linkedin-secret-sauce 0.7.1 → 0.7.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.
|
@@ -185,29 +185,65 @@ function createLddProvider(config) {
|
|
|
185
185
|
return null;
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
+
/**
|
|
189
|
+
* Calculate confidence score based on email type
|
|
190
|
+
* Professional emails are scored higher than personal ones
|
|
191
|
+
*/
|
|
192
|
+
function getConfidenceScore(emailType) {
|
|
193
|
+
if (!emailType)
|
|
194
|
+
return 75; // Unknown type
|
|
195
|
+
const type = emailType.toLowerCase();
|
|
196
|
+
// Professional/business emails - highest confidence
|
|
197
|
+
if (type === 'professional' || type === 'business' || type === 'work') {
|
|
198
|
+
return 95;
|
|
199
|
+
}
|
|
200
|
+
// Personal emails - still valid but lower priority for B2B
|
|
201
|
+
if (type === 'personal' || type === 'private') {
|
|
202
|
+
return 70;
|
|
203
|
+
}
|
|
204
|
+
// Other types (e.g., "other", "unknown")
|
|
205
|
+
return 75;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Classify email type for the enrichment result
|
|
209
|
+
*/
|
|
210
|
+
function classifyEmailType(emailType) {
|
|
211
|
+
if (!emailType)
|
|
212
|
+
return 'unknown';
|
|
213
|
+
const type = emailType.toLowerCase();
|
|
214
|
+
if (type === 'professional' || type === 'business' || type === 'work') {
|
|
215
|
+
return 'business';
|
|
216
|
+
}
|
|
217
|
+
if (type === 'personal' || type === 'private') {
|
|
218
|
+
return 'personal';
|
|
219
|
+
}
|
|
220
|
+
return 'unknown';
|
|
221
|
+
}
|
|
188
222
|
function parseResponse(data) {
|
|
189
223
|
if (!data.success || !data.data) {
|
|
190
224
|
return null;
|
|
191
225
|
}
|
|
192
226
|
// Return ALL valid emails from the profile
|
|
193
227
|
const profileEmails = data.data.emails || [];
|
|
194
|
-
const validEmails = profileEmails.filter((e) => e.
|
|
228
|
+
const validEmails = profileEmails.filter((e) => e.emailAddress && e.emailAddress.includes("@"));
|
|
195
229
|
if (validEmails.length === 0) {
|
|
196
230
|
return null;
|
|
197
231
|
}
|
|
198
|
-
// Build multi-result with all emails
|
|
199
|
-
const emails = validEmails
|
|
200
|
-
|
|
232
|
+
// Build multi-result with all emails, sorted by confidence (professional first)
|
|
233
|
+
const emails = validEmails
|
|
234
|
+
.map((e) => ({
|
|
235
|
+
email: e.emailAddress,
|
|
201
236
|
verified: true, // LDD data is pre-verified
|
|
202
|
-
confidence:
|
|
237
|
+
confidence: getConfidenceScore(e.emailType),
|
|
203
238
|
metadata: {
|
|
204
|
-
emailType: e.
|
|
205
|
-
|
|
206
|
-
linkedinUsername: data.data.
|
|
207
|
-
|
|
208
|
-
|
|
239
|
+
emailType: e.emailType,
|
|
240
|
+
emailTypeClassified: classifyEmailType(e.emailType),
|
|
241
|
+
linkedinUsername: data.data.linkedInUsername,
|
|
242
|
+
numericLinkedInId: data.data.numericLinkedInId,
|
|
243
|
+
sourceRecordId: data.data.sourceRecordId,
|
|
209
244
|
},
|
|
210
|
-
}))
|
|
245
|
+
}))
|
|
246
|
+
.sort((a, b) => b.confidence - a.confidence); // Sort by confidence descending
|
|
211
247
|
return { emails };
|
|
212
248
|
}
|
|
213
249
|
// Mark provider name for orchestrator
|
|
@@ -467,24 +467,18 @@ export interface SmartProspectGetContactsResponse {
|
|
|
467
467
|
};
|
|
468
468
|
}
|
|
469
469
|
export interface LddProfileEmail {
|
|
470
|
-
|
|
471
|
-
|
|
470
|
+
id: number;
|
|
471
|
+
emailAddress: string | null;
|
|
472
|
+
emailType: string | null;
|
|
472
473
|
}
|
|
473
474
|
export interface LddProfilePhone {
|
|
474
|
-
|
|
475
|
-
|
|
475
|
+
id: number;
|
|
476
|
+
phoneNumber: string | null;
|
|
476
477
|
}
|
|
477
478
|
export interface LddProfileData {
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
linkedin_username?: string | null;
|
|
482
|
-
first_name?: string | null;
|
|
483
|
-
last_name?: string | null;
|
|
484
|
-
full_name?: string | null;
|
|
485
|
-
profile_headline?: string | null;
|
|
486
|
-
profile_summary?: string | null;
|
|
487
|
-
profile_location?: string | null;
|
|
479
|
+
sourceRecordId: string;
|
|
480
|
+
numericLinkedInId: string | null;
|
|
481
|
+
linkedInUsername: string | null;
|
|
488
482
|
emails: LddProfileEmail[];
|
|
489
483
|
phones: LddProfilePhone[];
|
|
490
484
|
}
|