@xuda.io/account_module 1.2.1784 → 1.2.1786
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/index.mjs +25 -22
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -2124,6 +2124,7 @@ export const add_contact = async function (req, job_id, headers) {
|
|
|
2124
2124
|
let is_spam = false;
|
|
2125
2125
|
// let email_type_info;
|
|
2126
2126
|
let account_type_info;
|
|
2127
|
+
let business_info;
|
|
2127
2128
|
let account_type;
|
|
2128
2129
|
let cached_contact;
|
|
2129
2130
|
let business_has_person;
|
|
@@ -2157,18 +2158,19 @@ export const add_contact = async function (req, job_id, headers) {
|
|
|
2157
2158
|
const is_business = await ai_module.is_business_contact(uid, email, name, metadata.subject, metadata.summarized_body, account_profile_info);
|
|
2158
2159
|
account_type = is_business ? 'business' : 'personal';
|
|
2159
2160
|
if (is_business) {
|
|
2160
|
-
|
|
2161
|
+
business_info = await ai_module.get_business_info(uid, '', contact_obj.email, account_profile_info);
|
|
2161
2162
|
if (business_info.business_name !== 'Not available') {
|
|
2162
2163
|
//&& !identifyPersonalProvider(business_info.business_domain)
|
|
2163
2164
|
business_has_person = await ai_module.is_business_contact_has_person(uid, email, name, metadata.subject, metadata.summarized_body, account_profile_info);
|
|
2164
2165
|
} else {
|
|
2165
2166
|
account_type = 'personal';
|
|
2167
|
+
business_info = undefined;
|
|
2166
2168
|
}
|
|
2167
2169
|
}
|
|
2168
2170
|
if (_.isEmpty(cached_contact) && account_type === 'business' && !business_has_person) {
|
|
2169
2171
|
if (!identifyPersonalProvider(business_info.business_domain)) {
|
|
2170
|
-
const domain = email.includes('@') ? email.split('@')[1] : '';
|
|
2171
|
-
cached_contact = await get_xuda_cache(uid, 'contact',
|
|
2172
|
+
// const domain = email.includes('@') ? email.split('@')[1] : '';
|
|
2173
|
+
cached_contact = await get_xuda_cache(uid, 'contact', business_info.business_domain, 'metadata');
|
|
2172
2174
|
} else {
|
|
2173
2175
|
cached_contact = await get_xuda_cache(uid, 'contact', business_info.business_name, 'metadata');
|
|
2174
2176
|
}
|
|
@@ -2199,6 +2201,7 @@ export const add_contact = async function (req, job_id, headers) {
|
|
|
2199
2201
|
metadata,
|
|
2200
2202
|
is_spam: cached_contact?.is_spam || is_spam,
|
|
2201
2203
|
business_has_person: cached_contact?.business_has_person || business_has_person,
|
|
2204
|
+
business_info: cached_contact?.business_info || business_info,
|
|
2202
2205
|
|
|
2203
2206
|
account_profiles: [account_profile_obj._id],
|
|
2204
2207
|
account_type: cached_contact?.account_type || account_type,
|
|
@@ -2209,25 +2212,25 @@ export const add_contact = async function (req, job_id, headers) {
|
|
|
2209
2212
|
contact_obj.business_info = _.cloneDeep(cached_contact.business_info);
|
|
2210
2213
|
} else {
|
|
2211
2214
|
if (!is_spam) {
|
|
2212
|
-
if (account_type === 'business') {
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
}
|
|
2215
|
+
// if (account_type === 'business') {
|
|
2216
|
+
// contact_obj.business_info = await ai_module.get_business_info(uid, contact_obj.name, contact_obj.email, account_profile_info);
|
|
2217
|
+
// save_xuda_cache(uid, 'contact', contact_obj.domain, null, contact_obj);
|
|
2218
|
+
|
|
2219
|
+
// // const business_info = await ai_module.get_business_info(uid, contact_obj.name, contact_obj.email, account_profile_info);
|
|
2220
|
+
// // if (business_info) {
|
|
2221
|
+
// // const { business_size, business_category, business_sub_category, business_country, business_bio, business_name } = business_info;
|
|
2222
|
+
// // contact_obj.mainCategory = business_category;
|
|
2223
|
+
// // contact_obj.subCategory = business_sub_category;
|
|
2224
|
+
// // contact_obj.business_size = business_size;
|
|
2225
|
+
// // contact_obj.country = business_country;
|
|
2226
|
+
// // contact_obj.bio = business_bio;
|
|
2227
|
+
// // contact_obj.business_name = business_name;
|
|
2228
|
+
|
|
2229
|
+
// // if (!contact_obj.name) {
|
|
2230
|
+
// // contact_obj.name = business_name;
|
|
2231
|
+
// // }
|
|
2232
|
+
// // }
|
|
2233
|
+
// }
|
|
2231
2234
|
|
|
2232
2235
|
if (account_type === 'personal' || contact_obj?.business_has_person) {
|
|
2233
2236
|
contact_obj.person_info = await ai_module.get_person_info(uid, contact_obj.name, contact_obj.email, account_profile_info, metadata?.summarized_body);
|