@drawbridge/drawbridge-utils 0.0.94 → 0.0.95

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
@@ -441,8 +441,8 @@ var resolvePlan = (subscription) => {
441
441
  };
442
442
  };
443
443
  var conversionRate = (subscription) => {
444
- var _a, _b;
445
- return ((_a = subscription == null ? void 0 : subscription.overrides) == null ? void 0 : _a.conversion) ?? (subscription == null ? void 0 : subscription.conversion) ?? ((_b = resolvePlan(subscription)) == null ? void 0 : _b.conversion) ?? free.conversion;
444
+ var _a;
445
+ return ((_a = resolvePlan(subscription)) == null ? void 0 : _a.conversion) ?? free.conversion;
446
446
  };
447
447
  // Annotate the CommonJS export names for ESM import in node:
448
448
  0 && (module.exports = {
package/dist/plans.d.cts CHANGED
@@ -230,15 +230,15 @@ const resolvePlan = ( subscription ) => {
230
230
  };
231
231
 
232
232
  // Resolve the conversion-fee percentage for an order's owning org.
233
- // Precedence: explicit per-subscription override (admin/negotiated) in
234
- // subscription.overrides the legacy top-level field (pre-migration docs;
235
- // remove after the overrides cleanup release) the plan's catalog default
236
- // the free-org rate. `??` throughout a stored 0 is a valid 0% override.
237
- // `subscription` is null for free orgs (they have no subscription doc).
233
+ //
234
+ // The plan is the only source. A negotiated rate is not a per-subscription
235
+ // override any more it is a custom plan, and `resolvePlan` reads that from
236
+ // `subscription.custom.conversion`. The catalog answers for everyone else.
237
+ //
238
+ // `??` not `||`, because a plan's 0 is a valid 0% rate. `subscription` is null
239
+ // for free orgs (they have no subscription document).
238
240
  const conversionRate = ( subscription ) =>
239
- subscription?.overrides?.conversion
240
- ?? subscription?.conversion
241
- ?? resolvePlan( subscription )?.conversion
241
+ resolvePlan( subscription )?.conversion
242
242
  ?? free.conversion;
243
243
 
244
244
  export { conversionRate, free, plans, resolvePlan };
package/dist/plans.d.ts CHANGED
@@ -230,15 +230,15 @@ const resolvePlan = ( subscription ) => {
230
230
  };
231
231
 
232
232
  // Resolve the conversion-fee percentage for an order's owning org.
233
- // Precedence: explicit per-subscription override (admin/negotiated) in
234
- // subscription.overrides the legacy top-level field (pre-migration docs;
235
- // remove after the overrides cleanup release) the plan's catalog default
236
- // the free-org rate. `??` throughout a stored 0 is a valid 0% override.
237
- // `subscription` is null for free orgs (they have no subscription doc).
233
+ //
234
+ // The plan is the only source. A negotiated rate is not a per-subscription
235
+ // override any more it is a custom plan, and `resolvePlan` reads that from
236
+ // `subscription.custom.conversion`. The catalog answers for everyone else.
237
+ //
238
+ // `??` not `||`, because a plan's 0 is a valid 0% rate. `subscription` is null
239
+ // for free orgs (they have no subscription document).
238
240
  const conversionRate = ( subscription ) =>
239
- subscription?.overrides?.conversion
240
- ?? subscription?.conversion
241
- ?? resolvePlan( subscription )?.conversion
241
+ resolvePlan( subscription )?.conversion
242
242
  ?? free.conversion;
243
243
 
244
244
  export { conversionRate, free, plans, resolvePlan };
package/dist/plans.js CHANGED
@@ -403,8 +403,8 @@ var resolvePlan = (subscription) => {
403
403
  };
404
404
  };
405
405
  var conversionRate = (subscription) => {
406
- var _a, _b;
407
- return ((_a = subscription == null ? void 0 : subscription.overrides) == null ? void 0 : _a.conversion) ?? (subscription == null ? void 0 : subscription.conversion) ?? ((_b = resolvePlan(subscription)) == null ? void 0 : _b.conversion) ?? free.conversion;
406
+ var _a;
407
+ return ((_a = resolvePlan(subscription)) == null ? void 0 : _a.conversion) ?? free.conversion;
408
408
  };
409
409
  export {
410
410
  conversionRate,
package/package.json CHANGED
@@ -169,5 +169,5 @@
169
169
  "test": ". \"$HOME/.nvm/nvm.sh\" && nvm use && node --test"
170
170
  },
171
171
  "types": "dist/index.d.ts",
172
- "version": "0.0.94"
172
+ "version": "0.0.95"
173
173
  }