@aglyn/aglyn 1.23.1 → 1.25.0
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/package.json +11 -11
- package/src/lib/app-utils/activity-labels.js +4 -1
- package/src/lib/app-utils/activity-labels.js.map +1 -1
- package/src/lib/app-utils/activity-presenter.d.ts +11 -0
- package/src/lib/app-utils/activity-presenter.js +9 -0
- package/src/lib/app-utils/activity-presenter.js.map +1 -1
- package/src/lib/app-utils/activity-search.d.ts +1 -0
- package/src/lib/app-utils/activity-search.js +1 -0
- package/src/lib/app-utils/activity-search.js.map +1 -1
- package/src/lib/app-utils/agent-api-catalog.d.ts +18 -0
- package/src/lib/app-utils/agent-api-catalog.js +8 -1
- package/src/lib/app-utils/agent-api-catalog.js.map +1 -1
- package/src/lib/app-utils/binding-token-catalog.d.ts +15 -0
- package/src/lib/app-utils/binding-token-catalog.js +16 -0
- package/src/lib/app-utils/binding-token-catalog.js.map +1 -1
- package/src/lib/app-utils/business-details.d.ts +5 -0
- package/src/lib/app-utils/business-details.js +4 -0
- package/src/lib/app-utils/business-details.js.map +1 -1
- package/src/lib/app-utils/connector-discovery.d.ts +80 -0
- package/src/lib/app-utils/connector-discovery.js +107 -0
- package/src/lib/app-utils/connector-discovery.js.map +1 -0
- package/src/lib/app-utils/crm.d.ts +17 -30
- package/src/lib/app-utils/crm.js +139 -3
- package/src/lib/app-utils/crm.js.map +1 -1
- package/src/lib/app-utils/docs-help-sections.generated.js +5 -1
- package/src/lib/app-utils/docs-help-sections.generated.js.map +1 -1
- package/src/lib/app-utils/docs-help.generated.d.ts +5 -5
- package/src/lib/app-utils/docs-help.generated.js +12 -3
- package/src/lib/app-utils/docs-help.generated.js.map +1 -1
- package/src/lib/app-utils/docs-index.generated.js +149 -9
- package/src/lib/app-utils/docs-index.generated.js.map +1 -1
- package/src/lib/app-utils/entity-picker-context.d.ts +6 -0
- package/src/lib/app-utils/entity-picker-context.js.map +1 -1
- package/src/lib/app-utils/expand-repeatables.js +25 -2
- package/src/lib/app-utils/expand-repeatables.js.map +1 -1
- package/src/lib/app-utils/host-tokens.d.ts +17 -0
- package/src/lib/app-utils/host-tokens.js +18 -0
- package/src/lib/app-utils/host-tokens.js.map +1 -1
- package/src/lib/app-utils/native-app-association.d.ts +9 -5
- package/src/lib/app-utils/native-app-association.js +10 -5
- package/src/lib/app-utils/native-app-association.js.map +1 -1
- package/src/lib/app-utils/native-nav.js +1 -1
- package/src/lib/app-utils/native-nav.js.map +1 -1
- package/src/lib/app-utils/organizations.js +4 -2
- package/src/lib/app-utils/organizations.js.map +1 -1
- package/src/lib/app-utils/plan-entitlements.d.ts +227 -36
- package/src/lib/app-utils/plan-entitlements.js +335 -43
- package/src/lib/app-utils/plan-entitlements.js.map +1 -1
- package/src/lib/app-utils/plugin-release-flags.generated.js +2 -2
- package/src/lib/app-utils/plugin-release-flags.generated.js.map +1 -1
- package/src/lib/app-utils/reusable-component-keys.d.ts +9 -0
- package/src/lib/app-utils/reusable-component-keys.js +9 -0
- package/src/lib/app-utils/reusable-component-keys.js.map +1 -1
- package/src/lib/app-utils/server.d.ts +1 -0
- package/src/lib/app-utils/server.js +1 -0
- package/src/lib/app-utils/server.js.map +1 -1
- package/src/lib/app-utils/sign-in-visibility.d.ts +78 -0
- package/src/lib/app-utils/sign-in-visibility.js +79 -0
- package/src/lib/app-utils/sign-in-visibility.js.map +1 -0
- package/src/lib/app-utils/site-live-url.d.ts +4 -1
- package/src/lib/app-utils/site-live-url.js +17 -3
- package/src/lib/app-utils/site-live-url.js.map +1 -1
- package/src/lib/app-utils/usage-level.d.ts +50 -0
- package/src/lib/app-utils/usage-level.js +94 -0
- package/src/lib/app-utils/usage-level.js.map +1 -0
- package/src/lib/foundation/definitions/org-billing.types.d.ts +24 -2
- package/src/lib/foundation/definitions/org-billing.types.js.map +1 -1
- package/src/lib/plugin-manager/plugin-contact-capture.d.ts +2 -0
- package/src/lib/plugin-manager/plugin-contact-capture.js.map +1 -1
|
@@ -159,6 +159,11 @@ import { planQuotaOf, pluginPlanFeatureRow, pluginPlanQuotaRow, pluginPlanQuotas
|
|
|
159
159
|
* without moving the figure every other agreement is measured against — the
|
|
160
160
|
* same mechanism every numeric entitlement uses.
|
|
161
161
|
*/ export const ENTERPRISE_EMAIL_SENDS_PER_MONTH = 260000;
|
|
162
|
+
/**
|
|
163
|
+
* Pro's included CRM records, and therefore Starter's CRM-record ceiling
|
|
164
|
+
* (AGL-4227): one constant, read by both rows, so the ceiling is always
|
|
165
|
+
* exactly what upgrading includes.
|
|
166
|
+
*/ const PRO_INCLUDED_CRM_RECORDS = 10000;
|
|
162
167
|
export const PLAN_ENTITLEMENTS = {
|
|
163
168
|
free: {
|
|
164
169
|
hostLimit: 1,
|
|
@@ -195,9 +200,12 @@ export const PLAN_ENTITLEMENTS = {
|
|
|
195
200
|
servicesPerHost: 0,
|
|
196
201
|
redirectsPerHost: 0,
|
|
197
202
|
contactsPerHost: 100,
|
|
203
|
+
maxCrmRecords: 0,
|
|
198
204
|
emailSendsPerMonth: 0,
|
|
199
205
|
actionRunsPerMonth: 0,
|
|
200
206
|
apiRequestsPerMonth: 0,
|
|
207
|
+
apiRequestsPerMinutePerOrg: 120,
|
|
208
|
+
maxApiRequestsPerMonth: 0,
|
|
201
209
|
datasetsPerOrg: 0,
|
|
202
210
|
maxDatasetsPerOrg: 0,
|
|
203
211
|
recordsPerDataset: 0,
|
|
@@ -311,6 +319,11 @@ export const PLAN_ENTITLEMENTS = {
|
|
|
311
319
|
servicesPerHost: 1,
|
|
312
320
|
redirectsPerHost: 25,
|
|
313
321
|
contactsPerHost: 1000,
|
|
322
|
+
// Starter sells CRM records past its 1,000 only up to Pro's included
|
|
323
|
+
// 10,000 (AGL-4227): past that a new record is refused with an upgrade
|
|
324
|
+
// message, and every record already held stays. Read off Pro's row so
|
|
325
|
+
// the two cannot drift; Pro and up have no ceiling.
|
|
326
|
+
maxCrmRecords: PRO_INCLUDED_CRM_RECORDS,
|
|
314
327
|
// Campaign email starts at Pro. A site that may send campaigns needs its
|
|
315
328
|
// own verified provider sending domain, and provisioning one is a real
|
|
316
329
|
// per-site operational cost that a campaign allowance commits the platform
|
|
@@ -332,7 +345,24 @@ export const PLAN_ENTITLEMENTS = {
|
|
|
332
345
|
// to it, and the CRM is what a Starter site builds before it upgrades.
|
|
333
346
|
emailSendsPerMonth: 0,
|
|
334
347
|
actionRunsPerMonth: 0,
|
|
335
|
-
|
|
348
|
+
// API access from Starter, billed by use (2026-11-16, AGL-4226). 500
|
|
349
|
+
// requests cost $0.06 at `perApiRequest` against a $16 annual price; past
|
|
350
|
+
// them each 1,000 bills at `PLAN_PRICING.starter.extraApiRequestsUsdPer1k`
|
|
351
|
+
// up to the monthly ceiling below. A third of Pro's band, which is one of
|
|
352
|
+
// the three API reasons to move up; the ceiling and the workspace rate
|
|
353
|
+
// limit are the other two.
|
|
354
|
+
apiRequestsPerMonth: 500,
|
|
355
|
+
// The whole workspace, every key and connection together, per minute
|
|
356
|
+
// (AGL-4226): the per-key 120 alone let a workspace multiply its budget
|
|
357
|
+
// by minting keys. Starter's is one key's worth.
|
|
358
|
+
apiRequestsPerMinutePerOrg: 120,
|
|
359
|
+
// A HARD monthly stop (AGL-4226): 19,500 requests of overage at most,
|
|
360
|
+
// $58.50 at Starter's rate, so the cheapest paid door cannot accrue more
|
|
361
|
+
// than that between invoices. THE one place the ceiling is written. Set
|
|
362
|
+
// with the rate so Pro is the cheaper plan before it is reached: about
|
|
363
|
+
// 17,900 requests on monthly prices, 13,500 on annual. Pro and above
|
|
364
|
+
// have none (`UNLIMITED`).
|
|
365
|
+
maxApiRequestsPerMonth: 20000,
|
|
336
366
|
datasetsPerOrg: 2,
|
|
337
367
|
maxDatasetsPerOrg: 10,
|
|
338
368
|
recordsPerDataset: 1000,
|
|
@@ -382,7 +412,10 @@ export const PLAN_ENTITLEMENTS = {
|
|
|
382
412
|
interactions: true,
|
|
383
413
|
actions: false,
|
|
384
414
|
webhooks: false,
|
|
385
|
-
|
|
415
|
+
// From Starter since AGL-4226: 500 requests, metered past them up to a
|
|
416
|
+
// 20,000 ceiling, at 120 a minute for the workspace. Webhooks stay off,
|
|
417
|
+
// and so do the Zapier hooks that are outbound events by another name.
|
|
418
|
+
apiAccess: true,
|
|
386
419
|
siteExport: false,
|
|
387
420
|
multilingual: false,
|
|
388
421
|
eventCalendar: false,
|
|
@@ -450,12 +483,17 @@ export const PLAN_ENTITLEMENTS = {
|
|
|
450
483
|
workflowsPerHost: UNLIMITED,
|
|
451
484
|
servicesPerHost: UNLIMITED,
|
|
452
485
|
redirectsPerHost: UNLIMITED,
|
|
453
|
-
contactsPerHost:
|
|
486
|
+
contactsPerHost: PRO_INCLUDED_CRM_RECORDS,
|
|
487
|
+
maxCrmRecords: UNLIMITED,
|
|
454
488
|
emailSendsPerMonth: 2500,
|
|
455
489
|
actionRunsPerMonth: 5000,
|
|
456
490
|
// API access moved in from Business with Business's band (v4), and the
|
|
457
491
|
// excess meters at Business's rate rather than refusing mid-integration.
|
|
458
492
|
apiRequestsPerMonth: 1500,
|
|
493
|
+
// Five keys' worth for the whole workspace (AGL-4226), and no monthly
|
|
494
|
+
// ceiling: the two API limits Starter has and Pro lifts.
|
|
495
|
+
apiRequestsPerMinutePerOrg: 600,
|
|
496
|
+
maxApiRequestsPerMonth: UNLIMITED,
|
|
459
497
|
datasetsPerOrg: 5,
|
|
460
498
|
maxDatasetsPerOrg: UNLIMITED,
|
|
461
499
|
recordsPerDataset: UNLIMITED,
|
|
@@ -558,9 +596,12 @@ export const PLAN_ENTITLEMENTS = {
|
|
|
558
596
|
servicesPerHost: UNLIMITED,
|
|
559
597
|
redirectsPerHost: UNLIMITED,
|
|
560
598
|
contactsPerHost: 30000,
|
|
599
|
+
maxCrmRecords: UNLIMITED,
|
|
561
600
|
emailSendsPerMonth: 15000,
|
|
562
601
|
actionRunsPerMonth: 50000,
|
|
563
602
|
apiRequestsPerMonth: 1500,
|
|
603
|
+
apiRequestsPerMinutePerOrg: 600,
|
|
604
|
+
maxApiRequestsPerMonth: UNLIMITED,
|
|
564
605
|
datasetsPerOrg: 10,
|
|
565
606
|
maxDatasetsPerOrg: 250,
|
|
566
607
|
recordsPerDataset: 100000,
|
|
@@ -632,9 +673,12 @@ export const PLAN_ENTITLEMENTS = {
|
|
|
632
673
|
servicesPerHost: UNLIMITED,
|
|
633
674
|
redirectsPerHost: UNLIMITED,
|
|
634
675
|
contactsPerHost: 100000,
|
|
676
|
+
maxCrmRecords: UNLIMITED,
|
|
635
677
|
emailSendsPerMonth: 25000,
|
|
636
678
|
actionRunsPerMonth: 100000,
|
|
637
679
|
apiRequestsPerMonth: 5000,
|
|
680
|
+
apiRequestsPerMinutePerOrg: 1200,
|
|
681
|
+
maxApiRequestsPerMonth: UNLIMITED,
|
|
638
682
|
datasetsPerOrg: 15,
|
|
639
683
|
maxDatasetsPerOrg: 500,
|
|
640
684
|
recordsPerDataset: 500000,
|
|
@@ -703,9 +747,12 @@ export const PLAN_ENTITLEMENTS = {
|
|
|
703
747
|
servicesPerHost: UNLIMITED,
|
|
704
748
|
redirectsPerHost: UNLIMITED,
|
|
705
749
|
contactsPerHost: 150000,
|
|
750
|
+
maxCrmRecords: UNLIMITED,
|
|
706
751
|
emailSendsPerMonth: 65000,
|
|
707
752
|
actionRunsPerMonth: 250000,
|
|
708
753
|
apiRequestsPerMonth: 17000,
|
|
754
|
+
apiRequestsPerMinutePerOrg: 2400,
|
|
755
|
+
maxApiRequestsPerMonth: UNLIMITED,
|
|
709
756
|
datasetsPerOrg: 25,
|
|
710
757
|
maxDatasetsPerOrg: 1000,
|
|
711
758
|
recordsPerDataset: 1000000,
|
|
@@ -778,9 +825,12 @@ export const PLAN_ENTITLEMENTS = {
|
|
|
778
825
|
servicesPerHost: UNLIMITED,
|
|
779
826
|
redirectsPerHost: UNLIMITED,
|
|
780
827
|
contactsPerHost: 500000,
|
|
828
|
+
maxCrmRecords: UNLIMITED,
|
|
781
829
|
emailSendsPerMonth: 130000,
|
|
782
830
|
actionRunsPerMonth: 1000000,
|
|
783
831
|
apiRequestsPerMonth: 85000,
|
|
832
|
+
apiRequestsPerMinutePerOrg: 6000,
|
|
833
|
+
maxApiRequestsPerMonth: UNLIMITED,
|
|
784
834
|
datasetsPerOrg: 50,
|
|
785
835
|
maxDatasetsPerOrg: 5000,
|
|
786
836
|
recordsPerDataset: UNLIMITED,
|
|
@@ -889,9 +939,12 @@ export const PLAN_ENTITLEMENTS = {
|
|
|
889
939
|
servicesPerHost: UNLIMITED,
|
|
890
940
|
redirectsPerHost: UNLIMITED,
|
|
891
941
|
contactsPerHost: 1000000,
|
|
942
|
+
maxCrmRecords: UNLIMITED,
|
|
892
943
|
emailSendsPerMonth: ENTERPRISE_EMAIL_SENDS_PER_MONTH,
|
|
893
944
|
actionRunsPerMonth: 2000000,
|
|
894
945
|
apiRequestsPerMonth: 170000,
|
|
946
|
+
apiRequestsPerMinutePerOrg: UNLIMITED,
|
|
947
|
+
maxApiRequestsPerMonth: UNLIMITED,
|
|
895
948
|
datasetsPerOrg: 100,
|
|
896
949
|
maxDatasetsPerOrg: 10000,
|
|
897
950
|
recordsPerDataset: UNLIMITED,
|
|
@@ -1187,12 +1240,25 @@ fillPluginPlanEntitlements(PLAN_ENTITLEMENTS);
|
|
|
1187
1240
|
starter: {
|
|
1188
1241
|
basePriceMonthlyUsd: 25,
|
|
1189
1242
|
basePriceAnnualMonthlyUsd: 16,
|
|
1190
|
-
|
|
1243
|
+
// $25 since AGL-4227 (from $20): three Starter sites now cost more than
|
|
1244
|
+
// Pro on both intervals ($75 vs $69 monthly, $66 vs $49 annual). Charged
|
|
1245
|
+
// at $20 until `STRIPE_PRICE_STARTER_EXTRA_HOST_V2[_YEARLY]` names the
|
|
1246
|
+
// $25 price — see `REPRICED_ADDONS` in `billing-addons.ts`.
|
|
1247
|
+
extraHostMonthlyUsd: 25,
|
|
1191
1248
|
extraSeatMonthlyUsd: 5,
|
|
1192
1249
|
extraCollaboratorMonthlyUsd: 3,
|
|
1193
1250
|
extraDatasetMonthlyUsd: 2,
|
|
1194
1251
|
extraDataGbMonthlyUsd: 0.36,
|
|
1195
|
-
|
|
1252
|
+
// API overage, per 1,000 past the 500 included (AGL-4226). THE one place
|
|
1253
|
+
// the Starter rate is written: specs, the refusal message, the console and
|
|
1254
|
+
// the generated tables read it from here. Six times Pro's $0.50 on
|
|
1255
|
+
// purpose, so upgrading is the cheaper path for a real integration (the
|
|
1256
|
+
// overage audit of 2026-11-16, option C), and the $3 per 1,000 Starter
|
|
1257
|
+
// already pays for AI credits. The most a Starter workspace can be billed
|
|
1258
|
+
// for API overage in a month is this times 19.5 (its 20,000 ceiling less
|
|
1259
|
+
// the 500 band), $58.50. Withheld where it could never be collected
|
|
1260
|
+
// (`apiOverageRateUsd`).
|
|
1261
|
+
extraApiRequestsUsdPer1k: 3,
|
|
1196
1262
|
// The top of the retail ladder, which Starter JOINS rather than steps
|
|
1197
1263
|
// above (AGL-3203): the ladder descends with the tier, and Starter is the
|
|
1198
1264
|
// rung below Pro, not a new one over it. Moves in lockstep with the 750
|
|
@@ -1201,11 +1267,14 @@ fillPluginPlanEntitlements(PLAN_ENTITLEMENTS);
|
|
|
1201
1267
|
// advertised on a quantity the plan never sold.
|
|
1202
1268
|
extraAssistCreditsUsdPer1k: 3,
|
|
1203
1269
|
extraContactsUsdPer1k: 1,
|
|
1204
|
-
//
|
|
1205
|
-
//
|
|
1206
|
-
//
|
|
1207
|
-
// the
|
|
1208
|
-
|
|
1270
|
+
// EVERY email Starter sends past 1,000 a month bills here (AGL-4227):
|
|
1271
|
+
// receipts, booking and form mail, workflow notices and one-to-one CRM
|
|
1272
|
+
// mail together, measured against `INCLUDED_EMAIL_SENDS_BY_PLAN.starter`
|
|
1273
|
+
// rather than the campaign band (still 0: campaigns start at Pro). Above
|
|
1274
|
+
// Pro's $2.25 so the ladder points up, and $2.50 keeps 2.70× of the $0.90
|
|
1275
|
+
// a thousand cost. Until this the mail was neither billed nor refused below
|
|
1276
|
+
// a 1,000-a-day abuse ceiling — $27 a month of provider cost at worst.
|
|
1277
|
+
extraEmailSendsUsdPer1k: 2.5,
|
|
1209
1278
|
// Starter keeps every wall (v4): its run bands stop rather than bill.
|
|
1210
1279
|
extraRunsUsdPer1k: null,
|
|
1211
1280
|
meteredInfraPassThrough: true
|
|
@@ -1255,7 +1324,9 @@ fillPluginPlanEntitlements(PLAN_ENTITLEMENTS);
|
|
|
1255
1324
|
extraCollaboratorMonthlyUsd: 1,
|
|
1256
1325
|
extraDatasetMonthlyUsd: 1,
|
|
1257
1326
|
extraDataGbMonthlyUsd: 0.36,
|
|
1258
|
-
|
|
1327
|
+
// Pro's $0.50 (AGL-4227): a page of 100 records costs $0.34 per 1,000,
|
|
1328
|
+
// and $0.35 kept nothing on it. Retired; no workspace can subscribe.
|
|
1329
|
+
extraApiRequestsUsdPer1k: 0.5,
|
|
1259
1330
|
extraAssistCreditsUsdPer1k: 2.5,
|
|
1260
1331
|
extraContactsUsdPer1k: 0.4,
|
|
1261
1332
|
extraEmailSendsUsdPer1k: 1.9,
|
|
@@ -1270,10 +1341,10 @@ fillPluginPlanEntitlements(PLAN_ENTITLEMENTS);
|
|
|
1270
1341
|
extraCollaboratorMonthlyUsd: 1,
|
|
1271
1342
|
extraDatasetMonthlyUsd: 1,
|
|
1272
1343
|
extraDataGbMonthlyUsd: 0.36,
|
|
1273
|
-
//
|
|
1274
|
-
//
|
|
1275
|
-
//
|
|
1276
|
-
extraApiRequestsUsdPer1k: 0.
|
|
1344
|
+
// Pro's $0.50 (AGL-4227). It was $0.25, floored at the 50% retail margin
|
|
1345
|
+
// on a default request (AGL-3444), which lost money on a page of 100
|
|
1346
|
+
// records ($0.34 per 1,000). Retired; no workspace can subscribe.
|
|
1347
|
+
extraApiRequestsUsdPer1k: 0.5,
|
|
1277
1348
|
extraAssistCreditsUsdPer1k: 2.25,
|
|
1278
1349
|
// FLOORED at the 50% retail margin, not stepped down again. The ladder
|
|
1279
1350
|
// above it descends $1.00 → $0.75 → $0.50 → $0.40, and one more step
|
|
@@ -1306,8 +1377,8 @@ fillPluginPlanEntitlements(PLAN_ENTITLEMENTS);
|
|
|
1306
1377
|
extraCollaboratorMonthlyUsd: 1,
|
|
1307
1378
|
extraDatasetMonthlyUsd: 1,
|
|
1308
1379
|
extraDataGbMonthlyUsd: 0.36,
|
|
1309
|
-
//
|
|
1310
|
-
extraApiRequestsUsdPer1k: 0.
|
|
1380
|
+
// Pro's $0.50 (AGL-4227) — see Advanced's.
|
|
1381
|
+
extraApiRequestsUsdPer1k: 0.5,
|
|
1311
1382
|
extraAssistCreditsUsdPer1k: 2,
|
|
1312
1383
|
// $0.40, because the band it meters is now FINITE.
|
|
1313
1384
|
//
|
|
@@ -1974,7 +2045,8 @@ export const STRIPE_PROCESSOR_FEE_FIXED_USD = 0.3;
|
|
|
1974
2045
|
* and functions bill, in USD per view (AGL-1879, AGL-3444): the CDN requests
|
|
1975
2046
|
* a cold load makes, and the one of them that reaches a function — the
|
|
1976
2047
|
* analytics beacon. A page view billed past a plan's band is priced at
|
|
1977
|
-
* `(perPageView + this) ×
|
|
2048
|
+
* `(perPageView + this) × METERED_PRICE_MULTIPLE`, rounded up — $0.83 per
|
|
2049
|
+
* 1,000 since AGL-3476 (this said $0.80 at × 1.3 until AGL-4227) — and every
|
|
1978
2050
|
* `bandwidthGb` band is sized with it counted.
|
|
1979
2051
|
*
|
|
1980
2052
|
* ## Why a page view needs a second cost term
|
|
@@ -2044,8 +2116,9 @@ export const STRIPE_PROCESSOR_FEE_FIXED_USD = 0.3;
|
|
|
2044
2116
|
/**
|
|
2045
2117
|
* Monthly unit costs for the meters the rollup already records (AGL-1134).
|
|
2046
2118
|
*
|
|
2047
|
-
* These are OUR costs, not prices — the org is billed at cost ×
|
|
2048
|
-
*
|
|
2119
|
+
* These are OUR costs, not prices — the org is billed at cost ×
|
|
2120
|
+
* `METERED_PRICE_MULTIPLE` (1.3388, AGL-3476), which keeps cost + 30%
|
|
2121
|
+
* (`METERED_MARKUP`, AGL-41) after Stripe's 2.9%. Storage/page-view/form rates match
|
|
2049
2122
|
* `METERED_UNIT_RATES_USD` in the metering module on purpose: two files
|
|
2050
2123
|
* disagreeing about what a page view costs is exactly the drift this function
|
|
2051
2124
|
* exists to remove.
|
|
@@ -2128,18 +2201,24 @@ export const STRIPE_PROCESSOR_FEE_FIXED_USD = 0.3;
|
|
|
2128
2201
|
* pricier than object storage.
|
|
2129
2202
|
*/ dataStoragePerGbMonth: 0.18,
|
|
2130
2203
|
/**
|
|
2131
|
-
* One `/v1` request — $
|
|
2204
|
+
* One `/v1` request — $120 per million (AGL-3444, re-derived for AGL-4226).
|
|
2132
2205
|
*
|
|
2133
2206
|
* Every request is a function invocation behind a CDN request, and it reads
|
|
2134
2207
|
* before it answers (`apps/console/utils/api-v1.ts`). The ledger for a
|
|
2135
2208
|
* default list page — 25 records, read as 26 — at Vercel's dearest region
|
|
2136
|
-
* and nam5's list prices:
|
|
2209
|
+
* and nam5's list prices, as the pipeline stands after AGL-4226:
|
|
2137
2210
|
*
|
|
2138
|
-
* - reads: the key, the rate-limit window, the org, the
|
|
2139
|
-
*
|
|
2140
|
-
* $0.06 per 100,000 = $0.0000186
|
|
2141
|
-
*
|
|
2142
|
-
*
|
|
2211
|
+
* - reads: the key, the key's rate-limit window, the org, the WORKSPACE's
|
|
2212
|
+
* rate-limit window (AGL-4226), the site the resource sits under, and
|
|
2213
|
+
* the page — 31, at $0.06 per 100,000 = $0.0000186. A plan whose month
|
|
2214
|
+
* is MEASURED (Starter, for its ceiling; a comp; Custom's fallback
|
|
2215
|
+
* band) reads the month's counter as well, 32 in all ($0.0000192). Before the
|
|
2216
|
+
* workspace limit it was 30 on a plan that never measured, and the
|
|
2217
|
+
* comment said 31 — the counter read is paid only where a month can
|
|
2218
|
+
* refuse.
|
|
2219
|
+
* - writes: the two rate-limit windows and the usage counter — 3, at
|
|
2220
|
+
* $0.18 per 100,000 = $0.0000054 (the key's last-used stamp is written
|
|
2221
|
+
* at most once a minute, and is left out)
|
|
2143
2222
|
* - the function, 0.4 s billed as active CPU at $0.221/hr, 2 GB at
|
|
2144
2223
|
* $0.0183/GB-hr, $0.60 per million invocations = $0.0000292
|
|
2145
2224
|
* - the CDN request: $3.20 per million = $0.0000032
|
|
@@ -2149,10 +2228,31 @@ export const STRIPE_PROCESSOR_FEE_FIXED_USD = 0.3;
|
|
|
2149
2228
|
* of request and envelope, through Fast Data Transfer ($0.35 a GB) and
|
|
2150
2229
|
* Fast Origin Transfer ($0.43 a GB), decimal GB = $0.0000615
|
|
2151
2230
|
*
|
|
2152
|
-
* $0.
|
|
2153
|
-
*
|
|
2154
|
-
*
|
|
2155
|
-
|
|
2231
|
+
* $0.0001179, or $0.0001185 where the month is measured, carried up to
|
|
2232
|
+
* $0.00012. It was $0.000117 before the workspace window's read and write.
|
|
2233
|
+
*
|
|
2234
|
+
* The figure is the DEFAULT request, not the ceiling — which is why a
|
|
2235
|
+
* request has been BILLED by size since AGL-4227: one unit per started
|
|
2236
|
+
* 256 KB of the larger of its request and response
|
|
2237
|
+
* (`API_BILLING_UNIT_BYTES`). At Pro's $0.50 per 1,000, $0.0005 a unit and
|
|
2238
|
+
* 97.1% of it kept after Stripe:
|
|
2239
|
+
*
|
|
2240
|
+
* - a full 256 KiB unit costs about $0.000262 (the $0.000057 fixed part
|
|
2241
|
+
* above plus 262,144 bytes at $0.78 a decimal GB): kept 1.86×, the
|
|
2242
|
+
* thinnest case, still above cost + 30%;
|
|
2243
|
+
* - a page of 100 — the most a client may ask for — is $0.000343 and
|
|
2244
|
+
* about 302 KiB, so 2 units ($0.001): kept 2.83×;
|
|
2245
|
+
* - a 1 MB body is 4 units ($0.002) against about $0.000837: kept 2.32×;
|
|
2246
|
+
* - a body at Vercel's 4.5 MB function limit (a base64 image upload, or a
|
|
2247
|
+
* page of large dataset records) is 18 units ($0.009) against about
|
|
2248
|
+
* $0.00357: kept 2.45×. Billed as one unit it lost about 7×.
|
|
2249
|
+
*
|
|
2250
|
+
* Before the unit, a request paid for itself only up to about 550 KB on the
|
|
2251
|
+
* wire; with it, every size clears cost + 30% at $0.50, and by more at
|
|
2252
|
+
* Starter's $3.00.
|
|
2253
|
+
*
|
|
2254
|
+
* See the 2026-10-01 and 2026-11-16 decision entries.
|
|
2255
|
+
*/ perApiRequest: 0.00012,
|
|
2156
2256
|
/**
|
|
2157
2257
|
* One CRM record held for a month. An operator-tuned estimate (AGL-1134),
|
|
2158
2258
|
* not built from a per-operation price: at `nam5`'s $0.06 per 100,000 it
|
|
@@ -2202,8 +2302,10 @@ export const STRIPE_PROCESSOR_FEE_FIXED_USD = 0.3;
|
|
|
2202
2302
|
* document returned — and a step that writes a dataset record or calls a
|
|
2203
2303
|
* webhook adds to it, so this is the typical figure, not the ceiling.
|
|
2204
2304
|
*
|
|
2205
|
-
* It is a COST, not a price
|
|
2206
|
-
*
|
|
2305
|
+
* It is a COST, not a price. Since pricing v4 Pro bills runs past its bands
|
|
2306
|
+
* at `RUN_OVERAGE_USD_PER_1K` ($0.02, cost × the pass-through multiple) and
|
|
2307
|
+
* Starter refuses at its band (comment corrected in AGL-4227). It exists so
|
|
2308
|
+
* a tier's run bands reach
|
|
2207
2309
|
* `orgMonthlyCogsUsd` and `tier-margin-floor.spec.ts` — Agency's 3,000,000
|
|
2208
2310
|
* runs are $36 a month that read as nothing while this was absent.
|
|
2209
2311
|
*/ perRun: 0.000013
|
|
@@ -3873,24 +3975,64 @@ export function checkQuota(org, quota, currentUsage) {
|
|
|
3873
3975
|
overageRateUsd
|
|
3874
3976
|
};
|
|
3875
3977
|
}
|
|
3978
|
+
/**
|
|
3979
|
+
* Whether a whole-bill discount takes the ENTIRE invoice, usage included
|
|
3980
|
+
* (AGL-4226): a 100% coupon that is not limited to the base price. Usage
|
|
3981
|
+
* past a band under it is measured, reported and invoiced at $0.
|
|
3982
|
+
*/ function wholeBillFullyDiscounted(org) {
|
|
3983
|
+
const discount = org == null ? void 0 : org.discount;
|
|
3984
|
+
if (!discount || discount.basePriceOnly === true) return false;
|
|
3985
|
+
return typeof discount.percentOff === 'number' && discount.percentOff >= 100;
|
|
3986
|
+
}
|
|
3987
|
+
/**
|
|
3988
|
+
* The per-1,000 rate API requests past the band are SOLD at for this org, or
|
|
3989
|
+
* `null` when nothing past the band is sold (AGL-4226).
|
|
3990
|
+
*
|
|
3991
|
+
* The plan's rate (`resolvePlanPricing`, so a comp sells nothing), withheld
|
|
3992
|
+
* on EVERY plan when the overage could never be collected: no live billing
|
|
3993
|
+
* subscription (`isBillingSubscription` — a paid plan stored without one), or
|
|
3994
|
+
* a 100% whole-bill discount. A withheld rate turns the band into the wall
|
|
3995
|
+
* `checkApiRequestQuota` already enforces for a plan with no rate, so those
|
|
3996
|
+
* workspaces stop at the requests they were given rather than metering onto
|
|
3997
|
+
* an invoice nobody pays.
|
|
3998
|
+
*
|
|
3999
|
+
* Starter-only when it was written (AGL-4226); every plan since a read-only
|
|
4000
|
+
* production count on 2026-11-16 found no workspace it would cut off (none
|
|
4001
|
+
* of 275 on a paid plan without a live subscription, none on a 100%
|
|
4002
|
+
* whole-bill coupon; the only unbilled ones are staff comps, none of them
|
|
4003
|
+
* calling the API). An explicit uncapped staff comp is untouched: its band is
|
|
4004
|
+
* `UNLIMITED`, so a null rate refuses nothing. Custom carries no rate, so its
|
|
4005
|
+
* contracted band was already the wall.
|
|
4006
|
+
*/ export function apiOverageRateUsd(org) {
|
|
4007
|
+
const rate = resolvePlanPricing(org).extraApiRequestsUsdPer1k;
|
|
4008
|
+
if (rate === null) return null;
|
|
4009
|
+
if (!isBillingSubscription(org) || wholeBillFullyDiscounted(org)) return null;
|
|
4010
|
+
return rate;
|
|
4011
|
+
}
|
|
3876
4012
|
/**
|
|
3877
4013
|
* Customer REST API request meter (AGL-634): the monthly request count for an
|
|
3878
|
-
* org.
|
|
3879
|
-
* `extraApiRequestsUsdPer1k` rate
|
|
3880
|
-
* onto the monthly invoice
|
|
3881
|
-
*
|
|
3882
|
-
* without
|
|
4014
|
+
* org. Every plan with `apiAccess` but Custom carries an
|
|
4015
|
+
* `extraApiRequestsUsdPer1k` rate (Starter since AGL-4226, Pro since pricing
|
|
4016
|
+
* v4), so requests past the included band meter onto the monthly invoice up
|
|
4017
|
+
* to the plan's monthly CEILING (`maxApiRequestsPerMonth`: 20,000 on
|
|
4018
|
+
* Starter, none from Pro up). Plans without a rate — Free, a comp, Custom
|
|
4019
|
+
* on its fallback band, or a Starter workspace whose overage cannot be
|
|
4020
|
+
* collected (`apiOverageRateUsd`) — stop at the band.
|
|
3883
4021
|
*/ export function checkApiRequestQuota(org, usedRequests) {
|
|
4022
|
+
var _entitlements_maxApiRequestsPerMonth;
|
|
3884
4023
|
const entitlements = resolveOrgEntitlements(org);
|
|
3885
|
-
const pricing = resolvePlanPricing(org);
|
|
3886
4024
|
const included = entitlements.apiRequestsPerMonth;
|
|
3887
|
-
const overageRateUsd =
|
|
4025
|
+
const overageRateUsd = apiOverageRateUsd(org);
|
|
4026
|
+
const ceiling = Math.max(included, Number((_entitlements_maxApiRequestsPerMonth = entitlements.maxApiRequestsPerMonth) != null ? _entitlements_maxApiRequestsPerMonth : UNLIMITED));
|
|
3888
4027
|
const used = Math.max(0, usedRequests);
|
|
3889
4028
|
const overageRequests = Math.max(0, used - included);
|
|
4029
|
+
const allowed = overageRateUsd !== null ? used < ceiling : used < included;
|
|
3890
4030
|
return {
|
|
3891
|
-
allowed
|
|
4031
|
+
allowed,
|
|
3892
4032
|
included,
|
|
3893
4033
|
used,
|
|
4034
|
+
ceiling,
|
|
4035
|
+
refusedBy: allowed ? null : overageRateUsd !== null ? 'ceiling' : 'band',
|
|
3894
4036
|
remaining: Math.max(0, included - used),
|
|
3895
4037
|
overageRequests,
|
|
3896
4038
|
overageMonthlyUsd: overageRateUsd === null ? 0 : Math.round(overageRequests / 1000 * overageRateUsd * 100) / 100,
|
|
@@ -3943,7 +4085,9 @@ export function checkQuota(org, quota, currentUsage) {
|
|
|
3943
4085
|
/**
|
|
3944
4086
|
* CRM records band meter (AGL-890, widened in AGL-2611): contacts, companies
|
|
3945
4087
|
* and deals, counted together across the org and measured against the ONE
|
|
3946
|
-
* band `contactsPerHost` names
|
|
4088
|
+
* band `contactsPerHost` names, up to `maxCrmRecords` (AGL-4227: Starter
|
|
4089
|
+
* stops adding at Pro's included amount; records it already holds stay and
|
|
4090
|
+
* bill). Paid plans carry an `extraContactsUsdPer1k`
|
|
3947
4091
|
* rate, so records past the included band meter onto the monthly invoice
|
|
3948
4092
|
* (cost-plus, like storage and API overage — a growing audience is never
|
|
3949
4093
|
* dropped); free has no rate and hard-bands at the included count, refusing
|
|
@@ -3963,16 +4107,23 @@ export function checkQuota(org, quota, currentUsage) {
|
|
|
3963
4107
|
* End-user member ACCOUNTS are unlimited on every plan (AGL-889) — this
|
|
3964
4108
|
* meters only the CRM record.
|
|
3965
4109
|
*/ export function checkCrmRecordsQuota(org, usedRecords) {
|
|
4110
|
+
var _entitlements_maxCrmRecords;
|
|
3966
4111
|
const entitlements = resolveOrgEntitlements(org);
|
|
3967
4112
|
const pricing = resolvePlanPricing(org);
|
|
3968
4113
|
const included = entitlements.contactsPerHost;
|
|
3969
4114
|
const overageRateUsd = pricing.extraContactsUsdPer1k;
|
|
4115
|
+
const ceiling = Math.max(included, Number((_entitlements_maxCrmRecords = entitlements.maxCrmRecords) != null ? _entitlements_maxCrmRecords : UNLIMITED));
|
|
3970
4116
|
const used = Math.max(0, usedRecords);
|
|
4117
|
+
// Every record HELD past the band bills, the ceiling included: the ceiling
|
|
4118
|
+
// refuses new records, it never stops billing the ones a workspace keeps.
|
|
3971
4119
|
const overageRecords = Math.max(0, used - included);
|
|
4120
|
+
const allowed = overageRateUsd !== null ? used < ceiling : used < included;
|
|
3972
4121
|
return {
|
|
3973
|
-
allowed
|
|
4122
|
+
allowed,
|
|
3974
4123
|
included,
|
|
3975
4124
|
used,
|
|
4125
|
+
ceiling,
|
|
4126
|
+
refusedBy: allowed ? null : overageRateUsd !== null ? 'ceiling' : 'band',
|
|
3976
4127
|
remaining: Math.max(0, included - used),
|
|
3977
4128
|
overageRecords,
|
|
3978
4129
|
overageMonthlyUsd: overageRateUsd === null ? 0 : Math.round(overageRecords / 1000 * overageRateUsd * 100) / 100,
|
|
@@ -4043,6 +4194,66 @@ export function checkQuota(org, quota, currentUsage) {
|
|
|
4043
4194
|
resetsAt
|
|
4044
4195
|
};
|
|
4045
4196
|
}
|
|
4197
|
+
/**
|
|
4198
|
+
* The EMAIL BILLING band where it is not the campaign band (AGL-4227): the
|
|
4199
|
+
* emails a month a plan includes across ALL mail on the cost meter — receipts,
|
|
4200
|
+
* notices, workflow and one-to-one CRM mail as well as campaigns — before
|
|
4201
|
+
* `extraEmailSendsUsdPer1k` bills.
|
|
4202
|
+
*
|
|
4203
|
+
* Starter's campaign band is 0 (campaigns start at Pro), so measuring its
|
|
4204
|
+
* overage against that band priced nothing at any volume. It now includes
|
|
4205
|
+
* 1,000 emails a month of everything, one-to-one CRM mail inside the same
|
|
4206
|
+
* 1,000, and bills past it. Every other plan bills against its campaign band
|
|
4207
|
+
* as before; a plan absent here has no separate billing band.
|
|
4208
|
+
*/ export const INCLUDED_EMAIL_SENDS_BY_PLAN = {
|
|
4209
|
+
starter: 1000
|
|
4210
|
+
};
|
|
4211
|
+
/**
|
|
4212
|
+
* A HARD monthly cap on a plan's email (AGL-4227), across everything on the
|
|
4213
|
+
* cost meter but account and security mail: past it, the next email is not
|
|
4214
|
+
* sent until the month turns (UTC). For the plan that cannot be billed for
|
|
4215
|
+
* usage — Free — so its mail has a bound that is not an invoice.
|
|
4216
|
+
*
|
|
4217
|
+
* 300 on Free. What a Free workspace legitimately sends is small: 20 form
|
|
4218
|
+
* submissions a month (a notice and a confirmation each, at most 40), no
|
|
4219
|
+
* store, no bookings, no campaigns, no one-to-one CRM mail and no workflows;
|
|
4220
|
+
* invitations, sign-in links and password resets are exempt and never
|
|
4221
|
+
* counted. 300 is several times that, and costs at most $0.27 a month at
|
|
4222
|
+
* `perEmailSend`. Counted on its own field from the month it ships, so it
|
|
4223
|
+
* never refuses mail because of what was sent before it existed.
|
|
4224
|
+
*
|
|
4225
|
+
* A plan absent here has no monthly cap (its daily abuse ceiling still
|
|
4226
|
+
* applies). An org can be given its own figure on
|
|
4227
|
+
* `entitlements.emailSendsMonthlyCap`.
|
|
4228
|
+
*/ export const EMAIL_SENDS_MONTHLY_CAP_BY_PLAN = {
|
|
4229
|
+
free: 300
|
|
4230
|
+
};
|
|
4231
|
+
/** The per-org override key for the monthly email cap. */ export const EMAIL_SENDS_MONTHLY_CAP_KEY = 'emailSendsMonthlyCap';
|
|
4232
|
+
/**
|
|
4233
|
+
* The org's hard monthly email cap (AGL-4227): its own figure when staff
|
|
4234
|
+
* wrote one, else its plan's, else `UNLIMITED`. The ONE reader the send seam,
|
|
4235
|
+
* the usage page and the usage alerts ask. Read off the plan the org RESOLVES
|
|
4236
|
+
* as, so a lapsed paid plan reads as Free.
|
|
4237
|
+
*/ export function resolveMonthlyEmailCap(org) {
|
|
4238
|
+
var _org_entitlements;
|
|
4239
|
+
const override = org == null ? void 0 : (_org_entitlements = org.entitlements) == null ? void 0 : _org_entitlements[EMAIL_SENDS_MONTHLY_CAP_KEY];
|
|
4240
|
+
if (typeof override === 'number' && Number.isFinite(override) && override >= 0) {
|
|
4241
|
+
return Math.floor(override);
|
|
4242
|
+
}
|
|
4243
|
+
const cap = EMAIL_SENDS_MONTHLY_CAP_BY_PLAN[resolveEffectivePlan(org)];
|
|
4244
|
+
return typeof cap === 'number' ? cap : UNLIMITED;
|
|
4245
|
+
}
|
|
4246
|
+
/**
|
|
4247
|
+
* The band an org's month of email is billed against (AGL-4227):
|
|
4248
|
+
* `INCLUDED_EMAIL_SENDS_BY_PLAN` for its plan where one is set, else its
|
|
4249
|
+
* resolved `emailSendsPerMonth`. The ONE reader the rollup and the billing
|
|
4250
|
+
* page ask, so the invoice and the readout cannot measure different bands.
|
|
4251
|
+
* A comp prices nothing past any band (`compPricing`), so the band it reads
|
|
4252
|
+
* here never bills.
|
|
4253
|
+
*/ export function emailSendsBillingBand(org) {
|
|
4254
|
+
const band = INCLUDED_EMAIL_SENDS_BY_PLAN[resolveEffectivePlan(org)];
|
|
4255
|
+
return typeof band === 'number' ? band : resolveOrgEntitlements(org).emailSendsPerMonth;
|
|
4256
|
+
}
|
|
4046
4257
|
/**
|
|
4047
4258
|
* Volume above the plan's included band, in emails.
|
|
4048
4259
|
*
|
|
@@ -4562,5 +4773,86 @@ function enforcementShape(atZero, atCeiling) {
|
|
|
4562
4773
|
*/ export function apiRequestEnforcementShape(org) {
|
|
4563
4774
|
return enforcementShape(checkApiRequestQuota(org, 0).allowed, checkApiRequestQuota(org, Number.MAX_SAFE_INTEGER).allowed);
|
|
4564
4775
|
}
|
|
4776
|
+
/**
|
|
4777
|
+
* Requests per minute the WHOLE workspace may make on the customer API, every
|
|
4778
|
+
* key and connection together (AGL-4226): the resolved
|
|
4779
|
+
* `apiRequestsPerMinutePerOrg`, or `UNLIMITED` when the plan sets none
|
|
4780
|
+
* (Custom without an agreed figure, an uncapped comp). Sits beside the
|
|
4781
|
+
* per-key 120 a minute, never instead of it.
|
|
4782
|
+
*
|
|
4783
|
+
* The ladder: Starter 120 (one key's worth), Pro 600, and each retired tier
|
|
4784
|
+
* above it at least Pro's — Business 600, Scale 1,200, Advanced 2,400,
|
|
4785
|
+
* Agency 6,000 — with Custom unlimited unless its agreement sets a number.
|
|
4786
|
+
*/ export function apiWorkspaceRateLimitPerMinute(org) {
|
|
4787
|
+
const value = Number(resolveOrgEntitlements(org).apiRequestsPerMinutePerOrg);
|
|
4788
|
+
if (!Number.isFinite(value)) return UNLIMITED;
|
|
4789
|
+
return Math.max(0, Math.floor(value));
|
|
4790
|
+
}
|
|
4791
|
+
/**
|
|
4792
|
+
* The cheapest self-serve plan with no monthly API ceiling, by price — the
|
|
4793
|
+
* plan a refusal at the ceiling names as the way past it (AGL-4226). `null`
|
|
4794
|
+
* when every self-serve plan has one.
|
|
4795
|
+
*/ export function cheapestPlanWithoutApiCeiling() {
|
|
4796
|
+
var _uncapped_;
|
|
4797
|
+
const uncapped = SELF_SERVE_PLANS.filter((plan)=>{
|
|
4798
|
+
var _PLAN_ENTITLEMENTS_plan_maxApiRequestsPerMonth;
|
|
4799
|
+
return PLAN_ENTITLEMENTS[plan].features.apiAccess && !Number.isFinite((_PLAN_ENTITLEMENTS_plan_maxApiRequestsPerMonth = PLAN_ENTITLEMENTS[plan].maxApiRequestsPerMonth) != null ? _PLAN_ENTITLEMENTS_plan_maxApiRequestsPerMonth : UNLIMITED);
|
|
4800
|
+
});
|
|
4801
|
+
uncapped.sort((a, b)=>PLAN_PRICING[a].basePriceMonthlyUsd - PLAN_PRICING[b].basePriceMonthlyUsd);
|
|
4802
|
+
return (_uncapped_ = uncapped[0]) != null ? _uncapped_ : null;
|
|
4803
|
+
}
|
|
4804
|
+
/**
|
|
4805
|
+
* What a monthly refusal says (AGL-4226), naming the limit that refused: the
|
|
4806
|
+
* plan's ceiling and the plan without one, or the band a plan that sells no
|
|
4807
|
+
* overage stopped at.
|
|
4808
|
+
*/ export function apiMonthlyRefusalMessage(org, quota) {
|
|
4809
|
+
const plan = resolveEffectivePlan(org);
|
|
4810
|
+
const label = PLAN_LABELS[plan];
|
|
4811
|
+
const next = cheapestPlanWithoutApiCeiling();
|
|
4812
|
+
const upgrade = next && next !== plan ? ` ${PLAN_LABELS[next]} has no monthly ceiling.` : '';
|
|
4813
|
+
if (quota.refusedBy === 'ceiling') {
|
|
4814
|
+
return `This workspace has made ${quota.ceiling.toLocaleString('en-US')} API requests this month, ` + `the most the ${label} plan allows. Requests resume when the month turns (UTC).${upgrade}`;
|
|
4815
|
+
}
|
|
4816
|
+
return `This workspace has used the ${quota.included.toLocaleString('en-US')} API requests ` + `included this month, and no overage can be billed to it. Requests resume when the month turns (UTC).`;
|
|
4817
|
+
}
|
|
4818
|
+
/**
|
|
4819
|
+
* What a refused CRM record says (AGL-4227): at Starter's ceiling, the
|
|
4820
|
+
* ceiling and the plan that includes it; at a band a plan sells nothing past,
|
|
4821
|
+
* the band. Records already held are never touched, and the message says so.
|
|
4822
|
+
*/ export function crmRecordsRefusalMessage(org, quota) {
|
|
4823
|
+
if (quota.refusedBy === 'ceiling') {
|
|
4824
|
+
const plan = resolveEffectivePlan(org);
|
|
4825
|
+
const next = SELF_SERVE_PLANS.find((candidate)=>{
|
|
4826
|
+
var _PLAN_ENTITLEMENTS_candidate_maxCrmRecords;
|
|
4827
|
+
return candidate !== plan && PLAN_PRICING[candidate].basePriceMonthlyUsd > PLAN_PRICING[plan].basePriceMonthlyUsd && !Number.isFinite((_PLAN_ENTITLEMENTS_candidate_maxCrmRecords = PLAN_ENTITLEMENTS[candidate].maxCrmRecords) != null ? _PLAN_ENTITLEMENTS_candidate_maxCrmRecords : UNLIMITED);
|
|
4828
|
+
});
|
|
4829
|
+
return `CRM records limit reached: the ${PLAN_LABELS[plan]} plan holds up to ` + `${quota.ceiling.toLocaleString('en-US')} records across contacts, companies and deals, ` + 'and every record you have is kept.' + (next ? ` Upgrade to ${PLAN_LABELS[next]} to add more.` : '');
|
|
4830
|
+
}
|
|
4831
|
+
return `CRM records limit reached (${quota.included.toLocaleString('en-US')} records across ` + 'contacts, companies and deals). Upgrade the plan to add more.';
|
|
4832
|
+
}
|
|
4833
|
+
/**
|
|
4834
|
+
* The size of ONE billed API unit (AGL-4227): a request is billed one unit
|
|
4835
|
+
* per started 256 KB of the larger of its request and response body.
|
|
4836
|
+
*
|
|
4837
|
+
* Every request was one unit at any size, and a request costs its bytes: a
|
|
4838
|
+
* default page is about 77 KB on the wire, a page of 100 records about
|
|
4839
|
+
* 302 KB, and a body at Vercel's 4.5 MB function limit about $0.0035 in
|
|
4840
|
+
* transfer alone — roughly 7× what one unit brings in at $0.50 per 1,000. A
|
|
4841
|
+
* 256 KB unit costs at most about $0.00026 (transfer at $0.78 per decimal GB
|
|
4842
|
+
* plus the request's fixed cost), which $0.50 per 1,000 covers 1.9 times
|
|
4843
|
+
* after Stripe's fee. The unit counts on the monthly counter, so it reaches
|
|
4844
|
+
* the invoice, the ceiling and the usage meter alike; the per-minute limits
|
|
4845
|
+
* keep counting CALLS.
|
|
4846
|
+
*/ export const API_BILLING_UNIT_BYTES = 256 * 1024;
|
|
4847
|
+
/**
|
|
4848
|
+
* How many billed units a request is (AGL-4227): one per started
|
|
4849
|
+
* `API_BILLING_UNIT_BYTES` of the larger of its request and response body,
|
|
4850
|
+
* and never fewer than one. A size that is not a finite, non-negative number
|
|
4851
|
+
* reads as 0, so it can only ever charge the one unit every call is.
|
|
4852
|
+
*/ export function apiRequestBillingUnits(requestBytes, responseBytes) {
|
|
4853
|
+
const size = (value)=>Number.isFinite(value) && value > 0 ? value : 0;
|
|
4854
|
+
const larger = Math.max(size(requestBytes), size(responseBytes));
|
|
4855
|
+
return Math.max(1, Math.ceil(larger / API_BILLING_UNIT_BYTES));
|
|
4856
|
+
}
|
|
4565
4857
|
|
|
4566
4858
|
//# sourceMappingURL=plan-entitlements.js.map
|