@raideno/convex-stripe 0.1.13 → 0.1.15

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.
Files changed (3) hide show
  1. package/dist/index.d.ts +1025 -576
  2. package/dist/server.js +448 -180
  3. package/package.json +1 -1
package/dist/server.js CHANGED
@@ -2256,13 +2256,16 @@ const normalizeConfiguration = (config) => {
2256
2256
  stripePlans: true,
2257
2257
  stripeSetupIntents: true,
2258
2258
  stripeSubscriptionSchedules: true,
2259
- stripeTaxIds: true
2259
+ stripeTaxIds: true,
2260
+ stripeMandates: true,
2261
+ stripeBillingPortalConfigurations: true
2260
2262
  },
2261
2263
  debug: false,
2262
2264
  logger: new Logger(config.debug || false),
2263
2265
  base: config.base || "stripe"
2264
2266
  };
2265
2267
  };
2268
+ const defineActionCallableFunction = (spec) => spec;
2266
2269
  const defineActionImplementation = (spec) => spec;
2267
2270
  const defineMutationImplementation = (spec) => spec;
2268
2271
  const nullablestring = () => v.union(v.string(), v.null());
@@ -2270,6 +2273,7 @@ const nullableboolean = () => v.union(v.boolean(), v.null());
2270
2273
  const nullablenumber = () => v.union(v.number(), v.null());
2271
2274
  const metadata = () => v.record(v.string(), v.union(v.string(), v.number(), v.null()));
2272
2275
  const optionalnullableobject = (object) => v.optional(v.union(v.object(object), v.null()));
