@lunora/payment 1.0.0-alpha.26 → 1.0.0-alpha.28

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.
@@ -1,34 +1,34 @@
1
1
  /**
2
- * Core domain types for `@lunora/payment`.
3
- *
4
- * The provider is a stateless translator; the store owns all state. These types are the
5
- * provider-agnostic vocabulary every adapter normalizes onto.
6
- */
7
- /**
8
- * ISO-4217 currency code (uppercase, 3 letters). Not enumerated — provider coverage varies.
9
- * @experimental
10
- */
2
+ * Core domain types for `@lunora/payment`.
3
+ *
4
+ * The provider is a stateless translator; the store owns all state. These types are the
5
+ * provider-agnostic vocabulary every adapter normalizes onto.
6
+ */
7
+ /**
8
+ * ISO-4217 currency code (uppercase, 3 letters). Not enumerated — provider coverage varies.
9
+ * @experimental
10
+ */
11
11
  type CurrencyCode = string;
12
12
  /**
13
- * Money as integer minor units + currency. Always carry the two together.
14
- *
15
- * `minorUnits` is a `bigint`, which is **not** JSON-serializable — cross the RPC/wire boundary
16
- * with the `toMoneyJSON` / `fromMoneyJSON` helpers (see `./money`).
17
- * @experimental
18
- */
13
+ * Money as integer minor units + currency. Always carry the two together.
14
+ *
15
+ * `minorUnits` is a `bigint`, which is **not** JSON-serializable — cross the RPC/wire boundary
16
+ * with the `toMoneyJSON` / `fromMoneyJSON` helpers (see `./money`).
17
+ * @experimental
18
+ */
19
19
  interface Money {
20
20
  readonly currency: CurrencyCode;
21
21
  readonly minorUnits: bigint;
22
22
  }
23
23
  /**
24
- * Stable provider identifier (Medusa-style). Ships Stripe/Polar/Autumn/Dodo plus Creem, an EU-friendly MoR.
25
- * @experimental
26
- */
24
+ * Stable provider identifier (Medusa-style). Ships Stripe/Polar/Autumn/Dodo plus Creem, an EU-friendly MoR.
25
+ * @experimental
26
+ */
27
27
  type ProviderId = "autumn" | "creem" | "dodopayments" | "polar" | "stripe";
