@xuda.io/account_module 1.2.1776 → 1.2.1778
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 +9 -9
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1388,7 +1388,7 @@ export const get_contact_info = async function (uid, contact_doc, _id) {
|
|
|
1388
1388
|
doc.email = doc.email;
|
|
1389
1389
|
}
|
|
1390
1390
|
|
|
1391
|
-
doc.
|
|
1391
|
+
doc.business_has_person = doc?.business_has_person && doc?.person_info?.person_full_name !== 'Not available';
|
|
1392
1392
|
doc.icon_pattern = await get_contact_pattern(doc);
|
|
1393
1393
|
|
|
1394
1394
|
delete doc.account_type_info;
|
|
@@ -2102,7 +2102,7 @@ export const add_contact = async function (req, job_id, headers) {
|
|
|
2102
2102
|
let account_type_info;
|
|
2103
2103
|
let account_type;
|
|
2104
2104
|
let cached_contact;
|
|
2105
|
-
let
|
|
2105
|
+
let business_has_person;
|
|
2106
2106
|
if (contact_uid) {
|
|
2107
2107
|
let { code: account_code, data: account_obj } = await db_module.get_couch_doc('xuda_accounts', contact_uid);
|
|
2108
2108
|
// account_info = account_obj.account_info;
|
|
@@ -2133,9 +2133,9 @@ export const add_contact = async function (req, job_id, headers) {
|
|
|
2133
2133
|
const is_business = await ai_module.is_business_contact(uid, email, name, metadata.subject, metadata.summarized_body, account_profile_info);
|
|
2134
2134
|
account_type = is_business ? 'business' : 'personal';
|
|
2135
2135
|
if (is_business) {
|
|
2136
|
-
|
|
2136
|
+
business_has_person = await ai_module.is_business_contact_has_person(uid, email, name, metadata.subject, metadata.summarized_body, account_profile_info);
|
|
2137
2137
|
}
|
|
2138
|
-
if (_.isEmpty(cached_contact) && account_type === 'business' && !
|
|
2138
|
+
if (_.isEmpty(cached_contact) && account_type === 'business' && !business_has_person) {
|
|
2139
2139
|
const domain = email.includes('@') ? email.split('@')[1] : '';
|
|
2140
2140
|
cached_contact = await get_xuda_cache(uid, 'contact', domain, 'metadata');
|
|
2141
2141
|
}
|
|
@@ -2164,7 +2164,7 @@ export const add_contact = async function (req, job_id, headers) {
|
|
|
2164
2164
|
team_req_id,
|
|
2165
2165
|
metadata,
|
|
2166
2166
|
is_spam: cached_contact?.is_spam || is_spam,
|
|
2167
|
-
|
|
2167
|
+
business_has_person: cached_contact?.business_has_person || business_has_person,
|
|
2168
2168
|
|
|
2169
2169
|
account_profiles: [account_profile_obj._id],
|
|
2170
2170
|
account_type: cached_contact?.account_type || account_type,
|
|
@@ -2195,7 +2195,7 @@ export const add_contact = async function (req, job_id, headers) {
|
|
|
2195
2195
|
// }
|
|
2196
2196
|
}
|
|
2197
2197
|
|
|
2198
|
-
if (account_type === 'personal' || contact_obj?.
|
|
2198
|
+
if (account_type === 'personal' || contact_obj?.business_has_person) {
|
|
2199
2199
|
contact_obj.person_info = await ai_module.get_person_info(uid, contact_obj.name, contact_obj.email, account_profile_info, metadata?.summarized_body);
|
|
2200
2200
|
if (!contact_obj.name) {
|
|
2201
2201
|
contact_obj.name = await ai_module.get_name_from_email_addr(uid, contact_obj.email, account_profile_info);
|
|
@@ -2291,7 +2291,7 @@ const set_contact_profile_picture = async function (uid, contact_id, metadata, j
|
|
|
2291
2291
|
|
|
2292
2292
|
let cache;
|
|
2293
2293
|
if (contact_obj?.account_type === 'business') {
|
|
2294
|
-
if (contact_obj?.
|
|
2294
|
+
if (contact_obj?.business_has_person && contact_obj?.person_info?.person_full_name !== 'Not available') {
|
|
2295
2295
|
cache = await get_xuda_cache(uid, 'profile_avatar', contact_obj.email, 'file');
|
|
2296
2296
|
} else {
|
|
2297
2297
|
cache = await get_xuda_cache(uid, 'profile_avatar', `${contact_obj?.business_info?.business_category || ''}_${contact_obj?.business_info?.business_sub_category || ''}`, 'file');
|
|
@@ -2318,7 +2318,7 @@ const set_contact_profile_picture = async function (uid, contact_id, metadata, j
|
|
|
2318
2318
|
country: contact_obj?.business_info?.business_country || contact_obj?.person_info?.person_nationality,
|
|
2319
2319
|
mainCategory: contact_obj?.business_info?.mainCategory,
|
|
2320
2320
|
subCategory: contact_obj?.business_info?.subCategory,
|
|
2321
|
-
|
|
2321
|
+
business_has_person: contact_obj?.business_has_person && contact_obj?.person_info?.person_full_name !== 'Not available',
|
|
2322
2322
|
person_nationality: contact_obj?.person_info?.person_nationality,
|
|
2323
2323
|
},
|
|
2324
2324
|
// { business_info: contact_obj.business_info, personal_info: contact_obj.personal_info, account_type_info: contact_obj.account_type_info },
|
|
@@ -2330,7 +2330,7 @@ const set_contact_profile_picture = async function (uid, contact_id, metadata, j
|
|
|
2330
2330
|
);
|
|
2331
2331
|
|
|
2332
2332
|
if (contact_obj?.account_type === 'business') {
|
|
2333
|
-
if (contact_obj?.
|
|
2333
|
+
if (contact_obj?.business_has_person && contact_obj?.person_info?.person_full_name !== 'Not available') {
|
|
2334
2334
|
cache = await save_xuda_cache(uid, 'profile_avatar', contact_obj.email, file_ret.data, { account_type: contact_obj.account_type, type: 'contact' });
|
|
2335
2335
|
} else {
|
|
2336
2336
|
cache = await save_xuda_cache(uid, 'profile_avatar', `${contact_obj?.business_info?.business_category || ''}_${contact_obj?.business_info?.business_sub_category || ''}`, file_ret.data, { account_type: contact_obj.account_type, type: 'contact' });
|