@fonderie/react-billing 0.5.0 → 0.7.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/index.cjs +332 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +88 -3
- package/dist/index.d.ts +88 -3
- package/dist/index.js +321 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -20,17 +20,27 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
-
FonderieApiError: () =>
|
|
23
|
+
FonderieApiError: () => import_client18.FonderieApiError,
|
|
24
24
|
useBillingPortal: () => useBillingPortal,
|
|
25
|
+
useCancelSubscription: () => useCancelSubscription,
|
|
25
26
|
useCheckout: () => useCheckout,
|
|
27
|
+
useInvoices: () => useInvoices,
|
|
28
|
+
usePaymentMethod: () => usePaymentMethod,
|
|
26
29
|
usePlan: () => usePlan,
|
|
27
30
|
usePlans: () => usePlans,
|
|
31
|
+
useReactivateSubscription: () => useReactivateSubscription,
|
|
32
|
+
useRemovePaymentMethod: () => useRemovePaymentMethod,
|
|
33
|
+
useSavePaymentMethod: () => useSavePaymentMethod,
|
|
34
|
+
useSetupPaymentMethod: () => useSetupPaymentMethod,
|
|
28
35
|
useSubscription: () => useSubscription,
|
|
29
36
|
useUsage: () => useUsage,
|
|
30
|
-
|
|
37
|
+
useWallet: () => useWallet,
|
|
38
|
+
useWalletCheckout: () => useWalletCheckout,
|
|
39
|
+
useWalletPreferences: () => useWalletPreferences,
|
|
40
|
+
useWalletTransactions: () => useWalletTransactions
|
|
31
41
|
});
|
|
32
42
|
module.exports = __toCommonJS(index_exports);
|
|
33
|
-
var
|
|
43
|
+
var import_client18 = require("@fonderie/client");
|
|
34
44
|
|
|
35
45
|
// src/hooks/useBillingPortal.ts
|
|
36
46
|
var import_client = require("@fonderie/client");
|
|
@@ -318,15 +328,333 @@ function useWalletPreferences(client) {
|
|
|
318
328
|
}, [refresh]);
|
|
319
329
|
return { spendPurchased, isLoading, error, refresh, setSpendPurchased };
|
|
320
330
|
}
|
|
331
|
+
|
|
332
|
+
// src/hooks/useWallet.ts
|
|
333
|
+
var import_client8 = require("@fonderie/client");
|
|
334
|
+
var import_react15 = require("@fonderie/react");
|
|
335
|
+
var import_react16 = require("react");
|
|
336
|
+
function useWallet(client) {
|
|
337
|
+
const billing = (0, import_react15.useFonderieSubClient)(client, (c) => c.billing, "useWallet");
|
|
338
|
+
const [wallet, setWallet] = (0, import_react16.useState)(null);
|
|
339
|
+
const [isLoading, setIsLoading] = (0, import_react16.useState)(true);
|
|
340
|
+
const [error, setError] = (0, import_react16.useState)(null);
|
|
341
|
+
const refresh = (0, import_react16.useCallback)(
|
|
342
|
+
async (opts) => {
|
|
343
|
+
setIsLoading(true);
|
|
344
|
+
setError(null);
|
|
345
|
+
try {
|
|
346
|
+
const { result } = await billing.getWallet({ bust: opts?.force });
|
|
347
|
+
setWallet(result.wallet);
|
|
348
|
+
} catch (err) {
|
|
349
|
+
const apiError = err instanceof import_client8.FonderieApiError ? err : new import_client8.FonderieApiError("unknown", String(err), 0);
|
|
350
|
+
setError(apiError);
|
|
351
|
+
setWallet(null);
|
|
352
|
+
} finally {
|
|
353
|
+
setIsLoading(false);
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
[billing]
|
|
357
|
+
);
|
|
358
|
+
(0, import_react16.useEffect)(() => {
|
|
359
|
+
void refresh();
|
|
360
|
+
}, [refresh]);
|
|
361
|
+
return { wallet, isLoading, error, refresh };
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
// src/hooks/useWalletTransactions.ts
|
|
365
|
+
var import_client9 = require("@fonderie/client");
|
|
366
|
+
var import_react17 = require("@fonderie/react");
|
|
367
|
+
var import_react18 = require("react");
|
|
368
|
+
function useWalletTransactions(client) {
|
|
369
|
+
const billing = (0, import_react17.useFonderieSubClient)(client, (c) => c.billing, "useWalletTransactions");
|
|
370
|
+
const [transactions, setTransactions] = (0, import_react18.useState)([]);
|
|
371
|
+
const [nextCursor, setNextCursor] = (0, import_react18.useState)(null);
|
|
372
|
+
const [isLoading, setIsLoading] = (0, import_react18.useState)(true);
|
|
373
|
+
const [error, setError] = (0, import_react18.useState)(null);
|
|
374
|
+
const refresh = (0, import_react18.useCallback)(
|
|
375
|
+
async (opts) => {
|
|
376
|
+
setIsLoading(true);
|
|
377
|
+
setError(null);
|
|
378
|
+
try {
|
|
379
|
+
const { result } = await billing.getWalletTransactions({ bust: opts?.force });
|
|
380
|
+
setTransactions(result.transactions);
|
|
381
|
+
setNextCursor(result.nextCursor);
|
|
382
|
+
} catch (err) {
|
|
383
|
+
const apiError = err instanceof import_client9.FonderieApiError ? err : new import_client9.FonderieApiError("unknown", String(err), 0);
|
|
384
|
+
setError(apiError);
|
|
385
|
+
} finally {
|
|
386
|
+
setIsLoading(false);
|
|
387
|
+
}
|
|
388
|
+
},
|
|
389
|
+
[billing]
|
|
390
|
+
);
|
|
391
|
+
const loadMore = (0, import_react18.useCallback)(async () => {
|
|
392
|
+
if (!nextCursor) return;
|
|
393
|
+
setError(null);
|
|
394
|
+
try {
|
|
395
|
+
const { result } = await billing.getWalletTransactions({ cursor: nextCursor });
|
|
396
|
+
setTransactions((prev) => [...prev, ...result.transactions]);
|
|
397
|
+
setNextCursor(result.nextCursor);
|
|
398
|
+
} catch (err) {
|
|
399
|
+
const apiError = err instanceof import_client9.FonderieApiError ? err : new import_client9.FonderieApiError("unknown", String(err), 0);
|
|
400
|
+
setError(apiError);
|
|
401
|
+
throw apiError;
|
|
402
|
+
}
|
|
403
|
+
}, [billing, nextCursor]);
|
|
404
|
+
(0, import_react18.useEffect)(() => {
|
|
405
|
+
void refresh();
|
|
406
|
+
}, [refresh]);
|
|
407
|
+
return {
|
|
408
|
+
transactions,
|
|
409
|
+
nextCursor,
|
|
410
|
+
hasMore: nextCursor !== null,
|
|
411
|
+
isLoading,
|
|
412
|
+
error,
|
|
413
|
+
refresh,
|
|
414
|
+
loadMore
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
// src/hooks/useWalletCheckout.ts
|
|
419
|
+
var import_client10 = require("@fonderie/client");
|
|
420
|
+
var import_react19 = require("@fonderie/react");
|
|
421
|
+
var import_react20 = require("react");
|
|
422
|
+
function useWalletCheckout(client) {
|
|
423
|
+
const billing = (0, import_react19.useFonderieSubClient)(client, (c) => c.billing, "useWalletCheckout");
|
|
424
|
+
const [isLoading, setIsLoading] = (0, import_react20.useState)(false);
|
|
425
|
+
const [error, setError] = (0, import_react20.useState)(null);
|
|
426
|
+
const checkout = (0, import_react20.useCallback)(
|
|
427
|
+
async (input) => {
|
|
428
|
+
setIsLoading(true);
|
|
429
|
+
setError(null);
|
|
430
|
+
try {
|
|
431
|
+
const { result } = await billing.createWalletCheckout(input);
|
|
432
|
+
return result.url;
|
|
433
|
+
} catch (err) {
|
|
434
|
+
const apiError = err instanceof import_client10.FonderieApiError ? err : new import_client10.FonderieApiError("unknown", String(err), 0);
|
|
435
|
+
setError(apiError);
|
|
436
|
+
throw apiError;
|
|
437
|
+
} finally {
|
|
438
|
+
setIsLoading(false);
|
|
439
|
+
}
|
|
440
|
+
},
|
|
441
|
+
[billing]
|
|
442
|
+
);
|
|
443
|
+
return { checkout, isLoading, error };
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
// src/hooks/useCancelSubscription.ts
|
|
447
|
+
var import_client11 = require("@fonderie/client");
|
|
448
|
+
var import_react21 = require("@fonderie/react");
|
|
449
|
+
var import_react22 = require("react");
|
|
450
|
+
function useCancelSubscription(client) {
|
|
451
|
+
const billing = (0, import_react21.useFonderieSubClient)(client, (c) => c.billing, "useCancelSubscription");
|
|
452
|
+
const [isLoading, setIsLoading] = (0, import_react22.useState)(false);
|
|
453
|
+
const [error, setError] = (0, import_react22.useState)(null);
|
|
454
|
+
const cancel = (0, import_react22.useCallback)(
|
|
455
|
+
async (input) => {
|
|
456
|
+
setIsLoading(true);
|
|
457
|
+
setError(null);
|
|
458
|
+
try {
|
|
459
|
+
const { result } = await billing.cancelSubscription(input);
|
|
460
|
+
return result;
|
|
461
|
+
} catch (err) {
|
|
462
|
+
const apiError = err instanceof import_client11.FonderieApiError ? err : new import_client11.FonderieApiError("unknown", String(err), 0);
|
|
463
|
+
setError(apiError);
|
|
464
|
+
throw apiError;
|
|
465
|
+
} finally {
|
|
466
|
+
setIsLoading(false);
|
|
467
|
+
}
|
|
468
|
+
},
|
|
469
|
+
[billing]
|
|
470
|
+
);
|
|
471
|
+
return { cancel, isLoading, error };
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
// src/hooks/useReactivateSubscription.ts
|
|
475
|
+
var import_client12 = require("@fonderie/client");
|
|
476
|
+
var import_react23 = require("@fonderie/react");
|
|
477
|
+
var import_react24 = require("react");
|
|
478
|
+
function useReactivateSubscription(client) {
|
|
479
|
+
const billing = (0, import_react23.useFonderieSubClient)(client, (c) => c.billing, "useReactivateSubscription");
|
|
480
|
+
const [isLoading, setIsLoading] = (0, import_react24.useState)(false);
|
|
481
|
+
const [error, setError] = (0, import_react24.useState)(null);
|
|
482
|
+
const reactivate = (0, import_react24.useCallback)(async () => {
|
|
483
|
+
setIsLoading(true);
|
|
484
|
+
setError(null);
|
|
485
|
+
try {
|
|
486
|
+
const { result } = await billing.reactivateSubscription();
|
|
487
|
+
return result;
|
|
488
|
+
} catch (err) {
|
|
489
|
+
const apiError = err instanceof import_client12.FonderieApiError ? err : new import_client12.FonderieApiError("unknown", String(err), 0);
|
|
490
|
+
setError(apiError);
|
|
491
|
+
throw apiError;
|
|
492
|
+
} finally {
|
|
493
|
+
setIsLoading(false);
|
|
494
|
+
}
|
|
495
|
+
}, [billing]);
|
|
496
|
+
return { reactivate, isLoading, error };
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
// src/hooks/usePaymentMethod.ts
|
|
500
|
+
var import_client13 = require("@fonderie/client");
|
|
501
|
+
var import_react25 = require("@fonderie/react");
|
|
502
|
+
var import_react26 = require("react");
|
|
503
|
+
function usePaymentMethod(client) {
|
|
504
|
+
const billing = (0, import_react25.useFonderieSubClient)(client, (c) => c.billing, "usePaymentMethod");
|
|
505
|
+
const [paymentMethod, setPaymentMethod] = (0, import_react26.useState)(null);
|
|
506
|
+
const [isLoading, setIsLoading] = (0, import_react26.useState)(true);
|
|
507
|
+
const [error, setError] = (0, import_react26.useState)(null);
|
|
508
|
+
const refresh = (0, import_react26.useCallback)(
|
|
509
|
+
async (opts) => {
|
|
510
|
+
setIsLoading(true);
|
|
511
|
+
setError(null);
|
|
512
|
+
try {
|
|
513
|
+
const { result } = await billing.getPaymentMethod({ bust: opts?.force });
|
|
514
|
+
setPaymentMethod(result.paymentMethod);
|
|
515
|
+
} catch (err) {
|
|
516
|
+
const apiError = err instanceof import_client13.FonderieApiError ? err : new import_client13.FonderieApiError("unknown", String(err), 0);
|
|
517
|
+
if (apiError.status !== 501) setError(apiError);
|
|
518
|
+
setPaymentMethod(null);
|
|
519
|
+
} finally {
|
|
520
|
+
setIsLoading(false);
|
|
521
|
+
}
|
|
522
|
+
},
|
|
523
|
+
[billing]
|
|
524
|
+
);
|
|
525
|
+
(0, import_react26.useEffect)(() => {
|
|
526
|
+
void refresh();
|
|
527
|
+
}, [refresh]);
|
|
528
|
+
return { paymentMethod, isLoading, error, refresh };
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
// src/hooks/useInvoices.ts
|
|
532
|
+
var import_client14 = require("@fonderie/client");
|
|
533
|
+
var import_react27 = require("@fonderie/react");
|
|
534
|
+
var import_react28 = require("react");
|
|
535
|
+
function useInvoices(client) {
|
|
536
|
+
const billing = (0, import_react27.useFonderieSubClient)(client, (c) => c.billing, "useInvoices");
|
|
537
|
+
const [invoices, setInvoices] = (0, import_react28.useState)([]);
|
|
538
|
+
const [isLoading, setIsLoading] = (0, import_react28.useState)(true);
|
|
539
|
+
const [error, setError] = (0, import_react28.useState)(null);
|
|
540
|
+
const refresh = (0, import_react28.useCallback)(
|
|
541
|
+
async (opts) => {
|
|
542
|
+
setIsLoading(true);
|
|
543
|
+
setError(null);
|
|
544
|
+
try {
|
|
545
|
+
const { result } = await billing.listInvoices({ bust: opts?.force });
|
|
546
|
+
setInvoices(result.invoices);
|
|
547
|
+
} catch (err) {
|
|
548
|
+
const apiError = err instanceof import_client14.FonderieApiError ? err : new import_client14.FonderieApiError("unknown", String(err), 0);
|
|
549
|
+
if (apiError.status !== 501) setError(apiError);
|
|
550
|
+
setInvoices([]);
|
|
551
|
+
} finally {
|
|
552
|
+
setIsLoading(false);
|
|
553
|
+
}
|
|
554
|
+
},
|
|
555
|
+
[billing]
|
|
556
|
+
);
|
|
557
|
+
(0, import_react28.useEffect)(() => {
|
|
558
|
+
void refresh();
|
|
559
|
+
}, [refresh]);
|
|
560
|
+
return { invoices, isLoading, error, refresh };
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
// src/hooks/useSetupPaymentMethod.ts
|
|
564
|
+
var import_client15 = require("@fonderie/client");
|
|
565
|
+
var import_react29 = require("@fonderie/react");
|
|
566
|
+
var import_react30 = require("react");
|
|
567
|
+
function useSetupPaymentMethod(client) {
|
|
568
|
+
const billing = (0, import_react29.useFonderieSubClient)(client, (c) => c.billing, "useSetupPaymentMethod");
|
|
569
|
+
const [isLoading, setIsLoading] = (0, import_react30.useState)(false);
|
|
570
|
+
const [error, setError] = (0, import_react30.useState)(null);
|
|
571
|
+
const setup = (0, import_react30.useCallback)(async () => {
|
|
572
|
+
setIsLoading(true);
|
|
573
|
+
setError(null);
|
|
574
|
+
try {
|
|
575
|
+
const { result } = await billing.setupPaymentMethod();
|
|
576
|
+
return result.clientSecret;
|
|
577
|
+
} catch (err) {
|
|
578
|
+
const apiError = err instanceof import_client15.FonderieApiError ? err : new import_client15.FonderieApiError("unknown", String(err), 0);
|
|
579
|
+
setError(apiError);
|
|
580
|
+
throw apiError;
|
|
581
|
+
} finally {
|
|
582
|
+
setIsLoading(false);
|
|
583
|
+
}
|
|
584
|
+
}, [billing]);
|
|
585
|
+
return { setup, isLoading, error };
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
// src/hooks/useSavePaymentMethod.ts
|
|
589
|
+
var import_client16 = require("@fonderie/client");
|
|
590
|
+
var import_react31 = require("@fonderie/react");
|
|
591
|
+
var import_react32 = require("react");
|
|
592
|
+
function useSavePaymentMethod(client) {
|
|
593
|
+
const billing = (0, import_react31.useFonderieSubClient)(client, (c) => c.billing, "useSavePaymentMethod");
|
|
594
|
+
const [isLoading, setIsLoading] = (0, import_react32.useState)(false);
|
|
595
|
+
const [error, setError] = (0, import_react32.useState)(null);
|
|
596
|
+
const save = (0, import_react32.useCallback)(
|
|
597
|
+
async (paymentMethodId) => {
|
|
598
|
+
setIsLoading(true);
|
|
599
|
+
setError(null);
|
|
600
|
+
try {
|
|
601
|
+
const { result } = await billing.savePaymentMethod({ paymentMethodId });
|
|
602
|
+
return result.paymentMethod;
|
|
603
|
+
} catch (err) {
|
|
604
|
+
const apiError = err instanceof import_client16.FonderieApiError ? err : new import_client16.FonderieApiError("unknown", String(err), 0);
|
|
605
|
+
setError(apiError);
|
|
606
|
+
throw apiError;
|
|
607
|
+
} finally {
|
|
608
|
+
setIsLoading(false);
|
|
609
|
+
}
|
|
610
|
+
},
|
|
611
|
+
[billing]
|
|
612
|
+
);
|
|
613
|
+
return { save, isLoading, error };
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
// src/hooks/useRemovePaymentMethod.ts
|
|
617
|
+
var import_client17 = require("@fonderie/client");
|
|
618
|
+
var import_react33 = require("@fonderie/react");
|
|
619
|
+
var import_react34 = require("react");
|
|
620
|
+
function useRemovePaymentMethod(client) {
|
|
621
|
+
const billing = (0, import_react33.useFonderieSubClient)(client, (c) => c.billing, "useRemovePaymentMethod");
|
|
622
|
+
const [isLoading, setIsLoading] = (0, import_react34.useState)(false);
|
|
623
|
+
const [error, setError] = (0, import_react34.useState)(null);
|
|
624
|
+
const remove = (0, import_react34.useCallback)(async () => {
|
|
625
|
+
setIsLoading(true);
|
|
626
|
+
setError(null);
|
|
627
|
+
try {
|
|
628
|
+
await billing.removePaymentMethod();
|
|
629
|
+
} catch (err) {
|
|
630
|
+
const apiError = err instanceof import_client17.FonderieApiError ? err : new import_client17.FonderieApiError("unknown", String(err), 0);
|
|
631
|
+
setError(apiError);
|
|
632
|
+
throw apiError;
|
|
633
|
+
} finally {
|
|
634
|
+
setIsLoading(false);
|
|
635
|
+
}
|
|
636
|
+
}, [billing]);
|
|
637
|
+
return { remove, isLoading, error };
|
|
638
|
+
}
|
|
321
639
|
// Annotate the CommonJS export names for ESM import in node:
|
|
322
640
|
0 && (module.exports = {
|
|
323
641
|
FonderieApiError,
|
|
324
642
|
useBillingPortal,
|
|
643
|
+
useCancelSubscription,
|
|
325
644
|
useCheckout,
|
|
645
|
+
useInvoices,
|
|
646
|
+
usePaymentMethod,
|
|
326
647
|
usePlan,
|
|
327
648
|
usePlans,
|
|
649
|
+
useReactivateSubscription,
|
|
650
|
+
useRemovePaymentMethod,
|
|
651
|
+
useSavePaymentMethod,
|
|
652
|
+
useSetupPaymentMethod,
|
|
328
653
|
useSubscription,
|
|
329
654
|
useUsage,
|
|
330
|
-
|
|
655
|
+
useWallet,
|
|
656
|
+
useWalletCheckout,
|
|
657
|
+
useWalletPreferences,
|
|
658
|
+
useWalletTransactions
|
|
331
659
|
});
|
|
332
660
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/hooks/useBillingPortal.ts","../src/hooks/useCheckout.ts","../src/hooks/usePlan.ts","../src/hooks/usePlans.ts","../src/hooks/useSubscription.ts","../src/hooks/useUsage.ts","../src/hooks/useWalletPreferences.ts"],"sourcesContent":["export type {\n\tBillingClient,\n\tICheckoutInput,\n\tICreatePlanInput,\n\tIPlanDTO,\n\tIPlanFeature,\n\tIRecordUsageInput,\n\tISubscriptionDTO,\n\tIUpdatePlanInput,\n\tSubscriberType,\n} from '@fonderie/client';\nexport { FonderieApiError } from '@fonderie/client';\nexport type {\n\tIUseBillingPortalReturn,\n\tIUseCheckoutReturn,\n\tIUsePlanReturn,\n\tIUsePlansReturn,\n\tIUseSubscriptionReturn,\n\tIUseUsageReturn,\n\tIUseWalletPreferencesReturn,\n} from './hooks';\nexport {\n\tuseBillingPortal,\n\tuseCheckout,\n\tusePlan,\n\tusePlans,\n\tuseSubscription,\n\tuseUsage,\n\tuseWalletPreferences,\n} from './hooks';\n","import type { BillingClient } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useState } from 'react';\n\nexport interface IUseBillingPortalReturn {\n\topenPortal: () => Promise<string>;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n}\n\nexport function useBillingPortal(client?: BillingClient): IUseBillingPortalReturn {\n\tconst billing = useFonderieSubClient(client, (c) => c.billing, 'useBillingPortal');\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst openPortal = useCallback(async () => {\n\t\tsetIsLoading(true);\n\t\tsetError(null);\n\t\ttry {\n\t\t\tconst { result } = await billing.createPortalSession();\n\t\t\treturn result.url;\n\t\t} catch (err) {\n\t\t\tconst apiError =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\tsetError(apiError);\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tsetIsLoading(false);\n\t\t}\n\t}, [billing]);\n\n\treturn { openPortal, isLoading, error };\n}\n","import type { BillingClient, ICheckoutInput } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useState } from 'react';\n\nexport interface IUseCheckoutReturn {\n\tcheckout: (input: ICheckoutInput) => Promise<string>;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n}\n\nexport function useCheckout(client?: BillingClient): IUseCheckoutReturn {\n\tconst billing = useFonderieSubClient(client, (c) => c.billing, 'useCheckout');\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst checkout = useCallback(\n\t\tasync (input: ICheckoutInput) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.createCheckoutSession(input);\n\t\t\t\treturn result.url;\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[billing],\n\t);\n\n\treturn { checkout, isLoading, error };\n}\n","import type { IPlanDTO } from '@fonderie/client';\nimport { BillingClient, FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useEffect, useState } from 'react';\n\nexport interface IUsePlanReturn {\n\tplan: IPlanDTO | null;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n\trefresh: (opts?: { force?: boolean }) => Promise<void>;\n}\n\nexport function usePlan(planId: string): IUsePlanReturn;\nexport function usePlan(client: BillingClient | undefined, planId: string): IUsePlanReturn;\nexport function usePlan(\n\tclientOrPlanId: BillingClient | string | undefined,\n\tmaybePlanId?: string,\n): IUsePlanReturn {\n\tconst firstIsClient = clientOrPlanId === undefined || clientOrPlanId instanceof BillingClient;\n\tconst explicit = firstIsClient ? (clientOrPlanId as BillingClient | undefined) : undefined;\n\tconst planId = firstIsClient ? (maybePlanId as string) : clientOrPlanId;\n\tconst billing = useFonderieSubClient(explicit, (c) => c.billing, 'usePlan');\n\tconst [plan, setPlan] = useState<IPlanDTO | null>(null);\n\tconst [isLoading, setIsLoading] = useState(true);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst refresh = useCallback(\n\t\tasync (opts?: { force?: boolean }) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.getPlan(planId, { bust: opts?.force });\n\t\t\t\tsetPlan(result.plan);\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[billing, planId],\n\t);\n\n\tuseEffect(() => {\n\t\tvoid refresh();\n\t}, [refresh]);\n\n\treturn { plan, isLoading, error, refresh };\n}\n","import type {\n\tBillingClient,\n\tICreatePlanInput,\n\tIPlanDTO,\n\tIUpdatePlanInput,\n} from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useEffect, useState } from 'react';\n\nexport interface IUsePlansReturn {\n\tplans: IPlanDTO[];\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n\trefresh: (opts?: { force?: boolean }) => Promise<void>;\n\tcreatePlan: (input: ICreatePlanInput) => Promise<IPlanDTO>;\n\tupdatePlan: (planId: string, input: IUpdatePlanInput) => Promise<IPlanDTO>;\n\tdeletePlan: (planId: string) => Promise<void>;\n}\n\nexport function usePlans(client?: BillingClient): IUsePlansReturn {\n\tconst billing = useFonderieSubClient(client, (c) => c.billing, 'usePlans');\n\tconst [plans, setPlans] = useState<IPlanDTO[]>([]);\n\tconst [isLoading, setIsLoading] = useState(true);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst refresh = useCallback(\n\t\tasync (opts?: { force?: boolean }) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.listPlans({ bust: opts?.force });\n\t\t\t\tsetPlans(result.plans);\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[billing],\n\t);\n\n\t// These writes are not auth-gated by @fonderie/billing —\n\t// gate the UI that calls them behind your own admin check before shipping it.\n\tconst createPlan = useCallback(\n\t\tasync (input: ICreatePlanInput) => {\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.createPlan(input);\n\t\t\t\tawait refresh();\n\t\t\t\treturn result.plan;\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t}\n\t\t},\n\t\t[billing, refresh],\n\t);\n\n\tconst updatePlan = useCallback(\n\t\tasync (planId: string, input: IUpdatePlanInput) => {\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.updatePlan(planId, input);\n\t\t\t\tawait refresh();\n\t\t\t\treturn result.plan;\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t}\n\t\t},\n\t\t[billing, refresh],\n\t);\n\n\tconst deletePlan = useCallback(\n\t\tasync (planId: string) => {\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tawait billing.deletePlan(planId);\n\t\t\t\tawait refresh();\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t}\n\t\t},\n\t\t[billing, refresh],\n\t);\n\n\tuseEffect(() => {\n\t\tvoid refresh();\n\t}, [refresh]);\n\n\treturn { plans, isLoading, error, refresh, createPlan, updatePlan, deletePlan };\n}\n","import type { BillingClient, ISubscriptionDTO } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useEffect, useState } from 'react';\n\nexport interface IUseSubscriptionReturn {\n\tsubscription: ISubscriptionDTO | null;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n\trefresh: (opts?: { force?: boolean }) => Promise<void>;\n}\n\nexport function useSubscription(client?: BillingClient): IUseSubscriptionReturn {\n\tconst billing = useFonderieSubClient(client, (c) => c.billing, 'useSubscription');\n\tconst [subscription, setSubscription] = useState<ISubscriptionDTO | null>(null);\n\tconst [isLoading, setIsLoading] = useState(true);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst refresh = useCallback(\n\t\tasync (opts?: { force?: boolean }) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.getSubscription({ bust: opts?.force });\n\t\t\t\tsetSubscription(result.subscription);\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\t// No active subscription is a normal, expected state — not an error banner.\n\t\t\t\tif (apiError.status !== 404) setError(apiError);\n\t\t\t\tsetSubscription(null);\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[billing],\n\t);\n\n\tuseEffect(() => {\n\t\tvoid refresh();\n\t}, [refresh]);\n\n\treturn { subscription, isLoading, error, refresh };\n}\n","import type { IRecordUsageInput } from '@fonderie/client';\nimport { BillingClient, FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useEffect, useState } from 'react';\n\nexport interface IUseUsageReturn {\n\ttotal: number | null;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n\trefresh: (opts?: { force?: boolean }) => Promise<void>;\n\trecordUsage: (input: IRecordUsageInput) => Promise<void>;\n}\n\nexport function useUsage(metric: string): IUseUsageReturn;\nexport function useUsage(client: BillingClient | undefined, metric: string): IUseUsageReturn;\nexport function useUsage(\n\tclientOrMetric: BillingClient | string | undefined,\n\tmaybeMetric?: string,\n): IUseUsageReturn {\n\tconst firstIsClient = clientOrMetric === undefined || clientOrMetric instanceof BillingClient;\n\tconst explicit = firstIsClient ? (clientOrMetric as BillingClient | undefined) : undefined;\n\tconst metric = firstIsClient ? (maybeMetric as string) : clientOrMetric;\n\tconst billing = useFonderieSubClient(explicit, (c) => c.billing, 'useUsage');\n\tconst [total, setTotal] = useState<number | null>(null);\n\tconst [isLoading, setIsLoading] = useState(true);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst refresh = useCallback(\n\t\tasync (opts?: { force?: boolean }) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.getUsage(metric, { bust: opts?.force });\n\t\t\t\tsetTotal(result.total);\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[billing, metric],\n\t);\n\n\tconst recordUsage = useCallback(\n\t\tasync (input: IRecordUsageInput) => {\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tawait billing.recordUsage(input);\n\t\t\t\tawait refresh();\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t}\n\t\t},\n\t\t[billing, refresh],\n\t);\n\n\tuseEffect(() => {\n\t\tvoid refresh();\n\t}, [refresh]);\n\n\treturn { total, isLoading, error, refresh, recordUsage };\n}\n","import { BillingClient, FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useEffect, useState } from 'react';\n\nexport interface IUseWalletPreferencesReturn {\n\t// Per-subscriber toggle: when false, a debit stops at the free allowance and\n\t// never draws down purchased credits. null until the first read resolves; a\n\t// subscriber with no balance row reads the server default (true).\n\tspendPurchased: boolean | null;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n\trefresh: (opts?: { force?: boolean }) => Promise<void>;\n\tsetSpendPurchased: (spendPurchased: boolean) => Promise<void>;\n}\n\nexport function useWalletPreferences(client?: BillingClient): IUseWalletPreferencesReturn {\n\tconst billing = useFonderieSubClient(client, (c) => c.billing, 'useWalletPreferences');\n\tconst [spendPurchased, setSpend] = useState<boolean | null>(null);\n\tconst [isLoading, setIsLoading] = useState(true);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst refresh = useCallback(\n\t\tasync (opts?: { force?: boolean }) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.getWallet({ bust: opts?.force });\n\t\t\t\t// The DTO omits spendPurchased when no balance row exists; surface the\n\t\t\t\t// server default (spend_purchased DEFAULT true) rather than null.\n\t\t\t\tsetSpend(result.wallet.spendPurchased ?? true);\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[billing],\n\t);\n\n\tconst setSpendPurchased = useCallback(\n\t\tasync (next: boolean) => {\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\t// The toggle route returns the refreshed wallet, so adopt it directly.\n\t\t\t\tconst { result } = await billing.setWalletPreferences({ spendPurchased: next });\n\t\t\t\tsetSpend(result.wallet.spendPurchased ?? next);\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t}\n\t\t},\n\t\t[billing],\n\t);\n\n\tuseEffect(() => {\n\t\tvoid refresh();\n\t}, [refresh]);\n\n\treturn { spendPurchased, isLoading, error, refresh, setSpendPurchased };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWA,IAAAA,iBAAiC;;;ACVjC,oBAAiC;AACjC,mBAAqC;AACrC,IAAAC,gBAAsC;AAQ/B,SAAS,iBAAiB,QAAiD;AACjF,QAAM,cAAU,mCAAqB,QAAQ,CAAC,MAAM,EAAE,SAAS,kBAAkB;AACjF,QAAM,CAAC,WAAW,YAAY,QAAI,wBAAS,KAAK;AAChD,QAAM,CAAC,OAAO,QAAQ,QAAI,wBAAkC,IAAI;AAEhE,QAAM,iBAAa,2BAAY,YAAY;AAC1C,iBAAa,IAAI;AACjB,aAAS,IAAI;AACb,QAAI;AACH,YAAM,EAAE,OAAO,IAAI,MAAM,QAAQ,oBAAoB;AACrD,aAAO,OAAO;AAAA,IACf,SAAS,KAAK;AACb,YAAM,WACL,eAAe,iCAAmB,MAAM,IAAI,+BAAiB,WAAW,OAAO,GAAG,GAAG,CAAC;AACvF,eAAS,QAAQ;AACjB,YAAM;AAAA,IACP,UAAE;AACD,mBAAa,KAAK;AAAA,IACnB;AAAA,EACD,GAAG,CAAC,OAAO,CAAC;AAEZ,SAAO,EAAE,YAAY,WAAW,MAAM;AACvC;;;AChCA,IAAAC,iBAAiC;AACjC,IAAAC,gBAAqC;AACrC,IAAAA,gB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AACb,UAAI;AACH,cAAM,EAAE,OAAO,IAAI,MAAM,QAAQ,UAAU,EAAE,MAAM,MAAM,MAAM,CAAC;AAGhE,iBAAS,OAAO,OAAO,kBAAkB,IAAI;AAAA,MAC9C,SAAS,KAAK;AACb,cAAM,WACL,eAAe,kCAAmB,MAAM,IAAI,gCAAiB,WAAW,OAAO,GAAG,GAAG,CAAC;AACvF,iBAAS,QAAQ;AAAA,MAClB,UAAE;AACD,qBAAa,KAAK;AAAA,MACnB;AAAA,IACD;AAAA,IACA,CAAC,OAAO;AAAA,EACT;AAEA,QAAM,wBAAoB;AAAA,IACzB,OAAO,SAAkB;AACxB,eAAS,IAAI;AACb,UAAI;AAEH,cAAM,EAAE,OAAO,IAAI,MAAM,QAAQ,qBAAqB,EAAE,gBAAgB,KAAK,CAAC;AAC9E,iBAAS,OAAO,OAAO,kBAAkB,IAAI;AAAA,MAC9C,SAAS,KAAK;AACb,cAAM,WACL,eAAe,kCAAmB,MAAM,IAAI,gCAAiB,WAAW,OAAO,GAAG,GAAG,CAAC;AACvF,iBAAS,QAAQ;AACjB,cAAM;AAAA,MACP;AAAA,IACD;AAAA,IACA,CAAC,OAAO;AAAA,EACT;AAEA,gCAAU,MAAM;AACf,SAAK,QAAQ;AAAA,EACd,GAAG,CAAC,OAAO,CAAC;AAEZ,SAAO,EAAE,gBAAgB,WAAW,OAAO,SAAS,kBAAkB;AACvE;","names":["import_client","import_react","import_client","import_react","import_client","import_react","import_client","import_react","import_client","import_react","import_client","import_react","import_client","import_react"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/hooks/useBillingPortal.ts","../src/hooks/useCheckout.ts","../src/hooks/usePlan.ts","../src/hooks/usePlans.ts","../src/hooks/useSubscription.ts","../src/hooks/useUsage.ts","../src/hooks/useWalletPreferences.ts","../src/hooks/useWallet.ts","../src/hooks/useWalletTransactions.ts","../src/hooks/useWalletCheckout.ts","../src/hooks/useCancelSubscription.ts","../src/hooks/useReactivateSubscription.ts","../src/hooks/usePaymentMethod.ts","../src/hooks/useInvoices.ts","../src/hooks/useSetupPaymentMethod.ts","../src/hooks/useSavePaymentMethod.ts","../src/hooks/useRemovePaymentMethod.ts"],"sourcesContent":["export type {\n\tBillingClient,\n\tICancelSubscriptionInput,\n\tICheckoutInput,\n\tICreatePlanInput,\n\tIInvoiceDTO,\n\tIPaymentMethodDTO,\n\tIPlanDTO,\n\tIPlanFeature,\n\tIRecordUsageInput,\n\tISubscriptionChangeResult,\n\tISubscriptionDTO,\n\tIUpdatePlanInput,\n\tIWalletCheckoutInput,\n\tIWalletDTO,\n\tIWalletTransactionDTO,\n\tSubscriberType,\n} from '@fonderie/client';\nexport { FonderieApiError } from '@fonderie/client';\nexport type {\n\tIUseBillingPortalReturn,\n\tIUseCancelSubscriptionReturn,\n\tIUseCheckoutReturn,\n\tIUseInvoicesReturn,\n\tIUsePaymentMethodReturn,\n\tIUsePlanReturn,\n\tIUsePlansReturn,\n\tIUseReactivateSubscriptionReturn,\n\tIUseRemovePaymentMethodReturn,\n\tIUseSavePaymentMethodReturn,\n\tIUseSetupPaymentMethodReturn,\n\tIUseSubscriptionReturn,\n\tIUseUsageReturn,\n\tIUseWalletCheckoutReturn,\n\tIUseWalletPreferencesReturn,\n\tIUseWalletReturn,\n\tIUseWalletTransactionsReturn,\n} from './hooks';\nexport {\n\tuseBillingPortal,\n\tuseCancelSubscription,\n\tuseCheckout,\n\tuseInvoices,\n\tusePaymentMethod,\n\tusePlan,\n\tusePlans,\n\tuseReactivateSubscription,\n\tuseRemovePaymentMethod,\n\tuseSavePaymentMethod,\n\tuseSetupPaymentMethod,\n\tuseSubscription,\n\tuseUsage,\n\tuseWallet,\n\tuseWalletCheckout,\n\tuseWalletPreferences,\n\tuseWalletTransactions,\n} from './hooks';\n","import type { BillingClient } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useState } from 'react';\n\nexport interface IUseBillingPortalReturn {\n\topenPortal: () => Promise<string>;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n}\n\nexport function useBillingPortal(client?: BillingClient): IUseBillingPortalReturn {\n\tconst billing = useFonderieSubClient(client, (c) => c.billing, 'useBillingPortal');\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst openPortal = useCallback(async () => {\n\t\tsetIsLoading(true);\n\t\tsetError(null);\n\t\ttry {\n\t\t\tconst { result } = await billing.createPortalSession();\n\t\t\treturn result.url;\n\t\t} catch (err) {\n\t\t\tconst apiError =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\tsetError(apiError);\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tsetIsLoading(false);\n\t\t}\n\t}, [billing]);\n\n\treturn { openPortal, isLoading, error };\n}\n","import type { BillingClient, ICheckoutInput } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useState } from 'react';\n\nexport interface IUseCheckoutReturn {\n\tcheckout: (input: ICheckoutInput) => Promise<string>;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n}\n\nexport function useCheckout(client?: BillingClient): IUseCheckoutReturn {\n\tconst billing = useFonderieSubClient(client, (c) => c.billing, 'useCheckout');\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst checkout = useCallback(\n\t\tasync (input: ICheckoutInput) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.createCheckoutSession(input);\n\t\t\t\treturn result.url;\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[billing],\n\t);\n\n\treturn { checkout, isLoading, error };\n}\n","import type { IPlanDTO } from '@fonderie/client';\nimport { BillingClient, FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useEffect, useState } from 'react';\n\nexport interface IUsePlanReturn {\n\tplan: IPlanDTO | null;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n\trefresh: (opts?: { force?: boolean }) => Promise<void>;\n}\n\nexport function usePlan(planId: string): IUsePlanReturn;\nexport function usePlan(client: BillingClient | undefined, planId: string): IUsePlanReturn;\nexport function usePlan(\n\tclientOrPlanId: BillingClient | string | undefined,\n\tmaybePlanId?: string,\n): IUsePlanReturn {\n\tconst firstIsClient = clientOrPlanId === undefined || clientOrPlanId instanceof BillingClient;\n\tconst explicit = firstIsClient ? (clientOrPlanId as BillingClient | undefined) : undefined;\n\tconst planId = firstIsClient ? (maybePlanId as string) : clientOrPlanId;\n\tconst billing = useFonderieSubClient(explicit, (c) => c.billing, 'usePlan');\n\tconst [plan, setPlan] = useState<IPlanDTO | null>(null);\n\tconst [isLoading, setIsLoading] = useState(true);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst refresh = useCallback(\n\t\tasync (opts?: { force?: boolean }) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.getPlan(planId, { bust: opts?.force });\n\t\t\t\tsetPlan(result.plan);\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[billing, planId],\n\t);\n\n\tuseEffect(() => {\n\t\tvoid refresh();\n\t}, [refresh]);\n\n\treturn { plan, isLoading, error, refresh };\n}\n","import type {\n\tBillingClient,\n\tICreatePlanInput,\n\tIPlanDTO,\n\tIUpdatePlanInput,\n} from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useEffect, useState } from 'react';\n\nexport interface IUsePlansReturn {\n\tplans: IPlanDTO[];\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n\trefresh: (opts?: { force?: boolean }) => Promise<void>;\n\tcreatePlan: (input: ICreatePlanInput) => Promise<IPlanDTO>;\n\tupdatePlan: (planId: string, input: IUpdatePlanInput) => Promise<IPlanDTO>;\n\tdeletePlan: (planId: string) => Promise<void>;\n}\n\nexport function usePlans(client?: BillingClient): IUsePlansReturn {\n\tconst billing = useFonderieSubClient(client, (c) => c.billing, 'usePlans');\n\tconst [plans, setPlans] = useState<IPlanDTO[]>([]);\n\tconst [isLoading, setIsLoading] = useState(true);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst refresh = useCallback(\n\t\tasync (opts?: { force?: boolean }) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.listPlans({ bust: opts?.force });\n\t\t\t\tsetPlans(result.plans);\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[billing],\n\t);\n\n\t// These writes are not auth-gated by @fonderie/billing —\n\t// gate the UI that calls them behind your own admin check before shipping it.\n\tconst createPlan = useCallback(\n\t\tasync (input: ICreatePlanInput) => {\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.createPlan(input);\n\t\t\t\tawait refresh();\n\t\t\t\treturn result.plan;\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t}\n\t\t},\n\t\t[billing, refresh],\n\t);\n\n\tconst updatePlan = useCallback(\n\t\tasync (planId: string, input: IUpdatePlanInput) => {\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.updatePlan(planId, input);\n\t\t\t\tawait refresh();\n\t\t\t\treturn result.plan;\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t}\n\t\t},\n\t\t[billing, refresh],\n\t);\n\n\tconst deletePlan = useCallback(\n\t\tasync (planId: string) => {\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tawait billing.deletePlan(planId);\n\t\t\t\tawait refresh();\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t}\n\t\t},\n\t\t[billing, refresh],\n\t);\n\n\tuseEffect(() => {\n\t\tvoid refresh();\n\t}, [refresh]);\n\n\treturn { plans, isLoading, error, refresh, createPlan, updatePlan, deletePlan };\n}\n","import type { BillingClient, ISubscriptionDTO } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useEffect, useState } from 'react';\n\nexport interface IUseSubscriptionReturn {\n\tsubscription: ISubscriptionDTO | null;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n\trefresh: (opts?: { force?: boolean }) => Promise<void>;\n}\n\nexport function useSubscription(client?: BillingClient): IUseSubscriptionReturn {\n\tconst billing = useFonderieSubClient(client, (c) => c.billing, 'useSubscription');\n\tconst [subscription, setSubscription] = useState<ISubscriptionDTO | null>(null);\n\tconst [isLoading, setIsLoading] = useState(true);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst refresh = useCallback(\n\t\tasync (opts?: { force?: boolean }) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.getSubscription({ bust: opts?.force });\n\t\t\t\tsetSubscription(result.subscription);\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\t// No active subscription is a normal, expected state — not an error banner.\n\t\t\t\tif (apiError.status !== 404) setError(apiError);\n\t\t\t\tsetSubscription(null);\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[billing],\n\t);\n\n\tuseEffect(() => {\n\t\tvoid refresh();\n\t}, [refresh]);\n\n\treturn { subscription, isLoading, error, refresh };\n}\n","import type { IRecordUsageInput } from '@fonderie/client';\nimport { BillingClient, FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useEffect, useState } from 'react';\n\nexport interface IUseUsageReturn {\n\ttotal: number | null;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n\trefresh: (opts?: { force?: boolean }) => Promise<void>;\n\trecordUsage: (input: IRecordUsageInput) => Promise<void>;\n}\n\nexport function useUsage(metric: string): IUseUsageReturn;\nexport function useUsage(client: BillingClient | undefined, metric: string): IUseUsageReturn;\nexport function useUsage(\n\tclientOrMetric: BillingClient | string | undefined,\n\tmaybeMetric?: string,\n): IUseUsageReturn {\n\tconst firstIsClient = clientOrMetric === undefined || clientOrMetric instanceof BillingClient;\n\tconst explicit = firstIsClient ? (clientOrMetric as BillingClient | undefined) : undefined;\n\tconst metric = firstIsClient ? (maybeMetric as string) : clientOrMetric;\n\tconst billing = useFonderieSubClient(explicit, (c) => c.billing, 'useUsage');\n\tconst [total, setTotal] = useState<number | null>(null);\n\tconst [isLoading, setIsLoading] = useState(true);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst refresh = useCallback(\n\t\tasync (opts?: { force?: boolean }) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.getUsage(metric, { bust: opts?.force });\n\t\t\t\tsetTotal(result.total);\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[billing, metric],\n\t);\n\n\tconst recordUsage = useCallback(\n\t\tasync (input: IRecordUsageInput) => {\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tawait billing.recordUsage(input);\n\t\t\t\tawait refresh();\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t}\n\t\t},\n\t\t[billing, refresh],\n\t);\n\n\tuseEffect(() => {\n\t\tvoid refresh();\n\t}, [refresh]);\n\n\treturn { total, isLoading, error, refresh, recordUsage };\n}\n","import { BillingClient, FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useEffect, useState } from 'react';\n\nexport interface IUseWalletPreferencesReturn {\n\t// Per-subscriber toggle: when false, a debit stops at the free allowance and\n\t// never draws down purchased credits. null until the first read resolves; a\n\t// subscriber with no balance row reads the server default (true).\n\tspendPurchased: boolean | null;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n\trefresh: (opts?: { force?: boolean }) => Promise<void>;\n\tsetSpendPurchased: (spendPurchased: boolean) => Promise<void>;\n}\n\nexport function useWalletPreferences(client?: BillingClient): IUseWalletPreferencesReturn {\n\tconst billing = useFonderieSubClient(client, (c) => c.billing, 'useWalletPreferences');\n\tconst [spendPurchased, setSpend] = useState<boolean | null>(null);\n\tconst [isLoading, setIsLoading] = useState(true);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst refresh = useCallback(\n\t\tasync (opts?: { force?: boolean }) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.getWallet({ bust: opts?.force });\n\t\t\t\t// The DTO omits spendPurchased when no balance row exists; surface the\n\t\t\t\t// server default (spend_purchased DEFAULT true) rather than null.\n\t\t\t\tsetSpend(result.wallet.spendPurchased ?? true);\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[billing],\n\t);\n\n\tconst setSpendPurchased = useCallback(\n\t\tasync (next: boolean) => {\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\t// The toggle route returns the refreshed wallet, so adopt it directly.\n\t\t\t\tconst { result } = await billing.setWalletPreferences({ spendPurchased: next });\n\t\t\t\tsetSpend(result.wallet.spendPurchased ?? next);\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t}\n\t\t},\n\t\t[billing],\n\t);\n\n\tuseEffect(() => {\n\t\tvoid refresh();\n\t}, [refresh]);\n\n\treturn { spendPurchased, isLoading, error, refresh, setSpendPurchased };\n}\n","import type { BillingClient, IWalletDTO } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useEffect, useState } from 'react';\n\nexport interface IUseWalletReturn {\n\t// The balance snapshot. Money fields are digit strings (server bigint →\n\t// string); null until the first read resolves or after a failed read.\n\twallet: IWalletDTO | null;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n\trefresh: (opts?: { force?: boolean }) => Promise<void>;\n}\n\n// The subscriber's stored-value wallet balance. Reads GET /billing/wallet, so\n// it reflects the periodic grant withBilling applies on every authed request.\nexport function useWallet(client?: BillingClient): IUseWalletReturn {\n\tconst billing = useFonderieSubClient(client, (c) => c.billing, 'useWallet');\n\tconst [wallet, setWallet] = useState<IWalletDTO | null>(null);\n\tconst [isLoading, setIsLoading] = useState(true);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst refresh = useCallback(\n\t\tasync (opts?: { force?: boolean }) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.getWallet({ bust: opts?.force });\n\t\t\t\tsetWallet(result.wallet);\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tsetWallet(null);\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[billing],\n\t);\n\n\tuseEffect(() => {\n\t\tvoid refresh();\n\t}, [refresh]);\n\n\treturn { wallet, isLoading, error, refresh };\n}\n","import type { BillingClient, IWalletTransactionDTO } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useEffect, useState } from 'react';\n\nexport interface IUseWalletTransactionsReturn {\n\ttransactions: IWalletTransactionDTO[];\n\t// Opaque cursor for the next page, or null when the ledger is exhausted.\n\tnextCursor: string | null;\n\thasMore: boolean;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n\trefresh: (opts?: { force?: boolean }) => Promise<void>;\n\t// Appends the next page. No-op when there is no further page.\n\tloadMore: () => Promise<void>;\n}\n\n// The wallet ledger, newest first — every credit/debit with a running\n// balanceAfter. Cursor-paginated: `loadMore` appends the next page.\nexport function useWalletTransactions(client?: BillingClient): IUseWalletTransactionsReturn {\n\tconst billing = useFonderieSubClient(client, (c) => c.billing, 'useWalletTransactions');\n\tconst [transactions, setTransactions] = useState<IWalletTransactionDTO[]>([]);\n\tconst [nextCursor, setNextCursor] = useState<string | null>(null);\n\tconst [isLoading, setIsLoading] = useState(true);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst refresh = useCallback(\n\t\tasync (opts?: { force?: boolean }) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.getWalletTransactions({ bust: opts?.force });\n\t\t\t\tsetTransactions(result.transactions);\n\t\t\t\tsetNextCursor(result.nextCursor);\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[billing],\n\t);\n\n\tconst loadMore = useCallback(async () => {\n\t\tif (!nextCursor) return;\n\t\tsetError(null);\n\t\ttry {\n\t\t\tconst { result } = await billing.getWalletTransactions({ cursor: nextCursor });\n\t\t\tsetTransactions((prev) => [...prev, ...result.transactions]);\n\t\t\tsetNextCursor(result.nextCursor);\n\t\t} catch (err) {\n\t\t\tconst apiError =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\tsetError(apiError);\n\t\t\tthrow apiError;\n\t\t}\n\t}, [billing, nextCursor]);\n\n\tuseEffect(() => {\n\t\tvoid refresh();\n\t}, [refresh]);\n\n\treturn {\n\t\ttransactions,\n\t\tnextCursor,\n\t\thasMore: nextCursor !== null,\n\t\tisLoading,\n\t\terror,\n\t\trefresh,\n\t\tloadMore,\n\t};\n}\n","import type { BillingClient, IWalletCheckoutInput } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useState } from 'react';\n\nexport interface IUseWalletCheckoutReturn {\n\t// Starts a one-time credit-pack purchase and resolves to the hosted checkout\n\t// URL to redirect the buyer to; the wallet is credited by the payment webhook.\n\tcheckout: (input: IWalletCheckoutInput) => Promise<string>;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n}\n\nexport function useWalletCheckout(client?: BillingClient): IUseWalletCheckoutReturn {\n\tconst billing = useFonderieSubClient(client, (c) => c.billing, 'useWalletCheckout');\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst checkout = useCallback(\n\t\tasync (input: IWalletCheckoutInput) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.createWalletCheckout(input);\n\t\t\t\treturn result.url;\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[billing],\n\t);\n\n\treturn { checkout, isLoading, error };\n}\n","import type {\n\tBillingClient,\n\tICancelSubscriptionInput,\n\tISubscriptionChangeResult,\n} from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useState } from 'react';\n\nexport interface IUseCancelSubscriptionReturn {\n\t// First-party cancel — no billing-portal round-trip. Default keeps access\n\t// until the paid-through date; pass { atPeriodEnd: false } to end it now.\n\t// Resolves to the new lifecycle state ({ atPeriodEnd, status, currentPeriodEnd }).\n\tcancel: (input?: ICancelSubscriptionInput) => Promise<ISubscriptionChangeResult>;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n}\n\nexport function useCancelSubscription(client?: BillingClient): IUseCancelSubscriptionReturn {\n\tconst billing = useFonderieSubClient(client, (c) => c.billing, 'useCancelSubscription');\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst cancel = useCallback(\n\t\tasync (input?: ICancelSubscriptionInput) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.cancelSubscription(input);\n\t\t\t\treturn result;\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[billing],\n\t);\n\n\treturn { cancel, isLoading, error };\n}\n","import type { BillingClient, ISubscriptionChangeResult } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useState } from 'react';\n\nexport interface IUseReactivateSubscriptionReturn {\n\t// Un-cancel a subscription scheduled to cancel at period end. Resolves to the\n\t// new lifecycle state; rejects (409) if the subscription is already fully\n\t// canceled — the caller should start a fresh checkout in that case.\n\treactivate: () => Promise<ISubscriptionChangeResult>;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n}\n\nexport function useReactivateSubscription(client?: BillingClient): IUseReactivateSubscriptionReturn {\n\tconst billing = useFonderieSubClient(client, (c) => c.billing, 'useReactivateSubscription');\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst reactivate = useCallback(async () => {\n\t\tsetIsLoading(true);\n\t\tsetError(null);\n\t\ttry {\n\t\t\tconst { result } = await billing.reactivateSubscription();\n\t\t\treturn result;\n\t\t} catch (err) {\n\t\t\tconst apiError =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\tsetError(apiError);\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tsetIsLoading(false);\n\t\t}\n\t}, [billing]);\n\n\treturn { reactivate, isLoading, error };\n}\n","import type { BillingClient, IPaymentMethodDTO } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useEffect, useState } from 'react';\n\nexport interface IUsePaymentMethodReturn {\n\t// The card on file (brand/last4/expiry), or null when none is stored or the\n\t// provider can't retrieve one (a normal \"no card\" state, not an error).\n\tpaymentMethod: IPaymentMethodDTO | null;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n\trefresh: (opts?: { force?: boolean }) => Promise<void>;\n}\n\n// The subscriber's card on file, for a billing page. Reads GET\n// /billing/payment-method.\nexport function usePaymentMethod(client?: BillingClient): IUsePaymentMethodReturn {\n\tconst billing = useFonderieSubClient(client, (c) => c.billing, 'usePaymentMethod');\n\tconst [paymentMethod, setPaymentMethod] = useState<IPaymentMethodDTO | null>(null);\n\tconst [isLoading, setIsLoading] = useState(true);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst refresh = useCallback(\n\t\tasync (opts?: { force?: boolean }) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.getPaymentMethod({ bust: opts?.force });\n\t\t\t\tsetPaymentMethod(result.paymentMethod);\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\t// 501 = the provider can't retrieve a card — a normal \"no card on\n\t\t\t\t// file\" state for a UI, not an error banner.\n\t\t\t\tif (apiError.status !== 501) setError(apiError);\n\t\t\t\tsetPaymentMethod(null);\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[billing],\n\t);\n\n\tuseEffect(() => {\n\t\tvoid refresh();\n\t}, [refresh]);\n\n\treturn { paymentMethod, isLoading, error, refresh };\n}\n","import type { BillingClient, IInvoiceDTO } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useEffect, useState } from 'react';\n\nexport interface IUseInvoicesReturn {\n\t// Invoices newest first; each links out via hostedInvoiceUrl/invoicePdf.\n\tinvoices: IInvoiceDTO[];\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n\trefresh: (opts?: { force?: boolean }) => Promise<void>;\n}\n\n// The subscriber's invoice history, for a billing page. Reads GET\n// /billing/invoices.\nexport function useInvoices(client?: BillingClient): IUseInvoicesReturn {\n\tconst billing = useFonderieSubClient(client, (c) => c.billing, 'useInvoices');\n\tconst [invoices, setInvoices] = useState<IInvoiceDTO[]>([]);\n\tconst [isLoading, setIsLoading] = useState(true);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst refresh = useCallback(\n\t\tasync (opts?: { force?: boolean }) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.listInvoices({ bust: opts?.force });\n\t\t\t\tsetInvoices(result.invoices);\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\t// 501 = the provider can't list invoices — a normal \"no invoices\" state.\n\t\t\t\tif (apiError.status !== 501) setError(apiError);\n\t\t\t\tsetInvoices([]);\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[billing],\n\t);\n\n\tuseEffect(() => {\n\t\tvoid refresh();\n\t}, [refresh]);\n\n\treturn { invoices, isLoading, error, refresh };\n}\n","import type { BillingClient } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useState } from 'react';\n\nexport interface IUseSetupPaymentMethodReturn {\n\t// Begin in-app card entry — resolves to the provider SetupIntent client secret\n\t// the embedded card element (Stripe Payment Element) confirms. No redirect;\n\t// the user never leaves the site. 501 when the provider has no in-app support.\n\tsetup: () => Promise<string>;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n}\n\nexport function useSetupPaymentMethod(client?: BillingClient): IUseSetupPaymentMethodReturn {\n\tconst billing = useFonderieSubClient(client, (c) => c.billing, 'useSetupPaymentMethod');\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst setup = useCallback(async () => {\n\t\tsetIsLoading(true);\n\t\tsetError(null);\n\t\ttry {\n\t\t\tconst { result } = await billing.setupPaymentMethod();\n\t\t\treturn result.clientSecret;\n\t\t} catch (err) {\n\t\t\tconst apiError =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\tsetError(apiError);\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tsetIsLoading(false);\n\t\t}\n\t}, [billing]);\n\n\treturn { setup, isLoading, error };\n}\n","import type { BillingClient, IPaymentMethodDTO } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useState } from 'react';\n\nexport interface IUseSavePaymentMethodReturn {\n\t// Save the card after the Payment Element confirms the SetupIntent: makes it\n\t// the default and records it. Resolves to the saved card for display; rejects\n\t// (422) if the card isn't attached to this customer.\n\tsave: (paymentMethodId: string) => Promise<IPaymentMethodDTO | null>;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n}\n\nexport function useSavePaymentMethod(client?: BillingClient): IUseSavePaymentMethodReturn {\n\tconst billing = useFonderieSubClient(client, (c) => c.billing, 'useSavePaymentMethod');\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst save = useCallback(\n\t\tasync (paymentMethodId: string) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.savePaymentMethod({ paymentMethodId });\n\t\t\t\treturn result.paymentMethod;\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[billing],\n\t);\n\n\treturn { save, isLoading, error };\n}\n","import type { BillingClient } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useState } from 'react';\n\nexport interface IUseRemovePaymentMethodReturn {\n\t// Remove the saved card (detach at the provider + clear the record).\n\tremove: () => Promise<void>;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n}\n\nexport function useRemovePaymentMethod(client?: BillingClient): IUseRemovePaymentMethodReturn {\n\tconst billing = useFonderieSubClient(client, (c) => c.billing, 'useRemovePaymentMethod');\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst remove = useCallback(async () => {\n\t\tsetIsLoading(true);\n\t\tsetError(null);\n\t\ttry {\n\t\t\tawait billing.removePaymentMethod();\n\t\t} catch (err) {\n\t\t\tconst apiError =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\tsetError(apiError);\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tsetIsLoading(false);\n\t\t}\n\t}, [billing]);\n\n\treturn { remove, isLoading, error };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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AAM;AACnC;","names":["import_client","import_react","import_client","import_react","import_client","import_react","import_client","import_react","import_client","import_react","import_client","import_react","import_client","import_react","import_client","import_react","import_client","import_react","import_client","import_react","import_client","import_react","import_client","import_react","import_client","import_react","import_client","import_react","import_client","import_react","import_client","import_react","import_client","import_react"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FonderieApiError, BillingClient, ICheckoutInput, IPlanDTO, ICreatePlanInput, IUpdatePlanInput, ISubscriptionDTO, IRecordUsageInput } from '@fonderie/client';
|
|
2
|
-
export { BillingClient, FonderieApiError, ICheckoutInput, ICreatePlanInput, IPlanDTO, IPlanFeature, IRecordUsageInput, ISubscriptionDTO, IUpdatePlanInput, SubscriberType } from '@fonderie/client';
|
|
1
|
+
import { FonderieApiError, BillingClient, ICheckoutInput, IPlanDTO, ICreatePlanInput, IUpdatePlanInput, ISubscriptionDTO, IRecordUsageInput, IWalletDTO, IWalletTransactionDTO, IWalletCheckoutInput, ICancelSubscriptionInput, ISubscriptionChangeResult, IPaymentMethodDTO, IInvoiceDTO } from '@fonderie/client';
|
|
2
|
+
export { BillingClient, FonderieApiError, ICancelSubscriptionInput, ICheckoutInput, ICreatePlanInput, IInvoiceDTO, IPaymentMethodDTO, IPlanDTO, IPlanFeature, IRecordUsageInput, ISubscriptionChangeResult, ISubscriptionDTO, IUpdatePlanInput, IWalletCheckoutInput, IWalletDTO, IWalletTransactionDTO, SubscriberType } from '@fonderie/client';
|
|
3
3
|
|
|
4
4
|
interface IUseBillingPortalReturn {
|
|
5
5
|
openPortal: () => Promise<string>;
|
|
@@ -72,4 +72,89 @@ interface IUseWalletPreferencesReturn {
|
|
|
72
72
|
}
|
|
73
73
|
declare function useWalletPreferences(client?: BillingClient): IUseWalletPreferencesReturn;
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
interface IUseWalletReturn {
|
|
76
|
+
wallet: IWalletDTO | null;
|
|
77
|
+
isLoading: boolean;
|
|
78
|
+
error: FonderieApiError | null;
|
|
79
|
+
refresh: (opts?: {
|
|
80
|
+
force?: boolean;
|
|
81
|
+
}) => Promise<void>;
|
|
82
|
+
}
|
|
83
|
+
declare function useWallet(client?: BillingClient): IUseWalletReturn;
|
|
84
|
+
|
|
85
|
+
interface IUseWalletTransactionsReturn {
|
|
86
|
+
transactions: IWalletTransactionDTO[];
|
|
87
|
+
nextCursor: string | null;
|
|
88
|
+
hasMore: boolean;
|
|
89
|
+
isLoading: boolean;
|
|
90
|
+
error: FonderieApiError | null;
|
|
91
|
+
refresh: (opts?: {
|
|
92
|
+
force?: boolean;
|
|
93
|
+
}) => Promise<void>;
|
|
94
|
+
loadMore: () => Promise<void>;
|
|
95
|
+
}
|
|
96
|
+
declare function useWalletTransactions(client?: BillingClient): IUseWalletTransactionsReturn;
|
|
97
|
+
|
|
98
|
+
interface IUseWalletCheckoutReturn {
|
|
99
|
+
checkout: (input: IWalletCheckoutInput) => Promise<string>;
|
|
100
|
+
isLoading: boolean;
|
|
101
|
+
error: FonderieApiError | null;
|
|
102
|
+
}
|
|
103
|
+
declare function useWalletCheckout(client?: BillingClient): IUseWalletCheckoutReturn;
|
|
104
|
+
|
|
105
|
+
interface IUseCancelSubscriptionReturn {
|
|
106
|
+
cancel: (input?: ICancelSubscriptionInput) => Promise<ISubscriptionChangeResult>;
|
|
107
|
+
isLoading: boolean;
|
|
108
|
+
error: FonderieApiError | null;
|
|
109
|
+
}
|
|
110
|
+
declare function useCancelSubscription(client?: BillingClient): IUseCancelSubscriptionReturn;
|
|
111
|
+
|
|
112
|
+
interface IUseReactivateSubscriptionReturn {
|
|
113
|
+
reactivate: () => Promise<ISubscriptionChangeResult>;
|
|
114
|
+
isLoading: boolean;
|
|
115
|
+
error: FonderieApiError | null;
|
|
116
|
+
}
|
|
117
|
+
declare function useReactivateSubscription(client?: BillingClient): IUseReactivateSubscriptionReturn;
|
|
118
|
+
|
|
119
|
+
interface IUsePaymentMethodReturn {
|
|
120
|
+
paymentMethod: IPaymentMethodDTO | null;
|
|
121
|
+
isLoading: boolean;
|
|
122
|
+
error: FonderieApiError | null;
|
|
123
|
+
refresh: (opts?: {
|
|
124
|
+
force?: boolean;
|
|
125
|
+
}) => Promise<void>;
|
|
126
|
+
}
|
|
127
|
+
declare function usePaymentMethod(client?: BillingClient): IUsePaymentMethodReturn;
|
|
128
|
+
|
|
129
|
+
interface IUseInvoicesReturn {
|
|
130
|
+
invoices: IInvoiceDTO[];
|
|
131
|
+
isLoading: boolean;
|
|
132
|
+
error: FonderieApiError | null;
|
|
133
|
+
refresh: (opts?: {
|
|
134
|
+
force?: boolean;
|
|
135
|
+
}) => Promise<void>;
|
|
136
|
+
}
|
|
137
|
+
declare function useInvoices(client?: BillingClient): IUseInvoicesReturn;
|
|
138
|
+
|
|
139
|
+
interface IUseSetupPaymentMethodReturn {
|
|
140
|
+
setup: () => Promise<string>;
|
|
141
|
+
isLoading: boolean;
|
|
142
|
+
error: FonderieApiError | null;
|
|
143
|
+
}
|
|
144
|
+
declare function useSetupPaymentMethod(client?: BillingClient): IUseSetupPaymentMethodReturn;
|
|
145
|
+
|
|
146
|
+
interface IUseSavePaymentMethodReturn {
|
|
147
|
+
save: (paymentMethodId: string) => Promise<IPaymentMethodDTO | null>;
|
|
148
|
+
isLoading: boolean;
|
|
149
|
+
error: FonderieApiError | null;
|
|
150
|
+
}
|
|
151
|
+
declare function useSavePaymentMethod(client?: BillingClient): IUseSavePaymentMethodReturn;
|
|
152
|
+
|
|
153
|
+
interface IUseRemovePaymentMethodReturn {
|
|
154
|
+
remove: () => Promise<void>;
|
|
155
|
+
isLoading: boolean;
|
|
156
|
+
error: FonderieApiError | null;
|
|
157
|
+
}
|
|
158
|
+
declare function useRemovePaymentMethod(client?: BillingClient): IUseRemovePaymentMethodReturn;
|
|
159
|
+
|
|
160
|
+
export { type IUseBillingPortalReturn, type IUseCancelSubscriptionReturn, type IUseCheckoutReturn, type IUseInvoicesReturn, type IUsePaymentMethodReturn, type IUsePlanReturn, type IUsePlansReturn, type IUseReactivateSubscriptionReturn, type IUseRemovePaymentMethodReturn, type IUseSavePaymentMethodReturn, type IUseSetupPaymentMethodReturn, type IUseSubscriptionReturn, type IUseUsageReturn, type IUseWalletCheckoutReturn, type IUseWalletPreferencesReturn, type IUseWalletReturn, type IUseWalletTransactionsReturn, useBillingPortal, useCancelSubscription, useCheckout, useInvoices, usePaymentMethod, usePlan, usePlans, useReactivateSubscription, useRemovePaymentMethod, useSavePaymentMethod, useSetupPaymentMethod, useSubscription, useUsage, useWallet, useWalletCheckout, useWalletPreferences, useWalletTransactions };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FonderieApiError, BillingClient, ICheckoutInput, IPlanDTO, ICreatePlanInput, IUpdatePlanInput, ISubscriptionDTO, IRecordUsageInput } from '@fonderie/client';
|
|
2
|
-
export { BillingClient, FonderieApiError, ICheckoutInput, ICreatePlanInput, IPlanDTO, IPlanFeature, IRecordUsageInput, ISubscriptionDTO, IUpdatePlanInput, SubscriberType } from '@fonderie/client';
|
|
1
|
+
import { FonderieApiError, BillingClient, ICheckoutInput, IPlanDTO, ICreatePlanInput, IUpdatePlanInput, ISubscriptionDTO, IRecordUsageInput, IWalletDTO, IWalletTransactionDTO, IWalletCheckoutInput, ICancelSubscriptionInput, ISubscriptionChangeResult, IPaymentMethodDTO, IInvoiceDTO } from '@fonderie/client';
|
|
2
|
+
export { BillingClient, FonderieApiError, ICancelSubscriptionInput, ICheckoutInput, ICreatePlanInput, IInvoiceDTO, IPaymentMethodDTO, IPlanDTO, IPlanFeature, IRecordUsageInput, ISubscriptionChangeResult, ISubscriptionDTO, IUpdatePlanInput, IWalletCheckoutInput, IWalletDTO, IWalletTransactionDTO, SubscriberType } from '@fonderie/client';
|
|
3
3
|
|
|
4
4
|
interface IUseBillingPortalReturn {
|
|
5
5
|
openPortal: () => Promise<string>;
|
|
@@ -72,4 +72,89 @@ interface IUseWalletPreferencesReturn {
|
|
|
72
72
|
}
|
|
73
73
|
declare function useWalletPreferences(client?: BillingClient): IUseWalletPreferencesReturn;
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
interface IUseWalletReturn {
|
|
76
|
+
wallet: IWalletDTO | null;
|
|
77
|
+
isLoading: boolean;
|
|
78
|
+
error: FonderieApiError | null;
|
|
79
|
+
refresh: (opts?: {
|
|
80
|
+
force?: boolean;
|
|
81
|
+
}) => Promise<void>;
|
|
82
|
+
}
|
|
83
|
+
declare function useWallet(client?: BillingClient): IUseWalletReturn;
|
|
84
|
+
|
|
85
|
+
interface IUseWalletTransactionsReturn {
|
|
86
|
+
transactions: IWalletTransactionDTO[];
|
|
87
|
+
nextCursor: string | null;
|
|
88
|
+
hasMore: boolean;
|
|
89
|
+
isLoading: boolean;
|
|
90
|
+
error: FonderieApiError | null;
|
|
91
|
+
refresh: (opts?: {
|
|
92
|
+
force?: boolean;
|
|
93
|
+
}) => Promise<void>;
|
|
94
|
+
loadMore: () => Promise<void>;
|
|
95
|
+
}
|
|
96
|
+
declare function useWalletTransactions(client?: BillingClient): IUseWalletTransactionsReturn;
|
|
97
|
+
|
|
98
|
+
interface IUseWalletCheckoutReturn {
|
|
99
|
+
checkout: (input: IWalletCheckoutInput) => Promise<string>;
|
|
100
|
+
isLoading: boolean;
|
|
101
|
+
error: FonderieApiError | null;
|
|
102
|
+
}
|
|
103
|
+
declare function useWalletCheckout(client?: BillingClient): IUseWalletCheckoutReturn;
|
|
104
|
+
|
|
105
|
+
interface IUseCancelSubscriptionReturn {
|
|
106
|
+
cancel: (input?: ICancelSubscriptionInput) => Promise<ISubscriptionChangeResult>;
|
|
107
|
+
isLoading: boolean;
|
|
108
|
+
error: FonderieApiError | null;
|
|
109
|
+
}
|
|
110
|
+
declare function useCancelSubscription(client?: BillingClient): IUseCancelSubscriptionReturn;
|
|
111
|
+
|
|
112
|
+
interface IUseReactivateSubscriptionReturn {
|
|
113
|
+
reactivate: () => Promise<ISubscriptionChangeResult>;
|
|
114
|
+
isLoading: boolean;
|
|
115
|
+
error: FonderieApiError | null;
|
|
116
|
+
}
|
|
117
|
+
declare function useReactivateSubscription(client?: BillingClient): IUseReactivateSubscriptionReturn;
|
|
118
|
+
|
|
119
|
+
interface IUsePaymentMethodReturn {
|
|
120
|
+
paymentMethod: IPaymentMethodDTO | null;
|
|
121
|
+
isLoading: boolean;
|
|
122
|
+
error: FonderieApiError | null;
|
|
123
|
+
refresh: (opts?: {
|
|
124
|
+
force?: boolean;
|
|
125
|
+
}) => Promise<void>;
|
|
126
|
+
}
|
|
127
|
+
declare function usePaymentMethod(client?: BillingClient): IUsePaymentMethodReturn;
|
|
128
|
+
|
|
129
|
+
interface IUseInvoicesReturn {
|
|
130
|
+
invoices: IInvoiceDTO[];
|
|
131
|
+
isLoading: boolean;
|
|
132
|
+
error: FonderieApiError | null;
|
|
133
|
+
refresh: (opts?: {
|
|
134
|
+
force?: boolean;
|
|
135
|
+
}) => Promise<void>;
|
|
136
|
+
}
|
|
137
|
+
declare function useInvoices(client?: BillingClient): IUseInvoicesReturn;
|
|
138
|
+
|
|
139
|
+
interface IUseSetupPaymentMethodReturn {
|
|
140
|
+
setup: () => Promise<string>;
|
|
141
|
+
isLoading: boolean;
|
|
142
|
+
error: FonderieApiError | null;
|
|
143
|
+
}
|
|
144
|
+
declare function useSetupPaymentMethod(client?: BillingClient): IUseSetupPaymentMethodReturn;
|
|
145
|
+
|
|
146
|
+
interface IUseSavePaymentMethodReturn {
|
|
147
|
+
save: (paymentMethodId: string) => Promise<IPaymentMethodDTO | null>;
|
|
148
|
+
isLoading: boolean;
|
|
149
|
+
error: FonderieApiError | null;
|
|
150
|
+
}
|
|
151
|
+
declare function useSavePaymentMethod(client?: BillingClient): IUseSavePaymentMethodReturn;
|
|
152
|
+
|
|
153
|
+
interface IUseRemovePaymentMethodReturn {
|
|
154
|
+
remove: () => Promise<void>;
|
|
155
|
+
isLoading: boolean;
|
|
156
|
+
error: FonderieApiError | null;
|
|
157
|
+
}
|
|
158
|
+
declare function useRemovePaymentMethod(client?: BillingClient): IUseRemovePaymentMethodReturn;
|
|
159
|
+
|
|
160
|
+
export { type IUseBillingPortalReturn, type IUseCancelSubscriptionReturn, type IUseCheckoutReturn, type IUseInvoicesReturn, type IUsePaymentMethodReturn, type IUsePlanReturn, type IUsePlansReturn, type IUseReactivateSubscriptionReturn, type IUseRemovePaymentMethodReturn, type IUseSavePaymentMethodReturn, type IUseSetupPaymentMethodReturn, type IUseSubscriptionReturn, type IUseUsageReturn, type IUseWalletCheckoutReturn, type IUseWalletPreferencesReturn, type IUseWalletReturn, type IUseWalletTransactionsReturn, useBillingPortal, useCancelSubscription, useCheckout, useInvoices, usePaymentMethod, usePlan, usePlans, useReactivateSubscription, useRemovePaymentMethod, useSavePaymentMethod, useSetupPaymentMethod, useSubscription, useUsage, useWallet, useWalletCheckout, useWalletPreferences, useWalletTransactions };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
-
import { FonderieApiError as
|
|
2
|
+
import { FonderieApiError as FonderieApiError18 } from "@fonderie/client";
|
|
3
3
|
|
|
4
4
|
// src/hooks/useBillingPortal.ts
|
|
5
5
|
import { FonderieApiError } from "@fonderie/client";
|
|
@@ -287,14 +287,332 @@ function useWalletPreferences(client) {
|
|
|
287
287
|
}, [refresh]);
|
|
288
288
|
return { spendPurchased, isLoading, error, refresh, setSpendPurchased };
|
|
289
289
|
}
|
|
290
|
+
|
|
291
|
+
// src/hooks/useWallet.ts
|
|
292
|
+
import { FonderieApiError as FonderieApiError8 } from "@fonderie/client";
|
|
293
|
+
import { useFonderieSubClient as useFonderieSubClient8 } from "@fonderie/react";
|
|
294
|
+
import { useCallback as useCallback8, useEffect as useEffect6, useState as useState8 } from "react";
|
|
295
|
+
function useWallet(client) {
|
|
296
|
+
const billing = useFonderieSubClient8(client, (c) => c.billing, "useWallet");
|
|
297
|
+
const [wallet, setWallet] = useState8(null);
|
|
298
|
+
const [isLoading, setIsLoading] = useState8(true);
|
|
299
|
+
const [error, setError] = useState8(null);
|
|
300
|
+
const refresh = useCallback8(
|
|
301
|
+
async (opts) => {
|
|
302
|
+
setIsLoading(true);
|
|
303
|
+
setError(null);
|
|
304
|
+
try {
|
|
305
|
+
const { result } = await billing.getWallet({ bust: opts?.force });
|
|
306
|
+
setWallet(result.wallet);
|
|
307
|
+
} catch (err) {
|
|
308
|
+
const apiError = err instanceof FonderieApiError8 ? err : new FonderieApiError8("unknown", String(err), 0);
|
|
309
|
+
setError(apiError);
|
|
310
|
+
setWallet(null);
|
|
311
|
+
} finally {
|
|
312
|
+
setIsLoading(false);
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
[billing]
|
|
316
|
+
);
|
|
317
|
+
useEffect6(() => {
|
|
318
|
+
void refresh();
|
|
319
|
+
}, [refresh]);
|
|
320
|
+
return { wallet, isLoading, error, refresh };
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
// src/hooks/useWalletTransactions.ts
|
|
324
|
+
import { FonderieApiError as FonderieApiError9 } from "@fonderie/client";
|
|
325
|
+
import { useFonderieSubClient as useFonderieSubClient9 } from "@fonderie/react";
|
|
326
|
+
import { useCallback as useCallback9, useEffect as useEffect7, useState as useState9 } from "react";
|
|
327
|
+
function useWalletTransactions(client) {
|
|
328
|
+
const billing = useFonderieSubClient9(client, (c) => c.billing, "useWalletTransactions");
|
|
329
|
+
const [transactions, setTransactions] = useState9([]);
|
|
330
|
+
const [nextCursor, setNextCursor] = useState9(null);
|
|
331
|
+
const [isLoading, setIsLoading] = useState9(true);
|
|
332
|
+
const [error, setError] = useState9(null);
|
|
333
|
+
const refresh = useCallback9(
|
|
334
|
+
async (opts) => {
|
|
335
|
+
setIsLoading(true);
|
|
336
|
+
setError(null);
|
|
337
|
+
try {
|
|
338
|
+
const { result } = await billing.getWalletTransactions({ bust: opts?.force });
|
|
339
|
+
setTransactions(result.transactions);
|
|
340
|
+
setNextCursor(result.nextCursor);
|
|
341
|
+
} catch (err) {
|
|
342
|
+
const apiError = err instanceof FonderieApiError9 ? err : new FonderieApiError9("unknown", String(err), 0);
|
|
343
|
+
setError(apiError);
|
|
344
|
+
} finally {
|
|
345
|
+
setIsLoading(false);
|
|
346
|
+
}
|
|
347
|
+
},
|
|
348
|
+
[billing]
|
|
349
|
+
);
|
|
350
|
+
const loadMore = useCallback9(async () => {
|
|
351
|
+
if (!nextCursor) return;
|
|
352
|
+
setError(null);
|
|
353
|
+
try {
|
|
354
|
+
const { result } = await billing.getWalletTransactions({ cursor: nextCursor });
|
|
355
|
+
setTransactions((prev) => [...prev, ...result.transactions]);
|
|
356
|
+
setNextCursor(result.nextCursor);
|
|
357
|
+
} catch (err) {
|
|
358
|
+
const apiError = err instanceof FonderieApiError9 ? err : new FonderieApiError9("unknown", String(err), 0);
|
|
359
|
+
setError(apiError);
|
|
360
|
+
throw apiError;
|
|
361
|
+
}
|
|
362
|
+
}, [billing, nextCursor]);
|
|
363
|
+
useEffect7(() => {
|
|
364
|
+
void refresh();
|
|
365
|
+
}, [refresh]);
|
|
366
|
+
return {
|
|
367
|
+
transactions,
|
|
368
|
+
nextCursor,
|
|
369
|
+
hasMore: nextCursor !== null,
|
|
370
|
+
isLoading,
|
|
371
|
+
error,
|
|
372
|
+
refresh,
|
|
373
|
+
loadMore
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
// src/hooks/useWalletCheckout.ts
|
|
378
|
+
import { FonderieApiError as FonderieApiError10 } from "@fonderie/client";
|
|
379
|
+
import { useFonderieSubClient as useFonderieSubClient10 } from "@fonderie/react";
|
|
380
|
+
import { useCallback as useCallback10, useState as useState10 } from "react";
|
|
381
|
+
function useWalletCheckout(client) {
|
|
382
|
+
const billing = useFonderieSubClient10(client, (c) => c.billing, "useWalletCheckout");
|
|
383
|
+
const [isLoading, setIsLoading] = useState10(false);
|
|
384
|
+
const [error, setError] = useState10(null);
|
|
385
|
+
const checkout = useCallback10(
|
|
386
|
+
async (input) => {
|
|
387
|
+
setIsLoading(true);
|
|
388
|
+
setError(null);
|
|
389
|
+
try {
|
|
390
|
+
const { result } = await billing.createWalletCheckout(input);
|
|
391
|
+
return result.url;
|
|
392
|
+
} catch (err) {
|
|
393
|
+
const apiError = err instanceof FonderieApiError10 ? err : new FonderieApiError10("unknown", String(err), 0);
|
|
394
|
+
setError(apiError);
|
|
395
|
+
throw apiError;
|
|
396
|
+
} finally {
|
|
397
|
+
setIsLoading(false);
|
|
398
|
+
}
|
|
399
|
+
},
|
|
400
|
+
[billing]
|
|
401
|
+
);
|
|
402
|
+
return { checkout, isLoading, error };
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
// src/hooks/useCancelSubscription.ts
|
|
406
|
+
import { FonderieApiError as FonderieApiError11 } from "@fonderie/client";
|
|
407
|
+
import { useFonderieSubClient as useFonderieSubClient11 } from "@fonderie/react";
|
|
408
|
+
import { useCallback as useCallback11, useState as useState11 } from "react";
|
|
409
|
+
function useCancelSubscription(client) {
|
|
410
|
+
const billing = useFonderieSubClient11(client, (c) => c.billing, "useCancelSubscription");
|
|
411
|
+
const [isLoading, setIsLoading] = useState11(false);
|
|
412
|
+
const [error, setError] = useState11(null);
|
|
413
|
+
const cancel = useCallback11(
|
|
414
|
+
async (input) => {
|
|
415
|
+
setIsLoading(true);
|
|
416
|
+
setError(null);
|
|
417
|
+
try {
|
|
418
|
+
const { result } = await billing.cancelSubscription(input);
|
|
419
|
+
return result;
|
|
420
|
+
} catch (err) {
|
|
421
|
+
const apiError = err instanceof FonderieApiError11 ? err : new FonderieApiError11("unknown", String(err), 0);
|
|
422
|
+
setError(apiError);
|
|
423
|
+
throw apiError;
|
|
424
|
+
} finally {
|
|
425
|
+
setIsLoading(false);
|
|
426
|
+
}
|
|
427
|
+
},
|
|
428
|
+
[billing]
|
|
429
|
+
);
|
|
430
|
+
return { cancel, isLoading, error };
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
// src/hooks/useReactivateSubscription.ts
|
|
434
|
+
import { FonderieApiError as FonderieApiError12 } from "@fonderie/client";
|
|
435
|
+
import { useFonderieSubClient as useFonderieSubClient12 } from "@fonderie/react";
|
|
436
|
+
import { useCallback as useCallback12, useState as useState12 } from "react";
|
|
437
|
+
function useReactivateSubscription(client) {
|
|
438
|
+
const billing = useFonderieSubClient12(client, (c) => c.billing, "useReactivateSubscription");
|
|
439
|
+
const [isLoading, setIsLoading] = useState12(false);
|
|
440
|
+
const [error, setError] = useState12(null);
|
|
441
|
+
const reactivate = useCallback12(async () => {
|
|
442
|
+
setIsLoading(true);
|
|
443
|
+
setError(null);
|
|
444
|
+
try {
|
|
445
|
+
const { result } = await billing.reactivateSubscription();
|
|
446
|
+
return result;
|
|
447
|
+
} catch (err) {
|
|
448
|
+
const apiError = err instanceof FonderieApiError12 ? err : new FonderieApiError12("unknown", String(err), 0);
|
|
449
|
+
setError(apiError);
|
|
450
|
+
throw apiError;
|
|
451
|
+
} finally {
|
|
452
|
+
setIsLoading(false);
|
|
453
|
+
}
|
|
454
|
+
}, [billing]);
|
|
455
|
+
return { reactivate, isLoading, error };
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
// src/hooks/usePaymentMethod.ts
|
|
459
|
+
import { FonderieApiError as FonderieApiError13 } from "@fonderie/client";
|
|
460
|
+
import { useFonderieSubClient as useFonderieSubClient13 } from "@fonderie/react";
|
|
461
|
+
import { useCallback as useCallback13, useEffect as useEffect8, useState as useState13 } from "react";
|
|
462
|
+
function usePaymentMethod(client) {
|
|
463
|
+
const billing = useFonderieSubClient13(client, (c) => c.billing, "usePaymentMethod");
|
|
464
|
+
const [paymentMethod, setPaymentMethod] = useState13(null);
|
|
465
|
+
const [isLoading, setIsLoading] = useState13(true);
|
|
466
|
+
const [error, setError] = useState13(null);
|
|
467
|
+
const refresh = useCallback13(
|
|
468
|
+
async (opts) => {
|
|
469
|
+
setIsLoading(true);
|
|
470
|
+
setError(null);
|
|
471
|
+
try {
|
|
472
|
+
const { result } = await billing.getPaymentMethod({ bust: opts?.force });
|
|
473
|
+
setPaymentMethod(result.paymentMethod);
|
|
474
|
+
} catch (err) {
|
|
475
|
+
const apiError = err instanceof FonderieApiError13 ? err : new FonderieApiError13("unknown", String(err), 0);
|
|
476
|
+
if (apiError.status !== 501) setError(apiError);
|
|
477
|
+
setPaymentMethod(null);
|
|
478
|
+
} finally {
|
|
479
|
+
setIsLoading(false);
|
|
480
|
+
}
|
|
481
|
+
},
|
|
482
|
+
[billing]
|
|
483
|
+
);
|
|
484
|
+
useEffect8(() => {
|
|
485
|
+
void refresh();
|
|
486
|
+
}, [refresh]);
|
|
487
|
+
return { paymentMethod, isLoading, error, refresh };
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
// src/hooks/useInvoices.ts
|
|
491
|
+
import { FonderieApiError as FonderieApiError14 } from "@fonderie/client";
|
|
492
|
+
import { useFonderieSubClient as useFonderieSubClient14 } from "@fonderie/react";
|
|
493
|
+
import { useCallback as useCallback14, useEffect as useEffect9, useState as useState14 } from "react";
|
|
494
|
+
function useInvoices(client) {
|
|
495
|
+
const billing = useFonderieSubClient14(client, (c) => c.billing, "useInvoices");
|
|
496
|
+
const [invoices, setInvoices] = useState14([]);
|
|
497
|
+
const [isLoading, setIsLoading] = useState14(true);
|
|
498
|
+
const [error, setError] = useState14(null);
|
|
499
|
+
const refresh = useCallback14(
|
|
500
|
+
async (opts) => {
|
|
501
|
+
setIsLoading(true);
|
|
502
|
+
setError(null);
|
|
503
|
+
try {
|
|
504
|
+
const { result } = await billing.listInvoices({ bust: opts?.force });
|
|
505
|
+
setInvoices(result.invoices);
|
|
506
|
+
} catch (err) {
|
|
507
|
+
const apiError = err instanceof FonderieApiError14 ? err : new FonderieApiError14("unknown", String(err), 0);
|
|
508
|
+
if (apiError.status !== 501) setError(apiError);
|
|
509
|
+
setInvoices([]);
|
|
510
|
+
} finally {
|
|
511
|
+
setIsLoading(false);
|
|
512
|
+
}
|
|
513
|
+
},
|
|
514
|
+
[billing]
|
|
515
|
+
);
|
|
516
|
+
useEffect9(() => {
|
|
517
|
+
void refresh();
|
|
518
|
+
}, [refresh]);
|
|
519
|
+
return { invoices, isLoading, error, refresh };
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
// src/hooks/useSetupPaymentMethod.ts
|
|
523
|
+
import { FonderieApiError as FonderieApiError15 } from "@fonderie/client";
|
|
524
|
+
import { useFonderieSubClient as useFonderieSubClient15 } from "@fonderie/react";
|
|
525
|
+
import { useCallback as useCallback15, useState as useState15 } from "react";
|
|
526
|
+
function useSetupPaymentMethod(client) {
|
|
527
|
+
const billing = useFonderieSubClient15(client, (c) => c.billing, "useSetupPaymentMethod");
|
|
528
|
+
const [isLoading, setIsLoading] = useState15(false);
|
|
529
|
+
const [error, setError] = useState15(null);
|
|
530
|
+
const setup = useCallback15(async () => {
|
|
531
|
+
setIsLoading(true);
|
|
532
|
+
setError(null);
|
|
533
|
+
try {
|
|
534
|
+
const { result } = await billing.setupPaymentMethod();
|
|
535
|
+
return result.clientSecret;
|
|
536
|
+
} catch (err) {
|
|
537
|
+
const apiError = err instanceof FonderieApiError15 ? err : new FonderieApiError15("unknown", String(err), 0);
|
|
538
|
+
setError(apiError);
|
|
539
|
+
throw apiError;
|
|
540
|
+
} finally {
|
|
541
|
+
setIsLoading(false);
|
|
542
|
+
}
|
|
543
|
+
}, [billing]);
|
|
544
|
+
return { setup, isLoading, error };
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
// src/hooks/useSavePaymentMethod.ts
|
|
548
|
+
import { FonderieApiError as FonderieApiError16 } from "@fonderie/client";
|
|
549
|
+
import { useFonderieSubClient as useFonderieSubClient16 } from "@fonderie/react";
|
|
550
|
+
import { useCallback as useCallback16, useState as useState16 } from "react";
|
|
551
|
+
function useSavePaymentMethod(client) {
|
|
552
|
+
const billing = useFonderieSubClient16(client, (c) => c.billing, "useSavePaymentMethod");
|
|
553
|
+
const [isLoading, setIsLoading] = useState16(false);
|
|
554
|
+
const [error, setError] = useState16(null);
|
|
555
|
+
const save = useCallback16(
|
|
556
|
+
async (paymentMethodId) => {
|
|
557
|
+
setIsLoading(true);
|
|
558
|
+
setError(null);
|
|
559
|
+
try {
|
|
560
|
+
const { result } = await billing.savePaymentMethod({ paymentMethodId });
|
|
561
|
+
return result.paymentMethod;
|
|
562
|
+
} catch (err) {
|
|
563
|
+
const apiError = err instanceof FonderieApiError16 ? err : new FonderieApiError16("unknown", String(err), 0);
|
|
564
|
+
setError(apiError);
|
|
565
|
+
throw apiError;
|
|
566
|
+
} finally {
|
|
567
|
+
setIsLoading(false);
|
|
568
|
+
}
|
|
569
|
+
},
|
|
570
|
+
[billing]
|
|
571
|
+
);
|
|
572
|
+
return { save, isLoading, error };
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
// src/hooks/useRemovePaymentMethod.ts
|
|
576
|
+
import { FonderieApiError as FonderieApiError17 } from "@fonderie/client";
|
|
577
|
+
import { useFonderieSubClient as useFonderieSubClient17 } from "@fonderie/react";
|
|
578
|
+
import { useCallback as useCallback17, useState as useState17 } from "react";
|
|
579
|
+
function useRemovePaymentMethod(client) {
|
|
580
|
+
const billing = useFonderieSubClient17(client, (c) => c.billing, "useRemovePaymentMethod");
|
|
581
|
+
const [isLoading, setIsLoading] = useState17(false);
|
|
582
|
+
const [error, setError] = useState17(null);
|
|
583
|
+
const remove = useCallback17(async () => {
|
|
584
|
+
setIsLoading(true);
|
|
585
|
+
setError(null);
|
|
586
|
+
try {
|
|
587
|
+
await billing.removePaymentMethod();
|
|
588
|
+
} catch (err) {
|
|
589
|
+
const apiError = err instanceof FonderieApiError17 ? err : new FonderieApiError17("unknown", String(err), 0);
|
|
590
|
+
setError(apiError);
|
|
591
|
+
throw apiError;
|
|
592
|
+
} finally {
|
|
593
|
+
setIsLoading(false);
|
|
594
|
+
}
|
|
595
|
+
}, [billing]);
|
|
596
|
+
return { remove, isLoading, error };
|
|
597
|
+
}
|
|
290
598
|
export {
|
|
291
|
-
|
|
599
|
+
FonderieApiError18 as FonderieApiError,
|
|
292
600
|
useBillingPortal,
|
|
601
|
+
useCancelSubscription,
|
|
293
602
|
useCheckout,
|
|
603
|
+
useInvoices,
|
|
604
|
+
usePaymentMethod,
|
|
294
605
|
usePlan,
|
|
295
606
|
usePlans,
|
|
607
|
+
useReactivateSubscription,
|
|
608
|
+
useRemovePaymentMethod,
|
|
609
|
+
useSavePaymentMethod,
|
|
610
|
+
useSetupPaymentMethod,
|
|
296
611
|
useSubscription,
|
|
297
612
|
useUsage,
|
|
298
|
-
|
|
613
|
+
useWallet,
|
|
614
|
+
useWalletCheckout,
|
|
615
|
+
useWalletPreferences,
|
|
616
|
+
useWalletTransactions
|
|
299
617
|
};
|
|
300
618
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/hooks/useBillingPortal.ts","../src/hooks/useCheckout.ts","../src/hooks/usePlan.ts","../src/hooks/usePlans.ts","../src/hooks/useSubscription.ts","../src/hooks/useUsage.ts","../src/hooks/useWalletPreferences.ts"],"sourcesContent":["export type {\n\tBillingClient,\n\tICheckoutInput,\n\tICreatePlanInput,\n\tIPlanDTO,\n\tIPlanFeature,\n\tIRecordUsageInput,\n\tISubscriptionDTO,\n\tIUpdatePlanInput,\n\tSubscriberType,\n} from '@fonderie/client';\nexport { FonderieApiError } from '@fonderie/client';\nexport type {\n\tIUseBillingPortalReturn,\n\tIUseCheckoutReturn,\n\tIUsePlanReturn,\n\tIUsePlansReturn,\n\tIUseSubscriptionReturn,\n\tIUseUsageReturn,\n\tIUseWalletPreferencesReturn,\n} from './hooks';\nexport {\n\tuseBillingPortal,\n\tuseCheckout,\n\tusePlan,\n\tusePlans,\n\tuseSubscription,\n\tuseUsage,\n\tuseWalletPreferences,\n} from './hooks';\n","import type { BillingClient } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useState } from 'react';\n\nexport interface IUseBillingPortalReturn {\n\topenPortal: () => Promise<string>;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n}\n\nexport function useBillingPortal(client?: BillingClient): IUseBillingPortalReturn {\n\tconst billing = useFonderieSubClient(client, (c) => c.billing, 'useBillingPortal');\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst openPortal = useCallback(async () => {\n\t\tsetIsLoading(true);\n\t\tsetError(null);\n\t\ttry {\n\t\t\tconst { result } = await billing.createPortalSession();\n\t\t\treturn result.url;\n\t\t} catch (err) {\n\t\t\tconst apiError =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\tsetError(apiError);\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tsetIsLoading(false);\n\t\t}\n\t}, [billing]);\n\n\treturn { openPortal, isLoading, error };\n}\n","import type { BillingClient, ICheckoutInput } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useState } from 'react';\n\nexport interface IUseCheckoutReturn {\n\tcheckout: (input: ICheckoutInput) => Promise<string>;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n}\n\nexport function useCheckout(client?: BillingClient): IUseCheckoutReturn {\n\tconst billing = useFonderieSubClient(client, (c) => c.billing, 'useCheckout');\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst checkout = useCallback(\n\t\tasync (input: ICheckoutInput) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.createCheckoutSession(input);\n\t\t\t\treturn result.url;\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[billing],\n\t);\n\n\treturn { checkout, isLoading, error };\n}\n","import type { IPlanDTO } from '@fonderie/client';\nimport { BillingClient, FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useEffect, useState } from 'react';\n\nexport interface IUsePlanReturn {\n\tplan: IPlanDTO | null;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n\trefresh: (opts?: { force?: boolean }) => Promise<void>;\n}\n\nexport function usePlan(planId: string): IUsePlanReturn;\nexport function usePlan(client: BillingClient | undefined, planId: string): IUsePlanReturn;\nexport function usePlan(\n\tclientOrPlanId: BillingClient | string | undefined,\n\tmaybePlanId?: string,\n): IUsePlanReturn {\n\tconst firstIsClient = clientOrPlanId === undefined || clientOrPlanId instanceof BillingClient;\n\tconst explicit = firstIsClient ? (clientOrPlanId as BillingClient | undefined) : undefined;\n\tconst planId = firstIsClient ? (maybePlanId as string) : clientOrPlanId;\n\tconst billing = useFonderieSubClient(explicit, (c) => c.billing, 'usePlan');\n\tconst [plan, setPlan] = useState<IPlanDTO | null>(null);\n\tconst [isLoading, setIsLoading] = useState(true);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst refresh = useCallback(\n\t\tasync (opts?: { force?: boolean }) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.getPlan(planId, { bust: opts?.force });\n\t\t\t\tsetPlan(result.plan);\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[billing, planId],\n\t);\n\n\tuseEffect(() => {\n\t\tvoid refresh();\n\t}, [refresh]);\n\n\treturn { plan, isLoading, error, refresh };\n}\n","import type {\n\tBillingClient,\n\tICreatePlanInput,\n\tIPlanDTO,\n\tIUpdatePlanInput,\n} from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useEffect, useState } from 'react';\n\nexport interface IUsePlansReturn {\n\tplans: IPlanDTO[];\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n\trefresh: (opts?: { force?: boolean }) => Promise<void>;\n\tcreatePlan: (input: ICreatePlanInput) => Promise<IPlanDTO>;\n\tupdatePlan: (planId: string, input: IUpdatePlanInput) => Promise<IPlanDTO>;\n\tdeletePlan: (planId: string) => Promise<void>;\n}\n\nexport function usePlans(client?: BillingClient): IUsePlansReturn {\n\tconst billing = useFonderieSubClient(client, (c) => c.billing, 'usePlans');\n\tconst [plans, setPlans] = useState<IPlanDTO[]>([]);\n\tconst [isLoading, setIsLoading] = useState(true);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst refresh = useCallback(\n\t\tasync (opts?: { force?: boolean }) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.listPlans({ bust: opts?.force });\n\t\t\t\tsetPlans(result.plans);\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[billing],\n\t);\n\n\t// These writes are not auth-gated by @fonderie/billing —\n\t// gate the UI that calls them behind your own admin check before shipping it.\n\tconst createPlan = useCallback(\n\t\tasync (input: ICreatePlanInput) => {\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.createPlan(input);\n\t\t\t\tawait refresh();\n\t\t\t\treturn result.plan;\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t}\n\t\t},\n\t\t[billing, refresh],\n\t);\n\n\tconst updatePlan = useCallback(\n\t\tasync (planId: string, input: IUpdatePlanInput) => {\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.updatePlan(planId, input);\n\t\t\t\tawait refresh();\n\t\t\t\treturn result.plan;\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t}\n\t\t},\n\t\t[billing, refresh],\n\t);\n\n\tconst deletePlan = useCallback(\n\t\tasync (planId: string) => {\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tawait billing.deletePlan(planId);\n\t\t\t\tawait refresh();\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t}\n\t\t},\n\t\t[billing, refresh],\n\t);\n\n\tuseEffect(() => {\n\t\tvoid refresh();\n\t}, [refresh]);\n\n\treturn { plans, isLoading, error, refresh, createPlan, updatePlan, deletePlan };\n}\n","import type { BillingClient, ISubscriptionDTO } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useEffect, useState } from 'react';\n\nexport interface IUseSubscriptionReturn {\n\tsubscription: ISubscriptionDTO | null;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n\trefresh: (opts?: { force?: boolean }) => Promise<void>;\n}\n\nexport function useSubscription(client?: BillingClient): IUseSubscriptionReturn {\n\tconst billing = useFonderieSubClient(client, (c) => c.billing, 'useSubscription');\n\tconst [subscription, setSubscription] = useState<ISubscriptionDTO | null>(null);\n\tconst [isLoading, setIsLoading] = useState(true);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst refresh = useCallback(\n\t\tasync (opts?: { force?: boolean }) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.getSubscription({ bust: opts?.force });\n\t\t\t\tsetSubscription(result.subscription);\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\t// No active subscription is a normal, expected state — not an error banner.\n\t\t\t\tif (apiError.status !== 404) setError(apiError);\n\t\t\t\tsetSubscription(null);\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[billing],\n\t);\n\n\tuseEffect(() => {\n\t\tvoid refresh();\n\t}, [refresh]);\n\n\treturn { subscription, isLoading, error, refresh };\n}\n","import type { IRecordUsageInput } from '@fonderie/client';\nimport { BillingClient, FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useEffect, useState } from 'react';\n\nexport interface IUseUsageReturn {\n\ttotal: number | null;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n\trefresh: (opts?: { force?: boolean }) => Promise<void>;\n\trecordUsage: (input: IRecordUsageInput) => Promise<void>;\n}\n\nexport function useUsage(metric: string): IUseUsageReturn;\nexport function useUsage(client: BillingClient | undefined, metric: string): IUseUsageReturn;\nexport function useUsage(\n\tclientOrMetric: BillingClient | string | undefined,\n\tmaybeMetric?: string,\n): IUseUsageReturn {\n\tconst firstIsClient = clientOrMetric === undefined || clientOrMetric instanceof BillingClient;\n\tconst explicit = firstIsClient ? (clientOrMetric as BillingClient | undefined) : undefined;\n\tconst metric = firstIsClient ? (maybeMetric as string) : clientOrMetric;\n\tconst billing = useFonderieSubClient(explicit, (c) => c.billing, 'useUsage');\n\tconst [total, setTotal] = useState<number | null>(null);\n\tconst [isLoading, setIsLoading] = useState(true);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst refresh = useCallback(\n\t\tasync (opts?: { force?: boolean }) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.getUsage(metric, { bust: opts?.force });\n\t\t\t\tsetTotal(result.total);\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[billing, metric],\n\t);\n\n\tconst recordUsage = useCallback(\n\t\tasync (input: IRecordUsageInput) => {\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tawait billing.recordUsage(input);\n\t\t\t\tawait refresh();\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t}\n\t\t},\n\t\t[billing, refresh],\n\t);\n\n\tuseEffect(() => {\n\t\tvoid refresh();\n\t}, [refresh]);\n\n\treturn { total, isLoading, error, refresh, recordUsage };\n}\n","import { BillingClient, FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useEffect, useState } from 'react';\n\nexport interface IUseWalletPreferencesReturn {\n\t// Per-subscriber toggle: when false, a debit stops at the free allowance and\n\t// never draws down purchased credits. null until the first read resolves; a\n\t// subscriber with no balance row reads the server default (true).\n\tspendPurchased: boolean | null;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n\trefresh: (opts?: { force?: boolean }) => Promise<void>;\n\tsetSpendPurchased: (spendPurchased: boolean) => Promise<void>;\n}\n\nexport function useWalletPreferences(client?: BillingClient): IUseWalletPreferencesReturn {\n\tconst billing = useFonderieSubClient(client, (c) => c.billing, 'useWalletPreferences');\n\tconst [spendPurchased, setSpend] = useState<boolean | null>(null);\n\tconst [isLoading, setIsLoading] = useState(true);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst refresh = useCallback(\n\t\tasync (opts?: { force?: boolean }) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.getWallet({ bust: opts?.force });\n\t\t\t\t// The DTO omits spendPurchased when no balance row exists; surface the\n\t\t\t\t// server default (spend_purchased DEFAULT true) rather than null.\n\t\t\t\tsetSpend(result.wallet.spendPurchased ?? true);\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[billing],\n\t);\n\n\tconst setSpendPurchased = useCallback(\n\t\tasync (next: boolean) => {\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\t// The toggle route returns the refreshed wallet, so adopt it directly.\n\t\t\t\tconst { result } = await billing.setWalletPreferences({ spendPurchased: next });\n\t\t\t\tsetSpend(result.wallet.spendPurchased ?? next);\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t}\n\t\t},\n\t\t[billing],\n\t);\n\n\tuseEffect(() => {\n\t\tvoid refresh();\n\t}, [refresh]);\n\n\treturn { spendPurchased, isLoading, error, refresh, setSpendPurchased };\n}\n"],"mappings":";AAWA,SAAS,oBAAAA,yBAAwB;;;ACVjC,SAAS,wBAAwB;AACjC,SAAS,4BAA4B;AACrC,SAAS,aAAa,gBAAgB;AAQ/B,SAAS,i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iBAAS,QAAQ;AAAA,MAClB,UAAE;AACD,qBAAa,KAAK;AAAA,MACnB;AAAA,IACD;AAAA,IACA,CAAC,OAAO;AAAA,EACT;AAEA,QAAM,oBAAoBE;AAAA,IACzB,OAAO,SAAkB;AACxB,eAAS,IAAI;AACb,UAAI;AAEH,cAAM,EAAE,OAAO,IAAI,MAAM,QAAQ,qBAAqB,EAAE,gBAAgB,KAAK,CAAC;AAC9E,iBAAS,OAAO,OAAO,kBAAkB,IAAI;AAAA,MAC9C,SAAS,KAAK;AACb,cAAM,WACL,eAAeF,oBAAmB,MAAM,IAAIA,kBAAiB,WAAW,OAAO,GAAG,GAAG,CAAC;AACvF,iBAAS,QAAQ;AACjB,cAAM;AAAA,MACP;AAAA,IACD;AAAA,IACA,CAAC,OAAO;AAAA,EACT;AAEA,EAAAG,WAAU,MAAM;AACf,SAAK,QAAQ;AAAA,EACd,GAAG,CAAC,OAAO,CAAC;AAEZ,SAAO,EAAE,gBAAgB,WAAW,OAAO,SAAS,kBAAkB;AACvE;","names":["FonderieApiError","FonderieApiError","useFonderieSubClient","useCallback","useState","FonderieApiError","useFonderieSubClient","useCallback","useState","FonderieApiError","useFonderieSubClient","useCallback","useEffect","useState","FonderieApiError","useFonderieSubClient","useCallback","useEffect","useState","BillingClient","FonderieApiError","useFonderieSubClient","useCallback","useEffect","useState","FonderieApiError","useFonderieSubClient","useCallback","useEffect","useState"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/hooks/useBillingPortal.ts","../src/hooks/useCheckout.ts","../src/hooks/usePlan.ts","../src/hooks/usePlans.ts","../src/hooks/useSubscription.ts","../src/hooks/useUsage.ts","../src/hooks/useWalletPreferences.ts","../src/hooks/useWallet.ts","../src/hooks/useWalletTransactions.ts","../src/hooks/useWalletCheckout.ts","../src/hooks/useCancelSubscription.ts","../src/hooks/useReactivateSubscription.ts","../src/hooks/usePaymentMethod.ts","../src/hooks/useInvoices.ts","../src/hooks/useSetupPaymentMethod.ts","../src/hooks/useSavePaymentMethod.ts","../src/hooks/useRemovePaymentMethod.ts"],"sourcesContent":["export type {\n\tBillingClient,\n\tICancelSubscriptionInput,\n\tICheckoutInput,\n\tICreatePlanInput,\n\tIInvoiceDTO,\n\tIPaymentMethodDTO,\n\tIPlanDTO,\n\tIPlanFeature,\n\tIRecordUsageInput,\n\tISubscriptionChangeResult,\n\tISubscriptionDTO,\n\tIUpdatePlanInput,\n\tIWalletCheckoutInput,\n\tIWalletDTO,\n\tIWalletTransactionDTO,\n\tSubscriberType,\n} from '@fonderie/client';\nexport { FonderieApiError } from '@fonderie/client';\nexport type {\n\tIUseBillingPortalReturn,\n\tIUseCancelSubscriptionReturn,\n\tIUseCheckoutReturn,\n\tIUseInvoicesReturn,\n\tIUsePaymentMethodReturn,\n\tIUsePlanReturn,\n\tIUsePlansReturn,\n\tIUseReactivateSubscriptionReturn,\n\tIUseRemovePaymentMethodReturn,\n\tIUseSavePaymentMethodReturn,\n\tIUseSetupPaymentMethodReturn,\n\tIUseSubscriptionReturn,\n\tIUseUsageReturn,\n\tIUseWalletCheckoutReturn,\n\tIUseWalletPreferencesReturn,\n\tIUseWalletReturn,\n\tIUseWalletTransactionsReturn,\n} from './hooks';\nexport {\n\tuseBillingPortal,\n\tuseCancelSubscription,\n\tuseCheckout,\n\tuseInvoices,\n\tusePaymentMethod,\n\tusePlan,\n\tusePlans,\n\tuseReactivateSubscription,\n\tuseRemovePaymentMethod,\n\tuseSavePaymentMethod,\n\tuseSetupPaymentMethod,\n\tuseSubscription,\n\tuseUsage,\n\tuseWallet,\n\tuseWalletCheckout,\n\tuseWalletPreferences,\n\tuseWalletTransactions,\n} from './hooks';\n","import type { BillingClient } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useState } from 'react';\n\nexport interface IUseBillingPortalReturn {\n\topenPortal: () => Promise<string>;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n}\n\nexport function useBillingPortal(client?: BillingClient): IUseBillingPortalReturn {\n\tconst billing = useFonderieSubClient(client, (c) => c.billing, 'useBillingPortal');\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst openPortal = useCallback(async () => {\n\t\tsetIsLoading(true);\n\t\tsetError(null);\n\t\ttry {\n\t\t\tconst { result } = await billing.createPortalSession();\n\t\t\treturn result.url;\n\t\t} catch (err) {\n\t\t\tconst apiError =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\tsetError(apiError);\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tsetIsLoading(false);\n\t\t}\n\t}, [billing]);\n\n\treturn { openPortal, isLoading, error };\n}\n","import type { BillingClient, ICheckoutInput } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useState } from 'react';\n\nexport interface IUseCheckoutReturn {\n\tcheckout: (input: ICheckoutInput) => Promise<string>;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n}\n\nexport function useCheckout(client?: BillingClient): IUseCheckoutReturn {\n\tconst billing = useFonderieSubClient(client, (c) => c.billing, 'useCheckout');\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst checkout = useCallback(\n\t\tasync (input: ICheckoutInput) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.createCheckoutSession(input);\n\t\t\t\treturn result.url;\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[billing],\n\t);\n\n\treturn { checkout, isLoading, error };\n}\n","import type { IPlanDTO } from '@fonderie/client';\nimport { BillingClient, FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useEffect, useState } from 'react';\n\nexport interface IUsePlanReturn {\n\tplan: IPlanDTO | null;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n\trefresh: (opts?: { force?: boolean }) => Promise<void>;\n}\n\nexport function usePlan(planId: string): IUsePlanReturn;\nexport function usePlan(client: BillingClient | undefined, planId: string): IUsePlanReturn;\nexport function usePlan(\n\tclientOrPlanId: BillingClient | string | undefined,\n\tmaybePlanId?: string,\n): IUsePlanReturn {\n\tconst firstIsClient = clientOrPlanId === undefined || clientOrPlanId instanceof BillingClient;\n\tconst explicit = firstIsClient ? (clientOrPlanId as BillingClient | undefined) : undefined;\n\tconst planId = firstIsClient ? (maybePlanId as string) : clientOrPlanId;\n\tconst billing = useFonderieSubClient(explicit, (c) => c.billing, 'usePlan');\n\tconst [plan, setPlan] = useState<IPlanDTO | null>(null);\n\tconst [isLoading, setIsLoading] = useState(true);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst refresh = useCallback(\n\t\tasync (opts?: { force?: boolean }) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.getPlan(planId, { bust: opts?.force });\n\t\t\t\tsetPlan(result.plan);\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[billing, planId],\n\t);\n\n\tuseEffect(() => {\n\t\tvoid refresh();\n\t}, [refresh]);\n\n\treturn { plan, isLoading, error, refresh };\n}\n","import type {\n\tBillingClient,\n\tICreatePlanInput,\n\tIPlanDTO,\n\tIUpdatePlanInput,\n} from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useEffect, useState } from 'react';\n\nexport interface IUsePlansReturn {\n\tplans: IPlanDTO[];\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n\trefresh: (opts?: { force?: boolean }) => Promise<void>;\n\tcreatePlan: (input: ICreatePlanInput) => Promise<IPlanDTO>;\n\tupdatePlan: (planId: string, input: IUpdatePlanInput) => Promise<IPlanDTO>;\n\tdeletePlan: (planId: string) => Promise<void>;\n}\n\nexport function usePlans(client?: BillingClient): IUsePlansReturn {\n\tconst billing = useFonderieSubClient(client, (c) => c.billing, 'usePlans');\n\tconst [plans, setPlans] = useState<IPlanDTO[]>([]);\n\tconst [isLoading, setIsLoading] = useState(true);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst refresh = useCallback(\n\t\tasync (opts?: { force?: boolean }) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.listPlans({ bust: opts?.force });\n\t\t\t\tsetPlans(result.plans);\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[billing],\n\t);\n\n\t// These writes are not auth-gated by @fonderie/billing —\n\t// gate the UI that calls them behind your own admin check before shipping it.\n\tconst createPlan = useCallback(\n\t\tasync (input: ICreatePlanInput) => {\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.createPlan(input);\n\t\t\t\tawait refresh();\n\t\t\t\treturn result.plan;\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t}\n\t\t},\n\t\t[billing, refresh],\n\t);\n\n\tconst updatePlan = useCallback(\n\t\tasync (planId: string, input: IUpdatePlanInput) => {\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.updatePlan(planId, input);\n\t\t\t\tawait refresh();\n\t\t\t\treturn result.plan;\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t}\n\t\t},\n\t\t[billing, refresh],\n\t);\n\n\tconst deletePlan = useCallback(\n\t\tasync (planId: string) => {\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tawait billing.deletePlan(planId);\n\t\t\t\tawait refresh();\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t}\n\t\t},\n\t\t[billing, refresh],\n\t);\n\n\tuseEffect(() => {\n\t\tvoid refresh();\n\t}, [refresh]);\n\n\treturn { plans, isLoading, error, refresh, createPlan, updatePlan, deletePlan };\n}\n","import type { BillingClient, ISubscriptionDTO } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useEffect, useState } from 'react';\n\nexport interface IUseSubscriptionReturn {\n\tsubscription: ISubscriptionDTO | null;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n\trefresh: (opts?: { force?: boolean }) => Promise<void>;\n}\n\nexport function useSubscription(client?: BillingClient): IUseSubscriptionReturn {\n\tconst billing = useFonderieSubClient(client, (c) => c.billing, 'useSubscription');\n\tconst [subscription, setSubscription] = useState<ISubscriptionDTO | null>(null);\n\tconst [isLoading, setIsLoading] = useState(true);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst refresh = useCallback(\n\t\tasync (opts?: { force?: boolean }) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.getSubscription({ bust: opts?.force });\n\t\t\t\tsetSubscription(result.subscription);\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\t// No active subscription is a normal, expected state — not an error banner.\n\t\t\t\tif (apiError.status !== 404) setError(apiError);\n\t\t\t\tsetSubscription(null);\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[billing],\n\t);\n\n\tuseEffect(() => {\n\t\tvoid refresh();\n\t}, [refresh]);\n\n\treturn { subscription, isLoading, error, refresh };\n}\n","import type { IRecordUsageInput } from '@fonderie/client';\nimport { BillingClient, FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useEffect, useState } from 'react';\n\nexport interface IUseUsageReturn {\n\ttotal: number | null;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n\trefresh: (opts?: { force?: boolean }) => Promise<void>;\n\trecordUsage: (input: IRecordUsageInput) => Promise<void>;\n}\n\nexport function useUsage(metric: string): IUseUsageReturn;\nexport function useUsage(client: BillingClient | undefined, metric: string): IUseUsageReturn;\nexport function useUsage(\n\tclientOrMetric: BillingClient | string | undefined,\n\tmaybeMetric?: string,\n): IUseUsageReturn {\n\tconst firstIsClient = clientOrMetric === undefined || clientOrMetric instanceof BillingClient;\n\tconst explicit = firstIsClient ? (clientOrMetric as BillingClient | undefined) : undefined;\n\tconst metric = firstIsClient ? (maybeMetric as string) : clientOrMetric;\n\tconst billing = useFonderieSubClient(explicit, (c) => c.billing, 'useUsage');\n\tconst [total, setTotal] = useState<number | null>(null);\n\tconst [isLoading, setIsLoading] = useState(true);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst refresh = useCallback(\n\t\tasync (opts?: { force?: boolean }) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.getUsage(metric, { bust: opts?.force });\n\t\t\t\tsetTotal(result.total);\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[billing, metric],\n\t);\n\n\tconst recordUsage = useCallback(\n\t\tasync (input: IRecordUsageInput) => {\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tawait billing.recordUsage(input);\n\t\t\t\tawait refresh();\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t}\n\t\t},\n\t\t[billing, refresh],\n\t);\n\n\tuseEffect(() => {\n\t\tvoid refresh();\n\t}, [refresh]);\n\n\treturn { total, isLoading, error, refresh, recordUsage };\n}\n","import { BillingClient, FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useEffect, useState } from 'react';\n\nexport interface IUseWalletPreferencesReturn {\n\t// Per-subscriber toggle: when false, a debit stops at the free allowance and\n\t// never draws down purchased credits. null until the first read resolves; a\n\t// subscriber with no balance row reads the server default (true).\n\tspendPurchased: boolean | null;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n\trefresh: (opts?: { force?: boolean }) => Promise<void>;\n\tsetSpendPurchased: (spendPurchased: boolean) => Promise<void>;\n}\n\nexport function useWalletPreferences(client?: BillingClient): IUseWalletPreferencesReturn {\n\tconst billing = useFonderieSubClient(client, (c) => c.billing, 'useWalletPreferences');\n\tconst [spendPurchased, setSpend] = useState<boolean | null>(null);\n\tconst [isLoading, setIsLoading] = useState(true);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst refresh = useCallback(\n\t\tasync (opts?: { force?: boolean }) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.getWallet({ bust: opts?.force });\n\t\t\t\t// The DTO omits spendPurchased when no balance row exists; surface the\n\t\t\t\t// server default (spend_purchased DEFAULT true) rather than null.\n\t\t\t\tsetSpend(result.wallet.spendPurchased ?? true);\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[billing],\n\t);\n\n\tconst setSpendPurchased = useCallback(\n\t\tasync (next: boolean) => {\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\t// The toggle route returns the refreshed wallet, so adopt it directly.\n\t\t\t\tconst { result } = await billing.setWalletPreferences({ spendPurchased: next });\n\t\t\t\tsetSpend(result.wallet.spendPurchased ?? next);\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t}\n\t\t},\n\t\t[billing],\n\t);\n\n\tuseEffect(() => {\n\t\tvoid refresh();\n\t}, [refresh]);\n\n\treturn { spendPurchased, isLoading, error, refresh, setSpendPurchased };\n}\n","import type { BillingClient, IWalletDTO } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useEffect, useState } from 'react';\n\nexport interface IUseWalletReturn {\n\t// The balance snapshot. Money fields are digit strings (server bigint →\n\t// string); null until the first read resolves or after a failed read.\n\twallet: IWalletDTO | null;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n\trefresh: (opts?: { force?: boolean }) => Promise<void>;\n}\n\n// The subscriber's stored-value wallet balance. Reads GET /billing/wallet, so\n// it reflects the periodic grant withBilling applies on every authed request.\nexport function useWallet(client?: BillingClient): IUseWalletReturn {\n\tconst billing = useFonderieSubClient(client, (c) => c.billing, 'useWallet');\n\tconst [wallet, setWallet] = useState<IWalletDTO | null>(null);\n\tconst [isLoading, setIsLoading] = useState(true);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst refresh = useCallback(\n\t\tasync (opts?: { force?: boolean }) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.getWallet({ bust: opts?.force });\n\t\t\t\tsetWallet(result.wallet);\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tsetWallet(null);\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[billing],\n\t);\n\n\tuseEffect(() => {\n\t\tvoid refresh();\n\t}, [refresh]);\n\n\treturn { wallet, isLoading, error, refresh };\n}\n","import type { BillingClient, IWalletTransactionDTO } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useEffect, useState } from 'react';\n\nexport interface IUseWalletTransactionsReturn {\n\ttransactions: IWalletTransactionDTO[];\n\t// Opaque cursor for the next page, or null when the ledger is exhausted.\n\tnextCursor: string | null;\n\thasMore: boolean;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n\trefresh: (opts?: { force?: boolean }) => Promise<void>;\n\t// Appends the next page. No-op when there is no further page.\n\tloadMore: () => Promise<void>;\n}\n\n// The wallet ledger, newest first — every credit/debit with a running\n// balanceAfter. Cursor-paginated: `loadMore` appends the next page.\nexport function useWalletTransactions(client?: BillingClient): IUseWalletTransactionsReturn {\n\tconst billing = useFonderieSubClient(client, (c) => c.billing, 'useWalletTransactions');\n\tconst [transactions, setTransactions] = useState<IWalletTransactionDTO[]>([]);\n\tconst [nextCursor, setNextCursor] = useState<string | null>(null);\n\tconst [isLoading, setIsLoading] = useState(true);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst refresh = useCallback(\n\t\tasync (opts?: { force?: boolean }) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.getWalletTransactions({ bust: opts?.force });\n\t\t\t\tsetTransactions(result.transactions);\n\t\t\t\tsetNextCursor(result.nextCursor);\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[billing],\n\t);\n\n\tconst loadMore = useCallback(async () => {\n\t\tif (!nextCursor) return;\n\t\tsetError(null);\n\t\ttry {\n\t\t\tconst { result } = await billing.getWalletTransactions({ cursor: nextCursor });\n\t\t\tsetTransactions((prev) => [...prev, ...result.transactions]);\n\t\t\tsetNextCursor(result.nextCursor);\n\t\t} catch (err) {\n\t\t\tconst apiError =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\tsetError(apiError);\n\t\t\tthrow apiError;\n\t\t}\n\t}, [billing, nextCursor]);\n\n\tuseEffect(() => {\n\t\tvoid refresh();\n\t}, [refresh]);\n\n\treturn {\n\t\ttransactions,\n\t\tnextCursor,\n\t\thasMore: nextCursor !== null,\n\t\tisLoading,\n\t\terror,\n\t\trefresh,\n\t\tloadMore,\n\t};\n}\n","import type { BillingClient, IWalletCheckoutInput } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useState } from 'react';\n\nexport interface IUseWalletCheckoutReturn {\n\t// Starts a one-time credit-pack purchase and resolves to the hosted checkout\n\t// URL to redirect the buyer to; the wallet is credited by the payment webhook.\n\tcheckout: (input: IWalletCheckoutInput) => Promise<string>;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n}\n\nexport function useWalletCheckout(client?: BillingClient): IUseWalletCheckoutReturn {\n\tconst billing = useFonderieSubClient(client, (c) => c.billing, 'useWalletCheckout');\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst checkout = useCallback(\n\t\tasync (input: IWalletCheckoutInput) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.createWalletCheckout(input);\n\t\t\t\treturn result.url;\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[billing],\n\t);\n\n\treturn { checkout, isLoading, error };\n}\n","import type {\n\tBillingClient,\n\tICancelSubscriptionInput,\n\tISubscriptionChangeResult,\n} from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useState } from 'react';\n\nexport interface IUseCancelSubscriptionReturn {\n\t// First-party cancel — no billing-portal round-trip. Default keeps access\n\t// until the paid-through date; pass { atPeriodEnd: false } to end it now.\n\t// Resolves to the new lifecycle state ({ atPeriodEnd, status, currentPeriodEnd }).\n\tcancel: (input?: ICancelSubscriptionInput) => Promise<ISubscriptionChangeResult>;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n}\n\nexport function useCancelSubscription(client?: BillingClient): IUseCancelSubscriptionReturn {\n\tconst billing = useFonderieSubClient(client, (c) => c.billing, 'useCancelSubscription');\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst cancel = useCallback(\n\t\tasync (input?: ICancelSubscriptionInput) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.cancelSubscription(input);\n\t\t\t\treturn result;\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[billing],\n\t);\n\n\treturn { cancel, isLoading, error };\n}\n","import type { BillingClient, ISubscriptionChangeResult } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useState } from 'react';\n\nexport interface IUseReactivateSubscriptionReturn {\n\t// Un-cancel a subscription scheduled to cancel at period end. Resolves to the\n\t// new lifecycle state; rejects (409) if the subscription is already fully\n\t// canceled — the caller should start a fresh checkout in that case.\n\treactivate: () => Promise<ISubscriptionChangeResult>;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n}\n\nexport function useReactivateSubscription(client?: BillingClient): IUseReactivateSubscriptionReturn {\n\tconst billing = useFonderieSubClient(client, (c) => c.billing, 'useReactivateSubscription');\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst reactivate = useCallback(async () => {\n\t\tsetIsLoading(true);\n\t\tsetError(null);\n\t\ttry {\n\t\t\tconst { result } = await billing.reactivateSubscription();\n\t\t\treturn result;\n\t\t} catch (err) {\n\t\t\tconst apiError =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\tsetError(apiError);\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tsetIsLoading(false);\n\t\t}\n\t}, [billing]);\n\n\treturn { reactivate, isLoading, error };\n}\n","import type { BillingClient, IPaymentMethodDTO } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useEffect, useState } from 'react';\n\nexport interface IUsePaymentMethodReturn {\n\t// The card on file (brand/last4/expiry), or null when none is stored or the\n\t// provider can't retrieve one (a normal \"no card\" state, not an error).\n\tpaymentMethod: IPaymentMethodDTO | null;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n\trefresh: (opts?: { force?: boolean }) => Promise<void>;\n}\n\n// The subscriber's card on file, for a billing page. Reads GET\n// /billing/payment-method.\nexport function usePaymentMethod(client?: BillingClient): IUsePaymentMethodReturn {\n\tconst billing = useFonderieSubClient(client, (c) => c.billing, 'usePaymentMethod');\n\tconst [paymentMethod, setPaymentMethod] = useState<IPaymentMethodDTO | null>(null);\n\tconst [isLoading, setIsLoading] = useState(true);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst refresh = useCallback(\n\t\tasync (opts?: { force?: boolean }) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.getPaymentMethod({ bust: opts?.force });\n\t\t\t\tsetPaymentMethod(result.paymentMethod);\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\t// 501 = the provider can't retrieve a card — a normal \"no card on\n\t\t\t\t// file\" state for a UI, not an error banner.\n\t\t\t\tif (apiError.status !== 501) setError(apiError);\n\t\t\t\tsetPaymentMethod(null);\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[billing],\n\t);\n\n\tuseEffect(() => {\n\t\tvoid refresh();\n\t}, [refresh]);\n\n\treturn { paymentMethod, isLoading, error, refresh };\n}\n","import type { BillingClient, IInvoiceDTO } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useEffect, useState } from 'react';\n\nexport interface IUseInvoicesReturn {\n\t// Invoices newest first; each links out via hostedInvoiceUrl/invoicePdf.\n\tinvoices: IInvoiceDTO[];\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n\trefresh: (opts?: { force?: boolean }) => Promise<void>;\n}\n\n// The subscriber's invoice history, for a billing page. Reads GET\n// /billing/invoices.\nexport function useInvoices(client?: BillingClient): IUseInvoicesReturn {\n\tconst billing = useFonderieSubClient(client, (c) => c.billing, 'useInvoices');\n\tconst [invoices, setInvoices] = useState<IInvoiceDTO[]>([]);\n\tconst [isLoading, setIsLoading] = useState(true);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst refresh = useCallback(\n\t\tasync (opts?: { force?: boolean }) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.listInvoices({ bust: opts?.force });\n\t\t\t\tsetInvoices(result.invoices);\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\t// 501 = the provider can't list invoices — a normal \"no invoices\" state.\n\t\t\t\tif (apiError.status !== 501) setError(apiError);\n\t\t\t\tsetInvoices([]);\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[billing],\n\t);\n\n\tuseEffect(() => {\n\t\tvoid refresh();\n\t}, [refresh]);\n\n\treturn { invoices, isLoading, error, refresh };\n}\n","import type { BillingClient } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useState } from 'react';\n\nexport interface IUseSetupPaymentMethodReturn {\n\t// Begin in-app card entry — resolves to the provider SetupIntent client secret\n\t// the embedded card element (Stripe Payment Element) confirms. No redirect;\n\t// the user never leaves the site. 501 when the provider has no in-app support.\n\tsetup: () => Promise<string>;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n}\n\nexport function useSetupPaymentMethod(client?: BillingClient): IUseSetupPaymentMethodReturn {\n\tconst billing = useFonderieSubClient(client, (c) => c.billing, 'useSetupPaymentMethod');\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst setup = useCallback(async () => {\n\t\tsetIsLoading(true);\n\t\tsetError(null);\n\t\ttry {\n\t\t\tconst { result } = await billing.setupPaymentMethod();\n\t\t\treturn result.clientSecret;\n\t\t} catch (err) {\n\t\t\tconst apiError =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\tsetError(apiError);\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tsetIsLoading(false);\n\t\t}\n\t}, [billing]);\n\n\treturn { setup, isLoading, error };\n}\n","import type { BillingClient, IPaymentMethodDTO } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useState } from 'react';\n\nexport interface IUseSavePaymentMethodReturn {\n\t// Save the card after the Payment Element confirms the SetupIntent: makes it\n\t// the default and records it. Resolves to the saved card for display; rejects\n\t// (422) if the card isn't attached to this customer.\n\tsave: (paymentMethodId: string) => Promise<IPaymentMethodDTO | null>;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n}\n\nexport function useSavePaymentMethod(client?: BillingClient): IUseSavePaymentMethodReturn {\n\tconst billing = useFonderieSubClient(client, (c) => c.billing, 'useSavePaymentMethod');\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst save = useCallback(\n\t\tasync (paymentMethodId: string) => {\n\t\t\tsetIsLoading(true);\n\t\t\tsetError(null);\n\t\t\ttry {\n\t\t\t\tconst { result } = await billing.savePaymentMethod({ paymentMethodId });\n\t\t\t\treturn result.paymentMethod;\n\t\t\t} catch (err) {\n\t\t\t\tconst apiError =\n\t\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\t\tsetError(apiError);\n\t\t\t\tthrow apiError;\n\t\t\t} finally {\n\t\t\t\tsetIsLoading(false);\n\t\t\t}\n\t\t},\n\t\t[billing],\n\t);\n\n\treturn { save, isLoading, error };\n}\n","import type { BillingClient } from '@fonderie/client';\nimport { FonderieApiError } from '@fonderie/client';\nimport { useFonderieSubClient } from '@fonderie/react';\nimport { useCallback, useState } from 'react';\n\nexport interface IUseRemovePaymentMethodReturn {\n\t// Remove the saved card (detach at the provider + clear the record).\n\tremove: () => Promise<void>;\n\tisLoading: boolean;\n\terror: FonderieApiError | null;\n}\n\nexport function useRemovePaymentMethod(client?: BillingClient): IUseRemovePaymentMethodReturn {\n\tconst billing = useFonderieSubClient(client, (c) => c.billing, 'useRemovePaymentMethod');\n\tconst [isLoading, setIsLoading] = useState(false);\n\tconst [error, setError] = useState<FonderieApiError | null>(null);\n\n\tconst remove = useCallback(async () => {\n\t\tsetIsLoading(true);\n\t\tsetError(null);\n\t\ttry {\n\t\t\tawait billing.removePaymentMethod();\n\t\t} catch (err) {\n\t\t\tconst apiError =\n\t\t\t\terr instanceof FonderieApiError ? err : new FonderieApiError('unknown', String(err), 0);\n\t\t\tsetError(apiError);\n\t\t\tthrow apiError;\n\t\t} finally {\n\t\t\tsetIsLoading(false);\n\t\t}\n\t}, [billing]);\n\n\treturn { remove, isLoading, error };\n}\n"],"mappings":";AAkBA,SAAS,oBAAAA,0BAAwB;;;ACjBjC,SAAS,wBAAwB;AACjC,SAAS,4BAA4B;AACrC,SAAS,aAAa,gBAAgB;AAQ/B,SAAS,iBAAiB,QAAiD;AACjF,QAAM,UAAU,qBAAqB,QAAQ,CAAC,MAAM,EAAE,SAAS,kBAAkB;AACjF,QAAM,CA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AACrC,SAAS,eAAAC,eAAa,YAAAC,kBAAgB;AAS/B,SAAS,uBAAuB,QAAuD;AAC7F,QAAM,UAAUF,uBAAqB,QAAQ,CAAC,MAAM,EAAE,SAAS,wBAAwB;AACvF,QAAM,CAAC,WAAW,YAAY,IAAIE,WAAS,KAAK;AAChD,QAAM,CAAC,OAAO,QAAQ,IAAIA,WAAkC,IAAI;AAEhE,QAAM,SAASD,cAAY,YAAY;AACtC,iBAAa,IAAI;AACjB,aAAS,IAAI;AACb,QAAI;AACH,YAAM,QAAQ,oBAAoB;AAAA,IACnC,SAAS,KAAK;AACb,YAAM,WACL,eAAeF,qBAAmB,MAAM,IAAIA,mBAAiB,WAAW,OAAO,GAAG,GAAG,CAAC;AACvF,eAAS,QAAQ;AACjB,YAAM;AAAA,IACP,UAAE;AACD,mBAAa,KAAK;AAAA,IACnB;AAAA,EACD,GAAG,CAAC,OAAO,CAAC;AAEZ,SAAO,EAAE,QAAQ,WAAW,MAAM;AACnC;","names":["FonderieApiError","FonderieApiError","useFonderieSubClient","useCallback","useState","FonderieApiError","useFonderieSubClient","useCallback","useState","FonderieApiError","useFonderieSubClient","useCallback","useEffect","useState","FonderieApiError","useFonderieSubClient","useCallback","useEffect","useState","BillingClient","FonderieApiError","useFonderieSubClient","useCallback","useEffect","useState","FonderieApiError","useFonderieSubClient","useCallback","useEffect","useState","FonderieApiError","useFonderieSubClient","useCallback","useEffect","useState","FonderieApiError","useFonderieSubClient","useCallback","useEffect","useState","FonderieApiError","useFonderieSubClient","useCallback","useState","FonderieApiError","useFonderieSubClient","useCallback","useState","FonderieApiError","useFonderieSubClient","useCallback","useState","FonderieApiError","useFonderieSubClient","useCallback","useEffect","useState","FonderieApiError","useFonderieSubClient","useCallback","useEffect","useState","FonderieApiError","useFonderieSubClient","useCallback","useState","FonderieApiError","useFonderieSubClient","useCallback","useState","FonderieApiError","useFonderieSubClient","useCallback","useState"]}
|