@xuda.io/account_module 1.2.522 → 1.2.523
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.
- package/index.mjs +20 -1
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1255,6 +1255,19 @@ const get_contact_border = function (doc) {
|
|
|
1255
1255
|
return ret;
|
|
1256
1256
|
};
|
|
1257
1257
|
|
|
1258
|
+
function formatPhoneWithFlag(phoneString) {
|
|
1259
|
+
// try {
|
|
1260
|
+
const phoneNumber = parsePhoneNumber(phoneString);
|
|
1261
|
+
if (phoneNumber && phoneNumber.country) {
|
|
1262
|
+
const flag = countryCodeEmoji(phoneNumber.country);
|
|
1263
|
+
const formatted = phoneNumber.formatInternational(); // e.g., +1 213 373 4253
|
|
1264
|
+
return `${flag} ${formatted}`;
|
|
1265
|
+
}
|
|
1266
|
+
// } catch (error) {
|
|
1267
|
+
// return 'Invalid phone number';
|
|
1268
|
+
// }
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1258
1271
|
export const get_contact_info = async function (uid, contact_doc, _id) {
|
|
1259
1272
|
const ai_module = await import(`${module_path}/ai_module/index.mjs`);
|
|
1260
1273
|
let doc = contact_doc;
|
|
@@ -1274,7 +1287,13 @@ export const get_contact_info = async function (uid, contact_doc, _id) {
|
|
|
1274
1287
|
//membership_plan
|
|
1275
1288
|
doc.name = `${account_info_ret.data.first_name} ${account_info_ret.data.last_name}`;
|
|
1276
1289
|
|
|
1277
|
-
|
|
1290
|
+
if (account_info_ret.data.phone) {
|
|
1291
|
+
try {
|
|
1292
|
+
doc.telephone = formatPhoneWithFlag(account_info_ret.data.phone);
|
|
1293
|
+
} catch (error) {
|
|
1294
|
+
doc.telephone = account_info_ret.data.phone;
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1278
1297
|
|
|
1279
1298
|
// doc.online = true;
|
|
1280
1299
|
if (doc.team_req_id) {
|