@xuda.io/account_module 1.2.1623 → 1.2.1625
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 +27 -19
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -2003,31 +2003,39 @@ export const add_contact = async function (req, job_id, headers) {
|
|
|
2003
2003
|
account_profiles: [account_profile_obj._id],
|
|
2004
2004
|
account_type,
|
|
2005
2005
|
};
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2006
|
+
if (_.isEmpty(cached_contact)) {
|
|
2007
|
+
if (account_type === 'business' && !is_spam) {
|
|
2008
|
+
const business_info = await ai_module.get_business_info(uid, contact_obj.name, contact_obj.email, account_profile_info);
|
|
2009
|
+
const { business_size, business_category, business_sub_category, business_country, business_bio, business_name } = business_info;
|
|
2010
|
+
contact_obj.mainCategory = business_category;
|
|
2011
|
+
contact_obj.subCategory = business_sub_category;
|
|
2012
|
+
contact_obj.business_size = business_size;
|
|
2013
|
+
contact_obj.country = business_country;
|
|
2014
|
+
contact_obj.bio = business_bio;
|
|
2015
|
+
contact_obj.business_name = business_name;
|
|
2016
|
+
|
|
2017
|
+
if (!contact_obj.name) {
|
|
2018
|
+
contact_obj.name = business_name;
|
|
2019
|
+
}
|
|
2019
2020
|
}
|
|
2020
|
-
}
|
|
2021
2021
|
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2022
|
+
if (account_type === 'personal') {
|
|
2023
|
+
if (!contact_obj.name) {
|
|
2024
|
+
contact_obj.name = await ai_module.get_name_from_email_addr(uid, contact_obj.email, account_profile_info);
|
|
2025
|
+
}
|
|
2025
2026
|
}
|
|
2027
|
+
} else {
|
|
2028
|
+
contact_obj.mainCategory = cached_contact.mainCategory;
|
|
2029
|
+
contact_obj.subCategory = cached_contact.subCategory;
|
|
2030
|
+
contact_obj.business_size = cached_contact.business_size;
|
|
2031
|
+
contact_obj.country = cached_contact.country;
|
|
2032
|
+
contact_obj.bio = cached_contact.bio;
|
|
2033
|
+
contact_obj.business_name = cached_contact.business_name;
|
|
2034
|
+
contact_obj.is_spam = cached_contact.is_spam;
|
|
2026
2035
|
}
|
|
2027
|
-
|
|
2028
2036
|
const save_ret = await save_contact(uid, contact_obj);
|
|
2029
2037
|
save_xuda_cache(uid, 'contact', contact_obj.email, null, contact_obj);
|
|
2030
|
-
if (!is_spam) {
|
|
2038
|
+
if (!contact_obj.is_spam) {
|
|
2031
2039
|
set_contact_profile_picture(uid, contact_obj._id, metadata, job_id, headers);
|
|
2032
2040
|
}
|
|
2033
2041
|
|