@xuda.io/account_module 1.2.2307 → 1.2.2308

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 +12 -1
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -596,7 +596,9 @@ const _MODULE_SUBSCRIPTIONS = [
596
596
  // Four-tier ladder since 2026-08-06 (free / external / api / custom rules),
597
597
  // chosen on the Bot Protection Manager's Plans tab, which calls
598
598
  // bot_protection_set_plan. Free holds no line item at all.
599
- { key: 'bot_protection', scope: 'account', field: 'bot_protection_plan', default_plan: 'bot_protection_free' },
599
+ // No default_plan on purpose: Free is a tier the customer activates, so an
600
+ // account that never chose one reads as not active rather than as Free.
601
+ { key: 'bot_protection', scope: 'account', field: 'bot_protection_plan', default_plan: '' },
600
602
  { key: 'static_website', scope: 'resource' },
601
603
  { key: 'profile_phone', scope: 'resource' },
602
604
  // UI-96: the hosted resources. Not PLAN_OBJ categories, they are billed per resource
@@ -808,6 +810,14 @@ export const get_module_subscriptions = async function (req = {}) {
808
810
  }
809
811
  const plan_id = account[m.field] || m.default_plan;
810
812
  const plan = plans[plan_id] || {};
813
+ // UI-103: a switch-off is a DOWNGRADE, so Stripe schedules it for the end of the
814
+ // period the customer already paid for and the plan field does not move until the
815
+ // webhook transitions it. Surfacing the pending change is what stops the UI from
816
+ // looking like the click did nothing.
817
+ const pc = account.pending_plan_change;
818
+ const pending = pc && pc.category === m.key
819
+ ? { to_plan: pc.to_plan, to_name: plans[pc.to_plan]?.name || pc.to_plan, effective: pc.effective || null }
820
+ : null;
811
821
  const price = Number(plan.price) || 0;
812
822
  return {
813
823
  ...base,
@@ -816,6 +826,7 @@ export const get_module_subscriptions = async function (req = {}) {
816
826
  price,
817
827
  active: price > 0,
818
828
  included: false,
829
+ pending,
819
830
  changed_ts: account[`${m.field}_changed`] || null,
820
831
  };
821
832
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.2307",
3
+ "version": "1.2.2308",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {