@xuda.io/account_module 1.2.2271 → 1.2.2272
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 +13 -2
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1191,6 +1191,17 @@ export const did_you_know_tips = async function (req, job_id, headers) {
|
|
|
1191
1191
|
return { code: 1, data: { action, tip_id: target_id, tips_state } };
|
|
1192
1192
|
}
|
|
1193
1193
|
|
|
1194
|
+
// Hold "Did you know" tips for the account's first week — brand-new
|
|
1195
|
+
// users get a clean onboarding run before we start surfacing tips. The
|
|
1196
|
+
// banner renders nothing when offer === null, so no frontend change is
|
|
1197
|
+
// needed. Fails OPEN for legacy accounts with no creation timestamp
|
|
1198
|
+
// (they're established users, not new ones).
|
|
1199
|
+
const DYK_MIN_AGE_MS = 7 * 24 * 60 * 60 * 1000;
|
|
1200
|
+
const created_ts = Number(account_doc.date_created_ts) || (account_doc.date_created ? new Date(account_doc.date_created).getTime() : 0);
|
|
1201
|
+
if (created_ts && Date.now() - created_ts < DYK_MIN_AGE_MS) {
|
|
1202
|
+
return { code: 1, data: { offer: null, message: 'account in first-week grace period' } };
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1194
1205
|
const all_tips = load_did_you_know_tips();
|
|
1195
1206
|
if (!all_tips.length) {
|
|
1196
1207
|
return { code: 1, data: { offer: null, message: 'no tips available' } };
|
|
@@ -4287,7 +4298,7 @@ export const get_account_ai_usage = async function (req, job_id, headers) {
|
|
|
4287
4298
|
credits_obj[source] += credits;
|
|
4288
4299
|
}
|
|
4289
4300
|
|
|
4290
|
-
let data = { credits: { ...credits_obj, total: total_credits }, usage: { profile, projects: [], total: total_usage } };
|
|
4301
|
+
let data = { credits: { ...credits_obj, total: total_credits }, usage: { profile, projects: [], total: total_usage }, packs: _conf.ai_credit_packs || [] };
|
|
4291
4302
|
|
|
4292
4303
|
if (job_id) {
|
|
4293
4304
|
data.profile_info = {};
|
|
@@ -4383,7 +4394,7 @@ export const get_account_ai_usage_old = async function (req, job_id, headers) {
|
|
|
4383
4394
|
credits_obj[source] += credits;
|
|
4384
4395
|
}
|
|
4385
4396
|
|
|
4386
|
-
let data = { credits: { ...credits_obj, total: total_credits }, usage: { profile, projects: [], total: total_usage } };
|
|
4397
|
+
let data = { credits: { ...credits_obj, total: total_credits }, usage: { profile, projects: [], total: total_usage }, packs: _conf.ai_credit_packs || [] };
|
|
4387
4398
|
|
|
4388
4399
|
if (job_id) {
|
|
4389
4400
|
data.profile_info = {};
|