2276
+ const optionalany = () => v.optional(v.any());
2273
2277
  async function deleteById(context, table, idField, idValue) {
2274
2278
  const existing = await context.db.query(table).filter((q) => q.eq(q.field(idField), idValue)).unique();
2275
2279
  if (existing) {
@@ -3284,11 +3288,12 @@ const PaymentIntentSchema = {
3284
3288
  ),
3285
3289
  object: v.string(),
3286
3290
  amount_capturable: v.number(),
3287
- amount_details: optionalnullableobject({
3288
- tip: optionalnullableobject({
3289
- amount: v.optional(nullablenumber())
3290
- })
3291
- }),
3291
+ // amount_details: optionalnullableobject({
3292
+ // tip: optionalnullableobject({
3293
+ // amount: v.optional(nullablenumber()),
3294
+ // }),
3295
+ // }),
3296
+ amount_details: v.optional(v.union(v.null(), v.any())),
3292
3297
  amount_received: v.number(),
3293
3298
  application: v.optional(nullablestring()),
3294
3299
  application_fee_amount: v.optional(nullablenumber()),
@@ -3349,102 +3354,8 @@ const PaymentIntentSchema = {
3349
3354
  };
3350
3355
  v.object(PaymentIntentSchema);
3351
3356
  const DEFAULT_CREATE_STRIPE_CUSTOMER_IF_MISSING$2 = true;
3352
- const LineItemSchema = v.union(
3353
- v.object({
3354
- adjustable_quantity: v.optional(
3355
- v.object({
3356
- enabled: v.boolean(),
3357
- maximum: v.optional(v.number()),
3358
- minimum: v.optional(v.number())
3359
- })
3360
- ),
3361
- price: v.string(),
3362
- quantity: v.optional(v.number()),
3363
- tax_rates: v.optional(v.array(v.string())),
3364
- dynamic_tax_rates: v.optional(v.array(v.string()))
3365
- }),
3366
- v.object({
3367
- adjustable_quantity: v.optional(
3368
- v.object({
3369
- enabled: v.boolean(),
3370
- maximum: v.optional(v.number()),
3371
- minimum: v.optional(v.number())
3372
- })
3373
- ),
3374
- price_data: v.union(
3375
- v.object({
3376
- currency: v.string(),
3377
- productId: v.string(),
3378
- recurring: v.optional(
3379
- v.object({
3380
- interval: v.union(
3381
- v.literal("day"),
3382
- v.literal("week"),
3383
- v.literal("month"),
3384
- v.literal("year")
3385
- ),
3386
- interval_count: v.optional(v.number())
3387
- })
3388
- ),
3389
- tax_behavior: v.optional(
3390
- v.union(
3391
- v.literal("exclusive"),
3392
- v.literal("inclusive"),
3393
- v.literal("unspecified")
3394
- )
3395
- ),
3396
- unit_amount: v.number()
3397
- }),
3398
- v.object({
3399
- currency: v.string(),
3400
- product_data: v.object({
3401
- description: v.optional(v.string()),
3402
- images: v.optional(v.array(v.string())),
3403
- metadata: metadata(),
3404
- name: v.string(),
3405
- tax_code: v.optional(v.string())
3406
- }),
3407
- recurring: v.optional(
3408
- v.object({
3409
- interval: v.union(
3410
- v.literal("day"),
3411
- v.literal("week"),
3412
- v.literal("month"),
3413
- v.literal("year")
3414
- ),
3415
- interval_count: v.optional(v.number())
3416
- })
3417
- ),
3418
- tax_behavior: v.optional(
3419
- v.union(
3420
- v.literal("exclusive"),
3421
- v.literal("inclusive"),
3422
- v.literal("unspecified")
3423
- )
3424
- ),
3425
- unit_amount: v.number()
3426
- })
3427
- ),
3428
- quantity: v.optional(v.number()),
3429
- tax_rates: v.optional(v.array(v.string())),
3430
- dynamic_tax_rates: v.optional(v.array(v.string()))
3431
- })
3432
- );
3433
- const PayImplementation = defineActionImplementation({
3357
+ const PayImplementation = defineActionCallableFunction({
3434
3358
  name: "pay",
3435
- args: v.object({
3436
- createStripeCustomerIfMissing: v.optional(v.boolean()),
3437
- entityId: v.string(),
3438
- metadata: v.optional(v.union(metadata(), v.null())),
3439
- referenceId: v.string(),
3440
- line_items: v.array(LineItemSchema),
3441
- success: v.object({
3442
- url: v.string()
3443
- }),
3444
- cancel: v.object({
3445
- url: v.string()
3446
- })
3447
- }),
3448
3359
  handler: async (context, args, configuration) => {
3449
3360
  const createStripeCustomerIfMissing = args.createStripeCustomerIfMissing ?? DEFAULT_CREATE_STRIPE_CUSTOMER_IF_MISSING$2;
3450
3361
  const stripe = new Stripe(configuration.stripe.secret_key, {
@@ -3486,7 +3397,7 @@ const PayImplementation = defineActionImplementation({
3486
3397
  referenceId: args.referenceId,
3487
3398
  customerId
3488
3399
  },
3489
- targetUrl: args.success.url
3400
+ targetUrl: args.success_url
3490
3401
  });
3491
3402
  const cancelUrl = await buildSignedReturnUrl({
3492
3403
  configuration,
@@ -3496,12 +3407,13 @@ const PayImplementation = defineActionImplementation({
3496
3407
  referenceId: args.referenceId,
3497
3408
  customerId
3498
3409
  },
3499
- targetUrl: args.cancel.url
3410
+ targetUrl: args.cancel_url
3500
3411
  });
3501
3412
  const checkout = await stripe.checkout.sessions.create({
3413
+ ...args,
3502
3414
  customer: customerId,
3503
3415
  ui_mode: "hosted",
3504
- mode: "payment",
3416
+ mode: args.mode,
3505
3417
  client_reference_id: args.referenceId,
3506
3418
  metadata: {
3507
3419
  ...args.metadata,
@@ -3509,20 +3421,19 @@ const PayImplementation = defineActionImplementation({
3509
3421
  customerId,
3510
3422
  referenceId: args.referenceId
3511
3423
  },
3512
- // TODO: how to handle idempotencyKeys ?
3513
- // idempotencyKey: "",
3514
- // --- --- ---
3515
3424
  line_items: args.line_items,
3516
3425
  success_url: successUrl,
3517
3426
  cancel_url: cancelUrl,
3518
3427
  payment_intent_data: {
3428
+ ...args.payment_intent_data || {},
3519
3429
  metadata: {
3430
+ ...args.payment_intent_data?.metadata || {},
3520
3431
  entityId: args.entityId,
3521
3432
  customerId,
3522
3433
  referenceId: args.referenceId
3523
3434
  }
3524
3435
  },
3525
- expand: ["payment_intent"]
3436
+ expand: [...args.expand || [], "payment_intent"]
3526
3437
  });
3527
3438
  await storeDispatchTyped(
3528
3439
  {
@@ -3559,15 +3470,8 @@ const PayImplementation = defineActionImplementation({
3559
3470
  }
3560
3471
  });
3561
3472
  const DEFAULT_CREATE_STRIPE_CUSTOMER_IF_MISSING$1 = true;
3562
- const PortalImplementation = defineActionImplementation({
3473
+ const PortalImplementation = defineActionCallableFunction({
3563
3474
  name: "portal",
3564
- args: v.object({
3565
- createStripeCustomerIfMissing: v.optional(v.boolean()),
3566
- entityId: v.string(),
3567
- return: v.object({
3568
- url: v.string()
3569
- })
3570
- }),
3571
3475
  handler: async (context, args, configuration) => {
3572
3476
  const createStripeCustomerIfMissing = args.createStripeCustomerIfMissing ?? DEFAULT_CREATE_STRIPE_CUSTOMER_IF_MISSING$1;
3573
3477
  const stripe = new Stripe(configuration.stripe.secret_key, {
@@ -3607,9 +3511,10 @@ const PortalImplementation = defineActionImplementation({
3607
3511
  data: {
3608
3512
  entityId: args.entityId
3609
3513
  },
3610
- targetUrl: args.return.url
3514
+ targetUrl: args.return_url
3611
3515
  });
3612
3516
  const portal = await stripe.billingPortal.sessions.create({
3517
+ ...args,
3613
3518
  customer: customerId,
3614
3519
  return_url: returnUrl
3615
3520
  });
@@ -3625,20 +3530,8 @@ const SubscriptionStripeToConvex = (subscription) => {
3625
3530
  v.any();
3626
3531
  const SubscriptionObject = v.any();
3627
3532
  const DEFAULT_CREATE_STRIPE_CUSTOMER_IF_MISSING = true;
3628
- const SubscribeImplementation = defineActionImplementation({
3533
+ const SubscribeImplementation = defineActionCallableFunction({
3629
3534
  name: "subscriptionCheckout",
3630
- args: v.object({
3631
- createStripeCustomerIfMissing: v.optional(v.boolean()),
3632
- entityId: v.string(),
3633
- priceId: v.string(),
3634
- metadata: v.optional(v.union(metadata(), v.null())),
3635
- success: v.object({
3636
- url: v.string()
3637
- }),
3638
- cancel: v.object({
3639
- url: v.string()
3640
- })
3641
- }),
3642
3535
  handler: async (context, args, configuration) => {
3643
3536
  const createStripeCustomerIfMissing = args.createStripeCustomerIfMissing ?? DEFAULT_CREATE_STRIPE_CUSTOMER_IF_MISSING;
3644
3537
  const stripe = new Stripe(configuration.stripe.secret_key, {
@@ -3678,7 +3571,7 @@ const SubscribeImplementation = defineActionImplementation({
3678
3571
  data: {
3679
3572
  entityId: args.entityId
3680
3573
  },
3681
- targetUrl: args.success.url
3574
+ targetUrl: args.success_url
3682
3575
  });
3683
3576
  const cancelUrl = await buildSignedReturnUrl({
3684
3577
  configuration,
@@ -3686,12 +3579,13 @@ const SubscribeImplementation = defineActionImplementation({
3686
3579
  data: {
3687
3580
  entityId: args.entityId
3688
3581
  },
3689
- targetUrl: args.cancel.url
3582
+ targetUrl: args.cancel_url
3690
3583
  });
3691
3584
  const checkout = await stripe.checkout.sessions.create({
3585
+ ...args,
3692
3586
  customer: customerId,
3693
3587
  ui_mode: "hosted",
3694
- mode: "subscription",
3588
+ mode: args.mode,
3695
3589
  line_items: [
3696
3590
  {
3697
3591
  price: args.priceId,
@@ -3699,7 +3593,7 @@ const SubscribeImplementation = defineActionImplementation({
3699
3593
  }
3700
3594
  ],
3701
3595
  metadata: {
3702
- ...args.metadata,
3596
+ ...args.metadata || {},
3703
3597
  entityId: args.entityId,
3704
3598
  customerId
3705
3599
  },
@@ -3707,12 +3601,14 @@ const SubscribeImplementation = defineActionImplementation({
3707
3601
  success_url: successUrl,
3708
3602
  cancel_url: cancelUrl,
3709
3603
  subscription_data: {
3604
+ ...args.subscription_data,
3710
3605
  metadata: {
3606
+ ...args.subscription_data?.metadata || {},
3711
3607
  entityId: args.entityId,
3712
3608
  customerId
3713
3609
  }
3714
3610
  },
3715
- expand: ["subscription"]
3611
+ expand: [...args.expand || [], "subscription"]
3716
3612
  });
3717
3613
  await storeDispatchTyped(
3718
3614
  {
@@ -3749,6 +3645,246 @@ const SubscribeImplementation = defineActionImplementation({
3749
3645
  return checkout;
3750
3646
  }
3751
3647
  });
3648
+ const BillingPortalConfigurationStripeToConvex = (configuration) => {
3649
+ const object = {
3650
+ id: configuration.id,
3651
+ object: configuration.object,
3652
+ active: configuration.active,
3653
+ application: typeof configuration.application === "string" ? configuration.application : null,
3654
+ business_profile: {
3655
+ headline: configuration.business_profile.headline,
3656
+ privacy_policy_url: configuration.business_profile.privacy_policy_url,
3657
+ terms_of_service_url: configuration.business_profile.terms_of_service_url
3658
+ },
3659
+ created: configuration.created,
3660
+ default_return_url: configuration.default_return_url,
3661
+ features: {
3662
+ customer_update: {
3663
+ allowed_updated: configuration.features.customer_update.allowed_updates,
3664
+ enabled: configuration.features.customer_update.enabled
3665
+ },
3666
+ invoice_history: {
3667
+ enabled: configuration.features.invoice_history.enabled
3668
+ },
3669
+ payment_method_update: {
3670
+ enabled: configuration.features.payment_method_update.enabled
3671
+ // payment_method_configuration:
3672
+ // configuration.features.payment_method_update.enabled,
3673
+ },
3674
+ subscription_cancel: {
3675
+ cancellation_reason: {
3676
+ enabled: configuration.features.subscription_cancel.cancellation_reason.enabled,
3677
+ options: configuration.features.subscription_cancel.cancellation_reason.options
3678
+ },
3679
+ enabled: configuration.features.subscription_cancel.enabled,
3680
+ mode: configuration.features.subscription_cancel.mode,
3681
+ proration_behavior: configuration.features.subscription_cancel.proration_behavior
3682
+ },
3683
+ subscription_update: {
3684
+ default_allowed_updates: configuration.features.subscription_update.default_allowed_updates,
3685
+ enabled: configuration.features.subscription_update.enabled,
3686
+ products: configuration.features.subscription_update.products,
3687
+ proration_behavior: configuration.features.subscription_update.proration_behavior,
3688
+ schedule_at_period_end: {
3689
+ conditions: configuration.features.subscription_update.schedule_at_period_end.conditions
3690
+ }
3691
+ // trial_updated_behavior:
3692
+ // configuration.features.subscription_update.trial_updated_behavior,
3693
+ }
3694
+ },
3695
+ is_default: configuration.is_default,
3696
+ livemode: configuration.livemode,
3697
+ login_page: {
3698
+ enabled: configuration.login_page.enabled,
3699
+ url: configuration.login_page.url
3700
+ },
3701
+ metadata: configuration.metadata,
3702
+ name: configuration.name,
3703
+ updated: configuration.updated
3704
+ };
3705
+ return object;
3706
+ };
3707
+ const BillingPortalConfigurationSchema = {
3708
+ id: v.string(),
3709
+ object: v.string(),
3710
+ active: v.boolean(),
3711
+ application: v.union(v.null(), v.string()),
3712
+ business_profile: v.object({
3713
+ headline: nullablestring(),
3714
+ privacy_policy_url: nullablestring(),
3715
+ terms_of_service_url: nullablestring()
3716
+ }),
3717
+ created: v.number(),
3718
+ default_return_url: nullablestring(),
3719
+ features: v.object({
3720
+ customer_update: v.object({
3721
+ allowed_updated: v.array(
3722
+ v.union(
3723
+ v.literal("address"),
3724
+ v.literal("email"),
3725
+ v.literal("name"),
3726
+ v.literal("phone"),
3727
+ v.literal("shipping"),
3728
+ v.literal("tax_id")
3729
+ )
3730
+ ),
3731
+ enabled: v.boolean()
3732
+ }),
3733
+ invoice_history: v.object({
3734
+ enabled: v.boolean()
3735
+ }),
3736
+ payment_method_update: v.object({
3737
+ enabled: v.boolean()
3738
+ // payment_method_configuration: nullablestring(),
3739
+ }),
3740
+ subscription_cancel: v.object({
3741
+ cancellation_reason: v.object({
3742
+ enabled: v.boolean(),
3743
+ options: v.array(
3744
+ v.union(
3745
+ v.literal("customer_service"),
3746
+ v.literal("low_quality"),
3747
+ v.literal("missing_features"),
3748
+ v.literal("other"),
3749
+ v.literal("switched_service"),
3750
+ v.literal("too_complex"),
3751
+ v.literal("too_expensive"),
3752
+ v.literal("unused")
3753
+ )
3754
+ )
3755
+ }),
3756
+ enabled: v.boolean(),
3757
+ mode: v.union(v.literal("at_period_end"), v.literal("immediately")),
3758
+ proration_behavior: v.union(
3759
+ v.literal("always_invoice"),
3760
+ v.literal("create_prorations"),
3761
+ v.literal("none")
3762
+ )
3763
+ }),
3764
+ subscription_update: v.object({
3765
+ default_allowed_updates: v.array(
3766
+ v.union(
3767
+ v.literal("price"),
3768
+ v.literal("promotion_code"),
3769
+ v.literal("quantity")
3770
+ )
3771
+ ),
3772
+ enabled: v.boolean(),
3773
+ products: v.optional(
3774
+ v.union(
3775
+ v.null(),
3776
+ v.array(
3777
+ v.object({
3778
+ adjustable_quantity: v.object({
3779
+ enabled: v.boolean(),
3780
+ maximum: nullablenumber(),
3781
+ minimum: nullablenumber()
3782
+ }),
3783
+ prices: v.array(v.string()),
3784
+ product: v.string()
3785
+ })
3786
+ )
3787
+ )
3788
+ ),
3789
+ proration_behavior: v.union(
3790
+ v.literal("always_invoice"),
3791
+ v.literal("create_prorations"),
3792
+ v.literal("none")
3793
+ ),
3794
+ schedule_at_period_end: v.object({
3795
+ conditions: v.array(
3796
+ v.object({
3797
+ type: v.union(
3798
+ v.literal("decreasing_item_amount"),
3799
+ v.literal("shortening_interval")
3800
+ )
3801
+ })
3802
+ )
3803
+ })
3804
+ // trial_updated_behavior: v.union(
3805
+ // v.literal("continue_trial"),
3806
+ // v.literal("end_trial")
3807
+ // ),
3808
+ })
3809
+ }),
3810
+ is_default: v.boolean(),
3811
+ livemode: v.boolean(),
3812
+ login_page: v.object({
3813
+ enabled: v.boolean(),
3814
+ url: nullablestring()
3815
+ }),
3816
+ metadata: v.union(v.null(), metadata()),
3817
+ name: nullablestring(),
3818
+ updated: v.number()
3819
+ };
3820
+ v.object(
3821
+ BillingPortalConfigurationSchema
3822
+ );
3823
+ const BillingPortalConfigurationsSyncImplementation = defineActionImplementation({
3824
+ args: v.object({}),
3825
+ name: "billingPortalConfigurations",
3826
+ handler: async (context, args, configuration) => {
3827
+ if (configuration.sync.stripeBillingPortalConfigurations !== true) return;
3828
+ const stripe = new Stripe(configuration.stripe.secret_key, {
3829
+ apiVersion: "2025-08-27.basil"
3830
+ });
3831
+ const localBillingPortalConfigurationsRes = await storeDispatchTyped(
3832
+ {
3833
+ operation: "selectAll",
3834
+ table: "stripeBillingPortalConfigurations"
3835
+ },
3836
+ context,
3837
+ configuration
3838
+ );
3839
+ const localBillingPortalConfigurationsById = new Map(
3840
+ (localBillingPortalConfigurationsRes.docs || []).map((p) => [
3841
+ p.billingPortalConfigurationId,
3842
+ p
3843
+ ])
3844
+ );
3845
+ const billingPortalConfigurations = await stripe.billingPortal.configurations.list({ limit: 100 }).autoPagingToArray({ limit: 1e4 });
3846
+ const stripeBillingPortalConfigurationIds = /* @__PURE__ */ new Set();
3847
+ for (const billingPortalConfiguration of billingPortalConfigurations) {
3848
+ stripeBillingPortalConfigurationIds.add(billingPortalConfiguration.id);
3849
+ await storeDispatchTyped(
3850
+ {
3851
+ operation: "upsert",
3852
+ table: "stripeBillingPortalConfigurations",
3853
+ idField: "billingPortalConfigurationId",
3854
+ data: {
3855
+ billingPortalConfigurationId: billingPortalConfiguration.id,
3856
+ stripe: BillingPortalConfigurationStripeToConvex(
3857
+ billingPortalConfiguration
3858
+ ),
3859
+ lastSyncedAt: Date.now()
3860
+ }
3861
+ },
3862
+ context,
3863
+ configuration
3864
+ );
3865
+ }
3866
+ for (const [
3867
+ billingPortalConfigurationId
3868
+ ] of localBillingPortalConfigurationsById.entries()) {
3869
+ if (!stripeBillingPortalConfigurationIds.has(billingPortalConfigurationId)) {
3870
+ await storeDispatchTyped(
3871
+ {
3872
+ operation: "deleteById",
3873
+ table: "stripeBillingPortalConfigurations",
3874
+ idField: "billingPortalConfigurationId",
3875
+ idValue: billingPortalConfigurationId
3876
+ },
3877
+ context,
3878
+ configuration
3879
+ );
3880
+ }
3881
+ }
3882
+ }
3883
+ });
3884
+ const __vite_glob_0_0$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3885
+ __proto__: null,
3886
+ BillingPortalConfigurationsSyncImplementation
3887
+ }, Symbol.toStringTag, { value: "Module" }));
3752
3888
  const ChargeStripeToConvex = (charge) => {
3753
3889
  const object = {
3754
3890
  id: charge.id,
@@ -3945,7 +4081,7 @@ const ChargesSyncImplementation = defineActionImplementation({
3945
4081
  }
3946
4082
  }
3947
4083
  });
3948
- const __vite_glob_0_0$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4084
+ const __vite_glob_0_1$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3949
4085
  __proto__: null,
3950
4086
  ChargesSyncImplementation
3951
4087
  }, Symbol.toStringTag, { value: "Module" }));
@@ -4006,7 +4142,7 @@ const CheckoutSessionsSyncImplementation = defineActionImplementation({
4006
4142
  }
4007
4143
  }
4008
4144
  });
4009
- const __vite_glob_0_1$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4145
+ const __vite_glob_0_2$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4010
4146
  __proto__: null,
4011
4147
  CheckoutSessionsSyncImplementation
4012
4148
  }, Symbol.toStringTag, { value: "Module" }));
@@ -4134,7 +4270,7 @@ const CouponsSyncImplementation = defineActionImplementation({
4134
4270
  }
4135
4271
  }
4136
4272
  });
4137
- const __vite_glob_0_2$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4273
+ const __vite_glob_0_3$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4138
4274
  __proto__: null,
4139
4275
  CouponsSyncImplementation
4140
4276
  }, Symbol.toStringTag, { value: "Module" }));
@@ -4316,7 +4452,7 @@ const CreditNotesSyncImplementation = defineActionImplementation({
4316
4452
  }
4317
4453
  }
4318
4454
  });
4319
- const __vite_glob_0_3$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4455
+ const __vite_glob_0_4$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4320
4456
  __proto__: null,
4321
4457
  CreditNotesSyncImplementation
4322
4458
  }, Symbol.toStringTag, { value: "Module" }));
@@ -4544,7 +4680,7 @@ const CustomersSyncImplementation = defineActionImplementation({
4544
4680
  }
4545
4681
  }
4546
4682
  });
4547
- const __vite_glob_0_4$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4683
+ const __vite_glob_0_5$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4548
4684
  __proto__: null,
4549
4685
  CustomersSyncImplementation
4550
4686
  }, Symbol.toStringTag, { value: "Module" }));
@@ -4672,7 +4808,7 @@ const DisputesSyncImplementation = defineActionImplementation({
4672
4808
  }
4673
4809
  }
4674
4810
  });
4675
- const __vite_glob_0_5$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4811
+ const __vite_glob_0_6$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4676
4812
  __proto__: null,
4677
4813
  DisputesSyncImplementation
4678
4814
  }, Symbol.toStringTag, { value: "Module" }));
@@ -4759,7 +4895,7 @@ const EarlyFraudWarningsSyncImplementation = defineActionImplementation({
4759
4895
  }
4760
4896
  }
4761
4897
  });
4762
- const __vite_glob_0_6$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4898
+ const __vite_glob_0_7$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4763
4899
  __proto__: null,
4764
4900
  EarlyFraudWarningsSyncImplementation
4765
4901
  }, Symbol.toStringTag, { value: "Module" }));
