@xuda.io/account_module 1.2.2271 → 1.2.2273
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 +14 -7
- package/index.mjs.premerge.bak +4725 -0
- package/package.json +1 -1
- package/scripts/run_backfill.mjs +1 -5
- package/scripts/run_backfill.mjs.premerge.bak +51 -0
- package/scripts/run_migrate_account.mjs +1 -5
- package/scripts/run_migrate_account.mjs.premerge.bak +54 -0
- package/scripts/run_migrate_all.mjs +1 -5
- package/scripts/run_migrate_all.mjs.premerge.bak +109 -0
package/index.mjs
CHANGED
|
@@ -37,11 +37,7 @@ const account_info_properties = [
|
|
|
37
37
|
'public_profile_disabled',
|
|
38
38
|
];
|
|
39
39
|
|
|
40
|
-
global._conf = (
|
|
41
|
-
await import(path.join(process.env.XUDA_HOME, process.env.XUDA_CONFIG), {
|
|
42
|
-
with: { type: 'json' },
|
|
43
|
-
})
|
|
44
|
-
).default;
|
|
40
|
+
global._conf = (await import(path.join(process.env.XUDA_HOME, "common", "load_conf.mjs"))).loadConf();
|
|
45
41
|
|
|
46
42
|
const _common = await import(path.join(process.env.XUDA_HOME, 'common', 'xuda_node_common.mjs'));
|
|
47
43
|
const _utils = await import(path.join(process.env.XUDA_HOME, 'common', 'xuda-cpi-utils.mjs'));
|
|
@@ -1191,6 +1187,17 @@ export const did_you_know_tips = async function (req, job_id, headers) {
|
|
|
1191
1187
|
return { code: 1, data: { action, tip_id: target_id, tips_state } };
|
|
1192
1188
|
}
|
|
1193
1189
|
|
|
1190
|
+
// Hold "Did you know" tips for the account's first week — brand-new
|
|
1191
|
+
// users get a clean onboarding run before we start surfacing tips. The
|
|
1192
|
+
// banner renders nothing when offer === null, so no frontend change is
|
|
1193
|
+
// needed. Fails OPEN for legacy accounts with no creation timestamp
|
|
1194
|
+
// (they're established users, not new ones).
|
|
1195
|
+
const DYK_MIN_AGE_MS = 7 * 24 * 60 * 60 * 1000;
|
|
1196
|
+
const created_ts = Number(account_doc.date_created_ts) || (account_doc.date_created ? new Date(account_doc.date_created).getTime() : 0);
|
|
1197
|
+
if (created_ts && Date.now() - created_ts < DYK_MIN_AGE_MS) {
|
|
1198
|
+
return { code: 1, data: { offer: null, message: 'account in first-week grace period' } };
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1194
1201
|
const all_tips = load_did_you_know_tips();
|
|
1195
1202
|
if (!all_tips.length) {
|
|
1196
1203
|
return { code: 1, data: { offer: null, message: 'no tips available' } };
|
|
@@ -4287,7 +4294,7 @@ export const get_account_ai_usage = async function (req, job_id, headers) {
|
|
|
4287
4294
|
credits_obj[source] += credits;
|
|
4288
4295
|
}
|
|
4289
4296
|
|
|
4290
|
-
let data = { credits: { ...credits_obj, total: total_credits }, usage: { profile, projects: [], total: total_usage } };
|
|
4297
|
+
let data = { credits: { ...credits_obj, total: total_credits }, usage: { profile, projects: [], total: total_usage }, packs: _conf.ai_credit_packs || [] };
|
|
4291
4298
|
|
|
4292
4299
|
if (job_id) {
|
|
4293
4300
|
data.profile_info = {};
|
|
@@ -4383,7 +4390,7 @@ export const get_account_ai_usage_old = async function (req, job_id, headers) {
|
|
|
4383
4390
|
credits_obj[source] += credits;
|
|
4384
4391
|
}
|
|
4385
4392
|
|
|
4386
|
-
let data = { credits: { ...credits_obj, total: total_credits }, usage: { profile, projects: [], total: total_usage } };
|
|
4393
|
+
let data = { credits: { ...credits_obj, total: total_credits }, usage: { profile, projects: [], total: total_usage }, packs: _conf.ai_credit_packs || [] };
|
|
4387
4394
|
|
|
4388
4395
|
if (job_id) {
|
|
4389
4396
|
data.profile_info = {};
|