@drawbridge/drawbridge-utils 0.0.134 → 0.0.136
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/connections/index.cjs +230 -106
- package/dist/connections/index.d.cts +167 -17
- package/dist/connections/index.d.ts +167 -17
- package/dist/connections/index.js +230 -106
- package/dist/connections/oauth.cjs +8 -2
- package/dist/connections/oauth.d.cts +14 -3
- package/dist/connections/oauth.d.ts +14 -3
- package/dist/connections/oauth.js +8 -2
- package/dist/pricing.cjs +727 -695
- package/dist/pricing.d.cts +53 -5
- package/dist/pricing.d.ts +53 -5
- package/dist/pricing.js +726 -695
- package/dist/providers.cjs +230 -106
- package/dist/providers.d.cts +4 -4
- package/dist/providers.d.ts +4 -4
- package/dist/providers.js +230 -106
- package/dist/twilio.cjs +51 -0
- package/dist/twilio.d.cts +67 -0
- package/dist/twilio.d.ts +67 -0
- package/dist/twilio.js +51 -0
- package/package.json +2 -2
package/dist/pricing.d.cts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import { MARKUP } from './billing.cjs';
|
|
2
|
+
export { LOCAL_FLAT_CENTS, PREMIUM_CPM_CENTS, PREMIUM_RATE_PER_GB, REUSE_FLAT_CENTS, STANDARD_CPM_CENTS, STANDARD_RATE_PER_GB, ai, scrape } from './billing.cjs';
|
|
1
3
|
export { conversionRate, free, plans, resolvePlan, unitAmountDecimal } from './plans.cjs';
|
|
2
|
-
|
|
4
|
+
import './transactions.cjs';
|
|
5
|
+
import '@drawbridge/drawbridge-telemetry';
|
|
6
|
+
import './usage.cjs';
|
|
3
7
|
import './features.cjs';
|
|
4
8
|
import './index.cjs';
|
|
5
9
|
import 'currency-codes';
|
|
6
10
|
import 'nanoid';
|
|
7
11
|
import './color.cjs';
|
|
8
12
|
import 'tinycolor2';
|
|
9
|
-
import './usage.cjs';
|
|
10
|
-
import './transactions.cjs';
|
|
11
|
-
import '@drawbridge/drawbridge-telemetry';
|
|
12
13
|
|
|
13
14
|
// Pricing — the one file you open to see every customer-facing number.
|
|
14
15
|
//
|
|
@@ -168,6 +169,34 @@ const sending = {
|
|
|
168
169
|
plan : emailPlan,
|
|
169
170
|
plans : emailPlans,
|
|
170
171
|
title : emailPlans[ emailPlan ].title
|
|
172
|
+
},
|
|
173
|
+
|
|
174
|
+
// What one outbound SMS SEGMENT costs us, against what channels.sms below
|
|
175
|
+
// sells it for. Here for the same reason the email figures are: this file is
|
|
176
|
+
// where a rate is found without knowing whose module owns it — and its
|
|
177
|
+
// absence is why "does an SMS action cover its cost" could not be answered
|
|
178
|
+
// from this repo at all.
|
|
179
|
+
//
|
|
180
|
+
// US toll-free outbound, read from Twilio's SMS pricing page 2026-09-03
|
|
181
|
+
// (https://www.twilio.com/en-us/sms/pricing/us): $0.0083 per segment, plus a
|
|
182
|
+
// carrier fee that varies by the DESTINATION carrier — $0.0035 AT&T, $0.0045
|
|
183
|
+
// T-Mobile / Verizon / US Cellular, $0.004 everywhere else. CENTS per
|
|
184
|
+
// segment, like every other rate in this file.
|
|
185
|
+
//
|
|
186
|
+
// WORST CASE, deliberately. A price floor computed from the average is a
|
|
187
|
+
// floor that half of real traffic sits underneath.
|
|
188
|
+
//
|
|
189
|
+
// A segment is 153 GSM-7 characters once a message spans more than one — or
|
|
190
|
+
// 67 if the body contains a single emoji or curly quote, which flips the
|
|
191
|
+
// whole message to UCS-2. Twilio reports the count as `num_segments` on the
|
|
192
|
+
// Message resource, which is what the send bills on.
|
|
193
|
+
sms : {
|
|
194
|
+
baseCents : 0.83,
|
|
195
|
+
// The dearest carrier fee, not the mean: see WORST CASE above.
|
|
196
|
+
carrierCents : 0.45,
|
|
197
|
+
// Stated, not summed — 0.83 + 0.45 is 1.2800000000000002 in binary
|
|
198
|
+
// floating point, and this number is compared against money.
|
|
199
|
+
segmentCostCents : 1.28
|
|
171
200
|
}
|
|
172
201
|
};
|
|
173
202
|
|
|
@@ -187,6 +216,25 @@ const channels = {
|
|
|
187
216
|
}
|
|
188
217
|
};
|
|
189
218
|
|
|
219
|
+
// The lowest CENTS-per-action rate a plan may charge. Custom plans are
|
|
220
|
+
// hand-entered, and the guard on them only ever rejected a MISSING rate — zero
|
|
221
|
+
// is finite, passed every check, and billed nothing.
|
|
222
|
+
//
|
|
223
|
+
// DERIVED, so it moves when the thing it protects moves. SMS is the binding
|
|
224
|
+
// channel by a wide margin: two actions must cover one segment, so the
|
|
225
|
+
// break-even is segmentCostCents / actionsPerSegment = 0.64¢ per action. Email
|
|
226
|
+
// breaks even at 0.133¢ and never binds.
|
|
227
|
+
//
|
|
228
|
+
// MARKUP is the family's existing margin multiplier (billing.js, 30%) rather
|
|
229
|
+
// than a second number invented here — we do not sell an action at cost any
|
|
230
|
+
// more than we sell a scrape at cost.
|
|
231
|
+
//
|
|
232
|
+
// For scale: the cheapest catalog rate is Elite at 1.5¢, comfortably clear. A
|
|
233
|
+
// negotiated deal can still go well below the catalog; it cannot go below cost.
|
|
234
|
+
const MINIMUM_ACTION_CENTS = Math.round(
|
|
235
|
+
( sending.sms.segmentCostCents / channels.sms.actionsPerSegment ) * MARKUP * 1000
|
|
236
|
+
) / 1000;
|
|
237
|
+
|
|
190
238
|
// The dedicated SMS number — a RECURRING SUBSCRIPTION ITEM, not an action:
|
|
191
239
|
// the carrier bills for holding the number whether or not it sends, so it
|
|
192
240
|
// joins the organization's subscription as its own line and leaves when the
|
|
@@ -203,4 +251,4 @@ const numbers = {
|
|
|
203
251
|
}
|
|
204
252
|
};
|
|
205
253
|
|
|
206
|
-
export { channels, numbers, sending };
|
|
254
|
+
export { MARKUP, MINIMUM_ACTION_CENTS, channels, numbers, sending };
|
package/dist/pricing.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import { MARKUP } from './billing.js';
|
|
2
|
+
export { LOCAL_FLAT_CENTS, PREMIUM_CPM_CENTS, PREMIUM_RATE_PER_GB, REUSE_FLAT_CENTS, STANDARD_CPM_CENTS, STANDARD_RATE_PER_GB, ai, scrape } from './billing.js';
|
|
1
3
|
export { conversionRate, free, plans, resolvePlan, unitAmountDecimal } from './plans.js';
|
|
2
|
-
|
|
4
|
+
import './transactions.js';
|
|
5
|
+
import '@drawbridge/drawbridge-telemetry';
|
|
6
|
+
import './usage.js';
|
|
3
7
|
import './features.js';
|
|
4
8
|
import './index.js';
|
|
5
9
|
import 'currency-codes';
|
|
6
10
|
import 'nanoid';
|
|
7
11
|
import './color.js';
|
|
8
12
|
import 'tinycolor2';
|
|
9
|
-
import './usage.js';
|
|
10
|
-
import './transactions.js';
|
|
11
|
-
import '@drawbridge/drawbridge-telemetry';
|
|
12
13
|
|
|
13
14
|
// Pricing — the one file you open to see every customer-facing number.
|
|
14
15
|
//
|
|
@@ -168,6 +169,34 @@ const sending = {
|
|
|
168
169
|
plan : emailPlan,
|
|
169
170
|
plans : emailPlans,
|
|
170
171
|
title : emailPlans[ emailPlan ].title
|
|
172
|
+
},
|
|
173
|
+
|
|
174
|
+
// What one outbound SMS SEGMENT costs us, against what channels.sms below
|
|
175
|
+
// sells it for. Here for the same reason the email figures are: this file is
|
|
176
|
+
// where a rate is found without knowing whose module owns it — and its
|
|
177
|
+
// absence is why "does an SMS action cover its cost" could not be answered
|
|
178
|
+
// from this repo at all.
|
|
179
|
+
//
|
|
180
|
+
// US toll-free outbound, read from Twilio's SMS pricing page 2026-09-03
|
|
181
|
+
// (https://www.twilio.com/en-us/sms/pricing/us): $0.0083 per segment, plus a
|
|
182
|
+
// carrier fee that varies by the DESTINATION carrier — $0.0035 AT&T, $0.0045
|
|
183
|
+
// T-Mobile / Verizon / US Cellular, $0.004 everywhere else. CENTS per
|
|
184
|
+
// segment, like every other rate in this file.
|
|
185
|
+
//
|
|
186
|
+
// WORST CASE, deliberately. A price floor computed from the average is a
|
|
187
|
+
// floor that half of real traffic sits underneath.
|
|
188
|
+
//
|
|
189
|
+
// A segment is 153 GSM-7 characters once a message spans more than one — or
|
|
190
|
+
// 67 if the body contains a single emoji or curly quote, which flips the
|
|
191
|
+
// whole message to UCS-2. Twilio reports the count as `num_segments` on the
|
|
192
|
+
// Message resource, which is what the send bills on.
|
|
193
|
+
sms : {
|
|
194
|
+
baseCents : 0.83,
|
|
195
|
+
// The dearest carrier fee, not the mean: see WORST CASE above.
|
|
196
|
+
carrierCents : 0.45,
|
|
197
|
+
// Stated, not summed — 0.83 + 0.45 is 1.2800000000000002 in binary
|
|
198
|
+
// floating point, and this number is compared against money.
|
|
199
|
+
segmentCostCents : 1.28
|
|
171
200
|
}
|
|
172
201
|
};
|
|
173
202
|
|
|
@@ -187,6 +216,25 @@ const channels = {
|
|
|
187
216
|
}
|
|
188
217
|
};
|
|
189
218
|
|
|
219
|
+
// The lowest CENTS-per-action rate a plan may charge. Custom plans are
|
|
220
|
+
// hand-entered, and the guard on them only ever rejected a MISSING rate — zero
|
|
221
|
+
// is finite, passed every check, and billed nothing.
|
|
222
|
+
//
|
|
223
|
+
// DERIVED, so it moves when the thing it protects moves. SMS is the binding
|
|
224
|
+
// channel by a wide margin: two actions must cover one segment, so the
|
|
225
|
+
// break-even is segmentCostCents / actionsPerSegment = 0.64¢ per action. Email
|
|
226
|
+
// breaks even at 0.133¢ and never binds.
|
|
227
|
+
//
|
|
228
|
+
// MARKUP is the family's existing margin multiplier (billing.js, 30%) rather
|
|
229
|
+
// than a second number invented here — we do not sell an action at cost any
|
|
230
|
+
// more than we sell a scrape at cost.
|
|
231
|
+
//
|
|
232
|
+
// For scale: the cheapest catalog rate is Elite at 1.5¢, comfortably clear. A
|
|
233
|
+
// negotiated deal can still go well below the catalog; it cannot go below cost.
|
|
234
|
+
const MINIMUM_ACTION_CENTS = Math.round(
|
|
235
|
+
( sending.sms.segmentCostCents / channels.sms.actionsPerSegment ) * MARKUP * 1000
|
|
236
|
+
) / 1000;
|
|
237
|
+
|
|
190
238
|
// The dedicated SMS number — a RECURRING SUBSCRIPTION ITEM, not an action:
|
|
191
239
|
// the carrier bills for holding the number whether or not it sends, so it
|
|
192
240
|
// joins the organization's subscription as its own line and leaves when the
|
|
@@ -203,4 +251,4 @@ const numbers = {
|
|
|
203
251
|
}
|
|
204
252
|
};
|
|
205
253
|
|
|
206
|
-
export { channels, numbers, sending };
|
|
254
|
+
export { MARKUP, MINIMUM_ACTION_CENTS, channels, numbers, sending };
|