pocketsflow 1.0.1 → 1.2.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 +17 -0
- package/dist/index.d.mts +86 -1
- package/dist/index.d.ts +86 -1
- package/dist/index.js +18 -0
- package/dist/index.mjs +18 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -202,6 +202,23 @@ await pocketsflow.upsells.delete('upsell_id');
|
|
|
202
202
|
|
|
203
203
|
### Subscriptions
|
|
204
204
|
|
|
205
|
+
The `subscriptions` namespace manages buyer subscriptions. Subscription offers
|
|
206
|
+
(the recurring products you sell) use `subscriptionOffers`:
|
|
207
|
+
|
|
208
|
+
```typescript
|
|
209
|
+
// Create a subscription offer
|
|
210
|
+
const newOffer = await pocketsflow.subscriptionOffers.create({
|
|
211
|
+
name: 'Pro Membership',
|
|
212
|
+
price: 29,
|
|
213
|
+
frequency: 'monthly',
|
|
214
|
+
trialPeriod: 7,
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
// List and get subscription offers
|
|
218
|
+
const offers = await pocketsflow.subscriptionOffers.list();
|
|
219
|
+
const offer = await pocketsflow.subscriptionOffers.get(newOffer._id);
|
|
220
|
+
```
|
|
221
|
+
|
|
205
222
|
```typescript
|
|
206
223
|
// List subscription customers
|
|
207
224
|
const subscriptions = await pocketsflow.subscriptions.list({
|
package/dist/index.d.mts
CHANGED
|
@@ -281,6 +281,78 @@ interface Subscription {
|
|
|
281
281
|
interface ListSubscriptionsParams extends PaginationParams, DateRangeParams {
|
|
282
282
|
status?: 'active' | 'canceled' | 'paused';
|
|
283
283
|
}
|
|
284
|
+
/** A subscription offer — a recurring product you sell. */
|
|
285
|
+
interface SubscriptionOffer {
|
|
286
|
+
_id: string;
|
|
287
|
+
userId: string;
|
|
288
|
+
name: string;
|
|
289
|
+
subtitle?: string;
|
|
290
|
+
description?: string;
|
|
291
|
+
price: number;
|
|
292
|
+
currency?: string;
|
|
293
|
+
frequency: 'weekly' | 'monthly' | 'yearly';
|
|
294
|
+
trialPeriod?: number;
|
|
295
|
+
published?: boolean;
|
|
296
|
+
redirectBackUrl?: string;
|
|
297
|
+
slug?: string;
|
|
298
|
+
thumbnail?: string;
|
|
299
|
+
images?: string[];
|
|
300
|
+
testMode: boolean;
|
|
301
|
+
createdAt: string;
|
|
302
|
+
updatedAt?: string;
|
|
303
|
+
}
|
|
304
|
+
interface CreateSubscriptionOfferParams {
|
|
305
|
+
/** Subscription offer name (required) */
|
|
306
|
+
name: string;
|
|
307
|
+
/** Recurring price in USD (required) */
|
|
308
|
+
price: number;
|
|
309
|
+
/** Billing frequency (required) */
|
|
310
|
+
frequency: 'weekly' | 'monthly' | 'yearly';
|
|
311
|
+
/** Short offer subtitle */
|
|
312
|
+
subtitle?: string;
|
|
313
|
+
/** Offer description */
|
|
314
|
+
description?: string;
|
|
315
|
+
/** Trial duration in days */
|
|
316
|
+
trialPeriod?: number;
|
|
317
|
+
/** Whether the offer is published */
|
|
318
|
+
published?: boolean;
|
|
319
|
+
/** Return URL used by the customer billing portal */
|
|
320
|
+
redirectBackUrl?: string;
|
|
321
|
+
/** Offer URL slug */
|
|
322
|
+
slug?: string;
|
|
323
|
+
/** Thumbnail URL */
|
|
324
|
+
thumbnail?: string;
|
|
325
|
+
/** Offer image URLs */
|
|
326
|
+
images?: string[];
|
|
327
|
+
/** Whether the offer is backed by a downloadable file */
|
|
328
|
+
isFile?: boolean;
|
|
329
|
+
/** File URL or uploaded file reference */
|
|
330
|
+
file?: string | Record<string, unknown>;
|
|
331
|
+
/** External offer URL */
|
|
332
|
+
url?: string;
|
|
333
|
+
/** Checkout copy and seller-facing configuration */
|
|
334
|
+
checkoutText?: string;
|
|
335
|
+
refundPolicy?: string;
|
|
336
|
+
callbackUrl?: string;
|
|
337
|
+
hasCallbackUrl?: boolean;
|
|
338
|
+
hasFirstName?: boolean;
|
|
339
|
+
hasLastName?: boolean;
|
|
340
|
+
portalText?: string;
|
|
341
|
+
privacyPolicy?: string;
|
|
342
|
+
termsOfService?: string;
|
|
343
|
+
ctaText?: string;
|
|
344
|
+
thankYouText?: string;
|
|
345
|
+
hasProductPage?: boolean;
|
|
346
|
+
showSales?: boolean;
|
|
347
|
+
showReviews?: boolean;
|
|
348
|
+
maxPrice?: number;
|
|
349
|
+
minPrice?: number;
|
|
350
|
+
design?: Record<string, unknown>;
|
|
351
|
+
colors?: Record<string, unknown>;
|
|
352
|
+
pageStyle?: Record<string, unknown>;
|
|
353
|
+
checkoutStyle?: Record<string, unknown>;
|
|
354
|
+
checkoutColors?: Record<string, unknown>;
|
|
355
|
+
}
|
|
284
356
|
interface Webhook {
|
|
285
357
|
_id: string;
|
|
286
358
|
userId: string;
|
|
@@ -380,6 +452,8 @@ declare class Pocketsflow {
|
|
|
380
452
|
discounts: DiscountsResource;
|
|
381
453
|
upsells: UpsellsResource;
|
|
382
454
|
subscriptions: SubscriptionsResource;
|
|
455
|
+
/** Subscription offers (recurring products), distinct from buyer memberships. */
|
|
456
|
+
subscriptionOffers: SubscriptionOffersResource;
|
|
383
457
|
webhooks: WebhooksResource;
|
|
384
458
|
users: UsersResource;
|
|
385
459
|
checkout: CheckoutResource;
|
|
@@ -486,6 +560,17 @@ declare class SubscriptionsResource {
|
|
|
486
560
|
message: string;
|
|
487
561
|
}>;
|
|
488
562
|
}
|
|
563
|
+
/** Your subscription offers — the recurring products you sell. */
|
|
564
|
+
declare class SubscriptionOffersResource {
|
|
565
|
+
private client;
|
|
566
|
+
constructor(client: Pocketsflow);
|
|
567
|
+
/** List all subscription offers */
|
|
568
|
+
list(): Promise<SubscriptionOffer[]>;
|
|
569
|
+
/** Get a subscription offer by ID */
|
|
570
|
+
get(id: string): Promise<SubscriptionOffer>;
|
|
571
|
+
/** Create a subscription offer */
|
|
572
|
+
create(params: CreateSubscriptionOfferParams): Promise<SubscriptionOffer>;
|
|
573
|
+
}
|
|
489
574
|
declare class WebhooksResource {
|
|
490
575
|
private client;
|
|
491
576
|
constructor(client: Pocketsflow);
|
|
@@ -531,4 +616,4 @@ declare class RefundsResource {
|
|
|
531
616
|
create(params: CreateRefundParams): Promise<Refund>;
|
|
532
617
|
}
|
|
533
618
|
|
|
534
|
-
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, type WebhookEvent };
|
|
619
|
+
export { type ApiError, type CheckoutSession, type CreateCheckoutParams, type CreateDiscountParams, type CreateProductParams, type CreateRefundParams, type CreateSubscriptionOfferParams, 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 SubscriptionOffer, type UpdateDiscountParams, type UpdateProductParams, type UpdateUpsellParams, type UpdateUserParams, type UpdateWebhookParams, type Upsell, type UpsellsResponse, type User, type Webhook, type WebhookEvent };
|
package/dist/index.d.ts
CHANGED
|
@@ -281,6 +281,78 @@ interface Subscription {
|
|
|
281
281
|
interface ListSubscriptionsParams extends PaginationParams, DateRangeParams {
|
|
282
282
|
status?: 'active' | 'canceled' | 'paused';
|
|
283
283
|
}
|
|
284
|
+
/** A subscription offer — a recurring product you sell. */
|
|
285
|
+
interface SubscriptionOffer {
|
|
286
|
+
_id: string;
|
|
287
|
+
userId: string;
|
|
288
|
+
name: string;
|
|
289
|
+
subtitle?: string;
|
|
290
|
+
description?: string;
|
|
291
|
+
price: number;
|
|
292
|
+
currency?: string;
|
|
293
|
+
frequency: 'weekly' | 'monthly' | 'yearly';
|
|
294
|
+
trialPeriod?: number;
|
|
295
|
+
published?: boolean;
|
|
296
|
+
redirectBackUrl?: string;
|
|
297
|
+
slug?: string;
|
|
298
|
+
thumbnail?: string;
|
|
299
|
+
images?: string[];
|
|
300
|
+
testMode: boolean;
|
|
301
|
+
createdAt: string;
|
|
302
|
+
updatedAt?: string;
|
|
303
|
+
}
|
|
304
|
+
interface CreateSubscriptionOfferParams {
|
|
305
|
+
/** Subscription offer name (required) */
|
|
306
|
+
name: string;
|
|
307
|
+
/** Recurring price in USD (required) */
|
|
308
|
+
price: number;
|
|
309
|
+
/** Billing frequency (required) */
|
|
310
|
+
frequency: 'weekly' | 'monthly' | 'yearly';
|
|
311
|
+
/** Short offer subtitle */
|
|
312
|
+
subtitle?: string;
|
|
313
|
+
/** Offer description */
|
|
314
|
+
description?: string;
|
|
315
|
+
/** Trial duration in days */
|
|
316
|
+
trialPeriod?: number;
|
|
317
|
+
/** Whether the offer is published */
|
|
318
|
+
published?: boolean;
|
|
319
|
+
/** Return URL used by the customer billing portal */
|
|
320
|
+
redirectBackUrl?: string;
|
|
321
|
+
/** Offer URL slug */
|
|
322
|
+
slug?: string;
|
|
323
|
+
/** Thumbnail URL */
|
|
324
|
+
thumbnail?: string;
|
|
325
|
+
/** Offer image URLs */
|
|
326
|
+
images?: string[];
|
|
327
|
+
/** Whether the offer is backed by a downloadable file */
|
|
328
|
+
isFile?: boolean;
|
|
329
|
+
/** File URL or uploaded file reference */
|
|
330
|
+
file?: string | Record<string, unknown>;
|
|
331
|
+
/** External offer URL */
|
|
332
|
+
url?: string;
|
|
333
|
+
/** Checkout copy and seller-facing configuration */
|
|
334
|
+
checkoutText?: string;
|
|
335
|
+
refundPolicy?: string;
|
|
336
|
+
callbackUrl?: string;
|
|
337
|
+
hasCallbackUrl?: boolean;
|
|
338
|
+
hasFirstName?: boolean;
|
|
339
|
+
hasLastName?: boolean;
|
|
340
|
+
portalText?: string;
|
|
341
|
+
privacyPolicy?: string;
|
|
342
|
+
termsOfService?: string;
|
|
343
|
+
ctaText?: string;
|
|
344
|
+
thankYouText?: string;
|
|
345
|
+
hasProductPage?: boolean;
|
|
346
|
+
showSales?: boolean;
|
|
347
|
+
showReviews?: boolean;
|
|
348
|
+
maxPrice?: number;
|
|
349
|
+
minPrice?: number;
|
|
350
|
+
design?: Record<string, unknown>;
|
|
351
|
+
colors?: Record<string, unknown>;
|
|
352
|
+
pageStyle?: Record<string, unknown>;
|
|
353
|
+
checkoutStyle?: Record<string, unknown>;
|
|
354
|
+
checkoutColors?: Record<string, unknown>;
|
|
355
|
+
}
|
|
284
356
|
interface Webhook {
|
|
285
357
|
_id: string;
|
|
286
358
|
userId: string;
|
|
@@ -380,6 +452,8 @@ declare class Pocketsflow {
|
|
|
380
452
|
discounts: DiscountsResource;
|
|
381
453
|
upsells: UpsellsResource;
|
|
382
454
|
subscriptions: SubscriptionsResource;
|
|
455
|
+
/** Subscription offers (recurring products), distinct from buyer memberships. */
|
|
456
|
+
subscriptionOffers: SubscriptionOffersResource;
|
|
383
457
|
webhooks: WebhooksResource;
|
|
384
458
|
users: UsersResource;
|
|
385
459
|
checkout: CheckoutResource;
|
|
@@ -486,6 +560,17 @@ declare class SubscriptionsResource {
|
|
|
486
560
|
message: string;
|
|
487
561
|
}>;
|
|
488
562
|
}
|
|
563
|
+
/** Your subscription offers — the recurring products you sell. */
|
|
564
|
+
declare class SubscriptionOffersResource {
|
|
565
|
+
private client;
|
|
566
|
+
constructor(client: Pocketsflow);
|
|
567
|
+
/** List all subscription offers */
|
|
568
|
+
list(): Promise<SubscriptionOffer[]>;
|
|
569
|
+
/** Get a subscription offer by ID */
|
|
570
|
+
get(id: string): Promise<SubscriptionOffer>;
|
|
571
|
+
/** Create a subscription offer */
|
|
572
|
+
create(params: CreateSubscriptionOfferParams): Promise<SubscriptionOffer>;
|
|
573
|
+
}
|
|
489
574
|
declare class WebhooksResource {
|
|
490
575
|
private client;
|
|
491
576
|
constructor(client: Pocketsflow);
|
|
@@ -531,4 +616,4 @@ declare class RefundsResource {
|
|
|
531
616
|
create(params: CreateRefundParams): Promise<Refund>;
|
|
532
617
|
}
|
|
533
618
|
|
|
534
|
-
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, type WebhookEvent };
|
|
619
|
+
export { type ApiError, type CheckoutSession, type CreateCheckoutParams, type CreateDiscountParams, type CreateProductParams, type CreateRefundParams, type CreateSubscriptionOfferParams, 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 SubscriptionOffer, type UpdateDiscountParams, type UpdateProductParams, type UpdateUpsellParams, type UpdateUserParams, type UpdateWebhookParams, type Upsell, type UpsellsResponse, type User, type Webhook, type WebhookEvent };
|
package/dist/index.js
CHANGED
|
@@ -54,6 +54,7 @@ var Pocketsflow = class {
|
|
|
54
54
|
this.discounts = new DiscountsResource(this);
|
|
55
55
|
this.upsells = new UpsellsResource(this);
|
|
56
56
|
this.subscriptions = new SubscriptionsResource(this);
|
|
57
|
+
this.subscriptionOffers = new SubscriptionOffersResource(this);
|
|
57
58
|
this.webhooks = new WebhooksResource(this);
|
|
58
59
|
this.users = new UsersResource(this);
|
|
59
60
|
this.checkout = new CheckoutResource(this);
|
|
@@ -262,6 +263,23 @@ var SubscriptionsResource = class {
|
|
|
262
263
|
);
|
|
263
264
|
}
|
|
264
265
|
};
|
|
266
|
+
var SubscriptionOffersResource = class {
|
|
267
|
+
constructor(client) {
|
|
268
|
+
this.client = client;
|
|
269
|
+
}
|
|
270
|
+
/** List all subscription offers */
|
|
271
|
+
async list() {
|
|
272
|
+
return this.client.request("GET", "/subscriptions");
|
|
273
|
+
}
|
|
274
|
+
/** Get a subscription offer by ID */
|
|
275
|
+
async get(id) {
|
|
276
|
+
return this.client.request("GET", `/subscriptions/${id}`);
|
|
277
|
+
}
|
|
278
|
+
/** Create a subscription offer */
|
|
279
|
+
async create(params) {
|
|
280
|
+
return this.client.request("POST", "/subscriptions", { body: params });
|
|
281
|
+
}
|
|
282
|
+
};
|
|
265
283
|
var WebhooksResource = class {
|
|
266
284
|
constructor(client) {
|
|
267
285
|
this.client = client;
|
package/dist/index.mjs
CHANGED
|
@@ -27,6 +27,7 @@ var Pocketsflow = class {
|
|
|
27
27
|
this.discounts = new DiscountsResource(this);
|
|
28
28
|
this.upsells = new UpsellsResource(this);
|
|
29
29
|
this.subscriptions = new SubscriptionsResource(this);
|
|
30
|
+
this.subscriptionOffers = new SubscriptionOffersResource(this);
|
|
30
31
|
this.webhooks = new WebhooksResource(this);
|
|
31
32
|
this.users = new UsersResource(this);
|
|
32
33
|
this.checkout = new CheckoutResource(this);
|
|
@@ -235,6 +236,23 @@ var SubscriptionsResource = class {
|
|
|
235
236
|
);
|
|
236
237
|
}
|
|
237
238
|
};
|
|
239
|
+
var SubscriptionOffersResource = class {
|
|
240
|
+
constructor(client) {
|
|
241
|
+
this.client = client;
|
|
242
|
+
}
|
|
243
|
+
/** List all subscription offers */
|
|
244
|
+
async list() {
|
|
245
|
+
return this.client.request("GET", "/subscriptions");
|
|
246
|
+
}
|
|
247
|
+
/** Get a subscription offer by ID */
|
|
248
|
+
async get(id) {
|
|
249
|
+
return this.client.request("GET", `/subscriptions/${id}`);
|
|
250
|
+
}
|
|
251
|
+
/** Create a subscription offer */
|
|
252
|
+
async create(params) {
|
|
253
|
+
return this.client.request("POST", "/subscriptions", { body: params });
|
|
254
|
+
}
|
|
255
|
+
};
|
|
238
256
|
var WebhooksResource = class {
|
|
239
257
|
constructor(client) {
|
|
240
258
|
this.client = client;
|