@drawbridge/drawbridge-utils 0.0.90 → 0.0.91

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/dist/plans.cjs CHANGED
@@ -423,8 +423,8 @@ var plans = {
423
423
  }
424
424
  };
425
425
  var conversionRate = (subscription) => {
426
- var _a;
427
- return (subscription == null ? void 0 : subscription.conversion) ?? ((_a = plans[subscription == null ? void 0 : subscription.plan]) == null ? void 0 : _a.conversion) ?? free.conversion;
426
+ var _a, _b;
427
+ return ((_a = subscription == null ? void 0 : subscription.overrides) == null ? void 0 : _a.conversion) ?? (subscription == null ? void 0 : subscription.conversion) ?? ((_b = plans[subscription == null ? void 0 : subscription.plan]) == null ? void 0 : _b.conversion) ?? free.conversion;
428
428
  };
429
429
  // Annotate the CommonJS export names for ESM import in node:
430
430
  0 && (module.exports = {
package/dist/plans.d.cts CHANGED
@@ -196,11 +196,14 @@ const plans = {
196
196
  };
197
197
 
198
198
  // Resolve the conversion-fee percentage for an order's owning org.
199
- // Precedence: explicit per-subscription override (admin/negotiated)
200
- // the plan's catalog default → the free-org rate. `subscription` is null
201
- // for free orgs (they have no subscription doc).
199
+ // Precedence: explicit per-subscription override (admin/negotiated) in
200
+ // subscription.overrides → the legacy top-level field (pre-migration docs;
201
+ // remove after the overrides cleanup release) the plan's catalog default →
202
+ // the free-org rate. `??` throughout — a stored 0 is a valid 0% override.
203
+ // `subscription` is null for free orgs (they have no subscription doc).
202
204
  const conversionRate = ( subscription ) =>
203
- subscription?.conversion
205
+ subscription?.overrides?.conversion
206
+ ?? subscription?.conversion
204
207
  ?? plans[ subscription?.plan ]?.conversion
205
208
  ?? free.conversion;
206
209
 
package/dist/plans.d.ts CHANGED
@@ -196,11 +196,14 @@ const plans = {
196
196
  };
197
197
 
198
198
  // Resolve the conversion-fee percentage for an order's owning org.
199
- // Precedence: explicit per-subscription override (admin/negotiated)
200
- // the plan's catalog default → the free-org rate. `subscription` is null
201
- // for free orgs (they have no subscription doc).
199
+ // Precedence: explicit per-subscription override (admin/negotiated) in
200
+ // subscription.overrides → the legacy top-level field (pre-migration docs;
201
+ // remove after the overrides cleanup release) the plan's catalog default →
202
+ // the free-org rate. `??` throughout — a stored 0 is a valid 0% override.
203
+ // `subscription` is null for free orgs (they have no subscription doc).
202
204
  const conversionRate = ( subscription ) =>
203
- subscription?.conversion
205
+ subscription?.overrides?.conversion
206
+ ?? subscription?.conversion
204
207
  ?? plans[ subscription?.plan ]?.conversion
205
208
  ?? free.conversion;
206
209
 
package/dist/plans.js CHANGED
@@ -386,8 +386,8 @@ var plans = {
386
386
  }
387
387
  };
388
388
  var conversionRate = (subscription) => {
389
- var _a;
390
- return (subscription == null ? void 0 : subscription.conversion) ?? ((_a = plans[subscription == null ? void 0 : subscription.plan]) == null ? void 0 : _a.conversion) ?? free.conversion;
389
+ var _a, _b;
390
+ return ((_a = subscription == null ? void 0 : subscription.overrides) == null ? void 0 : _a.conversion) ?? (subscription == null ? void 0 : subscription.conversion) ?? ((_b = plans[subscription == null ? void 0 : subscription.plan]) == null ? void 0 : _b.conversion) ?? free.conversion;
391
391
  };
392
392
  export {
393
393
  conversionRate,
package/package.json CHANGED
@@ -13,7 +13,7 @@
13
13
  "tinycolor2": "1.6.0"
14
14
  },
15
15
  "devDependencies": {
16
- "@drawbridge/drawbridge-agents": "0.1.24",
16
+ "@drawbridge/drawbridge-agents": "0.1.28",
17
17
  "@node-oauth/oauth2-server": "5.3.0",
18
18
  "tsup": "8.5.1",
19
19
  "typescript": "5.9.3"
@@ -164,5 +164,5 @@
164
164
  "test": ". \"$HOME/.nvm/nvm.sh\" && nvm use && node --test"
165
165
  },
166
166
  "types": "dist/index.d.ts",
167
- "version": "0.0.90"
167
+ "version": "0.0.91"
168
168
  }