@@ -5115,7 +5251,7 @@ const InvoicesSyncImplementation = defineActionImplementation({
5115
5251
  }
5116
5252
  }
5117
5253
  });
5118
- const __vite_glob_0_7$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5254
+ const __vite_glob_0_8$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5119
5255
  __proto__: null,
5120
5256
  InvoicesSyncImplementation
5121
5257
  }, Symbol.toStringTag, { value: "Module" }));
@@ -5176,7 +5312,7 @@ const PaymentIntentsSyncImplementation = defineActionImplementation({
5176
5312
  }
5177
5313
  }
5178
5314
  });
5179
- const __vite_glob_0_8$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5315
+ const __vite_glob_0_9$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5180
5316
  __proto__: null,
5181
5317
  PaymentIntentsSyncImplementation
5182
5318
  }, Symbol.toStringTag, { value: "Module" }));
@@ -5526,7 +5662,7 @@ const PaymentMethodsSyncImplementation = defineActionImplementation({
5526
5662
  }
5527
5663
  }
5528
5664
  });
5529
- const __vite_glob_0_9$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5665
+ const __vite_glob_0_10$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5530
5666
  __proto__: null,
5531
5667
  PaymentMethodsSyncImplementation
5532
5668
  }, Symbol.toStringTag, { value: "Module" }));
