@xuda.io/account_module 1.2.2257 → 1.2.2258
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 +62 -3
- package/index_ms.mjs +10 -11
- package/index_msa.mjs +16 -15
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -34,6 +34,7 @@ const account_info_properties = [
|
|
|
34
34
|
'network_lang',
|
|
35
35
|
'network_country_code',
|
|
36
36
|
'network_city_slug',
|
|
37
|
+
'public_profile_disabled',
|
|
37
38
|
];
|
|
38
39
|
|
|
39
40
|
global._conf = (
|
|
@@ -1263,7 +1264,7 @@ export const get_account_name = async function (req) {
|
|
|
1263
1264
|
if (data.code < 0) {
|
|
1264
1265
|
return data;
|
|
1265
1266
|
}
|
|
1266
|
-
const { membership_plan = '', support_plan = '', ai_workspace_plan = '', date_created_ts = '' } = data.data;
|
|
1267
|
+
const { membership_plan = '', support_plan = '', ai_workspace_plan = '', date_created_ts = '', stat = '' } = data.data;
|
|
1267
1268
|
var obj = {
|
|
1268
1269
|
first_name: '',
|
|
1269
1270
|
last_name: '',
|
|
@@ -1275,13 +1276,41 @@ export const get_account_name = async function (req) {
|
|
|
1275
1276
|
support_plan,
|
|
1276
1277
|
ai_workspace_plan,
|
|
1277
1278
|
date_created_ts,
|
|
1279
|
+
stat,
|
|
1278
1280
|
};
|
|
1279
1281
|
if (data.data.account_info) {
|
|
1280
|
-
const {
|
|
1281
|
-
|
|
1282
|
+
const {
|
|
1283
|
+
first_name,
|
|
1284
|
+
last_name,
|
|
1285
|
+
email,
|
|
1286
|
+
phone_number,
|
|
1287
|
+
profile_picture,
|
|
1288
|
+
profile_avatar,
|
|
1289
|
+
username,
|
|
1290
|
+
website,
|
|
1291
|
+
country,
|
|
1292
|
+
bio,
|
|
1293
|
+
industry,
|
|
1294
|
+
account_type,
|
|
1295
|
+
address,
|
|
1296
|
+
city,
|
|
1297
|
+
state,
|
|
1298
|
+
zip,
|
|
1299
|
+
business_name,
|
|
1300
|
+
auto_respond,
|
|
1301
|
+
auto_respond_mode,
|
|
1302
|
+
auto_respond_agents,
|
|
1303
|
+
avatar_source,
|
|
1304
|
+
active_account_profile_id,
|
|
1305
|
+
network_country_code,
|
|
1306
|
+
public_profile_disabled,
|
|
1307
|
+
} = data.data.account_info;
|
|
1282
1308
|
|
|
1283
1309
|
obj = {
|
|
1284
1310
|
_id: data.data._id,
|
|
1311
|
+
stat,
|
|
1312
|
+
network_country_code,
|
|
1313
|
+
public_profile_disabled,
|
|
1285
1314
|
first_name,
|
|
1286
1315
|
last_name,
|
|
1287
1316
|
email,
|
|
@@ -2609,6 +2638,35 @@ const set_account_profile_picture = async function (uid, account_uid, metadata,
|
|
|
2609
2638
|
}
|
|
2610
2639
|
};
|
|
2611
2640
|
|
|
2641
|
+
// Internal trigger used by the widget Google-signup flow: when a freshly-created
|
|
2642
|
+
// visitor account already has a profile_picture (their Google photo) but no
|
|
2643
|
+
// generated avatar yet, kick off avatar generation. set_account_profile_picture
|
|
2644
|
+
// maintains profile_avatar_stat (1 → 2 → 3); the caller polls that. Mirrors the
|
|
2645
|
+
// opportunistic trigger in update_account_info (profile_avatar_stat !== 2 guards
|
|
2646
|
+
// against re-triggering while a generation is mid-flight).
|
|
2647
|
+
export const ensure_profile_avatar = async function (req, job_id, headers) {
|
|
2648
|
+
try {
|
|
2649
|
+
const { uid } = req || {};
|
|
2650
|
+
if (!uid) return { code: -1, data: 'missing uid' };
|
|
2651
|
+
const { code, data: account_obj } = await db_module.get_couch_doc('xuda_accounts', uid);
|
|
2652
|
+
if (code < 0 || !account_obj) return { code: -1, data: 'account not found' };
|
|
2653
|
+
const info = account_obj.account_info || {};
|
|
2654
|
+
if (info.profile_picture && !info.profile_avatar && info.profile_avatar_stat !== 2) {
|
|
2655
|
+
// Best-effort profile context for AI-usage attribution. A freshly-created
|
|
2656
|
+
// widget visitor may have no profile/project yet — tolerate that.
|
|
2657
|
+
let account_profile_info;
|
|
2658
|
+
try {
|
|
2659
|
+
account_profile_info = await get_active_account_profile_info(uid);
|
|
2660
|
+
} catch (e) {}
|
|
2661
|
+
// fire-and-forget inside this worker; generation is heavy (vision + image ops)
|
|
2662
|
+
set_account_profile_picture(uid, uid, info, job_id, headers, account_profile_info);
|
|
2663
|
+
}
|
|
2664
|
+
return { code: 1, data: { profile_avatar_stat: info.profile_avatar_stat || 0 } };
|
|
2665
|
+
} catch (err) {
|
|
2666
|
+
return { code: -1, data: err.message };
|
|
2667
|
+
}
|
|
2668
|
+
};
|
|
2669
|
+
|
|
2612
2670
|
setTimeout(async () => {
|
|
2613
2671
|
const app_id = 'prj712ffdf5aa8adce6cedef988f9c12392'; //'prj3937cb6f9a31c8c7dea25055bba845b1'; //
|
|
2614
2672
|
const uid = 'd39126e0e2c51ffbd1aad10709fc8335';
|
|
@@ -4015,6 +4073,7 @@ export const update_entity_account_profiles = async function (req, job_id, heade
|
|
|
4015
4073
|
};
|
|
4016
4074
|
|
|
4017
4075
|
export const get_contact = async function (uid, contact_id) {
|
|
4076
|
+
if (!contact_id) return null;
|
|
4018
4077
|
const account_profile_info = await get_active_account_profile_info(uid);
|
|
4019
4078
|
|
|
4020
4079
|
const contact_ret = await db_module.get_app_couch_doc_native(account_profile_info.app_id, contact_id);
|
package/index_ms.mjs
CHANGED
|
@@ -33,15 +33,6 @@ export const increment_account_usage = async function (...args) {
|
|
|
33
33
|
return await broker.send_to_queue("increment_account_usage", ...args);
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
// accrue_deployment_costs removed — on-demand billing computes
|
|
37
|
-
// from app_cost timestamps. See compute_cycle_billable_amount in
|
|
38
|
-
// deploy_module/cost.mjs and the get_billing_metrics +
|
|
39
|
-
// flush_deployment_usage_to_stripe entry points in stripe_module.
|
|
40
|
-
|
|
41
|
-
export const backfill_app_costs = async function (...args) {
|
|
42
|
-
return await broker.send_to_queue("backfill_app_costs", ...args);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
36
|
export const mark_app_terminated = async function (...args) {
|
|
46
37
|
return await broker.send_to_queue("mark_app_terminated", ...args);
|
|
47
38
|
};
|
|
@@ -54,12 +45,16 @@ export const get_flagged_accounts = async function (...args) {
|
|
|
54
45
|
return await broker.send_to_queue("get_flagged_accounts", ...args);
|
|
55
46
|
};
|
|
56
47
|
|
|
48
|
+
export const sweep_abuse_signals = async function (...args) {
|
|
49
|
+
return await broker.send_to_queue("sweep_abuse_signals", ...args);
|
|
50
|
+
};
|
|
51
|
+
|
|
57
52
|
export const mark_account_reviewed = async function (...args) {
|
|
58
53
|
return await broker.send_to_queue("mark_account_reviewed", ...args);
|
|
59
54
|
};
|
|
60
55
|
|
|
61
|
-
export const
|
|
62
|
-
return await broker.send_to_queue("
|
|
56
|
+
export const backfill_app_costs = async function (...args) {
|
|
57
|
+
return await broker.send_to_queue("backfill_app_costs", ...args);
|
|
63
58
|
};
|
|
64
59
|
|
|
65
60
|
export const get_account_data = async function (...args) {
|
|
@@ -206,6 +201,10 @@ export const ts_contact = async function (...args) {
|
|
|
206
201
|
return await broker.send_to_queue("ts_contact", ...args);
|
|
207
202
|
};
|
|
208
203
|
|
|
204
|
+
export const ensure_profile_avatar = async function (...args) {
|
|
205
|
+
return await broker.send_to_queue("ensure_profile_avatar", ...args);
|
|
206
|
+
};
|
|
207
|
+
|
|
209
208
|
export const add_contact = async function (...args) {
|
|
210
209
|
return await broker.send_to_queue("add_contact", ...args);
|
|
211
210
|
};
|
package/index_msa.mjs
CHANGED
|
@@ -33,31 +33,28 @@ export const increment_account_usage = function (...args) {
|
|
|
33
33
|
broker.send_to_queue_async("increment_account_usage", ...args);
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
export const backfill_app_costs = function (...args) {
|
|
40
|
-
broker.send_to_queue_async("backfill_app_costs", ...args);
|
|
36
|
+
export const mark_app_terminated = function (...args) {
|
|
37
|
+
broker.send_to_queue_async("mark_app_terminated", ...args);
|
|
41
38
|
};
|
|
42
39
|
|
|
43
|
-
export const
|
|
44
|
-
|
|
40
|
+
export const recompute_abuse_signals = function (...args) {
|
|
41
|
+
broker.send_to_queue_async("recompute_abuse_signals", ...args);
|
|
45
42
|
};
|
|
46
43
|
|
|
47
|
-
export const
|
|
48
|
-
|
|
44
|
+
export const get_flagged_accounts = function (...args) {
|
|
45
|
+
broker.send_to_queue_async("get_flagged_accounts", ...args);
|
|
49
46
|
};
|
|
50
47
|
|
|
51
|
-
export const
|
|
52
|
-
|
|
48
|
+
export const sweep_abuse_signals = function (...args) {
|
|
49
|
+
broker.send_to_queue_async("sweep_abuse_signals", ...args);
|
|
53
50
|
};
|
|
54
51
|
|
|
55
|
-
export const mark_account_reviewed =
|
|
56
|
-
|
|
52
|
+
export const mark_account_reviewed = function (...args) {
|
|
53
|
+
broker.send_to_queue_async("mark_account_reviewed", ...args);
|
|
57
54
|
};
|
|
58
55
|
|
|
59
|
-
export const
|
|
60
|
-
|
|
56
|
+
export const backfill_app_costs = function (...args) {
|
|
57
|
+
broker.send_to_queue_async("backfill_app_costs", ...args);
|
|
61
58
|
};
|
|
62
59
|
|
|
63
60
|
export const get_account_data = function (...args) {
|
|
@@ -204,6 +201,10 @@ export const ts_contact = function (...args) {
|
|
|
204
201
|
broker.send_to_queue_async("ts_contact", ...args);
|
|
205
202
|
};
|
|
206
203
|
|
|
204
|
+
export const ensure_profile_avatar = function (...args) {
|
|
205
|
+
broker.send_to_queue_async("ensure_profile_avatar", ...args);
|
|
206
|
+
};
|
|
207
|
+
|
|
207
208
|
export const add_contact = function (...args) {
|
|
208
209
|
broker.send_to_queue_async("add_contact", ...args);
|
|
209
210
|
};
|