@xuda.io/account_module 1.2.1704 → 1.2.1705
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 +8 -0
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -2094,6 +2094,11 @@ export const add_contact = async function (req, job_id, headers) {
|
|
|
2094
2094
|
} else {
|
|
2095
2095
|
// contact without use account
|
|
2096
2096
|
cached_contact = await get_xuda_cache(uid, 'contact', email, 'metadata');
|
|
2097
|
+
if (_.isEmpty(cached_contact) && account_type === 'business') {
|
|
2098
|
+
const domain = email.includes('@') ? email.split('@')[1] : '';
|
|
2099
|
+
cached_contact = await get_xuda_cache(uid, 'contact', domain, 'metadata');
|
|
2100
|
+
}
|
|
2101
|
+
|
|
2097
2102
|
if (_.isEmpty(cached_contact)) {
|
|
2098
2103
|
if (metadata.subject && !metadata.is_sent) {
|
|
2099
2104
|
is_spam = await ai_module.is_spam_email(uid, email, metadata.subject, account_profile_info);
|
|
@@ -2131,6 +2136,8 @@ export const add_contact = async function (req, job_id, headers) {
|
|
|
2131
2136
|
} else {
|
|
2132
2137
|
if (account_type === 'business' && !is_spam) {
|
|
2133
2138
|
contact_obj.business_info = await ai_module.get_business_info(uid, contact_obj.name, contact_obj.email, account_profile_info);
|
|
2139
|
+
save_xuda_cache(uid, 'contact', contact_obj.domain, null, contact_obj);
|
|
2140
|
+
|
|
2134
2141
|
// const business_info = await ai_module.get_business_info(uid, contact_obj.name, contact_obj.email, account_profile_info);
|
|
2135
2142
|
// if (business_info) {
|
|
2136
2143
|
// const { business_size, business_category, business_sub_category, business_country, business_bio, business_name } = business_info;
|
|
@@ -2172,6 +2179,7 @@ export const add_contact = async function (req, job_id, headers) {
|
|
|
2172
2179
|
// }
|
|
2173
2180
|
const save_ret = await save_contact(uid, contact_obj);
|
|
2174
2181
|
save_xuda_cache(uid, 'contact', contact_obj.email, null, contact_obj);
|
|
2182
|
+
|
|
2175
2183
|
if (!contact_obj.is_spam && contact_obj.name) {
|
|
2176
2184
|
set_contact_profile_picture(uid, contact_obj._id, metadata, job_id, headers);
|
|
2177
2185
|
}
|