@@ -5683,7 +5819,7 @@ const PayoutsSyncImplementation = defineActionImplementation({
5683
5819
  }
5684
5820
  }
5685
5821
  });
5686
- const __vite_glob_0_10$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5822
+ const __vite_glob_0_11$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5687
5823
  __proto__: null,
5688
5824
  PayoutsSyncImplementation
5689
5825
  }, Symbol.toStringTag, { value: "Module" }));
@@ -5807,7 +5943,7 @@ const PlansSyncImplementation = defineActionImplementation({
5807
5943
  }
5808
5944
  }
5809
5945
  });
5810
- const __vite_glob_0_11$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5946
+ const __vite_glob_0_12$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5811
5947
  __proto__: null,
5812
5948
  PlansSyncImplementation
5813
5949
  }, Symbol.toStringTag, { value: "Module" }));
@@ -5929,7 +6065,7 @@ const PricesSyncImplementation = defineActionImplementation({
5929
6065
  }
5930
6066
  }
5931
6067
  });
5932
- const __vite_glob_0_12$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6068
+ const __vite_glob_0_13$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5933
6069
  __proto__: null,
5934
6070
  PricesSyncImplementation
5935
6071
  }, Symbol.toStringTag, { value: "Module" }));
@@ -6045,7 +6181,7 @@ const ProductsSyncImplementation = defineActionImplementation({
6045
6181
  }
6046
6182
  }
