@xuda.io/account_module 1.2.1640 → 1.2.1642

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 +17 -11
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -2044,7 +2044,7 @@ export const add_contact = async function (req, job_id, headers) {
2044
2044
  /////////////////
2045
2045
 
2046
2046
  let is_spam = false;
2047
- debugger;
2047
+
2048
2048
  let account_type;
2049
2049
  let cached_contact;
2050
2050
  if (contact_uid) {
@@ -2094,16 +2094,22 @@ export const add_contact = async function (req, job_id, headers) {
2094
2094
  if (_.isEmpty(cached_contact)) {
2095
2095
  if (account_type === 'business' && !is_spam) {
2096
2096
  const business_info = await ai_module.get_business_info(uid, contact_obj.name, contact_obj.email, account_profile_info);
2097
- const { business_size, business_category, business_sub_category, business_country, business_bio, business_name } = business_info;
2098
- contact_obj.mainCategory = business_category;
2099
- contact_obj.subCategory = business_sub_category;
2100
- contact_obj.business_size = business_size;
2101
- contact_obj.country = business_country;
2102
- contact_obj.bio = business_bio;
2103
- contact_obj.business_name = business_name;
2104
-
2097
+ if (business_info) {
2098
+ const { business_size, business_category, business_sub_category, business_country, business_bio, business_name } = business_info;
2099
+ contact_obj.mainCategory = business_category;
2100
+ contact_obj.subCategory = business_sub_category;
2101
+ contact_obj.business_size = business_size;
2102
+ contact_obj.country = business_country;
2103
+ contact_obj.bio = business_bio;
2104
+ contact_obj.business_name = business_name;
2105
+
2106
+ if (!contact_obj.name) {
2107
+ contact_obj.name = business_name;
2108
+ }
2109
+ }
2110
+ } else {
2105
2111
  if (!contact_obj.name) {
2106
- contact_obj.name = business_name;
2112
+ contact_obj.name = '';
2107
2113
  }
2108
2114
  }
2109
2115
 
@@ -2124,7 +2130,7 @@ export const add_contact = async function (req, job_id, headers) {
2124
2130
  }
2125
2131
  const save_ret = await save_contact(uid, contact_obj);
2126
2132
  save_xuda_cache(uid, 'contact', contact_obj.email, null, contact_obj);
2127
- if (!contact_obj.is_spam) {
2133
+ if (!contact_obj.is_spam && contact_obj.name) {
2128
2134
  set_contact_profile_picture(uid, contact_obj._id, metadata, job_id, headers);
2129
2135
  }
2130
2136
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.1640",
3
+ "version": "1.2.1642",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {