convex-affiliates 1.1.4 → 2.0.1
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/README.md +10 -2
- package/dist/client/index.d.ts +110 -119
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +162 -159
- package/dist/client/index.js.map +1 -1
- package/dist/component/_generated/component.d.ts +136 -131
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/affiliates.d.ts +45 -45
- package/dist/component/analytics.d.ts +3 -3
- package/dist/component/campaigns.d.ts +48 -48
- package/dist/component/commissions.d.ts +4 -4
- package/dist/component/payouts.d.ts +8 -8
- package/dist/component/referrals.d.ts +19 -19
- package/dist/component/schema.d.ts +43 -43
- package/dist/component/validators.d.ts +7 -7
- package/package.json +1 -1
- package/src/client/index.test.ts +18 -2
- package/src/client/index.ts +222 -207
- package/src/component/_generated/component.ts +138 -128
package/README.md
CHANGED
|
@@ -255,14 +255,22 @@ If you're not using `@convex-dev/stripe`, use the standalone handler with built-
|
|
|
255
255
|
// convex/http.ts
|
|
256
256
|
import { httpRouter } from "convex/server";
|
|
257
257
|
import { components } from "./_generated/api";
|
|
258
|
-
import {
|
|
258
|
+
import { createAffiliateApi } from "convex-affiliates";
|
|
259
259
|
|
|
260
260
|
const http = httpRouter();
|
|
261
261
|
|
|
262
|
+
const affiliates = createAffiliateApi(components.affiliates, {
|
|
263
|
+
auth: async (ctx) => {
|
|
264
|
+
const identity = await ctx.auth.getUserIdentity();
|
|
265
|
+
if (!identity) throw new Error("Not authenticated");
|
|
266
|
+
return identity.subject;
|
|
267
|
+
},
|
|
268
|
+
});
|
|
269
|
+
|
|
262
270
|
http.route({
|
|
263
271
|
path: "/webhooks/stripe",
|
|
264
272
|
method: "POST",
|
|
265
|
-
handler: createStripeWebhookHandler(
|
|
273
|
+
handler: affiliates.createStripeWebhookHandler({
|
|
266
274
|
webhookSecret: process.env.STRIPE_WEBHOOK_SECRET!,
|
|
267
275
|
}),
|
|
268
276
|
});
|
package/dist/client/index.d.ts
CHANGED
|
@@ -125,21 +125,32 @@ export interface AffiliateConfig {
|
|
|
125
125
|
*/
|
|
126
126
|
baseUrl?: string;
|
|
127
127
|
}
|
|
128
|
+
/**
|
|
129
|
+
* Context type for auth callbacks.
|
|
130
|
+
* Uses the full query context so consumers can call helpers like
|
|
131
|
+
* `authComponent.safeGetAuthUser(ctx)` which need `runQuery`.
|
|
132
|
+
*/
|
|
133
|
+
export type RunQueryCtx = {
|
|
134
|
+
runQuery: (query: any, args?: any) => Promise<any>;
|
|
135
|
+
auth: Auth;
|
|
136
|
+
};
|
|
137
|
+
export type RunMutationCtx = RunQueryCtx & {
|
|
138
|
+
runMutation: (mutation: any, args?: any) => Promise<any>;
|
|
139
|
+
};
|
|
140
|
+
export type RunActionCtx = RunMutationCtx & {
|
|
141
|
+
runAction: (action: any, args?: any) => Promise<any>;
|
|
142
|
+
};
|
|
128
143
|
export interface CreateAffiliateApiConfig extends AffiliateConfig {
|
|
129
144
|
/**
|
|
130
145
|
* Authentication function that returns the user ID.
|
|
131
146
|
* Called for all authenticated endpoints.
|
|
132
147
|
*/
|
|
133
|
-
auth: (ctx:
|
|
134
|
-
auth: Auth;
|
|
135
|
-
}) => Promise<string>;
|
|
148
|
+
auth: (ctx: RunQueryCtx) => Promise<string>;
|
|
136
149
|
/**
|
|
137
150
|
* Optional admin check function.
|
|
138
151
|
* If not provided, admin endpoints will use the auth function only.
|
|
139
152
|
*/
|
|
140
|
-
isAdmin?: (ctx:
|
|
141
|
-
auth: Auth;
|
|
142
|
-
}) => Promise<boolean>;
|
|
153
|
+
isAdmin?: (ctx: RunQueryCtx) => Promise<boolean>;
|
|
143
154
|
/**
|
|
144
155
|
* Optional type-safe hooks for affiliate lifecycle events.
|
|
145
156
|
* Each hook receives typed data specific to that event.
|
|
@@ -168,19 +179,14 @@ export interface CreateAffiliateApiConfig extends AffiliateConfig {
|
|
|
168
179
|
* import { createAffiliateApi } from "convex-affiliates";
|
|
169
180
|
* import { components } from "./_generated/api";
|
|
170
181
|
*
|
|
171
|
-
* export const {
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
* const identity = await ctx.auth.getUserIdentity();
|
|
180
|
-
* if (!identity) throw new Error("Not authenticated");
|
|
181
|
-
* return identity.subject;
|
|
182
|
-
* },
|
|
183
|
-
* });
|
|
182
|
+
* export const { trackClick, register, getPortalData } =
|
|
183
|
+
* createAffiliateApi(components.affiliates, {
|
|
184
|
+
* auth: async (ctx) => {
|
|
185
|
+
* const identity = await ctx.auth.getUserIdentity();
|
|
186
|
+
* if (!identity) throw new Error("Not authenticated");
|
|
187
|
+
* return identity.subject;
|
|
188
|
+
* },
|
|
189
|
+
* });
|
|
184
190
|
* ```
|
|
185
191
|
*/
|
|
186
192
|
export declare function createAffiliateApi(component: ComponentApi, config: CreateAffiliateApiConfig): {
|
|
@@ -220,12 +226,12 @@ export declare function createAffiliateApi(component: ComponentApi, config: Crea
|
|
|
220
226
|
* ```
|
|
221
227
|
*/
|
|
222
228
|
trackClick: import("convex/server").RegisteredMutation<"public", {
|
|
223
|
-
subId?: string | undefined;
|
|
224
|
-
ipAddress?: string | undefined;
|
|
225
229
|
referrer?: string | undefined;
|
|
226
230
|
userAgent?: string | undefined;
|
|
227
|
-
|
|
231
|
+
ipAddress?: string | undefined;
|
|
232
|
+
subId?: string | undefined;
|
|
228
233
|
affiliateCode: string;
|
|
234
|
+
landingPage: string;
|
|
229
235
|
}, Promise<{
|
|
230
236
|
referralId: string;
|
|
231
237
|
} | null>>;
|
|
@@ -275,13 +281,13 @@ export declare function createAffiliateApi(component: ComponentApi, config: Crea
|
|
|
275
281
|
* ```
|
|
276
282
|
*/
|
|
277
283
|
register: import("convex/server").RegisteredMutation<"public", {
|
|
284
|
+
customCode?: string | undefined;
|
|
278
285
|
displayName?: string | undefined;
|
|
279
286
|
website?: string | undefined;
|
|
280
|
-
customCode?: string | undefined;
|
|
281
287
|
socialMedia?: string | undefined;
|
|
282
288
|
email: string;
|
|
283
289
|
}, Promise<{
|
|
284
|
-
affiliateId:
|
|
290
|
+
affiliateId: string;
|
|
285
291
|
code: string;
|
|
286
292
|
}>>;
|
|
287
293
|
/**
|
|
@@ -303,14 +309,13 @@ export declare function createAffiliateApi(component: ComponentApi, config: Crea
|
|
|
303
309
|
* ```
|
|
304
310
|
*/
|
|
305
311
|
getAffiliate: import("convex/server").RegisteredQuery<"public", {}, Promise<{
|
|
306
|
-
_id:
|
|
312
|
+
_id: string;
|
|
307
313
|
_creationTime: number;
|
|
308
314
|
userId: string;
|
|
309
|
-
campaignId:
|
|
315
|
+
campaignId: string;
|
|
310
316
|
code: string;
|
|
311
317
|
displayName?: string;
|
|
312
318
|
bio?: string;
|
|
313
|
-
avatarUrl?: string;
|
|
314
319
|
website?: string;
|
|
315
320
|
socials?: {
|
|
316
321
|
twitter?: string;
|
|
@@ -324,6 +329,11 @@ export declare function createAffiliateApi(component: ComponentApi, config: Crea
|
|
|
324
329
|
description?: string;
|
|
325
330
|
cta?: string;
|
|
326
331
|
};
|
|
332
|
+
promoContent?: {
|
|
333
|
+
title?: string;
|
|
334
|
+
type: "other" | "youtube_video" | "blog" | "twitter" | "instagram" | "tiktok";
|
|
335
|
+
url: string;
|
|
336
|
+
};
|
|
327
337
|
customCommissionType?: "percentage" | "fixed";
|
|
328
338
|
customCommissionValue?: number;
|
|
329
339
|
payoutMethod?: "manual" | "bank_transfer" | "paypal" | "other";
|
|
@@ -365,26 +375,26 @@ export declare function createAffiliateApi(component: ComponentApi, config: Crea
|
|
|
365
375
|
*/
|
|
366
376
|
updateProfile: import("convex/server").RegisteredMutation<"public", {
|
|
367
377
|
displayName?: string | undefined;
|
|
378
|
+
website?: string | undefined;
|
|
379
|
+
payoutEmail?: string | undefined;
|
|
368
380
|
bio?: string | undefined;
|
|
369
381
|
promoContent?: {
|
|
370
382
|
title?: string | undefined;
|
|
371
|
-
type: "other" | "
|
|
383
|
+
type: "other" | "youtube_video" | "blog" | "twitter" | "instagram" | "tiktok";
|
|
372
384
|
url: string;
|
|
373
385
|
} | undefined;
|
|
374
|
-
website?: string | undefined;
|
|
375
386
|
socials?: {
|
|
376
387
|
twitter?: string | undefined;
|
|
377
|
-
youtube?: string | undefined;
|
|
378
388
|
instagram?: string | undefined;
|
|
379
389
|
tiktok?: string | undefined;
|
|
390
|
+
youtube?: string | undefined;
|
|
380
391
|
linkedin?: string | undefined;
|
|
381
392
|
} | undefined;
|
|
382
393
|
customCopy?: {
|
|
383
|
-
headline?: string | undefined;
|
|
384
394
|
description?: string | undefined;
|
|
395
|
+
headline?: string | undefined;
|
|
385
396
|
cta?: string | undefined;
|
|
386
397
|
} | undefined;
|
|
387
|
-
payoutEmail?: string | undefined;
|
|
388
398
|
}, Promise<null>>;
|
|
389
399
|
/**
|
|
390
400
|
* Get complete portal data for the affiliate dashboard.
|
|
@@ -405,7 +415,7 @@ export declare function createAffiliateApi(component: ComponentApi, config: Crea
|
|
|
405
415
|
*/
|
|
406
416
|
getPortalData: import("convex/server").RegisteredQuery<"public", {}, Promise<{
|
|
407
417
|
affiliate: {
|
|
408
|
-
_id:
|
|
418
|
+
_id: string;
|
|
409
419
|
code: string;
|
|
410
420
|
displayName?: string;
|
|
411
421
|
status: "pending" | "approved" | "suspended" | "rejected";
|
|
@@ -425,11 +435,11 @@ export declare function createAffiliateApi(component: ComponentApi, config: Crea
|
|
|
425
435
|
commissionValue: number;
|
|
426
436
|
};
|
|
427
437
|
recentCommissions: Array<{
|
|
428
|
-
_id:
|
|
438
|
+
_id: string;
|
|
429
439
|
saleAmountCents: number;
|
|
430
440
|
commissionAmountCents: number;
|
|
431
441
|
currency: string;
|
|
432
|
-
status:
|
|
442
|
+
status: string;
|
|
433
443
|
createdAt: number;
|
|
434
444
|
}>;
|
|
435
445
|
pendingPayout: {
|
|
@@ -469,32 +479,7 @@ export declare function createAffiliateApi(component: ComponentApi, config: Crea
|
|
|
469
479
|
numItems: number;
|
|
470
480
|
cursor: string | null;
|
|
471
481
|
};
|
|
472
|
-
}, Promise<import("convex/server").PaginationResult<
|
|
473
|
-
_id: import("../component/_generated/dataModel.js").Id<"commissions">;
|
|
474
|
-
_creationTime: number;
|
|
475
|
-
affiliateId: import("../component/_generated/dataModel.js").Id<"affiliates">;
|
|
476
|
-
referralId: import("../component/_generated/dataModel.js").Id<"referrals">;
|
|
477
|
-
stripeCustomerId: string;
|
|
478
|
-
stripeProductId?: string;
|
|
479
|
-
stripeInvoiceId?: string;
|
|
480
|
-
stripeChargeId?: string;
|
|
481
|
-
stripeSubscriptionId?: string;
|
|
482
|
-
paymentNumber?: number;
|
|
483
|
-
subscriptionStartedAt?: number;
|
|
484
|
-
saleAmountCents: number;
|
|
485
|
-
commissionAmountCents: number;
|
|
486
|
-
commissionRate: number;
|
|
487
|
-
commissionType: "percentage" | "fixed";
|
|
488
|
-
currency: string;
|
|
489
|
-
status: "pending" | "approved" | "processing" | "paid" | "reversed";
|
|
490
|
-
payoutId?: import("../component/_generated/dataModel.js").Id<"payouts">;
|
|
491
|
-
dueAt: number;
|
|
492
|
-
createdAt: number;
|
|
493
|
-
approvedAt?: number;
|
|
494
|
-
paidAt?: number;
|
|
495
|
-
reversedAt?: number;
|
|
496
|
-
reversalReason?: string;
|
|
497
|
-
}>>>;
|
|
482
|
+
}, Promise<import("convex/server").PaginationResult<any>>>;
|
|
498
483
|
/**
|
|
499
484
|
* List the current affiliate's payouts with pagination.
|
|
500
485
|
* Supports filtering by status and cursor-based pagination.
|
|
@@ -526,21 +511,7 @@ export declare function createAffiliateApi(component: ComponentApi, config: Crea
|
|
|
526
511
|
numItems: number;
|
|
527
512
|
cursor: string | null;
|
|
528
513
|
};
|
|
529
|
-
}, Promise<import("convex/server").PaginationResult<
|
|
530
|
-
_id: import("../component/_generated/dataModel.js").Id<"payouts">;
|
|
531
|
-
_creationTime: number;
|
|
532
|
-
affiliateId: import("../component/_generated/dataModel.js").Id<"affiliates">;
|
|
533
|
-
amountCents: number;
|
|
534
|
-
currency: string;
|
|
535
|
-
method: "manual" | "bank_transfer" | "paypal" | "other";
|
|
536
|
-
periodStart: number;
|
|
537
|
-
periodEnd: number;
|
|
538
|
-
status: "pending" | "completed" | "cancelled";
|
|
539
|
-
commissionsCount: number;
|
|
540
|
-
notes?: string;
|
|
541
|
-
createdAt: number;
|
|
542
|
-
completedAt?: number;
|
|
543
|
-
}>>>;
|
|
514
|
+
}, Promise<import("convex/server").PaginationResult<any>>>;
|
|
544
515
|
/**
|
|
545
516
|
* List the current affiliate's referrals (clicks and signups).
|
|
546
517
|
* Shows the funnel of visitors who clicked affiliate links.
|
|
@@ -564,9 +535,9 @@ export declare function createAffiliateApi(component: ComponentApi, config: Crea
|
|
|
564
535
|
status?: "clicked" | "signed_up" | "converted" | "expired" | undefined;
|
|
565
536
|
limit?: number | undefined;
|
|
566
537
|
}, Promise<{
|
|
567
|
-
_id:
|
|
538
|
+
_id: string;
|
|
568
539
|
_creationTime: number;
|
|
569
|
-
affiliateId:
|
|
540
|
+
affiliateId: string;
|
|
570
541
|
referralId: string;
|
|
571
542
|
landingPage: string;
|
|
572
543
|
utmSource?: string;
|
|
@@ -680,7 +651,13 @@ export declare function createAffiliateApi(component: ComponentApi, config: Crea
|
|
|
680
651
|
userId?: string | undefined;
|
|
681
652
|
referralId?: string | undefined;
|
|
682
653
|
affiliateCode?: string | undefined;
|
|
683
|
-
}, Promise<
|
|
654
|
+
}, Promise<{
|
|
655
|
+
affiliateCode: string;
|
|
656
|
+
affiliateDisplayName?: string;
|
|
657
|
+
discountType: "percentage" | "fixed";
|
|
658
|
+
discountValue: number;
|
|
659
|
+
stripeCouponId?: string;
|
|
660
|
+
} | null>>;
|
|
684
661
|
/**
|
|
685
662
|
* Get admin dashboard overview with aggregate statistics.
|
|
686
663
|
* Requires admin authorization via the `isAdmin` callback.
|
|
@@ -731,18 +708,17 @@ export declare function createAffiliateApi(component: ComponentApi, config: Crea
|
|
|
731
708
|
* ```
|
|
732
709
|
*/
|
|
733
710
|
adminListAffiliates: import("convex/server").RegisteredQuery<"public", {
|
|
734
|
-
status?: "pending" | "approved" | "suspended" | "rejected" | undefined;
|
|
735
711
|
campaignId?: string | undefined;
|
|
712
|
+
status?: "pending" | "approved" | "suspended" | "rejected" | undefined;
|
|
736
713
|
limit?: number | undefined;
|
|
737
714
|
}, Promise<{
|
|
738
|
-
_id:
|
|
715
|
+
_id: string;
|
|
739
716
|
_creationTime: number;
|
|
740
717
|
userId: string;
|
|
741
|
-
campaignId:
|
|
718
|
+
campaignId: string;
|
|
742
719
|
code: string;
|
|
743
720
|
displayName?: string;
|
|
744
721
|
bio?: string;
|
|
745
|
-
avatarUrl?: string;
|
|
746
722
|
website?: string;
|
|
747
723
|
socials?: {
|
|
748
724
|
twitter?: string;
|
|
@@ -756,6 +732,11 @@ export declare function createAffiliateApi(component: ComponentApi, config: Crea
|
|
|
756
732
|
description?: string;
|
|
757
733
|
cta?: string;
|
|
758
734
|
};
|
|
735
|
+
promoContent?: {
|
|
736
|
+
title?: string;
|
|
737
|
+
type: "other" | "youtube_video" | "blog" | "twitter" | "instagram" | "tiktok";
|
|
738
|
+
url: string;
|
|
739
|
+
};
|
|
759
740
|
customCommissionType?: "percentage" | "fixed";
|
|
760
741
|
customCommissionValue?: number;
|
|
761
742
|
payoutMethod?: "manual" | "bank_transfer" | "paypal" | "other";
|
|
@@ -798,7 +779,7 @@ export declare function createAffiliateApi(component: ComponentApi, config: Crea
|
|
|
798
779
|
limit?: number | undefined;
|
|
799
780
|
sortBy?: "commissions" | "conversions" | "revenue" | undefined;
|
|
800
781
|
}, Promise<{
|
|
801
|
-
_id:
|
|
782
|
+
_id: string;
|
|
802
783
|
code: string;
|
|
803
784
|
displayName?: string;
|
|
804
785
|
stats: {
|
|
@@ -890,7 +871,7 @@ export declare function createAffiliateApi(component: ComponentApi, config: Crea
|
|
|
890
871
|
adminListCampaigns: import("convex/server").RegisteredQuery<"public", {
|
|
891
872
|
activeOnly?: boolean | undefined;
|
|
892
873
|
}, Promise<{
|
|
893
|
-
_id:
|
|
874
|
+
_id: string;
|
|
894
875
|
_creationTime: number;
|
|
895
876
|
name: string;
|
|
896
877
|
slug: string;
|
|
@@ -904,6 +885,10 @@ export declare function createAffiliateApi(component: ComponentApi, config: Crea
|
|
|
904
885
|
payoutTerm: "NET-0" | "NET-15" | "NET-30" | "NET-60" | "NET-90";
|
|
905
886
|
cookieDurationDays: number;
|
|
906
887
|
minPayoutCents: number;
|
|
888
|
+
maxClicksPerIpPerHour?: number;
|
|
889
|
+
refereeDiscountType?: "percentage" | "fixed";
|
|
890
|
+
refereeDiscountValue?: number;
|
|
891
|
+
refereeStripeCouponId?: string;
|
|
907
892
|
allowedProducts?: string[];
|
|
908
893
|
excludedProducts?: string[];
|
|
909
894
|
createdAt: number;
|
|
@@ -945,19 +930,49 @@ export declare function createAffiliateApi(component: ComponentApi, config: Crea
|
|
|
945
930
|
minPayoutCents?: number | undefined;
|
|
946
931
|
allowedProducts?: string[] | undefined;
|
|
947
932
|
excludedProducts?: string[] | undefined;
|
|
948
|
-
commissionType: "percentage" | "fixed";
|
|
949
|
-
name: string;
|
|
950
933
|
slug: string;
|
|
934
|
+
name: string;
|
|
935
|
+
commissionType: "percentage" | "fixed";
|
|
951
936
|
commissionValue: number;
|
|
952
|
-
}, Promise<
|
|
937
|
+
}, Promise<string>>;
|
|
938
|
+
/**
|
|
939
|
+
* Register HTTP routes for affiliate functionality.
|
|
940
|
+
* The component reference is already available from the closure.
|
|
941
|
+
*
|
|
942
|
+
* @param http - The Convex HTTP router
|
|
943
|
+
* @param options - Optional configuration (e.g., pathPrefix)
|
|
944
|
+
*
|
|
945
|
+
* @example
|
|
946
|
+
* ```typescript
|
|
947
|
+
* const affiliates = createAffiliateApi(components.affiliates, { ... });
|
|
948
|
+
* affiliates.registerRoutes(http, { pathPrefix: "/affiliates" });
|
|
949
|
+
* ```
|
|
950
|
+
*/
|
|
951
|
+
registerRoutes(http: HttpRouter, options?: {
|
|
952
|
+
pathPrefix?: string;
|
|
953
|
+
}): void;
|
|
954
|
+
/**
|
|
955
|
+
* Create a Stripe webhook handler that processes affiliate-related events.
|
|
956
|
+
* The component reference is already available from the closure.
|
|
957
|
+
*
|
|
958
|
+
* @param webhookConfig - Configuration with webhookSecret
|
|
959
|
+
* @returns An HTTP action handler for Stripe webhooks
|
|
960
|
+
*
|
|
961
|
+
* @example
|
|
962
|
+
* ```typescript
|
|
963
|
+
* const affiliates = createAffiliateApi(components.affiliates, { ... });
|
|
964
|
+
*
|
|
965
|
+
* http.route({
|
|
966
|
+
* path: "/webhooks/stripe",
|
|
967
|
+
* method: "POST",
|
|
968
|
+
* handler: affiliates.createStripeWebhookHandler({
|
|
969
|
+
* webhookSecret: process.env.STRIPE_WEBHOOK_SECRET!,
|
|
970
|
+
* }),
|
|
971
|
+
* });
|
|
972
|
+
* ```
|
|
973
|
+
*/
|
|
974
|
+
createStripeWebhookHandler(webhookConfig: StripeWebhookConfig): import("convex/server").PublicHttpAction;
|
|
953
975
|
};
|
|
954
|
-
/**
|
|
955
|
-
* Register HTTP routes for affiliate functionality.
|
|
956
|
-
* Useful for public API endpoints and webhook handling.
|
|
957
|
-
*/
|
|
958
|
-
export declare function registerRoutes(http: HttpRouter, component: ComponentApi, options?: {
|
|
959
|
-
pathPrefix?: string;
|
|
960
|
-
}): void;
|
|
961
976
|
export interface StripeWebhookConfig {
|
|
962
977
|
/**
|
|
963
978
|
* Stripe webhook signing secret (whsec_...).
|
|
@@ -966,30 +981,6 @@ export interface StripeWebhookConfig {
|
|
|
966
981
|
*/
|
|
967
982
|
webhookSecret: string;
|
|
968
983
|
}
|
|
969
|
-
/**
|
|
970
|
-
* Create a Stripe webhook handler that processes affiliate-related events.
|
|
971
|
-
* Handles invoice.paid, charge.refunded, and checkout.session.completed events.
|
|
972
|
-
*
|
|
973
|
-
* @example
|
|
974
|
-
* ```typescript
|
|
975
|
-
* import { httpRouter } from "convex/server";
|
|
976
|
-
* import { createStripeWebhookHandler } from "convex-affiliates";
|
|
977
|
-
* import { components } from "./_generated/api";
|
|
978
|
-
*
|
|
979
|
-
* const http = httpRouter();
|
|
980
|
-
*
|
|
981
|
-
* http.route({
|
|
982
|
-
* path: "/webhooks/stripe",
|
|
983
|
-
* method: "POST",
|
|
984
|
-
* handler: createStripeWebhookHandler(components.affiliates, {
|
|
985
|
-
* webhookSecret: process.env.STRIPE_WEBHOOK_SECRET!,
|
|
986
|
-
* }),
|
|
987
|
-
* });
|
|
988
|
-
*
|
|
989
|
-
* export default http;
|
|
990
|
-
* ```
|
|
991
|
-
*/
|
|
992
|
-
export declare function createStripeWebhookHandler(component: ComponentApi, config: StripeWebhookConfig): import("convex/server").PublicHttpAction;
|
|
993
984
|
/**
|
|
994
985
|
* Options for Stripe event handlers.
|
|
995
986
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAiBzE;;;GAGG;AACH,KAAK,gBAAgB,GAAG;IACtB,QAAQ,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IACnD,WAAW,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IACzD,SAAS,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;CACtD,CAAC;AAEF;;;GAGG;AACH,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,I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