6047
6183
  });
6048
- const __vite_glob_0_13$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6184
+ const __vite_glob_0_14$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6049
6185
  __proto__: null,
6050
6186
  ProductsSyncImplementation
6051
6187
  }, Symbol.toStringTag, { value: "Module" }));
@@ -6158,7 +6294,7 @@ const PromotionCodesSyncImplementation = defineActionImplementation({
6158
6294
  }
6159
6295
  }
6160
6296
  });
6161
- const __vite_glob_0_14$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6297
+ const __vite_glob_0_15$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6162
6298
  __proto__: null,
6163
6299
  PromotionCodesSyncImplementation
6164
6300
  }, Symbol.toStringTag, { value: "Module" }));
@@ -6283,7 +6419,7 @@ const RefundsSyncImplementation = defineActionImplementation({
6283
6419
  }
6284
6420
  }
6285
6421
  });
6286
- const __vite_glob_0_15$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6422
+ const __vite_glob_0_16$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6287
6423
  __proto__: null,
6288
6424
  RefundsSyncImplementation
6289
6425
  }, Symbol.toStringTag, { value: "Module" }));
@@ -6400,7 +6536,7 @@ const ReviewsSyncImplementation = defineActionImplementation({
6400
6536
  }
6401
6537
  }
6402
6538
  });
6403
- const __vite_glob_0_16$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6539
+ const __vite_glob_0_17$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6404
6540
  __proto__: null,
6405
6541
  ReviewsSyncImplementation
