@dodopayments/convex 0.2.3 → 0.2.6

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.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as convex_server from 'convex/server';
2
- import { GenericActionCtx } from 'convex/server';
2
+ import { FunctionReference, GenericActionCtx, GenericDataModel } from 'convex/server';
3
3
  import { CheckoutSessionPayload } from '@dodopayments/core/checkout';
4
4
  export { CheckoutHandlerConfig, CheckoutSessionBillingAddress, CheckoutSessionCustomer, CheckoutSessionPayload, CheckoutSessionProductCartItem, CheckoutSessionResponse, PaymentMethodType } from '@dodopayments/core/checkout';
5
5
  export { Dispute, LicenseKey, Payment, Refund, Subscription, WebhookEventHandlers, WebhookPayload } from '@dodopayments/core/schemas';
@@ -9,10 +9,13 @@ export { WebhookHandlerConfig } from '@dodopayments/core/webhook';
9
9
  type CustomerPortalArgs = {
10
10
  send_email?: boolean;
11
11
  };
12
+ type RunActionCtx = {
13
+ runAction: GenericActionCtx<GenericDataModel>["runAction"];
14
+ };
12
15
  interface DodoPaymentsComponent {
13
16
  lib: {
14
- checkout: any;
15
- customerPortal: any;
17
+ checkout: FunctionReference<"action", "internal">;
18
+ customerPortal: FunctionReference<"action", "internal">;
16
19
  };
17
20
  }
18
21
  type DodoPaymentsClientConfig = {
@@ -34,14 +37,18 @@ declare class DodoPayments {
34
37
  * Creates a Dodo Payments checkout session.
35
38
  * Uses session checkout with full feature support.
36
39
  */
37
- checkout: (ctx: any, args: {
40
+ checkout: (ctx: RunActionCtx, args: {
38
41
  payload: CheckoutSessionPayload;
39
- }) => Promise<any>;
42
+ }) => Promise<{
43
+ checkout_url: string;
44
+ }>;
40
45
  /**
41
46
  * Retrieves a URL for the customer portal.
42
- * This function is designed to be called from a public Convex query in your app.
47
+ * Requires the user to be identified via the identify function in the config.
43
48
  */
44
- customerPortal: (ctx: any, args?: CustomerPortalArgs) => Promise<any>;
49
+ customerPortal: (ctx: any, args?: CustomerPortalArgs) => Promise<{
50
+ portal_url: string;
51
+ }>;
45
52
  };
46
53
  }
47
54
 
@@ -54,7 +61,7 @@ type CustomerPortalResponse = {
54
61
  portal_url: string;
55
62
  };
56
63
 
57
- type ConvexWebhookHandlerConfig = Omit<WebhookHandlerConfig<GenericActionCtx<any>>, "webhookKey">;
64
+ type ConvexWebhookHandlerConfig = Omit<WebhookHandlerConfig<GenericActionCtx<GenericDataModel>>, "webhookKey">;
58
65
  /**
59
66
  * Creates a Convex HTTP action to securely handle Dodo Payments webhooks.
60
67
  *
package/dist/index.js CHANGED
@@ -22,7 +22,7 @@ class DodoPayments {
22
22
  },
23
23
  /**
24
24
  * Retrieves a URL for the customer portal.
25
- * This function is designed to be called from a public Convex query in your app.
25
+ * Requires the user to be identified via the identify function in the config.
26
26
  */
27
27
  customerPortal: async (ctx, args) => {
28
28
  const identity = await this.config.identify(ctx);