28
28
  /**
29
- * What a provider can do — encoded in types so tax/UX assumptions aren't tribal knowledge.
30
- * @experimental
31
- */
29
+ * What a provider can do — encoded in types so tax/UX assumptions aren't tribal knowledge.
30
+ * @experimental
31
+ */
32
32
  interface ProviderCapabilities {
33
33
  /** True for Polar / Lemon Squeezy / Paddle; false for Stripe (PSP) and Autumn (runs on your own Stripe). Drives tax/invoice ownership. */
34
34
  readonly merchantOfRecord: boolean;
@@ -38,19 +38,19 @@ interface ProviderCapabilities {
38
38
  readonly usageMetering: boolean;
39
39
  }
40
40
  /**
41
- * Lifecycle state of a one-time payment session.
42
- * @experimental
43
- */
41
+ * Lifecycle state of a one-time payment session.
42
+ * @experimental
43
+ */
44
44
  type PaymentState = "authorized" | "canceled" | "captured" | "failed" | "initiated" | "partially_refunded" | "refunded";
45
45
  /**
46
- * Lifecycle state of a subscription.
47
- * @experimental
48
- */
46
+ * Lifecycle state of a subscription.
47
+ * @experimental
48
+ */
49
49
  type SubscriptionState = "active" | "canceled" | "past_due" | "paused" | "trialing";
50
50
  /**
51
- * `Customer` is part of the experimental `@lunora/payment` API and may change without a major version bump.
52
- * @experimental
53
- */
51
+ * `Customer` is part of the experimental `@lunora/payment` API and may change without a major version bump.
52
+ * @experimental
53
+ */
54
54
  interface Customer {
55
55
  readonly createdAt: number;
56
56
  readonly email?: string;
@@ -61,9 +61,9 @@ interface Customer {
61
61
  readonly referenceId: string;
62
62
  }
63
63
  /**
64
- * `PaymentSession` is part of the experimental `@lunora/payment` API and may change without a major version bump.
65
- * @experimental
66
- */
64
+ * `PaymentSession` is part of the experimental `@lunora/payment` API and may change without a major version bump.
65
+ * @experimental
66
+ */
67
67
  interface PaymentSession {
68
68
  readonly amount: Money;
69
69
  readonly capturedAmount: Money;
@@ -77,9 +77,9 @@ interface PaymentSession {
77
77
  readonly updatedAt: number;
78
78
  }
79
79
  /**
80
- * `Subscription` is part of the experimental `@lunora/payment` API and may change without a major version bump.
81
- * @experimental
82
- */
80
+ * `Subscription` is part of the experimental `@lunora/payment` API and may change without a major version bump.
81
+ * @experimental
82
+ */
83
83
  interface Subscription {
84
84
  readonly cancelAtPeriodEnd: boolean;
85
85
  readonly createdAt: number;
@@ -95,30 +95,30 @@ interface Subscription {
95
95
  readonly updatedAt: number;
96
96
  }
97
97
  /**
98
- * `CustomerRef` is part of the experimental `@lunora/payment` API and may change without a major version bump.
99
- * @experimental
100
- */
98
+ * `CustomerRef` is part of the experimental `@lunora/payment` API and may change without a major version bump.
99
+ * @experimental
100
+ */
101
101
  interface CustomerRef {
102
102
  readonly email?: string;
103
103
  readonly metadata?: Record<string, string>;
104
104
  readonly referenceId: string;
105
105
  }
106
106
  /**
107
- * `CheckoutInput` is part of the experimental `@lunora/payment` API and may change without a major version bump.
108
- * @experimental
109
- */
107
+ * `CheckoutInput` is part of the experimental `@lunora/payment` API and may change without a major version bump.
108
+ * @experimental
109
+ */
110
110
  interface CheckoutInput {
111
111
  readonly cancelUrl: string;
112
112
  /**
113
- * Ignored at runtime (kept for backward-compat). The provider customer is always derived from the store for the
114
- * authorized `referenceId` (never caller-supplied) to prevent cross-tenant checkout attachment (IDOR).
115
- * Retained on the type only for backward compatibility; setting it has no effect.
116
- */
113
+ * Ignored at runtime (kept for backward-compat). The provider customer is always derived from the store for the
114
+ * authorized `referenceId` (never caller-supplied) to prevent cross-tenant checkout attachment (IDOR).
115
+ * Retained on the type only for backward compatibility; setting it has no effect.
116
+ */
117
117
  readonly customerId?: string;
118
118
  /**
119
- * Customer email, used when the reference has no provider customer yet. Some Merchant-of-Record
120
- * providers (e.g. Dodo Payments) require an email to mint a customer, so pass it on first checkout.
121
- */
119
+ * Customer email, used when the reference has no provider customer yet. Some Merchant-of-Record
120
+ * providers (e.g. Dodo Payments) require an email to mint a customer, so pass it on first checkout.
121
+ */
122
122
  readonly email?: string;
123
123
  /** Outbound idempotency key for the provider call; auto-derived when omitted. */
124
124
  readonly idempotencyKey?: string;
@@ -130,35 +130,35 @@ interface CheckoutInput {
130
130
  readonly successUrl: string;
131
131
  }
132
132
  /**
133
- * `CheckoutResult` is part of the experimental `@lunora/payment` API and may change without a major version bump.
134
- * @experimental
135
- */
133
+ * `CheckoutResult` is part of the experimental `@lunora/payment` API and may change without a major version bump.
134
+ * @experimental
135
+ */
136
136
  interface CheckoutResult {
137
137
  readonly id: string;
138
138
  readonly provider: ProviderId;
139
139
  readonly url: string;
140
140
  }
141
141
  /**
142
- * `attach` input — subscribe a reference to a plan. A thin, plan-oriented skin over
143
- * {@link CheckoutInput}: `mode` defaults to `"subscription"` (the common case), so callers pass
144
- * just `{ referenceId, priceId, successUrl, cancelUrl }`.
145
- * @experimental
146
- */
142
+ * `attach` input — subscribe a reference to a plan. A thin, plan-oriented skin over
143
+ * {@link CheckoutInput}: `mode` defaults to `"subscription"` (the common case), so callers pass
144
+ * just `{ referenceId, priceId, successUrl, cancelUrl }`.
145
+ * @experimental
146
+ */
147
147
  interface AttachInput extends Omit<CheckoutInput, "mode"> {
148
148
  readonly mode?: CheckoutInput["mode"];
149
149
  }
150
150
  /**
151
- * `PortalInput` is part of the experimental `@lunora/payment` API and may change without a major version bump.
152
- * @experimental
153
- */
151
+ * `PortalInput` is part of the experimental `@lunora/payment` API and may change without a major version bump.
152
+ * @experimental
153
+ */
154
154
  interface PortalInput {
155
155
  readonly customerId: string;
156
156
  readonly returnUrl: string;
157
157
  }
158
158
  /**
159
- * A single durable usage record — one metered event for a `(referenceId, featureId)` pair.
160
- * @experimental
161
- */
159
+ * A single durable usage record — one metered event for a `(referenceId, featureId)` pair.
160
+ * @experimental
161
+ */
162
162
  interface UsageEvent {
163
163
  readonly createdAt: number;
164
164
  readonly featureId: string;
@@ -171,28 +171,28 @@ interface UsageEvent {
171
171
  readonly reportedToProvider: boolean;
172
172
  }
173
173
  /**
174
- * `track` input — record metered usage for a reference's feature.
175
- * @experimental
176
- */
174
+ * `track` input — record metered usage for a reference's feature.
175
+ * @experimental
176
+ */
177
177
  interface TrackInput {
178
178
  readonly featureId: string;
179
179
  /** Caller-supplied dedupe key; a fresh one is generated when omitted (so each call records). */
180
180
  readonly idempotencyKey?: string;
181
181
  /**
182
- * `"add"` (default) increments usage by `quantity`; `"set"` reconciles the period total to `quantity`.
183
- * `"set"` is a non-atomic read-modify-write (it reads the current total, then appends the delta), so
184
- * concurrent `"set"` calls for the same reference can over- or under-count — call it only from a
185
- * serialized context (a single Durable Object or per-reference lock). `"add"` is always safe.
186
- */
182
+ * `"add"` (default) increments usage by `quantity`; `"set"` reconciles the period total to `quantity`.
183
+ * `"set"` is a non-atomic read-modify-write (it reads the current total, then appends the delta), so
184
+ * concurrent `"set"` calls for the same reference can over- or under-count — call it only from a
185
+ * serialized context (a single Durable Object or per-reference lock). `"add"` is always safe.
186
+ */
187
187
  readonly mode?: "add" | "set";
188
188
  /** Usage amount to add, or the absolute period total when `mode` is `"set"` (defaults to `1`). */
189
189
  readonly quantity?: number;
190
190
  readonly referenceId: string;
191
191
  }
192
192
  /**
193
- * Result of a `track` call.
194
- * @experimental
195
- */
193
+ * Result of a `track` call.
194
+ * @experimental
195
+ */
196
196
  interface TrackResult {
197
197
  /** True when this call inserted a new usage event; false when deduplicated by idempotency key. */
198
198
  readonly recorded: boolean;
@@ -200,10 +200,10 @@ interface TrackResult {
200
200
  readonly reportedToProvider: boolean;
201
201
  }
202
202
  /**
203
- * `check` input — is a reference allowed something right now? Pass `featureId` to check a feature
204
- * grant/allowance, or `priceId` to check active access to a product (one of the two is required).
205
- * @experimental
206
- */
203
+ * `check` input — is a reference allowed something right now? Pass `featureId` to check a feature
204
+ * grant/allowance, or `priceId` to check active access to a product (one of the two is required).
205
+ * @experimental
206
+ */
207
207
  interface CheckInput {
208
208
  /** Feature to check a grant/allowance for. Provide this **or** `priceId`. */
209
209
  readonly featureId?: string;
@@ -214,9 +214,9 @@ interface CheckInput {
214
214
  readonly referenceId: string;
215
215
  }
216
216
  /**
217
- * Result of a `check` call.
218
- * @experimental
219
- */
217
+ * Result of a `check` call.
218
+ * @experimental
219
+ */
220
220
  interface CheckResult {
221
221
  /** Whether the reference may consume `quantity` units of the feature right now. */
222
222
  readonly allowed: boolean;
@@ -230,16 +230,16 @@ interface CheckResult {
230
230
  readonly used?: number;
231
231
  }
232
232
  /**
233
- * One feature's resolved allowance for a reference — a {@link CheckResult} tagged with its feature.
234
- * @experimental
235
- */
233
+ * One feature's resolved allowance for a reference — a {@link CheckResult} tagged with its feature.
234
+ * @experimental
235
+ */
236
236
  interface FeatureBalance extends CheckResult {
237
237
  readonly featureId: string;
238
238
  }
239
239
  /**
240
- * Input the adapter forwards to the provider's metering API (Stripe Meter Events / Polar ingestion).
241
- * @experimental
242
- */
240
+ * Input the adapter forwards to the provider's metering API (Stripe Meter Events / Polar ingestion).
241
+ * @experimental
242
+ */
243
243
  interface ReportUsageInput {
244
244
  /** Provider customer id, when known (Stripe meter events key on it). */
245
245
  readonly customerId?: string;
@@ -251,9 +251,9 @@ interface ReportUsageInput {
251
251
  readonly timestamp?: number;
252
252
  }
253
253
  /**
254
- * `CaptureInput` is part of the experimental `@lunora/payment` API and may change without a major version bump.
255
- * @experimental
256
- */
254
+ * `CaptureInput` is part of the experimental `@lunora/payment` API and may change without a major version bump.
255
+ * @experimental
256
+ */
257
257
  interface CaptureInput {
258
258
  /** Partial capture amount; full capture when omitted. */
259
259
  readonly amount?: Money;
@@ -261,9 +261,9 @@ interface CaptureInput {
261
261
  readonly sessionId: string;
262
262
  }
263
263
  /**
264
- * `RefundInput` is part of the experimental `@lunora/payment` API and may change without a major version bump.
265
- * @experimental
266
- */
264
+ * `RefundInput` is part of the experimental `@lunora/payment` API and may change without a major version bump.
265
+ * @experimental
266
+ */
267
267
  interface RefundInput {
268
268
  /** Partial refund amount; full refund when omitted. */
269
269
  readonly amount?: Money;
@@ -272,50 +272,50 @@ interface RefundInput {
272
272
  readonly sessionId: string;
273
273
  }
274
274
  /**
275
- * `CancelSubscriptionOptions` is part of the experimental `@lunora/payment` API and may change without a major version bump.
276
- * @experimental
277
- */
275
+ * `CancelSubscriptionOptions` is part of the experimental `@lunora/payment` API and may change without a major version bump.
276
+ * @experimental
277
+ */
278
278
  interface CancelSubscriptionOptions {
279
279
  /** Cancel at period end instead of immediately. */
280
280
  readonly atPeriodEnd?: boolean;
281
281
  readonly idempotencyKey?: string;
282
282
  }
283
283
  /**
284
- * `SubscriptionPatch` is part of the experimental `@lunora/payment` API and may change without a major version bump.
285
- * @experimental
286
- */
284
+ * `SubscriptionPatch` is part of the experimental `@lunora/payment` API and may change without a major version bump.
285
+ * @experimental
286
+ */
287
287
  interface SubscriptionPatch {
288
288
  readonly priceId?: string;
289
289
  readonly quantity?: number;
290
290
  }
291
291
  /**
292
- * Normalized webhook outcome — the *core state transition* a provider event implies.
293
- * @experimental
294
- */
292
+ * Normalized webhook outcome — the *core state transition* a provider event implies.
293
+ * @experimental
294
+ */
295
295
  type WebhookActionType = "payment.authorized" | "payment.captured" | "payment.failed" | "payment.refunded" | "subscription.active" | "subscription.canceled" | "subscription.past_due" | "subscription.paused" | "subscription.updated" | "unhandled";
296
296
  /**
297
- * How a refund action's {@link WebhookAction.amount} should be interpreted by the sync layer.
298
- *
299
- * `"delta"` is an incremental amount added to the running refunded total (Polar `refund.created`,
300
- * and the historical default), so multiple events accumulate. `"absolute"` is the provider's
301
- * cumulative refunded-to-date total (Stripe `charge.refunded` carries `amount_refunded`, which
302
- * already sums all prior partial refunds); the sync layer sets the refunded total to this value
303
- * rather than adding, so repeated partial-refund events do not over-count.
304
- *
305
- * Omitted means `"delta"`, preserving the original behavior for callers that predate this field.
306
- * @experimental
307
- */
297
+ * How a refund action's {@link WebhookAction.amount} should be interpreted by the sync layer.
298
+ *
299
+ * `"delta"` is an incremental amount added to the running refunded total (Polar `refund.created`,
300
+ * and the historical default), so multiple events accumulate. `"absolute"` is the provider's
301
+ * cumulative refunded-to-date total (Stripe `charge.refunded` carries `amount_refunded`, which
302
+ * already sums all prior partial refunds); the sync layer sets the refunded total to this value
303
+ * rather than adding, so repeated partial-refund events do not over-count.
304
+ *
305
+ * Omitted means `"delta"`, preserving the original behavior for callers that predate this field.
306
+ * @experimental
307
+ */
308
308
  type RefundAmountKind = "absolute" | "delta";
309
309
  /**
310
- * `WebhookAction` is part of the experimental `@lunora/payment` API and may change without a major version bump.
311
- * @experimental
312
- */
310
+ * `WebhookAction` is part of the experimental `@lunora/payment` API and may change without a major version bump.
311
+ * @experimental
312
+ */
313
313
  interface WebhookAction {
314
314
  readonly amount?: Money;
315
315
  /**
316
- * Interpretation of {@link WebhookAction.amount} for refund actions (`payment.refunded`).
317
- * Defaults to `"delta"` when omitted. Ignored for non-refund actions.
318
- */
316
+ * Interpretation of {@link WebhookAction.amount} for refund actions (`payment.refunded`).
317
+ * Defaults to `"delta"` when omitted. Ignored for non-refund actions.
318
+ */
319
319
  readonly amountKind?: RefundAmountKind;
320
320
  readonly cancelAtPeriodEnd?: boolean;
321
321
  readonly currentPeriodEnd?: number;
@@ -334,24 +334,24 @@ interface WebhookAction {
334
334
  readonly type: WebhookActionType;
335
335
  }
336
336
  /**
337
- * Result of applying a webhook action to the store.
338
- * @experimental
339
- */
337
+ * Result of applying a webhook action to the store.
338
+ * @experimental
339
+ */
340
340
  interface ApplyResult {
341
341
  readonly applied: boolean;
342
342
  readonly reason?: "duplicate" | "illegal_transition" | "invalid_refund_amount" | "ok" | "unhandled";
343
343
  }
344
344
  /**
345
- * A read-only header bag; the platform `Headers` object satisfies it.
346
- * @experimental
347
- */
345
+ * A read-only header bag; the platform `Headers` object satisfies it.
346
+ * @experimental
347
+ */
348
348
  interface WebhookHeaders {
349
349
  get: (name: string) => null | string;
350
350
  }
351
351
  /**
352
- * `WebhookInput` is part of the experimental `@lunora/payment` API and may change without a major version bump.
353
- * @experimental
354
- */
352
+ * `WebhookInput` is part of the experimental `@lunora/payment` API and may change without a major version bump.
353
+ * @experimental
354
+ */
355
355
  interface WebhookInput {
356
356
  /** Request headers (signature schemes read provider-specific headers from here). */
357
357
  readonly headers: WebhookHeaders;
@@ -359,12 +359,12 @@ interface WebhookInput {
359
359
  readonly payload: string;
360
360
  }
361
361
  /**
362
- * A stateless translator between the provider API and Lunora's normalized vocabulary.
363
- *
364
- * Adapters never own state — they make provider calls and normalize provider events into a
365
- * `WebhookAction`. All durable state lives in the payment store.
366
- * @experimental
367
- */
362
+ * A stateless translator between the provider API and Lunora's normalized vocabulary.
363
+ *
364
+ * Adapters never own state — they make provider calls and normalize provider events into a
365
+ * `WebhookAction`. All durable state lives in the payment store.
366
+ * @experimental
367
+ */
368
368
  interface PaymentAdapter {
369
369
  cancelPayment: (sessionId: string, options?: {
370
370
  idempotencyKey?: string;
@@ -373,23 +373,23 @@ interface PaymentAdapter {
373
373
  readonly capabilities: ProviderCapabilities;
374
374
  capturePayment: (input: CaptureInput) => Promise<PaymentSession>;
375
375
  /**
376
- * Ask the provider whether a reference may consume `quantity` units of a feature (or holds active
377
- * access to a product) right now — for providers that own entitlement truth themselves (e.g.
378
- * Autumn computes balances, credits, and limits from its plan config). Optional: when absent, the
379
- * facade's `check` evaluates locally from the synced store + the app's `entitlements` config. When
380
- * present, the facade delegates `check` to it, so `entitlements` need not be configured.
381
- */
376
+ * Ask the provider whether a reference may consume `quantity` units of a feature (or holds active
377
+ * access to a product) right now — for providers that own entitlement truth themselves (e.g.
378
+ * Autumn computes balances, credits, and limits from its plan config). Optional: when absent, the
379
+ * facade's `check` evaluates locally from the synced store + the app's `entitlements` config. When
380
+ * present, the facade delegates `check` to it, so `entitlements` need not be configured.
381
+ */
382
382
  checkEntitlement?: (input: CheckInput) => Promise<CheckResult>;
383
383
  createCheckout: (input: CheckoutInput) => Promise<CheckoutResult>;
384
384
  createPortalSession: (input: PortalInput) => Promise<{
385
385
  url: string;
386
386
  }>;
387
387
  /**
388
- * Resolve every feature allowance for a reference straight from the provider — the optional
389
- * companion to `checkEntitlement` that powers `listBalances`. Present only on providers that
390
- * own entitlement truth; when absent, the facade evaluates balances locally from the store + the
391
- * app's `entitlements` config.
392
- */
388
+ * Resolve every feature allowance for a reference straight from the provider — the optional
389
+ * companion to `checkEntitlement` that powers `listBalances`. Present only on providers that
390
+ * own entitlement truth; when absent, the facade evaluates balances locally from the store + the
391
+ * app's `entitlements` config.
392
+ */
393
393
  getBalances?: (referenceId: string) => Promise<FeatureBalance[]>;
394
394
  getOrCreateCustomer: (ref: CustomerRef) => Promise<Customer>;
395
395
  /** Fetch the provider's current truth for a payment session — the basis for reconciliation. */
@@ -402,26 +402,26 @@ interface PaymentAdapter {
402
402
  parseWebhook: (input: WebhookInput) => Promise<WebhookAction>;
403
403
  refundPayment: (input: RefundInput) => Promise<PaymentSession>;
404
404
  /**
405
- * Forward metered usage to the provider's billing API. Optional — present only on providers
406
- * whose `capabilities.usageMetering` is `true` and that expose an ingestion endpoint. When
407
- * absent, `track` still records usage durably and `check` enforces limits locally.
408
- */
405
+ * Forward metered usage to the provider's billing API. Optional — present only on providers
406
+ * whose `capabilities.usageMetering` is `true` and that expose an ingestion endpoint. When
407
+ * absent, `track` still records usage durably and `check` enforces limits locally.
408
+ */
409
409
  reportUsage?: (input: ReportUsageInput) => Promise<void>;
410
410
  resumeSubscription: (subscriptionId: string) => Promise<Subscription>;
411
411
  updateSubscription: (subscriptionId: string, patch: SubscriptionPatch) => Promise<Subscription>;
412
412
  }
413
413
  /**
414
- * Registry of adapters keyed by provider id — supports dual-register during provider migration.
415
- * @experimental
416
- */
414
+ * Registry of adapters keyed by provider id — supports dual-register during provider migration.
415
+ * @experimental
416
+ */
417
417
  interface AdapterRegistry {
418
418
  all: () => PaymentAdapter[];
419
419
  get: (provider: ProviderId) => PaymentAdapter;
420
420
  has: (provider: ProviderId) => boolean;
421
421
  }
422
422
  /**
423
- * `createAdapterRegistry` is part of the experimental `@lunora/payment` API and may change without a major version bump.
424
- * @experimental
425
- */
423
+ * `createAdapterRegistry` is part of the experimental `@lunora/payment` API and may change without a major version bump.
424
+ * @experimental
425
+ */
426
426
  declare const createAdapterRegistry: (adapters: ReadonlyArray<PaymentAdapter>) => AdapterRegistry;
427
427
  export { ApplyResult as A, Customer as C, FeatureBalance as F, Money as M, PaymentAdapter as P, RefundAmountKind as R, Subscription as S, TrackInput as T, UsageEvent as U, WebhookActionType as W, ProviderId as a, PaymentSession as b, AttachInput as c, CheckoutResult as d, CancelSubscriptionOptions as e, CheckInput as f, CheckResult as g, CheckoutInput as h, TrackResult as i, CurrencyCode as j, PaymentState as k, SubscriptionState as l, WebhookAction as m, AdapterRegistry as n, CaptureInput as o, CustomerRef as p, PortalInput as q, ProviderCapabilities as r, RefundInput as s, ReportUsageInput as t, SubscriptionPatch as u, WebhookHeaders as v, WebhookInput as w, createAdapterRegistry as x };
@@ -1,7 +1,7 @@
1
1
  /**
2
- * A per-seat / per-workspace sub-customer with its own feature balances.
3
- * @experimental
4
- */
2
+ * A per-seat / per-workspace sub-customer with its own feature balances.
3
+ * @experimental
4
+ */
5
5
  interface AutumnEntity {
6
6
  readonly featureId?: string;
7
7
  readonly id: string;
@@ -10,9 +10,9 @@ interface AutumnEntity {
10
10
  readonly raw: Record<string, unknown>;
11
11
  }
12
12
  /**
13
- * `CreateEntityInput` is part of the experimental `@lunora/payment` API and may change without a major version bump.
14
- * @experimental
15
- */
13
+ * `CreateEntityInput` is part of the experimental `@lunora/payment` API and may change without a major version bump.
14
+ * @experimental
15
+ */
16
16
  interface CreateEntityInput {
17
17
  /** The feature the entity consumes a seat/allowance of (e.g. `"seats"`). */
18
18
  readonly featureId: string;
@@ -21,49 +21,49 @@ interface CreateEntityInput {
21
21
  readonly name?: string;
22
22
  }
23
23
  /**
24
- * One point in a usage-events aggregation.
25
- * @experimental
26
- */
24
+ * One point in a usage-events aggregation.
25
+ * @experimental
26
+ */
27
27
  interface UsageEventPoint {
28
28
  readonly count: number;
29
29
  readonly period?: string;
30
30
  readonly raw: Record<string, unknown>;
31
31
  }
32
32
  /**
33
- * `EventsListInput` is part of the experimental `@lunora/payment` API and may change without a major version bump.
34
- * @experimental
35
- */
33
+ * `EventsListInput` is part of the experimental `@lunora/payment` API and may change without a major version bump.
34
+ * @experimental
35
+ */
36
36
  interface EventsListInput {
37
37
  /** Feature(s) to report on. */
38
38
  readonly featureId: ReadonlyArray<string> | string;
39
39
  }
40
40
  /**
41
- * `EventsAggregateInput` is part of the experimental `@lunora/payment` API and may change without a major version bump.
42
- * @experimental
43
- */
41
+ * `EventsAggregateInput` is part of the experimental `@lunora/payment` API and may change without a major version bump.
42
+ * @experimental
43
+ */
44
44
  interface EventsAggregateInput extends EventsListInput {
45
45
  /** Time window to aggregate over (aggregate only — `list` ignores it, so it isn't accepted there). */
46
46
  readonly range?: "7d" | "24h" | "30d" | "90d" | "last_cycle";
47
47
  }
48
48
  /**
49
- * A prepaid feature quantity purchased at checkout (e.g. buy 5 seats up front).
50
- * @experimental
51
- */
49
+ * A prepaid feature quantity purchased at checkout (e.g. buy 5 seats up front).
50
+ * @experimental
51
+ */
52
52
  interface PrepaidOption {
53
53
  readonly featureId: string;
54
54
  readonly quantity: number;
55
55
  }
56
56
  /**
57
- * Autumn-native checkout — richer than the generic `createCheckout` (trials, prepaid, entities, rewards).
58
- * @experimental
59
- */
57
+ * Autumn-native checkout — richer than the generic `createCheckout` (trials, prepaid, entities, rewards).
58
+ * @experimental
59
+ */
60
60
  interface AutumnCheckoutInput {
61
61
  /** Scope the checkout to a specific entity (seat/workspace) rather than the top-level customer. */
62
62
  readonly entityId?: string;
63
63
  /**
64
- * Autumn applies a plan's configured free trial automatically. Pass `false` to opt out of that
65
- * trial for this checkout; leave unset (or `true`) to keep the plan default.
66
- */
64
+ * Autumn applies a plan's configured free trial automatically. Pass `false` to opt out of that
65
+ * trial for this checkout; leave unset (or `true`) to keep the plan default.
66
+ */
67
67
  readonly freeTrial?: boolean;
68
68
  /** Prepaid feature quantities to purchase up front. */
69
69
  readonly options?: ReadonlyArray<PrepaidOption>;
@@ -74,9 +74,9 @@ interface AutumnCheckoutInput {
74
74
  readonly successUrl?: string;
75
75
  }
76
76
  /**
77
- * The subset of the Autumn SDK surface the native facade calls. A real `Autumn` instance satisfies it.
78
- * @experimental
79
- */
77
+ * The subset of the Autumn SDK surface the native facade calls. A real `Autumn` instance satisfies it.
78
+ * @experimental
79
+ */
80
80
  interface AutumnFeaturesClientLike {
81
81
  readonly billing: unknown;
82
82
  readonly entities: unknown;
@@ -85,16 +85,16 @@ interface AutumnFeaturesClientLike {
85
85
  readonly referrals: unknown;
86
86
  }
87
87
  /**
88
- * `AutumnFeaturesOptions` is part of the experimental `@lunora/payment` API and may change without a major version bump.
89
- * @experimental
90
- */
88
+ * `AutumnFeaturesOptions` is part of the experimental `@lunora/payment` API and may change without a major version bump.
89
+ * @experimental
90
+ */
91
91
  interface AutumnFeaturesOptions {
92
92
  readonly client: AutumnFeaturesClientLike;
93
93
  }
94
94
  /**
95
- * The Autumn-native feature facade returned by {@link createAutumnFeatures}.
96
- * @experimental
97
- */
95
+ * The Autumn-native feature facade returned by {@link createAutumnFeatures}.
96
+ * @experimental
97
+ */
98
98
  interface AutumnFeatures {
99
99
  readonly checkout: (referenceId: string, input: AutumnCheckoutInput) => Promise<{
100
100
  raw: Record<string, unknown>;
@@ -121,9 +121,9 @@ interface AutumnFeatures {
121
121
  };
122
122
  }
123
123
  /**
124
- * Build the Autumn-native feature facade over an injected client. Companion to `createAutumnAdapter`;
125
- * share the same underlying `autumn-js` `Autumn` client between them.
126
- * @experimental
127
- */
124
+ * Build the Autumn-native feature facade over an injected client. Companion to `createAutumnAdapter`;
125
+ * share the same underlying `autumn-js` `Autumn` client between them.
126
+ * @experimental
127
+ */
128
128
  declare const createAutumnFeatures: (options: AutumnFeaturesOptions) => AutumnFeatures;
129
129
  export { type AutumnCheckoutInput, type AutumnEntity, type AutumnFeatures, type AutumnFeaturesClientLike, type AutumnFeaturesOptions, type CreateEntityInput, type EventsAggregateInput, type EventsListInput, type PrepaidOption, type UsageEventPoint, createAutumnFeatures };