autumn-js 0.1.11 → 0.1.12
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/libraries/backend/better-auth.d.mts +30 -26
- package/dist/libraries/backend/better-auth.d.ts +30 -26
- package/dist/libraries/backend/better-auth.js +172 -2
- package/dist/libraries/backend/better-auth.mjs +7 -7
- package/dist/libraries/backend/{chunk-EW2R7722.mjs → chunk-2DWGCQCF.mjs} +1 -1
- package/dist/libraries/backend/{chunk-VNJ3MFJE.mjs → chunk-56RGUNOT.mjs} +1 -1
- package/dist/libraries/backend/{chunk-P3ARLB2M.mjs → chunk-6JI6MF4S.mjs} +1 -1
- package/dist/libraries/backend/{chunk-5DDCZMDB.mjs → chunk-FA5Z2MOT.mjs} +1 -1
- package/dist/libraries/backend/{chunk-RAHKKJED.mjs → chunk-NWPFUFXX.mjs} +6 -6
- package/dist/libraries/backend/{chunk-NAP2URIW.mjs → chunk-Q7SD535L.mjs} +172 -2
- package/dist/libraries/backend/{chunk-7K3RATTK.mjs → chunk-SDL7BFTH.mjs} +1 -1
- package/dist/libraries/backend/convex.js +172 -2
- package/dist/libraries/backend/convex.mjs +7 -7
- package/dist/libraries/backend/elysia.js +172 -2
- package/dist/libraries/backend/elysia.mjs +7 -7
- package/dist/libraries/backend/express.d.mts +1 -1
- package/dist/libraries/backend/express.d.ts +1 -1
- package/dist/libraries/backend/express.js +172 -2
- package/dist/libraries/backend/express.mjs +7 -7
- package/dist/libraries/backend/fastify.js +172 -2
- package/dist/libraries/backend/fastify.mjs +7 -7
- package/dist/libraries/backend/hono.js +172 -2
- package/dist/libraries/backend/hono.mjs +7 -7
- package/dist/libraries/backend/index.d.mts +1 -1
- package/dist/libraries/backend/index.d.ts +1 -1
- package/dist/libraries/backend/index.js +172 -2
- package/dist/libraries/backend/index.mjs +7 -7
- package/dist/libraries/backend/next.js +172 -2
- package/dist/libraries/backend/next.mjs +7 -7
- package/dist/libraries/backend/react-router.js +172 -2
- package/dist/libraries/backend/react-router.mjs +7 -7
- package/dist/libraries/backend/{referralTypes-C1eZ8cjO.d.mts → referralTypes-BOsjdpOb.d.mts} +176 -6
- package/dist/libraries/backend/{referralTypes-FlI0fYwz.d.ts → referralTypes-DcfU8B6R.d.ts} +176 -6
- package/dist/libraries/backend/remix_dep.js +172 -2
- package/dist/libraries/backend/remix_dep.mjs +7 -7
- package/dist/libraries/backend/routes/backendRouter.js +172 -2
- package/dist/libraries/backend/routes/backendRouter.mjs +7 -7
- package/dist/libraries/backend/routes/entityRoutes.js +172 -2
- package/dist/libraries/backend/routes/entityRoutes.mjs +3 -3
- package/dist/libraries/backend/routes/genRoutes.js +172 -2
- package/dist/libraries/backend/routes/genRoutes.mjs +3 -3
- package/dist/libraries/backend/routes/productRoutes.js +172 -2
- package/dist/libraries/backend/routes/productRoutes.mjs +3 -3
- package/dist/libraries/backend/routes/referralRoutes.js +172 -2
- package/dist/libraries/backend/routes/referralRoutes.mjs +3 -3
- package/dist/libraries/backend/supabase.js +172 -2
- package/dist/libraries/backend/supabase.mjs +7 -7
- package/dist/libraries/backend/tanstack.js +172 -2
- package/dist/libraries/backend/tanstack.mjs +7 -7
- package/dist/libraries/backend/utils/backendRes.js +172 -2
- package/dist/libraries/backend/utils/backendRes.mjs +1 -1
- package/dist/libraries/backend/utils/withAuth.d.mts +1 -1
- package/dist/libraries/backend/utils/withAuth.d.ts +1 -1
- package/dist/libraries/backend/utils/withAuth.js +172 -2
- package/dist/libraries/backend/utils/withAuth.mjs +2 -2
- package/dist/libraries/react/AutumnContext.d.mts +6 -6
- package/dist/libraries/react/AutumnContext.d.ts +6 -6
- package/dist/libraries/react/AutumnContext.js +172 -2
- package/dist/libraries/react/AutumnContext.mjs +4 -4
- package/dist/libraries/react/BaseAutumnProvider.d.mts +6 -6
- package/dist/libraries/react/BaseAutumnProvider.d.ts +6 -6
- package/dist/libraries/react/BaseAutumnProvider.js +172 -13
- package/dist/libraries/react/BaseAutumnProvider.mjs +9 -9
- package/dist/libraries/react/{ReactAutumnClient-CfDtucnL.d.ts → ReactAutumnClient-CIAkiqwV.d.ts} +5 -5
- package/dist/libraries/react/{ReactAutumnClient-IFdMWiu5.d.mts → ReactAutumnClient-zBxnpPLM.d.mts} +5 -5
- package/dist/libraries/react/ReactAutumnProvider.d.mts +2 -2
- package/dist/libraries/react/ReactAutumnProvider.d.ts +2 -2
- package/dist/libraries/react/ReactAutumnProvider.js +172 -13
- package/dist/libraries/react/ReactAutumnProvider.mjs +10 -10
- package/dist/libraries/react/{attachTypes-CLK4jfuj.d.ts → attachTypes-BQaZHr5e.d.ts} +1 -1
- package/dist/libraries/react/{attachTypes-C5gcbNrS.d.mts → attachTypes-Cuxn1ThG.d.mts} +1 -1
- package/dist/libraries/react/{chunk-4NZ7ML7V.mjs → chunk-26K62U62.mjs} +2 -2
- package/dist/libraries/react/{chunk-WYQMHQUE.mjs → chunk-5O3IHYFF.mjs} +172 -2
- package/dist/libraries/react/{chunk-3MF54MDU.mjs → chunk-5RTUQSYZ.mjs} +1 -1
- package/dist/libraries/react/{chunk-XK3AXQED.mjs → chunk-6X76WFOV.mjs} +3 -13
- package/dist/libraries/react/{chunk-JHFJKAXG.mjs → chunk-7A2PZDUO.mjs} +25 -25
- package/dist/libraries/react/{chunk-YHT2JUXO.mjs → chunk-7HRCOEUW.mjs} +1 -1
- package/dist/libraries/react/{chunk-KP2Q65Y3.mjs → chunk-CMUWZZWV.mjs} +2 -2
- package/dist/libraries/react/{chunk-KMYL54B4.mjs → chunk-DKOF357C.mjs} +1 -1
- package/dist/libraries/react/{chunk-67RWFVWN.mjs → chunk-HNIU2WNT.mjs} +2 -2
- package/dist/libraries/react/{chunk-U3OQJXCW.mjs → chunk-JTYEHM27.mjs} +4 -4
- package/dist/libraries/react/{chunk-6D6TYTTO.mjs → chunk-P6CAHZVT.mjs} +1 -2
- package/dist/libraries/react/{chunk-TTLL63A4.mjs → chunk-QNMB7QR6.mjs} +3 -3
- package/dist/libraries/react/{chunk-2ENHPIYQ.mjs → chunk-RK4NRHHQ.mjs} +3 -3
- package/dist/libraries/react/{chunk-VZY225C6.mjs → chunk-ROKCGZ77.mjs} +2 -2
- package/dist/libraries/react/{chunk-FDNQ6GRK.mjs → chunk-TE2MOBO7.mjs} +1 -1
- package/dist/libraries/react/{chunk-OMJJLT2Q.mjs → chunk-VGNA76RG.mjs} +1 -1
- package/dist/libraries/react/client/ReactAutumnClient.d.mts +6 -6
- package/dist/libraries/react/client/ReactAutumnClient.d.ts +6 -6
- package/dist/libraries/react/client/ReactAutumnClient.js +172 -2
- package/dist/libraries/react/client/ReactAutumnClient.mjs +3 -3
- package/dist/libraries/react/client/clientCompMethods.d.mts +6 -6
- package/dist/libraries/react/client/clientCompMethods.d.ts +6 -6
- package/dist/libraries/react/client/clientCusMethods.d.mts +6 -6
- package/dist/libraries/react/client/clientCusMethods.d.ts +6 -6
- package/dist/libraries/react/client/clientEntityMethods.d.mts +6 -6
- package/dist/libraries/react/client/clientEntityMethods.d.ts +6 -6
- package/dist/libraries/react/client/clientGenMethods.d.mts +6 -6
- package/dist/libraries/react/client/clientGenMethods.d.ts +6 -6
- package/dist/libraries/react/client/clientProdMethods.d.mts +6 -6
- package/dist/libraries/react/client/clientProdMethods.d.ts +6 -6
- package/dist/libraries/react/client/clientReferralMethods.d.mts +6 -6
- package/dist/libraries/react/client/clientReferralMethods.d.ts +6 -6
- package/dist/libraries/react/client/types/clientGenTypes.js +172 -2
- package/dist/libraries/react/client/types/clientGenTypes.mjs +1 -1
- package/dist/libraries/react/components/checkout-dialog/checkout-dialog-synced.d.mts +2 -2
- package/dist/libraries/react/components/checkout-dialog/checkout-dialog-synced.d.ts +2 -2
- package/dist/libraries/react/components/checkout-dialog/checkout-dialog-synced.js +172 -13
- package/dist/libraries/react/components/checkout-dialog/checkout-dialog-synced.mjs +26 -26
- package/dist/libraries/react/components/checkout-dialog/lib/checkout-content.d.mts +2 -2
- package/dist/libraries/react/components/checkout-dialog/lib/checkout-content.d.ts +2 -2
- package/dist/libraries/react/components/paywall-dialog/lib/paywall-content.d.mts +1 -1
- package/dist/libraries/react/components/paywall-dialog/lib/paywall-content.d.ts +1 -1
- package/dist/libraries/react/components/paywall-dialog/paywall-dialog-synced.js +172 -2
- package/dist/libraries/react/components/paywall-dialog/paywall-dialog-synced.mjs +26 -26
- package/dist/libraries/react/components/pricing-table/lib/pricing-table-content.d.mts +1 -1
- package/dist/libraries/react/components/pricing-table/lib/pricing-table-content.d.ts +1 -1
- package/dist/libraries/react/components/pricing-table/pricing-table-synced.d.mts +1 -1
- package/dist/libraries/react/components/pricing-table/pricing-table-synced.d.ts +1 -1
- package/dist/libraries/react/components/pricing-table/pricing-table-synced.js +172 -13
- package/dist/libraries/react/components/pricing-table/pricing-table-synced.mjs +26 -26
- package/dist/libraries/react/components/ui/button.d.mts +2 -2
- package/dist/libraries/react/components/ui/button.d.ts +2 -2
- package/dist/libraries/react/components/ui/dialog.mjs +2 -2
- package/dist/libraries/react/components/ui/popover.mjs +2 -2
- package/dist/libraries/react/{cusTypes-CBapqjzm.d.mts → cusTypes-B2m4-oz4.d.mts} +1 -1
- package/dist/libraries/react/{cusTypes-D13MXEN7.d.ts → cusTypes-lMnznWYJ.d.ts} +1 -1
- package/dist/libraries/react/{entTypes-C1bM1Zpv.d.mts → entTypes-D-gn1jj2.d.mts} +1 -1
- package/dist/libraries/react/{entTypes-DbIrfEpl.d.ts → entTypes-WMQRyYAv.d.ts} +1 -1
- package/dist/libraries/react/{genTypes-C_ilxndU.d.mts → genTypes-DdYlVEah.d.mts} +1 -1
- package/dist/libraries/react/{genTypes-DjcQWIOM.d.ts → genTypes-aPPwPimh.d.ts} +1 -1
- package/dist/libraries/react/hooks/helpers/handleCheck.d.mts +6 -6
- package/dist/libraries/react/hooks/helpers/handleCheck.d.ts +6 -6
- package/dist/libraries/react/hooks/helpers/handleCheck.js +172 -2
- package/dist/libraries/react/hooks/helpers/handleCheck.mjs +2 -2
- package/dist/libraries/react/hooks/helpers/useAutumnBase.d.mts +6 -6
- package/dist/libraries/react/hooks/helpers/useAutumnBase.d.ts +6 -6
- package/dist/libraries/react/hooks/helpers/useAutumnBase.js +172 -3
- package/dist/libraries/react/hooks/helpers/useAutumnBase.mjs +3 -3
- package/dist/libraries/react/hooks/useAnalytics.d.mts +2 -2
- package/dist/libraries/react/hooks/useAnalytics.d.ts +2 -2
- package/dist/libraries/react/hooks/useAnalytics.js +172 -2
- package/dist/libraries/react/hooks/useAnalytics.mjs +5 -5
- package/dist/libraries/react/hooks/useCustomer.d.mts +66 -8
- package/dist/libraries/react/hooks/useCustomer.d.ts +66 -8
- package/dist/libraries/react/hooks/useCustomer.js +172 -13
- package/dist/libraries/react/hooks/useCustomer.mjs +9 -9
- package/dist/libraries/react/hooks/useCustomerBase.d.mts +50 -9
- package/dist/libraries/react/hooks/useCustomerBase.d.ts +50 -9
- package/dist/libraries/react/hooks/useCustomerBase.js +172 -13
- package/dist/libraries/react/hooks/useCustomerBase.mjs +8 -8
- package/dist/libraries/react/hooks/useEntity.d.mts +4 -4
- package/dist/libraries/react/hooks/useEntity.d.ts +4 -4
- package/dist/libraries/react/hooks/useEntity.js +172 -3
- package/dist/libraries/react/hooks/useEntity.mjs +9 -9
- package/dist/libraries/react/hooks/useEntityBase.d.mts +6 -6
- package/dist/libraries/react/hooks/useEntityBase.d.ts +6 -6
- package/dist/libraries/react/hooks/useEntityBase.js +172 -3
- package/dist/libraries/react/hooks/useEntityBase.mjs +8 -8
- package/dist/libraries/react/hooks/usePaywall.d.mts +1 -1
- package/dist/libraries/react/hooks/usePaywall.d.ts +1 -1
- package/dist/libraries/react/hooks/usePaywall.js +172 -2
- package/dist/libraries/react/hooks/usePaywall.mjs +5 -5
- package/dist/libraries/react/hooks/usePricingTable.d.mts +1 -1
- package/dist/libraries/react/hooks/usePricingTable.d.ts +1 -1
- package/dist/libraries/react/hooks/usePricingTable.js +172 -2
- package/dist/libraries/react/hooks/usePricingTable.mjs +6 -6
- package/dist/libraries/react/hooks/usePricingTableBase.d.mts +6 -6
- package/dist/libraries/react/hooks/usePricingTableBase.d.ts +6 -6
- package/dist/libraries/react/hooks/usePricingTableBase.js +172 -2
- package/dist/libraries/react/hooks/usePricingTableBase.mjs +2 -2
- package/dist/libraries/react/hooks/useProductsBase.d.mts +6 -6
- package/dist/libraries/react/hooks/useProductsBase.d.ts +6 -6
- package/dist/libraries/react/index.d.mts +104 -7
- package/dist/libraries/react/index.d.ts +104 -7
- package/dist/libraries/react/index.js +172 -13
- package/dist/libraries/react/index.mjs +172 -13
- package/dist/libraries/react/{prodTypes-B8NdKyKo.d.ts → prodTypes-C8xRoBP7.d.mts} +1 -1
- package/dist/libraries/react/{prodTypes-B8NdKyKo.d.mts → prodTypes-C8xRoBP7.d.ts} +1 -1
- package/dist/next/client/hooks/useCustomer.d.mts +44 -7
- package/dist/next/client/hooks/useCustomer.d.ts +44 -7
- package/dist/next/server/cusActions.d.mts +176 -6
- package/dist/next/server/cusActions.d.ts +176 -6
- package/dist/sdk/index.d.mts +174 -4
- package/dist/sdk/index.d.ts +174 -4
- package/dist/sdk/index.js +171 -1
- package/dist/sdk/index.mjs +171 -1
- package/dist/utils/encryptUtils.js +172 -2
- package/dist/utils/encryptUtils.mjs +172 -2
- package/package.json +1 -1
- package/dist/libraries/react/{chunk-7JNU5ABT.mjs → chunk-FJWZPMWU.mjs} +3 -3
- package/dist/libraries/react/{chunk-LCWL3TIT.mjs → chunk-OTZ65PCT.mjs} +3 -3
|
@@ -487,22 +487,92 @@ var Autumn = class {
|
|
|
487
487
|
entities = entityMethods(this);
|
|
488
488
|
referrals = referralMethods(this);
|
|
489
489
|
features = featureMethods(this);
|
|
490
|
-
|
|
490
|
+
/**
|
|
491
|
+
* Initiates a checkout flow for a product purchase.
|
|
492
|
+
*
|
|
493
|
+
* The checkout function handles the purchase process for products with pricing.
|
|
494
|
+
* It determines whether to show a dialog for user input or redirect directly
|
|
495
|
+
* to Stripe based on the customer's state and product requirements.
|
|
496
|
+
*
|
|
497
|
+
* @param params - Checkout parameters including product ID, customer data, and options
|
|
498
|
+
* @returns Promise resolving to checkout details including pricing, prorations, and URLs
|
|
499
|
+
*
|
|
500
|
+
* @example
|
|
501
|
+
* ```typescript
|
|
502
|
+
* const result = await autumn.checkout({
|
|
503
|
+
* customer_id: "user_123",
|
|
504
|
+
* product_id: "pro",
|
|
505
|
+
* success_url: "https://myapp.com/success"
|
|
506
|
+
* });
|
|
507
|
+
*
|
|
508
|
+
* if (result.url) {
|
|
509
|
+
* // Redirect to Stripe checkout
|
|
510
|
+
* window.location.href = result.url;
|
|
511
|
+
* }
|
|
512
|
+
* ```
|
|
513
|
+
*/
|
|
491
514
|
async checkout(params) {
|
|
492
515
|
return handleCheckout({
|
|
493
516
|
instance: this,
|
|
494
517
|
params
|
|
495
518
|
});
|
|
496
519
|
}
|
|
497
|
-
static
|
|
520
|
+
static checkout = (params) => staticWrapper(handleCheckout, void 0, { params });
|
|
498
521
|
static usage = (params) => staticWrapper(handleUsage, void 0, { params });
|
|
522
|
+
/**
|
|
523
|
+
* Attaches a product to a customer, enabling access and handling billing.
|
|
524
|
+
*
|
|
525
|
+
* The attach function activates a product for a customer and applies all product items.
|
|
526
|
+
* When you attach a product:
|
|
527
|
+
* - The customer gains access to all features in the product
|
|
528
|
+
* - If the product has prices, the customer will be billed accordingly
|
|
529
|
+
* - If there's no existing payment method, a checkout URL will be generated
|
|
530
|
+
*
|
|
531
|
+
* @param params - Attach parameters including customer ID, product ID, and options
|
|
532
|
+
* @returns Promise resolving to attachment result with checkout URL if needed
|
|
533
|
+
*
|
|
534
|
+
* @example
|
|
535
|
+
* ```typescript
|
|
536
|
+
* const result = await autumn.attach({
|
|
537
|
+
* customer_id: "user_123",
|
|
538
|
+
* product_id: "pro",
|
|
539
|
+
* success_url: "https://myapp.com/success"
|
|
540
|
+
* });
|
|
541
|
+
*
|
|
542
|
+
* if (result.checkout_url) {
|
|
543
|
+
* // Payment required - redirect to checkout
|
|
544
|
+
* window.location.href = result.checkout_url;
|
|
545
|
+
* } else {
|
|
546
|
+
* // Product successfully attached
|
|
547
|
+
* console.log("Access granted:", result.message);
|
|
548
|
+
* }
|
|
549
|
+
* ```
|
|
550
|
+
*/
|
|
499
551
|
async attach(params) {
|
|
500
552
|
return handleAttach({
|
|
501
553
|
instance: this,
|
|
502
554
|
params
|
|
503
555
|
});
|
|
504
556
|
}
|
|
557
|
+
static attach = (params) => staticWrapper(handleAttach, void 0, { params });
|
|
505
558
|
static setupPayment = (params) => staticWrapper(handleSetupPayment, void 0, { params });
|
|
559
|
+
/**
|
|
560
|
+
* Sets up a payment method for a customer.
|
|
561
|
+
*
|
|
562
|
+
* This method allows you to set up payment methods for customers without
|
|
563
|
+
* immediately charging them. Useful for collecting payment information
|
|
564
|
+
* before product attachment or for updating existing payment methods.
|
|
565
|
+
*
|
|
566
|
+
* @param params - Setup payment parameters including customer information
|
|
567
|
+
* @returns Promise resolving to setup payment result
|
|
568
|
+
*
|
|
569
|
+
* @example
|
|
570
|
+
* ```typescript
|
|
571
|
+
* const result = await autumn.setupPayment({
|
|
572
|
+
* customer_id: "user_123"
|
|
573
|
+
* });
|
|
574
|
+
* ```
|
|
575
|
+
*/
|
|
506
576
|
async setupPayment(params) {
|
|
507
577
|
return handleSetupPayment({
|
|
508
578
|
instance: this,
|
|
@@ -510,6 +580,24 @@ var Autumn = class {
|
|
|
510
580
|
});
|
|
511
581
|
}
|
|
512
582
|
static cancel = (params) => staticWrapper(handleCancel, void 0, { params });
|
|
583
|
+
/**
|
|
584
|
+
* Cancels a customer's subscription or product attachment.
|
|
585
|
+
*
|
|
586
|
+
* This method allows you to cancel a customer's subscription to a specific product.
|
|
587
|
+
* You can choose to cancel immediately or at the end of the billing cycle.
|
|
588
|
+
*
|
|
589
|
+
* @param params - Cancel parameters including customer ID and product ID
|
|
590
|
+
* @returns Promise resolving to cancellation result
|
|
591
|
+
*
|
|
592
|
+
* @example
|
|
593
|
+
* ```typescript
|
|
594
|
+
* const result = await autumn.cancel({
|
|
595
|
+
* customer_id: "user_123",
|
|
596
|
+
* product_id: "pro",
|
|
597
|
+
* cancel_immediately: false // Cancel at end of billing cycle
|
|
598
|
+
* });
|
|
599
|
+
* ```
|
|
600
|
+
*/
|
|
513
601
|
async cancel(params) {
|
|
514
602
|
return handleCancel({
|
|
515
603
|
instance: this,
|
|
@@ -517,6 +605,29 @@ var Autumn = class {
|
|
|
517
605
|
});
|
|
518
606
|
}
|
|
519
607
|
static check = (params) => staticWrapper(handleCheck, void 0, { params });
|
|
608
|
+
/**
|
|
609
|
+
* Checks if a customer has access to a specific feature.
|
|
610
|
+
*
|
|
611
|
+
* This method verifies whether a customer has permission to use a feature
|
|
612
|
+
* and checks their remaining balance/usage limits. It can be used to gate
|
|
613
|
+
* features and determine when to show upgrade prompts.
|
|
614
|
+
*
|
|
615
|
+
* @param params - Check parameters including customer ID and feature ID
|
|
616
|
+
* @returns Promise resolving to access check result with allowed status and balance info
|
|
617
|
+
*
|
|
618
|
+
* @example
|
|
619
|
+
* ```typescript
|
|
620
|
+
* const result = await autumn.check({
|
|
621
|
+
* customer_id: "user_123",
|
|
622
|
+
* feature_id: "messages",
|
|
623
|
+
* required_balance: 1
|
|
624
|
+
* });
|
|
625
|
+
*
|
|
626
|
+
* if (!result.allowed) {
|
|
627
|
+
* console.log("Feature access denied - upgrade required");
|
|
628
|
+
* }
|
|
629
|
+
* ```
|
|
630
|
+
*/
|
|
520
631
|
async check(params) {
|
|
521
632
|
return handleCheck({
|
|
522
633
|
instance: this,
|
|
@@ -524,12 +635,50 @@ var Autumn = class {
|
|
|
524
635
|
});
|
|
525
636
|
}
|
|
526
637
|
static track = (params) => staticWrapper(handleTrack, void 0, { params });
|
|
638
|
+
/**
|
|
639
|
+
* Tracks usage events for features or analytics.
|
|
640
|
+
*
|
|
641
|
+
* This method records usage events for metered features, updating the customer's
|
|
642
|
+
* balance and usage statistics. It's typically used server-side to ensure
|
|
643
|
+
* accurate tracking that cannot be manipulated by users.
|
|
644
|
+
*
|
|
645
|
+
* @param params - Track parameters including customer ID, feature ID, and usage value
|
|
646
|
+
* @returns Promise resolving to tracking result
|
|
647
|
+
*
|
|
648
|
+
* @example
|
|
649
|
+
* ```typescript
|
|
650
|
+
* const result = await autumn.track({
|
|
651
|
+
* customer_id: "user_123",
|
|
652
|
+
* feature_id: "messages",
|
|
653
|
+
* value: 1 // Track 1 message sent
|
|
654
|
+
* });
|
|
655
|
+
* ```
|
|
656
|
+
*/
|
|
527
657
|
async track(params) {
|
|
528
658
|
return handleTrack({
|
|
529
659
|
instance: this,
|
|
530
660
|
params
|
|
531
661
|
});
|
|
532
662
|
}
|
|
663
|
+
/**
|
|
664
|
+
* Retrieves usage statistics and analytics for a customer.
|
|
665
|
+
*
|
|
666
|
+
* This method fetches detailed usage information for a customer's features,
|
|
667
|
+
* including current balances, usage history, and analytics data. Useful
|
|
668
|
+
* for displaying usage dashboards or generating reports.
|
|
669
|
+
*
|
|
670
|
+
* @param params - Usage parameters including customer ID and optional filters
|
|
671
|
+
* @returns Promise resolving to usage statistics and analytics data
|
|
672
|
+
*
|
|
673
|
+
* @example
|
|
674
|
+
* ```typescript
|
|
675
|
+
* const result = await autumn.usage({
|
|
676
|
+
* customer_id: "user_123",
|
|
677
|
+
* feature_id: "messages"
|
|
678
|
+
* value: 20 // Usage value
|
|
679
|
+
* });
|
|
680
|
+
* ```
|
|
681
|
+
*/
|
|
533
682
|
async usage(params) {
|
|
534
683
|
return handleUsage({
|
|
535
684
|
instance: this,
|
|
@@ -537,6 +686,25 @@ var Autumn = class {
|
|
|
537
686
|
});
|
|
538
687
|
}
|
|
539
688
|
static query = (params) => staticWrapper(handleQuery, void 0, { params });
|
|
689
|
+
/**
|
|
690
|
+
* Performs advanced queries on customer data and analytics.
|
|
691
|
+
*
|
|
692
|
+
* This method allows you to run complex queries against customer data,
|
|
693
|
+
* usage patterns, and billing information. Useful for generating reports,
|
|
694
|
+
* analytics, and custom data insights.
|
|
695
|
+
*
|
|
696
|
+
* @param params - Query parameters including customer ID and query specifications
|
|
697
|
+
* @returns Promise resolving to query results with requested data
|
|
698
|
+
*
|
|
699
|
+
* @example
|
|
700
|
+
* ```typescript
|
|
701
|
+
* const result = await autumn.query({
|
|
702
|
+
* customer_id: "user_123",
|
|
703
|
+
* feature_id: "messages" // feature id to fetch for query, can also be an array
|
|
704
|
+
* });
|
|
705
|
+
*
|
|
706
|
+
* ```
|
|
707
|
+
*/
|
|
540
708
|
async query(params) {
|
|
541
709
|
return handleQuery({
|
|
542
710
|
instance: this,
|
|
@@ -752,6 +920,8 @@ var CheckoutParamsSchema = import_v47.z.object({
|
|
|
752
920
|
product_id: import_v47.z.string(),
|
|
753
921
|
entity_id: import_v47.z.string().optional(),
|
|
754
922
|
options: import_v47.z.array(AttachFeatureOptionsSchema).optional(),
|
|
923
|
+
force_checkout: import_v47.z.boolean().optional(),
|
|
924
|
+
invoice: import_v47.z.boolean().optional(),
|
|
755
925
|
success_url: import_v47.z.string().optional(),
|
|
756
926
|
customer_data: CustomerDataSchema.optional(),
|
|
757
927
|
entity_data: import_v47.z.any().optional(),
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
usePricingTable
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-CIBQ4BJU.mjs";
|
|
5
|
+
} from "../chunk-HNIU2WNT.mjs";
|
|
6
|
+
import "../chunk-7HRCOEUW.mjs";
|
|
7
|
+
import "../chunk-TE2MOBO7.mjs";
|
|
8
|
+
import "../chunk-JTYEHM27.mjs";
|
|
9
|
+
import "../chunk-5O3IHYFF.mjs";
|
|
11
10
|
import "../chunk-V575SGOW.mjs";
|
|
12
11
|
import "../chunk-ZV4RPZTM.mjs";
|
|
13
12
|
import "../chunk-JVCOY7ZL.mjs";
|
|
13
|
+
import "../chunk-CIBQ4BJU.mjs";
|
|
14
14
|
import "../chunk-VTGR7VVK.mjs";
|
|
15
15
|
import "../chunk-WFFVOEUG.mjs";
|
|
16
16
|
import "../chunk-ZF2HUCN6.mjs";
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import * as swr from 'swr';
|
|
2
2
|
import { A as AutumnError } from '../error-DHbclCVh.mjs';
|
|
3
|
-
import { P as Product } from '../prodTypes-
|
|
3
|
+
import { P as Product } from '../prodTypes-C8xRoBP7.mjs';
|
|
4
4
|
import { ProductDetails } from '../client/types/clientPricingTableTypes.mjs';
|
|
5
|
-
import { A as AutumnClient } from '../ReactAutumnClient-
|
|
5
|
+
import { A as AutumnClient } from '../ReactAutumnClient-zBxnpPLM.mjs';
|
|
6
6
|
import 'zod/v4';
|
|
7
7
|
import '../client/types/clientEntTypes.mjs';
|
|
8
8
|
import '../client/types/clientGenTypes.mjs';
|
|
9
|
-
import '../genTypes-
|
|
10
|
-
import '../attachTypes-
|
|
11
|
-
import '../entTypes-
|
|
12
|
-
import '../cusTypes-
|
|
9
|
+
import '../genTypes-DdYlVEah.mjs';
|
|
10
|
+
import '../attachTypes-Cuxn1ThG.mjs';
|
|
11
|
+
import '../entTypes-D-gn1jj2.mjs';
|
|
12
|
+
import '../cusTypes-B2m4-oz4.mjs';
|
|
13
13
|
|
|
14
14
|
declare const usePricingTableBase: ({ client, params, }: {
|
|
15
15
|
client: AutumnClient;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import * as swr from 'swr';
|
|
2
2
|
import { A as AutumnError } from '../error-DHbclCVh.js';
|
|
3
|
-
import { P as Product } from '../prodTypes-
|
|
3
|
+
import { P as Product } from '../prodTypes-C8xRoBP7.js';
|
|
4
4
|
import { ProductDetails } from '../client/types/clientPricingTableTypes.js';
|
|
5
|
-
import { A as AutumnClient } from '../ReactAutumnClient-
|
|
5
|
+
import { A as AutumnClient } from '../ReactAutumnClient-CIAkiqwV.js';
|
|
6
6
|
import 'zod/v4';
|
|
7
7
|
import '../client/types/clientEntTypes.js';
|
|
8
8
|
import '../client/types/clientGenTypes.js';
|
|
9
|
-
import '../genTypes-
|
|
10
|
-
import '../attachTypes-
|
|
11
|
-
import '../entTypes-
|
|
12
|
-
import '../cusTypes-
|
|
9
|
+
import '../genTypes-aPPwPimh.js';
|
|
10
|
+
import '../attachTypes-BQaZHr5e.js';
|
|
11
|
+
import '../entTypes-WMQRyYAv.js';
|
|
12
|
+
import '../cusTypes-lMnznWYJ.js';
|
|
13
13
|
|
|
14
14
|
declare const usePricingTableBase: ({ client, params, }: {
|
|
15
15
|
client: AutumnClient;
|
|
@@ -485,22 +485,92 @@ var Autumn = class {
|
|
|
485
485
|
entities = entityMethods(this);
|
|
486
486
|
referrals = referralMethods(this);
|
|
487
487
|
features = featureMethods(this);
|
|
488
|
-
|
|
488
|
+
/**
|
|
489
|
+
* Initiates a checkout flow for a product purchase.
|
|
490
|
+
*
|
|
491
|
+
* The checkout function handles the purchase process for products with pricing.
|
|
492
|
+
* It determines whether to show a dialog for user input or redirect directly
|
|
493
|
+
* to Stripe based on the customer's state and product requirements.
|
|
494
|
+
*
|
|
495
|
+
* @param params - Checkout parameters including product ID, customer data, and options
|
|
496
|
+
* @returns Promise resolving to checkout details including pricing, prorations, and URLs
|
|
497
|
+
*
|
|
498
|
+
* @example
|
|
499
|
+
* ```typescript
|
|
500
|
+
* const result = await autumn.checkout({
|
|
501
|
+
* customer_id: "user_123",
|
|
502
|
+
* product_id: "pro",
|
|
503
|
+
* success_url: "https://myapp.com/success"
|
|
504
|
+
* });
|
|
505
|
+
*
|
|
506
|
+
* if (result.url) {
|
|
507
|
+
* // Redirect to Stripe checkout
|
|
508
|
+
* window.location.href = result.url;
|
|
509
|
+
* }
|
|
510
|
+
* ```
|
|
511
|
+
*/
|
|
489
512
|
async checkout(params) {
|
|
490
513
|
return handleCheckout({
|
|
491
514
|
instance: this,
|
|
492
515
|
params
|
|
493
516
|
});
|
|
494
517
|
}
|
|
495
|
-
static
|
|
518
|
+
static checkout = (params) => staticWrapper(handleCheckout, void 0, { params });
|
|
496
519
|
static usage = (params) => staticWrapper(handleUsage, void 0, { params });
|
|
520
|
+
/**
|
|
521
|
+
* Attaches a product to a customer, enabling access and handling billing.
|
|
522
|
+
*
|
|
523
|
+
* The attach function activates a product for a customer and applies all product items.
|
|
524
|
+
* When you attach a product:
|
|
525
|
+
* - The customer gains access to all features in the product
|
|
526
|
+
* - If the product has prices, the customer will be billed accordingly
|
|
527
|
+
* - If there's no existing payment method, a checkout URL will be generated
|
|
528
|
+
*
|
|
529
|
+
* @param params - Attach parameters including customer ID, product ID, and options
|
|
530
|
+
* @returns Promise resolving to attachment result with checkout URL if needed
|
|
531
|
+
*
|
|
532
|
+
* @example
|
|
533
|
+
* ```typescript
|
|
534
|
+
* const result = await autumn.attach({
|
|
535
|
+
* customer_id: "user_123",
|
|
536
|
+
* product_id: "pro",
|
|
537
|
+
* success_url: "https://myapp.com/success"
|
|
538
|
+
* });
|
|
539
|
+
*
|
|
540
|
+
* if (result.checkout_url) {
|
|
541
|
+
* // Payment required - redirect to checkout
|
|
542
|
+
* window.location.href = result.checkout_url;
|
|
543
|
+
* } else {
|
|
544
|
+
* // Product successfully attached
|
|
545
|
+
* console.log("Access granted:", result.message);
|
|
546
|
+
* }
|
|
547
|
+
* ```
|
|
548
|
+
*/
|
|
497
549
|
async attach(params) {
|
|
498
550
|
return handleAttach({
|
|
499
551
|
instance: this,
|
|
500
552
|
params
|
|
501
553
|
});
|
|
502
554
|
}
|
|
555
|
+
static attach = (params) => staticWrapper(handleAttach, void 0, { params });
|
|
503
556
|
static setupPayment = (params) => staticWrapper(handleSetupPayment, void 0, { params });
|
|
557
|
+
/**
|
|
558
|
+
* Sets up a payment method for a customer.
|
|
559
|
+
*
|
|
560
|
+
* This method allows you to set up payment methods for customers without
|
|
561
|
+
* immediately charging them. Useful for collecting payment information
|
|
562
|
+
* before product attachment or for updating existing payment methods.
|
|
563
|
+
*
|
|
564
|
+
* @param params - Setup payment parameters including customer information
|
|
565
|
+
* @returns Promise resolving to setup payment result
|
|
566
|
+
*
|
|
567
|
+
* @example
|
|
568
|
+
* ```typescript
|
|
569
|
+
* const result = await autumn.setupPayment({
|
|
570
|
+
* customer_id: "user_123"
|
|
571
|
+
* });
|
|
572
|
+
* ```
|
|
573
|
+
*/
|
|
504
574
|
async setupPayment(params) {
|
|
505
575
|
return handleSetupPayment({
|
|
506
576
|
instance: this,
|
|
@@ -508,6 +578,24 @@ var Autumn = class {
|
|
|
508
578
|
});
|
|
509
579
|
}
|
|
510
580
|
static cancel = (params) => staticWrapper(handleCancel, void 0, { params });
|
|
581
|
+
/**
|
|
582
|
+
* Cancels a customer's subscription or product attachment.
|
|
583
|
+
*
|
|
584
|
+
* This method allows you to cancel a customer's subscription to a specific product.
|
|
585
|
+
* You can choose to cancel immediately or at the end of the billing cycle.
|
|
586
|
+
*
|
|
587
|
+
* @param params - Cancel parameters including customer ID and product ID
|
|
588
|
+
* @returns Promise resolving to cancellation result
|
|
589
|
+
*
|
|
590
|
+
* @example
|
|
591
|
+
* ```typescript
|
|
592
|
+
* const result = await autumn.cancel({
|
|
593
|
+
* customer_id: "user_123",
|
|
594
|
+
* product_id: "pro",
|
|
595
|
+
* cancel_immediately: false // Cancel at end of billing cycle
|
|
596
|
+
* });
|
|
597
|
+
* ```
|
|
598
|
+
*/
|
|
511
599
|
async cancel(params) {
|
|
512
600
|
return handleCancel({
|
|
513
601
|
instance: this,
|
|
@@ -515,6 +603,29 @@ var Autumn = class {
|
|
|
515
603
|
});
|
|
516
604
|
}
|
|
517
605
|
static check = (params) => staticWrapper(handleCheck, void 0, { params });
|
|
606
|
+
/**
|
|
607
|
+
* Checks if a customer has access to a specific feature.
|
|
608
|
+
*
|
|
609
|
+
* This method verifies whether a customer has permission to use a feature
|
|
610
|
+
* and checks their remaining balance/usage limits. It can be used to gate
|
|
611
|
+
* features and determine when to show upgrade prompts.
|
|
612
|
+
*
|
|
613
|
+
* @param params - Check parameters including customer ID and feature ID
|
|
614
|
+
* @returns Promise resolving to access check result with allowed status and balance info
|
|
615
|
+
*
|
|
616
|
+
* @example
|
|
617
|
+
* ```typescript
|
|
618
|
+
* const result = await autumn.check({
|
|
619
|
+
* customer_id: "user_123",
|
|
620
|
+
* feature_id: "messages",
|
|
621
|
+
* required_balance: 1
|
|
622
|
+
* });
|
|
623
|
+
*
|
|
624
|
+
* if (!result.allowed) {
|
|
625
|
+
* console.log("Feature access denied - upgrade required");
|
|
626
|
+
* }
|
|
627
|
+
* ```
|
|
628
|
+
*/
|
|
518
629
|
async check(params) {
|
|
519
630
|
return handleCheck({
|
|
520
631
|
instance: this,
|
|
@@ -522,12 +633,50 @@ var Autumn = class {
|
|
|
522
633
|
});
|
|
523
634
|
}
|
|
524
635
|
static track = (params) => staticWrapper(handleTrack, void 0, { params });
|
|
636
|
+
/**
|
|
637
|
+
* Tracks usage events for features or analytics.
|
|
638
|
+
*
|
|
639
|
+
* This method records usage events for metered features, updating the customer's
|
|
640
|
+
* balance and usage statistics. It's typically used server-side to ensure
|
|
641
|
+
* accurate tracking that cannot be manipulated by users.
|
|
642
|
+
*
|
|
643
|
+
* @param params - Track parameters including customer ID, feature ID, and usage value
|
|
644
|
+
* @returns Promise resolving to tracking result
|
|
645
|
+
*
|
|
646
|
+
* @example
|
|
647
|
+
* ```typescript
|
|
648
|
+
* const result = await autumn.track({
|
|
649
|
+
* customer_id: "user_123",
|
|
650
|
+
* feature_id: "messages",
|
|
651
|
+
* value: 1 // Track 1 message sent
|
|
652
|
+
* });
|
|
653
|
+
* ```
|
|
654
|
+
*/
|
|
525
655
|
async track(params) {
|
|
526
656
|
return handleTrack({
|
|
527
657
|
instance: this,
|
|
528
658
|
params
|
|
529
659
|
});
|
|
530
660
|
}
|
|
661
|
+
/**
|
|
662
|
+
* Retrieves usage statistics and analytics for a customer.
|
|
663
|
+
*
|
|
664
|
+
* This method fetches detailed usage information for a customer's features,
|
|
665
|
+
* including current balances, usage history, and analytics data. Useful
|
|
666
|
+
* for displaying usage dashboards or generating reports.
|
|
667
|
+
*
|
|
668
|
+
* @param params - Usage parameters including customer ID and optional filters
|
|
669
|
+
* @returns Promise resolving to usage statistics and analytics data
|
|
670
|
+
*
|
|
671
|
+
* @example
|
|
672
|
+
* ```typescript
|
|
673
|
+
* const result = await autumn.usage({
|
|
674
|
+
* customer_id: "user_123",
|
|
675
|
+
* feature_id: "messages"
|
|
676
|
+
* value: 20 // Usage value
|
|
677
|
+
* });
|
|
678
|
+
* ```
|
|
679
|
+
*/
|
|
531
680
|
async usage(params) {
|
|
532
681
|
return handleUsage({
|
|
533
682
|
instance: this,
|
|
@@ -535,6 +684,25 @@ var Autumn = class {
|
|
|
535
684
|
});
|
|
536
685
|
}
|
|
537
686
|
static query = (params) => staticWrapper(handleQuery, void 0, { params });
|
|
687
|
+
/**
|
|
688
|
+
* Performs advanced queries on customer data and analytics.
|
|
689
|
+
*
|
|
690
|
+
* This method allows you to run complex queries against customer data,
|
|
691
|
+
* usage patterns, and billing information. Useful for generating reports,
|
|
692
|
+
* analytics, and custom data insights.
|
|
693
|
+
*
|
|
694
|
+
* @param params - Query parameters including customer ID and query specifications
|
|
695
|
+
* @returns Promise resolving to query results with requested data
|
|
696
|
+
*
|
|
697
|
+
* @example
|
|
698
|
+
* ```typescript
|
|
699
|
+
* const result = await autumn.query({
|
|
700
|
+
* customer_id: "user_123",
|
|
701
|
+
* feature_id: "messages" // feature id to fetch for query, can also be an array
|
|
702
|
+
* });
|
|
703
|
+
*
|
|
704
|
+
* ```
|
|
705
|
+
*/
|
|
538
706
|
async query(params) {
|
|
539
707
|
return handleQuery({
|
|
540
708
|
instance: this,
|
|
@@ -750,6 +918,8 @@ var CheckoutParamsSchema = import_v47.z.object({
|
|
|
750
918
|
product_id: import_v47.z.string(),
|
|
751
919
|
entity_id: import_v47.z.string().optional(),
|
|
752
920
|
options: import_v47.z.array(AttachFeatureOptionsSchema).optional(),
|
|
921
|
+
force_checkout: import_v47.z.boolean().optional(),
|
|
922
|
+
invoice: import_v47.z.boolean().optional(),
|
|
753
923
|
success_url: import_v47.z.string().optional(),
|
|
754
924
|
customer_data: CustomerDataSchema.optional(),
|
|
755
925
|
entity_data: import_v47.z.any().optional(),
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { P as Product } from '../prodTypes-
|
|
2
|
-
import { A as AutumnClient } from '../ReactAutumnClient-
|
|
1
|
+
import { P as Product } from '../prodTypes-C8xRoBP7.mjs';
|
|
2
|
+
import { A as AutumnClient } from '../ReactAutumnClient-zBxnpPLM.mjs';
|
|
3
3
|
import 'zod/v4';
|
|
4
4
|
import '../client/types/clientEntTypes.mjs';
|
|
5
5
|
import '../client/types/clientGenTypes.mjs';
|
|
6
6
|
import '../error-DHbclCVh.mjs';
|
|
7
|
-
import '../genTypes-
|
|
8
|
-
import '../attachTypes-
|
|
9
|
-
import '../entTypes-
|
|
10
|
-
import '../cusTypes-
|
|
7
|
+
import '../genTypes-DdYlVEah.mjs';
|
|
8
|
+
import '../attachTypes-Cuxn1ThG.mjs';
|
|
9
|
+
import '../entTypes-D-gn1jj2.mjs';
|
|
10
|
+
import '../cusTypes-B2m4-oz4.mjs';
|
|
11
11
|
|
|
12
12
|
declare const useProductsBase: ({ client }: {
|
|
13
13
|
client: AutumnClient;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { P as Product } from '../prodTypes-
|
|
2
|
-
import { A as AutumnClient } from '../ReactAutumnClient-
|
|
1
|
+
import { P as Product } from '../prodTypes-C8xRoBP7.js';
|
|
2
|
+
import { A as AutumnClient } from '../ReactAutumnClient-CIAkiqwV.js';
|
|
3
3
|
import 'zod/v4';
|
|
4
4
|
import '../client/types/clientEntTypes.js';
|
|
5
5
|
import '../client/types/clientGenTypes.js';
|
|
6
6
|
import '../error-DHbclCVh.js';
|
|
7
|
-
import '../genTypes-
|
|
8
|
-
import '../attachTypes-
|
|
9
|
-
import '../entTypes-
|
|
10
|
-
import '../cusTypes-
|
|
7
|
+
import '../genTypes-aPPwPimh.js';
|
|
8
|
+
import '../attachTypes-BQaZHr5e.js';
|
|
9
|
+
import '../entTypes-WMQRyYAv.js';
|
|
10
|
+
import '../cusTypes-lMnznWYJ.js';
|
|
11
11
|
|
|
12
12
|
declare const useProductsBase: ({ client }: {
|
|
13
13
|
client: AutumnClient;
|