@xuda.io/account_module 1.2.2314 → 1.2.2315

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 +20 -8
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -685,7 +685,18 @@ const _MODULE_SUBSCRIPTIONS = [
685
685
  // screen showed the stores.
686
686
  { key: 'commerce', scope: 'account', field: 'commerce_plan', default_plan: 'commerce_free', is_activated: (a) => !!a.commerce_plan },
687
687
  { key: 'shipping', scope: 'account', field: 'shipping_plan', default_plan: 'shipping_free' },
688
- { key: 'finance', scope: 'account', field: 'finance_plan', default_plan: 'finance_free' },
688
+ // UI-192: an account can be USING Finance without ever having been through the picker —
689
+ // finance accounts predate the ladder, and info@xuda.ai holds two of them with no
690
+ // `finance_plan` at all. Reporting that as "not switched on" put the module behind a
691
+ // pitch for the customer already invoicing through it. Both markers sit on the account
692
+ // document, so this costs no extra read.
693
+ {
694
+ key: 'finance',
695
+ scope: 'account',
696
+ field: 'finance_plan',
697
+ default_plan: 'finance_free',
698
+ is_activated: (a) => !!(a.finance_plan || a.finance_plan_changed || a.finance_active || a.finance_account_id),
699
+ },
689
700
  // The desk screen has its own copy of this ladder (UI-82), because Tickets is
690
701
  // switched on there as well as here. Both call tickets_set_plan, so the plan
691
702
  // is one line item on the consolidated subscription either way.
@@ -947,13 +958,14 @@ export const get_module_subscriptions = async function (req = {}) {
947
958
  if (ar.code < 0 || !ar.data) return { code: -404, data: 'account not found' };
948
959
  const account = ar.data;
949
960
  const plans = _conf.PLAN_OBJ || {};
950
- // A category is only offerable once its paid tiers carry a real Stripe
951
- // price, otherwise "activate" would set a plan nobody is billed for. A module
952
- // whose money is NOT a plan line item says so itself (phone), because for those
953
- // an absent price_id is the design, not a gap.
954
- const billable = (m) =>
955
- m.billable === true ||
956
- Object.values(plans).some((p) => p.category === m.key && Number(p.price) > 0 && p.price_id && !/TODO/.test(p.price_id));
961
+ // A category is offerable once it has a paid tier with a real amount on it. It used to
962
+ // also demand a hand-made Stripe price behind that tier, which is what left Commerce,
963
+ // Shipping and Finance reading "Coming soon" on the create screen while their products
964
+ // were finished and shipped: stripe_module now mints the price from the catalog the
965
+ // first time a tier is bought (_resolve_plan_price), so a placeholder price id is no
966
+ // longer a reason to take a module off the shelf. A module whose money is not a plan
967
+ // line item at all still says so itself (phone charges the number).
968
+ const billable = (m) => m.billable === true || Object.values(plans).some((p) => p.category === m.key && Number(p.price) > 0);
957
969
 
958
970
  const resource_items = await _module_resource_items(uid);
959
971
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.2314",
3
+ "version": "1.2.2315",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {