@nodaro/sdk 2.49.0 → 2.51.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/dist/{chunk-FIMBPKIH.cjs → chunk-4BAHF762.cjs} +43 -2
- package/dist/chunk-4BAHF762.cjs.map +1 -0
- package/dist/chunk-6FZN3QQO.cjs +146 -0
- package/dist/chunk-6FZN3QQO.cjs.map +1 -0
- package/dist/{chunk-5MOJSYHI.js → chunk-7QK2NXJA.js} +43 -2
- package/dist/chunk-7QK2NXJA.js.map +1 -0
- package/dist/{chunk-2JAKOBD3.js → chunk-EC6MC46Y.js} +5 -5
- package/dist/{chunk-2JAKOBD3.js.map → chunk-EC6MC46Y.js.map} +1 -1
- package/dist/{chunk-PPP6VZ3I.cjs → chunk-HPSENMVN.cjs} +8 -8
- package/dist/{chunk-PPP6VZ3I.cjs.map → chunk-HPSENMVN.cjs.map} +1 -1
- package/dist/{chunk-NOBQQTAG.cjs → chunk-OMX7JBGY.cjs} +3 -3
- package/dist/{chunk-NOBQQTAG.cjs.map → chunk-OMX7JBGY.cjs.map} +1 -1
- package/dist/chunk-WYYDWJFF.js +144 -0
- package/dist/chunk-WYYDWJFF.js.map +1 -0
- package/dist/{chunk-5MZYOJCJ.js → chunk-XISHBW5I.js} +3 -3
- package/dist/{chunk-5MZYOJCJ.js.map → chunk-XISHBW5I.js.map} +1 -1
- package/dist/entries/billing.cjs +2 -2
- package/dist/entries/billing.d.cts +202 -3
- package/dist/entries/billing.d.ts +202 -3
- package/dist/entries/billing.js +1 -1
- package/dist/entries/client.cjs +9 -9
- package/dist/entries/client.js +4 -4
- package/dist/entries/core.cjs +5 -5
- package/dist/entries/core.js +1 -1
- package/dist/entries/credits.cjs +2 -2
- package/dist/entries/credits.d.cts +179 -1
- package/dist/entries/credits.d.ts +179 -1
- package/dist/entries/credits.js +1 -1
- package/dist/index.cjs +12 -12
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -4
- package/package.json +1 -1
- package/dist/chunk-5MOJSYHI.js.map +0 -1
- package/dist/chunk-FIMBPKIH.cjs.map +0 -1
- package/dist/chunk-J4WFSKY6.js +0 -50
- package/dist/chunk-J4WFSKY6.js.map +0 -1
- package/dist/chunk-NGKODS3J.cjs +0 -52
- package/dist/chunk-NGKODS3J.cjs.map +0 -1
|
@@ -8,8 +8,10 @@ import '@nodaro/shared/organizations';
|
|
|
8
8
|
* (`backend/src/ee/routes/billing.ts`, `backend/src/routes/billing-surface.ts`),
|
|
9
9
|
* the source of truth: keep these in sync if they change.
|
|
10
10
|
*
|
|
11
|
-
* Buying,
|
|
12
|
-
*
|
|
11
|
+
* Buying, the plan, the payment settings, the receipts and the invoices answer
|
|
12
|
+
* a SIGNED-IN SESSION only (`supabaseAuth`, the credential a first-party web
|
|
13
|
+
* app holds): those routes refuse an API key and an app's OAuth token with
|
|
14
|
+
* `403 forbidden` (`ForbiddenError`). Their methods are marked so below.
|
|
13
15
|
*/
|
|
14
16
|
/** A sum of money in its currency's major unit (`12` = 12.00), with its ISO-4217 code (`"USD"`). */
|
|
15
17
|
interface BillingMoney {
|
|
@@ -203,6 +205,203 @@ declare class BillingResource {
|
|
|
203
205
|
* when the provider could not answer — not a zero balance. Every edition.
|
|
204
206
|
*/
|
|
205
207
|
account(): Promise<BillingAccountSummary | null>;
|
|
208
|
+
/**
|
|
209
|
+
* `GET /v1/billing/transactions` → the account's credit purchases, newest
|
|
210
|
+
* first: subscription payments and credit packs, each with its Stripe
|
|
211
|
+
* receipt link when one was captured. **Signed-in session only.**
|
|
212
|
+
*/
|
|
213
|
+
purchases(): Promise<BillingPurchase[]>;
|
|
214
|
+
/**
|
|
215
|
+
* `GET /v1/billing/invoices` → every payment as a document, newest first:
|
|
216
|
+
* a Stripe invoice (with its PDF) for each subscription payment, a hosted
|
|
217
|
+
* receipt for each credit pack or load. **Signed-in session only.**
|
|
218
|
+
*/
|
|
219
|
+
invoices(): Promise<BillingDocument[]>;
|
|
220
|
+
/**
|
|
221
|
+
* `GET /v1/billing/payment-method` → the card and the billing details on
|
|
222
|
+
* file with Stripe; both `null` for an account that has not bought yet
|
|
223
|
+
* (never an error). **Signed-in session only.**
|
|
224
|
+
*/
|
|
225
|
+
paymentMethod(): Promise<BillingPaymentMethod>;
|
|
226
|
+
/**
|
|
227
|
+
* `GET /v1/billing/auto-recharge` → the automatic top-up setting: when the
|
|
228
|
+
* balance falls under `thresholdCredits`, `amountUsd` is loaded from the
|
|
229
|
+
* saved card. **Signed-in session only.**
|
|
230
|
+
*/
|
|
231
|
+
autoRecharge(): Promise<BillingAutoRecharge>;
|
|
232
|
+
/**
|
|
233
|
+
* `PUT /v1/billing/auto-recharge` → changes the automatic top-up. Enabling
|
|
234
|
+
* needs both `thresholdCredits` (100–100,000) and `amountUsd` (a whole
|
|
235
|
+
* amount in the load range); the server answers `400` otherwise. A change
|
|
236
|
+
* clears the failure count. **Signed-in session only.**
|
|
237
|
+
*/
|
|
238
|
+
setAutoRecharge(input: BillingAutoRechargeInput): Promise<BillingAutoRechargeSaved>;
|
|
239
|
+
/**
|
|
240
|
+
* `POST /v1/billing/create-checkout-session` → a Stripe Checkout page for a
|
|
241
|
+
* plan or a credit pack (`priceId` from {@link BillingPlansResult}): send
|
|
242
|
+
* the person to `url`. Pass `returnPath` (a path on your own origin, such
|
|
243
|
+
* as `"/billing"`) to have Stripe bring them back to your app with
|
|
244
|
+
* `checkout=success` or `checkout=cancelled` in the query; without it the
|
|
245
|
+
* Nodaro app's own pages are used. `ForbiddenError` with the code
|
|
246
|
+
* `self_serve_disabled` on a deployment that does not sell to its users.
|
|
247
|
+
* **Signed-in session only.**
|
|
248
|
+
*/
|
|
249
|
+
checkout(input: BillingCheckoutInput): Promise<BillingCheckoutSession>;
|
|
250
|
+
/**
|
|
251
|
+
* `POST /v1/billing/create-load-session` → a Stripe Checkout page that loads
|
|
252
|
+
* a whole amount (`amountUsd`, within {@link BillingPlansResult.topUpRange})
|
|
253
|
+
* as credits at the packs' rate; `credits` is what it will grant. The card
|
|
254
|
+
* is saved for auto top-up. `returnPath` as in {@link checkout}.
|
|
255
|
+
* **Signed-in session only.**
|
|
256
|
+
*/
|
|
257
|
+
loadCredits(input: BillingLoadInput): Promise<BillingLoadSession>;
|
|
258
|
+
/**
|
|
259
|
+
* `POST /v1/billing/manage-subscription` → a Stripe Customer Portal page
|
|
260
|
+
* (the card, the billing address, the invoices, cancelling): send the person
|
|
261
|
+
* to `url`; `returnPath` is where the portal's Back goes (default the app's
|
|
262
|
+
* `/billing`). `NotFoundError` before a first purchase — Stripe does not
|
|
263
|
+
* know the account yet. **Signed-in session only.**
|
|
264
|
+
*/
|
|
265
|
+
portal(input?: BillingPortalInput): Promise<BillingPortalSession>;
|
|
266
|
+
/**
|
|
267
|
+
* `POST /v1/billing/change-plan` → moves the active subscription to another
|
|
268
|
+
* plan's price (`newPriceId`, a subscription price from the plans list),
|
|
269
|
+
* prorated by Stripe; the new tier applies at once. `NotFoundError` with no
|
|
270
|
+
* active subscription; `400` on a pack's price or the current one.
|
|
271
|
+
* **Signed-in session only.**
|
|
272
|
+
*/
|
|
273
|
+
changePlan(input: BillingChangePlanInput): Promise<BillingChangePlanResult>;
|
|
274
|
+
}
|
|
275
|
+
/** One credit purchase (`billing.purchases()`), as the `transactions` row names it. */
|
|
276
|
+
interface BillingPurchase {
|
|
277
|
+
id: string;
|
|
278
|
+
/** The Stripe payment or subscription id. */
|
|
279
|
+
stripe_transaction_id: string | null;
|
|
280
|
+
/** `"subscription"` (a plan payment), `"topup"` (a credit pack or a load) or `"refund"` (money given back: `credits_granted` negative). */
|
|
281
|
+
type: string;
|
|
282
|
+
/** What was paid, in US dollars (on a refund, the sum given back). */
|
|
283
|
+
amount_usd: number;
|
|
284
|
+
/** Negative on a refund. */
|
|
285
|
+
credits_granted: number;
|
|
286
|
+
/** The plan paid for, on a subscription payment. */
|
|
287
|
+
tier: string | null;
|
|
288
|
+
/** ISO-8601. */
|
|
289
|
+
created_at: string;
|
|
290
|
+
/** Stripe's hosted receipt; `null` when none was captured. */
|
|
291
|
+
receipt_url: string | null;
|
|
292
|
+
}
|
|
293
|
+
/** A payment document: a Stripe invoice (a subscription payment) or a receipt (a credit purchase). */
|
|
294
|
+
interface BillingDocument {
|
|
295
|
+
id: string;
|
|
296
|
+
kind: "invoice" | "receipt";
|
|
297
|
+
/** The invoice number Stripe printed; `null` on a receipt. */
|
|
298
|
+
number: string | null;
|
|
299
|
+
/** ISO-8601. */
|
|
300
|
+
at: string;
|
|
301
|
+
amount: BillingMoney;
|
|
302
|
+
/** The credits the payment granted; `null` on an invoice (the plan's credits come with the period). Negative on a refund. */
|
|
303
|
+
credits: number | null;
|
|
304
|
+
/** `"paid"`, `"open"`, `"void"`, `"uncollectible"`, or `"refunded"` (a receipt for money given back: `amount` and `credits` negative). */
|
|
305
|
+
status: string;
|
|
306
|
+
description: string | null;
|
|
307
|
+
/** The PDF, on an invoice; `null` on a receipt. */
|
|
308
|
+
pdfUrl: string | null;
|
|
309
|
+
/** The hosted page: Stripe's invoice page, or the receipt. */
|
|
310
|
+
url: string | null;
|
|
311
|
+
}
|
|
312
|
+
/** The card on file, as Stripe shows it. */
|
|
313
|
+
interface BillingCard {
|
|
314
|
+
/** `"visa"`, `"mastercard"`, … */
|
|
315
|
+
brand: string;
|
|
316
|
+
last4: string;
|
|
317
|
+
expMonth: number;
|
|
318
|
+
expYear: number;
|
|
319
|
+
}
|
|
320
|
+
/** The name, email and country on file. */
|
|
321
|
+
interface BillingDetails {
|
|
322
|
+
name: string | null;
|
|
323
|
+
email: string | null;
|
|
324
|
+
/** ISO-3166 alpha-2. */
|
|
325
|
+
country: string | null;
|
|
326
|
+
}
|
|
327
|
+
/** The answer of `billing.paymentMethod()`: both `null` before a first purchase. */
|
|
328
|
+
interface BillingPaymentMethod {
|
|
329
|
+
card: BillingCard | null;
|
|
330
|
+
billingDetails: BillingDetails | null;
|
|
331
|
+
}
|
|
332
|
+
/** The automatic top-up setting (`billing.autoRecharge()`). */
|
|
333
|
+
interface BillingAutoRecharge {
|
|
334
|
+
enabled: boolean;
|
|
335
|
+
/** Load when the balance falls under this many credits; `null` when never set. */
|
|
336
|
+
thresholdCredits: number | null;
|
|
337
|
+
/** The whole dollar amount loaded each time; `null` when never set. */
|
|
338
|
+
amountUsd: number | null;
|
|
339
|
+
/** Failed attempts in a row; the server stops trying after a few, until the setting is saved again. */
|
|
340
|
+
failureCount: number;
|
|
341
|
+
/** ISO-8601; `null` before the first attempt. */
|
|
342
|
+
lastAttemptAt: string | null;
|
|
343
|
+
/** Whether a card is saved to charge; without one, enabling cannot work. */
|
|
344
|
+
hasSavedCard: boolean;
|
|
345
|
+
}
|
|
346
|
+
/** What `billing.setAutoRecharge()` sends; `thresholdCredits` and `amountUsd` are both required to enable. */
|
|
347
|
+
interface BillingAutoRechargeInput {
|
|
348
|
+
enabled: boolean;
|
|
349
|
+
thresholdCredits?: number;
|
|
350
|
+
amountUsd?: number;
|
|
351
|
+
}
|
|
352
|
+
/** What `billing.setAutoRecharge()` answers: the fields as sent (`null` for one left out, even when a stored value remains); read {@link BillingResource.autoRecharge} for the whole setting. */
|
|
353
|
+
interface BillingAutoRechargeSaved {
|
|
354
|
+
enabled: boolean;
|
|
355
|
+
thresholdCredits: number | null;
|
|
356
|
+
amountUsd: number | null;
|
|
357
|
+
}
|
|
358
|
+
/** What `billing.checkout()` sends. */
|
|
359
|
+
interface BillingCheckoutInput {
|
|
360
|
+
/** A plan's monthly or yearly price id, or a credit pack's (`BillingTopUp.id`). */
|
|
361
|
+
priceId: string;
|
|
362
|
+
/** Inferred from the price when omitted. */
|
|
363
|
+
mode?: "subscription" | "payment";
|
|
364
|
+
/** A path on the calling origin Stripe brings the person back to (`"/billing"`, a query allowed): one leading `/`, no host, no `#`. Wins over `embedded`. */
|
|
365
|
+
returnPath?: string;
|
|
366
|
+
/** Set by an embedded first-party surface: return to the app's public checkout-complete page. */
|
|
367
|
+
embedded?: boolean;
|
|
368
|
+
}
|
|
369
|
+
/** A Stripe Checkout page to send the person to. */
|
|
370
|
+
interface BillingCheckoutSession {
|
|
371
|
+
url: string | null;
|
|
372
|
+
}
|
|
373
|
+
/** What `billing.loadCredits()` sends. */
|
|
374
|
+
interface BillingLoadInput {
|
|
375
|
+
/** A whole dollar amount within `topUpRange`. */
|
|
376
|
+
amountUsd: number;
|
|
377
|
+
/** As in {@link BillingCheckoutInput.returnPath}; wins over `embedded`. */
|
|
378
|
+
returnPath?: string;
|
|
379
|
+
embedded?: boolean;
|
|
380
|
+
}
|
|
381
|
+
/** A Stripe Checkout page for a load, and the credits it grants. */
|
|
382
|
+
interface BillingLoadSession {
|
|
383
|
+
url: string | null;
|
|
384
|
+
credits: number;
|
|
385
|
+
}
|
|
386
|
+
/** What `billing.portal()` sends. */
|
|
387
|
+
interface BillingPortalInput {
|
|
388
|
+
/** Where the portal's Back goes: a path on the calling origin; default the app's `/billing`. */
|
|
389
|
+
returnPath?: string;
|
|
390
|
+
}
|
|
391
|
+
/** A Stripe Customer Portal page to send the person to. */
|
|
392
|
+
interface BillingPortalSession {
|
|
393
|
+
url: string;
|
|
394
|
+
}
|
|
395
|
+
/** What `billing.changePlan()` sends. */
|
|
396
|
+
interface BillingChangePlanInput {
|
|
397
|
+
/** A subscription price id from the plans list. */
|
|
398
|
+
newPriceId: string;
|
|
399
|
+
}
|
|
400
|
+
/** What `billing.changePlan()` answers. */
|
|
401
|
+
interface BillingChangePlanResult {
|
|
402
|
+
subscriptionId: string;
|
|
403
|
+
/** The plan now in force: `"basic"`, `"standard"`, … */
|
|
404
|
+
tier: string;
|
|
206
405
|
}
|
|
207
406
|
|
|
208
|
-
export { type BillingAccountSummary, type BillingMoney, type BillingMonthlyPrice, type BillingPlan, type BillingPlanPrices, type BillingPlansResult, type BillingPriceCredits, BillingResource, type BillingSubscription, type BillingSubscriptionResult, type BillingSurface, type BillingTopUp, type BillingUsageCategory, type BillingYearlyPrice };
|
|
407
|
+
export { type BillingAccountSummary, type BillingAutoRecharge, type BillingAutoRechargeInput, type BillingAutoRechargeSaved, type BillingCard, type BillingChangePlanInput, type BillingChangePlanResult, type BillingCheckoutInput, type BillingCheckoutSession, type BillingDetails, type BillingDocument, type BillingLoadInput, type BillingLoadSession, type BillingMoney, type BillingMonthlyPrice, type BillingPaymentMethod, type BillingPlan, type BillingPlanPrices, type BillingPlansResult, type BillingPortalInput, type BillingPortalSession, type BillingPriceCredits, type BillingPurchase, BillingResource, type BillingSubscription, type BillingSubscriptionResult, type BillingSurface, type BillingTopUp, type BillingUsageCategory, type BillingYearlyPrice };
|
|
@@ -8,8 +8,10 @@ import '@nodaro/shared/organizations';
|
|
|
8
8
|
* (`backend/src/ee/routes/billing.ts`, `backend/src/routes/billing-surface.ts`),
|
|
9
9
|
* the source of truth: keep these in sync if they change.
|
|
10
10
|
*
|
|
11
|
-
* Buying,
|
|
12
|
-
*
|
|
11
|
+
* Buying, the plan, the payment settings, the receipts and the invoices answer
|
|
12
|
+
* a SIGNED-IN SESSION only (`supabaseAuth`, the credential a first-party web
|
|
13
|
+
* app holds): those routes refuse an API key and an app's OAuth token with
|
|
14
|
+
* `403 forbidden` (`ForbiddenError`). Their methods are marked so below.
|
|
13
15
|
*/
|
|
14
16
|
/** A sum of money in its currency's major unit (`12` = 12.00), with its ISO-4217 code (`"USD"`). */
|
|
15
17
|
interface BillingMoney {
|
|
@@ -203,6 +205,203 @@ declare class BillingResource {
|
|
|
203
205
|
* when the provider could not answer — not a zero balance. Every edition.
|
|
204
206
|
*/
|
|
205
207
|
account(): Promise<BillingAccountSummary | null>;
|
|
208
|
+
/**
|
|
209
|
+
* `GET /v1/billing/transactions` → the account's credit purchases, newest
|
|
210
|
+
* first: subscription payments and credit packs, each with its Stripe
|
|
211
|
+
* receipt link when one was captured. **Signed-in session only.**
|
|
212
|
+
*/
|
|
213
|
+
purchases(): Promise<BillingPurchase[]>;
|
|
214
|
+
/**
|
|
215
|
+
* `GET /v1/billing/invoices` → every payment as a document, newest first:
|
|
216
|
+
* a Stripe invoice (with its PDF) for each subscription payment, a hosted
|
|
217
|
+
* receipt for each credit pack or load. **Signed-in session only.**
|
|
218
|
+
*/
|
|
219
|
+
invoices(): Promise<BillingDocument[]>;
|
|
220
|
+
/**
|
|
221
|
+
* `GET /v1/billing/payment-method` → the card and the billing details on
|
|
222
|
+
* file with Stripe; both `null` for an account that has not bought yet
|
|
223
|
+
* (never an error). **Signed-in session only.**
|
|
224
|
+
*/
|
|
225
|
+
paymentMethod(): Promise<BillingPaymentMethod>;
|
|
226
|
+
/**
|
|
227
|
+
* `GET /v1/billing/auto-recharge` → the automatic top-up setting: when the
|
|
228
|
+
* balance falls under `thresholdCredits`, `amountUsd` is loaded from the
|
|
229
|
+
* saved card. **Signed-in session only.**
|
|
230
|
+
*/
|
|
231
|
+
autoRecharge(): Promise<BillingAutoRecharge>;
|
|
232
|
+
/**
|
|
233
|
+
* `PUT /v1/billing/auto-recharge` → changes the automatic top-up. Enabling
|
|
234
|
+
* needs both `thresholdCredits` (100–100,000) and `amountUsd` (a whole
|
|
235
|
+
* amount in the load range); the server answers `400` otherwise. A change
|
|
236
|
+
* clears the failure count. **Signed-in session only.**
|
|
237
|
+
*/
|
|
238
|
+
setAutoRecharge(input: BillingAutoRechargeInput): Promise<BillingAutoRechargeSaved>;
|
|
239
|
+
/**
|
|
240
|
+
* `POST /v1/billing/create-checkout-session` → a Stripe Checkout page for a
|
|
241
|
+
* plan or a credit pack (`priceId` from {@link BillingPlansResult}): send
|
|
242
|
+
* the person to `url`. Pass `returnPath` (a path on your own origin, such
|
|
243
|
+
* as `"/billing"`) to have Stripe bring them back to your app with
|
|
244
|
+
* `checkout=success` or `checkout=cancelled` in the query; without it the
|
|
245
|
+
* Nodaro app's own pages are used. `ForbiddenError` with the code
|
|
246
|
+
* `self_serve_disabled` on a deployment that does not sell to its users.
|
|
247
|
+
* **Signed-in session only.**
|
|
248
|
+
*/
|
|
249
|
+
checkout(input: BillingCheckoutInput): Promise<BillingCheckoutSession>;
|
|
250
|
+
/**
|
|
251
|
+
* `POST /v1/billing/create-load-session` → a Stripe Checkout page that loads
|
|
252
|
+
* a whole amount (`amountUsd`, within {@link BillingPlansResult.topUpRange})
|
|
253
|
+
* as credits at the packs' rate; `credits` is what it will grant. The card
|
|
254
|
+
* is saved for auto top-up. `returnPath` as in {@link checkout}.
|
|
255
|
+
* **Signed-in session only.**
|
|
256
|
+
*/
|
|
257
|
+
loadCredits(input: BillingLoadInput): Promise<BillingLoadSession>;
|
|
258
|
+
/**
|
|
259
|
+
* `POST /v1/billing/manage-subscription` → a Stripe Customer Portal page
|
|
260
|
+
* (the card, the billing address, the invoices, cancelling): send the person
|
|
261
|
+
* to `url`; `returnPath` is where the portal's Back goes (default the app's
|
|
262
|
+
* `/billing`). `NotFoundError` before a first purchase — Stripe does not
|
|
263
|
+
* know the account yet. **Signed-in session only.**
|
|
264
|
+
*/
|
|
265
|
+
portal(input?: BillingPortalInput): Promise<BillingPortalSession>;
|
|
266
|
+
/**
|
|
267
|
+
* `POST /v1/billing/change-plan` → moves the active subscription to another
|
|
268
|
+
* plan's price (`newPriceId`, a subscription price from the plans list),
|
|
269
|
+
* prorated by Stripe; the new tier applies at once. `NotFoundError` with no
|
|
270
|
+
* active subscription; `400` on a pack's price or the current one.
|
|
271
|
+
* **Signed-in session only.**
|
|
272
|
+
*/
|
|
273
|
+
changePlan(input: BillingChangePlanInput): Promise<BillingChangePlanResult>;
|
|
274
|
+
}
|
|
275
|
+
/** One credit purchase (`billing.purchases()`), as the `transactions` row names it. */
|
|
276
|
+
interface BillingPurchase {
|
|
277
|
+
id: string;
|
|
278
|
+
/** The Stripe payment or subscription id. */
|
|
279
|
+
stripe_transaction_id: string | null;
|
|
280
|
+
/** `"subscription"` (a plan payment), `"topup"` (a credit pack or a load) or `"refund"` (money given back: `credits_granted` negative). */
|
|
281
|
+
type: string;
|
|
282
|
+
/** What was paid, in US dollars (on a refund, the sum given back). */
|
|
283
|
+
amount_usd: number;
|
|
284
|
+
/** Negative on a refund. */
|
|
285
|
+
credits_granted: number;
|
|
286
|
+
/** The plan paid for, on a subscription payment. */
|
|
287
|
+
tier: string | null;
|
|
288
|
+
/** ISO-8601. */
|
|
289
|
+
created_at: string;
|
|
290
|
+
/** Stripe's hosted receipt; `null` when none was captured. */
|
|
291
|
+
receipt_url: string | null;
|
|
292
|
+
}
|
|
293
|
+
/** A payment document: a Stripe invoice (a subscription payment) or a receipt (a credit purchase). */
|
|
294
|
+
interface BillingDocument {
|
|
295
|
+
id: string;
|
|
296
|
+
kind: "invoice" | "receipt";
|
|
297
|
+
/** The invoice number Stripe printed; `null` on a receipt. */
|
|
298
|
+
number: string | null;
|
|
299
|
+
/** ISO-8601. */
|
|
300
|
+
at: string;
|
|
301
|
+
amount: BillingMoney;
|
|
302
|
+
/** The credits the payment granted; `null` on an invoice (the plan's credits come with the period). Negative on a refund. */
|
|
303
|
+
credits: number | null;
|
|
304
|
+
/** `"paid"`, `"open"`, `"void"`, `"uncollectible"`, or `"refunded"` (a receipt for money given back: `amount` and `credits` negative). */
|
|
305
|
+
status: string;
|
|
306
|
+
description: string | null;
|
|
307
|
+
/** The PDF, on an invoice; `null` on a receipt. */
|
|
308
|
+
pdfUrl: string | null;
|
|
309
|
+
/** The hosted page: Stripe's invoice page, or the receipt. */
|
|
310
|
+
url: string | null;
|
|
311
|
+
}
|
|
312
|
+
/** The card on file, as Stripe shows it. */
|
|
313
|
+
interface BillingCard {
|
|
314
|
+
/** `"visa"`, `"mastercard"`, … */
|
|
315
|
+
brand: string;
|
|
316
|
+
last4: string;
|
|
317
|
+
expMonth: number;
|
|
318
|
+
expYear: number;
|
|
319
|
+
}
|
|
320
|
+
/** The name, email and country on file. */
|
|
321
|
+
interface BillingDetails {
|
|
322
|
+
name: string | null;
|
|
323
|
+
email: string | null;
|
|
324
|
+
/** ISO-3166 alpha-2. */
|
|
325
|
+
country: string | null;
|
|
326
|
+
}
|
|
327
|
+
/** The answer of `billing.paymentMethod()`: both `null` before a first purchase. */
|
|
328
|
+
interface BillingPaymentMethod {
|
|
329
|
+
card: BillingCard | null;
|
|
330
|
+
billingDetails: BillingDetails | null;
|
|
331
|
+
}
|
|
332
|
+
/** The automatic top-up setting (`billing.autoRecharge()`). */
|
|
333
|
+
interface BillingAutoRecharge {
|
|
334
|
+
enabled: boolean;
|
|
335
|
+
/** Load when the balance falls under this many credits; `null` when never set. */
|
|
336
|
+
thresholdCredits: number | null;
|
|
337
|
+
/** The whole dollar amount loaded each time; `null` when never set. */
|
|
338
|
+
amountUsd: number | null;
|
|
339
|
+
/** Failed attempts in a row; the server stops trying after a few, until the setting is saved again. */
|
|
340
|
+
failureCount: number;
|
|
341
|
+
/** ISO-8601; `null` before the first attempt. */
|
|
342
|
+
lastAttemptAt: string | null;
|
|
343
|
+
/** Whether a card is saved to charge; without one, enabling cannot work. */
|
|
344
|
+
hasSavedCard: boolean;
|
|
345
|
+
}
|
|
346
|
+
/** What `billing.setAutoRecharge()` sends; `thresholdCredits` and `amountUsd` are both required to enable. */
|
|
347
|
+
interface BillingAutoRechargeInput {
|
|
348
|
+
enabled: boolean;
|
|
349
|
+
thresholdCredits?: number;
|
|
350
|
+
amountUsd?: number;
|
|
351
|
+
}
|
|
352
|
+
/** What `billing.setAutoRecharge()` answers: the fields as sent (`null` for one left out, even when a stored value remains); read {@link BillingResource.autoRecharge} for the whole setting. */
|
|
353
|
+
interface BillingAutoRechargeSaved {
|
|
354
|
+
enabled: boolean;
|
|
355
|
+
thresholdCredits: number | null;
|
|
356
|
+
amountUsd: number | null;
|
|
357
|
+
}
|
|
358
|
+
/** What `billing.checkout()` sends. */
|
|
359
|
+
interface BillingCheckoutInput {
|
|
360
|
+
/** A plan's monthly or yearly price id, or a credit pack's (`BillingTopUp.id`). */
|
|
361
|
+
priceId: string;
|
|
362
|
+
/** Inferred from the price when omitted. */
|
|
363
|
+
mode?: "subscription" | "payment";
|
|
364
|
+
/** A path on the calling origin Stripe brings the person back to (`"/billing"`, a query allowed): one leading `/`, no host, no `#`. Wins over `embedded`. */
|
|
365
|
+
returnPath?: string;
|
|
366
|
+
/** Set by an embedded first-party surface: return to the app's public checkout-complete page. */
|
|
367
|
+
embedded?: boolean;
|
|
368
|
+
}
|
|
369
|
+
/** A Stripe Checkout page to send the person to. */
|
|
370
|
+
interface BillingCheckoutSession {
|
|
371
|
+
url: string | null;
|
|
372
|
+
}
|
|
373
|
+
/** What `billing.loadCredits()` sends. */
|
|
374
|
+
interface BillingLoadInput {
|
|
375
|
+
/** A whole dollar amount within `topUpRange`. */
|
|
376
|
+
amountUsd: number;
|
|
377
|
+
/** As in {@link BillingCheckoutInput.returnPath}; wins over `embedded`. */
|
|
378
|
+
returnPath?: string;
|
|
379
|
+
embedded?: boolean;
|
|
380
|
+
}
|
|
381
|
+
/** A Stripe Checkout page for a load, and the credits it grants. */
|
|
382
|
+
interface BillingLoadSession {
|
|
383
|
+
url: string | null;
|
|
384
|
+
credits: number;
|
|
385
|
+
}
|
|
386
|
+
/** What `billing.portal()` sends. */
|
|
387
|
+
interface BillingPortalInput {
|
|
388
|
+
/** Where the portal's Back goes: a path on the calling origin; default the app's `/billing`. */
|
|
389
|
+
returnPath?: string;
|
|
390
|
+
}
|
|
391
|
+
/** A Stripe Customer Portal page to send the person to. */
|
|
392
|
+
interface BillingPortalSession {
|
|
393
|
+
url: string;
|
|
394
|
+
}
|
|
395
|
+
/** What `billing.changePlan()` sends. */
|
|
396
|
+
interface BillingChangePlanInput {
|
|
397
|
+
/** A subscription price id from the plans list. */
|
|
398
|
+
newPriceId: string;
|
|
399
|
+
}
|
|
400
|
+
/** What `billing.changePlan()` answers. */
|
|
401
|
+
interface BillingChangePlanResult {
|
|
402
|
+
subscriptionId: string;
|
|
403
|
+
/** The plan now in force: `"basic"`, `"standard"`, … */
|
|
404
|
+
tier: string;
|
|
206
405
|
}
|
|
207
406
|
|
|
208
|
-
export { type BillingAccountSummary, type BillingMoney, type BillingMonthlyPrice, type BillingPlan, type BillingPlanPrices, type BillingPlansResult, type BillingPriceCredits, BillingResource, type BillingSubscription, type BillingSubscriptionResult, type BillingSurface, type BillingTopUp, type BillingUsageCategory, type BillingYearlyPrice };
|
|
407
|
+
export { type BillingAccountSummary, type BillingAutoRecharge, type BillingAutoRechargeInput, type BillingAutoRechargeSaved, type BillingCard, type BillingChangePlanInput, type BillingChangePlanResult, type BillingCheckoutInput, type BillingCheckoutSession, type BillingDetails, type BillingDocument, type BillingLoadInput, type BillingLoadSession, type BillingMoney, type BillingMonthlyPrice, type BillingPaymentMethod, type BillingPlan, type BillingPlanPrices, type BillingPlansResult, type BillingPortalInput, type BillingPortalSession, type BillingPriceCredits, type BillingPurchase, BillingResource, type BillingSubscription, type BillingSubscriptionResult, type BillingSurface, type BillingTopUp, type BillingUsageCategory, type BillingYearlyPrice };
|
package/dist/entries/billing.js
CHANGED
package/dist/entries/client.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkHPSENMVN_cjs = require('../chunk-HPSENMVN.cjs');
|
|
4
4
|
require('../chunk-JTOEHQQJ.cjs');
|
|
5
5
|
require('../chunk-W5VHATSR.cjs');
|
|
6
6
|
require('../chunk-R63TTR35.cjs');
|
|
@@ -43,14 +43,14 @@ require('../chunk-43FVH6LJ.cjs');
|
|
|
43
43
|
require('../chunk-YFS2LMG4.cjs');
|
|
44
44
|
require('../chunk-OSMKIRKI.cjs');
|
|
45
45
|
require('../chunk-FRQJNGJS.cjs');
|
|
46
|
-
var
|
|
46
|
+
var chunkOMX7JBGY_cjs = require('../chunk-OMX7JBGY.cjs');
|
|
47
47
|
require('../chunk-FM2KM5TY.cjs');
|
|
48
48
|
require('../chunk-HGCVWOGK.cjs');
|
|
49
|
-
require('../chunk-
|
|
49
|
+
require('../chunk-4BAHF762.cjs');
|
|
50
50
|
require('../chunk-A3S55XGF.cjs');
|
|
51
51
|
require('../chunk-JOXZ4ZIF.cjs');
|
|
52
52
|
require('../chunk-GA4LZZKQ.cjs');
|
|
53
|
-
require('../chunk-
|
|
53
|
+
require('../chunk-6FZN3QQO.cjs');
|
|
54
54
|
require('../chunk-TY2S25W5.cjs');
|
|
55
55
|
require('../chunk-BPWUWUZ3.cjs');
|
|
56
56
|
require('../chunk-HAKYPZLB.cjs');
|
|
@@ -59,23 +59,23 @@ require('../chunk-HAKYPZLB.cjs');
|
|
|
59
59
|
|
|
60
60
|
Object.defineProperty(exports, "NodaroClient", {
|
|
61
61
|
enumerable: true,
|
|
62
|
-
get: function () { return
|
|
62
|
+
get: function () { return chunkHPSENMVN_cjs.NodaroClient; }
|
|
63
63
|
});
|
|
64
64
|
Object.defineProperty(exports, "createClient", {
|
|
65
65
|
enumerable: true,
|
|
66
|
-
get: function () { return
|
|
66
|
+
get: function () { return chunkHPSENMVN_cjs.createClient; }
|
|
67
67
|
});
|
|
68
68
|
Object.defineProperty(exports, "CallbackAuth", {
|
|
69
69
|
enumerable: true,
|
|
70
|
-
get: function () { return
|
|
70
|
+
get: function () { return chunkOMX7JBGY_cjs.CallbackAuth; }
|
|
71
71
|
});
|
|
72
72
|
Object.defineProperty(exports, "StaticTokenAuth", {
|
|
73
73
|
enumerable: true,
|
|
74
|
-
get: function () { return
|
|
74
|
+
get: function () { return chunkOMX7JBGY_cjs.StaticTokenAuth; }
|
|
75
75
|
});
|
|
76
76
|
Object.defineProperty(exports, "supabaseAuth", {
|
|
77
77
|
enumerable: true,
|
|
78
|
-
get: function () { return
|
|
78
|
+
get: function () { return chunkOMX7JBGY_cjs.supabaseAuth; }
|
|
79
79
|
});
|
|
80
80
|
//# sourceMappingURL=client.cjs.map
|
|
81
81
|
//# sourceMappingURL=client.cjs.map
|
package/dist/entries/client.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { NodaroClient, createClient } from '../chunk-
|
|
1
|
+
export { NodaroClient, createClient } from '../chunk-EC6MC46Y.js';
|
|
2
2
|
import '../chunk-WY4QRJZW.js';
|
|
3
3
|
import '../chunk-ERLXU47J.js';
|
|
4
4
|
import '../chunk-T7N7DFQJ.js';
|
|
@@ -41,14 +41,14 @@ import '../chunk-SFB4YLCS.js';
|
|
|
41
41
|
import '../chunk-BU5A6K4C.js';
|
|
42
42
|
import '../chunk-D2ILCSOQ.js';
|
|
43
43
|
import '../chunk-7CUWAVWB.js';
|
|
44
|
-
export { CallbackAuth, StaticTokenAuth, supabaseAuth } from '../chunk-
|
|
44
|
+
export { CallbackAuth, StaticTokenAuth, supabaseAuth } from '../chunk-XISHBW5I.js';
|
|
45
45
|
import '../chunk-L6T44A3G.js';
|
|
46
46
|
import '../chunk-CK3AMMSC.js';
|
|
47
|
-
import '../chunk-
|
|
47
|
+
import '../chunk-7QK2NXJA.js';
|
|
48
48
|
import '../chunk-65E3JBFZ.js';
|
|
49
49
|
import '../chunk-7LODCIQK.js';
|
|
50
50
|
import '../chunk-3QFTP5P5.js';
|
|
51
|
-
import '../chunk-
|
|
51
|
+
import '../chunk-WYYDWJFF.js';
|
|
52
52
|
import '../chunk-OCRUDBPG.js';
|
|
53
53
|
import '../chunk-KG4R454Z.js';
|
|
54
54
|
import '../chunk-EJSGJDZY.js';
|
package/dist/entries/core.cjs
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
require('../chunk-X7XP5WBP.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkOMX7JBGY_cjs = require('../chunk-OMX7JBGY.cjs');
|
|
5
5
|
require('../chunk-FM2KM5TY.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
Object.defineProperty(exports, "CallbackAuth", {
|
|
10
10
|
enumerable: true,
|
|
11
|
-
get: function () { return
|
|
11
|
+
get: function () { return chunkOMX7JBGY_cjs.CallbackAuth; }
|
|
12
12
|
});
|
|
13
13
|
Object.defineProperty(exports, "NodaroClientCore", {
|
|
14
14
|
enumerable: true,
|
|
15
|
-
get: function () { return
|
|
15
|
+
get: function () { return chunkOMX7JBGY_cjs.NodaroClientCore; }
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "StaticTokenAuth", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: function () { return
|
|
19
|
+
get: function () { return chunkOMX7JBGY_cjs.StaticTokenAuth; }
|
|
20
20
|
});
|
|
21
21
|
Object.defineProperty(exports, "supabaseAuth", {
|
|
22
22
|
enumerable: true,
|
|
23
|
-
get: function () { return
|
|
23
|
+
get: function () { return chunkOMX7JBGY_cjs.supabaseAuth; }
|
|
24
24
|
});
|
|
25
25
|
//# sourceMappingURL=core.cjs.map
|
|
26
26
|
//# sourceMappingURL=core.cjs.map
|
package/dist/entries/core.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '../chunk-AUDHV3OE.js';
|
|
2
|
-
export { CallbackAuth, NodaroClientCore, StaticTokenAuth, supabaseAuth } from '../chunk-
|
|
2
|
+
export { CallbackAuth, NodaroClientCore, StaticTokenAuth, supabaseAuth } from '../chunk-XISHBW5I.js';
|
|
3
3
|
import '../chunk-L6T44A3G.js';
|
|
4
4
|
//# sourceMappingURL=core.js.map
|
|
5
5
|
//# sourceMappingURL=core.js.map
|
package/dist/entries/credits.cjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
require('../chunk-ALUUBPDG.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunk4BAHF762_cjs = require('../chunk-4BAHF762.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, "CreditsResource", {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: function () { return
|
|
10
|
+
get: function () { return chunk4BAHF762_cjs.CreditsResource; }
|
|
11
11
|
});
|
|
12
12
|
//# sourceMappingURL=credits.cjs.map
|
|
13
13
|
//# sourceMappingURL=credits.cjs.map
|