pocketsflow 1.0.0 → 1.1.0
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 +138 -8
- package/dist/index.d.mts +495 -9
- package/dist/index.d.ts +495 -9
- package/dist/index.js +262 -6
- package/dist/index.mjs +262 -6
- package/package.json +4 -3
package/dist/index.d.ts
CHANGED
|
@@ -48,13 +48,42 @@ interface ProductFile {
|
|
|
48
48
|
size?: number;
|
|
49
49
|
}
|
|
50
50
|
interface CreateProductParams {
|
|
51
|
+
/** Product name (required) */
|
|
51
52
|
name: string;
|
|
53
|
+
/** Product description */
|
|
52
54
|
description?: string;
|
|
55
|
+
/** Product price (required, defaults to 0) */
|
|
53
56
|
price: number;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
/** Product subtitle */
|
|
58
|
+
subtitle?: string;
|
|
59
|
+
/** Whether customer can pay what they want */
|
|
60
|
+
payWant?: boolean;
|
|
61
|
+
/** Minimum price for pay-what-you-want */
|
|
62
|
+
minPrice?: number;
|
|
63
|
+
/** Maximum price for pay-what-you-want */
|
|
64
|
+
maxPrice?: number;
|
|
65
|
+
/** Whether product is published */
|
|
66
|
+
published?: boolean;
|
|
67
|
+
/** Product slug for URL */
|
|
68
|
+
slug?: string;
|
|
69
|
+
/** Thumbnail image URL */
|
|
70
|
+
thumbnail?: string;
|
|
71
|
+
/** Product images array */
|
|
72
|
+
images?: string[];
|
|
73
|
+
/** Call to action text */
|
|
74
|
+
ctaText?: string;
|
|
75
|
+
/** Show sales count */
|
|
76
|
+
showSales?: boolean;
|
|
77
|
+
/** Show reviews */
|
|
78
|
+
showReviews?: boolean;
|
|
79
|
+
/** Refund policy text */
|
|
80
|
+
refundPolicy?: string;
|
|
81
|
+
/** Callback URL for redirects */
|
|
82
|
+
callbackUrl?: string;
|
|
83
|
+
/** Collect first name */
|
|
84
|
+
hasFirstName?: boolean;
|
|
85
|
+
/** Collect last name */
|
|
86
|
+
hasLastName?: boolean;
|
|
58
87
|
}
|
|
59
88
|
interface UpdateProductParams {
|
|
60
89
|
name?: string;
|
|
@@ -162,12 +191,19 @@ interface Discount {
|
|
|
162
191
|
createdAt: string;
|
|
163
192
|
}
|
|
164
193
|
interface CreateDiscountParams {
|
|
194
|
+
/** Discount name (required) */
|
|
165
195
|
name: string;
|
|
196
|
+
/** Discount code (required) - what customers enter at checkout */
|
|
166
197
|
code: string;
|
|
198
|
+
/** Discount value (required) */
|
|
167
199
|
value: number;
|
|
168
|
-
|
|
200
|
+
/** Value type: 'percentage' or 'fixed' (defaults to 'percentage') */
|
|
201
|
+
valueType?: 'percentage' | 'fixed';
|
|
202
|
+
/** Whether discount is active (defaults to true) */
|
|
169
203
|
active?: boolean;
|
|
204
|
+
/** Product IDs this discount applies to (required) */
|
|
170
205
|
mainProductIds: string[];
|
|
206
|
+
/** Expiration date (ISO 8601 string) */
|
|
171
207
|
expiration?: string;
|
|
172
208
|
}
|
|
173
209
|
interface UpdateDiscountParams {
|
|
@@ -199,14 +235,23 @@ interface UpsellsResponse {
|
|
|
199
235
|
salesWithUpsells: any[];
|
|
200
236
|
}
|
|
201
237
|
interface CreateUpsellParams {
|
|
202
|
-
name
|
|
238
|
+
/** Upsell name */
|
|
239
|
+
name?: string;
|
|
240
|
+
/** Offer text/headline */
|
|
241
|
+
offer?: string;
|
|
242
|
+
/** Product IDs that trigger this upsell (required) */
|
|
203
243
|
mainProductIds: string[];
|
|
244
|
+
/** Product ID to upsell (required) */
|
|
204
245
|
upsellProductId: string;
|
|
246
|
+
/** Upsell price (required) */
|
|
205
247
|
upsellPrice: number;
|
|
248
|
+
/** Upsell description shown to customer */
|
|
206
249
|
upsellDescription?: string;
|
|
250
|
+
/** Primary button text (e.g., "Yes, add this!") */
|
|
207
251
|
primaryButtonText?: string;
|
|
252
|
+
/** Secondary button text (e.g., "No thanks") */
|
|
208
253
|
secondaryButtonText?: string;
|
|
209
|
-
|
|
254
|
+
/** Whether upsell is active (defaults to true) */
|
|
210
255
|
active?: boolean;
|
|
211
256
|
}
|
|
212
257
|
interface UpdateUpsellParams {
|
|
@@ -236,6 +281,273 @@ interface Subscription {
|
|
|
236
281
|
interface ListSubscriptionsParams extends PaginationParams, DateRangeParams {
|
|
237
282
|
status?: 'active' | 'canceled' | 'paused';
|
|
238
283
|
}
|
|
284
|
+
/** A subscription OFFER — a recurring product you sell. */
|
|
285
|
+
interface SubscriptionOffer {
|
|
286
|
+
_id: string;
|
|
287
|
+
userId: string;
|
|
288
|
+
name: string;
|
|
289
|
+
description?: string;
|
|
290
|
+
price: number;
|
|
291
|
+
currency?: string;
|
|
292
|
+
frequency: 'weekly' | 'monthly' | 'yearly';
|
|
293
|
+
published?: boolean;
|
|
294
|
+
slug?: string;
|
|
295
|
+
thumbnail?: string;
|
|
296
|
+
testMode: boolean;
|
|
297
|
+
createdAt: string;
|
|
298
|
+
updatedAt?: string;
|
|
299
|
+
}
|
|
300
|
+
/** Whop-sourced live membership status. */
|
|
301
|
+
type SubscriberStatus = 'incomplete' | 'incomplete_expired' | 'trialing' | 'active' | 'past_due' | 'canceled' | 'unpaid' | 'succeeded' | 'refunded' | 'paused';
|
|
302
|
+
/** A subscriber — a buyer's membership in one of your subscription offers. */
|
|
303
|
+
interface Subscriber {
|
|
304
|
+
_id: string;
|
|
305
|
+
buyerEmail: string;
|
|
306
|
+
/** Native portal link. The id pair is the capability — no login required. */
|
|
307
|
+
portalUrl?: string;
|
|
308
|
+
status: SubscriberStatus;
|
|
309
|
+
active: boolean;
|
|
310
|
+
/** The Whop PLAN id for this subscriber */
|
|
311
|
+
whopSubscriptionId?: string;
|
|
312
|
+
/** The Whop MEMBERSHIP id — drives the native portal cancel/resume actions */
|
|
313
|
+
whopMembershipId?: string;
|
|
314
|
+
cancelAtPeriodEnd?: boolean;
|
|
315
|
+
subscriptionId: string;
|
|
316
|
+
firstName?: string;
|
|
317
|
+
lastName?: string;
|
|
318
|
+
country?: string;
|
|
319
|
+
createdAt: string;
|
|
320
|
+
/** The joined subscription offer */
|
|
321
|
+
subscription?: {
|
|
322
|
+
_id: string;
|
|
323
|
+
name: string;
|
|
324
|
+
price: number;
|
|
325
|
+
frequency: 'weekly' | 'monthly' | 'yearly';
|
|
326
|
+
} | null;
|
|
327
|
+
}
|
|
328
|
+
interface ListSubscribersParams extends PaginationParams {
|
|
329
|
+
status?: SubscriberStatus;
|
|
330
|
+
buyerEmail?: string;
|
|
331
|
+
/** Alias for buyerEmail */
|
|
332
|
+
email?: string;
|
|
333
|
+
/** Filter by subscription offer id */
|
|
334
|
+
subscriptionId?: string;
|
|
335
|
+
}
|
|
336
|
+
interface SubscribersResponse {
|
|
337
|
+
subscribers: Subscriber[];
|
|
338
|
+
pagination: {
|
|
339
|
+
totalCount: number;
|
|
340
|
+
totalPages: number;
|
|
341
|
+
currentPage: number;
|
|
342
|
+
pageSize: number;
|
|
343
|
+
hasMore: boolean;
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
interface SubscriberDetail {
|
|
347
|
+
subscriber: Subscriber;
|
|
348
|
+
/** The subscription offer */
|
|
349
|
+
subscription: SubscriptionOffer | null;
|
|
350
|
+
/** The buyer's customer record */
|
|
351
|
+
customer: Customer | null;
|
|
352
|
+
status: SubscriberStatus;
|
|
353
|
+
/** Every subscription payment (initial + renewals) for this subscriber */
|
|
354
|
+
payments: Payment[];
|
|
355
|
+
/** Only present when `live: true` — null if the live lookup failed */
|
|
356
|
+
whopMembership?: Record<string, any> | null;
|
|
357
|
+
}
|
|
358
|
+
/** Native subscriber portal payload (no authentication required). */
|
|
359
|
+
interface SubscriberPortalData {
|
|
360
|
+
subscription?: SubscriptionOffer | null;
|
|
361
|
+
subscriber?: Subscriber | null;
|
|
362
|
+
payments?: Payment[];
|
|
363
|
+
[key: string]: any;
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* A single payment (a `Sale`). Covers BOTH one-time product purchases
|
|
367
|
+
* (`isSubscription: false`) and subscription payments — the initial charge and
|
|
368
|
+
* every renewal (`isSubscription: true`).
|
|
369
|
+
*/
|
|
370
|
+
interface Payment {
|
|
371
|
+
_id: string;
|
|
372
|
+
isSubscription: boolean;
|
|
373
|
+
/** Subscription payments only: `initial` activates the membership, `renewal` after */
|
|
374
|
+
billingReason?: 'initial' | 'renewal';
|
|
375
|
+
/** Charged amount (after tax), in the payment currency */
|
|
376
|
+
amount: number;
|
|
377
|
+
grossAmount?: number;
|
|
378
|
+
amountBeforeTax?: number;
|
|
379
|
+
taxAmount?: number;
|
|
380
|
+
currency: string;
|
|
381
|
+
buyerEmail: string;
|
|
382
|
+
firstName?: string;
|
|
383
|
+
lastName?: string;
|
|
384
|
+
isRefunded: boolean;
|
|
385
|
+
isDisputed: boolean;
|
|
386
|
+
/** Empty on subscription payments — use `subscriptionId` instead */
|
|
387
|
+
productId?: string;
|
|
388
|
+
/** Empty on one-time product purchases */
|
|
389
|
+
subscriptionId?: string;
|
|
390
|
+
whopPaymentId?: string;
|
|
391
|
+
whopPlanId?: string;
|
|
392
|
+
whopMembershipId?: string;
|
|
393
|
+
createdAt: string;
|
|
394
|
+
}
|
|
395
|
+
interface ListPaymentsParams extends PaginationParams, DateRangeParams {
|
|
396
|
+
/** `one_time`, `subscription`, or `all` (default) */
|
|
397
|
+
type?: 'one_time' | 'subscription' | 'all';
|
|
398
|
+
productId?: string;
|
|
399
|
+
/** Filter by subscription offer id */
|
|
400
|
+
subscriptionId?: string;
|
|
401
|
+
}
|
|
402
|
+
interface PaymentsResponse {
|
|
403
|
+
payments: Payment[];
|
|
404
|
+
pagination: {
|
|
405
|
+
totalCount: number;
|
|
406
|
+
totalPages: number;
|
|
407
|
+
currentPage: number;
|
|
408
|
+
pageSize: number;
|
|
409
|
+
hasMore: boolean;
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
interface PaymentDetail {
|
|
413
|
+
payment: Payment & {
|
|
414
|
+
/** Net to the seller (amountBeforeTax − affiliateCut − stripeFee) */
|
|
415
|
+
net?: number;
|
|
416
|
+
/** Processor fee (Stripe or PayPal) */
|
|
417
|
+
fee?: number;
|
|
418
|
+
/** The raw stored Whop payment payload captured on the webhook */
|
|
419
|
+
metadata?: Record<string, any>;
|
|
420
|
+
};
|
|
421
|
+
/** One-time purchases only; null for subscription payments */
|
|
422
|
+
product: Product | null;
|
|
423
|
+
/** Subscription payments only; null for one-time purchases */
|
|
424
|
+
subscription: SubscriptionOffer | null;
|
|
425
|
+
customer: Customer | null;
|
|
426
|
+
whop?: Record<string, any>;
|
|
427
|
+
/** Only present when `live: true` — null if the live lookup failed */
|
|
428
|
+
whopLive?: Record<string, any> | null;
|
|
429
|
+
}
|
|
430
|
+
interface CreatorPageLink {
|
|
431
|
+
title?: string;
|
|
432
|
+
url?: string;
|
|
433
|
+
order?: number;
|
|
434
|
+
[key: string]: any;
|
|
435
|
+
}
|
|
436
|
+
interface CreatorPage {
|
|
437
|
+
_id: string;
|
|
438
|
+
userId: string;
|
|
439
|
+
creatorName?: string;
|
|
440
|
+
creatorBio?: string;
|
|
441
|
+
username?: string;
|
|
442
|
+
socialLinks?: CreatorPageLink[];
|
|
443
|
+
regularLinks?: CreatorPageLink[];
|
|
444
|
+
theme?: string;
|
|
445
|
+
themeV2?: Record<string, any>;
|
|
446
|
+
gaMeasurementId?: string;
|
|
447
|
+
subscriberForm?: Record<string, any>;
|
|
448
|
+
bookingEnabled?: boolean;
|
|
449
|
+
bookingButtonLabel?: string;
|
|
450
|
+
template?: string;
|
|
451
|
+
createdAt: string;
|
|
452
|
+
updatedAt?: string;
|
|
453
|
+
}
|
|
454
|
+
interface CreateCreatorPageParams {
|
|
455
|
+
creatorName?: string;
|
|
456
|
+
creatorBio?: string;
|
|
457
|
+
username?: string;
|
|
458
|
+
socialLinks?: CreatorPageLink[];
|
|
459
|
+
regularLinks?: CreatorPageLink[];
|
|
460
|
+
theme?: string;
|
|
461
|
+
themeV2?: Record<string, any>;
|
|
462
|
+
gaMeasurementId?: string;
|
|
463
|
+
subscriberForm?: Record<string, any>;
|
|
464
|
+
bookingEnabled?: boolean;
|
|
465
|
+
bookingButtonLabel?: string;
|
|
466
|
+
template?: string;
|
|
467
|
+
}
|
|
468
|
+
type UpdateCreatorPageParams = CreateCreatorPageParams;
|
|
469
|
+
interface UploadImageResponse {
|
|
470
|
+
imageUrl: string;
|
|
471
|
+
}
|
|
472
|
+
type NewsletterPostStatus = 'draft' | 'scheduled' | 'sending' | 'sent' | 'failed' | 'automation';
|
|
473
|
+
interface NewsletterPost {
|
|
474
|
+
_id: string;
|
|
475
|
+
creatorId: string;
|
|
476
|
+
name: string;
|
|
477
|
+
subject?: string;
|
|
478
|
+
preview?: string;
|
|
479
|
+
fromName?: string;
|
|
480
|
+
fromEmail: string;
|
|
481
|
+
replyToEmail?: string;
|
|
482
|
+
contentHtml?: string;
|
|
483
|
+
contentJson?: any;
|
|
484
|
+
status: NewsletterPostStatus;
|
|
485
|
+
scheduledAt?: string;
|
|
486
|
+
scheduledTimezone?: string;
|
|
487
|
+
sentAt?: string;
|
|
488
|
+
sendToAll?: boolean;
|
|
489
|
+
tags?: string[];
|
|
490
|
+
subscriberIds?: string[];
|
|
491
|
+
source?: 'dashboard' | 'api';
|
|
492
|
+
createdAt: string;
|
|
493
|
+
updatedAt: string;
|
|
494
|
+
}
|
|
495
|
+
interface CreateNewsletterPostParams {
|
|
496
|
+
/** Internal post name (required) */
|
|
497
|
+
name: string;
|
|
498
|
+
/** Required before the post can leave `draft` */
|
|
499
|
+
subject?: string;
|
|
500
|
+
/** Required before the post can leave `draft` */
|
|
501
|
+
preview?: string;
|
|
502
|
+
/** Required before the post can leave `draft` */
|
|
503
|
+
fromName?: string;
|
|
504
|
+
/** Defaults to your configured sender */
|
|
505
|
+
fromEmail?: string;
|
|
506
|
+
replyToEmail?: string;
|
|
507
|
+
/** Required before the post can leave `draft` */
|
|
508
|
+
contentHtml?: string;
|
|
509
|
+
contentJson?: any;
|
|
510
|
+
status?: NewsletterPostStatus;
|
|
511
|
+
scheduledAt?: string;
|
|
512
|
+
scheduledTimezone?: string;
|
|
513
|
+
sendToAll?: boolean;
|
|
514
|
+
tags?: string[];
|
|
515
|
+
subscriberIds?: string[];
|
|
516
|
+
}
|
|
517
|
+
type UpdateNewsletterPostParams = Partial<CreateNewsletterPostParams>;
|
|
518
|
+
interface SendNewsletterPostResponse {
|
|
519
|
+
message: string;
|
|
520
|
+
post: NewsletterPost;
|
|
521
|
+
}
|
|
522
|
+
interface SendEmailParams {
|
|
523
|
+
/** Recipient(s) — 1 to 100 addresses */
|
|
524
|
+
to: string | string[];
|
|
525
|
+
subject: string;
|
|
526
|
+
/** Required unless `text` is provided */
|
|
527
|
+
html?: string;
|
|
528
|
+
/** Used to generate `html` when `html` is omitted */
|
|
529
|
+
text?: string;
|
|
530
|
+
fromName?: string;
|
|
531
|
+
replyTo?: string;
|
|
532
|
+
preview?: string;
|
|
533
|
+
}
|
|
534
|
+
interface SendEmailResponse {
|
|
535
|
+
/** The id of the post created for this send */
|
|
536
|
+
id: string;
|
|
537
|
+
/** Recipients the send was accepted for */
|
|
538
|
+
accepted: string[];
|
|
539
|
+
status: 'sent';
|
|
540
|
+
}
|
|
541
|
+
interface NewsletterSubscriber {
|
|
542
|
+
_id: string;
|
|
543
|
+
userId: string;
|
|
544
|
+
email: string;
|
|
545
|
+
name?: string;
|
|
546
|
+
status: 'active' | 'unsubscribed';
|
|
547
|
+
tags?: string[];
|
|
548
|
+
createdAt: string;
|
|
549
|
+
updatedAt: string;
|
|
550
|
+
}
|
|
239
551
|
interface Webhook {
|
|
240
552
|
_id: string;
|
|
241
553
|
userId: string;
|
|
@@ -248,11 +560,17 @@ interface Webhook {
|
|
|
248
560
|
createdAt: string;
|
|
249
561
|
}
|
|
250
562
|
interface CreateWebhookParams {
|
|
563
|
+
/** Webhook endpoint URL (required) */
|
|
251
564
|
url: string;
|
|
252
|
-
|
|
565
|
+
/** Events to subscribe to (required) */
|
|
566
|
+
events: WebhookEvent[];
|
|
567
|
+
/** Webhook description */
|
|
253
568
|
description?: string;
|
|
569
|
+
/** Whether webhook is active (defaults to true) */
|
|
254
570
|
active?: boolean;
|
|
255
571
|
}
|
|
572
|
+
/** Available webhook events */
|
|
573
|
+
type WebhookEvent = 'order.completed' | 'order.refunded' | 'product.created' | 'product.updated' | 'product.deleted' | 'review.created' | 'customer.created' | 'customer.subscription.updated' | 'customer.subscription.deleted' | 'invoice.payment_succeeded' | 'invoice.payment_failed' | 'invoice.created' | 'invoice.upcoming' | 'payment_intent.succeeded' | 'payment_intent.payment_failed' | 'customer.subscription.trial_will_end' | 'customer.subscription.pause' | 'customer.subscription.resumed' | 'identity.verification_session.verified' | 'identity.verification_session.processing' | 'identity.verification_session.requires_input';
|
|
256
574
|
interface UpdateWebhookParams {
|
|
257
575
|
url?: string;
|
|
258
576
|
events?: string[];
|
|
@@ -329,6 +647,12 @@ declare class Pocketsflow {
|
|
|
329
647
|
discounts: DiscountsResource;
|
|
330
648
|
upsells: UpsellsResource;
|
|
331
649
|
subscriptions: SubscriptionsResource;
|
|
650
|
+
subscriptionOffers: SubscriptionOffersResource;
|
|
651
|
+
subscribers: SubscribersResource;
|
|
652
|
+
payments: PaymentsResource;
|
|
653
|
+
creatorPages: CreatorPagesResource;
|
|
654
|
+
images: ImagesResource;
|
|
655
|
+
newsletters: NewslettersResource;
|
|
332
656
|
webhooks: WebhooksResource;
|
|
333
657
|
users: UsersResource;
|
|
334
658
|
checkout: CheckoutResource;
|
|
@@ -402,6 +726,10 @@ declare class DiscountsResource {
|
|
|
402
726
|
delete(id: string): Promise<{
|
|
403
727
|
message: string;
|
|
404
728
|
}>;
|
|
729
|
+
/** Validate a discount code against a product and get the resulting price */
|
|
730
|
+
apply(discountCode: string, productId: string): Promise<any>;
|
|
731
|
+
/** Check whether a product has any discounts */
|
|
732
|
+
checkProduct(productId: string): Promise<any>;
|
|
405
733
|
}
|
|
406
734
|
declare class UpsellsResource {
|
|
407
735
|
private client;
|
|
@@ -419,6 +747,14 @@ declare class UpsellsResource {
|
|
|
419
747
|
message: string;
|
|
420
748
|
}>;
|
|
421
749
|
}
|
|
750
|
+
/**
|
|
751
|
+
* Legacy subscriber access via the Orders endpoints, kept for v1 compatibility.
|
|
752
|
+
*
|
|
753
|
+
* Prefer `subscribers` (buyers) and `subscriptionOffers` (the recurring
|
|
754
|
+
* products you sell) — they cover pause/resume and filtering, which these do
|
|
755
|
+
* not. Note `cancel`/`refund` here key off the Stripe subscription id, whereas
|
|
756
|
+
* `subscribers.cancel` accepts the subscriber `_id` or Whop membership id.
|
|
757
|
+
*/
|
|
422
758
|
declare class SubscriptionsResource {
|
|
423
759
|
private client;
|
|
424
760
|
constructor(client: Pocketsflow);
|
|
@@ -435,6 +771,156 @@ declare class SubscriptionsResource {
|
|
|
435
771
|
message: string;
|
|
436
772
|
}>;
|
|
437
773
|
}
|
|
774
|
+
/**
|
|
775
|
+
* Your subscription OFFERS — the recurring products you sell.
|
|
776
|
+
* To work with your buyers instead, use `subscribers`.
|
|
777
|
+
*/
|
|
778
|
+
declare class SubscriptionOffersResource {
|
|
779
|
+
private client;
|
|
780
|
+
constructor(client: Pocketsflow);
|
|
781
|
+
/** List all subscription offers */
|
|
782
|
+
list(): Promise<SubscriptionOffer[]>;
|
|
783
|
+
/** Get a subscription offer by ID */
|
|
784
|
+
get(id: string): Promise<SubscriptionOffer>;
|
|
785
|
+
}
|
|
786
|
+
/**
|
|
787
|
+
* Your subscribers — buyers with a membership in one of your subscription
|
|
788
|
+
* offers. `id` accepts either the subscriber's `_id` or its Whop membership id.
|
|
789
|
+
*/
|
|
790
|
+
declare class SubscribersResource {
|
|
791
|
+
private client;
|
|
792
|
+
constructor(client: Pocketsflow);
|
|
793
|
+
/** List subscribers */
|
|
794
|
+
list(params?: ListSubscribersParams): Promise<SubscribersResponse>;
|
|
795
|
+
/**
|
|
796
|
+
* Get a subscriber with its full payment history.
|
|
797
|
+
* Pass `live` to also fetch the authoritative membership from Whop; the
|
|
798
|
+
* lookup degrades gracefully and never fails the request.
|
|
799
|
+
*/
|
|
800
|
+
get(id: string, options?: {
|
|
801
|
+
live?: boolean;
|
|
802
|
+
}): Promise<SubscriberDetail>;
|
|
803
|
+
/** Cancel a subscriber's subscription */
|
|
804
|
+
cancel(id: string): Promise<{
|
|
805
|
+
success: boolean;
|
|
806
|
+
message?: string;
|
|
807
|
+
}>;
|
|
808
|
+
/** Pause a subscriber's subscription */
|
|
809
|
+
pause(id: string): Promise<{
|
|
810
|
+
success: boolean;
|
|
811
|
+
message?: string;
|
|
812
|
+
}>;
|
|
813
|
+
/** Resume a paused subscription */
|
|
814
|
+
resume(id: string): Promise<{
|
|
815
|
+
success: boolean;
|
|
816
|
+
message?: string;
|
|
817
|
+
}>;
|
|
818
|
+
/**
|
|
819
|
+
* Read the native subscriber portal payload. The `subscriptionId` +
|
|
820
|
+
* `subscriberId` pair is itself the capability — these portal endpoints are
|
|
821
|
+
* unauthenticated, so the API key is not required to call them.
|
|
822
|
+
*/
|
|
823
|
+
portal(subscriptionId: string, subscriberId: string): Promise<SubscriberPortalData>;
|
|
824
|
+
/** Cancel a membership through the native portal */
|
|
825
|
+
portalCancel(subscriberId: string): Promise<{
|
|
826
|
+
success?: boolean;
|
|
827
|
+
message?: string;
|
|
828
|
+
}>;
|
|
829
|
+
/** Resume a pending cancellation through the native portal */
|
|
830
|
+
portalResume(subscriberId: string): Promise<{
|
|
831
|
+
success?: boolean;
|
|
832
|
+
message?: string;
|
|
833
|
+
}>;
|
|
834
|
+
}
|
|
835
|
+
/**
|
|
836
|
+
* The unified payment ledger — one-time purchases AND subscription payments
|
|
837
|
+
* (the initial charge plus every renewal).
|
|
838
|
+
*/
|
|
839
|
+
declare class PaymentsResource {
|
|
840
|
+
private client;
|
|
841
|
+
constructor(client: Pocketsflow);
|
|
842
|
+
/** List payments */
|
|
843
|
+
list(params?: ListPaymentsParams): Promise<PaymentsResponse>;
|
|
844
|
+
/**
|
|
845
|
+
* Get a payment by ID. Pass `live` to also fetch the authoritative payment
|
|
846
|
+
* from Whop; the lookup degrades gracefully and never fails the request.
|
|
847
|
+
*/
|
|
848
|
+
get(id: string, options?: {
|
|
849
|
+
live?: boolean;
|
|
850
|
+
}): Promise<PaymentDetail>;
|
|
851
|
+
}
|
|
852
|
+
/** Your Link in Bio page. */
|
|
853
|
+
declare class CreatorPagesResource {
|
|
854
|
+
private client;
|
|
855
|
+
constructor(client: Pocketsflow);
|
|
856
|
+
/** Get your Link in Bio page */
|
|
857
|
+
get(): Promise<CreatorPage>;
|
|
858
|
+
/** Create your Link in Bio page. Fails if one already exists — use `update`. */
|
|
859
|
+
create(params: CreateCreatorPageParams): Promise<CreatorPage>;
|
|
860
|
+
/** Update your Link in Bio page (partial) */
|
|
861
|
+
update(params: UpdateCreatorPageParams): Promise<CreatorPage>;
|
|
862
|
+
/** Delete your Link in Bio page */
|
|
863
|
+
delete(): Promise<{
|
|
864
|
+
message: string;
|
|
865
|
+
}>;
|
|
866
|
+
/** Check whether a username is available */
|
|
867
|
+
checkUsername(username: string): Promise<any>;
|
|
868
|
+
/** Set your Link in Bio username */
|
|
869
|
+
updateUsername(username: string): Promise<CreatorPage>;
|
|
870
|
+
}
|
|
871
|
+
/** Image uploads. */
|
|
872
|
+
declare class ImagesResource {
|
|
873
|
+
private client;
|
|
874
|
+
constructor(client: Pocketsflow);
|
|
875
|
+
/**
|
|
876
|
+
* Upload an image and get back its hosted URL.
|
|
877
|
+
*
|
|
878
|
+
* `file` accepts anything FormData can hold — a Blob/File, or a Buffer in
|
|
879
|
+
* Node 18+. `filename` is used when the value carries no name of its own.
|
|
880
|
+
*/
|
|
881
|
+
upload(file: Blob | Uint8Array | ArrayBuffer, filename?: string): Promise<UploadImageResponse>;
|
|
882
|
+
}
|
|
883
|
+
/** Newsletter posts and subscribers. */
|
|
884
|
+
declare class NewslettersResource {
|
|
885
|
+
private client;
|
|
886
|
+
posts: NewsletterPostsResource;
|
|
887
|
+
subscribers: NewsletterSubscribersResource;
|
|
888
|
+
constructor(client: Pocketsflow);
|
|
889
|
+
/**
|
|
890
|
+
* Send a one-off email to up to 100 recipients.
|
|
891
|
+
* Requires a verified sender email. Either `html` or `text` must be given.
|
|
892
|
+
*/
|
|
893
|
+
send(params: SendEmailParams): Promise<SendEmailResponse>;
|
|
894
|
+
}
|
|
895
|
+
declare class NewsletterPostsResource {
|
|
896
|
+
private client;
|
|
897
|
+
constructor(client: Pocketsflow);
|
|
898
|
+
/** List all posts, newest first */
|
|
899
|
+
list(): Promise<NewsletterPost[]>;
|
|
900
|
+
/** Get a post by ID */
|
|
901
|
+
get(id: string): Promise<NewsletterPost>;
|
|
902
|
+
/**
|
|
903
|
+
* Create a post. Leaving `draft` requires `subject`, `preview`, `fromName`
|
|
904
|
+
* and `contentHtml` to be set.
|
|
905
|
+
*/
|
|
906
|
+
create(params: CreateNewsletterPostParams): Promise<NewsletterPost>;
|
|
907
|
+
/** Update a post. Posts that have already been sent cannot be edited. */
|
|
908
|
+
update(id: string, params: UpdateNewsletterPostParams): Promise<NewsletterPost>;
|
|
909
|
+
/** Delete a post */
|
|
910
|
+
delete(id: string): Promise<NewsletterPost>;
|
|
911
|
+
/** Queue a post for sending to its subscribers */
|
|
912
|
+
send(id: string): Promise<SendNewsletterPostResponse>;
|
|
913
|
+
}
|
|
914
|
+
declare class NewsletterSubscribersResource {
|
|
915
|
+
private client;
|
|
916
|
+
constructor(client: Pocketsflow);
|
|
917
|
+
/** List all subscribers, newest first */
|
|
918
|
+
list(): Promise<NewsletterSubscriber[]>;
|
|
919
|
+
/** Get a subscriber by ID */
|
|
920
|
+
get(id: string): Promise<NewsletterSubscriber>;
|
|
921
|
+
/** Remove a subscriber */
|
|
922
|
+
delete(id: string): Promise<NewsletterSubscriber>;
|
|
923
|
+
}
|
|
438
924
|
declare class WebhooksResource {
|
|
439
925
|
private client;
|
|
440
926
|
constructor(client: Pocketsflow);
|
|
@@ -480,4 +966,4 @@ declare class RefundsResource {
|
|
|
480
966
|
create(params: CreateRefundParams): Promise<Refund>;
|
|
481
967
|
}
|
|
482
968
|
|
|
483
|
-
export { type ApiError, type CheckoutSession, type CreateCheckoutParams, type CreateDiscountParams, type CreateProductParams, type CreateRefundParams, type CreateUpsellParams, type CreateVariantParams, type CreateWebhookParams, type Customer, type DateRangeParams, type Discount, type ListCustomersParams, type ListOrdersParams, type ListReviewsParams, type ListSubscriptionsParams, type Order, type OrdersResponse, type PaginatedResponse, type PaginationParams, Pocketsflow, type PocketsflowConfig, PocketsflowError, type Product, type ProductFile, type ProductVariant, type Refund, type Review, type Subscription, type UpdateDiscountParams, type UpdateProductParams, type UpdateUpsellParams, type UpdateUserParams, type UpdateWebhookParams, type Upsell, type UpsellsResponse, type User, type Webhook };
|
|
969
|
+
export { type ApiError, type CheckoutSession, type CreateCheckoutParams, type CreateCreatorPageParams, type CreateDiscountParams, type CreateNewsletterPostParams, type CreateProductParams, type CreateRefundParams, type CreateUpsellParams, type CreateVariantParams, type CreateWebhookParams, type CreatorPage, type CreatorPageLink, type Customer, type DateRangeParams, type Discount, type ListCustomersParams, type ListOrdersParams, type ListPaymentsParams, type ListReviewsParams, type ListSubscribersParams, type ListSubscriptionsParams, type NewsletterPost, type NewsletterPostStatus, type NewsletterSubscriber, type Order, type OrdersResponse, type PaginatedResponse, type PaginationParams, type Payment, type PaymentDetail, type PaymentsResponse, Pocketsflow, type PocketsflowConfig, PocketsflowError, type Product, type ProductFile, type ProductVariant, type Refund, type Review, type SendEmailParams, type SendEmailResponse, type SendNewsletterPostResponse, type Subscriber, type SubscriberDetail, type SubscriberPortalData, type SubscriberStatus, type SubscribersResponse, type Subscription, type SubscriptionOffer, type UpdateCreatorPageParams, type UpdateDiscountParams, type UpdateNewsletterPostParams, type UpdateProductParams, type UpdateUpsellParams, type UpdateUserParams, type UpdateWebhookParams, type UploadImageResponse, type Upsell, type UpsellsResponse, type User, type Webhook, type WebhookEvent };
|