@xuda.io/account_module 1.2.1940 → 1.2.1942

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 +8 -14
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -2754,7 +2754,7 @@ export const unpin_contact = async function (req) {
2754
2754
 
2755
2755
  export const not_spam_contact = async function (req, job_id, headers) {
2756
2756
  const email_module = await import(`${module_path}/email_module/index.mjs`);
2757
- // const ai_module = await import(`${module_path}/ai_module/index.mjs`);
2757
+ const ai_module = await import(`${module_path}/ai_module/index.mjs`);
2758
2758
 
2759
2759
  const { contact_id, uid } = req;
2760
2760
  const account_profile_info = await get_active_account_profile_info(uid);
@@ -2764,26 +2764,21 @@ export const not_spam_contact = async function (req, job_id, headers) {
2764
2764
 
2765
2765
  //////////////////
2766
2766
  const is_business = await ai_module.is_business_contact(uid, contact_doc.email, contact_doc.name, contact_doc?.metadata?.subject, contact_doc?.metadata?.summarized_body, account_profile_info);
2767
- account_type = is_business ? 'business' : 'personal';
2767
+ contact_doc.account_type = is_business ? 'business' : 'personal';
2768
2768
  if (is_business) {
2769
- business_info = await ai_module.get_business_info(uid, '', email, account_profile_info, { light: true });
2769
+ contact_doc.business_info = await ai_module.get_business_info(uid, '', contact_doc.email, account_profile_info, { light: true });
2770
2770
  if (business_info.business_name !== 'Not available') {
2771
- business_has_person = await ai_module.is_business_contact_has_person(uid, email, name, metadata.subject, metadata.summarized_body, account_profile_info);
2772
- } else {
2773
- account_type = 'personal';
2774
- business_info = undefined;
2775
- }
2776
- }
2777
- if (_.isEmpty(cached_contact) && account_type === 'business' && !business_has_person) {
2778
- if (!identifyPersonalProvider(business_info.business_domain)) {
2779
- cached_contact = await get_xuda_cache(uid, 'contact', business_info.business_domain, 'metadata');
2771
+ contact_doc.business_has_person = await ai_module.is_business_contact_has_person(uid, contact_doc.email, contact_doc.name, contact_doc?.metadata?.subject, contact_doc?.metadata?.summarized_body, account_profile_info);
2780
2772
  } else {
2781
- cached_contact = await get_xuda_cache(uid, 'contact', business_info.business_name, 'metadata');
2773
+ contact_doc.account_type = 'personal';
2774
+ contact_doc.business_info = undefined;
2782
2775
  }
2783
2776
  }
2784
2777
 
2785
2778
  ////////////////
2786
2779
 
2780
+ const contact_save_ret = await save_contact(uid, contact_doc);
2781
+
2787
2782
  await db_module.save_couch_doc_native('xuda_accounts', {
2788
2783
  _id: await _common.xuda_get_uuid('spam_whitelist'),
2789
2784
  uid,
@@ -2793,7 +2788,6 @@ export const not_spam_contact = async function (req, job_id, headers) {
2793
2788
  stat: 3,
2794
2789
  });
2795
2790
 
2796
- const contact_save_ret = await save_contact(uid, contact_doc);
2797
2791
  await delete_xuda_cache(contact_doc);
2798
2792
  set_contact_profile_picture(uid, contact_doc._id, {}, job_id, headers, account_profile_info, false);
2799
2793
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.1940",
3
+ "version": "1.2.1942",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {