@drawbridge/drawbridge-utils 0.0.94 → 0.0.96
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 +12 -3
- package/dist/plans.d.cts +18 -9
- package/dist/plans.d.ts +18 -9
- package/dist/plans.js +12 -3
- package/package.json +1 -1
package/dist/plans.cjs
CHANGED
|
@@ -284,7 +284,16 @@ var all = {
|
|
|
284
284
|
page.shortcode.key,
|
|
285
285
|
...array
|
|
286
286
|
]),
|
|
287
|
-
|
|
287
|
+
// `members` and `storage` default to infinite so an unnamed term on a custom
|
|
288
|
+
// plan reads as UNLIMITED rather than absent. Storage used to have no
|
|
289
|
+
// default, so a deal that did not name it resolved to undefined and the
|
|
290
|
+
// organization's usage card simply omitted the row — the same blank field
|
|
291
|
+
// that showed "Unlimited" for members showed nothing at all for storage.
|
|
292
|
+
// Every catalog plan names both, so the defaults only ever apply to a
|
|
293
|
+
// custom plan. `actions` has no default on purpose: an unnamed allowance
|
|
294
|
+
// bills nothing, which is why the availability switch refuses to flip
|
|
295
|
+
// without one.
|
|
296
|
+
limits: ({ actions, members = infinite, storage = infinite }) => ({
|
|
288
297
|
campaign: {
|
|
289
298
|
advertisements: infinite,
|
|
290
299
|
links: infinite,
|
|
@@ -441,8 +450,8 @@ var resolvePlan = (subscription) => {
|
|
|
441
450
|
};
|
|
442
451
|
};
|
|
443
452
|
var conversionRate = (subscription) => {
|
|
444
|
-
var _a
|
|
445
|
-
return ((_a =
|
|
453
|
+
var _a;
|
|
454
|
+
return ((_a = resolvePlan(subscription)) == null ? void 0 : _a.conversion) ?? free.conversion;
|
|
446
455
|
};
|
|
447
456
|
// Annotate the CommonJS export names for ESM import in node:
|
|
448
457
|
0 && (module.exports = {
|
package/dist/plans.d.cts
CHANGED
|
@@ -53,7 +53,16 @@ const all = {
|
|
|
53
53
|
page.shortcode.key,
|
|
54
54
|
...array
|
|
55
55
|
]),
|
|
56
|
-
|
|
56
|
+
// `members` and `storage` default to infinite so an unnamed term on a custom
|
|
57
|
+
// plan reads as UNLIMITED rather than absent. Storage used to have no
|
|
58
|
+
// default, so a deal that did not name it resolved to undefined and the
|
|
59
|
+
// organization's usage card simply omitted the row — the same blank field
|
|
60
|
+
// that showed "Unlimited" for members showed nothing at all for storage.
|
|
61
|
+
// Every catalog plan names both, so the defaults only ever apply to a
|
|
62
|
+
// custom plan. `actions` has no default on purpose: an unnamed allowance
|
|
63
|
+
// bills nothing, which is why the availability switch refuses to flip
|
|
64
|
+
// without one.
|
|
65
|
+
limits : ({ actions, members = infinite, storage = infinite }) => ({
|
|
57
66
|
campaign : {
|
|
58
67
|
advertisements : infinite,
|
|
59
68
|
links : infinite,
|
|
@@ -230,15 +239,15 @@ const resolvePlan = ( subscription ) => {
|
|
|
230
239
|
};
|
|
231
240
|
|
|
232
241
|
// Resolve the conversion-fee percentage for an order's owning org.
|
|
233
|
-
//
|
|
234
|
-
//
|
|
235
|
-
//
|
|
236
|
-
//
|
|
237
|
-
//
|
|
242
|
+
//
|
|
243
|
+
// The plan is the only source. A negotiated rate is not a per-subscription
|
|
244
|
+
// override any more — it is a custom plan, and `resolvePlan` reads that from
|
|
245
|
+
// `subscription.custom.conversion`. The catalog answers for everyone else.
|
|
246
|
+
//
|
|
247
|
+
// `??` not `||`, because a plan's 0 is a valid 0% rate. `subscription` is null
|
|
248
|
+
// for free orgs (they have no subscription document).
|
|
238
249
|
const conversionRate = ( subscription ) =>
|
|
239
|
-
subscription?.
|
|
240
|
-
?? subscription?.conversion
|
|
241
|
-
?? resolvePlan( subscription )?.conversion
|
|
250
|
+
resolvePlan( subscription )?.conversion
|
|
242
251
|
?? free.conversion;
|
|
243
252
|
|
|
244
253
|
export { conversionRate, free, plans, resolvePlan };
|
package/dist/plans.d.ts
CHANGED
|
@@ -53,7 +53,16 @@ const all = {
|
|
|
53
53
|
page.shortcode.key,
|
|
54
54
|
...array
|
|
55
55
|
]),
|
|
56
|
-
|
|
56
|
+
// `members` and `storage` default to infinite so an unnamed term on a custom
|
|
57
|
+
// plan reads as UNLIMITED rather than absent. Storage used to have no
|
|
58
|
+
// default, so a deal that did not name it resolved to undefined and the
|
|
59
|
+
// organization's usage card simply omitted the row — the same blank field
|
|
60
|
+
// that showed "Unlimited" for members showed nothing at all for storage.
|
|
61
|
+
// Every catalog plan names both, so the defaults only ever apply to a
|
|
62
|
+
// custom plan. `actions` has no default on purpose: an unnamed allowance
|
|
63
|
+
// bills nothing, which is why the availability switch refuses to flip
|
|
64
|
+
// without one.
|
|
65
|
+
limits : ({ actions, members = infinite, storage = infinite }) => ({
|
|
57
66
|
campaign : {
|
|
58
67
|
advertisements : infinite,
|
|
59
68
|
links : infinite,
|
|
@@ -230,15 +239,15 @@ const resolvePlan = ( subscription ) => {
|
|
|
230
239
|
};
|
|
231
240
|
|
|
232
241
|
// Resolve the conversion-fee percentage for an order's owning org.
|
|
233
|
-
//
|
|
234
|
-
//
|
|
235
|
-
//
|
|
236
|
-
//
|
|
237
|
-
//
|
|
242
|
+
//
|
|
243
|
+
// The plan is the only source. A negotiated rate is not a per-subscription
|
|
244
|
+
// override any more — it is a custom plan, and `resolvePlan` reads that from
|
|
245
|
+
// `subscription.custom.conversion`. The catalog answers for everyone else.
|
|
246
|
+
//
|
|
247
|
+
// `??` not `||`, because a plan's 0 is a valid 0% rate. `subscription` is null
|
|
248
|
+
// for free orgs (they have no subscription document).
|
|
238
249
|
const conversionRate = ( subscription ) =>
|
|
239
|
-
subscription?.
|
|
240
|
-
?? subscription?.conversion
|
|
241
|
-
?? resolvePlan( subscription )?.conversion
|
|
250
|
+
resolvePlan( subscription )?.conversion
|
|
242
251
|
?? free.conversion;
|
|
243
252
|
|
|
244
253
|
export { conversionRate, free, plans, resolvePlan };
|
package/dist/plans.js
CHANGED
|
@@ -246,7 +246,16 @@ var all = {
|
|
|
246
246
|
page.shortcode.key,
|
|
247
247
|
...array
|
|
248
248
|
]),
|
|
249
|
-
|
|
249
|
+
// `members` and `storage` default to infinite so an unnamed term on a custom
|
|
250
|
+
// plan reads as UNLIMITED rather than absent. Storage used to have no
|
|
251
|
+
// default, so a deal that did not name it resolved to undefined and the
|
|
252
|
+
// organization's usage card simply omitted the row — the same blank field
|
|
253
|
+
// that showed "Unlimited" for members showed nothing at all for storage.
|
|
254
|
+
// Every catalog plan names both, so the defaults only ever apply to a
|
|
255
|
+
// custom plan. `actions` has no default on purpose: an unnamed allowance
|
|
256
|
+
// bills nothing, which is why the availability switch refuses to flip
|
|
257
|
+
// without one.
|
|
258
|
+
limits: ({ actions, members = infinite, storage = infinite }) => ({
|
|
250
259
|
campaign: {
|
|
251
260
|
advertisements: infinite,
|
|
252
261
|
links: infinite,
|
|
@@ -403,8 +412,8 @@ var resolvePlan = (subscription) => {
|
|
|
403
412
|
};
|
|
404
413
|
};
|
|
405
414
|
var conversionRate = (subscription) => {
|
|
406
|
-
var _a
|
|
407
|
-
return ((_a =
|
|
415
|
+
var _a;
|
|
416
|
+
return ((_a = resolvePlan(subscription)) == null ? void 0 : _a.conversion) ?? free.conversion;
|
|
408
417
|
};
|
|
409
418
|
export {
|
|
410
419
|
conversionRate,
|
package/package.json
CHANGED