6406
6542
  }, Symbol.toStringTag, { value: "Module" }));
@@ -6549,7 +6685,7 @@ const SetupIntentsSyncImplementation = defineActionImplementation({
6549
6685
  }
6550
6686
  }
6551
6687
  });
6552
- const __vite_glob_0_17$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6688
+ const __vite_glob_0_18$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6553
6689
  __proto__: null,
6554
6690
  SetupIntentsSyncImplementation
6555
6691
  }, Symbol.toStringTag, { value: "Module" }));
@@ -6745,7 +6881,7 @@ const SubscriptionSchedulesSyncImplementation = defineActionImplementation({
6745
6881
  }
6746
6882
  }
6747
6883
  });
6748
- const __vite_glob_0_18$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6884
+ const __vite_glob_0_19$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6749
6885
  __proto__: null,
6750
6886
  SubscriptionSchedulesSyncImplementation
6751
6887
  }, Symbol.toStringTag, { value: "Module" }));
@@ -6817,7 +6953,7 @@ const SubscriptionsSyncImplementation = defineActionImplementation({
6817
6953
  }
6818
6954
  }
6819
6955
  });
6820
- const __vite_glob_0_19$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6956
+ const __vite_glob_0_20$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6821
6957
  __proto__: null,
6822
6958
  SubscriptionsSyncImplementation
6823
6959
  }, Symbol.toStringTag, { value: "Module" }));
@@ -6927,7 +7063,7 @@ const TaxIdsSyncImplementation = defineActionImplementation({
6927
7063
  }
6928
7064
  }
6929
7065
  });
6930
- const __vite_glob_0_20$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7066
+ const __vite_glob_0_21$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6931
7067
  __proto__: null,
6932
7068
  TaxIdsSyncImplementation
6933
7069
  }, Symbol.toStringTag, { value: "Module" }));
@@ -6953,7 +7089,8 @@ const HANDLERS_MODULES$1 = Object.values(
6953
7089
  __vite_glob_0_17$1,
6954
7090
  __vite_glob_0_18$1,
6955
7091
  __vite_glob_0_19$1,
6956
- __vite_glob_0_20$1
7092
+ __vite_glob_0_20$1,
7093
+ __vite_glob_0_21$1
6957
7094
  ]
6958
7095
  );
6959
7096
  if (HANDLERS_MODULES$1.some((handler) => Object.keys(handler).length > 1)) {
@@ -6970,6 +7107,7 @@ const SyncAllImplementation = defineActionImplementation({
6970
7107
  HANDLERS$1.map(async (handler) => {
6971
7108
  try {
6972
7109
  await handler.handler(context, {}, configuration);
7110
+ console.info(`[STRIPE SYNC ${handler.name}](Success)`);
6973
7111
  } catch (error) {
6974
7112
  configuration.logger.error(
6975
7113
  `[STRIPE SYNC ${handler.name}](Error): ${error}`
@@ -6982,6 +7120,41 @@ const SyncAllImplementation = defineActionImplementation({
6982
7120
  function defineWebhookHandler(handler) {
6983
7121
  return handler;
6984
7122
  }
7123
+ const billingPortalConfiguration_handler = defineWebhookHandler({
7124
+ events: [
7125
+ "billing_portal.configuration.created",
7126
+ "billing_portal.configuration.updated"
7127
+ ],
7128
+ handle: async (event, context, configuration) => {
7129
+ if (configuration.sync.stripeProducts !== true) return;
7130
+ const billingPortalConfiguration = event.data.object;
7131
+ switch (event.type) {
7132
+ case "billing_portal.configuration.created":
7133
+ case "billing_portal.configuration.updated":
7134
+ await storeDispatchTyped(
7135
+ {
7136
+ operation: "upsert",
7137
+ table: "stripeBillingPortalConfigurations",
7138
+ idField: "billingPortalConfigurationId",
7139
+ data: {
7140
+ billingPortalConfigurationId: billingPortalConfiguration.id,
7141
+ stripe: BillingPortalConfigurationStripeToConvex(
7142
+ billingPortalConfiguration
7143
+ ),
7144
+ lastSyncedAt: Date.now()
7145
+ }
7146
+ },
7147
+ context,
7148
+ configuration
7149
+ );
7150
+ break;
7151
+ }
7152
+ }
7153
+ });
7154
+ const __vite_glob_0_0 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7155
+ __proto__: null,
7156
+ default: billingPortalConfiguration_handler
7157
+ }, Symbol.toStringTag, { value: "Module" }));
6985
7158
  const charges_handler = defineWebhookHandler({
6986
7159
  events: [
6987
7160
  "charge.captured",
@@ -7021,7 +7194,7 @@ const charges_handler = defineWebhookHandler({
7021
7194
  }
7022
7195
  }
7023
7196
  });
7024
- const __vite_glob_0_0 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7197
+ const __vite_glob_0_1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7025
7198
  __proto__: null,
7026
7199
  default: charges_handler
7027
7200
  }, Symbol.toStringTag, { value: "Module" }));
@@ -7058,7 +7231,7 @@ const checkoutSessions_handler = defineWebhookHandler({
7058
7231
  }
7059
7232
  }
7060
7233
  });
7061
- const __vite_glob_0_1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7234
+ const __vite_glob_0_2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7062
7235
  __proto__: null,
7063
7236
  default: checkoutSessions_handler
7064
7237
  }, Symbol.toStringTag, { value: "Module" }));
@@ -7100,7 +7273,7 @@ const coupons_handler = defineWebhookHandler({
7100
7273
  }
7101
7274
  }
7102
7275
  });
7103
- const __vite_glob_0_2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7276
+ const __vite_glob_0_3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7104
7277
  __proto__: null,
7105
7278
  default: coupons_handler
7106
7279
  }, Symbol.toStringTag, { value: "Module" }));
@@ -7131,7 +7304,7 @@ const creditNotes_handler = defineWebhookHandler({
7131
7304
  }
7132
7305
  }
7133
7306
  });
7134
- const __vite_glob_0_3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7307
+ const __vite_glob_0_4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7135
7308
  __proto__: null,
