@xuda.io/account_module 1.2.1704 → 1.2.1706

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 +10 -1
  2. 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
  }
@@ -2196,6 +2204,7 @@ const set_contact_profile_picture = async function (uid, contact_id, metadata, j
2196
2204
  throw new Error(`contact ${contact_id} not found`);
2197
2205
  }
2198
2206
  await update_contact_profile_picture_status(uid, contact_id, 2);
2207
+ ////// PROFILE PICTURE
2199
2208
  if (!contact_obj.profile_picture) {
2200
2209
  let cache = await get_xuda_cache(uid, 'profile_picture', contact_obj.email, 'file');
2201
2210
  if (!cache && contact_obj.business_name) {
@@ -2223,7 +2232,7 @@ const set_contact_profile_picture = async function (uid, contact_id, metadata, j
2223
2232
  const contact_save_ret = await db_module.save_app_couch_doc(account_profile_info.app_id, contact_obj);
2224
2233
  profile_picture = contact_obj.profile_picture;
2225
2234
  }
2226
-
2235
+ ////// PROFILE AVATAR
2227
2236
  if (!contact_obj.profile_avatar) {
2228
2237
  let cache = await get_xuda_cache(uid, 'profile_avatar', contact_obj.email, 'file');
2229
2238
  if (!cache && contact_obj.business_name) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.1704",
3
+ "version": "1.2.1706",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {