paddle-checkout-accelerator 2.1.0 → 2.2.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.
Files changed (81) hide show
  1. package/bin/paddle-checkout-accelerator.js +247 -0
  2. package/dist/index.cjs +1150 -0
  3. package/dist/index.d.cts +290 -0
  4. package/dist/index.d.ts +290 -0
  5. package/dist/index.js +1079 -0
  6. package/package.json +14 -7
  7. package/recipes/nextjs/app/billing.ts +1 -1
  8. package/dist/package/index.d.ts +0 -28
  9. package/dist/package/index.js +0 -28
  10. package/dist/src/components/paddle/BillingHistory.d.ts +0 -1
  11. package/dist/src/components/paddle/BillingHistory.js +0 -17
  12. package/dist/src/components/paddle/CustomerPortal.d.ts +0 -1
  13. package/dist/src/components/paddle/CustomerPortal.js +0 -5
  14. package/dist/src/components/paddle/CustomerPortalButton.d.ts +0 -1
  15. package/dist/src/components/paddle/CustomerPortalButton.js +0 -31
  16. package/dist/src/components/paddle/InlineCheckout.d.ts +0 -5
  17. package/dist/src/components/paddle/InlineCheckout.js +0 -13
  18. package/dist/src/components/paddle/PricingTable.d.ts +0 -1
  19. package/dist/src/components/paddle/PricingTable.js +0 -27
  20. package/dist/src/components/paddle/SubscriptionCard.d.ts +0 -6
  21. package/dist/src/components/paddle/SubscriptionCard.js +0 -5
  22. package/dist/src/components/paddle/TrialBanner.d.ts +0 -5
  23. package/dist/src/components/paddle/TrialBanner.js +0 -5
  24. package/dist/src/components/paddle/UpgradeModal.d.ts +0 -11
  25. package/dist/src/components/paddle/UpgradeModal.js +0 -35
  26. package/dist/src/components/paddle/UsageMeter.d.ts +0 -6
  27. package/dist/src/components/paddle/UsageMeter.js +0 -8
  28. package/dist/src/components/paddle/gates/SubscriptionGate.d.ts +0 -7
  29. package/dist/src/components/paddle/gates/SubscriptionGate.js +0 -8
  30. package/dist/src/lib/billing/adapters/index.d.ts +0 -3
  31. package/dist/src/lib/billing/adapters/index.js +0 -3
  32. package/dist/src/lib/billing/adapters/memory.d.ts +0 -2
  33. package/dist/src/lib/billing/adapters/memory.js +0 -41
  34. package/dist/src/lib/billing/adapters/prisma/index.d.ts +0 -28
  35. package/dist/src/lib/billing/adapters/prisma/index.js +0 -80
  36. package/dist/src/lib/billing/adapters/types.d.ts +0 -13
  37. package/dist/src/lib/billing/adapters/types.js +0 -1
  38. package/dist/src/lib/billing/configure.d.ts +0 -6
  39. package/dist/src/lib/billing/configure.js +0 -13
  40. package/dist/src/lib/billing/customer-repair.d.ts +0 -4
  41. package/dist/src/lib/billing/customer-repair.js +0 -19
  42. package/dist/src/lib/billing/demo-seed.d.ts +0 -1
  43. package/dist/src/lib/billing/demo-seed.js +0 -13
  44. package/dist/src/lib/billing/entitlements.d.ts +0 -3
  45. package/dist/src/lib/billing/entitlements.js +0 -16
  46. package/dist/src/lib/billing/events.d.ts +0 -12
  47. package/dist/src/lib/billing/events.js +0 -20
  48. package/dist/src/lib/billing/plans.d.ts +0 -9
  49. package/dist/src/lib/billing/plans.js +0 -41
  50. package/dist/src/lib/billing/protection.d.ts +0 -6
  51. package/dist/src/lib/billing/protection.js +0 -16
  52. package/dist/src/lib/billing/refresh.d.ts +0 -1
  53. package/dist/src/lib/billing/refresh.js +0 -32
  54. package/dist/src/lib/billing/subscriptions.d.ts +0 -16
  55. package/dist/src/lib/billing/subscriptions.js +0 -36
  56. package/dist/src/lib/billing/teams.d.ts +0 -42
  57. package/dist/src/lib/billing/teams.js +0 -104
  58. package/dist/src/lib/billing/usage.d.ts +0 -17
  59. package/dist/src/lib/billing/usage.js +0 -40
  60. package/dist/src/lib/billing/webhook-sync.d.ts +0 -26
  61. package/dist/src/lib/billing/webhook-sync.js +0 -39
  62. package/dist/src/lib/paddle/api.d.ts +0 -1
  63. package/dist/src/lib/paddle/api.js +0 -21
  64. package/dist/src/lib/paddle/client.d.ts +0 -1
  65. package/dist/src/lib/paddle/client.js +0 -13
  66. package/dist/src/lib/paddle/customers.d.ts +0 -15
  67. package/dist/src/lib/paddle/customers.js +0 -14
  68. package/dist/src/lib/paddle/events.d.ts +0 -10
  69. package/dist/src/lib/paddle/events.js +0 -11
  70. package/dist/src/lib/paddle/hooks.d.ts +0 -4
  71. package/dist/src/lib/paddle/hooks.js +0 -11
  72. package/dist/src/lib/paddle/portal.d.ts +0 -8
  73. package/dist/src/lib/paddle/portal.js +0 -28
  74. package/dist/src/lib/paddle/subscriptions.d.ts +0 -20
  75. package/dist/src/lib/paddle/subscriptions.js +0 -10
  76. package/dist/src/lib/paddle/types.d.ts +0 -8
  77. package/dist/src/lib/paddle/types.js +0 -1
  78. package/dist/src/lib/paddle/webhook.d.ts +0 -1
  79. package/dist/src/lib/paddle/webhook.js +0 -8
  80. package/dist/src/lib/utils.d.ts +0 -2
  81. package/dist/src/lib/utils.js +0 -5