7136
7309
  default: creditNotes_handler
7137
7310
  }, Symbol.toStringTag, { value: "Module" }));
@@ -7180,7 +7353,7 @@ const customers_handler = defineWebhookHandler({
7180
7353
  }
7181
7354
  }
7182
7355
  });
7183
- const __vite_glob_0_4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7356
+ const __vite_glob_0_5 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7184
7357
  __proto__: null,
7185
7358
  default: customers_handler
7186
7359
  }, Symbol.toStringTag, { value: "Module" }));
@@ -7219,7 +7392,7 @@ const disputes_handler = defineWebhookHandler({
7219
7392
  }
7220
7393
  }
7221
7394
  });
7222
- const __vite_glob_0_5 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7395
+ const __vite_glob_0_6 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7223
7396
  __proto__: null,
7224
7397
  default: disputes_handler
7225
7398
  }, Symbol.toStringTag, { value: "Module" }));
@@ -7252,7 +7425,7 @@ const earlyFraudWarnings_handler = defineWebhookHandler({
7252
7425
  }
7253
7426
  }
7254
7427
  });
7255
- const __vite_glob_0_6 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7428
+ const __vite_glob_0_7 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7256
7429
  __proto__: null,
7257
7430
  default: earlyFraudWarnings_handler
7258
7431
  }, Symbol.toStringTag, { value: "Module" }));
@@ -7320,10 +7493,93 @@ const invoices_handler = defineWebhookHandler({
7320
7493
  }
7321
7494
  }
7322
7495
  });
7323
- const __vite_glob_0_7 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7496
+ const __vite_glob_0_8 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7324
7497
  __proto__: null,
7325
7498
  default: invoices_handler
7326
7499
  }, Symbol.toStringTag, { value: "Module" }));
7500
+ const MandateStripeToConvex = (mandate) => {
7501
+ const object = {
7502
+ id: mandate.id,
7503
+ customer_acceptance: mandate.customer_acceptance,
7504
+ payment_method: typeof mandate.payment_method === "string" ? mandate.payment_method : mandate.payment_method.id,
7505
+ payment_method_details: mandate.payment_method_details,
7506
+ status: mandate.status,
7507
+ type: mandate.type,
7508
+ object: mandate.object,
7509
+ livemode: mandate.livemode,
7510
+ multi_use: mandate.multi_use,
7511
+ on_behalf_of: mandate.on_behalf_of,
7512
+ single_use: mandate.single_use
7513
+ };
7514
+ return object;
7515
+ };
7516
+ const MandateSchema = {
7517
+ id: v.string(),
7518
+ customer_acceptance: v.object({
7519
+ accepted_at: v.optional(nullablenumber()),
7520
+ // offline: optionalnullableobject({
7521
+ // // TODO: complete
7522
+ // }),
7523
+ offline: optionalany(),
7524
+ online: optionalnullableobject({
7525
+ ip_address: v.optional(nullablestring()),
7526
+ user_agent: v.optional(nullablestring())
7527
+ }),
7528
+ type: v.union(v.literal("offline"), v.literal("online"))
7529
+ }),
7530
+ payment_method: v.string(),
7531
+ // payment_method_details: v.object({
7532
+ // // TODO: complete
7533
+ // }),
7534
+ payment_method_details: optionalany(),
7535
+ status: v.union(
7536
+ v.literal("active"),
7537
+ v.literal("inactive"),
7538
+ v.literal("pending")
7539
+ ),
7540
+ type: v.union(v.literal("multi_use"), v.literal("single_use")),
7541
+ object: v.string(),
7542
+ livemode: v.boolean(),
7543
+ // multi_use: optionalnullableobject({
7544
+ // // TODO: complete
7545
+ // }),
7546
+ multi_use: optionalany(),
7547
+ on_behalf_of: v.optional(nullablestring()),
7548
+ single_use: optionalnullableobject({
7549
+ amount: v.number(),
7550
+ currency: v.string()
7551
+ })
7552
+ };
7553
+ v.object(MandateSchema);
7554
+ const mandates_handler = defineWebhookHandler({
7555
+ events: ["mandate.updated"],
7556
+ handle: async (event, context, configuration) => {
7557
+ if (configuration.sync.stripeMandates !== true) return;
7558
+ const mandate = event.data.object;
7559
+ switch (event.type) {
7560
+ case "mandate.updated":
7561
+ await storeDispatchTyped(
7562
+ {
7563
+ operation: "upsert",
7564
+ table: "stripeMandates",
7565
+ idField: "mandateId",
7566
+ data: {
7567
+ mandateId: mandate.id,
7568
+ stripe: MandateStripeToConvex(mandate),
7569
+ lastSyncedAt: Date.now()
7570
+ }
7571
+ },
7572
+ context,
7573
+ configuration
7574
+ );
7575
+ break;
7576
+ }
7577
+ }
7578
+ });
7579
+ const __vite_glob_0_9 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7580
+ __proto__: null,
7581
+ default: mandates_handler
7582
+ }, Symbol.toStringTag, { value: "Module" }));
7327
7583
  const paymentIntents_handler = defineWebhookHandler({
7328
7584
  events: [
7329
7585
  "payment_intent.created",
@@ -7365,7 +7621,7 @@ const paymentIntents_handler = defineWebhookHandler({
7365
7621
  }
7366
7622
  }
7367
7623
  });
7368
- const __vite_glob_0_8 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7624
+ const __vite_glob_0_10 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7369
7625
  __proto__: null,
7370
7626
  default: paymentIntents_handler
7371
7627
  }, Symbol.toStringTag, { value: "Module" }));
@@ -7402,7 +7658,7 @@ const paymentMethods_handler = defineWebhookHandler({
7402
7658
  }
7403
7659
  }
7404
7660
  });
7405
- const __vite_glob_0_9 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7661
+ const __vite_glob_0_11 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7406
7662
  __proto__: null,
7407
7663
  default: paymentMethods_handler
7408
7664
  }, Symbol.toStringTag, { value: "Module" }));
