@xuda.io/ai_module 1.1.5632 → 1.1.5633

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 +18 -1
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -14937,13 +14937,26 @@ const _widget_verify_google_id_token = async function (id_token) {
14937
14937
  return payload;
14938
14938
  };
14939
14939
 
14940
+ // Widget/site visitors never hit the dashboard login, which is what normally
14941
+ // runs misc.login_maintenance_fix (plans, Stripe customer, starter credits).
14942
+ // Run it from here instead, once per account: gate on stripe_customer_id since
14943
+ // create_stripe_customer is the step that stamps membership_plan. Fire-and-forget
14944
+ // so signup latency is unaffected; without token_ret the account_project_id fix
14945
+ // throws by design AFTER the plan/credit fixes have completed.
14946
+ const _widget_account_maintenance = function (uid) {
14947
+ try {
14948
+ misc_msa.login_maintenance_fix(uid, null);
14949
+ } catch (err) {}
14950
+ };
14951
+
14940
14952
  const _widget_find_or_create_visitor = async function (email, name, google_sub, picture) {
14941
14953
  const ret = await db_module.find_couch_query('xuda_accounts', {
14942
14954
  selector: { 'account_info.email': email },
14943
- fields: ['_id'],
14955
+ fields: ['_id', 'stripe_customer_id'],
14944
14956
  limit: 1,
14945
14957
  });
14946
14958
  if (ret.docs && ret.docs.length) {
14959
+ if (!ret.docs[0].stripe_customer_id) _widget_account_maintenance(ret.docs[0]._id);
14947
14960
  // If we have a google_sub and the existing account lacks one, attach it.
14948
14961
  // Also seed the Google photo as the profile_picture when the account has no
14949
14962
  // avatar yet, so avatar generation has a source to work from.
@@ -14987,6 +15000,9 @@ const _widget_find_or_create_visitor = async function (email, name, google_sub,
14987
15000
  }
14988
15001
  const doc = {
14989
15002
  _id: await _common.xuda_get_uuid('account'),
15003
+ // 1 = unverified (Boaz 2026-07-06): widget signups stay plain unverified
15004
+ // until a real dashboard login; keeps them out of search_users (stat 3)
15005
+ // and out of the missing-plan report (stat-3-only).
14990
15006
  stat: 1,
14991
15007
  docType: 'account',
14992
15008
  source: 'widget',
@@ -15000,6 +15016,7 @@ const _widget_find_or_create_visitor = async function (email, name, google_sub,
15000
15016
  }
15001
15017
  const save_ret = await db_module.save_couch_doc('xuda_accounts', doc);
15002
15018
  if (save_ret.code < 0) throw new Error(save_ret.data || 'visitor_create_failed');
15019
+ _widget_account_maintenance(doc._id);
15003
15020
  return doc._id;
15004
15021
  };
15005
15022
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.5632",
3
+ "version": "1.1.5633",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",