package/dist/index.cjs ADDED
@@ -0,0 +1,1150 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
+ var __spreadValues = (a, b) => {
12
+ for (var prop in b || (b = {}))
13
+ if (__hasOwnProp.call(b, prop))
14
+ __defNormalProp(a, prop, b[prop]);
15
+ if (__getOwnPropSymbols)
16
+ for (var prop of __getOwnPropSymbols(b)) {
17
+ if (__propIsEnum.call(b, prop))
18
+ __defNormalProp(a, prop, b[prop]);
19
+ }
20
+ return a;
21
+ };
22
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
23
+ var __export = (target, all) => {
24
+ for (var name in all)
25
+ __defProp(target, name, { get: all[name], enumerable: true });
26
+ };
27
+ var __copyProps = (to, from, except, desc) => {
28
+ if (from && typeof from === "object" || typeof from === "function") {
29
+ for (let key of __getOwnPropNames(from))
30
+ if (!__hasOwnProp.call(to, key) && key !== except)
31
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
32
+ }
33
+ return to;
34
+ };
35
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
36
+
37
+ // package/index.ts
38
+ var index_exports = {};
39
+ __export(index_exports, {
40
+ BillingHistory: () => BillingHistory,
41
+ CustomerPortalButton: () => CustomerPortalButton,
42
+ SubscriptionCard: () => SubscriptionCard,
43
+ SubscriptionGate: () => SubscriptionGate,
44
+ TrialBanner: () => TrialBanner,
45
+ UpgradeModal: () => UpgradeModal,
46
+ UsageMeter: () => UsageMeter,
47
+ addTeamMember: () => addTeamMember,
48
+ canInviteTeamMember: () => canInviteTeamMember,
49
+ canUse: () => canUse,
50
+ configureBilling: () => configureBilling,
51
+ createCustomerPortalSession: () => createCustomerPortalSession,
52
+ createPrismaBillingAdapter: () => createPrismaBillingAdapter,
53
+ createTeam: () => createTeam,
54
+ fetchPaddleCustomer: () => fetchPaddleCustomer,
55
+ fetchPaddleSubscription: () => fetchPaddleSubscription,
56
+ fetchPaddleSubscriptionsForCustomer: () => fetchPaddleSubscriptionsForCustomer,
57
+ findFirstPaddleCustomerByEmail: () => findFirstPaddleCustomerByEmail,
58
+ findPaddleCustomersByEmail: () => findPaddleCustomersByEmail,
59
+ getBillingEvents: () => getBillingEvents,
60
+ getPaddle: () => getPaddle,
61
+ getPlanSeatLimit: () => getPlanSeatLimit,
62
+ getSeatUsage: () => getSeatUsage,
63
+ getSubscription: () => getSubscription,
64
+ getTeam: () => getTeam,
65
+ getUsage: () => getUsage,
66
+ getUsageLimit: () => getUsageLimit,
67
+ hasFeature: () => hasFeature,
68
+ incrementUsage: () => incrementUsage,
69
+ isSubscriptionActive: () => isSubscriptionActive,
70
+ memoryBillingAdapter: () => memoryBillingAdapter,
71
+ openCheckout: () => openCheckout,
72
+ paddleApi: () => paddleApi,
73
+ plans: () => plans,
74
+ protectFeature: () => protectFeature,
75
+ protectPlan: () => protectPlan,
76
+ protectUsage: () => protectUsage,
77
+ recordBillingEvent: () => recordBillingEvent,
78
+ refreshSubscriptionFromPaddle: () => refreshSubscriptionFromPaddle,
79
+ removeTeamMember: () => removeTeamMember,
80
+ repairSubscriptionByEmail: () => repairSubscriptionByEmail,
81
+ requireFeature: () => requireFeature,
82
+ requireSubscription: () => requireSubscription,
83
+ requireUsage: () => requireUsage,
84
+ seedDemoBilling: () => seedDemoBilling,
85
+ setBillingAdapter: () => setBillingAdapter,
86
+ setBillingEventAdapter: () => setBillingEventAdapter,
87
+ setTeamAdapter: () => setTeamAdapter,
88
+ setUsageAdapter: () => setUsageAdapter,
89
+ syncPaddleEvent: () => syncPaddleEvent,
90
+ updateTeamPlan: () => updateTeamPlan,
91
+ upsertSubscription: () => upsertSubscription,
92
+ verifyPaddleWebhook: () => verifyPaddleWebhook
93
+ });
94
+ module.exports = __toCommonJS(index_exports);
95
+
96
+ // src/components/paddle/UpgradeModal.tsx
97
+ var import_react = require("react");
98
+ var import_lucide_react = require("lucide-react");
99
+
100
+ // src/lib/paddle/client.ts
101
+ var import_paddle_js = require("@paddle/paddle-js");
102
+ var paddleInstance = null;
103
+ async function getPaddle() {
104
+ if (paddleInstance) {
105
+ return paddleInstance;
106
+ }
107
+ paddleInstance = await (0, import_paddle_js.initializePaddle)({
108
+ token: process.env.NEXT_PUBLIC_PADDLE_CLIENT_TOKEN
109
+ });
110
+ return paddleInstance;
111
+ }
112
+
113
+ // src/lib/paddle/hooks.ts
114
+ async function openCheckout(items) {
115
+ const paddle = await getPaddle();
116
+ if (!paddle) {
117
+ throw new Error(
118
+ "Paddle failed to initialize"
119
+ );
120
+ }
121
+ paddle.Checkout.open({
122
+ items
123
+ });
124
+ }
125
+
126
+ // src/components/paddle/UpgradeModal.tsx
127
+ var import_jsx_runtime = require("react/jsx-runtime");
128
+ function UpgradeModal({
129
+ open,
130
+ onClose,
131
+ currentPlan,
132
+ targetPlan,
133
+ targetPriceId,
134
+ yearlySavings,
135
+ onUpgradeSuccess
136
+ }) {
137
+ const [loading, setLoading] = (0, import_react.useState)(false);
138
+ const [error, setError] = (0, import_react.useState)(null);
139
+ if (!open) return null;
140
+ async function handleUpgrade() {
141
+ try {
142
+ setLoading(true);
143
+ setError(null);
144
+ await openCheckout([
145
+ {
146
+ priceId: targetPriceId,
147
+ quantity: 1
148
+ }
149
+ ]);
150
+ onUpgradeSuccess == null ? void 0 : onUpgradeSuccess({
151
+ targetPlan
152
+ });
153
+ } catch (err) {
154
+ setError(
155
+ err instanceof Error ? err.message : "Unable to launch checkout"
156
+ );
157
+ } finally {
158
+ setLoading(false);
159
+ }
160
+ }
161
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "w-full max-w-lg rounded-3xl border bg-white shadow-2xl", children: [
162
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center justify-between border-b p-6", children: [
163
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
164
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: "text-xl font-semibold", children: "Upgrade Plan" }),
165
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "mt-1 text-sm text-slate-500", children: "Unlock additional features" })
166
+ ] }),
167
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
168
+ "button",
169
+ {
170
+ onClick: onClose,
171
+ className: "rounded-lg p-2 hover:bg-slate-100",
172
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.X, { size: 18 })
173
+ }
174
+ )
175
+ ] }),
176
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "p-6", children: [
177
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "rounded-2xl border p-5", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center justify-between", children: [
178
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
179
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-sm text-slate-500", children: "Current" }),
180
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "mt-1 font-semibold", children: currentPlan })
181
+ ] }),
182
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
183
+ import_lucide_react.ArrowRight,
184
+ {
185
+ className: "text-slate-400",
186
+ size: 20
187
+ }
188
+ ),
189
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "text-right", children: [
190
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-sm text-slate-500", children: "Upgrade To" }),
191
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "mt-1 font-semibold", children: targetPlan })
192
+ ] })
193
+ ] }) }),
194
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "mt-6 rounded-2xl bg-slate-50 p-5", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("ul", { className: "space-y-3", children: [
195
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { className: "flex items-center gap-3", children: [
196
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Check, { size: 16 }),
197
+ "Unlimited projects"
198
+ ] }),
199
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { className: "flex items-center gap-3", children: [
200
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Check, { size: 16 }),
201
+ "Advanced billing"
202
+ ] }),
203
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { className: "flex items-center gap-3", children: [
204
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Check, { size: 16 }),
205
+ "Priority support"
206
+ ] }),
207
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { className: "flex items-center gap-3", children: [
208
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Check, { size: 16 }),
209
+ "Team access"
210
+ ] })
211
+ ] }) }),
212
+ yearlySavings && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "mt-4 rounded-xl border border-emerald-200 bg-emerald-50 p-3 text-sm", children: [
213
+ "Save ",
214
+ yearlySavings
215
+ ] }),
216
+ error && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "mt-4 rounded-xl border border-red-200 bg-red-50 p-3 text-sm text-red-700", children: error }),
217
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
218
+ "button",
219
+ {
220
+ onClick: handleUpgrade,
221
+ disabled: loading,
222
+ className: "mt-6 flex w-full items-center justify-center gap-2 rounded-2xl bg-black px-5 py-4 text-white transition hover:opacity-90 disabled:opacity-50",
223
+ children: loading ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
224
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
225
+ import_lucide_react.Loader2,
226
+ {
227
+ size: 18,
228
+ className: "animate-spin"
229
+ }
230
+ ),
231
+ "Launching Checkout..."
232
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
233
+ "Upgrade Now",
234
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ArrowRight, { size: 18 })
235
+ ] })
236
+ }
237
+ )
238
+ ] })
239
+ ] }) });
240
+ }
241
+
242
+ // src/components/paddle/UsageMeter.tsx
243
+ var import_jsx_runtime2 = require("react/jsx-runtime");
244
+ function UsageMeter({
245
+ current,
246
+ limit
247
+ }) {
248
+ const percentage = Math.min(
249
+ 100,
250
+ current / limit * 100
251
+ );
252
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "rounded-xl border p-5", children: [
253
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex justify-between", children: [
254
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "Usage" }),
255
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { children: [
256
+ current,
257
+ "/",
258
+ limit
259
+ ] })
260
+ ] }),
261
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "mt-3 h-3 rounded-full bg-gray-100", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
262
+ "div",
263
+ {
264
+ className: "h-3 rounded-full bg-black",
265
+ style: {
266
+ width: `${percentage}%`
267
+ }
268
+ }
269
+ ) })
270
+ ] });
271
+ }
272
+
273
+ // src/components/paddle/TrialBanner.tsx
274
+ var import_jsx_runtime3 = require("react/jsx-runtime");
275
+ function TrialBanner({
276
+ daysRemaining
277
+ }) {
278
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "rounded-xl border border-yellow-300 bg-yellow-50 p-4", children: [
279
+ "Trial expires in",
280
+ " ",
281
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("strong", { children: [
282
+ daysRemaining,
283
+ " days"
284
+ ] }),
285
+ "."
286
+ ] });
287
+ }
288
+
289
+ // src/components/paddle/BillingHistory.tsx
290
+ var import_jsx_runtime4 = require("react/jsx-runtime");
291
+ var invoices = [
292
+ {
293
+ id: "INV-001",
294
+ amount: "$79",
295
+ status: "Paid"
296
+ },
297
+ {
298
+ id: "INV-002",
299
+ amount: "$79",
300
+ status: "Paid"
301
+ }
302
+ ];
303
+ function BillingHistory() {
304
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "rounded-xl border", children: invoices.map((invoice) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
305
+ "div",
306
+ {
307
+ className: "flex justify-between border-b p-4",
308
+ children: [
309
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { children: invoice.id }),
310
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { children: invoice.amount }),
311
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { children: invoice.status })
312
+ ]
313
+ },
314
+ invoice.id
315
+ )) });
316
+ }
317
+
318
+ // src/components/paddle/CustomerPortalButton.tsx
319
+ var import_react2 = require("react");
320
+ var import_jsx_runtime5 = require("react/jsx-runtime");
321
+ function CustomerPortalButton() {
322
+ const [loading, setLoading] = (0, import_react2.useState)(false);
323
+ const [error, setError] = (0, import_react2.useState)(null);
324
+ async function launchPortal() {
325
+ var _a2;
326
+ try {
327
+ setLoading(true);
328
+ setError(null);
329
+ const response = await fetch(
330
+ "/api/paddle/portal-session",
331
+ { method: "POST" }
332
+ );
333
+ const data = await response.json();
334
+ if (!response.ok || !data.success || !data.url) {
335
+ throw new Error(
336
+ (_a2 = data.error) != null ? _a2 : "Unable to open billing portal"
337
+ );
338
+ }
339
+ window.location.href = data.url;
340
+ } catch (err) {
341
+ setError(
342
+ err instanceof Error ? err.message : "Unable to open billing portal"
343
+ );
344
+ } finally {
345
+ setLoading(false);
346
+ }
347
+ }
348
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "space-y-3", children: [
349
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
350
+ "button",
351
+ {
352
+ onClick: launchPortal,
353
+ disabled: loading,
354
+ className: "rounded-xl bg-black px-4 py-3 text-white disabled:opacity-60",
355
+ children: loading ? "Opening Billing..." : "Manage Billing"
356
+ }
357
+ ),
358
+ error && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "rounded-xl border border-red-200 bg-red-50 p-3 text-sm text-red-700", children: error })
359
+ ] });
360
+ }
361
+
362
+ // src/components/paddle/SubscriptionCard.tsx
363
+ var import_jsx_runtime6 = require("react/jsx-runtime");
364
+ function SubscriptionCard({
365
+ plan,
366
+ status
367
+ }) {
368
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "rounded-2xl border p-6", children: [
369
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "text-sm text-gray-500", children: "Current Plan" }),
370
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mt-2 text-3xl font-bold", children: plan }),
371
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mt-4", children: [
372
+ "Status: ",
373
+ status
374
+ ] })
375
+ ] });
376
+ }
377
+
378
+ // src/components/paddle/gates/SubscriptionGate.tsx
379
+ var import_jsx_runtime7 = require("react/jsx-runtime");
380
+ function SubscriptionGate({
381
+ active,
382
+ children,
383
+ fallback
384
+ }) {
385
+ if (!active) {
386
+ return fallback != null ? fallback : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "rounded-xl border p-6", children: "Upgrade required." });
387
+ }
388
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children });
389
+ }
390
+
391
+ // src/lib/paddle/webhook.ts
392
+ var import_svix = require("svix");
393
+ async function verifyPaddleWebhook(rawBody, signature) {
394
+ const secret = process.env.PADDLE_WEBHOOK_SECRET;
395
+ const wh = new import_svix.Webhook(secret);
396
+ return wh.verify(rawBody, {
397
+ "paddle-signature": signature
398
+ });
399
+ }
400
+
401
+ // src/lib/billing/plans.ts
402
+ var plans = {
403
+ free: {
404
+ name: "Free",
405
+ monthlyLimit: 25,
406
+ seatLimit: 1,
407
+ features: ["checkout"]
408
+ },
409
+ starter: {
410
+ name: "Starter",
411
+ monthlyLimit: 500,
412
+ seatLimit: 1,
413
+ features: ["checkout", "customer_portal"]
414
+ },
415
+ pro: {
416
+ name: "Pro",
417
+ monthlyLimit: 5e3,
418
+ seatLimit: 5,
419
+ features: [
420
+ "checkout",
421
+ "customer_portal",
422
+ "usage_limits",
423
+ "api_access"
424
+ ]
425
+ },
426
+ business: {
427
+ name: "Business",
428
+ monthlyLimit: 5e4,
429
+ seatLimit: 25,
430
+ features: [
431
+ "checkout",
432
+ "customer_portal",
433
+ "usage_limits",
434
+ "team_members",
435
+ "api_access",
436
+ "priority_support"
437
+ ]
438
+ }
439
+ };
440
+ function getPlanSeatLimit(plan) {
441
+ return plans[plan].seatLimit;
442
+ }
443
+
444
+ // src/lib/billing/adapters/memory.ts
445
+ var subscriptions = /* @__PURE__ */ new Map();
446
+ var usage = /* @__PURE__ */ new Map();
447
+ var teams = /* @__PURE__ */ new Map();
448
+ var billingEvents = /* @__PURE__ */ new Map();
449
+ function usageKey(userId, key, period) {
450
+ return `${userId}:${key}:${period}`;
451
+ }
452
+ var memoryBillingAdapter = {
453
+ async getSubscription(userId) {
454
+ var _a2;
455
+ return (_a2 = subscriptions.get(userId)) != null ? _a2 : null;
456
+ },
457
+ async upsertSubscription(record) {
458
+ subscriptions.set(
459
+ record.userId,
460
+ record
461
+ );
462
+ return record;
463
+ },
464
+ async getUsage(userId, key, period) {
465
+ var _a2;
466
+ return (_a2 = usage.get(
467
+ usageKey(userId, key, period)
468
+ )) != null ? _a2 : 0;
469
+ },
470
+ async incrementUsage(userId, key, period, amount) {
471
+ var _a2;
472
+ const id = usageKey(userId, key, period);
473
+ const next = ((_a2 = usage.get(id)) != null ? _a2 : 0) + amount;
474
+ usage.set(id, next);
475
+ return next;
476
+ },
477
+ async getTeam(teamId) {
478
+ var _a2;
479
+ return (_a2 = teams.get(teamId)) != null ? _a2 : null;
480
+ },
481
+ async upsertTeam(team) {
482
+ teams.set(
483
+ team.teamId,
484
+ team
485
+ );
486
+ return team;
487
+ },
488
+ async recordBillingEvent(event) {
489
+ var _a2;
490
+ const current = (_a2 = billingEvents.get(event.userId)) != null ? _a2 : [];
491
+ current.unshift(event);
492
+ billingEvents.set(
493
+ event.userId,
494
+ current
495
+ );
496
+ return event;
497
+ },
498
+ async getBillingEvents(userId) {
499
+ var _a2;
500
+ return (_a2 = billingEvents.get(userId)) != null ? _a2 : [];
501
+ }
502
+ };
503
+
504
+ // src/lib/billing/adapters/prisma/index.ts
505
+ function createPrismaBillingAdapter(prisma) {
506
+ return {
507
+ async getSubscription(userId) {
508
+ return prisma.subscription.findUnique({
509
+ where: { userId }
510
+ });
511
+ },
512
+ async upsertSubscription(record) {
513
+ return prisma.subscription.upsert({
514
+ where: {
515
+ userId: record.userId
516
+ },
517
+ create: record,
518
+ update: record
519
+ });
520
+ },
521
+ async getUsage(userId, key, period) {
522
+ var _a2;
523
+ const usage2 = await prisma.usageEvent.findUnique({
524
+ where: {
525
+ userId_key_period: {
526
+ userId,
527
+ key,
528
+ period
529
+ }
530
+ }
531
+ });
532
+ return (_a2 = usage2 == null ? void 0 : usage2.count) != null ? _a2 : 0;
533
+ },
534
+ async incrementUsage(userId, key, period, amount) {
535
+ const usage2 = await prisma.usageEvent.upsert({
536
+ where: {
537
+ userId_key_period: {
538
+ userId,
539
+ key,
540
+ period
541
+ }
542
+ },
543
+ create: {
544
+ userId,
545
+ key,
546
+ period,
547
+ count: amount
548
+ },
549
+ update: {
550
+ count: {
551
+ increment: amount
552
+ }
553
+ }
554
+ });
555
+ return usage2.count;
556
+ },
557
+ async getTeam(teamId) {
558
+ return prisma.team.findUnique({
559
+ where: { teamId }
560
+ });
561
+ },
562
+ async upsertTeam(team) {
563
+ return prisma.team.upsert({
564
+ where: {
565
+ teamId: team.teamId
566
+ },
567
+ create: team,
568
+ update: team
569
+ });
570
+ },
571
+ async recordBillingEvent(event) {
572
+ return prisma.billingEvent.create({
573
+ data: event
574
+ });
575
+ },
576
+ async getBillingEvents(userId) {
577
+ return prisma.billingEvent.findMany({
578
+ where: { userId },
579
+ orderBy: {
580
+ createdAt: "desc"
581
+ }
582
+ });
583
+ }
584
+ };
585
+ }
586
+
587
+ // src/lib/billing/subscriptions.ts
588
+ var adapter = memoryBillingAdapter;
589
+ function setBillingAdapter(nextAdapter) {
590
+ adapter = nextAdapter;
591
+ }
592
+ async function getSubscription(userId) {
593
+ var _a2;
594
+ return (_a2 = await adapter.getSubscription(
595
+ userId
596
+ )) != null ? _a2 : {
597
+ userId,
598
+ plan: "free",
599
+ status: "none"
600
+ };
601
+ }
602
+ async function upsertSubscription(record) {
603
+ return adapter.upsertSubscription(
604
+ record
605
+ );
606
+ }
607
+ function isSubscriptionActive(subscription) {
608
+ return subscription.status === "active" || subscription.status === "trialing";
609
+ }
610
+ async function requireSubscription(userId, minimumPlan = "starter") {
611
+ const subscription = await getSubscription(userId);
612
+ if (!isSubscriptionActive(subscription)) {
613
+ throw new Error(
614
+ "Active subscription required"
615
+ );
616
+ }
617
+ const order = [
618
+ "free",
619
+ "starter",
620
+ "pro",
621
+ "business"
622
+ ];
623
+ if (order.indexOf(subscription.plan) < order.indexOf(minimumPlan)) {
624
+ throw new Error(
625
+ `${minimumPlan} plan required`
626
+ );
627
+ }
628
+ return subscription;
629
+ }
630
+
631
+ // src/lib/billing/entitlements.ts
632
+ async function hasFeature(userId, feature) {
633
+ const subscription = await getSubscription(userId);
634
+ if (!isSubscriptionActive(subscription)) {
635
+ return false;
636
+ }
637
+ return plans[subscription.plan].features.includes(feature);
638
+ }
639
+ async function requireFeature(userId, feature) {
640
+ const allowed = await hasFeature(userId, feature);
641
+ if (!allowed) {
642
+ throw new Error(
643
+ `Feature not available: ${feature}`
644
+ );
645
+ }
646
+ return true;
647
+ }
648
+
649
+ // src/lib/billing/usage.ts
650
+ var adapter2 = memoryBillingAdapter;
651
+ function setUsageAdapter(nextAdapter) {
652
+ adapter2 = nextAdapter;
653
+ }
654
+ function currentPeriod() {
655
+ const now = /* @__PURE__ */ new Date();
656
+ return `${now.getUTCFullYear()}-${String(
657
+ now.getUTCMonth() + 1
658
+ ).padStart(2, "0")}`;
659
+ }
660
+ async function getUsage(userId, key) {
661
+ return adapter2.getUsage(
662
+ userId,
663
+ key,
664
+ currentPeriod()
665
+ );
666
+ }
667
+ async function getUsageLimit(userId) {
668
+ const subscription = await getSubscription(userId);
669
+ return plans[subscription.plan].monthlyLimit;
670
+ }
671
+ async function canUse(userId, key) {
672
+ const [used, limit] = await Promise.all([
673
+ getUsage(userId, key),
674
+ getUsageLimit(userId)
675
+ ]);
676
+ return {
677
+ allowed: used < limit,
678
+ used,
679
+ limit,
680
+ remaining: Math.max(
681
+ 0,
682
+ limit - used
683
+ )
684
+ };
685
+ }
686
+ async function incrementUsage(userId, key, amount = 1) {
687
+ return adapter2.incrementUsage(
688
+ userId,
689
+ key,
690
+ currentPeriod(),
691
+ amount
692
+ );
693
+ }
694
+ async function requireUsage(userId, key) {
695
+ const usage2 = await canUse(userId, key);
696
+ if (!usage2.allowed) {
697
+ throw new Error(
698
+ "Usage limit reached"
699
+ );
700
+ }
701
+ return usage2;
702
+ }
703
+
704
+ // src/lib/billing/webhook-sync.ts
705
+ async function syncPaddleEvent(event) {
706
+ var _a2, _b, _c, _d, _e;
707
+ const data = event.data;
708
+ const userId = (_a2 = data == null ? void 0 : data.custom_data) == null ? void 0 : _a2.userId;
709
+ if (!userId) {
710
+ return {
711
+ synced: false,
712
+ reason: "missing userId in custom_data"
713
+ };
714
+ }
715
+ const plan = (_c = (_b = data == null ? void 0 : data.custom_data) == null ? void 0 : _b.plan) != null ? _c : "starter";
716
+ if ((_d = event.event_type) == null ? void 0 : _d.startsWith(
717
+ "subscription."
718
+ )) {
719
+ await upsertSubscription({
720
+ userId,
721
+ plan,
722
+ status: (data == null ? void 0 : data.status) === "active" ? "active" : (data == null ? void 0 : data.status) === "trialing" ? "trialing" : (data == null ? void 0 : data.status) === "paused" ? "paused" : (data == null ? void 0 : data.status) === "canceled" ? "canceled" : "none",
723
+ paddleCustomerId: data == null ? void 0 : data.customer_id,
724
+ paddleSubscriptionId: data == null ? void 0 : data.id,
725
+ currentPeriodEnd: (_e = data == null ? void 0 : data.current_billing_period) == null ? void 0 : _e.ends_at
726
+ });
727
+ return {
728
+ synced: true,
729
+ type: "subscription"
730
+ };
731
+ }
732
+ return {
733
+ synced: false,
734
+ reason: "unhandled event type"
735
+ };
736
+ }
737
+
738
+ // src/lib/billing/protection.ts
739
+ async function protectPlan(userId, plan) {
740
+ return requireSubscription(
741
+ userId,
742
+ plan
743
+ );
744
+ }
745
+ async function protectFeature(userId, feature) {
746
+ return requireFeature(
747
+ userId,
748
+ feature
749
+ );
750
+ }
751
+ async function protectUsage(userId, usageKey2, amount = 1) {
752
+ await requireUsage(
753
+ userId,
754
+ usageKey2
755
+ );
756
+ await incrementUsage(
757
+ userId,
758
+ usageKey2,
759
+ amount
760
+ );
761
+ return {
762
+ allowed: true
763
+ };
764
+ }
765
+
766
+ // src/lib/billing/demo-seed.ts
767
+ var seeded = false;
768
+ async function seedDemoBilling() {
769
+ if (seeded) {
770
+ return;
771
+ }
772
+ await upsertSubscription({
773
+ userId: "demo-user-1",
774
+ plan: "pro",
775
+ status: "active"
776
+ });
777
+ seeded = true;
778
+ }
779
+
780
+ // src/lib/paddle/portal.ts
781
+ async function createCustomerPortalSession({
782
+ customerId,
783
+ returnUrl
784
+ }) {
785
+ var _a2, _b;
786
+ const apiKey = process.env.PADDLE_API_KEY;
787
+ if (!apiKey) {
788
+ throw new Error("Missing PADDLE_API_KEY");
789
+ }
790
+ const response = await fetch(
791
+ "https://api.paddle.com/customer-portal-sessions",
792
+ {
793
+ method: "POST",
794
+ headers: {
795
+ Authorization: `Bearer ${apiKey}`,
796
+ "Content-Type": "application/json"
797
+ },
798
+ body: JSON.stringify({
799
+ customer_id: customerId,
800
+ urls: returnUrl ? { return_url: returnUrl } : void 0
801
+ })
802
+ }
803
+ );
804
+ if (!response.ok) {
805
+ throw new Error(
806
+ "Failed to create Paddle customer portal session"
807
+ );
808
+ }
809
+ const data = await response.json();
810
+ const url = (_b = (_a2 = data.data) == null ? void 0 : _a2.urls) == null ? void 0 : _b.general;
811
+ if (!url) {
812
+ throw new Error(
813
+ "Paddle portal URL missing from response"
814
+ );
815
+ }
816
+ return { url };
817
+ }
818
+
819
+ // src/lib/paddle/api.ts
820
+ var _a;
821
+ var PADDLE_API_BASE = (_a = process.env.PADDLE_API_BASE) != null ? _a : "https://api.paddle.com";
822
+ async function paddleApi(path, options = {}) {
823
+ const apiKey = process.env.PADDLE_API_KEY;
824
+ if (!apiKey) {
825
+ throw new Error("Missing PADDLE_API_KEY");
826
+ }
827
+ const response = await fetch(
828
+ `${PADDLE_API_BASE}${path}`,
829
+ __spreadProps(__spreadValues({}, options), {
830
+ headers: __spreadValues({
831
+ Authorization: `Bearer ${apiKey}`,
832
+ "Content-Type": "application/json"
833
+ }, options.headers)
834
+ })
835
+ );
836
+ if (!response.ok) {
837
+ const text = await response.text();
838
+ throw new Error(
839
+ `Paddle API failed: ${response.status} ${text}`
840
+ );
841
+ }
842
+ return response.json();
843
+ }
844
+
845
+ // src/lib/paddle/subscriptions.ts
846
+ async function fetchPaddleSubscription(subscriptionId) {
847
+ return paddleApi(
848
+ `/subscriptions/${subscriptionId}`
849
+ );
850
+ }
851
+ async function fetchPaddleSubscriptionsForCustomer(customerId) {
852
+ const params = new URLSearchParams({
853
+ customer_id: customerId
854
+ });
855
+ return paddleApi(
856
+ `/subscriptions?${params.toString()}`
857
+ );
858
+ }
859
+
860
+ // src/lib/billing/refresh.ts
861
+ function mapStatus(status) {
862
+ if (status === "active") return "active";
863
+ if (status === "trialing") return "trialing";
864
+ if (status === "paused") return "paused";
865
+ if (status === "canceled") return "canceled";
866
+ if (status === "past_due") return "past_due";
867
+ return "none";
868
+ }
869
+ async function refreshSubscriptionFromPaddle(subscriptionId) {
870
+ var _a2, _b, _c, _d;
871
+ const response = await fetchPaddleSubscription(
872
+ subscriptionId
873
+ );
874
+ const sub = response.data;
875
+ const userId = (_a2 = sub == null ? void 0 : sub.custom_data) == null ? void 0 : _a2.userId;
876
+ if (!sub || !userId) {
877
+ throw new Error(
878
+ "Paddle subscription missing custom_data.userId"
879
+ );
880
+ }
881
+ const plan = (_c = (_b = sub.custom_data) == null ? void 0 : _b.plan) != null ? _c : "starter";
882
+ return upsertSubscription({
883
+ userId,
884
+ plan,
885
+ status: mapStatus(sub.status),
886
+ paddleCustomerId: sub.customer_id,
887
+ paddleSubscriptionId: sub.id,
888
+ currentPeriodEnd: (_d = sub.current_billing_period) == null ? void 0 : _d.ends_at
889
+ });
890
+ }
891
+
892
+ // src/lib/paddle/customers.ts
893
+ async function fetchPaddleCustomer(customerId) {
894
+ return paddleApi(
895
+ `/customers/${customerId}`
896
+ );
897
+ }
898
+ async function findPaddleCustomersByEmail(email) {
899
+ const params = new URLSearchParams({
900
+ email
901
+ });
902
+ return paddleApi(
903
+ `/customers?${params.toString()}`
904
+ );
905
+ }
906
+ async function findFirstPaddleCustomerByEmail(email) {
907
+ var _a2, _b;
908
+ const response = await findPaddleCustomersByEmail(email);
909
+ return (_b = (_a2 = response.data) == null ? void 0 : _a2[0]) != null ? _b : null;
910
+ }
911
+
912
+ // src/lib/billing/customer-repair.ts
913
+ async function repairSubscriptionByEmail(email) {
914
+ var _a2;
915
+ const customer = await findFirstPaddleCustomerByEmail(email);
916
+ if (!customer) {
917
+ throw new Error(
918
+ "No Paddle customer found for email"
919
+ );
920
+ }
921
+ const subscriptions2 = await fetchPaddleSubscriptionsForCustomer(
922
+ customer.id
923
+ );
924
+ const activeSubscription = (_a2 = subscriptions2.data) == null ? void 0 : _a2.find(
925
+ (sub) => ["active", "trialing", "past_due"].includes(
926
+ sub.status
927
+ )
928
+ );
929
+ if (!activeSubscription) {
930
+ throw new Error(
931
+ "No active Paddle subscription found for customer"
932
+ );
933
+ }
934
+ const repaired = await refreshSubscriptionFromPaddle(
935
+ activeSubscription.id
936
+ );
937
+ return {
938
+ customer,
939
+ subscription: repaired
940
+ };
941
+ }
942
+
943
+ // src/lib/billing/teams.ts
944
+ var adapter3 = memoryBillingAdapter;
945
+ function setTeamAdapter(nextAdapter) {
946
+ adapter3 = nextAdapter;
947
+ }
948
+ function requireTeamAdapter() {
949
+ if (!adapter3.getTeam || !adapter3.upsertTeam) {
950
+ throw new Error(
951
+ "Billing adapter does not support team operations"
952
+ );
953
+ }
954
+ return adapter3;
955
+ }
956
+ async function createTeam({
957
+ teamId,
958
+ name,
959
+ ownerId,
960
+ plan = "free"
961
+ }) {
962
+ const now = (/* @__PURE__ */ new Date()).toISOString();
963
+ const team = {
964
+ teamId,
965
+ name,
966
+ ownerId,
967
+ plan,
968
+ members: [
969
+ {
970
+ userId: ownerId,
971
+ role: "owner",
972
+ joinedAt: now
973
+ }
974
+ ]
975
+ };
976
+ return requireTeamAdapter().upsertTeam(team);
977
+ }
978
+ async function getTeam(teamId) {
979
+ return requireTeamAdapter().getTeam(teamId);
980
+ }
981
+ async function updateTeamPlan(teamId, plan) {
982
+ const team = await getTeam(teamId);
983
+ if (!team) {
984
+ throw new Error("Team not found");
985
+ }
986
+ team.plan = plan;
987
+ return requireTeamAdapter().upsertTeam(team);
988
+ }
989
+ async function getSeatUsage(teamId) {
990
+ const team = await getTeam(teamId);
991
+ if (!team) {
992
+ throw new Error("Team not found");
993
+ }
994
+ const limit = getPlanSeatLimit(team.plan);
995
+ const used = team.members.length;
996
+ return {
997
+ used,
998
+ limit,
999
+ remaining: Math.max(0, limit - used),
1000
+ allowed: used < limit
1001
+ };
1002
+ }
1003
+ async function canInviteTeamMember(teamId) {
1004
+ const usage2 = await getSeatUsage(teamId);
1005
+ return usage2.allowed;
1006
+ }
1007
+ async function addTeamMember({
1008
+ teamId,
1009
+ userId,
1010
+ email,
1011
+ role = "member"
1012
+ }) {
1013
+ const team = await getTeam(teamId);
1014
+ if (!team) {
1015
+ throw new Error("Team not found");
1016
+ }
1017
+ const alreadyMember = team.members.some(
1018
+ (member) => member.userId === userId
1019
+ );
1020
+ if (alreadyMember) {
1021
+ return team;
1022
+ }
1023
+ const usage2 = await getSeatUsage(teamId);
1024
+ if (!usage2.allowed) {
1025
+ throw new Error(
1026
+ "Seat limit reached"
1027
+ );
1028
+ }
1029
+ const nextTeam = __spreadProps(__spreadValues({}, team), {
1030
+ members: [
1031
+ ...team.members,
1032
+ {
1033
+ userId,
1034
+ email,
1035
+ role,
1036
+ joinedAt: (/* @__PURE__ */ new Date()).toISOString()
1037
+ }
1038
+ ]
1039
+ });
1040
+ return requireTeamAdapter().upsertTeam(nextTeam);
1041
+ }
1042
+ async function removeTeamMember({
1043
+ teamId,
1044
+ userId
1045
+ }) {
1046
+ const team = await getTeam(teamId);
1047
+ if (!team) {
1048
+ throw new Error("Team not found");
1049
+ }
1050
+ if (team.ownerId === userId) {
1051
+ throw new Error(
1052
+ "Cannot remove team owner"
1053
+ );
1054
+ }
1055
+ const nextTeam = __spreadProps(__spreadValues({}, team), {
1056
+ members: team.members.filter(
1057
+ (member) => member.userId !== userId
1058
+ )
1059
+ });
1060
+ return requireTeamAdapter().upsertTeam(nextTeam);
1061
+ }
1062
+
1063
+ // src/lib/billing/events.ts
1064
+ var adapter4 = memoryBillingAdapter;
1065
+ function setBillingEventAdapter(nextAdapter) {
1066
+ adapter4 = nextAdapter;
1067
+ }
1068
+ function requireEventAdapter() {
1069
+ if (!adapter4.recordBillingEvent || !adapter4.getBillingEvents) {
1070
+ throw new Error(
1071
+ "Billing adapter does not support event operations"
1072
+ );
1073
+ }
1074
+ return adapter4;
1075
+ }
1076
+ async function recordBillingEvent(event) {
1077
+ return requireEventAdapter().recordBillingEvent(event);
1078
+ }
1079
+ async function getBillingEvents(userId) {
1080
+ return requireEventAdapter().getBillingEvents(userId);
1081
+ }
1082
+
1083
+ // src/lib/billing/configure.ts
1084
+ function configureBilling({
1085
+ adapter: adapter5
1086
+ }) {
1087
+ setBillingAdapter(adapter5);
1088
+ setUsageAdapter(adapter5);
1089
+ setTeamAdapter(adapter5);
1090
+ setBillingEventAdapter(adapter5);
1091
+ return {
1092
+ adapterConfigured: true
1093
+ };
1094
+ }
1095
+ // Annotate the CommonJS export names for ESM import in node:
1096
+ 0 && (module.exports = {
1097
+ BillingHistory,
1098
+ CustomerPortalButton,
1099
+ SubscriptionCard,
1100
+ SubscriptionGate,
1101
+ TrialBanner,
1102
+ UpgradeModal,
1103
+ UsageMeter,
1104
+ addTeamMember,
1105
+ canInviteTeamMember,
1106
+ canUse,
1107
+ configureBilling,
1108
+ createCustomerPortalSession,
1109
+ createPrismaBillingAdapter,
1110
+ createTeam,
1111
+ fetchPaddleCustomer,
1112
+ fetchPaddleSubscription,
1113
+ fetchPaddleSubscriptionsForCustomer,
1114
+ findFirstPaddleCustomerByEmail,
1115
+ findPaddleCustomersByEmail,
1116
+ getBillingEvents,
1117
+ getPaddle,
1118
+ getPlanSeatLimit,
1119
+ getSeatUsage,
1120
+ getSubscription,
1121
+ getTeam,
1122
+ getUsage,
1123
+ getUsageLimit,
1124
+ hasFeature,
1125
+ incrementUsage,
1126
+ isSubscriptionActive,
1127
+ memoryBillingAdapter,
1128
+ openCheckout,
1129
+ paddleApi,
1130
+ plans,
1131
+ protectFeature,
1132
+ protectPlan,
1133
+ protectUsage,
1134
+ recordBillingEvent,
1135
+ refreshSubscriptionFromPaddle,
1136
+ removeTeamMember,
1137
+ repairSubscriptionByEmail,
1138
+ requireFeature,
1139
+ requireSubscription,
1140
+ requireUsage,
1141
+ seedDemoBilling,
1142
+ setBillingAdapter,
1143
+ setBillingEventAdapter,
1144
+ setTeamAdapter,
1145
+ setUsageAdapter,
1146
+ syncPaddleEvent,
1147
+ updateTeamPlan,
1148
+ upsertSubscription,
1149
+ verifyPaddleWebhook
1150
+ });