@@ -7443,7 +7699,7 @@ const payouts_handler = defineWebhookHandler({
7443
7699
  }
7444
7700
  }
7445
7701
  });
7446
- const __vite_glob_0_10 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7702
+ const __vite_glob_0_12 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7447
7703
  __proto__: null,
7448
7704
  default: payouts_handler
7449
7705
  }, Symbol.toStringTag, { value: "Module" }));
@@ -7474,7 +7730,7 @@ const plans_handler = defineWebhookHandler({
7474
7730
  }
7475
7731
  }
7476
7732
  });
7477
- const __vite_glob_0_11 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7733
+ const __vite_glob_0_13 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7478
7734
  __proto__: null,
7479
7735
  default: plans_handler
7480
7736
  }, Symbol.toStringTag, { value: "Module" }));
@@ -7518,7 +7774,7 @@ const prices_handler = defineWebhookHandler({
7518
7774
  }
7519
7775
  }
7520
7776
  });
7521
- const __vite_glob_0_12 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7777
+ const __vite_glob_0_14 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7522
7778
  __proto__: null,
7523
7779
  default: prices_handler
7524
7780
  }, Symbol.toStringTag, { value: "Module" }));
@@ -7562,7 +7818,7 @@ const products_handler = defineWebhookHandler({
7562
7818
  }
7563
7819
  }
7564
7820
  });
7565
- const __vite_glob_0_13 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7821
+ const __vite_glob_0_15 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7566
7822
  __proto__: null,
7567
7823
  default: products_handler
7568
7824
  }, Symbol.toStringTag, { value: "Module" }));
@@ -7592,7 +7848,7 @@ const promotionCodes_handler = defineWebhookHandler({
7592
7848
  }
7593
7849
  }
7594
7850
  });
7595
- const __vite_glob_0_14 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7851
+ const __vite_glob_0_16 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7596
7852
  __proto__: null,
7597
7853
  default: promotionCodes_handler
7598
7854
  }, Symbol.toStringTag, { value: "Module" }));
@@ -7628,7 +7884,7 @@ const refunds_handler = defineWebhookHandler({
7628
7884
  }
7629
7885
  }
7630
7886
  });
7631
- const __vite_glob_0_15 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7887
+ const __vite_glob_0_17 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7632
7888
  __proto__: null,
7633
7889
  default: refunds_handler
7634
7890
  }, Symbol.toStringTag, { value: "Module" }));
@@ -7658,7 +7914,7 @@ const reviews_handler = defineWebhookHandler({
7658
7914
  }
7659
7915
  }
7660
7916
  });
7661
- const __vite_glob_0_16 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7917
+ const __vite_glob_0_18 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7662
7918
  __proto__: null,
7663
7919
  default: reviews_handler
7664
7920
  }, Symbol.toStringTag, { value: "Module" }));
@@ -7701,7 +7957,7 @@ const setupIntent_handler = defineWebhookHandler({
7701
7957
  }
7702
7958
  }
7703
7959
  });
7704
- const __vite_glob_0_17 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7960
+ const __vite_glob_0_19 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7705
7961
  __proto__: null,
7706
7962
  default: setupIntent_handler
7707
7963
  }, Symbol.toStringTag, { value: "Module" }));
@@ -7744,7 +8000,7 @@ const subscriptionSchedules_handler = defineWebhookHandler({
7744
8000
  }
7745
8001
  }
7746
8002
  });
7747
- const __vite_glob_0_18 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8003
+ const __vite_glob_0_20 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7748
8004
  __proto__: null,
7749
8005
  default: subscriptionSchedules_handler
7750
8006
  }, Symbol.toStringTag, { value: "Module" }));
@@ -7781,7 +8037,7 @@ const subscription_handler = defineWebhookHandler({
7781
8037
  );
7782
8038
  }
7783
8039
  });
7784
- const __vite_glob_0_19 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8040
+ const __vite_glob_0_21 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7785
8041
  __proto__: null,
7786
8042
  default: subscription_handler
7787
8043
  }, Symbol.toStringTag, { value: "Module" }));
@@ -7820,7 +8076,7 @@ const taxId_handler = defineWebhookHandler({
7820
8076
  }
7821
8077
  }
7822
8078
  });
7823
- const __vite_glob_0_20 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
8079
+ const __vite_glob_0_22 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7824
8080
  __proto__: null,
7825
8081
  default: taxId_handler
7826
8082
  }, Symbol.toStringTag, { value: "Module" }));
@@ -7846,7 +8102,9 @@ const HANDLERS_MODULES = Object.values(
7846
8102
  __vite_glob_0_17,
7847
8103
  __vite_glob_0_18,
7848
8104
  __vite_glob_0_19,
7849
- __vite_glob_0_20
8105
+ __vite_glob_0_20,
8106
+ __vite_glob_0_21,
8107
+ __vite_glob_0_22
7850
8108
  ]
7851
8109
  );
7852
8110
  if (HANDLERS_MODULES.some((handler) => Object.keys(handler).length > 1)) {
@@ -7989,7 +8247,17 @@ const stripeTables = {
7989
8247
  subscriptionScheduleId: v.string(),
7990
8248
  stripe: v.object(SubscriptionScheduleSchema),
7991
8249
  lastSyncedAt: v.number()
7992
- }).index("bySubscriptionScheduleId", ["subscriptionScheduleId"])
8250
+ }).index("bySubscriptionScheduleId", ["subscriptionScheduleId"]),
8251
+ stripeMandates: defineTable({
8252
+ mandateId: v.string(),
8253
+ stripe: v.object(MandateSchema),
8254
+ lastSyncedAt: v.number()
8255
+ }).index("byMandateId", ["mandateId"]),
8256
+ stripeBillingPortalConfigurations: defineTable({
8257
+ billingPortalConfigurationId: v.string(),
8258
+ stripe: v.object(BillingPortalConfigurationSchema),
8259
+ lastSyncedAt: v.number()
8260
+ }).index("byBillingPortalConfigurationId", ["billingPortalConfigurationId"])
7993
8261
  };
7994
8262
  defineSchema(stripeTables);
7995
8263
  const buildHttp = (configuration) => ({