@dodopayments/convex 0.2.6 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import { action } from './_generated/server.js';
2
2
  import { v } from 'convex/values';
3
- import { buildCheckoutUrl } from '../packages/core/dist/chunk-7ICTY2GO.js';
3
+ import { buildCheckoutUrl } from '../packages/core/dist/chunk-BVTJMX2W.js';
4
4
  import DodoPayments from 'dodopayments';
5
5
 
6
6
  const checkoutSessionPayloadValidator = v.object({
package/dist/index.cjs CHANGED
@@ -5270,6 +5270,12 @@ var SubscriptionExpiredPayloadSchema = objectType({
5270
5270
  timestamp: stringType().transform((d) => new Date(d)),
5271
5271
  data: SubscriptionSchema
5272
5272
  });
5273
+ var SubscriptionUpdatedPayloadSchema = objectType({
5274
+ business_id: stringType(),
5275
+ type: literalType("subscription.updated"),
5276
+ timestamp: stringType().transform((d) => new Date(d)),
5277
+ data: SubscriptionSchema
5278
+ });
5273
5279
  var LicenseKeyCreatedPayloadSchema = objectType({
5274
5280
  business_id: stringType(),
5275
5281
  type: literalType("license_key.created"),
@@ -5298,6 +5304,7 @@ var WebhookPayloadSchema = discriminatedUnionType("type", [
5298
5304
  SubscriptionCancelledPayloadSchema,
5299
5305
  SubscriptionFailedPayloadSchema,
5300
5306
  SubscriptionExpiredPayloadSchema,
5307
+ SubscriptionUpdatedPayloadSchema,
5301
5308
  LicenseKeyCreatedPayloadSchema
5302
5309
  ]);
5303
5310
 
@@ -6226,6 +6233,9 @@ async function handleWebhookPayload(payload, config, context) {
6226
6233
  if (payload.type === "subscription.expired") {
6227
6234
  await callHandler(config.onSubscriptionExpired, payload);
6228
6235
  }
6236
+ if (payload.type === "subscription.updated") {
6237
+ await callHandler(config.onSubscriptionUpdated, payload);
6238
+ }
6229
6239
  if (payload.type === "license_key.created") {
6230
6240
  await callHandler(config.onLicenseKeyCreated, payload);
6231
6241
  }