@xuda.io/account_module 1.2.1773 → 1.2.1775

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.
Files changed (2) hide show
  1. package/index.mjs +9 -3
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -2102,6 +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 has_person;
2105
2106
  if (contact_uid) {
2106
2107
  let { code: account_code, data: account_obj } = await db_module.get_couch_doc('xuda_accounts', contact_uid);
2107
2108
  // account_info = account_obj.account_info;
@@ -2126,9 +2127,13 @@ export const add_contact = async function (req, job_id, headers) {
2126
2127
  is_spam = await ai_module.is_spam_email(uid, email, metadata.subject, account_profile_info);
2127
2128
  }
2128
2129
  if (!is_spam) {
2129
- account_type_info = await ai_module.analyze_email_account_type(uid, name, email, account_profile_info, metadata?.summarized_body);
2130
- account_type = account_type_info.account_type;
2130
+ // account_type_info = await ai_module.analyze_email_account_type(uid, name, email, account_profile_info, metadata?.summarized_body);
2131
+ // account_type = account_type_info.account_type;
2131
2132
 
2133
+ const is_business = await ai_module.is_business_contact(uid, email, name, metadata.subject, metadata.summarized_body, account_profile_info);
2134
+ account_type = is_business ? 'business' : 'personal';
2135
+
2136
+ has_person = await ai_module.is_business_contact_has_person(uid, email, name, metadata.subject, metadata.summarized_body, account_profile_info);
2132
2137
  if (_.isEmpty(cached_contact) && account_type === 'business' && !account_type_info.is_real_person) {
2133
2138
  const domain = email.includes('@') ? email.split('@')[1] : '';
2134
2139
  cached_contact = await get_xuda_cache(uid, 'contact', domain, 'metadata');
@@ -2158,10 +2163,11 @@ export const add_contact = async function (req, job_id, headers) {
2158
2163
  team_req_id,
2159
2164
  metadata,
2160
2165
  is_spam: cached_contact?.is_spam || is_spam,
2166
+ has_person: cached_contact?.has_person || has_person,
2161
2167
 
2162
2168
  account_profiles: [account_profile_obj._id],
2163
2169
  account_type: cached_contact?.account_type || account_type,
2164
- account_type_info: cached_contact?.account_type_info || account_type_info,
2170
+ // account_type_info: cached_contact?.account_type_info || account_type_info,
2165
2171
  // email_type_info: cached_contact?.email_type_info || email_type_info,
2166
2172
  };
2167
2173
  if (!_.isEmpty(cached_contact?.business_info)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.1773",
3
+ "version": "1.2.1775",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {