@xuda.io/account_module 1.2.1065 → 1.2.1067

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 +57 -27
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -2497,39 +2497,69 @@ export const get_account_profile_info = async function (uid, contact_profile_doc
2497
2497
  if (account_info_ret.code < 0) {
2498
2498
  return;
2499
2499
  }
2500
+ if (!doc.profile_avatar) {
2501
+ doc.profile_avatar = account_info_ret.data.profile_avatar;
2502
+ }
2500
2503
 
2501
- doc.profile_avatar = account_info_ret.data.profile_avatar;
2504
+ // doc.name = account_info_ret.data?.account_type === 'business' ? account_info_ret.data.business_name : `${account_info_ret.data.first_name} ${account_info_ret.data.last_name}`;
2502
2505
 
2503
- doc.name = account_info_ret.data?.account_type === 'business' ? account_info_ret.data.business_name : `${account_info_ret.data.first_name} ${account_info_ret.data.last_name}`;
2506
+ // if (account_info_ret.data.phone_number) {
2507
+ // try {
2508
+ // doc.phone_number = formatPhoneWithFlag(account_info_ret.data.phone_number, account_info_ret.data.country);
2509
+ // } catch (err) {
2510
+ // console.error(err);
2511
+ // doc.phone_number = account_info_ret.data.phone_number;
2512
+ // }
2513
+ // }
2504
2514
 
2505
- if (account_info_ret.data.phone_number) {
2506
- try {
2507
- doc.phone_number = formatPhoneWithFlag(account_info_ret.data.phone_number, account_info_ret.data.country);
2508
- } catch (err) {
2509
- console.error(err);
2510
- doc.phone_number = account_info_ret.data.phone_number;
2511
- }
2512
- }
2515
+ // if (doc.team_req_id) {
2516
+ // try {
2517
+ // const req_doc = await db_module.get_couch_doc_native('xuda_team', doc.team_req_id);
2518
+ // doc.connection_stat = req_doc.team_req_stat;
2519
+ // doc.connection_type = req_doc.access_type;
2520
+ // if (doc.connection_type === 'contact_connection') {
2521
+ // doc.friend_since = req_doc.team_req_date;
2522
+ // }
2523
+ // } catch (err) {
2524
+ // if (err.message === 'deleted') {
2525
+ // try {
2526
+ // let contact_doc = await db_module.get_couch_doc_native('xuda_contacts', doc._id);
2527
+ // contact_doc.team_req_id = '';
2528
+ // await db_module.save_couch_doc('xuda_contacts', contact_doc);
2529
+ // } catch (error) {}
2530
+ // }
2531
+ // doc.connection_stat = 0;
2532
+ // }
2533
+ // }
2513
2534
 
2514
- if (doc.team_req_id) {
2515
- try {
2516
- const req_doc = await db_module.get_couch_doc_native('xuda_team', doc.team_req_id);
2517
- doc.connection_stat = req_doc.team_req_stat;
2518
- doc.connection_type = req_doc.access_type;
2519
- if (doc.connection_type === 'contact_connection') {
2520
- doc.friend_since = req_doc.team_req_date;
2521
- }
2522
- } catch (err) {
2523
- if (err.message === 'deleted') {
2524
- try {
2525
- let contact_doc = await db_module.get_couch_doc_native('xuda_contacts', doc._id);
2526
- contact_doc.team_req_id = '';
2527
- await db_module.save_couch_doc('xuda_contacts', contact_doc);
2528
- } catch (error) {}
2535
+ const get_pattern = async function (doc) {
2536
+ let ret = `default-pattern.png`;
2537
+
2538
+ if (doc.account_type === 'business') {
2539
+ ret = doc.profile_picture;
2540
+ } else {
2541
+ switch (doc.avatar_source) {
2542
+ case 'fictional':
2543
+ ret = `fictional-avatar-pattern.png`;
2544
+ break;
2545
+
2546
+ case 'ai profile':
2547
+ ret = `fictional-avatar-pattern.png`;
2548
+ break;
2549
+
2550
+ case 'authentic profile':
2551
+ ret = `authentic-avatar-pattern.png`;
2552
+ break;
2553
+
2554
+ default:
2555
+ ret = `xu-pattern.png`;
2556
+ break;
2529
2557
  }
2530
- doc.connection_stat = 0;
2531
2558
  }
2532
- }
2559
+
2560
+ return ret;
2561
+ };
2562
+
2533
2563
  doc.avatar_source = account_info_ret.data.avatar_source;
2534
2564
  doc.icon_pattern = await get_contact_pattern(doc);
2535
2565
  doc.username = account_info_ret.data.username;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.1065",
3
+ "version": "1.2.1067",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {